Skip to content

Commit

Permalink
Add initial definition for the Switch Cluster and activate it for som…
Browse files Browse the repository at this point in the history
…e configurations (#6313)

* Add definition for the Switch Cluster

* Activate the Switch Cluster in some configurations

* Update gen/ folder

* Revert chip_client_clusters by chip_server_clusters for the python specific templates at the moment

* Update the python generated file
  • Loading branch information
vivien-apple authored Apr 28, 2021
1 parent 7af4eb8 commit 0f92c5f
Show file tree
Hide file tree
Showing 83 changed files with 12,401 additions and 788 deletions.
196 changes: 195 additions & 1 deletion examples/all-clusters-app/all-clusters-common/all-clusters-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -1420,6 +1420,103 @@
}
]
},
{
"name": "Switch",
"code": 59,
"mfgCode": null,
"define": "SWITCH_CLUSTER",
"side": "client",
"enabled": 0,
"commands": [],
"attributes": [
{
"name": "cluster revision",
"code": 65533,
"mfgCode": null,
"side": "client",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x0001",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
}
]
},
{
"name": "Switch",
"code": 59,
"mfgCode": null,
"define": "SWITCH_CLUSTER",
"side": "server",
"enabled": 0,
"commands": [],
"attributes": [
{
"name": "number of positions",
"code": 0,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "2",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
},
{
"name": "current position",
"code": 1,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
},
{
"name": "multi press max",
"code": 2,
"mfgCode": null,
"side": "server",
"included": 0,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "2",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
},
{
"name": "cluster revision",
"code": 65533,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x0001",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
}
]
},
{
"name": "Operational Credentials",
"code": 62,
Expand Down Expand Up @@ -5216,6 +5313,103 @@
}
]
},
{
"name": "Switch",
"code": 59,
"mfgCode": null,
"define": "SWITCH_CLUSTER",
"side": "client",
"enabled": 0,
"commands": [],
"attributes": [
{
"name": "cluster revision",
"code": 65533,
"mfgCode": null,
"side": "client",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x0001",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"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",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "2",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
},
{
"name": "current position",
"code": 1,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
},
{
"name": "multi press max",
"code": 2,
"mfgCode": null,
"side": "server",
"included": 0,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "2",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
},
{
"name": "cluster revision",
"code": 65533,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x0001",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
}
]
},
{
"name": "Door Lock",
"code": 257,
Expand Down Expand Up @@ -7681,7 +7875,7 @@
"mfgCode": null,
"define": "BINDING_CLUSTER",
"side": "server",
"enabled": 0,
"enabled": 1,
"commands": [],
"attributes": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,15 @@

// Server attributes

// Attribute ids for cluster: Switch

// Client attributes

// Server attributes
#define ZCL_NUMBER_OF_POSITIONS_ATTRIBUTE_ID (0x0000)
#define ZCL_CURRENT_POSITION_ATTRIBUTE_ID (0x0001)
#define ZCL_MULTI_PRESS_MAX_ATTRIBUTE_ID (0x0002)

// Attribute ids for cluster: Operational Credentials

// Client attributes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ EmberAfStatus emberAfOtaSoftwareUpdateServerClusterServerCommandParse(EmberAfClu
EmberAfStatus emberAfOnOffClusterServerCommandParse(EmberAfClusterCommand * cmd);
EmberAfStatus emberAfOperationalCredentialsClusterServerCommandParse(EmberAfClusterCommand * cmd);
EmberAfStatus emberAfScenesClusterServerCommandParse(EmberAfClusterCommand * cmd);
EmberAfStatus emberAfSwitchClusterServerCommandParse(EmberAfClusterCommand * cmd);
EmberAfStatus emberAfTemperatureMeasurementClusterServerCommandParse(EmberAfClusterCommand * cmd);
EmberAfStatus emberAfThermostatClusterServerCommandParse(EmberAfClusterCommand * cmd);

Expand Down Expand Up @@ -154,6 +155,10 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd)
case ZCL_SCENES_CLUSTER_ID:
result = emberAfScenesClusterServerCommandParse(cmd);
break;
case ZCL_SWITCH_CLUSTER_ID:
// No commands are enabled for cluster Switch
result = status(false, true, cmd->mfgSpecific);
break;
case ZCL_TEMP_MEASUREMENT_CLUSTER_ID:
// No commands are enabled for cluster Temperature Measurement
result = status(false, true, cmd->mfgSpecific);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId)
case ZCL_SCENES_CLUSTER_ID:
emberAfScenesClusterInitCallback(endpoint);
break;
case ZCL_SWITCH_CLUSTER_ID:
emberAfSwitchClusterInitCallback(endpoint);
break;
case ZCL_TEMP_MEASUREMENT_CLUSTER_ID:
emberAfTemperatureMeasurementClusterInitCallback(endpoint);
break;
Expand Down Expand Up @@ -201,6 +204,11 @@ void __attribute__((weak)) emberAfScenesClusterInitCallback(EndpointId endpoint)
// To prevent warning
(void) endpoint;
}
void __attribute__((weak)) emberAfSwitchClusterInitCallback(EndpointId endpoint)
{
// To prevent warning
(void) endpoint;
}
void __attribute__((weak)) emberAfTemperatureMeasurementClusterInitCallback(EndpointId endpoint)
{
// To prevent warning
Expand Down
78 changes: 78 additions & 0 deletions examples/all-clusters-app/all-clusters-common/gen/callback.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,14 @@ void emberAfOperationalCredentialsClusterInitCallback(chip::EndpointId endpoint)
*/
void emberAfScenesClusterInitCallback(chip::EndpointId endpoint);

/** @brief Switch Cluster Init
*
* Cluster Init
*
* @param endpoint Endpoint that is being initialized
*/
void emberAfSwitchClusterInitCallback(chip::EndpointId endpoint);

/** @brief Temperature Measurement Cluster Init
*
* Cluster Init
Expand Down Expand Up @@ -1622,6 +1630,76 @@ EmberAfStatus emberAfScenesClusterServerPreAttributeChangedCallback(chip::Endpoi
*/
void emberAfScenesClusterServerTickCallback(chip::EndpointId endpoint);

//
// Switch Cluster server
//

/** @brief Switch Cluster Server Init
*
* Server Init
*
* @param endpoint Endpoint that is being initialized
*/
void emberAfSwitchClusterServerInitCallback(chip::EndpointId endpoint);

/** @brief Switch Cluster Server Attribute Changed
*
* Server Attribute Changed
*
* @param endpoint Endpoint that is being initialized
* @param attributeId Attribute that changed
*/
void emberAfSwitchClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId);

