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

[ZIGBEE] How to send event notification commands ( custom response packet )

Hi, I want to send Door Lock Event Notification commands.

so I modified ZB_ZCL_DOOR_LOCK_SEND_LOCK_DOOR_RES macro in zb_zcl_door_lock.h file.

#define ZB_ZCL_MY_DOOR_LOCK_SEND_OPERATING_EVENT_NOTIFICATION(buffer,                                  \
                                                              addr,                                    \
                                                              dst_addr_mode,                           \
                                                              dst_ep,                                  \
                                                              ep,                                      \
                                                              prfl_id,                                 \
                                                              evt_src,                                  \
                                                              evt_code,                                  \
                                                              user_id,                                \
                                                              pin,                                \
                                                              pin_len,                                \
                                                              local_time,                               \
                                                              data,                               \
                                                              cb,   \
                                                              aps_secured)                             \
{                                                                                                     \
  zb_uint8_t* ptr = ZB_ZCL_START_PACKET(buffer);                                                      \
  zb_ret_t ret; \
  ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_RES_FRAME_CONTROL(ptr);                                           \
  ZB_ZCL_CONSTRUCT_COMMAND_HEADER(ptr, ZB_ZCL_GET_SEQ_NUM(), \
                                  ZB_ZCL_CMD_DOOR_LOCK_OPERATION_EVENT_NOTIFICATION_ID); \
  ZB_ZCL_PACKET_PUT_DATA8(ptr, evt_src);                                              \
  ZB_ZCL_PACKET_PUT_DATA8(ptr, evt_code);                                              \
  ZB_ZCL_PACKET_PUT_DATA16_VAL(ptr, user_id);                                              \
  ZB_ZCL_PACKET_PUT_DATA_N(ptr, pin, pin_len);                                              \
  ZB_ZCL_PACKET_PUT_DATA32_VAL(ptr, local_time);                                              \
  ZB_ZCL_PACKET_PUT_DATA8(ptr, data);                                              \
  ret = zb_zcl_finish_and_send_packet_new(buffer,                                            \
                                  ptr,                                               \
                                  (zb_addr_u *)(&(addr)),                                              \
                                  dst_addr_mode,                                     \
                                  dst_ep,                                            \
                                  ep,                                                \
                                  prfl_id,                                           \
                                  ZB_ZCL_CLUSTER_ID_DOOR_LOCK,                       \
                                  cb,                                              \
                                  aps_secured,                                       \
                                  ZB_FALSE,                                          \
                                  0);                                                \
  DEBUG_PRINTF("NOTI RET: %d\r\n", ret);\
}

OPER EVT NOTI [17] : 
19 1A 20 00 09 34 12 04 31 32 33 34 21 43 65 87 44 
NOTI RET: 0

DEBUG_PRINTF("zb_zcl_check_accept_command: %02X\r\n", zb_zcl_check_accept_command(buffer));\

The result always is zero (ZB_FALSE). There is no a packet sent out checked by sniffer. 

"zb_zcl_check_accept_command" function returns 0xC3 which is ZB_ZCL_STATUS_UNSUP_CLUST if cluster with role specified in ZCL header is not supported.

  • Hi,

    zb_zcl_finish_and_send_packet_new returns zb_ret_t (return type for Zigbee functions returning execution status). The different error codes that zb_ret_t returns can be found in the enum zb_ret_e, which states that 0 is the same as RET_OK, so the function returned without error.

    The door lock cluster is implemented according to the Zigbee Cluster Library (ZCL) specification, in chapter 7.3. Since you get ZB_ZCL_STATUS_UNSUP_CLUST, the problem might be that the implementation of ZB_ZCL_MY_DOOR_LOCK_SEND_OPERATING_EVENT_NOTIFICATION is not according to the ZCL specifications.

    I need some more time to figure out what the issue is, and why, so I'll come back to you later.

    Best regards,

    Marte

  • Hi, Thanks for reply.

    I solved my problem which is address error. I set destination address to my address. after changing this, I checked a packet sent out.

Related