- Command manipulation API naming conventions.
- ZCL commands (both general and cluster specific) are divided into 2 complementary types: requests and responses.
1) Structures for command requests have postfix _req
, for responses - _res
correspondingly.
2) Macro definitions for parsing commands have postfixes _REQ
and _RES
for requests/responses parsing, respectively. Id est:
- ZB_ZCL_<CLUSTER_NAME>_GET_<COMMAND_NAME>_REQ(buf, cmd_struct_ptr) for requests.
- ZB_ZCL_<CLUSTER_NAME>_GET_<COMMAND_NAME>_RES(buf, cmd_struct_ptr) for responses.
3) Macro definitions for sending cluster commands request/respons:
- ZB_ZCL_<CLUSTER_NAME>_SEND_<COMMAND_NAME>_REQ for request.
- ZB_ZCL_<CLUSTER_NAME>_SEND_<COMMAND_NAME>_RES for response.
4) For composing and sending command with variable number of parameters:
- ZB_ZCL_<CLUSTER_NAME>_INIT_<COMMAND_NAME>_REQ() - initializes packet and fills in mandatory packet fields.
- ZB_ZCL_<CLUSTER_NAME>_ADD_<PARAM_NAME>_<COMMAND_NAME>_REQ() - consequently appends records of the variable part of the packet.
- ZB_ZCL_<CLUSTER_NAME>_SEND_<COMMAND_NAME>_REQ() - finishes packet data filling and schedules packet for sending.
5) Parameters list for macro definitions for sending requests/responses:
- put all general parameters first: buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, dis_default_resp, cb.
- if there are any additional parameters, specific for particular command, put it in the tail.
More comprehensive documentation and API usage examples could be found in subsections describing particular clusters and HA device test source code.