nRF5 SDK for Thread and Zigbee v3.2.0
Data Structures | Macros | Typedefs
Default response command sending and parsing.

Data Structures

struct  zb_zcl_default_resp_payload_s
 Default response payload structure. More...
 

Macros

#define ZB_ZCL_SEND_DEFAULT_RESP_DIRECTION(buffer,addr, addr_mode, dst_ep, ep, prof_id, cluster_id, seq_num, cmd, status_code, direction)
 Send default response command with custom Direction. More...
 
#define ZB_ZCL_SEND_DEFAULT_RESP_WITH_CB(buffer, addr, addr_mode, dst_ep, ep, prof_id, cluster_id, seq_num, cmd, status_code, callback)
 Send default response command and execute callback when it is acknowledged or expired. More...
 
#define ZB_ZCL_CHECK_IF_SEND_DEFAULT_RESP_EXT(_is_broadcast, _delivery_mode, _disable_def_resp, _status, _is_def_resp_frame)
 check whether command requires default response to be sent More...
 
#define ZB_ZCL_CHECK_IF_SEND_DEFAULT_RESP(_cmd_info, _status)
 API call that is used to check if it is needed to send Default response for the command. More...
 
#define ZB_ZCL_SEND_DEFAULT_RESP_EXT(_buffer, _dst_addr, _dst_addr_mode, _dst_ep, _src_ep,_prof_id, _cluster_id, _seq_num, _cmd, _status_code,_direction, _is_manuf_specific, _manuf_code, _callback)
 General API for sending Default response command. More...
 
#define ZB_ZCL_SEND_DEFAULT_RESP(buffer, addr, addr_mode, dst_ep, ep, prof_id, cluster_id, seq_num, cmd, status_code)
 Send default response command. More...
 
#define ZB_ZCL_SEND_DEFAULT_RESP_MANUF(buffer, addr, addr_mode, dst_ep, ep, prof_id, cluster_id, seq_num, cmd, status_code, manuf_code)
 Send default response command. More...
 
#define ZB_ZCL_READ_DEFAULT_RESP(buffer)
 Default response structured reading. More...
 

Typedefs

typedef struct
zb_zcl_default_resp_payload_s 
zb_zcl_default_resp_payload_t
 Default response payload structure.
 

Detailed Description

Default response command is defined in ZCL spec, subclause 2.4.12.

Example
Command can be sent like in the following snippet: Incoming default response can be barsed as following:

For more information see any HA sample

Macro Definition Documentation

#define ZB_ZCL_CHECK_IF_SEND_DEFAULT_RESP (   _cmd_info,
  _status 
)
Value:
ZB_NWK_IS_ADDRESS_BROADCAST((_cmd_info).addr_data.common_data.dst_addr), \
ZB_APS_FC_GET_DELIVERY_MODE((_cmd_info).addr_data.common_data.fc), \
(_cmd_info).disable_default_response, _status, \
((_cmd_info).is_common_command && (_cmd_info).cmd_id == ZB_ZCL_CMD_DEFAULT_RESP))
#define ZB_ZCL_CHECK_IF_SEND_DEFAULT_RESP_EXT(_is_broadcast, _delivery_mode, _disable_def_resp, _status, _is_def_resp_frame)
check whether command requires default response to be sent
Definition: zb_zcl_commands.h:376
Definition: zb_zcl_commands.h:89

API call that is used to check if it is needed to send Default response for the command.

Parameters
_cmd_info- variable of zb_zcl_parsed_hdr_t type, containg received command header data
_status- status of the handled command
#define ZB_ZCL_CHECK_IF_SEND_DEFAULT_RESP_EXT (   _is_broadcast,
  _delivery_mode,
  _disable_def_resp,
  _status,
  _is_def_resp_frame 
)
Value:
(!(_is_broadcast) && ((_delivery_mode) == ZB_APS_DELIVERY_UNICAST) && \
(!(_disable_def_resp) || (_status) != ZB_ZCL_STATUS_SUCCESS) \
&& !(_is_def_resp_frame))
Definition: zb_zcl_common.h:335

