nRF5 SDK for Thread and Zigbee v3.2.0
Data Structures | Macros | Typedefs | Functions
ZCL attributes reporting

Data Structures

union  zb_zcl_attr_var_u
 

Macros

#define ZB_ZCL_MIN_REPORTING_INTERVAL_DEFAULT   0x0005
 
#define ZB_ZCL_MIN_REPORTING_INTERVAL_DEFAULT   0x0005
 
#define ZB_ZCL_MAX_REPORTING_INTERVAL_DEFAULT   0x0000
 
#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 atrtibute 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
zb_void_t report_attribute_cb(zb_uint16_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)
{
zb_buf_t *buf = zb_get_in_buf();
zb_test_reporting_info_t *test_rep_info = ZB_GET_BUF_PARAM(buf, zb_test_reporting_info_t);
TRACE_MSG(TRACE_ZCL1, ">> report_attribute_cb addr %d ep %hd, cluster %d, attr %d",
(FMT__D_H_D_D, addr, ep, cluster_id, attr_id));
ZVUNUSED(attr_type);
if (ep != DST_ENDPOINT || cluster_id != ZB_ZCL_CLUSTER_ID_ON_OFF || attr_id != TEST_REPORTING_ATTR)
{
g_error_cnt++;
TRACE_MSG(TRACE_ERROR, "Error, incorrect report is received", (FMT__0));
}
TRACE_MSG(TRACE_ZCL2, "reporting interval %d, value %hd",
(FMT__D_H, g_reporting_interval, *value));
test_rep_info->ep = ep;
test_rep_info->cluster_id = cluster_id;
test_rep_info->attr_id = attr_id;
test_rep_info->value = *value;
test_rep_info->rep_interval = g_reporting_interval;
g_reporting_interval = 0;
next_step(buf);
TRACE_MSG(TRACE_ZCL1, "<< report_attribute_cb", (FMT__0));
}
ZB_ZCL_SET_REPORT_ATTR_CB(&report_attribute_cb);

For more information see 546_reporting, reporting_srv samples

Macro Definition Documentation

#define ZB_ZCL_MAX_REPORTING_INTERVAL_DEFAULT   0x0000

Default value for maximum reporting interval

#define ZB_ZCL_MAX_REPORTING_INTERVAL_DEFAULT   0x0000

Default value for maximum reporting interval

#define ZB_ZCL_MIN_REPORTING_INTERVAL_DEFAULT   0x0005

Default value for minimum reporting interval

#define ZB_ZCL_MIN_REPORTING_INTERVAL_DEFAULT   0x0005

Default value for minimum reporting interval

Typedef Documentation

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
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
value- pointer to reported data value

Function Documentation

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_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
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 atrtibute 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

Documentation feedback | Developer Zone | Subscribe | Updated