Context:
I am developing a Zigbee lock that implements the door lock cluster, and needs to be able to parse and handle incoming ZCL commands. According to this documentation, the SDK provides two handling mechanisms for this use-case.
1) ZCL packet handler - registered via ZB_AF_SET_ENDPOINT_HANDLER. The SDK provides this method to bypass the default handler for application-specific handling of a ZCL command.
2) Zigbee device callback - this is an optional callback registered via ZB_ZCL_REGISTER_DEVICE_CB. It's called by the stack's default cluster handlers when an event such as in incoming ZCL command occurs.
Question:
To my understanding, both these handlers serve the purpose of processing ZCL commands. My question is, what's the distinction between the two and what use-cases serve the purpose of each? For example, if I issue a lock command from a coordinator, should the locking operation be performed in the ZCL packer handler after it is parsed for ZB_ZCL_CMD_DOOR_LOCK_LOCK_DOOR, or should it be performed in the Zigbee device callback when its called with the ID ZB_ZCL_DOOR_LOCK_LOCK_DOOR_CB_ID. Is there a rule of thumb for which flow to follow for processing commands and is it standard for all types commands or is one better suited for certain types of commands.
Thank you.