check whether command requires default response to be sent

Default response is sent if:

  • particular response is not sent yet
  • original command is NOT broadcat
  • disable_default_response is set to FALSE or command status is not Success
  • command itself is NOT default response

This is a helper method, use ZB_ZCL_CHECK_IF_SEND_DEFAULT_RESP instead

Parameters
_is_broadcast- broadcast bit from NWK header
_delivery_mode- delivery mode from APS header
_disable_def_resp- Disable Default Response bit from ZCL header
_status- status of the handled command
_is_def_resp_frame- check for command type
#define ZB_ZCL_READ_DEFAULT_RESP (   buffer)
Value:
( (ZB_BUF_LEN((buffer)) != sizeof(zb_zcl_default_resp_payload_t)) ? \
NULL : \
Default response payload structure.
Definition: zb_zcl_commands.h:483
struct zb_zcl_default_resp_payload_s zb_zcl_default_resp_payload_t
Default response payload structure.
#define ZB_BUF_BEGIN(zbbuf)
Definition: zboss_api_core.h:767
#define ZB_BUF_LEN(zbbuf)
Definition: zboss_api_core.h:776

Default response structured reading.

Parameters
buffer- pointer to the message buffer (of type zb_buf_t) containing payload
Returns
pointer to zb_zcl_default_resp_payload_s structure
Attention
returned pointer will point to the same data in the buffer thus being valid until buffer data will be overwritten.
#define ZB_ZCL_SEND_DEFAULT_RESP (   buffer,
  addr,
  addr_mode,
  dst_ep,
  ep,
  prof_id,
  cluster_id,
  seq_num,
  cmd,
  status_code 
)
Value:
ZB_ZCL_SEND_DEFAULT_RESP_WITH_CB(buffer, addr, addr_mode, dst_ep, ep, prof_id, cluster_id, \
seq_num, cmd, status_code, NULL)
#define ZB_ZCL_SEND_DEFAULT_RESP_WITH_CB(buffer, addr, addr_mode, dst_ep, ep, prof_id, cluster_id, seq_num, cmd, status_code, callback)
Send default response command and execute callback when it is acknowledged or expired.
Definition: zb_zcl_commands.h:347

Send default response command.

