From 36db5073bf3d1bda7c77addcdd2d086eaf4d61ce Mon Sep 17 00:00:00 2001 From: Vivien Nicolas Date: Fri, 17 Feb 2023 22:19:38 +0100 Subject: [PATCH] Update OffWithEffect arguments to be of type int8u per spec (#25132) * Update OffWithEffect arguments to be of type int8u per spec * Update generated code --- .../all-clusters-common/all-clusters-app.matter | 2 +- .../all-clusters-app/ameba/main/include/OnOffCommands.h | 4 ++-- .../rootnode_colortemperaturelight_hbUnzYVeyn.matter | 2 +- examples/lighting-app/lighting-common/lighting-app.matter | 2 +- examples/lighting-app/nxp/zap/lighting-on-off.matter | 2 +- .../silabs/efr32/data_model/lighting-thread-app.matter | 2 +- .../silabs/efr32/data_model/lighting-wifi-app.matter | 2 +- .../ota-requestor-common/ota-requestor-app.matter | 2 +- examples/placeholder/linux/apps/app1/config.matter | 4 ++-- examples/placeholder/linux/apps/app2/config.matter | 4 ++-- src/app/clusters/on-off-server/on-off-server.cpp | 2 +- .../zap-templates/zcl/data-model/chip/onoff-cluster.xml | 2 +- src/controller/data_model/controller-clusters.matter | 2 +- src/controller/python/chip/clusters/Objects.py | 4 ++-- .../Framework/CHIP/zap-generated/MTRBaseClusters.mm | 3 +-- src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm | 3 +-- .../app-common/app-common/zap-generated/cluster-objects.h | 8 ++++---- zzz_generated/chip-tool/zap-generated/test/Commands.h | 8 ++++---- .../zap-generated/cluster/Commands.h | 2 +- 19 files changed, 29 insertions(+), 31 deletions(-) diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter index 4d1c7ad1c6e3bd..5121505cff7afe 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter @@ -322,7 +322,7 @@ server cluster OnOff = 6 { request struct OffWithEffectRequest { OnOffEffectIdentifier effectIdentifier = 0; - OnOffDelayedAllOffEffectVariant effectVariant = 1; + int8u effectVariant = 1; } request struct OnWithTimedOffRequest { diff --git a/examples/all-clusters-app/ameba/main/include/OnOffCommands.h b/examples/all-clusters-app/ameba/main/include/OnOffCommands.h index b21afe8f6603e0..dd05750f1c70e1 100644 --- a/examples/all-clusters-app/ameba/main/include/OnOffCommands.h +++ b/examples/all-clusters-app/ameba/main/include/OnOffCommands.h @@ -125,7 +125,7 @@ void ProcessOnOffUnicastBindingCommand(BindingCommandData * data, const EmberBin case Clusters::OnOff::Commands::OffWithEffect::Id: offwitheffectCommand.effectIdentifier = static_cast(data->args[0]); - offwitheffectCommand.effectVariant = static_cast(data->args[1]); + offwitheffectCommand.effectVariant = static_cast(data->args[1]); Controller::InvokeCommandRequest(peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(), binding.remote, offwitheffectCommand, onSuccess, onFailure); break; @@ -172,7 +172,7 @@ void ProcessOnOffGroupBindingCommand(BindingCommandData * data, const EmberBindi case Clusters::OnOff::Commands::OffWithEffect::Id: offwitheffectCommand.effectIdentifier = static_cast(data->args[0]); - offwitheffectCommand.effectVariant = static_cast(data->args[1]); + offwitheffectCommand.effectVariant = static_cast(data->args[1]); Controller::InvokeGroupCommandRequest(&exchangeMgr, binding.fabricIndex, binding.groupId, offwitheffectCommand); break; diff --git a/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.matter b/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.matter index 6035360b3cfe0c..b7c3398ff4f42c 100644 --- a/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.matter +++ b/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.matter @@ -154,7 +154,7 @@ server cluster OnOff = 6 { request struct OffWithEffectRequest { OnOffEffectIdentifier effectIdentifier = 0; - OnOffDelayedAllOffEffectVariant effectVariant = 1; + int8u effectVariant = 1; } request struct OnWithTimedOffRequest { diff --git a/examples/lighting-app/lighting-common/lighting-app.matter b/examples/lighting-app/lighting-common/lighting-app.matter index 2f18fcd19cc2db..b796597f58fbff 100644 --- a/examples/lighting-app/lighting-common/lighting-app.matter +++ b/examples/lighting-app/lighting-common/lighting-app.matter @@ -159,7 +159,7 @@ server cluster OnOff = 6 { request struct OffWithEffectRequest { OnOffEffectIdentifier effectIdentifier = 0; - OnOffDelayedAllOffEffectVariant effectVariant = 1; + int8u effectVariant = 1; } request struct OnWithTimedOffRequest { diff --git a/examples/lighting-app/nxp/zap/lighting-on-off.matter b/examples/lighting-app/nxp/zap/lighting-on-off.matter index f69d4fe027f847..51351cbd2c4e03 100644 --- a/examples/lighting-app/nxp/zap/lighting-on-off.matter +++ b/examples/lighting-app/nxp/zap/lighting-on-off.matter @@ -154,7 +154,7 @@ server cluster OnOff = 6 { request struct OffWithEffectRequest { OnOffEffectIdentifier effectIdentifier = 0; - OnOffDelayedAllOffEffectVariant effectVariant = 1; + int8u effectVariant = 1; } request struct OnWithTimedOffRequest { diff --git a/examples/lighting-app/silabs/efr32/data_model/lighting-thread-app.matter b/examples/lighting-app/silabs/efr32/data_model/lighting-thread-app.matter index 112b81cf97b819..4f7528e0671a6f 100644 --- a/examples/lighting-app/silabs/efr32/data_model/lighting-thread-app.matter +++ b/examples/lighting-app/silabs/efr32/data_model/lighting-thread-app.matter @@ -159,7 +159,7 @@ server cluster OnOff = 6 { request struct OffWithEffectRequest { OnOffEffectIdentifier effectIdentifier = 0; - OnOffDelayedAllOffEffectVariant effectVariant = 1; + int8u effectVariant = 1; } request struct OnWithTimedOffRequest { diff --git a/examples/lighting-app/silabs/efr32/data_model/lighting-wifi-app.matter b/examples/lighting-app/silabs/efr32/data_model/lighting-wifi-app.matter index df102d23fcf5f9..864f52ecebeaa8 100644 --- a/examples/lighting-app/silabs/efr32/data_model/lighting-wifi-app.matter +++ b/examples/lighting-app/silabs/efr32/data_model/lighting-wifi-app.matter @@ -159,7 +159,7 @@ server cluster OnOff = 6 { request struct OffWithEffectRequest { OnOffEffectIdentifier effectIdentifier = 0; - OnOffDelayedAllOffEffectVariant effectVariant = 1; + int8u effectVariant = 1; } request struct OnWithTimedOffRequest { diff --git a/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.matter b/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.matter index 51fe946f600156..2f09e3db5ef4fc 100644 --- a/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.matter +++ b/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.matter @@ -159,7 +159,7 @@ server cluster OnOff = 6 { request struct OffWithEffectRequest { OnOffEffectIdentifier effectIdentifier = 0; - OnOffDelayedAllOffEffectVariant effectVariant = 1; + int8u effectVariant = 1; } request struct OnWithTimedOffRequest { diff --git a/examples/placeholder/linux/apps/app1/config.matter b/examples/placeholder/linux/apps/app1/config.matter index e47559d7bd8e55..922811dc3773c4 100644 --- a/examples/placeholder/linux/apps/app1/config.matter +++ b/examples/placeholder/linux/apps/app1/config.matter @@ -269,7 +269,7 @@ client cluster OnOff = 6 { request struct OffWithEffectRequest { OnOffEffectIdentifier effectIdentifier = 0; - OnOffDelayedAllOffEffectVariant effectVariant = 1; + int8u effectVariant = 1; } request struct OnWithTimedOffRequest { @@ -330,7 +330,7 @@ server cluster OnOff = 6 { request struct OffWithEffectRequest { OnOffEffectIdentifier effectIdentifier = 0; - OnOffDelayedAllOffEffectVariant effectVariant = 1; + int8u effectVariant = 1; } request struct OnWithTimedOffRequest { diff --git a/examples/placeholder/linux/apps/app2/config.matter b/examples/placeholder/linux/apps/app2/config.matter index ed84ad41e6adeb..6ba186919e73b3 100644 --- a/examples/placeholder/linux/apps/app2/config.matter +++ b/examples/placeholder/linux/apps/app2/config.matter @@ -269,7 +269,7 @@ client cluster OnOff = 6 { request struct OffWithEffectRequest { OnOffEffectIdentifier effectIdentifier = 0; - OnOffDelayedAllOffEffectVariant effectVariant = 1; + int8u effectVariant = 1; } request struct OnWithTimedOffRequest { @@ -330,7 +330,7 @@ server cluster OnOff = 6 { request struct OffWithEffectRequest { OnOffEffectIdentifier effectIdentifier = 0; - OnOffDelayedAllOffEffectVariant effectVariant = 1; + int8u effectVariant = 1; } request struct OnWithTimedOffRequest { diff --git a/src/app/clusters/on-off-server/on-off-server.cpp b/src/app/clusters/on-off-server/on-off-server.cpp index 31d37bda1c1a34..2c0c58f17739da 100644 --- a/src/app/clusters/on-off-server/on-off-server.cpp +++ b/src/app/clusters/on-off-server/on-off-server.cpp @@ -394,7 +394,7 @@ bool OnOffServer::offWithEffectCommand(app::CommandHandler * commandObj, const a if (effect != nullptr && effect->mOffWithEffectTrigger != nullptr) { effect->mEffectIdentifier = effectId; - effect->mEffectVariant = to_underlying(effectVariant); + effect->mEffectVariant = effectVariant; effect->mOffWithEffectTrigger(effect); } diff --git a/src/app/zap-templates/zcl/data-model/chip/onoff-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/onoff-cluster.xml index 7ef1790f37f1d8..1389de212bdd2d 100644 --- a/src/app/zap-templates/zcl/data-model/chip/onoff-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/onoff-cluster.xml @@ -80,7 +80,7 @@ limitations under the License. The OffWithEffect command allows devices to be turned off using enhanced ways of fading. - + diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index d0e3124e5ead92..fec46ee12c0b03 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -280,7 +280,7 @@ client cluster OnOff = 6 { request struct OffWithEffectRequest { OnOffEffectIdentifier effectIdentifier = 0; - OnOffDelayedAllOffEffectVariant effectVariant = 1; + int8u effectVariant = 1; } request struct OnWithTimedOffRequest { diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index 2ef328b8938b30..3be505def39d2f 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -1384,11 +1384,11 @@ def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields = [ ClusterObjectFieldDescriptor(Label="effectIdentifier", Tag=0, Type=OnOff.Enums.OnOffEffectIdentifier), - ClusterObjectFieldDescriptor(Label="effectVariant", Tag=1, Type=OnOff.Enums.OnOffDelayedAllOffEffectVariant), + ClusterObjectFieldDescriptor(Label="effectVariant", Tag=1, Type=uint), ]) effectIdentifier: 'OnOff.Enums.OnOffEffectIdentifier' = 0 - effectVariant: 'OnOff.Enums.OnOffDelayedAllOffEffectVariant' = 0 + effectVariant: 'uint' = 0 @dataclass class OnWithRecallGlobalScene(ClusterCommand): diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm index a9a15d7a717e7e..760362d0194706 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm @@ -3537,8 +3537,7 @@ - (void)offWithEffectWithParams:(MTROnOffClusterOffWithEffectParams *)params com } request.effectIdentifier = static_cast>( params.effectIdentifier.unsignedCharValue); - request.effectVariant - = static_cast>(params.effectVariant.unsignedCharValue); + request.effectVariant = params.effectVariant.unsignedCharValue; return MTRStartInvokeInteraction(typedBridge, request, exchangeManager, session, successCb, failureCb, self->_endpoint, timedInvokeTimeoutMs, invokeTimeout); diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm index 8d0b8c6113eac6..69ab6161b8412b 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm @@ -2346,8 +2346,7 @@ - (void)offWithEffectWithParams:(MTROnOffClusterOffWithEffectParams *)params } request.effectIdentifier = static_cast>( params.effectIdentifier.unsignedCharValue); - request.effectVariant - = static_cast>(params.effectVariant.unsignedCharValue); + request.effectVariant = params.effectVariant.unsignedCharValue; return MTRStartInvokeInteraction(typedBridge, request, exchangeManager, session, successCb, failureCb, self->_endpoint, timedInvokeTimeoutMs, invokeTimeout); 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 b2eb0e244fd787..8d1c6919fe6955 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 @@ -1978,8 +1978,8 @@ struct Type static constexpr CommandId GetCommandId() { return Commands::OffWithEffect::Id; } static constexpr ClusterId GetClusterId() { return Clusters::OnOff::Id; } - OnOffEffectIdentifier effectIdentifier = static_cast(0); - OnOffDelayedAllOffEffectVariant effectVariant = static_cast(0); + OnOffEffectIdentifier effectIdentifier = static_cast(0); + uint8_t effectVariant = static_cast(0); CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; @@ -1994,8 +1994,8 @@ struct DecodableType static constexpr CommandId GetCommandId() { return Commands::OffWithEffect::Id; } static constexpr ClusterId GetClusterId() { return Clusters::OnOff::Id; } - OnOffEffectIdentifier effectIdentifier = static_cast(0); - OnOffDelayedAllOffEffectVariant effectVariant = static_cast(0); + OnOffEffectIdentifier effectIdentifier = static_cast(0); + uint8_t effectVariant = static_cast(0); CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace OffWithEffect diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index 3a577fcb6e8bc6..ab6a7832a1a809 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -110908,7 +110908,7 @@ class Test_TC_OO_2_3Suite : public TestCommand ListFreer listFreer; chip::app::Clusters::OnOff::Commands::OffWithEffect::Type value; value.effectIdentifier = static_cast(0); - value.effectVariant = static_cast(0); + value.effectVariant = 0U; return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::OffWithEffect::Id, value, chip::NullOptional @@ -110966,7 +110966,7 @@ class Test_TC_OO_2_3Suite : public TestCommand ListFreer listFreer; chip::app::Clusters::OnOff::Commands::OffWithEffect::Type value; value.effectIdentifier = static_cast(0); - value.effectVariant = static_cast(0); + value.effectVariant = 0U; return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::OffWithEffect::Id, value, chip::NullOptional @@ -111023,7 +111023,7 @@ class Test_TC_OO_2_3Suite : public TestCommand ListFreer listFreer; chip::app::Clusters::OnOff::Commands::OffWithEffect::Type value; value.effectIdentifier = static_cast(1); - value.effectVariant = static_cast(0); + value.effectVariant = 0U; return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::OffWithEffect::Id, value, chip::NullOptional @@ -111247,7 +111247,7 @@ class Test_TC_OO_2_3Suite : public TestCommand ListFreer listFreer; chip::app::Clusters::OnOff::Commands::OffWithEffect::Type value; value.effectIdentifier = static_cast(0); - value.effectVariant = static_cast(0); + value.effectVariant = 0U; return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::OffWithEffect::Id, value, chip::NullOptional 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 184c68449197c5..4d2ecb6ea7db73 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -3125,7 +3125,7 @@ class OnOffOffWithEffect : public ClusterCommand { params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.effectIdentifier = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.effectIdentifier)]; - params.effectVariant = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.effectVariant)]; + params.effectVariant = [NSNumber numberWithUnsignedChar:mRequest.effectVariant]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) {