diff --git a/src/controller/python/chip/clusters/CHIPClusters.cpp b/src/controller/python/chip/clusters/CHIPClusters.cpp index 0439f789d3ef62..20ee9b1479020e 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.cpp +++ b/src/controller/python/chip/clusters/CHIPClusters.cpp @@ -202,13 +202,9 @@ static void OnBridgedActionsActionListListAttributeResponse( void * context, const chip::app::DataModel::DecodableList & list) { - uint16_t count = 0; - auto iter = list.begin(); - while (iter.Next()) - { - ++count; - } - if (iter.GetStatus() != CHIP_NO_ERROR) + size_t count = 0; + CHIP_ERROR err = list.ComputeSize(&count); + if (err != CHIP_NO_ERROR) { if (gFailureResponseDelegate != nullptr) { @@ -222,7 +218,7 @@ static void OnBridgedActionsActionListListAttributeResponse( if (count > 0) ChipLogProgress(Zcl, " ["); - iter = list.begin(); + auto iter = list.begin(); while (iter.Next()) { #if CHIP_PROGRESS_LOGGING @@ -237,6 +233,14 @@ static void OnBridgedActionsActionListListAttributeResponse( ChipLogProgress(Zcl, " Status: %" PRIu8 ",", entry.status); ChipLogProgress(Zcl, " },"); } + if (iter.GetStatus() != CHIP_NO_ERROR) + { + if (gFailureResponseDelegate != nullptr) + { + gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); + } + return; + } if (count > 0) ChipLogProgress(Zcl, " ]"); @@ -252,13 +256,9 @@ static void OnBridgedActionsEndpointListListAttributeResponse( const chip::app::DataModel::DecodableList & list) { - uint16_t count = 0; - auto iter = list.begin(); - while (iter.Next()) - { - ++count; - } - if (iter.GetStatus() != CHIP_NO_ERROR) + size_t count = 0; + CHIP_ERROR err = list.ComputeSize(&count); + if (err != CHIP_NO_ERROR) { if (gFailureResponseDelegate != nullptr) { @@ -272,7 +272,7 @@ static void OnBridgedActionsEndpointListListAttributeResponse( if (count > 0) ChipLogProgress(Zcl, " ["); - iter = list.begin(); + auto iter = list.begin(); while (iter.Next()) { #if CHIP_PROGRESS_LOGGING @@ -285,6 +285,14 @@ static void OnBridgedActionsEndpointListListAttributeResponse( ChipLogProgress(Zcl, " Endpoints: %s,", ByteSpanToString(entry.endpoints).c_str()); ChipLogProgress(Zcl, " },"); } + if (iter.GetStatus() != CHIP_NO_ERROR) + { + if (gFailureResponseDelegate != nullptr) + { + gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); + } + return; + } if (count > 0) ChipLogProgress(Zcl, " ]"); 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 e28dbf7071222a..98d85d95ccc378 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 @@ -5488,7 +5488,7 @@ struct TypeInfo using Type = DataModel::List; using DecodableType = DataModel::DecodableList; - static constexpr ClusterId GetClusterId() { return BridgedActions::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::BridgedActions::Id; } static constexpr AttributeId GetAttributeId() { return Attributes::ActionList::Id; } }; } // namespace ActionList @@ -5498,7 +5498,7 @@ struct TypeInfo using Type = DataModel::List; using DecodableType = DataModel::DecodableList; - static constexpr ClusterId GetClusterId() { return BridgedActions::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::BridgedActions::Id; } static constexpr AttributeId GetAttributeId() { return Attributes::EndpointList::Id; } }; } // namespace EndpointList @@ -5508,10 +5508,30 @@ struct TypeInfo using Type = chip::CharSpan; using DecodableType = chip::CharSpan; - static constexpr ClusterId GetClusterId() { return BridgedActions::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::BridgedActions::Id; } static constexpr AttributeId GetAttributeId() { return Attributes::SetupUrl::Id; } }; } // namespace SetupUrl +namespace FeatureMap { +struct TypeInfo +{ + using Type = uint32_t; + using DecodableType = uint32_t; + + static constexpr ClusterId GetClusterId() { return Clusters::BridgedActions::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::FeatureMap::Id; } +}; +} // namespace FeatureMap +namespace ClusterRevision { +struct TypeInfo +{ + using Type = uint16_t; + using DecodableType = uint16_t; + + static constexpr ClusterId GetClusterId() { return Clusters::BridgedActions::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::ClusterRevision::Id; } +}; +} // namespace ClusterRevision } // namespace Attributes } // namespace BridgedActions namespace Basic { 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 c302fd8ba8ea80..42ab85dcf51964 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 @@ -820,9 +820,13 @@ namespace SetupUrl { static constexpr AttributeId Id = 0x00000002; } // namespace SetupUrl -namespace FeatureMap = Globals::Attributes::FeatureMap; +namespace FeatureMap { +static constexpr AttributeId Id = Globals::Attributes::FeatureMap::Id; +} // namespace FeatureMap -namespace ClusterRevision = Globals::Attributes::ClusterRevision; +namespace ClusterRevision { +static constexpr AttributeId Id = Globals::Attributes::ClusterRevision::Id; +} // namespace ClusterRevision } // namespace Attributes } // namespace BridgedActions diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index de57c6c8caa50f..23c78e82c95ca6 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -219,19 +219,14 @@ static void OnBridgedActionsActionListListAttributeResponse( { ModelCommand * command = static_cast(context); - size_t count = 0; + size_t count = 0; + CHIP_ERROR err = list.ComputeSize(&count); + if (err != CHIP_NO_ERROR) { - auto iter = list.begin(); - while (iter.Next()) - { - ++count; - } - if (iter.GetStatus() != CHIP_NO_ERROR) - { - command->SetCommandExitStatus(iter.GetStatus()); - return; - } + command->SetCommandExitStatus(err); + return; } + ChipLogProgress(chipTool, "OnBridgedActionsActionListListAttributeResponse: %zu entries", count); auto iter = list.begin(); @@ -250,8 +245,7 @@ static void OnBridgedActionsActionListListAttributeResponse( ChipLogProgress(chipTool, " supportedCommands: %" PRIu16 "", entry.supportedCommands); ChipLogProgress(chipTool, " status: %" PRIu8 "", entry.status); } - - command->SetCommandExitStatus(CHIP_NO_ERROR); + command->SetCommandExitStatus(iter.GetStatus()); } static void OnBridgedActionsEndpointListListAttributeResponse( @@ -261,19 +255,14 @@ static void OnBridgedActionsEndpointListListAttributeResponse( { ModelCommand * command = static_cast(context); - size_t count = 0; + size_t count = 0; + CHIP_ERROR err = list.ComputeSize(&count); + if (err != CHIP_NO_ERROR) { - auto iter = list.begin(); - while (iter.Next()) - { - ++count; - } - if (iter.GetStatus() != CHIP_NO_ERROR) - { - command->SetCommandExitStatus(iter.GetStatus()); - return; - } + command->SetCommandExitStatus(err); + return; } + ChipLogProgress(chipTool, "OnBridgedActionsEndpointListListAttributeResponse: %zu entries", count); auto iter = list.begin(); @@ -290,8 +279,7 @@ static void OnBridgedActionsEndpointListListAttributeResponse( ChipLogProgress(chipTool, " type: %" PRIu8 "", entry.type); ChipLogProgress(Zcl, " Endpoints: %zu", entry.endpoints.size()); } - - command->SetCommandExitStatus(CHIP_NO_ERROR); + command->SetCommandExitStatus(iter.GetStatus()); } static void diff --git a/zzz_generated/controller-clusters/zap-generated/tests/CHIPClustersTest.cpp b/zzz_generated/controller-clusters/zap-generated/tests/CHIPClustersTest.cpp index 87c42da8c2245b..7a1bf36aa8fb86 100644 --- a/zzz_generated/controller-clusters/zap-generated/tests/CHIPClustersTest.cpp +++ b/zzz_generated/controller-clusters/zap-generated/tests/CHIPClustersTest.cpp @@ -456,37 +456,23 @@ CHIP_ERROR BooleanStateClusterTest::WriteAttributeClusterRevision(Callback::Canc } CHIP_ERROR BridgedActionsClusterTest::WriteAttributeSetupUrl(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, chip::CharSpan setupUrl) + Callback::Cancelable * onFailureCallback, chip::CharSpan value) { app::WriteClientHandle handle; - chip::app::AttributePathParams attributePath; - attributePath.mNodeId = mDevice->GetDeviceId(); - attributePath.mEndpointId = mEndpoint; - attributePath.mClusterId = mClusterId; - attributePath.mFieldId = BridgedActions::Attributes::SetupUrl::Id; - attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); - - ReturnErrorOnFailure(app::InteractionModelEngine::GetInstance()->NewWriteClient(handle)); - ReturnErrorOnFailure(handle.EncodeAttributeWritePayload(attributePath, setupUrl)); - + ReturnErrorOnFailure( + app::InteractionModelEngine::GetInstance()->NewWriteClient(handle, mDevice->GetInteractionModelDelegate())); + ReturnErrorOnFailure(handle.EncodeAttributeWritePayload( + chip::app::AttributePathParams(mEndpoint, mClusterId, BridgedActions::Attributes::SetupUrl::Id), value)); return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } - CHIP_ERROR BridgedActionsClusterTest::WriteAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, - uint16_t clusterRevision) + Callback::Cancelable * onFailureCallback, uint16_t value) { app::WriteClientHandle handle; - chip::app::AttributePathParams attributePath; - attributePath.mNodeId = mDevice->GetDeviceId(); - attributePath.mEndpointId = mEndpoint; - attributePath.mClusterId = mClusterId; - attributePath.mFieldId = Globals::Attributes::ClusterRevision::Id; - attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); - - ReturnErrorOnFailure(app::InteractionModelEngine::GetInstance()->NewWriteClient(handle)); - ReturnErrorOnFailure(handle.EncodeAttributeWritePayload(attributePath, clusterRevision)); - + ReturnErrorOnFailure( + app::InteractionModelEngine::GetInstance()->NewWriteClient(handle, mDevice->GetInteractionModelDelegate())); + ReturnErrorOnFailure(handle.EncodeAttributeWritePayload( + chip::app::AttributePathParams(mEndpoint, mClusterId, BridgedActions::Attributes::ClusterRevision::Id), value)); return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); }