From 6bb4af86bd4e040e5840047a885fa82cc13020e9 Mon Sep 17 00:00:00 2001 From: lpbeliveau-silabs Date: Mon, 16 Oct 2023 13:51:12 -0400 Subject: [PATCH] Modified Attribute 7 from scene cluster to SceneInfoStruct and added support in scenes-server --- .../all-clusters-app.matter | 19 +- .../all-clusters-common/all-clusters-app.zap | 22 +- .../all-clusters-minimal-app.matter | 41 +- .../all-clusters-minimal-app.zap | 44 +- .../light-switch-app.matter | 11 +- .../lighting-common/lighting-app.matter | 15 +- .../lighting-common/lighting-app.zap | 10 +- .../data_model/lighting-thread-app.matter | 27 +- .../silabs/data_model/lighting-thread-app.zap | 26 +- .../data_model/lighting-wifi-app.matter | 15 +- .../silabs/data_model/lighting-wifi-app.zap | 10 +- .../placeholder/linux/apps/app1/config.matter | 15 +- .../placeholder/linux/apps/app1/config.zap | 10 +- .../placeholder/linux/apps/app2/config.matter | 15 +- .../placeholder/linux/apps/app2/config.zap | 10 +- .../nxp/zap/thermostat_matter_thread.matter | 15 +- .../nxp/zap/thermostat_matter_thread.zap | 8 +- .../nxp/zap/thermostat_matter_wifi.matter | 15 +- .../nxp/zap/thermostat_matter_wifi.zap | 8 +- .../virtual-device-app.matter | 15 +- .../virtual-device-app.zap | 10 +- .../zap/tests/inputs/all-clusters-app.zap | 20 +- .../app-templates/endpoint_config.h | 6 +- .../color-control-server.cpp | 10 +- .../clusters/level-control/level-control.cpp | 2 +- .../clusters/on-off-server/on-off-server.cpp | 2 +- .../clusters/scenes-server/scenes-server.cpp | 386 ++++++++++++++---- .../clusters/scenes-server/scenes-server.h | 36 +- src/app/tests/suites/certification/PICS.yaml | 2 +- .../suites/certification/Test_TC_S_1_1.yaml | 47 ++- .../suites/certification/Test_TC_S_2_1.yaml | 17 +- .../suites/certification/Test_TC_S_2_2.yaml | 32 +- .../tests/suites/certification/ci-pics-values | 12 +- .../zcl/data-model/chip/scene.xml | 11 +- .../zcl/zcl-with-test-extensions.json | 2 +- src/app/zap-templates/zcl/zcl.json | 2 +- .../data_model/controller-clusters.matter | 11 +- .../chip/devicecontroller/ChipClusters.java | 28 +- .../chip/devicecontroller/ChipStructs.java | 49 +++ .../devicecontroller/ClusterIDMapping.java | 2 +- .../devicecontroller/ClusterInfoMapping.java | 21 + .../devicecontroller/ClusterReadMapping.java | 14 +- .../chip/devicecontroller/cluster/files.gni | 1 + .../structs/ScenesClusterSceneInfoStruct.kt | 86 ++++ .../CHIPAttributeTLVValueDecoder.cpp | 82 +++- .../java/zap-generated/CHIPClientCallbacks.h | 3 + .../java/zap-generated/CHIPReadCallbacks.cpp | 129 ++++++ .../python/chip/clusters/CHIPClusters.py | 4 +- .../python/chip/clusters/Objects.py | 31 +- .../CHIP/templates/availability.yaml | 18 +- .../MTRAttributeSpecifiedCheck.mm | 2 +- .../MTRAttributeTLVValueDecoder.mm | 33 +- .../CHIP/zap-generated/MTRBaseClusters.h | 16 +- .../CHIP/zap-generated/MTRBaseClusters.mm | 18 +- .../CHIP/zap-generated/MTRClusterConstants.h | 4 +- .../CHIP/zap-generated/MTRClusters.h | 4 +- .../CHIP/zap-generated/MTRClusters.mm | 4 +- .../CHIP/zap-generated/MTRStructsObjc.h | 10 + .../CHIP/zap-generated/MTRStructsObjc.mm | 42 ++ .../zap-generated/cluster-objects.cpp | 91 ++++- .../zap-generated/cluster-objects.h | 56 ++- .../app-common/zap-generated/ids/Attributes.h | 4 +- .../zap-generated/cluster/Commands.h | 11 +- .../cluster/ComplexArgumentParser.cpp | 60 +++ .../cluster/ComplexArgumentParser.h | 5 + .../cluster/logging/DataModelLogger.cpp | 63 ++- .../cluster/logging/DataModelLogger.h | 3 + .../zap-generated/cluster/Commands.h | 55 ++- .../zap-generated/test/Commands.h | 292 +++++++++---- 69 files changed, 1744 insertions(+), 456 deletions(-) create mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesClusterSceneInfoStruct.kt 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 7f3601b0078991..f44aef8f34e7b6 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 @@ -139,6 +139,15 @@ provisional server cluster Scenes = 5 { AttributeValuePair attributeValueList[] = 1; } + fabric_scoped struct SceneInfoStruct { + int8u sceneCount = 0; + fabric_sensitive int8u currentScene = 1; + fabric_sensitive group_id currentGroup = 2; + fabric_sensitive boolean sceneValid = 3; + int8u remainingCapacity = 4; + fabric_idx fabricIndex = 254; + } + readonly attribute int8u sceneCount = 0; readonly attribute int8u currentScene = 1; readonly attribute group_id currentGroup = 2; @@ -146,7 +155,7 @@ provisional server cluster Scenes = 5 { readonly attribute bitmap8 nameSupport = 4; readonly attribute nullable node_id lastConfiguredBy = 5; readonly attribute int16u sceneTableSize = 6; - readonly attribute int8u remainingCapacity = 7; + readonly attribute SceneInfoStruct fabricSceneInfo[] = 7; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -5700,12 +5709,12 @@ endpoint 1 { ram attribute nameSupport default = 0x80; ram attribute lastConfiguredBy; ram attribute sceneTableSize default = 16; - callback attribute remainingCapacity default = 8; + callback attribute fabricSceneInfo; callback attribute generatedCommandList; callback attribute acceptedCommandList; callback attribute eventList; callback attribute attributeList; - ram attribute featureMap default = 7; + ram attribute featureMap default = 15; ram attribute clusterRevision default = 5; handle command AddScene; @@ -6784,12 +6793,12 @@ endpoint 2 { ram attribute nameSupport default = 0x80; ram attribute lastConfiguredBy; ram attribute sceneTableSize default = 16; - callback attribute remainingCapacity default = 8; + callback attribute fabricSceneInfo; callback attribute generatedCommandList; callback attribute acceptedCommandList; callback attribute eventList; callback attribute attributeList; - ram attribute featureMap default = 7; + ram attribute featureMap default = 15; ram attribute clusterRevision default = 5; handle command AddScene; diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap index ba7c60dd255ce2..51c9ef35e17500 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap @@ -6911,16 +6911,16 @@ "reportableChange": 0 }, { - "name": "RemainingCapacity", + "name": "FabricSceneInfo", "code": 7, "mfgCode": null, "side": "server", - "type": "int8u", + "type": "array", "included": 1, - "storageOption": "External", + "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "8", + "defaultValue": "", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -7000,7 +7000,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "7", + "defaultValue": "15", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -20503,16 +20503,16 @@ "reportableChange": 0 }, { - "name": "RemainingCapacity", + "name": "FabricSceneInfo", "code": 7, "mfgCode": null, "side": "server", - "type": "int8u", + "type": "array", "included": 1, - "storageOption": "External", + "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "8", + "defaultValue": "", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -20592,7 +20592,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "7", + "defaultValue": "15", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -21887,4 +21887,4 @@ } ], "log": [] -} \ No newline at end of file +} 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 e2ee1bc8b3f7ce..532839a43aaf2e 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 @@ -139,6 +139,15 @@ provisional server cluster Scenes = 5 { AttributeValuePair attributeValueList[] = 1; } + fabric_scoped struct SceneInfoStruct { + int8u sceneCount = 0; + fabric_sensitive int8u currentScene = 1; + fabric_sensitive group_id currentGroup = 2; + fabric_sensitive boolean sceneValid = 3; + int8u remainingCapacity = 4; + fabric_idx fabricIndex = 254; + } + readonly attribute int8u sceneCount = 0; readonly attribute int8u currentScene = 1; readonly attribute group_id currentGroup = 2; @@ -146,7 +155,7 @@ provisional server cluster Scenes = 5 { readonly attribute bitmap8 nameSupport = 4; readonly attribute nullable node_id lastConfiguredBy = 5; readonly attribute int16u sceneTableSize = 6; - readonly attribute int8u remainingCapacity = 7; + readonly attribute SceneInfoStruct fabricSceneInfo[] = 7; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -4378,18 +4387,18 @@ endpoint 1 { server cluster Scenes { callback attribute sceneCount default = 0x00; - ram attribute currentScene default = 0x00; - ram attribute currentGroup default = 0x0000; - ram attribute sceneValid default = 0x00; - ram attribute nameSupport default = 0x80; - ram attribute lastConfiguredBy; - ram attribute sceneTableSize default = 16; - callback attribute remainingCapacity default = 8; + callback attribute currentScene default = 0x00; + callback attribute currentGroup default = 0x0000; + callback attribute sceneValid default = 0x00; + callback attribute nameSupport default = 0x80; + callback attribute lastConfiguredBy; + callback attribute sceneTableSize default = 16; + callback attribute fabricSceneInfo; callback attribute generatedCommandList; callback attribute acceptedCommandList; callback attribute eventList; callback attribute attributeList; - ram attribute featureMap default = 7; + ram attribute featureMap default = 15; ram attribute clusterRevision default = 5; handle command AddScene; @@ -4942,17 +4951,17 @@ endpoint 2 { server cluster Scenes { callback attribute sceneCount default = 0x00; - ram attribute currentScene default = 0x00; - ram attribute currentGroup default = 0x0000; - ram attribute sceneValid default = 0x00; - ram attribute nameSupport default = 0x80; - ram attribute sceneTableSize default = 16; - callback attribute remainingCapacity default = 8; + callback attribute currentScene default = 0x00; + callback attribute currentGroup default = 0x0000; + callback attribute sceneValid default = 0x00; + callback attribute nameSupport default = 0x80; + callback attribute sceneTableSize default = 16; + callback attribute fabricSceneInfo; callback attribute generatedCommandList; callback attribute acceptedCommandList; callback attribute eventList; callback attribute attributeList; - ram attribute featureMap default = 7; + ram attribute featureMap default = 15; ram attribute clusterRevision default = 5; handle command AddScene; diff --git a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap index 0a8b5882f67122..b731217a0c63d2 100644 --- a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap +++ b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap @@ -4624,7 +4624,7 @@ "side": "server", "type": "int8u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "0x00", @@ -4640,7 +4640,7 @@ "side": "server", "type": "group_id", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "0x0000", @@ -4656,7 +4656,7 @@ "side": "server", "type": "boolean", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "0x00", @@ -4672,7 +4672,7 @@ "side": "server", "type": "bitmap8", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "0x80", @@ -4688,7 +4688,7 @@ "side": "server", "type": "node_id", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -4704,7 +4704,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "16", @@ -4714,16 +4714,16 @@ "reportableChange": 0 }, { - "name": "RemainingCapacity", + "name": "FabricSceneInfo", "code": 7, "mfgCode": null, "side": "server", - "type": "int8u", + "type": "array", "included": 1, - "storageOption": "External", + "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "8", + "defaultValue": "", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -4803,7 +4803,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "7", + "defaultValue": "15", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -10924,7 +10924,7 @@ "side": "server", "type": "int8u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "0x00", @@ -10940,7 +10940,7 @@ "side": "server", "type": "group_id", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "0x0000", @@ -10956,7 +10956,7 @@ "side": "server", "type": "boolean", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "0x00", @@ -10972,7 +10972,7 @@ "side": "server", "type": "bitmap8", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "0x80", @@ -10988,7 +10988,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "16", @@ -10998,16 +10998,16 @@ "reportableChange": 0 }, { - "name": "RemainingCapacity", + "name": "FabricSceneInfo", "code": 7, "mfgCode": null, "side": "server", - "type": "int8u", + "type": "array", "included": 1, - "storageOption": "External", + "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "8", + "defaultValue": "", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -11087,7 +11087,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "7", + "defaultValue": "15", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -12318,4 +12318,4 @@ } ], "log": [] -} \ No newline at end of file +} 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 625104b359a561..8494041c485a97 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 @@ -187,6 +187,15 @@ provisional client cluster Scenes = 5 { AttributeValuePair attributeValueList[] = 1; } + fabric_scoped struct SceneInfoStruct { + int8u sceneCount = 0; + fabric_sensitive int8u currentScene = 1; + fabric_sensitive group_id currentGroup = 2; + fabric_sensitive boolean sceneValid = 3; + int8u remainingCapacity = 4; + fabric_idx fabricIndex = 254; + } + readonly attribute int8u sceneCount = 0; readonly attribute int8u currentScene = 1; readonly attribute group_id currentGroup = 2; @@ -194,7 +203,7 @@ provisional client cluster Scenes = 5 { readonly attribute bitmap8 nameSupport = 4; readonly attribute optional nullable node_id lastConfiguredBy = 5; readonly attribute int16u sceneTableSize = 6; - readonly attribute int8u remainingCapacity = 7; + readonly attribute SceneInfoStruct fabricSceneInfo[] = 7; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; diff --git a/examples/lighting-app/lighting-common/lighting-app.matter b/examples/lighting-app/lighting-common/lighting-app.matter index d2949059cc557e..8b6e4934c68483 100644 --- a/examples/lighting-app/lighting-common/lighting-app.matter +++ b/examples/lighting-app/lighting-common/lighting-app.matter @@ -139,6 +139,15 @@ provisional server cluster Scenes = 5 { AttributeValuePair attributeValueList[] = 1; } + fabric_scoped struct SceneInfoStruct { + int8u sceneCount = 0; + fabric_sensitive int8u currentScene = 1; + fabric_sensitive group_id currentGroup = 2; + fabric_sensitive boolean sceneValid = 3; + int8u remainingCapacity = 4; + fabric_idx fabricIndex = 254; + } + readonly attribute int8u sceneCount = 0; readonly attribute int8u currentScene = 1; readonly attribute group_id currentGroup = 2; @@ -146,7 +155,7 @@ provisional server cluster Scenes = 5 { readonly attribute bitmap8 nameSupport = 4; readonly attribute nullable node_id lastConfiguredBy = 5; readonly attribute int16u sceneTableSize = 6; - readonly attribute int8u remainingCapacity = 7; + readonly attribute SceneInfoStruct fabricSceneInfo[] = 7; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -2491,11 +2500,11 @@ endpoint 1 { ram attribute nameSupport default = 0x80; ram attribute lastConfiguredBy; ram attribute sceneTableSize default = 16; - callback attribute remainingCapacity default = 8; + callback attribute fabricSceneInfo; callback attribute generatedCommandList; callback attribute acceptedCommandList; callback attribute attributeList; - ram attribute featureMap default = 7; + ram attribute featureMap default = 15; ram attribute clusterRevision default = 5; handle command AddScene; diff --git a/examples/lighting-app/lighting-common/lighting-app.zap b/examples/lighting-app/lighting-common/lighting-app.zap index 93f5cd2eb9cc08..79ed7a344826f9 100644 --- a/examples/lighting-app/lighting-common/lighting-app.zap +++ b/examples/lighting-app/lighting-common/lighting-app.zap @@ -4629,16 +4629,16 @@ "reportableChange": 0 }, { - "name": "RemainingCapacity", + "name": "FabricSceneInfo", "code": 7, "mfgCode": null, "side": "server", - "type": "int8u", + "type": "array", "included": 1, - "storageOption": "External", + "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "8", + "defaultValue": "", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -4702,7 +4702,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "7", + "defaultValue": "15", "reportable": 1, "minInterval": 1, "maxInterval": 65534, 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 7fba724a460eac..4dc79624c3d896 100644 --- a/examples/lighting-app/silabs/data_model/lighting-thread-app.matter +++ b/examples/lighting-app/silabs/data_model/lighting-thread-app.matter @@ -139,6 +139,15 @@ provisional server cluster Scenes = 5 { AttributeValuePair attributeValueList[] = 1; } + fabric_scoped struct SceneInfoStruct { + int8u sceneCount = 0; + fabric_sensitive int8u currentScene = 1; + fabric_sensitive group_id currentGroup = 2; + fabric_sensitive boolean sceneValid = 3; + int8u remainingCapacity = 4; + fabric_idx fabricIndex = 254; + } + readonly attribute int8u sceneCount = 0; readonly attribute int8u currentScene = 1; readonly attribute group_id currentGroup = 2; @@ -146,7 +155,7 @@ provisional server cluster Scenes = 5 { readonly attribute bitmap8 nameSupport = 4; readonly attribute nullable node_id lastConfiguredBy = 5; readonly attribute int16u sceneTableSize = 6; - readonly attribute int8u remainingCapacity = 7; + readonly attribute SceneInfoStruct fabricSceneInfo[] = 7; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -2501,18 +2510,18 @@ endpoint 1 { server cluster Scenes { callback attribute sceneCount default = 0x00; - ram attribute currentScene default = 0x00; - ram attribute currentGroup default = 0x0000; - ram attribute sceneValid default = 0x00; - ram attribute nameSupport default = 0x80; - ram attribute lastConfiguredBy; - ram attribute sceneTableSize default = 16; - callback attribute remainingCapacity default = 8; + callback attribute currentScene default = 0x00; + callback attribute currentGroup default = 0x0000; + callback attribute sceneValid default = 0x00; + callback attribute nameSupport default = 0x80; + callback attribute lastConfiguredBy; + callback attribute sceneTableSize default = 16; + callback attribute fabricSceneInfo; callback attribute generatedCommandList; callback attribute acceptedCommandList; callback attribute eventList; callback attribute attributeList; - ram attribute featureMap default = 7; + callback attribute featureMap default = 15; ram attribute clusterRevision default = 5; handle command AddScene; diff --git a/examples/lighting-app/silabs/data_model/lighting-thread-app.zap b/examples/lighting-app/silabs/data_model/lighting-thread-app.zap index 1425494ce80b80..feef6e5600063f 100644 --- a/examples/lighting-app/silabs/data_model/lighting-thread-app.zap +++ b/examples/lighting-app/silabs/data_model/lighting-thread-app.zap @@ -4079,7 +4079,7 @@ "side": "server", "type": "int8u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "0x00", @@ -4095,7 +4095,7 @@ "side": "server", "type": "group_id", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "0x0000", @@ -4111,7 +4111,7 @@ "side": "server", "type": "boolean", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "0x00", @@ -4127,7 +4127,7 @@ "side": "server", "type": "bitmap8", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "0x80", @@ -4143,7 +4143,7 @@ "side": "server", "type": "node_id", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -4159,7 +4159,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "16", @@ -4169,16 +4169,16 @@ "reportableChange": 0 }, { - "name": "RemainingCapacity", + "name": "FabricSceneInfo", "code": 7, "mfgCode": null, "side": "server", - "type": "int8u", + "type": "array", "included": 1, - "storageOption": "External", + "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "8", + "defaultValue": "", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -4255,10 +4255,10 @@ "side": "server", "type": "bitmap32", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "7", + "defaultValue": "15", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -5917,4 +5917,4 @@ "networkId": 0 } ] -} \ No newline at end of file +} 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 7a76484abf4fa3..bd20c0a084060d 100644 --- a/examples/lighting-app/silabs/data_model/lighting-wifi-app.matter +++ b/examples/lighting-app/silabs/data_model/lighting-wifi-app.matter @@ -139,6 +139,15 @@ provisional server cluster Scenes = 5 { AttributeValuePair attributeValueList[] = 1; } + fabric_scoped struct SceneInfoStruct { + int8u sceneCount = 0; + fabric_sensitive int8u currentScene = 1; + fabric_sensitive group_id currentGroup = 2; + fabric_sensitive boolean sceneValid = 3; + int8u remainingCapacity = 4; + fabric_idx fabricIndex = 254; + } + readonly attribute int8u sceneCount = 0; readonly attribute int8u currentScene = 1; readonly attribute group_id currentGroup = 2; @@ -146,7 +155,7 @@ provisional server cluster Scenes = 5 { readonly attribute bitmap8 nameSupport = 4; readonly attribute nullable node_id lastConfiguredBy = 5; readonly attribute int16u sceneTableSize = 6; - readonly attribute int8u remainingCapacity = 7; + readonly attribute SceneInfoStruct fabricSceneInfo[] = 7; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -2347,12 +2356,12 @@ endpoint 1 { ram attribute nameSupport default = 0x80; ram attribute lastConfiguredBy; ram attribute sceneTableSize default = 16; - callback attribute remainingCapacity default = 8; + callback attribute fabricSceneInfo; callback attribute generatedCommandList; callback attribute acceptedCommandList; callback attribute eventList; callback attribute attributeList; - ram attribute featureMap default = 7; + ram attribute featureMap default = 15; ram attribute clusterRevision default = 5; handle command AddScene; diff --git a/examples/lighting-app/silabs/data_model/lighting-wifi-app.zap b/examples/lighting-app/silabs/data_model/lighting-wifi-app.zap index e4f32d952c9286..ceffe1ab0f11ee 100644 --- a/examples/lighting-app/silabs/data_model/lighting-wifi-app.zap +++ b/examples/lighting-app/silabs/data_model/lighting-wifi-app.zap @@ -3345,16 +3345,16 @@ "reportableChange": 0 }, { - "name": "RemainingCapacity", + "name": "FabricSceneInfo", "code": 7, "mfgCode": null, "side": "server", - "type": "int8u", + "type": "array", "included": 1, - "storageOption": "External", + "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "8", + "defaultValue": "", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -3434,7 +3434,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "7", + "defaultValue": "15", "reportable": 1, "minInterval": 1, "maxInterval": 65534, diff --git a/examples/placeholder/linux/apps/app1/config.matter b/examples/placeholder/linux/apps/app1/config.matter index 5ff8d4573fef7f..9f6224544da46a 100644 --- a/examples/placeholder/linux/apps/app1/config.matter +++ b/examples/placeholder/linux/apps/app1/config.matter @@ -187,13 +187,22 @@ provisional server cluster Scenes = 5 { AttributeValuePair attributeValueList[] = 1; } + fabric_scoped struct SceneInfoStruct { + int8u sceneCount = 0; + fabric_sensitive int8u currentScene = 1; + fabric_sensitive group_id currentGroup = 2; + fabric_sensitive boolean sceneValid = 3; + int8u remainingCapacity = 4; + fabric_idx fabricIndex = 254; + } + readonly attribute int8u sceneCount = 0; readonly attribute int8u currentScene = 1; readonly attribute group_id currentGroup = 2; readonly attribute boolean sceneValid = 3; readonly attribute bitmap8 nameSupport = 4; readonly attribute int16u sceneTableSize = 6; - readonly attribute int8u remainingCapacity = 7; + readonly attribute SceneInfoStruct fabricSceneInfo[] = 7; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -7380,11 +7389,11 @@ endpoint 1 { ram attribute sceneValid default = 0x00; ram attribute nameSupport; ram attribute sceneTableSize default = 16; - callback attribute remainingCapacity default = 8; + callback attribute fabricSceneInfo; callback attribute generatedCommandList; callback attribute acceptedCommandList; callback attribute attributeList; - ram attribute featureMap default = 7; + ram attribute featureMap default = 15; ram attribute clusterRevision default = 5; handle command AddScene; diff --git a/examples/placeholder/linux/apps/app1/config.zap b/examples/placeholder/linux/apps/app1/config.zap index 79277d9a1f7720..32f185844f6917 100644 --- a/examples/placeholder/linux/apps/app1/config.zap +++ b/examples/placeholder/linux/apps/app1/config.zap @@ -11990,16 +11990,16 @@ "reportableChange": 0 }, { - "name": "RemainingCapacity", + "name": "FabricSceneInfo", "code": 7, "mfgCode": null, "side": "server", - "type": "int8u", + "type": "array", "included": 1, - "storageOption": "External", + "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "8", + "defaultValue": "", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -12063,7 +12063,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "7", + "defaultValue": "15", "reportable": 1, "minInterval": 1, "maxInterval": 65534, diff --git a/examples/placeholder/linux/apps/app2/config.matter b/examples/placeholder/linux/apps/app2/config.matter index 4250eaf837efb1..b5991ec6e35c89 100644 --- a/examples/placeholder/linux/apps/app2/config.matter +++ b/examples/placeholder/linux/apps/app2/config.matter @@ -187,13 +187,22 @@ provisional server cluster Scenes = 5 { AttributeValuePair attributeValueList[] = 1; } + fabric_scoped struct SceneInfoStruct { + int8u sceneCount = 0; + fabric_sensitive int8u currentScene = 1; + fabric_sensitive group_id currentGroup = 2; + fabric_sensitive boolean sceneValid = 3; + int8u remainingCapacity = 4; + fabric_idx fabricIndex = 254; + } + readonly attribute int8u sceneCount = 0; readonly attribute int8u currentScene = 1; readonly attribute group_id currentGroup = 2; readonly attribute boolean sceneValid = 3; readonly attribute bitmap8 nameSupport = 4; readonly attribute int16u sceneTableSize = 6; - readonly attribute int8u remainingCapacity = 7; + readonly attribute SceneInfoStruct fabricSceneInfo[] = 7; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -7344,11 +7353,11 @@ endpoint 1 { ram attribute sceneValid default = 0x00; ram attribute nameSupport; ram attribute sceneTableSize default = 16; - callback attribute remainingCapacity default = 8; + callback attribute fabricSceneInfo; callback attribute generatedCommandList; callback attribute acceptedCommandList; callback attribute attributeList; - ram attribute featureMap default = 7; + ram attribute featureMap default = 15; ram attribute clusterRevision default = 5; handle command AddScene; diff --git a/examples/placeholder/linux/apps/app2/config.zap b/examples/placeholder/linux/apps/app2/config.zap index bd7cd1500906e9..7983c2c1f3d9ab 100644 --- a/examples/placeholder/linux/apps/app2/config.zap +++ b/examples/placeholder/linux/apps/app2/config.zap @@ -12072,16 +12072,16 @@ "reportableChange": 0 }, { - "name": "RemainingCapacity", + "name": "FabricSceneInfo", "code": 7, "mfgCode": null, "side": "server", - "type": "int8u", + "type": "array", "included": 1, - "storageOption": "External", + "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "8", + "defaultValue": "", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -12145,7 +12145,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "7", + "defaultValue": "15", "reportable": 1, "minInterval": 1, "maxInterval": 65534, diff --git a/examples/thermostat/nxp/zap/thermostat_matter_thread.matter b/examples/thermostat/nxp/zap/thermostat_matter_thread.matter index 7ce046e5c72fc2..a5d526d6195bc6 100644 --- a/examples/thermostat/nxp/zap/thermostat_matter_thread.matter +++ b/examples/thermostat/nxp/zap/thermostat_matter_thread.matter @@ -181,13 +181,22 @@ provisional server cluster Scenes = 5 { AttributeValuePair attributeValueList[] = 1; } + fabric_scoped struct SceneInfoStruct { + int8u sceneCount = 0; + fabric_sensitive int8u currentScene = 1; + fabric_sensitive group_id currentGroup = 2; + fabric_sensitive boolean sceneValid = 3; + int8u remainingCapacity = 4; + fabric_idx fabricIndex = 254; + } + readonly attribute int8u sceneCount = 0; readonly attribute int8u currentScene = 1; readonly attribute group_id currentGroup = 2; readonly attribute boolean sceneValid = 3; readonly attribute bitmap8 nameSupport = 4; readonly attribute int16u sceneTableSize = 6; - readonly attribute int8u remainingCapacity = 7; + readonly attribute SceneInfoStruct fabricSceneInfo[] = 7; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -2109,8 +2118,8 @@ endpoint 1 { ram attribute sceneValid default = 0x00; ram attribute nameSupport; ram attribute sceneTableSize; - callback attribute remainingCapacity; - ram attribute featureMap default = 0; + callback attribute fabricSceneInfo; + ram attribute featureMap default = 15; ram attribute clusterRevision default = 4; handle command AddScene; diff --git a/examples/thermostat/nxp/zap/thermostat_matter_thread.zap b/examples/thermostat/nxp/zap/thermostat_matter_thread.zap index 5a182daade2b19..3183b8bf3f3e72 100644 --- a/examples/thermostat/nxp/zap/thermostat_matter_thread.zap +++ b/examples/thermostat/nxp/zap/thermostat_matter_thread.zap @@ -3933,13 +3933,13 @@ "reportableChange": 0 }, { - "name": "RemainingCapacity", + "name": "FabricSceneInfo", "code": 7, "mfgCode": null, "side": "server", - "type": "int8u", + "type": "array", "included": 1, - "storageOption": "External", + "storageOption": "RAM", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -3958,7 +3958,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": "15", "reportable": 1, "minInterval": 1, "maxInterval": 65534, diff --git a/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter b/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter index 52de8d4d2f25d6..8609835e90c576 100644 --- a/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter +++ b/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter @@ -181,13 +181,22 @@ provisional server cluster Scenes = 5 { AttributeValuePair attributeValueList[] = 1; } + fabric_scoped struct SceneInfoStruct { + int8u sceneCount = 0; + fabric_sensitive int8u currentScene = 1; + fabric_sensitive group_id currentGroup = 2; + fabric_sensitive boolean sceneValid = 3; + int8u remainingCapacity = 4; + fabric_idx fabricIndex = 254; + } + readonly attribute int8u sceneCount = 0; readonly attribute int8u currentScene = 1; readonly attribute group_id currentGroup = 2; readonly attribute boolean sceneValid = 3; readonly attribute bitmap8 nameSupport = 4; readonly attribute int16u sceneTableSize = 6; - readonly attribute int8u remainingCapacity = 7; + readonly attribute SceneInfoStruct fabricSceneInfo[] = 7; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -1963,8 +1972,8 @@ endpoint 1 { ram attribute sceneValid default = 0x00; ram attribute nameSupport; ram attribute sceneTableSize; - callback attribute remainingCapacity; - ram attribute featureMap default = 0; + callback attribute fabricSceneInfo; + ram attribute featureMap default = 15; ram attribute clusterRevision default = 4; handle command AddScene; diff --git a/examples/thermostat/nxp/zap/thermostat_matter_wifi.zap b/examples/thermostat/nxp/zap/thermostat_matter_wifi.zap index 2bbedb4a04e8c9..4f86ed5fe5d88f 100644 --- a/examples/thermostat/nxp/zap/thermostat_matter_wifi.zap +++ b/examples/thermostat/nxp/zap/thermostat_matter_wifi.zap @@ -3075,13 +3075,13 @@ "reportableChange": 0 }, { - "name": "RemainingCapacity", + "name": "FabricSceneInfo", "code": 7, "mfgCode": null, "side": "server", - "type": "int8u", + "type": "array", "included": 1, - "storageOption": "External", + "storageOption": "RAM", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -3100,7 +3100,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": "15", "reportable": 1, "minInterval": 1, "maxInterval": 65534, 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 5910114fc99122..0e5537d153bd01 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 @@ -139,13 +139,22 @@ provisional server cluster Scenes = 5 { AttributeValuePair attributeValueList[] = 1; } + fabric_scoped struct SceneInfoStruct { + int8u sceneCount = 0; + fabric_sensitive int8u currentScene = 1; + fabric_sensitive group_id currentGroup = 2; + fabric_sensitive boolean sceneValid = 3; + int8u remainingCapacity = 4; + fabric_idx fabricIndex = 254; + } + readonly attribute int8u sceneCount = 0; readonly attribute int8u currentScene = 1; readonly attribute group_id currentGroup = 2; readonly attribute boolean sceneValid = 3; readonly attribute bitmap8 nameSupport = 4; readonly attribute int16u sceneTableSize = 6; - readonly attribute int8u remainingCapacity = 7; + readonly attribute SceneInfoStruct fabricSceneInfo[] = 7; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -2887,12 +2896,12 @@ endpoint 1 { ram attribute sceneValid default = 0x00; ram attribute nameSupport; ram attribute sceneTableSize default = 16; - callback attribute remainingCapacity default = 8; + callback attribute fabricSceneInfo; callback attribute generatedCommandList; callback attribute acceptedCommandList; callback attribute eventList; callback attribute attributeList; - ram attribute featureMap default = 7; + ram attribute featureMap default = 15; ram attribute clusterRevision default = 5; handle command AddScene; diff --git a/examples/virtual-device-app/virtual-device-common/virtual-device-app.zap b/examples/virtual-device-app/virtual-device-common/virtual-device-app.zap index d0b59539b15b04..c1b0c52031d2e3 100644 --- a/examples/virtual-device-app/virtual-device-common/virtual-device-app.zap +++ b/examples/virtual-device-app/virtual-device-common/virtual-device-app.zap @@ -4537,16 +4537,16 @@ "reportableChange": 0 }, { - "name": "RemainingCapacity", + "name": "FabricSceneInfo", "code": 7, "mfgCode": null, "side": "server", - "type": "int8u", + "type": "array", "included": 1, - "storageOption": "External", + "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "8", + "defaultValue": "", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -4626,7 +4626,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "7", + "defaultValue": "15", "reportable": 1, "minInterval": 1, "maxInterval": 65534, diff --git a/scripts/tools/zap/tests/inputs/all-clusters-app.zap b/scripts/tools/zap/tests/inputs/all-clusters-app.zap index 549973ecaf05b9..c424ed40819062 100644 --- a/scripts/tools/zap/tests/inputs/all-clusters-app.zap +++ b/scripts/tools/zap/tests/inputs/all-clusters-app.zap @@ -6184,16 +6184,16 @@ "reportableChange": 0 }, { - "name": "RemainingCapacity", + "name": "FabricSceneInfo", "code": 7, "mfgCode": null, "side": "server", - "type": "int8u", + "type": "array", "included": 1, - "storageOption": "External", + "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "8", + "defaultValue": "", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -6273,7 +6273,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "7", + "defaultValue": "15", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -15431,16 +15431,16 @@ "reportableChange": 0 }, { - "name": "RemainingCapacity", + "name": "FabricSceneInfo", "code": 7, "mfgCode": null, "side": "server", - "type": "int8u", + "type": "array", "included": 1, - "storageOption": "External", + "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "8", + "defaultValue": "", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -15520,7 +15520,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "7", + "defaultValue": "15", "reportable": 1, "minInterval": 1, "maxInterval": 65534, diff --git a/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h b/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h index 4679085f1570dd..3746ae474cf77f 100644 --- a/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h +++ b/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h @@ -760,8 +760,8 @@ { ZAP_SIMPLE_DEFAULT(0x00), 0x00000003, 1, ZAP_TYPE(BOOLEAN), 0 }, /* SceneValid */ \ { ZAP_EMPTY_DEFAULT(), 0x00000004, 1, ZAP_TYPE(BITMAP8), 0 }, /* NameSupport */ \ { ZAP_SIMPLE_DEFAULT(16), 0x00000006, 2, ZAP_TYPE(INT16U), 0 }, /* SceneTableSize */ \ - { ZAP_EMPTY_DEFAULT(), 0x00000007, 1, ZAP_TYPE(INT8U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) }, /* RemainingCapacity */ \ - { ZAP_SIMPLE_DEFAULT(7), 0x0000FFFC, 4, ZAP_TYPE(BITMAP32), 0 }, /* FeatureMap */ \ + { ZAP_EMPTY_DEFAULT(), 0x00000007, 0, ZAP_TYPE(ARRAY), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) }, /* FabricSceneInfo */ \ + { ZAP_SIMPLE_DEFAULT(15), 0x0000FFFC, 4, ZAP_TYPE(BITMAP32), 0 }, /* FeatureMap */ \ { ZAP_SIMPLE_DEFAULT(5), 0x0000FFFD, 2, ZAP_TYPE(INT16U), 0 }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: On/Off (server) */ \ @@ -1426,7 +1426,7 @@ { ZAP_SIMPLE_DEFAULT(0x00), 0x00000003, 1, ZAP_TYPE(BOOLEAN), 0 }, /* SceneValid */ \ { ZAP_EMPTY_DEFAULT(), 0x00000004, 1, ZAP_TYPE(BITMAP8), 0 }, /* NameSupport */ \ { ZAP_SIMPLE_DEFAULT(16), 0x00000006, 2, ZAP_TYPE(INT16U), 0 }, /* SceneTableSize */ \ - { ZAP_EMPTY_DEFAULT(), 0x00000007, 1, ZAP_TYPE(INT8U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) }, /* RemainingCapacity */ \ + { ZAP_EMPTY_DEFAULT(), 0x00000007, 0, ZAP_TYPE(ARRAY), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) }, /* FabricSceneInfo */ \ { ZAP_SIMPLE_DEFAULT(7), 0x0000FFFC, 4, ZAP_TYPE(BITMAP32), 0 }, /* FeatureMap */ \ { ZAP_SIMPLE_DEFAULT(5), 0x0000FFFD, 2, ZAP_TYPE(INT16U), 0 }, /* ClusterRevision */ \ \ 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 39fc5f9cdcc710..b826351b791731 100644 --- a/src/app/clusters/color-control-server/color-control-server.cpp +++ b/src/app/clusters/color-control-server/color-control-server.cpp @@ -1581,7 +1581,7 @@ bool ColorControlServer::moveToHueAndSaturationCommand(app::CommandHandler * com } Status status = moveToHueAndSaturation(hue, saturation, transitionTime, isEnhanced, commandPath.mEndpointId); #ifdef EMBER_AF_PLUGIN_SCENES - Scenes::ScenesServer::Instance().MakeSceneInvalid(commandPath.mEndpointId); + Scenes::ScenesServer::Instance().MakeSceneInvalidForAllFabrics(commandPath.mEndpointId); #endif // EMBER_AF_PLUGIN_SCENES commandObj->AddStatus(commandPath, status); return true; @@ -1786,7 +1786,7 @@ bool ColorControlServer::moveToSaturationCommand(app::CommandHandler * commandOb } Status status = moveToSaturation(commandData.saturation, commandData.transitionTime, commandPath.mEndpointId); #ifdef EMBER_AF_PLUGIN_SCENES - Scenes::ScenesServer::Instance().MakeSceneInvalid(commandPath.mEndpointId); + Scenes::ScenesServer::Instance().MakeSceneInvalidForAllFabrics(commandPath.mEndpointId); #endif // EMBER_AF_PLUGIN_SCENES commandObj->AddStatus(commandPath, status); return true; @@ -1970,7 +1970,7 @@ bool ColorControlServer::colorLoopCommand(app::CommandHandler * commandObj, cons exit: #ifdef EMBER_AF_PLUGIN_SCENES - Scenes::ScenesServer::Instance().MakeSceneInvalid(endpoint); + Scenes::ScenesServer::Instance().MakeSceneInvalidForAllFabrics(endpoint); #endif // EMBER_AF_PLUGIN_SCENES commandObj->AddStatus(commandPath, status); return true; @@ -2179,7 +2179,7 @@ bool ColorControlServer::moveToColorCommand(app::CommandHandler * commandObj, co Status status = moveToColor(commandData.colorX, commandData.colorY, commandData.transitionTime, commandPath.mEndpointId); #ifdef EMBER_AF_PLUGIN_SCENES - Scenes::ScenesServer::Instance().MakeSceneInvalid(commandPath.mEndpointId); + Scenes::ScenesServer::Instance().MakeSceneInvalidForAllFabrics(commandPath.mEndpointId); #endif // EMBER_AF_PLUGIN_SCENES commandObj->AddStatus(commandPath, status); return true; @@ -2706,7 +2706,7 @@ bool ColorControlServer::moveToColorTempCommand(app::CommandHandler * commandObj Status status = moveToColorTemp(commandPath.mEndpointId, commandData.colorTemperatureMireds, commandData.transitionTime); #ifdef EMBER_AF_PLUGIN_SCENES - Scenes::ScenesServer::Instance().MakeSceneInvalid(commandPath.mEndpointId); + Scenes::ScenesServer::Instance().MakeSceneInvalidForAllFabrics(commandPath.mEndpointId); #endif // EMBER_AF_PLUGIN_SCENES commandObj->AddStatus(commandPath, status); return true; diff --git a/src/app/clusters/level-control/level-control.cpp b/src/app/clusters/level-control/level-control.cpp index c7e376aa5a99f3..69a8e68e55a82a 100644 --- a/src/app/clusters/level-control/level-control.cpp +++ b/src/app/clusters/level-control/level-control.cpp @@ -914,7 +914,7 @@ static Status moveToLevelHandler(EndpointId endpoint, CommandId commandId, uint8 // The level has changed, the scene is no longer valid. if (emberAfContainsServer(endpoint, Scenes::Id)) { - Scenes::ScenesServer::Instance().MakeSceneInvalid(endpoint); + Scenes::ScenesServer::Instance().MakeSceneInvalidForAllFabrics(endpoint); } #endif // EMBER_AF_PLUGIN_SCENES 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 bbd35235e99555..e38392133faf81 100644 --- a/src/app/clusters/on-off-server/on-off-server.cpp +++ b/src/app/clusters/on-off-server/on-off-server.cpp @@ -562,7 +562,7 @@ EmberAfStatus OnOffServer::setOnOffValue(chip::EndpointId endpoint, chip::Comman // the current scene as described in the attribute table is invalid, // so mark it as invalid (just writes the valid/invalid attribute) - Scenes::ScenesServer::Instance().MakeSceneInvalid(endpoint); + Scenes::ScenesServer::Instance().MakeSceneInvalidForAllFabrics(endpoint); #endif // EMBER_AF_PLUGIN_SCENES // The returned status is based solely on the On/Off cluster. Errors in the diff --git a/src/app/clusters/scenes-server/scenes-server.cpp b/src/app/clusters/scenes-server/scenes-server.cpp index 2386e2155d6722..1327ea6bbf76b9 100644 --- a/src/app/clusters/scenes-server/scenes-server.cpp +++ b/src/app/clusters/scenes-server/scenes-server.cpp @@ -47,6 +47,23 @@ namespace app { namespace Clusters { namespace Scenes { +namespace { + +class ScenesServerFabricDelegate : public chip::FabricTable::Delegate +{ + void OnFabricRemoved(const FabricTable & fabricTable, FabricIndex fabricIndex) override + { + for (auto endpoint : EnabledEndpointsWithServerCluster(Id)) + { + ScenesServer::Instance().RemoveFabric(endpoint, fabricIndex); + } + } +}; + +static ScenesServerFabricDelegate gFabricDelegate; + +} // namespace + /// @brief Generate and add a response to a command handler context if err parameter is not CHIP_NO_ERROR /// @tparam ResponseType Type of response, depends on the command /// @param ctx Command Handler context where to add reponse @@ -64,6 +81,63 @@ CHIP_ERROR AddResponseOnError(CommandHandlerInterface::HandlerContext & ctx, Res return err; } +/// @brief Helper function to update the FabricSceneInfo attribute for a given Endpoint and fabric +/// @param endpoint Endpoint to update +/// @param fabric Fabric to update +/// @param group Group to update, if not provided, will be assigned 0 for a new SceneInfoStruct or keep previous value for an +/// existing one +/// @param scene Scene to update, if not provided, will be assigned 0 for a new SceneInfoStruct or keep previous value for an +/// existing one +/// @param SceneValid SceneValid status, if not provided, will be assigned false for a new SceneInfoStruct or keep previous +/// value for an existing one +/// @return +CHIP_ERROR updateFabricSceneInfo(EndpointId endpoint, FabricIndex fabric, Optional group, Optional scene, + Optional SceneValid) +{ + VerifyOrReturnError(kInvalidEndpointId != endpoint, CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrReturnError(kUndefinedFabricIndex != fabric, CHIP_ERROR_INVALID_ARGUMENT); + + SceneTable * sceneTable = scenes::GetSceneTableImpl(endpoint); + Structs::SceneInfoStruct::Type * SceneInfo = ScenesServer::Instance().GetSceneInfoStruct(endpoint, fabric); + if (nullptr != SceneInfo) + { + if (group.HasValue()) + { + SceneInfo->currentGroup = group.Value(); + } + + if (scene.HasValue()) + { + SceneInfo->currentScene = scene.Value(); + } + + if (SceneValid.HasValue()) + { + SceneInfo->sceneValid = SceneValid.Value(); + } + + ReturnErrorOnFailure(sceneTable->GetFabricSceneCount(fabric, SceneInfo->sceneCount)); + ReturnErrorOnFailure(sceneTable->GetRemainingCapacity(fabric, SceneInfo->remainingCapacity)); + } + else + { + // If we couldn't find a SceneInfoStruct for the fabric, create one + Structs::SceneInfoStruct::Type newSceneInfo; + newSceneInfo.fabricIndex = fabric; + + newSceneInfo.currentGroup = (group.HasValue()) ? group.Value() : 0; + newSceneInfo.currentScene = (scene.HasValue()) ? scene.Value() : 0; + newSceneInfo.sceneValid = (SceneValid.HasValue()) ? SceneValid.Value() : false; + + ReturnErrorOnFailure(sceneTable->GetFabricSceneCount(fabric, newSceneInfo.sceneCount)); + ReturnErrorOnFailure(sceneTable->GetRemainingCapacity(fabric, newSceneInfo.remainingCapacity)); + ReturnErrorOnFailure(ScenesServer::Instance().SetSceneInfoStruct(endpoint, fabric, newSceneInfo)); + } + + MatterReportingAttributeChangeCallback(endpoint, Id, Attributes::FabricSceneInfo::Id); + return CHIP_NO_ERROR; +} + /// @brief Generate and add a response to a command handler context depending on an EmberAfStatus /// @tparam ResponseType Type of response, depends on the command /// @param ctx Command Handler context where to add reponse @@ -93,6 +167,134 @@ CHIP_ERROR UpdateLastConfiguredBy(HandlerContext & ctx, ResponseType resp) return CHIP_NO_ERROR; } +/// @brief Gets the SceneInfoStruct array associated to an endpoint +/// @param endpoint target endpoint +/// @param fabric target fabric +/// @return Nullptr if not found, pointer to the SceneInfoStruct array otherwise +Structs::SceneInfoStruct::Type * ScenesServer::FabricSceneInfo::GetFabricSceneInfo(EndpointId endpoint) +{ + size_t endpointIndex = 0; + VerifyOrReturnValue(CHIP_NO_ERROR == FindFabricSceneInfoIndex(endpoint, endpointIndex), nullptr); + return mSceneInfoStructs[endpointIndex]; +} + +/// @brief Gets the SceneInfoStruct () for a specific fabric for a specific endpoint +/// @param endpoint target endpoint +/// @param fabric target fabric +/// @param index +/// @return Nullptr if not found, pointer to the SceneInfoStruct otherwise +Structs::SceneInfoStruct::Type * ScenesServer::FabricSceneInfo::GetSceneInfoStruct(EndpointId endpoint, FabricIndex fabric) +{ + size_t endpointIndex = 0; + VerifyOrReturnValue(CHIP_NO_ERROR == FindFabricSceneInfoIndex(endpoint, endpointIndex), nullptr); + uint8_t sceneInfoStructIndex = 0; + VerifyOrReturnValue(CHIP_NO_ERROR == FindSceneInfoStructIndex(fabric, endpointIndex, sceneInfoStructIndex), nullptr); + + return &mSceneInfoStructs[endpointIndex][sceneInfoStructIndex]; +} + +///@brief Sets the SceneInfoStruct () for a specific fabric for a specific endpoint +/// @param endpoint target endpoint +/// @param fabric target fabric +/// @param [in] sceneInfoStruct SceneInfoStruct to set +/// @return CHIP_NO_ERROR, CHIP_ERROR_NOT_FOUND if the endpoint is not found, CHIP_ERROR_NO_MEMORY if the number of fabric is +/// exceeded, CHIP_ERROR_INVALID_ARGUMENT if invalid fabric or endpoint +CHIP_ERROR ScenesServer::FabricSceneInfo::SetSceneInfoStruct(EndpointId endpoint, FabricIndex fabric, + Structs::SceneInfoStruct::Type & sceneInfoStruct) +{ + VerifyOrReturnError(kInvalidEndpointId != endpoint, CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrReturnError(kUndefinedFabricIndex != fabric, CHIP_ERROR_INVALID_ARGUMENT); + + size_t endpointIndex = 0; + ReturnErrorOnFailure(FindFabricSceneInfoIndex(endpoint, endpointIndex)); + uint8_t sceneInfoStructIndex = 0; + if (CHIP_ERROR_NOT_FOUND == FindSceneInfoStructIndex(fabric, endpointIndex, sceneInfoStructIndex)) + { + VerifyOrReturnError(mSceneInfoStructsCount[endpointIndex] < kScenesServerMaxFabricCount, CHIP_ERROR_NO_MEMORY); + sceneInfoStructIndex = mSceneInfoStructsCount[endpointIndex]; + + // Increment number of populated ScenesInfoStructs + mSceneInfoStructsCount[endpointIndex]++; + } + mSceneInfoStructs[endpointIndex][sceneInfoStructIndex] = sceneInfoStruct; + + return CHIP_NO_ERROR; +} + +/// @brief Clears the SceneInfoStruct () associated to a fabric and compresses the array to leave uninitialised structs at the end +/// @param[in] endpoint target endpoint +/// @param[in] fabric target fabric +void ScenesServer::FabricSceneInfo::ClearSceneInfoStruct(EndpointId endpoint, FabricIndex fabric) +{ + size_t endpointIndex = 0; + ReturnOnFailure(FindFabricSceneInfoIndex(endpoint, endpointIndex)); + uint8_t sceneInfoStructIndex = 0; + ReturnOnFailure(FindSceneInfoStructIndex(fabric, endpointIndex, sceneInfoStructIndex)); + + uint8_t nextIndex = static_cast(sceneInfoStructIndex + 1); + uint8_t moveNum = static_cast(kScenesServerMaxFabricCount - nextIndex); + // Compress the endpoint's SceneInfoStruct array + if (moveNum) + { + memmove(&mSceneInfoStructs[endpointIndex][sceneInfoStructIndex], &mSceneInfoStructs[endpointIndex][nextIndex], + sizeof(Structs::SceneInfoStruct::Type) * moveNum); + } + + // Decrement the SceneInfoStruct count + mSceneInfoStructsCount[endpointIndex]--; + + // Clear the last populated SceneInfoStruct + mSceneInfoStructs[endpointIndex][mSceneInfoStructsCount[endpointIndex]].fabricIndex = 0; + mSceneInfoStructs[endpointIndex][mSceneInfoStructsCount[endpointIndex]].sceneCount = 0; + mSceneInfoStructs[endpointIndex][mSceneInfoStructsCount[endpointIndex]].currentScene = 0; + mSceneInfoStructs[endpointIndex][mSceneInfoStructsCount[endpointIndex]].currentGroup = 0; + mSceneInfoStructs[endpointIndex][mSceneInfoStructsCount[endpointIndex]].remainingCapacity = 0; +} + +/// @brief Returns the index of the FabricSceneInfo associated to an endpoint +/// @param[in] endpoint target endpoint +/// @param[out] endpointIndex index of the corresponding FabricSceneInfo for an endpoint, corresponds to a row in the +/// mSceneInfoStructs array, +/// @return CHIP_NO_ERROR or CHIP_ERROR_NOT_FOUND, CHIP_ERROR_INVALID_ARGUMENT if invalid endpoint +CHIP_ERROR ScenesServer::FabricSceneInfo::FindFabricSceneInfoIndex(EndpointId endpoint, size_t & endpointIndex) +{ + VerifyOrReturnError(kInvalidEndpointId != endpoint, CHIP_ERROR_INVALID_ARGUMENT); + + uint16_t index = emberAfGetClusterServerEndpointIndex(endpoint, Scenes::Id, EMBER_AF_SCENES_CLUSTER_SERVER_ENDPOINT_COUNT); + + if (index < kScenesServerMaxEndpointCount) + { + endpointIndex = index; + return CHIP_NO_ERROR; + } + return CHIP_ERROR_NOT_FOUND; +} + +/// @brief Returns the SceneInfoStruct () associated to a fabric +/// @param[in] fabric target fabric +/// @param[in] endpointIndex index of the corresponding FabricSceneInfo for an endpoint, corresponds to a row in the +/// mSceneInfoStructs array +/// @param[out] index index of the corresponding SceneInfoStruct if found, mFabricSceneInfo[endpoint] number of fabrics otherwise +/// @return CHIP_NO_ERROR or CHIP_ERROR_NOT_FOUND, CHIP_ERROR_INVALID_ARGUMENT if invalid fabric or endpoint +CHIP_ERROR ScenesServer::FabricSceneInfo::FindSceneInfoStructIndex(FabricIndex fabric, size_t endpointIndex, uint8_t & index) +{ + VerifyOrReturnError(endpointIndex < kScenesServerMaxEndpointCount, CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrReturnError(kUndefinedFabricIndex != fabric, CHIP_ERROR_INVALID_ARGUMENT); + + index = 0; + + for (auto & info : mSceneInfoStructs[endpointIndex]) + { + if (info.fabricIndex == fabric) + { + return CHIP_NO_ERROR; + } + index++; + } + + return CHIP_ERROR_NOT_FOUND; +} + ScenesServer ScenesServer::mInstance; ScenesServer & ScenesServer::Instance() @@ -113,6 +315,8 @@ CHIP_ERROR ScenesServer::Init() SceneTable * sceneTable = scenes::GetSceneTableImpl(); ReturnErrorOnFailure(sceneTable->Init(&chip::Server::GetInstance().GetPersistentStorage())); + // TODO: Move everything Endpoint related in OnEndpointAdded method, see issue: + // https://github.com/project-chip/connectedhomeip/issues/26877 for (auto endpoint : EnabledEndpointsWithServerCluster(Id)) { uint32_t featureMap = 0; @@ -136,8 +340,9 @@ CHIP_ERROR ScenesServer::Init() ChipLogDetail(Zcl, "ERR: getting the scenes FeatureMap on Endpoint %hu Status: %x", endpoint, status); } - // Explicit AttributeValuePairs and TableSize features are mandatory for matter so we force-set them here - featureMap |= (to_underlying(Feature::kExplicit) | to_underlying(Feature::kTableSize)); + // Explicit AttributeValuePairs is mandatory for matter so we force it here + featureMap |= + (to_underlying(Feature::kExplicit) | to_underlying(Feature::kFabricScenes) | to_underlying(Feature::kTableSize)); status = Attributes::FeatureMap::Set(endpoint, featureMap); if (EMBER_ZCL_STATUS_SUCCESS != status) { @@ -149,6 +354,15 @@ CHIP_ERROR ScenesServer::Init() { ChipLogDetail(Zcl, "ERR: setting LastConfiguredBy on Endpoint %hu Status: %x", endpoint, status); } + + // Get Scene Table for a specific endpoint + sceneTable = scenes::GetSceneTableImpl(endpoint); + // Initialize the FabricSceneInfo list from data in Flash + for (auto & info : chip::Server::GetInstance().GetFabricTable()) + { + auto fabric = info.GetFabricIndex(); + updateFabricSceneInfo(endpoint, fabric, Optional(), Optional(), Optional()); + } } mIsInitialized = true; @@ -269,9 +483,11 @@ void AddSceneParse(CommandHandlerInterface::HandlerContext & ctx, const CommandD ReturnOnFailure( AddResponseOnError(ctx, response, sceneTable->SetSceneTableEntry(ctx.mCommandHandler.GetAccessingFabricIndex(), scene))); - // Update Attributes - MatterReportingAttributeChangeCallback(ctx.mRequestPath.mEndpointId, Id, Attributes::SceneCount::Id); - MatterReportingAttributeChangeCallback(ctx.mRequestPath.mEndpointId, Id, Attributes::RemainingCapacity::Id); + // Update FabricSceneInfo + ReturnOnFailure( + AddResponseOnError(ctx, response, + updateFabricSceneInfo(ctx.mRequestPath.mEndpointId, ctx.mCommandHandler.GetAccessingFabricIndex(), + Optional(), Optional(), Optional()))); ReturnOnFailure(UpdateLastConfiguredBy(ctx, response)); @@ -362,6 +578,9 @@ void ViewSceneParse(HandlerContext & ctx, const CommandData & req, GroupDataProv CHIP_ERROR StoreSceneParse(const FabricIndex & fabricIdx, const EndpointId & endpointID, const GroupId & groupID, const SceneId & sceneID, GroupDataProvider * groupProvider) { + // Make SceneValid false for all fabrics before store scenes + ScenesServer::Instance().MakeSceneInvalidForAllFabrics(endpointID); + uint16_t endpointTableSize = 0; ReturnErrorOnFailure( StatusIB(ToInteractionModelStatus(Attributes::SceneTableSize::Get(endpointID, &endpointTableSize))).ToChipError()); @@ -409,12 +628,9 @@ CHIP_ERROR StoreSceneParse(const FabricIndex & fabricIdx, const EndpointId & end // Insert in Scene Table ReturnErrorOnFailure(sceneTable->SetSceneTableEntry(fabricIdx, scene)); - // Update size attributes - MatterReportingAttributeChangeCallback(endpointID, Id, Attributes::SceneCount::Id); - MatterReportingAttributeChangeCallback(endpointID, Id, Attributes::RemainingCapacity::Id); - - ReturnErrorOnFailure(StatusIB(ToInteractionModelStatus(Attributes::CurrentScene::Set(endpointID, sceneID))).ToChipError()); - ReturnErrorOnFailure(StatusIB(ToInteractionModelStatus(Attributes::CurrentGroup::Set(endpointID, groupID))).ToChipError()); + // Update SceneInfo Attribute + ReturnErrorOnFailure( + updateFabricSceneInfo(endpointID, fabricIdx, Optional(groupID), Optional(sceneID), Optional(true))); return CHIP_NO_ERROR; } @@ -423,6 +639,9 @@ CHIP_ERROR RecallSceneParse(const FabricIndex & fabricIdx, const EndpointId & en const SceneId & sceneID, const Optional> & transitionTime, GroupDataProvider * groupProvider) { + // Make SceneValid false for all fabrics before recall scenes + ScenesServer::Instance().MakeSceneInvalidForAllFabrics(endpointID); + uint16_t endpointTableSize = 0; ReturnErrorOnFailure( StatusIB(ToInteractionModelStatus(Attributes::SceneTableSize::Get(endpointID, &endpointTableSize))).ToChipError()); @@ -455,9 +674,9 @@ CHIP_ERROR RecallSceneParse(const FabricIndex & fabricIdx, const EndpointId & en ReturnErrorOnFailure(sceneTable->SceneApplyEFS(scene)); - ReturnErrorOnFailure(StatusIB(ToInteractionModelStatus(Attributes::CurrentScene::Set(endpointID, sceneID))).ToChipError()); - - ReturnErrorOnFailure(StatusIB(ToInteractionModelStatus(Attributes::CurrentGroup::Set(endpointID, groupID))).ToChipError()); + // Update FabricSceneInfo, at this point the scene is considered valid + ReturnErrorOnFailure( + updateFabricSceneInfo(endpointID, fabricIdx, Optional(groupID), Optional(sceneID), Optional(true))); return CHIP_NO_ERROR; } @@ -513,43 +732,54 @@ void ScenesServer::InvokeCommand(HandlerContext & ctxt) // AttributeAccessInterface CHIP_ERROR ScenesServer::Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) { - uint8_t value = 0; - uint16_t endpointTableSize = 0; - ReturnErrorOnFailure( - StatusIB(ToInteractionModelStatus(Attributes::SceneTableSize::Get(aPath.mEndpointId, &endpointTableSize))).ToChipError()); - - // Get Scene Table Instance - SceneTable * sceneTable; - switch (aPath.mAttributeId) { - case Attributes::SceneCount::Id: - sceneTable = scenes::GetSceneTableImpl(aPath.mEndpointId, endpointTableSize); - ReturnErrorOnFailure(sceneTable->GetEndpointSceneCount(value)); - return aEncoder.Encode(value); - case Attributes::RemainingCapacity::Id: - sceneTable = scenes::GetSceneTableImpl(aPath.mEndpointId, endpointTableSize); - ReturnErrorOnFailure(sceneTable->GetRemainingCapacity(aEncoder.AccessingFabricIndex(), value)); - return aEncoder.Encode(value); + case Attributes::FabricSceneInfo::Id: { + return aEncoder.EncodeList([&](const auto & encoder) -> CHIP_ERROR { + for (auto & info : Server::GetInstance().GetFabricTable()) + { + auto fabric = info.GetFabricIndex(); + Structs::SceneInfoStruct::Type * SceneInfo = GetSceneInfoStruct(aPath.mEndpointId, fabric); + if (nullptr != SceneInfo) + { + ReturnErrorOnFailure(encoder.Encode(*SceneInfo)); + } + } + return CHIP_NO_ERROR; + }); + } default: return CHIP_NO_ERROR; } } +Structs::SceneInfoStruct::Type * ScenesServer::GetSceneInfoStruct(EndpointId endpoint, FabricIndex fabric) +{ + Structs::SceneInfoStruct::Type * sceneInfoStruct = mFabricSceneInfo.GetSceneInfoStruct(endpoint, fabric); + return sceneInfoStruct; +} + +CHIP_ERROR ScenesServer::SetSceneInfoStruct(EndpointId endpoint, FabricIndex fabric, + Structs::SceneInfoStruct::Type & sceneInfoStruct) +{ + ReturnErrorOnFailure(mFabricSceneInfo.SetSceneInfoStruct(endpoint, fabric, sceneInfoStruct)); + return CHIP_NO_ERROR; +} + void ScenesServer::GroupWillBeRemoved(FabricIndex aFabricIx, EndpointId aEndpointId, GroupId aGroupId) { // Get Scene Table Instance SceneTable * sceneTable = scenes::GetSceneTableImpl(aEndpointId); VerifyOrReturn(nullptr != sceneTable); - chip::GroupId currentGroup; - Attributes::CurrentGroup::Get(aEndpointId, ¤tGroup); + Structs::SceneInfoStruct::Type * SceneInfo = mFabricSceneInfo.GetSceneInfoStruct(aEndpointId, aFabricIx); + chip::GroupId currentGroup = (nullptr != SceneInfo) ? SceneInfo->currentGroup : 0x0000; // If currentGroup is what is being removed, we can't possibly still have a valid scene, // because the scene we have (if any) will also be removed. if (aGroupId == currentGroup) { - MakeSceneInvalid(aEndpointId); + MakeSceneInvalid(aEndpointId, aFabricIx); } VerifyOrReturn(nullptr != mGroupProvider); @@ -561,28 +791,28 @@ void ScenesServer::GroupWillBeRemoved(FabricIndex aFabricIx, EndpointId aEndpoin sceneTable->DeleteAllScenesInGroup(aFabricIx, aGroupId); } -void ScenesServer::MakeSceneInvalid(EndpointId aEndpointId) +void ScenesServer::MakeSceneInvalid(EndpointId aEndpointId, FabricIndex aFabricIx) { - Attributes::SceneValid::Set(aEndpointId, false); + updateFabricSceneInfo(aEndpointId, aFabricIx, Optional(), Optional(), Optional(false)); } -void ScenesServer::StoreCurrentScene(FabricIndex aFabricIx, EndpointId aEndpointId, GroupId aGroupId, SceneId aSceneId) +void ScenesServer::MakeSceneInvalidForAllFabrics(EndpointId aEndpointId) { - if (CHIP_NO_ERROR == StoreSceneParse(aFabricIx, aEndpointId, aGroupId, aSceneId, mGroupProvider)) + for (auto & info : chip::Server::GetInstance().GetFabricTable()) { - Attributes::SceneValid::Set(aEndpointId, true); + MakeSceneInvalid(aEndpointId, info.GetFabricIndex()); } } + +void ScenesServer::StoreCurrentScene(FabricIndex aFabricIx, EndpointId aEndpointId, GroupId aGroupId, SceneId aSceneId) +{ + StoreSceneParse(aFabricIx, aEndpointId, aGroupId, aSceneId, mGroupProvider); +} void ScenesServer::RecallScene(FabricIndex aFabricIx, EndpointId aEndpointId, GroupId aGroupId, SceneId aSceneId) { - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == Attributes::SceneValid::Set(aEndpointId, false)); - Optional> transitionTime; - if (CHIP_NO_ERROR == RecallSceneParse(aFabricIx, aEndpointId, aGroupId, aSceneId, transitionTime, mGroupProvider)) - { - Attributes::SceneValid::Set(aEndpointId, true); - } + RecallSceneParse(aFabricIx, aEndpointId, aGroupId, aSceneId, transitionTime, mGroupProvider); } bool ScenesServer::IsHandlerRegistered(EndpointId aEndpointId, scenes::SceneHandler * handler) @@ -611,6 +841,13 @@ void ScenesServer::UnregisterSceneHandler(EndpointId aEndpointId, scenes::SceneH } } +void ScenesServer::RemoveFabric(EndpointId aEndpointId, FabricIndex aFabricIndex) +{ + SceneTable * sceneTable = scenes::GetSceneTableImpl(aEndpointId); + sceneTable->RemoveFabric(aFabricIndex); + mFabricSceneInfo.ClearSceneInfoStruct(aEndpointId, aFabricIndex); +} + void ScenesServer::HandleAddScene(HandlerContext & ctx, const Commands::AddScene::DecodableType & req) { AddSceneParse(ctx, req, mGroupProvider); @@ -657,11 +894,20 @@ void ScenesServer::HandleRemoveScene(HandlerContext & ctx, const Commands::Remov ReturnOnFailure(AddResponseOnError( ctx, response, sceneTable->RemoveSceneTableEntry(ctx.mCommandHandler.GetAccessingFabricIndex(), scene.mStorageId))); - // Update Attributes - MatterReportingAttributeChangeCallback(ctx.mRequestPath.mEndpointId, Id, Attributes::SceneCount::Id); - MatterReportingAttributeChangeCallback(ctx.mRequestPath.mEndpointId, Id, Attributes::RemainingCapacity::Id); + // Update SceneInfoStruct Attributes + Structs::SceneInfoStruct::Type * sceneInfo = + GetSceneInfoStruct(ctx.mRequestPath.mEndpointId, ctx.mCommandHandler.GetAccessingFabricIndex()); + Optional sceneValid; + if (nullptr != sceneInfo) + { + sceneValid = (req.groupID == sceneInfo->currentGroup && req.sceneID == sceneInfo->currentScene) ? Optional(false) + : Optional(); + } - ReturnOnFailure(UpdateLastConfiguredBy(ctx, response)); + ReturnOnFailure( + AddResponseOnError(ctx, response, + updateFabricSceneInfo(ctx.mRequestPath.mEndpointId, ctx.mCommandHandler.GetAccessingFabricIndex(), + Optional(), Optional(), sceneValid))); // Write response response.status = to_underlying(Protocols::InteractionModel::Status::Success); @@ -696,8 +942,18 @@ void ScenesServer::HandleRemoveAllScenes(HandlerContext & ctx, const Commands::R ctx, response, sceneTable->DeleteAllScenesInGroup(ctx.mCommandHandler.GetAccessingFabricIndex(), req.groupID))); // Update Attributes - MatterReportingAttributeChangeCallback(ctx.mRequestPath.mEndpointId, Id, Attributes::SceneCount::Id); - MatterReportingAttributeChangeCallback(ctx.mRequestPath.mEndpointId, Id, Attributes::RemainingCapacity::Id); + Structs::SceneInfoStruct::Type * sceneInfo = + GetSceneInfoStruct(ctx.mRequestPath.mEndpointId, ctx.mCommandHandler.GetAccessingFabricIndex()); + Optional sceneValid; + if (nullptr != sceneInfo) + { + sceneValid = (req.groupID == sceneInfo->currentGroup) ? Optional(false) : Optional(); + } + + ReturnOnFailure( + AddResponseOnError(ctx, response, + updateFabricSceneInfo(ctx.mRequestPath.mEndpointId, ctx.mCommandHandler.GetAccessingFabricIndex(), + Optional(), Optional(), sceneValid))); ReturnOnFailure(UpdateLastConfiguredBy(ctx, response)); @@ -710,9 +966,6 @@ void ScenesServer::HandleStoreScene(HandlerContext & ctx, const Commands::StoreS { Commands::StoreSceneResponse::Type response; - // Scene Valid is false when this command begins - ReturnOnFailure(AddResponseOnError(ctx, response, Attributes::SceneValid::Set(ctx.mRequestPath.mEndpointId, false))); - // Response data response.groupID = req.groupID; response.sceneID = req.sceneID; @@ -722,8 +975,6 @@ void ScenesServer::HandleStoreScene(HandlerContext & ctx, const Commands::StoreS if (CHIP_NO_ERROR == err) { - ReturnOnFailure(AddResponseOnError(ctx, response, Attributes::SceneValid::Set(ctx.mRequestPath.mEndpointId, true))); - ReturnOnFailure(UpdateLastConfiguredBy(ctx, response)); } @@ -733,21 +984,12 @@ void ScenesServer::HandleStoreScene(HandlerContext & ctx, const Commands::StoreS void ScenesServer::HandleRecallScene(HandlerContext & ctx, const Commands::RecallScene::DecodableType & req) { - // Scene Valid is false when this command begins - EmberAfStatus status = Attributes::SceneValid::Set(ctx.mRequestPath.mEndpointId, false); - if (EMBER_ZCL_STATUS_SUCCESS != status) - { - ctx.mCommandHandler.AddStatus(ctx.mRequestPath, ToInteractionModelStatus(status)); - return; - } - CHIP_ERROR err = RecallSceneParse(ctx.mCommandHandler.GetAccessingFabricIndex(), ctx.mRequestPath.mEndpointId, req.groupID, req.sceneID, req.transitionTime, mGroupProvider); if (CHIP_NO_ERROR == err) { - status = Attributes::SceneValid::Set(ctx.mRequestPath.mEndpointId, true); - ctx.mCommandHandler.AddStatus(ctx.mRequestPath, ToInteractionModelStatus(status)); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Protocols::InteractionModel::Status::Success); return; } @@ -883,9 +1125,11 @@ void ScenesServer::HandleCopyScene(HandlerContext & ctx, const Commands::CopySce ctx, response, sceneTable->SetSceneTableEntry(ctx.mCommandHandler.GetAccessingFabricIndex(), scene))); } - // Update Attributes - MatterReportingAttributeChangeCallback(ctx.mRequestPath.mEndpointId, Id, Attributes::SceneCount::Id); - MatterReportingAttributeChangeCallback(ctx.mRequestPath.mEndpointId, Id, Attributes::RemainingCapacity::Id); + // Update SceneInfoStruct Attributes + ReturnOnFailure( + AddResponseOnError(ctx, response, + updateFabricSceneInfo(ctx.mRequestPath.mEndpointId, ctx.mCommandHandler.GetAccessingFabricIndex(), + Optional(), Optional(), Optional()))); ReturnOnFailure(UpdateLastConfiguredBy(ctx, response)); @@ -904,8 +1148,10 @@ void ScenesServer::HandleCopyScene(HandlerContext & ctx, const Commands::CopySce AddResponseOnError(ctx, response, sceneTable->SetSceneTableEntry(ctx.mCommandHandler.GetAccessingFabricIndex(), scene))); // Update Attributes - MatterReportingAttributeChangeCallback(ctx.mRequestPath.mEndpointId, Id, Attributes::SceneCount::Id); - MatterReportingAttributeChangeCallback(ctx.mRequestPath.mEndpointId, Id, Attributes::RemainingCapacity::Id); + ReturnOnFailure( + AddResponseOnError(ctx, response, + updateFabricSceneInfo(ctx.mRequestPath.mEndpointId, ctx.mCommandHandler.GetAccessingFabricIndex(), + Optional(), Optional(), Optional()))); ReturnOnFailure(UpdateLastConfiguredBy(ctx, response)); diff --git a/src/app/clusters/scenes-server/scenes-server.h b/src/app/clusters/scenes-server/scenes-server.h index a96d1dc29ce3ca..7140cd20e2e348 100644 --- a/src/app/clusters/scenes-server/scenes-server.h +++ b/src/app/clusters/scenes-server/scenes-server.h @@ -34,6 +34,28 @@ namespace Scenes { class ScenesServer : public CommandHandlerInterface, public AttributeAccessInterface { public: + static constexpr size_t kScenesServerMaxEndpointCount = + EMBER_AF_SCENES_CLUSTER_SERVER_ENDPOINT_COUNT + CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT; + static_assert(kScenesServerMaxEndpointCount <= kEmberInvalidEndpointIndex, "Scenes endpoint count error"); + static constexpr uint8_t kScenesServerMaxFabricCount = CHIP_CONFIG_MAX_FABRICS; + + // FabricSceneInfo + class FabricSceneInfo + { + public: + Structs::SceneInfoStruct::Type * GetFabricSceneInfo(EndpointId endpoint); + Structs::SceneInfoStruct::Type * GetSceneInfoStruct(EndpointId endpoint, FabricIndex fabric); + CHIP_ERROR SetSceneInfoStruct(EndpointId endpoint, FabricIndex fabric, Structs::SceneInfoStruct::Type & sceneInfoStruct); + void ClearSceneInfoStruct(EndpointId endpoint, FabricIndex fabric); + + private: + CHIP_ERROR FindFabricSceneInfoIndex(EndpointId endpoint, size_t & endpointIndex); + CHIP_ERROR FindSceneInfoStructIndex(FabricIndex fabric, size_t endpointIndex, uint8_t & index); + + Structs::SceneInfoStruct::Type mSceneInfoStructs[kScenesServerMaxEndpointCount][kScenesServerMaxFabricCount]; + uint8_t mSceneInfoStructsCount[kScenesServerMaxEndpointCount] = { 0 }; + }; + static ScenesServer & Instance(); CHIP_ERROR Init(); @@ -45,16 +67,25 @@ class ScenesServer : public CommandHandlerInterface, public AttributeAccessInter // AttributeAccessInterface CHIP_ERROR Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override; + // SceneInfoStruct Accessors + Structs::SceneInfoStruct::Type * GetSceneInfoStruct(EndpointId endpoint, FabricIndex fabric); + CHIP_ERROR SetSceneInfoStruct(EndpointId endpoint, FabricIndex fabric, Structs::SceneInfoStruct::Type & sceneInfoStruct); + // Callbacks void GroupWillBeRemoved(FabricIndex aFabricIx, EndpointId aEndpointId, GroupId aGroupId); - void MakeSceneInvalid(EndpointId aEndpointId); + void MakeSceneInvalid(EndpointId aEndpointId, FabricIndex aFabricIx); + void MakeSceneInvalidForAllFabrics(EndpointId aEndpointId); void StoreCurrentScene(FabricIndex aFabricIx, EndpointId aEndpointId, GroupId aGroupId, SceneId aSceneId); void RecallScene(FabricIndex aFabricIx, EndpointId aEndpointId, GroupId aGroupId, SceneId aSceneId); + // Handlers for extension field sets bool IsHandlerRegistered(EndpointId aEndpointId, scenes::SceneHandler * handler); void RegisterSceneHandler(EndpointId aEndpointId, scenes::SceneHandler * handler); void UnregisterSceneHandler(EndpointId aEndpointId, scenes::SceneHandler * handler); + // Fabric + void RemoveFabric(EndpointId aEndpointId, FabricIndex aFabricIndex); + private: ScenesServer() : CommandHandlerInterface(Optional(), Id), AttributeAccessInterface(Optional(), Id) {} ~ScenesServer() { Shutdown(); } @@ -76,6 +107,9 @@ class ScenesServer : public CommandHandlerInterface, public AttributeAccessInter // Group Data Provider Credentials::GroupDataProvider * mGroupProvider = nullptr; + // FabricSceneInfo + FabricSceneInfo mFabricSceneInfo; + // Instance static ScenesServer mInstance; }; diff --git a/src/app/tests/suites/certification/PICS.yaml b/src/app/tests/suites/certification/PICS.yaml index d94eada4ad6415..9266cf540ef7a7 100644 --- a/src/app/tests/suites/certification/PICS.yaml +++ b/src/app/tests/suites/certification/PICS.yaml @@ -5707,7 +5707,7 @@ PICS: - label: "Does the device implement the SceneTableSize attribute?" id: S.S.A0006 - - label: "Does the device implement the RemainingCapacity attribute?" + - label: "Does the device implement the FabricSceneInfo attribute?" id: S.S.A0007 # diff --git a/src/app/tests/suites/certification/Test_TC_S_1_1.yaml b/src/app/tests/suites/certification/Test_TC_S_1_1.yaml index ed3fe73f726710..5e37c99702eda1 100644 --- a/src/app/tests/suites/certification/Test_TC_S_1_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_S_1_1.yaml @@ -41,7 +41,7 @@ tests: constraints: type: int16u - - label: "Step 3a: Read FeatureMap (global attribute 65532)" + - label: "Step 3a: Read FeatureMap NameSupport bit (global attribute 65532)" PICS: (!S.S.F00) command: "readAttribute" attribute: "FeatureMap" @@ -50,7 +50,7 @@ tests: type: bitmap32 hasMasksClear: [0x1] - - label: "Step 3a: Read FeatureMap (global attribute 65532)" + - label: "Step 3a: Read FeatureMap NameSupport bit (global attribute 65532)" PICS: S.S.F00 command: "readAttribute" attribute: "FeatureMap" @@ -59,7 +59,17 @@ tests: type: bitmap32 hasMasksSet: [0x1] - - label: "Step 3b: Read FeatureMap (global attribute 65532)" + - label: "Step 3b: Read FeatureMap Explicit bit (global attribute 65532)" + PICS: (!S.S.F01) + command: "readAttribute" + attribute: "FeatureMap" + response: + constraints: + type: bitmap32 + hasMasksClear: [0x2] + + - label: "Step 3b: Read FeatureMap Explicit bit (global attribute 65532)" + PICS: S.S.F01 command: "readAttribute" attribute: "FeatureMap" response: @@ -67,7 +77,17 @@ tests: type: bitmap32 hasMasksSet: [0x2] - - label: "Step 3c: Read FeatureMap (global attribute 65532)" + - label: "Step 3c: Read FeatureMap TableSize bit (global attribute 65532)" + PICS: (!S.S.F02) + command: "readAttribute" + attribute: "FeatureMap" + response: + constraints: + type: bitmap32 + hasMasksClear: [0x4] + + - label: "Step 3c: Read FeatureMap TableSize bit (global attribute 65532)" + PICS: S.S.F02 command: "readAttribute" attribute: "FeatureMap" response: @@ -75,6 +95,25 @@ tests: type: bitmap32 hasMasksSet: [0x4] + - label: "Step 3d: Read FeatureMap FabricScene bit (global attribute 65532)" + PICS: (!S.S.F03) + command: "readAttribute" + attribute: "FeatureMap" + response: + constraints: + type: bitmap32 + + hasMasksClear: [0x8] + + - label: "Step 3d: Read FeatureMap FabricScene bit (global attribute 65532)" + PICS: S.S.F03 + command: "readAttribute" + attribute: "FeatureMap" + response: + constraints: + type: bitmap32 + hasMasksSet: [0x8] + - label: "Step 4: Read Mandatory attributes in AttributeList (global attribute 65531)" diff --git a/src/app/tests/suites/certification/Test_TC_S_2_1.yaml b/src/app/tests/suites/certification/Test_TC_S_2_1.yaml index 3e31cf836e1dd2..97f3c0a23a1892 100644 --- a/src/app/tests/suites/certification/Test_TC_S_2_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_S_2_1.yaml @@ -35,7 +35,7 @@ tests: value: nodeId - label: "Step 2: TH reads from the DUT the (0x0000) SceneCount attribute" - PICS: S.S.A0000 + PICS: S.S.A0000 && (!S.S.F03) command: "readAttribute" attribute: "SceneCount" response: @@ -43,7 +43,7 @@ tests: type: int8u - label: "Step 3: TH reads from the DUT the (0x0001) CurrentScene attribute" - PICS: S.S.A0001 + PICS: S.S.A0001 && (!S.S.F03) command: "readAttribute" attribute: "CurrentScene" response: @@ -51,7 +51,7 @@ tests: type: int8u - label: "Step 4: TH reads from the DUT the (0x0002) CurrentGroup attribute" - PICS: S.S.A0002 + PICS: S.S.A0002 && (!S.S.F03) command: "readAttribute" attribute: "CurrentGroup" response: @@ -59,7 +59,7 @@ tests: type: group_id - label: "Step 5: TH reads from the DUT the (0x0003) SceneValid attribute" - PICS: S.S.A0003 + PICS: S.S.A0003 && (!S.S.F03) command: "readAttribute" attribute: "SceneValid" response: @@ -67,7 +67,7 @@ tests: type: boolean - label: "Step 6: TH reads from the DUT the (0x0004) NameSupport attribute" - PICS: S.S.A0003 && S.S.F00 + PICS: S.S.A0004 && S.S.F00 command: "readAttribute" attribute: "NameSupport" response: @@ -103,11 +103,10 @@ tests: type: int16u - label: - "Step 9: TH reads from the DUT the (0x0007) RemainingCapacity - attribute" + "Step 9: TH reads from the DUT the (0x0007) FabricSceneInfo attribute" PICS: S.S.A0007 command: "readAttribute" - attribute: "RemainingCapacity" + attribute: "FabricSceneInfo" response: constraints: - type: int8u + type: list 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 16780a7e9c0353..9214bee0ef8966 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 @@ -309,7 +309,7 @@ tests: type: boolean - label: "Step 3g: TH reads attribute SceneTableSize from DUT." - PICS: S.S.F03 && S.S.F02 + PICS: PICS_SDK_CI_ONLY && S.S.F03 && S.S.F02 command: "readAttribute" attribute: "SceneTableSize" response: @@ -317,7 +317,6 @@ tests: constraints: type: int16u - #FabricSceneInfo attribute not supported - label: "Step 3h: TH reads attribute FabricSceneInfo from DUT" verification: | DUT provides FabricSceneInfo containing (for the current fabric) following fields: @@ -330,7 +329,7 @@ tests: SceneValid has the value TRUE. - if S.S.F02(TS), RemainingCapacity has the value SceneTableSize/2 + if S.S.F02(TS), RemainingCapacity has the value fabricCapacity - 1 cluster: "LogCommands" command: "UserPrompt" PICS: PICS_SKIP_SAMPLE_APP && S.S.F03 && S.S.F02 @@ -341,18 +340,21 @@ tests: - name: "expectedValue" value: "y" - #- label: "Step 3h: TH reads attribute FabricSceneInfo from DUT" - # PICS: S.S.F03 && S.S.F02 - # command: "readAttribute" - # attribute: "FabricSceneInfo" - # response: - # value: { - # SceneCount: SceneCountValue, - # CurrentScene: 0x01, - # CurrentGroup: G1, - # SceneValid: true, - # RemainingCapacity: ( SceneTableSizeValue/2 ), - # } + - label: "Step 3h: TH reads attribute FabricSceneInfo from DUT" + PICS: PICS_SDK_CI_ONLY && S.S.F03 && S.S.F02 + command: "readAttribute" + attribute: "FabricSceneInfo" + response: + value: + [ + { + SceneCount: 1, + CurrentScene: 0x01, + CurrentGroup: G1, + SceneValid: true, + RemainingCapacity: fabricCapacity - 1, + }, + ] - label: "Step 4a: Reboot target device" PICS: PICS_SDK_CI_ONLY diff --git a/src/app/tests/suites/certification/ci-pics-values b/src/app/tests/suites/certification/ci-pics-values index a4dcce73f08600..f186d8d783dac2 100644 --- a/src/app/tests/suites/certification/ci-pics-values +++ b/src/app/tests/suites/certification/ci-pics-values @@ -651,14 +651,14 @@ I.C.AO-WRITE=0 # Scenes Cluster S.S=1 -S.S.A0000=1 -S.S.A0001=1 -S.S.A0002=1 -S.S.A0003=1 +S.S.A0000=0 +S.S.A0001=0 +S.S.A0002=0 +S.S.A0003=0 S.S.A0004=1 S.S.A0005=1 S.S.A0006=1 -S.S.A0007=0 +S.S.A0007=1 S.S.C00.Rsp=1 S.S.C01.Rsp=1 S.S.C02.Rsp=1 @@ -674,7 +674,7 @@ S.S.AO=0 S.S.F00=1 S.S.F01=1 S.S.F02=1 -S.S.F03=0 +S.S.F03=1 PICS_SC_RECALL_SCENE_TRANSITION_TIME=1 S.C=0 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 43b63e67409b37..3cfdf02b3cacc4 100644 --- a/src/app/zap-templates/zcl/data-model/chip/scene.xml +++ b/src/app/zap-templates/zcl/data-model/chip/scene.xml @@ -20,6 +20,15 @@ limitations under the License. + + + + + + + + + @@ -50,7 +59,7 @@ limitations under the License. NameSupport LastConfiguredBy SceneTableSize - RemainingCapacity + FabricSceneInfo Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeId": VALUE, "AttributeValue": VALUE}]}' diff --git a/src/app/zap-templates/zcl/zcl-with-test-extensions.json b/src/app/zap-templates/zcl/zcl-with-test-extensions.json index d5e8f55dfdf964..fc705e241d0a17 100644 --- a/src/app/zap-templates/zcl/zcl-with-test-extensions.json +++ b/src/app/zap-templates/zcl/zcl-with-test-extensions.json @@ -216,7 +216,7 @@ "FeatureMap", "ThreadMetrics" ], - "Scenes": ["SceneCount", "RemainingCapacity"], + "Scenes": ["SceneCount"], "Unit Testing": [ "struct_attr", "nullable_struct", diff --git a/src/app/zap-templates/zcl/zcl.json b/src/app/zap-templates/zcl/zcl.json index 77462935f97592..56d678f9752aa5 100644 --- a/src/app/zap-templates/zcl/zcl.json +++ b/src/app/zap-templates/zcl/zcl.json @@ -214,7 +214,7 @@ "FeatureMap", "ThreadMetrics" ], - "Scenes": ["SceneCount", "RemainingCapacity"], + "Scenes": ["SceneCount"], "Unit Testing": [ "struct_attr", "nullable_struct", diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index caabe18f4fa4b4..36e736723d1e1b 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -147,6 +147,15 @@ provisional client cluster Scenes = 5 { AttributeValuePair attributeValueList[] = 1; } + fabric_scoped struct SceneInfoStruct { + int8u sceneCount = 0; + fabric_sensitive int8u currentScene = 1; + fabric_sensitive group_id currentGroup = 2; + fabric_sensitive boolean sceneValid = 3; + int8u remainingCapacity = 4; + fabric_idx fabricIndex = 254; + } + readonly attribute int8u sceneCount = 0; readonly attribute int8u currentScene = 1; readonly attribute group_id currentGroup = 2; @@ -154,7 +163,7 @@ provisional client cluster Scenes = 5 { readonly attribute bitmap8 nameSupport = 4; readonly attribute optional nullable node_id lastConfiguredBy = 5; readonly attribute int16u sceneTableSize = 6; - readonly attribute int8u remainingCapacity = 7; + readonly attribute SceneInfoStruct fabricSceneInfo[] = 7; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java index e79b8954570243..bd798abe12d51c 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java @@ -666,6 +666,12 @@ public interface LastConfiguredByAttributeCallback { default void onSubscriptionEstablished(long subscriptionId) {} } + public interface FabricSceneInfoAttributeCallback { + void onSuccess(List value); + void onError(Exception ex); + default void onSubscriptionEstablished(long subscriptionId) {} + } + public interface GeneratedCommandListAttributeCallback { void onSuccess(List value); void onError(Exception ex); @@ -760,14 +766,20 @@ public void subscribeSceneTableSizeAttribute( subscribeSceneTableSizeAttribute(chipClusterPtr, callback, minInterval, maxInterval); } - public void readRemainingCapacityAttribute( - IntegerAttributeCallback callback) { - readRemainingCapacityAttribute(chipClusterPtr, callback); + public void readFabricSceneInfoAttribute( + FabricSceneInfoAttributeCallback callback) { + readFabricSceneInfoAttribute(chipClusterPtr, callback, true); } - public void subscribeRemainingCapacityAttribute( - IntegerAttributeCallback callback, int minInterval, int maxInterval) { - subscribeRemainingCapacityAttribute(chipClusterPtr, callback, minInterval, maxInterval); + public void readFabricSceneInfoAttributeWithFabricFilter( + FabricSceneInfoAttributeCallback callback, boolean isFabricFiltered) { + readFabricSceneInfoAttribute(chipClusterPtr, callback, isFabricFiltered); + } + + + public void subscribeFabricSceneInfoAttribute( + FabricSceneInfoAttributeCallback callback, int minInterval, int maxInterval) { + subscribeFabricSceneInfoAttribute(chipClusterPtr, callback, minInterval, maxInterval); } public void readGeneratedCommandListAttribute( @@ -858,9 +870,9 @@ public void subscribeClusterRevisionAttribute( private native void subscribeSceneTableSizeAttribute(long chipClusterPtr, IntegerAttributeCallback callback, int minInterval, int maxInterval); - private native void readRemainingCapacityAttribute(long chipClusterPtr, IntegerAttributeCallback callback); + private native void readFabricSceneInfoAttribute(long chipClusterPtr, FabricSceneInfoAttributeCallback callback, boolean isFabricFiltered); - private native void subscribeRemainingCapacityAttribute(long chipClusterPtr, IntegerAttributeCallback callback, int minInterval, int maxInterval); + private native void subscribeFabricSceneInfoAttribute(long chipClusterPtr, FabricSceneInfoAttributeCallback callback, int minInterval, int maxInterval); private native void readGeneratedCommandListAttribute(long chipClusterPtr, GeneratedCommandListAttributeCallback callback); diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java index b2a267b050609a..eb953a512fcaad 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java @@ -72,6 +72,55 @@ public String toString() { return output.toString(); } } +public static class ScenesClusterSceneInfoStruct { + public Integer sceneCount; + public Integer currentScene; + public Integer currentGroup; + public Boolean sceneValid; + public Integer remainingCapacity; + public Integer fabricIndex; + public ScenesClusterSceneInfoStruct( + Integer sceneCount, + Integer currentScene, + Integer currentGroup, + Boolean sceneValid, + Integer remainingCapacity, + Integer fabricIndex + ) { + this.sceneCount = sceneCount; + this.currentScene = currentScene; + this.currentGroup = currentGroup; + this.sceneValid = sceneValid; + this.remainingCapacity = remainingCapacity; + this.fabricIndex = fabricIndex; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ScenesClusterSceneInfoStruct {\n"); + output.append("\tsceneCount: "); + output.append(sceneCount); + output.append("\n"); + output.append("\tcurrentScene: "); + output.append(currentScene); + output.append("\n"); + output.append("\tcurrentGroup: "); + output.append(currentGroup); + output.append("\n"); + output.append("\tsceneValid: "); + output.append(sceneValid); + output.append("\n"); + output.append("\tremainingCapacity: "); + output.append(remainingCapacity); + output.append("\n"); + output.append("\tfabricIndex: "); + output.append(fabricIndex); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} public static class DescriptorClusterDeviceTypeStruct { public Long deviceType; public Integer revision; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java index c5d09f3834e59b..fad96af0466276 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java @@ -667,7 +667,7 @@ public enum Attribute { NameSupport(4L), LastConfiguredBy(5L), SceneTableSize(6L), - RemainingCapacity(7L), + FabricSceneInfo(7L), GeneratedCommandList(65528L), AcceptedCommandList(65529L), EventList(65530L), diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java index a051e4d5b071b8..78195e62ed05d1 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java @@ -750,6 +750,27 @@ public void onError(Exception ex) { } } + public static class DelegatedScenesClusterFabricSceneInfoAttributeCallback implements ChipClusters.ScenesCluster.FabricSceneInfoAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + public static class DelegatedScenesClusterGeneratedCommandListAttributeCallback implements ChipClusters.ScenesCluster.GeneratedCommandListAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java index 8cd4db031a7831..4afd2f25c8fffa 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java @@ -276,17 +276,17 @@ private static Map readScenesInteractionInfo() { readScenesSceneTableSizeCommandParams ); result.put("readSceneTableSizeAttribute", readScenesSceneTableSizeAttributeInteractionInfo); - Map readScenesRemainingCapacityCommandParams = new LinkedHashMap(); - InteractionInfo readScenesRemainingCapacityAttributeInteractionInfo = new InteractionInfo( + Map readScenesFabricSceneInfoCommandParams = new LinkedHashMap(); + InteractionInfo readScenesFabricSceneInfoAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { - ((ChipClusters.ScenesCluster) cluster).readRemainingCapacityAttribute( - (ChipClusters.IntegerAttributeCallback) callback + ((ChipClusters.ScenesCluster) cluster).readFabricSceneInfoAttribute( + (ChipClusters.ScenesCluster.FabricSceneInfoAttributeCallback) callback ); }, - () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), - readScenesRemainingCapacityCommandParams + () -> new ClusterInfoMapping.DelegatedScenesClusterFabricSceneInfoAttributeCallback(), + readScenesFabricSceneInfoCommandParams ); - result.put("readRemainingCapacityAttribute", readScenesRemainingCapacityAttributeInteractionInfo); + result.put("readFabricSceneInfoAttribute", readScenesFabricSceneInfoAttributeInteractionInfo); Map readScenesGeneratedCommandListCommandParams = new LinkedHashMap(); InteractionInfo readScenesGeneratedCommandListAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { 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 7b067fdcef6e8b..5db49be2e364a2 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni @@ -64,6 +64,7 @@ structs_sources = [ "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RvcRunModeClusterModeTagStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesClusterAttributeValuePair.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesClusterExtensionFieldSet.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesClusterSceneInfoStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/SoftwareDiagnosticsClusterThreadMetricsStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/TargetNavigatorClusterTargetInfoStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThermostatClusterThermostatScheduleTransition.kt", diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesClusterSceneInfoStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesClusterSceneInfoStruct.kt new file mode 100644 index 00000000000000..066ade4d02a12f --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesClusterSceneInfoStruct.kt @@ -0,0 +1,86 @@ +/* + * + * 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 ScenesClusterSceneInfoStruct( + val sceneCount: UInt, + val currentScene: UInt, + val currentGroup: UInt, + val sceneValid: Boolean, + val remainingCapacity: UInt, + val fabricIndex: UInt +) { + override fun toString(): String = buildString { + append("ScenesClusterSceneInfoStruct {\n") + append("\tsceneCount : $sceneCount\n") + append("\tcurrentScene : $currentScene\n") + append("\tcurrentGroup : $currentGroup\n") + append("\tsceneValid : $sceneValid\n") + append("\tremainingCapacity : $remainingCapacity\n") + append("\tfabricIndex : $fabricIndex\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_SCENE_COUNT), sceneCount) + put(ContextSpecificTag(TAG_CURRENT_SCENE), currentScene) + put(ContextSpecificTag(TAG_CURRENT_GROUP), currentGroup) + put(ContextSpecificTag(TAG_SCENE_VALID), sceneValid) + put(ContextSpecificTag(TAG_REMAINING_CAPACITY), remainingCapacity) + put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) + endStructure() + } + } + + companion object { + private const val TAG_SCENE_COUNT = 0 + private const val TAG_CURRENT_SCENE = 1 + private const val TAG_CURRENT_GROUP = 2 + private const val TAG_SCENE_VALID = 3 + private const val TAG_REMAINING_CAPACITY = 4 + private const val TAG_FABRIC_INDEX = 254 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ScenesClusterSceneInfoStruct { + tlvReader.enterStructure(tlvTag) + val sceneCount = tlvReader.getUInt(ContextSpecificTag(TAG_SCENE_COUNT)) + val currentScene = tlvReader.getUInt(ContextSpecificTag(TAG_CURRENT_SCENE)) + val currentGroup = tlvReader.getUInt(ContextSpecificTag(TAG_CURRENT_GROUP)) + val sceneValid = tlvReader.getBoolean(ContextSpecificTag(TAG_SCENE_VALID)) + val remainingCapacity = tlvReader.getUInt(ContextSpecificTag(TAG_REMAINING_CAPACITY)) + val fabricIndex = tlvReader.getUInt(ContextSpecificTag(TAG_FABRIC_INDEX)) + + tlvReader.exitContainer() + + return ScenesClusterSceneInfoStruct( + sceneCount, + currentScene, + currentGroup, + sceneValid, + remainingCapacity, + fabricIndex + ) + } + } +} diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp index 5e2b611d121792..3c91d68ab6d8bf 100644 --- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp @@ -492,8 +492,8 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR value); return value; } - case Attributes::RemainingCapacity::Id: { - using TypeInfo = Attributes::RemainingCapacity::TypeInfo; + case Attributes::FabricSceneInfo::Id: { + using TypeInfo = Attributes::FabricSceneInfo::TypeInfo; TypeInfo::DecodableType cppValue; *aError = app::DataModel::Decode(aReader, cppValue); if (*aError != CHIP_NO_ERROR) @@ -501,11 +501,79 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR return nullptr; } jobject value; - std::string valueClassName = "java/lang/Integer"; - std::string valueCtorSignature = "(I)V"; - jint jnivalue = static_cast(cppValue); - chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), jnivalue, - value); + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + jobject newElement_0_sceneCount; + std::string newElement_0_sceneCountClassName = "java/lang/Integer"; + std::string newElement_0_sceneCountCtorSignature = "(I)V"; + jint jninewElement_0_sceneCount = static_cast(entry_0.sceneCount); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_sceneCountClassName.c_str(), + newElement_0_sceneCountCtorSignature.c_str(), + jninewElement_0_sceneCount, newElement_0_sceneCount); + jobject newElement_0_currentScene; + std::string newElement_0_currentSceneClassName = "java/lang/Integer"; + std::string newElement_0_currentSceneCtorSignature = "(I)V"; + jint jninewElement_0_currentScene = static_cast(entry_0.currentScene); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_currentSceneClassName.c_str(), + newElement_0_currentSceneCtorSignature.c_str(), + jninewElement_0_currentScene, newElement_0_currentScene); + jobject newElement_0_currentGroup; + std::string newElement_0_currentGroupClassName = "java/lang/Integer"; + std::string newElement_0_currentGroupCtorSignature = "(I)V"; + jint jninewElement_0_currentGroup = static_cast(entry_0.currentGroup); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_currentGroupClassName.c_str(), + newElement_0_currentGroupCtorSignature.c_str(), + jninewElement_0_currentGroup, newElement_0_currentGroup); + jobject newElement_0_sceneValid; + std::string newElement_0_sceneValidClassName = "java/lang/Boolean"; + std::string newElement_0_sceneValidCtorSignature = "(Z)V"; + jboolean jninewElement_0_sceneValid = static_cast(entry_0.sceneValid); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_sceneValidClassName.c_str(), + newElement_0_sceneValidCtorSignature.c_str(), + jninewElement_0_sceneValid, newElement_0_sceneValid); + jobject newElement_0_remainingCapacity; + std::string newElement_0_remainingCapacityClassName = "java/lang/Integer"; + std::string newElement_0_remainingCapacityCtorSignature = "(I)V"; + jint jninewElement_0_remainingCapacity = static_cast(entry_0.remainingCapacity); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_remainingCapacityClassName.c_str(), newElement_0_remainingCapacityCtorSignature.c_str(), + jninewElement_0_remainingCapacity, newElement_0_remainingCapacity); + jobject newElement_0_fabricIndex; + std::string newElement_0_fabricIndexClassName = "java/lang/Integer"; + std::string newElement_0_fabricIndexCtorSignature = "(I)V"; + jint jninewElement_0_fabricIndex = static_cast(entry_0.fabricIndex); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIndexClassName.c_str(), + newElement_0_fabricIndexCtorSignature.c_str(), + jninewElement_0_fabricIndex, newElement_0_fabricIndex); + + jclass sceneInfoStructStructClass_1; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$ScenesClusterSceneInfoStruct", sceneInfoStructStructClass_1); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$ScenesClusterSceneInfoStruct"); + return nullptr; + } + jmethodID sceneInfoStructStructCtor_1 = + env->GetMethodID(sceneInfoStructStructClass_1, "", + "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Boolean;Ljava/lang/" + "Integer;Ljava/lang/Integer;)V"); + if (sceneInfoStructStructCtor_1 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$ScenesClusterSceneInfoStruct constructor"); + return nullptr; + } + + newElement_0 = env->NewObject(sceneInfoStructStructClass_1, sceneInfoStructStructCtor_1, newElement_0_sceneCount, + newElement_0_currentScene, newElement_0_currentGroup, newElement_0_sceneValid, + newElement_0_remainingCapacity, newElement_0_fabricIndex); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } return value; } case Attributes::GeneratedCommandList::Id: { diff --git a/src/controller/java/zap-generated/CHIPClientCallbacks.h b/src/controller/java/zap-generated/CHIPClientCallbacks.h index 76f215309f6705..e1fd49767bcc70 100644 --- a/src/controller/java/zap-generated/CHIPClientCallbacks.h +++ b/src/controller/java/zap-generated/CHIPClientCallbacks.h @@ -44,6 +44,9 @@ typedef void (*GroupsEventListListAttributeCallback)(void * context, const chip::app::DataModel::DecodableList & data); typedef void (*GroupsAttributeListListAttributeCallback)(void * context, const chip::app::DataModel::DecodableList & data); +typedef void (*ScenesFabricSceneInfoListAttributeCallback)( + void * context, + const chip::app::DataModel::DecodableList & data); typedef void (*ScenesGeneratedCommandListListAttributeCallback)(void * context, const chip::app::DataModel::DecodableList & data); typedef void (*ScenesAcceptedCommandListListAttributeCallback)(void * context, diff --git a/src/controller/java/zap-generated/CHIPReadCallbacks.cpp b/src/controller/java/zap-generated/CHIPReadCallbacks.cpp index b45aa5e51806d2..cf09656989a7ea 100644 --- a/src/controller/java/zap-generated/CHIPReadCallbacks.cpp +++ b/src/controller/java/zap-generated/CHIPReadCallbacks.cpp @@ -661,6 +661,135 @@ void CHIPScenesLastConfiguredByAttributeCallback::CallbackFn(void * context, env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } +CHIPScenesFabricSceneInfoAttributeCallback::CHIPScenesFabricSceneInfoAttributeCallback(jobject javaCallback, bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPScenesFabricSceneInfoAttributeCallback::~CHIPScenesFabricSceneInfoAttributeCallback() +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPScenesFabricSceneInfoAttributeCallback::CallbackFn( + void * context, + const chip::app::DataModel::DecodableList & list) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + jobject javaCallbackRef; + + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + + std::unique_ptr cppCallback( + reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. + javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, + ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); + + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); + + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + jobject newElement_0_sceneCount; + std::string newElement_0_sceneCountClassName = "java/lang/Integer"; + std::string newElement_0_sceneCountCtorSignature = "(I)V"; + jint jninewElement_0_sceneCount = static_cast(entry_0.sceneCount); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_sceneCountClassName.c_str(), + newElement_0_sceneCountCtorSignature.c_str(), + jninewElement_0_sceneCount, newElement_0_sceneCount); + jobject newElement_0_currentScene; + std::string newElement_0_currentSceneClassName = "java/lang/Integer"; + std::string newElement_0_currentSceneCtorSignature = "(I)V"; + jint jninewElement_0_currentScene = static_cast(entry_0.currentScene); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_currentSceneClassName.c_str(), + newElement_0_currentSceneCtorSignature.c_str(), + jninewElement_0_currentScene, newElement_0_currentScene); + jobject newElement_0_currentGroup; + std::string newElement_0_currentGroupClassName = "java/lang/Integer"; + std::string newElement_0_currentGroupCtorSignature = "(I)V"; + jint jninewElement_0_currentGroup = static_cast(entry_0.currentGroup); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_currentGroupClassName.c_str(), + newElement_0_currentGroupCtorSignature.c_str(), + jninewElement_0_currentGroup, newElement_0_currentGroup); + jobject newElement_0_sceneValid; + std::string newElement_0_sceneValidClassName = "java/lang/Boolean"; + std::string newElement_0_sceneValidCtorSignature = "(Z)V"; + jboolean jninewElement_0_sceneValid = static_cast(entry_0.sceneValid); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_sceneValidClassName.c_str(), + newElement_0_sceneValidCtorSignature.c_str(), + jninewElement_0_sceneValid, newElement_0_sceneValid); + jobject newElement_0_remainingCapacity; + std::string newElement_0_remainingCapacityClassName = "java/lang/Integer"; + std::string newElement_0_remainingCapacityCtorSignature = "(I)V"; + jint jninewElement_0_remainingCapacity = static_cast(entry_0.remainingCapacity); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_remainingCapacityClassName.c_str(), newElement_0_remainingCapacityCtorSignature.c_str(), + jninewElement_0_remainingCapacity, newElement_0_remainingCapacity); + jobject newElement_0_fabricIndex; + std::string newElement_0_fabricIndexClassName = "java/lang/Integer"; + std::string newElement_0_fabricIndexCtorSignature = "(I)V"; + jint jninewElement_0_fabricIndex = static_cast(entry_0.fabricIndex); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIndexClassName.c_str(), + newElement_0_fabricIndexCtorSignature.c_str(), + jninewElement_0_fabricIndex, newElement_0_fabricIndex); + + jclass sceneInfoStructStructClass_1; + err = chip::JniReferences::GetInstance().GetClassRef(env, "chip/devicecontroller/ChipStructs$ScenesClusterSceneInfoStruct", + sceneInfoStructStructClass_1); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$ScenesClusterSceneInfoStruct"); + return; + } + jmethodID sceneInfoStructStructCtor_1 = env->GetMethodID(sceneInfoStructStructClass_1, "", + "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/" + "lang/Boolean;Ljava/lang/Integer;Ljava/lang/Integer;)V"); + if (sceneInfoStructStructCtor_1 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$ScenesClusterSceneInfoStruct constructor"); + return; + } + + newElement_0 = env->NewObject(sceneInfoStructStructClass_1, sceneInfoStructStructCtor_1, newElement_0_sceneCount, + newElement_0_currentScene, newElement_0_currentGroup, newElement_0_sceneValid, + newElement_0_remainingCapacity, newElement_0_fabricIndex); + chip::JniReferences::GetInstance().AddToList(arrayListObj, newElement_0); + } + + env->ExceptionClear(); + env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); +} + CHIPScenesGeneratedCommandListAttributeCallback::CHIPScenesGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index e5efbe902213d2..da925074b3783b 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -332,9 +332,9 @@ class ChipClusters: "reportable": True, }, 0x00000007: { - "attributeName": "RemainingCapacity", + "attributeName": "FabricSceneInfo", "attributeId": 0x00000007, - "type": "int", + "type": "", "reportable": True, }, 0x0000FFF8: { diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index e67077ba62feb3..79920b52daee0d 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -597,7 +597,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="nameSupport", Tag=0x00000004, Type=uint), ClusterObjectFieldDescriptor(Label="lastConfiguredBy", Tag=0x00000005, Type=typing.Union[None, Nullable, uint]), ClusterObjectFieldDescriptor(Label="sceneTableSize", Tag=0x00000006, Type=uint), - ClusterObjectFieldDescriptor(Label="remainingCapacity", Tag=0x00000007, Type=uint), + ClusterObjectFieldDescriptor(Label="fabricSceneInfo", Tag=0x00000007, Type=typing.List[Scenes.Structs.SceneInfoStruct]), ClusterObjectFieldDescriptor(Label="generatedCommandList", Tag=0x0000FFF8, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="acceptedCommandList", Tag=0x0000FFF9, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="eventList", Tag=0x0000FFFA, Type=typing.List[uint]), @@ -613,7 +613,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: nameSupport: 'uint' = None lastConfiguredBy: 'typing.Union[None, Nullable, uint]' = None sceneTableSize: 'uint' = None - remainingCapacity: 'uint' = None + fabricSceneInfo: 'typing.List[Scenes.Structs.SceneInfoStruct]' = None generatedCommandList: 'typing.List[uint]' = None acceptedCommandList: 'typing.List[uint]' = None eventList: 'typing.List[uint]' = None @@ -658,6 +658,27 @@ def descriptor(cls) -> ClusterObjectDescriptor: clusterID: 'uint' = 0 attributeValueList: 'typing.List[Scenes.Structs.AttributeValuePair]' = field(default_factory=lambda: []) + @dataclass + class SceneInfoStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="sceneCount", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="currentScene", Tag=1, Type=uint), + ClusterObjectFieldDescriptor(Label="currentGroup", Tag=2, Type=uint), + ClusterObjectFieldDescriptor(Label="sceneValid", Tag=3, Type=bool), + ClusterObjectFieldDescriptor(Label="remainingCapacity", Tag=4, Type=uint), + ClusterObjectFieldDescriptor(Label="fabricIndex", Tag=254, Type=uint), + ]) + + sceneCount: 'uint' = 0 + currentScene: 'uint' = 0 + currentGroup: 'uint' = 0 + sceneValid: 'bool' = False + remainingCapacity: 'uint' = 0 + fabricIndex: 'uint' = 0 + class Commands: @dataclass class AddScene(ClusterCommand): @@ -1161,7 +1182,7 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: 'uint' = 0 @dataclass - class RemainingCapacity(ClusterAttributeDescriptor): + class FabricSceneInfo(ClusterAttributeDescriptor): @ChipUtility.classproperty def cluster_id(cls) -> int: return 0x00000005 @@ -1172,9 +1193,9 @@ def attribute_id(cls) -> int: @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=uint) + return ClusterObjectFieldDescriptor(Type=typing.List[Scenes.Structs.SceneInfoStruct]) - value: 'uint' = 0 + value: 'typing.List[Scenes.Structs.SceneInfoStruct]' = field(default_factory=lambda: []) @dataclass class GeneratedCommandList(ClusterAttributeDescriptor): diff --git a/src/darwin/Framework/CHIP/templates/availability.yaml b/src/darwin/Framework/CHIP/templates/availability.yaml index 05d280d165687f..add4a0adb4d2e8 100644 --- a/src/darwin/Framework/CHIP/templates/availability.yaml +++ b/src/darwin/Framework/CHIP/templates/availability.yaml @@ -7426,7 +7426,7 @@ Scenes: # New scenes bits not stable yet. - SceneTableSize - - RemainingCapacity + - SceneInfoStruct FanControl: # New Fan Control bits not stable yet. - AirflowDirection @@ -7520,6 +7520,22 @@ watchOS: "10.1" tvOS: "17.1" introduced: + attributes: + Scenes: + - SceneTableSize + - FabricSceneInfo + structs: + Scenes: + - SceneInfoStruct + struct fields: + Scenes: + SceneInfoStruct: + - SceneCount + - CurrentScene + - CurrentGroup + - SceneValid + - NameSupport + - LastConfiguredBy bitmaps: TimeFormatLocalization: - Feature diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm index f034ce2ef1cb3c..5e60ad3de1fb83 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm @@ -111,7 +111,7 @@ static BOOL AttributeIsSpecifiedInScenesCluster(AttributeId aAttributeId) case Attributes::SceneTableSize::Id: { return YES; } - case Attributes::RemainingCapacity::Id: { + case Attributes::FabricSceneInfo::Id: { return YES; } case Attributes::GeneratedCommandList::Id: { diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm index 4fcd7e0c8bd86f..c8828f6288afbf 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm @@ -304,7 +304,6 @@ static id _Nullable DecodeAttributeValueForScenesCluster(AttributeId aAttributeI } return value; } -#if MTR_ENABLE_PROVISIONAL case Attributes::SceneTableSize::Id: { using TypeInfo = Attributes::SceneTableSize::TypeInfo; TypeInfo::DecodableType cppValue; @@ -316,20 +315,38 @@ static id _Nullable DecodeAttributeValueForScenesCluster(AttributeId aAttributeI value = [NSNumber numberWithUnsignedShort:cppValue]; return value; } -#endif // MTR_ENABLE_PROVISIONAL -#if MTR_ENABLE_PROVISIONAL - case Attributes::RemainingCapacity::Id: { - using TypeInfo = Attributes::RemainingCapacity::TypeInfo; + case Attributes::FabricSceneInfo::Id: { + using TypeInfo = Attributes::FabricSceneInfo::TypeInfo; TypeInfo::DecodableType cppValue; *aError = DataModel::Decode(aReader, cppValue); if (*aError != CHIP_NO_ERROR) { return nil; } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTRScenesClusterSceneInfoStruct * newElement_0; + newElement_0 = [MTRScenesClusterSceneInfoStruct new]; + newElement_0.sceneCount = [NSNumber numberWithUnsignedChar:entry_0.sceneCount]; + newElement_0.currentScene = [NSNumber numberWithUnsignedChar:entry_0.currentScene]; + newElement_0.currentGroup = [NSNumber numberWithUnsignedShort:entry_0.currentGroup]; + newElement_0.sceneValid = [NSNumber numberWithBool:entry_0.sceneValid]; + newElement_0.remainingCapacity = [NSNumber numberWithUnsignedChar:entry_0.remainingCapacity]; + newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } return value; } -#endif // MTR_ENABLE_PROVISIONAL default: { break; } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h index 43dde2ac143c4e..87540fe81befc2 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -321,17 +321,17 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); + (void)readAttributeLastConfiguredByWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); -- (void)readAttributeSceneTableSizeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)readAttributeSceneTableSizeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_AVAILABLE(ios(17.1), macos(14.1), watchos(10.1), tvos(17.1)); - (void)subscribeAttributeSceneTableSizeWithParams:(MTRSubscribeParams *)params subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; -+ (void)readAttributeSceneTableSizeWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_AVAILABLE(ios(17.1), macos(14.1), watchos(10.1), tvos(17.1)); ++ (void)readAttributeSceneTableSizeWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_AVAILABLE(ios(17.1), macos(14.1), watchos(10.1), tvos(17.1)); -- (void)readAttributeRemainingCapacityWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; -- (void)subscribeAttributeRemainingCapacityWithParams:(MTRSubscribeParams *)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; -+ (void)readAttributeRemainingCapacityWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)readAttributeFabricSceneInfoWithParams:(MTRReadParams * _Nullable)params completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_AVAILABLE(ios(17.1), macos(14.1), watchos(10.1), tvos(17.1)); +- (void)subscribeAttributeFabricSceneInfoWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_AVAILABLE(ios(17.1), macos(14.1), watchos(10.1), tvos(17.1)); ++ (void)readAttributeFabricSceneInfoWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_AVAILABLE(ios(17.1), macos(14.1), watchos(10.1), tvos(17.1)); - (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); - (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams *)params diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm index bf7226762e2370..72079705c3d334 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm @@ -1914,22 +1914,22 @@ + (void)readAttributeSceneTableSizeWithClusterStateCache:(MTRClusterStateCacheCo completion:completion]; } -- (void)readAttributeRemainingCapacityWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeFabricSceneInfoWithParams:(MTRReadParams * _Nullable)params completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = Scenes::Attributes::RemainingCapacity::TypeInfo; + using TypeInfo = Scenes::Attributes::FabricSceneInfo::TypeInfo; [self.device _readKnownAttributeWithEndpointID:@(self.endpoint) clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) - params:nil + params:params queue:self.callbackQueue completion:completion]; } -- (void)subscribeAttributeRemainingCapacityWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeFabricSceneInfoWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = Scenes::Attributes::RemainingCapacity::TypeInfo; + using TypeInfo = Scenes::Attributes::FabricSceneInfo::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:@(self.endpoint) clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -1939,9 +1939,9 @@ - (void)subscribeAttributeRemainingCapacityWithParams:(MTRSubscribeParams * _Non subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeRemainingCapacityWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeFabricSceneInfoWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = Scenes::Attributes::RemainingCapacity::TypeInfo; + using TypeInfo = Scenes::Attributes::FabricSceneInfo::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h index d2307978241522..397569f41bbdea 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h @@ -316,8 +316,8 @@ typedef NS_ENUM(uint32_t, MTRAttributeIDType) { MTRAttributeIDTypeClusterScenesAttributeSceneValidID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000003, MTRAttributeIDTypeClusterScenesAttributeNameSupportID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000004, MTRAttributeIDTypeClusterScenesAttributeLastConfiguredByID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000005, - MTRAttributeIDTypeClusterScenesAttributeSceneTableSizeID MTR_PROVISIONALLY_AVAILABLE = 0x00000006, - MTRAttributeIDTypeClusterScenesAttributeRemainingCapacityID MTR_PROVISIONALLY_AVAILABLE = 0x00000007, + MTRAttributeIDTypeClusterScenesAttributeSceneTableSizeID MTR_AVAILABLE(ios(17.1), macos(14.1), watchos(10.1), tvos(17.1)) = 0x00000006, + MTRAttributeIDTypeClusterScenesAttributeFabricSceneInfoID MTR_AVAILABLE(ios(17.1), macos(14.1), watchos(10.1), tvos(17.1)) = 0x00000007, MTRAttributeIDTypeClusterScenesAttributeGeneratedCommandListID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = MTRAttributeIDTypeGlobalAttributeGeneratedCommandListID, MTRAttributeIDTypeClusterScenesAttributeAcceptedCommandListID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = MTRAttributeIDTypeGlobalAttributeAcceptedCommandListID, MTRAttributeIDTypeClusterScenesAttributeEventListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeEventListID, diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h index 78984c02bd52a4..7865da1a47cac6 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h @@ -160,9 +160,9 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - (NSDictionary * _Nullable)readAttributeLastConfiguredByWithParams:(MTRReadParams * _Nullable)params MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); -- (NSDictionary * _Nullable)readAttributeSceneTableSizeWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; +- (NSDictionary * _Nullable)readAttributeSceneTableSizeWithParams:(MTRReadParams * _Nullable)params MTR_AVAILABLE(ios(17.1), macos(14.1), watchos(10.1), tvos(17.1)); -- (NSDictionary * _Nullable)readAttributeRemainingCapacityWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; +- (NSDictionary * _Nullable)readAttributeFabricSceneInfoWithParams:(MTRReadParams * _Nullable)params MTR_AVAILABLE(ios(17.1), macos(14.1), watchos(10.1), tvos(17.1)); - (NSDictionary * _Nullable)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm index 3c33dee7774b9e..6a6419390a6f61 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm @@ -773,9 +773,9 @@ - (void)copySceneWithParams:(MTRScenesClusterCopySceneParams *)params expectedVa return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeScenesID) attributeID:@(MTRAttributeIDTypeClusterScenesAttributeSceneTableSizeID) params:params]; } -- (NSDictionary * _Nullable)readAttributeRemainingCapacityWithParams:(MTRReadParams * _Nullable)params +- (NSDictionary * _Nullable)readAttributeFabricSceneInfoWithParams:(MTRReadParams * _Nullable)params { - return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeScenesID) attributeID:@(MTRAttributeIDTypeClusterScenesAttributeRemainingCapacityID) params:params]; + return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeScenesID) attributeID:@(MTRAttributeIDTypeClusterScenesAttributeFabricSceneInfoID) params:params]; } - (NSDictionary * _Nullable)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h index b4f24e39d67f53..b59b01248f56df 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h @@ -33,6 +33,16 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @property (nonatomic, copy) NSArray * _Nonnull attributeValueList MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); @end +MTR_AVAILABLE(ios(17.1), macos(14.1), watchos(10.1), tvos(17.1)) +@interface MTRScenesClusterSceneInfoStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull sceneCount MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull currentScene MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull currentGroup MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull sceneValid MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull remainingCapacity MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull fabricIndex MTR_PROVISIONALLY_AVAILABLE; +@end + MTR_AVAILABLE(ios(16.2), macos(13.1), watchos(9.2), tvos(16.2)) @interface MTRDescriptorClusterDeviceTypeStruct : NSObject @property (nonatomic, copy) NSNumber * _Nonnull deviceType MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm index 9a4b63d7f67cc4..a29fa88cdbfe08 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm @@ -99,6 +99,48 @@ - (NSNumber * _Nonnull)clusterId @end +@implementation MTRScenesClusterSceneInfoStruct +- (instancetype)init +{ + if (self = [super init]) { + + _sceneCount = @(0); + + _currentScene = @(0); + + _currentGroup = @(0); + + _sceneValid = @(0); + + _remainingCapacity = @(0); + + _fabricIndex = @(0); + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRScenesClusterSceneInfoStruct alloc] init]; + + other.sceneCount = self.sceneCount; + other.currentScene = self.currentScene; + other.currentGroup = self.currentGroup; + other.sceneValid = self.sceneValid; + other.remainingCapacity = self.remainingCapacity; + other.fabricIndex = self.fabricIndex; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: sceneCount:%@; currentScene:%@; currentGroup:%@; sceneValid:%@; remainingCapacity:%@; fabricIndex:%@; >", NSStringFromClass([self class]), _sceneCount, _currentScene, _currentGroup, _sceneValid, _remainingCapacity, _fabricIndex]; + return descriptionString; +} + +@end + @implementation MTRDescriptorClusterDeviceTypeStruct - (instancetype)init { 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 c59f529bde4a5f..d1960c517c0e9a 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 @@ -924,6 +924,93 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } } // namespace ExtensionFieldSet + +namespace SceneInfoStruct { +CHIP_ERROR Type::EncodeForWrite(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + return DoEncode(aWriter, aTag, NullOptional); +} + +CHIP_ERROR Type::EncodeForRead(TLV::TLVWriter & aWriter, TLV::Tag aTag, FabricIndex aAccessingFabricIndex) const +{ + return DoEncode(aWriter, aTag, MakeOptional(aAccessingFabricIndex)); +} + +CHIP_ERROR Type::DoEncode(TLV::TLVWriter & aWriter, TLV::Tag aTag, const Optional & aAccessingFabricIndex) const +{ + bool includeSensitive = !aAccessingFabricIndex.HasValue() || (aAccessingFabricIndex.Value() == fabricIndex); + + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + + encoder.Encode(to_underlying(Fields::kSceneCount), sceneCount); + if (includeSensitive) + { + encoder.Encode(to_underlying(Fields::kCurrentScene), currentScene); + } + if (includeSensitive) + { + encoder.Encode(to_underlying(Fields::kCurrentGroup), currentGroup); + } + if (includeSensitive) + { + encoder.Encode(to_underlying(Fields::kSceneValid), sceneValid); + } + encoder.Encode(to_underlying(Fields::kRemainingCapacity), remainingCapacity); + if (aAccessingFabricIndex.HasValue()) + { + encoder.Encode(to_underlying(Fields::kFabricIndex), fabricIndex); + } + + return encoder.Finalize(); +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + detail::StructDecodeIterator __iterator(reader); + while (true) + { + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kSceneCount)) + { + err = DataModel::Decode(reader, sceneCount); + } + else if (__context_tag == to_underlying(Fields::kCurrentScene)) + { + err = DataModel::Decode(reader, currentScene); + } + else if (__context_tag == to_underlying(Fields::kCurrentGroup)) + { + err = DataModel::Decode(reader, currentGroup); + } + else if (__context_tag == to_underlying(Fields::kSceneValid)) + { + err = DataModel::Decode(reader, sceneValid); + } + else if (__context_tag == to_underlying(Fields::kRemainingCapacity)) + { + err = DataModel::Decode(reader, remainingCapacity); + } + else if (__context_tag == to_underlying(Fields::kFabricIndex)) + { + err = DataModel::Decode(reader, fabricIndex); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} + +} // namespace SceneInfoStruct } // namespace Structs namespace Commands { @@ -1804,8 +1891,8 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre return DataModel::Decode(reader, lastConfiguredBy); case Attributes::SceneTableSize::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, sceneTableSize); - case Attributes::RemainingCapacity::TypeInfo::GetAttributeId(): - return DataModel::Decode(reader, remainingCapacity); + case Attributes::FabricSceneInfo::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, fabricSceneInfo); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): 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 26ad7ac20b2b50..9b6db6dcc8c09c 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 @@ -967,6 +967,45 @@ struct DecodableType }; } // namespace ExtensionFieldSet +namespace SceneInfoStruct { +enum class Fields : uint8_t +{ + kSceneCount = 0, + kCurrentScene = 1, + kCurrentGroup = 2, + kSceneValid = 3, + kRemainingCapacity = 4, + kFabricIndex = 254, +}; + +struct Type +{ +public: + uint8_t sceneCount = static_cast(0); + uint8_t currentScene = static_cast(0); + chip::GroupId currentGroup = static_cast(0); + bool sceneValid = static_cast(0); + uint8_t remainingCapacity = static_cast(0); + chip::FabricIndex fabricIndex = static_cast(0); + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = true; + + auto GetFabricIndex() const { return fabricIndex; } + + void SetFabricIndex(chip::FabricIndex fabricIndex_) { fabricIndex = fabricIndex_; } + + CHIP_ERROR EncodeForWrite(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; + CHIP_ERROR EncodeForRead(TLV::TLVWriter & aWriter, TLV::Tag aTag, FabricIndex aAccessingFabricIndex) const; + +private: + CHIP_ERROR DoEncode(TLV::TLVWriter & aWriter, TLV::Tag aTag, const Optional & aAccessingFabricIndex) const; +}; + +using DecodableType = Type; + +} // namespace SceneInfoStruct } // namespace Structs namespace Commands { @@ -1892,18 +1931,19 @@ struct TypeInfo static constexpr bool MustUseTimedWrite() { return false; } }; } // namespace SceneTableSize -namespace RemainingCapacity { +namespace FabricSceneInfo { struct TypeInfo { - using Type = uint8_t; - using DecodableType = uint8_t; - using DecodableArgType = uint8_t; + using Type = chip::app::DataModel::List; + using DecodableType = chip::app::DataModel::DecodableList; + using DecodableArgType = + const chip::app::DataModel::DecodableList &; static constexpr ClusterId GetClusterId() { return Clusters::Scenes::Id; } - static constexpr AttributeId GetAttributeId() { return Attributes::RemainingCapacity::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::FabricSceneInfo::Id; } static constexpr bool MustUseTimedWrite() { return false; } }; -} // namespace RemainingCapacity +} // namespace FabricSceneInfo namespace GeneratedCommandList { struct TypeInfo : public Clusters::Globals::Attributes::GeneratedCommandList::TypeInfo { @@ -1955,8 +1995,8 @@ struct TypeInfo Attributes::SceneValid::TypeInfo::DecodableType sceneValid = static_cast(0); Attributes::NameSupport::TypeInfo::DecodableType nameSupport = static_cast(0); Attributes::LastConfiguredBy::TypeInfo::DecodableType lastConfiguredBy; - Attributes::SceneTableSize::TypeInfo::DecodableType sceneTableSize = static_cast(0); - Attributes::RemainingCapacity::TypeInfo::DecodableType remainingCapacity = static_cast(0); + Attributes::SceneTableSize::TypeInfo::DecodableType sceneTableSize = static_cast(0); + Attributes::FabricSceneInfo::TypeInfo::DecodableType fabricSceneInfo; Attributes::GeneratedCommandList::TypeInfo::DecodableType generatedCommandList; Attributes::AcceptedCommandList::TypeInfo::DecodableType acceptedCommandList; Attributes::EventList::TypeInfo::DecodableType eventList; diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h b/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h index c636d2caa06ee1..e1403810da02e3 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h @@ -158,9 +158,9 @@ namespace SceneTableSize { static constexpr AttributeId Id = 0x00000006; } // namespace SceneTableSize -namespace RemainingCapacity { +namespace FabricSceneInfo { static constexpr AttributeId Id = 0x00000007; -} // namespace RemainingCapacity +} // namespace FabricSceneInfo namespace GeneratedCommandList { static constexpr AttributeId Id = Globals::Attributes::GeneratedCommandList::Id; diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index bd1852ca31af5a..00613ee916de27 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -501,7 +501,7 @@ class GroupsAddGroupIfIdentifying : public ClusterCommand | * NameSupport | 0x0004 | | * LastConfiguredBy | 0x0005 | | * SceneTableSize | 0x0006 | -| * RemainingCapacity | 0x0007 | +| * FabricSceneInfo | 0x0007 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | @@ -11636,7 +11636,7 @@ void registerClusterScenes(Commands & commands, CredentialIssuerCommands * creds make_unique(Id, "name-support", Attributes::NameSupport::Id, credsIssuerConfig), // make_unique(Id, "last-configured-by", Attributes::LastConfiguredBy::Id, credsIssuerConfig), // make_unique(Id, "scene-table-size", Attributes::SceneTableSize::Id, credsIssuerConfig), // - make_unique(Id, "remaining-capacity", Attributes::RemainingCapacity::Id, credsIssuerConfig), // + make_unique(Id, "fabric-scene-info", Attributes::FabricSceneInfo::Id, credsIssuerConfig), // make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // make_unique(Id, "event-list", Attributes::EventList::Id, credsIssuerConfig), // @@ -11659,8 +11659,9 @@ void registerClusterScenes(Commands & commands, CredentialIssuerCommands * creds credsIssuerConfig), // make_unique>(Id, "scene-table-size", 0, UINT16_MAX, Attributes::SceneTableSize::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>(Id, "remaining-capacity", 0, UINT8_MAX, Attributes::RemainingCapacity::Id, - WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique< + WriteAttributeAsComplex>>( + Id, "fabric-scene-info", Attributes::FabricSceneInfo::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>>( Id, "generated-command-list", Attributes::GeneratedCommandList::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // @@ -11682,7 +11683,7 @@ void registerClusterScenes(Commands & commands, CredentialIssuerCommands * creds make_unique(Id, "name-support", Attributes::NameSupport::Id, credsIssuerConfig), // make_unique(Id, "last-configured-by", Attributes::LastConfiguredBy::Id, credsIssuerConfig), // make_unique(Id, "scene-table-size", Attributes::SceneTableSize::Id, credsIssuerConfig), // - make_unique(Id, "remaining-capacity", Attributes::RemainingCapacity::Id, credsIssuerConfig), // + make_unique(Id, "fabric-scene-info", Attributes::FabricSceneInfo::Id, credsIssuerConfig), // make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // make_unique(Id, "event-list", Attributes::EventList::Id, credsIssuerConfig), // diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp index e0c1360460b1c7..c10ed54691d243 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp @@ -283,6 +283,66 @@ void ComplexArgumentParser::Finalize(chip::app::Clusters::Scenes::Structs::Exten ComplexArgumentParser::Finalize(request.attributeValueList); } +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::Scenes::Structs::SceneInfoStruct::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + // Copy to track which members we already processed. + Json::Value valueCopy(value); + + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("SceneInfoStruct.sceneCount", "sceneCount", value.isMember("sceneCount"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("SceneInfoStruct.currentScene", "currentScene", value.isMember("currentScene"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("SceneInfoStruct.currentGroup", "currentGroup", value.isMember("currentGroup"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("SceneInfoStruct.sceneValid", "sceneValid", value.isMember("sceneValid"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("SceneInfoStruct.remainingCapacity", "remainingCapacity", + value.isMember("remainingCapacity"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "sceneCount"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.sceneCount, value["sceneCount"])); + valueCopy.removeMember("sceneCount"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "currentScene"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.currentScene, value["currentScene"])); + valueCopy.removeMember("currentScene"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "currentGroup"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.currentGroup, value["currentGroup"])); + valueCopy.removeMember("currentGroup"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "sceneValid"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.sceneValid, value["sceneValid"])); + valueCopy.removeMember("sceneValid"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "remainingCapacity"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.remainingCapacity, value["remainingCapacity"])); + valueCopy.removeMember("remainingCapacity"); + + if (value.isMember("fabricIndex")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "fabricIndex"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.fabricIndex, value["fabricIndex"])); + } + valueCopy.removeMember("fabricIndex"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::Scenes::Structs::SceneInfoStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.sceneCount); + ComplexArgumentParser::Finalize(request.currentScene); + ComplexArgumentParser::Finalize(request.currentGroup); + ComplexArgumentParser::Finalize(request.sceneValid); + ComplexArgumentParser::Finalize(request.remainingCapacity); + ComplexArgumentParser::Finalize(request.fabricIndex); +} + CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::Descriptor::Structs::DeviceTypeStruct::Type & request, Json::Value & value) diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h index 6a9f327de7492c..f4a094e14786db 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h @@ -61,6 +61,11 @@ static CHIP_ERROR Setup(const char * label, chip::app::Clusters::Scenes::Structs static void Finalize(chip::app::Clusters::Scenes::Structs::ExtensionFieldSet::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::Scenes::Structs::SceneInfoStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::Scenes::Structs::SceneInfoStruct::Type & request); + static CHIP_ERROR Setup(const char * label, chip::app::Clusters::Descriptor::Structs::DeviceTypeStruct::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 ae45b6d5ef70c7..3435ea34e49976 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -237,6 +237,63 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, return CHIP_NO_ERROR; } +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const chip::app::Clusters::Scenes::Structs::SceneInfoStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("SceneCount", indent + 1, value.sceneCount); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'SceneCount'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("CurrentScene", indent + 1, value.currentScene); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'CurrentScene'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("CurrentGroup", indent + 1, value.currentGroup); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'CurrentGroup'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("SceneValid", indent + 1, value.sceneValid); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'SceneValid'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("RemainingCapacity", indent + 1, value.remainingCapacity); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'RemainingCapacity'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("FabricIndex", indent + 1, value.fabricIndex); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'FabricIndex'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const chip::app::Clusters::Descriptor::Structs::DeviceTypeStruct::DecodableType & value) { @@ -5211,10 +5268,10 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("SceneTableSize", 1, value); } - case Scenes::Attributes::RemainingCapacity::Id: { - uint8_t value; + case Scenes::Attributes::FabricSceneInfo::Id: { + chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("RemainingCapacity", 1, value); + return DataModelLogger::LogValue("FabricSceneInfo", 1, value); } case Scenes::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; 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 96f8b52b007164..ea11c6d735f09e 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h @@ -44,6 +44,9 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::Scenes::Structs::ExtensionFieldSet::DecodableType & value); +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::Scenes::Structs::SceneInfoStruct::DecodableType & value); + static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::Descriptor::Structs::DeviceTypeStruct::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 ab996359816e33..d55c3f0b2c0ec8 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -1895,7 +1895,7 @@ class SubscribeAttributeGroupsClusterRevision : public SubscribeAttribute { | * NameSupport | 0x0004 | | * LastConfiguredBy | 0x0005 | | * SceneTableSize | 0x0006 | -| * RemainingCapacity | 0x0007 | +| * FabricSceneInfo | 0x0007 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | @@ -3010,8 +3010,6 @@ class SubscribeAttributeScenesLastConfiguredBy : public SubscribeAttribute { } }; -#if MTR_ENABLE_PROVISIONAL - /* * Attribute SceneTableSize */ @@ -3094,38 +3092,39 @@ class SubscribeAttributeScenesSceneTableSize : public SubscribeAttribute { } }; -#endif // MTR_ENABLE_PROVISIONAL -#if MTR_ENABLE_PROVISIONAL - /* - * Attribute RemainingCapacity + * Attribute FabricSceneInfo */ -class ReadScenesRemainingCapacity : public ReadAttribute { +class ReadScenesFabricSceneInfo : public ReadAttribute { public: - ReadScenesRemainingCapacity() - : ReadAttribute("remaining-capacity") + ReadScenesFabricSceneInfo() + : ReadAttribute("fabric-scene-info") { } - ~ReadScenesRemainingCapacity() + ~ReadScenesFabricSceneInfo() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Scenes::Id; - constexpr chip::AttributeId attributeId = chip::app::Clusters::Scenes::Attributes::RemainingCapacity::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::Scenes::Attributes::FabricSceneInfo::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeRemainingCapacityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Scenes.RemainingCapacity response %@", [value description]); + __auto_type * params = [[MTRReadParams alloc] init]; + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + [cluster readAttributeFabricSceneInfoWithParams:params completion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"Scenes.FabricSceneInfo response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { - LogNSError("Scenes RemainingCapacity read Error", error); + LogNSError("Scenes FabricSceneInfo read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); @@ -3134,21 +3133,21 @@ class ReadScenesRemainingCapacity : public ReadAttribute { } }; -class SubscribeAttributeScenesRemainingCapacity : public SubscribeAttribute { +class SubscribeAttributeScenesFabricSceneInfo : public SubscribeAttribute { public: - SubscribeAttributeScenesRemainingCapacity() - : SubscribeAttribute("remaining-capacity") + SubscribeAttributeScenesFabricSceneInfo() + : SubscribeAttribute("fabric-scene-info") { } - ~SubscribeAttributeScenesRemainingCapacity() + ~SubscribeAttributeScenesFabricSceneInfo() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Scenes::Id; - constexpr chip::CommandId attributeId = chip::app::Clusters::Scenes::Attributes::RemainingCapacity::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::Scenes::Attributes::FabricSceneInfo::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); @@ -3163,10 +3162,10 @@ class SubscribeAttributeScenesRemainingCapacity : public SubscribeAttribute { if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } - [cluster subscribeAttributeRemainingCapacityWithParams:params + [cluster subscribeAttributeFabricSceneInfoWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Scenes.RemainingCapacity response %@", [value description]); + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"Scenes.FabricSceneInfo response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { @@ -3179,8 +3178,6 @@ class SubscribeAttributeScenesRemainingCapacity : public SubscribeAttribute { } }; -#endif // MTR_ENABLE_PROVISIONAL - /* * Attribute GeneratedCommandList */ @@ -153445,14 +153442,10 @@ void registerClusterScenes(Commands & commands) make_unique(), // make_unique(), // make_unique(), // -#if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // -#endif // MTR_ENABLE_PROVISIONAL -#if MTR_ENABLE_PROVISIONAL - make_unique(), // - make_unique(), // -#endif // MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // make_unique(), // make_unique(), // make_unique(), // diff --git a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h index 3d3737a78c4347..ebae9107d79a7b 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h @@ -171495,136 +171495,176 @@ class Test_TC_S_1_1 : public TestCommandBridge { err = TestStep2ReadClusterRevisionGlobalAttribute65533_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Step 3a: Read FeatureMap (global attribute 65532)\n"); + ChipLogProgress(chipTool, " ***** Test Step 2 : Step 3a: Read FeatureMap NameSupport bit (global attribute 65532)\n"); if (ShouldSkip("(!S.S.F00)")) { NextTest(); return; } - err = TestStep3aReadFeatureMapGlobalAttribute65532_2(); + err = TestStep3aReadFeatureMapNameSupportBitGlobalAttribute65532_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Step 3a: Read FeatureMap (global attribute 65532)\n"); + ChipLogProgress(chipTool, " ***** Test Step 3 : Step 3a: Read FeatureMap NameSupport bit (global attribute 65532)\n"); if (ShouldSkip("S.S.F00")) { NextTest(); return; } - err = TestStep3aReadFeatureMapGlobalAttribute65532_3(); + err = TestStep3aReadFeatureMapNameSupportBitGlobalAttribute65532_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Step 3b: Read FeatureMap (global attribute 65532)\n"); - err = TestStep3bReadFeatureMapGlobalAttribute65532_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Step 3b: Read FeatureMap Explicit bit (global attribute 65532)\n"); + if (ShouldSkip("(!S.S.F01)")) { + NextTest(); + return; + } + err = TestStep3bReadFeatureMapExplicitBitGlobalAttribute65532_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Step 3c: Read FeatureMap (global attribute 65532)\n"); - err = TestStep3cReadFeatureMapGlobalAttribute65532_5(); + ChipLogProgress(chipTool, " ***** Test Step 5 : Step 3b: Read FeatureMap Explicit bit (global attribute 65532)\n"); + if (ShouldSkip("S.S.F01")) { + NextTest(); + return; + } + err = TestStep3bReadFeatureMapExplicitBitGlobalAttribute65532_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Step 4: Read Mandatory attributes in AttributeList (global attribute 65531)\n"); - if (ShouldSkip("S.S")) { + ChipLogProgress(chipTool, " ***** Test Step 6 : Step 3c: Read FeatureMap TableSize bit (global attribute 65532)\n"); + if (ShouldSkip("(!S.S.F02)")) { NextTest(); return; } - err = TestStep4ReadMandatoryAttributesInAttributeListGlobalAttribute65531_6(); + err = TestStep3cReadFeatureMapTableSizeBitGlobalAttribute65532_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Step 4b: Read optional attributes(SceneCount, CurrentScene, CurrentGroup, SceneValid) in AttributeList (global attribute 65531)\n"); - if (ShouldSkip("(!S.S.F03)")) { + ChipLogProgress(chipTool, " ***** Test Step 7 : Step 3c: Read FeatureMap TableSize bit (global attribute 65532)\n"); + if (ShouldSkip("S.S.F02")) { NextTest(); return; } - err = TestStep4bReadOptionalAttributesSceneCountCurrentSceneCurrentGroupSceneValidInAttributeListGlobalAttribute65531_7(); + err = TestStep3cReadFeatureMapTableSizeBitGlobalAttribute65532_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Step 4c: Read optinnal attribute(LastConfiguredBy) in AttributeList (global attribute 65531)\n"); - if (ShouldSkip("S.S.A0005")) { + ChipLogProgress(chipTool, " ***** Test Step 8 : Step 3d: Read FeatureMap FabricScene bit (global attribute 65532)\n"); + if (ShouldSkip("(!S.S.F03)")) { NextTest(); return; } - err = TestStep4cReadOptinnalAttributeLastConfiguredByInAttributeListGlobalAttribute65531_8(); + err = TestStep3dReadFeatureMapFabricSceneBitGlobalAttribute65532_8(); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Step 4d: Read optionnal attribute(SceneTableSize) in AttributeList (global attribute 65531)\n"); - if (ShouldSkip("S.S.F02")) { + ChipLogProgress(chipTool, " ***** Test Step 9 : Step 3d: Read FeatureMap FabricScene bit (global attribute 65532)\n"); + if (ShouldSkip("S.S.F03")) { NextTest(); return; } - err = TestStep4dReadOptionnalAttributeSceneTableSizeInAttributeListGlobalAttribute65531_9(); + err = TestStep3dReadFeatureMapFabricSceneBitGlobalAttribute65532_9(); break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Step 4e: Read optional attribute(FabricSceneInfo) in AttributeList (global attribute 65531)\n"); - if (ShouldSkip("S.S.F03")) { + ChipLogProgress(chipTool, " ***** Test Step 10 : Step 4: Read Mandatory attributes in AttributeList (global attribute 65531)\n"); + if (ShouldSkip("S.S")) { NextTest(); return; } - err = TestStep4eReadOptionalAttributeFabricSceneInfoInAttributeListGlobalAttribute65531_10(); + err = TestStep4ReadMandatoryAttributesInAttributeListGlobalAttribute65531_10(); break; case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Step 5: Read EventList (global attribute 65530)\n"); - if (ShouldSkip("PICS_EVENT_LIST_ENABLED")) { + ChipLogProgress(chipTool, " ***** Test Step 11 : Step 4b: Read optional attributes(SceneCount, CurrentScene, CurrentGroup, SceneValid) in AttributeList (global attribute 65531)\n"); + if (ShouldSkip("(!S.S.F03)")) { NextTest(); return; } - NextTest(); - return; + err = TestStep4bReadOptionalAttributesSceneCountCurrentSceneCurrentGroupSceneValidInAttributeListGlobalAttribute65531_11(); + break; case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Step 6a: Read Mandatory commands in AcceptedCommandList (global attribute 65529)\n"); - if (ShouldSkip("S.S")) { + ChipLogProgress(chipTool, " ***** Test Step 12 : Step 4c: Read optinnal attribute(LastConfiguredBy) in AttributeList (global attribute 65531)\n"); + if (ShouldSkip("S.S.A0005")) { NextTest(); return; } - err = TestStep6aReadMandatoryCommandsInAcceptedCommandListGlobalAttribute65529_12(); + err = TestStep4cReadOptinnalAttributeLastConfiguredByInAttributeListGlobalAttribute65531_12(); break; case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Step 6b: Read optional command(EnhancedAddSceneResponse) AcceptedCommandList (global attribute 65529)\n"); - if (ShouldSkip("S.S.C40.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 13 : Step 4d: Read optionnal attribute(SceneTableSize) in AttributeList (global attribute 65531)\n"); + if (ShouldSkip("S.S.F02")) { NextTest(); return; } - err = TestStep6bReadOptionalCommandEnhancedAddSceneResponseAcceptedCommandListGlobalAttribute65529_13(); + err = TestStep4dReadOptionnalAttributeSceneTableSizeInAttributeListGlobalAttribute65531_13(); break; case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Step 6c: Read optional command(EnhancedViewSceneResponse) AcceptedCommandList (global attribute 65529)\n"); - if (ShouldSkip("S.S.C41.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 14 : Step 4e: Read optional attribute(FabricSceneInfo) in AttributeList (global attribute 65531)\n"); + if (ShouldSkip("S.S.F03")) { NextTest(); return; } - err = TestStep6cReadOptionalCommandEnhancedViewSceneResponseAcceptedCommandListGlobalAttribute65529_14(); + err = TestStep4eReadOptionalAttributeFabricSceneInfoInAttributeListGlobalAttribute65531_14(); break; case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Step 6d: Read optional command(CopySceneResponse) AcceptedCommandList (global attribute 65529)\n"); - if (ShouldSkip("S.S.C42.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 15 : Step 5: Read EventList (global attribute 65530)\n"); + if (ShouldSkip("PICS_EVENT_LIST_ENABLED")) { NextTest(); return; } - err = TestStep6dReadOptionalCommandCopySceneResponseAcceptedCommandListGlobalAttribute65529_15(); - break; + NextTest(); + return; case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Step 7a: Read GeneratedCommandList (global attribute 65528)\n"); - err = TestStep7aReadGeneratedCommandListGlobalAttribute65528_16(); + ChipLogProgress(chipTool, " ***** Test Step 16 : Step 6a: Read Mandatory commands in AcceptedCommandList (global attribute 65529)\n"); + if (ShouldSkip("S.S")) { + NextTest(); + return; + } + err = TestStep6aReadMandatoryCommandsInAcceptedCommandListGlobalAttribute65529_16(); break; case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : Step 7b: Read optional command(EnhancedAddSceneResponse) in GeneratedCommandList (global attribute 65528)\n"); + ChipLogProgress(chipTool, " ***** Test Step 17 : Step 6b: Read optional command(EnhancedAddSceneResponse) AcceptedCommandList (global attribute 65529)\n"); if (ShouldSkip("S.S.C40.Rsp")) { NextTest(); return; } - err = TestStep7bReadOptionalCommandEnhancedAddSceneResponseInGeneratedCommandListGlobalAttribute65528_17(); + err = TestStep6bReadOptionalCommandEnhancedAddSceneResponseAcceptedCommandListGlobalAttribute65529_17(); break; case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : Step 7c: Read optional command(EnhancedViewSceneResponse) in GeneratedCommandList (global attribute 65528)\n"); + ChipLogProgress(chipTool, " ***** Test Step 18 : Step 6c: Read optional command(EnhancedViewSceneResponse) AcceptedCommandList (global attribute 65529)\n"); if (ShouldSkip("S.S.C41.Rsp")) { NextTest(); return; } - err = TestStep7cReadOptionalCommandEnhancedViewSceneResponseInGeneratedCommandListGlobalAttribute65528_18(); + err = TestStep6cReadOptionalCommandEnhancedViewSceneResponseAcceptedCommandListGlobalAttribute65529_18(); break; case 19: - ChipLogProgress(chipTool, " ***** Test Step 19 : Step 7d: Read optional command(CopySceneResponse) in GeneratedCommandList (global attribute 65528)\n"); + ChipLogProgress(chipTool, " ***** Test Step 19 : Step 6d: Read optional command(CopySceneResponse) AcceptedCommandList (global attribute 65529)\n"); if (ShouldSkip("S.S.C42.Rsp")) { NextTest(); return; } - err = TestStep7dReadOptionalCommandCopySceneResponseInGeneratedCommandListGlobalAttribute65528_19(); + err = TestStep6dReadOptionalCommandCopySceneResponseAcceptedCommandListGlobalAttribute65529_19(); + break; + case 20: + ChipLogProgress(chipTool, " ***** Test Step 20 : Step 7a: Read GeneratedCommandList (global attribute 65528)\n"); + err = TestStep7aReadGeneratedCommandListGlobalAttribute65528_20(); + break; + case 21: + ChipLogProgress(chipTool, " ***** Test Step 21 : Step 7b: Read optional command(EnhancedAddSceneResponse) in GeneratedCommandList (global attribute 65528)\n"); + if (ShouldSkip("S.S.C40.Rsp")) { + NextTest(); + return; + } + err = TestStep7bReadOptionalCommandEnhancedAddSceneResponseInGeneratedCommandListGlobalAttribute65528_21(); + break; + case 22: + ChipLogProgress(chipTool, " ***** Test Step 22 : Step 7c: Read optional command(EnhancedViewSceneResponse) in GeneratedCommandList (global attribute 65528)\n"); + if (ShouldSkip("S.S.C41.Rsp")) { + NextTest(); + return; + } + err = TestStep7cReadOptionalCommandEnhancedViewSceneResponseInGeneratedCommandListGlobalAttribute65528_22(); + break; + case 23: + ChipLogProgress(chipTool, " ***** Test Step 23 : Step 7d: Read optional command(CopySceneResponse) in GeneratedCommandList (global attribute 65528)\n"); + if (ShouldSkip("S.S.C42.Rsp")) { + NextTest(); + return; + } + err = TestStep7dReadOptionalCommandCopySceneResponseInGeneratedCommandListGlobalAttribute65528_23(); break; } @@ -171697,6 +171737,18 @@ class Test_TC_S_1_1 : public TestCommandBridge { case 19: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 21: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 22: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 23: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; } // Go on to the next test. @@ -171707,7 +171759,7 @@ class Test_TC_S_1_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 20; + const uint16_t mTestCount = 24; chip::Optional mNodeId; chip::Optional mCluster; @@ -171746,7 +171798,7 @@ class Test_TC_S_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep3aReadFeatureMapGlobalAttribute65532_2() + CHIP_ERROR TestStep3aReadFeatureMapNameSupportBitGlobalAttribute65532_2() { MTRBaseDevice * device = GetDevice("alpha"); @@ -171754,7 +171806,7 @@ class Test_TC_S_1_1 : public TestCommandBridge { VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Step 3a: Read FeatureMap (global attribute 65532) Error: %@", err); + NSLog(@"Step 3a: Read FeatureMap NameSupport bit (global attribute 65532) Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -171765,7 +171817,7 @@ class Test_TC_S_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep3aReadFeatureMapGlobalAttribute65532_3() + CHIP_ERROR TestStep3aReadFeatureMapNameSupportBitGlobalAttribute65532_3() { MTRBaseDevice * device = GetDevice("alpha"); @@ -171773,7 +171825,7 @@ class Test_TC_S_1_1 : public TestCommandBridge { VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Step 3a: Read FeatureMap (global attribute 65532) Error: %@", err); + NSLog(@"Step 3a: Read FeatureMap NameSupport bit (global attribute 65532) Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -171784,7 +171836,7 @@ class Test_TC_S_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep3bReadFeatureMapGlobalAttribute65532_4() + CHIP_ERROR TestStep3bReadFeatureMapExplicitBitGlobalAttribute65532_4() { MTRBaseDevice * device = GetDevice("alpha"); @@ -171792,7 +171844,7 @@ class Test_TC_S_1_1 : public TestCommandBridge { VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Step 3b: Read FeatureMap (global attribute 65532) Error: %@", err); + NSLog(@"Step 3b: Read FeatureMap Explicit bit (global attribute 65532) Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -171803,7 +171855,7 @@ class Test_TC_S_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep3cReadFeatureMapGlobalAttribute65532_5() + CHIP_ERROR TestStep3bReadFeatureMapExplicitBitGlobalAttribute65532_5() { MTRBaseDevice * device = GetDevice("alpha"); @@ -171811,7 +171863,7 @@ class Test_TC_S_1_1 : public TestCommandBridge { VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Step 3c: Read FeatureMap (global attribute 65532) Error: %@", err); + NSLog(@"Step 3b: Read FeatureMap Explicit bit (global attribute 65532) Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -171822,7 +171874,83 @@ class Test_TC_S_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep4ReadMandatoryAttributesInAttributeListGlobalAttribute65531_6() + CHIP_ERROR TestStep3cReadFeatureMapTableSizeBitGlobalAttribute65532_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 3c: Read FeatureMap TableSize bit (global attribute 65532) Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep3cReadFeatureMapTableSizeBitGlobalAttribute65532_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 3c: Read FeatureMap TableSize bit (global attribute 65532) Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep3dReadFeatureMapFabricSceneBitGlobalAttribute65532_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 3d: Read FeatureMap FabricScene bit (global attribute 65532) Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep3dReadFeatureMapFabricSceneBitGlobalAttribute65532_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 3d: Read FeatureMap FabricScene bit (global attribute 65532) Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep4ReadMandatoryAttributesInAttributeListGlobalAttribute65531_10() { MTRBaseDevice * device = GetDevice("alpha"); @@ -171848,7 +171976,7 @@ class Test_TC_S_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep4bReadOptionalAttributesSceneCountCurrentSceneCurrentGroupSceneValidInAttributeListGlobalAttribute65531_7() + CHIP_ERROR TestStep4bReadOptionalAttributesSceneCountCurrentSceneCurrentGroupSceneValidInAttributeListGlobalAttribute65531_11() { MTRBaseDevice * device = GetDevice("alpha"); @@ -171872,7 +172000,7 @@ class Test_TC_S_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep4cReadOptinnalAttributeLastConfiguredByInAttributeListGlobalAttribute65531_8() + CHIP_ERROR TestStep4cReadOptinnalAttributeLastConfiguredByInAttributeListGlobalAttribute65531_12() { MTRBaseDevice * device = GetDevice("alpha"); @@ -171893,7 +172021,7 @@ class Test_TC_S_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep4dReadOptionnalAttributeSceneTableSizeInAttributeListGlobalAttribute65531_9() + CHIP_ERROR TestStep4dReadOptionnalAttributeSceneTableSizeInAttributeListGlobalAttribute65531_13() { MTRBaseDevice * device = GetDevice("alpha"); @@ -171914,7 +172042,7 @@ class Test_TC_S_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep4eReadOptionalAttributeFabricSceneInfoInAttributeListGlobalAttribute65531_10() + CHIP_ERROR TestStep4eReadOptionalAttributeFabricSceneInfoInAttributeListGlobalAttribute65531_14() { MTRBaseDevice * device = GetDevice("alpha"); @@ -171935,7 +172063,7 @@ class Test_TC_S_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep6aReadMandatoryCommandsInAcceptedCommandListGlobalAttribute65529_12() + CHIP_ERROR TestStep6aReadMandatoryCommandsInAcceptedCommandListGlobalAttribute65529_16() { MTRBaseDevice * device = GetDevice("alpha"); @@ -171962,7 +172090,7 @@ class Test_TC_S_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep6bReadOptionalCommandEnhancedAddSceneResponseAcceptedCommandListGlobalAttribute65529_13() + CHIP_ERROR TestStep6bReadOptionalCommandEnhancedAddSceneResponseAcceptedCommandListGlobalAttribute65529_17() { MTRBaseDevice * device = GetDevice("alpha"); @@ -171983,7 +172111,7 @@ class Test_TC_S_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep6cReadOptionalCommandEnhancedViewSceneResponseAcceptedCommandListGlobalAttribute65529_14() + CHIP_ERROR TestStep6cReadOptionalCommandEnhancedViewSceneResponseAcceptedCommandListGlobalAttribute65529_18() { MTRBaseDevice * device = GetDevice("alpha"); @@ -172004,7 +172132,7 @@ class Test_TC_S_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep6dReadOptionalCommandCopySceneResponseAcceptedCommandListGlobalAttribute65529_15() + CHIP_ERROR TestStep6dReadOptionalCommandCopySceneResponseAcceptedCommandListGlobalAttribute65529_19() { MTRBaseDevice * device = GetDevice("alpha"); @@ -172025,7 +172153,7 @@ class Test_TC_S_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep7aReadGeneratedCommandListGlobalAttribute65528_16() + CHIP_ERROR TestStep7aReadGeneratedCommandListGlobalAttribute65528_20() { MTRBaseDevice * device = GetDevice("alpha"); @@ -172051,7 +172179,7 @@ class Test_TC_S_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep7bReadOptionalCommandEnhancedAddSceneResponseInGeneratedCommandListGlobalAttribute65528_17() + CHIP_ERROR TestStep7bReadOptionalCommandEnhancedAddSceneResponseInGeneratedCommandListGlobalAttribute65528_21() { MTRBaseDevice * device = GetDevice("alpha"); @@ -172072,7 +172200,7 @@ class Test_TC_S_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep7cReadOptionalCommandEnhancedViewSceneResponseInGeneratedCommandListGlobalAttribute65528_18() + CHIP_ERROR TestStep7cReadOptionalCommandEnhancedViewSceneResponseInGeneratedCommandListGlobalAttribute65528_22() { MTRBaseDevice * device = GetDevice("alpha"); @@ -172093,7 +172221,7 @@ class Test_TC_S_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep7dReadOptionalCommandCopySceneResponseInGeneratedCommandListGlobalAttribute65528_19() + CHIP_ERROR TestStep7dReadOptionalCommandCopySceneResponseInGeneratedCommandListGlobalAttribute65528_23() { MTRBaseDevice * device = GetDevice("alpha"); @@ -172161,7 +172289,7 @@ class Test_TC_S_2_1 : public TestCommandBridge { break; case 1: ChipLogProgress(chipTool, " ***** Test Step 1 : Step 2: TH reads from the DUT the (0x0000) SceneCount attribute\n"); - if (ShouldSkip("S.S.A0000")) { + if (ShouldSkip("S.S.A0000 && (!S.S.F03)")) { NextTest(); return; } @@ -172169,7 +172297,7 @@ class Test_TC_S_2_1 : public TestCommandBridge { break; case 2: ChipLogProgress(chipTool, " ***** Test Step 2 : Step 3: TH reads from the DUT the (0x0001) CurrentScene attribute\n"); - if (ShouldSkip("S.S.A0001")) { + if (ShouldSkip("S.S.A0001 && (!S.S.F03)")) { NextTest(); return; } @@ -172177,7 +172305,7 @@ class Test_TC_S_2_1 : public TestCommandBridge { break; case 3: ChipLogProgress(chipTool, " ***** Test Step 3 : Step 4: TH reads from the DUT the (0x0002) CurrentGroup attribute\n"); - if (ShouldSkip("S.S.A0002")) { + if (ShouldSkip("S.S.A0002 && (!S.S.F03)")) { NextTest(); return; } @@ -172185,7 +172313,7 @@ class Test_TC_S_2_1 : public TestCommandBridge { break; case 4: ChipLogProgress(chipTool, " ***** Test Step 4 : Step 5: TH reads from the DUT the (0x0003) SceneValid attribute\n"); - if (ShouldSkip("S.S.A0003")) { + if (ShouldSkip("S.S.A0003 && (!S.S.F03)")) { NextTest(); return; } @@ -172193,7 +172321,7 @@ class Test_TC_S_2_1 : public TestCommandBridge { break; case 5: ChipLogProgress(chipTool, " ***** Test Step 5 : Step 6: TH reads from the DUT the (0x0004) NameSupport attribute\n"); - if (ShouldSkip("S.S.A0003 && S.S.F00")) { + if (ShouldSkip("S.S.A0004 && S.S.F00")) { NextTest(); return; } @@ -172224,12 +172352,12 @@ class Test_TC_S_2_1 : public TestCommandBridge { err = TestStep8ThReadsFromTheDutThe0x0006SceneTableSizeAttribute_8(); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Step 9: TH reads from the DUT the (0x0007) RemainingCapacity attribute\n"); + ChipLogProgress(chipTool, " ***** Test Step 9 : Step 9: TH reads from the DUT the (0x0007) FabricSceneInfo attribute\n"); if (ShouldSkip("S.S.A0007")) { NextTest(); return; } - err = TestStep9ThReadsFromTheDutThe0x0007RemainingCapacityAttribute_9(); + err = TestStep9ThReadsFromTheDutThe0x0007FabricSceneInfoAttribute_9(); break; } @@ -172463,19 +172591,21 @@ class Test_TC_S_2_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep9ThReadsFromTheDutThe0x0007RemainingCapacityAttribute_9() + CHIP_ERROR TestStep9ThReadsFromTheDutThe0x0007FabricSceneInfoAttribute_9() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeRemainingCapacityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Step 9: TH reads from the DUT the (0x0007) RemainingCapacity attribute Error: %@", err); + __auto_type * params = [[MTRReadParams alloc] init]; + params.filterByFabric = true; + [cluster readAttributeFabricSceneInfoWithParams:params completion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 9: TH reads from the DUT the (0x0007) FabricSceneInfo attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("remainingCapacity", "int8u", "int8u")); + VerifyOrReturn(CheckConstraintType("fabricSceneInfo", "list", "list")); NextTest(); }];