这里主要讲述协调器和终端之间的绑定。
This mechanism uses a button press or other similar action at the selected devices to bind within a specific timeout period. The End Device Bind Request messages are collected at the coordinator within the timeout period and a resulting Binding Table entry is created based on the agreement of profile ID and cluster ID. The default end device binding timeout (APS_DEFAULT_MAXBINDING_TIME) is16 seconds (defined in nwk_globals.h), but can be changed if added to f8wConfig.cfg or as a compile flag.
绑定表的创建时间应该是在允许绑定时间结束之后开始的。协议默认的绑定时间为16s。
All sample applications have 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 only the cluster IDs relevant to the lamp On/Off functions.
所有的应用中均有处理绑定的按键事件,具体的看看代码就知道了。
下面的这段话不是很理解,暂时贴在这里,求高手作答。蓝色部分求高手看了之后留言讲解。
Coordinator end device binding is a toggle process. Meaning that the first time your go through the process, it will
create a binding entry in the requesting devices. Then, when you go through the process again, it will remove the
bindings in the requesting devices. That’s why, in the following process, it will send an unbind, and wait to see if
the unbind was successful. If the unbind was successful, the binding entry must have 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 will 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, 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 on to 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 is done, do the same process with the second device.
5. When the second device is done, send the ZDO End Device Bind Response messages to both the first
and second device.