Developing with ZBOSS for Zigbee
ZCL attributes reporting

Data Structures

union  zb_zcl_attr_var_u
 

Macros

#define ZB_ZCL_MIN_REPORTING_INTERVAL_DEFAULT   0x0005
 
#define ZB_ZCL_MAX_REPORTING_INTERVAL_DEFAULT   0x0000
 
#define ZB_ZCL_REPORTING_NOT_NEEDED   0xFFFF
 If Maximum reporting interval is set to value 0xFFFF,reporting is not needed for current attribute.
 

Typedefs

typedef void(* zb_zcl_no_reporting_cb_t) (zb_uint8_t ep, zb_uint16_t cluster_id, zb_uint16_t attr_id)
 Informs application that some attribute value was not reported during defined time interval. More...
 
typedef void(* zb_zcl_report_attr_cb_t) (zb_zcl_addr_t *addr, zb_uint8_t ep, zb_uint16_t cluster_id, zb_uint16_t attr_id, zb_uint8_t attr_type, zb_uint8_t *value)
 Informs application about received attribute report. More...
 

Functions

zb_ret_t zb_zcl_start_attr_reporting (zb_uint8_t ep, zb_uint16_t cluster_id, zb_uint8_t cluster_role, zb_uint16_t attr_id)
 Start attribute reporting. More...
 
zb_ret_t zb_zcl_stop_attr_reporting (zb_uint8_t ep, zb_uint16_t cluster_id, zb_uint8_t cluster_role, zb_uint16_t attr_id)
 Stop attribute reporting. More...
 
zb_bool_t zcl_is_attr_reported (zb_uint8_t ep, zb_uint16_t cluster_id, zb_uint8_t cluster_role, zb_uint16_t attr_id)
 Check if an attribute is configured for reporting or not. More...
 
zb_ret_t zb_zcl_put_reporting_info (zb_zcl_reporting_info_t *rep_info_ptr, zb_bool_t override)
 

Detailed Description

ZCL attribute reporting being described in ZCL spec, subclauses 2.4.7 through 2.4.11, and subclauses covering clusters with reportable attributes.

API for attribute reporting configuring and configuration details reading documented in: Configure reporting command sending and parsing, and Report attribute command parsing respectively.

Since all events related to attribute reporting are being handled internally, application can be provided with information on attribute report receipt event, and attribute report not received within predefined interval event. To handle these events, application may set "report attribute" and "no reporting" callbacks with ZB_ZCL_SET_REPORT_ATTR_CB() and ZB_ZCL_SET_NO_REPORTING_CB() macros respectively.

Example
/* Sets a callback being called on receive attribute report */
ZB_ZCL_SET_REPORT_ATTR_CB(report_attribute_cb);
void report_attribute_cb(zb_zcl_addr_t *addr, zb_uint8_t ep, zb_uint16_t cluster_id,
zb_uint16_t attr_id, zb_uint8_t attr_type, zb_uint8_t *value)
{
ZVUNUSED(ep);
ZVUNUSED(attr_type);
ZVUNUSED(value);
TRACE_MSG(TRACE_APP1, ">> report_attribute_cb addr %d ep %hd, cluster 0x%x, attr %d",
(FMT__D_H_D_D, addr->u.short_addr, ep, cluster_id, attr_id));
TRACE_MSG(TRACE_APP1, "<< report_attribute_cb", (FMT__0));
}

Macro Definition Documentation

◆ ZB_ZCL_MAX_REPORTING_INTERVAL_DEFAULT

#define ZB_ZCL_MAX_REPORTING_INTERVAL_DEFAULT   0x0000

Default value for maximum reporting interval

◆ ZB_ZCL_MIN_REPORTING_INTERVAL_DEFAULT

#define ZB_ZCL_MIN_REPORTING_INTERVAL_DEFAULT   0x0005

Default value for minimum reporting interval

Typedef Documentation

◆ zb_zcl_no_reporting_cb_t

typedef void(* zb_zcl_no_reporting_cb_t) (zb_uint8_t ep, zb_uint16_t cluster_id, zb_uint16_t attr_id)

Informs application that some attribute value was not reported during defined time interval.

Parameters
ep- endpoint number
cluster_id- cluster ID
attr_id- attribute ID

◆ zb_zcl_report_attr_cb_t

typedef void(* zb_zcl_report_attr_cb_t) (zb_zcl_addr_t *addr, zb_uint8_t ep, zb_uint16_t cluster_id, zb_uint16_t attr_id, zb_uint8_t attr_type, zb_uint8_t *value)

Informs application about received attribute report.

Parameters
addr- source address
ep- source endpoint number
cluster_id- cluster ID
attr_id- attribute ID
attr_type- attribute type
value- pointer to reported data value

Function Documentation

◆ zb_zcl_start_attr_reporting()

zb_ret_t zb_zcl_start_attr_reporting ( zb_uint8_t  ep,
zb_uint16_t  cluster_id,
zb_uint8_t  cluster_role,
zb_uint16_t  attr_id 
)

Start attribute reporting.

Parameters
ep- endpoint number
cluster_id- cluster ID
cluster_role- cluster role
attr_id- attribute ID
Returns
RET_OK if reporting is successfully started
RET_DOES_NOT_EXIST if reporting can't be configured with given parameters (i.e cluster not present)

◆ zb_zcl_stop_attr_reporting()

zb_ret_t zb_zcl_stop_attr_reporting ( zb_uint8_t  ep,
zb_uint16_t  cluster_id,
zb_uint8_t  cluster_role,
zb_uint16_t  attr_id 
)

Stop attribute reporting.

Parameters
ep- endpoint number
cluster_id- cluster ID
cluster_role- cluster role
attr_id- attribute ID
Returns
RET_OK if reporting is successfully stopped
RET_DOES_NOT_EXIST if reporting was not set up with given parameters

◆ zcl_is_attr_reported()

zb_bool_t zcl_is_attr_reported ( zb_uint8_t  ep,
zb_uint16_t  cluster_id,
zb_uint8_t  cluster_role,
zb_uint16_t  attr_id 
)

Check if an attribute is configured for reporting or not.

Parameters
ep- endpoint number
cluster_id- cluster ID
cluster_role- cluster role
attr_id- attribute ID
Returns
ZB_TRUE if attribute is reported
zb_uint8_t
unsigned char zb_uint8_t
Project-local 1-byte unsigned int type.
Definition: zb_types.h:153
TRACE_MSG
#define TRACE_MSG(lm, fmts, args)
Put trace output.
Definition: zb_trace.h:359
ZB_ZCL_SET_REPORT_ATTR_CB
#define ZB_ZCL_SET_REPORT_ATTR_CB(func_ptr)
Set report attribute callback. The macro sets a callback being called on receive attribute report....
Definition: zboss_api_zcl.h:267
zb_zcl_addr_s
Type to represent source address of ZCL message.
Definition: zb_zcl_common.h:1117
zb_uint16_t
unsigned short zb_uint16_t
Project-local 2-byte unsigned int type.
Definition: zb_types.h:157
zb_zcl_addr_s::zb_zcl_addr_u::short_addr
zb_uint16_t short_addr
Definition: zb_zcl_common.h:1122