nRF5 SDK for Thread and Zigbee v3.2.0
Data Structures | Macros | Typedefs | Enumerations
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 enum zb_zcl_disc_complete_e zb_zcl_disc_complete_t
 ZCL Discover Attribute Response - complete field. More...
 

Enumerations

enum  zb_zcl_disc_complete_e { ZB_ZCL_DISC_NON_COMPLETE = 0x00, ZB_ZCL_DISC_COMPLETE = 0x01 }
 ZCL Discover Attribute Response - complete field. More...
 

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

#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_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); \
}
#define ZB_ZCL_PACKET_PUT_DATA8(ptr, val)
Put 8-bit value to packet.
Definition: zb_zcl_common.h:1353
#define ZB_ZCL_GET_SEQ_NUM()
Return next sequence number for ZCL frame.
Definition: zb_zcl_common.h:1250
#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_PACKET_PUT_DATA16_VAL(ptr, val)
Definition: zb_zcl_common.h:1371
#define ZB_ZCL_FINISH_PACKET(zbbuf, ptr)
Definition: zb_zcl_common.h:1654
Definition: zb_zcl_commands.h:90
unsigned char zb_uint8_t
Project-local 1-byte unsigned int type.
Definition: zb_types.h:116

Discover Attribute Request.

Parameters
buffer- reference to buffer to put packet into
cmd_ptr- pointer to command (not used)
direction- direction of command (see zb_zcl_frame_direction_t)
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
#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_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); \
}
#define ZB_ZCL_PACKET_PUT_DATA8(ptr, val)
Put 8-bit value to packet.
Definition: zb_zcl_common.h:1353
#define ZB_ZCL_GET_SEQ_NUM()
Return next sequence number for ZCL frame.
Definition: zb_zcl_common.h:1250
#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_PACKET_PUT_DATA16_VAL(ptr, val)
Definition: zb_zcl_common.h:1371
#define ZB_ZCL_FINISH_PACKET(zbbuf, ptr)
Definition: zb_zcl_common.h:1654
Definition: zb_zcl_commands.h:90
unsigned char zb_uint8_t
Project-local 1-byte unsigned int type.
Definition: zb_types.h:116

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
#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); \
ZB_BUF_CUT_LEFT2((data_buf), sizeof(zb_uint8_t)); \
} \
else \
{ \
(complete) = 0; \
} \
}
#define ZB_BUF_BEGIN(zbbuf)
Definition: zboss_api_core.h:767
#define ZB_BUF_LEN(zbbuf)
Definition: zboss_api_core.h:776
unsigned char zb_uint8_t
Project-local 1-byte unsigned int type.
Definition: zb_types.h:116

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- pointer to zb_buf_t 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.
#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); \
\
ZB_BUF_CUT_LEFT2((data_buf), ZB_ZCL_DISC_ATTR_RESP_SIZE); \
} \
}
#define ZB_BUF_BEGIN(zbbuf)
Definition: zboss_api_core.h:767
#define ZB_BUF_LEN(zbbuf)
Definition: zboss_api_core.h:776
ZCL Description for Discover Attribute Response frame.
Definition: zb_zcl_commands.h:1148

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- pointer to zb_buf_t 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 exctracted from intial data_buf buffer

Typedef Documentation

ZCL Description for Discover Attribute Response frame.

See also
ZCL spec, zb_zcl_read_attr 2.4.14 Discover Attribute Response

ZCL Discover Attribute Command frame.

See also
ZCL spec, zb_zcl_disc_attr 2.4.13 Discover Attributes Command

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

ZCL Discover Attribute Response - complete field.

See also
ZCL spec, clause 2.4.14

Enumeration Type Documentation

ZCL Discover Attribute Response - complete field.

See also
ZCL spec, clause 2.4.14
Enumerator
ZB_ZCL_DISC_NON_COMPLETE 

more attributes to be discovered

ZB_ZCL_DISC_COMPLETE 

no more attributes to be discovered


Documentation feedback | Developer Zone | Subscribe | Updated