From 5a634f50c6ab824f9ebc78c73e5b6281033b49da Mon Sep 17 00:00:00 2001 From: lpbeliveau-silabs <112982107+lpbeliveau-silabs@users.noreply.github.com> Date: Fri, 5 Jul 2024 18:56:44 -0400 Subject: [PATCH] [Scenes] AttributeValue refactor (#33260) * Refactor AttributeValue to the appropriate Value* in AttributeValueList * Updated attribute value in test * Applied comments about typing and commented code, as well as example of colorcontrol in scenes * Made static check on same type instead of size * Update src/app/zap-templates/zcl/data-model/chip/scene.xml Co-authored-by: Boris Zbarsky * Added checks for missing values in level control and on off * Added checks for HasValue in color control apply scene handler * Added check on out of range values in the level control handler * Updated Zap generated files --------- Co-authored-by: Boris Zbarsky --- data_model/1.3/clusters/Scenes.xml | 116 ++++++------ .../all-clusters-app.matter | 15 +- .../all-clusters-minimal-app.matter | 15 +- ...tnode_dimmablepluginunit_f8a9a0b9d4.matter | 15 +- .../light-switch-app.matter | 15 +- .../light-switch-app/qpg/zap/switch.matter | 15 +- .../lighting-common/lighting-app.matter | 15 +- .../data_model/lighting-thread-app.matter | 15 +- .../data_model/lighting-wifi-app.matter | 15 +- .../placeholder/linux/apps/app1/config.matter | 15 +- .../placeholder/linux/apps/app2/config.matter | 15 +- .../nxp/zap/thermostat_matter_thread.matter | 15 +- .../nxp/zap/thermostat_matter_wifi.matter | 15 +- .../virtual-device-app.matter | 15 +- .../color-control-server.cpp | 79 +++++--- .../clusters/level-control/level-control.cpp | 26 ++- .../clusters/on-off-server/on-off-server.cpp | 13 +- .../clusters/scenes-server/SceneHandlerImpl.h | 4 +- src/app/tests/TestSceneTable.cpp | 59 +++--- .../suites/TestScenesFabricSceneInfo.yaml | 92 +++++++++- .../tests/suites/TestScenesMultiFabric.yaml | 8 +- .../suites/certification/Test_TC_S_2_2.yaml | 10 +- .../suites/certification/Test_TC_S_2_3.yaml | 28 +-- .../zcl/data-model/chip/scene.xml | 31 +++- .../data_model/controller-clusters.matter | 15 +- .../chip/devicecontroller/ChipStructs.java | 147 ++++++++++++--- .../chip/devicecontroller/cluster/files.gni | 2 +- ...enesManagementClusterAttributeValuePair.kt | 56 ------ ...nagementClusterAttributeValuePairStruct.kt | 172 ++++++++++++++++++ ...cenesManagementClusterExtensionFieldSet.kt | 6 +- .../java/matter/controller/cluster/files.gni | 2 +- ...enesManagementClusterAttributeValuePair.kt | 56 ------ ...nagementClusterAttributeValuePairStruct.kt | 172 ++++++++++++++++++ ...cenesManagementClusterExtensionFieldSet.kt | 6 +- .../python/chip/clusters/Objects.py | 24 ++- .../CHIP/zap-generated/MTRBaseClusters.h | 2 +- .../zap-generated/MTRCommandPayloadsObjc.mm | 82 ++++++++- .../CHIP/zap-generated/MTRStructsObjc.h | 11 +- .../CHIP/zap-generated/MTRStructsObjc.mm | 31 +++- .../zap-generated/cluster-objects.cpp | 45 ++++- .../zap-generated/cluster-objects.h | 28 ++- .../cluster/ComplexArgumentParser.cpp | 77 +++++++- .../cluster/ComplexArgumentParser.h | 5 +- .../cluster/logging/DataModelLogger.cpp | 62 ++++++- .../cluster/logging/DataModelLogger.h | 2 +- .../zap-generated/cluster/Commands.h | 45 ++++- 46 files changed, 1295 insertions(+), 414 deletions(-) delete mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesManagementClusterAttributeValuePair.kt create mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesManagementClusterAttributeValuePairStruct.kt delete mode 100644 src/controller/java/generated/java/matter/controller/cluster/structs/ScenesManagementClusterAttributeValuePair.kt create mode 100644 src/controller/java/generated/java/matter/controller/cluster/structs/ScenesManagementClusterAttributeValuePairStruct.kt diff --git a/data_model/1.3/clusters/Scenes.xml b/data_model/1.3/clusters/Scenes.xml index bf68f8528fa159..9150a754d3041a 100644 --- a/data_model/1.3/clusters/Scenes.xml +++ b/data_model/1.3/clusters/Scenes.xml @@ -1,61 +1,61 @@ - @@ -398,4 +398,4 @@ Davis, CA 95616, USA - \ No newline at end of file + 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 fb634514fc9802..b512a6b1399d58 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 @@ -3513,14 +3513,21 @@ provisional cluster ScenesManagement = 98 { kSceneNames = 0x1; } - struct AttributeValuePair { + struct AttributeValuePairStruct { attrib_id attributeID = 0; - int32u attributeValue = 1; + optional int8u valueUnsigned8 = 1; + optional int8s valueSigned8 = 2; + optional int16u valueUnsigned16 = 3; + optional int16s valueSigned16 = 4; + optional int32u valueUnsigned32 = 5; + optional int32s valueSigned32 = 6; + optional int64u valueUnsigned64 = 7; + optional int64s valueSigned64 = 8; } struct ExtensionFieldSet { cluster_id clusterID = 0; - AttributeValuePair attributeValueList[] = 1; + AttributeValuePairStruct attributeValueList[] = 1; } fabric_scoped struct SceneInfoStruct { @@ -3632,7 +3639,7 @@ provisional cluster ScenesManagement = 98 { int8u sceneIdentifierFrom = 2; } - /** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeId": VALUE, "AttributeValue": VALUE}]}' */ + /** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeID": VALUE, "Value*": VALUE}]}' */ fabric command access(invoke: manage) AddScene(AddSceneRequest): AddSceneResponse = 0; /** Retrieves the requested scene entry from its Scene table. */ fabric command ViewScene(ViewSceneRequest): ViewSceneResponse = 1; 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 19eb0d0b954746..f7b4645e04f3a8 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 @@ -2425,14 +2425,21 @@ provisional cluster ScenesManagement = 98 { kSceneNames = 0x1; } - struct AttributeValuePair { + struct AttributeValuePairStruct { attrib_id attributeID = 0; - int32u attributeValue = 1; + optional int8u valueUnsigned8 = 1; + optional int8s valueSigned8 = 2; + optional int16u valueUnsigned16 = 3; + optional int16s valueSigned16 = 4; + optional int32u valueUnsigned32 = 5; + optional int32s valueSigned32 = 6; + optional int64u valueUnsigned64 = 7; + optional int64s valueSigned64 = 8; } struct ExtensionFieldSet { cluster_id clusterID = 0; - AttributeValuePair attributeValueList[] = 1; + AttributeValuePairStruct attributeValueList[] = 1; } fabric_scoped struct SceneInfoStruct { @@ -2544,7 +2551,7 @@ provisional cluster ScenesManagement = 98 { int8u sceneIdentifierFrom = 2; } - /** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeId": VALUE, "AttributeValue": VALUE}]}' */ + /** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeID": VALUE, "Value*": VALUE}]}' */ fabric command access(invoke: manage) AddScene(AddSceneRequest): AddSceneResponse = 0; /** Retrieves the requested scene entry from its Scene table. */ fabric command ViewScene(ViewSceneRequest): ViewSceneResponse = 1; diff --git a/examples/chef/devices/rootnode_dimmablepluginunit_f8a9a0b9d4.matter b/examples/chef/devices/rootnode_dimmablepluginunit_f8a9a0b9d4.matter index 9d51e5c047e8cf..013752d2fdbf8a 100644 --- a/examples/chef/devices/rootnode_dimmablepluginunit_f8a9a0b9d4.matter +++ b/examples/chef/devices/rootnode_dimmablepluginunit_f8a9a0b9d4.matter @@ -1515,14 +1515,21 @@ provisional cluster ScenesManagement = 98 { kSceneNames = 0x1; } - struct AttributeValuePair { + struct AttributeValuePairStruct { attrib_id attributeID = 0; - int32u attributeValue = 1; + optional int8u valueUnsigned8 = 1; + optional int8s valueSigned8 = 2; + optional int16u valueUnsigned16 = 3; + optional int16s valueSigned16 = 4; + optional int32u valueUnsigned32 = 5; + optional int32s valueSigned32 = 6; + optional int64u valueUnsigned64 = 7; + optional int64s valueSigned64 = 8; } struct ExtensionFieldSet { cluster_id clusterID = 0; - AttributeValuePair attributeValueList[] = 1; + AttributeValuePairStruct attributeValueList[] = 1; } fabric_scoped struct SceneInfoStruct { @@ -1634,7 +1641,7 @@ provisional cluster ScenesManagement = 98 { int8u sceneIdentifierFrom = 2; } - /** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeId": VALUE, "AttributeValue": VALUE}]}' */ + /** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeID": VALUE, "Value*": VALUE}]}' */ fabric command access(invoke: manage) AddScene(AddSceneRequest): AddSceneResponse = 0; /** Retrieves the requested scene entry from its Scene table. */ fabric command ViewScene(ViewSceneRequest): ViewSceneResponse = 1; 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 dbc415a9f76771..a0d6dfe2d3a781 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 @@ -2043,14 +2043,21 @@ provisional cluster ScenesManagement = 98 { kSceneNames = 0x1; } - struct AttributeValuePair { + struct AttributeValuePairStruct { attrib_id attributeID = 0; - int32u attributeValue = 1; + optional int8u valueUnsigned8 = 1; + optional int8s valueSigned8 = 2; + optional int16u valueUnsigned16 = 3; + optional int16s valueSigned16 = 4; + optional int32u valueUnsigned32 = 5; + optional int32s valueSigned32 = 6; + optional int64u valueUnsigned64 = 7; + optional int64s valueSigned64 = 8; } struct ExtensionFieldSet { cluster_id clusterID = 0; - AttributeValuePair attributeValueList[] = 1; + AttributeValuePairStruct attributeValueList[] = 1; } fabric_scoped struct SceneInfoStruct { @@ -2162,7 +2169,7 @@ provisional cluster ScenesManagement = 98 { int8u sceneIdentifierFrom = 2; } - /** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeId": VALUE, "AttributeValue": VALUE}]}' */ + /** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeID": VALUE, "Value*": VALUE}]}' */ fabric command access(invoke: manage) AddScene(AddSceneRequest): AddSceneResponse = 0; /** Retrieves the requested scene entry from its Scene table. */ fabric command ViewScene(ViewSceneRequest): ViewSceneResponse = 1; diff --git a/examples/light-switch-app/qpg/zap/switch.matter b/examples/light-switch-app/qpg/zap/switch.matter index 1965ae66663150..677a40b0f5485a 100644 --- a/examples/light-switch-app/qpg/zap/switch.matter +++ b/examples/light-switch-app/qpg/zap/switch.matter @@ -1840,14 +1840,21 @@ provisional cluster ScenesManagement = 98 { kSceneNames = 0x1; } - struct AttributeValuePair { + struct AttributeValuePairStruct { attrib_id attributeID = 0; - int32u attributeValue = 1; + optional int8u valueUnsigned8 = 1; + optional int8s valueSigned8 = 2; + optional int16u valueUnsigned16 = 3; + optional int16s valueSigned16 = 4; + optional int32u valueUnsigned32 = 5; + optional int32s valueSigned32 = 6; + optional int64u valueUnsigned64 = 7; + optional int64s valueSigned64 = 8; } struct ExtensionFieldSet { cluster_id clusterID = 0; - AttributeValuePair attributeValueList[] = 1; + AttributeValuePairStruct attributeValueList[] = 1; } fabric_scoped struct SceneInfoStruct { @@ -1959,7 +1966,7 @@ provisional cluster ScenesManagement = 98 { int8u sceneIdentifierFrom = 2; } - /** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeId": VALUE, "AttributeValue": VALUE}]}' */ + /** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeID": VALUE, "Value*": VALUE}]}' */ fabric command access(invoke: manage) AddScene(AddSceneRequest): AddSceneResponse = 0; /** Retrieves the requested scene entry from its Scene table. */ fabric command ViewScene(ViewSceneRequest): ViewSceneResponse = 1; diff --git a/examples/lighting-app/lighting-common/lighting-app.matter b/examples/lighting-app/lighting-common/lighting-app.matter index bf90ec6343f364..f0bfd80d7ddaed 100644 --- a/examples/lighting-app/lighting-common/lighting-app.matter +++ b/examples/lighting-app/lighting-common/lighting-app.matter @@ -1853,14 +1853,21 @@ provisional cluster ScenesManagement = 98 { kSceneNames = 0x1; } - struct AttributeValuePair { + struct AttributeValuePairStruct { attrib_id attributeID = 0; - int32u attributeValue = 1; + optional int8u valueUnsigned8 = 1; + optional int8s valueSigned8 = 2; + optional int16u valueUnsigned16 = 3; + optional int16s valueSigned16 = 4; + optional int32u valueUnsigned32 = 5; + optional int32s valueSigned32 = 6; + optional int64u valueUnsigned64 = 7; + optional int64s valueSigned64 = 8; } struct ExtensionFieldSet { cluster_id clusterID = 0; - AttributeValuePair attributeValueList[] = 1; + AttributeValuePairStruct attributeValueList[] = 1; } fabric_scoped struct SceneInfoStruct { @@ -1972,7 +1979,7 @@ provisional cluster ScenesManagement = 98 { int8u sceneIdentifierFrom = 2; } - /** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeId": VALUE, "AttributeValue": VALUE}]}' */ + /** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeID": VALUE, "Value*": VALUE}]}' */ fabric command access(invoke: manage) AddScene(AddSceneRequest): AddSceneResponse = 0; /** Retrieves the requested scene entry from its Scene table. */ fabric command ViewScene(ViewSceneRequest): ViewSceneResponse = 1; diff --git a/examples/lighting-app/silabs/data_model/lighting-thread-app.matter b/examples/lighting-app/silabs/data_model/lighting-thread-app.matter index 064f69b601374c..6754f806b1a6b2 100644 --- a/examples/lighting-app/silabs/data_model/lighting-thread-app.matter +++ b/examples/lighting-app/silabs/data_model/lighting-thread-app.matter @@ -1557,14 +1557,21 @@ provisional cluster ScenesManagement = 98 { kSceneNames = 0x1; } - struct AttributeValuePair { + struct AttributeValuePairStruct { attrib_id attributeID = 0; - int32u attributeValue = 1; + optional int8u valueUnsigned8 = 1; + optional int8s valueSigned8 = 2; + optional int16u valueUnsigned16 = 3; + optional int16s valueSigned16 = 4; + optional int32u valueUnsigned32 = 5; + optional int32s valueSigned32 = 6; + optional int64u valueUnsigned64 = 7; + optional int64s valueSigned64 = 8; } struct ExtensionFieldSet { cluster_id clusterID = 0; - AttributeValuePair attributeValueList[] = 1; + AttributeValuePairStruct attributeValueList[] = 1; } fabric_scoped struct SceneInfoStruct { @@ -1676,7 +1683,7 @@ provisional cluster ScenesManagement = 98 { int8u sceneIdentifierFrom = 2; } - /** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeId": VALUE, "AttributeValue": VALUE}]}' */ + /** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeID": VALUE, "Value*": VALUE}]}' */ fabric command access(invoke: manage) AddScene(AddSceneRequest): AddSceneResponse = 0; /** Retrieves the requested scene entry from its Scene table. */ fabric command ViewScene(ViewSceneRequest): ViewSceneResponse = 1; diff --git a/examples/lighting-app/silabs/data_model/lighting-wifi-app.matter b/examples/lighting-app/silabs/data_model/lighting-wifi-app.matter index 3f04c35e57d154..37415d0d79f5cc 100644 --- a/examples/lighting-app/silabs/data_model/lighting-wifi-app.matter +++ b/examples/lighting-app/silabs/data_model/lighting-wifi-app.matter @@ -1848,14 +1848,21 @@ provisional cluster ScenesManagement = 98 { kSceneNames = 0x1; } - struct AttributeValuePair { + struct AttributeValuePairStruct { attrib_id attributeID = 0; - int32u attributeValue = 1; + optional int8u valueUnsigned8 = 1; + optional int8s valueSigned8 = 2; + optional int16u valueUnsigned16 = 3; + optional int16s valueSigned16 = 4; + optional int32u valueUnsigned32 = 5; + optional int32s valueSigned32 = 6; + optional int64u valueUnsigned64 = 7; + optional int64s valueSigned64 = 8; } struct ExtensionFieldSet { cluster_id clusterID = 0; - AttributeValuePair attributeValueList[] = 1; + AttributeValuePairStruct attributeValueList[] = 1; } fabric_scoped struct SceneInfoStruct { @@ -1967,7 +1974,7 @@ provisional cluster ScenesManagement = 98 { int8u sceneIdentifierFrom = 2; } - /** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeId": VALUE, "AttributeValue": VALUE}]}' */ + /** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeID": VALUE, "Value*": VALUE}]}' */ fabric command access(invoke: manage) AddScene(AddSceneRequest): AddSceneResponse = 0; /** Retrieves the requested scene entry from its Scene table. */ fabric command ViewScene(ViewSceneRequest): ViewSceneResponse = 1; diff --git a/examples/placeholder/linux/apps/app1/config.matter b/examples/placeholder/linux/apps/app1/config.matter index f8663f2cf3da08..aa2f299a5c6093 100644 --- a/examples/placeholder/linux/apps/app1/config.matter +++ b/examples/placeholder/linux/apps/app1/config.matter @@ -3020,14 +3020,21 @@ provisional cluster ScenesManagement = 98 { kSceneNames = 0x1; } - struct AttributeValuePair { + struct AttributeValuePairStruct { attrib_id attributeID = 0; - int32u attributeValue = 1; + optional int8u valueUnsigned8 = 1; + optional int8s valueSigned8 = 2; + optional int16u valueUnsigned16 = 3; + optional int16s valueSigned16 = 4; + optional int32u valueUnsigned32 = 5; + optional int32s valueSigned32 = 6; + optional int64u valueUnsigned64 = 7; + optional int64s valueSigned64 = 8; } struct ExtensionFieldSet { cluster_id clusterID = 0; - AttributeValuePair attributeValueList[] = 1; + AttributeValuePairStruct attributeValueList[] = 1; } fabric_scoped struct SceneInfoStruct { @@ -3139,7 +3146,7 @@ provisional cluster ScenesManagement = 98 { int8u sceneIdentifierFrom = 2; } - /** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeId": VALUE, "AttributeValue": VALUE}]}' */ + /** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeID": VALUE, "Value*": VALUE}]}' */ fabric command access(invoke: manage) AddScene(AddSceneRequest): AddSceneResponse = 0; /** Retrieves the requested scene entry from its Scene table. */ fabric command ViewScene(ViewSceneRequest): ViewSceneResponse = 1; diff --git a/examples/placeholder/linux/apps/app2/config.matter b/examples/placeholder/linux/apps/app2/config.matter index 22ba33760fc585..82c062fbef2dd3 100644 --- a/examples/placeholder/linux/apps/app2/config.matter +++ b/examples/placeholder/linux/apps/app2/config.matter @@ -2977,14 +2977,21 @@ provisional cluster ScenesManagement = 98 { kSceneNames = 0x1; } - struct AttributeValuePair { + struct AttributeValuePairStruct { attrib_id attributeID = 0; - int32u attributeValue = 1; + optional int8u valueUnsigned8 = 1; + optional int8s valueSigned8 = 2; + optional int16u valueUnsigned16 = 3; + optional int16s valueSigned16 = 4; + optional int32u valueUnsigned32 = 5; + optional int32s valueSigned32 = 6; + optional int64u valueUnsigned64 = 7; + optional int64s valueSigned64 = 8; } struct ExtensionFieldSet { cluster_id clusterID = 0; - AttributeValuePair attributeValueList[] = 1; + AttributeValuePairStruct attributeValueList[] = 1; } fabric_scoped struct SceneInfoStruct { @@ -3096,7 +3103,7 @@ provisional cluster ScenesManagement = 98 { int8u sceneIdentifierFrom = 2; } - /** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeId": VALUE, "AttributeValue": VALUE}]}' */ + /** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeID": VALUE, "Value*": VALUE}]}' */ fabric command access(invoke: manage) AddScene(AddSceneRequest): AddSceneResponse = 0; /** Retrieves the requested scene entry from its Scene table. */ fabric command ViewScene(ViewSceneRequest): ViewSceneResponse = 1; diff --git a/examples/thermostat/nxp/zap/thermostat_matter_thread.matter b/examples/thermostat/nxp/zap/thermostat_matter_thread.matter index 1ea6115cc9e85f..55439d700c7c06 100644 --- a/examples/thermostat/nxp/zap/thermostat_matter_thread.matter +++ b/examples/thermostat/nxp/zap/thermostat_matter_thread.matter @@ -1753,14 +1753,21 @@ provisional cluster ScenesManagement = 98 { kSceneNames = 0x1; } - struct AttributeValuePair { + struct AttributeValuePairStruct { attrib_id attributeID = 0; - int32u attributeValue = 1; + optional int8u valueUnsigned8 = 1; + optional int8s valueSigned8 = 2; + optional int16u valueUnsigned16 = 3; + optional int16s valueSigned16 = 4; + optional int32u valueUnsigned32 = 5; + optional int32s valueSigned32 = 6; + optional int64u valueUnsigned64 = 7; + optional int64s valueSigned64 = 8; } struct ExtensionFieldSet { cluster_id clusterID = 0; - AttributeValuePair attributeValueList[] = 1; + AttributeValuePairStruct attributeValueList[] = 1; } fabric_scoped struct SceneInfoStruct { @@ -1872,7 +1879,7 @@ provisional cluster ScenesManagement = 98 { int8u sceneIdentifierFrom = 2; } - /** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeId": VALUE, "AttributeValue": VALUE}]}' */ + /** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeID": VALUE, "Value*": VALUE}]}' */ fabric command access(invoke: manage) AddScene(AddSceneRequest): AddSceneResponse = 0; /** Retrieves the requested scene entry from its Scene table. */ fabric command ViewScene(ViewSceneRequest): ViewSceneResponse = 1; diff --git a/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter b/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter index e0c7ca67a73518..e6aa1f27611e44 100644 --- a/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter +++ b/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter @@ -1664,14 +1664,21 @@ provisional cluster ScenesManagement = 98 { kSceneNames = 0x1; } - struct AttributeValuePair { + struct AttributeValuePairStruct { attrib_id attributeID = 0; - int32u attributeValue = 1; + optional int8u valueUnsigned8 = 1; + optional int8s valueSigned8 = 2; + optional int16u valueUnsigned16 = 3; + optional int16s valueSigned16 = 4; + optional int32u valueUnsigned32 = 5; + optional int32s valueSigned32 = 6; + optional int64u valueUnsigned64 = 7; + optional int64s valueSigned64 = 8; } struct ExtensionFieldSet { cluster_id clusterID = 0; - AttributeValuePair attributeValueList[] = 1; + AttributeValuePairStruct attributeValueList[] = 1; } fabric_scoped struct SceneInfoStruct { @@ -1783,7 +1790,7 @@ provisional cluster ScenesManagement = 98 { int8u sceneIdentifierFrom = 2; } - /** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeId": VALUE, "AttributeValue": VALUE}]}' */ + /** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeID": VALUE, "Value*": VALUE}]}' */ fabric command access(invoke: manage) AddScene(AddSceneRequest): AddSceneResponse = 0; /** Retrieves the requested scene entry from its Scene table. */ fabric command ViewScene(ViewSceneRequest): ViewSceneResponse = 1; diff --git a/examples/virtual-device-app/virtual-device-common/virtual-device-app.matter b/examples/virtual-device-app/virtual-device-common/virtual-device-app.matter index b6b1aac3565ed0..5fe6dd615c6d46 100644 --- a/examples/virtual-device-app/virtual-device-common/virtual-device-app.matter +++ b/examples/virtual-device-app/virtual-device-common/virtual-device-app.matter @@ -1900,14 +1900,21 @@ provisional cluster ScenesManagement = 98 { kSceneNames = 0x1; } - struct AttributeValuePair { + struct AttributeValuePairStruct { attrib_id attributeID = 0; - int32u attributeValue = 1; + optional int8u valueUnsigned8 = 1; + optional int8s valueSigned8 = 2; + optional int16u valueUnsigned16 = 3; + optional int16s valueSigned16 = 4; + optional int32u valueUnsigned32 = 5; + optional int32s valueSigned32 = 6; + optional int64u valueUnsigned64 = 7; + optional int64s valueSigned64 = 8; } struct ExtensionFieldSet { cluster_id clusterID = 0; - AttributeValuePair attributeValueList[] = 1; + AttributeValuePairStruct attributeValueList[] = 1; } fabric_scoped struct SceneInfoStruct { @@ -2019,7 +2026,7 @@ provisional cluster ScenesManagement = 98 { int8u sceneIdentifierFrom = 2; } - /** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeId": VALUE, "AttributeValue": VALUE}]}' */ + /** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeID": VALUE, "Value*": VALUE}]}' */ fabric command access(invoke: manage) AddScene(AddSceneRequest): AddSceneResponse = 0; /** Retrieves the requested scene entry from its Scene table. */ fabric command ViewScene(ViewSceneRequest): ViewSceneResponse = 1; diff --git a/src/app/clusters/color-control-server/color-control-server.cpp b/src/app/clusters/color-control-server/color-control-server.cpp index 558703a8f12fce..6c2dcb2353331c 100644 --- a/src/app/clusters/color-control-server/color-control-server.cpp +++ b/src/app/clusters/color-control-server/color-control-server.cpp @@ -99,7 +99,7 @@ class DefaultColorControlSceneHandler : public scenes::DefaultSceneHandlerImpl /// @return CHIP_NO_ERROR if successfully serialized the data, CHIP_ERROR_INVALID_ARGUMENT otherwise CHIP_ERROR SerializeSave(EndpointId endpoint, ClusterId cluster, MutableByteSpan & serializedBytes) override { - using AttributeValuePair = ScenesManagement::Structs::AttributeValuePair::Type; + using AttributeValuePair = ScenesManagement::Structs::AttributeValuePairStruct::Type; AttributeValuePair pairs[kColorControlScenableAttributesCount]; @@ -112,21 +112,21 @@ class DefaultColorControlSceneHandler : public scenes::DefaultSceneHandlerImpl { xValue = 0x616B; // Default X value according to spec } - AddAttributeValuePair(pairs, Attributes::CurrentX::Id, xValue, attributeCount); + AddAttributeValuePair(pairs, Attributes::CurrentX::Id, xValue, attributeCount); uint16_t yValue; if (Status::Success != Attributes::CurrentY::Get(endpoint, &yValue)) { yValue = 0x607D; // Default Y value according to spec } - AddAttributeValuePair(pairs, Attributes::CurrentY::Id, yValue, attributeCount); + AddAttributeValuePair(pairs, Attributes::CurrentY::Id, yValue, attributeCount); } if (ColorControlServer::Instance().HasFeature(endpoint, ColorControlServer::Feature::kEnhancedHue)) { uint16_t hueValue = 0x0000; Attributes::EnhancedCurrentHue::Get(endpoint, &hueValue); - AddAttributeValuePair(pairs, Attributes::EnhancedCurrentHue::Id, hueValue, attributeCount); + AddAttributeValuePair(pairs, Attributes::EnhancedCurrentHue::Id, hueValue, attributeCount); } if (ColorControlServer::Instance().HasFeature(endpoint, ColorControlServer::Feature::kHueAndSaturation)) @@ -136,7 +136,7 @@ class DefaultColorControlSceneHandler : public scenes::DefaultSceneHandlerImpl { saturationValue = 0x00; } - AddAttributeValuePair(pairs, Attributes::CurrentSaturation::Id, saturationValue, attributeCount); + AddAttributeValuePair(pairs, Attributes::CurrentSaturation::Id, saturationValue, attributeCount); } if (ColorControlServer::Instance().HasFeature(endpoint, ColorControlServer::Feature::kColorLoop)) @@ -146,21 +146,21 @@ class DefaultColorControlSceneHandler : public scenes::DefaultSceneHandlerImpl { loopActiveValue = 0x00; } - AddAttributeValuePair(pairs, Attributes::ColorLoopActive::Id, loopActiveValue, attributeCount); + AddAttributeValuePair(pairs, Attributes::ColorLoopActive::Id, loopActiveValue, attributeCount); uint8_t loopDirectionValue; if (Status::Success != Attributes::ColorLoopDirection::Get(endpoint, &loopDirectionValue)) { loopDirectionValue = 0x00; } - AddAttributeValuePair(pairs, Attributes::ColorLoopDirection::Id, loopDirectionValue, attributeCount); + AddAttributeValuePair(pairs, Attributes::ColorLoopDirection::Id, loopDirectionValue, attributeCount); uint16_t loopTimeValue; if (Status::Success != Attributes::ColorLoopTime::Get(endpoint, &loopTimeValue)) { loopTimeValue = 0x0019; // Default loop time value according to spec } - AddAttributeValuePair(pairs, Attributes::ColorLoopTime::Id, loopTimeValue, attributeCount); + AddAttributeValuePair(pairs, Attributes::ColorLoopTime::Id, loopTimeValue, attributeCount); } if (ColorControlServer::Instance().HasFeature(endpoint, ColorControlServer::Feature::kColorTemperature)) @@ -170,7 +170,7 @@ class DefaultColorControlSceneHandler : public scenes::DefaultSceneHandlerImpl { temperatureValue = 0x00FA; // Default temperature value according to spec } - AddAttributeValuePair(pairs, Attributes::ColorTemperatureMireds::Id, temperatureValue, attributeCount); + AddAttributeValuePair(pairs, Attributes::ColorTemperatureMireds::Id, temperatureValue, attributeCount); } uint8_t modeValue; @@ -178,7 +178,7 @@ class DefaultColorControlSceneHandler : public scenes::DefaultSceneHandlerImpl { modeValue = ColorControl::EnhancedColorMode::kCurrentXAndCurrentY; // Default mode value according to spec } - AddAttributeValuePair(pairs, Attributes::EnhancedColorMode::Id, modeValue, attributeCount); + AddAttributeValuePair(pairs, Attributes::EnhancedColorMode::Id, modeValue, attributeCount); app::DataModel::List attributeValueList(pairs, attributeCount); @@ -194,7 +194,7 @@ class DefaultColorControlSceneHandler : public scenes::DefaultSceneHandlerImpl CHIP_ERROR ApplyScene(EndpointId endpoint, ClusterId cluster, const ByteSpan & serializedBytes, scenes::TransitionTimeMs timeMs) override { - app::DataModel::DecodableList attributeValueList; + app::DataModel::DecodableList attributeValueList; ReturnErrorOnFailure(DecodeAttributeValueList(serializedBytes, attributeValueList)); @@ -237,52 +237,60 @@ class DefaultColorControlSceneHandler : public scenes::DefaultSceneHandlerImpl case Attributes::CurrentX::Id: if (SupportsColorMode(endpoint, ColorControl::EnhancedColorMode::kCurrentXAndCurrentY)) { - if (decodePair.attributeValue) - colorXTransitionState->finalValue = - std::min(static_cast(decodePair.attributeValue), colorXTransitionState->highLimit); + VerifyOrReturnError(decodePair.valueUnsigned16.HasValue(), CHIP_ERROR_INVALID_ARGUMENT); + colorXTransitionState->finalValue = + std::min(decodePair.valueUnsigned16.Value(), colorXTransitionState->highLimit); } break; case Attributes::CurrentY::Id: if (SupportsColorMode(endpoint, ColorControl::EnhancedColorMode::kCurrentXAndCurrentY)) { + VerifyOrReturnError(decodePair.valueUnsigned16.HasValue(), CHIP_ERROR_INVALID_ARGUMENT); colorYTransitionState->finalValue = - std::min(static_cast(decodePair.attributeValue), colorYTransitionState->highLimit); + std::min(decodePair.valueUnsigned16.Value(), colorYTransitionState->highLimit); } break; case Attributes::EnhancedCurrentHue::Id: if (SupportsColorMode(endpoint, ColorControl::EnhancedColorMode::kEnhancedCurrentHueAndCurrentSaturation)) { - colorHueTransitionState->finalEnhancedHue = static_cast(decodePair.attributeValue); + VerifyOrReturnError(decodePair.valueUnsigned16.HasValue(), CHIP_ERROR_INVALID_ARGUMENT); + colorHueTransitionState->finalEnhancedHue = decodePair.valueUnsigned16.Value(); } break; case Attributes::CurrentSaturation::Id: if (SupportsColorMode(endpoint, ColorControl::EnhancedColorMode::kCurrentHueAndCurrentSaturation)) { - colorSaturationTransitionState->finalValue = - std::min(static_cast(decodePair.attributeValue), colorSaturationTransitionState->highLimit); + VerifyOrReturnError(decodePair.valueUnsigned8.HasValue(), CHIP_ERROR_INVALID_ARGUMENT); + colorSaturationTransitionState->finalValue = std::min(static_cast(decodePair.valueUnsigned8.Value()), + colorSaturationTransitionState->highLimit); } break; case Attributes::ColorLoopActive::Id: - loopActiveValue = static_cast(decodePair.attributeValue); + VerifyOrReturnError(decodePair.valueUnsigned8.HasValue(), CHIP_ERROR_INVALID_ARGUMENT); + loopActiveValue = decodePair.valueUnsigned8.Value(); break; case Attributes::ColorLoopDirection::Id: - loopDirectionValue = static_cast(decodePair.attributeValue); + VerifyOrReturnError(decodePair.valueUnsigned8.HasValue(), CHIP_ERROR_INVALID_ARGUMENT); + loopDirectionValue = decodePair.valueUnsigned8.Value(); break; case Attributes::ColorLoopTime::Id: - loopTimeValue = static_cast(decodePair.attributeValue); + VerifyOrReturnError(decodePair.valueUnsigned16.HasValue(), CHIP_ERROR_INVALID_ARGUMENT); + loopTimeValue = decodePair.valueUnsigned16.Value(); break; case Attributes::ColorTemperatureMireds::Id: if (SupportsColorMode(endpoint, ColorControl::EnhancedColorMode::kColorTemperature)) { + VerifyOrReturnError(decodePair.valueUnsigned16.HasValue(), CHIP_ERROR_INVALID_ARGUMENT); colorTempTransitionState->finalValue = - std::min(static_cast(decodePair.attributeValue), colorTempTransitionState->highLimit); + std::min(decodePair.valueUnsigned16.Value(), colorTempTransitionState->highLimit); } break; case Attributes::EnhancedColorMode::Id: - if (decodePair.attributeValue <= + VerifyOrReturnError(decodePair.valueUnsigned8.HasValue(), CHIP_ERROR_INVALID_ARGUMENT); + if (decodePair.valueUnsigned8.Value() <= static_cast(ColorControl::EnhancedColorMode::kEnhancedCurrentHueAndCurrentSaturation)) { - targetColorMode = static_cast(decodePair.attributeValue); + targetColorMode = decodePair.valueUnsigned8.Value(); } break; default: @@ -371,11 +379,28 @@ class DefaultColorControlSceneHandler : public scenes::DefaultSceneHandlerImpl } } - void AddAttributeValuePair(ScenesManagement::Structs::AttributeValuePair::Type * pairs, AttributeId id, uint32_t value, + /// AddAttributeValuePair + /// @brief Helper function to add an attribute value pair to the attribute value pair array in the color control SceneHandler + /// @param pairs list of attribute value pairs + /// @param id attribute id + /// @param value attribute value + /// @param attributeCount number of attributes in the list, incremented by this function, used to keep track of how many + /// attributes from the array are being used for the list to encode + template + void AddAttributeValuePair(ScenesManagement::Structs::AttributeValuePairStruct::Type * pairs, AttributeId id, Type value, size_t & attributeCount) { - pairs[attributeCount].attributeID = id; - pairs[attributeCount].attributeValue = value; + static_assert((std::is_same_v) || (std::is_same_v), "Type must be uint8_t or uint16_t"); + + pairs[attributeCount].attributeID = id; + if constexpr ((std::is_same_v) ) + { + pairs[attributeCount].valueUnsigned8.SetValue(value); + } + else if constexpr ((std::is_same_v) ) + { + pairs[attributeCount].valueUnsigned16.SetValue(value); + } attributeCount++; } }; diff --git a/src/app/clusters/level-control/level-control.cpp b/src/app/clusters/level-control/level-control.cpp index 2ee9f2cfa54c04..6ae7d141a4edfe 100644 --- a/src/app/clusters/level-control/level-control.cpp +++ b/src/app/clusters/level-control/level-control.cpp @@ -160,7 +160,7 @@ class DefaultLevelControlSceneHandler : public scenes::DefaultSceneHandlerImpl /// @return CHIP_NO_ERROR if successfully serialized the data, CHIP_ERROR_INVALID_ARGUMENT otherwise CHIP_ERROR SerializeSave(EndpointId endpoint, ClusterId cluster, MutableByteSpan & serializedBytes) override { - using AttributeValuePair = ScenesManagement::Structs::AttributeValuePair::Type; + using AttributeValuePair = ScenesManagement::Structs::AttributeValuePairStruct::Type; app::DataModel::Nullable level; VerifyOrReturnError(Status::Success == Attributes::CurrentLevel::Get(endpoint, level), CHIP_ERROR_READ_FAILED); @@ -173,19 +173,19 @@ class DefaultLevelControlSceneHandler : public scenes::DefaultSceneHandlerImpl pairs[0].attributeID = Attributes::CurrentLevel::Id; if (!level.IsNull()) { - pairs[0].attributeValue = level.Value(); + pairs[0].valueUnsigned8.SetValue(level.Value()); } else { - chip::app::NumericAttributeTraits::SetNull(pairs[0].attributeValue); + pairs[0].valueUnsigned8.SetValue(app::NumericAttributeTraits::kNullValue); } size_t attributeCount = 1; if (LevelControlHasFeature(endpoint, LevelControl::Feature::kFrequency)) { uint16_t frequency; VerifyOrReturnError(Status::Success == Attributes::CurrentFrequency::Get(endpoint, &frequency), CHIP_ERROR_READ_FAILED); - pairs[attributeCount].attributeID = Attributes::CurrentFrequency::Id; - pairs[attributeCount].attributeValue = frequency; + pairs[attributeCount].attributeID = Attributes::CurrentFrequency::Id; + pairs[attributeCount].valueUnsigned16.SetValue(frequency); attributeCount++; } @@ -203,7 +203,7 @@ class DefaultLevelControlSceneHandler : public scenes::DefaultSceneHandlerImpl CHIP_ERROR ApplyScene(EndpointId endpoint, ClusterId cluster, const ByteSpan & serializedBytes, scenes::TransitionTimeMs timeMs) override { - app::DataModel::DecodableList attributeValueList; + app::DataModel::DecodableList attributeValueList; ReturnErrorOnFailure(DecodeAttributeValueList(serializedBytes, attributeValueList)); @@ -225,11 +225,13 @@ class DefaultLevelControlSceneHandler : public scenes::DefaultSceneHandlerImpl switch (decodePair.attributeID) { case Attributes::CurrentLevel::Id: - level = static_cast(decodePair.attributeValue); + VerifyOrReturnError(decodePair.valueUnsigned8.HasValue(), CHIP_ERROR_INVALID_ARGUMENT); + level = decodePair.valueUnsigned8.Value(); break; case Attributes::CurrentFrequency::Id: // TODO : Uncomment when frequency is supported by the level control cluster - // frequency = static_cast(decodePair.attributeValue); + // VerifyOrReturnError(decodePair.valueUnsigned16.HasValue(), CHIP_ERROR_INVALID_ARGUMENT); + // frequency = decodePair.valueUnsigned16.Value(); break; default: return CHIP_ERROR_INVALID_ARGUMENT; @@ -240,7 +242,13 @@ class DefaultLevelControlSceneHandler : public scenes::DefaultSceneHandlerImpl // TODO : Implement action on frequency when frequency not provisional anymore // if(LevelControlHasFeature(endpoint, LevelControl::Feature::kFrequency)){} - if (!chip::app::NumericAttributeTraits::IsNullValue(level)) + EmberAfLevelControlState * state = getState(endpoint); + if (level < state->minLevel || level > state->maxLevel) + { + chip::app::NumericAttributeTraits::SetNull(level); + } + + if (!app::NumericAttributeTraits::IsNullValue(level)) { CommandId command = LevelControlHasFeature(endpoint, LevelControl::Feature::kOnOff) ? Commands::MoveToLevelWithOnOff::Id : Commands::MoveToLevel::Id; diff --git a/src/app/clusters/on-off-server/on-off-server.cpp b/src/app/clusters/on-off-server/on-off-server.cpp index c7e64cd7afc161..8332403d68ebd4 100644 --- a/src/app/clusters/on-off-server/on-off-server.cpp +++ b/src/app/clusters/on-off-server/on-off-server.cpp @@ -150,7 +150,7 @@ class DefaultOnOffSceneHandler : public scenes::DefaultSceneHandlerImpl /// @return CHIP_NO_ERROR if successfully serialized the data, CHIP_ERROR_INVALID_ARGUMENT otherwise CHIP_ERROR SerializeSave(EndpointId endpoint, ClusterId cluster, MutableByteSpan & serializedBytes) override { - using AttributeValuePair = ScenesManagement::Structs::AttributeValuePair::Type; + using AttributeValuePair = ScenesManagement::Structs::AttributeValuePairStruct::Type; bool currentValue; // read current on/off value @@ -163,8 +163,8 @@ class DefaultOnOffSceneHandler : public scenes::DefaultSceneHandlerImpl AttributeValuePair pairs[scenableAttributeCount]; - pairs[0].attributeID = Attributes::OnOff::Id; - pairs[0].attributeValue = currentValue; + pairs[0].attributeID = Attributes::OnOff::Id; + pairs[0].valueUnsigned8.SetValue(currentValue); app::DataModel::List attributeValueList(pairs); @@ -180,7 +180,7 @@ class DefaultOnOffSceneHandler : public scenes::DefaultSceneHandlerImpl CHIP_ERROR ApplyScene(EndpointId endpoint, ClusterId cluster, const ByteSpan & serializedBytes, scenes::TransitionTimeMs timeMs) override { - app::DataModel::DecodableList attributeValueList; + app::DataModel::DecodableList attributeValueList; VerifyOrReturnError(cluster == OnOff::Id, CHIP_ERROR_INVALID_ARGUMENT); @@ -195,8 +195,9 @@ class DefaultOnOffSceneHandler : public scenes::DefaultSceneHandlerImpl { auto & decodePair = pair_iterator.GetValue(); VerifyOrReturnError(decodePair.attributeID == Attributes::OnOff::Id, CHIP_ERROR_INVALID_ARGUMENT); - ReturnErrorOnFailure( - mSceneEndpointStatePairs.InsertPair(OnOffEndPointPair(endpoint, static_cast(decodePair.attributeValue)))); + VerifyOrReturnError(decodePair.valueUnsigned8.HasValue(), CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(mSceneEndpointStatePairs.InsertPair( + OnOffEndPointPair(endpoint, static_cast(decodePair.valueUnsigned8.Value())))); } // Verify that the EFS was completely read CHIP_ERROR err = pair_iterator.GetStatus(); diff --git a/src/app/clusters/scenes-server/SceneHandlerImpl.h b/src/app/clusters/scenes-server/SceneHandlerImpl.h index 554ba2d7ad4893..88aa1350dfef43 100644 --- a/src/app/clusters/scenes-server/SceneHandlerImpl.h +++ b/src/app/clusters/scenes-server/SceneHandlerImpl.h @@ -36,8 +36,8 @@ class DefaultSceneHandlerImpl : public scenes::SceneHandler template using DecodableList = app::DataModel::DecodableList; - using AttributeValuePairType = app::Clusters::ScenesManagement::Structs::AttributeValuePair::Type; - using AttributeValuePairDecodableType = app::Clusters::ScenesManagement::Structs::AttributeValuePair::DecodableType; + using AttributeValuePairType = app::Clusters::ScenesManagement::Structs::AttributeValuePairStruct::Type; + using AttributeValuePairDecodableType = app::Clusters::ScenesManagement::Structs::AttributeValuePairStruct::DecodableType; using ExtensionFieldSetDecodableType = app::Clusters::ScenesManagement::Structs::ExtensionFieldSet::DecodableType; using ExtensionFieldSetType = app::Clusters::ScenesManagement::Structs::ExtensionFieldSet::Type; diff --git a/src/app/tests/TestSceneTable.cpp b/src/app/tests/TestSceneTable.cpp index 1563c286ac3e16..ffb0a1fd5650ff 100644 --- a/src/app/tests/TestSceneTable.cpp +++ b/src/app/tests/TestSceneTable.cpp @@ -140,9 +140,9 @@ static app::Clusters::ScenesManagement::Structs::ExtensionFieldSet::Type OOexten static app::Clusters::ScenesManagement::Structs::ExtensionFieldSet::Type LCextensionFieldSet; static app::Clusters::ScenesManagement::Structs::ExtensionFieldSet::Type CCextensionFieldSet; -static app::Clusters::ScenesManagement::Structs::AttributeValuePair::Type OOPairs[1]; -static app::Clusters::ScenesManagement::Structs::AttributeValuePair::Type LCPairs[2]; -static app::Clusters::ScenesManagement::Structs::AttributeValuePair::Type CCPairs[8]; +static app::Clusters::ScenesManagement::Structs::AttributeValuePairStruct::Type OOPairs[1]; +static app::Clusters::ScenesManagement::Structs::AttributeValuePairStruct::Type LCPairs[2]; +static app::Clusters::ScenesManagement::Structs::AttributeValuePairStruct::Type CCPairs[8]; static uint8_t OO_buffer[scenes::kMaxFieldBytesPerCluster] = { 0 }; static uint8_t LC_buffer[scenes::kMaxFieldBytesPerCluster] = { 0 }; @@ -535,30 +535,30 @@ TEST_F(TestSceneTable, TestHandlerFunctions) static const uint16_t LC_av_payload[2] = { 0x64, 0x01F0 }; static const uint16_t CC_av_payload[8] = { 0 }; - OOPairs[0].attributeID = kOnOffAttId; - OOPairs[0].attributeValue = OO_av_payload; - - LCPairs[0].attributeID = kCurrentLevelId; - LCPairs[0].attributeValue = LC_av_payload[0]; - LCPairs[1].attributeID = kCurrentFrequencyId; - LCPairs[1].attributeValue = LC_av_payload[1]; - - CCPairs[0].attributeID = kCurrentSaturationId; - CCPairs[0].attributeValue = CC_av_payload[0]; - CCPairs[1].attributeID = kCurrentXId; - CCPairs[1].attributeValue = CC_av_payload[1]; - CCPairs[2].attributeID = kCurrentYId; - CCPairs[2].attributeValue = CC_av_payload[2]; - CCPairs[3].attributeID = kColorTemperatureMiredsId; - CCPairs[3].attributeValue = CC_av_payload[3]; - CCPairs[4].attributeID = kEnhancedCurrentHueId; - CCPairs[4].attributeValue = CC_av_payload[4]; - CCPairs[5].attributeID = kColorLoopActiveId; - CCPairs[5].attributeValue = CC_av_payload[5]; - CCPairs[6].attributeID = kColorLoopDirectionId; - CCPairs[6].attributeValue = CC_av_payload[6]; - CCPairs[7].attributeID = kColorLoopTimeId; - CCPairs[7].attributeValue = CC_av_payload[7]; + OOPairs[0].attributeID = kOnOffAttId; + OOPairs[0].valueUnsigned8.SetValue(OO_av_payload); + + LCPairs[0].attributeID = kCurrentLevelId; + LCPairs[0].valueUnsigned8.SetValue(static_cast(LC_av_payload[0])); + LCPairs[1].attributeID = kCurrentFrequencyId; + LCPairs[1].valueUnsigned16.SetValue(LC_av_payload[1]); + + CCPairs[0].attributeID = kCurrentSaturationId; + CCPairs[0].valueUnsigned8.SetValue(static_cast(CC_av_payload[0])); + CCPairs[1].attributeID = kCurrentXId; + CCPairs[1].valueUnsigned16.SetValue(CC_av_payload[1]); + CCPairs[2].attributeID = kCurrentYId; + CCPairs[2].valueUnsigned16.SetValue(CC_av_payload[2]); + CCPairs[3].attributeID = kColorTemperatureMiredsId; + CCPairs[3].valueUnsigned16.SetValue(CC_av_payload[3]); + CCPairs[4].attributeID = kEnhancedCurrentHueId; + CCPairs[4].valueUnsigned16.SetValue(CC_av_payload[4]); + CCPairs[5].attributeID = kColorLoopActiveId; + CCPairs[5].valueUnsigned8.SetValue(static_cast(CC_av_payload[5])); + CCPairs[6].attributeID = kColorLoopDirectionId; + CCPairs[6].valueUnsigned8.SetValue(static_cast(CC_av_payload[6])); + CCPairs[7].attributeID = kColorLoopTimeId; + CCPairs[7].valueUnsigned8.SetValue(static_cast(CC_av_payload[7])); // Initialize Extension Field sets as if they were received by add commands OOextensionFieldSet.clusterID = kOnOffClusterId; @@ -667,12 +667,11 @@ TEST_F(TestSceneTable, TestHandlerFunctions) // To test failure on serialize and deserialize when too many pairs are in the field sets app::Clusters::ScenesManagement::Structs::ExtensionFieldSet::Type extensionFieldFailTestOut; app::Clusters::ScenesManagement::Structs::ExtensionFieldSet::DecodableType extensionFieldFailTestIn; - app::Clusters::ScenesManagement::Structs::AttributeValuePair::Type TooManyPairs[16]; + app::Clusters::ScenesManagement::Structs::AttributeValuePairStruct::Type TooManyPairs[16]; - uint8_t payloadOk = 0; for (uint8_t i = 0; i < 16; i++) { - TooManyPairs[i].attributeValue = payloadOk; + TooManyPairs[i].valueUnsigned8.SetValue(0); } extensionFieldFailTestOut.clusterID = kColorControlClusterId; diff --git a/src/app/tests/suites/TestScenesFabricSceneInfo.yaml b/src/app/tests/suites/TestScenesFabricSceneInfo.yaml index a15f9f0ef310a1..ba83953588bd3b 100644 --- a/src/app/tests/suites/TestScenesFabricSceneInfo.yaml +++ b/src/app/tests/suites/TestScenesFabricSceneInfo.yaml @@ -208,12 +208,50 @@ tests: { ClusterID: 0x0006, AttributeValueList: - [{ AttributeID: 0x0000, AttributeValue: 0x01 }], + [{ AttributeID: 0x0000, ValueUnsigned8: 0x01 }], }, { ClusterID: 0x0008, AttributeValueList: - [{ AttributeID: 0x0000, AttributeValue: 0x64 }], + [{ AttributeID: 0x0000, ValueUnsigned8: 0x64 }], + }, + { + ClusterID: 0x0300, + AttributeValueList: + [ + { + AttributeID: 0x0001, + ValueUnsigned8: 0x64, + }, + { + AttributeID: 0x0003, + ValueUnsigned16: 0x64, + }, + { + AttributeID: 0x0004, + ValueUnsigned16: 0x64, + }, + { + AttributeID: 0x0007, + ValueUnsigned16: 0x64, + }, + { + AttributeID: 0x4000, + ValueUnsigned16: 0x64, + }, + { + AttributeID: 0x4001, + ValueUnsigned8: 0x64, + }, + { + AttributeID: 0x4002, + ValueUnsigned8: 0x64, + }, + { + AttributeID: 0x4003, + ValueUnsigned8: 0x64, + }, + ], }, ] response: @@ -266,12 +304,50 @@ tests: { ClusterID: 0x0006, AttributeValueList: - [{ AttributeID: 0x0000, AttributeValue: 0x01 }], + [{ AttributeID: 0x0000, ValueUnsigned8: 0x01 }], }, { ClusterID: 0x0008, AttributeValueList: - [{ AttributeID: 0x0000, AttributeValue: 0x64 }], + [{ AttributeID: 0x0000, ValueUnsigned8: 0x64 }], + }, + { + ClusterID: 0x0300, + AttributeValueList: + [ + { + AttributeID: 0x0001, + ValueUnsigned8: 0x64, + }, + { + AttributeID: 0x0003, + ValueUnsigned16: 0x64, + }, + { + AttributeID: 0x0004, + ValueUnsigned16: 0x64, + }, + { + AttributeID: 0x0007, + ValueUnsigned16: 0x64, + }, + { + AttributeID: 0x4000, + ValueUnsigned16: 0x64, + }, + { + AttributeID: 0x4001, + ValueUnsigned8: 0x64, + }, + { + AttributeID: 0x4002, + ValueUnsigned8: 0x64, + }, + { + AttributeID: 0x4003, + ValueUnsigned8: 0x64, + }, + ], }, ] @@ -334,12 +410,12 @@ tests: { ClusterID: 0x0006, AttributeValueList: - [{ AttributeID: 0x0000, AttributeValue: 0x00 }], + [{ AttributeID: 0x0000, ValueUnsigned8: 0x00 }], }, { ClusterID: 0x0008, AttributeValueList: - [{ AttributeID: 0x0000, AttributeValue: 0xFA }], + [{ AttributeID: 0x0000, ValueUnsigned8: 0xFA }], }, ] @@ -367,12 +443,12 @@ tests: { ClusterID: 0x0006, AttributeValueList: - [{ AttributeID: 0x0000, AttributeValue: 0x00 }], + [{ AttributeID: 0x0000, ValueUnsigned8: 0x00 }], }, { ClusterID: 0x0008, AttributeValueList: - [{ AttributeID: 0x0000, AttributeValue: 0xFA }], + [{ AttributeID: 0x0000, ValueUnsigned8: 0xFA }], }, ] diff --git a/src/app/tests/suites/TestScenesMultiFabric.yaml b/src/app/tests/suites/TestScenesMultiFabric.yaml index f969270426bf19..d0e79798acb904 100644 --- a/src/app/tests/suites/TestScenesMultiFabric.yaml +++ b/src/app/tests/suites/TestScenesMultiFabric.yaml @@ -345,12 +345,12 @@ tests: { ClusterID: 0x0006, AttributeValueList: - [{ AttributeID: 0x0000, AttributeValue: 0x01 }], + [{ AttributeID: 0x0000, ValueUnsigned8: 0x01 }], }, { ClusterID: 0x0008, AttributeValueList: - [{ AttributeID: 0x0000, AttributeValue: 0x64 }], + [{ AttributeID: 0x0000, ValueUnsigned8: 0x64 }], }, ] response: @@ -451,12 +451,12 @@ tests: { ClusterID: 0x0006, AttributeValueList: - [{ AttributeID: 0x0000, AttributeValue: 0x01 }], + [{ AttributeID: 0x0000, ValueUnsigned8: 0x01 }], }, { ClusterID: 0x0008, AttributeValueList: - [{ AttributeID: 0x0000, AttributeValue: 0x64 }], + [{ AttributeID: 0x0000, ValueUnsigned8: 0x64 }], }, ] response: diff --git a/src/app/tests/suites/certification/Test_TC_S_2_2.yaml b/src/app/tests/suites/certification/Test_TC_S_2_2.yaml index 02407f8807d993..ead80fedb78436 100644 --- a/src/app/tests/suites/certification/Test_TC_S_2_2.yaml +++ b/src/app/tests/suites/certification/Test_TC_S_2_2.yaml @@ -463,7 +463,7 @@ tests: [ { AttributeID: 0x0000, - AttributeValue: 0x01, + ValueUnsigned8: 0x01, }, ], }, @@ -473,7 +473,7 @@ tests: [ { AttributeID: 0x0000, - AttributeValue: 0x64, + ValueUnsigned8: 0x64, }, ], }, @@ -620,12 +620,12 @@ tests: { ClusterID: 0x0006, AttributeValueList: - [{ AttributeID: 0x0000, AttributeValue: 0x01 }], + [{ AttributeID: 0x0000, ValueUnsigned8: 0x01 }], }, { ClusterID: 0x0008, AttributeValueList: - [{ AttributeID: 0x0000, AttributeValue: 0x64 }], + [{ AttributeID: 0x0000, ValueUnsigned8: 0x64 }], }, ] response: @@ -643,7 +643,7 @@ tests: to 60 000 000 (60 000s) and a set of extension fields appropriate to AC1." verification: | - ./chip-tool scenesmanagement add-scene 0x0001 0x01 60000000 "scene name" '[{"clusterID": "0x0300", "attributeValueList":[{"attributeID": "0x4001", "attributeValue": "0x01"}]}]' 1 1 + ./chip-tool scenesmanagement add-scene 0x0001 0x01 60000000 "scene name" '[{"clusterID": "0x0300", "attributeValueList":[{"attributeID": "0x4001", "ValueUnsigned8": "0x01"}]}]' 1 1 Verify DUT sends a AddSceneResponse command to TH with the Status field set to 0x00 (SUCCESS), the GroupID field set to G1 and the SceneID field set to 0x01 on the TH(Chip-tool) Log and below is the sample log provided for the raspi platform: diff --git a/src/app/tests/suites/certification/Test_TC_S_2_3.yaml b/src/app/tests/suites/certification/Test_TC_S_2_3.yaml index b39a2e762a1113..5a76916edb39b7 100644 --- a/src/app/tests/suites/certification/Test_TC_S_2_3.yaml +++ b/src/app/tests/suites/certification/Test_TC_S_2_3.yaml @@ -287,12 +287,12 @@ tests: { ClusterID: 0x0006, AttributeValueList: - [{ AttributeID: 0x0000, AttributeValue: 0x01 }], + [{ AttributeID: 0x0000, ValueUnsigned8: 0x01 }], }, { ClusterID: 0x0008, AttributeValueList: - [{ AttributeID: 0x0000, AttributeValue: 0x64 }], + [{ AttributeID: 0x0000, ValueUnsigned8: 0x64 }], }, ] response: @@ -309,7 +309,7 @@ tests: to G1, the SceneID field set to 0x01, the TransitionTime field set to 1000 (1s) and a set of extension fields appropriate to AC1." verification: | - ./chip-tool scenesmanagement add-scene 0x0101 0x01 1000 "scene name" '[{"clusterID": "0x0006", "attributeValueList":[{"attributeID": "0x0001", "attributeValue": "0x01"}, ]}, {"clusterID": "0x0008", "attributeValueList":[{"attributeID": "0x0000", "attributeValue": "0x64"}, ]}]' 1 1 + ./chip-tool scenesmanagement add-scene 0x0101 0x01 1000 "scene name" '[{"clusterID": "0x0006", "attributeValueList":[{"attributeID": "0x0000", "ValueUnsigned8": "0x01"}, ]}, {"clusterID": "0x0008", "attributeValueList":[{"attributeID": "0x0000", "ValueUnsigned8": "0x64"}, ]}]' 1 1 Verify DUT sends a AddSceneResponse command to TH with the Status field set to 0x00 (SUCCESS), the GroupID field set to 257 and the SceneID field set to 0x01 on the TH(Chip-tool) Log and below is the sample log provided for the raspi platform: @@ -361,12 +361,12 @@ tests: { ClusterID: 0x0006, AttributeValueList: - [{ AttributeID: 0x0000, AttributeValue: 0x01 }], + [{ AttributeID: 0x0000, ValueUnsigned8: 0x01 }], }, { ClusterID: 0x0008, AttributeValueList: - [{ AttributeID: 0x0000, AttributeValue: 0x64 }], + [{ AttributeID: 0x0000, ValueUnsigned8: 0x64 }], }, ] @@ -395,8 +395,8 @@ tests: [1708071897.294574][7731:7733] CHIP:TOO: ClusterID: 6 [1708071897.294580][7731:7733] CHIP:TOO: AttributeValueList: 1 entries [1708071897.294589][7731:7733] CHIP:TOO: [1]: { - [1708071897.294593][7731:7733] CHIP:TOO: AttributeID: 1 - [1708071897.294596][7731:7733] CHIP:TOO: AttributeValue: 1 + [1708071897.294593][7731:7733] CHIP:TOO: AttributeID: 0 + [1708071897.294596][7731:7733] CHIP:TOO: ValueUnsigned8: 1 [1708071897.294599][7731:7733] CHIP:TOO: } [1708071897.294603][7731:7733] CHIP:TOO: } [1708071897.294611][7731:7733] CHIP:TOO: [2]: { @@ -404,7 +404,7 @@ tests: [1708071897.294621][7731:7733] CHIP:TOO: AttributeValueList: 1 entries [1708071897.294628][7731:7733] CHIP:TOO: [1]: { [1708071897.294633][7731:7733] CHIP:TOO: AttributeID: 0 - [1708071897.294636][7731:7733] CHIP:TOO: AttributeValue: 100 + [1708071897.294636][7731:7733] CHIP:TOO: ValueUnsigned8: 100 [1708071897.294639][7731:7733] CHIP:TOO: } [1708071897.294643][7731:7733] CHIP:TOO: } [1708071897.294647][7731:7733] CHIP:TOO: } @@ -543,12 +543,12 @@ tests: { ClusterID: 0x0006, AttributeValueList: - [{ AttributeID: 0x0000, AttributeValue: 0x01 }], + [{ AttributeID: 0x0000, ValueUnsigned8: 0x01 }], }, { ClusterID: 0x0008, AttributeValueList: - [{ AttributeID: 0x0000, AttributeValue: 0x64 }], + [{ AttributeID: 0x0000, ValueUnsigned8: 0x64 }], }, ] @@ -557,7 +557,7 @@ tests: field set to G1, the SceneID field set to 0x03, the TransitionTime field set to G1 and a set of extension fields appropriate to AC1." verification: | - ./chip-tool scenesmanagement add-scene 0x0101 0x03 1 "scene name" '[{"clusterID": "0x0300", "attributeValueList":[{"attributeID": "0x4002", "attributeValue": "0x01"}]}]' 0xffffffffffff0101 1 + ./chip-tool scenesmanagement add-scene 0x0101 0x03 1 "scene name" '[{"clusterID": "0x0300", "attributeValueList":[{"attributeID": "0x4002", "ValueUnsigned8": "0x01"}]}]' 0xffffffffffff0101 1 Note: As this is a multicast command, no log is expected. cluster: "LogCommands" command: "UserPrompt" @@ -599,12 +599,12 @@ tests: { ClusterID: 0x0006, AttributeValueList: - [{ AttributeID: 0x0000, AttributeValue: 0x01 }], + [{ AttributeID: 0x0000, ValueUnsigned8: 0x01 }], }, { ClusterID: 0x0008, AttributeValueList: - [{ AttributeID: 0x0000, AttributeValue: 0x64 }], + [{ AttributeID: 0x0000, ValueUnsigned8: 0x64 }], }, ] - label: @@ -633,7 +633,7 @@ tests: [1707285444.028853][13682:13684] CHIP:TOO: AttributeValueList: 1 entries [1707285444.028882][13682:13684] CHIP:TOO: [1]: { [1707285444.028896][13682:13684] CHIP:TOO: AttributeID: 16386 - [1707285444.028913][13682:13684] CHIP:TOO: AttributeValue: 1 + [1707285444.028913][13682:13684] CHIP:TOO: ValueUnsigned16: 1 [1707285444.028925][13682:13684] CHIP:TOO: } [1707285444.028937][13682:13684] CHIP:TOO: } [1707285444.028950][13682:13684] CHIP:TOO: } 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 0c1189093c4e79..b6315bdc1287c1 100644 --- a/src/app/zap-templates/zcl/data-model/chip/scene.xml +++ b/src/app/zap-templates/zcl/data-model/chip/scene.xml @@ -29,16 +29,39 @@ limitations under the License. - + - + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -63,7 +86,7 @@ limitations under the License. FabricSceneInfo - Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeId": VALUE, "AttributeValue": VALUE}]}' + Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeID": VALUE, "Value*": VALUE}]}' diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 961ac180ef36a3..0add2f8c6c5095 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -3756,14 +3756,21 @@ provisional cluster ScenesManagement = 98 { kSceneNames = 0x1; } - struct AttributeValuePair { + struct AttributeValuePairStruct { attrib_id attributeID = 0; - int32u attributeValue = 1; + optional int8u valueUnsigned8 = 1; + optional int8s valueSigned8 = 2; + optional int16u valueUnsigned16 = 3; + optional int16s valueSigned16 = 4; + optional int32u valueUnsigned32 = 5; + optional int32s valueSigned32 = 6; + optional int64u valueUnsigned64 = 7; + optional int64s valueSigned64 = 8; } struct ExtensionFieldSet { cluster_id clusterID = 0; - AttributeValuePair attributeValueList[] = 1; + AttributeValuePairStruct attributeValueList[] = 1; } fabric_scoped struct SceneInfoStruct { @@ -3875,7 +3882,7 @@ provisional cluster ScenesManagement = 98 { int8u sceneIdentifierFrom = 2; } - /** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeId": VALUE, "AttributeValue": VALUE}]}' */ + /** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeID": VALUE, "Value*": VALUE}]}' */ fabric command access(invoke: manage) AddScene(AddSceneRequest): AddSceneResponse = 0; /** Retrieves the requested scene entry from its Scene table. */ fabric command ViewScene(ViewSceneRequest): ViewSceneResponse = 1; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java index 35a08b3e35268d..6cc21fd1f911c7 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java @@ -5078,62 +5078,167 @@ public String toString() { return output.toString(); } } -public static class ScenesManagementClusterAttributeValuePair { +public static class ScenesManagementClusterAttributeValuePairStruct { public Long attributeID; - public Long attributeValue; + public Optional valueUnsigned8; + public Optional valueSigned8; + public Optional valueUnsigned16; + public Optional valueSigned16; + public Optional valueUnsigned32; + public Optional valueSigned32; + public Optional valueUnsigned64; + public Optional valueSigned64; private static final long ATTRIBUTE_I_D_ID = 0L; - private static final long ATTRIBUTE_VALUE_ID = 1L; - - public ScenesManagementClusterAttributeValuePair( + private static final long VALUE_UNSIGNED8_ID = 1L; + private static final long VALUE_SIGNED8_ID = 2L; + private static final long VALUE_UNSIGNED16_ID = 3L; + private static final long VALUE_SIGNED16_ID = 4L; + private static final long VALUE_UNSIGNED32_ID = 5L; + private static final long VALUE_SIGNED32_ID = 6L; + private static final long VALUE_UNSIGNED64_ID = 7L; + private static final long VALUE_SIGNED64_ID = 8L; + + public ScenesManagementClusterAttributeValuePairStruct( Long attributeID, - Long attributeValue + Optional valueUnsigned8, + Optional valueSigned8, + Optional valueUnsigned16, + Optional valueSigned16, + Optional valueUnsigned32, + Optional valueSigned32, + Optional valueUnsigned64, + Optional valueSigned64 ) { this.attributeID = attributeID; - this.attributeValue = attributeValue; + this.valueUnsigned8 = valueUnsigned8; + this.valueSigned8 = valueSigned8; + this.valueUnsigned16 = valueUnsigned16; + this.valueSigned16 = valueSigned16; + this.valueUnsigned32 = valueUnsigned32; + this.valueSigned32 = valueSigned32; + this.valueUnsigned64 = valueUnsigned64; + this.valueSigned64 = valueSigned64; } public StructType encodeTlv() { ArrayList values = new ArrayList<>(); values.add(new StructElement(ATTRIBUTE_I_D_ID, new UIntType(attributeID))); - values.add(new StructElement(ATTRIBUTE_VALUE_ID, new UIntType(attributeValue))); + values.add(new StructElement(VALUE_UNSIGNED8_ID, valueUnsigned8.map((nonOptionalvalueUnsigned8) -> new UIntType(nonOptionalvalueUnsigned8)).orElse(new EmptyType()))); + values.add(new StructElement(VALUE_SIGNED8_ID, valueSigned8.map((nonOptionalvalueSigned8) -> new IntType(nonOptionalvalueSigned8)).orElse(new EmptyType()))); + values.add(new StructElement(VALUE_UNSIGNED16_ID, valueUnsigned16.map((nonOptionalvalueUnsigned16) -> new UIntType(nonOptionalvalueUnsigned16)).orElse(new EmptyType()))); + values.add(new StructElement(VALUE_SIGNED16_ID, valueSigned16.map((nonOptionalvalueSigned16) -> new IntType(nonOptionalvalueSigned16)).orElse(new EmptyType()))); + values.add(new StructElement(VALUE_UNSIGNED32_ID, valueUnsigned32.map((nonOptionalvalueUnsigned32) -> new UIntType(nonOptionalvalueUnsigned32)).orElse(new EmptyType()))); + values.add(new StructElement(VALUE_SIGNED32_ID, valueSigned32.map((nonOptionalvalueSigned32) -> new IntType(nonOptionalvalueSigned32)).orElse(new EmptyType()))); + values.add(new StructElement(VALUE_UNSIGNED64_ID, valueUnsigned64.map((nonOptionalvalueUnsigned64) -> new UIntType(nonOptionalvalueUnsigned64)).orElse(new EmptyType()))); + values.add(new StructElement(VALUE_SIGNED64_ID, valueSigned64.map((nonOptionalvalueSigned64) -> new IntType(nonOptionalvalueSigned64)).orElse(new EmptyType()))); return new StructType(values); } - public static ScenesManagementClusterAttributeValuePair decodeTlv(BaseTLVType tlvValue) { + public static ScenesManagementClusterAttributeValuePairStruct decodeTlv(BaseTLVType tlvValue) { if (tlvValue == null || tlvValue.type() != TLVType.Struct) { return null; } Long attributeID = null; - Long attributeValue = null; + Optional valueUnsigned8 = Optional.empty(); + Optional valueSigned8 = Optional.empty(); + Optional valueUnsigned16 = Optional.empty(); + Optional valueSigned16 = Optional.empty(); + Optional valueUnsigned32 = Optional.empty(); + Optional valueSigned32 = Optional.empty(); + Optional valueUnsigned64 = Optional.empty(); + Optional valueSigned64 = Optional.empty(); for (StructElement element: ((StructType)tlvValue).value()) { if (element.contextTagNum() == ATTRIBUTE_I_D_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); attributeID = castingValue.value(Long.class); } - } else if (element.contextTagNum() == ATTRIBUTE_VALUE_ID) { + } else if (element.contextTagNum() == VALUE_UNSIGNED8_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + valueUnsigned8 = Optional.of(castingValue.value(Integer.class)); + } + } else if (element.contextTagNum() == VALUE_SIGNED8_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Int) { + IntType castingValue = element.value(IntType.class); + valueSigned8 = Optional.of(castingValue.value(Integer.class)); + } + } else if (element.contextTagNum() == VALUE_UNSIGNED16_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); - attributeValue = castingValue.value(Long.class); + valueUnsigned16 = Optional.of(castingValue.value(Integer.class)); + } + } else if (element.contextTagNum() == VALUE_SIGNED16_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Int) { + IntType castingValue = element.value(IntType.class); + valueSigned16 = Optional.of(castingValue.value(Integer.class)); + } + } else if (element.contextTagNum() == VALUE_UNSIGNED32_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + valueUnsigned32 = Optional.of(castingValue.value(Long.class)); + } + } else if (element.contextTagNum() == VALUE_SIGNED32_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Int) { + IntType castingValue = element.value(IntType.class); + valueSigned32 = Optional.of(castingValue.value(Long.class)); + } + } else if (element.contextTagNum() == VALUE_UNSIGNED64_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + valueUnsigned64 = Optional.of(castingValue.value(Long.class)); + } + } else if (element.contextTagNum() == VALUE_SIGNED64_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Int) { + IntType castingValue = element.value(IntType.class); + valueSigned64 = Optional.of(castingValue.value(Long.class)); } } } - return new ScenesManagementClusterAttributeValuePair( + return new ScenesManagementClusterAttributeValuePairStruct( attributeID, - attributeValue + valueUnsigned8, + valueSigned8, + valueUnsigned16, + valueSigned16, + valueUnsigned32, + valueSigned32, + valueUnsigned64, + valueSigned64 ); } @Override public String toString() { StringBuilder output = new StringBuilder(); - output.append("ScenesManagementClusterAttributeValuePair {\n"); + output.append("ScenesManagementClusterAttributeValuePairStruct {\n"); output.append("\tattributeID: "); output.append(attributeID); output.append("\n"); - output.append("\tattributeValue: "); - output.append(attributeValue); + output.append("\tvalueUnsigned8: "); + output.append(valueUnsigned8); + output.append("\n"); + output.append("\tvalueSigned8: "); + output.append(valueSigned8); + output.append("\n"); + output.append("\tvalueUnsigned16: "); + output.append(valueUnsigned16); + output.append("\n"); + output.append("\tvalueSigned16: "); + output.append(valueSigned16); + output.append("\n"); + output.append("\tvalueUnsigned32: "); + output.append(valueUnsigned32); + output.append("\n"); + output.append("\tvalueSigned32: "); + output.append(valueSigned32); + output.append("\n"); + output.append("\tvalueUnsigned64: "); + output.append(valueUnsigned64); + output.append("\n"); + output.append("\tvalueSigned64: "); + output.append(valueSigned64); output.append("\n"); output.append("}\n"); return output.toString(); @@ -5141,13 +5246,13 @@ public String toString() { } public static class ScenesManagementClusterExtensionFieldSet { public Long clusterID; - public ArrayList attributeValueList; + public ArrayList attributeValueList; private static final long CLUSTER_I_D_ID = 0L; private static final long ATTRIBUTE_VALUE_LIST_ID = 1L; public ScenesManagementClusterExtensionFieldSet( Long clusterID, - ArrayList attributeValueList + ArrayList attributeValueList ) { this.clusterID = clusterID; this.attributeValueList = attributeValueList; @@ -5166,7 +5271,7 @@ public static ScenesManagementClusterExtensionFieldSet decodeTlv(BaseTLVType tlv return null; } Long clusterID = null; - ArrayList attributeValueList = null; + ArrayList attributeValueList = null; for (StructElement element: ((StructType)tlvValue).value()) { if (element.contextTagNum() == CLUSTER_I_D_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { @@ -5176,7 +5281,7 @@ public static ScenesManagementClusterExtensionFieldSet decodeTlv(BaseTLVType tlv } else if (element.contextTagNum() == ATTRIBUTE_VALUE_LIST_ID) { if (element.value(BaseTLVType.class).type() == TLVType.Array) { ArrayType castingValue = element.value(ArrayType.class); - attributeValueList = castingValue.map((elementcastingValue) -> ChipStructs.ScenesManagementClusterAttributeValuePair.decodeTlv(elementcastingValue)); + attributeValueList = castingValue.map((elementcastingValue) -> ChipStructs.ScenesManagementClusterAttributeValuePairStruct.decodeTlv(elementcastingValue)); } } } diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni index 4bcff980b6cbe6..a62e5ec79a241e 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni @@ -113,7 +113,7 @@ structs_sources = [ "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RvcOperationalStateClusterOperationalStateStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RvcRunModeClusterModeOptionStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RvcRunModeClusterModeTagStruct.kt", - "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesManagementClusterAttributeValuePair.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesManagementClusterAttributeValuePairStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesManagementClusterExtensionFieldSet.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesManagementClusterSceneInfoStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterHomeLocationStruct.kt", diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesManagementClusterAttributeValuePair.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesManagementClusterAttributeValuePair.kt deleted file mode 100644 index 3cf9c98d53e6d1..00000000000000 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesManagementClusterAttributeValuePair.kt +++ /dev/null @@ -1,56 +0,0 @@ -/* - * - * Copyright (c) 2023 Project CHIP Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package chip.devicecontroller.cluster.structs - -import chip.devicecontroller.cluster.* -import matter.tlv.ContextSpecificTag -import matter.tlv.Tag -import matter.tlv.TlvReader -import matter.tlv.TlvWriter - -class ScenesManagementClusterAttributeValuePair(val attributeID: ULong, val attributeValue: ULong) { - override fun toString(): String = buildString { - append("ScenesManagementClusterAttributeValuePair {\n") - append("\tattributeID : $attributeID\n") - append("\tattributeValue : $attributeValue\n") - append("}\n") - } - - fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { - tlvWriter.apply { - startStructure(tlvTag) - put(ContextSpecificTag(TAG_ATTRIBUTE_I_D), attributeID) - put(ContextSpecificTag(TAG_ATTRIBUTE_VALUE), attributeValue) - endStructure() - } - } - - companion object { - private const val TAG_ATTRIBUTE_I_D = 0 - private const val TAG_ATTRIBUTE_VALUE = 1 - - fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ScenesManagementClusterAttributeValuePair { - tlvReader.enterStructure(tlvTag) - val attributeID = tlvReader.getULong(ContextSpecificTag(TAG_ATTRIBUTE_I_D)) - val attributeValue = tlvReader.getULong(ContextSpecificTag(TAG_ATTRIBUTE_VALUE)) - - tlvReader.exitContainer() - - return ScenesManagementClusterAttributeValuePair(attributeID, attributeValue) - } - } -} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesManagementClusterAttributeValuePairStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesManagementClusterAttributeValuePairStruct.kt new file mode 100644 index 00000000000000..f8526c71f933a5 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesManagementClusterAttributeValuePairStruct.kt @@ -0,0 +1,172 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package chip.devicecontroller.cluster.structs + +import chip.devicecontroller.cluster.* +import java.util.Optional +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ScenesManagementClusterAttributeValuePairStruct( + val attributeID: ULong, + val valueUnsigned8: Optional, + val valueSigned8: Optional, + val valueUnsigned16: Optional, + val valueSigned16: Optional, + val valueUnsigned32: Optional, + val valueSigned32: Optional, + val valueUnsigned64: Optional, + val valueSigned64: Optional, +) { + override fun toString(): String = buildString { + append("ScenesManagementClusterAttributeValuePairStruct {\n") + append("\tattributeID : $attributeID\n") + append("\tvalueUnsigned8 : $valueUnsigned8\n") + append("\tvalueSigned8 : $valueSigned8\n") + append("\tvalueUnsigned16 : $valueUnsigned16\n") + append("\tvalueSigned16 : $valueSigned16\n") + append("\tvalueUnsigned32 : $valueUnsigned32\n") + append("\tvalueSigned32 : $valueSigned32\n") + append("\tvalueUnsigned64 : $valueUnsigned64\n") + append("\tvalueSigned64 : $valueSigned64\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_ATTRIBUTE_I_D), attributeID) + if (valueUnsigned8.isPresent) { + val optvalueUnsigned8 = valueUnsigned8.get() + put(ContextSpecificTag(TAG_VALUE_UNSIGNED8), optvalueUnsigned8) + } + if (valueSigned8.isPresent) { + val optvalueSigned8 = valueSigned8.get() + put(ContextSpecificTag(TAG_VALUE_SIGNED8), optvalueSigned8) + } + if (valueUnsigned16.isPresent) { + val optvalueUnsigned16 = valueUnsigned16.get() + put(ContextSpecificTag(TAG_VALUE_UNSIGNED16), optvalueUnsigned16) + } + if (valueSigned16.isPresent) { + val optvalueSigned16 = valueSigned16.get() + put(ContextSpecificTag(TAG_VALUE_SIGNED16), optvalueSigned16) + } + if (valueUnsigned32.isPresent) { + val optvalueUnsigned32 = valueUnsigned32.get() + put(ContextSpecificTag(TAG_VALUE_UNSIGNED32), optvalueUnsigned32) + } + if (valueSigned32.isPresent) { + val optvalueSigned32 = valueSigned32.get() + put(ContextSpecificTag(TAG_VALUE_SIGNED32), optvalueSigned32) + } + if (valueUnsigned64.isPresent) { + val optvalueUnsigned64 = valueUnsigned64.get() + put(ContextSpecificTag(TAG_VALUE_UNSIGNED64), optvalueUnsigned64) + } + if (valueSigned64.isPresent) { + val optvalueSigned64 = valueSigned64.get() + put(ContextSpecificTag(TAG_VALUE_SIGNED64), optvalueSigned64) + } + endStructure() + } + } + + companion object { + private const val TAG_ATTRIBUTE_I_D = 0 + private const val TAG_VALUE_UNSIGNED8 = 1 + private const val TAG_VALUE_SIGNED8 = 2 + private const val TAG_VALUE_UNSIGNED16 = 3 + private const val TAG_VALUE_SIGNED16 = 4 + private const val TAG_VALUE_UNSIGNED32 = 5 + private const val TAG_VALUE_SIGNED32 = 6 + private const val TAG_VALUE_UNSIGNED64 = 7 + private const val TAG_VALUE_SIGNED64 = 8 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader, + ): ScenesManagementClusterAttributeValuePairStruct { + tlvReader.enterStructure(tlvTag) + val attributeID = tlvReader.getULong(ContextSpecificTag(TAG_ATTRIBUTE_I_D)) + val valueUnsigned8 = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_VALUE_UNSIGNED8))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_VALUE_UNSIGNED8))) + } else { + Optional.empty() + } + val valueSigned8 = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_VALUE_SIGNED8))) { + Optional.of(tlvReader.getInt(ContextSpecificTag(TAG_VALUE_SIGNED8))) + } else { + Optional.empty() + } + val valueUnsigned16 = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_VALUE_UNSIGNED16))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_VALUE_UNSIGNED16))) + } else { + Optional.empty() + } + val valueSigned16 = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_VALUE_SIGNED16))) { + Optional.of(tlvReader.getInt(ContextSpecificTag(TAG_VALUE_SIGNED16))) + } else { + Optional.empty() + } + val valueUnsigned32 = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_VALUE_UNSIGNED32))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_VALUE_UNSIGNED32))) + } else { + Optional.empty() + } + val valueSigned32 = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_VALUE_SIGNED32))) { + Optional.of(tlvReader.getLong(ContextSpecificTag(TAG_VALUE_SIGNED32))) + } else { + Optional.empty() + } + val valueUnsigned64 = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_VALUE_UNSIGNED64))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_VALUE_UNSIGNED64))) + } else { + Optional.empty() + } + val valueSigned64 = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_VALUE_SIGNED64))) { + Optional.of(tlvReader.getLong(ContextSpecificTag(TAG_VALUE_SIGNED64))) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return ScenesManagementClusterAttributeValuePairStruct( + attributeID, + valueUnsigned8, + valueSigned8, + valueUnsigned16, + valueSigned16, + valueUnsigned32, + valueSigned32, + valueUnsigned64, + valueSigned64, + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesManagementClusterExtensionFieldSet.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesManagementClusterExtensionFieldSet.kt index 64bc8aff47ea55..a2add794802904 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesManagementClusterExtensionFieldSet.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesManagementClusterExtensionFieldSet.kt @@ -25,7 +25,7 @@ import matter.tlv.TlvWriter class ScenesManagementClusterExtensionFieldSet( val clusterID: ULong, - val attributeValueList: List, + val attributeValueList: List, ) { override fun toString(): String = buildString { append("ScenesManagementClusterExtensionFieldSet {\n") @@ -55,10 +55,10 @@ class ScenesManagementClusterExtensionFieldSet( tlvReader.enterStructure(tlvTag) val clusterID = tlvReader.getULong(ContextSpecificTag(TAG_CLUSTER_I_D)) val attributeValueList = - buildList { + buildList { tlvReader.enterArray(ContextSpecificTag(TAG_ATTRIBUTE_VALUE_LIST)) while (!tlvReader.isEndOfContainer()) { - add(ScenesManagementClusterAttributeValuePair.fromTlv(AnonymousTag, tlvReader)) + add(ScenesManagementClusterAttributeValuePairStruct.fromTlv(AnonymousTag, tlvReader)) } tlvReader.exitContainer() } diff --git a/src/controller/java/generated/java/matter/controller/cluster/files.gni b/src/controller/java/generated/java/matter/controller/cluster/files.gni index 7c11cb00b0aceb..27e731d29bf4d9 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/files.gni +++ b/src/controller/java/generated/java/matter/controller/cluster/files.gni @@ -113,7 +113,7 @@ matter_structs_sources = [ "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/RvcOperationalStateClusterOperationalStateStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/RvcRunModeClusterModeOptionStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/RvcRunModeClusterModeTagStruct.kt", - "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ScenesManagementClusterAttributeValuePair.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ScenesManagementClusterAttributeValuePairStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ScenesManagementClusterExtensionFieldSet.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ScenesManagementClusterSceneInfoStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterHomeLocationStruct.kt", diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ScenesManagementClusterAttributeValuePair.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ScenesManagementClusterAttributeValuePair.kt deleted file mode 100644 index 1a14970ba2bd58..00000000000000 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/ScenesManagementClusterAttributeValuePair.kt +++ /dev/null @@ -1,56 +0,0 @@ -/* - * - * Copyright (c) 2023 Project CHIP Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package matter.controller.cluster.structs - -import matter.controller.cluster.* -import matter.tlv.ContextSpecificTag -import matter.tlv.Tag -import matter.tlv.TlvReader -import matter.tlv.TlvWriter - -class ScenesManagementClusterAttributeValuePair(val attributeID: UInt, val attributeValue: UInt) { - override fun toString(): String = buildString { - append("ScenesManagementClusterAttributeValuePair {\n") - append("\tattributeID : $attributeID\n") - append("\tattributeValue : $attributeValue\n") - append("}\n") - } - - fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { - tlvWriter.apply { - startStructure(tlvTag) - put(ContextSpecificTag(TAG_ATTRIBUTE_I_D), attributeID) - put(ContextSpecificTag(TAG_ATTRIBUTE_VALUE), attributeValue) - endStructure() - } - } - - companion object { - private const val TAG_ATTRIBUTE_I_D = 0 - private const val TAG_ATTRIBUTE_VALUE = 1 - - fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ScenesManagementClusterAttributeValuePair { - tlvReader.enterStructure(tlvTag) - val attributeID = tlvReader.getUInt(ContextSpecificTag(TAG_ATTRIBUTE_I_D)) - val attributeValue = tlvReader.getUInt(ContextSpecificTag(TAG_ATTRIBUTE_VALUE)) - - tlvReader.exitContainer() - - return ScenesManagementClusterAttributeValuePair(attributeID, attributeValue) - } - } -} diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ScenesManagementClusterAttributeValuePairStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ScenesManagementClusterAttributeValuePairStruct.kt new file mode 100644 index 00000000000000..9f142d41b3da4f --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ScenesManagementClusterAttributeValuePairStruct.kt @@ -0,0 +1,172 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package matter.controller.cluster.structs + +import java.util.Optional +import matter.controller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ScenesManagementClusterAttributeValuePairStruct( + val attributeID: UInt, + val valueUnsigned8: Optional, + val valueSigned8: Optional, + val valueUnsigned16: Optional, + val valueSigned16: Optional, + val valueUnsigned32: Optional, + val valueSigned32: Optional, + val valueUnsigned64: Optional, + val valueSigned64: Optional, +) { + override fun toString(): String = buildString { + append("ScenesManagementClusterAttributeValuePairStruct {\n") + append("\tattributeID : $attributeID\n") + append("\tvalueUnsigned8 : $valueUnsigned8\n") + append("\tvalueSigned8 : $valueSigned8\n") + append("\tvalueUnsigned16 : $valueUnsigned16\n") + append("\tvalueSigned16 : $valueSigned16\n") + append("\tvalueUnsigned32 : $valueUnsigned32\n") + append("\tvalueSigned32 : $valueSigned32\n") + append("\tvalueUnsigned64 : $valueUnsigned64\n") + append("\tvalueSigned64 : $valueSigned64\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_ATTRIBUTE_I_D), attributeID) + if (valueUnsigned8.isPresent) { + val optvalueUnsigned8 = valueUnsigned8.get() + put(ContextSpecificTag(TAG_VALUE_UNSIGNED8), optvalueUnsigned8) + } + if (valueSigned8.isPresent) { + val optvalueSigned8 = valueSigned8.get() + put(ContextSpecificTag(TAG_VALUE_SIGNED8), optvalueSigned8) + } + if (valueUnsigned16.isPresent) { + val optvalueUnsigned16 = valueUnsigned16.get() + put(ContextSpecificTag(TAG_VALUE_UNSIGNED16), optvalueUnsigned16) + } + if (valueSigned16.isPresent) { + val optvalueSigned16 = valueSigned16.get() + put(ContextSpecificTag(TAG_VALUE_SIGNED16), optvalueSigned16) + } + if (valueUnsigned32.isPresent) { + val optvalueUnsigned32 = valueUnsigned32.get() + put(ContextSpecificTag(TAG_VALUE_UNSIGNED32), optvalueUnsigned32) + } + if (valueSigned32.isPresent) { + val optvalueSigned32 = valueSigned32.get() + put(ContextSpecificTag(TAG_VALUE_SIGNED32), optvalueSigned32) + } + if (valueUnsigned64.isPresent) { + val optvalueUnsigned64 = valueUnsigned64.get() + put(ContextSpecificTag(TAG_VALUE_UNSIGNED64), optvalueUnsigned64) + } + if (valueSigned64.isPresent) { + val optvalueSigned64 = valueSigned64.get() + put(ContextSpecificTag(TAG_VALUE_SIGNED64), optvalueSigned64) + } + endStructure() + } + } + + companion object { + private const val TAG_ATTRIBUTE_I_D = 0 + private const val TAG_VALUE_UNSIGNED8 = 1 + private const val TAG_VALUE_SIGNED8 = 2 + private const val TAG_VALUE_UNSIGNED16 = 3 + private const val TAG_VALUE_SIGNED16 = 4 + private const val TAG_VALUE_UNSIGNED32 = 5 + private const val TAG_VALUE_SIGNED32 = 6 + private const val TAG_VALUE_UNSIGNED64 = 7 + private const val TAG_VALUE_SIGNED64 = 8 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader, + ): ScenesManagementClusterAttributeValuePairStruct { + tlvReader.enterStructure(tlvTag) + val attributeID = tlvReader.getUInt(ContextSpecificTag(TAG_ATTRIBUTE_I_D)) + val valueUnsigned8 = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_VALUE_UNSIGNED8))) { + Optional.of(tlvReader.getUByte(ContextSpecificTag(TAG_VALUE_UNSIGNED8))) + } else { + Optional.empty() + } + val valueSigned8 = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_VALUE_SIGNED8))) { + Optional.of(tlvReader.getByte(ContextSpecificTag(TAG_VALUE_SIGNED8))) + } else { + Optional.empty() + } + val valueUnsigned16 = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_VALUE_UNSIGNED16))) { + Optional.of(tlvReader.getUShort(ContextSpecificTag(TAG_VALUE_UNSIGNED16))) + } else { + Optional.empty() + } + val valueSigned16 = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_VALUE_SIGNED16))) { + Optional.of(tlvReader.getShort(ContextSpecificTag(TAG_VALUE_SIGNED16))) + } else { + Optional.empty() + } + val valueUnsigned32 = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_VALUE_UNSIGNED32))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_VALUE_UNSIGNED32))) + } else { + Optional.empty() + } + val valueSigned32 = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_VALUE_SIGNED32))) { + Optional.of(tlvReader.getInt(ContextSpecificTag(TAG_VALUE_SIGNED32))) + } else { + Optional.empty() + } + val valueUnsigned64 = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_VALUE_UNSIGNED64))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_VALUE_UNSIGNED64))) + } else { + Optional.empty() + } + val valueSigned64 = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_VALUE_SIGNED64))) { + Optional.of(tlvReader.getLong(ContextSpecificTag(TAG_VALUE_SIGNED64))) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return ScenesManagementClusterAttributeValuePairStruct( + attributeID, + valueUnsigned8, + valueSigned8, + valueUnsigned16, + valueSigned16, + valueUnsigned32, + valueSigned32, + valueUnsigned64, + valueSigned64, + ) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ScenesManagementClusterExtensionFieldSet.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ScenesManagementClusterExtensionFieldSet.kt index bf90959b2604ed..bd219e98d152fd 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/ScenesManagementClusterExtensionFieldSet.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ScenesManagementClusterExtensionFieldSet.kt @@ -25,7 +25,7 @@ import matter.tlv.TlvWriter class ScenesManagementClusterExtensionFieldSet( val clusterID: UInt, - val attributeValueList: List, + val attributeValueList: List, ) { override fun toString(): String = buildString { append("ScenesManagementClusterExtensionFieldSet {\n") @@ -55,10 +55,10 @@ class ScenesManagementClusterExtensionFieldSet( tlvReader.enterStructure(tlvTag) val clusterID = tlvReader.getUInt(ContextSpecificTag(TAG_CLUSTER_I_D)) val attributeValueList = - buildList { + buildList { tlvReader.enterArray(ContextSpecificTag(TAG_ATTRIBUTE_VALUE_LIST)) while (!tlvReader.isEndOfContainer()) { - add(ScenesManagementClusterAttributeValuePair.fromTlv(AnonymousTag, tlvReader)) + add(ScenesManagementClusterAttributeValuePairStruct.fromTlv(AnonymousTag, tlvReader)) } tlvReader.exitContainer() } diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index de7708f8bcb318..516e2f5a2e7800 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -20334,17 +20334,31 @@ class Feature(IntFlag): class Structs: @dataclass - class AttributeValuePair(ClusterObject): + class AttributeValuePairStruct(ClusterObject): @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ ClusterObjectFieldDescriptor(Label="attributeID", Tag=0, Type=uint), - ClusterObjectFieldDescriptor(Label="attributeValue", Tag=1, Type=uint), + ClusterObjectFieldDescriptor(Label="valueUnsigned8", Tag=1, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="valueSigned8", Tag=2, Type=typing.Optional[int]), + ClusterObjectFieldDescriptor(Label="valueUnsigned16", Tag=3, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="valueSigned16", Tag=4, Type=typing.Optional[int]), + ClusterObjectFieldDescriptor(Label="valueUnsigned32", Tag=5, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="valueSigned32", Tag=6, Type=typing.Optional[int]), + ClusterObjectFieldDescriptor(Label="valueUnsigned64", Tag=7, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="valueSigned64", Tag=8, Type=typing.Optional[int]), ]) attributeID: 'uint' = 0 - attributeValue: 'uint' = 0 + valueUnsigned8: 'typing.Optional[uint]' = None + valueSigned8: 'typing.Optional[int]' = None + valueUnsigned16: 'typing.Optional[uint]' = None + valueSigned16: 'typing.Optional[int]' = None + valueUnsigned32: 'typing.Optional[uint]' = None + valueSigned32: 'typing.Optional[int]' = None + valueUnsigned64: 'typing.Optional[uint]' = None + valueSigned64: 'typing.Optional[int]' = None @dataclass class ExtensionFieldSet(ClusterObject): @@ -20353,11 +20367,11 @@ def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ ClusterObjectFieldDescriptor(Label="clusterID", Tag=0, Type=uint), - ClusterObjectFieldDescriptor(Label="attributeValueList", Tag=1, Type=typing.List[ScenesManagement.Structs.AttributeValuePair]), + ClusterObjectFieldDescriptor(Label="attributeValueList", Tag=1, Type=typing.List[ScenesManagement.Structs.AttributeValuePairStruct]), ]) clusterID: 'uint' = 0 - attributeValueList: 'typing.List[ScenesManagement.Structs.AttributeValuePair]' = field(default_factory=lambda: []) + attributeValueList: 'typing.List[ScenesManagement.Structs.AttributeValuePairStruct]' = field(default_factory=lambda: []) @dataclass class SceneInfoStruct(ClusterObject): diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h index 979c1b92605c15..fbf61defa7fe56 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -6625,7 +6625,7 @@ MTR_PROVISIONALLY_AVAILABLE /** * Command AddScene * - * Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeId": VALUE, "AttributeValue": VALUE}]}' + * Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeID": VALUE, "Value*": VALUE}]}' */ - (void)addSceneWithParams:(MTRScenesManagementClusterAddSceneParams *)params completion:(void (^)(MTRScenesManagementClusterAddSceneResponseParams * _Nullable data, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; /** diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm index 01a7844ada5f32..bacd761f42ffac 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm @@ -13068,13 +13068,44 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader } listFreer.add(listHolder_2); for (size_t i_2 = 0; i_2 < element_0.attributeValueList.count; ++i_2) { - if (![element_0.attributeValueList[i_2] isKindOfClass:[MTRScenesManagementClusterAttributeValuePair class]]) { + if (![element_0.attributeValueList[i_2] isKindOfClass:[MTRScenesManagementClusterAttributeValuePairStruct class]]) { // Wrong kind of value. return CHIP_ERROR_INVALID_ARGUMENT; } - auto element_2 = (MTRScenesManagementClusterAttributeValuePair *) element_0.attributeValueList[i_2]; + auto element_2 = (MTRScenesManagementClusterAttributeValuePairStruct *) element_0.attributeValueList[i_2]; listHolder_2->mList[i_2].attributeID = element_2.attributeID.unsignedIntValue; - listHolder_2->mList[i_2].attributeValue = element_2.attributeValue.unsignedIntValue; + if (element_2.valueUnsigned8 != nil) { + auto & definedValue_4 = listHolder_2->mList[i_2].valueUnsigned8.Emplace(); + definedValue_4 = element_2.valueUnsigned8.unsignedCharValue; + } + if (element_2.valueSigned8 != nil) { + auto & definedValue_4 = listHolder_2->mList[i_2].valueSigned8.Emplace(); + definedValue_4 = element_2.valueSigned8.charValue; + } + if (element_2.valueUnsigned16 != nil) { + auto & definedValue_4 = listHolder_2->mList[i_2].valueUnsigned16.Emplace(); + definedValue_4 = element_2.valueUnsigned16.unsignedShortValue; + } + if (element_2.valueSigned16 != nil) { + auto & definedValue_4 = listHolder_2->mList[i_2].valueSigned16.Emplace(); + definedValue_4 = element_2.valueSigned16.shortValue; + } + if (element_2.valueUnsigned32 != nil) { + auto & definedValue_4 = listHolder_2->mList[i_2].valueUnsigned32.Emplace(); + definedValue_4 = element_2.valueUnsigned32.unsignedIntValue; + } + if (element_2.valueSigned32 != nil) { + auto & definedValue_4 = listHolder_2->mList[i_2].valueSigned32.Emplace(); + definedValue_4 = element_2.valueSigned32.intValue; + } + if (element_2.valueUnsigned64 != nil) { + auto & definedValue_4 = listHolder_2->mList[i_2].valueUnsigned64.Emplace(); + definedValue_4 = element_2.valueUnsigned64.unsignedLongLongValue; + } + if (element_2.valueSigned64 != nil) { + auto & definedValue_4 = listHolder_2->mList[i_2].valueSigned64.Emplace(); + definedValue_4 = element_2.valueSigned64.longLongValue; + } } listHolder_0->mList[i_0].attributeValueList = ListType_2(listHolder_2->mList, element_0.attributeValueList.count); } else { @@ -13431,10 +13462,49 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::ScenesMa auto iter_3 = entry_1.attributeValueList.begin(); while (iter_3.Next()) { auto & entry_3 = iter_3.GetValue(); - MTRScenesManagementClusterAttributeValuePair * newElement_3; - newElement_3 = [MTRScenesManagementClusterAttributeValuePair new]; + MTRScenesManagementClusterAttributeValuePairStruct * newElement_3; + newElement_3 = [MTRScenesManagementClusterAttributeValuePairStruct new]; newElement_3.attributeID = [NSNumber numberWithUnsignedInt:entry_3.attributeID]; - newElement_3.attributeValue = [NSNumber numberWithUnsignedInt:entry_3.attributeValue]; + if (entry_3.valueUnsigned8.HasValue()) { + newElement_3.valueUnsigned8 = [NSNumber numberWithUnsignedChar:entry_3.valueUnsigned8.Value()]; + } else { + newElement_3.valueUnsigned8 = nil; + } + if (entry_3.valueSigned8.HasValue()) { + newElement_3.valueSigned8 = [NSNumber numberWithChar:entry_3.valueSigned8.Value()]; + } else { + newElement_3.valueSigned8 = nil; + } + if (entry_3.valueUnsigned16.HasValue()) { + newElement_3.valueUnsigned16 = [NSNumber numberWithUnsignedShort:entry_3.valueUnsigned16.Value()]; + } else { + newElement_3.valueUnsigned16 = nil; + } + if (entry_3.valueSigned16.HasValue()) { + newElement_3.valueSigned16 = [NSNumber numberWithShort:entry_3.valueSigned16.Value()]; + } else { + newElement_3.valueSigned16 = nil; + } + if (entry_3.valueUnsigned32.HasValue()) { + newElement_3.valueUnsigned32 = [NSNumber numberWithUnsignedInt:entry_3.valueUnsigned32.Value()]; + } else { + newElement_3.valueUnsigned32 = nil; + } + if (entry_3.valueSigned32.HasValue()) { + newElement_3.valueSigned32 = [NSNumber numberWithInt:entry_3.valueSigned32.Value()]; + } else { + newElement_3.valueSigned32 = nil; + } + if (entry_3.valueUnsigned64.HasValue()) { + newElement_3.valueUnsigned64 = [NSNumber numberWithUnsignedLongLong:entry_3.valueUnsigned64.Value()]; + } else { + newElement_3.valueUnsigned64 = nil; + } + if (entry_3.valueSigned64.HasValue()) { + newElement_3.valueSigned64 = [NSNumber numberWithLongLong:entry_3.valueSigned64.Value()]; + } else { + newElement_3.valueSigned64 = nil; + } [array_3 addObject:newElement_3]; } CHIP_ERROR err = iter_3.GetStatus(); diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h index 74a621dd01df9c..2301e63c1e5c38 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h @@ -1017,9 +1017,16 @@ MTR_AVAILABLE(ios(17.4), macos(14.4), watchos(10.4), tvos(17.4)) @end MTR_PROVISIONALLY_AVAILABLE -@interface MTRScenesManagementClusterAttributeValuePair : NSObject +@interface MTRScenesManagementClusterAttributeValuePairStruct : NSObject @property (nonatomic, copy) NSNumber * _Nonnull attributeID MTR_PROVISIONALLY_AVAILABLE; -@property (nonatomic, copy) NSNumber * _Nonnull attributeValue MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable valueUnsigned8 MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable valueSigned8 MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable valueUnsigned16 MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable valueSigned16 MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable valueUnsigned32 MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable valueSigned32 MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable valueUnsigned64 MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable valueSigned64 MTR_PROVISIONALLY_AVAILABLE; @end MTR_PROVISIONALLY_AVAILABLE diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm index 5dca49be4900cf..97031c54c37287 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm @@ -4024,31 +4024,52 @@ - (NSString *)description @end -@implementation MTRScenesManagementClusterAttributeValuePair +@implementation MTRScenesManagementClusterAttributeValuePairStruct - (instancetype)init { if (self = [super init]) { _attributeID = @(0); - _attributeValue = @(0); + _valueUnsigned8 = nil; + + _valueSigned8 = nil; + + _valueUnsigned16 = nil; + + _valueSigned16 = nil; + + _valueUnsigned32 = nil; + + _valueSigned32 = nil; + + _valueUnsigned64 = nil; + + _valueSigned64 = nil; } return self; } - (id)copyWithZone:(NSZone * _Nullable)zone { - auto other = [[MTRScenesManagementClusterAttributeValuePair alloc] init]; + auto other = [[MTRScenesManagementClusterAttributeValuePairStruct alloc] init]; other.attributeID = self.attributeID; - other.attributeValue = self.attributeValue; + other.valueUnsigned8 = self.valueUnsigned8; + other.valueSigned8 = self.valueSigned8; + other.valueUnsigned16 = self.valueUnsigned16; + other.valueSigned16 = self.valueSigned16; + other.valueUnsigned32 = self.valueUnsigned32; + other.valueSigned32 = self.valueSigned32; + other.valueUnsigned64 = self.valueUnsigned64; + other.valueSigned64 = self.valueSigned64; return other; } - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: attributeID:%@; attributeValue:%@; >", NSStringFromClass([self class]), _attributeID, _attributeValue]; + NSString * descriptionString = [NSString stringWithFormat:@"<%@: attributeID:%@; valueUnsigned8:%@; valueSigned8:%@; valueUnsigned16:%@; valueSigned16:%@; valueUnsigned32:%@; valueSigned32:%@; valueUnsigned64:%@; valueSigned64:%@; >", NSStringFromClass([self class]), _attributeID, _valueUnsigned8, _valueSigned8, _valueUnsigned16, _valueSigned16, _valueUnsigned32, _valueSigned32, _valueUnsigned64, _valueSigned64]; return descriptionString; } 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 42a36d6da15918..09383b5a02c3ec 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 @@ -12594,12 +12594,19 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) namespace ScenesManagement { namespace Structs { -namespace AttributeValuePair { +namespace AttributeValuePairStruct { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; encoder.Encode(to_underlying(Fields::kAttributeID), attributeID); - encoder.Encode(to_underlying(Fields::kAttributeValue), attributeValue); + encoder.Encode(to_underlying(Fields::kValueUnsigned8), valueUnsigned8); + encoder.Encode(to_underlying(Fields::kValueSigned8), valueSigned8); + encoder.Encode(to_underlying(Fields::kValueUnsigned16), valueUnsigned16); + encoder.Encode(to_underlying(Fields::kValueSigned16), valueSigned16); + encoder.Encode(to_underlying(Fields::kValueUnsigned32), valueUnsigned32); + encoder.Encode(to_underlying(Fields::kValueSigned32), valueSigned32); + encoder.Encode(to_underlying(Fields::kValueUnsigned64), valueUnsigned64); + encoder.Encode(to_underlying(Fields::kValueSigned64), valueSigned64); return encoder.Finalize(); } @@ -12621,9 +12628,37 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { err = DataModel::Decode(reader, attributeID); } - else if (__context_tag == to_underlying(Fields::kAttributeValue)) + else if (__context_tag == to_underlying(Fields::kValueUnsigned8)) { - err = DataModel::Decode(reader, attributeValue); + err = DataModel::Decode(reader, valueUnsigned8); + } + else if (__context_tag == to_underlying(Fields::kValueSigned8)) + { + err = DataModel::Decode(reader, valueSigned8); + } + else if (__context_tag == to_underlying(Fields::kValueUnsigned16)) + { + err = DataModel::Decode(reader, valueUnsigned16); + } + else if (__context_tag == to_underlying(Fields::kValueSigned16)) + { + err = DataModel::Decode(reader, valueSigned16); + } + else if (__context_tag == to_underlying(Fields::kValueUnsigned32)) + { + err = DataModel::Decode(reader, valueUnsigned32); + } + else if (__context_tag == to_underlying(Fields::kValueSigned32)) + { + err = DataModel::Decode(reader, valueSigned32); + } + else if (__context_tag == to_underlying(Fields::kValueUnsigned64)) + { + err = DataModel::Decode(reader, valueUnsigned64); + } + else if (__context_tag == to_underlying(Fields::kValueSigned64)) + { + err = DataModel::Decode(reader, valueSigned64); } else { @@ -12633,7 +12668,7 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } } -} // namespace AttributeValuePair +} // namespace AttributeValuePairStruct namespace ExtensionFieldSet { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const 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 a1fb80c760815c..5b562f5b58a020 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 @@ -18174,18 +18174,32 @@ struct DecodableType } // namespace RvcOperationalState namespace ScenesManagement { namespace Structs { -namespace AttributeValuePair { +namespace AttributeValuePairStruct { enum class Fields : uint8_t { - kAttributeID = 0, - kAttributeValue = 1, + kAttributeID = 0, + kValueUnsigned8 = 1, + kValueSigned8 = 2, + kValueUnsigned16 = 3, + kValueSigned16 = 4, + kValueUnsigned32 = 5, + kValueSigned32 = 6, + kValueUnsigned64 = 7, + kValueSigned64 = 8, }; struct Type { public: chip::AttributeId attributeID = static_cast(0); - uint32_t attributeValue = static_cast(0); + Optional valueUnsigned8; + Optional valueSigned8; + Optional valueUnsigned16; + Optional valueSigned16; + Optional valueUnsigned32; + Optional valueSigned32; + Optional valueUnsigned64; + Optional valueSigned64; CHIP_ERROR Decode(TLV::TLVReader & reader); @@ -18196,7 +18210,7 @@ struct Type using DecodableType = Type; -} // namespace AttributeValuePair +} // namespace AttributeValuePairStruct namespace ExtensionFieldSet { enum class Fields : uint8_t { @@ -18208,7 +18222,7 @@ struct Type { public: chip::ClusterId clusterID = static_cast(0); - DataModel::List attributeValueList; + DataModel::List attributeValueList; static constexpr bool kIsFabricScoped = false; @@ -18219,7 +18233,7 @@ struct DecodableType { public: chip::ClusterId clusterID = static_cast(0); - DataModel::DecodableList attributeValueList; + DataModel::DecodableList attributeValueList; CHIP_ERROR Decode(TLV::TLVReader & reader); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp index c094853ab71712..035f26c348a135 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp @@ -2169,7 +2169,7 @@ void ComplexArgumentParser::Finalize(chip::app::Clusters::ModeSelect::Structs::M } CHIP_ERROR ComplexArgumentParser::Setup(const char * label, - chip::app::Clusters::ScenesManagement::Structs::AttributeValuePair::Type & request, + chip::app::Clusters::ScenesManagement::Structs::AttributeValuePairStruct::Type & request, Json::Value & value) { VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); @@ -2177,27 +2177,84 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, // Copy to track which members we already processed. Json::Value valueCopy(value); - ReturnErrorOnFailure( - ComplexArgumentParser::EnsureMemberExist("AttributeValuePair.attributeID", "attributeID", value.isMember("attributeID"))); - ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("AttributeValuePair.attributeValue", "attributeValue", - value.isMember("attributeValue"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("AttributeValuePairStruct.attributeID", "attributeID", + value.isMember("attributeID"))); char labelWithMember[kMaxLabelLength]; snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "attributeID"); ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.attributeID, value["attributeID"])); valueCopy.removeMember("attributeID"); - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "attributeValue"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.attributeValue, value["attributeValue"])); - valueCopy.removeMember("attributeValue"); + if (value.isMember("valueUnsigned8")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "valueUnsigned8"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.valueUnsigned8, value["valueUnsigned8"])); + } + valueCopy.removeMember("valueUnsigned8"); + + if (value.isMember("valueSigned8")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "valueSigned8"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.valueSigned8, value["valueSigned8"])); + } + valueCopy.removeMember("valueSigned8"); + + if (value.isMember("valueUnsigned16")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "valueUnsigned16"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.valueUnsigned16, value["valueUnsigned16"])); + } + valueCopy.removeMember("valueUnsigned16"); + + if (value.isMember("valueSigned16")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "valueSigned16"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.valueSigned16, value["valueSigned16"])); + } + valueCopy.removeMember("valueSigned16"); + + if (value.isMember("valueUnsigned32")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "valueUnsigned32"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.valueUnsigned32, value["valueUnsigned32"])); + } + valueCopy.removeMember("valueUnsigned32"); + + if (value.isMember("valueSigned32")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "valueSigned32"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.valueSigned32, value["valueSigned32"])); + } + valueCopy.removeMember("valueSigned32"); + + if (value.isMember("valueUnsigned64")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "valueUnsigned64"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.valueUnsigned64, value["valueUnsigned64"])); + } + valueCopy.removeMember("valueUnsigned64"); + + if (value.isMember("valueSigned64")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "valueSigned64"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.valueSigned64, value["valueSigned64"])); + } + valueCopy.removeMember("valueSigned64"); return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); } -void ComplexArgumentParser::Finalize(chip::app::Clusters::ScenesManagement::Structs::AttributeValuePair::Type & request) +void ComplexArgumentParser::Finalize(chip::app::Clusters::ScenesManagement::Structs::AttributeValuePairStruct::Type & request) { ComplexArgumentParser::Finalize(request.attributeID); - ComplexArgumentParser::Finalize(request.attributeValue); + ComplexArgumentParser::Finalize(request.valueUnsigned8); + ComplexArgumentParser::Finalize(request.valueSigned8); + ComplexArgumentParser::Finalize(request.valueUnsigned16); + ComplexArgumentParser::Finalize(request.valueSigned16); + ComplexArgumentParser::Finalize(request.valueUnsigned32); + ComplexArgumentParser::Finalize(request.valueSigned32); + ComplexArgumentParser::Finalize(request.valueUnsigned64); + ComplexArgumentParser::Finalize(request.valueSigned64); } CHIP_ERROR ComplexArgumentParser::Setup(const char * label, diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h index f2893064ebafe0..b32e8eedcefb9f 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h @@ -259,10 +259,11 @@ static CHIP_ERROR Setup(const char * label, chip::app::Clusters::ModeSelect::Str static void Finalize(chip::app::Clusters::ModeSelect::Structs::ModeOptionStruct::Type & request); -static CHIP_ERROR Setup(const char * label, chip::app::Clusters::ScenesManagement::Structs::AttributeValuePair::Type & request, +static CHIP_ERROR Setup(const char * label, + chip::app::Clusters::ScenesManagement::Structs::AttributeValuePairStruct::Type & request, Json::Value & value); -static void Finalize(chip::app::Clusters::ScenesManagement::Structs::AttributeValuePair::Type & request); +static void Finalize(chip::app::Clusters::ScenesManagement::Structs::AttributeValuePairStruct::Type & request); static CHIP_ERROR Setup(const char * label, chip::app::Clusters::ScenesManagement::Structs::ExtensionFieldSet::Type & request, Json::Value & value); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp index d61ba121300baa..ec9b3c4b962c17 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -1959,7 +1959,7 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, - const chip::app::Clusters::ScenesManagement::Structs::AttributeValuePair::DecodableType & value) + const chip::app::Clusters::ScenesManagement::Structs::AttributeValuePairStruct::DecodableType & value) { DataModelLogger::LogString(label, indent, "{"); { @@ -1971,10 +1971,66 @@ DataModelLogger::LogValue(const char * label, size_t indent, } } { - CHIP_ERROR err = LogValue("AttributeValue", indent + 1, value.attributeValue); + CHIP_ERROR err = LogValue("ValueUnsigned8", indent + 1, value.valueUnsigned8); if (err != CHIP_NO_ERROR) { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'AttributeValue'"); + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'ValueUnsigned8'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("ValueSigned8", indent + 1, value.valueSigned8); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'ValueSigned8'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("ValueUnsigned16", indent + 1, value.valueUnsigned16); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'ValueUnsigned16'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("ValueSigned16", indent + 1, value.valueSigned16); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'ValueSigned16'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("ValueUnsigned32", indent + 1, value.valueUnsigned32); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'ValueUnsigned32'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("ValueSigned32", indent + 1, value.valueSigned32); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'ValueSigned32'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("ValueUnsigned64", indent + 1, value.valueUnsigned64); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'ValueUnsigned64'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("ValueSigned64", indent + 1, value.valueSigned64); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'ValueSigned64'"); return err; } } diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h index f0474e39422622..922ae495192512 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h @@ -163,7 +163,7 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::ModeSelect::Structs::ModeOptionStruct::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, - const chip::app::Clusters::ScenesManagement::Structs::AttributeValuePair::DecodableType & value); + const chip::app::Clusters::ScenesManagement::Structs::AttributeValuePairStruct::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::ScenesManagement::Structs::ExtensionFieldSet::DecodableType & value); diff --git a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h index b91d8584fa83be..166c18b63911e4 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -69437,10 +69437,49 @@ class ScenesManagementAddScene : public ClusterCommand { { // Scope for our temporary variables auto * array_2 = [NSMutableArray new]; for (auto & entry_2 : entry_0.attributeValueList) { - MTRScenesManagementClusterAttributeValuePair * newElement_2; - newElement_2 = [MTRScenesManagementClusterAttributeValuePair new]; + MTRScenesManagementClusterAttributeValuePairStruct * newElement_2; + newElement_2 = [MTRScenesManagementClusterAttributeValuePairStruct new]; newElement_2.attributeID = [NSNumber numberWithUnsignedInt:entry_2.attributeID]; - newElement_2.attributeValue = [NSNumber numberWithUnsignedInt:entry_2.attributeValue]; + if (entry_2.valueUnsigned8.HasValue()) { + newElement_2.valueUnsigned8 = [NSNumber numberWithUnsignedChar:entry_2.valueUnsigned8.Value()]; + } else { + newElement_2.valueUnsigned8 = nil; + } + if (entry_2.valueSigned8.HasValue()) { + newElement_2.valueSigned8 = [NSNumber numberWithChar:entry_2.valueSigned8.Value()]; + } else { + newElement_2.valueSigned8 = nil; + } + if (entry_2.valueUnsigned16.HasValue()) { + newElement_2.valueUnsigned16 = [NSNumber numberWithUnsignedShort:entry_2.valueUnsigned16.Value()]; + } else { + newElement_2.valueUnsigned16 = nil; + } + if (entry_2.valueSigned16.HasValue()) { + newElement_2.valueSigned16 = [NSNumber numberWithShort:entry_2.valueSigned16.Value()]; + } else { + newElement_2.valueSigned16 = nil; + } + if (entry_2.valueUnsigned32.HasValue()) { + newElement_2.valueUnsigned32 = [NSNumber numberWithUnsignedInt:entry_2.valueUnsigned32.Value()]; + } else { + newElement_2.valueUnsigned32 = nil; + } + if (entry_2.valueSigned32.HasValue()) { + newElement_2.valueSigned32 = [NSNumber numberWithInt:entry_2.valueSigned32.Value()]; + } else { + newElement_2.valueSigned32 = nil; + } + if (entry_2.valueUnsigned64.HasValue()) { + newElement_2.valueUnsigned64 = [NSNumber numberWithUnsignedLongLong:entry_2.valueUnsigned64.Value()]; + } else { + newElement_2.valueUnsigned64 = nil; + } + if (entry_2.valueSigned64.HasValue()) { + newElement_2.valueSigned64 = [NSNumber numberWithLongLong:entry_2.valueSigned64.Value()]; + } else { + newElement_2.valueSigned64 = nil; + } [array_2 addObject:newElement_2]; } newElement_0.attributeValueList = array_2;