bind与command---绑定之命令理解-1

       前一篇文章中主要讲了对于绑定的理解。现在来讲讲对于绑定的实现。

      绑定的实现主要有两种方式:

     If the extended address of the destination device is known, the zb_BindDevice() can be to create a binding entry.

      如果知道目的设备的IEEE地址,那么就可以使用这种模式。但是大多数情形下我们是不知道目标设备的IEEE地址的。可能能通过网络层的IEEE地址的请求函数来请求获得目的设备的IEEE地址,至于具体操作,这里没有去详细讨论,这里提出一个思路,大家可以去尝试一下。

       If the extended address is not known, a “push button” strategy may be employed. In this case, the

destination device is first put in a state where it will respond to match requests by issuing the

zb_AllowBindResponse(). Then the zb_ BindDevice() is issued on the source device with a null address. 大多数是使用这种方式来实现,在Zstack中就是用这种策略实现的。

In addition, bindings can be setup by using an external commissioning tool.

       Note that bindings can only be created between “complementary” devices. That is, the binding will only

succeed if both devices have registered the same command_id  in their simple descriptor structures and

one device has the command as an “output” while the other device has it as an “input”.

      这里需要注意两点,绑定是互补的,也就是说必须源设备和目的设备是成对出现的。且一个设备必须作为一个输出,一个设备必须多输入(这里的输入和输出是必须出现的,但是可以多个设备作为输入或者输出)。请注意这里提到命令。绑定是实现端点之间的连接的,那么command_id就是实现绑定的一种方式。也就是说再不同应用中有相同的command_id,那么着两个设备就可以实现绑定。当然他们的属性值要是正确的,比如输入输出属性。

原文地址:https://www.cnblogs.com/farbeyond/p/5204598.html