diff --git a/src/app/zap-templates/zcl/data-model/chip/bridged-actions-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/bridged-actions-cluster.xml index 21e805243e1a3b..cc9b2d3684c355 100644 --- a/src/app/zap-templates/zcl/data-model/chip/bridged-actions-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/bridged-actions-cluster.xml @@ -172,5 +172,20 @@ limitations under the License. + + This event SHALL be generated when there is a change in the Status of an ActionID. + + + + + + + This event SHALL be generated when there is some error which prevents the action from its normal planned execution. + + + + + + diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index 084ed1d4f7fa02..0920c336579510 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -5121,6 +5121,45 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: 'uint' = 0 + class Events: + @dataclass + class StateChanged(ClusterEventDescriptor): + cluster_id: typing.ClassVar[int] = 0x0025 + event_id: typing.ClassVar[int] = 0x00000000 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields = [ + ClusterObjectFieldDescriptor(Label="actionID", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="invokeID", Tag=1, Type=uint), + ClusterObjectFieldDescriptor(Label="newState", Tag=2, Type=BridgedActions.Enums.ActionStatusEnum), + ]) + + actionID: 'uint' = 0 + invokeID: 'uint' = 0 + newState: 'BridgedActions.Enums.ActionStatusEnum' = 0 + + @dataclass + class ActionFailed(ClusterEventDescriptor): + cluster_id: typing.ClassVar[int] = 0x0025 + event_id: typing.ClassVar[int] = 0x00000001 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields = [ + ClusterObjectFieldDescriptor(Label="actionID", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="invokeID", Tag=1, Type=uint), + ClusterObjectFieldDescriptor(Label="newState", Tag=2, Type=BridgedActions.Enums.ActionStatusEnum), + ClusterObjectFieldDescriptor(Label="error", Tag=3, Type=BridgedActions.Enums.ActionErrorEnum), + ]) + + actionID: 'uint' = 0 + invokeID: 'uint' = 0 + newState: 'BridgedActions.Enums.ActionStatusEnum' = 0 + error: 'BridgedActions.Enums.ActionErrorEnum' = 0 + @dataclass class Basic(Cluster): 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 eb75909b970501..1d8adae836a303 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 @@ -4592,6 +4592,94 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } // namespace Commands namespace Events { +namespace StateChanged { +CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const +{ + TLV::TLVType outer; + ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kActionID)), actionID)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kInvokeID)), invokeID)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kNewState)), newState)); + ReturnErrorOnFailure(writer.EndContainer(outer)); + return CHIP_NO_ERROR; +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + TLV::TLVType outer; + VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); + ReturnErrorOnFailure(reader.EnterContainer(outer)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + VerifyOrReturnError(TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); + switch (TLV::TagNumFromTag(reader.GetTag())) + { + case to_underlying(Fields::kActionID): + ReturnErrorOnFailure(DataModel::Decode(reader, actionID)); + break; + case to_underlying(Fields::kInvokeID): + ReturnErrorOnFailure(DataModel::Decode(reader, invokeID)); + break; + case to_underlying(Fields::kNewState): + ReturnErrorOnFailure(DataModel::Decode(reader, newState)); + break; + default: + break; + } + } + + VerifyOrReturnError(err == CHIP_END_OF_TLV, err); + ReturnErrorOnFailure(reader.ExitContainer(outer)); + return CHIP_NO_ERROR; +} +} // namespace StateChanged. +namespace ActionFailed { +CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const +{ + TLV::TLVType outer; + ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kActionID)), actionID)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kInvokeID)), invokeID)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kNewState)), newState)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kError)), error)); + ReturnErrorOnFailure(writer.EndContainer(outer)); + return CHIP_NO_ERROR; +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + TLV::TLVType outer; + VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); + ReturnErrorOnFailure(reader.EnterContainer(outer)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + VerifyOrReturnError(TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); + switch (TLV::TagNumFromTag(reader.GetTag())) + { + case to_underlying(Fields::kActionID): + ReturnErrorOnFailure(DataModel::Decode(reader, actionID)); + break; + case to_underlying(Fields::kInvokeID): + ReturnErrorOnFailure(DataModel::Decode(reader, invokeID)); + break; + case to_underlying(Fields::kNewState): + ReturnErrorOnFailure(DataModel::Decode(reader, newState)); + break; + case to_underlying(Fields::kError): + ReturnErrorOnFailure(DataModel::Decode(reader, error)); + break; + default: + break; + } + } + + VerifyOrReturnError(err == CHIP_END_OF_TLV, err); + ReturnErrorOnFailure(reader.ExitContainer(outer)); + return CHIP_NO_ERROR; +} +} // namespace ActionFailed. } // namespace Events } // namespace BridgedActions 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 73f6c3d1d9845d..a5b10719f44b19 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 @@ -6920,6 +6920,89 @@ struct TypeInfo }; } // namespace ClusterRevision } // namespace Attributes +namespace Events { +namespace StateChanged { +static constexpr PriorityLevel kPriorityLevel = PriorityLevel::Info; +static constexpr EventId kEventId = 0x00000000; + +enum class Fields +{ + kActionID = 0, + kInvokeID = 1, + kNewState = 2, +}; + +struct Type +{ +public: + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return kEventId; } + static constexpr ClusterId GetClusterId() { return Clusters::BridgedActions::Id; } + + uint16_t actionID; + uint32_t invokeID; + ActionStatusEnum newState; + + CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; +}; + +struct DecodableType +{ +public: + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return kEventId; } + static constexpr ClusterId GetClusterId() { return Clusters::BridgedActions::Id; } + + uint16_t actionID; + uint32_t invokeID; + ActionStatusEnum newState; + + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +} // namespace StateChanged +namespace ActionFailed { +static constexpr PriorityLevel kPriorityLevel = PriorityLevel::Info; +static constexpr EventId kEventId = 0x00000001; + +enum class Fields +{ + kActionID = 0, + kInvokeID = 1, + kNewState = 2, + kError = 3, +}; + +struct Type +{ +public: + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return kEventId; } + static constexpr ClusterId GetClusterId() { return Clusters::BridgedActions::Id; } + + uint16_t actionID; + uint32_t invokeID; + ActionStatusEnum newState; + ActionErrorEnum error; + + CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; +}; + +struct DecodableType +{ +public: + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return kEventId; } + static constexpr ClusterId GetClusterId() { return Clusters::BridgedActions::Id; } + + uint16_t actionID; + uint32_t invokeID; + ActionStatusEnum newState; + ActionErrorEnum error; + + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +} // namespace ActionFailed +} // namespace Events } // namespace BridgedActions namespace Basic {