ZigBee Base Device
所有节点都必须有的基础功能,协调节点之间的行为,与网络创建、加入以及网络安全相关。
1.1 Initialising and starting the ZigBee Base Device
在初始化ZigBee PRO stack以及从persistent storage(固存)中恢复ZigBee Base Device attribute bbdbNodeIsOnANetwork 后,调用BDB_vInit()函数初始化。ZBD的相关事件推送到回调函数
APP_vBdbCallback()中。
NOTE:ZigBee BaseDevice 需要提前注册BDB_ZTIMER以保证,ZBD正常运行。
1.1.1 If the node was not in a network:
- 对于支持Touchlink commissioning的Router,根据BDBC_TL_PRIMARY_CHANNEL_SET或者RAND_CHANNEL的设置选择一个channel。对于Co-ordinator、其他Router以及End Device则没有动作。
- 尝试建网或加入网络。
- 生成BDB_EVENT_INT_SUCCESS事件。
1.1.2 if the node was in a network
- 对于Co-ordinator 和 Router, 没有动作,生成BDB_EVENT_INT_SUCCESS事件。
- 对于End Device, 尝试rejoin network;rejoin cycles如下:
- 尝试之前的网络参数,不带network discovery。
- 尝试network discovery,用u32bdbPrimaryChannelSet指定的primary channel。
- 尝试network discovery, 用u32bdbSecondaryChannelSet指定的secondary channel。
通过BDBC_IMP_MAX_REJOIN_CYCLES指定rejoin cycles的次数。
如果rejoin attempt成功,返回BDB_EVENT_REJOIN_SUCCESS,如果不成功,返回BDB_EVENT_REJOIN_FAILURE
1.2 Network Commissioning
Network commissioning 的动作如下:
- Creating a newtork;
- Allowing devices to join the network;
- Joining a network;
- Binding a local endpoint to an endpoint on a remote node;
- Adding a remote node to a group;
Commissioning activities由ZigBee node 类型决定;
ZigBee Base Device提供了4种commissioning modes,如下:
- Touchlink:
- Creating a new network;
- Allowing other devices to join an existing network;
- Joining local device to an existing network;
- Network Steering:
- Allowing other devices to join an existing network;
- Joining local device to an existing network;
- Network Formation:
- Creating a new network;
- Finding and Binding:
- Binding a local endpoint to an endpoint on a remote node;
- Adding a remote node to a group;
Commissioning modes 可以通过attribute u8bdbCommissioningMode设置,通过attribute ebdbCommissioningStatus来看当前的state。