Skip to content

Commit 1403573

Browse files
jmartinez-silabspull[bot]
authored andcommitted
Set OnOff StartUpOff attribute as nullable (#16377)
* OnOff StartUpOnOff attribute is nullable * regen * remove case EMBER_ZCL_START_UP_ON_OFF_VALUE_SET_TO_PREVIOUS. Already handled if startUpOnOff is null * Address PR comments * Fix conflicts by rebase and regen
1 parent 8a32812 commit 1403573

File tree

37 files changed

+264
-103
lines changed

37 files changed

+264
-103
lines changed

examples/all-clusters-app/all-clusters-common/all-clusters-app.matter

+1-1
Original file line numberDiff line numberDiff line change
@@ -2274,7 +2274,7 @@ server cluster OnOff = 6 {
22742274
readonly attribute boolean globalSceneControl = 16384;
22752275
attribute int16u onTime = 16385;
22762276
attribute int16u offWaitTime = 16386;
2277-
attribute enum8 startUpOnOff = 16387;
2277+
attribute nullable enum8 startUpOnOff = 16387;
22782278
readonly global attribute bitmap32 featureMap = 65532;
22792279
readonly global attribute int16u clusterRevision = 65533;
22802280

examples/light-switch-app/light-switch-common/light-switch-app.matter

+1-1
Original file line numberDiff line numberDiff line change
@@ -1096,7 +1096,7 @@ client cluster OnOff = 6 {
10961096
readonly attribute boolean globalSceneControl = 16384;
10971097
attribute int16u onTime = 16385;
10981098
attribute int16u offWaitTime = 16386;
1099-
attribute enum8 startUpOnOff = 16387;
1099+
attribute nullable enum8 startUpOnOff = 16387;
11001100
readonly global attribute attrib_id attributeList[] = 65531;
11011101
readonly global attribute bitmap32 featureMap = 65532;
11021102
readonly global attribute int16u clusterRevision = 65533;

examples/lighting-app/lighting-common/lighting-app.matter

+1-1
Original file line numberDiff line numberDiff line change
@@ -1174,7 +1174,7 @@ server cluster OnOff = 6 {
11741174
readonly attribute boolean globalSceneControl = 16384;
11751175
attribute int16u onTime = 16385;
11761176
attribute int16u offWaitTime = 16386;
1177-
attribute enum8 startUpOnOff = 16387;
1177+
attribute nullable enum8 startUpOnOff = 16387;
11781178
readonly global attribute bitmap32 featureMap = 65532;
11791179
readonly global attribute int16u clusterRevision = 65533;
11801180

examples/lock-app/lock-common/lock-app.matter

+1-1
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ server cluster OnOff = 6 {
660660
readonly attribute boolean globalSceneControl = 16384;
661661
attribute int16u onTime = 16385;
662662
attribute int16u offWaitTime = 16386;
663-
attribute enum8 startUpOnOff = 16387;
663+
attribute nullable enum8 startUpOnOff = 16387;
664664
readonly global attribute bitmap32 featureMap = 65532;
665665
readonly global attribute int16u clusterRevision = 65533;
666666

examples/placeholder/linux/apps/app1/config.matter

+2-2
Original file line numberDiff line numberDiff line change
@@ -1162,7 +1162,7 @@ client cluster OnOff = 6 {
11621162
readonly attribute boolean globalSceneControl = 16384;
11631163
attribute int16u onTime = 16385;
11641164
attribute int16u offWaitTime = 16386;
1165-
attribute enum8 startUpOnOff = 16387;
1165+
attribute nullable enum8 startUpOnOff = 16387;
11661166
readonly global attribute bitmap32 featureMap = 65532;
11671167
readonly global attribute int16u clusterRevision = 65533;
11681168

@@ -1213,7 +1213,7 @@ server cluster OnOff = 6 {
12131213
readonly attribute boolean globalSceneControl = 16384;
12141214
attribute int16u onTime = 16385;
12151215
attribute int16u offWaitTime = 16386;
1216-
attribute enum8 startUpOnOff = 16387;
1216+
attribute nullable enum8 startUpOnOff = 16387;
12171217
readonly global attribute bitmap32 featureMap = 65532;
12181218
readonly global attribute int16u clusterRevision = 65533;
12191219

examples/placeholder/linux/apps/app2/config.matter

+1-1
Original file line numberDiff line numberDiff line change
@@ -1150,7 +1150,7 @@ server cluster OnOff = 6 {
11501150
readonly attribute boolean globalSceneControl = 16384;
11511151
attribute int16u onTime = 16385;
11521152
attribute int16u offWaitTime = 16386;
1153-
attribute enum8 startUpOnOff = 16387;
1153+
attribute nullable enum8 startUpOnOff = 16387;
11541154
readonly global attribute bitmap32 featureMap = 65532;
11551155
readonly global attribute int16u clusterRevision = 65533;
11561156

examples/pump-app/pump-common/pump-app.matter

+1-1
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,7 @@ server cluster OnOff = 6 {
902902
readonly attribute boolean globalSceneControl = 16384;
903903
attribute int16u onTime = 16385;
904904
attribute int16u offWaitTime = 16386;
905-
attribute enum8 startUpOnOff = 16387;
905+
attribute nullable enum8 startUpOnOff = 16387;
906906
readonly global attribute int16u clusterRevision = 65533;
907907

908908
request struct OffWithEffectRequest {

examples/tv-casting-app/tv-casting-common/tv-casting-app.matter

+2-2
Original file line numberDiff line numberDiff line change
@@ -1448,7 +1448,7 @@ client cluster OnOff = 6 {
14481448
readonly attribute boolean globalSceneControl = 16384;
14491449
attribute int16u onTime = 16385;
14501450
attribute int16u offWaitTime = 16386;
1451-
attribute enum8 startUpOnOff = 16387;
1451+
attribute nullable enum8 startUpOnOff = 16387;
14521452
readonly global attribute bitmap32 featureMap = 65532;
14531453
readonly global attribute int16u clusterRevision = 65533;
14541454

@@ -1485,7 +1485,7 @@ server cluster OnOff = 6 {
14851485
readonly attribute boolean globalSceneControl = 16384;
14861486
attribute int16u onTime = 16385;
14871487
attribute int16u offWaitTime = 16386;
1488-
attribute enum8 startUpOnOff = 16387;
1488+
attribute nullable enum8 startUpOnOff = 16387;
14891489
readonly global attribute bitmap32 featureMap = 65532;
14901490
readonly global attribute int16u clusterRevision = 65533;
14911491

src/app/clusters/on-off-server/on-off-server.cpp

+20-19
Original file line numberDiff line numberDiff line change
@@ -229,35 +229,36 @@ void OnOffServer::initOnOffServer(chip::EndpointId endpoint)
229229
// set the OnOff attribute to 1.If the previous value of the OnOff
230230
// attribute is equal to 1, set the OnOff attribute to 0 (toggle).
231231
// 0x03-0xfe These values are reserved. No action.
232-
// 0xff Set the OnOff attribute to its previous value.
232+
// 0xff This value cannot happen.
233+
// null Set the OnOff attribute to its previous value.
233234

234235
// Initialize startUpOnOff to No action value 0xFE
235-
uint8_t startUpOnOff = 0xFE;
236-
EmberAfStatus status = Attributes::StartUpOnOff::Get(endpoint, &startUpOnOff);
236+
app::DataModel::Nullable<uint8_t> startUpOnOff;
237+
EmberAfStatus status = Attributes::StartUpOnOff::Get(endpoint, startUpOnOff);
237238
if (status == EMBER_ZCL_STATUS_SUCCESS)
238239
{
239240
// Initialise updated value to 0
240241
bool updatedOnOff = 0;
241242
status = Attributes::OnOff::Get(endpoint, &updatedOnOff);
242243
if (status == EMBER_ZCL_STATUS_SUCCESS)
243244
{
244-
switch (startUpOnOff)
245+
if (!startUpOnOff.IsNull())
245246
{
246-
case EMBER_ZCL_START_UP_ON_OFF_VALUE_SET_TO_OFF:
247-
updatedOnOff = 0; // Off
248-
break;
249-
case EMBER_ZCL_START_UP_ON_OFF_VALUE_SET_TO_ON:
250-
updatedOnOff = 1; // On
251-
break;
252-
case EMBER_ZCL_START_UP_ON_OFF_VALUE_SET_TO_TOGGLE:
253-
updatedOnOff = !updatedOnOff;
254-
break;
255-
case EMBER_ZCL_START_UP_ON_OFF_VALUE_SET_TO_PREVIOUS:
256-
default:
257-
// All other values 0x03- 0xFE are reserved - no action.
258-
// When value is 0xFF - update with last value - that is as good as
259-
// no action.
260-
break;
247+
switch (startUpOnOff.Value())
248+
{
249+
case EMBER_ZCL_START_UP_ON_OFF_VALUE_SET_TO_OFF:
250+
updatedOnOff = 0; // Off
251+
break;
252+
case EMBER_ZCL_START_UP_ON_OFF_VALUE_SET_TO_ON:
253+
updatedOnOff = 1; // On
254+
break;
255+
case EMBER_ZCL_START_UP_ON_OFF_VALUE_SET_TO_TOGGLE:
256+
updatedOnOff = !updatedOnOff;
257+
break;
258+
default:
259+
// All other values 0x03- 0xFE are reserved - no action.
260+
break;
261+
}
261262
}
262263
status = Attributes::OnOff::Set(endpoint, updatedOnOff);
263264
}

src/app/zap-templates/zcl/data-model/chip/onoff-cluster.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ limitations under the License.
5252
<attribute side="server" code="0x4000" define="GLOBAL_SCENE_CONTROL" type="boolean" default="1" optional="true">GlobalSceneControl</attribute>
5353
<attribute side="server" code="0x4001" define="ON_TIME" type="int16u" default="0" writable="true" optional="true">OnTime</attribute>
5454
<attribute side="server" code="0x4002" define="OFF_WAIT_TIME" type="int16u" default="0" writable="true" optional="true">OffWaitTime</attribute>
55-
<attribute side="server" code="0x4003" define="START_UP_ON_OFF" type="enum8" writable="true" optional="true">StartUpOnOff</attribute>
55+
<attribute side="server" code="0x4003" define="START_UP_ON_OFF" type="enum8" default="0" writable="true" isNullable="true" optional="true">StartUpOnOff</attribute>
5656

5757
<command source="client" code="0x00" name="Off" optional="false">
5858
<description>On receipt of this command, a device SHALL enter its ‘Off’ state. This state is device dependent, but it is recommended that it is used for power off or similar functions. On receipt of the Off command, the OnTime attribute SHALL be set to 0.</description>

src/app/zap-templates/zcl/data-model/silabs/types.xml

-1
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,6 @@ limitations under the License.
813813
<item name="SetToOn" value="0x01"/>
814814
<item name="SetToToggle" value="0x02"/>
815815
<!-- 0x03-0xFF reserved -->
816-
<item name="SetToPrevious" value="0xFF"/>
817816
</enum>
818817
<enum name="LevelControlOptions" type="BITMAP8">
819818
<item name="ExecuteIfOff" value="0x1"/>

src/controller/data_model/controller-clusters.matter

+1-1
Original file line numberDiff line numberDiff line change
@@ -2690,7 +2690,7 @@ client cluster OnOff = 6 {
26902690
readonly attribute boolean globalSceneControl = 16384;
26912691
attribute int16u onTime = 16385;
26922692
attribute int16u offWaitTime = 16386;
2693-
attribute enum8 startUpOnOff = 16387;
2693+
attribute nullable enum8 startUpOnOff = 16387;
26942694
readonly global attribute command_id generatedCommandList[] = 65528;
26952695
readonly global attribute command_id acceptedCommandList[] = 65529;
26962696
readonly global attribute attrib_id attributeList[] = 65531;

src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp

+11-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/controller/java/zap-generated/CHIPClustersWrite-JNI.cpp

+10-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/controller/java/zap-generated/CHIPReadCallbacks.cpp

+64
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/controller/java/zap-generated/CHIPReadCallbacks.h

+29
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java

+15-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/controller/java/zap-generated/chip/devicecontroller/ClusterReadMapping.java

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)