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

Problem) zigbee send/receive

Hello, I am a student studying zigbee.
I want to communicate zigbee with the nRF52840 board, but first I checked the lead on/off of the board where zc_light was uploaded with zc_light,zc_switch to learn.

In 'zc_switch' on zc_switch, 'static zb_void_t light_switch_send_on_off (zb_b_buffid_t_off' function have

" ZB_ZCL_ON_OFF_SEND_REQ (bufid,
m_device_ctx.bulb_params.short_addr,
ZB_APS_ADDR_MODE_16_ENDP_PRESENT,
m_device_ctx.bulb_params.endpoint,
LIGHT_SWITCH_ENDPOINT,
ZB_AF_HA_PROFILE_ID,
ZB_ZCL_DISABLE_DEFAULT_RESPONSE,
cmd_id,
NULL);"


Here, 'bufid' will have a packet value, but when I put '3' to test it, I don't know where zc_light gets that value.

devzone.nordicsemi.com/.../question-zigbee-send-receive-zc_light-zc_switch

In the answers on the link above,

zb_bufid_t zcl_cmd_buf = param;
zb_zcl_parsed_hdr_t *cmd_info = ZB_BUF_GET_PARAM (zcl_cmd_buf, zb_zcl_parsed_hdr_t);

They want me to take this.

I have no idea.

I'd appreciate your help.

Parents
  • Hi,

    As I stated in the other ticket, the Zigbee stack handles the on/off commands received on the zc_light. Therefore, the function where this is happening is unavailable to the user, and as such, you'll not be able to find the exact function where zc_light receives the value. So in other words, the Zigbee stack has all mandatory features in the Zigbee specification, and then provides an Application Programming Interface (API) to access the different services. What's available to the user is the callback function, zcl_device_cb, that handles ZCL commands, which you can find in the light_bulb example. However this does not show how it's received, only how it's handled.  

    So, as stated in the other ticket, you have to override this function by creating a custom handler for this if you want to be able to handle the receiving part yourself, but then you will have to implement that yourself. However, if you only want to understand what's happening, I would instead recommend you read up on how the Zigbee stack works, as well as the different clusters, especially the on/off cluster in this case.

    Best regards,

    Marte

Reply
  • Hi,

    As I stated in the other ticket, the Zigbee stack handles the on/off commands received on the zc_light. Therefore, the function where this is happening is unavailable to the user, and as such, you'll not be able to find the exact function where zc_light receives the value. So in other words, the Zigbee stack has all mandatory features in the Zigbee specification, and then provides an Application Programming Interface (API) to access the different services. What's available to the user is the callback function, zcl_device_cb, that handles ZCL commands, which you can find in the light_bulb example. However this does not show how it's received, only how it's handled.  

    So, as stated in the other ticket, you have to override this function by creating a custom handler for this if you want to be able to handle the receiving part yourself, but then you will have to implement that yourself. However, if you only want to understand what's happening, I would instead recommend you read up on how the Zigbee stack works, as well as the different clusters, especially the on/off cluster in this case.

    Best regards,

    Marte

Children
  • Thank you for your answer. The reason why I want to know the payload value of lead on/off is because I want to know the return side because I want to print out the log of end-device if I send the lead from switch instead of on/off.It sounds like a simple method, but it's hard because it's my first time seeing zigbee.
    Should I implement zigbee myself? Or is there a way to transform zc_light and zc_switch?

  • Hi,

    I'm not sure I understand your question. If you want to know what the value of on/off is, you could find this in the Zigbee Cluster Library (ZCL) specification. There you will find the On/Off cluster library and see that it's 0x00 for off and 0x01 for on. ZCL is a set of standardised commands, or functions, to be used in Zigbee applications. In the case of the light switch example, there are two clusters used to control the light: the On/Off cluster is used for turning the light on or off, and the Level Control for dimming the light.  As I've stated before, you should read up on the Zigbee specification in order to get a better understanding of how Zigbee works. In addition to this, you should read about the ZCL and how it's implemented and used in Zigbee applications, as well as read up on relevant clusters, such as the On/Off cluster.

    Best regards,

    Marte

Related