From 09f014cebf114980e6174277d8d45f301f77679f Mon Sep 17 00:00:00 2001 From: liangpy4 <150026141+liangpy4@users.noreply.github.com> Date: Wed, 17 Jan 2024 11:14:52 +0800 Subject: [PATCH] [Feature]Microwave oven control cluster implementation - add watt setting (#31130) * update .xml and .json * add src/controller * regen ZAP, add new attributes for microwave oven control cluster * update MicrowaveOvenDevice SDK and APP * update comment for MWO * Restyled by whitespace * Restyled by clang-format * Restyled by prettier-json * Restyled by isort * update XML * update MWO after reviewed * Restyled by clang-format * update MWO sdk after reviewed * Restyled by clang-format * update microwave-oven-device.h * update MWC-wattSetting after reviewed * update comment for HandleSetCookingParametersCallback method * update MWOCTRL, add new feature PowerInLimits * push test * Restyled by whitespace * Restyled by clang-format * regen_all and rebuild * update MWOCTRL after review * Restyled by whitespace * Restyled by clang-format * update code after reviewed * update code after reviewed * Restyled by whitespace * Restyled by clang-format * Restyled by autopep8 * update code after reviewed * update code after reviewed * Restyled by whitespace * Restyled by clang-format * update code, adding new checking for powerSetting Number * fix restyled issue * Restyled by whitespace * Restyled by clang-format * update code after reviewed * fix restyled issue * Restyled by whitespace * Restyled by clang-format * update code after reviewed * Restyled by clang-format --------- Co-authored-by: Restyled.io --- .../include/microwave-oven-device.h | 95 +++- .../microwave-oven-app.matter | 20 +- .../microwave-oven-app.zap | 36 +- .../src/microwave-oven-device.cpp | 57 ++- .../microwave-oven-control-server.cpp | 279 ++++++++---- .../microwave-oven-control-server.h | 100 +++-- .../chip/microwave-oven-control-cluster.xml | 29 +- .../zcl/zcl-with-test-extensions.json | 7 +- src/app/zap-templates/zcl/zcl.json | 7 +- .../data_model/controller-clusters.matter | 16 +- .../data_model/controller-clusters.zap | 53 +++ .../chip/devicecontroller/ChipClusters.java | 124 +++++- .../devicecontroller/ClusterIDMapping.java | 8 +- .../devicecontroller/ClusterInfoMapping.java | 31 ++ .../devicecontroller/ClusterReadMapping.java | 44 ++ .../clusters/MicrowaveOvenControlCluster.kt | 414 +++++++++++++++++- .../CHIPAttributeTLVValueDecoder.cpp | 73 +++ .../java/zap-generated/CHIPClientCallbacks.h | 2 + .../java/zap-generated/CHIPReadCallbacks.cpp | 72 +++ .../python/chip/clusters/CHIPClusters.py | 28 +- .../python/chip/clusters/Objects.py | 92 +++- .../MTRAttributeSpecifiedCheck.mm | 12 + .../MTRAttributeTLVValueDecoder.mm | 59 +++ .../CHIP/zap-generated/MTRBaseClusters.h | 30 ++ .../CHIP/zap-generated/MTRBaseClusters.mm | 144 ++++++ .../CHIP/zap-generated/MTRClusterConstants.h | 6 +- .../CHIP/zap-generated/MTRClusters.h | 8 + .../CHIP/zap-generated/MTRClusters.mm | 20 + .../zap-generated/MTRCommandPayloadsObjc.h | 4 + .../zap-generated/MTRCommandPayloadsObjc.mm | 20 +- .../zap-generated/attributes/Accessors.cpp | 31 -- .../zap-generated/attributes/Accessors.h | 5 - .../app-common/zap-generated/cluster-enums.h | 11 +- .../zap-generated/cluster-objects.cpp | 18 + .../zap-generated/cluster-objects.h | 64 ++- .../app-common/zap-generated/ids/Attributes.h | 18 +- .../zap-generated/cluster/Commands.h | 24 +- .../cluster/logging/DataModelLogger.cpp | 20 + .../zap-generated/cluster/Commands.h | 382 +++++++++++++++- 39 files changed, 2242 insertions(+), 221 deletions(-) diff --git a/examples/microwave-oven-app/microwave-oven-common/include/microwave-oven-device.h b/examples/microwave-oven-app/microwave-oven-common/include/microwave-oven-device.h index c42c36ac5a4077..2775d2a3227812 100644 --- a/examples/microwave-oven-app/microwave-oven-common/include/microwave-oven-device.h +++ b/examples/microwave-oven-app/microwave-oven-common/include/microwave-oven-device.h @@ -32,16 +32,6 @@ namespace chip { namespace app { namespace Clusters { -/** - * set default value for the optional attributes - */ -constexpr uint8_t kDefaultMinPower = 10u; -constexpr uint8_t kDefaultMaxPower = 100u; -constexpr uint8_t kDefaultPowerStep = 10u; - -constexpr uint8_t ModeNormal = 0; -constexpr uint8_t ModeDefrost = 1; - class ExampleMicrowaveOvenDevice : public MicrowaveOvenControl::Delegate, public ModeBase::Delegate, public OperationalState::Delegate @@ -56,8 +46,10 @@ class ExampleMicrowaveOvenDevice : public MicrowaveOvenControl::Delegate, explicit ExampleMicrowaveOvenDevice(EndpointId aClustersEndpoint) : mOperationalStateInstance(this, aClustersEndpoint), mMicrowaveOvenModeInstance(this, aClustersEndpoint, MicrowaveOvenMode::Id, 0), - mMicrowaveOvenControlInstance(this, aClustersEndpoint, MicrowaveOvenControl::Id, mOperationalStateInstance, - mMicrowaveOvenModeInstance) + mMicrowaveOvenControlInstance(this, aClustersEndpoint, MicrowaveOvenControl::Id, + BitMask(MicrowaveOvenControl::Feature::kPowerAsNumber, + MicrowaveOvenControl::Feature::kPowerNumberLimits), + mOperationalStateInstance, mMicrowaveOvenModeInstance) {} /** @@ -69,28 +61,60 @@ class ExampleMicrowaveOvenDevice : public MicrowaveOvenControl::Delegate, /** * handle command for microwave oven control: set cooking parameters */ - Protocols::InteractionModel::Status HandleSetCookingParametersCallback(uint8_t cookMode, uint32_t cookTime, - uint8_t powerSetting) override; + Protocols::InteractionModel::Status HandleSetCookingParametersCallback(uint8_t cookMode, uint32_t cookTimeSec, + bool startAfterSetting, + Optional powerSettingNum, + Optional wattSettingIndex) override; /** * handle command for microwave oven control: add more time */ - Protocols::InteractionModel::Status HandleModifyCookTimeCallback(uint32_t finalCookTime) override; + Protocols::InteractionModel::Status HandleModifyCookTimeSecondsCallback(uint32_t finalcookTimeSec) override; + + /** + * Get the watt setting from the supported watts array. + * @param index The index of the watt setting to be returned. It is assumed that watt setting are indexable from 0 and with no + * gaps. + * @param wattSetting A reference to receive the watt setting on success. + * @return Returns a CHIP_NO_ERROR if there was no error and the label was returned successfully. + * CHIP_ERROR_NOT_FOUND if the index in beyond the list of available labels. + */ + CHIP_ERROR GetWattSettingByIndex(uint8_t index, uint16_t & wattSetting) override; + + /** + * Get the value of power setting number. + */ + uint8_t GetPowerSettingNum() const override { return mPowerSettingNum; } + + /** + * Get the value of min power number. + */ + uint8_t GetMinPowerNum() const override { return kMinPowerNum; } /** - * Get the value of MinPower. + * Get the value of max power number. */ - uint8_t GetMinPower() const override { return kDefaultMinPower; } + uint8_t GetMaxPowerNum() const override { return kMaxPowerNum; } /** - * Get the value of MaxPower. + * Get the value of power step number. */ - uint8_t GetMaxPower() const override { return kDefaultMaxPower; } + uint8_t GetPowerStepNum() const override { return kPowerStepNum; } /** - * Get the value of PowerStep. + * Get the value of max cook time in seconds. */ - uint8_t GetPowerStep() const override { return kDefaultPowerStep; } + uint32_t GetMaxCookTimeSec() const override { return kMaxCookTimeSec; } + + /** + * Get the value of selected watt index. + */ + uint8_t GetCurrentWattIndex() const override { return mSelectedWattIndex; }; + + /** + * Get the value of watt rating. + */ + uint16_t GetWattRating() const override { return mWattRating; }; // delegates from OperationalState cluster using ModeTagStructType = detail::Structs::ModeTagStruct::Type; @@ -201,16 +225,41 @@ class ExampleMicrowaveOvenDevice : public MicrowaveOvenControl::Delegate, ModeBase::Instance mMicrowaveOvenModeInstance; MicrowaveOvenControl::Instance mMicrowaveOvenControlInstance; + // set default value for the optional attributes + static constexpr uint8_t kMinPowerNum = 20u; + static constexpr uint8_t kMaxPowerNum = 90u; + static constexpr uint8_t kPowerStepNum = 10u; + static constexpr uint32_t kMaxCookTimeSec = 86400u; + static constexpr uint8_t kDefaultPowerSettingNum = 100u; + + // define the mode value + static constexpr uint8_t kModeNormal = 0u; + static constexpr uint8_t kModeDefrost = 1u; + + // define the example watts + static constexpr uint16_t kExampleWatt1 = 100u; + static constexpr uint16_t kExampleWatt2 = 300u; + static constexpr uint16_t kExampleWatt3 = 500u; + static constexpr uint16_t kExampleWatt4 = 800u; + static constexpr uint16_t kExampleWatt5 = 1000u; + + // MicrowaveOvenControl variables + uint8_t mPowerSettingNum = kDefaultPowerSettingNum; + uint8_t mSelectedWattIndex = 0; + uint16_t mWattRating = 0; + + const uint16_t mWattSettingList[5] = { kExampleWatt1, kExampleWatt2, kExampleWatt3, kExampleWatt4, kExampleWatt5 }; + // MicrowaveOvenMode types ModeTagStructType modeTagsNormal[1] = { { .value = to_underlying(MicrowaveOvenMode::ModeTag::kNormal) } }; ModeTagStructType modeTagsDefrost[1] = { { .value = to_underlying(MicrowaveOvenMode::ModeTag::kDefrost) } }; const detail::Structs::ModeOptionStruct::Type kModeOptions[2] = { detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Normal"), - .mode = ModeNormal, + .mode = kModeNormal, .modeTags = DataModel::List(modeTagsNormal) }, detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Defrost"), - .mode = ModeDefrost, + .mode = kModeDefrost, .modeTags = DataModel::List(modeTagsDefrost) } }; diff --git a/examples/microwave-oven-app/microwave-oven-common/microwave-oven-app.matter b/examples/microwave-oven-app/microwave-oven-common/microwave-oven-app.matter index fec61bc7a38add..70d2b496e213fa 100644 --- a/examples/microwave-oven-app/microwave-oven-common/microwave-oven-app.matter +++ b/examples/microwave-oven-app/microwave-oven-common/microwave-oven-app.matter @@ -1033,11 +1033,21 @@ provisional cluster MicrowaveOvenMode = 94 { provisional cluster MicrowaveOvenControl = 95 { revision 1; // NOTE: Default/not specifically set - readonly attribute elapsed_s cookTime = 1; - readonly attribute int8u powerSetting = 2; + bitmap Feature : bitmap32 { + kPowerAsNumber = 0x1; + kPowerInWatts = 0x2; + kPowerNumberLimits = 0x4; + } + + readonly attribute elapsed_s cookTime = 0; + readonly attribute elapsed_s maxCookTime = 1; + readonly attribute optional int8u powerSetting = 2; readonly attribute optional int8u minPower = 3; readonly attribute optional int8u maxPower = 4; readonly attribute optional int8u powerStep = 5; + readonly attribute optional int16u supportedWatts[] = 6; + readonly attribute optional int8u selectedWattIndex = 7; + readonly attribute optional int16u wattRating = 8; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -1049,6 +1059,8 @@ provisional cluster MicrowaveOvenControl = 95 { optional int8u cookMode = 0; optional elapsed_s cookTime = 1; optional int8u powerSetting = 2; + optional int8u wattSettingIndex = 3; + optional boolean startAfterSetting = 4; } request struct AddMoreTimeRequest { @@ -1396,15 +1408,17 @@ endpoint 1 { server cluster MicrowaveOvenControl { callback attribute cookTime; + callback attribute maxCookTime; callback attribute powerSetting; callback attribute minPower; callback attribute maxPower; callback attribute powerStep; + callback attribute wattRating; callback attribute generatedCommandList; callback attribute acceptedCommandList; callback attribute eventList; callback attribute attributeList; - ram attribute featureMap default = 0; + callback attribute featureMap; ram attribute clusterRevision default = 1; handle command SetCookingParameters; diff --git a/examples/microwave-oven-app/microwave-oven-common/microwave-oven-app.zap b/examples/microwave-oven-app/microwave-oven-common/microwave-oven-app.zap index b5bab9d8a6443f..c0cb802e0f4b29 100644 --- a/examples/microwave-oven-app/microwave-oven-common/microwave-oven-app.zap +++ b/examples/microwave-oven-app/microwave-oven-common/microwave-oven-app.zap @@ -3183,6 +3183,22 @@ "attributes": [ { "name": "CookTime", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "elapsed_s", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "MaxCookTime", "code": 1, "mfgCode": null, "side": "server", @@ -3261,6 +3277,22 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "WattRating", + "code": 8, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "GeneratedCommandList", "code": 65528, @@ -3332,10 +3364,10 @@ "side": "server", "type": "bitmap32", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, diff --git a/examples/microwave-oven-app/microwave-oven-common/src/microwave-oven-device.cpp b/examples/microwave-oven-app/microwave-oven-common/src/microwave-oven-device.cpp index 2b584701e42192..39e8ab2bf98b73 100644 --- a/examples/microwave-oven-app/microwave-oven-common/src/microwave-oven-device.cpp +++ b/examples/microwave-oven-app/microwave-oven-common/src/microwave-oven-device.cpp @@ -35,38 +35,83 @@ void ExampleMicrowaveOvenDevice::MicrowaveOvenInit() mOperationalStateInstance.Init(); mMicrowaveOvenModeInstance.Init(); mMicrowaveOvenControlInstance.Init(); + + // set default value for attribute SelectedWattIndex and WattRating + if (mMicrowaveOvenControlInstance.HasFeature(MicrowaveOvenControl::Feature::kPowerInWatts)) + { + static_assert(ArraySize(mWattSettingList) > 0, "Watt setting list is empty!"); + mSelectedWattIndex = ArraySize(mWattSettingList) - 1; + mWattRating = mWattSettingList[mSelectedWattIndex]; + } + else + { + mWattRating = kExampleWatt5; + } } /** * MicrowaveOvenControl cluster */ Protocols::InteractionModel::Status -ExampleMicrowaveOvenDevice::HandleSetCookingParametersCallback(uint8_t cookMode, uint32_t cookTime, uint8_t powerSetting) +ExampleMicrowaveOvenDevice::HandleSetCookingParametersCallback(uint8_t cookMode, uint32_t cookTimeSec, bool startAfterSetting, + Optional powerSettingNum, + Optional wattSettingIndex) { // placeholder implementation Status status; + // Update cook mode. if ((status = mMicrowaveOvenModeInstance.UpdateCurrentMode(cookMode)) != Status::Success) { return status; } - mMicrowaveOvenControlInstance.SetCookTime(cookTime); - mMicrowaveOvenControlInstance.SetPowerSetting(powerSetting); + + mMicrowaveOvenControlInstance.SetCookTimeSec(cookTimeSec); + + // If using power as number, check if powerSettingNum has value before setting the power number. + // If powerSetting field is missing in the command, the powerSettingNum passed here is handled to the max value + // and user can use this value directly. + if (powerSettingNum.HasValue()) + { + mPowerSettingNum = powerSettingNum.Value(); + } + + // If using power in watt, check if wattSettingIndex has value before setting the watt rating and watt list index. + // If wattSettinIndex field is missing in the command, the wattSettingIndex passed here is handled to the max value + // and user can use this value directly. + if (wattSettingIndex.HasValue()) + { + mSelectedWattIndex = wattSettingIndex.Value(); + mWattRating = mWattSettingList[mSelectedWattIndex]; + } + + if (startAfterSetting) + { + mOperationalStateInstance.SetOperationalState(to_underlying(OperationalStateEnum::kRunning)); + } return Status::Success; } -Protocols::InteractionModel::Status ExampleMicrowaveOvenDevice::HandleModifyCookTimeCallback(uint32_t finalCookTime) +Protocols::InteractionModel::Status ExampleMicrowaveOvenDevice::HandleModifyCookTimeSecondsCallback(uint32_t finalCookTimeSec) { // placeholder implementation - mMicrowaveOvenControlInstance.SetCookTime(finalCookTime); + mMicrowaveOvenControlInstance.SetCookTimeSec(finalCookTimeSec); return Status::Success; } +CHIP_ERROR ExampleMicrowaveOvenDevice::GetWattSettingByIndex(uint8_t index, uint16_t & wattSetting) +{ + VerifyOrReturnError(index < ArraySize(mWattSettingList), CHIP_ERROR_NOT_FOUND); + + wattSetting = mWattSettingList[index]; + return CHIP_NO_ERROR; +} + /** * OperationalState cluster */ app::DataModel::Nullable ExampleMicrowaveOvenDevice::GetCountdownTime() { - return DataModel::MakeNullable(mMicrowaveOvenControlInstance.GetCookTime()); + return DataModel::MakeNullable(mMicrowaveOvenControlInstance.GetCookTimeSec()); } CHIP_ERROR ExampleMicrowaveOvenDevice::GetOperationalStateAtIndex(size_t index, diff --git a/src/app/clusters/microwave-oven-control-server/microwave-oven-control-server.cpp b/src/app/clusters/microwave-oven-control-server/microwave-oven-control-server.cpp index 09716a03fd9d09..c1e9546b2afcb7 100644 --- a/src/app/clusters/microwave-oven-control-server/microwave-oven-control-server.cpp +++ b/src/app/clusters/microwave-oven-control-server/microwave-oven-control-server.cpp @@ -40,11 +40,12 @@ namespace Clusters { namespace MicrowaveOvenControl { Instance::Instance(Delegate * aDelegate, EndpointId aEndpointId, ClusterId aClusterId, - Clusters::OperationalState::Instance & aOpStateInstance, + BitMask aFeature, Clusters::OperationalState::Instance & aOpStateInstance, Clusters::ModeBase::Instance & aMicrowaveOvenModeInstance) : CommandHandlerInterface(MakeOptional(aEndpointId), aClusterId), AttributeAccessInterface(MakeOptional(aEndpointId), aClusterId), mDelegate(aDelegate), mEndpointId(aEndpointId), - mClusterId(aClusterId), mOpStateInstance(aOpStateInstance), mMicrowaveOvenModeInstance(aMicrowaveOvenModeInstance) + mClusterId(aClusterId), mFeature(aFeature), mOpStateInstance(aOpStateInstance), + mMicrowaveOvenModeInstance(aMicrowaveOvenModeInstance) { mDelegate->SetInstance(this); } @@ -58,77 +59,148 @@ Instance::~Instance() CHIP_ERROR Instance::Init() { // Check if the cluster has been selected in zap - if (!emberAfContainsServer(mEndpointId, mClusterId)) - { - ChipLogError(Zcl, "Microwave Oven Control: The cluster with ID %lu was not enabled in zap.", long(mClusterId)); - return CHIP_ERROR_INVALID_ARGUMENT; - } + VerifyOrReturnError( + emberAfContainsServer(mEndpointId, mClusterId), CHIP_ERROR_INVALID_ARGUMENT, + ChipLogError(Zcl, "Microwave Oven Control: The cluster with ID %lu was not enabled in zap.", long(mClusterId))); + + // Exactly one of the PowerAsNumber and PowerInWatts features must be supported, per spec. + VerifyOrReturnError( + mFeature.Has(MicrowaveOvenControl::Feature::kPowerAsNumber) || mFeature.Has(MicrowaveOvenControl::Feature::kPowerInWatts), + CHIP_ERROR_INVALID_ARGUMENT, + ChipLogError(Zcl, + "Microwave Oven Control: feature bits error, feature must support one of PowerInWatts and PowerAsNumber")); + + // Check that the feature bits do not include both PowerAsNumber and PowerInWatts + VerifyOrReturnError( + !(mFeature.Has(MicrowaveOvenControl::Feature::kPowerAsNumber) && + mFeature.Has(MicrowaveOvenControl::Feature::kPowerInWatts)), + CHIP_ERROR_INVALID_ARGUMENT, + ChipLogError(Zcl, + "Microwave Oven Control: feature bits error, feature could not support both PowerAsNumber and PowerInWatts")); + + // Per spec, the PowerNumberLimits feature is only allowed if the PowerAsNumber feature is supported. + VerifyOrReturnError( + !mFeature.Has(MicrowaveOvenControl::Feature::kPowerNumberLimits) || + mFeature.Has(MicrowaveOvenControl::Feature::kPowerAsNumber), + CHIP_ERROR_INVALID_ARGUMENT, + ChipLogError( + Zcl, + "Microwave Oven Control: feature bits error, if feature supports PowerNumberLimits it must support PowerAsNumber")); ReturnErrorOnFailure(InteractionModelEngine::GetInstance()->RegisterCommandHandler(this)); VerifyOrReturnError(registerAttributeAccessOverride(this), CHIP_ERROR_INCORRECT_STATE); - + // If the PowerInWatts feature is supported, get the count of supported watt levels so we can later + // ensure incoming watt level values are valid. + if (HasFeature(MicrowaveOvenControl::Feature::kPowerInWatts)) + { + mSupportedWattLevels = GetCountOfSupportedWattLevels(); + VerifyOrReturnError(mSupportedWattLevels > 0, CHIP_ERROR_INVALID_ARGUMENT, + ChipLogError(Zcl, "Microwave Oven Control: supported watt levels is empty")); + } return CHIP_NO_ERROR; } -uint32_t Instance::GetCookTime() const +bool Instance::HasFeature(MicrowaveOvenControl::Feature feature) const { - return mCookTime; + return mFeature.Has(feature); } -uint8_t Instance::GetPowerSetting() const +uint8_t Instance::GetCountOfSupportedWattLevels() const { - return mPowerSetting; + uint8_t wattIndex = 0; + uint16_t watt = 0; + while (mDelegate->GetWattSettingByIndex(wattIndex, watt) == CHIP_NO_ERROR) + { + wattIndex++; + } + return wattIndex; } -void Instance::SetCookTime(uint32_t cookTime) +uint32_t Instance::GetCookTimeSec() const { - uint32_t oldCookTime = mCookTime; - mCookTime = cookTime; - if (mCookTime != oldCookTime) - { - MatterReportingAttributeChangeCallback(mEndpointId, mClusterId, Attributes::CookTime::Id); - } + return mCookTimeSec; } -void Instance::SetPowerSetting(uint8_t powerSetting) +void Instance::SetCookTimeSec(uint32_t cookTimeSec) { - uint8_t oldPowerSetting = mPowerSetting; - mPowerSetting = powerSetting; - if (mPowerSetting != oldPowerSetting) + uint32_t oldCookTimeSec = mCookTimeSec; + mCookTimeSec = cookTimeSec; + if (mCookTimeSec != oldCookTimeSec) { - MatterReportingAttributeChangeCallback(mEndpointId, mClusterId, Attributes::PowerSetting::Id); + MatterReportingAttributeChangeCallback(mEndpointId, mClusterId, Attributes::CookTime::Id); } } CHIP_ERROR Instance::Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) { - ChipLogError(Zcl, "OperationalState: Reading"); + ChipLogError(Zcl, "Microwave Oven Control: Reading"); switch (aPath.mAttributeId) { - case MicrowaveOvenControl::Attributes::CookTime::Id: { - ReturnErrorOnFailure(aEncoder.Encode(GetCookTime())); - } - break; - - case MicrowaveOvenControl::Attributes::PowerSetting::Id: { - ReturnErrorOnFailure(aEncoder.Encode(GetPowerSetting())); - } - break; - - case MicrowaveOvenControl::Attributes::MinPower::Id: { - ReturnErrorOnFailure(aEncoder.Encode(mDelegate->GetMinPower())); - } - break; - - case MicrowaveOvenControl::Attributes::MaxPower::Id: { - ReturnErrorOnFailure(aEncoder.Encode(mDelegate->GetMaxPower())); - } - break; - - case MicrowaveOvenControl::Attributes::PowerStep::Id: { - ReturnErrorOnFailure(aEncoder.Encode(mDelegate->GetPowerStep())); - } - break; + case MicrowaveOvenControl::Attributes::CookTime::Id: + return aEncoder.Encode(GetCookTimeSec()); + + case MicrowaveOvenControl::Attributes::MaxCookTime::Id: + return aEncoder.Encode(mDelegate->GetMaxCookTimeSec()); + + case MicrowaveOvenControl::Attributes::PowerSetting::Id: + VerifyOrReturnError(HasFeature(MicrowaveOvenControl::Feature::kPowerAsNumber), CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE, + ChipLogError(Zcl, "Microwave Oven Control: can not get PowerSetting number, feature is not supported")); + + return aEncoder.Encode(mDelegate->GetPowerSettingNum()); + + case MicrowaveOvenControl::Attributes::MinPower::Id: + VerifyOrReturnError(HasFeature(MicrowaveOvenControl::Feature::kPowerAsNumber), CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE, + ChipLogError(Zcl, "Microwave Oven Control: can not get MinPower number, feature is not supported")); + + return aEncoder.Encode(HasFeature(MicrowaveOvenControl::Feature::kPowerNumberLimits) ? mDelegate->GetMinPowerNum() + : kDefaultMinPowerNum); + + case MicrowaveOvenControl::Attributes::MaxPower::Id: + VerifyOrReturnError(HasFeature(MicrowaveOvenControl::Feature::kPowerAsNumber), CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE, + ChipLogError(Zcl, "Microwave Oven Control: can not get MaxPower number, feature is not supported")); + + return aEncoder.Encode(HasFeature(MicrowaveOvenControl::Feature::kPowerNumberLimits) ? mDelegate->GetMaxPowerNum() + : kDefaultMaxPowerNum); + + case MicrowaveOvenControl::Attributes::PowerStep::Id: + VerifyOrReturnError(HasFeature(MicrowaveOvenControl::Feature::kPowerAsNumber), CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE, + ChipLogError(Zcl, "Microwave Oven Control: can not get PowerStep number, feature is not supported")); + + return aEncoder.Encode(HasFeature(MicrowaveOvenControl::Feature::kPowerNumberLimits) ? mDelegate->GetPowerStepNum() + : kDefaultPowerStepNum); + + case MicrowaveOvenControl::Attributes::SupportedWatts::Id: + VerifyOrReturnError(HasFeature(MicrowaveOvenControl::Feature::kPowerInWatts), CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE, + ChipLogError(Zcl, "Microwave Oven Control: can not get SuppoertWatts list, feature is not supported")); + + return aEncoder.EncodeList([delegate = mDelegate](const auto & encoder) -> CHIP_ERROR { + uint16_t wattRating; + uint8_t index = 0; + CHIP_ERROR err = CHIP_NO_ERROR; + while ((err = delegate->GetWattSettingByIndex(index, wattRating)) == CHIP_NO_ERROR) + { + ReturnErrorOnFailure(encoder.Encode(wattRating)); + index++; + } + if (err == CHIP_ERROR_NOT_FOUND) + { + return CHIP_NO_ERROR; + } + return err; + }); + + case MicrowaveOvenControl::Attributes::SelectedWattIndex::Id: + VerifyOrReturnError( + HasFeature(MicrowaveOvenControl::Feature::kPowerInWatts), CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE, + ChipLogError(Zcl, "Microwave Oven Control: can not get SelectedWattIndex number, feature is not supported")); + + return aEncoder.Encode(mDelegate->GetCurrentWattIndex()); + + case MicrowaveOvenControl::Attributes::WattRating::Id: + return aEncoder.Encode(mDelegate->GetWattRating()); + + case MicrowaveOvenControl::Attributes::FeatureMap::Id: + return aEncoder.Encode(mFeature.Raw()); } return CHIP_NO_ERROR; } @@ -161,17 +233,28 @@ void Instance::HandleSetCookingParameters(HandlerContext & ctx, const Commands:: uint8_t opState; uint8_t modeValue; uint8_t reqCookMode; - uint32_t reqCookTime; - uint8_t reqPowerSetting; - auto & cookMode = req.cookMode; - auto & cookTime = req.cookTime; - auto & powerSetting = req.powerSetting; + uint32_t reqCookTimeSec; + bool reqStartAfterSetting; + auto & cookMode = req.cookMode; + auto & cookTimeSec = req.cookTime; + auto & powerSetting = req.powerSetting; + auto & wattSettingIndex = req.wattSettingIndex; + auto & startAfterSetting = req.startAfterSetting; opState = mOpStateInstance.GetCurrentOperationalState(); VerifyOrExit(opState == to_underlying(OperationalStateEnum::kStopped), status = Status::InvalidInState); - VerifyOrExit(cookMode.HasValue() || cookTime.HasValue() || powerSetting.HasValue(), status = Status::InvalidCommand; - ChipLogError(Zcl, "Microwave Oven Control: Failed to set cooking parameters, all command fields are missing ")); + if (startAfterSetting.HasValue()) + { + VerifyOrExit( + ServerClusterCommandExists( + ConcreteCommandPath(mEndpointId, OperationalState::Id, OperationalState::Commands::Start::Id)) == Status::Success, + status = Status::InvalidCommand; + ChipLogError( + Zcl, + "Microwave Oven Control: Failed to set cooking parameters, Start command of operational state is not supported")); + } + reqStartAfterSetting = startAfterSetting.ValueOr(false); modeValue = 0; VerifyOrExit(mMicrowaveOvenModeInstance.GetModeValueByModeTag(to_underlying(MicrowaveOvenMode::ModeTag::kNormal), modeValue) == @@ -180,19 +263,68 @@ void Instance::HandleSetCookingParameters(HandlerContext & ctx, const Commands:: ChipLogError(Zcl, "Microwave Oven Control: Failed to set cookMode, Normal mode is not found")); reqCookMode = cookMode.ValueOr(modeValue); - VerifyOrExit(mMicrowaveOvenModeInstance.IsSupportedMode(reqCookMode), status = Status::InvalidCommand; + VerifyOrExit(mMicrowaveOvenModeInstance.IsSupportedMode(reqCookMode), status = Status::ConstraintError; ChipLogError(Zcl, "Microwave Oven Control: Failed to set cookMode, cookMode is not supported")); - reqCookTime = cookTime.ValueOr(MicrowaveOvenControl::kDefaultCookTime); - VerifyOrExit(IsCookTimeInRange(reqCookTime), status = Status::InvalidCommand; + reqCookTimeSec = cookTimeSec.ValueOr(MicrowaveOvenControl::kDefaultCookTimeSec); + VerifyOrExit(IsCookTimeSecondsInRange(reqCookTimeSec, mDelegate->GetMaxCookTimeSec()), status = Status::ConstraintError; ChipLogError(Zcl, "Microwave Oven Control: Failed to set cookTime, cookTime value is out of range")); - reqPowerSetting = powerSetting.ValueOr(mDelegate->GetMaxPower()); - VerifyOrExit(IsPowerSettingInRange(reqPowerSetting, mDelegate->GetMinPower(), mDelegate->GetMaxPower()), - status = Status::InvalidCommand; - ChipLogError(Zcl, "Microwave Oven Control: Failed to set cookPower, cookPower value is out of range")); - - status = mDelegate->HandleSetCookingParametersCallback(reqCookMode, reqCookTime, reqPowerSetting); + if (HasFeature(MicrowaveOvenControl::Feature::kPowerAsNumber)) + { + // if using power as number, check if the param is invalid and set PowerSetting number. + uint8_t reqPowerSettingNum; + uint8_t maxPowerNum = kDefaultMaxPowerNum; + uint8_t minPowerNum = kDefaultMinPowerNum; + uint8_t powerStepNum = kDefaultPowerStepNum; + VerifyOrExit(!wattSettingIndex.HasValue(), status = Status::InvalidCommand; ChipLogError( + Zcl, "Microwave Oven Control: Failed to set cooking parameters, should have no value for wattSettingIndex")); + + VerifyOrExit( + cookMode.HasValue() || cookTimeSec.HasValue() || powerSetting.HasValue(), status = Status::InvalidCommand; + ChipLogError(Zcl, "Microwave Oven Control: Failed to set cooking parameters, all command fields are missing ")); + + if (HasFeature(MicrowaveOvenControl::Feature::kPowerNumberLimits)) + { + maxPowerNum = mDelegate->GetMaxPowerNum(); + minPowerNum = mDelegate->GetMinPowerNum(); + powerStepNum = mDelegate->GetPowerStepNum(); + } + reqPowerSettingNum = powerSetting.ValueOr(maxPowerNum); + VerifyOrExit(IsPowerSettingNumberInRange(reqPowerSettingNum, minPowerNum, maxPowerNum), status = Status::ConstraintError; + ChipLogError(Zcl, "Microwave Oven Control: Failed to set PowerSetting, PowerSetting value is out of range")); + + VerifyOrExit( + reqPowerSettingNum % powerStepNum == 0, status = Status::InvalidCommand; ChipLogError( + Zcl, + "Microwave Oven Control: Failed to set PowerSetting, PowerSetting value must be multiple of PowerStep number")); + + status = mDelegate->HandleSetCookingParametersCallback(reqCookMode, reqCookTimeSec, reqStartAfterSetting, + MakeOptional(reqPowerSettingNum), NullOptional); + } + else + { + // if using power in watt, check if the param is invalid and set wattSettingIndex number. + uint8_t reqWattSettingIndex; + VerifyOrExit(!powerSetting.HasValue(), status = Status::InvalidCommand; ChipLogError( + Zcl, "Microwave Oven Control: Failed to set cooking parameters, should have no value for powerSetting ")); + + VerifyOrExit( + cookMode.HasValue() || cookTimeSec.HasValue() || wattSettingIndex.HasValue(), status = Status::InvalidCommand; + ChipLogError(Zcl, "Microwave Oven Control: Failed to set cooking parameters, all command fields are missing ")); + + // count of supported watt levels must greater than 0 + VerifyOrExit( + mSupportedWattLevels > 0, + ChipLogError(Zcl, "Microwave Oven Control: Failed to set wattSettingIndex, count of supported watt levels is 0")); + + reqWattSettingIndex = wattSettingIndex.ValueOr(mSupportedWattLevels - 1); + VerifyOrExit(reqWattSettingIndex <= (mSupportedWattLevels - 1), status = Status::ConstraintError; + ChipLogError(Zcl, "Microwave Oven Control: Failed to set wattSettingIndex, wattSettingIndex is out of range")); + + status = mDelegate->HandleSetCookingParametersCallback(reqCookMode, reqCookTimeSec, reqStartAfterSetting, NullOptional, + MakeOptional(reqWattSettingIndex)); + } exit: ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status); @@ -203,30 +335,30 @@ void Instance::HandleAddMoreTime(HandlerContext & ctx, const Commands::AddMoreTi ChipLogDetail(Zcl, "Microwave Oven Control: HandleAddMoreTime"); Status status; uint8_t opState; - uint32_t finalCookTime; + uint32_t finalCookTimeSec; opState = mOpStateInstance.GetCurrentOperationalState(); VerifyOrExit(opState != to_underlying(OperationalStateEnum::kError), status = Status::InvalidInState); // if the added cooking time is greater than the max cooking time, the cooking time stay unchanged. - VerifyOrExit(req.timeToAdd <= kMaxCookTime - GetCookTime(), status = Status::ConstraintError; + VerifyOrExit(req.timeToAdd + GetCookTimeSec() <= mDelegate->GetMaxCookTimeSec(), status = Status::ConstraintError; ChipLogError(Zcl, "Microwave Oven Control: Failed to set cookTime, cookTime value is out of range")); - finalCookTime = GetCookTime() + req.timeToAdd; - status = mDelegate->HandleModifyCookTimeCallback(finalCookTime); + finalCookTimeSec = GetCookTimeSec() + req.timeToAdd; + status = mDelegate->HandleModifyCookTimeSecondsCallback(finalCookTimeSec); exit: ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status); } -bool IsCookTimeInRange(uint32_t cookTime) +bool IsCookTimeSecondsInRange(uint32_t cookTimeSec, uint32_t maxCookTimeSec) { - return MicrowaveOvenControl::kMinCookTime <= cookTime && cookTime <= MicrowaveOvenControl::kMaxCookTime; + return MicrowaveOvenControl::kMinCookTimeSec <= cookTimeSec && cookTimeSec <= maxCookTimeSec; } -bool IsPowerSettingInRange(uint8_t powerSetting, uint8_t minCookPower, uint8_t maxCookPower) +bool IsPowerSettingNumberInRange(uint8_t powerSettingNum, uint8_t minCookPowerNum, uint8_t maxCookPowerNum) { - return minCookPower <= powerSetting && powerSetting <= maxCookPower; + return minCookPowerNum <= powerSettingNum && powerSettingNum <= maxCookPowerNum; } } // namespace MicrowaveOvenControl @@ -238,6 +370,5 @@ bool IsPowerSettingInRange(uint8_t powerSetting, uint8_t minCookPower, uint8_t m * * Server Init * - * @param endpoint Endpoint that is being initialized */ void MatterMicrowaveOvenControlPluginServerInitCallback() {} diff --git a/src/app/clusters/microwave-oven-control-server/microwave-oven-control-server.h b/src/app/clusters/microwave-oven-control-server/microwave-oven-control-server.h index a9f1f1f5847b3b..d82b353f7f3eb1 100644 --- a/src/app/clusters/microwave-oven-control-server/microwave-oven-control-server.h +++ b/src/app/clusters/microwave-oven-control-server/microwave-oven-control-server.h @@ -31,11 +31,11 @@ namespace app { namespace Clusters { namespace MicrowaveOvenControl { -constexpr uint32_t kDefaultCookTime = 30u; -constexpr uint8_t kDefaultPowerSetting = 100u; -constexpr uint32_t kMaxCookTime = 65535u; -constexpr uint32_t kMinCookTime = 1u; -constexpr uint16_t kDerivedModeTag = 16384u; +constexpr uint32_t kDefaultCookTimeSec = 30u; +constexpr uint32_t kMinCookTimeSec = 1u; +constexpr uint8_t kDefaultMinPowerNum = 10u; +constexpr uint8_t kDefaultMaxPowerNum = 100u; +constexpr uint8_t kDefaultPowerStepNum = 10u; class Delegate; @@ -49,12 +49,13 @@ class Instance : public CommandHandlerInterface, public AttributeAccessInterface * Note: the caller must ensure that the delegate lives throughout the instance's lifetime. * @param aEndpointId The endpoint on which this cluster exists. This must match the zap configuration. * @param aClusterId The ID of the Microwave Oven Control cluster to be instantiated. + * @param aFeature The bitmask value that identifies which features are supported by this instance. * @param aOpStateInstance The reference of Operational State Instance. * @param aMicrowaveOvenModeInstance The reference of Microwave Oven Mode Instance. * Note: a MicrowaveOvenControl instance must relies on an Operational State instance and a Microwave Oven Mode instance. * Caller must ensure those 2 instances are live and initialized before initializing MicorwaveOvenControl instance. */ - Instance(Delegate * aDelegate, EndpointId aEndpointId, ClusterId aClusterId, + Instance(Delegate * aDelegate, EndpointId aEndpointId, ClusterId aClusterId, BitMask aFeature, Clusters::OperationalState::Instance & aOpStateInstance, Clusters::ModeBase::Instance & aMicrowaveOvenModeInstance); ~Instance() override; @@ -64,31 +65,32 @@ class Instance : public CommandHandlerInterface, public AttributeAccessInterface * This function must be called after defining an Instance class object. * @return Returns an error if the given endpoint and cluster ID have not been enabled in zap or if the * CommandHandler or AttributeHandler registration fails, else returns CHIP_NO_ERROR. + * This method also checks if the feature setting is valid, if invalid it will returns CHIP_ERROR_INVALID_ARGUMENT. */ CHIP_ERROR Init(); - /** - * @brief define the get/set api for the mandatory attributes - */ - uint32_t GetCookTime() const; - void SetCookTime(uint32_t cookTime); + bool HasFeature(MicrowaveOvenControl::Feature feature) const; + + uint8_t GetCountOfSupportedWattLevels() const; - uint8_t GetPowerSetting() const; - void SetPowerSetting(uint8_t powerSetting); + uint32_t GetCookTimeSec() const; + + void SetCookTimeSec(uint32_t cookTimeSec); private: Delegate * mDelegate; EndpointId mEndpointId; ClusterId mClusterId; + BitMask mFeature; Clusters::OperationalState::Instance & mOpStateInstance; Clusters::ModeBase::Instance & mMicrowaveOvenModeInstance; - uint32_t mCookTime = kDefaultCookTime; - uint8_t mPowerSetting = kDefaultPowerSetting; + uint32_t mCookTimeSec = kDefaultCookTimeSec; + uint8_t mSupportedWattLevels = 0; /** * IM-level implementation of read - * @return appropriately mapped CHIP_ERROR if applicable (may return CHIP_IM_GLOBAL_STATUS errors) + * @return appropriately mapped CHIP_ERROR if applicable */ CHIP_ERROR Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override; @@ -125,27 +127,53 @@ class Delegate virtual ~Delegate() = default; /** - * @brief Handle Command Callback in application: SetCookingParameters - * @return Returns the Interaction Model status code which was user determined in the business logic - * @param cookMode: the user defined modes which from the Microwave Oven Mode application level - * @param cookTime: the input cook time value - * @param powerSetting: the input power setting value + * @brief Handle Command Callback in application: SetCookingParameters. + * @return Returns the Interaction Model status code which was user determined in the business logic. + * @param cookMode: the input cook mode value. Callee needs to define the cooking mode value in the Microwave Oven Mode + * instance. + * @param cookTimeSec: the input cook time value. + * @param startAfterSetting: if true, the cooking operation will start after handling the command. + * @param powerSettingNum: the input power setting value. + * @param wattSettingIndex: the input watts setting index. + * Note: powerSettingNum and wattSettingIndex must be mutually exclusive. + * If using power as number, wattSettingIndex will be set to NullOptional. + * If using power in watts, powerSettingNum will be set to NullOptional. */ - virtual Protocols::InteractionModel::Status HandleSetCookingParametersCallback(uint8_t cookMode, uint32_t cookTime, - uint8_t powerSetting) = 0; + virtual Protocols::InteractionModel::Status HandleSetCookingParametersCallback(uint8_t cookMode, uint32_t cookTimeSec, + bool startAfterSetting, + Optional powerSettingNum, + Optional wattSettingIndex) = 0; /** - * @brief Handle Command Callback in application: AddMoreTime - * @return Returns the Interaction Model status code which was user determined in the business logic - * @param finalCookTime: the cook time value after adding input time + * @brief Handle Command Callback in application: AddMoreTime. + * @return Returns the Interaction Model status code which was user determined in the business logic. + * @param finalCookTimeSec: the cook time value after adding input time. */ - virtual Protocols::InteractionModel::Status HandleModifyCookTimeCallback(uint32_t finalCookTime) = 0; + virtual Protocols::InteractionModel::Status HandleModifyCookTimeSecondsCallback(uint32_t finalCookTimeSec) = 0; + + /** + * Get the watt setting from the supported watts list. + * @param index The index of the watt setting to be returned. It is assumed that watt setting are indexable from 0 and with no + * gaps. + * @param wattSetting A reference to receive the watt setting on success. + * @return Returns a CHIP_NO_ERROR if there was no error and the label was returned successfully, + * CHIP_ERROR_NOT_FOUND if the index in beyond the list of available labels. + */ + virtual CHIP_ERROR GetWattSettingByIndex(uint8_t index, uint16_t & wattSetting) = 0; + + virtual uint32_t GetMaxCookTimeSec() const = 0; + + virtual uint8_t GetPowerSettingNum() const = 0; + + virtual uint8_t GetMinPowerNum() const = 0; + + virtual uint8_t GetMaxPowerNum() const = 0; - virtual uint8_t GetMinPower() const = 0; + virtual uint8_t GetPowerStepNum() const = 0; - virtual uint8_t GetMaxPower() const = 0; + virtual uint8_t GetCurrentWattIndex() const = 0; - virtual uint8_t GetPowerStep() const = 0; + virtual uint16_t GetWattRating() const = 0; private: friend class Instance; @@ -163,18 +191,14 @@ class Delegate }; /** - * @brief Check if the given cook time is in range - * @param cookTime cookTime that given by user + * @brief Check if the given cook time is in range. */ -bool IsCookTimeInRange(uint32_t cookTime); +bool IsCookTimeSecondsInRange(uint32_t cookTimeSec, uint32_t maxCookTimeSec); /** - * @brief Check if the given cooking power is in range - * @param powerSetting power setting that given by user - * @param minCookPower the min power setting that defined in application level - * @param maxCookPower the max power setting that defined in application level + * @brief Check if the given cooking power is in range. */ -bool IsPowerSettingInRange(uint8_t powerSetting, uint8_t minCookPower, uint8_t maxCookPower); +bool IsPowerSettingNumberInRange(uint8_t powerSettingNum, uint8_t minCookPowerNum, uint8_t maxCookPowerNum); } // namespace MicrowaveOvenControl } // namespace Clusters diff --git a/src/app/zap-templates/zcl/data-model/chip/microwave-oven-control-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/microwave-oven-control-cluster.xml index e6cb38e39a1efc..ab13fc51e10f29 100644 --- a/src/app/zap-templates/zcl/data-model/chip/microwave-oven-control-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/microwave-oven-control-cluster.xml @@ -17,6 +17,13 @@ limitations under the License. + + + + + + + Microwave Oven Control Appliances @@ -25,17 +32,23 @@ limitations under the License. MICROWAVE_OVEN_CONTROL_CLUSTER true true - CookTime - PowerSetting - MinPower - MaxPower - PowerStep + CookTime + MaxCookTime + PowerSetting + MinPower + MaxPower + PowerStep + SupportedWatts + SelectedWattIndex + WattRating Set Cooking Parameters - - - + + + + + Add More Cooking Time diff --git a/src/app/zap-templates/zcl/zcl-with-test-extensions.json b/src/app/zap-templates/zcl/zcl-with-test-extensions.json index 707947cc61558a..a39d0a58b128f9 100644 --- a/src/app/zap-templates/zcl/zcl-with-test-extensions.json +++ b/src/app/zap-templates/zcl/zcl-with-test-extensions.json @@ -345,10 +345,15 @@ "Microwave Oven Mode": ["SupportedModes", "CurrentMode", "FeatureMap"], "Microwave Oven Control": [ "CookTime", + "MaxCookTime", "PowerSetting", "MinPower", "MaxPower", - "PowerStep" + "PowerStep", + "SupportedWatts", + "SelectedWattIndex", + "WattRating", + "FeatureMap" ], "Laundry Washer Mode": [ "SupportedModes", diff --git a/src/app/zap-templates/zcl/zcl.json b/src/app/zap-templates/zcl/zcl.json index 4898e0b2e6d3b4..21f13fb7f6d14b 100644 --- a/src/app/zap-templates/zcl/zcl.json +++ b/src/app/zap-templates/zcl/zcl.json @@ -343,10 +343,15 @@ "Microwave Oven Mode": ["SupportedModes", "CurrentMode", "FeatureMap"], "Microwave Oven Control": [ "CookTime", + "MaxCookTime", "PowerSetting", "MinPower", "MaxPower", - "PowerStep" + "PowerStep", + "SupportedWatts", + "SelectedWattIndex", + "WattRating", + "FeatureMap" ], "Laundry Washer Mode": [ "SupportedModes", diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 28f9582073a57f..5f550b620b8006 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -3548,11 +3548,21 @@ provisional cluster MicrowaveOvenMode = 94 { provisional cluster MicrowaveOvenControl = 95 { revision 1; // NOTE: Default/not specifically set - readonly attribute elapsed_s cookTime = 1; - readonly attribute int8u powerSetting = 2; + bitmap Feature : bitmap32 { + kPowerAsNumber = 0x1; + kPowerInWatts = 0x2; + kPowerNumberLimits = 0x4; + } + + readonly attribute elapsed_s cookTime = 0; + readonly attribute elapsed_s maxCookTime = 1; + readonly attribute optional int8u powerSetting = 2; readonly attribute optional int8u minPower = 3; readonly attribute optional int8u maxPower = 4; readonly attribute optional int8u powerStep = 5; + readonly attribute optional int16u supportedWatts[] = 6; + readonly attribute optional int8u selectedWattIndex = 7; + readonly attribute optional int16u wattRating = 8; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -3564,6 +3574,8 @@ provisional cluster MicrowaveOvenControl = 95 { optional int8u cookMode = 0; optional elapsed_s cookTime = 1; optional int8u powerSetting = 2; + optional int8u wattSettingIndex = 3; + optional boolean startAfterSetting = 4; } request struct AddMoreTimeRequest { diff --git a/src/controller/data_model/controller-clusters.zap b/src/controller/data_model/controller-clusters.zap index 1b3b7263e52b36..9c1c09406ad207 100644 --- a/src/controller/data_model/controller-clusters.zap +++ b/src/controller/data_model/controller-clusters.zap @@ -2861,6 +2861,59 @@ } ] }, + { + "name": "Microwave Oven Control", + "code": 95, + "mfgCode": null, + "define": "MICROWAVE_OVEN_CONTROL_CLUSTER", + "side": "client", + "enabled": 1, + "apiMaturity": "provisional", + "commands": [ + { + "name": "SetCookingParameters", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "client", + "type": "bitmap32", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, { "name": "Operational State", "code": 96, diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java index ff25d92b121c8c..8eb7fcdcee4b3a 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java @@ -24412,11 +24412,15 @@ public void onSuccess(byte[] tlv) { public static class MicrowaveOvenControlCluster extends BaseChipCluster { public static final long CLUSTER_ID = 95L; - private static final long COOK_TIME_ATTRIBUTE_ID = 1L; + private static final long COOK_TIME_ATTRIBUTE_ID = 0L; + private static final long MAX_COOK_TIME_ATTRIBUTE_ID = 1L; private static final long POWER_SETTING_ATTRIBUTE_ID = 2L; private static final long MIN_POWER_ATTRIBUTE_ID = 3L; private static final long MAX_POWER_ATTRIBUTE_ID = 4L; private static final long POWER_STEP_ATTRIBUTE_ID = 5L; + private static final long SUPPORTED_WATTS_ATTRIBUTE_ID = 6L; + private static final long SELECTED_WATT_INDEX_ATTRIBUTE_ID = 7L; + private static final long WATT_RATING_ATTRIBUTE_ID = 8L; private static final long GENERATED_COMMAND_LIST_ATTRIBUTE_ID = 65528L; private static final long ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID = 65529L; private static final long EVENT_LIST_ATTRIBUTE_ID = 65530L; @@ -24434,11 +24438,11 @@ public long initWithDevice(long devicePtr, int endpointId) { return 0L; } - public void setCookingParameters(DefaultClusterCallback callback, Optional cookMode, Optional cookTime, Optional powerSetting) { - setCookingParameters(callback, cookMode, cookTime, powerSetting, 0); + public void setCookingParameters(DefaultClusterCallback callback, Optional cookMode, Optional cookTime, Optional powerSetting, Optional wattSettingIndex, Optional startAfterSetting) { + setCookingParameters(callback, cookMode, cookTime, powerSetting, wattSettingIndex, startAfterSetting, 0); } - public void setCookingParameters(DefaultClusterCallback callback, Optional cookMode, Optional cookTime, Optional powerSetting, int timedInvokeTimeoutMs) { + public void setCookingParameters(DefaultClusterCallback callback, Optional cookMode, Optional cookTime, Optional powerSetting, Optional wattSettingIndex, Optional startAfterSetting, int timedInvokeTimeoutMs) { final long commandId = 0L; ArrayList elements = new ArrayList<>(); @@ -24454,6 +24458,14 @@ public void setCookingParameters(DefaultClusterCallback callback, Optionalmap((nonOptionalpowerSetting) -> new UIntType(nonOptionalpowerSetting)).orElse(new EmptyType()); elements.add(new StructElement(powerSettingFieldID, powerSettingtlvValue)); + final long wattSettingIndexFieldID = 3L; + BaseTLVType wattSettingIndextlvValue = wattSettingIndex.map((nonOptionalwattSettingIndex) -> new UIntType(nonOptionalwattSettingIndex)).orElse(new EmptyType()); + elements.add(new StructElement(wattSettingIndexFieldID, wattSettingIndextlvValue)); + + final long startAfterSettingFieldID = 4L; + BaseTLVType startAfterSettingtlvValue = startAfterSetting.map((nonOptionalstartAfterSetting) -> new BooleanType(nonOptionalstartAfterSetting)).orElse(new EmptyType()); + elements.add(new StructElement(startAfterSettingFieldID, startAfterSettingtlvValue)); + StructType value = new StructType(elements); invoke(new InvokeCallbackImpl(callback) { @Override @@ -24482,6 +24494,10 @@ public void onResponse(StructType invokeStructValue) { }}, commandId, value, timedInvokeTimeoutMs); } + public interface SupportedWattsAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + public interface GeneratedCommandListAttributeCallback extends BaseAttributeCallback { void onSuccess(List value); } @@ -24523,6 +24539,31 @@ public void onSuccess(byte[] tlv) { }, COOK_TIME_ATTRIBUTE_ID, minInterval, maxInterval); } + public void readMaxCookTimeAttribute( + LongAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, MAX_COOK_TIME_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, MAX_COOK_TIME_ATTRIBUTE_ID, true); + } + + public void subscribeMaxCookTimeAttribute( + LongAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, MAX_COOK_TIME_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + } + }, MAX_COOK_TIME_ATTRIBUTE_ID, minInterval, maxInterval); + } + public void readPowerSettingAttribute( IntegerAttributeCallback callback) { ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, POWER_SETTING_ATTRIBUTE_ID); @@ -24623,6 +24664,81 @@ public void onSuccess(byte[] tlv) { }, POWER_STEP_ATTRIBUTE_ID, minInterval, maxInterval); } + public void readSupportedWattsAttribute( + SupportedWattsAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SUPPORTED_WATTS_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, SUPPORTED_WATTS_ATTRIBUTE_ID, true); + } + + public void subscribeSupportedWattsAttribute( + SupportedWattsAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SUPPORTED_WATTS_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + } + }, SUPPORTED_WATTS_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readSelectedWattIndexAttribute( + IntegerAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SELECTED_WATT_INDEX_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, SELECTED_WATT_INDEX_ATTRIBUTE_ID, true); + } + + public void subscribeSelectedWattIndexAttribute( + IntegerAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SELECTED_WATT_INDEX_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + } + }, SELECTED_WATT_INDEX_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readWattRatingAttribute( + IntegerAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, WATT_RATING_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, WATT_RATING_ATTRIBUTE_ID, true); + } + + public void subscribeWattRatingAttribute( + IntegerAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, WATT_RATING_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + } + }, WATT_RATING_ATTRIBUTE_ID, minInterval, maxInterval); + } + public void readGeneratedCommandListAttribute( GeneratedCommandListAttributeCallback callback) { ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GENERATED_COMMAND_LIST_ATTRIBUTE_ID); diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java index 41f10d3711f857..a1be6ce8ae6bd1 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java @@ -7913,11 +7913,15 @@ public long getID() { } public enum Attribute { - CookTime(1L), + CookTime(0L), + MaxCookTime(1L), PowerSetting(2L), MinPower(3L), MaxPower(4L), PowerStep(5L), + SupportedWatts(6L), + SelectedWattIndex(7L), + WattRating(8L), GeneratedCommandList(65528L), AcceptedCommandList(65529L), EventList(65530L), @@ -7983,7 +7987,7 @@ public static Command value(long id) throws NoSuchFieldError { } throw new NoSuchFieldError(); } - }public enum SetCookingParametersCommandField {CookMode(0),CookTime(1),PowerSetting(2),; + }public enum SetCookingParametersCommandField {CookMode(0),CookTime(1),PowerSetting(2),WattSettingIndex(3),StartAfterSetting(4),; private final int id; SetCookingParametersCommandField(int id) { this.id = id; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java index 227f5e072f447d..10007746d7dd7b 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java @@ -8539,6 +8539,27 @@ public void onError(Exception ex) { } } + public static class DelegatedMicrowaveOvenControlClusterSupportedWattsAttributeCallback implements ChipClusters.MicrowaveOvenControlCluster.SupportedWattsAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + public static class DelegatedMicrowaveOvenControlClusterGeneratedCommandListAttributeCallback implements ChipClusters.MicrowaveOvenControlCluster.GeneratedCommandListAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override @@ -22674,6 +22695,12 @@ public Map> getCommandMap() { CommandParameterInfo microwaveOvenControlsetCookingParameterspowerSettingCommandParameterInfo = new CommandParameterInfo("powerSetting", Optional.class, Integer.class); microwaveOvenControlsetCookingParametersCommandParams.put("powerSetting",microwaveOvenControlsetCookingParameterspowerSettingCommandParameterInfo); + + CommandParameterInfo microwaveOvenControlsetCookingParameterswattSettingIndexCommandParameterInfo = new CommandParameterInfo("wattSettingIndex", Optional.class, Integer.class); + microwaveOvenControlsetCookingParametersCommandParams.put("wattSettingIndex",microwaveOvenControlsetCookingParameterswattSettingIndexCommandParameterInfo); + + CommandParameterInfo microwaveOvenControlsetCookingParametersstartAfterSettingCommandParameterInfo = new CommandParameterInfo("startAfterSetting", Optional.class, Boolean.class); + microwaveOvenControlsetCookingParametersCommandParams.put("startAfterSetting",microwaveOvenControlsetCookingParametersstartAfterSettingCommandParameterInfo); InteractionInfo microwaveOvenControlsetCookingParametersInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.MicrowaveOvenControlCluster) cluster) @@ -22684,6 +22711,10 @@ public Map> getCommandMap() { commandArguments.get("cookTime") , (Optional) commandArguments.get("powerSetting") + , (Optional) + commandArguments.get("wattSettingIndex") + , (Optional) + commandArguments.get("startAfterSetting") ); }, () -> new DelegatedDefaultClusterCallback(), diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java index 35ea1ba5220d21..64a4a7a1ff08c7 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java @@ -7855,6 +7855,17 @@ private static Map readMicrowaveOvenControlInteractionI readMicrowaveOvenControlCookTimeCommandParams ); result.put("readCookTimeAttribute", readMicrowaveOvenControlCookTimeAttributeInteractionInfo); + Map readMicrowaveOvenControlMaxCookTimeCommandParams = new LinkedHashMap(); + InteractionInfo readMicrowaveOvenControlMaxCookTimeAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.MicrowaveOvenControlCluster) cluster).readMaxCookTimeAttribute( + (ChipClusters.LongAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedLongAttributeCallback(), + readMicrowaveOvenControlMaxCookTimeCommandParams + ); + result.put("readMaxCookTimeAttribute", readMicrowaveOvenControlMaxCookTimeAttributeInteractionInfo); Map readMicrowaveOvenControlPowerSettingCommandParams = new LinkedHashMap(); InteractionInfo readMicrowaveOvenControlPowerSettingAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -7899,6 +7910,39 @@ private static Map readMicrowaveOvenControlInteractionI readMicrowaveOvenControlPowerStepCommandParams ); result.put("readPowerStepAttribute", readMicrowaveOvenControlPowerStepAttributeInteractionInfo); + Map readMicrowaveOvenControlSupportedWattsCommandParams = new LinkedHashMap(); + InteractionInfo readMicrowaveOvenControlSupportedWattsAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.MicrowaveOvenControlCluster) cluster).readSupportedWattsAttribute( + (ChipClusters.MicrowaveOvenControlCluster.SupportedWattsAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedMicrowaveOvenControlClusterSupportedWattsAttributeCallback(), + readMicrowaveOvenControlSupportedWattsCommandParams + ); + result.put("readSupportedWattsAttribute", readMicrowaveOvenControlSupportedWattsAttributeInteractionInfo); + Map readMicrowaveOvenControlSelectedWattIndexCommandParams = new LinkedHashMap(); + InteractionInfo readMicrowaveOvenControlSelectedWattIndexAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.MicrowaveOvenControlCluster) cluster).readSelectedWattIndexAttribute( + (ChipClusters.IntegerAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readMicrowaveOvenControlSelectedWattIndexCommandParams + ); + result.put("readSelectedWattIndexAttribute", readMicrowaveOvenControlSelectedWattIndexAttributeInteractionInfo); + Map readMicrowaveOvenControlWattRatingCommandParams = new LinkedHashMap(); + InteractionInfo readMicrowaveOvenControlWattRatingAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.MicrowaveOvenControlCluster) cluster).readWattRatingAttribute( + (ChipClusters.IntegerAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readMicrowaveOvenControlWattRatingCommandParams + ); + result.put("readWattRatingAttribute", readMicrowaveOvenControlWattRatingAttributeInteractionInfo); Map readMicrowaveOvenControlGeneratedCommandListCommandParams = new LinkedHashMap(); InteractionInfo readMicrowaveOvenControlGeneratedCommandListAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/MicrowaveOvenControlCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/MicrowaveOvenControlCluster.kt index fdb896c19ff9aa..2548f9fdc3e725 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/MicrowaveOvenControlCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/MicrowaveOvenControlCluster.kt @@ -44,6 +44,16 @@ class MicrowaveOvenControlCluster( private val controller: MatterController, private val endpointId: UShort ) { + class SupportedWattsAttribute(val value: List?) + + sealed class SupportedWattsAttributeSubscriptionState { + data class Success(val value: List?) : SupportedWattsAttributeSubscriptionState() + + data class Error(val exception: Exception) : SupportedWattsAttributeSubscriptionState() + + object SubscriptionEstablished : SupportedWattsAttributeSubscriptionState() + } + class GeneratedCommandListAttribute(val value: List) sealed class GeneratedCommandListAttributeSubscriptionState { @@ -88,6 +98,8 @@ class MicrowaveOvenControlCluster( cookMode: UByte?, cookTime: UInt?, powerSetting: UByte?, + wattSettingIndex: UByte?, + startAfterSetting: Boolean?, timedInvokeTimeout: Duration? = null ) { val commandId: UInt = 0u @@ -103,6 +115,16 @@ class MicrowaveOvenControlCluster( val TAG_POWER_SETTING_REQ: Int = 2 powerSetting?.let { tlvWriter.put(ContextSpecificTag(TAG_POWER_SETTING_REQ), powerSetting) } + + val TAG_WATT_SETTING_INDEX_REQ: Int = 3 + wattSettingIndex?.let { + tlvWriter.put(ContextSpecificTag(TAG_WATT_SETTING_INDEX_REQ), wattSettingIndex) + } + + val TAG_START_AFTER_SETTING_REQ: Int = 4 + startAfterSetting?.let { + tlvWriter.put(ContextSpecificTag(TAG_START_AFTER_SETTING_REQ), startAfterSetting) + } tlvWriter.endStructure() val request: InvokeRequest = @@ -138,7 +160,7 @@ class MicrowaveOvenControlCluster( } suspend fun readCookTimeAttribute(): UInt { - val ATTRIBUTE_ID: UInt = 1u + val ATTRIBUTE_ID: UInt = 0u val attributePath = AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) @@ -172,7 +194,7 @@ class MicrowaveOvenControlCluster( minInterval: Int, maxInterval: Int ): Flow { - val ATTRIBUTE_ID: UInt = 1u + val ATTRIBUTE_ID: UInt = 0u val attributePaths = listOf( AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) @@ -218,7 +240,88 @@ class MicrowaveOvenControlCluster( } } - suspend fun readPowerSettingAttribute(): UByte { + suspend fun readMaxCookTimeAttribute(): UInt { + val ATTRIBUTE_ID: UInt = 1u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Maxcooktime attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UInt = tlvReader.getUInt(AnonymousTag) + + return decodedValue + } + + suspend fun subscribeMaxCookTimeAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 1u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + UIntSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Maxcooktime attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UInt = tlvReader.getUInt(AnonymousTag) + + emit(UIntSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(UIntSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readPowerSettingAttribute(): UByte? { val ATTRIBUTE_ID: UInt = 2u val attributePath = @@ -244,7 +347,12 @@ class MicrowaveOvenControlCluster( // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: UByte = tlvReader.getUByte(AnonymousTag) + val decodedValue: UByte? = + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getUByte(AnonymousTag) + } else { + null + } return decodedValue } @@ -288,9 +396,14 @@ class MicrowaveOvenControlCluster( // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: UByte = tlvReader.getUByte(AnonymousTag) + val decodedValue: UByte? = + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getUByte(AnonymousTag) + } else { + null + } - emit(UByteSubscriptionState.Success(decodedValue)) + decodedValue?.let { emit(UByteSubscriptionState.Success(it)) } } SubscriptionState.SubscriptionEstablished -> { emit(UByteSubscriptionState.SubscriptionEstablished) @@ -572,6 +685,295 @@ class MicrowaveOvenControlCluster( } } + suspend fun readSupportedWattsAttribute(): SupportedWattsAttribute { + val ATTRIBUTE_ID: UInt = 6u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Supportedwatts attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List? = + if (tlvReader.isNextTag(AnonymousTag)) { + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUShort(AnonymousTag)) + } + tlvReader.exitContainer() + } + } else { + null + } + + return SupportedWattsAttribute(decodedValue) + } + + suspend fun subscribeSupportedWattsAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 6u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + SupportedWattsAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { + "Supportedwatts attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List? = + if (tlvReader.isNextTag(AnonymousTag)) { + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUShort(AnonymousTag)) + } + tlvReader.exitContainer() + } + } else { + null + } + + decodedValue?.let { emit(SupportedWattsAttributeSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(SupportedWattsAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readSelectedWattIndexAttribute(): UByte? { + val ATTRIBUTE_ID: UInt = 7u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Selectedwattindex attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UByte? = + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getUByte(AnonymousTag) + } else { + null + } + + return decodedValue + } + + suspend fun subscribeSelectedWattIndexAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 7u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + UByteSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { + "Selectedwattindex attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UByte? = + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getUByte(AnonymousTag) + } else { + null + } + + decodedValue?.let { emit(UByteSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(UByteSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readWattRatingAttribute(): UShort? { + val ATTRIBUTE_ID: UInt = 8u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Wattrating attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UShort? = + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getUShort(AnonymousTag) + } else { + null + } + + return decodedValue + } + + suspend fun subscribeWattRatingAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 8u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + UShortSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Wattrating attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UShort? = + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getUShort(AnonymousTag) + } else { + null + } + + decodedValue?.let { emit(UShortSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(UShortSubscriptionState.SubscriptionEstablished) + } + } + } + } + suspend fun readGeneratedCommandListAttribute(): GeneratedCommandListAttribute { val ATTRIBUTE_ID: UInt = 65528u diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp index 86c0ce2e3d36f5..58910928212ab4 100644 --- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp @@ -17124,6 +17124,22 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR jnivalue, value); return value; } + case Attributes::MaxCookTime::Id: { + using TypeInfo = Attributes::MaxCookTime::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + jlong jnivalue = static_cast(cppValue); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + jnivalue, value); + return value; + } case Attributes::PowerSetting::Id: { using TypeInfo = Attributes::PowerSetting::TypeInfo; TypeInfo::DecodableType cppValue; @@ -17188,6 +17204,63 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR value); return value; } + case Attributes::SupportedWatts::Id: { + using TypeInfo = Attributes::SupportedWatts::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Integer"; + std::string newElement_0CtorSignature = "(I)V"; + jint jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::SelectedWattIndex::Id: { + using TypeInfo = Attributes::SelectedWattIndex::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + std::string valueClassName = "java/lang/Integer"; + std::string valueCtorSignature = "(I)V"; + jint jnivalue = static_cast(cppValue); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), jnivalue, + value); + return value; + } + case Attributes::WattRating::Id: { + using TypeInfo = Attributes::WattRating::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + std::string valueClassName = "java/lang/Integer"; + std::string valueCtorSignature = "(I)V"; + jint jnivalue = static_cast(cppValue); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), jnivalue, + value); + return value; + } case Attributes::GeneratedCommandList::Id: { using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; TypeInfo::DecodableType cppValue; diff --git a/src/controller/java/zap-generated/CHIPClientCallbacks.h b/src/controller/java/zap-generated/CHIPClientCallbacks.h index 23240110a76f9d..65f8b84445e99d 100644 --- a/src/controller/java/zap-generated/CHIPClientCallbacks.h +++ b/src/controller/java/zap-generated/CHIPClientCallbacks.h @@ -642,6 +642,8 @@ typedef void (*MicrowaveOvenModeEventListListAttributeCallback)(void * context, const chip::app::DataModel::DecodableList & data); typedef void (*MicrowaveOvenModeAttributeListListAttributeCallback)( void * context, const chip::app::DataModel::DecodableList & data); +typedef void (*MicrowaveOvenControlSupportedWattsListAttributeCallback)(void * context, + const chip::app::DataModel::DecodableList & data); typedef void (*MicrowaveOvenControlGeneratedCommandListListAttributeCallback)( void * context, const chip::app::DataModel::DecodableList & data); typedef void (*MicrowaveOvenControlAcceptedCommandListListAttributeCallback)( diff --git a/src/controller/java/zap-generated/CHIPReadCallbacks.cpp b/src/controller/java/zap-generated/CHIPReadCallbacks.cpp index 7dc74f00c951c0..827f73f4f74a50 100644 --- a/src/controller/java/zap-generated/CHIPReadCallbacks.cpp +++ b/src/controller/java/zap-generated/CHIPReadCallbacks.cpp @@ -26946,6 +26946,78 @@ void CHIPMicrowaveOvenModeAttributeListAttributeCallback::CallbackFn( env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); } +CHIPMicrowaveOvenControlSupportedWattsAttributeCallback::CHIPMicrowaveOvenControlSupportedWattsAttributeCallback( + jobject javaCallback, bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), + keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPMicrowaveOvenControlSupportedWattsAttributeCallback::~CHIPMicrowaveOvenControlSupportedWattsAttributeCallback() +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPMicrowaveOvenControlSupportedWattsAttributeCallback::CallbackFn(void * context, + const chip::app::DataModel::DecodableList & list) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + jobject javaCallbackRef; + + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + + std::unique_ptr cppCallback( + reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. + javaCallbackRef = cppCallback->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, + ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); + + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); + + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Integer"; + std::string newElement_0CtorSignature = "(I)V"; + jint jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), + jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(arrayListObj, newElement_0); + } + + env->ExceptionClear(); + env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); +} + CHIPMicrowaveOvenControlGeneratedCommandListAttributeCallback::CHIPMicrowaveOvenControlGeneratedCommandListAttributeCallback( jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index cdc3c3a897fb25..2c5cfc50944076 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -5500,6 +5500,8 @@ class ChipClusters: "cookMode": "int", "cookTime": "int", "powerSetting": "int", + "wattSettingIndex": "int", + "startAfterSetting": "bool", }, }, 0x00000001: { @@ -5511,8 +5513,14 @@ class ChipClusters: }, }, "attributes": { - 0x00000001: { + 0x00000000: { "attributeName": "CookTime", + "attributeId": 0x00000000, + "type": "int", + "reportable": True, + }, + 0x00000001: { + "attributeName": "MaxCookTime", "attributeId": 0x00000001, "type": "int", "reportable": True, @@ -5541,6 +5549,24 @@ class ChipClusters: "type": "int", "reportable": True, }, + 0x00000006: { + "attributeName": "SupportedWatts", + "attributeId": 0x00000006, + "type": "int", + "reportable": True, + }, + 0x00000007: { + "attributeName": "SelectedWattIndex", + "attributeId": 0x00000007, + "type": "int", + "reportable": True, + }, + 0x00000008: { + "attributeName": "WattRating", + "attributeId": 0x00000008, + "type": "int", + "reportable": True, + }, 0x0000FFF8: { "attributeName": "GeneratedCommandList", "attributeId": 0x0000FFF8, diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index de895fb0dbdbb1..6cfb1520eb2936 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -19194,11 +19194,15 @@ class MicrowaveOvenControl(Cluster): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ - ClusterObjectFieldDescriptor(Label="cookTime", Tag=0x00000001, Type=uint), - ClusterObjectFieldDescriptor(Label="powerSetting", Tag=0x00000002, Type=uint), + ClusterObjectFieldDescriptor(Label="cookTime", Tag=0x00000000, Type=uint), + ClusterObjectFieldDescriptor(Label="maxCookTime", Tag=0x00000001, Type=uint), + ClusterObjectFieldDescriptor(Label="powerSetting", Tag=0x00000002, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="minPower", Tag=0x00000003, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="maxPower", Tag=0x00000004, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="powerStep", Tag=0x00000005, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="supportedWatts", Tag=0x00000006, Type=typing.Optional[typing.List[uint]]), + ClusterObjectFieldDescriptor(Label="selectedWattIndex", Tag=0x00000007, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="wattRating", Tag=0x00000008, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="generatedCommandList", Tag=0x0000FFF8, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="acceptedCommandList", Tag=0x0000FFF9, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="eventList", Tag=0x0000FFFA, Type=typing.List[uint]), @@ -19208,10 +19212,14 @@ def descriptor(cls) -> ClusterObjectDescriptor: ]) cookTime: 'uint' = None - powerSetting: 'uint' = None + maxCookTime: 'uint' = None + powerSetting: 'typing.Optional[uint]' = None minPower: 'typing.Optional[uint]' = None maxPower: 'typing.Optional[uint]' = None powerStep: 'typing.Optional[uint]' = None + supportedWatts: 'typing.Optional[typing.List[uint]]' = None + selectedWattIndex: 'typing.Optional[uint]' = None + wattRating: 'typing.Optional[uint]' = None generatedCommandList: 'typing.List[uint]' = None acceptedCommandList: 'typing.List[uint]' = None eventList: 'typing.List[uint]' = None @@ -19219,6 +19227,12 @@ def descriptor(cls) -> ClusterObjectDescriptor: featureMap: 'uint' = None clusterRevision: 'uint' = None + class Bitmaps: + class Feature(IntFlag): + kPowerAsNumber = 0x1 + kPowerInWatts = 0x2 + kPowerNumberLimits = 0x4 + class Commands: @dataclass class SetCookingParameters(ClusterCommand): @@ -19234,11 +19248,15 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="cookMode", Tag=0, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="cookTime", Tag=1, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="powerSetting", Tag=2, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="wattSettingIndex", Tag=3, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="startAfterSetting", Tag=4, Type=typing.Optional[bool]), ]) cookMode: 'typing.Optional[uint]' = None cookTime: 'typing.Optional[uint]' = None powerSetting: 'typing.Optional[uint]' = None + wattSettingIndex: 'typing.Optional[uint]' = None + startAfterSetting: 'typing.Optional[bool]' = None @dataclass class AddMoreTime(ClusterCommand): @@ -19263,6 +19281,22 @@ class CookTime(ClusterAttributeDescriptor): def cluster_id(cls) -> int: return 0x0000005F + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000000 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + value: 'uint' = 0 + + @dataclass + class MaxCookTime(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0000005F + @ChipUtility.classproperty def attribute_id(cls) -> int: return 0x00000001 @@ -19285,9 +19319,9 @@ def attribute_id(cls) -> int: @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=uint) + return ClusterObjectFieldDescriptor(Type=typing.Optional[uint]) - value: 'uint' = 0 + value: 'typing.Optional[uint]' = None @dataclass class MinPower(ClusterAttributeDescriptor): @@ -19337,6 +19371,54 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: 'typing.Optional[uint]' = None + @dataclass + class SupportedWatts(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0000005F + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000006 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Optional[typing.List[uint]]) + + value: 'typing.Optional[typing.List[uint]]' = None + + @dataclass + class SelectedWattIndex(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0000005F + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000007 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Optional[uint]) + + value: 'typing.Optional[uint]' = None + + @dataclass + class WattRating(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0000005F + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000008 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Optional[uint]) + + value: 'typing.Optional[uint]' = None + @dataclass class GeneratedCommandList(ClusterAttributeDescriptor): @ChipUtility.classproperty diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm index 9aad3593d44f7e..61c99664562981 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm @@ -2556,6 +2556,9 @@ static BOOL AttributeIsSpecifiedInMicrowaveOvenControlCluster(AttributeId aAttri case Attributes::CookTime::Id: { return YES; } + case Attributes::MaxCookTime::Id: { + return YES; + } case Attributes::PowerSetting::Id: { return YES; } @@ -2568,6 +2571,15 @@ static BOOL AttributeIsSpecifiedInMicrowaveOvenControlCluster(AttributeId aAttri case Attributes::PowerStep::Id: { return YES; } + case Attributes::SupportedWatts::Id: { + return YES; + } + case Attributes::SelectedWattIndex::Id: { + return YES; + } + case Attributes::WattRating::Id: { + return YES; + } case Attributes::GeneratedCommandList::Id: { return YES; } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm index 3a652b6567045a..6308eacacf72f9 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm @@ -6693,6 +6693,17 @@ static id _Nullable DecodeAttributeValueForMicrowaveOvenControlCluster(Attribute value = [NSNumber numberWithUnsignedInt:cppValue]; return value; } + case Attributes::MaxCookTime::Id: { + using TypeInfo = Attributes::MaxCookTime::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } case Attributes::PowerSetting::Id: { using TypeInfo = Attributes::PowerSetting::TypeInfo; TypeInfo::DecodableType cppValue; @@ -6737,6 +6748,54 @@ static id _Nullable DecodeAttributeValueForMicrowaveOvenControlCluster(Attribute value = [NSNumber numberWithUnsignedChar:cppValue]; return value; } + case Attributes::SupportedWatts::Id: { + using TypeInfo = Attributes::SupportedWatts::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedShort:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::SelectedWattIndex::Id: { + using TypeInfo = Attributes::SelectedWattIndex::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::WattRating::Id: { + using TypeInfo = Attributes::WattRating::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } default: { break; } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h index 0ca9a134e9f8a0..1c3298fb15b308 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -6273,6 +6273,12 @@ MTR_PROVISIONALLY_AVAILABLE reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; + (void)readAttributeCookTimeWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)readAttributeMaxCookTimeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeMaxCookTimeWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeMaxCookTimeWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + - (void)readAttributePowerSettingWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - (void)subscribeAttributePowerSettingWithParams:(MTRSubscribeParams *)params subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished @@ -6297,6 +6303,24 @@ MTR_PROVISIONALLY_AVAILABLE reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; + (void)readAttributePowerStepWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)readAttributeSupportedWattsWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeSupportedWattsWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeSupportedWattsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeSelectedWattIndexWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeSelectedWattIndexWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeSelectedWattIndexWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeWattRatingWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeWattRatingWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeWattRatingWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + - (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams *)params subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished @@ -17084,6 +17108,12 @@ typedef NS_OPTIONS(uint32_t, MTRMicrowaveOvenModeFeature) { MTRMicrowaveOvenModeFeatureOnOff MTR_PROVISIONALLY_AVAILABLE = 0x1, } MTR_PROVISIONALLY_AVAILABLE; +typedef NS_OPTIONS(uint32_t, MTRMicrowaveOvenControlFeature) { + MTRMicrowaveOvenControlFeaturePowerAsNumber MTR_PROVISIONALLY_AVAILABLE = 0x1, + MTRMicrowaveOvenControlFeaturePowerInWatts MTR_PROVISIONALLY_AVAILABLE = 0x2, + MTRMicrowaveOvenControlFeaturePowerNumberLimits MTR_PROVISIONALLY_AVAILABLE = 0x4, +} MTR_PROVISIONALLY_AVAILABLE; + typedef NS_ENUM(uint8_t, MTROperationalStateErrorState) { MTROperationalStateErrorStateNoError MTR_AVAILABLE(ios(17.4), macos(14.4), watchos(10.4), tvos(17.4)) = 0x00, MTROperationalStateErrorStateUnableToStartOrResume MTR_AVAILABLE(ios(17.4), macos(14.4), watchos(10.4), tvos(17.4)) = 0x01, diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm index 7d0bda83a36c7e..1bda7cb36cd7bf 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm @@ -45451,6 +45451,42 @@ + (void)readAttributeCookTimeWithClusterStateCache:(MTRClusterStateCacheContaine completion:completion]; } +- (void)readAttributeMaxCookTimeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = MicrowaveOvenControl::Attributes::MaxCookTime::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeMaxCookTimeWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = MicrowaveOvenControl::Attributes::MaxCookTime::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeMaxCookTimeWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = MicrowaveOvenControl::Attributes::MaxCookTime::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + - (void)readAttributePowerSettingWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { using TypeInfo = MicrowaveOvenControl::Attributes::PowerSetting::TypeInfo; @@ -45595,6 +45631,114 @@ + (void)readAttributePowerStepWithClusterStateCache:(MTRClusterStateCacheContain completion:completion]; } +- (void)readAttributeSupportedWattsWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = MicrowaveOvenControl::Attributes::SupportedWatts::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeSupportedWattsWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = MicrowaveOvenControl::Attributes::SupportedWatts::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeSupportedWattsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = MicrowaveOvenControl::Attributes::SupportedWatts::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeSelectedWattIndexWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = MicrowaveOvenControl::Attributes::SelectedWattIndex::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeSelectedWattIndexWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = MicrowaveOvenControl::Attributes::SelectedWattIndex::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeSelectedWattIndexWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = MicrowaveOvenControl::Attributes::SelectedWattIndex::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeWattRatingWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = MicrowaveOvenControl::Attributes::WattRating::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeWattRatingWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = MicrowaveOvenControl::Attributes::WattRating::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeWattRatingWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = MicrowaveOvenControl::Attributes::WattRating::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + - (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { using TypeInfo = MicrowaveOvenControl::Attributes::GeneratedCommandList::TypeInfo; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h index 93cb43e3fa557b..77e169df653784 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h @@ -2458,11 +2458,15 @@ typedef NS_ENUM(uint32_t, MTRAttributeIDType) { MTRAttributeIDTypeClusterMicrowaveOvenModeAttributeClusterRevisionID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeClusterRevisionID, // Cluster MicrowaveOvenControl attributes - MTRAttributeIDTypeClusterMicrowaveOvenControlAttributeCookTimeID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, + MTRAttributeIDTypeClusterMicrowaveOvenControlAttributeCookTimeID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, + MTRAttributeIDTypeClusterMicrowaveOvenControlAttributeMaxCookTimeID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, MTRAttributeIDTypeClusterMicrowaveOvenControlAttributePowerSettingID MTR_PROVISIONALLY_AVAILABLE = 0x00000002, MTRAttributeIDTypeClusterMicrowaveOvenControlAttributeMinPowerID MTR_PROVISIONALLY_AVAILABLE = 0x00000003, MTRAttributeIDTypeClusterMicrowaveOvenControlAttributeMaxPowerID MTR_PROVISIONALLY_AVAILABLE = 0x00000004, MTRAttributeIDTypeClusterMicrowaveOvenControlAttributePowerStepID MTR_PROVISIONALLY_AVAILABLE = 0x00000005, + MTRAttributeIDTypeClusterMicrowaveOvenControlAttributeSupportedWattsID MTR_PROVISIONALLY_AVAILABLE = 0x00000006, + MTRAttributeIDTypeClusterMicrowaveOvenControlAttributeSelectedWattIndexID MTR_PROVISIONALLY_AVAILABLE = 0x00000007, + MTRAttributeIDTypeClusterMicrowaveOvenControlAttributeWattRatingID MTR_PROVISIONALLY_AVAILABLE = 0x00000008, MTRAttributeIDTypeClusterMicrowaveOvenControlAttributeGeneratedCommandListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeGeneratedCommandListID, MTRAttributeIDTypeClusterMicrowaveOvenControlAttributeAcceptedCommandListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeAcceptedCommandListID, MTRAttributeIDTypeClusterMicrowaveOvenControlAttributeEventListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeEventListID, diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h index 69f49c206f8881..6fcea80c35673e 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h @@ -2988,6 +2988,8 @@ MTR_PROVISIONALLY_AVAILABLE - (NSDictionary * _Nullable)readAttributeCookTimeWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; +- (NSDictionary * _Nullable)readAttributeMaxCookTimeWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + - (NSDictionary * _Nullable)readAttributePowerSettingWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; - (NSDictionary * _Nullable)readAttributeMinPowerWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; @@ -2996,6 +2998,12 @@ MTR_PROVISIONALLY_AVAILABLE - (NSDictionary * _Nullable)readAttributePowerStepWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; +- (NSDictionary * _Nullable)readAttributeSupportedWattsWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeSelectedWattIndexWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeWattRatingWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + - (NSDictionary * _Nullable)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; - (NSDictionary * _Nullable)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm index 977b82c6796e36..7f79d6452d3415 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm @@ -7895,6 +7895,11 @@ - (void)addMoreTimeWithParams:(MTRMicrowaveOvenControlClusterAddMoreTimeParams * return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeMicrowaveOvenControlID) attributeID:@(MTRAttributeIDTypeClusterMicrowaveOvenControlAttributeCookTimeID) params:params]; } +- (NSDictionary * _Nullable)readAttributeMaxCookTimeWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeMicrowaveOvenControlID) attributeID:@(MTRAttributeIDTypeClusterMicrowaveOvenControlAttributeMaxCookTimeID) params:params]; +} + - (NSDictionary * _Nullable)readAttributePowerSettingWithParams:(MTRReadParams * _Nullable)params { return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeMicrowaveOvenControlID) attributeID:@(MTRAttributeIDTypeClusterMicrowaveOvenControlAttributePowerSettingID) params:params]; @@ -7915,6 +7920,21 @@ - (void)addMoreTimeWithParams:(MTRMicrowaveOvenControlClusterAddMoreTimeParams * return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeMicrowaveOvenControlID) attributeID:@(MTRAttributeIDTypeClusterMicrowaveOvenControlAttributePowerStepID) params:params]; } +- (NSDictionary * _Nullable)readAttributeSupportedWattsWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeMicrowaveOvenControlID) attributeID:@(MTRAttributeIDTypeClusterMicrowaveOvenControlAttributeSupportedWattsID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeSelectedWattIndexWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeMicrowaveOvenControlID) attributeID:@(MTRAttributeIDTypeClusterMicrowaveOvenControlAttributeSelectedWattIndexID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeWattRatingWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeMicrowaveOvenControlID) attributeID:@(MTRAttributeIDTypeClusterMicrowaveOvenControlAttributeWattRatingID) params:params]; +} + - (NSDictionary * _Nullable)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params { return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeMicrowaveOvenControlID) attributeID:@(MTRAttributeIDTypeClusterMicrowaveOvenControlAttributeGeneratedCommandListID) params:params]; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h index cb450c7d8272e8..d5b65a7fbc4feb 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h @@ -4402,6 +4402,10 @@ MTR_PROVISIONALLY_AVAILABLE @property (nonatomic, copy) NSNumber * _Nullable cookTime MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSNumber * _Nullable powerSetting MTR_PROVISIONALLY_AVAILABLE; + +@property (nonatomic, copy) NSNumber * _Nullable wattSettingIndex MTR_PROVISIONALLY_AVAILABLE; + +@property (nonatomic, copy) NSNumber * _Nullable startAfterSetting MTR_PROVISIONALLY_AVAILABLE; /** * Controls whether the command is a timed command (using Timed Invoke). * diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm index 40de36e3c89929..b5472ad77833a3 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm @@ -11904,6 +11904,10 @@ - (instancetype)init _cookTime = nil; _powerSetting = nil; + + _wattSettingIndex = nil; + + _startAfterSetting = nil; _timedInvokeTimeoutMs = nil; _serverSideProcessingTimeout = nil; } @@ -11917,6 +11921,8 @@ - (id)copyWithZone:(NSZone * _Nullable)zone; other.cookMode = self.cookMode; other.cookTime = self.cookTime; other.powerSetting = self.powerSetting; + other.wattSettingIndex = self.wattSettingIndex; + other.startAfterSetting = self.startAfterSetting; other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; @@ -11925,7 +11931,7 @@ - (id)copyWithZone:(NSZone * _Nullable)zone; - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: cookMode:%@; cookTime:%@; powerSetting:%@; >", NSStringFromClass([self class]), _cookMode, _cookTime, _powerSetting]; + NSString * descriptionString = [NSString stringWithFormat:@"<%@: cookMode:%@; cookTime:%@; powerSetting:%@; wattSettingIndex:%@; startAfterSetting:%@; >", NSStringFromClass([self class]), _cookMode, _cookTime, _powerSetting, _wattSettingIndex, _startAfterSetting]; return descriptionString; } @@ -11955,6 +11961,18 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader definedValue_0 = self.powerSetting.unsignedCharValue; } } + { + if (self.wattSettingIndex != nil) { + auto & definedValue_0 = encodableStruct.wattSettingIndex.Emplace(); + definedValue_0 = self.wattSettingIndex.unsignedCharValue; + } + } + { + if (self.startAfterSetting != nil) { + auto & definedValue_0 = encodableStruct.startAfterSetting.Emplace(); + definedValue_0 = self.startAfterSetting.boolValue; + } + } auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); if (buffer.IsNull()) { diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp index e38b7822557b91..2d66ab991824ce 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp @@ -8730,37 +8730,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) namespace MicrowaveOvenControl { namespace Attributes { -namespace FeatureMap { - -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::MicrowaveOvenControl::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - *value = Traits::StorageToWorking(temp); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::MicrowaveOvenControl::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE); -} - -} // namespace FeatureMap - namespace ClusterRevision { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h index 39bac607884451..6cd63bd5d0c76c 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h @@ -1703,11 +1703,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); namespace MicrowaveOvenControl { namespace Attributes { -namespace FeatureMap { -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value); // bitmap32 -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); -} // namespace FeatureMap - namespace ClusterRevision { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // int16u EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h index ef36497d5375db..49b66ec661f0eb 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h @@ -1945,7 +1945,16 @@ enum class Feature : uint32_t }; } // namespace MicrowaveOvenMode -namespace MicrowaveOvenControl {} // namespace MicrowaveOvenControl +namespace MicrowaveOvenControl { + +// Bitmap for Feature +enum class Feature : uint32_t +{ + kPowerAsNumber = 0x1, + kPowerInWatts = 0x2, + kPowerNumberLimits = 0x4, +}; +} // namespace MicrowaveOvenControl namespace OperationalState { diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp index a9a99a79658241..e4988fdd696cd1 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp @@ -11800,6 +11800,8 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const encoder.Encode(to_underlying(Fields::kCookMode), cookMode); encoder.Encode(to_underlying(Fields::kCookTime), cookTime); encoder.Encode(to_underlying(Fields::kPowerSetting), powerSetting); + encoder.Encode(to_underlying(Fields::kWattSettingIndex), wattSettingIndex); + encoder.Encode(to_underlying(Fields::kStartAfterSetting), startAfterSetting); return encoder.Finalize(); } @@ -11829,6 +11831,14 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { err = DataModel::Decode(reader, powerSetting); } + else if (__context_tag == to_underlying(Fields::kWattSettingIndex)) + { + err = DataModel::Decode(reader, wattSettingIndex); + } + else if (__context_tag == to_underlying(Fields::kStartAfterSetting)) + { + err = DataModel::Decode(reader, startAfterSetting); + } else { } @@ -11880,6 +11890,8 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre { case Attributes::CookTime::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, cookTime); + case Attributes::MaxCookTime::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, maxCookTime); case Attributes::PowerSetting::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, powerSetting); case Attributes::MinPower::TypeInfo::GetAttributeId(): @@ -11888,6 +11900,12 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre return DataModel::Decode(reader, maxPower); case Attributes::PowerStep::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, powerStep); + case Attributes::SupportedWatts::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, supportedWatts); + case Attributes::SelectedWattIndex::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, selectedWattIndex); + case Attributes::WattRating::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, wattRating); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h index 086127558a642b..e41a226edfbdaa 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h @@ -17059,9 +17059,11 @@ namespace Commands { namespace SetCookingParameters { enum class Fields : uint8_t { - kCookMode = 0, - kCookTime = 1, - kPowerSetting = 2, + kCookMode = 0, + kCookTime = 1, + kPowerSetting = 2, + kWattSettingIndex = 3, + kStartAfterSetting = 4, }; struct Type @@ -17074,6 +17076,8 @@ struct Type Optional cookMode; Optional cookTime; Optional powerSetting; + Optional wattSettingIndex; + Optional startAfterSetting; CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; @@ -17091,6 +17095,8 @@ struct DecodableType Optional cookMode; Optional cookTime; Optional powerSetting; + Optional wattSettingIndex; + Optional startAfterSetting; CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace SetCookingParameters @@ -17142,6 +17148,18 @@ struct TypeInfo static constexpr bool MustUseTimedWrite() { return false; } }; } // namespace CookTime +namespace MaxCookTime { +struct TypeInfo +{ + using Type = uint32_t; + using DecodableType = uint32_t; + using DecodableArgType = uint32_t; + + static constexpr ClusterId GetClusterId() { return Clusters::MicrowaveOvenControl::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::MaxCookTime::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace MaxCookTime namespace PowerSetting { struct TypeInfo { @@ -17190,6 +17208,42 @@ struct TypeInfo static constexpr bool MustUseTimedWrite() { return false; } }; } // namespace PowerStep +namespace SupportedWatts { +struct TypeInfo +{ + using Type = chip::app::DataModel::List; + using DecodableType = chip::app::DataModel::DecodableList; + using DecodableArgType = const chip::app::DataModel::DecodableList &; + + static constexpr ClusterId GetClusterId() { return Clusters::MicrowaveOvenControl::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::SupportedWatts::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace SupportedWatts +namespace SelectedWattIndex { +struct TypeInfo +{ + using Type = uint8_t; + using DecodableType = uint8_t; + using DecodableArgType = uint8_t; + + static constexpr ClusterId GetClusterId() { return Clusters::MicrowaveOvenControl::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::SelectedWattIndex::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace SelectedWattIndex +namespace WattRating { +struct TypeInfo +{ + using Type = uint16_t; + using DecodableType = uint16_t; + using DecodableArgType = uint16_t; + + static constexpr ClusterId GetClusterId() { return Clusters::MicrowaveOvenControl::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::WattRating::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace WattRating namespace GeneratedCommandList { struct TypeInfo : public Clusters::Globals::Attributes::GeneratedCommandList::TypeInfo { @@ -17236,10 +17290,14 @@ struct TypeInfo CHIP_ERROR Decode(TLV::TLVReader & reader, const ConcreteAttributePath & path); Attributes::CookTime::TypeInfo::DecodableType cookTime = static_cast(0); + Attributes::MaxCookTime::TypeInfo::DecodableType maxCookTime = static_cast(0); Attributes::PowerSetting::TypeInfo::DecodableType powerSetting = static_cast(0); Attributes::MinPower::TypeInfo::DecodableType minPower = static_cast(0); Attributes::MaxPower::TypeInfo::DecodableType maxPower = static_cast(0); Attributes::PowerStep::TypeInfo::DecodableType powerStep = static_cast(0); + Attributes::SupportedWatts::TypeInfo::DecodableType supportedWatts; + Attributes::SelectedWattIndex::TypeInfo::DecodableType selectedWattIndex = static_cast(0); + Attributes::WattRating::TypeInfo::DecodableType wattRating = static_cast(0); Attributes::GeneratedCommandList::TypeInfo::DecodableType generatedCommandList; Attributes::AcceptedCommandList::TypeInfo::DecodableType acceptedCommandList; Attributes::EventList::TypeInfo::DecodableType eventList; diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h b/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h index 395b091e4add5e..62785377b59df5 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h @@ -3193,9 +3193,13 @@ namespace MicrowaveOvenControl { namespace Attributes { namespace CookTime { -static constexpr AttributeId Id = 0x00000001; +static constexpr AttributeId Id = 0x00000000; } // namespace CookTime +namespace MaxCookTime { +static constexpr AttributeId Id = 0x00000001; +} // namespace MaxCookTime + namespace PowerSetting { static constexpr AttributeId Id = 0x00000002; } // namespace PowerSetting @@ -3212,6 +3216,18 @@ namespace PowerStep { static constexpr AttributeId Id = 0x00000005; } // namespace PowerStep +namespace SupportedWatts { +static constexpr AttributeId Id = 0x00000006; +} // namespace SupportedWatts + +namespace SelectedWattIndex { +static constexpr AttributeId Id = 0x00000007; +} // namespace SelectedWattIndex + +namespace WattRating { +static constexpr AttributeId Id = 0x00000008; +} // namespace WattRating + namespace GeneratedCommandList { static constexpr AttributeId Id = Globals::Attributes::GeneratedCommandList::Id; } // namespace GeneratedCommandList diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index f90d86b9afbc57..c1e1d69f59d802 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -5388,11 +5388,15 @@ class DishwasherAlarmModifyEnabledAlarms : public ClusterCommand | * AddMoreTime | 0x01 | |------------------------------------------------------------------------------| | Attributes: | | -| * CookTime | 0x0001 | +| * CookTime | 0x0000 | +| * MaxCookTime | 0x0001 | | * PowerSetting | 0x0002 | | * MinPower | 0x0003 | | * MaxPower | 0x0004 | | * PowerStep | 0x0005 | +| * SupportedWatts | 0x0006 | +| * SelectedWattIndex | 0x0007 | +| * WattRating | 0x0008 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | @@ -5415,6 +5419,8 @@ class MicrowaveOvenControlSetCookingParameters : public ClusterCommand AddArgument("CookMode", 0, UINT8_MAX, &mRequest.cookMode); AddArgument("CookTime", 0, UINT32_MAX, &mRequest.cookTime); AddArgument("PowerSetting", 0, UINT8_MAX, &mRequest.powerSetting); + AddArgument("WattSettingIndex", 0, UINT8_MAX, &mRequest.wattSettingIndex); + AddArgument("StartAfterSetting", 0, 1, &mRequest.startAfterSetting); ClusterCommand::AddArguments(); } @@ -19180,10 +19186,14 @@ void registerClusterMicrowaveOvenControl(Commands & commands, CredentialIssuerCo // make_unique(Id, credsIssuerConfig), // make_unique(Id, "cook-time", Attributes::CookTime::Id, credsIssuerConfig), // + make_unique(Id, "max-cook-time", Attributes::MaxCookTime::Id, credsIssuerConfig), // make_unique(Id, "power-setting", Attributes::PowerSetting::Id, credsIssuerConfig), // make_unique(Id, "min-power", Attributes::MinPower::Id, credsIssuerConfig), // make_unique(Id, "max-power", Attributes::MaxPower::Id, credsIssuerConfig), // make_unique(Id, "power-step", Attributes::PowerStep::Id, credsIssuerConfig), // + make_unique(Id, "supported-watts", Attributes::SupportedWatts::Id, credsIssuerConfig), // + make_unique(Id, "selected-watt-index", Attributes::SelectedWattIndex::Id, credsIssuerConfig), // + make_unique(Id, "watt-rating", Attributes::WattRating::Id, credsIssuerConfig), // make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // make_unique(Id, "event-list", Attributes::EventList::Id, credsIssuerConfig), // @@ -19193,6 +19203,8 @@ void registerClusterMicrowaveOvenControl(Commands & commands, CredentialIssuerCo make_unique>(Id, credsIssuerConfig), // make_unique>(Id, "cook-time", 0, UINT32_MAX, Attributes::CookTime::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>(Id, "max-cook-time", 0, UINT32_MAX, Attributes::MaxCookTime::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>(Id, "power-setting", 0, UINT8_MAX, Attributes::PowerSetting::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>(Id, "min-power", 0, UINT8_MAX, Attributes::MinPower::Id, WriteCommandType::kForceWrite, @@ -19201,6 +19213,12 @@ void registerClusterMicrowaveOvenControl(Commands & commands, CredentialIssuerCo credsIssuerConfig), // make_unique>(Id, "power-step", 0, UINT8_MAX, Attributes::PowerStep::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "supported-watts", Attributes::SupportedWatts::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>(Id, "selected-watt-index", 0, UINT8_MAX, Attributes::SelectedWattIndex::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>(Id, "watt-rating", 0, UINT16_MAX, Attributes::WattRating::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>>( Id, "generated-command-list", Attributes::GeneratedCommandList::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // @@ -19216,10 +19234,14 @@ void registerClusterMicrowaveOvenControl(Commands & commands, CredentialIssuerCo WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique(Id, credsIssuerConfig), // make_unique(Id, "cook-time", Attributes::CookTime::Id, credsIssuerConfig), // + make_unique(Id, "max-cook-time", Attributes::MaxCookTime::Id, credsIssuerConfig), // make_unique(Id, "power-setting", Attributes::PowerSetting::Id, credsIssuerConfig), // make_unique(Id, "min-power", Attributes::MinPower::Id, credsIssuerConfig), // make_unique(Id, "max-power", Attributes::MaxPower::Id, credsIssuerConfig), // make_unique(Id, "power-step", Attributes::PowerStep::Id, credsIssuerConfig), // + make_unique(Id, "supported-watts", Attributes::SupportedWatts::Id, credsIssuerConfig), // + make_unique(Id, "selected-watt-index", Attributes::SelectedWattIndex::Id, credsIssuerConfig), // + make_unique(Id, "watt-rating", Attributes::WattRating::Id, credsIssuerConfig), // make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // make_unique(Id, "event-list", Attributes::EventList::Id, credsIssuerConfig), // diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp index 8b045be0c9ff46..d38c78eded3f2b 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -11475,6 +11475,11 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("CookTime", 1, value); } + case MicrowaveOvenControl::Attributes::MaxCookTime::Id: { + uint32_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("MaxCookTime", 1, value); + } case MicrowaveOvenControl::Attributes::PowerSetting::Id: { uint8_t value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); @@ -11495,6 +11500,21 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("PowerStep", 1, value); } + case MicrowaveOvenControl::Attributes::SupportedWatts::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("SupportedWatts", 1, value); + } + case MicrowaveOvenControl::Attributes::SelectedWattIndex::Id: { + uint8_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("SelectedWattIndex", 1, value); + } + case MicrowaveOvenControl::Attributes::WattRating::Id: { + uint16_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("WattRating", 1, value); + } case MicrowaveOvenControl::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); diff --git a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h index b465678ccd9fe0..49fd07683ab36e 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -65764,11 +65764,15 @@ class SubscribeAttributeMicrowaveOvenModeClusterRevision : public SubscribeAttri | * AddMoreTime | 0x01 | |------------------------------------------------------------------------------| | Attributes: | | -| * CookTime | 0x0001 | +| * CookTime | 0x0000 | +| * MaxCookTime | 0x0001 | | * PowerSetting | 0x0002 | | * MinPower | 0x0003 | | * MaxPower | 0x0004 | | * PowerStep | 0x0005 | +| * SupportedWatts | 0x0006 | +| * SelectedWattIndex | 0x0007 | +| * WattRating | 0x0008 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | @@ -65796,6 +65800,12 @@ class MicrowaveOvenControlSetCookingParameters : public ClusterCommand { #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("PowerSetting", 0, UINT8_MAX, &mRequest.powerSetting); +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + AddArgument("WattSettingIndex", 0, UINT8_MAX, &mRequest.wattSettingIndex); +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + AddArgument("StartAfterSetting", 0, 1, &mRequest.startAfterSetting); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } @@ -65831,6 +65841,20 @@ class MicrowaveOvenControlSetCookingParameters : public ClusterCommand { } else { params.powerSetting = nil; } +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + if (mRequest.wattSettingIndex.HasValue()) { + params.wattSettingIndex = [NSNumber numberWithUnsignedChar:mRequest.wattSettingIndex.Value()]; + } else { + params.wattSettingIndex = nil; + } +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + if (mRequest.startAfterSetting.HasValue()) { + params.startAfterSetting = [NSNumber numberWithBool:mRequest.startAfterSetting.Value()]; + } else { + params.startAfterSetting = nil; + } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; @@ -65997,6 +66021,91 @@ class SubscribeAttributeMicrowaveOvenControlCookTime : public SubscribeAttribute #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL +/* + * Attribute MaxCookTime + */ +class ReadMicrowaveOvenControlMaxCookTime : public ReadAttribute { +public: + ReadMicrowaveOvenControlMaxCookTime() + : ReadAttribute("max-cook-time") + { + } + + ~ReadMicrowaveOvenControlMaxCookTime() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::MicrowaveOvenControl::Attributes::MaxCookTime::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeMaxCookTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"MicrowaveOvenControl.MaxCookTime response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("MicrowaveOvenControl MaxCookTime read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeMicrowaveOvenControlMaxCookTime : public SubscribeAttribute { +public: + SubscribeAttributeMicrowaveOvenControlMaxCookTime() + : SubscribeAttribute("max-cook-time") + { + } + + ~SubscribeAttributeMicrowaveOvenControlMaxCookTime() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenControl::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::MicrowaveOvenControl::Attributes::MaxCookTime::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeMaxCookTimeWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"MicrowaveOvenControl.MaxCookTime response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + /* * Attribute PowerSetting */ @@ -66337,6 +66446,261 @@ class SubscribeAttributeMicrowaveOvenControlPowerStep : public SubscribeAttribut #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL +/* + * Attribute SupportedWatts + */ +class ReadMicrowaveOvenControlSupportedWatts : public ReadAttribute { +public: + ReadMicrowaveOvenControlSupportedWatts() + : ReadAttribute("supported-watts") + { + } + + ~ReadMicrowaveOvenControlSupportedWatts() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::MicrowaveOvenControl::Attributes::SupportedWatts::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeSupportedWattsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"MicrowaveOvenControl.SupportedWatts response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("MicrowaveOvenControl SupportedWatts read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeMicrowaveOvenControlSupportedWatts : public SubscribeAttribute { +public: + SubscribeAttributeMicrowaveOvenControlSupportedWatts() + : SubscribeAttribute("supported-watts") + { + } + + ~SubscribeAttributeMicrowaveOvenControlSupportedWatts() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenControl::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::MicrowaveOvenControl::Attributes::SupportedWatts::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeSupportedWattsWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"MicrowaveOvenControl.SupportedWatts response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute SelectedWattIndex + */ +class ReadMicrowaveOvenControlSelectedWattIndex : public ReadAttribute { +public: + ReadMicrowaveOvenControlSelectedWattIndex() + : ReadAttribute("selected-watt-index") + { + } + + ~ReadMicrowaveOvenControlSelectedWattIndex() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::MicrowaveOvenControl::Attributes::SelectedWattIndex::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeSelectedWattIndexWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"MicrowaveOvenControl.SelectedWattIndex response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("MicrowaveOvenControl SelectedWattIndex read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeMicrowaveOvenControlSelectedWattIndex : public SubscribeAttribute { +public: + SubscribeAttributeMicrowaveOvenControlSelectedWattIndex() + : SubscribeAttribute("selected-watt-index") + { + } + + ~SubscribeAttributeMicrowaveOvenControlSelectedWattIndex() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenControl::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::MicrowaveOvenControl::Attributes::SelectedWattIndex::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeSelectedWattIndexWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"MicrowaveOvenControl.SelectedWattIndex response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute WattRating + */ +class ReadMicrowaveOvenControlWattRating : public ReadAttribute { +public: + ReadMicrowaveOvenControlWattRating() + : ReadAttribute("watt-rating") + { + } + + ~ReadMicrowaveOvenControlWattRating() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::MicrowaveOvenControl::Attributes::WattRating::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeWattRatingWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"MicrowaveOvenControl.WattRating response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("MicrowaveOvenControl WattRating read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeMicrowaveOvenControlWattRating : public SubscribeAttribute { +public: + SubscribeAttributeMicrowaveOvenControlWattRating() + : SubscribeAttribute("watt-rating") + { + } + + ~SubscribeAttributeMicrowaveOvenControlWattRating() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenControl::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::MicrowaveOvenControl::Attributes::WattRating::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeWattRatingWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"MicrowaveOvenControl.WattRating response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + /* * Attribute GeneratedCommandList */ @@ -180328,6 +180692,10 @@ void registerClusterMicrowaveOvenControl(Commands & commands) make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // @@ -180344,6 +180712,18 @@ void registerClusterMicrowaveOvenControl(Commands & commands) make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), //