Skip to content

Commit

Permalink
cleanup for ovenMode
Browse files Browse the repository at this point in the history
  • Loading branch information
eahove committed Dec 13, 2023
1 parent ba1a248 commit e52a535
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8625,7 +8625,7 @@
"side": "server",
"type": "int8u",
"included": 1,
"storageOption": "RAM",
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
Expand Down Expand Up @@ -8705,7 +8705,7 @@
"side": "server",
"type": "bitmap32",
"included": 1,
"storageOption": "RAM",
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "0",
Expand Down
59 changes: 28 additions & 31 deletions examples/all-clusters-app/all-clusters-common/include/oven-modes.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,57 +30,57 @@ namespace Clusters {

namespace OvenMode {

const uint8_t ModeBake = 0;
const uint8_t ModeConvection = 1;
const uint8_t ModeGrill = 2;
const uint8_t ModeRoast = 3;
const uint8_t ModeClean = 4;
const uint8_t ModeConvectionBake = 5;
const uint8_t ModeConvectionRoast = 6;
const uint8_t ModeWarming = 7;
const uint8_t ModeProofing = 8;
const uint8_t ModeBake = 0;
const uint8_t ModeConvection = 1;
const uint8_t ModeGrill = 2;
const uint8_t ModeRoast = 3;
const uint8_t ModeClean = 4;
const uint8_t ModeConvectionBake = 5;
const uint8_t ModeConvectionRoast = 6;
const uint8_t ModeWarming = 7;
const uint8_t ModeProofing = 8;

/// This is an application level delegate to handle Oven commands according to the specific business logic.
class OvenModeDelegate : public ModeBase::Delegate
{
private:
using ModeTagStructType = detail::Structs::ModeTagStruct::Type;
ModeTagStructType ModeTagsBake[1] = { { .value = to_underlying(ModeTag::kBake) } };
ModeTagStructType ModeTagsConvection[1] = { { .value = to_underlying(ModeTag::kConvection) } };
ModeTagStructType ModeTagsGrill[1] = { { .value = to_underlying(ModeTag::kGrill) } };
ModeTagStructType ModeTagsRoast[1] = { { .value = to_underlying(ModeTag::kRoast) } };
ModeTagStructType ModeTagsClean[1] = { { .value = to_underlying(ModeTag::kClean) } };
ModeTagStructType ModeTagsConvectionBake[1] = { { .value = to_underlying(ModeTag::kConvectionBake) } };
ModeTagStructType ModeTagsConvectionRoast[1]= { { .value = to_underlying(ModeTag::kConvectionRoast) } };
ModeTagStructType ModeTagsWarming[1] = { { .value = to_underlying(ModeTag::kWarming) } };
ModeTagStructType ModeTagsProofing[1] = { { .value = to_underlying(ModeTag::kProofing) } };
using ModeTagStructType = detail::Structs::ModeTagStruct::Type;
ModeTagStructType ModeTagsBake[1] = { { .value = to_underlying(ModeTag::kBake) } };
ModeTagStructType ModeTagsConvection[1] = { { .value = to_underlying(ModeTag::kConvection) } };
ModeTagStructType ModeTagsGrill[1] = { { .value = to_underlying(ModeTag::kGrill) } };
ModeTagStructType ModeTagsRoast[1] = { { .value = to_underlying(ModeTag::kRoast) } };
ModeTagStructType ModeTagsClean[1] = { { .value = to_underlying(ModeTag::kClean) } };
ModeTagStructType ModeTagsConvectionBake[1] = { { .value = to_underlying(ModeTag::kConvectionBake) } };
ModeTagStructType ModeTagsConvectionRoast[1] = { { .value = to_underlying(ModeTag::kConvectionRoast) } };
ModeTagStructType ModeTagsWarming[1] = { { .value = to_underlying(ModeTag::kWarming) } };
ModeTagStructType ModeTagsProofing[1] = { { .value = to_underlying(ModeTag::kProofing) } };

const detail::Structs::ModeOptionStruct::Type kModeOptions[9] = {
detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Bake"),
detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Bake"),
.mode = ModeBake,
.modeTags = DataModel::List<const ModeTagStructType>(ModeTagsBake) },
detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Convection"),
detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Convection"),
.mode = ModeConvection,
.modeTags = DataModel::List<const ModeTagStructType>(ModeTagsConvection) },
detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Grill"),
detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Grill"),
.mode = ModeGrill,
.modeTags = DataModel::List<const ModeTagStructType>(ModeTagsGrill) },
detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Roast"),
detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Roast"),
.mode = ModeRoast,
.modeTags = DataModel::List<const ModeTagStructType>(ModeTagsRoast) },
detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Clean"),
detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Clean"),
.mode = ModeClean,
.modeTags = DataModel::List<const ModeTagStructType>(ModeTagsClean) },
detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Convection Bake"),
detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Convection Bake"),
.mode = ModeConvectionBake,
.modeTags = DataModel::List<const ModeTagStructType>(ModeTagsConvectionBake) },
detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Convection Roast"),
detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Convection Roast"),
.mode = ModeConvectionRoast,
.modeTags = DataModel::List<const ModeTagStructType>(ModeTagsConvectionRoast) },
detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Warming"),
detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Warming"),
.mode = ModeWarming,
.modeTags = DataModel::List<const ModeTagStructType>(ModeTagsWarming) },
detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Proofing"),
detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Proofing"),
.mode = ModeProofing,
.modeTags = DataModel::List<const ModeTagStructType>(ModeTagsProofing) },
};
Expand All @@ -101,9 +101,6 @@ ModeBase::Instance * Instance();
void Shutdown();

} // namespace OvenMode



} // namespace Clusters
} // namespace app
} // namespace chip
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,10 @@ void OvenMode::Shutdown()
gOvenModeDelegate = nullptr;
}
}
void emberAfOvenModeClusterServerInitCallback(chip::EndpointId endpointId)
// void emberAfOvenModeClusterInitCallback(chip::EndpointId endpointId)

