Configure reporting command sending and parsing

nRF5 SDK for Thread and Zigbee v4.2.0

Data Structures

struct  zb_zcl_configure_reporting_req_clnt_s
 
struct  zb_zcl_configure_reporting_req_srv_s
 
union  zb_zcl_configure_reporting_req_u_s
 General type for Configure Reporting Request command. More...
 
struct  zb_zcl_configure_reporting_req_s
 One chunk of Configure reporting command request. More...
 
struct  zb_zcl_configure_reporting_res_s
 

Macros

#define ZB_ZCL_GENERAL_GET_NEXT_CONFIGURE_REPORTING_REQ(data_buf, config_rep_req)
 Parses Configure reporting command request and returns next Attribute reporting configuration record or NULL if there is no more data. More...
 
#define ZB_ZCL_GENERAL_GET_NEXT_CONFIGURE_REPORTING_RES(data_buf, config_rep_res)
 Parses Configure reporting response and returns next configure attribute status record or NULL if there is no more data. More...
 
#define ZB_ZCL_GENERAL_INIT_CONFIGURE_REPORTING_SRV_REQ(buffer, ptr, def_resp)
 Initialize Configure reporting command (report send case) More...
 
#define ZB_ZCL_GENERAL_INIT_CONFIGURE_REPORTING_CLI_REQ(buffer, ptr, def_resp)
 Initialize Configure reporting command (report receive case) More...
 
#define ZB_ZCL_GENERAL_ADD_SEND_REPORT_CONFIGURE_REPORTING_REQ( ptr, attr_id, attr_type, min_interval, max_interval, report_change)
 Add attribute reporting configuration record to command payload (report send case) More...
 
#define ZB_ZCL_GENERAL_ADD_RECV_REPORT_CONFIGURE_REPORTING_REQ(ptr, attr_id, timeout)
 Add attribute reporting configuration record to command payload (report receive case) More...
 
#define ZB_ZCL_GENERAL_SEND_CONFIGURE_REPORTING_REQ( buffer, ptr, addr, dst_addr_mode, dst_ep, ep, prfl_id, cluster_id, cb)
 Sends Configure reporting command. More...
 

Detailed Description

Most of actions related to the attribute reporting configuration are implemented in ZCL internals.

As described in ZCL spec, subclause 2.4.7, Configure Reporting command has two forms:

  • client to server - instructs server to configure for attribute reporting.
  • server to client - notifies client that server has configured for attribute reporting, and will report attribute values to the client.

Request to configure server for attribute reporting can be filled like in the snippet below:

cmd_ptr,
cmd_ptr, ZB_ZCL_ATTR_ON_OFF_ON_OFF_ID, ZB_ZCL_ATTR_TYPE_BOOL, SIMPLE_GW_REPORTING_MIN_INTERVAL,
SIMPLE_GW_REPORTING_MAX_INTERVAL(dev_idx), 0);
ZB_ZCL_GENERAL_SEND_CONFIGURE_REPORTING_REQ(buf, cmd_ptr, g_device_ctx.devices[dev_idx].short_addr, ZB_APS_ADDR_MODE_16_ENDP_PRESENT,
g_device_ctx.devices[dev_idx].endpoint, SIMPLE_GW_ENDPOINT,
ZB_AF_HA_PROFILE_ID, ZB_ZCL_CLUSTER_ID_ON_OFF, configure_reporting_cb);

Other variant of the command can be filled in a similar way with ZB_ZCL_GENERAL_INIT_CONFIGURE_REPORTING_CLI_REQ() and ZB_ZCL_GENERAL_ADD_RECV_REPORT_CONFIGURE_REPORTING_REQ() macros, and scheduled for sending with ZB_ZCL_GENERAL_SEND_CONFIGURE_REPORTING_REQ() macro.

Configure reporting request record can be parsed as:

zb_bufid_t buffer = pointer_to_the_packet_buffer;
...
do
{
if (! req_record)
{
break;
}
process_request_record(req_record);
} while (1);

Configure Reporting response command will be generated automatically by ZCL internals. Response record to the Configure Reporting command can be parsed as:

If there are several Configure Reporting response records, they could be processed cyclically in the same manner as Configure Reporting request ones.

Macro Definition Documentation

◆ ZB_ZCL_GENERAL_ADD_RECV_REPORT_CONFIGURE_REPORTING_REQ

