Developing with ZBOSS for Zigbee
Report attribute command parsing

Data Structures

struct  zb_zcl_report_attr_req_s
 ZCL Report Attribute Command frame. More...
 

Macros

#define ZB_ZCL_GENERAL_GET_NEXT_REPORT_ATTR_REQ(data_buf, rep_attr_req)
 Parses Report attribute command and returns next Attribute report or NULL if there is no more data. More...
 

Typedefs

typedef struct zb_zcl_report_attr_req_s zb_zcl_report_attr_req_t
 ZCL Report Attribute Command frame. More...
 

Detailed Description

Report attributes command originates from ZCL internals as a packet constructed according to ZCL spec, subclause 2.4.11. This command can be parsed by cyclical application of ZB_ZCL_GENERAL_GET_NEXT_REPORT_ATTR_REQ() macro.

Macro Definition Documentation

◆ ZB_ZCL_GENERAL_GET_NEXT_REPORT_ATTR_REQ

#define ZB_ZCL_GENERAL_GET_NEXT_REPORT_ATTR_REQ (   data_buf,
  rep_attr_req 
)
Value:
{ \
zb_uint8_t req_size = 0xff; \
(rep_attr_req) = zb_buf_len(data_buf) >= ZB_ZCL_REPORT_ATTR_REQ_SIZE ? \
(zb_zcl_report_attr_req_t*)zb_buf_begin(data_buf) : NULL; \
\
if (rep_attr_req) \
{ \
req_size = ZB_ZCL_REPORT_ATTR_REQ_SIZE; \
ZB_ZCL_HTOLE16_INPLACE(&(rep_attr_req)->attr_id); \
/* Reduce req_size value by sizeof(zb_uint8_t) because it is \
* already included into zb_zcl_report_attr_req_t */ \
req_size += \
zb_zcl_get_attribute_size((rep_attr_req)->attr_type, (rep_attr_req)->attr_value) - \
sizeof(zb_uint8_t); \
if (req_size <= zb_buf_len(data_buf)) \
{ \
ZB_ZCL_FIX_ENDIAN((rep_attr_req)->attr_value, (rep_attr_req)->attr_type); \
} \
\
if (req_size <= zb_buf_len(data_buf)) \
{ \
(void)zb_buf_cut_left((data_buf), req_size); \
} \
else \
{ \
(rep_attr_req) = NULL; \
} \
} \
}

Parses Report attribute command and returns next Attribute report or NULL if there is no more data.

If command contains invalid data, NULL is returned.

Parameters
data_buf- ID zb_bufid_t of a buffer containing Report attribute command data
rep_attr_req- out pointer to zb_zcl_report_attr_req_t, containing Attribute report
Note
data_buf buffer should contain Report attribute command payload, without ZCL header. Each parsed Attribute report attribute is extracted from initial data_buf buffer

Typedef Documentation

◆ zb_zcl_report_attr_req_t

ZCL Report Attribute Command frame.

See also
ZCL spec, 2.4.11.1 Report Attributes Command
Note
Report attribute command contains variable number of attribute reports, zb_zcl_report_attr_req_t defines one attribute report
zb_uint8_t
unsigned char zb_uint8_t
Project-local 1-byte unsigned int type.
Definition: zb_types.h:149
zb_buf_cut_left
#define zb_buf_cut_left(buf, size)
Definition: zboss_api_buf.h:473
zb_buf_begin
#define zb_buf_begin(buf)
Definition: zboss_api_buf.h:344
zb_zcl_report_attr_req_s
ZCL Report Attribute Command frame.
Definition: zb_zcl_commands.h:1647
zb_buf_len
#define zb_buf_len(buf)
Definition: zboss_api_buf.h:362