/** @brief Switch Cluster Server Manufacturer Specific Attribute Changed
*
* Server Manufacturer Specific Attribute Changed
*
* @param endpoint Endpoint that is being initialized
* @param attributeId Attribute that changed
* @param manufacturerCode Manufacturer Code of the attribute that changed
*/
void emberAfSwitchClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint,
chip::AttributeId attributeId,
uint16_t manufacturerCode);

/** @brief Switch Cluster Server Message Sent
*
* Server Message Sent
*
* @param type The type of message sent
* @param indexOrDestination The destination or address to which the message was sent
* @param apsFrame The APS frame for the message
* @param msgLen The length of the message
* @param message The message that was sent
* @param status The status of the sent message
*/
void emberAfSwitchClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination,
EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message,
EmberStatus status);

/** @brief Switch Cluster Server Pre Attribute Changed
*
* server Pre Attribute Changed
*
* @param endpoint Endpoint that is being initialized
* @param attributeId Attribute to be changed
* @param attributeType Attribute type
* @param size Attribute size
* @param value Attribute value
*/
EmberAfStatus emberAfSwitchClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId,
EmberAfAttributeType attributeType, uint8_t size,
uint8_t * value);

/** @brief Switch Cluster Server Tick
*
* server Tick
*
* @param endpoint Endpoint that is being served
*/
void emberAfSwitchClusterServerTickCallback(chip::EndpointId endpoint);

//
// Temperature Measurement Cluster server
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@
// Definitions for cluster: Network Commissioning
#define ZCL_NETWORK_COMMISSIONING_CLUSTER_ID (0x0031)

// Definitions for cluster: Switch
#define ZCL_SWITCH_CLUSTER_ID (0x003B)

// Definitions for cluster: Operational Credentials
#define ZCL_OPERATIONAL_CREDENTIALS_CLUSTER_ID (0x003E)

Expand Down
Loading

0 comments on commit 0f92c5f

Please sign in to comment.