Skip to content

Commit

Permalink
Restyled by clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
restyled-commits authored and erwinpan1 committed Feb 12, 2024
1 parent df49055 commit b8042eb
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ bool AudioOutputManager::HandleRenameOutput(const uint8_t & index, const chip::C
if (output.index == index)
{
audioOutputRenamed = true;
const size_t len = std::min(mBufMax, name.size());
const size_t len = std::min(mBufMax, name.size());
memcpy(this->Data(index), name.data(), len);
output.name = chip::CharSpan(this->Data(index), len);
return audioOutputRenamed;
return audioOutputRenamed;
}
}

Expand All @@ -84,7 +84,7 @@ bool AudioOutputManager::HandleSelectOutput(const uint8_t & index)
{
audioOutputSelected = true;
mCurrentOutput = index;
return audioOutputSelected;
return audioOutputSelected;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@

class AudioOutputManager : public chip::app::Clusters::AudioOutput::Delegate
{
using OutputInfoType = chip::app::Clusters::AudioOutput::Structs::OutputInfoStruct::Type;
using OutputInfoType = chip::app::Clusters::AudioOutput::Structs::OutputInfoStruct::Type;

public:
AudioOutputManager();

Expand Down
26 changes: 13 additions & 13 deletions examples/chef/common/clusters/channel/ChannelManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
#include <app-common/zap-generated/attributes/Accessors.h>
#include <app/util/config.h>

#include <vector>
#include <iostream>
#include <sstream>
#include <vector>

using namespace chip;
using namespace chip::app;
Expand Down Expand Up @@ -141,12 +141,10 @@ bool ChannelManager::isChannelMatched(const ChannelInfoType & channel, const chi
ss << channel.majorNumber << "." << channel.minorNumber;
std::string number = ss.str();

auto isMatch = [&match](const Optional<chip::CharSpan> &a)
{
return a.HasValue() && a.Value().data_equal(match);
};
auto isMatch = [&match](const Optional<chip::CharSpan> & a) { return a.HasValue() && a.Value().data_equal(match); };

return isMatch(channel.name) || isMatch(channel.affiliateCallSign) || isMatch(channel.callSign) || match.data_equal(chip::CharSpan::fromCharString(number.c_str()));
return isMatch(channel.name) || isMatch(channel.affiliateCallSign) || isMatch(channel.callSign) ||
match.data_equal(chip::CharSpan::fromCharString(number.c_str()));
}

void ChannelManager::HandleChangeChannel(CommandResponseHelper<ChangeChannelResponseType> & helper, const CharSpan & match)
Expand All @@ -160,14 +158,15 @@ void ChannelManager::HandleChangeChannel(CommandResponseHelper<ChangeChannelResp
// or callSign or affiliateCallSign or majorNumber.minorNumber
if (isChannelMatched(mChannels[i], match))
{
if (iMatchedChannel != -1) {
if (iMatchedChannel != -1)
{
// Error: Found multiple matches
response.status = chip::app::Clusters::Channel::StatusEnum::kMultipleMatches;
helper.Success(response);
return;
}
iMatchedChannel = i;
}
return;
}
iMatchedChannel = i;
}
}

if (iMatchedChannel == -1)
Expand Down Expand Up @@ -201,7 +200,7 @@ bool ChannelManager::HandleChangeChannelByNumber(const uint16_t & majorNumber, c
channelChanged = true;
mCurrentChannelIndex = index;
mCurrentChannel = channel;
return channelChanged;
return channelChanged;
}
}
index++;
Expand Down Expand Up @@ -300,7 +299,8 @@ bool ChannelManager::HandleRecordProgram(const chip::CharSpan & programIdentifie
std::string nextIdString(program.identifier.data(), program.identifier.size());
if (nextIdString == idString)
{
program.recordingFlag = MakeOptional(static_cast<uint32_t>(shouldRecordSeries ? RecordingFlagBitmap::kRecordSeries : RecordingFlagBitmap::kScheduled));
program.recordingFlag = MakeOptional(
static_cast<uint32_t>(shouldRecordSeries ? RecordingFlagBitmap::kRecordSeries : RecordingFlagBitmap::kScheduled));
}
}

Expand Down
27 changes: 14 additions & 13 deletions examples/chef/common/clusters/channel/ChannelManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,31 @@
#include <app/clusters/channel-server/channel-server.h>
#include <vector>


