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

Parsing values from Coordinator to Router

Hello to all,
I have a question about parsing zigbee commands when they present a payload.
I have a Coordinator that implements the Window Controller Device of the HA profile which sends a value to set the tilt percentage:
I send the percentage value to a Window Covering Device through this define "ZB_ZCL_WINDOW_COVERING_SEND_GO_TO_TILT_PERCENTAGE_REQ".
The Window Covering Device correctly detects the message, what I can't do is read the percentage value I sent.
In the Window Covering device I use the define "ZB_ZCL_WINDOW_COVERING_GET_GO_TO_TILT_PERCENTAGE_REQ" to parsing but I never read the value I sent.

Do I have to do any other operations? Have I understood what I have to do?

Best regards,
Raffaela
  • Hi.

    If you shared your code it would be easier to have a look at this question.

    What status does ZB_ZCL_WINDOW_COVERING_SEND_GO_TO_TILT_PERCENTAGE_REQ return? Are you sure that it returns the correct status?

    /** @brief Parses Get Go to Tilt Percentage command and fills to data request
        structure. If request contains invalid data, -1 is returned as Percentage Tilt Value
        @param data_buf - pointer to zb_buf_t buffer containing command request data
        @param tilt_percentage_req - variable to save command request
        @param status - return ZB_ZCL_PARSE_STATUS_SUCCESS if request contains valid data,
        else ZB_ZCL_PARSE_STATUS_FAILURE
        @note data_buf buffer should contain command request payload without ZCL header.
    */


    Have you remembered this:
    @note data_buf buffer should contain command request payload without ZCL header.

    Best regards,
    Andreas

  • Hi Andreas,

    The code that I wrote is the following:

    static zb_void_t zcl_device_cb(zb_uint8_t param)
    {
        zb_uint8_t                       cluster_id;
        zb_uint8_t                       attr_id;
        zb_buf_t                       * p_buffer = (zb_buf_t *)ZB_BUF_FROM_REF(param);
    
        zb_zcl_device_callback_param_t * p_device_cb_param =
                         ZB_GET_BUF_PARAM(p_buffer, zb_zcl_device_callback_param_t);
    
        NRF_LOG_INFO("zcl_device_cb id %hd", p_device_cb_param->device_cb_id);
        zb_zcl_go_to_tilt_percentage_req_t* tilt_percentage_req;
        volatile zb_zcl_parse_status_t status;
        static volatile zb_uint16_t perc;
        /* Set default response value. */
        p_device_cb_param->status = RET_OK;
    
        switch (p_device_cb_param->device_cb_id)
        {
            case ZB_ZCL_WINDOW_COVERING_UP_OPEN_CB_ID:
                 bsp_board_led_on(BULB_LED);
                 break;
            
            case ZB_ZCL_WINDOW_COVERING_DOWN_CLOSE_CB_ID:
                 bsp_board_led_on(BULB_LED);
                 break;
    
            case ZB_ZCL_WINDOW_COVERING_STOP_CB_ID:
                 bsp_board_led_off(BULB_LED);
                 break;
    
            case ZB_ZCL_WINDOW_COVERING_GO_TO_TILT_PERCENTAGE_CB_ID:
                 bsp_board_led_on(BULB_LED);
                 ZB_ZCL_WINDOW_COVERING_GET_GO_TO_TILT_PERCENTAGE_REQ(p_buffer, tilt_percentage_req, status);
                 perc=&(*tilt_percentage_req).percentage_tilt_value;
                 counter++;
                 break;
    
            default:
                p_device_cb_param->status = RET_ERROR;
                break;
        }
    
        NRF_LOG_INFO("zcl_device_cb status: %hd", p_device_cb_param->status);
    }

    I'm not sure that the data_buf that I'm passing to the "ZB_ZCL_WINDOW_COVERING_SEND_GO_TO_TILT_PERCENTAGE_REQ" is the buffer without header.

    Thank you for your time and best regards,

    Raffaela

  • Hi Andreas,

    Some news?

    Checking well, I would say that the data_buffer (p_buffer) I am passing to the define "ZB_ZCL_WINDOW_COVERING_GET_GO_TO_TILT_PERCENTAGE_REQ"  still contains the header but at the moment I have no idea how to delete this part. And within "p_device_cb_param" I can't find any data that corresponds to the data I'm sending. I know that the data I'm sending is present in p_buffer.buf but I can't access it in any way. Do you have any suggestions? Am I misinterpreting any information?

    I await your feedback, thanks again for the availability.

    Raffaela

  • Hi.

    Could you clarify what you try to do with this line?

                 perc=&(*tilt_percentage_req).percentage_tilt_value;

    *tilt_percentage_req returns a structure.
    (*tilt_percentage_req).percentage_tilt_value returns perentage_tile_value.
    &(*tilt_percentage_req).percentage_tilt_value returns the address of the percentage_tilt_value.

    Also, what is printed when you run this?
    What does the line:

    NRF_LOG_INFO("zcl_device_cb status: %hd", p_device_cb_param->status);

    print?

    Best regards,

    Andreas

  • Sorry, 

    These lines of code are not important for my questions, there are a mistake; the problem is the define that doesn't woks, o better, I haven't idea how to obtain the zcl payload to pass to the define. Can you help with this problem?

    Thank you, 

    Raffaela

Related