|
21 | 21 | #include <app-common/zap-generated/cluster-objects.h> |
22 | 22 | #include <lib/core/CHIPError.h> |
23 | 23 | #include <lib/core/DataModelTypes.h> |
| 24 | +#include <app/clusters/mode-base-server/mode-base-server.h> |
| 25 | +#include <app/clusters/temperature-control-server/supported-temperature-levels-manager.h> |
| 26 | +#include <app/data-model/List.h> |
| 27 | +#include <lib/support/Span.h> |
24 | 28 |
|
25 | 29 | namespace chip { |
26 | 30 | namespace app { |
27 | 31 | namespace Clusters { |
28 | | -namespace Oven { |
| 32 | +namespace TemperatureControlledCabinet { |
| 33 | +class OvenModeDelegate : public ModeBase::Delegate |
| 34 | +{ |
| 35 | +public: |
| 36 | + // Oven mode constants - made static and public for potential reuse |
| 37 | + static constexpr uint8_t kModeBake = 0; |
| 38 | + static constexpr uint8_t kModeConvection = 1; |
| 39 | + static constexpr uint8_t kModeGrill = 2; |
| 40 | + static constexpr uint8_t kModeRoast = 3; |
| 41 | + static constexpr uint8_t kModeClean = 4; |
| 42 | + static constexpr uint8_t kModeConvectionBake = 5; |
| 43 | + static constexpr uint8_t kModeConvectionRoast = 6; |
| 44 | + static constexpr uint8_t kModeWarming = 7; |
| 45 | + static constexpr uint8_t kModeProofing = 8; |
| 46 | + static constexpr uint8_t kModeCount = 9; |
| 47 | + |
| 48 | + OvenModeDelegate(EndpointId endpointId) : mEndpointId(endpointId) {} |
| 49 | + |
| 50 | + // ModeBase::Delegate interface |
| 51 | + CHIP_ERROR Init() override; |
| 52 | + void HandleChangeToMode(uint8_t mode, ModeBase::Commands::ChangeToModeResponse::Type & response) override; |
| 53 | + CHIP_ERROR GetModeLabelByIndex(uint8_t modeIndex, MutableCharSpan & label) override; |
| 54 | + CHIP_ERROR GetModeValueByIndex(uint8_t modeIndex, uint8_t & value) override; |
| 55 | + CHIP_ERROR GetModeTagsByIndex(uint8_t modeIndex, DataModel::List<detail::Structs::ModeTagStruct::Type> & tags) override; |
| 56 | + |
| 57 | +private: |
| 58 | + EndpointId mEndpointId; |
| 59 | + |
| 60 | + // Static arrays moved to implementation file to reduce header size |
| 61 | + static const detail::Structs::ModeTagStruct::Type sModeTagsBake[]; |
| 62 | + static const detail::Structs::ModeTagStruct::Type sModeTagsConvection[]; |
| 63 | + static const detail::Structs::ModeTagStruct::Type sModeTagsGrill[]; |
| 64 | + static const detail::Structs::ModeTagStruct::Type sModeTagsRoast[]; |
| 65 | + static const detail::Structs::ModeTagStruct::Type sModeTagsClean[]; |
| 66 | + static const detail::Structs::ModeTagStruct::Type sModeTagsConvectionBake[]; |
| 67 | + static const detail::Structs::ModeTagStruct::Type sModeTagsConvectionRoast[]; |
| 68 | + static const detail::Structs::ModeTagStruct::Type sModeTagsWarming[]; |
| 69 | + static const detail::Structs::ModeTagStruct::Type sModeTagsProofing[]; |
| 70 | + |
| 71 | + static const detail::Structs::ModeOptionStruct::Type skModeOptions[]; |
| 72 | +}; |
| 73 | + |
| 74 | +class TemperatureControlledCabinetEndpoint |
| 75 | +{ |
| 76 | +public: |
| 77 | + TemperatureControlledCabinetEndpoint(EndpointId endpointId) : |
| 78 | + mEndpointId(endpointId), mOvenModeDelegate(endpointId), mOvenModeInstance(&mOvenModeDelegate, mEndpointId, OvenMode::Id, 0) |
| 79 | + {} |
| 80 | + |
| 81 | + /** |
| 82 | + * Initialize the temperature controlled cabinet endpoint. |
| 83 | + */ |
| 84 | + CHIP_ERROR Init(); |
| 85 | + |
| 86 | +private: |
| 87 | + EndpointId mEndpointId = kInvalidEndpointId; |
| 88 | + OvenModeDelegate mOvenModeDelegate; |
| 89 | + ModeBase::Instance mOvenModeInstance; |
| 90 | +}; |
29 | 91 |
|
| 92 | +} // namespace TemperatureControlledCabinet |
| 93 | + |
| 94 | +namespace Oven { |
30 | 95 | /** |
31 | 96 | * @brief Base oven endpoint placeholder. |
32 | 97 | */ |
33 | 98 | class OvenEndpoint |
34 | 99 | { |
35 | 100 | public: |
36 | | - OvenEndpoint(EndpointId endpointId) {} |
| 101 | + OvenEndpoint() {} |
37 | 102 |
|
38 | 103 | /** |
39 | 104 | * @brief Initialize the oven endpoint. |
40 | | - * |
41 | | - * @return CHIP_ERROR indicating success or failure of the initialization. |
42 | 105 | */ |
43 | 106 | CHIP_ERROR Init(); |
44 | 107 | }; |
|
0 commit comments