From 9d7e65c35e02947465a8ee7eae2ac9cb8f143c47 Mon Sep 17 00:00:00 2001 From: Song Guo Date: Thu, 20 Jan 2022 14:51:11 +0800 Subject: [PATCH] Run Codegen --- .../all-clusters-app.matter | 5 +++ .../python/chip/clusters/Objects.py | 29 ++++++++++++++ .../CHIP/zap-generated/CHIPStructsObjc.h | 5 +++ .../CHIP/zap-generated/CHIPStructsObjc.mm | 11 ++++++ .../zap-generated/endpoint_config.h | 16 ++++---- .../app-common/zap-generated/af-structs.h | 6 +++ .../app-common/zap-generated/attribute-id.h | 1 + .../zap-generated/cluster-objects.cpp | 39 +++++++++++++++++++ .../zap-generated/cluster-objects.h | 34 ++++++++++++++++ .../app-common/zap-generated/ids/Attributes.h | 4 ++ .../zap-generated/cluster/Commands.h | 17 ++++++++ 11 files changed, 160 insertions(+), 7 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 bfda8a92abea9b..d17e0594526f7b 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 @@ -2527,6 +2527,10 @@ server cluster TestCluster = 1295 { double h = 7; } + struct TestFabricScoped { + fabric_idx fabricIndex = 0; + } + struct NestedStructList { INT8U a = 0; BOOLEAN b = 1; @@ -2595,6 +2599,7 @@ server cluster TestCluster = 1295 { attribute int16u rangeRestrictedInt16u = 40; attribute int16s rangeRestrictedInt16s = 41; readonly attribute LONG_OCTET_STRING listLongOctetString[] = 42; + readonly attribute TestFabricScoped listFabricScoped[] = 43; attribute boolean timedWriteBoolean = 48; attribute boolean nullableBoolean = 32768; attribute bitmap8 nullableBitmap8 = 32769; diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index e1dfcb274b8e43..3f53c50c120e90 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -29799,6 +29799,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="rangeRestrictedInt16u", Tag=0x00000028, Type=uint), ClusterObjectFieldDescriptor(Label="rangeRestrictedInt16s", Tag=0x00000029, Type=int), ClusterObjectFieldDescriptor(Label="listLongOctetString", Tag=0x0000002A, Type=typing.List[bytes]), + ClusterObjectFieldDescriptor(Label="listFabricScoped", Tag=0x0000002B, Type=typing.List[TestCluster.Structs.TestFabricScoped]), ClusterObjectFieldDescriptor(Label="timedWriteBoolean", Tag=0x00000030, Type=bool), ClusterObjectFieldDescriptor(Label="unsupported", Tag=0x000000FF, Type=bool), ClusterObjectFieldDescriptor(Label="nullableBoolean", Tag=0x00008000, Type=typing.Union[Nullable, bool]), @@ -29882,6 +29883,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: rangeRestrictedInt16u: 'uint' = None rangeRestrictedInt16s: 'int' = None listLongOctetString: 'typing.List[bytes]' = None + listFabricScoped: 'typing.List[TestCluster.Structs.TestFabricScoped]' = None timedWriteBoolean: 'bool' = None unsupported: 'bool' = None nullableBoolean: 'typing.Union[Nullable, bool]' = None @@ -30037,6 +30039,17 @@ def descriptor(cls) -> ClusterObjectDescriptor: a: 'typing.List[TestCluster.Structs.NestedStructList]' = field(default_factory=lambda: []) + @dataclass + class TestFabricScoped(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields = [ + ClusterObjectFieldDescriptor(Label="fabricIndex", Tag=0, Type=uint), + ]) + + fabricIndex: 'uint' = 0 + @dataclass class TestListStructOctet(ClusterObject): @ChipUtility.classproperty @@ -31329,6 +31342,22 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: 'typing.List[bytes]' = field(default_factory=lambda: []) + @dataclass + class ListFabricScoped(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x050F + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000002B + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[TestCluster.Structs.TestFabricScoped]) + + value: 'typing.List[TestCluster.Structs.TestFabricScoped]' = field(default_factory=lambda: []) + @dataclass class TimedWriteBoolean(ClusterAttributeDescriptor): @ChipUtility.classproperty diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.h index 77d89dd91468fd..55208b34251297 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.h @@ -456,6 +456,11 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)init; @end +@interface CHIPTestClusterClusterTestFabricScoped : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull fabricIndex; +- (instancetype)init; +@end + @interface CHIPTestClusterClusterTestListStructOctet : NSObject @property (strong, nonatomic) NSNumber * _Nonnull fabricIndex; @property (strong, nonatomic) NSData * _Nonnull operationalCert; diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.mm index de4f4843d9b2d4..aa690e434db4ac 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.mm @@ -938,6 +938,17 @@ - (instancetype)init } @end +@implementation CHIPTestClusterClusterTestFabricScoped +- (instancetype)init +{ + if (self = [super init]) { + + _fabricIndex = @(0); + } + return self; +} +@end + @implementation CHIPTestClusterClusterTestListStructOctet - (instancetype)init { diff --git a/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h b/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h index 7a87e98863a0e6..ec4679c0b904fd 100644 --- a/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h +++ b/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h @@ -1484,7 +1484,7 @@ #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask // This is an array of EmberAfAttributeMetadata structures. -#define GENERATED_ATTRIBUTE_COUNT 615 +#define GENERATED_ATTRIBUTE_COUNT 616 #define GENERATED_ATTRIBUTES \ { \ \ @@ -2270,6 +2270,8 @@ { 0x00000029, ZAP_TYPE(INT16S), 2, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_MIN_MAX_DEFAULTS_INDEX(34) }, /* range_restricted_int16s */ \ { 0x0000002A, ZAP_TYPE(ARRAY), 1000, 0, ZAP_LONG_DEFAULTS_INDEX(2942) }, /* list_long_octet_string */ \ + { 0x0000002B, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* list_fabric_scoped */ \ { 0x00000030, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(MUST_USE_TIMED_WRITE), \ ZAP_EMPTY_DEFAULT() }, /* timed_write_boolean */ \ { 0x00008000, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ @@ -2700,28 +2702,28 @@ 0x0000050E, ZAP_ATTRIBUTE_INDEX(506), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Account Login (server) */ \ { \ - 0x0000050F, ZAP_ATTRIBUTE_INDEX(507), 78, 3285, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0000050F, ZAP_ATTRIBUTE_INDEX(507), 79, 3285, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Test Cluster (server) */ \ { \ - 0x00000B04, ZAP_ATTRIBUTE_INDEX(585), 12, 28, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x00000B04, ZAP_ATTRIBUTE_INDEX(586), 12, 28, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Electrical Measurement (server) */ \ { 0x00000004, \ - ZAP_ATTRIBUTE_INDEX(597), \ + ZAP_ATTRIBUTE_INDEX(598), \ 2, \ 3, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayGroupsServer }, /* Endpoint: 2, Cluster: Groups (server) */ \ { 0x00000006, \ - ZAP_ATTRIBUTE_INDEX(599), \ + ZAP_ATTRIBUTE_INDEX(600), \ 7, \ 13, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayOnOffServer }, /* Endpoint: 2, Cluster: On/Off (server) */ \ { \ - 0x0000001D, ZAP_ATTRIBUTE_INDEX(606), 5, 0, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0000001D, ZAP_ATTRIBUTE_INDEX(607), 5, 0, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 2, Cluster: Descriptor (server) */ \ { 0x00000406, \ - ZAP_ATTRIBUTE_INDEX(611), \ + ZAP_ATTRIBUTE_INDEX(612), \ 4, \ 5, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ diff --git a/zzz_generated/app-common/app-common/zap-generated/af-structs.h b/zzz_generated/app-common/app-common/zap-generated/af-structs.h index 0631b180ff8857..8927d4f43c5f3c 100644 --- a/zzz_generated/app-common/app-common/zap-generated/af-structs.h +++ b/zzz_generated/app-common/app-common/zap-generated/af-structs.h @@ -506,6 +506,12 @@ typedef struct _TargetInfo chip::CharSpan name; } TargetInfo; +// Struct for TestFabricScoped +typedef struct _TestFabricScoped +{ + chip::FabricIndex fabricIndex; +} TestFabricScoped; + // Struct for TestListStructOctet typedef struct _TestListStructOctet { diff --git a/zzz_generated/app-common/app-common/zap-generated/attribute-id.h b/zzz_generated/app-common/app-common/zap-generated/attribute-id.h index aea2d23d566967..1d74fa332150ae 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attribute-id.h +++ b/zzz_generated/app-common/app-common/zap-generated/attribute-id.h @@ -1501,6 +1501,7 @@ #define ZCL_RANGE_RESTRICTED_INT16_U_ATTRIBUTE_ID (0x0028) #define ZCL_RANGE_RESTRICTED_INT16S_ATTRIBUTE_ID (0x0029) #define ZCL_LIST_LONG_OCTET_STRING_ATTRIBUTE_ID (0x002A) +#define ZCL_LIST_FABRIC_SCOPED_ATTRIBUTE_ID (0x002B) #define ZCL_TIMED_WRITE_BOOLEAN_ATTRIBUTE_ID (0x0030) #define ZCL_UNSUPPORTED_ATTRIBUTE_ID (0x00FF) #define ZCL_NULLABLE_BOOLEAN_ATTRIBUTE_ID (0x8000) 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 4afd56afd3ff67..45fe3c3bd73c51 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 @@ -21936,6 +21936,42 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } } // namespace DoubleNestedStructList +namespace TestFabricScoped { +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::kFabricIndex)), fabricIndex)); + 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); + err = reader.EnterContainer(outer); + ReturnErrorOnFailure(err); + 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::kFabricIndex): + ReturnErrorOnFailure(DataModel::Decode(reader, fabricIndex)); + break; + default: + break; + } + } + + VerifyOrReturnError(err == CHIP_END_OF_TLV, err); + ReturnErrorOnFailure(reader.ExitContainer(outer)); + return CHIP_NO_ERROR; +} + +} // namespace TestFabricScoped namespace TestListStructOctet { CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const { @@ -23435,6 +23471,9 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre case Attributes::ListLongOctetString::TypeInfo::GetAttributeId(): ReturnErrorOnFailure(DataModel::Decode(reader, listLongOctetString)); break; + case Attributes::ListFabricScoped::TypeInfo::GetAttributeId(): + ReturnErrorOnFailure(DataModel::Decode(reader, listFabricScoped)); + break; case Attributes::TimedWriteBoolean::TypeInfo::GetAttributeId(): ReturnErrorOnFailure(DataModel::Decode(reader, timedWriteBoolean)); break; 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 c504ead4c10204..567cb9de1b7c11 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 @@ -33645,6 +33645,25 @@ struct DecodableType }; } // namespace DoubleNestedStructList +namespace TestFabricScoped { +enum class Fields +{ + kFabricIndex = 0, +}; + +struct Type +{ +public: + chip::FabricIndex fabricIndex = static_cast(0); + + CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; + CHIP_ERROR Decode(TLV::TLVReader & reader); + bool MatchesFabricIndex(FabricIndex fabricIndex_) const { return fabricIndex == fabricIndex_; } +}; + +using DecodableType = Type; + +} // namespace TestFabricScoped namespace TestListStructOctet { enum class Fields { @@ -35529,6 +35548,20 @@ struct TypeInfo static constexpr bool MustUseTimedWrite() { return false; } }; } // namespace ListLongOctetString +namespace ListFabricScoped { +struct TypeInfo +{ + using Type = chip::app::DataModel::List; + using DecodableType = + chip::app::DataModel::DecodableList; + using DecodableArgType = + const chip::app::DataModel::DecodableList &; + + static constexpr ClusterId GetClusterId() { return Clusters::TestCluster::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::ListFabricScoped::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace ListFabricScoped namespace TimedWriteBoolean { struct TypeInfo { @@ -36038,6 +36071,7 @@ struct TypeInfo Attributes::RangeRestrictedInt16u::TypeInfo::DecodableType rangeRestrictedInt16u = static_cast(0); Attributes::RangeRestrictedInt16s::TypeInfo::DecodableType rangeRestrictedInt16s = static_cast(0); Attributes::ListLongOctetString::TypeInfo::DecodableType listLongOctetString; + Attributes::ListFabricScoped::TypeInfo::DecodableType listFabricScoped; Attributes::TimedWriteBoolean::TypeInfo::DecodableType timedWriteBoolean = static_cast(0); Attributes::Unsupported::TypeInfo::DecodableType unsupported = static_cast(0); Attributes::NullableBoolean::TypeInfo::DecodableType nullableBoolean; 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 b852d6334c9776..9d03aae14f4849 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 @@ -5268,6 +5268,10 @@ namespace ListLongOctetString { static constexpr AttributeId Id = 0x0000002A; } // namespace ListLongOctetString +namespace ListFabricScoped { +static constexpr AttributeId Id = 0x0000002B; +} // namespace ListFabricScoped + namespace TimedWriteBoolean { static constexpr AttributeId Id = 0x00000030; } // namespace TimedWriteBoolean diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index cc180ac9db53c4..971c02d13a0e17 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -145,6 +145,8 @@ CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::TestCluster::Structs::NestedStructList::DecodableType & value); CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::TestCluster::Structs::DoubleNestedStructList::DecodableType & value); +CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::TestCluster::Structs::TestFabricScoped::DecodableType & value); CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::TestCluster::Structs::TestListStructOctet::DecodableType & value); @@ -2517,6 +2519,21 @@ CHIP_ERROR LogValue(const char * label, size_t indent, ChipLogProgress(chipTool, "%s}", IndentStr(indent).c_str()); return CHIP_NO_ERROR; } +CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::TestCluster::Structs::TestFabricScoped::DecodableType & value) +{ + ChipLogProgress(chipTool, "%s%s: {", IndentStr(indent).c_str(), label); + { + CHIP_ERROR err = LogValue("FabricIndex", indent + 1, value.fabricIndex); + if (err != CHIP_NO_ERROR) + { + ChipLogProgress(chipTool, "%sStruct truncated due to invalid value for 'FabricIndex'", 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, const chip::app::Clusters::TestCluster::Structs::TestListStructOctet::DecodableType & value) {