Developing with ZBOSS for Zigbee
Discover attributes request and response sending and parsing.

Data Structures

struct  zb_zcl_disc_attr_req_s
 ZCL Discover Attribute Command frame. More...
 
struct  zb_zcl_disc_attr_info_s
 ZCL Description for Discover Attribute Response frame. More...
 
struct  zb_zcl_disc_attr_res_s
 ZCL Discover Attribute Response frame. More...
 

Macros

#define ZB_ZCL_GENERAL_GET_COMPLETE_DISC_RES(data_buf, complete)
 Parses Discovery attribute response and returns next Read attribute status record or NULL if there is no more data. More...
 
#define ZB_ZCL_GENERAL_GET_NEXT_DISC_ATTR_RES(data_buf, disc_attr_info)
 Discovery attribute response and returns next Discovery attribute status record or NULL if there is no more data. More...
 
#define ZB_ZCL_GENERAL_DISC_READ_ATTR_REQ(buffer, def_resp, start_attr_id, max_len, addr, dst_addr_mode, dst_ep, ep, profile_id, cluster_id, cb)
 Discover attribute command. More...
 
#define ZB_ZCL_GENERAL_DISC_ATTR_REQ_A(buffer, cmd_ptr, direction, def_resp, start_attr_id, max_len, addr, dst_addr_mode, dst_ep, ep, profile_id, cluster_id, cb)
 Discover Attribute Request. More...
 

Typedefs

typedef struct zb_zcl_disc_attr_req_s zb_zcl_disc_attr_req_t
 ZCL Discover Attribute Command frame. More...
 
typedef struct zb_zcl_disc_attr_info_s zb_zcl_disc_attr_info_t
 ZCL Description for Discover Attribute Response frame. More...
 
typedef struct zb_zcl_disc_attr_res_s zb_zcl_disc_attr_res_t
 ZCL Discover Attribute Response frame. More...
 
typedef zb_uint8_t zb_zcl_disc_complete_t
 Type for possible values of ZCL Discover Attribute Response. More...
 

ZCL Discover Attribute Response - complete field

See also
ZCL spec, clause 2.4.14
#define ZB_ZCL_DISC_NON_COMPLETE   0x00U
 
#define ZB_ZCL_DISC_COMPLETE   0x01U
 

Detailed Description

Discover attributes command described in ZCL spec, subclauses 2.4.13 and 2.4.14.

Read attributes request command can be formed and sent as in following snippet:

