From 18ab5f4bd66a5aa6607d852c27ad2aaac51e43d7 Mon Sep 17 00:00:00 2001 From: jmartinez-silabs <67972863+jmartinez-silabs@users.noreply.github.com> Date: Tue, 1 Mar 2022 10:27:03 -0500 Subject: [PATCH] OnOff cluster featuremap (#15618) * Gate OnOff optional commands and attributes logic by featuremap value. Fix Level Control onLevel attribute default value * Update On Level to default 0xFF to represent null zap issue #354, update test TC_OO_1_1 featuremap value * regen all --- .../all-clusters-app.matter | 4 + .../all-clusters-common/all-clusters-app.zap | 219 +++++++++++------- .../bridge-common/bridge-app.matter | 4 + .../light-switch-app.matter | 4 + .../lighting-common/lighting-app.matter | 4 + .../lighting-common/lighting-app.zap | 57 ++++- examples/lock-app/lock-common/lock-app.matter | 4 + .../placeholder/linux/apps/app1/config.matter | 4 + .../placeholder/linux/apps/app2/config.matter | 4 + examples/pump-app/pump-common/pump-app.matter | 4 + .../pump-controller-app.matter | 4 + examples/tv-app/tv-common/tv-app.matter | 4 + .../tv-casting-common/tv-casting-app.matter | 4 + .../clusters/on-off-server/on-off-server.cpp | 123 ++++++---- .../clusters/on-off-server/on-off-server.h | 8 + .../suites/certification/Test_TC_OO_1_1.yaml | 4 +- .../zcl/data-model/chip/onoff-cluster.xml | 6 +- .../zcl/data-model/silabs/general.xml | 2 +- .../data_model/controller-clusters.matter | 4 + .../Framework/CHIPTests/CHIPClustersTests.m | 4 +- .../zap-generated/endpoint_config.h | 6 +- .../zap-generated/cluster-objects.h | 6 + .../app-common/zap-generated/enums.h | 2 + .../chip-tool/zap-generated/test/Commands.h | 4 +- .../zap-generated/endpoint_config.h | 6 +- 25 files changed, 342 insertions(+), 153 deletions(-) diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter index 4f61d4b6dc3887..80fa3553b26f74 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 @@ -2261,6 +2261,10 @@ server cluster OnOff = 6 { kAcceptOnlyWhenOn = 0x1; } + bitmap OnOffFeature : BITMAP32 { + kLighting = 0x1; + } + readonly attribute boolean onOff = 0; readonly attribute boolean globalSceneControl = 16384; attribute int16u onTime = 16385; 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 30b994ae687f94..9cb121b0405757 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 @@ -906,7 +906,7 @@ "commands": [], "attributes": [ { - "name": "binding list", + "name": "Binding", "code": 0, "mfgCode": null, "side": "server", @@ -915,7 +915,7 @@ "singleton": 0, "bounded": 0, "defaultValue": "", - "reportable": 0, + "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -1423,7 +1423,7 @@ "mfgCode": null, "side": "server", "included": 0, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1574,7 +1574,7 @@ "mfgCode": null, "side": "server", "included": 0, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1655,7 +1655,7 @@ "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -2186,7 +2186,7 @@ "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -2291,7 +2291,7 @@ "mfgCode": null, "side": "server", "included": 0, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -4522,7 +4522,7 @@ "reportableChange": 0 }, { - "name": "fabrics list", + "name": "Fabrics", "code": 1, "mfgCode": null, "side": "server", @@ -7311,7 +7311,7 @@ "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -7326,7 +7326,7 @@ "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -7341,7 +7341,7 @@ "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -8041,7 +8041,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0000", + "defaultValue": "0x0001", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -8390,7 +8390,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0xFE", + "defaultValue": "0xFF", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -8456,6 +8456,51 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "ServerGeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClientGeneratedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "FeatureMap", "code": 65532, @@ -8733,7 +8778,7 @@ "commands": [], "attributes": [ { - "name": "binding list", + "name": "Binding", "code": 0, "mfgCode": null, "side": "server", @@ -8742,7 +8787,7 @@ "singleton": 0, "bounded": 0, "defaultValue": "", - "reportable": 0, + "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -9474,7 +9519,7 @@ "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -9776,7 +9821,7 @@ "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -10060,7 +10105,7 @@ "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -10075,7 +10120,7 @@ "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -10142,7 +10187,7 @@ "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -11213,7 +11258,7 @@ "mfgCode": null, "side": "server", "included": 0, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -14602,7 +14647,7 @@ "commands": [], "attributes": [ { - "name": "wake on lan mac address", + "name": "MACAddress", "code": 0, "mfgCode": null, "side": "server", @@ -14642,7 +14687,7 @@ "enabled": 0, "commands": [ { - "name": "ChangeChannelRequest", + "name": "ChangeChannel", "code": 0, "mfgCode": null, "source": "client", @@ -14650,7 +14695,7 @@ "outgoing": 1 }, { - "name": "ChangeChannelByNumberRequest", + "name": "ChangeChannelByNumber", "code": 2, "mfgCode": null, "source": "client", @@ -14686,12 +14731,12 @@ "commands": [], "attributes": [ { - "name": "channel list", + "name": "ChannelList", "code": 0, "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -14701,7 +14746,7 @@ "reportableChange": 0 }, { - "name": "channel lineup", + "name": "Lineup", "code": 1, "mfgCode": null, "side": "server", @@ -14716,7 +14761,7 @@ "reportableChange": 0 }, { - "name": "current channel", + "name": "CurrentChannel", "code": 2, "mfgCode": null, "side": "server", @@ -14736,7 +14781,7 @@ "mfgCode": null, "side": "server", "included": 0, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -14786,7 +14831,7 @@ "enabled": 0, "commands": [ { - "name": "NavigateTargetRequest", + "name": "NavigateTarget", "code": 0, "mfgCode": null, "source": "client", @@ -14822,12 +14867,12 @@ "commands": [], "attributes": [ { - "name": "target navigator list", + "name": "TargetList", "code": 0, "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -14837,7 +14882,7 @@ "reportableChange": 0 }, { - "name": "current navigator target", + "name": "CurrentTarget", "code": 1, "mfgCode": null, "side": "server", @@ -14857,7 +14902,7 @@ "mfgCode": null, "side": "server", "included": 0, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -14907,7 +14952,7 @@ "enabled": 0, "commands": [ { - "name": "PlayRequest", + "name": "Play", "code": 0, "mfgCode": null, "source": "client", @@ -14915,7 +14960,7 @@ "outgoing": 1 }, { - "name": "PauseRequest", + "name": "Pause", "code": 1, "mfgCode": null, "source": "client", @@ -14923,7 +14968,7 @@ "outgoing": 1 }, { - "name": "StopRequest", + "name": "StopPlayback", "code": 2, "mfgCode": null, "source": "client", @@ -14931,7 +14976,7 @@ "outgoing": 1 }, { - "name": "StartOverRequest", + "name": "StartOver", "code": 3, "mfgCode": null, "source": "client", @@ -14939,7 +14984,7 @@ "outgoing": 1 }, { - "name": "PreviousRequest", + "name": "Previous", "code": 4, "mfgCode": null, "source": "client", @@ -14947,7 +14992,7 @@ "outgoing": 1 }, { - "name": "NextRequest", + "name": "Next", "code": 5, "mfgCode": null, "source": "client", @@ -14955,7 +15000,7 @@ "outgoing": 1 }, { - "name": "RewindRequest", + "name": "Rewind", "code": 6, "mfgCode": null, "source": "client", @@ -14963,7 +15008,7 @@ "outgoing": 1 }, { - "name": "FastForwardRequest", + "name": "FastForward", "code": 7, "mfgCode": null, "source": "client", @@ -14971,7 +15016,7 @@ "outgoing": 1 }, { - "name": "SkipForwardRequest", + "name": "SkipForward", "code": 8, "mfgCode": null, "source": "client", @@ -14979,7 +15024,7 @@ "outgoing": 1 }, { - "name": "SkipBackwardRequest", + "name": "SkipBackward", "code": 9, "mfgCode": null, "source": "client", @@ -15015,7 +15060,7 @@ "commands": [], "attributes": [ { - "name": "playback state", + "name": "CurrentState", "code": 0, "mfgCode": null, "side": "server", @@ -15030,7 +15075,7 @@ "reportableChange": 0 }, { - "name": "start time", + "name": "StartTime", "code": 1, "mfgCode": null, "side": "server", @@ -15045,7 +15090,7 @@ "reportableChange": 0 }, { - "name": "duration", + "name": "Duration", "code": 2, "mfgCode": null, "side": "server", @@ -15060,7 +15105,7 @@ "reportableChange": 0 }, { - "name": "position", + "name": "SampledPosition", "code": 3, "mfgCode": null, "side": "server", @@ -15075,7 +15120,7 @@ "reportableChange": 0 }, { - "name": "playback speed", + "name": "PlaybackSpeed", "code": 4, "mfgCode": null, "side": "server", @@ -15090,7 +15135,7 @@ "reportableChange": 0 }, { - "name": "seek range end", + "name": "SeekRangeEnd", "code": 5, "mfgCode": null, "side": "server", @@ -15105,7 +15150,7 @@ "reportableChange": 0 }, { - "name": "seek range start", + "name": "SeekRangeStart", "code": 6, "mfgCode": null, "side": "server", @@ -15125,7 +15170,7 @@ "mfgCode": null, "side": "server", "included": 0, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -15175,7 +15220,7 @@ "enabled": 0, "commands": [ { - "name": "SelectInputRequest", + "name": "SelectInput", "code": 0, "mfgCode": null, "source": "client", @@ -15183,7 +15228,7 @@ "outgoing": 1 }, { - "name": "ShowInputStatusRequest", + "name": "ShowInputStatus", "code": 1, "mfgCode": null, "source": "client", @@ -15191,7 +15236,7 @@ "outgoing": 1 }, { - "name": "HideInputStatusRequest", + "name": "HideInputStatus", "code": 2, "mfgCode": null, "source": "client", @@ -15199,7 +15244,7 @@ "outgoing": 1 }, { - "name": "RenameInputRequest", + "name": "RenameInput", "code": 3, "mfgCode": null, "source": "client", @@ -15235,12 +15280,12 @@ "commands": [], "attributes": [ { - "name": "media input list", + "name": "InputList", "code": 0, "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -15250,7 +15295,7 @@ "reportableChange": 0 }, { - "name": "current media input", + "name": "CurrentInput", "code": 1, "mfgCode": null, "side": "server", @@ -15270,7 +15315,7 @@ "mfgCode": null, "side": "server", "included": 0, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -15381,7 +15426,7 @@ "enabled": 0, "commands": [ { - "name": "SendKeyRequest", + "name": "SendKey", "code": 0, "mfgCode": null, "source": "client", @@ -15442,7 +15487,7 @@ "enabled": 0, "commands": [ { - "name": "LaunchContentRequest", + "name": "LaunchContent", "code": 0, "mfgCode": null, "source": "client", @@ -15450,7 +15495,7 @@ "outgoing": 1 }, { - "name": "LaunchURLRequest", + "name": "LaunchURL", "code": 1, "mfgCode": null, "source": "client", @@ -15486,12 +15531,12 @@ "commands": [], "attributes": [ { - "name": "accept header list", + "name": "AcceptHeader", "code": 0, "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -15501,7 +15546,7 @@ "reportableChange": 0 }, { - "name": "supported streaming protocols", + "name": "SupportedStreamingProtocols", "code": 1, "mfgCode": null, "side": "server", @@ -15541,7 +15586,7 @@ "enabled": 0, "commands": [ { - "name": "SelectOutputRequest", + "name": "SelectOutput", "code": 0, "mfgCode": null, "source": "client", @@ -15549,7 +15594,7 @@ "outgoing": 1 }, { - "name": "RenameOutputRequest", + "name": "RenameOutput", "code": 1, "mfgCode": null, "source": "client", @@ -15585,12 +15630,12 @@ "commands": [], "attributes": [ { - "name": "audio output list", + "name": "OutputList", "code": 0, "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -15600,7 +15645,7 @@ "reportableChange": 0 }, { - "name": "current audio output", + "name": "CurrentOutput", "code": 1, "mfgCode": null, "side": "server", @@ -15640,7 +15685,7 @@ "enabled": 0, "commands": [ { - "name": "LaunchAppRequest", + "name": "LaunchApp", "code": 0, "mfgCode": null, "source": "client", @@ -15676,12 +15721,12 @@ "commands": [], "attributes": [ { - "name": "application launcher list", + "name": "CatalogList", "code": 0, "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -15691,7 +15736,7 @@ "reportableChange": 0 }, { - "name": "application launcher app", + "name": "CurrentApp", "code": 1, "mfgCode": null, "side": "server", @@ -15758,7 +15803,7 @@ "commands": [], "attributes": [ { - "name": "vendor name", + "name": "VendorName", "code": 0, "mfgCode": null, "side": "server", @@ -15773,7 +15818,7 @@ "reportableChange": 0 }, { - "name": "vendor id", + "name": "VendorID", "code": 1, "mfgCode": null, "side": "server", @@ -15788,7 +15833,7 @@ "reportableChange": 0 }, { - "name": "application name", + "name": "ApplicationName", "code": 2, "mfgCode": null, "side": "server", @@ -15803,7 +15848,7 @@ "reportableChange": 0 }, { - "name": "product id", + "name": "ProductID", "code": 3, "mfgCode": null, "side": "server", @@ -15818,7 +15863,7 @@ "reportableChange": 0 }, { - "name": "application status", + "name": "Status", "code": 5, "mfgCode": null, "side": "server", @@ -15833,7 +15878,7 @@ "reportableChange": 0 }, { - "name": "application version", + "name": "ApplicationVersion", "code": 6, "mfgCode": null, "side": "server", @@ -15848,12 +15893,12 @@ "reportableChange": 0 }, { - "name": "allowed vendor list", + "name": "AllowedVendorList", "code": 7, "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -15888,7 +15933,7 @@ "enabled": 0, "commands": [ { - "name": "GetSetupPINRequest", + "name": "GetSetupPIN", "code": 0, "mfgCode": null, "source": "client", @@ -16821,7 +16866,7 @@ "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -17406,7 +17451,7 @@ "mfgCode": null, "side": "server", "included": 0, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -21146,4 +21191,4 @@ } ], "log": [] -} +} \ No newline at end of file diff --git a/examples/bridge-app/bridge-common/bridge-app.matter b/examples/bridge-app/bridge-common/bridge-app.matter index 023aa2321088a0..f181f6b8f04a38 100644 --- a/examples/bridge-app/bridge-common/bridge-app.matter +++ b/examples/bridge-app/bridge-common/bridge-app.matter @@ -666,6 +666,10 @@ server cluster OnOff = 6 { kAcceptOnlyWhenOn = 0x1; } + bitmap OnOffFeature : BITMAP32 { + kLighting = 0x1; + } + readonly attribute boolean onOff = 0; readonly global attribute int16u clusterRevision = 65533; 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 408acd4fe4980b..3e771d0fdc49aa 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 @@ -1003,6 +1003,10 @@ client cluster OnOff = 6 { kAcceptOnlyWhenOn = 0x1; } + bitmap OnOffFeature : BITMAP32 { + kLighting = 0x1; + } + readonly attribute boolean onOff = 0; readonly attribute boolean globalSceneControl = 16384; attribute int16u onTime = 16385; diff --git a/examples/lighting-app/lighting-common/lighting-app.matter b/examples/lighting-app/lighting-common/lighting-app.matter index 562a35f38c2903..b53b0901c91637 100644 --- a/examples/lighting-app/lighting-common/lighting-app.matter +++ b/examples/lighting-app/lighting-common/lighting-app.matter @@ -1167,6 +1167,10 @@ server cluster OnOff = 6 { kAcceptOnlyWhenOn = 0x1; } + bitmap OnOffFeature : BITMAP32 { + kLighting = 0x1; + } + readonly attribute boolean onOff = 0; readonly attribute boolean globalSceneControl = 16384; attribute int16u onTime = 16385; diff --git a/examples/lighting-app/lighting-common/lighting-app.zap b/examples/lighting-app/lighting-common/lighting-app.zap index 25d2247db39016..5bf79812af3980 100644 --- a/examples/lighting-app/lighting-common/lighting-app.zap +++ b/examples/lighting-app/lighting-common/lighting-app.zap @@ -1446,7 +1446,7 @@ "mfgCode": null, "side": "server", "included": 0, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1597,7 +1597,7 @@ "mfgCode": null, "side": "server", "included": 0, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -2158,7 +2158,7 @@ "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -4418,7 +4418,7 @@ "reportableChange": 0 }, { - "name": "fabrics list", + "name": "Fabrics", "code": 1, "mfgCode": null, "side": "server", @@ -5455,7 +5455,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": "1", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -5722,7 +5722,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0xFE", + "defaultValue": "0xFF", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -5788,6 +5788,51 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "ServerGeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClientGeneratedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "FeatureMap", "code": 65532, diff --git a/examples/lock-app/lock-common/lock-app.matter b/examples/lock-app/lock-common/lock-app.matter index 3df89bd83592cf..ff34b5a97901e9 100644 --- a/examples/lock-app/lock-common/lock-app.matter +++ b/examples/lock-app/lock-common/lock-app.matter @@ -653,6 +653,10 @@ server cluster OnOff = 6 { kAcceptOnlyWhenOn = 0x1; } + bitmap OnOffFeature : BITMAP32 { + kLighting = 0x1; + } + readonly attribute boolean onOff = 0; readonly attribute boolean globalSceneControl = 16384; attribute int16u onTime = 16385; diff --git a/examples/placeholder/linux/apps/app1/config.matter b/examples/placeholder/linux/apps/app1/config.matter index 6f726728d00241..b55cccb1d937d2 100644 --- a/examples/placeholder/linux/apps/app1/config.matter +++ b/examples/placeholder/linux/apps/app1/config.matter @@ -557,6 +557,10 @@ server cluster OnOff = 6 { kAcceptOnlyWhenOn = 0x1; } + bitmap OnOffFeature : BITMAP32 { + kLighting = 0x1; + } + readonly attribute boolean onOff = 0; readonly global attribute int16u clusterRevision = 65533; diff --git a/examples/placeholder/linux/apps/app2/config.matter b/examples/placeholder/linux/apps/app2/config.matter index 6f726728d00241..b55cccb1d937d2 100644 --- a/examples/placeholder/linux/apps/app2/config.matter +++ b/examples/placeholder/linux/apps/app2/config.matter @@ -557,6 +557,10 @@ server cluster OnOff = 6 { kAcceptOnlyWhenOn = 0x1; } + bitmap OnOffFeature : BITMAP32 { + kLighting = 0x1; + } + readonly attribute boolean onOff = 0; readonly global attribute int16u clusterRevision = 65533; diff --git a/examples/pump-app/pump-common/pump-app.matter b/examples/pump-app/pump-common/pump-app.matter index 514861ccbec004..fa3d4c4e155390 100644 --- a/examples/pump-app/pump-common/pump-app.matter +++ b/examples/pump-app/pump-common/pump-app.matter @@ -895,6 +895,10 @@ server cluster OnOff = 6 { kAcceptOnlyWhenOn = 0x1; } + bitmap OnOffFeature : BITMAP32 { + kLighting = 0x1; + } + readonly attribute boolean onOff = 0; readonly attribute boolean globalSceneControl = 16384; attribute int16u onTime = 16385; diff --git a/examples/pump-controller-app/pump-controller-common/pump-controller-app.matter b/examples/pump-controller-app/pump-controller-common/pump-controller-app.matter index b71315f7cf4df6..7640967e7bddb7 100644 --- a/examples/pump-controller-app/pump-controller-common/pump-controller-app.matter +++ b/examples/pump-controller-app/pump-controller-common/pump-controller-app.matter @@ -597,6 +597,10 @@ client cluster OnOff = 6 { kAcceptOnlyWhenOn = 0x1; } + bitmap OnOffFeature : BITMAP32 { + kLighting = 0x1; + } + readonly attribute boolean onOff = 0; readonly global attribute int16u clusterRevision = 65533; diff --git a/examples/tv-app/tv-common/tv-app.matter b/examples/tv-app/tv-common/tv-app.matter index 1cbdd4f4506dfb..a8330a7fe73969 100644 --- a/examples/tv-app/tv-common/tv-app.matter +++ b/examples/tv-app/tv-common/tv-app.matter @@ -1414,6 +1414,10 @@ server cluster OnOff = 6 { kAcceptOnlyWhenOn = 0x1; } + bitmap OnOffFeature : BITMAP32 { + kLighting = 0x1; + } + readonly attribute boolean onOff = 0; readonly global attribute int16u clusterRevision = 65533; diff --git a/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter b/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter index 985951c7922260..33906c74951a7c 100644 --- a/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter +++ b/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter @@ -2073,6 +2073,10 @@ server cluster OnOff = 6 { kAcceptOnlyWhenOn = 0x1; } + bitmap OnOffFeature : BITMAP32 { + kLighting = 0x1; + } + readonly attribute boolean onOff = 0; readonly attribute boolean globalSceneControl = 16384; attribute int16u onTime = 16385; 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 f2b36f379413c7..b6b7fd4e2b9266 100644 --- a/src/app/clusters/on-off-server/on-off-server.cpp +++ b/src/app/clusters/on-off-server/on-off-server.cpp @@ -76,6 +76,15 @@ OnOffServer & OnOffServer::Instance() return instance; } +bool OnOffServer::HasFeature(chip::EndpointId endpoint, OnOffFeature feature) +{ + bool success; + uint32_t featureMap; + success = (Attributes::FeatureMap::Get(endpoint, &featureMap) == EMBER_ZCL_STATUS_SUCCESS); + + return success ? ((featureMap & to_underlying(feature)) != 0) : false; +} + /** @brief On/off Cluster Set Value * * This function is called when the on/off value needs to be set, either through @@ -119,24 +128,27 @@ EmberAfStatus OnOffServer::setOnOffValue(chip::EndpointId endpoint, uint8_t comm // before updating the on/off attribute. if (newValue) // Set On { - uint16_t onTime = 0; - Attributes::OnTime::Get(endpoint, &onTime); - - if (onTime == 0) + if (SupportsLightingApplications(endpoint)) { - emberAfOnOffClusterPrintln("On Command - OffWaitTime : 0"); - Attributes::OffWaitTime::Set(endpoint, 0); + uint16_t onTime = 0; + Attributes::OnTime::Get(endpoint, &onTime); - // Stop timer on the endpoint - EmberEventControl * event = getEventControl(endpoint); - if (event != nullptr) + if (onTime == 0) { - emberEventControlSetInactive(event); - emberAfOnOffClusterPrintln("On/Toggle Command - Stop Timer"); + emberAfOnOffClusterPrintln("On Command - OffWaitTime : 0"); + Attributes::OffWaitTime::Set(endpoint, 0); + + // Stop timer on the endpoint + EmberEventControl * event = getEventControl(endpoint); + if (event != nullptr) + { + emberEventControlSetInactive(event); + emberAfOnOffClusterPrintln("On/Toggle Command - Stop Timer"); + } } - } - Attributes::GlobalSceneControl::Set(endpoint, true); + Attributes::GlobalSceneControl::Set(endpoint, true); + } // write the new on/off value status = Attributes::OnOff::Set(endpoint, newValue); @@ -157,8 +169,11 @@ EmberAfStatus OnOffServer::setOnOffValue(chip::EndpointId endpoint, uint8_t comm } else // Set Off { - emberAfOnOffClusterPrintln("Off Command - OnTime : 0"); - Attributes::OnTime::Set(endpoint, 0); // Reset onTime + if (SupportsLightingApplications(endpoint)) + { + emberAfOnOffClusterPrintln("Off Command - OnTime : 0"); + Attributes::OnTime::Set(endpoint, 0); // Reset onTime + } #ifdef EMBER_AF_PLUGIN_LEVEL_CONTROL // If initiatedByLevelChange is false, then we assume that the level change @@ -197,7 +212,7 @@ void OnOffServer::initOnOffServer(chip::EndpointId endpoint) { #ifndef IGNORE_ON_OFF_CLUSTER_START_UP_ON_OFF // StartUp behavior relies on OnOff and StartUpOnOff attributes being non-volatile. - if (areStartUpOnOffServerAttributesNonVolatile(endpoint)) + if (SupportsLightingApplications(endpoint) && areStartUpOnOffServerAttributesNonVolatile(endpoint)) { // Read the StartUpOnOff attribute and set the OnOff attribute as per // following from zcl 7 14-0127-20i-zcl-ch-3-general.doc. @@ -283,50 +298,58 @@ bool OnOffServer::offWithEffectCommand(app::CommandHandler * commandObj, const a uint8_t effectVariant = commandData.effectVariant; chip::EndpointId endpoint = commandPath.mEndpointId; EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; + + if (SupportsLightingApplications(endpoint)) + { #ifdef EMBER_AF_PLUGIN_SCENES - FabricIndex fabric = commandObj->GetAccessingFabricIndex(); + FabricIndex fabric = commandObj->GetAccessingFabricIndex(); #endif // EMBER_AF_PLUGIN_SCENES - bool globalSceneControl = false; - OnOff::Attributes::GlobalSceneControl::Get(endpoint, &globalSceneControl); + bool globalSceneControl = false; + OnOff::Attributes::GlobalSceneControl::Get(endpoint, &globalSceneControl); - bool isOnBeforeCommand = false; - OnOff::Attributes::OnOff::Get(endpoint, &isOnBeforeCommand); + bool isOnBeforeCommand = false; + OnOff::Attributes::OnOff::Get(endpoint, &isOnBeforeCommand); - if (globalSceneControl) - { -#ifdef EMBER_AF_PLUGIN_SCENES - GroupId groupId = ZCL_SCENES_GLOBAL_SCENE_GROUP_ID; - if (commandObj->GetExchangeContext()->IsGroupExchangeContext()) + if (globalSceneControl) { - groupId = commandObj->GetExchangeContext()->GetSessionHandle()->AsGroupSession()->GetGroupId(); - } +#ifdef EMBER_AF_PLUGIN_SCENES + GroupId groupId = ZCL_SCENES_GLOBAL_SCENE_GROUP_ID; + if (commandObj->GetExchangeContext()->IsGroupExchangeContext()) + { + groupId = commandObj->GetExchangeContext()->GetSessionHandle()->AsGroupSession()->GetGroupId(); + } - emberAfScenesClusterStoreCurrentSceneCallback(fabric, endpoint, groupId, ZCL_SCENES_GLOBAL_SCENE_SCENE_ID); + emberAfScenesClusterStoreCurrentSceneCallback(fabric, endpoint, groupId, ZCL_SCENES_GLOBAL_SCENE_SCENE_ID); #endif // EMBER_AF_PLUGIN_SCENES - OnOff::Attributes::GlobalSceneControl::Set(endpoint, false); - - status = setOnOffValue(endpoint, Commands::Off::Id, false); - Attributes::OnTime::Set(endpoint, 0); - } - else - { - status = setOnOffValue(endpoint, Commands::Off::Id, false); - } + OnOff::Attributes::GlobalSceneControl::Set(endpoint, false); - // Only apply effect if OnOff is on - if (isOnBeforeCommand) - { - OnOffEffect * effect = inst(endpoint); + status = setOnOffValue(endpoint, Commands::Off::Id, false); + Attributes::OnTime::Set(endpoint, 0); + } + else + { + status = setOnOffValue(endpoint, Commands::Off::Id, false); + } - if (effect != nullptr && effect->mOffWithEffectTrigger != nullptr) + // Only apply effect if OnOff is on + if (isOnBeforeCommand) { - effect->mEffectIdentifier = effectId; - effect->mEffectVariant = effectVariant; + OnOffEffect * effect = inst(endpoint); - effect->mOffWithEffectTrigger(effect); + if (effect != nullptr && effect->mOffWithEffectTrigger != nullptr) + { + effect->mEffectIdentifier = effectId; + effect->mEffectVariant = effectVariant; + + effect->mOffWithEffectTrigger(effect); + } } } + else + { + status = EMBER_ZCL_STATUS_UNSUPPORTED_COMMAND; + } emberAfSendImmediateDefaultResponse(status); return true; @@ -336,6 +359,13 @@ bool OnOffServer::OnWithRecallGlobalSceneCommand(app::CommandHandler * commandOb { chip::EndpointId endpoint = commandPath.mEndpointId; EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; + + if (!SupportsLightingApplications(endpoint)) + { + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_UNSUPPORTED_COMMAND); + return true; + } + #ifdef EMBER_AF_PLUGIN_SCENES FabricIndex fabric = commandObj->GetAccessingFabricIndex(); #endif // EMBER_AF_PLUGIN_SCENES @@ -380,6 +410,7 @@ bool OnOffServer::OnWithTimedOffCommand(const app::ConcreteCommandPath & command EmberEventControl * event = configureEventControl(endpoint); VerifyOrExit(event != nullptr, status = EMBER_ZCL_STATUS_UNSUPPORTED_ENDPOINT); + VerifyOrExit(SupportsLightingApplications(endpoint), status = EMBER_ZCL_STATUS_UNSUPPORTED_COMMAND); OnOff::Attributes::OnOff::Get(endpoint, &isOn); diff --git a/src/app/clusters/on-off-server/on-off-server.h b/src/app/clusters/on-off-server/on-off-server.h index 043c3c8c52a932..94e61e66d81445 100644 --- a/src/app/clusters/on-off-server/on-off-server.h +++ b/src/app/clusters/on-off-server/on-off-server.h @@ -23,6 +23,8 @@ #include #include +using chip::app::Clusters::OnOff::OnOffFeature; + /********************************************************** * Defines and Macros *********************************************************/ @@ -58,6 +60,12 @@ class OnOffServer void updateOnOffTimeCommand(chip::EndpointId endpoint); EmberAfStatus setOnOffValue(chip::EndpointId endpoint, uint8_t command, bool initiatedByLevelChange); + bool HasFeature(chip::EndpointId endpoint, OnOffFeature feature); + inline bool SupportsLightingApplications(chip::EndpointId endpointId) + { + return HasFeature(endpointId, OnOffFeature::kLighting); + } + private: /********************************************************** * Functions Definitions diff --git a/src/app/tests/suites/certification/Test_TC_OO_1_1.yaml b/src/app/tests/suites/certification/Test_TC_OO_1_1.yaml index 96fcc0bbeb8f7e..9b48e099c7d24f 100644 --- a/src/app/tests/suites/certification/Test_TC_OO_1_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_OO_1_1.yaml @@ -93,7 +93,7 @@ tests: command: "readAttribute" attribute: "FeatureMap" response: - value: 0 + value: 1 - label: "Read the optional global attribute : FeatureMap" command: "readAttribute" @@ -114,4 +114,4 @@ tests: command: "readAttribute" attribute: "FeatureMap" response: - value: 0 + value: 1 diff --git a/src/app/zap-templates/zcl/data-model/chip/onoff-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/onoff-cluster.xml index 46631a33cabea0..ff6f391bb8fa1b 100644 --- a/src/app/zap-templates/zcl/data-model/chip/onoff-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/onoff-cluster.xml @@ -82,6 +82,10 @@ limitations under the License. - + + + + + diff --git a/src/app/zap-templates/zcl/data-model/silabs/general.xml b/src/app/zap-templates/zcl/data-model/silabs/general.xml index 34608181556928..6b66e5ca726e80 100644 --- a/src/app/zap-templates/zcl/data-model/silabs/general.xml +++ b/src/app/zap-templates/zcl/data-model/silabs/general.xml @@ -401,7 +401,7 @@ limitations under the License. max frequency on off transition time - on level + on level on transition time off transition time default move rate diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 2ef6cd902d81d2..ee323600f4bdbc 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -2666,6 +2666,10 @@ client cluster OnOff = 6 { kAcceptOnlyWhenOn = 0x1; } + bitmap OnOffFeature : BITMAP32 { + kLighting = 0x1; + } + readonly attribute boolean onOff = 0; readonly attribute boolean globalSceneControl = 16384; attribute int16u onTime = 16385; diff --git a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m index a3cb0649d996c2..d202049ebdfb19 100644 --- a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m +++ b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m @@ -16095,7 +16095,7 @@ - (void)testSendClusterTest_TC_OO_1_1_000006_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); + XCTAssertEqual([actualValue unsignedIntValue], 1UL); } [expectation fulfill]; @@ -16160,7 +16160,7 @@ - (void)testSendClusterTest_TC_OO_1_1_000009_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], 0UL); + XCTAssertEqual([actualValue unsignedIntValue], 1UL); } [expectation fulfill]; diff --git a/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h b/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h index 114b65c04bf6f3..cc864d4be4b860 100644 --- a/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h +++ b/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h @@ -263,7 +263,7 @@ /* Endpoint: 1, Cluster: On/Off (server), big-endian */ \ \ /* 355 - FeatureMap, */ \ - 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x01, \ \ /* Endpoint: 1, Cluster: Level Control (server), big-endian */ \ \ @@ -715,7 +715,7 @@ /* Endpoint: 1, Cluster: On/Off (server), little-endian */ \ \ /* 355 - FeatureMap, */ \ - 0x00, 0x00, 0x00, 0x00, \ + 0x01, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Level Control (server), little-endian */ \ \ @@ -1367,7 +1367,7 @@ { 0x00000010, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_SIMPLE_DEFAULT(0x0000) }, /* on off transition time */ \ { 0x00000011, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_SIMPLE_DEFAULT(0xFE) }, /* on level */ \ + ZAP_SIMPLE_DEFAULT(0xFF) }, /* on level */ \ { 0x00000012, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_EMPTY_DEFAULT() }, /* on transition time */ \ { 0x00000013, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ 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 71cd13a363701f..85bcb1ddc8b5d3 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 @@ -2969,6 +2969,12 @@ enum class OnOffControl : uint8_t kAcceptOnlyWhenOn = 0x1, }; +// Bitmap for OnOffFeature +enum class OnOffFeature : uint32_t +{ + kLighting = 0x1, +}; + namespace Commands { // Forward-declarations so we can reference these later. diff --git a/zzz_generated/app-common/app-common/zap-generated/enums.h b/zzz_generated/app-common/app-common/zap-generated/enums.h index 4d89dd9f211d6e..f41fd62f8956c0 100644 --- a/zzz_generated/app-common/app-common/zap-generated/enums.h +++ b/zzz_generated/app-common/app-common/zap-generated/enums.h @@ -955,6 +955,8 @@ enum EmberAfWiFiVersionType : uint8_t #define EMBER_AF_OCCUPANCY_SENSOR_TYPE_BITMAP_PHYSICAL_CONTACT_OFFSET (2) #define EMBER_AF_ON_OFF_CONTROL_ACCEPT_ONLY_WHEN_ON (1) #define EMBER_AF_ON_OFF_CONTROL_ACCEPT_ONLY_WHEN_ON_OFFSET (0) +#define EMBER_AF_ON_OFF_FEATURE_LIGHTING (1) +#define EMBER_AF_ON_OFF_FEATURE_LIGHTING_OFFSET (0) #define EMBER_AF_POWER_SOURCE_FEATURE_WIRED (1) #define EMBER_AF_POWER_SOURCE_FEATURE_WIRED_OFFSET (0) #define EMBER_AF_POWER_SOURCE_FEATURE_BATTERY (2) diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index 606b2281f73fb2..86788136d32999 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -29112,7 +29112,7 @@ class Test_TC_OO_1_1Suite : public TestCommand void OnSuccessResponse_6(uint32_t featureMap) { - VerifyOrReturn(CheckValue("featureMap", featureMap, 0UL)); + VerifyOrReturn(CheckValue("featureMap", featureMap, 1UL)); NextTest(); } @@ -29182,7 +29182,7 @@ class Test_TC_OO_1_1Suite : public TestCommand void OnSuccessResponse_9(uint32_t featureMap) { - VerifyOrReturn(CheckValue("featureMap", featureMap, 0UL)); + VerifyOrReturn(CheckValue("featureMap", featureMap, 1UL)); NextTest(); } diff --git a/zzz_generated/lighting-app/zap-generated/endpoint_config.h b/zzz_generated/lighting-app/zap-generated/endpoint_config.h index cab00a4d6932ed..2e44117a904500 100644 --- a/zzz_generated/lighting-app/zap-generated/endpoint_config.h +++ b/zzz_generated/lighting-app/zap-generated/endpoint_config.h @@ -258,7 +258,7 @@ /* Endpoint: 1, Cluster: On/Off (server), big-endian */ \ \ /* 351 - FeatureMap, */ \ - 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x01, \ \ /* Endpoint: 1, Cluster: Level Control (server), big-endian */ \ \ @@ -499,7 +499,7 @@ /* Endpoint: 1, Cluster: On/Off (server), little-endian */ \ \ /* 351 - FeatureMap, */ \ - 0x00, 0x00, 0x00, 0x00, \ + 0x01, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Level Control (server), little-endian */ \ \ @@ -852,7 +852,7 @@ { 0x00000010, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_SIMPLE_DEFAULT(0x0000) }, /* on off transition time */ \ { 0x00000011, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_SIMPLE_DEFAULT(0xFE) }, /* on level */ \ + ZAP_SIMPLE_DEFAULT(0xFF) }, /* on level */ \ { 0x00000012, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_EMPTY_DEFAULT() }, /* on transition time */ \ { 0x00000013, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \