From 0be1817a51461d84ff455be5f3d7904d5dfb07ef Mon Sep 17 00:00:00 2001 From: Mathieu Kardous Date: Tue, 28 Sep 2021 09:19:35 -0400 Subject: [PATCH 1/3] Change transitionTime back to uint8 --- .../color-control-server/color-control-server.cpp | 10 +++++----- .../color-control-server/color-control-server.h | 2 +- src/app/zap-templates/zcl/data-model/silabs/ha.xml | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/app/clusters/color-control-server/color-control-server.cpp b/src/app/clusters/color-control-server/color-control-server.cpp index 23df2937830284..26afc65a853b7a 100644 --- a/src/app/clusters/color-control-server/color-control-server.cpp +++ b/src/app/clusters/color-control-server/color-control-server.cpp @@ -1288,7 +1288,7 @@ bool ColorControlServer::moveToSaturationCommand(uint8_t saturation, uint16_t tr return true; } -bool ColorControlServer::stepSaturationCommand(uint8_t stepMode, uint8_t stepSize, uint16_t transitionTime, uint8_t optionsMask, +bool ColorControlServer::stepSaturationCommand(uint8_t stepMode, uint8_t stepSize, uint8_t transitionTime, uint8_t optionsMask, uint8_t optionsOverride) { EndpointId endpoint = emberAfCurrentEndpoint(); @@ -2320,15 +2320,15 @@ bool emberAfColorControlClusterMoveToHueAndSaturationCallback(EndpointId endpoin } bool emberAfColorControlClusterStepHueCallback(EndpointId endpoint, app::CommandHandler * commandObj, uint8_t stepMode, - uint8_t stepSize, uint16_t transitionTime, uint8_t optionsMask, + uint8_t stepSize, uint8_t transitionTime, uint8_t optionsMask, uint8_t optionsOverride) { - return ColorControlServer::Instance().stepHueCommand(stepMode, static_cast(stepSize), transitionTime, optionsMask, - optionsOverride, false); + return ColorControlServer::Instance().stepHueCommand( + stepMode, static_cast(stepSize), static_cast(transitionTime), optionsMask, optionsOverride, false); } bool emberAfColorControlClusterStepSaturationCallback(EndpointId aEndpoint, app::CommandHandler * commandObj, uint8_t stepMode, - uint8_t stepSize, uint16_t transitionTime, uint8_t optionsMask, + uint8_t stepSize, uint8_t transitionTime, uint8_t optionsMask, uint8_t optionsOverride) { return ColorControlServer::Instance().stepSaturationCommand(stepMode, stepSize, transitionTime, optionsMask, optionsOverride); diff --git a/src/app/clusters/color-control-server/color-control-server.h b/src/app/clusters/color-control-server/color-control-server.h index 43560da8509537..763d292c20185b 100644 --- a/src/app/clusters/color-control-server/color-control-server.h +++ b/src/app/clusters/color-control-server/color-control-server.h @@ -154,7 +154,7 @@ class ColorControlServer bool isEnhanced); bool moveSaturationCommand(uint8_t moveMode, uint8_t rate, uint8_t optionsMask, uint8_t optionsOverride); bool moveToSaturationCommand(uint8_t saturation, uint16_t transitionTime, uint8_t optionsMask, uint8_t optionsOverride); - bool stepSaturationCommand(uint8_t stepMode, uint8_t stepSize, uint16_t transitionTime, uint8_t optionsMask, + bool stepSaturationCommand(uint8_t stepMode, uint8_t stepSize, uint8_t transitionTime, uint8_t optionsMask, uint8_t optionsOverride); bool colorLoopCommand(uint8_t updateFlags, uint8_t action, uint8_t direction, uint16_t time, uint16_t startHue, uint8_t optionsMask, uint8_t optionsOverride); diff --git a/src/app/zap-templates/zcl/data-model/silabs/ha.xml b/src/app/zap-templates/zcl/data-model/silabs/ha.xml index 45f9720bee7fff..9c4d5ebed26798 100644 --- a/src/app/zap-templates/zcl/data-model/silabs/ha.xml +++ b/src/app/zap-templates/zcl/data-model/silabs/ha.xml @@ -311,7 +311,7 @@ limitations under the License. - + @@ -339,7 +339,7 @@ limitations under the License. - + From f382e2ce03b8587acdefc9fd5e45295dfefcfb66 Mon Sep 17 00:00:00 2001 From: Mathieu Kardous Date: Tue, 28 Sep 2021 09:19:52 -0400 Subject: [PATCH 2/3] Generated code --- .../python/chip/clusters/CHIPClusters.cpp | 7 +- .../python/chip/clusters/CHIPClusters.py | 4 +- .../CHIP/zap-generated/CHIPClustersObjc.h | 4 +- .../CHIP/zap-generated/CHIPClustersObjc.mm | 4 +- .../Framework/CHIPTests/CHIPClustersTests.m | 8 +- .../zap-generated/IMClusterCommandHandler.cpp | 4 +- .../app-common/zap-generated/callback.h | 4 +- .../zap-generated/client-command-macro.h | 4 +- .../zap-generated/cluster/Commands.h | 8 +- .../chip-tool/zap-generated/test/Commands.h | 8 +- .../zap-generated/CHIPClusters.cpp | 8 +- .../zap-generated/CHIPClusters.h | 4 +- .../zap-generated/CHIPClusters.cpp | 132 ++++++++++++++++++ .../lighting-app/zap-generated/CHIPClusters.h | 10 ++ .../zap-generated/IMClusterCommandHandler.cpp | 57 +------- .../zap-generated/IMClusterCommandHandler.cpp | 4 +- .../zap-generated/IMClusterCommandHandler.cpp | 4 +- 17 files changed, 182 insertions(+), 92 deletions(-) diff --git a/src/controller/python/chip/clusters/CHIPClusters.cpp b/src/controller/python/chip/clusters/CHIPClusters.cpp index 4c83d3efb9eb52..c823eca0e2a48b 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.cpp +++ b/src/controller/python/chip/clusters/CHIPClusters.cpp @@ -1412,9 +1412,8 @@ chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_StepColorTemper } chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_StepHue(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId, - uint8_t stepMode, uint8_t stepSize, - uint16_t transitionTime, uint8_t optionsMask, - uint8_t optionsOverride) + uint8_t stepMode, uint8_t stepSize, uint8_t transitionTime, + uint8_t optionsMask, uint8_t optionsOverride) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; @@ -1424,7 +1423,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_StepHue(chip::C chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_StepSaturation(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t stepMode, uint8_t stepSize, - uint16_t transitionTime, uint8_t optionsMask, + uint8_t transitionTime, uint8_t optionsMask, uint8_t optionsOverride) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index 310bb676a4a25c..e45e186d873955 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -5862,10 +5862,10 @@ def InitLib(self, chipLib): self._chipLib.chip_ime_AppendCommand_ColorControl_StepColorTemperature.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint16, ctypes.c_uint16, ctypes.c_uint16, ctypes.c_uint8, ctypes.c_uint8] self._chipLib.chip_ime_AppendCommand_ColorControl_StepColorTemperature.restype = ctypes.c_uint32 # Cluster ColorControl Command StepHue - self._chipLib.chip_ime_AppendCommand_ColorControl_StepHue.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint8, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint8, ctypes.c_uint8] + self._chipLib.chip_ime_AppendCommand_ColorControl_StepHue.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint8, ctypes.c_uint8, ctypes.c_uint8, ctypes.c_uint8, ctypes.c_uint8] self._chipLib.chip_ime_AppendCommand_ColorControl_StepHue.restype = ctypes.c_uint32 # Cluster ColorControl Command StepSaturation - self._chipLib.chip_ime_AppendCommand_ColorControl_StepSaturation.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint8, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint8, ctypes.c_uint8] + self._chipLib.chip_ime_AppendCommand_ColorControl_StepSaturation.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint8, ctypes.c_uint8, ctypes.c_uint8, ctypes.c_uint8, ctypes.c_uint8] self._chipLib.chip_ime_AppendCommand_ColorControl_StepSaturation.restype = ctypes.c_uint32 # Cluster ColorControl Command StopMoveStep self._chipLib.chip_ime_AppendCommand_ColorControl_StopMoveStep.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint8, ctypes.c_uint8] diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h index 2d79e01c840c41..df1cd2930ce873 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h @@ -386,13 +386,13 @@ NS_ASSUME_NONNULL_BEGIN responseHandler:(ResponseHandler)responseHandler; - (void)stepHue:(uint8_t)stepMode stepSize:(uint8_t)stepSize - transitionTime:(uint16_t)transitionTime + transitionTime:(uint8_t)transitionTime optionsMask:(uint8_t)optionsMask optionsOverride:(uint8_t)optionsOverride responseHandler:(ResponseHandler)responseHandler; - (void)stepSaturation:(uint8_t)stepMode stepSize:(uint8_t)stepSize - transitionTime:(uint16_t)transitionTime + transitionTime:(uint8_t)transitionTime optionsMask:(uint8_t)optionsMask optionsOverride:(uint8_t)optionsOverride responseHandler:(ResponseHandler)responseHandler; diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm index 5b253a1dd2b758..faa822e2432b8b 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm @@ -951,7 +951,7 @@ new CHIPDefaultSuccessCallbackBridge(self.callbackQueue, responseHandler, ^(Canc - (void)stepHue:(uint8_t)stepMode stepSize:(uint8_t)stepSize - transitionTime:(uint16_t)transitionTime + transitionTime:(uint8_t)transitionTime optionsMask:(uint8_t)optionsMask optionsOverride:(uint8_t)optionsOverride responseHandler:(ResponseHandler)responseHandler @@ -963,7 +963,7 @@ new CHIPDefaultSuccessCallbackBridge(self.callbackQueue, responseHandler, ^(Canc - (void)stepSaturation:(uint8_t)stepMode stepSize:(uint8_t)stepSize - transitionTime:(uint16_t)transitionTime + transitionTime:(uint8_t)transitionTime optionsMask:(uint8_t)optionsMask optionsOverride:(uint8_t)optionsOverride responseHandler:(ResponseHandler)responseHandler diff --git a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m index 9a96c8e313097b..343712676915a7 100644 --- a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m +++ b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m @@ -4337,7 +4337,7 @@ - (void)testSendClusterTest_TC_CC_3_4_000010_StepHue uint8_t stepModeArgument = 1; uint8_t stepSizeArgument = 5; - uint16_t transitionTimeArgument = 25U; + uint8_t transitionTimeArgument = 25; uint8_t optionsMaskArgument = 0; uint8_t optionsOverrideArgument = 0; [cluster stepHue:stepModeArgument @@ -4366,7 +4366,7 @@ - (void)testSendClusterTest_TC_CC_3_4_000011_StepHue uint8_t stepModeArgument = 3; uint8_t stepSizeArgument = 5; - uint16_t transitionTimeArgument = 25U; + uint8_t transitionTimeArgument = 25; uint8_t optionsMaskArgument = 0; uint8_t optionsOverrideArgument = 0; [cluster stepHue:stepModeArgument @@ -4476,7 +4476,7 @@ - (void)testSendClusterTest_TC_CC_3_4_000015_StepSaturation uint8_t stepModeArgument = 1; uint8_t stepSizeArgument = 15; - uint16_t transitionTimeArgument = 10U; + uint8_t transitionTimeArgument = 10; uint8_t optionsMaskArgument = 0; uint8_t optionsOverrideArgument = 0; [cluster stepSaturation:stepModeArgument @@ -4505,7 +4505,7 @@ - (void)testSendClusterTest_TC_CC_3_4_000016_StepSaturation uint8_t stepModeArgument = 3; uint8_t stepSizeArgument = 20; - uint16_t transitionTimeArgument = 10U; + uint8_t transitionTimeArgument = 10; uint8_t optionsMaskArgument = 0; uint8_t optionsOverrideArgument = 0; [cluster stepSaturation:stepModeArgument diff --git a/zzz_generated/all-clusters-app/zap-generated/IMClusterCommandHandler.cpp b/zzz_generated/all-clusters-app/zap-generated/IMClusterCommandHandler.cpp index 95abb963bcf9f3..86d7cf335fdac9 100644 --- a/zzz_generated/all-clusters-app/zap-generated/IMClusterCommandHandler.cpp +++ b/zzz_generated/all-clusters-app/zap-generated/IMClusterCommandHandler.cpp @@ -1761,7 +1761,7 @@ void DispatchServerCommand(CommandHandler * apCommandObj, CommandId aCommandId, expectArgumentCount = 5; uint8_t stepMode; uint8_t stepSize; - uint16_t transitionTime; + uint8_t transitionTime; uint8_t optionsMask; uint8_t optionsOverride; bool argExists[5]; @@ -1836,7 +1836,7 @@ void DispatchServerCommand(CommandHandler * apCommandObj, CommandId aCommandId, expectArgumentCount = 5; uint8_t stepMode; uint8_t stepSize; - uint16_t transitionTime; + uint8_t transitionTime; uint8_t optionsMask; uint8_t optionsOverride; bool argExists[5]; diff --git a/zzz_generated/app-common/app-common/zap-generated/callback.h b/zzz_generated/app-common/app-common/zap-generated/callback.h index 3f05007e9644ac..29bfc59190d948 100644 --- a/zzz_generated/app-common/app-common/zap-generated/callback.h +++ b/zzz_generated/app-common/app-common/zap-generated/callback.h @@ -16317,7 +16317,7 @@ bool emberAfColorControlClusterMoveHueCallback(chip::EndpointId endpoint, chip:: * @brief Color Control Cluster StepHue Command callback (from client) */ bool emberAfColorControlClusterStepHueCallback(chip::EndpointId endpoint, chip::app::CommandHandler * commandObj, uint8_t stepMode, - uint8_t stepSize, uint16_t transitionTime, uint8_t optionsMask, + uint8_t stepSize, uint8_t transitionTime, uint8_t optionsMask, uint8_t optionsOverride); /** * @brief Color Control Cluster MoveToSaturation Command callback (from client) @@ -16334,7 +16334,7 @@ bool emberAfColorControlClusterMoveSaturationCallback(chip::EndpointId endpoint, * @brief Color Control Cluster StepSaturation Command callback (from client) */ bool emberAfColorControlClusterStepSaturationCallback(chip::EndpointId endpoint, chip::app::CommandHandler * commandObj, - uint8_t stepMode, uint8_t stepSize, uint16_t transitionTime, + uint8_t stepMode, uint8_t stepSize, uint8_t transitionTime, uint8_t optionsMask, uint8_t optionsOverride); /** * @brief Color Control Cluster MoveToHueAndSaturation Command callback (from client) diff --git a/zzz_generated/app-common/app-common/zap-generated/client-command-macro.h b/zzz_generated/app-common/app-common/zap-generated/client-command-macro.h index 19efcb980118ca..68f520d95f2cd8 100644 --- a/zzz_generated/app-common/app-common/zap-generated/client-command-macro.h +++ b/zzz_generated/app-common/app-common/zap-generated/client-command-macro.h @@ -3413,7 +3413,7 @@ * Command: StepHue * @param stepMode HueStepMode * @param stepSize INT8U - * @param transitionTime INT16U + * @param transitionTime INT8U * @param optionsMask BITMAP8 * @param optionsOverride BITMAP8 */ @@ -3456,7 +3456,7 @@ * Command: StepSaturation * @param stepMode SaturationStepMode * @param stepSize INT8U - * @param transitionTime INT16U + * @param transitionTime INT8U * @param optionsMask BITMAP8 * @param optionsOverride BITMAP8 */ diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index 1a3f734250f775..a83a8afdd77666 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -5067,7 +5067,7 @@ class ColorControlStepHue : public ModelCommand { AddArgument("StepMode", 0, UINT8_MAX, &mStepMode); AddArgument("StepSize", 0, UINT8_MAX, &mStepSize); - AddArgument("TransitionTime", 0, UINT16_MAX, &mTransitionTime); + AddArgument("TransitionTime", 0, UINT8_MAX, &mTransitionTime); AddArgument("OptionsMask", 0, UINT8_MAX, &mOptionsMask); AddArgument("OptionsOverride", 0, UINT8_MAX, &mOptionsOverride); ModelCommand::AddArguments(); @@ -5095,7 +5095,7 @@ class ColorControlStepHue : public ModelCommand new chip::Callback::Callback(OnDefaultFailureResponse, this); uint8_t mStepMode; uint8_t mStepSize; - uint16_t mTransitionTime; + uint8_t mTransitionTime; uint8_t mOptionsMask; uint8_t mOptionsOverride; }; @@ -5110,7 +5110,7 @@ class ColorControlStepSaturation : public ModelCommand { AddArgument("StepMode", 0, UINT8_MAX, &mStepMode); AddArgument("StepSize", 0, UINT8_MAX, &mStepSize); - AddArgument("TransitionTime", 0, UINT16_MAX, &mTransitionTime); + AddArgument("TransitionTime", 0, UINT8_MAX, &mTransitionTime); AddArgument("OptionsMask", 0, UINT8_MAX, &mOptionsMask); AddArgument("OptionsOverride", 0, UINT8_MAX, &mOptionsOverride); ModelCommand::AddArguments(); @@ -5138,7 +5138,7 @@ class ColorControlStepSaturation : public ModelCommand new chip::Callback::Callback(OnDefaultFailureResponse, this); uint8_t mStepMode; uint8_t mStepSize; - uint16_t mTransitionTime; + uint8_t mTransitionTime; uint8_t mOptionsMask; uint8_t mOptionsOverride; }; diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index ce3581966b8116..2280f79a46dec2 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -8446,7 +8446,7 @@ class Test_TC_CC_3_4 : public TestCommand uint8_t stepModeArgument = 1; uint8_t stepSizeArgument = 5; - uint16_t transitionTimeArgument = 25U; + uint8_t transitionTimeArgument = 25; uint8_t optionsMaskArgument = 0; uint8_t optionsOverrideArgument = 0; @@ -8465,7 +8465,7 @@ class Test_TC_CC_3_4 : public TestCommand uint8_t stepModeArgument = 3; uint8_t stepSizeArgument = 5; - uint16_t transitionTimeArgument = 25U; + uint8_t transitionTimeArgument = 25; uint8_t optionsMaskArgument = 0; uint8_t optionsOverrideArgument = 0; @@ -8538,7 +8538,7 @@ class Test_TC_CC_3_4 : public TestCommand uint8_t stepModeArgument = 1; uint8_t stepSizeArgument = 15; - uint16_t transitionTimeArgument = 10U; + uint8_t transitionTimeArgument = 10; uint8_t optionsMaskArgument = 0; uint8_t optionsOverrideArgument = 0; @@ -8557,7 +8557,7 @@ class Test_TC_CC_3_4 : public TestCommand uint8_t stepModeArgument = 3; uint8_t stepSizeArgument = 20; - uint16_t transitionTimeArgument = 10U; + uint8_t transitionTimeArgument = 10; uint8_t optionsMaskArgument = 0; uint8_t optionsOverrideArgument = 0; diff --git a/zzz_generated/controller-clusters/zap-generated/CHIPClusters.cpp b/zzz_generated/controller-clusters/zap-generated/CHIPClusters.cpp index 320083ba999c95..446fcad66af41c 100644 --- a/zzz_generated/controller-clusters/zap-generated/CHIPClusters.cpp +++ b/zzz_generated/controller-clusters/zap-generated/CHIPClusters.cpp @@ -2336,7 +2336,7 @@ CHIP_ERROR ColorControlCluster::StepColorTemperature(Callback::Cancelable * onSu } CHIP_ERROR ColorControlCluster::StepHue(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, - uint8_t stepMode, uint8_t stepSize, uint16_t transitionTime, uint8_t optionsMask, + uint8_t stepMode, uint8_t stepSize, uint8_t transitionTime, uint8_t optionsMask, uint8_t optionsOverride) { CHIP_ERROR err = CHIP_NO_ERROR; @@ -2362,7 +2362,7 @@ CHIP_ERROR ColorControlCluster::StepHue(Callback::Cancelable * onSuccessCallback SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), stepMode)); // stepSize: int8u SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), stepSize)); - // transitionTime: int16u + // transitionTime: int8u SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), transitionTime)); // optionsMask: bitmap8 SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), optionsMask)); @@ -2386,7 +2386,7 @@ CHIP_ERROR ColorControlCluster::StepHue(Callback::Cancelable * onSuccessCallback } CHIP_ERROR ColorControlCluster::StepSaturation(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, - uint8_t stepMode, uint8_t stepSize, uint16_t transitionTime, uint8_t optionsMask, + uint8_t stepMode, uint8_t stepSize, uint8_t transitionTime, uint8_t optionsMask, uint8_t optionsOverride) { CHIP_ERROR err = CHIP_NO_ERROR; @@ -2412,7 +2412,7 @@ CHIP_ERROR ColorControlCluster::StepSaturation(Callback::Cancelable * onSuccessC SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), stepMode)); // stepSize: int8u SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), stepSize)); - // transitionTime: int16u + // transitionTime: int8u SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), transitionTime)); // optionsMask: bitmap8 SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), optionsMask)); diff --git a/zzz_generated/controller-clusters/zap-generated/CHIPClusters.h b/zzz_generated/controller-clusters/zap-generated/CHIPClusters.h index 5c465de5f3c1e9..1e2d64a17fd0b3 100644 --- a/zzz_generated/controller-clusters/zap-generated/CHIPClusters.h +++ b/zzz_generated/controller-clusters/zap-generated/CHIPClusters.h @@ -308,9 +308,9 @@ class DLL_EXPORT ColorControlCluster : public ClusterBase uint8_t stepMode, uint16_t stepSize, uint16_t transitionTime, uint16_t colorTemperatureMinimum, uint16_t colorTemperatureMaximum, uint8_t optionsMask, uint8_t optionsOverride); CHIP_ERROR StepHue(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint8_t stepMode, - uint8_t stepSize, uint16_t transitionTime, uint8_t optionsMask, uint8_t optionsOverride); + uint8_t stepSize, uint8_t transitionTime, uint8_t optionsMask, uint8_t optionsOverride); CHIP_ERROR StepSaturation(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint8_t stepMode, - uint8_t stepSize, uint16_t transitionTime, uint8_t optionsMask, uint8_t optionsOverride); + uint8_t stepSize, uint8_t transitionTime, uint8_t optionsMask, uint8_t optionsOverride); CHIP_ERROR StopMoveStep(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint8_t optionsMask, uint8_t optionsOverride); diff --git a/zzz_generated/lighting-app/zap-generated/CHIPClusters.cpp b/zzz_generated/lighting-app/zap-generated/CHIPClusters.cpp index c109f5d26e71e1..1249d9c0ca0802 100644 --- a/zzz_generated/lighting-app/zap-generated/CHIPClusters.cpp +++ b/zzz_generated/lighting-app/zap-generated/CHIPClusters.cpp @@ -45,6 +45,120 @@ namespace Controller { // TODO(#4503): Commands should take group id as an argument. // OnOff Cluster Commands +CHIP_ERROR OnOffCluster::Off(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + app::CommandSender * sender = nullptr; + TLV::TLVWriter * writer = nullptr; + uint8_t argSeqNumber = 0; + + // Used when encoding non-empty command. Suppress error message when encoding empty commands. + (void) writer; + (void) argSeqNumber; + + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, OnOff::Commands::Ids::Off, + (app::CommandPathFlags::kEndpointIdValid) }; + + SuccessOrExit(err = app::InteractionModelEngine::GetInstance()->NewCommandSender(&sender)); + + SuccessOrExit(err = sender->PrepareCommand(cmdParams)); + + // Command takes no arguments. + + SuccessOrExit(err = sender->FinishCommand()); + + // #6308: This is a temporary solution before we fully support IM on application side and should be replaced by IMDelegate. + mDevice->AddIMResponseHandler(sender, onSuccessCallback, onFailureCallback); + + err = mDevice->SendCommands(sender); + +exit: + // On error, we are responsible to close the sender. + if (err != CHIP_NO_ERROR && sender != nullptr) + { + sender->Shutdown(); + } + return err; +} + +CHIP_ERROR OnOffCluster::On(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + app::CommandSender * sender = nullptr; + TLV::TLVWriter * writer = nullptr; + uint8_t argSeqNumber = 0; + + // Used when encoding non-empty command. Suppress error message when encoding empty commands. + (void) writer; + (void) argSeqNumber; + + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, OnOff::Commands::Ids::On, + (app::CommandPathFlags::kEndpointIdValid) }; + + SuccessOrExit(err = app::InteractionModelEngine::GetInstance()->NewCommandSender(&sender)); + + SuccessOrExit(err = sender->PrepareCommand(cmdParams)); + + // Command takes no arguments. + + SuccessOrExit(err = sender->FinishCommand()); + + // #6308: This is a temporary solution before we fully support IM on application side and should be replaced by IMDelegate. + mDevice->AddIMResponseHandler(sender, onSuccessCallback, onFailureCallback); + + err = mDevice->SendCommands(sender); + +exit: + // On error, we are responsible to close the sender. + if (err != CHIP_NO_ERROR && sender != nullptr) + { + sender->Shutdown(); + } + return err; +} + +CHIP_ERROR OnOffCluster::Toggle(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + app::CommandSender * sender = nullptr; + TLV::TLVWriter * writer = nullptr; + uint8_t argSeqNumber = 0; + + // Used when encoding non-empty command. Suppress error message when encoding empty commands. + (void) writer; + (void) argSeqNumber; + + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, OnOff::Commands::Ids::Toggle, + (app::CommandPathFlags::kEndpointIdValid) }; + + SuccessOrExit(err = app::InteractionModelEngine::GetInstance()->NewCommandSender(&sender)); + + SuccessOrExit(err = sender->PrepareCommand(cmdParams)); + + // Command takes no arguments. + + SuccessOrExit(err = sender->FinishCommand()); + + // #6308: This is a temporary solution before we fully support IM on application side and should be replaced by IMDelegate. + mDevice->AddIMResponseHandler(sender, onSuccessCallback, onFailureCallback); + + err = mDevice->SendCommands(sender); + +exit: + // On error, we are responsible to close the sender. + if (err != CHIP_NO_ERROR && sender != nullptr) + { + sender->Shutdown(); + } + return err; +} + // OnOff Cluster Attributes CHIP_ERROR OnOffCluster::ReadAttributeOnOff(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) { @@ -57,6 +171,24 @@ CHIP_ERROR OnOffCluster::ReadAttributeOnOff(Callback::Cancelable * onSuccessCall BasicAttributeFilter); } +CHIP_ERROR OnOffCluster::ConfigureAttributeOnOff(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint16_t minInterval, uint16_t maxInterval) +{ + + chip::app::AttributePathParams attributePath; + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = OnOff::Attributes::Ids::OnOff; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + return mDevice->SendSubscribeAttributeRequest(attributePath, minInterval, maxInterval, onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR OnOffCluster::ReportAttributeOnOff(Callback::Cancelable * onReportCallback) +{ + return RequestAttributeReporting(OnOff::Attributes::Ids::OnOff, onReportCallback, + BasicAttributeFilter); +} + CHIP_ERROR OnOffCluster::ReadAttributeGlobalSceneControl(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) { diff --git a/zzz_generated/lighting-app/zap-generated/CHIPClusters.h b/zzz_generated/lighting-app/zap-generated/CHIPClusters.h index b2bd05d1461070..5c36318aa27872 100644 --- a/zzz_generated/lighting-app/zap-generated/CHIPClusters.h +++ b/zzz_generated/lighting-app/zap-generated/CHIPClusters.h @@ -36,6 +36,11 @@ class DLL_EXPORT OnOffCluster : public ClusterBase OnOffCluster() : ClusterBase(app::Clusters::OnOff::Id) {} ~OnOffCluster() {} + // Cluster Commands + CHIP_ERROR Off(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR On(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR Toggle(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + // Cluster Attributes CHIP_ERROR ReadAttributeOnOff(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); CHIP_ERROR ReadAttributeGlobalSceneControl(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); @@ -49,6 +54,11 @@ class DLL_EXPORT OnOffCluster : public ClusterBase uint16_t value); CHIP_ERROR WriteAttributeStartUpOnOff(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint8_t value); + CHIP_ERROR ConfigureAttributeOnOff(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint16_t minInterval, uint16_t maxInterval); + CHIP_ERROR ReportAttributeOnOff(Callback::Cancelable * onReportCallback); + +private: }; } // namespace Controller diff --git a/zzz_generated/lighting-app/zap-generated/IMClusterCommandHandler.cpp b/zzz_generated/lighting-app/zap-generated/IMClusterCommandHandler.cpp index 3392f4c9c665dc..d97917f35e2420 100644 --- a/zzz_generated/lighting-app/zap-generated/IMClusterCommandHandler.cpp +++ b/zzz_generated/lighting-app/zap-generated/IMClusterCommandHandler.cpp @@ -1459,7 +1459,7 @@ void DispatchServerCommand(CommandHandler * apCommandObj, CommandId aCommandId, expectArgumentCount = 5; uint8_t stepMode; uint8_t stepSize; - uint16_t transitionTime; + uint8_t transitionTime; uint8_t optionsMask; uint8_t optionsOverride; bool argExists[5]; @@ -1534,7 +1534,7 @@ void DispatchServerCommand(CommandHandler * apCommandObj, CommandId aCommandId, expectArgumentCount = 5; uint8_t stepMode; uint8_t stepSize; - uint16_t transitionTime; + uint8_t transitionTime; uint8_t optionsMask; uint8_t optionsOverride; bool argExists[5]; @@ -3223,58 +3223,7 @@ namespace OnOff { void DispatchServerCommand(CommandHandler * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv) { - // We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV - // When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error. - // Any error value TLVUnpackError means we have received an illegal value. - // The following variables are used for all commands to save code size. - CHIP_ERROR TLVError = CHIP_NO_ERROR; - CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - uint32_t validArgumentCount = 0; - uint32_t expectArgumentCount = 0; - uint32_t currentDecodeTagId = 0; - bool wasHandled = false; - { - switch (aCommandId) - { - case Clusters::OnOff::Commands::Ids::Off: { - - wasHandled = emberAfOnOffClusterOffCallback(aEndpointId, apCommandObj); - break; - } - case Clusters::OnOff::Commands::Ids::On: { - - wasHandled = emberAfOnOffClusterOnCallback(aEndpointId, apCommandObj); - break; - } - case Clusters::OnOff::Commands::Ids::Toggle: { - - wasHandled = emberAfOnOffClusterToggleCallback(aEndpointId, apCommandObj); - break; - } - default: { - // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aEndpointId, Clusters::OnOff::Id, aCommandId); - return; - } - } - } - - if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled) - { - CommandPathParams returnStatusParam = { aEndpointId, - 0, // GroupId - Clusters::OnOff::Id, aCommandId, (CommandPathFlags::kEndpointIdValid) }; - apCommandObj->AddStatusCode(returnStatusParam, Protocols::SecureChannel::GeneralStatusCode::kBadRequest, - Protocols::SecureChannel::Id, Protocols::InteractionModel::Status::InvalidCommand); - ChipLogProgress(Zcl, - "Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT - ", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32, - validArgumentCount, expectArgumentCount, TLVError.Format(), TLVUnpackError.Format(), currentDecodeTagId); - // A command with no arguments would never write currentDecodeTagId. If - // progress logging is also disabled, it would look unused. Silence that - // warning. - UNUSED_VAR(currentDecodeTagId); - } + ReportCommandUnsupported(apCommandObj, aEndpointId, Clusters::OnOff::Id, aCommandId); } } // namespace OnOff diff --git a/zzz_generated/thermostat/zap-generated/IMClusterCommandHandler.cpp b/zzz_generated/thermostat/zap-generated/IMClusterCommandHandler.cpp index b9fc9bf01db23b..084cf4a333afb1 100644 --- a/zzz_generated/thermostat/zap-generated/IMClusterCommandHandler.cpp +++ b/zzz_generated/thermostat/zap-generated/IMClusterCommandHandler.cpp @@ -1382,7 +1382,7 @@ void DispatchServerCommand(CommandHandler * apCommandObj, CommandId aCommandId, expectArgumentCount = 5; uint8_t stepMode; uint8_t stepSize; - uint16_t transitionTime; + uint8_t transitionTime; uint8_t optionsMask; uint8_t optionsOverride; bool argExists[5]; @@ -1457,7 +1457,7 @@ void DispatchServerCommand(CommandHandler * apCommandObj, CommandId aCommandId, expectArgumentCount = 5; uint8_t stepMode; uint8_t stepSize; - uint16_t transitionTime; + uint8_t transitionTime; uint8_t optionsMask; uint8_t optionsOverride; bool argExists[5]; diff --git a/zzz_generated/tv-casting-app/zap-generated/IMClusterCommandHandler.cpp b/zzz_generated/tv-casting-app/zap-generated/IMClusterCommandHandler.cpp index 2d579a07b1a551..7be08878728adf 100644 --- a/zzz_generated/tv-casting-app/zap-generated/IMClusterCommandHandler.cpp +++ b/zzz_generated/tv-casting-app/zap-generated/IMClusterCommandHandler.cpp @@ -1382,7 +1382,7 @@ void DispatchServerCommand(CommandHandler * apCommandObj, CommandId aCommandId, expectArgumentCount = 5; uint8_t stepMode; uint8_t stepSize; - uint16_t transitionTime; + uint8_t transitionTime; uint8_t optionsMask; uint8_t optionsOverride; bool argExists[5]; @@ -1457,7 +1457,7 @@ void DispatchServerCommand(CommandHandler * apCommandObj, CommandId aCommandId, expectArgumentCount = 5; uint8_t stepMode; uint8_t stepSize; - uint16_t transitionTime; + uint8_t transitionTime; uint8_t optionsMask; uint8_t optionsOverride; bool argExists[5]; From ae74f9e1ed5d07ceaadf530fd951cf7799a67f85 Mon Sep 17 00:00:00 2001 From: Mathieu Kardous Date: Tue, 28 Sep 2021 10:54:46 -0400 Subject: [PATCH 3/3] Regenerated problamtic code files --- .../zap-generated/CHIPClusters.cpp | 132 ------------------ .../lighting-app/zap-generated/CHIPClusters.h | 10 -- .../zap-generated/IMClusterCommandHandler.cpp | 53 ++++++- 3 files changed, 52 insertions(+), 143 deletions(-) diff --git a/zzz_generated/lighting-app/zap-generated/CHIPClusters.cpp b/zzz_generated/lighting-app/zap-generated/CHIPClusters.cpp index 1249d9c0ca0802..c109f5d26e71e1 100644 --- a/zzz_generated/lighting-app/zap-generated/CHIPClusters.cpp +++ b/zzz_generated/lighting-app/zap-generated/CHIPClusters.cpp @@ -45,120 +45,6 @@ namespace Controller { // TODO(#4503): Commands should take group id as an argument. // OnOff Cluster Commands -CHIP_ERROR OnOffCluster::Off(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - app::CommandSender * sender = nullptr; - TLV::TLVWriter * writer = nullptr; - uint8_t argSeqNumber = 0; - - // Used when encoding non-empty command. Suppress error message when encoding empty commands. - (void) writer; - (void) argSeqNumber; - - VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); - - app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, OnOff::Commands::Ids::Off, - (app::CommandPathFlags::kEndpointIdValid) }; - - SuccessOrExit(err = app::InteractionModelEngine::GetInstance()->NewCommandSender(&sender)); - - SuccessOrExit(err = sender->PrepareCommand(cmdParams)); - - // Command takes no arguments. - - SuccessOrExit(err = sender->FinishCommand()); - - // #6308: This is a temporary solution before we fully support IM on application side and should be replaced by IMDelegate. - mDevice->AddIMResponseHandler(sender, onSuccessCallback, onFailureCallback); - - err = mDevice->SendCommands(sender); - -exit: - // On error, we are responsible to close the sender. - if (err != CHIP_NO_ERROR && sender != nullptr) - { - sender->Shutdown(); - } - return err; -} - -CHIP_ERROR OnOffCluster::On(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - app::CommandSender * sender = nullptr; - TLV::TLVWriter * writer = nullptr; - uint8_t argSeqNumber = 0; - - // Used when encoding non-empty command. Suppress error message when encoding empty commands. - (void) writer; - (void) argSeqNumber; - - VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); - - app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, OnOff::Commands::Ids::On, - (app::CommandPathFlags::kEndpointIdValid) }; - - SuccessOrExit(err = app::InteractionModelEngine::GetInstance()->NewCommandSender(&sender)); - - SuccessOrExit(err = sender->PrepareCommand(cmdParams)); - - // Command takes no arguments. - - SuccessOrExit(err = sender->FinishCommand()); - - // #6308: This is a temporary solution before we fully support IM on application side and should be replaced by IMDelegate. - mDevice->AddIMResponseHandler(sender, onSuccessCallback, onFailureCallback); - - err = mDevice->SendCommands(sender); - -exit: - // On error, we are responsible to close the sender. - if (err != CHIP_NO_ERROR && sender != nullptr) - { - sender->Shutdown(); - } - return err; -} - -CHIP_ERROR OnOffCluster::Toggle(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - app::CommandSender * sender = nullptr; - TLV::TLVWriter * writer = nullptr; - uint8_t argSeqNumber = 0; - - // Used when encoding non-empty command. Suppress error message when encoding empty commands. - (void) writer; - (void) argSeqNumber; - - VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); - - app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, OnOff::Commands::Ids::Toggle, - (app::CommandPathFlags::kEndpointIdValid) }; - - SuccessOrExit(err = app::InteractionModelEngine::GetInstance()->NewCommandSender(&sender)); - - SuccessOrExit(err = sender->PrepareCommand(cmdParams)); - - // Command takes no arguments. - - SuccessOrExit(err = sender->FinishCommand()); - - // #6308: This is a temporary solution before we fully support IM on application side and should be replaced by IMDelegate. - mDevice->AddIMResponseHandler(sender, onSuccessCallback, onFailureCallback); - - err = mDevice->SendCommands(sender); - -exit: - // On error, we are responsible to close the sender. - if (err != CHIP_NO_ERROR && sender != nullptr) - { - sender->Shutdown(); - } - return err; -} - // OnOff Cluster Attributes CHIP_ERROR OnOffCluster::ReadAttributeOnOff(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) { @@ -171,24 +57,6 @@ CHIP_ERROR OnOffCluster::ReadAttributeOnOff(Callback::Cancelable * onSuccessCall BasicAttributeFilter); } -CHIP_ERROR OnOffCluster::ConfigureAttributeOnOff(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, - uint16_t minInterval, uint16_t maxInterval) -{ - - chip::app::AttributePathParams attributePath; - attributePath.mEndpointId = mEndpoint; - attributePath.mClusterId = mClusterId; - attributePath.mFieldId = OnOff::Attributes::Ids::OnOff; - attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); - return mDevice->SendSubscribeAttributeRequest(attributePath, minInterval, maxInterval, onSuccessCallback, onFailureCallback); -} - -CHIP_ERROR OnOffCluster::ReportAttributeOnOff(Callback::Cancelable * onReportCallback) -{ - return RequestAttributeReporting(OnOff::Attributes::Ids::OnOff, onReportCallback, - BasicAttributeFilter); -} - CHIP_ERROR OnOffCluster::ReadAttributeGlobalSceneControl(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) { diff --git a/zzz_generated/lighting-app/zap-generated/CHIPClusters.h b/zzz_generated/lighting-app/zap-generated/CHIPClusters.h index 5c36318aa27872..b2bd05d1461070 100644 --- a/zzz_generated/lighting-app/zap-generated/CHIPClusters.h +++ b/zzz_generated/lighting-app/zap-generated/CHIPClusters.h @@ -36,11 +36,6 @@ class DLL_EXPORT OnOffCluster : public ClusterBase OnOffCluster() : ClusterBase(app::Clusters::OnOff::Id) {} ~OnOffCluster() {} - // Cluster Commands - CHIP_ERROR Off(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); - CHIP_ERROR On(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); - CHIP_ERROR Toggle(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); - // Cluster Attributes CHIP_ERROR ReadAttributeOnOff(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); CHIP_ERROR ReadAttributeGlobalSceneControl(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); @@ -54,11 +49,6 @@ class DLL_EXPORT OnOffCluster : public ClusterBase uint16_t value); CHIP_ERROR WriteAttributeStartUpOnOff(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint8_t value); - CHIP_ERROR ConfigureAttributeOnOff(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, - uint16_t minInterval, uint16_t maxInterval); - CHIP_ERROR ReportAttributeOnOff(Callback::Cancelable * onReportCallback); - -private: }; } // namespace Controller diff --git a/zzz_generated/lighting-app/zap-generated/IMClusterCommandHandler.cpp b/zzz_generated/lighting-app/zap-generated/IMClusterCommandHandler.cpp index d97917f35e2420..02345088b07fbd 100644 --- a/zzz_generated/lighting-app/zap-generated/IMClusterCommandHandler.cpp +++ b/zzz_generated/lighting-app/zap-generated/IMClusterCommandHandler.cpp @@ -3223,7 +3223,58 @@ namespace OnOff { void DispatchServerCommand(CommandHandler * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv) { - ReportCommandUnsupported(apCommandObj, aEndpointId, Clusters::OnOff::Id, aCommandId); + // We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV + // When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error. + // Any error value TLVUnpackError means we have received an illegal value. + // The following variables are used for all commands to save code size. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; + uint32_t validArgumentCount = 0; + uint32_t expectArgumentCount = 0; + uint32_t currentDecodeTagId = 0; + bool wasHandled = false; + { + switch (aCommandId) + { + case Clusters::OnOff::Commands::Ids::Off: { + + wasHandled = emberAfOnOffClusterOffCallback(aEndpointId, apCommandObj); + break; + } + case Clusters::OnOff::Commands::Ids::On: { + + wasHandled = emberAfOnOffClusterOnCallback(aEndpointId, apCommandObj); + break; + } + case Clusters::OnOff::Commands::Ids::Toggle: { + + wasHandled = emberAfOnOffClusterToggleCallback(aEndpointId, apCommandObj); + break; + } + default: { + // Unrecognized command ID, error status will apply. + ReportCommandUnsupported(apCommandObj, aEndpointId, Clusters::OnOff::Id, aCommandId); + return; + } + } + } + + if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled) + { + CommandPathParams returnStatusParam = { aEndpointId, + 0, // GroupId + Clusters::OnOff::Id, aCommandId, (CommandPathFlags::kEndpointIdValid) }; + apCommandObj->AddStatusCode(returnStatusParam, Protocols::SecureChannel::GeneralStatusCode::kBadRequest, + Protocols::SecureChannel::Id, Protocols::InteractionModel::Status::InvalidCommand); + ChipLogProgress(Zcl, + "Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT + ", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32, + validArgumentCount, expectArgumentCount, TLVError.Format(), TLVUnpackError.Format(), currentDecodeTagId); + // A command with no arguments would never write currentDecodeTagId. If + // progress logging is also disabled, it would look unused. Silence that + // warning. + UNUSED_VAR(currentDecodeTagId); + } } } // namespace OnOff