class ChannelManager : public chip::app::Clusters::Channel::Delegate
{
using RecordingFlagBitmap = chip::app::Clusters::Channel::RecordingFlagBitmap;
using ChangeChannelResponseType = chip::app::Clusters::Channel::Commands::ChangeChannelResponse::Type;
using ProgramGuideResponseType = chip::app::Clusters::Channel::Commands::ProgramGuideResponse::Type;
using ChannelInfoType = chip::app::Clusters::Channel::Structs::ChannelInfoStruct::Type;
using AdditionalInfoType = chip::app::Clusters::Channel::Structs::AdditionalInfoStruct::Type;
using LineupInfoType = chip::app::Clusters::Channel::Structs::LineupInfoStruct::Type;
using PageTokenType = chip::app::Clusters::Channel::Structs::PageTokenStruct::Type;
using ProgramType = chip::app::Clusters::Channel::Structs::ProgramStruct::Type;
using ChannelPagingType = chip::app::Clusters::Channel::Structs::ChannelPagingStruct::Type;
using RecordingFlagBitmap = chip::app::Clusters::Channel::RecordingFlagBitmap;
using ChangeChannelResponseType = chip::app::Clusters::Channel::Commands::ChangeChannelResponse::Type;
using ProgramGuideResponseType = chip::app::Clusters::Channel::Commands::ProgramGuideResponse::Type;
using ChannelInfoType = chip::app::Clusters::Channel::Structs::ChannelInfoStruct::Type;
using AdditionalInfoType = chip::app::Clusters::Channel::Structs::AdditionalInfoStruct::Type;
using LineupInfoType = chip::app::Clusters::Channel::Structs::LineupInfoStruct::Type;
using PageTokenType = chip::app::Clusters::Channel::Structs::PageTokenStruct::Type;
using ProgramType = chip::app::Clusters::Channel::Structs::ProgramStruct::Type;
using ChannelPagingType = chip::app::Clusters::Channel::Structs::ChannelPagingStruct::Type;

public:
ChannelManager();

CHIP_ERROR HandleGetChannelList(chip::app::AttributeValueEncoder & aEncoder) override;
CHIP_ERROR HandleGetLineup(chip::app::AttributeValueEncoder & aEncoder) override;
CHIP_ERROR HandleGetCurrentChannel(chip::app::AttributeValueEncoder & aEncoder) override;

void HandleChangeChannel(chip::app::CommandResponseHelper<ChangeChannelResponseType> & helper, const chip::CharSpan & match) override;
void HandleChangeChannel(chip::app::CommandResponseHelper<ChangeChannelResponseType> & helper,
const chip::CharSpan & match) override;
bool HandleChangeChannelByNumber(const uint16_t & majorNumber, const uint16_t & minorNumber) override;
bool HandleSkipChannel(const int16_t & count) override;
void HandleGetProgramGuide(chip::app::CommandResponseHelper<ProgramGuideResponseType> & helper, const chip::Optional<uint32_t> & startTime,
const chip::Optional<uint32_t> & endTime,
void HandleGetProgramGuide(chip::app::CommandResponseHelper<ProgramGuideResponseType> & helper,
const chip::Optional<uint32_t> & startTime, const chip::Optional<uint32_t> & endTime,
const chip::Optional<chip::app::DataModel::DecodableList<ChannelInfoType>> & channelList,
const chip::Optional<PageTokenType> & pageToken,
const chip::Optional<chip::BitMask<RecordingFlagBitmap>> & recordingFlag,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@

#include <app/clusters/keypad-input-server/keypad-input-server.h>


class KeypadInputManager : public chip::app::Clusters::KeypadInput::Delegate
{
using SendKeyResponseType = chip::app::Clusters::KeypadInput::Commands::SendKeyResponse::Type;
using CecKeyCodeType = chip::app::Clusters::KeypadInput::CECKeyCodeEnum;
using SendKeyResponseType = chip::app::Clusters::KeypadInput::Commands::SendKeyResponse::Type;
using CecKeyCodeType = chip::app::Clusters::KeypadInput::CECKeyCodeEnum;

public:
void HandleSendKey(chip::app::CommandResponseHelper<SendKeyResponseType> & helper, const CecKeyCodeType & keyCode) override;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ bool MediaInputManager::HandleRenameInput(const uint8_t index, const chip::CharS
if (input.index == index)
{
mediaInputRenamed = true;
const size_t len = std::min(mBufMax, name.size());
const size_t len = std::min(mBufMax, name.size());
memcpy(this->Data(index), name.data(), len);
input.name = chip::CharSpan(this->Data(index), name.size());
return mediaInputRenamed;
Expand Down
5 changes: 3 additions & 2 deletions examples/chef/common/clusters/media-input/MediaInputManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@

class MediaInputManager : public chip::app::Clusters::MediaInput::Delegate
{
using InputInfoType = chip::app::Clusters::MediaInput::Structs::InputInfoStruct::Type;
using InputInfoType = chip::app::Clusters::MediaInput::Structs::InputInfoStruct::Type;

public:
MediaInputManager();

Expand All @@ -44,5 +45,5 @@ using InputInfoType = chip::app::Clusters::MediaInput::Structs::InputInfoStruct:
char mCharDataBuffer[10][mBufMax];

private:
static constexpr int mTotalInput = 3;
static constexpr int mTotalInput = 3;
};
4 changes: 1 addition & 3 deletions examples/chef/common/stubs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,7 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath &
* emberAfPluginOnOffClusterServerPostInitCallback.
*
*/
void emberAfOnOffClusterInitCallback(EndpointId endpoint)
{
}
void emberAfOnOffClusterInitCallback(EndpointId endpoint) {}

#ifdef EMBER_AF_PLUGIN_AUDIO_OUTPUT_SERVER
#include "audio-output/AudioOutputManager.h"
Expand Down

0 comments on commit b8042eb

Please sign in to comment.