#define ZB_ZCL_GENERAL_ADD_RECV_REPORT_CONFIGURE_REPORTING_REQ (   ptr,
  attr_id,
  timeout 
)
Value:
{ \
ZB_ZCL_PACKET_PUT_DATA8(ptr, ZB_ZCL_CONFIGURE_REPORTING_RECV_REPORT); \
ZB_ZCL_PACKET_PUT_DATA16_VAL(ptr, (attr_id)); \
ZB_ZCL_PACKET_PUT_DATA16_VAL(ptr, (timeout)); \
}
Definition: zb_zcl_commands.h:1419

Add attribute reporting configuration record to command payload (report receive case)

Parameters
ptr- command buffer pointer
attr_id- attribute identifier
timeout- reporting timeout

◆ ZB_ZCL_GENERAL_ADD_SEND_REPORT_CONFIGURE_REPORTING_REQ

#define ZB_ZCL_GENERAL_ADD_SEND_REPORT_CONFIGURE_REPORTING_REQ (   ptr,
  attr_id,
  attr_type,
  min_interval,
  max_interval,
  report_change 
)
Value:
{ \
ZB_ZCL_PACKET_PUT_DATA8(ptr, ZB_ZCL_CONFIGURE_REPORTING_SEND_REPORT); \
ZB_ZCL_PACKET_PUT_DATA16_VAL(ptr, (attr_id)); \
ZB_ZCL_PACKET_PUT_DATA8(ptr, (attr_type)); \
ZB_ZCL_PACKET_PUT_DATA16_VAL(ptr, (min_interval)); \
ZB_ZCL_PACKET_PUT_DATA16_VAL(ptr, (max_interval)); \
if (zb_zcl_is_analog_data_type(attr_type)) \
{ \
(ptr) = zb_zcl_put_value_to_packet((ptr), (attr_type), report_change); \
} \
}
Definition: zb_zcl_commands.h:1418
zb_uint8_t * zb_zcl_put_value_to_packet(zb_uint8_t *cmd_ptr, zb_uint8_t attr_type, zb_uint8_t *attr_value)
zb_bool_t zb_zcl_is_analog_data_type(zb_uint8_t attr_type)
Check whether type of ZCL attrbiute is analog.

Add attribute reporting configuration record to command payload (report send case)

Parameters
ptr- command buffer pointer
attr_id- attribute identifier
attr_type- type of the attribute
min_interval- reporting minimum interval
max_interval- reporting maximum interval
report_change- reportable value change

◆ ZB_ZCL_GENERAL_GET_NEXT_CONFIGURE_REPORTING_REQ

#define ZB_ZCL_GENERAL_GET_NEXT_CONFIGURE_REPORTING_REQ (   data_buf,
  config_rep_req 
)

Parses Configure reporting command request and returns next Attribute reporting configuration record or NULL if there is no more data.

If request contains invalid data, NULL is returned.

Parameters
data_buf- ID zb_bufid_t of a buffer containing Parses Configure reporting command data
config_rep_req- out pointer to zb_zcl_configure_reporting_req_t, containing Attribute reporting configuration record
Note
data_buf buffer should contain Configure reporting command payload, without ZCL header. Each parsed Attribute reporting configuration record is extracted from initial data_buf buffer

◆ ZB_ZCL_GENERAL_GET_NEXT_CONFIGURE_REPORTING_RES

#define ZB_ZCL_GENERAL_GET_NEXT_CONFIGURE_REPORTING_RES (   data_buf,
  config_rep_res 
)

Parses Configure reporting response and returns next configure 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 Configure reporting response data
config_rep_res- out pointer to zb_zcl_configure_reporting_res_t, containing Configure attribute status record
Note
data_buf buffer should contain Configure reporting response payload, without ZCL header. Each parsed Configure attribute status record is extracted from initial data_buf buffer

◆ ZB_ZCL_GENERAL_INIT_CONFIGURE_REPORTING_CLI_REQ

