From e52a535deb3b68afd3056c283aaac6267db810a3 Mon Sep 17 00:00:00 2001 From: Erik Hove Date: Tue, 12 Dec 2023 22:29:10 -0600 Subject: [PATCH] cleanup for ovenMode --- .../all-clusters-common/all-clusters-app.zap | 4 +- .../all-clusters-common/include/oven-modes.h | 59 +++++++++---------- .../all-clusters-common/src/oven-modes.cpp | 6 +- .../all-clusters-app/linux/main-common.cpp | 9 +-- 4 files changed, 35 insertions(+), 43 deletions(-) diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap index 00a408d9c385ed..a2147d313fb6eb 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap @@ -8625,7 +8625,7 @@ "side": "server", "type": "int8u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -8705,7 +8705,7 @@ "side": "server", "type": "bitmap32", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "0", diff --git a/examples/all-clusters-app/all-clusters-common/include/oven-modes.h b/examples/all-clusters-app/all-clusters-common/include/oven-modes.h index dfe44cc098084d..7e264a4c47e272 100644 --- a/examples/all-clusters-app/all-clusters-common/include/oven-modes.h +++ b/examples/all-clusters-app/all-clusters-common/include/oven-modes.h @@ -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(ModeTagsBake) }, - detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Convection"), + detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Convection"), .mode = ModeConvection, .modeTags = DataModel::List(ModeTagsConvection) }, - detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Grill"), + detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Grill"), .mode = ModeGrill, .modeTags = DataModel::List(ModeTagsGrill) }, - detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Roast"), + detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Roast"), .mode = ModeRoast, .modeTags = DataModel::List(ModeTagsRoast) }, - detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Clean"), + detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Clean"), .mode = ModeClean, .modeTags = DataModel::List(ModeTagsClean) }, - detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Convection Bake"), + detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Convection Bake"), .mode = ModeConvectionBake, .modeTags = DataModel::List(ModeTagsConvectionBake) }, - detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Convection Roast"), + detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Convection Roast"), .mode = ModeConvectionRoast, .modeTags = DataModel::List(ModeTagsConvectionRoast) }, - detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Warming"), + detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Warming"), .mode = ModeWarming, .modeTags = DataModel::List(ModeTagsWarming) }, - detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Proofing"), + detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Proofing"), .mode = ModeProofing, .modeTags = DataModel::List(ModeTagsProofing) }, }; @@ -101,9 +101,6 @@ ModeBase::Instance * Instance(); void Shutdown(); } // namespace OvenMode - - - } // namespace Clusters } // namespace app } // namespace chip diff --git a/examples/all-clusters-app/all-clusters-common/src/oven-modes.cpp b/examples/all-clusters-app/all-clusters-common/src/oven-modes.cpp index f5a70a156198bf..5e86bccd859a13 100644 --- a/examples/all-clusters-app/all-clusters-common/src/oven-modes.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/oven-modes.cpp @@ -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. diff --git a/examples/all-clusters-app/linux/main-common.cpp b/examples/all-clusters-app/linux/main-common.cpp index 9af169a2d2caf6..1707b06800e867 100644 --- a/examples/all-clusters-app/linux/main-common.cpp +++ b/examples/all-clusters-app/linux/main-common.cpp @@ -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" @@ -36,7 +36,6 @@ #include #include #include -#include #include #include #include @@ -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");