From 29f766b5fccfa2055ea72dc1ee6a3d2a3564e11d Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 2 May 2023 09:26:33 -0400 Subject: [PATCH] Make the "status" type match the spec. It's 8 bits in the spec, not 16 bits. Fixes https://github.com/project-chip/connectedhomeip/issues/26317 --- .../all-clusters-app.matter | 12 ++++++------ .../all-clusters-minimal-app.matter | 12 ++++++------ .../light-switch-app.matter | 18 +++++++++--------- .../placeholder/linux/apps/app1/config.matter | 12 ++++++------ .../placeholder/linux/apps/app2/config.matter | 12 ++++++------ .../thermostat-common/thermostat.matter | 12 ++++++------ examples/window-app/common/window-app.matter | 12 ++++++------ src/app/util/ember-compatibility-functions.cpp | 2 +- src/app/zap-templates/common/override.js | 4 ++++ .../zcl/data-model/chip/chip-types.xml | 2 +- .../zcl/data-model/chip/scene.xml | 18 +++++++++--------- .../data_model/controller-clusters.matter | 18 +++++++++--------- .../app-common/zap-generated/attribute-size.h | 2 +- 13 files changed, 70 insertions(+), 66 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 7d5c990db66e81..42c84d484b7ef0 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 @@ -192,13 +192,13 @@ server cluster Scenes = 5 { } response struct AddSceneResponse = 0 { - ENUM8 status = 0; + status status = 0; group_id groupID = 1; INT8U sceneID = 2; } response struct ViewSceneResponse = 1 { - ENUM8 status = 0; + status status = 0; group_id groupID = 1; INT8U sceneID = 2; optional INT16U transitionTime = 3; @@ -207,24 +207,24 @@ server cluster Scenes = 5 { } response struct RemoveSceneResponse = 2 { - ENUM8 status = 0; + status status = 0; group_id groupID = 1; INT8U sceneID = 2; } response struct RemoveAllScenesResponse = 3 { - ENUM8 status = 0; + status status = 0; group_id groupID = 1; } response struct StoreSceneResponse = 4 { - ENUM8 status = 0; + status status = 0; group_id groupID = 1; INT8U sceneID = 2; } response struct GetSceneMembershipResponse = 6 { - ENUM8 status = 0; + status status = 0; nullable INT8U capacity = 1; group_id groupID = 2; optional INT8U sceneList[] = 3; diff --git a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter index 059bdeae17cece..b539775bb89a24 100644 --- a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter +++ b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter @@ -186,13 +186,13 @@ server cluster Scenes = 5 { } response struct AddSceneResponse = 0 { - ENUM8 status = 0; + status status = 0; group_id groupID = 1; INT8U sceneID = 2; } response struct ViewSceneResponse = 1 { - ENUM8 status = 0; + status status = 0; group_id groupID = 1; INT8U sceneID = 2; optional INT16U transitionTime = 3; @@ -201,24 +201,24 @@ server cluster Scenes = 5 { } response struct RemoveSceneResponse = 2 { - ENUM8 status = 0; + status status = 0; group_id groupID = 1; INT8U sceneID = 2; } response struct RemoveAllScenesResponse = 3 { - ENUM8 status = 0; + status status = 0; group_id groupID = 1; } response struct StoreSceneResponse = 4 { - ENUM8 status = 0; + status status = 0; group_id groupID = 1; INT8U sceneID = 2; } response struct GetSceneMembershipResponse = 6 { - ENUM8 status = 0; + status status = 0; nullable INT8U capacity = 1; group_id groupID = 2; optional INT8U sceneList[] = 3; diff --git a/examples/light-switch-app/light-switch-common/light-switch-app.matter b/examples/light-switch-app/light-switch-common/light-switch-app.matter index cba838c3007d9b..b7d15c21c5baa5 100644 --- a/examples/light-switch-app/light-switch-common/light-switch-app.matter +++ b/examples/light-switch-app/light-switch-common/light-switch-app.matter @@ -212,7 +212,7 @@ client cluster Scenes = 5 { } response struct AddSceneResponse = 0 { - ENUM8 status = 0; + status status = 0; group_id groupID = 1; INT8U sceneID = 2; } @@ -223,7 +223,7 @@ client cluster Scenes = 5 { } response struct ViewSceneResponse = 1 { - ENUM8 status = 0; + status status = 0; group_id groupID = 1; INT8U sceneID = 2; optional INT16U transitionTime = 3; @@ -237,7 +237,7 @@ client cluster Scenes = 5 { } response struct RemoveSceneResponse = 2 { - ENUM8 status = 0; + status status = 0; group_id groupID = 1; INT8U sceneID = 2; } @@ -247,7 +247,7 @@ client cluster Scenes = 5 { } response struct RemoveAllScenesResponse = 3 { - ENUM8 status = 0; + status status = 0; group_id groupID = 1; } @@ -257,7 +257,7 @@ client cluster Scenes = 5 { } response struct StoreSceneResponse = 4 { - ENUM8 status = 0; + status status = 0; group_id groupID = 1; INT8U sceneID = 2; } @@ -273,7 +273,7 @@ client cluster Scenes = 5 { } response struct GetSceneMembershipResponse = 6 { - ENUM8 status = 0; + status status = 0; nullable INT8U capacity = 1; group_id groupID = 2; optional INT8U sceneList[] = 3; @@ -288,7 +288,7 @@ client cluster Scenes = 5 { } response struct EnhancedAddSceneResponse = 64 { - ENUM8 status = 0; + status status = 0; group_id groupID = 1; INT8U sceneID = 2; } @@ -299,7 +299,7 @@ client cluster Scenes = 5 { } response struct EnhancedViewSceneResponse = 65 { - ENUM8 status = 0; + status status = 0; group_Id groupID = 1; INT8U sceneID = 2; optional INT16U transitionTime = 3; @@ -316,7 +316,7 @@ client cluster Scenes = 5 { } response struct CopySceneResponse = 66 { - ENUM8 status = 0; + status status = 0; group_Id groupIdentifierFrom = 1; INT8U sceneIdentifierFrom = 2; } diff --git a/examples/placeholder/linux/apps/app1/config.matter b/examples/placeholder/linux/apps/app1/config.matter index 1ed428f54b89a9..273c1ec586109d 100644 --- a/examples/placeholder/linux/apps/app1/config.matter +++ b/examples/placeholder/linux/apps/app1/config.matter @@ -192,13 +192,13 @@ server cluster Scenes = 5 { } response struct AddSceneResponse = 0 { - ENUM8 status = 0; + status status = 0; group_id groupID = 1; INT8U sceneID = 2; } response struct ViewSceneResponse = 1 { - ENUM8 status = 0; + status status = 0; group_id groupID = 1; INT8U sceneID = 2; optional INT16U transitionTime = 3; @@ -207,24 +207,24 @@ server cluster Scenes = 5 { } response struct RemoveSceneResponse = 2 { - ENUM8 status = 0; + status status = 0; group_id groupID = 1; INT8U sceneID = 2; } response struct RemoveAllScenesResponse = 3 { - ENUM8 status = 0; + status status = 0; group_id groupID = 1; } response struct StoreSceneResponse = 4 { - ENUM8 status = 0; + status status = 0; group_id groupID = 1; INT8U sceneID = 2; } response struct GetSceneMembershipResponse = 6 { - ENUM8 status = 0; + status status = 0; nullable INT8U capacity = 1; group_id groupID = 2; optional INT8U sceneList[] = 3; diff --git a/examples/placeholder/linux/apps/app2/config.matter b/examples/placeholder/linux/apps/app2/config.matter index cb867628e21df7..e94fe97c30e56f 100644 --- a/examples/placeholder/linux/apps/app2/config.matter +++ b/examples/placeholder/linux/apps/app2/config.matter @@ -192,13 +192,13 @@ server cluster Scenes = 5 { } response struct AddSceneResponse = 0 { - ENUM8 status = 0; + status status = 0; group_id groupID = 1; INT8U sceneID = 2; } response struct ViewSceneResponse = 1 { - ENUM8 status = 0; + status status = 0; group_id groupID = 1; INT8U sceneID = 2; optional INT16U transitionTime = 3; @@ -207,24 +207,24 @@ server cluster Scenes = 5 { } response struct RemoveSceneResponse = 2 { - ENUM8 status = 0; + status status = 0; group_id groupID = 1; INT8U sceneID = 2; } response struct RemoveAllScenesResponse = 3 { - ENUM8 status = 0; + status status = 0; group_id groupID = 1; } response struct StoreSceneResponse = 4 { - ENUM8 status = 0; + status status = 0; group_id groupID = 1; INT8U sceneID = 2; } response struct GetSceneMembershipResponse = 6 { - ENUM8 status = 0; + status status = 0; nullable INT8U capacity = 1; group_id groupID = 2; optional INT8U sceneList[] = 3; diff --git a/examples/thermostat/thermostat-common/thermostat.matter b/examples/thermostat/thermostat-common/thermostat.matter index 5711a58d2c24d8..c80be3c5798312 100644 --- a/examples/thermostat/thermostat-common/thermostat.matter +++ b/examples/thermostat/thermostat-common/thermostat.matter @@ -240,13 +240,13 @@ server cluster Scenes = 5 { } response struct AddSceneResponse = 0 { - ENUM8 status = 0; + status status = 0; group_id groupID = 1; INT8U sceneID = 2; } response struct ViewSceneResponse = 1 { - ENUM8 status = 0; + status status = 0; group_id groupID = 1; INT8U sceneID = 2; optional INT16U transitionTime = 3; @@ -255,24 +255,24 @@ server cluster Scenes = 5 { } response struct RemoveSceneResponse = 2 { - ENUM8 status = 0; + status status = 0; group_id groupID = 1; INT8U sceneID = 2; } response struct RemoveAllScenesResponse = 3 { - ENUM8 status = 0; + status status = 0; group_id groupID = 1; } response struct StoreSceneResponse = 4 { - ENUM8 status = 0; + status status = 0; group_id groupID = 1; INT8U sceneID = 2; } response struct GetSceneMembershipResponse = 6 { - ENUM8 status = 0; + status status = 0; nullable INT8U capacity = 1; group_id groupID = 2; optional INT8U sceneList[] = 3; diff --git a/examples/window-app/common/window-app.matter b/examples/window-app/common/window-app.matter index 0ac80a3916d20e..a1a0b80460ee2c 100644 --- a/examples/window-app/common/window-app.matter +++ b/examples/window-app/common/window-app.matter @@ -192,13 +192,13 @@ server cluster Scenes = 5 { } response struct AddSceneResponse = 0 { - ENUM8 status = 0; + status status = 0; group_id groupID = 1; INT8U sceneID = 2; } response struct ViewSceneResponse = 1 { - ENUM8 status = 0; + status status = 0; group_id groupID = 1; INT8U sceneID = 2; optional INT16U transitionTime = 3; @@ -207,24 +207,24 @@ server cluster Scenes = 5 { } response struct RemoveSceneResponse = 2 { - ENUM8 status = 0; + status status = 0; group_id groupID = 1; INT8U sceneID = 2; } response struct RemoveAllScenesResponse = 3 { - ENUM8 status = 0; + status status = 0; group_id groupID = 1; } response struct StoreSceneResponse = 4 { - ENUM8 status = 0; + status status = 0; group_id groupID = 1; INT8U sceneID = 2; } response struct GetSceneMembershipResponse = 6 { - ENUM8 status = 0; + status status = 0; nullable INT8U capacity = 1; group_id groupID = 2; optional INT8U sceneList[] = 3; diff --git a/src/app/util/ember-compatibility-functions.cpp b/src/app/util/ember-compatibility-functions.cpp index 2a18548ad07bb7..7faf6116890300 100644 --- a/src/app/util/ember-compatibility-functions.cpp +++ b/src/app/util/ember-compatibility-functions.cpp @@ -73,6 +73,7 @@ EmberAfAttributeType BaseType(EmberAfAttributeType type) case ZCL_FABRIC_IDX_ATTRIBUTE_TYPE: // Fabric Index case ZCL_BITMAP8_ATTRIBUTE_TYPE: // 8-bit bitmap case ZCL_ENUM8_ATTRIBUTE_TYPE: // 8-bit enumeration + case ZCL_STATUS_ATTRIBUTE_TYPE: // Status Code case ZCL_PERCENT_ATTRIBUTE_TYPE: // Percentage static_assert(std::is_same::value, "chip::Percent is expected to be uint8_t, change this when necessary"); @@ -83,7 +84,6 @@ EmberAfAttributeType BaseType(EmberAfAttributeType type) case ZCL_VENDOR_ID_ATTRIBUTE_TYPE: // Vendor Id case ZCL_ENUM16_ATTRIBUTE_TYPE: // 16-bit enumeration case ZCL_BITMAP16_ATTRIBUTE_TYPE: // 16-bit bitmap - case ZCL_STATUS_ATTRIBUTE_TYPE: // Status Code case ZCL_PERCENT100THS_ATTRIBUTE_TYPE: // 100ths of a percent static_assert(std::is_same::value, "chip::EndpointId is expected to be uint16_t, change this when necessary"); diff --git a/src/app/zap-templates/common/override.js b/src/app/zap-templates/common/override.js index 57275493fb3764..9552bf4e113101 100644 --- a/src/app/zap-templates/common/override.js +++ b/src/app/zap-templates/common/override.js @@ -58,6 +58,10 @@ function atomicType(arg) return 'chip::EventNumber'; case 'fabric_idx': return 'chip::FabricIndex'; + case 'status': + // We can't make this into InteractionModel::Status, since it might be a + // cluster-specific status. + return 'uint8_t'; case 'octet_string': case 'long_octet_string': return 'chip::ByteSpan'; 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 95123673d405fb..c1bd6043813ff4 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 @@ -70,7 +70,7 @@ limitations under the License. - + diff --git a/src/app/zap-templates/zcl/data-model/chip/scene.xml b/src/app/zap-templates/zcl/data-model/chip/scene.xml index 1cc60a956483f9..ee0e60b4fc41d6 100644 --- a/src/app/zap-templates/zcl/data-model/chip/scene.xml +++ b/src/app/zap-templates/zcl/data-model/chip/scene.xml @@ -146,7 +146,7 @@ limitations under the License. The command is generated in response to a received unicast AddScene command, - + @@ -155,7 +155,7 @@ limitations under the License. The command is generated in response to a received unicast ViewScene command - + @@ -167,7 +167,7 @@ limitations under the License. The command is generated in response to a received unicast RemoveScene command - + @@ -176,7 +176,7 @@ limitations under the License. The command is generated in response to a received unicast RemoveAllScenes command - + @@ -184,7 +184,7 @@ limitations under the License. The command is generated in response to a received unicast StoreScene command - + @@ -193,7 +193,7 @@ limitations under the License. The command is generated in response to a received unicast GetSceneMembership command - + @@ -203,7 +203,7 @@ limitations under the License. The command is generated in response to a received unicast EnhancedAddScene command - + @@ -212,7 +212,7 @@ limitations under the License. The command is generated in response to a received unicast EnhancedViewScene command - + @@ -224,7 +224,7 @@ limitations under the License. The command is generated in response to a received unicast CopyScene command - + diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index a77f66684da4c4..3cbadf7a89a051 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -172,7 +172,7 @@ client cluster Scenes = 5 { } response struct AddSceneResponse = 0 { - ENUM8 status = 0; + status status = 0; group_id groupID = 1; INT8U sceneID = 2; } @@ -183,7 +183,7 @@ client cluster Scenes = 5 { } response struct ViewSceneResponse = 1 { - ENUM8 status = 0; + status status = 0; group_id groupID = 1; INT8U sceneID = 2; optional INT16U transitionTime = 3; @@ -197,7 +197,7 @@ client cluster Scenes = 5 { } response struct RemoveSceneResponse = 2 { - ENUM8 status = 0; + status status = 0; group_id groupID = 1; INT8U sceneID = 2; } @@ -207,7 +207,7 @@ client cluster Scenes = 5 { } response struct RemoveAllScenesResponse = 3 { - ENUM8 status = 0; + status status = 0; group_id groupID = 1; } @@ -217,7 +217,7 @@ client cluster Scenes = 5 { } response struct StoreSceneResponse = 4 { - ENUM8 status = 0; + status status = 0; group_id groupID = 1; INT8U sceneID = 2; } @@ -233,7 +233,7 @@ client cluster Scenes = 5 { } response struct GetSceneMembershipResponse = 6 { - ENUM8 status = 0; + status status = 0; nullable INT8U capacity = 1; group_id groupID = 2; optional INT8U sceneList[] = 3; @@ -248,7 +248,7 @@ client cluster Scenes = 5 { } response struct EnhancedAddSceneResponse = 64 { - ENUM8 status = 0; + status status = 0; group_id groupID = 1; INT8U sceneID = 2; } @@ -259,7 +259,7 @@ client cluster Scenes = 5 { } response struct EnhancedViewSceneResponse = 65 { - ENUM8 status = 0; + status status = 0; group_Id groupID = 1; INT8U sceneID = 2; optional INT16U transitionTime = 3; @@ -276,7 +276,7 @@ client cluster Scenes = 5 { } response struct CopySceneResponse = 66 { - ENUM8 status = 0; + status status = 0; group_Id groupIdentifierFrom = 1; INT8U sceneIdentifierFrom = 2; } 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 1c8dc9b444bb1e..8d51c73d95580c 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 @@ -32,6 +32,6 @@ ZCL_BOOLEAN_ATTRIBUTE_TYPE, 1, ZCL_BITMAP8_ATTRIBUTE_TYPE, 1, ZCL_BITMAP16_ATTRI ZCL_PERCENT100THS_ATTRIBUTE_TYPE, 2, ZCL_CLUSTER_ID_ATTRIBUTE_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, 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,