Thursday, December 13, 2018

How to use EmberZNet to do ZCL report

The following steps show you how to use EmberZNet to do ZCL report

Using ZCL_TEMP_MEASUREMENT_CLUSTER_ID to send temperature attribute report as example.

1. Prepare ZCL data buffer with emberAfFillCommandGlobalServerToClientReportAttributes. The buffer format is Attribute ID -> Data type -> Attribute data. For Attribute ID and Attribute data, it's low byte first.

uint8_t buff[5] = {0x00, 0x00, 0x29, 0x05, 0x06};  //Attribute ID (0x0000) -> Data type (0x29) -> Attribute data (0x0605). emberAfFillCommandGlobalServerToClientReportAttributes(ZCL_TEMP_MEASUREMENT_CLUSTER_ID, (uint8_t *) buff, 5);

2. Set source and destination endpoint with emberAfSetCommandEndpoints

emberAfSetCommandEndpoints(1, 1); //endpoint(uint8_t sourceEndpoint, uint8_t destinationEndpoint):

3. Call the following line to do unicast to coordinator

emberAfSendCommandUnicast(EMBER_OUTGOING_DIRECT, 0x0000);


Or call the following line to do unicast using binding address.

emberAfSendCommandUnicastToBindings();

No comments:

Post a Comment