void emberAfOvenModeClusterServerInitCallback(chip::EndpointId endpointId) {}

void emberAfOvenModeClusterInitCallback(chip::EndpointId endpointId)
{
ChipLogProgress(Echo, "emberAfOvenModeClusterInitCallback called");
VerifyOrDie(endpointId == 1); // this cluster is only enabled for endpoint 1.
Expand Down
9 changes: 1 addition & 8 deletions examples/all-clusters-app/linux/main-common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
#include "laundry-washer-controls-delegate-impl.h"
#include "laundry-washer-mode.h"
#include "microwave-oven-mode.h"
#include "operational-state-delegate-impl.h"
#include "oven-modes.h"
#include "oven-operational-state-delegate-impl.h"
#include "operational-state-delegate-impl.h"
#include "resource-monitoring-delegates.h"
#include "rvc-modes.h"
#include "tcc-mode.h"
Expand All @@ -36,7 +36,6 @@
#include <app/att-storage.h>
#include <app/clusters/identify-server/identify-server.h>
#include <app/clusters/laundry-washer-controls-server/laundry-washer-controls-server.h>
#include <app/clusters/laundry-washer-controls-server/laundry-washer-controls-server.h>
#include <app/clusters/mode-base-server/mode-base-server.h>
#include <app/server/Server.h>
#include <app/util/af.h>
Expand Down Expand Up @@ -254,12 +253,6 @@ void emberAfLaundryWasherControlsClusterInitCallback(EndpointId endpoint)
LaundryWasherControlsServer::SetDefaultDelegate(endpoint, &LaundryWasherControlDelegate::getLaundryWasherControlDelegate());
}

using namespace chip::app::Clusters::OvenMode;
void emberAfOvenModeClusterInitCallback(EndpointId endpoint)
{
OvenModeServer::SetDefaultDelegate(endpoint, &LaundryWasherControlDelegate::getLaundryWasherControlDelegate());
}

void emberAfLowPowerClusterInitCallback(EndpointId endpoint)
{
ChipLogProgress(NotSpecified, "Setting LowPower default delegate to global manager");
Expand Down

0 comments on commit e52a535

Please sign in to comment.