Skip to content

Commit

Permalink
[Scenes] AttributeValue refactor (#33260)
Browse files Browse the repository at this point in the history
* Refactor AttributeValue to the appropriate Value* in AttributeValueList

* Updated attribute value in test

* Applied comments about typing and commented code, as well as example of colorcontrol in scenes

* Made static check on same type instead of size

* Update src/app/zap-templates/zcl/data-model/chip/scene.xml

Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>

* Added checks for missing values in level control and on off

* Added checks for HasValue in color control apply scene handler

* Added check on out of range values in the level control handler

* Updated Zap generated files

---------

Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
  • Loading branch information
2 people authored and pull[bot] committed Sep 10, 2024
1 parent 5688857 commit 1254176
Show file tree
Hide file tree
Showing 46 changed files with 1,295 additions and 414 deletions.
116 changes: 58 additions & 58 deletions data_model/1.3/clusters/Scenes.xml
Original file line number Diff line number Diff line change
@@ -1,61 +1,61 @@
<?xml version="1.0"?>
<!--
Copyright (C) Connectivity Standards Alliance (2021). All rights reserved.
The information within this document is the property of the Connectivity
Standards Alliance and its use and disclosure are restricted, except as
expressly set forth herein.
Connectivity Standards Alliance hereby grants you a fully-paid, non-exclusive,
nontransferable, worldwide, limited and revocable license (without the right to
sublicense), under Connectivity Standards Alliance's applicable copyright
rights, to view, download, save, reproduce and use the document solely for your
own internal purposes and in accordance with the terms of the license set forth
herein. This license does not authorize you to, and you expressly warrant that
you shall not: (a) permit others (outside your organization) to use this
document; (b) post or publish this document; (c) modify, adapt, translate, or
otherwise change this document in any manner or create any derivative work
based on this document; (d) remove or modify any notice or label on this
document, including this Copyright Notice, License and Disclaimer. The
Connectivity Standards Alliance does not grant you any license hereunder other
than as expressly stated herein.
Elements of this document may be subject to third party intellectual property
rights, including without limitation, patent, copyright or trademark rights,
and any such third party may or may not be a member of the Connectivity
Standards Alliance. Connectivity Standards Alliance members grant other
Connectivity Standards Alliance members certain intellectual property rights as
set forth in the Connectivity Standards Alliance IPR Policy. Connectivity
Standards Alliance members do not grant you any rights under this license. The
Connectivity Standards Alliance is not responsible for, and shall not be held
responsible in any manner for, identifying or failing to identify any or all
such third party intellectual property rights. Please visit www.csa-iot.org for
more information on how to become a member of the Connectivity Standards
Alliance.
This document and the information contained herein are provided on an “AS IS”
basis and the Connectivity Standards Alliance DISCLAIMS ALL WARRANTIES EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO (A) ANY WARRANTY THAT THE USE OF THE
INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OF THIRD PARTIES (INCLUDING
WITHOUT LIMITATION ANY INTELLECTUAL PROPERTY RIGHTS INCLUDING PATENT, COPYRIGHT
OR TRADEMARK RIGHTS); OR (B) ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE, TITLE OR NONINFRINGEMENT. IN NO EVENT WILL THE
CONNECTIVITY STANDARDS ALLIANCE BE LIABLE FOR ANY LOSS OF PROFITS, LOSS OF
BUSINESS, LOSS OF USE OF DATA, INTERRUPTION OF BUSINESS, OR FOR ANY OTHER
DIRECT, INDIRECT, SPECIAL OR EXEMPLARY, INCIDENTAL, PUNITIVE OR CONSEQUENTIAL
DAMAGES OF ANY KIND, IN CONTRACT OR IN TORT, IN CONNECTION WITH THIS DOCUMENT
OR THE INFORMATION CONTAINED HEREIN, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
LOSS OR DAMAGE.
All company, brand and product names in this document may be trademarks that
are the sole property of their respective owners.
This notice and disclaimer must be included on all copies of this document.
Connectivity Standards Alliance
508 Second Street, Suite 206
Davis, CA 95616, USA
:xrefstyle: basic
<!--
Copyright (C) Connectivity Standards Alliance (2021). All rights reserved.
The information within this document is the property of the Connectivity
Standards Alliance and its use and disclosure are restricted, except as
expressly set forth herein.
Connectivity Standards Alliance hereby grants you a fully-paid, non-exclusive,
nontransferable, worldwide, limited and revocable license (without the right to
sublicense), under Connectivity Standards Alliance's applicable copyright
rights, to view, download, save, reproduce and use the document solely for your
own internal purposes and in accordance with the terms of the license set forth
herein. This license does not authorize you to, and you expressly warrant that
you shall not: (a) permit others (outside your organization) to use this
document; (b) post or publish this document; (c) modify, adapt, translate, or
otherwise change this document in any manner or create any derivative work
based on this document; (d) remove or modify any notice or label on this
document, including this Copyright Notice, License and Disclaimer. The
Connectivity Standards Alliance does not grant you any license hereunder other
than as expressly stated herein.
Elements of this document may be subject to third party intellectual property
rights, including without limitation, patent, copyright or trademark rights,
and any such third party may or may not be a member of the Connectivity
Standards Alliance. Connectivity Standards Alliance members grant other
Connectivity Standards Alliance members certain intellectual property rights as
set forth in the Connectivity Standards Alliance IPR Policy. Connectivity
Standards Alliance members do not grant you any rights under this license. The
Connectivity Standards Alliance is not responsible for, and shall not be held
responsible in any manner for, identifying or failing to identify any or all
such third party intellectual property rights. Please visit www.csa-iot.org for
more information on how to become a member of the Connectivity Standards
Alliance.
This document and the information contained herein are provided on an “AS IS”
basis and the Connectivity Standards Alliance DISCLAIMS ALL WARRANTIES EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO (A) ANY WARRANTY THAT THE USE OF THE
INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OF THIRD PARTIES (INCLUDING
WITHOUT LIMITATION ANY INTELLECTUAL PROPERTY RIGHTS INCLUDING PATENT, COPYRIGHT
OR TRADEMARK RIGHTS); OR (B) ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE, TITLE OR NONINFRINGEMENT. IN NO EVENT WILL THE
CONNECTIVITY STANDARDS ALLIANCE BE LIABLE FOR ANY LOSS OF PROFITS, LOSS OF
BUSINESS, LOSS OF USE OF DATA, INTERRUPTION OF BUSINESS, OR FOR ANY OTHER
DIRECT, INDIRECT, SPECIAL OR EXEMPLARY, INCIDENTAL, PUNITIVE OR CONSEQUENTIAL
DAMAGES OF ANY KIND, IN CONTRACT OR IN TORT, IN CONNECTION WITH THIS DOCUMENT
OR THE INFORMATION CONTAINED HEREIN, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
LOSS OR DAMAGE.
All company, brand and product names in this document may be trademarks that
are the sole property of their respective owners.
This notice and disclaimer must be included on all copies of this document.
Connectivity Standards Alliance
508 Second Street, Suite 206
Davis, CA 95616, USA
:xrefstyle: basic
-->
<cluster xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="types types.xsd cluster cluster.xsd" id="0x0062" name="Scenes Management Cluster" revision="1">
<revisionHistory>
Expand Down Expand Up @@ -398,4 +398,4 @@ Davis, CA 95616, USA
</field>
</command>
</commands>
</cluster>
</cluster>
Original file line number Diff line number Diff line change
Expand Up @@ -3513,14 +3513,21 @@ provisional cluster ScenesManagement = 98 {
kSceneNames = 0x1;
}

struct AttributeValuePair {
struct AttributeValuePairStruct {
attrib_id attributeID = 0;
int32u attributeValue = 1;
optional int8u valueUnsigned8 = 1;
optional int8s valueSigned8 = 2;
optional int16u valueUnsigned16 = 3;
optional int16s valueSigned16 = 4;
optional int32u valueUnsigned32 = 5;
optional int32s valueSigned32 = 6;
optional int64u valueUnsigned64 = 7;
optional int64s valueSigned64 = 8;
}

struct ExtensionFieldSet {
cluster_id clusterID = 0;
AttributeValuePair attributeValueList[] = 1;
AttributeValuePairStruct attributeValueList[] = 1;
}

fabric_scoped struct SceneInfoStruct {
Expand Down Expand Up @@ -3632,7 +3639,7 @@ provisional cluster ScenesManagement = 98 {
int8u sceneIdentifierFrom = 2;
}

/** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeId": VALUE, "AttributeValue": VALUE}]}' */
/** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeID": VALUE, "Value*": VALUE}]}' */
fabric command access(invoke: manage) AddScene(AddSceneRequest): AddSceneResponse = 0;
/** Retrieves the requested scene entry from its Scene table. */
fabric command ViewScene(ViewSceneRequest): ViewSceneResponse = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2425,14 +2425,21 @@ provisional cluster ScenesManagement = 98 {
kSceneNames = 0x1;
}

struct AttributeValuePair {
struct AttributeValuePairStruct {
attrib_id attributeID = 0;
int32u attributeValue = 1;
optional int8u valueUnsigned8 = 1;
optional int8s valueSigned8 = 2;
optional int16u valueUnsigned16 = 3;
optional int16s valueSigned16 = 4;
optional int32u valueUnsigned32 = 5;
optional int32s valueSigned32 = 6;
optional int64u valueUnsigned64 = 7;
optional int64s valueSigned64 = 8;
}

struct ExtensionFieldSet {
cluster_id clusterID = 0;
AttributeValuePair attributeValueList[] = 1;
AttributeValuePairStruct attributeValueList[] = 1;
}

fabric_scoped struct SceneInfoStruct {
Expand Down Expand Up @@ -2544,7 +2551,7 @@ provisional cluster ScenesManagement = 98 {
int8u sceneIdentifierFrom = 2;
}

/** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeId": VALUE, "AttributeValue": VALUE}]}' */
/** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeID": VALUE, "Value*": VALUE}]}' */
fabric command access(invoke: manage) AddScene(AddSceneRequest): AddSceneResponse = 0;
/** Retrieves the requested scene entry from its Scene table. */
fabric command ViewScene(ViewSceneRequest): ViewSceneResponse = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1515,14 +1515,21 @@ provisional cluster ScenesManagement = 98 {
kSceneNames = 0x1;
}

struct AttributeValuePair {
struct AttributeValuePairStruct {
attrib_id attributeID = 0;
int32u attributeValue = 1;
optional int8u valueUnsigned8 = 1;
optional int8s valueSigned8 = 2;
optional int16u valueUnsigned16 = 3;
optional int16s valueSigned16 = 4;
optional int32u valueUnsigned32 = 5;
optional int32s valueSigned32 = 6;
optional int64u valueUnsigned64 = 7;
optional int64s valueSigned64 = 8;
}

struct ExtensionFieldSet {
cluster_id clusterID = 0;
AttributeValuePair attributeValueList[] = 1;
AttributeValuePairStruct attributeValueList[] = 1;
}

fabric_scoped struct SceneInfoStruct {
Expand Down Expand Up @@ -1634,7 +1641,7 @@ provisional cluster ScenesManagement = 98 {
int8u sceneIdentifierFrom = 2;
}

/** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeId": VALUE, "AttributeValue": VALUE}]}' */
/** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeID": VALUE, "Value*": VALUE}]}' */
fabric command access(invoke: manage) AddScene(AddSceneRequest): AddSceneResponse = 0;
/** Retrieves the requested scene entry from its Scene table. */
fabric command ViewScene(ViewSceneRequest): ViewSceneResponse = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2043,14 +2043,21 @@ provisional cluster ScenesManagement = 98 {
kSceneNames = 0x1;
}

struct AttributeValuePair {
struct AttributeValuePairStruct {
attrib_id attributeID = 0;
int32u attributeValue = 1;
optional int8u valueUnsigned8 = 1;
optional int8s valueSigned8 = 2;
optional int16u valueUnsigned16 = 3;
optional int16s valueSigned16 = 4;
optional int32u valueUnsigned32 = 5;
optional int32s valueSigned32 = 6;
optional int64u valueUnsigned64 = 7;
optional int64s valueSigned64 = 8;
}

struct ExtensionFieldSet {
cluster_id clusterID = 0;
AttributeValuePair attributeValueList[] = 1;
AttributeValuePairStruct attributeValueList[] = 1;
}

fabric_scoped struct SceneInfoStruct {
Expand Down Expand Up @@ -2162,7 +2169,7 @@ provisional cluster ScenesManagement = 98 {
int8u sceneIdentifierFrom = 2;
}

/** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeId": VALUE, "AttributeValue": VALUE}]}' */
/** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeID": VALUE, "Value*": VALUE}]}' */
fabric command access(invoke: manage) AddScene(AddSceneRequest): AddSceneResponse = 0;
/** Retrieves the requested scene entry from its Scene table. */
fabric command ViewScene(ViewSceneRequest): ViewSceneResponse = 1;
Expand Down
15 changes: 11 additions & 4 deletions examples/light-switch-app/qpg/zap/switch.matter
Original file line number Diff line number Diff line change
Expand Up @@ -1840,14 +1840,21 @@ provisional cluster ScenesManagement = 98 {
kSceneNames = 0x1;
}

struct AttributeValuePair {
struct AttributeValuePairStruct {
attrib_id attributeID = 0;
int32u attributeValue = 1;
optional int8u valueUnsigned8 = 1;
optional int8s valueSigned8 = 2;
optional int16u valueUnsigned16 = 3;
optional int16s valueSigned16 = 4;
optional int32u valueUnsigned32 = 5;
optional int32s valueSigned32 = 6;
optional int64u valueUnsigned64 = 7;
optional int64s valueSigned64 = 8;
}

struct ExtensionFieldSet {
cluster_id clusterID = 0;
AttributeValuePair attributeValueList[] = 1;
AttributeValuePairStruct attributeValueList[] = 1;
}

fabric_scoped struct SceneInfoStruct {
Expand Down Expand Up @@ -1959,7 +1966,7 @@ provisional cluster ScenesManagement = 98 {
int8u sceneIdentifierFrom = 2;
}

/** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeId": VALUE, "AttributeValue": VALUE}]}' */
/** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeID": VALUE, "Value*": VALUE}]}' */
fabric command access(invoke: manage) AddScene(AddSceneRequest): AddSceneResponse = 0;
/** Retrieves the requested scene entry from its Scene table. */
fabric command ViewScene(ViewSceneRequest): ViewSceneResponse = 1;
Expand Down
15 changes: 11 additions & 4 deletions examples/lighting-app/lighting-common/lighting-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -1853,14 +1853,21 @@ provisional cluster ScenesManagement = 98 {
kSceneNames = 0x1;
}

struct AttributeValuePair {
struct AttributeValuePairStruct {
attrib_id attributeID = 0;
int32u attributeValue = 1;
optional int8u valueUnsigned8 = 1;
optional int8s valueSigned8 = 2;
optional int16u valueUnsigned16 = 3;
optional int16s valueSigned16 = 4;
optional int32u valueUnsigned32 = 5;
optional int32s valueSigned32 = 6;
optional int64u valueUnsigned64 = 7;
optional int64s valueSigned64 = 8;
}

struct ExtensionFieldSet {
cluster_id clusterID = 0;
AttributeValuePair attributeValueList[] = 1;
AttributeValuePairStruct attributeValueList[] = 1;
}

fabric_scoped struct SceneInfoStruct {
Expand Down Expand Up @@ -1972,7 +1979,7 @@ provisional cluster ScenesManagement = 98 {
int8u sceneIdentifierFrom = 2;
}

/** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeId": VALUE, "AttributeValue": VALUE}]}' */
/** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeID": VALUE, "Value*": VALUE}]}' */
fabric command access(invoke: manage) AddScene(AddSceneRequest): AddSceneResponse = 0;
/** Retrieves the requested scene entry from its Scene table. */
fabric command ViewScene(ViewSceneRequest): ViewSceneResponse = 1;
Expand Down
15 changes: 11 additions & 4 deletions examples/lighting-app/silabs/data_model/lighting-thread-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -1557,14 +1557,21 @@ provisional cluster ScenesManagement = 98 {
kSceneNames = 0x1;
}

struct AttributeValuePair {
struct AttributeValuePairStruct {
attrib_id attributeID = 0;
int32u attributeValue = 1;
optional int8u valueUnsigned8 = 1;
optional int8s valueSigned8 = 2;
optional int16u valueUnsigned16 = 3;
optional int16s valueSigned16 = 4;
optional int32u valueUnsigned32 = 5;
optional int32s valueSigned32 = 6;
optional int64u valueUnsigned64 = 7;
optional int64s valueSigned64 = 8;
}

struct ExtensionFieldSet {
cluster_id clusterID = 0;
AttributeValuePair attributeValueList[] = 1;
AttributeValuePairStruct attributeValueList[] = 1;
}

fabric_scoped struct SceneInfoStruct {
Expand Down Expand Up @@ -1676,7 +1683,7 @@ provisional cluster ScenesManagement = 98 {
int8u sceneIdentifierFrom = 2;
}

/** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeId": VALUE, "AttributeValue": VALUE}]}' */
/** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeID": VALUE, "Value*": VALUE}]}' */
fabric command access(invoke: manage) AddScene(AddSceneRequest): AddSceneResponse = 0;
/** Retrieves the requested scene entry from its Scene table. */
fabric command ViewScene(ViewSceneRequest): ViewSceneResponse = 1;
Expand Down
15 changes: 11 additions & 4 deletions examples/lighting-app/silabs/data_model/lighting-wifi-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -1848,14 +1848,21 @@ provisional cluster ScenesManagement = 98 {
kSceneNames = 0x1;
}

struct AttributeValuePair {
struct AttributeValuePairStruct {
attrib_id attributeID = 0;
int32u attributeValue = 1;
optional int8u valueUnsigned8 = 1;
optional int8s valueSigned8 = 2;
optional int16u valueUnsigned16 = 3;
optional int16s valueSigned16 = 4;
optional int32u valueUnsigned32 = 5;
optional int32s valueSigned32 = 6;
optional int64u valueUnsigned64 = 7;
optional int64s valueSigned64 = 8;
}

struct ExtensionFieldSet {
cluster_id clusterID = 0;
AttributeValuePair attributeValueList[] = 1;
AttributeValuePairStruct attributeValueList[] = 1;
}

fabric_scoped struct SceneInfoStruct {
Expand Down Expand Up @@ -1967,7 +1974,7 @@ provisional cluster ScenesManagement = 98 {
int8u sceneIdentifierFrom = 2;
}

/** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeId": VALUE, "AttributeValue": VALUE}]}' */
/** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeID": VALUE, "Value*": VALUE}]}' */
fabric command access(invoke: manage) AddScene(AddSceneRequest): AddSceneResponse = 0;
/** Retrieves the requested scene entry from its Scene table. */
fabric command ViewScene(ViewSceneRequest): ViewSceneResponse = 1;
Expand Down
Loading

0 comments on commit 1254176

Please sign in to comment.