Parameters
buffer- pointer to zb_buf_t buffer with payload
addr- short destination address
addr_mode- address mode, only ZB_APS_ADDR_MODE_16_GROUP_ENDP_NOT_PRESENT and ZB_APS_ADDR_MODE_16_ENDP_PRESENT are supported
dst_ep- destination end point
ep- our end point
prof_id- profile identifier
cluster_id- cluster identifier
seq_num- sequence number
cmd- dentifier of the command the response is dedicated to
status_code- status field for received command
#define ZB_ZCL_SEND_DEFAULT_RESP_DIRECTION (   buffer,
  addr,
  addr_mode,
  dst_ep,
  ep,
  prof_id,
  cluster_id,
  seq_num,
  cmd,
  status_code,
  direction 
)
Value:
{ \
zb_uint8_t * ptr = NULL; \
ptr = ZB_ZCL_START_PACKET(buffer); \
ZB_ZCL_CONSTRUCT_GENERAL_COMMAND_RESP_FRAME_CONTROL_A(ptr, \
*(ptr++) = cmd; \
*(ptr++) = status_code; \
ZB_ZCL_FINISH_PACKET(buffer, ptr) \
ZB_ZCL_SEND_COMMAND_SHORT(buffer, addr, addr_mode, dst_ep, ep, prof_id, cluster_id, NULL); \
}
#define ZB_ZCL_START_PACKET(zbbuf)
Initializes zb_buf_t buffer and returns pointer to the beginning of array.
Definition: zb_zcl_common.h:1332
Standard profile command.
Definition: zb_zcl_common.h:844
#define ZB_ZCL_CONSTRUCT_COMMAND_HEADER(data_ptr, tsn, cmd_id)
Construct ZCL header.
Definition: zb_zcl_common.h:1207
#define ZB_ZCL_FINISH_PACKET(zbbuf, ptr)
Definition: zb_zcl_common.h:1654
Definition: zb_zcl_commands.h:89
unsigned char zb_uint8_t
Project-local 1-byte unsigned int type.
Definition: zb_types.h:116

Send default response command with custom Direction.

If you don't want to specify direction explicitly, use ZB_ZCL_SEND_DEFAULT_RESP()

Parameters
buffer- pointer to zb_buf_t buffer with payload
addr- short destination address
addr_mode- address mode, only ZB_APS_ADDR_MODE_16_GROUP_ENDP_NOT_PRESENT and ZB_APS_ADDR_MODE_16_ENDP_PRESENT are supported
dst_ep- destination end point
ep- our end point
prof_id- profile identifier
cluster_id- cluster identifier
seq_num- sequence number
cmd- dentifier of the command the response is dedicated to
status_code- status field for received command
direction- direction of the command (see zb_zcl_frame_direction_t)
#define ZB_ZCL_SEND_DEFAULT_RESP_EXT (   _buffer,
  _dst_addr,
  _dst_addr_mode,
  _dst_ep,
  _src_ep,
  _prof_id,
  _cluster_id,
  _seq_num,
  _cmd,
  _status_code,
  _direction,
  _is_manuf_specific,
  _manuf_code,
  _callback 
)
Value:
{ \
zb_uint8_t * _ptr = NULL; \
_ptr = ZB_ZCL_START_PACKET(_buffer); \
ZB_ZCL_CONSTRUCT_GENERAL_COMMAND_RESP_FRAME_CONTROL_A(_ptr, \
(_direction), \
(zb_zcl_manufacturer_specific_t)((_is_manuf_specific)!=ZB_FALSE ? \
_is_manuf_specific, _manuf_code, ZB_ZCL_CMD_DEFAULT_RESP); \
*(_ptr++) = (_cmd); \
*(_ptr++) = (_status_code); \
ZB_ZCL_FINISH_PACKET(_buffer, _ptr) \
ZB_ZCL_SEND_COMMAND_SHORT(_buffer, _dst_addr, _dst_addr_mode, _dst_ep, _src_ep, _prof_id, _cluster_id, _callback); \
}
#define ZB_ZCL_START_PACKET(zbbuf)
Initializes zb_buf_t buffer and returns pointer to the beginning of array.
Definition: zb_zcl_common.h:1332
Standard profile command.
Definition: zb_zcl_common.h:844
#define ZB_ZCL_FINISH_PACKET(zbbuf, ptr)
Definition: zb_zcl_common.h:1654
Definition: zb_zcl_commands.h:89
unsigned char zb_uint8_t
Project-local 1-byte unsigned int type.
Definition: zb_types.h:116
#define ZB_ZCL_CONSTRUCT_COMMAND_HEADER_EXT(_data_ptr, _tsn, _is_manuf_spec, _manuf_specific, _cmd_id)
Construct ZCL header, Manufacturer specific value is conditionally supported.
Definition: zb_zcl_common.h:1211
Command refers to manufacturer-specific profile extension.
Definition: zb_zcl_common.h:849
Definition: zb_types.h:100
enum zb_zcl_manufacturer_specific_e zb_zcl_manufacturer_specific_t
Values for Manufacturer-specific subfield of FCF in ZCL frame.

General API for sending Default response command.

Parameters
_buffer- zb_buf_t buffer
_dst_addr- 16-bit destinition address
_dst_addr_mode- destinition adress mode. Possible values ZB_APS_ADDR_MODE_DST_ADDR_ENDP_NOT_PRESENT, ZB_APS_ADDR_MODE_16_GROUP_ENDP_NOT_PRESENT, ZB_APS_ADDR_MODE_16_ENDP_PRESENT
_dst_ep- destinition Endpoint number
_src_ep- source Endpoint number
_prof_id- profile ID
_cluster_id- cluster ID
_seq_num- transaction sequense number
_cmd- command ID
_status_code- command status (enum zb_zcl_status_e)
_direction- direction of command (see zb_zcl_frame_direction_t)
_is_manuf_specific- flag, equal to 1 if command is manufacturer specific
_manuf_code- manufacturer specific code, is taken unto account only if _is_manuf_specific is equal to 1
_callback- pointer to the callback function that will be called when the command is sent
#define ZB_ZCL_SEND_DEFAULT_RESP_MANUF (   buffer,
  addr,
  addr_mode,
  dst_ep,
  ep,
  prof_id,
  cluster_id,
  seq_num,
  cmd,
  status_code,
  manuf_code 
)
Value:
ZB_ZCL_SEND_DEFAULT_RESP_MANUF_WITH_CB(buffer, addr, addr_mode, dst_ep, ep, prof_id, cluster_id, \
seq_num, cmd, status_code, manuf_code, NULL)

