-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OvenMode example Implementation (#30983)
* Adding oven op state * Python regen * Fixing alignment * regenerate with oven device. * regenerated zap and chiptool * oven opState first pass builds and runs, but running tests results in a lot of failure messages. * tentative updates based on RVC * updated cluster name & fix build * regen zap * linux builds with oven mode update. * remove duplicate ovencacvity Entries * remove duplicate oven cavity entry * Revert "remove duplicate ovencacvity Entries" This reverts commit 87e891e. * cleanup for ovenMode * cleanup: remove operationalState changes * update config-data. Regen. * Restyled by clang-format * Reverting files.gni, settings.json * adding to emberAf function to get it compiled * adding oven-modes.cpp to more make files. * Adding to 2 more make files * removed "server" init(), struck from init list * removed references to ovenCavityOperationalState * Regenerated Zap * zap regen after rebase * updating name of dryer control endpoint count * fixing merge for telink * cleanup auto-format changes * Fix zap file merge error --------- Co-authored-by: abeck-riis <98488327+abeck-riis@users.noreply.github.com> Co-authored-by: Restyled.io <commits@restyled.io>
- Loading branch information
Showing
22 changed files
with
448 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
106 changes: 106 additions & 0 deletions
106
examples/all-clusters-app/all-clusters-common/include/oven-modes.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
/* | ||
* | ||
* Copyright (c) 2023 Project CHIP Authors | ||
* All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <app/clusters/mode-base-server/mode-base-server.h> | ||
#include <app/util/af.h> | ||
#include <app/util/config.h> | ||
#include <cstring> | ||
#include <utility> | ||
|
||
namespace chip { | ||
namespace app { | ||
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; | ||
|
||
/// 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) } }; | ||
|
||
const detail::Structs::ModeOptionStruct::Type kModeOptions[9] = { | ||
detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Bake"), | ||
.mode = ModeBake, | ||
.modeTags = DataModel::List<const ModeTagStructType>(ModeTagsBake) }, | ||
detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Convection"), | ||
.mode = ModeConvection, | ||
.modeTags = DataModel::List<const ModeTagStructType>(ModeTagsConvection) }, | ||
detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Grill"), | ||
.mode = ModeGrill, | ||
.modeTags = DataModel::List<const ModeTagStructType>(ModeTagsGrill) }, | ||
detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Roast"), | ||
.mode = ModeRoast, | ||
.modeTags = DataModel::List<const ModeTagStructType>(ModeTagsRoast) }, | ||
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"), | ||
.mode = ModeConvectionBake, | ||
.modeTags = DataModel::List<const ModeTagStructType>(ModeTagsConvectionBake) }, | ||
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"), | ||
.mode = ModeWarming, | ||
.modeTags = DataModel::List<const ModeTagStructType>(ModeTagsWarming) }, | ||
detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Proofing"), | ||
.mode = ModeProofing, | ||
.modeTags = DataModel::List<const ModeTagStructType>(ModeTagsProofing) }, | ||
}; | ||
|
||
CHIP_ERROR Init() override; | ||
void HandleChangeToMode(uint8_t mode, ModeBase::Commands::ChangeToModeResponse::Type & response) override; | ||
|
||
CHIP_ERROR GetModeLabelByIndex(uint8_t modeIndex, MutableCharSpan & label) override; | ||
CHIP_ERROR GetModeValueByIndex(uint8_t modeIndex, uint8_t & value) override; | ||
CHIP_ERROR GetModeTagsByIndex(uint8_t modeIndex, DataModel::List<ModeTagStructType> & tags) override; | ||
|
||
public: | ||
~OvenModeDelegate() override = default; | ||
}; | ||
|
||
ModeBase::Instance * Instance(); | ||
|
||
void Shutdown(); | ||
|
||
} // namespace OvenMode | ||
} // namespace Clusters | ||
} // namespace app | ||
} // namespace chip |
Oops, something went wrong.