ZB_ZCL_GENERAL_DISC_ATTR_REQ(zcl_cmd_buf, cmd_ptr, ZB_ZCL_ENABLE_DEFAULT_RESPONSE,
DUT_ADDR, DUT_ADDR_MODE, DUT_ENDPOINT,

Discover attributes response can be parsed as:

until allocated buffer space exceeds.

Discover attributes request parsing and response filling and sending is implemented in ZCL library internal functions.

For more information see any HA sample

Macro Definition Documentation

◆ ZB_ZCL_DISC_COMPLETE

#define ZB_ZCL_DISC_COMPLETE   0x01U

no more attributes to be discovered

◆ ZB_ZCL_DISC_NON_COMPLETE

#define ZB_ZCL_DISC_NON_COMPLETE   0x00U

more attributes to be discovered

◆ ZB_ZCL_GENERAL_DISC_ATTR_REQ_A

#define ZB_ZCL_GENERAL_DISC_ATTR_REQ_A (   buffer,
  cmd_ptr,
  direction,
  def_resp,
  start_attr_id,
  max_len,
  addr,
  dst_addr_mode,
  dst_ep,
  ep,
  profile_id,
  cluster_id,
  cb 
)
Value:
{ \
zb_uint8_t *cmd_ptr = ZB_ZCL_START_PACKET(buffer); \
ZB_ZCL_CONSTRUCT_GENERAL_COMMAND_REQ_FRAME_CONTROL_A(cmd_ptr, direction, \
ZB_ZCL_CONSTRUCT_COMMAND_HEADER(cmd_ptr, ZB_ZCL_GET_SEQ_NUM(), ZB_ZCL_CMD_DISC_ATTRIB); \
ZB_ZCL_PACKET_PUT_DATA16_VAL(cmd_ptr, (start_attr_id)); \
ZB_ZCL_PACKET_PUT_DATA8(cmd_ptr, (max_len)); \
ZB_ZCL_FINISH_PACKET(buffer, cmd_ptr) \
ZB_ZCL_SEND_COMMAND_SHORT(buffer, addr, dst_addr_mode, dst_ep, ep, profile_id, cluster_id, cb); \
}

Discover Attribute Request.

Parameters
buffer- reference to buffer to put packet into
cmd_ptr- pointer to command (not used)
direction- direction of command (see zcl_frame_direction)
def_resp- enable/disable default response
start_attr_id- start attribute ID
max_len- max count
addr- address to send packet to
dst_addr_mode- addressing mode
dst_ep- destination endpoint
ep- sending endpoint
profile_id- profile identifier
cluster_id- cluster identifier
cb- callback for getting command send status

◆ ZB_ZCL_GENERAL_DISC_READ_ATTR_REQ

#define ZB_ZCL_GENERAL_DISC_READ_ATTR_REQ (   buffer,
  def_resp,
  start_attr_id,
  max_len,
  addr,
  dst_addr_mode,
  dst_ep,
  ep,
  profile_id,
  cluster_id,
  cb 
)
Value:
{ \
zb_uint8_t *cmd_ptr = ZB_ZCL_START_PACKET(buffer); \
ZB_ZCL_CONSTRUCT_GENERAL_COMMAND_REQ_FRAME_CONTROL(cmd_ptr, def_resp); \
ZB_ZCL_CONSTRUCT_COMMAND_HEADER(cmd_ptr, ZB_ZCL_GET_SEQ_NUM(), ZB_ZCL_CMD_DISC_ATTRIB); \
ZB_ZCL_PACKET_PUT_DATA16_VAL(cmd_ptr, (start_attr_id)); \
ZB_ZCL_PACKET_PUT_DATA8(cmd_ptr, (max_len)); \
ZB_ZCL_FINISH_PACKET(buffer, cmd_ptr) \
ZB_ZCL_SEND_COMMAND_SHORT(buffer, addr, dst_addr_mode, dst_ep, ep, profile_id, cluster_id, cb); \
}

Discover attribute command.

Parameters
buffer- reference to buffer to put packet into
def_resp- enable/disable default response
start_attr_id- start attribute ID
max_len- max count
addr- address to send packet to
dst_addr_mode- addressing mode
dst_ep- destination endpoint
ep- sending endpoint
profile_id- profile identifier
cluster_id- cluster identifier
cb- callback for getting command send status

◆ ZB_ZCL_GENERAL_GET_COMPLETE_DISC_RES

#define ZB_ZCL_GENERAL_GET_COMPLETE_DISC_RES (   data_buf,
  complete 
)
Value:
{ \
if (zb_buf_len(data_buf) > 0) \
{ \
complete = *(zb_uint8_t*)zb_buf_begin(data_buf); \
(void)zb_buf_cut_left((data_buf), sizeof(zb_uint8_t)); \
} \
else \
{ \
(complete) = 0; \
} \
}

Parses Discovery attribute response and returns next Read attribute status record or NULL if there is no more data.

If response contains invalid data, 0 is returned.

Parameters
data_buf- ID zb_bufid_t of a buffer containing discover attribute response data
complete- variable to store Complete field
Note
data_buf buffer should contain Discover attribute response payload, without ZCL header.

◆ ZB_ZCL_GENERAL_GET_NEXT_DISC_ATTR_RES

#define ZB_ZCL_GENERAL_GET_NEXT_DISC_ATTR_RES (   data_buf,
  disc_attr_info 
)
Value:
{ \
(disc_attr_info) = zb_buf_len(data_buf) >= ZB_ZCL_DISC_ATTR_RESP_SIZE ? \
\
if (disc_attr_info) \
{ \
ZB_ZCL_HTOLE16_INPLACE(&(disc_attr_info)->attr_id); \
\
(void)zb_buf_cut_left((data_buf), ZB_ZCL_DISC_ATTR_RESP_SIZE); \
} \
}

