From 1275833270d8001f712ef0bb64c67b01e8b99d96 Mon Sep 17 00:00:00 2001 From: Markus Becker Date: Fri, 24 Jun 2022 19:47:03 +0200 Subject: [PATCH] [nrfconnect] Include GenericSwitch in light-switch example (#19848) * [nrfconnect] Include GenericSwitch in light-switch example In matter there are 2 types of light switch device types: - On/Off Light Switch, Dimmer Switch, Color Dimmer Switch, Control Bridge - Generic Switch Up to now only the first type was shown in the light-switch example. This commit adds GenericSwitch for the nrfconnect light-switch sample. The GenericSwitch has been added on EP 2 and uses button 3. Testing using chip-tool and DK: chip-tool interactive start Subscribe to the initial-press and short-release >>> switch subscribe-event initial-press 1 20 2 --is-urgent true >>> switch subscribe-event initial-press 1 20 2 --is-urgent true The code implements a momentary switch with features MS and MSR. * Restyled by whitespace * Restyled by clang-format * Restyled by prettier-markdown * Add missed generated file. * Restyled by prettier-markdown * Adress review comments * Directly calling GenericSwitchInitialPress/GenericSwitchReleasePress without Timer * Rename newPosition/previousPosition * Update zap * Remove Switch cluster on EP0 * Disabled Groups, Scenes, Binding on EP2 * Named EP2 * Correct previousPosition and newPosition. * Apply suggestions from code review Thanks @greg-fer. Co-authored-by: Grzegorz Ferenc <41291385+greg-fer@users.noreply.github.com> * Restyled by clang-format * Restyled by prettier-markdown * Correct second subscription command in README * Remove leading >>> in commands * Use backticks for commands Co-authored-by: Restyled.io Co-authored-by: Grzegorz Ferenc <41291385+greg-fer@users.noreply.github.com> --- .../light-switch-app.matter | 51 +- .../light-switch-common/light-switch-app.zap | 1341 ++++++++++++++++- .../light-switch-app/nrfconnect/README.md | 51 +- .../nrfconnect/main/AppTask.cpp | 43 +- .../nrfconnect/main/LightSwitch.cpp | 35 +- .../nrfconnect/main/include/AppConfig.h | 6 +- .../nrfconnect/main/include/AppTask.h | 2 +- .../nrfconnect/main/include/LightSwitch.h | 5 +- .../zap-generated/CHIPClientCallbacks.h | 4 + .../zap-generated/endpoint_config.h | 125 +- .../zap-generated/gen_config.h | 4 +- 11 files changed, 1582 insertions(+), 85 deletions(-) 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 998c68bb4c2956..dd08489a0f2f45 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 @@ -31,6 +31,8 @@ client cluster Identify = 3 { attribute int16u identifyTime = 0; readonly attribute enum8 identifyType = 1; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute attrib_id attributeList[] = 65531; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; @@ -61,6 +63,8 @@ server cluster Identify = 3 { attribute int16u identifyTime = 0; readonly attribute enum8 identifyType = 1; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute attrib_id attributeList[] = 65531; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; @@ -300,6 +304,8 @@ server cluster Descriptor = 29 { readonly attribute CLUSTER_ID serverList[] = 1; readonly attribute CLUSTER_ID clientList[] = 2; readonly attribute ENDPOINT_NO partsList[] = 3; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute attrib_id attributeList[] = 65531; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; @@ -1229,6 +1235,11 @@ server cluster Switch = 59 { INT8U totalNumberOfPressesCounted = 1; } + readonly attribute int8u numberOfPositions = 0; + readonly attribute int8u currentPosition = 1; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute attrib_id attributeList[] = 65531; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; } @@ -1920,11 +1931,6 @@ endpoint 0 { ram attribute clusterRevision default = 1; } - server cluster Switch { - ram attribute featureMap; - ram attribute clusterRevision default = 1; - } - server cluster AdministratorCommissioning { callback attribute windowStatus; callback attribute adminFabricIndex default = 1; @@ -2002,5 +2008,40 @@ endpoint 1 { ram attribute clusterRevision default = 1; } } +endpoint 2 { + device type genericswitch = 15; + + server cluster Identify { + ram attribute identifyTime; + ram attribute identifyType; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute attributeList; + ram attribute featureMap; + ram attribute clusterRevision default = 2; + } + + server cluster Descriptor { + callback attribute deviceList; + callback attribute serverList; + callback attribute clientList; + callback attribute partsList; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute attributeList; + ram attribute featureMap; + ram attribute clusterRevision default = 1; + } + + server cluster Switch { + ram attribute numberOfPositions default = 2; + ram attribute currentPosition; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute attributeList; + ram attribute featureMap default = 2; + ram attribute clusterRevision default = 1; + } +} diff --git a/examples/light-switch-app/light-switch-common/light-switch-app.zap b/examples/light-switch-app/light-switch-common/light-switch-app.zap index 70fe778341a154..9bdf9e4fc32586 100644 --- a/examples/light-switch-app/light-switch-common/light-switch-app.zap +++ b/examples/light-switch-app/light-switch-common/light-switch-app.zap @@ -4557,7 +4557,7 @@ "mfgCode": null, "define": "SWITCH_CLUSTER", "side": "server", - "enabled": 1, + "enabled": 0, "commands": [], "attributes": [ { @@ -7967,26 +7967,1325 @@ ] } ] - } - ], - "endpoints": [ - { - "endpointTypeName": "MA-rootdevice", - "endpointTypeIndex": 0, - "profileId": 259, - "endpointId": 0, - "networkId": 0, - "endpointVersion": 1, - "deviceIdentifier": 22 }, { - "endpointTypeName": "MA-onofflightswitch", - "endpointTypeIndex": 1, - "profileId": 259, - "endpointId": 1, - "networkId": 0, - "endpointVersion": 1, - "deviceIdentifier": 259 - } - ] + "name": "MA-genericswitch", + "deviceTypeName": "MA-genericswitch", + "deviceTypeCode": 15, + "deviceTypeProfileId": 259, + "clusters": [ + { + "name": "Identify", + "code": 3, + "mfgCode": null, + "define": "IDENTIFY_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [ + { + "name": "Identify", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "TriggerEffect", + "code": 64, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + } + ], + "attributes": [ + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "client", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Identify", + "code": 3, + "mfgCode": null, + "define": "IDENTIFY_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "identify time", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "identify type", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "enum8", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Groups", + "code": 4, + "mfgCode": null, + "define": "GROUPS_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [ + { + "name": "AddGroup", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "ViewGroup", + "code": 1, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "GetGroupMembership", + "code": 2, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "RemoveGroup", + "code": 3, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "RemoveAllGroups", + "code": 4, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "AddGroupIfIdentifying", + "code": 5, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + } + ], + "attributes": [ + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "client", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Groups", + "code": 4, + "mfgCode": null, + "define": "GROUPS_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [ + { + "name": "AddGroupResponse", + "code": 0, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "ViewGroupResponse", + "code": 1, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "GetGroupMembershipResponse", + "code": 2, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "RemoveGroupResponse", + "code": 3, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "name support", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "bitmap8", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Scenes", + "code": 5, + "mfgCode": null, + "define": "SCENES_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [ + { + "name": "AddScene", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "ViewScene", + "code": 1, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "RemoveScene", + "code": 2, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "RemoveAllScenes", + "code": 3, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "StoreScene", + "code": 4, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "RecallScene", + "code": 5, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "GetSceneMembership", + "code": 6, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "client", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "4", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Scenes", + "code": 5, + "mfgCode": null, + "define": "SCENES_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [ + { + "name": "AddSceneResponse", + "code": 0, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "ViewSceneResponse", + "code": 1, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "RemoveSceneResponse", + "code": 2, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "RemoveAllScenesResponse", + "code": 3, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "StoreSceneResponse", + "code": 4, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "GetSceneMembershipResponse", + "code": 6, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "SceneCount", + "code": 0, + "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": "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, + "mfgCode": null, + "side": "server", + "type": "bitmap8", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "LastConfiguredBy", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "node_id", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "4", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Descriptor", + "code": 29, + "mfgCode": null, + "define": "DESCRIPTOR_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "client", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Descriptor", + "code": 29, + "mfgCode": null, + "define": "DESCRIPTOR_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "device list", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "server list", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "client list", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "parts list", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Binding", + "code": 30, + "mfgCode": null, + "define": "BINDING_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "client", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Binding", + "code": 30, + "mfgCode": null, + "define": "BINDING_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "Binding", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Switch", + "code": 59, + "mfgCode": null, + "define": "SWITCH_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "client", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Switch", + "code": 59, + "mfgCode": null, + "define": "SWITCH_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "number of positions", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "current position", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "multi press max", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + } + ] + } + ], + "endpoints": [ + { + "endpointTypeName": "MA-rootdevice", + "endpointTypeIndex": 0, + "profileId": 259, + "endpointId": 0, + "networkId": 0, + "endpointVersion": 1, + "deviceIdentifier": 22 + }, + { + "endpointTypeName": "MA-onofflightswitch", + "endpointTypeIndex": 1, + "profileId": 259, + "endpointId": 1, + "networkId": 0, + "endpointVersion": 1, + "deviceIdentifier": 259 + }, + { + "endpointTypeName": "MA-genericswitch", + "endpointTypeIndex": 2, + "profileId": 259, + "endpointId": 2, + "networkId": 0, + "endpointVersion": 1, + "deviceIdentifier": 15 + } + ], + "log": [] } \ No newline at end of file diff --git a/examples/light-switch-app/nrfconnect/README.md b/examples/light-switch-app/nrfconnect/README.md index 2b559a38edebd6..a00f14725a0915 100644 --- a/examples/light-switch-app/nrfconnect/README.md +++ b/examples/light-switch-app/nrfconnect/README.md @@ -62,13 +62,39 @@ and [Zephyr RTOS](https://zephyrproject.org/). Visit Matter's [nRF Connect platform overview](../../../docs/guides/nrfconnect_platform_overview.md) to read more about the platform structure and dependencies. +In Matter, the following types of light switch devices are available: + +- Group 1: On/Off Light Switch, Dimmer Switch, Color Dimmer Switch, Control + Bridge +- Group 2: Generic Switch + +The first type (here referred to as Group 1) uses client application clusters +(for example, Level Control) and bindings to send commands to the server +clusters. This type of switch is on the endpoint 1 of this example. + +With the second type (Group 2), controllers can use event subscriptions to be +informed about changes on the switch server cluster. This type of switch is on +the endpoint 2 of this example. + +### Group 1 light switch devices overview + A light switch device is a simple embedded controller, which has the ability to control lighting devices, such as light bulbs or LEDs. After commissioning into a Matter network, the light switch device does not know what it can control. In other words, it has no information about another device being connected to the same network. You must provide this information to the light switch through the process called binding, which links clusters and endpoints on both devices, so -that the devices can interact with each other. +that the devices can interact with each other. This functionality is on the +endpoint 1 and triggered by **Button 2**. + +### Generic Switch + +The Generic Switch on the endpoint 2 offers the switch server cluster. It +implements the Momentary Switch (`MS`) and Momentary Switch Release (`MSR`) +features. For this reason, it sends event notifications `InitialPress` and +`ShortRelease` if **Button 3** of the DK is pressed and released. + +### Common example settings The Matter device that runs the light switch application is controlled by the Matter controller device over the Thread protocol. By default, the Matter device @@ -273,6 +299,11 @@ platform image. with 1% increments every 300 milliseconds as long as **Button 2** is pressed. +**Button 3** can be used for the following purposes: + +- _Pressed once_ — Changes the value of the attribute `CurrentPosition` + and (if subscribed) sends the event notifications to the controller. + **Button 4** can be used to start the NFC tag emulation and enable Bluetooth LE advertising for the predefined period of time (15 minutes by default). @@ -708,6 +739,24 @@ use [light switch buttons](#buttons) or [Matter CLI commands](#matter-cli-commands), as described in the [Device UI](#device-ui) section. +### Testing the Generic Switch + +To test the Generic Switch, complete the following steps: + +1. Enter the interactive mode of the CHIP Tool: + + chip-tool interactive start + +2. Subscribe to the `InitialPress` and `ShortRelease` event notifications: + +```shell +switch subscribe-event initial-press 1 20 2 --is-urgent true +switch subscribe-event short-release 1 20 2 --is-urgent true --keepSubscriptions true +``` + +3. Press **Button 3** to test the new configuration. When pressing and + releasing **Button 3**, both events should be sent to the controller. + ### Testing Device Firmware Upgrade Read the diff --git a/examples/light-switch-app/nrfconnect/main/AppTask.cpp b/examples/light-switch-app/nrfconnect/main/AppTask.cpp index 14ac3779f39d1e..b9c85caf6ff2b8 100644 --- a/examples/light-switch-app/nrfconnect/main/AppTask.cpp +++ b/examples/light-switch-app/nrfconnect/main/AppTask.cpp @@ -49,8 +49,10 @@ using namespace ::chip::DeviceLayer; LOG_MODULE_DECLARE(app, CONFIG_MATTER_LOG_LEVEL); namespace { -constexpr EndpointId kLightSwitchEndpointId = 1; -constexpr EndpointId kLightEndpointId = 1; +constexpr EndpointId kLightDimmerSwitchEndpointId = 1; +constexpr EndpointId kLightGenericSwitchEndpointId = 2; +constexpr EndpointId kLightEndpointId = 1; + constexpr uint32_t kFactoryResetTriggerTimeout = 3000; constexpr uint32_t kFactoryResetCancelWindow = 3000; constexpr uint32_t kDimmerTriggeredTimeout = 500; @@ -124,7 +126,7 @@ CHIP_ERROR AppTask::Init() return err; } - LightSwitch::GetInstance().Init(kLightSwitchEndpointId); + LightSwitch::GetInstance().Init(kLightDimmerSwitchEndpointId, kLightGenericSwitchEndpointId); // Initialize UI components LEDWidget::InitGpio(); @@ -216,11 +218,15 @@ void AppTask::ButtonPushHandler(AppEvent * aEvent) sAppTask.StartTimer(Timer::Function, kFactoryResetTriggerTimeout); sAppTask.mFunction = TimerFunction::SoftwareUpdate; break; - case SWITCH_BUTTON: + case DIMMER_SWITCH_BUTTON: LOG_INF("Button has been pressed, keep in this state for at least 500 ms to change light sensitivity of binded " "lighting devices."); sAppTask.StartTimer(Timer::DimmerTrigger, kDimmerTriggeredTimeout); break; + case GENERIC_SWITCH_BUTTON: + LOG_INF("GenericSwitch: InitialPress"); + LightSwitch::GetInstance().GenericSwitchInitialPress(); + break; default: break; } @@ -257,7 +263,7 @@ void AppTask::ButtonReleaseHandler(AppEvent * aEvent) LOG_INF("Factory Reset has been canceled"); } break; - case SWITCH_BUTTON: + case DIMMER_SWITCH_BUTTON: if (!sWasDimmerTriggered) { LightSwitch::GetInstance().InitiateActionSwitch(LightSwitch::Action::Toggle); @@ -266,6 +272,10 @@ void AppTask::ButtonReleaseHandler(AppEvent * aEvent) sAppTask.CancelTimer(Timer::DimmerTrigger); sWasDimmerTriggered = false; break; + case GENERIC_SWITCH_BUTTON: + LOG_INF("GenericSwitch: ShortRelease"); + LightSwitch::GetInstance().GenericSwitchReleasePress(); + break; default: break; } @@ -475,16 +485,31 @@ void AppTask::ButtonEventHandler(uint32_t aButtonState, uint32_t aHasChanged) sAppTask.PostEvent(&buttonEvent); } - if (SWITCH_BUTTON_MASK & aButtonState & aHasChanged) + if (DIMMER_SWITCH_BUTTON_MASK & aButtonState & aHasChanged) + { + buttonEvent.ButtonEvent.PinNo = DIMMER_SWITCH_BUTTON; + buttonEvent.ButtonEvent.Action = AppEvent::kButtonPushEvent; + buttonEvent.Handler = ButtonPushHandler; + sAppTask.PostEvent(&buttonEvent); + } + else if (DIMMER_SWITCH_BUTTON_MASK & aHasChanged) + { + buttonEvent.ButtonEvent.PinNo = DIMMER_SWITCH_BUTTON; + buttonEvent.ButtonEvent.Action = AppEvent::kButtonReleaseEvent; + buttonEvent.Handler = ButtonReleaseHandler; + sAppTask.PostEvent(&buttonEvent); + } + + if (GENERIC_SWITCH_BUTTON_MASK & aButtonState & aHasChanged) { - buttonEvent.ButtonEvent.PinNo = SWITCH_BUTTON; + buttonEvent.ButtonEvent.PinNo = GENERIC_SWITCH_BUTTON; buttonEvent.ButtonEvent.Action = AppEvent::kButtonPushEvent; buttonEvent.Handler = ButtonPushHandler; sAppTask.PostEvent(&buttonEvent); } - else if (SWITCH_BUTTON_MASK & aHasChanged) + else if (GENERIC_SWITCH_BUTTON_MASK & aHasChanged) { - buttonEvent.ButtonEvent.PinNo = SWITCH_BUTTON; + buttonEvent.ButtonEvent.PinNo = GENERIC_SWITCH_BUTTON; buttonEvent.ButtonEvent.Action = AppEvent::kButtonReleaseEvent; buttonEvent.Handler = ButtonReleaseHandler; sAppTask.PostEvent(&buttonEvent); diff --git a/examples/light-switch-app/nrfconnect/main/LightSwitch.cpp b/examples/light-switch-app/nrfconnect/main/LightSwitch.cpp index 2b54264eb45b14..f1903e208a2563 100644 --- a/examples/light-switch-app/nrfconnect/main/LightSwitch.cpp +++ b/examples/light-switch-app/nrfconnect/main/LightSwitch.cpp @@ -24,13 +24,19 @@ #include #include +#include + +#include + using namespace chip; using namespace chip::app; +using namespace chip::app::Clusters; -void LightSwitch::Init(chip::EndpointId aLightSwitchEndpoint) +void LightSwitch::Init(chip::EndpointId aLightDimmerSwitchEndpoint, chip::EndpointId aLightGenericSwitchEndpointId) { BindingHandler::GetInstance().Init(); - mLightSwitchEndpoint = aLightSwitchEndpoint; + mLightSwitchEndpoint = aLightDimmerSwitchEndpoint; + mLightGenericSwitchEndpointId = aLightGenericSwitchEndpointId; } void LightSwitch::InitiateActionSwitch(Action mAction) @@ -80,3 +86,28 @@ void LightSwitch::DimmerChangeBrightness() DeviceLayer::PlatformMgr().ScheduleWork(BindingHandler::SwitchWorkerHandler, reinterpret_cast(data)); } } + +void LightSwitch::GenericSwitchInitialPress() +{ + DeviceLayer::SystemLayer().ScheduleLambda([this] { + // Press moves Position from 0 (idle) to 1 (press) + uint8_t newPosition = 1; + + Clusters::Switch::Attributes::CurrentPosition::Set(mLightGenericSwitchEndpointId, newPosition); + // InitialPress event takes newPosition as event data + Clusters::SwitchServer::Instance().OnInitialPress(mLightGenericSwitchEndpointId, newPosition); + }); +} + +void LightSwitch::GenericSwitchReleasePress() +{ + DeviceLayer::SystemLayer().ScheduleLambda([this] { + // Release moves Position from 1 (press) to 0 (idle) + uint8_t previousPosition = 1; + uint8_t newPosition = 0; + + Clusters::Switch::Attributes::CurrentPosition::Set(mLightGenericSwitchEndpointId, newPosition); + // ShortRelease event takes previousPosition as event data + Clusters::SwitchServer::Instance().OnShortRelease(mLightGenericSwitchEndpointId, previousPosition); + }); +} diff --git a/examples/light-switch-app/nrfconnect/main/include/AppConfig.h b/examples/light-switch-app/nrfconnect/main/include/AppConfig.h index 4981ca6aadfc04..7e71ce1fa1381f 100644 --- a/examples/light-switch-app/nrfconnect/main/include/AppConfig.h +++ b/examples/light-switch-app/nrfconnect/main/include/AppConfig.h @@ -22,8 +22,10 @@ #define FUNCTION_BUTTON DK_BTN1 #define FUNCTION_BUTTON_MASK DK_BTN1_MSK -#define SWITCH_BUTTON DK_BTN2 -#define SWITCH_BUTTON_MASK DK_BTN2_MSK +#define DIMMER_SWITCH_BUTTON DK_BTN2 +#define DIMMER_SWITCH_BUTTON_MASK DK_BTN2_MSK +#define GENERIC_SWITCH_BUTTON DK_BTN3 +#define GENERIC_SWITCH_BUTTON_MASK DK_BTN3_MSK #define BLE_ADVERTISEMENT_START_BUTTON DK_BTN4 #define BLE_ADVERTISEMENT_START_BUTTON_MASK DK_BTN4_MSK diff --git a/examples/light-switch-app/nrfconnect/main/include/AppTask.h b/examples/light-switch-app/nrfconnect/main/include/AppTask.h index f392046c236410..06f9e1d574cb0a 100644 --- a/examples/light-switch-app/nrfconnect/main/include/AppTask.h +++ b/examples/light-switch-app/nrfconnect/main/include/AppTask.h @@ -57,7 +57,7 @@ class AppTask { NoneSelected = 0, SoftwareUpdate, - FactoryReset + FactoryReset, }; TimerFunction mFunction = TimerFunction::NoneSelected; diff --git a/examples/light-switch-app/nrfconnect/main/include/LightSwitch.h b/examples/light-switch-app/nrfconnect/main/include/LightSwitch.h index 222bb5216f4fae..926c40017ccf2e 100644 --- a/examples/light-switch-app/nrfconnect/main/include/LightSwitch.h +++ b/examples/light-switch-app/nrfconnect/main/include/LightSwitch.h @@ -31,9 +31,11 @@ class LightSwitch Off /// Turn off light on lighting-app device }; - void Init(chip::EndpointId aLightSwitchEndpoint); + void Init(chip::EndpointId aLightDimmerSwitchEndpoint, chip::EndpointId aLightGenericSwitchEndpointId); void InitiateActionSwitch(Action); void DimmerChangeBrightness(); + void GenericSwitchInitialPress(); + void GenericSwitchReleasePress(); chip::EndpointId GetLightSwitchEndpointId() { return mLightSwitchEndpoint; } static LightSwitch & GetInstance() @@ -47,4 +49,5 @@ class LightSwitch constexpr static auto kMaximumBrightness = 254; chip::EndpointId mLightSwitchEndpoint; + chip::EndpointId mLightGenericSwitchEndpointId; }; diff --git a/zzz_generated/light-switch-app/zap-generated/CHIPClientCallbacks.h b/zzz_generated/light-switch-app/zap-generated/CHIPClientCallbacks.h index 75fe2d30a51f11..ae93a3832151b2 100644 --- a/zzz_generated/light-switch-app/zap-generated/CHIPClientCallbacks.h +++ b/zzz_generated/light-switch-app/zap-generated/CHIPClientCallbacks.h @@ -30,6 +30,10 @@ #include // List specific responses +typedef void (*IdentifyGeneratedCommandListListAttributeCallback)( + void * context, const chip::app::DataModel::DecodableList & data); +typedef void (*IdentifyAcceptedCommandListListAttributeCallback)(void * context, + const chip::app::DataModel::DecodableList & data); typedef void (*IdentifyAttributeListListAttributeCallback)(void * context, const chip::app::DataModel::DecodableList & data); typedef void (*ScenesAttributeListListAttributeCallback)(void * context, diff --git a/zzz_generated/light-switch-app/zap-generated/endpoint_config.h b/zzz_generated/light-switch-app/zap-generated/endpoint_config.h index 6c2a3331a78f92..f2c17c5be7aa0c 100644 --- a/zzz_generated/light-switch-app/zap-generated/endpoint_config.h +++ b/zzz_generated/light-switch-app/zap-generated/endpoint_config.h @@ -80,7 +80,7 @@ #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask // This is an array of EmberAfAttributeMetadata structures. -#define GENERATED_ATTRIBUTE_COUNT 223 +#define GENERATED_ATTRIBUTE_COUNT 235 #define GENERATED_ATTRIBUTES \ { \ \ @@ -382,10 +382,6 @@ { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_SIMPLE_DEFAULT(3) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ - /* Endpoint: 0, Cluster: Switch (server) */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_SIMPLE_DEFAULT(0) }, /* FeatureMap */ \ - { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ - \ /* Endpoint: 0, Cluster: AdministratorCommissioning (server) */ \ { 0x00000000, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* WindowStatus */ \ { 0x00000001, ZAP_TYPE(FABRIC_IDX), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ @@ -452,6 +448,26 @@ { 0x00000000, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_EMPTY_DEFAULT() }, /* Binding */ \ { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_SIMPLE_DEFAULT(0) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + \ + /* Endpoint: 2, Cluster: Identify (server) */ \ + { 0x00000000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0x0) }, /* identify time */ \ + { 0x00000001, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0x0) }, /* identify type */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_SIMPLE_DEFAULT(0) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(2) }, /* ClusterRevision */ \ + \ + /* Endpoint: 2, Cluster: Descriptor (server) */ \ + { 0x00000000, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* device list */ \ + { 0x00000001, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* server list */ \ + { 0x00000002, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* client list */ \ + { 0x00000003, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* parts list */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_SIMPLE_DEFAULT(0) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + \ + /* Endpoint: 2, Cluster: Switch (server) */ \ + { 0x00000000, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(2) }, /* number of positions */ \ + { 0x00000001, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0) }, /* current position */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_SIMPLE_DEFAULT(2) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ } @@ -593,12 +609,17 @@ 0x00000002 /* GetGroupMembershipResponse */, \ 0x00000003 /* RemoveGroupResponse */, \ chip::kInvalidCommandId /* end of list */, \ + /* Endpoint: 2, Cluster: Identify (server) */\ + /* AcceptedCommandList (index=76) */ \ + 0x00000000 /* Identify */, \ + 0x00000040 /* TriggerEffect */, \ + chip::kInvalidCommandId /* end of list */, \ } // clang-format on #define ZAP_CLUSTER_MASK(mask) CLUSTER_MASK_##mask -#define GENERATED_CLUSTER_COUNT 30 +#define GENERATED_CLUSTER_COUNT 32 // clang-format off #define GENERATED_CLUSTERS { \ @@ -778,21 +799,10 @@ .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 33 ) ,\ .generatedCommandList = nullptr ,\ },\ - { \ - /* Endpoint: 0, Cluster: Switch (server) */ \ - .clusterId = 0x0000003B, \ - .attributes = ZAP_ATTRIBUTE_INDEX(180), \ - .attributeCount = 2, \ - .clusterSize = 6, \ - .mask = ZAP_CLUSTER_MASK(SERVER), \ - .functions = NULL, \ - .acceptedCommandList = nullptr ,\ - .generatedCommandList = nullptr ,\ - },\ { \ /* Endpoint: 0, Cluster: AdministratorCommissioning (server) */ \ .clusterId = 0x0000003C, \ - .attributes = ZAP_ATTRIBUTE_INDEX(182), \ + .attributes = ZAP_ATTRIBUTE_INDEX(180), \ .attributeCount = 5, \ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -803,7 +813,7 @@ { \ /* Endpoint: 0, Cluster: Operational Credentials (server) */ \ .clusterId = 0x0000003E, \ - .attributes = ZAP_ATTRIBUTE_INDEX(187), \ + .attributes = ZAP_ATTRIBUTE_INDEX(185), \ .attributeCount = 8, \ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -814,7 +824,7 @@ { \ /* Endpoint: 0, Cluster: Group Key Management (server) */ \ .clusterId = 0x0000003F, \ - .attributes = ZAP_ATTRIBUTE_INDEX(195), \ + .attributes = ZAP_ATTRIBUTE_INDEX(193), \ .attributeCount = 6, \ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -825,7 +835,7 @@ { \ /* Endpoint: 0, Cluster: Fixed Label (server) */ \ .clusterId = 0x00000040, \ - .attributes = ZAP_ATTRIBUTE_INDEX(201), \ + .attributes = ZAP_ATTRIBUTE_INDEX(199), \ .attributeCount = 3, \ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -836,7 +846,7 @@ { \ /* Endpoint: 0, Cluster: User Label (server) */ \ .clusterId = 0x00000041, \ - .attributes = ZAP_ATTRIBUTE_INDEX(204), \ + .attributes = ZAP_ATTRIBUTE_INDEX(202), \ .attributeCount = 3, \ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -847,7 +857,7 @@ { \ /* Endpoint: 1, Cluster: Identify (client) */ \ .clusterId = 0x00000003, \ - .attributes = ZAP_ATTRIBUTE_INDEX(207), \ + .attributes = ZAP_ATTRIBUTE_INDEX(205), \ .attributeCount = 0, \ .clusterSize = 0, \ .mask = ZAP_CLUSTER_MASK(CLIENT), \ @@ -858,7 +868,7 @@ { \ /* Endpoint: 1, Cluster: Identify (server) */ \ .clusterId = 0x00000003, \ - .attributes = ZAP_ATTRIBUTE_INDEX(207), \ + .attributes = ZAP_ATTRIBUTE_INDEX(205), \ .attributeCount = 4, \ .clusterSize = 9, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION), \ @@ -869,7 +879,7 @@ { \ /* Endpoint: 1, Cluster: Groups (server) */ \ .clusterId = 0x00000004, \ - .attributes = ZAP_ATTRIBUTE_INDEX(211), \ + .attributes = ZAP_ATTRIBUTE_INDEX(209), \ .attributeCount = 3, \ .clusterSize = 7, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ @@ -880,7 +890,7 @@ { \ /* Endpoint: 1, Cluster: Scenes (client) */ \ .clusterId = 0x00000005, \ - .attributes = ZAP_ATTRIBUTE_INDEX(214), \ + .attributes = ZAP_ATTRIBUTE_INDEX(212), \ .attributeCount = 0, \ .clusterSize = 0, \ .mask = ZAP_CLUSTER_MASK(CLIENT), \ @@ -891,7 +901,7 @@ { \ /* Endpoint: 1, Cluster: On/Off (client) */ \ .clusterId = 0x00000006, \ - .attributes = ZAP_ATTRIBUTE_INDEX(214), \ + .attributes = ZAP_ATTRIBUTE_INDEX(212), \ .attributeCount = 0, \ .clusterSize = 0, \ .mask = ZAP_CLUSTER_MASK(CLIENT), \ @@ -902,7 +912,7 @@ { \ /* Endpoint: 1, Cluster: Descriptor (server) */ \ .clusterId = 0x0000001D, \ - .attributes = ZAP_ATTRIBUTE_INDEX(214), \ + .attributes = ZAP_ATTRIBUTE_INDEX(212), \ .attributeCount = 6, \ .clusterSize = 4, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -913,7 +923,7 @@ { \ /* Endpoint: 1, Cluster: Binding (server) */ \ .clusterId = 0x0000001E, \ - .attributes = ZAP_ATTRIBUTE_INDEX(220), \ + .attributes = ZAP_ATTRIBUTE_INDEX(218), \ .attributeCount = 3, \ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -924,7 +934,7 @@ { \ /* Endpoint: 1, Cluster: Color Control (client) */ \ .clusterId = 0x00000300, \ - .attributes = ZAP_ATTRIBUTE_INDEX(223), \ + .attributes = ZAP_ATTRIBUTE_INDEX(221), \ .attributeCount = 0, \ .clusterSize = 0, \ .mask = ZAP_CLUSTER_MASK(CLIENT), \ @@ -932,18 +942,51 @@ .acceptedCommandList = nullptr ,\ .generatedCommandList = nullptr ,\ },\ + { \ + /* Endpoint: 2, Cluster: Identify (server) */ \ + .clusterId = 0x00000003, \ + .attributes = ZAP_ATTRIBUTE_INDEX(221), \ + .attributeCount = 4, \ + .clusterSize = 9, \ + .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION), \ + .functions = chipFuncArrayIdentifyServer, \ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 76 ) ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 2, Cluster: Descriptor (server) */ \ + .clusterId = 0x0000001D, \ + .attributes = ZAP_ATTRIBUTE_INDEX(225), \ + .attributeCount = 6, \ + .clusterSize = 6, \ + .mask = ZAP_CLUSTER_MASK(SERVER), \ + .functions = NULL, \ + .acceptedCommandList = nullptr ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 2, Cluster: Switch (server) */ \ + .clusterId = 0x0000003B, \ + .attributes = ZAP_ATTRIBUTE_INDEX(231), \ + .attributeCount = 4, \ + .clusterSize = 8, \ + .mask = ZAP_CLUSTER_MASK(SERVER), \ + .functions = NULL, \ + .acceptedCommandList = nullptr ,\ + .generatedCommandList = nullptr ,\ + },\ } // clang-format on #define ZAP_CLUSTER_INDEX(index) (&generatedClusters[index]) -#define ZAP_FIXED_ENDPOINT_DATA_VERSION_COUNT 25 +#define ZAP_FIXED_ENDPOINT_DATA_VERSION_COUNT 27 // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 22, 250 }, { ZAP_CLUSTER_INDEX(22), 8, 26 }, \ + { ZAP_CLUSTER_INDEX(0), 21, 244 }, { ZAP_CLUSTER_INDEX(21), 8, 26 }, { ZAP_CLUSTER_INDEX(29), 3, 23 }, \ } // Largest attribute size is needed for various buffers @@ -955,50 +998,50 @@ static_assert(ATTRIBUTE_LARGEST <= CHIP_CONFIG_MAX_ATTRIBUTE_STORE_ELEMENT_SIZE, #define ATTRIBUTE_SINGLETONS_SIZE (37) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (276) +#define ATTRIBUTE_MAX_SIZE (293) // Number of fixed endpoints -#define FIXED_ENDPOINT_COUNT (2) +#define FIXED_ENDPOINT_COUNT (3) // Array of endpoints that are supported, the data inside // the array is the endpoint number. #define FIXED_ENDPOINT_ARRAY \ { \ - 0x0000, 0x0001 \ + 0x0000, 0x0001, 0x0002 \ } // Array of profile ids #define FIXED_PROFILE_IDS \ { \ - 0x0103, 0x0103 \ + 0x0103, 0x0103, 0x0103 \ } // Array of device types #define FIXED_DEVICE_TYPES \ { \ - { 0x0016, 1 }, { 0x0103, 1 } \ + { 0x0016, 1 }, { 0x0103, 1 }, { 0x000F, 1 } \ } // Array of device type offsets #define FIXED_DEVICE_TYPE_OFFSETS \ { \ - 0, 1 \ + 0, 1, 2 \ } // Array of device type lengths #define FIXED_DEVICE_TYPE_LENGTHS \ { \ - 1, 1 \ + 1, 1, 1 \ } // Array of endpoint types supported on each endpoint #define FIXED_ENDPOINT_TYPES \ { \ - 0, 1 \ + 0, 1, 2 \ } // Array of networks supported on each endpoint #define FIXED_NETWORKS \ { \ - 0, 0 \ + 0, 0, 0 \ } diff --git a/zzz_generated/light-switch-app/zap-generated/gen_config.h b/zzz_generated/light-switch-app/zap-generated/gen_config.h index 39483911ffa359..77dc4cb1c9327a 100644 --- a/zzz_generated/light-switch-app/zap-generated/gen_config.h +++ b/zzz_generated/light-switch-app/zap-generated/gen_config.h @@ -30,11 +30,11 @@ /**** Cluster endpoint counts ****/ #define EMBER_AF_IDENTIFY_CLUSTER_CLIENT_ENDPOINT_COUNT (1) -#define EMBER_AF_IDENTIFY_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_IDENTIFY_CLUSTER_SERVER_ENDPOINT_COUNT (2) #define EMBER_AF_GROUPS_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_SCENES_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_ON_OFF_CLUSTER_CLIENT_ENDPOINT_COUNT (1) -#define EMBER_AF_DESCRIPTOR_CLUSTER_SERVER_ENDPOINT_COUNT (2) +#define EMBER_AF_DESCRIPTOR_CLUSTER_SERVER_ENDPOINT_COUNT (3) #define EMBER_AF_BINDING_CLUSTER_SERVER_ENDPOINT_COUNT (2) #define EMBER_AF_ACCESS_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_BASIC_CLUSTER_SERVER_ENDPOINT_COUNT (1)