Skip to content

Commit

Permalink
fix the CI error
Browse files Browse the repository at this point in the history
  • Loading branch information
mideayanghui committed Nov 22, 2023
1 parent c78d5c1 commit c025ee6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const uint8_t ModeNormal = 0;
const uint8_t ModeDefrost = 1;

/// This is an application level delegate to handle MicrowaveOvenMode commands according to the specific business logic.
class MicrowaveOvenModeDelegate : public ModeBase::Delegate
class ExampleMicrowaveOvenModeDelegate : public ModeBase::Delegate
{
private:
using ModeTagStructType = detail::Structs::ModeTagStruct::Type;
Expand All @@ -58,7 +58,7 @@ class MicrowaveOvenModeDelegate : public ModeBase::Delegate
CHIP_ERROR GetModeTagsByIndex(uint8_t modeIndex, DataModel::List<ModeTagStructType> & tags) override;

public:
~MicrowaveOvenModeDelegate() override = default;
~ExampleMicrowaveOvenModeDelegate() override = default;
};

ModeBase::Instance * Instance();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,21 @@ template <typename T>
using List = chip::app::DataModel::List<T>;
using ModeTagStructType = chip::app::Clusters::detail::Structs::ModeTagStruct::Type;

static MicrowaveOvenModeDelegate * gMicrowaveOvenModeDelegate = nullptr;
static ExampleMicrowaveOvenModeDelegate * gMicrowaveOvenModeDelegate = nullptr;
static ModeBase::Instance * gMicrowaveOvenModeInstance = nullptr;

CHIP_ERROR MicrowaveOvenModeDelegate::Init()
CHIP_ERROR ExampleMicrowaveOvenModeDelegate::Init()
{
return CHIP_NO_ERROR;
}

// todo refactor code by making a parent class for all ModeInstance classes to reduce flash usage.
void MicrowaveOvenModeDelegate::HandleChangeToMode(uint8_t NewMode, ModeBase::Commands::ChangeToModeResponse::Type & response)
void ExampleMicrowaveOvenModeDelegate::HandleChangeToMode(uint8_t NewMode, ModeBase::Commands::ChangeToModeResponse::Type & response)
{
response.status = to_underlying(ModeBase::StatusCode::kSuccess);
}

CHIP_ERROR MicrowaveOvenModeDelegate::GetModeLabelByIndex(uint8_t modeIndex, chip::MutableCharSpan & label)
CHIP_ERROR ExampleMicrowaveOvenModeDelegate::GetModeLabelByIndex(uint8_t modeIndex, chip::MutableCharSpan & label)
{
if (modeIndex >= ArraySize(kModeOptions))
{
Expand All @@ -48,7 +48,7 @@ CHIP_ERROR MicrowaveOvenModeDelegate::GetModeLabelByIndex(uint8_t modeIndex, chi
return chip::CopyCharSpanToMutableCharSpan(kModeOptions[modeIndex].label, label);
}

CHIP_ERROR MicrowaveOvenModeDelegate::GetModeValueByIndex(uint8_t modeIndex, uint8_t & value)
CHIP_ERROR ExampleMicrowaveOvenModeDelegate::GetModeValueByIndex(uint8_t modeIndex, uint8_t & value)
{
if (modeIndex >= ArraySize(kModeOptions))
{
Expand All @@ -58,7 +58,7 @@ CHIP_ERROR MicrowaveOvenModeDelegate::GetModeValueByIndex(uint8_t modeIndex, uin
return CHIP_NO_ERROR;
}

CHIP_ERROR MicrowaveOvenModeDelegate::GetModeTagsByIndex(uint8_t modeIndex, List<ModeTagStructType> & tags)
CHIP_ERROR ExampleMicrowaveOvenModeDelegate::GetModeTagsByIndex(uint8_t modeIndex, List<ModeTagStructType> & tags)
{
if (modeIndex >= ArraySize(kModeOptions))
{
Expand Down Expand Up @@ -98,7 +98,7 @@ void MicrowaveOvenMode::Shutdown()
void emberAfMicrowaveOvenModeClusterInitCallback(chip::EndpointId endpointId)
{
VerifyOrDie(gMicrowaveOvenModeDelegate == nullptr && gMicrowaveOvenModeInstance == nullptr);
gMicrowaveOvenModeDelegate = new MicrowaveOvenMode::MicrowaveOvenModeDelegate;
gMicrowaveOvenModeDelegate = new MicrowaveOvenMode::ExampleMicrowaveOvenModeDelegate;
gMicrowaveOvenModeInstance =
new ModeBase::Instance(gMicrowaveOvenModeDelegate, 0x1, MicrowaveOvenMode::Id, chip::to_underlying(Feature::kOnOff));
gMicrowaveOvenModeInstance->Init();
Expand Down
2 changes: 2 additions & 0 deletions examples/all-clusters-app/linux/main-common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "include/tv-callbacks.h"
#include "laundry-washer-controls-delegate-impl.h"
#include "laundry-washer-mode.h"
#include "microwave-oven-mode.h"
#include "operational-state-delegate-impl.h"
#include "resource-monitoring-delegates.h"
#include "rvc-modes.h"
Expand Down Expand Up @@ -226,6 +227,7 @@ void ApplicationShutdown()
Clusters::LaundryWasherMode::Shutdown();
Clusters::RvcCleanMode::Shutdown();
Clusters::RvcRunMode::Shutdown();
Clusters::MicrowaveOvenMode::Shutdown();
Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Shutdown();
Clusters::HepaFilterMonitoring::Shutdown();
Clusters::ActivatedCarbonFilterMonitoring::Shutdown();
Expand Down

0 comments on commit c025ee6

Please sign in to comment.