This mainly covers the bindings between the coordinator and the terminal.
This mechanism uses a button press or other similar action at the selected devices to bind within a specific timeout perio D. The End Device Bind Request Messages is collected at the coordinator within the timeout period and a resulting bindin G Table entry is created based on the agreement for Profile ID and cluster ID. The default end device binding timeout (Aps_default_maxbinding_time) is16 seconds (defined in nwk_globals.h), but can is C Hanged if added to F8wconfig.cfg or as a compile flag.
The binding table should be created at the end of the allowable binding time. The default binding time for the protocol is 16s.
All sample applications has a function that handles key events [for example, Transmitapp_handlekeys () in
TRANSMITAPP.C]. This function calls Zdapp_sendenddevicebindreq () [in ZDAPP.C], which gathers all the
Information for the application's endpoint and calls Zdp_enddevicebindreq () [zdprofile.c] to send the
Message to the coordinator. Or, as in Samplelight and Sampleswitch, Zdp_enddevicebindreq () is called
Directly with the cluster IDs relevant to the lamp on/off functions.
All applications have a key event to handle the binding, just look at the code to know.
The following paragraph is not very understanding, temporarily posted here, ask the master to answer. The blue part asks the master to read the message to explain after.
Coordinator end device binding is a toggle process. Meaning that first time your go through the process, it'll
Create a binding entry in the requesting devices. Then if you go through the process again, it'll remove the
Bindings in the requesting devices. That's why, in the following process, it'll send an unbind, and wait for see if
The unbind was successful. If The unbind was successful, the binding entry must has existed and been removed,
Otherwise it sends a binding request to make the entry.
When the coordinator receives 2 matching END Device Bind requests, it'll start the process of creating source
Binding entries in the requesting devices. The coordinator follows the following process, assuming matches were
Found in the ZDO End Device Bind requests:
1. Send a ZDO Unbind Request to the first device. The End Device Bind is toggle process and so the Unbind
is sent first-to-remove an existing bind entry.
2. Wait for the ZDO Unbind Response, if the Response status is Zdp_no_entry, send a ZDO Bind
Request to make the binding entry in the source device. If The response status is Zdp_success,
Move the cluster ID for the first device (the unbind removed the Entry–toggle).
3. Wait for the ZDO Bind Response. When received, move on to the next cluster ID for the first device.
4. When the first device was done, do the same process with the second device.
5. When the second device is do, send the ZDO End device Bind Response messages to both the first
and second device.
The binding between the ZigBee device Object end device bind request--coordinator and the terminal