Q1, Would it send out APS ACK request? so the call back is dealing the APS ACK confirmation, right?
Q2, If we set the call back as NULL, how the buffer got released?
Q3, If multiple ZB_ZCL_SEND_COMMAND_SHORT are sent, would the zboss call the right call back?
It doesn't get released.
I'll have to get back to you on this tomorrow.
Here is an update.
Q2: Generally, if no callback is set, the stack will free it upon receiving APS ACK. The only broken scenario is when the stack cannot send the command - in such a situation the app should handle the return code to free it, which is impossible with the macro-version.
So you should either use zb_zcl_finish_and_send_packet() (which is described in zb_zcl_common.h in SDK_for_Thread_and_Zigbee_4.0.0) or provide a callback function.
Q3: They are called with the order of receiving APS ACKs. So, if one is lost, the order may differ from the sending queue.
How about ZB_ZCL_GROUPS_SEND_ADD_GROUP_REQ (..., cb), it uses ZB_ZCL_SEND_COMMAND_SHORT to send the packet. There is no way to check if the stack send the command in this case. How we deal this situation?
Heidi is out on business travel so I have taken over this case. If you want to check if the stack have sent the add group command you will need to register an endpoint handler and parse the add group response manually, just like you would parse a read attribute response for example.
From the ZCL spec section 18.104.22.168.1 the payload of the add group response command is the following:
This command is generated in response to a received Add Group command. The Status field is set toSUCCESS, DUPLICATE_EXISTS, or INSUFFICIENT_SPACE as appropriate. The Group ID field is set tothe Group ID field of the received Add Group command.
Correct me if I am wrong.
The following is how I understand
ZB_ZCL_GROUPS_SEND_ADD_GROUP_REQ (..., Default Response, cb, ...)
if Default Response is enabled, the client needs to register an endpoint handler to take care of it. The cb is assigned to handle the APS ACK. It the cb is NULL, the stack will free it upon receiving APS ACK.
When the server receives the Add Group command, it will respond it. The registered end point handler inside the client will receive the server response, and use ZB_ZCL_GROUPS_GET_ADD_GROUP_RES to parse the returned response.
Q1. If Default Response is enabled, the server will respond the default response and Add Group Command?
Q2. In the zigbee/light_control/light_bulb does not see any ZB_ZCL_GROUPS_GET_ADD_GROUP_REQ
to respond the add group command?
Q3. In Add group command definitions, it mentioned "For more information see 5.5.3_groups sample". Where to find 5.5.3?
Thanks so much