Send default response command.

Parameters
buffer- pointer to zb_buf_t buffer with payload
addr- short destination address
addr_mode- address mode, only ZB_APS_ADDR_MODE_16_GROUP_ENDP_NOT_PRESENT and ZB_APS_ADDR_MODE_16_ENDP_PRESENT are supported
dst_ep- destination end point
ep- our end point
prof_id- profile identifier
cluster_id- cluster identifier
seq_num- sequence number
cmd- dentifier of the command the response is dedicated to
status_code- status field for received command
manuf_code- manufacturer code
#define ZB_ZCL_SEND_DEFAULT_RESP_WITH_CB (   buffer,
  addr,
  addr_mode,
  dst_ep,
  ep,
  prof_id,
  cluster_id,
  seq_num,
  cmd,
  status_code,
  callback 
)
Value:
{ \
zb_uint8_t * ptr = NULL; \
ptr = ZB_ZCL_START_PACKET(buffer); \
ZB_ZCL_CONSTRUCT_GENERAL_COMMAND_RESP_FRAME_CONTROL(ptr); \
*(ptr++) = cmd; \
*(ptr++) = status_code; \
ZB_ZCL_FINISH_PACKET(buffer, ptr) \
ZB_ZCL_SEND_COMMAND_SHORT(buffer, addr, addr_mode, dst_ep, ep, prof_id, cluster_id, (callback)); \
}
#define ZB_ZCL_START_PACKET(zbbuf)
Initializes zb_buf_t buffer and returns pointer to the beginning of array.
Definition: zb_zcl_common.h:1332
#define ZB_ZCL_CONSTRUCT_COMMAND_HEADER(data_ptr, tsn, cmd_id)
Construct ZCL header.
Definition: zb_zcl_common.h:1207
#define ZB_ZCL_FINISH_PACKET(zbbuf, ptr)
Definition: zb_zcl_common.h:1654
Definition: zb_zcl_commands.h:89
unsigned char zb_uint8_t
Project-local 1-byte unsigned int type.
Definition: zb_types.h:116

Send default response command and execute callback when it is acknowledged or expired.

If no callback is needed, use ZB_ZCL_SEND_DEFAULT_RESP()

Parameters
buffer- pointer to zb_buf_t buffer with payload
addr- short destination address
addr_mode- address mode, only ZB_APS_ADDR_MODE_16_GROUP_ENDP_NOT_PRESENT and ZB_APS_ADDR_MODE_16_ENDP_PRESENT are supported
dst_ep- destination end point
ep- our end point
prof_id- profile identifier
cluster_id- cluster identifier
seq_num- sequence number
cmd- dentifier of the command the response is dedicated to
status_code- status field for received command
callback- callback to be executed when command is acknowledged or expired (of type zb_callback_t)

Documentation feedback | Developer Zone | Subscribe | Updated