From ce37c4ca86537ae717853b96cbb9fc4638ca3edc Mon Sep 17 00:00:00 2001 From: Harsha Rajendran Date: Fri, 4 Feb 2022 09:07:52 -0500 Subject: [PATCH] Enabling Basic Information Cluster in the ota-provider app (#14765) --- .../ota-provider-app.matter | 38 +++++++++ .../ota-provider-common/ota-provider-app.zap | 8 +- .../PluginApplicationCallbacks.h | 1 + .../zap-generated/callback-stub.cpp | 8 ++ .../zap-generated/endpoint_config.h | 84 +++++++++++++++---- .../zap-generated/gen_config.h | 6 ++ 6 files changed, 127 insertions(+), 18 deletions(-) diff --git a/examples/ota-provider-app/ota-provider-common/ota-provider-app.matter b/examples/ota-provider-app/ota-provider-common/ota-provider-app.matter index a9469260f65c29..f575b36cda6c98 100644 --- a/examples/ota-provider-app/ota-provider-common/ota-provider-app.matter +++ b/examples/ota-provider-app/ota-provider-common/ota-provider-app.matter @@ -130,6 +130,43 @@ server cluster AccessControl = 31 { readonly global attribute int16u clusterRevision = 65533; } +server cluster Basic = 40 { + critical event StartUp = 0 { + INT32U softwareVersion = 0; + } + + critical event ShutDown = 1 { + } + + info event Leave = 2 { + } + + info event ReachableChanged = 3 { + boolean reachableNewValue = 0; + } + + readonly attribute int16u dataModelRevision = 0; + readonly attribute char_string<32> vendorName = 1; + readonly attribute vendor_id vendorID = 2; + readonly attribute char_string<32> productName = 3; + readonly attribute int16u productID = 4; + attribute char_string<32> nodeLabel = 5; + attribute char_string<2> location = 6; + readonly attribute int16u hardwareVersion = 7; + readonly attribute char_string<64> hardwareVersionString = 8; + readonly attribute int32u softwareVersion = 9; + readonly attribute char_string<64> softwareVersionString = 10; + readonly attribute char_string<16> manufacturingDate = 11; + readonly attribute char_string<32> partNumber = 12; + readonly attribute long_char_string<256> productURL = 13; + readonly attribute char_string<64> productLabel = 14; + readonly attribute char_string<32> serialNumber = 15; + attribute boolean localConfigDisabled = 16; + readonly attribute boolean reachable = 17; + readonly attribute char_string<32> uniqueID = 18; + readonly global attribute int16u clusterRevision = 65533; +} + server cluster FixedLabel = 64 { readonly attribute LabelStruct labelList[] = 0; readonly global attribute int16u clusterRevision = 65533; @@ -523,6 +560,7 @@ server cluster UserLabel = 65 { endpoint 0 { binding cluster AccessControl; server cluster AccessControl; + server cluster Basic; server cluster FixedLabel; server cluster GeneralCommissioning; server cluster LocalizationConfiguration; diff --git a/examples/ota-provider-app/ota-provider-common/ota-provider-app.zap b/examples/ota-provider-app/ota-provider-common/ota-provider-app.zap index be7305b3b5a893..83e230cbc5ce4a 100644 --- a/examples/ota-provider-app/ota-provider-common/ota-provider-app.zap +++ b/examples/ota-provider-app/ota-provider-common/ota-provider-app.zap @@ -864,11 +864,11 @@ "mfgCode": null, "define": "BASIC_CLUSTER", "side": "server", - "enabled": 0, + "enabled": 1, "commands": [], "attributes": [ { - "name": "DataModelRevision", + "name": "InteractionModelVersion", "code": 0, "mfgCode": null, "side": "server", @@ -1629,7 +1629,7 @@ "reportableChange": 0 }, { - "name": "BasicCommissioningInfo", + "name": "BasicCommissioningInfoList", "code": 1, "mfgCode": null, "side": "server", @@ -4251,4 +4251,4 @@ } ], "log": [] -} +} \ No newline at end of file diff --git a/zzz_generated/ota-provider-app/zap-generated/PluginApplicationCallbacks.h b/zzz_generated/ota-provider-app/zap-generated/PluginApplicationCallbacks.h index c2b16e2e97b374..4368f88d0e6a2a 100644 --- a/zzz_generated/ota-provider-app/zap-generated/PluginApplicationCallbacks.h +++ b/zzz_generated/ota-provider-app/zap-generated/PluginApplicationCallbacks.h @@ -24,6 +24,7 @@ #define MATTER_PLUGINS_INIT \ MatterAccessControlPluginClientInitCallback(); \ MatterAccessControlPluginServerInitCallback(); \ + MatterBasicPluginServerInitCallback(); \ MatterFixedLabelPluginServerInitCallback(); \ MatterGeneralCommissioningPluginServerInitCallback(); \ MatterLocalizationConfigurationPluginServerInitCallback(); \ diff --git a/zzz_generated/ota-provider-app/zap-generated/callback-stub.cpp b/zzz_generated/ota-provider-app/zap-generated/callback-stub.cpp index 1db898dd6ab740..e5801d09058651 100644 --- a/zzz_generated/ota-provider-app/zap-generated/callback-stub.cpp +++ b/zzz_generated/ota-provider-app/zap-generated/callback-stub.cpp @@ -32,6 +32,9 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId) case ZCL_ACCESS_CONTROL_CLUSTER_ID: emberAfAccessControlClusterInitCallback(endpoint); break; + case ZCL_BASIC_CLUSTER_ID: + emberAfBasicClusterInitCallback(endpoint); + break; case ZCL_FIXED_LABEL_CLUSTER_ID: emberAfFixedLabelClusterInitCallback(endpoint); break; @@ -67,6 +70,11 @@ void __attribute__((weak)) emberAfAccessControlClusterInitCallback(EndpointId en // To prevent warning (void) endpoint; } +void __attribute__((weak)) emberAfBasicClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} void __attribute__((weak)) emberAfFixedLabelClusterInitCallback(EndpointId endpoint) { // To prevent warning diff --git a/zzz_generated/ota-provider-app/zap-generated/endpoint_config.h b/zzz_generated/ota-provider-app/zap-generated/endpoint_config.h index 5723691a9e4912..7a75d52791cabe 100644 --- a/zzz_generated/ota-provider-app/zap-generated/endpoint_config.h +++ b/zzz_generated/ota-provider-app/zap-generated/endpoint_config.h @@ -116,7 +116,7 @@ #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask // This is an array of EmberAfAttributeMetadata structures. -#define GENERATED_ATTRIBUTE_COUNT 39 +#define GENERATED_ATTRIBUTE_COUNT 59 #define GENERATED_ATTRIBUTES \ { \ \ @@ -128,6 +128,48 @@ { 0x0000FFFB, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* AttributeList */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ + /* Endpoint: 0, Cluster: Basic (server) */ \ + { 0x00000000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_SIMPLE_DEFAULT(10) }, /* DataModelRevision */ \ + { 0x00000001, ZAP_TYPE(CHAR_STRING), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* VendorName */ \ + { 0x00000002, ZAP_TYPE(VENDOR_ID), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* VendorID */ \ + { 0x00000003, ZAP_TYPE(CHAR_STRING), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* ProductName */ \ + { 0x00000004, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* ProductID */ \ + { 0x00000005, ZAP_TYPE(CHAR_STRING), 33, \ + ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(SINGLETON) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ + ZAP_EMPTY_DEFAULT() }, /* NodeLabel */ \ + { 0x00000006, ZAP_TYPE(CHAR_STRING), 0, \ + ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ + ZAP_EMPTY_DEFAULT() }, /* Location */ \ + { 0x00000007, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* HardwareVersion */ \ + { 0x00000008, ZAP_TYPE(CHAR_STRING), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* HardwareVersionString */ \ + { 0x00000009, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* SoftwareVersion */ \ + { 0x0000000A, ZAP_TYPE(CHAR_STRING), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* SoftwareVersionString */ \ + { 0x0000000B, ZAP_TYPE(CHAR_STRING), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* ManufacturingDate */ \ + { 0x0000000C, ZAP_TYPE(CHAR_STRING), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* PartNumber */ \ + { 0x0000000D, ZAP_TYPE(LONG_CHAR_STRING), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* ProductURL */ \ + { 0x0000000E, ZAP_TYPE(CHAR_STRING), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* ProductLabel */ \ + { 0x0000000F, ZAP_TYPE(CHAR_STRING), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* SerialNumber */ \ + { 0x00000010, ZAP_TYPE(BOOLEAN), 1, \ + ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(SINGLETON) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ + ZAP_SIMPLE_DEFAULT(0) }, /* LocalConfigDisabled */ \ + { 0x00000011, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_SIMPLE_DEFAULT(1) }, /* Reachable */ \ + { 0x00000012, ZAP_TYPE(CHAR_STRING), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* UniqueID */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + \ /* Endpoint: 0, Cluster: OTA Software Update Provider (server) */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* ClusterRevision */ \ \ @@ -196,6 +238,9 @@ // Cluster function static arrays #define GENERATED_FUNCTION_ARRAYS \ + const EmberAfGenericClusterFunction chipFuncArrayBasicServer[] = { \ + (EmberAfGenericClusterFunction) emberAfBasicClusterServerInitCallback, \ + }; \ const EmberAfGenericClusterFunction chipFuncArrayLocalizationConfigurationServer[] = { \ (EmberAfGenericClusterFunction) emberAfLocalizationConfigurationClusterServerInitCallback, \ (EmberAfGenericClusterFunction) MatterLocalizationConfigurationClusterServerPreAttributeChangedCallback, \ @@ -261,7 +306,7 @@ // clang-format on #define ZAP_CLUSTER_MASK(mask) CLUSTER_MASK_##mask -#define GENERATED_CLUSTER_COUNT 10 +#define GENERATED_CLUSTER_COUNT 11 // clang-format off #define GENERATED_CLUSTERS { \ @@ -287,10 +332,21 @@ .clientGeneratedCommandList = nullptr ,\ .serverGeneratedCommandList = nullptr ,\ },\ + { \ + /* Endpoint: 0, Cluster: Basic (server) */ \ + .clusterId = 0x00000028, \ + .attributes = ZAP_ATTRIBUTE_INDEX(4), \ + .attributeCount = 20, \ + .clusterSize = 39, \ + .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ + .functions = chipFuncArrayBasicServer, \ + .clientGeneratedCommandList = nullptr ,\ + .serverGeneratedCommandList = nullptr ,\ + },\ { \ /* Endpoint: 0, Cluster: OTA Software Update Provider (server) */ \ .clusterId = 0x00000029, \ - .attributes = ZAP_ATTRIBUTE_INDEX(4), \ + .attributes = ZAP_ATTRIBUTE_INDEX(24), \ .attributeCount = 1, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -301,7 +357,7 @@ { \ /* Endpoint: 0, Cluster: Localization Configuration (server) */ \ .clusterId = 0x0000002B, \ - .attributes = ZAP_ATTRIBUTE_INDEX(5), \ + .attributes = ZAP_ATTRIBUTE_INDEX(25), \ .attributeCount = 3, \ .clusterSize = 38, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \ @@ -312,7 +368,7 @@ { \ /* Endpoint: 0, Cluster: Time Format Localization (server) */ \ .clusterId = 0x0000002C, \ - .attributes = ZAP_ATTRIBUTE_INDEX(8), \ + .attributes = ZAP_ATTRIBUTE_INDEX(28), \ .attributeCount = 4, \ .clusterSize = 4, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \ @@ -323,7 +379,7 @@ { \ /* Endpoint: 0, Cluster: General Commissioning (server) */ \ .clusterId = 0x00000030, \ - .attributes = ZAP_ATTRIBUTE_INDEX(12), \ + .attributes = ZAP_ATTRIBUTE_INDEX(32), \ .attributeCount = 6, \ .clusterSize = 16, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -334,7 +390,7 @@ { \ /* Endpoint: 0, Cluster: Network Commissioning (server) */ \ .clusterId = 0x00000031, \ - .attributes = ZAP_ATTRIBUTE_INDEX(18), \ + .attributes = ZAP_ATTRIBUTE_INDEX(38), \ .attributeCount = 10, \ .clusterSize = 60, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -345,7 +401,7 @@ { \ /* Endpoint: 0, Cluster: Operational Credentials (server) */ \ .clusterId = 0x0000003E, \ - .attributes = ZAP_ATTRIBUTE_INDEX(28), \ + .attributes = ZAP_ATTRIBUTE_INDEX(48), \ .attributeCount = 7, \ .clusterSize = 4, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -356,7 +412,7 @@ { \ /* Endpoint: 0, Cluster: Fixed Label (server) */ \ .clusterId = 0x00000040, \ - .attributes = ZAP_ATTRIBUTE_INDEX(35), \ + .attributes = ZAP_ATTRIBUTE_INDEX(55), \ .attributeCount = 2, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -367,7 +423,7 @@ { \ /* Endpoint: 0, Cluster: User Label (server) */ \ .clusterId = 0x00000041, \ - .attributes = ZAP_ATTRIBUTE_INDEX(37), \ + .attributes = ZAP_ATTRIBUTE_INDEX(57), \ .attributeCount = 2, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -381,22 +437,22 @@ #define ZAP_CLUSTER_INDEX(index) (&generatedClusters[index]) -#define ZAP_FIXED_ENDPOINT_DATA_VERSION_COUNT 9 +#define ZAP_FIXED_ENDPOINT_DATA_VERSION_COUNT 10 // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 10, 130 }, \ + { ZAP_CLUSTER_INDEX(0), 11, 169 }, \ } // Largest attribute size is needed for various buffers #define ATTRIBUTE_LARGEST (401) // Total size of singleton attributes -#define ATTRIBUTE_SINGLETONS_SIZE (0) +#define ATTRIBUTE_SINGLETONS_SIZE (39) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (130) +#define ATTRIBUTE_MAX_SIZE (169) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (1) diff --git a/zzz_generated/ota-provider-app/zap-generated/gen_config.h b/zzz_generated/ota-provider-app/zap-generated/gen_config.h index 01f218457209ad..dfec7d7f1da446 100644 --- a/zzz_generated/ota-provider-app/zap-generated/gen_config.h +++ b/zzz_generated/ota-provider-app/zap-generated/gen_config.h @@ -31,6 +31,7 @@ /**** Cluster endpoint counts ****/ #define EMBER_AF_ACCESS_CONTROL_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_ACCESS_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_BASIC_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_FIXED_LABEL_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_GENERAL_COMMISSIONING_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_LOCALIZATION_CONFIGURATION_CLUSTER_SERVER_ENDPOINT_COUNT (1) @@ -51,6 +52,11 @@ #define EMBER_AF_PLUGIN_ACCESS_CONTROL_SERVER #define EMBER_AF_PLUGIN_ACCESS_CONTROL +// Use this macro to check if the server side of the Basic cluster is included +#define ZCL_USING_BASIC_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_BASIC_SERVER +#define EMBER_AF_PLUGIN_BASIC + // Use this macro to check if the server side of the Fixed Label cluster is included #define ZCL_USING_FIXED_LABEL_CLUSTER_SERVER #define EMBER_AF_PLUGIN_FIXED_LABEL_SERVER