Skip to content

Commit

Permalink
Extract OnOff cluster definition from general.xml and zll.xml (#8330)
Browse files Browse the repository at this point in the history
* Extract OnOff cluster definition from general.xml and zll.xml to have it into its own file and reformat it to make it easier to read when comparing to the spec

* Update some attributes name into the tests file to match the name update in onoff.xml

* Update zap files to takes into account the names changes, as well as the Cluster Revision change

* Use as[Upper/Lower]CamelCase instead of asCamelCased for src/darwin/Framework/CHIP/templates

* Update gen/ folders
  • Loading branch information
vivien-apple authored Jul 14, 2021
1 parent 67d91c2 commit 8ceb910
Show file tree
Hide file tree
Showing 36 changed files with 925 additions and 235 deletions.
91 changes: 83 additions & 8 deletions examples/all-clusters-app/all-clusters-common/all-clusters-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@
"commands": [],
"attributes": [
{
"name": "on/off",
"name": "OnOff",
"code": 0,
"mfgCode": null,
"side": "server",
Expand Down Expand Up @@ -6602,7 +6602,7 @@
"commands": [],
"attributes": [
{
"name": "on/off",
"name": "OnOff",
"code": 0,
"mfgCode": null,
"side": "server",
Expand All @@ -6617,7 +6617,7 @@
"reportableChange": 0
},
{
"name": "global scene control",
"name": "GlobalSceneControl",
"code": 16384,
"mfgCode": null,
"side": "server",
Expand All @@ -6632,7 +6632,7 @@
"reportableChange": 0
},
{
"name": "on time",
"name": "OnTime",
"code": 16385,
"mfgCode": null,
"side": "server",
Expand All @@ -6647,7 +6647,7 @@
"reportableChange": 0
},
{
"name": "off wait time",
"name": "OffWaitTime",
"code": 16386,
"mfgCode": null,
"side": "server",
Expand All @@ -6662,7 +6662,7 @@
"reportableChange": 0
},
{
"name": "start up on off",
"name": "StartUpOnOff",
"code": 16387,
"mfgCode": null,
"side": "server",
Expand Down Expand Up @@ -6700,7 +6700,7 @@
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "2",
"defaultValue": "3",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
Expand Down Expand Up @@ -14167,7 +14167,7 @@
"commands": [],
"attributes": [
{
"name": "on/off",
"name": "OnOff",
"code": 0,
"mfgCode": null,
"side": "server",
Expand All @@ -14181,6 +14181,81 @@
"maxInterval": 65344,
"reportableChange": 0
},
{
"name": "GlobalSceneControl",
"code": 16384,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "1",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
},
{
"name": "OnTime",
"code": 16385,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
},
{
"name": "OffWaitTime",
"code": 16386,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
},
{
"name": "StartUpOnOff",
"code": 16387,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
},
{
"name": "feature map",
"code": 65532,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x0000",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
},
{
"name": "cluster revision",
"code": 65533,
Expand Down
49 changes: 32 additions & 17 deletions examples/all-clusters-app/all-clusters-common/gen/endpoint_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,11 @@
0x00, 0x00, 0x00, 0x00, \
\
/* 10414 - total active power, */ \
0x00, 0x00, 0x00, 0x00, \
\
/* Endpoint: 2, Cluster: On/off (server), big-endian */ \
\
/* 10418 - feature map, */ \
0x00, 0x00, 0x00, 0x00, \
}

Expand Down Expand Up @@ -1892,12 +1897,17 @@
0x00, 0x00, 0x00, 0x00, \
\
/* 10414 - total active power, */ \
0x00, 0x00, 0x00, 0x00, \
\
/* Endpoint: 2, Cluster: On/off (server), little-endian */ \
\
/* 10418 - feature map, */ \
0x00, 0x00, 0x00, 0x00, \
}

#endif // BIGENDIAN_CPU

#define GENERATED_DEFAULTS_COUNT (126)
#define GENERATED_DEFAULTS_COUNT (127)

#define ZAP_TYPE(type) ZCL_##type##_ATTRIBUTE_TYPE
#define ZAP_LONG_DEFAULTS_INDEX(index) \
Expand Down Expand Up @@ -1925,7 +1935,7 @@

#define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask
// This is an array of EmberAfAttributeMetadata structures.
#define GENERATED_ATTRIBUTE_COUNT 369
#define GENERATED_ATTRIBUTE_COUNT 374
#define GENERATED_ATTRIBUTES \
{ \
\
Expand Down Expand Up @@ -2106,13 +2116,13 @@
{ 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(3) }, /* cluster revision */ \
\
/* Endpoint: 1, Cluster: On/off (server) */ \
{ 0x0000, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* on/off */ \
{ 0x4000, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_SIMPLE_DEFAULT(0x01) }, /* global scene control */ \
{ 0x4001, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0x0000) }, /* on time */ \
{ 0x4002, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0x0000) }, /* off wait time */ \
{ 0x4003, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_EMPTY_DEFAULT() }, /* start up on off */ \
{ 0x0000, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* OnOff */ \
{ 0x4000, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_SIMPLE_DEFAULT(0x01) }, /* GlobalSceneControl */ \
{ 0x4001, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0x0000) }, /* OnTime */ \
{ 0x4002, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0x0000) }, /* OffWaitTime */ \
{ 0x4003, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_EMPTY_DEFAULT() }, /* StartUpOnOff */ \
{ 0xFFFC, ZAP_TYPE(INT32U), 4, 0, ZAP_LONG_DEFAULTS_INDEX(3482) }, /* feature map */ \
{ 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(2) }, /* cluster revision */ \
{ 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(3) }, /* cluster revision */ \
\
/* Endpoint: 1, Cluster: Level Control (server) */ \
{ 0x0000, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* current level */ \
Expand Down Expand Up @@ -2416,8 +2426,13 @@
{ 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \
\
/* Endpoint: 2, Cluster: On/off (server) */ \
{ 0x0000, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* on/off */ \
{ 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(2) }, /* cluster revision */ \
{ 0x0000, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* OnOff */ \
{ 0x4000, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_SIMPLE_DEFAULT(1) }, /* GlobalSceneControl */ \
{ 0x4001, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* OnTime */ \
{ 0x4002, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* OffWaitTime */ \
{ 0x4003, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_EMPTY_DEFAULT() }, /* StartUpOnOff */ \
{ 0xFFFC, ZAP_TYPE(INT32U), 4, 0, ZAP_LONG_DEFAULTS_INDEX(10418) }, /* feature map */ \
{ 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(2) }, /* cluster revision */ \
\
/* Endpoint: 2, Cluster: Occupancy Sensing (server) */ \
{ 0x0000, ZAP_TYPE(BITMAP8), 1, 0, ZAP_EMPTY_DEFAULT() }, /* occupancy */ \
Expand Down Expand Up @@ -2667,12 +2682,12 @@
}, /* Endpoint: 1, Cluster: Binding (server) */ \
{ 0x0006, \
ZAP_ATTRIBUTE_INDEX(363), \
2, \
3, \
7, \
13, \
ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \
chipFuncArrayOnOffServer }, /* Endpoint: 2, Cluster: On/off (server) */ \
{ 0x0406, \
ZAP_ATTRIBUTE_INDEX(365), \
ZAP_ATTRIBUTE_INDEX(370), \
4, \
5, \
ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \
Expand All @@ -2684,7 +2699,7 @@
// This is an array of EmberAfEndpointType structures.
#define GENERATED_ENDPOINT_TYPES \
{ \
{ ZAP_CLUSTER_INDEX(0), 15, 3560 }, { ZAP_CLUSTER_INDEX(15), 37, 7252 }, { ZAP_CLUSTER_INDEX(52), 2, 8 }, \
{ ZAP_CLUSTER_INDEX(0), 15, 3560 }, { ZAP_CLUSTER_INDEX(15), 37, 7252 }, { ZAP_CLUSTER_INDEX(52), 2, 18 }, \
}

// Largest attribute size is needed for various buffers
Expand All @@ -2694,7 +2709,7 @@
#define ATTRIBUTE_SINGLETONS_SIZE (1497)

// Total size of attribute storage
#define ATTRIBUTE_MAX_SIZE (10820)
#define ATTRIBUTE_MAX_SIZE (10830)

// Number of fixed endpoints
#define FIXED_ENDPOINT_COUNT (3)
Expand Down Expand Up @@ -3068,7 +3083,7 @@
/* Endpoint: 1, Cluster: On/off (server) */ \
{ \
ZAP_REPORT_DIRECTION(REPORTED), 0x0001, 0x0006, 0x0000, ZAP_CLUSTER_MASK(SERVER), 0x0000, { { 0, 65344, 0 } } \
}, /* on/off */ \
}, /* OnOff */ \
\
/* Endpoint: 1, Cluster: Level Control (server) */ \
{ \
Expand Down Expand Up @@ -3208,7 +3223,7 @@
/* Endpoint: 2, Cluster: On/off (server) */ \
{ \
ZAP_REPORT_DIRECTION(REPORTED), 0x0002, 0x0006, 0x0000, ZAP_CLUSTER_MASK(SERVER), 0x0000, { { 0, 65344, 0 } } \
}, /* on/off */ \
}, /* OnOff */ \
\
/* Endpoint: 2, Cluster: Occupancy Sensing (server) */ \
{ \
Expand Down
4 changes: 2 additions & 2 deletions examples/bridge-app/bridge-common/gen/endpoint_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@
{ 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \
\
/* Endpoint: 1, Cluster: On/off (server) */ \
{ 0x0000, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* on/off */ \
{ 0x0000, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* OnOff */ \
{ 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(2) }, /* cluster revision */ \
\
/* Endpoint: 1, Cluster: Level Control (server) */ \
Expand Down Expand Up @@ -1140,7 +1140,7 @@
/* Endpoint: 1, Cluster: On/off (server) */ \
{ \
ZAP_REPORT_DIRECTION(REPORTED), 0x0001, 0x0006, 0x0000, ZAP_CLUSTER_MASK(SERVER), 0x0000, { { 0, 65344, 0 } } \
}, /* on/off */ \
}, /* OnOff */ \
\
/* Endpoint: 1, Cluster: Level Control (server) */ \
{ \
Expand Down
Loading

0 comments on commit 8ceb910

Please sign in to comment.