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

Obtaining Send_Add_Group_Request command status.

Hello there,

I am trying to send an add_group_request to a device on the network, and want to capture the send status of the device to check the status of the call. I am doing this by assigning a callback function add_group_callback() to the ZB_ZCL_GROUPS_SEND_ADD_GROUP_REQ() function, as below:

ZB_ZCL_GROUPS_SEND_ADD_GROUP_REQ(bufid,
                                    dst_addr,
                                    ZB_APS_ADDR_MODE_16_ENDP_PRESENT,
                                    dst_ep,
                                    LIGHT_SWITCH_ENDPOINT,
                                    ZB_AF_HA_PROFILE_ID,
                                    ZB_ZCL_DISABLE_DEFAULT_RESPONSE,
                                    add_group_callback,
                                    group);

The command works just fine, and I am able to add the group to the receiving device's grouping table. However I just need some reassurance as to how I am supposed to parse the callback parameter.

I am currently trying to use the zb_buf_get_status() function in order to extract the status directly from the bufid, as below. This gives me a status of 0, which seems to make sense.

static zb_void_t add_group_callback(zb_bufid_t bufid) {
    zb_uint16_t status_buf = zb_buf_get_status(bufid);

    NRF_LOG_INFO("Add group status buff %d", status_buf);

    if (bufid)
    {
        zb_buf_free(bufid);
    }
}

My 3 questions are: 

  1. Is the above method the correct way of getting the send status?
  2. I would like to capture the response of the device which receives the add_group_req command. How would I go about doing this? I am sure it will have something to do with the ZB_ZCL_GROUPS_GET_ADD_GROUP_RES() command, but I am not sure how to use it.
  3. Could you point me to a list of status codes and their meaning?

Thank you very much for your time,
Angry Oatmeal.

Parents
  • Hi,

    Sorry for the late reply. The status of the transmission is stored in zb_zcl_command_send_status_t.

    So for getting the command status from the callback perhaps something like this is better, the status would be stored  inside p_cmd_add_group_status:

    static zb_void_t add_group_callback(zb_bufid_t bufid) {
        zb_zcl_command_send_status_t * p_cmd_add_group_status;
        
        p_cmd_add_group_status = ZB_GET_BUF_PARAM(bufid, zb_zcl_command_send_status_t);
        
        if (bufid)
        {
            zb_buf_free(bufid);
        }
    }

    Best regards,

    Marjeris

Reply
  • Hi,

    Sorry for the late reply. The status of the transmission is stored in zb_zcl_command_send_status_t.

    So for getting the command status from the callback perhaps something like this is better, the status would be stored  inside p_cmd_add_group_status:

    static zb_void_t add_group_callback(zb_bufid_t bufid) {
        zb_zcl_command_send_status_t * p_cmd_add_group_status;
        
        p_cmd_add_group_status = ZB_GET_BUF_PARAM(bufid, zb_zcl_command_send_status_t);
        
        if (bufid)
        {
            zb_buf_free(bufid);
        }
    }

    Best regards,

    Marjeris

Children
Related