This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Can't parse a reporting configuration response from a coordinator side.

Hi,

I am new here and I have some issues with Zigbee reporting implementation.

I am trying to implement a reporting feature between a coordinator and an end device, which is a temperature sensor, but I can't parse the reporting response. I pass all the commissioning, binding steps, then I send the reporting request  from the coordinator and I can see from the sniffer the reporting request and the related end device's response.

From what i have understand reading the instructions on your infocenter, the reporting makes a part from ZCL layer, so the response should be captured first from the ZCL handler.

I think that the problem consists in the ZCL handler initialization. i used the ZB_AF_SET_ENDPOINT_HANDLER(ENDPOINT, handler), but it can't be activated when i receive the reporting message.

From the sinffer i can see the same reporting packets (req and resp) from my system and the CLI example, same data.

I followed the command line example for the coordinator implementation, the multisensor example for the end device implementation and wireshark for sniffing using your nrf_sniffer software on the usb dongle.

 
//Report request
static zb_void_t reporting_attr(zb_uint8_t param)
{
    zb_buf_t                  * p_buf = ZB_GET_OUT_BUF();
    configure_reporting_req_t   req;
    zb_uint8_t                * p_cmd_ptr;
    zb_ret_t                    zb_err_code;  if (!p_buf)
    {
        printf("Failed to execute command (buf alloc failed)\n");
        return;
    }    req.profile_id = ZB_AF_HA_PROFILE_ID;
    req.cluster_id = ZB_ZCL_CLUSTER_ID_TEMP_MEASUREMENT;    req.attr_id = ZB_ZCL_ATTR_TEMP_MEASUREMENT_VALUE_ID;
    req.attr_type = ZB_ZCL_ATTR_TYPE_S16;    req.interval_min = ZIGBEE_CONFIGURE_REPORT_DEFAULT_MIN_INTERVAL;
    req.interval_max = ZIGBEE_CONFIGURE_REPORT_DEFAULT_MAX_INTERVAL;    //ZB_MEMCPY(req.remote_node.addr_long,m_attr_table[item].remote_ieee_addr,sizeof(zb_ieee_addr_t));
    req.remote_node.addr_short = m_attr_table[item].remote_node.addr_short;
    req.remote_addr_mode = ZB_APS_ADDR_MODE_16_ENDP_PRESENT;
    req.remote_ep = m_attr_table[item].remote_ep;    ZB_ZCL_GENERAL_INIT_CONFIGURE_REPORTING_SRV_REQ(p_buf,
                                                    p_cmd_ptr,
                                                    ZB_ZCL_ENABLE_DEFAULT_RESPONSE);    ZB_ZCL_GENERAL_ADD_SEND_REPORT_CONFIGURE_REPORTING_REQ(p_cmd_ptr,
        req.attr_id, req.attr_type, req.interval_min, req.interval_max,
        ZIGBEE_CONFIGURE_REPORT_DEFAULT_VALUE_CHANGE);    ZB_ZCL_GENERAL_SEND_CONFIGURE_REPORTING_REQ(p_buf, p_cmd_ptr,
        req.remote_node, req.remote_addr_mode, req.remote_ep, HA_TEMP_SENSOR_ENDPOINT,
        req.profile_id, req.cluster_id, NULL);
}
        
// ZCL Callback   
static zb_uint8_t zcl_device_cb(zb_uint8_t param)
{
    zb_buf_t            * p_zcl_cmd_buf         = (zb_buf_t *)ZB_BUF_FROM_REF(param);
    zb_zcl_parsed_hdr_t * p_cmd_info    = ZB_GET_BUF_PARAM(p_zcl_cmd_buf, zb_zcl_parsed_hdr_t);
    tsn_ctx_t           * p_tsn_ctx;    if (p_cmd_info->cmd_id == ZB_ZCL_CMD_REPORT_ATTRIB)
    {
        attr_update(p_cmd_info, param);
        ZB_FREE_BUF_BY_REF(param);
    }
    else if (p_cmd_info->cmd_id == ZB_ZCL_CMD_CONFIG_REPORT_RESP)
    {        reporting_attr_cb(p_tsn_ctx, param);
    }    /* All callbacks should either reuse or free passed buffers. If param == 0, the buffer is invalid (not passed) */
    if (param)
    {
        ZB_FREE_BUF_BY_REF(param);
    }
    return 1;
}
        
/* Register callback for handling ZCL commands. */
ZB_AF_SET_ENDPOINT_HANDLER(HA_TEMP_SENSOR_ENDPOINT, zcl_device_cb);
    

Parents Reply Children
No Data
Related