ZB_ZCL_SET_MODIFY_ATTR_VALUE_CB seam not working in SDK NRF4.1.0

Hello,

I will try to use the macro ZB_ZCL_SET_MODIFY_ATTR_VALUE_CB to define a callback when an attribut is written in my device.
But the callback I write is never called.
I have try the same thing with ZB_ZCL_SET_REPORT_ATTR_CB when my device receive a report attribut, it works well.
I have try also with ZB_ZCL_CHECK_ATTR_VALUE_CB this works well to, this callback is called before the write attribut is done.

So, what is the problem please ?

Parents
  • Hi,

    It can be quite a challenge to troubleshoot. As a starting point, could you tell me where and how did you define the callbacks, both the ones working and the one set by ZB_ZCL_SET_MODIFY_ATTR_VALUE_CB. What are you doing to try to get the callback defined by ZB_ZCL_SET_MODIFY_ATTR_VALUE_CB to be called?

    I got in touch with an expert in Zigbee regarding this issue and got to know that there is an easy way to handle attributes changes. Kindly take a look at the light bulb example (\examples\zigbee\light_control\light_bulb). 

    On line 588 in main.c, the following code, B_ZCL_REGISTER_DEVICE_CB(zcl_device_cb); sets zcl_device_cb as the Zigbee device callback (you can read more about how to use this here: Implementing Zigbee device callback). So when the device receives a ZCL command the callback will be called. The implementation of this callback is just a few lines up in main.c, starting on line 466.

    You then have multiple types of callbacks, as defined in zb_zcl_device_callback_id_e (also on line 278 in external/zboss/include/zboss_api_zcl.h). You find the type of callback by first getting the parameters of the callback:

    zb_zcl_device_callback_param_t * p_device_cb_param = ZB_BUF_GET_PARAM(bufid, zb_zcl_device_callback_param_t);

    Then the callback is given by device_cb_id:

    p_device_cb_param->device_cb_id

    You can then use ZB_ZCL_SET_ATTR_VALUE_CB_ID, informs the user that an attribute value has been changed. So, you can simply do as in the light switch example, where there's a switch for the callback type, and if the type is ZB_ZCL_SET_ATTR_VALUE_CB_ID, you can find the cluster ID and attribute ID:

    cluster_id = p_device_cb_param->cb_param.set_attr_value_param.cluster_id;

    attr_id    = p_device_cb_param->cb_param.set_attr_value_param.attr_id;

    And then implement what you want to do when the specific attribute in the specific cluster is changed.

    Hope this helps.

    Kind Regards,

    Swathy

Reply
  • Hi,

    It can be quite a challenge to troubleshoot. As a starting point, could you tell me where and how did you define the callbacks, both the ones working and the one set by ZB_ZCL_SET_MODIFY_ATTR_VALUE_CB. What are you doing to try to get the callback defined by ZB_ZCL_SET_MODIFY_ATTR_VALUE_CB to be called?

    I got in touch with an expert in Zigbee regarding this issue and got to know that there is an easy way to handle attributes changes. Kindly take a look at the light bulb example (\examples\zigbee\light_control\light_bulb). 

    On line 588 in main.c, the following code, B_ZCL_REGISTER_DEVICE_CB(zcl_device_cb); sets zcl_device_cb as the Zigbee device callback (you can read more about how to use this here: Implementing Zigbee device callback). So when the device receives a ZCL command the callback will be called. The implementation of this callback is just a few lines up in main.c, starting on line 466.

    You then have multiple types of callbacks, as defined in zb_zcl_device_callback_id_e (also on line 278 in external/zboss/include/zboss_api_zcl.h). You find the type of callback by first getting the parameters of the callback:

    zb_zcl_device_callback_param_t * p_device_cb_param = ZB_BUF_GET_PARAM(bufid, zb_zcl_device_callback_param_t);

    Then the callback is given by device_cb_id:

    p_device_cb_param->device_cb_id

    You can then use ZB_ZCL_SET_ATTR_VALUE_CB_ID, informs the user that an attribute value has been changed. So, you can simply do as in the light switch example, where there's a switch for the callback type, and if the type is ZB_ZCL_SET_ATTR_VALUE_CB_ID, you can find the cluster ID and attribute ID:

    cluster_id = p_device_cb_param->cb_param.set_attr_value_param.cluster_id;

    attr_id    = p_device_cb_param->cb_param.set_attr_value_param.attr_id;

    And then implement what you want to do when the specific attribute in the specific cluster is changed.

    Hope this helps.

    Kind Regards,

    Swathy

Children
No Data
Related