From 9bae8d5fc1bc6e896aaf9ac3d6eaec31c7db40ae Mon Sep 17 00:00:00 2001 From: Robert Szewczyk Date: Mon, 4 Sep 2023 18:42:19 -0700 Subject: [PATCH] Aligned chip-types.xml with the latest Matter spec (#28978) * Aligned chip-types.xml with the latest Matter spec * reordered the XML to use the same order as the spec; this should make maintenance a bit more sane * renumbered types to avoid duplication and conflicts and to align with the spec Fixes #28976 * Regen ZAP * Reflect the type changes in the Python codegen per code review comment * Add XSD validation for unique IDs * Add a unique constraint on the `id` element in `` sequence * Add chip-types.xml to the validator script --- .../matter_idl/generators/types.py | 8 ++- .../zcl/data-model/chip/chip-types.xml | 66 ++++++++++++------- src/app/zap-templates/zcl/validate.sh | 1 + src/app/zap-templates/zcl/zcl.xsd | 6 ++ .../app-common/zap-generated/attribute-size.h | 13 ++-- .../app-common/zap-generated/attribute-type.h | 47 +++++++------ 6 files changed, 87 insertions(+), 54 deletions(-) diff --git a/scripts/py_matter_idl/matter_idl/generators/types.py b/scripts/py_matter_idl/matter_idl/generators/types.py index a22275bf29bb0f..c5428a92ff6636 100644 --- a/scripts/py_matter_idl/matter_idl/generators/types.py +++ b/scripts/py_matter_idl/matter_idl/generators/types.py @@ -196,23 +196,27 @@ def is_struct(self) -> bool: "data_ver": BasicInteger(idl_name="data_ver", byte_count=4, is_signed=False), "date": BasicInteger(idl_name="date", byte_count=4, is_signed=False), "devtype_id": BasicInteger(idl_name="devtype_id", byte_count=4, is_signed=False), + "elapsed_s": BasicInteger(idl_name="elapsed_s", byte_count=4, is_signed=False), "endpoint_no": BasicInteger(idl_name="endpoint_no", byte_count=2, is_signed=False), + "entry_idx": BasicInteger(idl_name="entry_idx", byte_count=2, is_signed=False), "epoch_s": BasicInteger(idl_name="epoch_s", byte_count=4, is_signed=False), "epoch_us": BasicInteger(idl_name="epoch_us", byte_count=8, is_signed=False), - "elapsed_s": BasicInteger(idl_name="elapsed_s", byte_count=4, is_signed=False), "event_id": BasicInteger(idl_name="event_id", byte_count=4, is_signed=False), "event_no": BasicInteger(idl_name="event_no", byte_count=8, is_signed=False), "fabric_id": BasicInteger(idl_name="fabric_id", byte_count=8, is_signed=False), "fabric_idx": BasicInteger(idl_name="fabric_idx", byte_count=1, is_signed=False), "field_id": BasicInteger(idl_name="field_id", byte_count=4, is_signed=False), "group_id": BasicInteger(idl_name="group_id", byte_count=2, is_signed=False), + "namespace": BasicInteger(idl_name="namespace", byte_count=1, is_signed=False), "node_id": BasicInteger(idl_name="node_id", byte_count=8, is_signed=False), "percent": BasicInteger(idl_name="percent", byte_count=1, is_signed=False), "percent100ths": BasicInteger(idl_name="percent100ths", byte_count=2, is_signed=False), "posix_ms": BasicInteger(idl_name="posix_ms", byte_count=8, is_signed=False), + "priority": BasicInteger(idl_name="priority", byte_count=1, is_signed=False), "status": BasicInteger(idl_name="status", byte_count=2, is_signed=False), - "systime_us": BasicInteger(idl_name="systime_us", byte_count=8, is_signed=False), "systime_ms": BasicInteger(idl_name="systime_ms", byte_count=8, is_signed=False), + "systime_us": BasicInteger(idl_name="systime_us", byte_count=8, is_signed=False), + "tag": BasicInteger(idl_name="tag", byte_count=1, is_signed=False), "temperature": BasicInteger(idl_name="temperature", byte_count=2, is_signed=True), "tod": BasicInteger(idl_name="tod", byte_count=4, is_signed=False), "trans_id": BasicInteger(idl_name="trans_id", byte_count=4, is_signed=False), diff --git a/src/app/zap-templates/zcl/data-model/chip/chip-types.xml b/src/app/zap-templates/zcl/data-model/chip/chip-types.xml index 2e8f2bf400fae2..0756fd85569f6c 100644 --- a/src/app/zap-templates/zcl/data-model/chip/chip-types.xml +++ b/src/app/zap-templates/zcl/data-model/chip/chip-types.xml @@ -46,8 +46,6 @@ limitations under the License. - - @@ -57,39 +55,57 @@ limitations under the License. + + + + - - + + + - - - + + + + + + + + + + + + + + + - - - - + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + diff --git a/src/app/zap-templates/zcl/validate.sh b/src/app/zap-templates/zcl/validate.sh index 1ae73fea1084de..22fe1009eb6a2b 100755 --- a/src/app/zap-templates/zcl/validate.sh +++ b/src/app/zap-templates/zcl/validate.sh @@ -1,2 +1,3 @@ #!/bin/bash xmllint --noout --schema zcl.xsd data-model/chip/matter-devices.xml +xmllint --noout --schema zcl.xsd data-model/chip/chip-types.xml diff --git a/src/app/zap-templates/zcl/zcl.xsd b/src/app/zap-templates/zcl/zcl.xsd index 1a880304f27305..a00a9e48cb87c7 100644 --- a/src/app/zap-templates/zcl/zcl.xsd +++ b/src/app/zap-templates/zcl/zcl.xsd @@ -221,6 +221,10 @@ This schema describes the format of the XML files, that describe the ZCL specifi + + + + @@ -233,6 +237,8 @@ This schema describes the format of the XML files, that describe the ZCL specifi + + diff --git a/zzz_generated/app-common/app-common/zap-generated/attribute-size.h b/zzz_generated/app-common/app-common/zap-generated/attribute-size.h index 8abca661608b0b..f4e3e5cac680b3 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attribute-size.h +++ b/zzz_generated/app-common/app-common/zap-generated/attribute-size.h @@ -27,12 +27,13 @@ ZCL_BOOLEAN_ATTRIBUTE_TYPE, 1, ZCL_BITMAP8_ATTRIBUTE_TYPE, 1, ZCL_BITMAP16_ATTRI ZCL_INT56U_ATTRIBUTE_TYPE, 7, ZCL_INT64U_ATTRIBUTE_TYPE, 8, ZCL_INT8S_ATTRIBUTE_TYPE, 1, ZCL_INT16S_ATTRIBUTE_TYPE, 2, ZCL_INT24S_ATTRIBUTE_TYPE, 3, ZCL_INT32S_ATTRIBUTE_TYPE, 4, ZCL_INT40S_ATTRIBUTE_TYPE, 5, ZCL_INT48S_ATTRIBUTE_TYPE, 6, ZCL_INT56S_ATTRIBUTE_TYPE, 7, ZCL_INT64S_ATTRIBUTE_TYPE, 8, ZCL_ENUM8_ATTRIBUTE_TYPE, 1, ZCL_ENUM16_ATTRIBUTE_TYPE, 2, - ZCL_SINGLE_ATTRIBUTE_TYPE, 4, ZCL_DOUBLE_ATTRIBUTE_TYPE, 8, ZCL_POSIX_MS_ATTRIBUT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IBUTE_TYPE, 4, ZCL_ATTRIB_ID_ATTRIBUTE_TYPE, 4, ZCL_FIELD_ID_ATTRIBUTE_TYPE, 4, ZCL_EVENT_ID_ATTRIBUTE_TYPE, 4, ZCL_COMMAND_ID_ATTRIBUTE_TYPE, 4, ZCL_ACTION_ID_ATTRIBUTE_TYPE, - 1, ZCL_TRANS_ID_ATTRIBUTE_TYPE, 4, ZCL_NODE_ID_ATTRIBUTE_TYPE, 8, ZCL_VENDOR_ID_ATTRIBUTE_TYPE, 2, - ZCL_DEVTYPE_ID_ATTRIBUTE_TYPE, 4, ZCL_FABRIC_ID_ATTRIBUTE_TYPE, 8, ZCL_GROUP_ID_ATTRIBUTE_TYPE, 2, ZCL_STATUS_ATTRIBUTE_TYPE, 1, - ZCL_DATA_VER_ATTRIBUTE_TYPE, 4, ZCL_EVENT_NO_ATTRIBUTE_TYPE, 8, ZCL_ENDPOINT_NO_ATTRIBUTE_TYPE, 2, - ZCL_FABRIC_IDX_ATTRIBUTE_TYPE, 1, ZCL_IPV4ADR_ATTRIBUTE_TYPE, 4, ZCL_IPV6ADR_ATTRIBUTE_TYPE, 16, + 1, ZCL_TRANS_ID_ATTRIBUTE_TYPE, 4, ZCL_NODE_ID_ATTRIBUTE_TYPE, 8, ZCL_IPV4ADR_ATTRIBUTE_TYPE, 4, ZCL_IPV6ADR_ATTRIBUTE_TYPE, 16, diff --git a/zzz_generated/app-common/app-common/zap-generated/attribute-type.h b/zzz_generated/app-common/app-common/zap-generated/attribute-type.h index 721aba2706f5dc..e79d1281b33a8c 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attribute-type.h +++ b/zzz_generated/app-common/app-common/zap-generated/attribute-type.h @@ -48,6 +48,8 @@ enum ZCL_INT64S_ATTRIBUTE_TYPE = 0x2F, // Signed 64-bit integer ZCL_ENUM8_ATTRIBUTE_TYPE = 0x30, // 8-bit enumeration ZCL_ENUM16_ATTRIBUTE_TYPE = 0x31, // 16-bit enumeration + ZCL_PRIORITY_ATTRIBUTE_TYPE = 0x32, // Priority + ZCL_STATUS_ATTRIBUTE_TYPE = 0x33, // Status Code ZCL_SINGLE_ATTRIBUTE_TYPE = 0x39, // Single precision ZCL_DOUBLE_ATTRIBUTE_TYPE = 0x3A, // Double precision ZCL_OCTET_STRING_ATTRIBUTE_TYPE = 0x41, // Octet String @@ -56,38 +58,41 @@ enum ZCL_LONG_CHAR_STRING_ATTRIBUTE_TYPE = 0x44, // Long Character String ZCL_ARRAY_ATTRIBUTE_TYPE = 0x48, // List ZCL_STRUCT_ATTRIBUTE_TYPE = 0x4C, // Structure - ZCL_POSIX_MS_ATTRIBUTE_TYPE = 0xD0, // Posix Time Milliseconds + ZCL_GROUP_ID_ATTRIBUTE_TYPE = 0xC0, // Group ID + ZCL_ENDPOINT_NO_ATTRIBUTE_TYPE = 0xC1, // Endpoint Number + ZCL_VENDOR_ID_ATTRIBUTE_TYPE = 0xC2, // Vendor ID + ZCL_DEVTYPE_ID_ATTRIBUTE_TYPE = 0xC3, // Device Type ID + ZCL_FABRIC_ID_ATTRIBUTE_TYPE = 0xC4, // Fabric ID + ZCL_FABRIC_IDX_ATTRIBUTE_TYPE = 0xC5, // Fabric Index + ZCL_ENTRY_IDX_ATTRIBUTE_TYPE = 0xC6, // Entry Index + ZCL_DATA_VER_ATTRIBUTE_TYPE = 0xC7, // Data Version + ZCL_EVENT_NO_ATTRIBUTE_TYPE = 0xC8, // Event Number + ZCL_SEMTAG_ATTRIBUTE_TYPE = 0xC9, // Semantic Tag + ZCL_NAMESPACE_ATTRIBUTE_TYPE = 0xCA, // Namespace + ZCL_TAG_ATTRIBUTE_TYPE = 0xCB, // Tag + ZCL_SYSTIME_US_ATTRIBUTE_TYPE = 0xD0, // System Time Microseconds ZCL_SYSTIME_MS_ATTRIBUTE_TYPE = 0xD1, // System Time Milliseconds ZCL_ELAPSED_S_ATTRIBUTE_TYPE = 0xD2, // Elapsed Time Seconds - ZCL_TEMPERATURE_ATTRIBUTE_TYPE = 0xDB, // Temperature + ZCL_TEMPERATURE_ATTRIBUTE_TYPE = 0xD8, // Temperature ZCL_TOD_ATTRIBUTE_TYPE = 0xE0, // Time of day ZCL_DATE_ATTRIBUTE_TYPE = 0xE1, // Date ZCL_EPOCH_US_ATTRIBUTE_TYPE = 0xE3, // Epoch Microseconds ZCL_EPOCH_S_ATTRIBUTE_TYPE = 0xE4, // Epoch Seconds - ZCL_SYSTIME_US_ATTRIBUTE_TYPE = 0xE5, // System Time Microseconds + ZCL_POSIX_MS_ATTRIBUTE_TYPE = 0xE5, // Posix Time Milliseconds ZCL_PERCENT_ATTRIBUTE_TYPE = 0xE6, // Percentage units 1% ZCL_PERCENT100THS_ATTRIBUTE_TYPE = 0xE7, // Percentage units 0.01% ZCL_CLUSTER_ID_ATTRIBUTE_TYPE = 0xE8, // Cluster ID ZCL_ATTRIB_ID_ATTRIBUTE_TYPE = 0xE9, // Attribute ID - ZCL_FIELD_ID_ATTRIBUTE_TYPE = 0xEA, // Field ID - ZCL_EVENT_ID_ATTRIBUTE_TYPE = 0xEB, // Event ID - ZCL_COMMAND_ID_ATTRIBUTE_TYPE = 0xEC, // Command ID - ZCL_ACTION_ID_ATTRIBUTE_TYPE = 0xED, // Action ID + ZCL_FIELD_ID_ATTRIBUTE_TYPE = 0xEB, // Field ID + ZCL_EVENT_ID_ATTRIBUTE_TYPE = 0xEC, // Event ID + ZCL_COMMAND_ID_ATTRIBUTE_TYPE = 0xED, // Command ID + ZCL_ACTION_ID_ATTRIBUTE_TYPE = 0xEE, // Action ID ZCL_TRANS_ID_ATTRIBUTE_TYPE = 0xEF, // Transaction ID ZCL_NODE_ID_ATTRIBUTE_TYPE = 0xF0, // Node ID - ZCL_VENDOR_ID_ATTRIBUTE_TYPE = 0xF1, // Vendor ID - ZCL_DEVTYPE_ID_ATTRIBUTE_TYPE = 0xF2, // Device Type ID - ZCL_FABRIC_ID_ATTRIBUTE_TYPE = 0xF3, // Fabric ID - ZCL_GROUP_ID_ATTRIBUTE_TYPE = 0xF4, // Group ID - ZCL_STATUS_ATTRIBUTE_TYPE = 0xF5, // Status Code - ZCL_DATA_VER_ATTRIBUTE_TYPE = 0xF6, // Data Version - ZCL_EVENT_NO_ATTRIBUTE_TYPE = 0xF7, // Event Number - ZCL_ENDPOINT_NO_ATTRIBUTE_TYPE = 0xF8, // Endpoint Number - ZCL_FABRIC_IDX_ATTRIBUTE_TYPE = 0xF9, // Fabric Index - ZCL_IPADR_ATTRIBUTE_TYPE = 0xFA, // IP Address - ZCL_IPV4ADR_ATTRIBUTE_TYPE = 0xFB, // IPv4 Address - ZCL_IPV6ADR_ATTRIBUTE_TYPE = 0xFC, // IPv6 Address - ZCL_IPV6PRE_ATTRIBUTE_TYPE = 0xFD, // IPv6 Prefix - ZCL_HWADR_ATTRIBUTE_TYPE = 0xFE, // Hardware Address + ZCL_IPADR_ATTRIBUTE_TYPE = 0xF2, // IP Address + ZCL_IPV4ADR_ATTRIBUTE_TYPE = 0xF3, // IPv4 Address + ZCL_IPV6ADR_ATTRIBUTE_TYPE = 0xF4, // IPv6 Address + ZCL_IPV6PRE_ATTRIBUTE_TYPE = 0xF5, // IPv6 Prefix + ZCL_HWADR_ATTRIBUTE_TYPE = 0xF6, // Hardware Address ZCL_UNKNOWN_ATTRIBUTE_TYPE = 0xFF, // Unknown };