Counters#
API and Callbacks for the Counters Component.
This component provides support for reading and manipulating counters that record different events in the stack.
API#
Send an request to the specified destination to send back a report of the non-zero counters.
Call this function at the beginning of the incoming message handler. It returns true if the incoming message was a counter's request and should be ignored by the rest of the incoming message handler.
Call this function within the incoming message handler to determine if the message is a counter's response. If so, it is up to the application to decode the payload whose format is described above.
Call this function at the beginning of the message sent handler. It returns true if the message was a counters response and should be ignored by the rest of the handler.
Macros#
To ensure the counters response does not exceed the maximum payload length, they are divided into separate messages if necessary. The maximum length of 48 leaves sufficient room for headers, all security modes, and source routing subframes if present. It should not be necessary to change this value, but if you do, make sure you understand the process.
API Documentation#
sl_zigbee_af_counters_send_request#
sl_status_t sl_zigbee_af_counters_send_request (sl_802154_short_addr_t destination, bool clearCounters)
Send an request to the specified destination to send back a report of the non-zero counters.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_802154_short_addr_t | [in] | destination | the address of the node to send the request to. |
bool | [in] | clearCounters | whether or not the destination should reset its counters to zero after successfully reporting them back to the requester. Because of technical constraints, counters are always cleared on a network coprocessor. |
Returns
SL_STATUS_OK if the request was successfully submitted for sending. See ::sl_zigbee_send_unicast() or ::sl_zigbee_ezsp_send_unicast for possible failure statuses.
sl_zigbee_af_counters_is_incoming_request#
bool sl_zigbee_af_counters_is_incoming_request (sl_zigbee_aps_frame_t * apsFrame, sl_802154_short_addr_t sender)
Call this function at the beginning of the incoming message handler. It returns true if the incoming message was a counter's request and should be ignored by the rest of the incoming message handler.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_zigbee_aps_frame_t * | [in] | apsFrame | the APS frame passed to the incoming message handler. |
sl_802154_short_addr_t | [in] | sender | the node ID of the sender of the request. |
Returns
true if the message was a counters request and should be ignored by the rest of the incoming message handler.
sl_zigbee_af_counters_is_incoming_response#
bool sl_zigbee_af_counters_is_incoming_response (sl_zigbee_aps_frame_t * apsFrame)
Call this function within the incoming message handler to determine if the message is a counter's response. If so, it is up to the application to decode the payload whose format is described above.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_zigbee_aps_frame_t * | [in] | apsFrame | the APS frame passed to the incoming message handler. |
Returns
true if the message is a counters response.
sl_zigbee_af_counters_is_outgoing_response#
bool sl_zigbee_af_counters_is_outgoing_response (sl_zigbee_aps_frame_t * apsFrame, sl_status_t status)
Call this function at the beginning of the message sent handler. It returns true if the message was a counters response and should be ignored by the rest of the handler.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_zigbee_aps_frame_t * | [in] | apsFrame | the APS frame passed to the message sent handler. |
sl_status_t | [in] | status | the status passed to the message sent handler. |
Returns
true if the message was a counters response and should be ignored by the rest of the message sent handler.