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 f6e3cf50fcb031..8bc60ce732b015 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 @@ -13,6 +13,12 @@ server cluster AccessControl = 31 { kGroup = 3; } + enum ChangeTypeEnum : ENUM8 { + kChanged = 0; + kAdded = 1; + kRemoved = 2; + } + enum Privilege : ENUM8 { kView = 1; kProxyView = 2; @@ -40,6 +46,22 @@ server cluster AccessControl = 31 { OCTET_STRING data = 1; } + info event AccessControlEntryChanged = 0 { + fabric_idx adminFabricIndex = 0; + node_id adminNodeID = 1; + INT16U adminPasscodeID = 2; + ChangeTypeEnum changeType = 3; + AccessControlEntry latestValue = 4; + } + + info event AccessControlExtensionChanged = 1 { + fabric_idx adminFabricIndex = 0; + node_id adminNodeID = 1; + INT16U adminPasscodeID = 2; + ChangeTypeEnum changeType = 3; + ExtensionEntry latestValue = 4; + } + attribute(writable) AccessControlEntry acl[] = 0; attribute(writable) ExtensionEntry extension[] = 1; attribute(readonly) int16u clusterRevision = 65533; diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 43a0c50e380e18..f37ee214bc9abb 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -13,6 +13,12 @@ client cluster AccessControl = 31 { kGroup = 3; } + enum ChangeTypeEnum : ENUM8 { + kChanged = 0; + kAdded = 1; + kRemoved = 2; + } + enum Privilege : ENUM8 { kView = 1; kProxyView = 2; @@ -40,6 +46,22 @@ client cluster AccessControl = 31 { OCTET_STRING data = 1; } + info event AccessControlEntryChanged = 0 { + fabric_idx adminFabricIndex = 0; + node_id adminNodeID = 1; + INT16U adminPasscodeID = 2; + ChangeTypeEnum changeType = 3; + AccessControlEntry latestValue = 4; + } + + info event AccessControlExtensionChanged = 1 { + fabric_idx adminFabricIndex = 0; + node_id adminNodeID = 1; + INT16U adminPasscodeID = 2; + ChangeTypeEnum changeType = 3; + ExtensionEntry latestValue = 4; + } + attribute(writable) AccessControlEntry acl[] = 0; attribute(writable) ExtensionEntry extension[] = 1; attribute(readonly) attrib_id attributeList[] = 65531; diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index c10a80d81e035c..c41372e5433178 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -5135,6 +5135,11 @@ class AuthMode(IntEnum): kCase = 0x02 kGroup = 0x03 + class ChangeTypeEnum(IntEnum): + kChanged = 0x00 + kAdded = 0x01 + kRemoved = 0x02 + class Privilege(IntEnum): kView = 0x01 kProxyView = 0x02 @@ -5276,6 +5281,61 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: 'uint' = 0 + class Events: + @dataclass + class AccessControlEntryChanged(ClusterEvent): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x001F + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000000 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields = [ + ClusterObjectFieldDescriptor(Label="adminFabricIndex", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="adminNodeID", Tag=1, Type=uint), + ClusterObjectFieldDescriptor(Label="adminPasscodeID", Tag=2, Type=uint), + ClusterObjectFieldDescriptor(Label="changeType", Tag=3, Type=AccessControl.Enums.ChangeTypeEnum), + ClusterObjectFieldDescriptor(Label="latestValue", Tag=4, Type=AccessControl.Structs.AccessControlEntry), + ]) + + adminFabricIndex: 'uint' = 0 + adminNodeID: 'uint' = 0 + adminPasscodeID: 'uint' = 0 + changeType: 'AccessControl.Enums.ChangeTypeEnum' = 0 + latestValue: 'AccessControl.Structs.AccessControlEntry' = field(default_factory=lambda: AccessControl.Structs.AccessControlEntry()) + + @dataclass + class AccessControlExtensionChanged(ClusterEvent): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x001F + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000001 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields = [ + ClusterObjectFieldDescriptor(Label="adminFabricIndex", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="adminNodeID", Tag=1, Type=uint), + ClusterObjectFieldDescriptor(Label="adminPasscodeID", Tag=2, Type=uint), + ClusterObjectFieldDescriptor(Label="changeType", Tag=3, Type=AccessControl.Enums.ChangeTypeEnum), + ClusterObjectFieldDescriptor(Label="latestValue", Tag=4, Type=AccessControl.Structs.ExtensionEntry), + ]) + + adminFabricIndex: 'uint' = 0 + adminNodeID: 'uint' = 0 + adminPasscodeID: 'uint' = 0 + changeType: 'AccessControl.Enums.ChangeTypeEnum' = 0 + latestValue: 'AccessControl.Structs.ExtensionEntry' = field(default_factory=lambda: AccessControl.Structs.ExtensionEntry()) + @dataclass class PollControl(Cluster): diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm index c9fb60c87a4b87..ceddfbdd80ab0e 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm @@ -6724,6 +6724,58 @@ } } +void CHIPAccessControlClusterChangeTypeEnumAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::AccessControl::ChangeTypeEnum value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPAccessControlClusterChangeTypeEnumAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished(void * context) +{ + auto * self = static_cast(context); + if (!self->mQueue) { + return; + } + + if (self->mEstablishedHandler != nil) { + dispatch_async(self->mQueue, self->mEstablishedHandler); + // On failure, mEstablishedHandler will be cleaned up by our destructor, + // but we can clean it up earlier on successful subscription + // establishment. + self->mEstablishedHandler = nil; + } +} + +void CHIPNullableAccessControlClusterChangeTypeEnumAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableAccessControlClusterChangeTypeEnumAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished(void * context) +{ + auto * self = static_cast(context); + if (!self->mQueue) { + return; + } + + if (self->mEstablishedHandler != nil) { + dispatch_async(self->mQueue, self->mEstablishedHandler); + // On failure, mEstablishedHandler will be cleaned up by our destructor, + // but we can clean it up earlier on successful subscription + // establishment. + self->mEstablishedHandler = nil; + } +} + void CHIPAccessControlClusterPrivilegeAttributeCallbackBridge::OnSuccessFn( void * context, chip::app::Clusters::AccessControl::Privilege value) { diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h index 2e401162c7c2f0..86c30b46373114 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h @@ -165,6 +165,9 @@ typedef void (*NullableApplianceControlClusterWarningEventAttributeCallback)( typedef void (*AccessControlClusterAuthModeAttributeCallback)(void *, chip::app::Clusters::AccessControl::AuthMode); typedef void (*NullableAccessControlClusterAuthModeAttributeCallback)( void *, const chip::app::DataModel::Nullable &); +typedef void (*AccessControlClusterChangeTypeEnumAttributeCallback)(void *, chip::app::Clusters::AccessControl::ChangeTypeEnum); +typedef void (*NullableAccessControlClusterChangeTypeEnumAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); typedef void (*AccessControlClusterPrivilegeAttributeCallback)(void *, chip::app::Clusters::AccessControl::Privilege); typedef void (*NullableAccessControlClusterPrivilegeAttributeCallback)( void *, const chip::app::DataModel::Nullable &); @@ -5403,6 +5406,64 @@ class CHIPNullableAccessControlClusterAuthModeAttributeCallbackSubscriptionBridg SubscriptionEstablishedHandler mEstablishedHandler; }; +class CHIPAccessControlClusterChangeTypeEnumAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPAccessControlClusterChangeTypeEnumAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::AccessControl::ChangeTypeEnum value); +}; + +class CHIPAccessControlClusterChangeTypeEnumAttributeCallbackSubscriptionBridge + : public CHIPAccessControlClusterChangeTypeEnumAttributeCallbackBridge +{ +public: + CHIPAccessControlClusterChangeTypeEnumAttributeCallbackSubscriptionBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, + SubscriptionEstablishedHandler establishedHandler) : + CHIPAccessControlClusterChangeTypeEnumAttributeCallbackBridge(queue, handler, action, true), + mEstablishedHandler(establishedHandler) + {} + + static void OnSubscriptionEstablished(void * context); + +private: + SubscriptionEstablishedHandler mEstablishedHandler; +}; + +class CHIPNullableAccessControlClusterChangeTypeEnumAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableAccessControlClusterChangeTypeEnumAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPNullableAccessControlClusterChangeTypeEnumAttributeCallbackSubscriptionBridge + : public CHIPNullableAccessControlClusterChangeTypeEnumAttributeCallbackBridge +{ +public: + CHIPNullableAccessControlClusterChangeTypeEnumAttributeCallbackSubscriptionBridge( + dispatch_queue_t queue, ResponseHandler handler, CHIPActionBlock action, + SubscriptionEstablishedHandler establishedHandler) : + CHIPNullableAccessControlClusterChangeTypeEnumAttributeCallbackBridge(queue, handler, action, true), + mEstablishedHandler(establishedHandler) + {} + + static void OnSubscriptionEstablished(void * context); + +private: + SubscriptionEstablishedHandler mEstablishedHandler; +}; + class CHIPAccessControlClusterPrivilegeAttributeCallbackBridge : public CHIPCallbackBridge { 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 434c297a8fb0c0..7e95d5d2a9690c 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 @@ -4635,6 +4635,106 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre } // namespace Attributes namespace Events { +namespace AccessControlEntryChanged { +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::kAdminFabricIndex)), adminFabricIndex)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kAdminNodeID)), adminNodeID)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kAdminPasscodeID)), adminPasscodeID)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kChangeType)), changeType)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kLatestValue)), latestValue)); + 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::kAdminFabricIndex): + ReturnErrorOnFailure(DataModel::Decode(reader, adminFabricIndex)); + break; + case to_underlying(Fields::kAdminNodeID): + ReturnErrorOnFailure(DataModel::Decode(reader, adminNodeID)); + break; + case to_underlying(Fields::kAdminPasscodeID): + ReturnErrorOnFailure(DataModel::Decode(reader, adminPasscodeID)); + break; + case to_underlying(Fields::kChangeType): + ReturnErrorOnFailure(DataModel::Decode(reader, changeType)); + break; + case to_underlying(Fields::kLatestValue): + ReturnErrorOnFailure(DataModel::Decode(reader, latestValue)); + break; + default: + break; + } + } + + VerifyOrReturnError(err == CHIP_END_OF_TLV, err); + ReturnErrorOnFailure(reader.ExitContainer(outer)); + return CHIP_NO_ERROR; +} +} // namespace AccessControlEntryChanged. +namespace AccessControlExtensionChanged { +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::kAdminFabricIndex)), adminFabricIndex)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kAdminNodeID)), adminNodeID)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kAdminPasscodeID)), adminPasscodeID)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kChangeType)), changeType)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kLatestValue)), latestValue)); + 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::kAdminFabricIndex): + ReturnErrorOnFailure(DataModel::Decode(reader, adminFabricIndex)); + break; + case to_underlying(Fields::kAdminNodeID): + ReturnErrorOnFailure(DataModel::Decode(reader, adminNodeID)); + break; + case to_underlying(Fields::kAdminPasscodeID): + ReturnErrorOnFailure(DataModel::Decode(reader, adminPasscodeID)); + break; + case to_underlying(Fields::kChangeType): + ReturnErrorOnFailure(DataModel::Decode(reader, changeType)); + break; + case to_underlying(Fields::kLatestValue): + ReturnErrorOnFailure(DataModel::Decode(reader, latestValue)); + break; + default: + break; + } + } + + VerifyOrReturnError(err == CHIP_END_OF_TLV, err); + ReturnErrorOnFailure(reader.ExitContainer(outer)); + return CHIP_NO_ERROR; +} +} // namespace AccessControlExtensionChanged. } // namespace Events } // namespace AccessControl 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 58bd22d5af126a..01549823f9e6bf 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 @@ -6402,6 +6402,13 @@ enum class AuthMode : uint8_t kCase = 0x02, kGroup = 0x03, }; +// Enum for ChangeTypeEnum +enum class ChangeTypeEnum : uint8_t +{ + kChanged = 0x00, + kAdded = 0x01, + kRemoved = 0x02, +}; // Enum for Privilege enum class Privilege : uint8_t { @@ -6576,6 +6583,98 @@ struct TypeInfo }; }; } // namespace Attributes +namespace Events { +namespace AccessControlEntryChanged { +static constexpr PriorityLevel kPriorityLevel = PriorityLevel::Info; +static constexpr EventId kEventId = 0x00000000; + +enum class Fields +{ + kAdminFabricIndex = 0, + kAdminNodeID = 1, + kAdminPasscodeID = 2, + kChangeType = 3, + kLatestValue = 4, +}; + +struct Type +{ +public: + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return kEventId; } + static constexpr ClusterId GetClusterId() { return Clusters::AccessControl::Id; } + + chip::FabricIndex adminFabricIndex = static_cast(0); + chip::NodeId adminNodeID = static_cast(0); + uint16_t adminPasscodeID = static_cast(0); + ChangeTypeEnum changeType = static_cast(0); + Structs::AccessControlEntry::Type latestValue; + + 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::AccessControl::Id; } + + chip::FabricIndex adminFabricIndex = static_cast(0); + chip::NodeId adminNodeID = static_cast(0); + uint16_t adminPasscodeID = static_cast(0); + ChangeTypeEnum changeType = static_cast(0); + Structs::AccessControlEntry::DecodableType latestValue; + + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +} // namespace AccessControlEntryChanged +namespace AccessControlExtensionChanged { +static constexpr PriorityLevel kPriorityLevel = PriorityLevel::Info; +static constexpr EventId kEventId = 0x00000001; + +enum class Fields +{ + kAdminFabricIndex = 0, + kAdminNodeID = 1, + kAdminPasscodeID = 2, + kChangeType = 3, + kLatestValue = 4, +}; + +struct Type +{ +public: + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return kEventId; } + static constexpr ClusterId GetClusterId() { return Clusters::AccessControl::Id; } + + chip::FabricIndex adminFabricIndex = static_cast(0); + chip::NodeId adminNodeID = static_cast(0); + uint16_t adminPasscodeID = static_cast(0); + ChangeTypeEnum changeType = static_cast(0); + Structs::ExtensionEntry::Type latestValue; + + 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::AccessControl::Id; } + + chip::FabricIndex adminFabricIndex = static_cast(0); + chip::NodeId adminNodeID = static_cast(0); + uint16_t adminPasscodeID = static_cast(0); + ChangeTypeEnum changeType = static_cast(0); + Structs::ExtensionEntry::DecodableType latestValue; + + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +} // namespace AccessControlExtensionChanged +} // namespace Events } // namespace AccessControl namespace PollControl { diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index 693545450dfaea..5a20477601ac5b 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -148,6 +148,10 @@ CHIP_ERROR LogValue(const char * label, size_t indent, CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::TestCluster::Structs::TestListStructOctet::DecodableType & value); +CHIP_ERROR LogValue(const char * label, size_t indent, + chip::app::Clusters::AccessControl::Events::AccessControlEntryChanged::DecodableType value); +CHIP_ERROR LogValue(const char * label, size_t indent, + chip::app::Clusters::AccessControl::Events::AccessControlExtensionChanged::DecodableType value); CHIP_ERROR LogValue(const char * label, size_t indent, chip::app::Clusters::BridgedActions::Events::StateChanged::DecodableType value); CHIP_ERROR LogValue(const char * label, size_t indent, @@ -2543,6 +2547,104 @@ CHIP_ERROR LogValue(const char * label, size_t indent, // be logging. #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-function" +CHIP_ERROR LogValue(const char * label, size_t indent, + chip::app::Clusters::AccessControl::Events::AccessControlEntryChanged::DecodableType value) +{ + ChipLogProgress(chipTool, "%s%s: {", IndentStr(indent).c_str(), label); + { + CHIP_ERROR err = LogValue("AdminFabricIndex", indent + 1, value.adminFabricIndex); + if (err != CHIP_NO_ERROR) + { + ChipLogProgress(chipTool, "%sEvent truncated due to invalid value for 'AdminFabricIndex'", + IndentStr(indent + 1).c_str()); + return err; + } + } + { + CHIP_ERROR err = LogValue("AdminNodeID", indent + 1, value.adminNodeID); + if (err != CHIP_NO_ERROR) + { + ChipLogProgress(chipTool, "%sEvent truncated due to invalid value for 'AdminNodeID'", IndentStr(indent + 1).c_str()); + return err; + } + } + { + CHIP_ERROR err = LogValue("AdminPasscodeID", indent + 1, value.adminPasscodeID); + if (err != CHIP_NO_ERROR) + { + ChipLogProgress(chipTool, "%sEvent truncated due to invalid value for 'AdminPasscodeID'", + IndentStr(indent + 1).c_str()); + return err; + } + } + { + CHIP_ERROR err = LogValue("ChangeType", indent + 1, value.changeType); + if (err != CHIP_NO_ERROR) + { + ChipLogProgress(chipTool, "%sEvent truncated due to invalid value for 'ChangeType'", IndentStr(indent + 1).c_str()); + return err; + } + } + { + CHIP_ERROR err = LogValue("LatestValue", indent + 1, value.latestValue); + if (err != CHIP_NO_ERROR) + { + ChipLogProgress(chipTool, "%sEvent truncated due to invalid value for 'LatestValue'", IndentStr(indent + 1).c_str()); + return err; + } + } + ChipLogProgress(chipTool, "%s}", IndentStr(indent).c_str()); + return CHIP_NO_ERROR; +} +CHIP_ERROR LogValue(const char * label, size_t indent, + chip::app::Clusters::AccessControl::Events::AccessControlExtensionChanged::DecodableType value) +{ + ChipLogProgress(chipTool, "%s%s: {", IndentStr(indent).c_str(), label); + { + CHIP_ERROR err = LogValue("AdminFabricIndex", indent + 1, value.adminFabricIndex); + if (err != CHIP_NO_ERROR) + { + ChipLogProgress(chipTool, "%sEvent truncated due to invalid value for 'AdminFabricIndex'", + IndentStr(indent + 1).c_str()); + return err; + } + } + { + CHIP_ERROR err = LogValue("AdminNodeID", indent + 1, value.adminNodeID); + if (err != CHIP_NO_ERROR) + { + ChipLogProgress(chipTool, "%sEvent truncated due to invalid value for 'AdminNodeID'", IndentStr(indent + 1).c_str()); + return err; + } + } + { + CHIP_ERROR err = LogValue("AdminPasscodeID", indent + 1, value.adminPasscodeID); + if (err != CHIP_NO_ERROR) + { + ChipLogProgress(chipTool, "%sEvent truncated due to invalid value for 'AdminPasscodeID'", + IndentStr(indent + 1).c_str()); + return err; + } + } + { + CHIP_ERROR err = LogValue("ChangeType", indent + 1, value.changeType); + if (err != CHIP_NO_ERROR) + { + ChipLogProgress(chipTool, "%sEvent truncated due to invalid value for 'ChangeType'", IndentStr(indent + 1).c_str()); + return err; + } + } + { + CHIP_ERROR err = LogValue("LatestValue", indent + 1, value.latestValue); + if (err != CHIP_NO_ERROR) + { + ChipLogProgress(chipTool, "%sEvent truncated due to invalid value for 'LatestValue'", IndentStr(indent + 1).c_str()); + return err; + } + } + ChipLogProgress(chipTool, "%s}", IndentStr(indent).c_str()); + return CHIP_NO_ERROR; +} CHIP_ERROR LogValue(const char * label, size_t indent, chip::app::Clusters::BridgedActions::Events::StateChanged::DecodableType value) { @@ -4516,8 +4618,157 @@ static void OnThermostatGetWeeklyScheduleResponseSuccess( | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | +| * AccessControlEntryChanged | 0x0000 | +| * AccessControlExtensionChanged | 0x0001 | \*----------------------------------------------------------------------------*/ +/* + * Event AccessControlEntryChanged + */ +class ReadAccessControlAccessControlEntryChanged : public ModelCommand +{ +public: + ReadAccessControlAccessControlEntryChanged() : ModelCommand("read-event") + { + AddArgument("event-name", "access-control-entry-changed"); + ModelCommand::AddArguments(); + } + + ~ReadAccessControlAccessControlEntryChanged() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x001F) ReadEvent on endpoint %" PRIu8, endpointId); + + chip::Controller::AccessControlCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ReadEvent( + this, OnEventResponse, OnDefaultFailure); + } + + static void OnEventResponse(void * context, + chip::app::Clusters::AccessControl::Events::AccessControlEntryChanged::DecodableType value) + { + OnGeneralAttributeEventResponse(context, "AccessControl.AccessControlEntryChanged response", value); + } +}; + +class ReportAccessControlAccessControlEntryChanged : public ModelCommand +{ +public: + ReportAccessControlAccessControlEntryChanged() : ModelCommand("report-event") + { + AddArgument("event-name", "access-control-entry-changed"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~ReportAccessControlAccessControlEntryChanged() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x001F) ReportEvent on endpoint %" PRIu8, endpointId); + + chip::Controller::AccessControlCluster cluster; + cluster.Associate(device, endpointId); + + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeEvent( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + + static void OnValueReport(void * context, + chip::app::Clusters::AccessControl::Events::AccessControlEntryChanged::DecodableType value) + { + LogValue("AccessControl.AccessControlEntryChanged report", 0, value); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; +/* + * Event AccessControlExtensionChanged + */ +class ReadAccessControlAccessControlExtensionChanged : public ModelCommand +{ +public: + ReadAccessControlAccessControlExtensionChanged() : ModelCommand("read-event") + { + AddArgument("event-name", "access-control-extension-changed"); + ModelCommand::AddArguments(); + } + + ~ReadAccessControlAccessControlExtensionChanged() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x001F) ReadEvent on endpoint %" PRIu8, endpointId); + + chip::Controller::AccessControlCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ReadEvent( + this, OnEventResponse, OnDefaultFailure); + } + + static void OnEventResponse(void * context, + chip::app::Clusters::AccessControl::Events::AccessControlExtensionChanged::DecodableType value) + { + OnGeneralAttributeEventResponse(context, "AccessControl.AccessControlExtensionChanged response", value); + } +}; + +class ReportAccessControlAccessControlExtensionChanged : public ModelCommand +{ +public: + ReportAccessControlAccessControlExtensionChanged() : ModelCommand("report-event") + { + AddArgument("event-name", "access-control-extension-changed"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~ReportAccessControlAccessControlExtensionChanged() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x001F) ReportEvent on endpoint %" PRIu8, endpointId); + + chip::Controller::AccessControlCluster cluster; + cluster.Associate(device, endpointId); + + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeEvent( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + + static void OnValueReport(void * context, + chip::app::Clusters::AccessControl::Events::AccessControlExtensionChanged::DecodableType value) + { + LogValue("AccessControl.AccessControlExtensionChanged report", 0, value); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute Acl */ @@ -59892,11 +60143,15 @@ void registerClusterAccessControl(Commands & commands) const char * clusterName = "AccessControl"; commands_list clusterCommands = { - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // }; commands.Register(clusterName, clusterCommands);