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 913ee8f94361eb..91ceabe5dcbdef 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 @@ -143,14 +143,19 @@ provisional server cluster Scenes = 5 { AttributeValuePair attributeValueList[] = 1; } - readonly attribute int8u sceneCount = 0; - readonly attribute int8u currentScene = 1; - readonly attribute group_id currentGroup = 2; - readonly attribute boolean sceneValid = 3; + 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 NameSupportBitmap 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; @@ -5672,19 +5677,15 @@ 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 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; @@ -6756,19 +6757,15 @@ 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 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 399b7db732f304..5f391a52fa267a 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 @@ -6626,70 +6626,6 @@ } ], "attributes": [ - { - "name": "SceneCount", - "code": 0, - "mfgCode": null, - "side": "server", - "type": "int8u", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x00", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "CurrentScene", - "code": 1, - "mfgCode": null, - "side": "server", - "type": "int8u", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x00", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "CurrentGroup", - "code": 2, - "mfgCode": null, - "side": "server", - "type": "group_id", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x0000", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "SceneValid", - "code": 3, - "mfgCode": null, - "side": "server", - "type": "boolean", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x00", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, { "name": "NameSupport", "code": 4, @@ -6739,16 +6675,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, @@ -6828,7 +6764,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "7", + "defaultValue": "15", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -20218,70 +20154,6 @@ } ], "attributes": [ - { - "name": "SceneCount", - "code": 0, - "mfgCode": null, - "side": "server", - "type": "int8u", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x00", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "CurrentScene", - "code": 1, - "mfgCode": null, - "side": "server", - "type": "int8u", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x00", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "CurrentGroup", - "code": 2, - "mfgCode": null, - "side": "server", - "type": "group_id", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x0000", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "SceneValid", - "code": 3, - "mfgCode": null, - "side": "server", - "type": "boolean", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x00", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, { "name": "NameSupport", "code": 4, @@ -20331,16 +20203,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, @@ -20420,7 +20292,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "7", + "defaultValue": "15", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -21713,6 +21585,7 @@ "endpointId": 65534, "networkId": 0 } - ], - "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 392b37d411a586..cbb1b7efd20700 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 @@ -143,14 +143,19 @@ provisional server cluster Scenes = 5 { AttributeValuePair attributeValueList[] = 1; } - readonly attribute int8u sceneCount = 0; - readonly attribute int8u currentScene = 1; - readonly attribute group_id currentGroup = 2; - readonly attribute boolean sceneValid = 3; + 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 NameSupportBitmap 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; @@ -4424,19 +4429,15 @@ 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 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; @@ -4988,18 +4989,14 @@ 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 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 c2bfea5a86981c..fd7ef67ad59ac9 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 @@ -4665,70 +4665,6 @@ } ], "attributes": [ - { - "name": "SceneCount", - "code": 0, - "mfgCode": null, - "side": "server", - "type": "int8u", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x00", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "CurrentScene", - "code": 1, - "mfgCode": null, - "side": "server", - "type": "int8u", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x00", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "CurrentGroup", - "code": 2, - "mfgCode": null, - "side": "server", - "type": "group_id", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x0000", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "SceneValid", - "code": 3, - "mfgCode": null, - "side": "server", - "type": "boolean", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x00", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, { "name": "NameSupport", "code": 4, @@ -4736,7 +4672,7 @@ "side": "server", "type": "NameSupportBitmap", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "0x80", @@ -4752,7 +4688,7 @@ "side": "server", "type": "node_id", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -4768,7 +4704,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "16", @@ -4778,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, @@ -4867,7 +4803,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "7", + "defaultValue": "15", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -10965,70 +10901,6 @@ } ], "attributes": [ - { - "name": "SceneCount", - "code": 0, - "mfgCode": null, - "side": "server", - "type": "int8u", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x00", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "CurrentScene", - "code": 1, - "mfgCode": null, - "side": "server", - "type": "int8u", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x00", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "CurrentGroup", - "code": 2, - "mfgCode": null, - "side": "server", - "type": "group_id", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x0000", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "SceneValid", - "code": 3, - "mfgCode": null, - "side": "server", - "type": "boolean", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x00", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, { "name": "NameSupport", "code": 4, @@ -11036,7 +10908,7 @@ "side": "server", "type": "NameSupportBitmap", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "0x80", @@ -11052,7 +10924,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "16", @@ -11062,16 +10934,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, @@ -11151,7 +11023,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "7", + "defaultValue": "15", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -12380,6 +12252,7 @@ "endpointId": 65534, "networkId": 0 } - ], - "log": [] -} \ No newline at end of file + ] +} + + diff --git a/examples/chef/devices/template.zap b/examples/chef/devices/template.zap index 5fa73bfadf0056..13c8c53c8cc328 100644 --- a/examples/chef/devices/template.zap +++ b/examples/chef/devices/template.zap @@ -2390,70 +2390,6 @@ } ], "attributes": [ - { - "name": "SceneCount", - "code": 0, - "mfgCode": null, - "side": "server", - "type": "int8u", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x00", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "CurrentScene", - "code": 1, - "mfgCode": null, - "side": "server", - "type": "int8u", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x00", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "CurrentGroup", - "code": 2, - "mfgCode": null, - "side": "server", - "type": "group_id", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x0000", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "SceneValid", - "code": 3, - "mfgCode": null, - "side": "server", - "type": "boolean", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x00", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "NameSupport", "code": 4, diff --git a/examples/darwin-framework-tool/templates/tests/ciTests.json b/examples/darwin-framework-tool/templates/tests/ciTests.json index fb15c5e8e92e37..1bc430a981a730 100644 --- a/examples/darwin-framework-tool/templates/tests/ciTests.json +++ b/examples/darwin-framework-tool/templates/tests/ciTests.json @@ -62,6 +62,8 @@ "Test_TC_FLW_2_1", "Test_TC_RH_2_1", "Disabled because darwin-framework-tool does not handle substraction in parameters", - "Test_TC_S_2_3" + "Test_TC_S_2_3", + "TestScenesMultiFabric", + "TestScenesFabricSceneInfo" ] } 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 c7476b3a6a752a..3619291c024505 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 @@ -191,14 +191,23 @@ provisional client cluster Scenes = 5 { AttributeValuePair attributeValueList[] = 1; } - readonly attribute int8u sceneCount = 0; - readonly attribute int8u currentScene = 1; - readonly attribute group_id currentGroup = 2; - readonly attribute boolean sceneValid = 3; + 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 optional int8u sceneCount = 0; + readonly attribute optional int8u currentScene = 1; + readonly attribute optional group_id currentGroup = 2; + readonly attribute optional boolean sceneValid = 3; readonly attribute NameSupportBitmap 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 5fb2132362fdf5..9d5ac549470cbc 100644 --- a/examples/lighting-app/lighting-common/lighting-app.matter +++ b/examples/lighting-app/lighting-common/lighting-app.matter @@ -143,14 +143,19 @@ provisional server cluster Scenes = 5 { AttributeValuePair attributeValueList[] = 1; } - readonly attribute int8u sceneCount = 0; - readonly attribute int8u currentScene = 1; - readonly attribute group_id currentGroup = 2; - readonly attribute boolean sceneValid = 3; + 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 NameSupportBitmap 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; @@ -2510,18 +2515,14 @@ 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 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 c5a15271eea687..6da9e05979bbf4 100644 --- a/examples/lighting-app/lighting-common/lighting-app.zap +++ b/examples/lighting-app/lighting-common/lighting-app.zap @@ -4564,70 +4564,6 @@ } ], "attributes": [ - { - "name": "SceneCount", - "code": 0, - "mfgCode": null, - "side": "server", - "type": "int8u", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x00", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "CurrentScene", - "code": 1, - "mfgCode": null, - "side": "server", - "type": "int8u", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x00", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "CurrentGroup", - "code": 2, - "mfgCode": null, - "side": "server", - "type": "group_id", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x0000", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "SceneValid", - "code": 3, - "mfgCode": null, - "side": "server", - "type": "boolean", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x00", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, { "name": "NameSupport", "code": 4, @@ -4677,16 +4613,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, @@ -4750,7 +4686,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 61289243f3e194..0e86b5ec1dd408 100644 --- a/examples/lighting-app/silabs/data_model/lighting-thread-app.matter +++ b/examples/lighting-app/silabs/data_model/lighting-thread-app.matter @@ -143,14 +143,19 @@ provisional server cluster Scenes = 5 { AttributeValuePair attributeValueList[] = 1; } - readonly attribute int8u sceneCount = 0; - readonly attribute int8u currentScene = 1; - readonly attribute group_id currentGroup = 2; - readonly attribute boolean sceneValid = 3; + 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 NameSupportBitmap 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; @@ -2526,19 +2531,15 @@ 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 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 e74bff2c9a5061..850576d9647ba9 100644 --- a/examples/lighting-app/silabs/data_model/lighting-thread-app.zap +++ b/examples/lighting-app/silabs/data_model/lighting-thread-app.zap @@ -4104,70 +4104,6 @@ } ], "attributes": [ - { - "name": "SceneCount", - "code": 0, - "mfgCode": null, - "side": "server", - "type": "int8u", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x00", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "CurrentScene", - "code": 1, - "mfgCode": null, - "side": "server", - "type": "int8u", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x00", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "CurrentGroup", - "code": 2, - "mfgCode": null, - "side": "server", - "type": "group_id", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x0000", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "SceneValid", - "code": 3, - "mfgCode": null, - "side": "server", - "type": "boolean", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x00", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, { "name": "NameSupport", "code": 4, @@ -4175,7 +4111,7 @@ "side": "server", "type": "NameSupportBitmap", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "0x80", @@ -4191,7 +4127,7 @@ "side": "server", "type": "node_id", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -4207,7 +4143,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "16", @@ -4217,16 +4153,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, @@ -4303,10 +4239,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, @@ -5964,6 +5900,7 @@ "endpointId": 1, "networkId": 0 } - ], - "log": [] -} \ 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 a27bc1c315dbe6..f853bf5e8e30ee 100644 --- a/examples/lighting-app/silabs/data_model/lighting-wifi-app.matter +++ b/examples/lighting-app/silabs/data_model/lighting-wifi-app.matter @@ -143,14 +143,19 @@ provisional server cluster Scenes = 5 { AttributeValuePair attributeValueList[] = 1; } - readonly attribute int8u sceneCount = 0; - readonly attribute int8u currentScene = 1; - readonly attribute group_id currentGroup = 2; - readonly attribute boolean sceneValid = 3; + 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 NameSupportBitmap 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; @@ -2366,19 +2371,15 @@ 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 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 a300edcca5e122..93b568a897ddd9 100644 --- a/examples/lighting-app/silabs/data_model/lighting-wifi-app.zap +++ b/examples/lighting-app/silabs/data_model/lighting-wifi-app.zap @@ -3280,70 +3280,6 @@ } ], "attributes": [ - { - "name": "SceneCount", - "code": 0, - "mfgCode": null, - "side": "server", - "type": "int8u", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x00", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "CurrentScene", - "code": 1, - "mfgCode": null, - "side": "server", - "type": "int8u", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x00", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "CurrentGroup", - "code": 2, - "mfgCode": null, - "side": "server", - "type": "group_id", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x0000", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "SceneValid", - "code": 3, - "mfgCode": null, - "side": "server", - "type": "boolean", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x00", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, { "name": "NameSupport", "code": 4, @@ -3393,16 +3329,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, @@ -3482,7 +3418,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 479a2afde597a9..3d8f9135409136 100644 --- a/examples/placeholder/linux/apps/app1/config.matter +++ b/examples/placeholder/linux/apps/app1/config.matter @@ -191,13 +191,18 @@ provisional server cluster Scenes = 5 { AttributeValuePair attributeValueList[] = 1; } - readonly attribute int8u sceneCount = 0; - readonly attribute int8u currentScene = 1; - readonly attribute group_id currentGroup = 2; - readonly attribute boolean sceneValid = 3; + 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 NameSupportBitmap 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; @@ -7435,17 +7440,13 @@ 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; 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 e8aa35532dc7ac..39b1315aee410e 100644 --- a/examples/placeholder/linux/apps/app1/config.zap +++ b/examples/placeholder/linux/apps/app1/config.zap @@ -11909,70 +11909,6 @@ } ], "attributes": [ - { - "name": "SceneCount", - "code": 0, - "mfgCode": null, - "side": "server", - "type": "int8u", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x00", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "CurrentScene", - "code": 1, - "mfgCode": null, - "side": "server", - "type": "int8u", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x00", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "CurrentGroup", - "code": 2, - "mfgCode": null, - "side": "server", - "type": "group_id", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x0000", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "SceneValid", - "code": 3, - "mfgCode": null, - "side": "server", - "type": "boolean", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x00", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "NameSupport", "code": 4, @@ -12006,16 +11942,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, @@ -12079,7 +12015,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 7e769bff6bca25..284ec9f396972b 100644 --- a/examples/placeholder/linux/apps/app2/config.matter +++ b/examples/placeholder/linux/apps/app2/config.matter @@ -191,13 +191,18 @@ provisional server cluster Scenes = 5 { AttributeValuePair attributeValueList[] = 1; } - readonly attribute int8u sceneCount = 0; - readonly attribute int8u currentScene = 1; - readonly attribute group_id currentGroup = 2; - readonly attribute boolean sceneValid = 3; + 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 NameSupportBitmap 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; @@ -7399,17 +7404,13 @@ 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; 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 cc205cd4014202..3417feb3df0ecc 100644 --- a/examples/placeholder/linux/apps/app2/config.zap +++ b/examples/placeholder/linux/apps/app2/config.zap @@ -11991,70 +11991,6 @@ } ], "attributes": [ - { - "name": "SceneCount", - "code": 0, - "mfgCode": null, - "side": "server", - "type": "int8u", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x00", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "CurrentScene", - "code": 1, - "mfgCode": null, - "side": "server", - "type": "int8u", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x00", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "CurrentGroup", - "code": 2, - "mfgCode": null, - "side": "server", - "type": "group_id", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x0000", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "SceneValid", - "code": 3, - "mfgCode": null, - "side": "server", - "type": "boolean", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x00", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "NameSupport", "code": 4, @@ -12088,16 +12024,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, @@ -12161,7 +12097,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 ccdf315a7bc2e3..10116d1df8f824 100644 --- a/examples/thermostat/nxp/zap/thermostat_matter_thread.matter +++ b/examples/thermostat/nxp/zap/thermostat_matter_thread.matter @@ -185,13 +185,18 @@ provisional server cluster Scenes = 5 { AttributeValuePair attributeValueList[] = 1; } - readonly attribute int8u sceneCount = 0; - readonly attribute int8u currentScene = 1; - readonly attribute group_id currentGroup = 2; - readonly attribute boolean sceneValid = 3; + 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 NameSupportBitmap 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; @@ -2128,14 +2133,10 @@ 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; 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 b05a0a97330cfd..cd687ebbd28424 100644 --- a/examples/thermostat/nxp/zap/thermostat_matter_thread.zap +++ b/examples/thermostat/nxp/zap/thermostat_matter_thread.zap @@ -3884,70 +3884,6 @@ } ], "attributes": [ - { - "name": "SceneCount", - "code": 0, - "mfgCode": null, - "side": "server", - "type": "int8u", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x00", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "CurrentScene", - "code": 1, - "mfgCode": null, - "side": "server", - "type": "int8u", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x00", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "CurrentGroup", - "code": 2, - "mfgCode": null, - "side": "server", - "type": "group_id", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x0000", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "SceneValid", - "code": 3, - "mfgCode": null, - "side": "server", - "type": "boolean", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x00", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, { "name": "NameSupport", "code": 4, @@ -3981,13 +3917,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": "", @@ -4006,7 +3942,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 bfc51fd9e47895..eac0acc054d276 100644 --- a/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter +++ b/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter @@ -185,13 +185,18 @@ provisional server cluster Scenes = 5 { AttributeValuePair attributeValueList[] = 1; } - readonly attribute int8u sceneCount = 0; - readonly attribute int8u currentScene = 1; - readonly attribute group_id currentGroup = 2; - readonly attribute boolean sceneValid = 3; + 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 NameSupportBitmap 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; @@ -1982,14 +1987,10 @@ 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; 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 4983e388ce580d..c5a2a9ce6af5b0 100644 --- a/examples/thermostat/nxp/zap/thermostat_matter_wifi.zap +++ b/examples/thermostat/nxp/zap/thermostat_matter_wifi.zap @@ -3026,70 +3026,6 @@ } ], "attributes": [ - { - "name": "SceneCount", - "code": 0, - "mfgCode": null, - "side": "server", - "type": "int8u", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x00", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "CurrentScene", - "code": 1, - "mfgCode": null, - "side": "server", - "type": "int8u", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x00", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "CurrentGroup", - "code": 2, - "mfgCode": null, - "side": "server", - "type": "group_id", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x0000", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "SceneValid", - "code": 3, - "mfgCode": null, - "side": "server", - "type": "boolean", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x00", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, { "name": "NameSupport", "code": 4, @@ -3123,13 +3059,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": "", @@ -3148,7 +3084,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 7e602e50d5cc4d..d2f419d1711a31 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 @@ -143,13 +143,18 @@ provisional server cluster Scenes = 5 { AttributeValuePair attributeValueList[] = 1; } - readonly attribute int8u sceneCount = 0; - readonly attribute int8u currentScene = 1; - readonly attribute group_id currentGroup = 2; - readonly attribute boolean sceneValid = 3; + 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 NameSupportBitmap 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; @@ -2907,18 +2912,14 @@ 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; 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 db88b0e8b03a3b..35997c63e72573 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 @@ -4488,70 +4488,6 @@ } ], "attributes": [ - { - "name": "SceneCount", - "code": 0, - "mfgCode": null, - "side": "server", - "type": "int8u", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x00", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "CurrentScene", - "code": 1, - "mfgCode": null, - "side": "server", - "type": "int8u", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x00", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "CurrentGroup", - "code": 2, - "mfgCode": null, - "side": "server", - "type": "group_id", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x0000", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "SceneValid", - "code": 3, - "mfgCode": null, - "side": "server", - "type": "boolean", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x00", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "NameSupport", "code": 4, @@ -4585,16 +4521,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, @@ -4674,7 +4610,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 dec068948ba752..7cfd95cc9aa97f 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 dd8fd1525e0d67..5c987480bc96ac 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 @@ -759,8 +759,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,8 +1426,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: 2, Cluster: On/Off (server) */ \ diff --git a/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/gen_config.h b/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/gen_config.h index fc0a4d3df39f84..11f7d888fcbbd8 100644 --- a/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/gen_config.h +++ b/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/gen_config.h @@ -107,11 +107,11 @@ // Scenes FeatureMap Attribute Toggle Scenes Name feature // App cluster specs 1.4.4 #define MATTER_CLUSTER_SCENE_NAME_SUPPORT_MASK 0x0001 -#define MATTER_CLUSTER_SCENE_NAME_SUPPORT (0x0007 & MATTER_CLUSTER_SCENE_NAME_SUPPORT_MASK) +#define MATTER_CLUSTER_SCENE_NAME_SUPPORT (0x000F & MATTER_CLUSTER_SCENE_NAME_SUPPORT_MASK) // Scenes FeatureMap Table Size feature used for the MATTER_SCENES_TABLE_SIZE define // App cluster specs 1.4.4.2 #define MATTER_CLUSTER_TABLE_SIZE_SUPPORT_MASK 0x0001 -#define MATTER_CLUSTER_TABLE_SIZE_SUPPORT (0x0007 & MATTER_CLUSTER_TABLE_SIZE_SUPPORT_MASK) +#define MATTER_CLUSTER_TABLE_SIZE_SUPPORT (0x000F & MATTER_CLUSTER_TABLE_SIZE_SUPPORT_MASK) // Use this macro to check if the server side of the On/Off cluster is included #define ZCL_USING_ON_OFF_CLUSTER_SERVER 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 a89d9686824770..a2bfc1a58b794e 100644 --- a/src/app/clusters/level-control/level-control.cpp +++ b/src/app/clusters/level-control/level-control.cpp @@ -910,7 +910,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 9f8c7d66229d97..a9f13a1b7ba4cc 100644 --- a/src/app/clusters/on-off-server/on-off-server.cpp +++ b/src/app/clusters/on-off-server/on-off-server.cpp @@ -460,7 +460,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 ba171b8dc36c45..1b319399719f4c 100644 --- a/src/app/clusters/scenes-server/scenes-server.cpp +++ b/src/app/clusters/scenes-server/scenes-server.cpp @@ -47,6 +47,8 @@ namespace app { namespace Clusters { namespace Scenes { +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 @@ -96,6 +98,202 @@ CHIP_ERROR UpdateLastConfiguredBy(HandlerContext & ctx, ResponseType resp) return AddResponseOnError(ctx, resp, status); } +/// @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.ValueOr(0); + newSceneInfo.currentScene = scene.ValueOr(0); + newSceneInfo.sceneValid = sceneValid.ValueOr(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; +} + +} // namespace + +/// @brief Gets the SceneInfoStruct array associated to an endpoint +/// @param endpoint target endpoint +/// @param fabric target fabric +/// @return Optional with no value not found, Span of SceneInfoStruct +Span ScenesServer::FabricSceneInfo::GetFabricSceneInfo(EndpointId endpoint) +{ + size_t endpointIndex = 0; + Span FabricSceneInfoSpan; + CHIP_ERROR status = FindFabricSceneInfoIndex(endpoint, endpointIndex); + if (CHIP_NO_ERROR == status) + { + FabricSceneInfoSpan = + Span(&mSceneInfoStructs[endpointIndex][0], mSceneInfoStructsCount[endpointIndex]); + } + return FabricSceneInfoSpan; +} + +/// @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 fabrics 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] < ArraySize(mSceneInfoStructs[endpointIndex]), + 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(ArraySize(mSceneInfoStructs[endpointIndex]) - nextIndex); + // Compress the endpoint's SceneInfoStruct array + if (moveNum) + { + for (size_t i = 0; i < moveNum; ++i) + { + mSceneInfoStructs[endpointIndex][sceneInfoStructIndex + i] = mSceneInfoStructs[endpointIndex][nextIndex + i]; + } + } + + // Decrement the SceneInfoStruct count + mSceneInfoStructsCount[endpointIndex]--; + + // Clear the last populated SceneInfoStruct + mSceneInfoStructs[endpointIndex][mSceneInfoStructsCount[endpointIndex]].fabricIndex = kUndefinedFabricIndex; + 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 < ArraySize(mSceneInfoStructs)) + { + endpointIndex = index; + return CHIP_NO_ERROR; + } + return CHIP_ERROR_NOT_FOUND; +} + +/// @brief Returns the SceneInfoStruct associated to a fabric +/// @param[in] fabric target fabric index +/// @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] out of bounds index 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 < ArraySize(mSceneInfoStructs), 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() @@ -248,9 +446,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)); @@ -341,6 +541,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 current fabric's SceneValid false before store scenes + ScenesServer::Instance().MakeSceneInvalid(endpointID, fabricIdx); + uint16_t endpointTableSize = 0; ReturnErrorOnFailure( StatusIB(ToInteractionModelStatus(Attributes::SceneTableSize::Get(endpointID, &endpointTableSize))).ToChipError()); @@ -388,12 +591,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, MakeOptional(groupID), MakeOptional(sceneID), + MakeOptional(static_cast(true)))); return CHIP_NO_ERROR; } @@ -402,6 +602,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()); @@ -434,9 +637,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; } @@ -492,43 +695,50 @@ 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 { + Span FabricSceneInfoSpan = mFabricSceneInfo.GetFabricSceneInfo(aPath.mEndpointId); + for (auto & info : FabricSceneInfoSpan) + { + ReturnErrorOnFailure(encoder.Encode(info)); + } + 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); @@ -540,28 +750,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) @@ -590,6 +800,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); @@ -636,11 +853,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 && req.groupID == sceneInfo->currentGroup && req.sceneID == sceneInfo->currentScene) + { + sceneValid.Emplace(false); + } 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); @@ -675,8 +901,19 @@ 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 && req.groupID == sceneInfo->currentGroup) + { + sceneValid.Emplace(false); + } + + ReturnOnFailure( + AddResponseOnError(ctx, response, + UpdateFabricSceneInfo(ctx.mRequestPath.mEndpointId, ctx.mCommandHandler.GetAccessingFabricIndex(), + Optional(), Optional(), sceneValid))); ReturnOnFailure(UpdateLastConfiguredBy(ctx, response)); @@ -689,9 +926,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; @@ -701,8 +935,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)); } @@ -712,21 +944,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; } @@ -862,9 +1085,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)); @@ -883,8 +1108,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)); @@ -935,6 +1162,13 @@ void emberAfScenesClusterServerInitCallback(EndpointId endpoint) { ChipLogDetail(Zcl, "ERR: setting LastConfiguredBy on Endpoint %hu Status: %x", endpoint, status); } + + // 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()); + } } void MatterScenesClusterServerShutdownCallback(EndpointId endpoint) diff --git a/src/app/clusters/scenes-server/scenes-server.h b/src/app/clusters/scenes-server/scenes-server.h index a96d1dc29ce3ca..d8501318eabfe2 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: + Span 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/TestScenesFabricSceneInfo.yaml b/src/app/tests/suites/TestScenesFabricSceneInfo.yaml new file mode 100644 index 00000000000000..8c211e43d94f40 --- /dev/null +++ b/src/app/tests/suites/TestScenesFabricSceneInfo.yaml @@ -0,0 +1,577 @@ +# 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. + +# !!!!!!!!!! TEST INFORMATION !!!!!!!!!!!!!!!!!! +# This test file tests the FabricSceneInfo attribute of the scenes cluster + +name: Scenes FabricSceneInfo testing + +PICS: + - MCORE.ROLE.COMMISSIONEE + - APPDEVICE.S + - S.S + - S.S.F03 + - S.S.A0007 + +config: + nodeId: 0x12344321 + cluster: "Scenes" + endpoint: 1 + payload: + type: char_string + defaultValue: "MT:-24J0AFN00KA0648G00" + discriminator: + type: int16u + defaultValue: 3840 + waitAfterCommissioning: + type: int16u + defaultValue: 5000 + PakeVerifier: + type: octet_string + defaultValue: "hex:b96170aae803346884724fe9a3b287c30330c2a660375d17bb205a8cf1aecb350457f8ab79ee253ab6a8e46bb09e543ae422736de501e3db37d441fe344920d09548e4c18240630c4ff4913c53513839b7c07fcc0627a1b8573a149fcd1fa466cf" + G1: + type: group_id + defaultValue: 0x0001 + G2: + type: group_id + defaultValue: 0x0002 + +tests: + - label: "Commission DUT to TH1" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "TH1 reads the fabric index" + cluster: "Operational Credentials" + endpoint: 0 + command: "readAttribute" + attribute: "CurrentFabricIndex" + response: + saveAs: th1FabricIndex + + - label: "Read FeatureMap FabricScene bit (global attribute 65532)" + command: "readAttribute" + attribute: "FeatureMap" + response: + constraints: + type: bitmap32 + hasMasksSet: [0x8] + + - label: "Read the FabricSceneInfo attribute (0x0007) " + command: "readAttribute" + attribute: "FabricSceneInfo" + response: + constraints: + type: list + + - label: "TH reads from the DUT the (0x0006) SceneTableSize attribute" + command: "readAttribute" + attribute: "SceneTableSize" + response: + values: + - name: "SceneTableSize" + saveAs: maxScenes + + - label: "Arithmetic operation to get the maxScenes - 1" + cluster: "Unit Testing" + command: "TestAddArguments" + arguments: + values: + - name: "arg1" + value: maxScenes - 1 + - name: "arg2" + value: 0 + response: + values: + - name: "returnValue" + saveAs: maxScenesMinusOne + value: maxScenes - 1 + + - label: "Arithmetic operation to get the fabric Capacity" + cluster: "Unit Testing" + command: "TestAddArguments" + arguments: + values: + - name: "arg1" + value: maxScenesMinusOne / 2 + - name: "arg2" + value: 0 + response: + values: + - name: "returnValue" + saveAs: fabricCapacity + value: maxScenesMinusOne / 2 + - label: "Preparation step :Add Group KeySet." + cluster: "Group Key Management" + endpoint: 0 + command: "KeySetWrite" + arguments: + values: + - name: "GroupKeySet" + value: + { + GroupKeySetID: 0x01a1, + GroupKeySecurityPolicy: 0, + EpochKey0: "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf", + EpochStartTime0: 1110000, + EpochKey1: "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf", + EpochStartTime1: 1110001, + EpochKey2: "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf", + EpochStartTime2: 1110002, + } + + - label: "Preparation step for using the Write Group Keys command." + cluster: "Group Key Management" + endpoint: 0 + command: "writeAttribute" + attribute: "GroupKeyMap" + arguments: + value: + [ + { FabricIndex: 0, GroupId: G1, GroupKeySetID: 0x01a1 }, + { FabricIndex: 0, GroupId: G2, GroupKeySetID: 0x01a1 }, + ] + + - label: "TH sends a RemoveAllGroups command to DUT." + cluster: "Groups" + command: "RemoveAllGroups" + + - label: "TH sends a AddGroup command to DUT for G1." + cluster: "Groups" + command: "AddGroup" + arguments: + values: + - name: "GroupID" + value: G1 + - name: "GroupName" + value: "Group1" + response: + values: + - name: "Status" + value: 0 + - name: "GroupID" + value: G1 + + - label: "TH sends a AddGroup command to DUT for G2." + cluster: "Groups" + command: "AddGroup" + arguments: + values: + - name: "GroupID" + value: G2 + - name: "GroupName" + value: "Group2" + response: + values: + - name: "Status" + value: 0 + - name: "GroupID" + value: G2 + + - label: "TH confirms the Fabric Capacity is Maximum" + command: "GetSceneMembership" + arguments: + values: + - name: "GroupID" + value: G1 + response: + values: + - name: "Status" + value: 0x00 + - name: "Capacity" + value: fabricCapacity + - name: "GroupID" + value: G1 + + - label: "TH sends an AddScene command to DUT for Scene 1 G1" + command: "AddScene" + arguments: + values: + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x01 + - name: "TransitionTime" + value: 0x0001 + - name: "SceneName" + value: "Scene1" + - name: "ExtensionFieldSets" + value: + [ + { + ClusterID: 0x0006, + AttributeValueList: + [{ AttributeID: 0x0000, AttributeValue: 0x01 }], + }, + { + ClusterID: 0x0008, + AttributeValueList: + [{ AttributeID: 0x0000, AttributeValue: 0x64 }], + }, + ] + response: + values: + - name: "Status" + value: 0x00 + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x01 + + - label: + "TH confirms the Scene was added to the Scene table by + GetSceneMembership" + command: "GetSceneMembership" + arguments: + values: + - name: "GroupID" + value: G1 + response: + values: + - name: "Status" + value: 0x00 + - name: "Capacity" + value: fabricCapacity -1 + - name: "GroupID" + value: G1 + + - label: "TH confirms the Scene Was properly added with ViewScene" + command: "ViewScene" + arguments: + values: + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x01 + response: + values: + - name: "Status" + value: 0x00 + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x01 + - name: "TransitionTime" + value: 0x0001 + - name: "ExtensionFieldSets" + value: + [ + { + ClusterID: 0x0006, + AttributeValueList: + [{ AttributeID: 0x0000, AttributeValue: 0x01 }], + }, + { + ClusterID: 0x0008, + AttributeValueList: + [{ AttributeID: 0x0000, AttributeValue: 0x64 }], + }, + ] + + - label: "Read the FabricSceneInfo attribute (0x0007) " + command: "readAttribute" + attribute: "FabricSceneInfo" + response: + value: + [ + { + SceneCount: 1, + CurrentScene: 0x00, + CurrentGroup: 0x00, + FabricIndex: th1FabricIndex, + SceneValid: false, + RemainingCapacity: fabricCapacity - 1, + }, + ] + + - label: "TH sends a RecallScene command for Scene 1 Group 1" + command: "RecallScene" + arguments: + values: + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x01 + + - label: "Confirm the FabricSceneInfo attribute was properly updated" + command: "readAttribute" + attribute: "FabricSceneInfo" + response: + value: + [ + { + SceneCount: 1, + CurrentScene: 0x01, + CurrentGroup: G1, + FabricIndex: th1FabricIndex, + SceneValid: true, + RemainingCapacity: fabricCapacity - 1, + }, + ] + + - label: "TH sends an AddScene command to DUT for Scene 1 G1" + command: "AddScene" + arguments: + values: + - name: "GroupID" + value: G2 + - name: "SceneID" + value: 0x01 + - name: "TransitionTime" + value: 0x0002 + - name: "SceneName" + value: "Scene1" + - name: "ExtensionFieldSets" + value: + [ + { + ClusterID: 0x0006, + AttributeValueList: + [{ AttributeID: 0x0000, AttributeValue: 0x00 }], + }, + { + ClusterID: 0x0008, + AttributeValueList: + [{ AttributeID: 0x0000, AttributeValue: 0xFA }], + }, + ] + + - label: "TH confirms the Scene Was properly added with ViewScene" + command: "ViewScene" + arguments: + values: + - name: "GroupID" + value: G2 + - name: "SceneID" + value: 0x01 + response: + values: + - name: "Status" + value: 0x00 + - name: "GroupID" + value: G2 + - name: "SceneID" + value: 0x01 + - name: "TransitionTime" + value: 0x0002 + - name: "ExtensionFieldSets" + value: + [ + { + ClusterID: 0x0006, + AttributeValueList: + [{ AttributeID: 0x0000, AttributeValue: 0x00 }], + }, + { + ClusterID: 0x0008, + AttributeValueList: + [{ AttributeID: 0x0000, AttributeValue: 0xFA }], + }, + ] + + - label: "Confirm the FabricSceneInfo attribute was properly updated" + command: "readAttribute" + attribute: "FabricSceneInfo" + response: + value: + [ + { + SceneCount: 2, + CurrentScene: 0x01, + CurrentGroup: G1, + FabricIndex: th1FabricIndex, + SceneValid: true, + RemainingCapacity: fabricCapacity - 2, + }, + ] + + - label: "TH sends a RecallScene command for Scene 1 Group 2" + command: "RecallScene" + arguments: + values: + - name: "GroupID" + value: G2 + - name: "SceneID" + value: 0x01 + + - label: "Confirm the FabricSceneInfo attribute was properly updated" + command: "readAttribute" + attribute: "FabricSceneInfo" + response: + value: + [ + { + SceneCount: 2, + CurrentScene: 0x01, + CurrentGroup: G2, + FabricIndex: th1FabricIndex, + SceneValid: true, + RemainingCapacity: fabricCapacity - 2, + }, + ] + + - label: + "Configures the DUT to a different state, should invalidate the scene" + cluster: "Level Control" + command: "MoveToLevelWithOnOff" + arguments: + values: + - name: "Level" + value: 200 + - name: "TransitionTime" + value: 0 + - name: "OptionsMask" + value: 1 + - name: "OptionsOverride" + value: 1 + + - label: "Confirm the FabricSceneInfo attribute was properly updated" + command: "readAttribute" + attribute: "FabricSceneInfo" + response: + value: + [ + { + SceneCount: 2, + CurrentScene: 0x01, + CurrentGroup: G2, + FabricIndex: th1FabricIndex, + SceneValid: false, + RemainingCapacity: fabricCapacity - 2, + }, + ] + + - label: "Store the current DUT state to a new scene" + command: "StoreScene" + arguments: + values: + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x02 + response: + values: + - name: "Status" + value: 0x00 + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x02 + + - label: "Confirm the FabricSceneInfo attribute was properly updated" + command: "readAttribute" + attribute: "FabricSceneInfo" + response: + value: + [ + { + SceneCount: 3, + CurrentScene: 0x02, + CurrentGroup: G1, + FabricIndex: th1FabricIndex, + SceneValid: true, + RemainingCapacity: fabricCapacity - 3, + }, + ] + + - label: "TH sends a RecallScene command for Scene 1 Group 2" + command: "RecallScene" + arguments: + values: + - name: "GroupID" + value: G2 + - name: "SceneID" + value: 0x01 + + - label: "Confirm the FabricSceneInfo attribute was properly updated" + command: "readAttribute" + attribute: "FabricSceneInfo" + response: + value: + [ + { + SceneCount: 3, + CurrentScene: 0x01, + CurrentGroup: G2, + FabricIndex: th1FabricIndex, + SceneValid: true, + RemainingCapacity: fabricCapacity - 3, + }, + ] + + - label: "Remove Active scene" + command: "RemoveScene" + arguments: + values: + - name: "GroupID" + value: G2 + - name: "SceneID" + value: 0x01 + response: + values: + - name: "Status" + value: 0x00 + - name: "GroupID" + value: G2 + - name: "SceneID" + value: 0x01 + + - label: "Confirm the FabricSceneInfo attribute was properly updated" + command: "readAttribute" + attribute: "FabricSceneInfo" + response: + value: + [ + { + SceneCount: 2, + CurrentScene: 0x01, + CurrentGroup: G2, + FabricIndex: th1FabricIndex, + SceneValid: false, + RemainingCapacity: fabricCapacity - 2, + }, + ] + + - label: "Remove all scenes from G1" + command: "RemoveAllScenes" + arguments: + values: + - name: "GroupID" + value: G1 + response: + values: + - name: "Status" + value: 0 + - name: "GroupID" + value: G1 + + - label: "Confirm the FabricSceneInfo attribute was properly updated" + command: "readAttribute" + attribute: "FabricSceneInfo" + response: + value: + [ + { + SceneCount: 0, + CurrentScene: 0x01, + CurrentGroup: G2, + FabricIndex: th1FabricIndex, + SceneValid: false, + RemainingCapacity: fabricCapacity, + }, + ] diff --git a/src/app/tests/suites/TestScenesMultiFabric.yaml b/src/app/tests/suites/TestScenesMultiFabric.yaml new file mode 100644 index 00000000000000..803b01cdd09e6b --- /dev/null +++ b/src/app/tests/suites/TestScenesMultiFabric.yaml @@ -0,0 +1,1029 @@ +# 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. + +# !!!!!!!!!! TEST INFORMATION !!!!!!!!!!!!!!!!!! +# This test covers multi fabric support for scenes cluster attributes such as LastConfiguredBy and FabricSceneInfo + +name: Scenes Multi-fabric testing + +PICS: + - MCORE.ROLE.COMMISSIONEE + - APPDEVICE.S + - S.S + - S.S.F03 + - S.S.A0007 + +config: + nodeId: 0x12344321 + cluster: "Scenes" + endpoint: 1 + payload: + type: char_string + defaultValue: "MT:-24J0AFN00KA0648G00" + discriminator: + type: int16u + defaultValue: 3840 + waitAfterCommissioning: + type: int16u + defaultValue: 5000 + PakeVerifier: + type: octet_string + defaultValue: "hex:b96170aae803346884724fe9a3b287c30330c2a660375d17bb205a8cf1aecb350457f8ab79ee253ab6a8e46bb09e543ae422736de501e3db37d441fe344920d09548e4c18240630c4ff4913c53513839b7c07fcc0627a1b8573a149fcd1fa466cf" + G1: + type: group_id + defaultValue: 0x0001 + G2: + type: group_id + defaultValue: 0x0002 + +tests: + - label: "Commission DUT to TH1" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "TH1 reads the fabric index" + cluster: "Operational Credentials" + endpoint: 0 + command: "readAttribute" + attribute: "CurrentFabricIndex" + response: + saveAs: th1FabricIndex + + - label: "Read the commissioner node ID from the alpha fabric" + identity: "alpha" + endpoint: 0 + cluster: "CommissionerCommands" + command: "GetCommissionerNodeId" + response: + values: + - name: "nodeId" + saveAs: commissionerNodeIdAlpha + + - label: "Open Commissioning Window from alpha" + endpoint: 0 + cluster: "Administrator Commissioning" + command: "OpenCommissioningWindow" + timedInteractionTimeoutMs: 10000 + arguments: + values: + - name: "CommissioningTimeout" + value: 180 + - name: "PAKEPasscodeVerifier" + value: PakeVerifier + - name: "Discriminator" + value: discriminator + - name: "Iterations" + value: 1000 + - name: "Salt" + value: "SPAKE2P Key Salt" + + - label: "Waiting after opening commissioning window" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: waitAfterCommissioning + + - label: "Commission from TH2" + identity: "beta" + endpoint: 0 + cluster: "CommissionerCommands" + command: "PairWithCode" + arguments: + values: + - name: "nodeId" + value: nodeId + - name: "payload" + value: payload + + - label: "Wait for the commissioned device to be retrieved for TH2" + endpoint: 0 + identity: beta + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Step 4: TH2 reads the fabric index" + identity: "beta" + endpoint: 0 + cluster: "Operational Credentials" + command: "readAttribute" + attribute: "CurrentFabricIndex" + response: + saveAs: th2FabricIndex + + - label: "Read the commissioner node ID from the beta fabric" + identity: "beta" + endpoint: 0 + cluster: "CommissionerCommands" + command: "GetCommissionerNodeId" + response: + values: + - name: "nodeId" + saveAs: commissionerNodeIdBeta + + - label: "Read FeatureMap FabricScene bit (global attribute 65532)" + command: "readAttribute" + attribute: "FeatureMap" + response: + constraints: + type: bitmap32 + hasMasksSet: [0x8] + + - label: "Read the FabricSceneInfo attribute (0x0007) " + command: "readAttribute" + attribute: "FabricSceneInfo" + response: + constraints: + type: list + + - label: "TH reads from the DUT the (0x0006) SceneTableSize attribute" + command: "readAttribute" + attribute: "SceneTableSize" + response: + values: + - name: "SceneTableSize" + saveAs: maxScenes + + - label: "Arithmetic operation to get the maxScenes - 1" + cluster: "Unit Testing" + command: "TestAddArguments" + arguments: + values: + - name: "arg1" + value: maxScenes - 1 + - name: "arg2" + value: 0 + response: + values: + - name: "returnValue" + saveAs: maxScenesMinusOne + value: maxScenes - 1 + + - label: "Arithmetic operation to get the fabric Capacity" + cluster: "Unit Testing" + command: "TestAddArguments" + arguments: + values: + - name: "arg1" + value: maxScenesMinusOne / 2 + - name: "arg2" + value: 0 + response: + values: + - name: "returnValue" + saveAs: fabricCapacity + value: maxScenesMinusOne / 2 + + - label: "Preparation step : TH 1 Add Group KeySet." + cluster: "Group Key Management" + endpoint: 0 + command: "KeySetWrite" + arguments: + values: + - name: "GroupKeySet" + value: + { + GroupKeySetID: 0x01a1, + GroupKeySecurityPolicy: 0, + EpochKey0: "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf", + EpochStartTime0: 1110000, + EpochKey1: "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf", + EpochStartTime1: 1110001, + EpochKey2: "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf", + EpochStartTime2: 1110002, + } + + - label: "Preparation step TH1 Map KeySets to GroupId." + cluster: "Group Key Management" + endpoint: 0 + command: "writeAttribute" + attribute: "GroupKeyMap" + arguments: + value: + [ + { FabricIndex: 0, GroupId: G1, GroupKeySetID: 0x01a1 }, + { FabricIndex: 0, GroupId: G2, GroupKeySetID: 0x01a1 }, + ] + + - label: "TH1 sends a RemoveAllGroups command to DUT." + cluster: "Groups" + command: "RemoveAllGroups" + + - label: "TH1 sends a AddGroup command to DUT for G1." + cluster: "Groups" + command: "AddGroup" + arguments: + values: + - name: "GroupID" + value: G1 + - name: "GroupName" + value: "Group1" + response: + values: + - name: "Status" + value: 0 + - name: "GroupID" + value: G1 + + - label: "TH1 sends a AddGroup command to DUT for G2." + cluster: "Groups" + command: "AddGroup" + arguments: + values: + - name: "GroupID" + value: G2 + - name: "GroupName" + value: "Group2" + response: + values: + - name: "Status" + value: 0 + - name: "GroupID" + value: G2 + + - label: "Preparation step : TH 2 Add Group KeySet." + identity: "beta" + cluster: "Group Key Management" + endpoint: 0 + command: "KeySetWrite" + arguments: + values: + - name: "GroupKeySet" + value: + { + GroupKeySetID: 0x01a2, + GroupKeySecurityPolicy: 0, + EpochKey0: "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf", + EpochStartTime0: 1120000, + EpochKey1: "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf", + EpochStartTime1: 1120001, + EpochKey2: "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf", + EpochStartTime2: 1120002, + } + + - label: "Preparation step TH1 Map KeySets to GroupId." + identity: "beta" + cluster: "Group Key Management" + endpoint: 0 + command: "writeAttribute" + attribute: "GroupKeyMap" + arguments: + value: [{ FabricIndex: 0, GroupId: G1, GroupKeySetID: 0x01a2 }] + + - label: "TH2 sends a AddGroup command to DUT for G1." + identity: "beta" + cluster: "Groups" + command: "AddGroup" + arguments: + values: + - name: "GroupID" + value: G1 + - name: "GroupName" + value: "Group1" + response: + values: + - name: "Status" + value: 0 + - name: "GroupID" + value: G1 + + - label: "TH1 confirms the Fabric Capacity is Maximum" + command: "GetSceneMembership" + arguments: + values: + - name: "GroupID" + value: G1 + response: + values: + - name: "Status" + value: 0x00 + - name: "Capacity" + value: fabricCapacity + - name: "GroupID" + value: G1 + + - label: "TH1 Reads LastConfiguredBy attribute" + command: "readAttribute" + attribute: "LastConfiguredBy" + response: + value: null + + - label: "TH2 reads LastConfiguredBy attribute" + identity: "beta" + command: "readAttribute" + attribute: "LastConfiguredBy" + response: + value: null + + - label: "TH1 sends an AddScene command to DUT for Scene 1 G1" + command: "AddScene" + arguments: + values: + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x01 + - name: "TransitionTime" + value: 0x0001 + - name: "SceneName" + value: "Scene1" + - name: "ExtensionFieldSets" + value: + [ + { + ClusterID: 0x0006, + AttributeValueList: + [{ AttributeID: 0x0000, AttributeValue: 0x01 }], + }, + { + ClusterID: 0x0008, + AttributeValueList: + [{ AttributeID: 0x0000, AttributeValue: 0x64 }], + }, + ] + response: + values: + - name: "Status" + value: 0x00 + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x01 + + - label: + "TH1 confirms the Scene was added to the Scene table by + GetSceneMembership" + command: "GetSceneMembership" + arguments: + values: + - name: "GroupID" + value: G1 + response: + values: + - name: "Status" + value: 0x00 + - name: "Capacity" + value: fabricCapacity -1 + - name: "GroupID" + value: G1 + + - label: "TH2 confirms the Scene membership wasn't affected for fabric 2" + identity: "beta" + command: "GetSceneMembership" + arguments: + values: + - name: "GroupID" + value: G1 + response: + values: + - name: "Status" + value: 0x00 + - name: "Capacity" + value: fabricCapacity + - name: "GroupID" + value: G1 + + - label: "TH1 Read the FabricSceneInfo attribute (0x0007) " + command: "readAttribute" + attribute: "FabricSceneInfo" + response: + value: + [ + { + SceneCount: 1, + CurrentScene: 0x00, + CurrentGroup: 0x00, + FabricIndex: th1FabricIndex, + SceneValid: false, + RemainingCapacity: fabricCapacity - 1, + }, + ] + + - label: "TH2 Read the FabricSceneInfo attribute (0x0007) " + identity: "beta" + command: "readAttribute" + attribute: "FabricSceneInfo" + response: + value: [] + # TODO : Have FabricSceneInfo initialized on adding a new fabric + + - label: "TH1 reads LastConfiguredBy attribute, should be TH1's nodeId" + command: "readAttribute" + attribute: "LastConfiguredBy" + response: + value: commissionerNodeIdAlpha + + - label: "TH2 reads LastConfiguredBy attribute, should be TH1's nodeId" + identity: "beta" + command: "readAttribute" + attribute: "LastConfiguredBy" + response: + value: commissionerNodeIdAlpha + + - label: "TH2 sends an AddScene command to DUT for Scene 1 G1" + identity: "beta" + command: "AddScene" + arguments: + values: + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x01 + - name: "TransitionTime" + value: 0x0001 + - name: "SceneName" + value: "Scene1" + - name: "ExtensionFieldSets" + value: + [ + { + ClusterID: 0x0006, + AttributeValueList: + [{ AttributeID: 0x0000, AttributeValue: 0x01 }], + }, + { + ClusterID: 0x0008, + AttributeValueList: + [{ AttributeID: 0x0000, AttributeValue: 0x64 }], + }, + ] + response: + values: + - name: "Status" + value: 0x00 + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x01 + + - label: "TH1 reads LastConfiguredBy attribute, should be TH2's nodeId" + command: "readAttribute" + attribute: "LastConfiguredBy" + response: + value: commissionerNodeIdBeta + + - label: "TH2 reads LastConfiguredBy attribute, should be TH2's nodeId" + identity: "beta" + command: "readAttribute" + attribute: "LastConfiguredBy" + response: + value: commissionerNodeIdBeta + + - label: "TH2 sends a RecallScene command for Scene 1 Group 1" + identity: "beta" + command: "RecallScene" + arguments: + values: + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x01 + + - label: "TH2 confirms the FabricSceneInfo attribute was properly updated" + identity: "beta" + command: "readAttribute" + attribute: "FabricSceneInfo" + response: + value: + [ + { + SceneCount: 1, + CurrentScene: 0x01, + CurrentGroup: G1, + FabricIndex: th2FabricIndex, + SceneValid: true, + RemainingCapacity: fabricCapacity - 1, + }, + ] + + - label: + "TH1 confirms there were no change to its FabricSceneInfo attribute" + command: "readAttribute" + attribute: "FabricSceneInfo" + response: + value: + [ + { + SceneCount: 1, + CurrentScene: 0x00, + CurrentGroup: 0x00, + FabricIndex: th1FabricIndex, + SceneValid: false, + RemainingCapacity: fabricCapacity - 1, + }, + ] + + - label: "TH1 copies Scene 1 from G1 to Scene 2 in G1" + command: "CopyScene" + arguments: + values: + - name: "Mode" + value: 0x00 + - name: "GroupIdentifierFrom" + value: G1 + - name: "SceneIdentifierFrom" + value: 0x01 + - name: "GroupIdentifierTo" + value: G1 + - name: "SceneIdentifierTo" + value: 0x02 + response: + values: + - name: "Status" + value: 0x00 + - name: "GroupIdentifierFrom" + value: G1 + - name: "SceneIdentifierFrom" + value: 0x01 + + - label: "TH1 reads LastConfiguredBy attribute, should be TH1's nodeId" + command: "readAttribute" + attribute: "LastConfiguredBy" + response: + value: commissionerNodeIdAlpha + + - label: "TH2 reads LastConfiguredBy attribute, should be TH1's nodeId" + identity: "beta" + command: "readAttribute" + attribute: "LastConfiguredBy" + response: + value: commissionerNodeIdAlpha + + - label: "TH2 confirms the FabricSceneInfo didn't change" + identity: "beta" + command: "readAttribute" + attribute: "FabricSceneInfo" + response: + value: + [ + { + SceneCount: 1, + CurrentScene: 0x01, + CurrentGroup: G1, + FabricIndex: th2FabricIndex, + SceneValid: true, + RemainingCapacity: fabricCapacity - 1, + }, + ] + + - label: + "TH1 confirms the update of FabricSceneInfo attribute with scene Valid + still false" + command: "readAttribute" + attribute: "FabricSceneInfo" + response: + value: + [ + { + SceneCount: 2, + CurrentScene: 0x00, + CurrentGroup: 0x00, + FabricIndex: th1FabricIndex, + SceneValid: false, + RemainingCapacity: fabricCapacity - 2, + }, + ] + + - label: "TH2 Remove Scene 1 from G1" + identity: "beta" + command: "RemoveScene" + arguments: + values: + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x01 + response: + values: + - name: "Status" + value: 0x00 + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x01 + + - label: "TH1 reads LastConfiguredBy attribute, should be TH2's nodeId" + command: "readAttribute" + attribute: "LastConfiguredBy" + response: + value: commissionerNodeIdBeta + + - label: "TH2 reads LastConfiguredBy attribute, should be TH2's nodeId" + identity: "beta" + command: "readAttribute" + attribute: "LastConfiguredBy" + response: + value: commissionerNodeIdBeta + + - label: "TH2 confirms the FabricSceneInfo's update" + identity: "beta" + command: "readAttribute" + attribute: "FabricSceneInfo" + response: + value: + [ + { + SceneCount: 0, + CurrentScene: 0x01, + CurrentGroup: G1, + FabricIndex: th2FabricIndex, + SceneValid: false, + RemainingCapacity: fabricCapacity, + }, + ] + + - label: "TH1 confirms its FabricSceneInfo remained unchanged" + command: "readAttribute" + attribute: "FabricSceneInfo" + response: + value: + [ + { + SceneCount: 2, + CurrentScene: 0x00, + CurrentGroup: 0x00, + FabricIndex: th1FabricIndex, + SceneValid: false, + RemainingCapacity: fabricCapacity - 2, + }, + ] + + - label: "TH1 copies all Scenes from G1 to G1" + command: "CopyScene" + arguments: + values: + - name: "Mode" + value: 0x01 + - name: "GroupIdentifierFrom" + value: G1 + - name: "SceneIdentifierFrom" + value: 0x00 + - name: "GroupIdentifierTo" + value: G2 + - name: "SceneIdentifierTo" + value: 0x00 + response: + values: + - name: "Status" + value: 0x00 + - name: "GroupIdentifierFrom" + value: G1 + - name: "SceneIdentifierFrom" + value: 0x00 + + - label: "TH1 reads LastConfiguredBy attribute, should be TH1's nodeId" + command: "readAttribute" + attribute: "LastConfiguredBy" + response: + value: commissionerNodeIdAlpha + + - label: "TH2 reads LastConfiguredBy attribute, should be TH1's nodeId" + identity: "beta" + command: "readAttribute" + attribute: "LastConfiguredBy" + response: + value: commissionerNodeIdAlpha + + - label: "TH2 confirms its FabricSceneInfo remained unchanged" + identity: "beta" + command: "readAttribute" + attribute: "FabricSceneInfo" + response: + value: + [ + { + SceneCount: 0, + CurrentScene: 0x01, + CurrentGroup: G1, + FabricIndex: th2FabricIndex, + SceneValid: false, + RemainingCapacity: fabricCapacity, + }, + ] + + - label: "TH1 confirms its FabricSceneInfo was updated" + command: "readAttribute" + attribute: "FabricSceneInfo" + response: + value: + [ + { + SceneCount: 4, + CurrentScene: 0x00, + CurrentGroup: 0x00, + FabricIndex: th1FabricIndex, + SceneValid: false, + RemainingCapacity: fabricCapacity - 4, + }, + ] + + - label: "TH1 sends a RecallScene command for Scene 1 Group 2" + command: "RecallScene" + arguments: + values: + - name: "GroupID" + value: G2 + - name: "SceneID" + value: 0x01 + + - label: "TH2 confirms its FabricSceneInfo remained unchanged" + identity: "beta" + command: "readAttribute" + attribute: "FabricSceneInfo" + response: + value: + [ + { + SceneCount: 0, + CurrentScene: 0x01, + CurrentGroup: G1, + FabricIndex: th2FabricIndex, + SceneValid: false, + RemainingCapacity: fabricCapacity, + }, + ] + + - label: "TH1 confirms its FabricSceneInfo was updated" + command: "readAttribute" + attribute: "FabricSceneInfo" + response: + value: + [ + { + SceneCount: 4, + CurrentScene: 0x01, + CurrentGroup: G2, + FabricIndex: th1FabricIndex, + SceneValid: true, + RemainingCapacity: fabricCapacity - 4, + }, + ] + + - label: "TH2 Store the current DUT state to a new scene" + identity: "beta" + command: "StoreScene" + arguments: + values: + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x02 + response: + values: + - name: "Status" + value: 0x00 + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x02 + + - label: "TH1 reads LastConfiguredBy attribute, should be TH2's nodeId" + command: "readAttribute" + attribute: "LastConfiguredBy" + response: + value: commissionerNodeIdBeta + + - label: "TH2 reads LastConfiguredBy attribute, should be TH2's nodeId" + identity: "beta" + command: "readAttribute" + attribute: "LastConfiguredBy" + response: + value: commissionerNodeIdBeta + + - label: "TH2 confirms its FabricSceneInfo was updated" + identity: "beta" + command: "readAttribute" + attribute: "FabricSceneInfo" + response: + value: + [ + { + SceneCount: 1, + CurrentScene: 0x02, + CurrentGroup: G1, + FabricIndex: th2FabricIndex, + SceneValid: true, + RemainingCapacity: fabricCapacity - 1, + }, + ] + + - label: + "TH1 confirms its FabricSceneInfo's field SceneValid remains unchanged" + command: "readAttribute" + attribute: "FabricSceneInfo" + response: + value: + [ + { + SceneCount: 4, + CurrentScene: 0x01, + CurrentGroup: G2, + FabricIndex: th1FabricIndex, + SceneValid: true, + RemainingCapacity: fabricCapacity - 4, + }, + ] + + - label: "TH1 removes all scenes from G1" + command: "RemoveAllScenes" + arguments: + values: + - name: "GroupID" + value: G1 + response: + values: + - name: "Status" + value: 0 + - name: "GroupID" + value: G1 + + - label: "TH1 reads LastConfiguredBy attribute, should be TH1's nodeId" + command: "readAttribute" + attribute: "LastConfiguredBy" + response: + value: commissionerNodeIdAlpha + + - label: "TH2 reads LastConfiguredBy attribute, should be TH1's nodeId" + identity: "beta" + command: "readAttribute" + attribute: "LastConfiguredBy" + response: + value: commissionerNodeIdAlpha + + - label: "TH2 confirms its FabricSceneInfo remained unchanged" + identity: "beta" + command: "readAttribute" + attribute: "FabricSceneInfo" + response: + value: + [ + { + SceneCount: 1, + CurrentScene: 0x02, + CurrentGroup: G1, + FabricIndex: th2FabricIndex, + SceneValid: true, + RemainingCapacity: fabricCapacity - 1, + }, + ] + + - label: + "TH1 confirms its FabricSceneInfo's field SceneCount and + RemainingCapacity were updated" + command: "readAttribute" + attribute: "FabricSceneInfo" + response: + value: + [ + { + SceneCount: 2, + CurrentScene: 0x01, + CurrentGroup: G2, + FabricIndex: th1FabricIndex, + SceneValid: true, + RemainingCapacity: fabricCapacity - 2, + }, + ] + + - label: "TH2 Remove Scene 2 from G1" + identity: "beta" + command: "RemoveScene" + arguments: + values: + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x02 + response: + values: + - name: "Status" + value: 0x00 + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x02 + + - label: "TH1 reads LastConfiguredBy attribute, should be TH2's nodeId" + command: "readAttribute" + attribute: "LastConfiguredBy" + response: + value: commissionerNodeIdBeta + + - label: "TH2 reads LastConfiguredBy attribute, should be TH2's nodeId" + identity: "beta" + command: "readAttribute" + attribute: "LastConfiguredBy" + response: + value: commissionerNodeIdBeta + + - label: "TH2 confirms its FabricSceneInfo was updated" + identity: "beta" + command: "readAttribute" + attribute: "FabricSceneInfo" + response: + value: + [ + { + SceneCount: 0, + CurrentScene: 0x02, + CurrentGroup: G1, + FabricIndex: th2FabricIndex, + SceneValid: false, + RemainingCapacity: fabricCapacity, + }, + ] + + - label: "TH1 confirms its FabricSceneInfo remained unchanged" + command: "readAttribute" + attribute: "FabricSceneInfo" + response: + value: + [ + { + SceneCount: 2, + CurrentScene: 0x01, + CurrentGroup: G2, + FabricIndex: th1FabricIndex, + SceneValid: true, + RemainingCapacity: fabricCapacity - 2, + }, + ] + + - label: "TH1 removes all scenes from G2" + command: "RemoveAllScenes" + arguments: + values: + - name: "GroupID" + value: G2 + response: + values: + - name: "Status" + value: 0 + - name: "GroupID" + value: G2 + + - label: "TH1 reads LastConfiguredBy attribute, should be TH2's nodeId" + command: "readAttribute" + attribute: "LastConfiguredBy" + response: + value: commissionerNodeIdAlpha + + - label: "TH2 reads LastConfiguredBy attribute, should be TH2's nodeId" + identity: "beta" + command: "readAttribute" + attribute: "LastConfiguredBy" + response: + value: commissionerNodeIdAlpha + + - label: "TH2 confirms its FabricSceneInfo remained unchanged" + identity: "beta" + command: "readAttribute" + attribute: "FabricSceneInfo" + response: + value: + [ + { + SceneCount: 0, + CurrentScene: 0x02, + CurrentGroup: G1, + FabricIndex: th2FabricIndex, + SceneValid: false, + RemainingCapacity: fabricCapacity, + }, + ] + + - label: "TH1 confirms its FabricSceneInfo was updated" + command: "readAttribute" + attribute: "FabricSceneInfo" + response: + value: + [ + { + SceneCount: 0, + CurrentScene: 0x01, + CurrentGroup: G2, + FabricIndex: th1FabricIndex, + SceneValid: false, + RemainingCapacity: fabricCapacity, + }, + ] diff --git a/src/app/tests/suites/certification/PICS.yaml b/src/app/tests/suites/certification/PICS.yaml index 1137d1dee7c5e3..a6f9974e59d182 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..08cb955a312fc4 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,24 @@ 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 a1f900478330c4..5601e168d5ab34 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 eb629bb708fdde..77167aa6f46673 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/tests/suites/ciTests.json b/src/app/tests/suites/ciTests.json index ae696e96735391..18a069f267e33e 100644 --- a/src/app/tests/suites/ciTests.json +++ b/src/app/tests/suites/ciTests.json @@ -322,6 +322,8 @@ ], "Scenes": [ "TestScenesFabricRemoval", + "TestScenesFabricSceneInfo", + "TestScenesMultiFabric", "Test_TC_S_1_1", "Test_TC_S_2_1", "Test_TC_S_2_2", 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 69455e4de08469..b8bcbc1243a1dd 100644 --- a/src/app/zap-templates/zcl/data-model/chip/scene.xml +++ b/src/app/zap-templates/zcl/data-model/chip/scene.xml @@ -25,6 +25,15 @@ limitations under the License. + + + + + + + + + @@ -48,14 +57,14 @@ limitations under the License. true - SceneCount - CurrentScene - CurrentGroup - SceneValid + SceneCount + CurrentScene + CurrentGroup + SceneValid 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 94fe1dcf13c74d..1b60b1da72c7a5 100644 --- a/src/app/zap-templates/zcl/zcl-with-test-extensions.json +++ b/src/app/zap-templates/zcl/zcl-with-test-extensions.json @@ -225,7 +225,6 @@ "FeatureMap", "ThreadMetrics" ], - "Scenes": ["SceneCount", "RemainingCapacity"], "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 c11483efa60c19..2d91a9b10ed774 100644 --- a/src/app/zap-templates/zcl/zcl.json +++ b/src/app/zap-templates/zcl/zcl.json @@ -223,7 +223,6 @@ "FeatureMap", "ThreadMetrics" ], - "Scenes": ["SceneCount", "RemainingCapacity"], "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 1d8863d0470b01..841c4cba61e5de 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -151,14 +151,23 @@ provisional client cluster Scenes = 5 { AttributeValuePair attributeValueList[] = 1; } - readonly attribute int8u sceneCount = 0; - readonly attribute int8u currentScene = 1; - readonly attribute group_id currentGroup = 2; - readonly attribute boolean sceneValid = 3; + 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 optional int8u sceneCount = 0; + readonly attribute optional int8u currentScene = 1; + readonly attribute optional group_id currentGroup = 2; + readonly attribute optional boolean sceneValid = 3; readonly attribute NameSupportBitmap 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 727713056ff4d0..249c406fd14e3b 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java @@ -1012,7 +1012,7 @@ public static class ScenesCluster extends BaseChipCluster { private static final long NAME_SUPPORT_ATTRIBUTE_ID = 4L; private static final long LAST_CONFIGURED_BY_ATTRIBUTE_ID = 5L; private static final long SCENE_TABLE_SIZE_ATTRIBUTE_ID = 6L; - private static final long REMAINING_CAPACITY_ATTRIBUTE_ID = 7L; + private static final long FABRIC_SCENE_INFO_ATTRIBUTE_ID = 7L; private static final long GENERATED_COMMAND_LIST_ATTRIBUTE_ID = 65528L; private static final long ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID = 65529L; private static final long EVENT_LIST_ATTRIBUTE_ID = 65530L; @@ -1600,6 +1600,10 @@ public interface LastConfiguredByAttributeCallback extends BaseAttributeCallback void onSuccess(@Nullable Long value); } + public interface FabricSceneInfoAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + public interface GeneratedCommandListAttributeCallback extends BaseAttributeCallback { void onSuccess(List value); } @@ -1791,29 +1795,34 @@ public void onSuccess(byte[] tlv) { }, SCENE_TABLE_SIZE_ATTRIBUTE_ID, minInterval, maxInterval); } - public void readRemainingCapacityAttribute( - IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, REMAINING_CAPACITY_ATTRIBUTE_ID); + public void readFabricSceneInfoAttribute( + FabricSceneInfoAttributeCallback callback) { + readFabricSceneInfoAttributeWithFabricFilter(callback, true); + } + + public void readFabricSceneInfoAttributeWithFabricFilter( + FabricSceneInfoAttributeCallback callback, boolean isFabricFiltered) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, FABRIC_SCENE_INFO_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, REMAINING_CAPACITY_ATTRIBUTE_ID, true); + }, FABRIC_SCENE_INFO_ATTRIBUTE_ID, isFabricFiltered); } - public void subscribeRemainingCapacityAttribute( - IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, REMAINING_CAPACITY_ATTRIBUTE_ID); + public void subscribeFabricSceneInfoAttribute( + FabricSceneInfoAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, FABRIC_SCENE_INFO_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); } - }, REMAINING_CAPACITY_ATTRIBUTE_ID, minInterval, maxInterval); + }, FABRIC_SCENE_INFO_ATTRIBUTE_ID, minInterval, maxInterval); } public void readGeneratedCommandListAttribute( diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java index b9889df5832fea..747e778fc648c9 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java @@ -146,6 +146,127 @@ 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; + private static final long SCENE_COUNT_ID = 0L; + private static final long CURRENT_SCENE_ID = 1L; + private static final long CURRENT_GROUP_ID = 2L; + private static final long SCENE_VALID_ID = 3L; + private static final long REMAINING_CAPACITY_ID = 4L; + private static final long FABRIC_INDEX_ID = 254L; + + 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; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(SCENE_COUNT_ID, new UIntType(sceneCount))); + values.add(new StructElement(CURRENT_SCENE_ID, new UIntType(currentScene))); + values.add(new StructElement(CURRENT_GROUP_ID, new UIntType(currentGroup))); + values.add(new StructElement(SCENE_VALID_ID, new BooleanType(sceneValid))); + values.add(new StructElement(REMAINING_CAPACITY_ID, new UIntType(remainingCapacity))); + values.add(new StructElement(FABRIC_INDEX_ID, new UIntType(fabricIndex))); + + return new StructType(values); + } + + public static ScenesClusterSceneInfoStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Integer sceneCount = null; + Integer currentScene = null; + Integer currentGroup = null; + Boolean sceneValid = null; + Integer remainingCapacity = null; + Integer fabricIndex = null; + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == SCENE_COUNT_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + sceneCount = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == CURRENT_SCENE_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + currentScene = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == CURRENT_GROUP_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + currentGroup = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == SCENE_VALID_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Boolean) { + BooleanType castingValue = element.value(BooleanType.class); + sceneValid = castingValue.value(Boolean.class); + } + } else if (element.contextTagNum() == REMAINING_CAPACITY_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + remainingCapacity = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == FABRIC_INDEX_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + fabricIndex = castingValue.value(Integer.class); + } + } + } + return new ScenesClusterSceneInfoStruct( + sceneCount, + currentScene, + currentGroup, + sceneValid, + remainingCapacity, + 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 f139027f09f55a..8cbd9b776dacff 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java @@ -685,7 +685,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 dab0923ab45c54..56582e7292f838 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 cff9c643bd1076..58155868cbad55 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 ab6a73b670b4ad..1af41716a66f63 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni @@ -74,6 +74,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/generated/java/matter/devicecontroller/cluster/clusters/ScenesCluster.kt b/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/ScenesCluster.kt index 9e5918c4255b88..4baf50cd57f18a 100644 --- a/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/ScenesCluster.kt +++ b/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/ScenesCluster.kt @@ -64,6 +64,8 @@ class ScenesCluster(private val controller: MatterController, private val endpoi class LastConfiguredByAttribute(val value: ULong?) + class FabricSceneInfoAttribute(val value: List) + class GeneratedCommandListAttribute(val value: List) class AcceptedCommandListAttribute(val value: List) @@ -279,11 +281,20 @@ class ScenesCluster(private val controller: MatterController, private val endpoi // Implementation needs to be added here } - suspend fun readRemainingCapacityAttribute(): UByte { + suspend fun readFabricSceneInfoAttribute(): FabricSceneInfoAttribute { + // Implementation needs to be added here + } + + suspend fun readFabricSceneInfoAttributeWithFabricFilter( + isFabricFiltered: Boolean + ): FabricSceneInfoAttribute { // Implementation needs to be added here } - suspend fun subscribeRemainingCapacityAttribute(minInterval: Int, maxInterval: Int): UByte { + suspend fun subscribeFabricSceneInfoAttribute( + minInterval: Int, + maxInterval: Int + ): FabricSceneInfoAttribute { // Implementation needs to be added here } diff --git a/src/controller/java/generated/java/matter/devicecontroller/cluster/files.gni b/src/controller/java/generated/java/matter/devicecontroller/cluster/files.gni index 3a27dbc0175593..c5b482861a8f1f 100644 --- a/src/controller/java/generated/java/matter/devicecontroller/cluster/files.gni +++ b/src/controller/java/generated/java/matter/devicecontroller/cluster/files.gni @@ -74,6 +74,7 @@ matter_structs_sources = [ "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/RvcRunModeClusterModeTagStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/ScenesClusterAttributeValuePair.kt", "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/ScenesClusterExtensionFieldSet.kt", + "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/ScenesClusterSceneInfoStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/SoftwareDiagnosticsClusterThreadMetricsStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/TargetNavigatorClusterTargetInfoStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/ThermostatClusterThermostatScheduleTransition.kt", diff --git a/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/ScenesClusterSceneInfoStruct.kt b/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/ScenesClusterSceneInfoStruct.kt new file mode 100644 index 00000000000000..7d21ccd8c87802 --- /dev/null +++ b/src/controller/java/generated/java/matter/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 matter.devicecontroller.cluster.structs + +import matter.devicecontroller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ScenesClusterSceneInfoStruct( + val sceneCount: UByte, + val currentScene: UByte, + val currentGroup: UShort, + val sceneValid: Boolean, + val remainingCapacity: UByte, + val fabricIndex: UByte +) { + 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.getUByte(ContextSpecificTag(TAG_SCENE_COUNT)) + val currentScene = tlvReader.getUByte(ContextSpecificTag(TAG_CURRENT_SCENE)) + val currentGroup = tlvReader.getUShort(ContextSpecificTag(TAG_CURRENT_GROUP)) + val sceneValid = tlvReader.getBoolean(ContextSpecificTag(TAG_SCENE_VALID)) + val remainingCapacity = tlvReader.getUByte(ContextSpecificTag(TAG_REMAINING_CAPACITY)) + val fabricIndex = tlvReader.getUByte(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 d1504d190064fb..a3d02e6f1d8a18 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 18294e94a57073..6dcaa0273203db 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 d1303b030bd0dd..cb801242e86fa2 100644 --- a/src/controller/java/zap-generated/CHIPReadCallbacks.cpp +++ b/src/controller/java/zap-generated/CHIPReadCallbacks.cpp @@ -657,6 +657,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), keepAlive(keepAlive) diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index 7ff5cb1d8ac324..9694aba2901ba8 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 9aec0d59bc78ec..3be03f37eaa6b4 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -590,14 +590,14 @@ class Scenes(Cluster): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ - ClusterObjectFieldDescriptor(Label="sceneCount", Tag=0x00000000, Type=uint), - ClusterObjectFieldDescriptor(Label="currentScene", Tag=0x00000001, Type=uint), - ClusterObjectFieldDescriptor(Label="currentGroup", Tag=0x00000002, Type=uint), - ClusterObjectFieldDescriptor(Label="sceneValid", Tag=0x00000003, Type=bool), + ClusterObjectFieldDescriptor(Label="sceneCount", Tag=0x00000000, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="currentScene", Tag=0x00000001, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="currentGroup", Tag=0x00000002, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="sceneValid", Tag=0x00000003, Type=typing.Optional[bool]), 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]), @@ -606,14 +606,14 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="clusterRevision", Tag=0x0000FFFD, Type=uint), ]) - sceneCount: 'uint' = None - currentScene: 'uint' = None - currentGroup: 'uint' = None - sceneValid: 'bool' = None + sceneCount: 'typing.Optional[uint]' = None + currentScene: 'typing.Optional[uint]' = None + currentGroup: 'typing.Optional[uint]' = None + sceneValid: 'typing.Optional[bool]' = None 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 @@ -661,6 +661,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): @@ -1063,9 +1084,9 @@ def attribute_id(cls) -> int: @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=uint) + return ClusterObjectFieldDescriptor(Type=typing.Optional[uint]) - value: 'uint' = 0 + value: 'typing.Optional[uint]' = None @dataclass class CurrentScene(ClusterAttributeDescriptor): @@ -1079,9 +1100,9 @@ def attribute_id(cls) -> int: @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=uint) + return ClusterObjectFieldDescriptor(Type=typing.Optional[uint]) - value: 'uint' = 0 + value: 'typing.Optional[uint]' = None @dataclass class CurrentGroup(ClusterAttributeDescriptor): @@ -1095,9 +1116,9 @@ def attribute_id(cls) -> int: @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=uint) + return ClusterObjectFieldDescriptor(Type=typing.Optional[uint]) - value: 'uint' = 0 + value: 'typing.Optional[uint]' = None @dataclass class SceneValid(ClusterAttributeDescriptor): @@ -1111,9 +1132,9 @@ def attribute_id(cls) -> int: @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=bool) + return ClusterObjectFieldDescriptor(Type=typing.Optional[bool]) - value: 'bool' = False + value: 'typing.Optional[bool]' = None @dataclass class NameSupport(ClusterAttributeDescriptor): @@ -1164,7 +1185,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 @@ -1175,9 +1196,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 6ac6a560fc9b89..34bf6964e34395 100644 --- a/src/darwin/Framework/CHIP/templates/availability.yaml +++ b/src/darwin/Framework/CHIP/templates/availability.yaml @@ -7464,7 +7464,6 @@ Scenes: # New scenes bits not stable yet. - SceneTableSize - - RemainingCapacity FanControl: # New Fan Control bits not stable yet. - AirflowDirection @@ -7737,6 +7736,7 @@ GeneralDiagnostics: # Not in the spec yet. - AverageWearCount + # New things, not quite finalized. renames: enums: OTASoftwareUpdateProvider: @@ -7817,6 +7817,14 @@ OptionsBitmap: - ExecuteIfOff - CoupleColorTempToLevel + attributes: + Scenes: + - FabricSceneInfo + # Targeting Spring 2024 Matter release + structs: + Scenes: + - SceneInfoStruct + # Targeting Spring 2024 Matter release deprecated: event fields: WiFiNetworkDiagnostics: diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm index 665346bd796d17..6de42ce94b25c3 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 9d414560fc3711..89891cde8a53ef 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm @@ -313,15 +313,36 @@ static id _Nullable DecodeAttributeValueForScenesCluster(AttributeId aAttributeI value = [NSNumber numberWithUnsignedShort:cppValue]; return value; } - 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; } default: { diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h index 2ce81e7b652e39..7bc762777ec7f8 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -327,11 +327,11 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) 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; -- (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_NEWLY_AVAILABLE; +- (void)subscribeAttributeFabricSceneInfoWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_NEWLY_AVAILABLE; ++ (void)readAttributeFabricSceneInfoWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_NEWLY_AVAILABLE; - (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 097f99f9b4afaa..6f58494e54b1a3 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm @@ -1872,22 +1872,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()) @@ -1897,9 +1897,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 99a9d58fdaae24..9eada242fef741 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h @@ -323,7 +323,7 @@ typedef NS_ENUM(uint32_t, MTRAttributeIDType) { 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, + MTRAttributeIDTypeClusterScenesAttributeFabricSceneInfoID MTR_NEWLY_AVAILABLE = 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 66c1d75384923b..a46e0f289f6877 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h @@ -147,7 +147,7 @@ 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)readAttributeRemainingCapacityWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; +- (NSDictionary * _Nullable)readAttributeFabricSceneInfoWithParams:(MTRReadParams * _Nullable)params MTR_NEWLY_AVAILABLE; - (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 25da5b6e7dc491..9d3e173cd0963e 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm @@ -736,9 +736,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 4d58ccb5d27b3f..05837d17597f41 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_NEWLY_AVAILABLE +@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 251d0f89b5aeeb..28362f4a4239b6 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/attributes/Accessors.cpp b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp index 1ec7df481fdc37..9a5fb6b4727a8e 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp @@ -268,6 +268,37 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) namespace Scenes { namespace Attributes { +namespace SceneCount { + +EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::Scenes::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + *value = Traits::StorageToWorking(temp); + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::Scenes::Id, Id, writable, ZCL_INT8U_ATTRIBUTE_TYPE); +} + +} // namespace SceneCount + namespace CurrentScene { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h index 5d55df3d0ace1e..18c64a3f277bfa 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h @@ -84,6 +84,11 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); namespace Scenes { namespace Attributes { +namespace SceneCount { +EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value); // int8u +EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value); +} // namespace SceneCount + namespace CurrentScene { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value); // int8u EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value); 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 dda8edc3777740..7b1939d3eb694c 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 93c8ba7b7a7cad..2f9071ff517108 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 { @@ -1956,8 +1996,8 @@ struct TypeInfo 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 3f1ea8b417ba6e..9f81c148bc4e6b 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 a658b06560504b..c299d42b262e0e 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -507,7 +507,7 @@ class GroupsAddGroupIfIdentifying : public ClusterCommand | * NameSupport | 0x0004 | | * LastConfiguredBy | 0x0005 | | * SceneTableSize | 0x0006 | -| * RemainingCapacity | 0x0007 | +| * FabricSceneInfo | 0x0007 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | @@ -12455,7 +12455,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), // @@ -12478,8 +12478,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), // @@ -12501,7 +12502,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 0d3781a511ce02..b99220cfda2c75 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 6cad8c0944afba..39eeb0b1fb5cce 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 b1bd0866fbe78b..5f4913be47a896 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) { @@ -5703,10 +5760,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 3236fba6b253d7..d7c9d36dfb7930 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 5f77623e027319..7fb5561e34eb1c 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -1901,7 +1901,7 @@ class SubscribeAttributeGroupsClusterRevision : public SubscribeAttribute { | * NameSupport | 0x0004 | | * LastConfiguredBy | 0x0005 | | * SceneTableSize | 0x0006 | -| * RemainingCapacity | 0x0007 | +| * FabricSceneInfo | 0x0007 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | @@ -3101,37 +3101,40 @@ 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); @@ -3140,21 +3143,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); @@ -3169,10 +3172,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 { @@ -3185,8 +3188,6 @@ class SubscribeAttributeScenesRemainingCapacity : public SubscribeAttribute { } }; -#endif // MTR_ENABLE_PROVISIONAL - /* * Attribute GeneratedCommandList */ @@ -161185,10 +161186,8 @@ void registerClusterScenes(Commands & commands) 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 127a6d973b90c3..dce1f3a5024ac7 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h @@ -188954,136 +188954,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 = 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_19(); + err = TestStep7dReadOptionalCommandCopySceneResponseInGeneratedCommandListGlobalAttribute65528_23(); break; } @@ -189156,6 +189196,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. @@ -189166,7 +189218,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; @@ -189209,7 +189261,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"); @@ -189218,9 +189270,9 @@ class Test_TC_S_1_1 : public TestCommandBridge { [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { if (err != nil) { - NSLog(@"Step 3a: Read FeatureMap (global attribute 65532): Error: %@", err); + NSLog(@"Step 3a: Read FeatureMap NameSupport bit (global attribute 65532): Error: %@", err); } else { - NSLog(@"Step 3a: Read FeatureMap (global attribute 65532): Success"); + NSLog(@"Step 3a: Read FeatureMap NameSupport bit (global attribute 65532): Success"); } VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -189232,7 +189284,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"); @@ -189241,9 +189293,9 @@ class Test_TC_S_1_1 : public TestCommandBridge { [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { if (err != nil) { - NSLog(@"Step 3a: Read FeatureMap (global attribute 65532): Error: %@", err); + NSLog(@"Step 3a: Read FeatureMap NameSupport bit (global attribute 65532): Error: %@", err); } else { - NSLog(@"Step 3a: Read FeatureMap (global attribute 65532): Success"); + NSLog(@"Step 3a: Read FeatureMap NameSupport bit (global attribute 65532): Success"); } VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -189255,7 +189307,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"); @@ -189264,9 +189316,9 @@ class Test_TC_S_1_1 : public TestCommandBridge { [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { if (err != nil) { - NSLog(@"Step 3b: Read FeatureMap (global attribute 65532): Error: %@", err); + NSLog(@"Step 3b: Read FeatureMap Explicit bit (global attribute 65532): Error: %@", err); } else { - NSLog(@"Step 3b: Read FeatureMap (global attribute 65532): Success"); + NSLog(@"Step 3b: Read FeatureMap Explicit bit (global attribute 65532): Success"); } VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -189278,7 +189330,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"); @@ -189287,9 +189339,9 @@ class Test_TC_S_1_1 : public TestCommandBridge { [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { if (err != nil) { - NSLog(@"Step 3c: Read FeatureMap (global attribute 65532): Error: %@", err); + NSLog(@"Step 3b: Read FeatureMap Explicit bit (global attribute 65532): Error: %@", err); } else { - NSLog(@"Step 3c: Read FeatureMap (global attribute 65532): Success"); + NSLog(@"Step 3b: Read FeatureMap Explicit bit (global attribute 65532): Success"); } VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -189301,7 +189353,99 @@ 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) { + if (err != nil) { + NSLog(@"Step 3c: Read FeatureMap TableSize bit (global attribute 65532): Error: %@", err); + } else { + NSLog(@"Step 3c: Read FeatureMap TableSize bit (global attribute 65532): Success"); + } + + 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) { + if (err != nil) { + NSLog(@"Step 3c: Read FeatureMap TableSize bit (global attribute 65532): Error: %@", err); + } else { + NSLog(@"Step 3c: Read FeatureMap TableSize bit (global attribute 65532): Success"); + } + + 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) { + if (err != nil) { + NSLog(@"Step 3d: Read FeatureMap FabricScene bit (global attribute 65532): Error: %@", err); + } else { + NSLog(@"Step 3d: Read FeatureMap FabricScene bit (global attribute 65532): Success"); + } + + 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) { + if (err != nil) { + NSLog(@"Step 3d: Read FeatureMap FabricScene bit (global attribute 65532): Error: %@", err); + } else { + NSLog(@"Step 3d: Read FeatureMap FabricScene bit (global attribute 65532): Success"); + } + + 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"); @@ -189331,7 +189475,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"); @@ -189359,7 +189503,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"); @@ -189384,7 +189528,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"); @@ -189409,7 +189553,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"); @@ -189434,7 +189578,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"); @@ -189465,7 +189609,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"); @@ -189490,7 +189634,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"); @@ -189515,7 +189659,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"); @@ -189540,7 +189684,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"); @@ -189570,7 +189714,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"); @@ -189595,7 +189739,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"); @@ -189620,7 +189764,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"); @@ -189692,7 +189836,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; } @@ -189700,7 +189844,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; } @@ -189708,7 +189852,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; } @@ -189716,7 +189860,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; } @@ -189724,7 +189868,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; } @@ -189755,12 +189899,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; } @@ -190026,23 +190170,25 @@ 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) { + __auto_type * params = [[MTRReadParams alloc] init]; + params.filterByFabric = true; + [cluster readAttributeFabricSceneInfoWithParams:params completion:^(NSArray * _Nullable value, NSError * _Nullable err) { if (err != nil) { - NSLog(@"Step 9: TH reads from the DUT the (0x0007) RemainingCapacity attribute: Error: %@", err); + NSLog(@"Step 9: TH reads from the DUT the (0x0007) FabricSceneInfo attribute: Error: %@", err); } else { - NSLog(@"Step 9: TH reads from the DUT the (0x0007) RemainingCapacity attribute: Success"); + NSLog(@"Step 9: TH reads from the DUT the (0x0007) FabricSceneInfo attribute: Success"); } VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("remainingCapacity", "int8u", "int8u")); + VerifyOrReturn(CheckConstraintType("fabricSceneInfo", "list", "list")); NextTest(); }];