Discovery attribute response and returns next Discovery attribute status record or NULL if there is no more data.

If response contains invalid data, NULL is returned.

Parameters
data_buf- ID zb_bufid_t of a buffer containing part of Discover attribute response data
disc_attr_info- out pointer to zb_zcl_disc_attr_info_t, containing Discover attribute status record
Note
data_buf buffer should contain Discover attribute response payload, without ZCL header. Each parsed Discover attribute status record is extracted from initial data_buf buffer

Typedef Documentation

◆ zb_zcl_disc_attr_info_t

ZCL Description for Discover Attribute Response frame.

See also
ZCL spec, zb_zcl_read_attr 2.4.14 Discover Attribute Response

◆ zb_zcl_disc_attr_req_t

ZCL Discover Attribute Command frame.

See also
ZCL spec, zb_zcl_disc_attr 2.4.13 Discover Attributes Command

◆ zb_zcl_disc_attr_res_t

ZCL Discover Attribute Response frame.

See also
ZCL spec, zb_zcl_read_attr 2.4.15 Discover Attribute Response
Note
Command frame contains variable number of parameters

◆ zb_zcl_disc_complete_t

Type for possible values of ZCL Discover Attribute Response.

ZB_AF_HA_PROFILE_ID
#define ZB_AF_HA_PROFILE_ID
Definition: zboss_api_af.h:287
ZB_ZCL_START_PACKET
#define ZB_ZCL_START_PACKET(zbbuf)
Initializes zb_buf_t buffer and returns pointer to the beginning of array.
Definition: zb_zcl_common.h:1427
zb_uint8_t
unsigned char zb_uint8_t
Project-local 1-byte unsigned int type.
Definition: zb_types.h:145
ZB_ZCL_ENABLE_DEFAULT_RESPONSE
#define ZB_ZCL_ENABLE_DEFAULT_RESPONSE
Definition: zb_zcl_common.h:932
ZB_ZCL_GET_SEQ_NUM
#define ZB_ZCL_GET_SEQ_NUM()
Return next sequence number for ZCL frame.
Definition: zb_zcl_common.h:1345
ZB_ZCL_NOT_MANUFACTURER_SPECIFIC
#define ZB_ZCL_NOT_MANUFACTURER_SPECIFIC
Definition: zb_zcl_common.h:908
zb_buf_cut_left
#define zb_buf_cut_left(buf, size)
Definition: zboss_api_buf.h:473
ZB_ZCL_GENERAL_GET_COMPLETE_DISC_RES
#define ZB_ZCL_GENERAL_GET_COMPLETE_DISC_RES(data_buf, complete)
Parses Discovery attribute response and returns next Read attribute status record or NULL if there is...
Definition: zb_zcl_commands.h:1206
ZB_ZCL_CLUSTER_ID_BINARY_INPUT
#define ZB_ZCL_CLUSTER_ID_BINARY_INPUT
Definition: zb_zcl_common.h:216
zb_buf_begin
#define zb_buf_begin(buf)
Definition: zboss_api_buf.h:344
zb_zcl_disc_attr_info_s
ZCL Description for Discover Attribute Response frame.
Definition: zb_zcl_commands.h:1154
ZB_ZCL_ATTR_BINARY_INPUT_PRESENT_VALUE_ID
@ ZB_ZCL_ATTR_BINARY_INPUT_PRESENT_VALUE_ID
PresentValue attribute.
Definition: zb_zcl_binary_input.h:79
ZB_ZCL_GENERAL_GET_NEXT_DISC_ATTR_RES
#define ZB_ZCL_GENERAL_GET_NEXT_DISC_ATTR_RES(data_buf, disc_attr_info)
Discovery attribute response and returns next Discovery attribute status record or NULL if there is n...
Definition: zb_zcl_commands.h:1229
zb_buf_len
#define zb_buf_len(buf)
Definition: zboss_api_buf.h:362
ZB_ZCL_CMD_DISC_ATTRIB
#define ZB_ZCL_CMD_DISC_ATTRIB
Definition: zb_zcl_commands.h:78