#define ZB_ZCL_GENERAL_INIT_CONFIGURE_REPORTING_CLI_REQ (   buffer,
  ptr,
  def_resp 
)
Value:
{ \
ptr = ZB_ZCL_START_PACKET(buffer); \
ZB_ZCL_CONSTRUCT_GENERAL_COMMAND_REQ_FRAME_CONTROL_A( \
ZB_ZCL_CONSTRUCT_COMMAND_HEADER(ptr, ZB_ZCL_GET_SEQ_NUM(), ZB_ZCL_CMD_CONFIG_REPORT); \
}
#define ZB_ZCL_GET_SEQ_NUM()
Return next sequence number for ZCL frame.
Definition: zb_zcl_common.h:1443
#define ZB_ZCL_START_PACKET(zbbuf)
Initializes zb_buf_t buffer and returns pointer to the beginning of array.
Definition: zb_zcl_common.h:1523
#define ZB_ZCL_FRAME_DIRECTION_TO_CLI
Definition: zb_zcl_common.h:1053
#define ZB_ZCL_NOT_MANUFACTURER_SPECIFIC
Definition: zb_zcl_common.h:1006
#define ZB_ZCL_CMD_CONFIG_REPORT
Definition: zb_zcl_commands.h:91

Initialize Configure reporting command (report receive case)

Parameters
bufferto put packet to
ptr- command buffer pointer
def_resp- enable/disable default response

◆ ZB_ZCL_GENERAL_INIT_CONFIGURE_REPORTING_SRV_REQ

#define ZB_ZCL_GENERAL_INIT_CONFIGURE_REPORTING_SRV_REQ (   buffer,
  ptr,
  def_resp 
)
Value:
{ \
ptr = ZB_ZCL_START_PACKET(buffer); \
ZB_ZCL_CONSTRUCT_GENERAL_COMMAND_REQ_FRAME_CONTROL_A( \
ZB_ZCL_CONSTRUCT_COMMAND_HEADER(ptr, ZB_ZCL_GET_SEQ_NUM(), ZB_ZCL_CMD_CONFIG_REPORT); \
}
#define ZB_ZCL_GET_SEQ_NUM()
Return next sequence number for ZCL frame.
Definition: zb_zcl_common.h:1443
#define ZB_ZCL_START_PACKET(zbbuf)
Initializes zb_buf_t buffer and returns pointer to the beginning of array.
Definition: zb_zcl_common.h:1523
#define ZB_ZCL_FRAME_DIRECTION_TO_SRV
Definition: zb_zcl_common.h:1051
#define ZB_ZCL_NOT_MANUFACTURER_SPECIFIC
Definition: zb_zcl_common.h:1006
#define ZB_ZCL_CMD_CONFIG_REPORT
Definition: zb_zcl_commands.h:91

Initialize Configure reporting command (report send case)

Parameters
bufferto put packet to
ptr- command buffer pointer
def_resp- enable/disable default response

◆ ZB_ZCL_GENERAL_SEND_CONFIGURE_REPORTING_REQ

#define ZB_ZCL_GENERAL_SEND_CONFIGURE_REPORTING_REQ (   buffer,
  ptr,
  addr,
  dst_addr_mode,
  dst_ep,
  ep,
  prfl_id,
  cluster_id,
  cb 
)
Value:
{ \
ZB_ZCL_FINISH_PACKET(buffer, ptr) \
ZB_ZCL_SEND_COMMAND_SHORT(buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, cluster_id, cb); \
}

Sends Configure reporting command.

Parameters
bufferto put data to
ptr- pointer to the memory area to put data to
addr- address to send packet to
dst_addr_mode- addressing mode
dst_ep- destination endpoint
ep- sending endpoint
prfl_id- profile identifier
cluster_id- cluster identifier
cb- callback for getting command send status

Typedef Documentation

◆ zb_zcl_configure_reporting_direction_value_t

Configure reporting command, direction field values

◆ zb_zcl_configure_reporting_req_clnt_t

u.clnt: as usual, cluster with client role sends this request to a server to configure reporting: how attribute should be reported by a server

◆ zb_zcl_configure_reporting_req_srv_t

u.srv: as usual, cluster with server role sends this request to a client, to inform him how an attribute will be reported by a server

◆ zb_zcl_configure_reporting_req_t

One chunk of Configure reporting command request.

Attribute reporting configuration record

◆ zb_zcl_configure_reporting_req_u_t

◆ zb_zcl_configure_reporting_res_t

One chunk of Configure reporting response command

Attribute status record

Enumeration Type Documentation

◆ zb_zcl_configure_reporting_direction_value_e

Configure reporting command, direction field values

Enumerator
ZB_ZCL_CONFIGURE_REPORTING_SEND_REPORT 

Report should be send by a cluster.

ZB_ZCL_CONFIGURE_REPORTING_RECV_REPORT 

Report should be received by a cluster.