Skip to content

Commit

Permalink
Remove using, todo, magic number
Browse files Browse the repository at this point in the history
  • Loading branch information
erwinpan1 committed Feb 12, 2024
1 parent 13aa22e commit 5edba02
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ MediaInputManager::MediaInputManager()
{
mCurrentInput = 1;

for (int i = 1; i < 3; ++i)
for (int i = 1; i < mTotalInput; ++i)
{
InputInfoType inputInfo;
inputInfo.description = chip::CharSpan::fromCharString("High-Definition Multimedia Interface");
Expand All @@ -40,7 +40,6 @@ MediaInputManager::MediaInputManager()

CHIP_ERROR MediaInputManager::HandleGetInputList(chip::app::AttributeValueEncoder & aEncoder)
{
// TODO: Insert code here
return aEncoder.EncodeList([this](const auto & encoder) -> CHIP_ERROR {
for (auto const & inputInfo : this->mInputs)
{
Expand Down
6 changes: 4 additions & 2 deletions examples/chef/common/clusters/media-input/MediaInputManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@
#include <app/clusters/media-input-server/media-input-server.h>
#include <vector>

using InputInfoType = chip::app::Clusters::MediaInput::Structs::InputInfoStruct::Type;

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

Expand All @@ -42,4 +41,7 @@ class MediaInputManager : public chip::app::Clusters::MediaInput::Delegate
std::vector<chip::app::Clusters::MediaInput::Structs::InputInfoStruct::Type> mInputs;
// Magic numbers are here on purpose, please allocate memory
char mCharDataBuffer[10][32];

private:
static constexpr int mTotalInput = 3;
};

0 comments on commit 5edba02

Please sign in to comment.