Skip to content

Commit

Permalink
Part 4: feature/binary input basic cluster (#7032)
Browse files Browse the repository at this point in the history
* format endpointClusterWithInit for easier pull requests

* add support for emberAfBinaryInputBasicClusterServerInitCallback

* fix emberAfBinaryInputBasicClusterServerInitCallback

Note: relies on project-chip/zap#154

* Add new clusters to zap_cluster_list.py

* add initial binary input basic cluster impl.

* fix typo in binary-input-server.cpp

* add binary input basic to controller-clusters.zap

used a custom patched zap tool. based on 535ebf3, because the current zap tool is not working properly

* Restyled by whitespace

* Restyled by clang-format

* add fixes && expose more binary input APIs

- replace emberAfReadAttribute with emberAfReadServerAttribute
- replace emberAfWriteAttribute with emberAfWriteServerAttribute
- add emberAfBinaryInputBasicClusterPrintln if not defined
- let the caller do the logging
- expose emberAfBinaryInputBasicClusterGetPresentValue
- expose emberAfBinaryInputBasicClusterGetOutOfService

* Revert "Add new clusters to zap_cluster_list.py"

This reverts commit 99492f2.

* add only binary input basic to zap_clusters_list.py

* remove emberAfBinaryInputBasicClusterServerInitCallback impl.

The default values are populated by the attribute storage.

* fix year of copyright

* fix includes in binary-input-basic-server.cpp

* add binary-input-basic cluster to the all-clusters-app.zap

* try to fix all-cluster-app/esp32

* another fix for the all-cluster-app/esp32

* Fix endpoint config generation for clusters with complicated names.

Other things are using c.clusterName, so we should do that here as well to match.

* Restore the octet string tests that were improperly removed

* Remove unnecessary init function from Binary Input cluster

* Move Binary Input cluster from endpoint 0 to endpoint 1 in all-clusters-app

* Regenerate generated files

Co-authored-by: Vivien Nicolas <[email protected]>
Co-authored-by: Restyled.io <[email protected]>
Co-authored-by: Boris Zbarsky <[email protected]>
  • Loading branch information
4 people authored and pull[bot] committed Jul 9, 2021
1 parent 1d15f0c commit 1069674
Show file tree
Hide file tree
Showing 29 changed files with 1,758 additions and 89 deletions.
97 changes: 97 additions & 0 deletions examples/all-clusters-app/all-clusters-common/all-clusters-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -6488,6 +6488,103 @@
}
]
},
{
"name": "Binary Input (Basic)",
"code": 15,
"mfgCode": null,
"define": "BINARY_INPUT_BASIC_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": "Binary Input (Basic)",
"code": 15,
"mfgCode": null,
"define": "BINARY_INPUT_BASIC_CLUSTER",
"side": "server",
"enabled": 1,
"commands": [],
"attributes": [
{
"name": "out of service",
"code": 81,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x00",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
},
{
"name": "present value",
"code": 85,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
},
{
"name": "status flags",
"code": 111,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x00",
"reportable": 1,
"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": "Descriptor",
"code": 29,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ EmberAfStatus emberAfApplicationLauncherClusterServerCommandParse(EmberAfCluster
EmberAfStatus emberAfAudioOutputClusterServerCommandParse(EmberAfClusterCommand * cmd);
EmberAfStatus emberAfBarrierControlClusterServerCommandParse(EmberAfClusterCommand * cmd);
EmberAfStatus emberAfBasicClusterServerCommandParse(EmberAfClusterCommand * cmd);
EmberAfStatus emberAfBinaryInputBasicClusterServerCommandParse(EmberAfClusterCommand * cmd);
EmberAfStatus emberAfBindingClusterServerCommandParse(EmberAfClusterCommand * cmd);
EmberAfStatus emberAfBridgedDeviceBasicClusterServerCommandParse(EmberAfClusterCommand * cmd);
EmberAfStatus emberAfColorControlClusterServerCommandParse(EmberAfClusterCommand * cmd);
Expand Down Expand Up @@ -136,6 +137,10 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd)
case ZCL_BASIC_CLUSTER_ID:
result = emberAfBasicClusterServerCommandParse(cmd);
break;
case ZCL_BINARY_INPUT_BASIC_CLUSTER_ID:
// No commands are enabled for cluster Binary Input (Basic)
result = status(false, true, cmd->mfgSpecific);
break;
case ZCL_BINDING_CLUSTER_ID:
result = emberAfBindingClusterServerCommandParse(cmd);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId)
case ZCL_BASIC_CLUSTER_ID:
emberAfBasicClusterInitCallback(endpoint);
break;
case ZCL_BINARY_INPUT_BASIC_CLUSTER_ID:
emberAfBinaryInputBasicClusterInitCallback(endpoint);
break;
case ZCL_BINDING_CLUSTER_ID:
emberAfBindingClusterInitCallback(endpoint);
break;
Expand Down Expand Up @@ -203,6 +206,11 @@ void __attribute__((weak)) emberAfBasicClusterInitCallback(EndpointId endpoint)
// To prevent warning
(void) endpoint;
}
void __attribute__((weak)) emberAfBinaryInputBasicClusterInitCallback(EndpointId endpoint)
{
// To prevent warning
(void) endpoint;
}
void __attribute__((weak)) emberAfBindingClusterInitCallback(EndpointId endpoint)
{
// To prevent warning
Expand Down
79 changes: 79 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 @@ -88,6 +88,14 @@ void emberAfBarrierControlClusterInitCallback(chip::EndpointId endpoint);
*/
void emberAfBasicClusterInitCallback(chip::EndpointId endpoint);

/** @brief Binary Input (Basic) Cluster Init
*
* Cluster Init
*
* @param endpoint Endpoint that is being initialized
*/
void emberAfBinaryInputBasicClusterInitCallback(chip::EndpointId endpoint);

/** @brief Binding Cluster Init
*
* Cluster Init
Expand Down Expand Up @@ -831,6 +839,77 @@ EmberAfStatus emberAfBasicClusterServerPreAttributeChangedCallback(chip::Endpoin
*/
void emberAfBasicClusterServerTickCallback(chip::EndpointId endpoint);

//
// Binary Input (Basic) Cluster server
//

/** @brief Binary Input (Basic) Cluster Server Init
*
* Server Init
*
* @param endpoint Endpoint that is being initialized
*/
void emberAfBinaryInputBasicClusterServerInitCallback(chip::EndpointId endpoint);

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

/** @brief Binary Input (Basic) 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 emberAfBinaryInputBasicClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint,
chip::AttributeId attributeId,
uint16_t manufacturerCode);

/** @brief Binary Input (Basic) Cluster Server Message Sent
*
* Server Message Sent
*
* @param type The type of message sent
* @param destination The destination 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 emberAfBinaryInputBasicClusterServerMessageSentCallback(EmberOutgoingMessageType type,
chip::MessageSendDestination destination, EmberApsFrame * apsFrame,
uint16_t msgLen, uint8_t * message, EmberStatus status);

/** @brief Binary Input (Basic) 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 emberAfBinaryInputBasicClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint,
chip::AttributeId attributeId,
EmberAfAttributeType attributeType, uint16_t size,
uint8_t * value);

/** @brief Binary Input (Basic) Cluster Server Tick
*
* server Tick
*
* @param endpoint Endpoint that is being served
*/
void emberAfBinaryInputBasicClusterServerTickCallback(chip::EndpointId endpoint);

//
// Binding Cluster server
//
Expand Down
Loading

0 comments on commit 1069674

Please sign in to comment.