Skip to content

Commit 56ecd46

Browse files
eve-cxrpvivien-applerestyled-commitsbzbarsky-apple
authored
Part 4: feature/binary input basic cluster (#7032)
* 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]>
1 parent 0f94665 commit 56ecd46

29 files changed

+1758
-89
lines changed

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

+97
Original file line numberDiff line numberDiff line change
@@ -6488,6 +6488,103 @@
64886488
}
64896489
]
64906490
},
6491+
{
6492+
"name": "Binary Input (Basic)",
6493+
"code": 15,
6494+
"mfgCode": null,
6495+
"define": "BINARY_INPUT_BASIC_CLUSTER",
6496+
"side": "client",
6497+
"enabled": 0,
6498+
"commands": [],
6499+
"attributes": [
6500+
{
6501+
"name": "cluster revision",
6502+
"code": 65533,
6503+
"mfgCode": null,
6504+
"side": "client",
6505+
"included": 1,
6506+
"storageOption": "RAM",
6507+
"singleton": 0,
6508+
"bounded": 0,
6509+
"defaultValue": "0x0001",
6510+
"reportable": 0,
6511+
"minInterval": 0,
6512+
"maxInterval": 65344,
6513+
"reportableChange": 0
6514+
}
6515+
]
6516+
},
6517+
{
6518+
"name": "Binary Input (Basic)",
6519+
"code": 15,
6520+
"mfgCode": null,
6521+
"define": "BINARY_INPUT_BASIC_CLUSTER",
6522+
"side": "server",
6523+
"enabled": 1,
6524+
"commands": [],
6525+
"attributes": [
6526+
{
6527+
"name": "out of service",
6528+
"code": 81,
6529+
"mfgCode": null,
6530+
"side": "server",
6531+
"included": 1,
6532+
"storageOption": "RAM",
6533+
"singleton": 0,
6534+
"bounded": 0,
6535+
"defaultValue": "0x00",
6536+
"reportable": 0,
6537+
"minInterval": 0,
6538+
"maxInterval": 65344,
6539+
"reportableChange": 0
6540+
},
6541+
{
6542+
"name": "present value",
6543+
"code": 85,
6544+
"mfgCode": null,
6545+
"side": "server",
6546+
"included": 1,
6547+
"storageOption": "RAM",
6548+
"singleton": 0,
6549+
"bounded": 0,
6550+
"defaultValue": "",
6551+
"reportable": 1,
6552+
"minInterval": 0,
6553+
"maxInterval": 65344,
6554+
"reportableChange": 0
6555+
},
6556+
{
6557+
"name": "status flags",
6558+
"code": 111,
6559+
"mfgCode": null,
6560+
"side": "server",
6561+
"included": 1,
6562+
"storageOption": "RAM",
6563+
"singleton": 0,
6564+
"bounded": 0,
6565+
"defaultValue": "0x00",
6566+
"reportable": 1,
6567+
"minInterval": 0,
6568+
"maxInterval": 65344,
6569+
"reportableChange": 0
6570+
},
6571+
{
6572+
"name": "cluster revision",
6573+
"code": 65533,
6574+
"mfgCode": null,
6575+
"side": "server",
6576+
"included": 1,
6577+
"storageOption": "RAM",
6578+
"singleton": 0,
6579+
"bounded": 0,
6580+
"defaultValue": "0x0001",
6581+
"reportable": 0,
6582+
"minInterval": 0,
6583+
"maxInterval": 65344,
6584+
"reportableChange": 0
6585+
}
6586+
]
6587+
},
64916588
{
64926589
"name": "Descriptor",
64936590
"code": 29,

examples/all-clusters-app/all-clusters-common/gen/call-command-handler.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ EmberAfStatus emberAfApplicationLauncherClusterServerCommandParse(EmberAfCluster
3434
EmberAfStatus emberAfAudioOutputClusterServerCommandParse(EmberAfClusterCommand * cmd);
3535
EmberAfStatus emberAfBarrierControlClusterServerCommandParse(EmberAfClusterCommand * cmd);
3636
EmberAfStatus emberAfBasicClusterServerCommandParse(EmberAfClusterCommand * cmd);
37+
EmberAfStatus emberAfBinaryInputBasicClusterServerCommandParse(EmberAfClusterCommand * cmd);
3738
EmberAfStatus emberAfBindingClusterServerCommandParse(EmberAfClusterCommand * cmd);
3839
EmberAfStatus emberAfBridgedDeviceBasicClusterServerCommandParse(EmberAfClusterCommand * cmd);
3940
EmberAfStatus emberAfColorControlClusterServerCommandParse(EmberAfClusterCommand * cmd);
@@ -136,6 +137,10 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd)
136137
case ZCL_BASIC_CLUSTER_ID:
137138
result = emberAfBasicClusterServerCommandParse(cmd);
138139
break;
140+
case ZCL_BINARY_INPUT_BASIC_CLUSTER_ID:
141+
// No commands are enabled for cluster Binary Input (Basic)
142+
result = status(false, true, cmd->mfgSpecific);
143+
break;
139144
case ZCL_BINDING_CLUSTER_ID:
140145
result = emberAfBindingClusterServerCommandParse(cmd);
141146
break;

examples/all-clusters-app/all-clusters-common/gen/callback-stub.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId)
4747
case ZCL_BASIC_CLUSTER_ID:
4848
emberAfBasicClusterInitCallback(endpoint);
4949
break;
50+
case ZCL_BINARY_INPUT_BASIC_CLUSTER_ID:
51+
emberAfBinaryInputBasicClusterInitCallback(endpoint);
52+
break;
5053
case ZCL_BINDING_CLUSTER_ID:
5154
emberAfBindingClusterInitCallback(endpoint);
5255
break;
@@ -203,6 +206,11 @@ void __attribute__((weak)) emberAfBasicClusterInitCallback(EndpointId endpoint)
203206
// To prevent warning
204207
(void) endpoint;
205208
}
209+
void __attribute__((weak)) emberAfBinaryInputBasicClusterInitCallback(EndpointId endpoint)
210+
{
211+
// To prevent warning
212+
(void) endpoint;
213+
}
206214
void __attribute__((weak)) emberAfBindingClusterInitCallback(EndpointId endpoint)
207215
{
208216
// To prevent warning

examples/all-clusters-app/all-clusters-common/gen/callback.h

+79
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,14 @@ void emberAfBarrierControlClusterInitCallback(chip::EndpointId endpoint);
8888
*/
8989
void emberAfBasicClusterInitCallback(chip::EndpointId endpoint);
9090

91+
/** @brief Binary Input (Basic) Cluster Init
92+
*
93+
* Cluster Init
94+
*
95+
* @param endpoint Endpoint that is being initialized
96+
*/
97+
void emberAfBinaryInputBasicClusterInitCallback(chip::EndpointId endpoint);
98+
9199
/** @brief Binding Cluster Init
92100
*
93101
* Cluster Init
@@ -831,6 +839,77 @@ EmberAfStatus emberAfBasicClusterServerPreAttributeChangedCallback(chip::Endpoin
831839
*/
832840
void emberAfBasicClusterServerTickCallback(chip::EndpointId endpoint);
833841

842+
//
843+
// Binary Input (Basic) Cluster server
844+
//
845+
846+
/** @brief Binary Input (Basic) Cluster Server Init
847+
*
848+
* Server Init
849+
*
850+
* @param endpoint Endpoint that is being initialized
851+
*/
852+
void emberAfBinaryInputBasicClusterServerInitCallback(chip::EndpointId endpoint);
853+
854+
/** @brief Binary Input (Basic) Cluster Server Attribute Changed
855+
*
856+
* Server Attribute Changed
857+
*
858+
* @param endpoint Endpoint that is being initialized
859+
* @param attributeId Attribute that changed
860+
*/
861+
void emberAfBinaryInputBasicClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId);
862+
863+
/** @brief Binary Input (Basic) Cluster Server Manufacturer Specific Attribute Changed
864+
*
865+
* Server Manufacturer Specific Attribute Changed
866+
*
867+
* @param endpoint Endpoint that is being initialized
868+
* @param attributeId Attribute that changed
869+
* @param manufacturerCode Manufacturer Code of the attribute that changed
870+
*/
871+
void emberAfBinaryInputBasicClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint,
872+
chip::AttributeId attributeId,
873+
uint16_t manufacturerCode);
874+
875+
/** @brief Binary Input (Basic) Cluster Server Message Sent
876+
*
877+
* Server Message Sent
878+
*
879+
* @param type The type of message sent
880+
* @param destination The destination to which the message was sent
881+
* @param apsFrame The APS frame for the message
882+
* @param msgLen The length of the message
883+
* @param message The message that was sent
884+
* @param status The status of the sent message
885+
*/
886+
void emberAfBinaryInputBasicClusterServerMessageSentCallback(EmberOutgoingMessageType type,
887+
chip::MessageSendDestination destination, EmberApsFrame * apsFrame,
888+
uint16_t msgLen, uint8_t * message, EmberStatus status);
889+
890+
/** @brief Binary Input (Basic) Cluster Server Pre Attribute Changed
891+
*
892+
* server Pre Attribute Changed
893+
*
894+
* @param endpoint Endpoint that is being initialized
895+
* @param attributeId Attribute to be changed
896+
* @param attributeType Attribute type
897+
* @param size Attribute size
898+
* @param value Attribute value
899+
*/
900+
EmberAfStatus emberAfBinaryInputBasicClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint,
901+
chip::AttributeId attributeId,
902+
EmberAfAttributeType attributeType, uint16_t size,
903+
uint8_t * value);
904+
905+
/** @brief Binary Input (Basic) Cluster Server Tick
906+
*
907+
* server Tick
908+
*
909+
* @param endpoint Endpoint that is being served
910+
*/
911+
void emberAfBinaryInputBasicClusterServerTickCallback(chip::EndpointId endpoint);
912+
834913
//
835914
// Binding Cluster server
836915
//

0 commit comments

Comments
 (0)