目录
开启允许入网命令Management Permit Joining Request
Match Descriptor Request/Response
Node Descriptor Request/Response
Active Endpoints Request/Response
Simple Descriptor Request/Response
入网流程图
设备进入通过coordinater入网
如果一个设备通过一个router入网的流程是:
入网相关命令说明
下面我们说明下入网过程中我们会遇到的一些重要命令
开启允许入网命令Management Permit Joining Request
coordinater 发出Permit Joining Request广播,允许设备入网,时长一般为180s
设备入网请求命令Beacon Request命令
待入网设备启动扫网操作后,将在预置信道发出Beacon Request广播,zigbee信道为11~26,一般考虑效率和与WiFi信道干扰问题,会选择几条优先信道(如11、15、20、25)进行扫网。
Beacon Request回复命令
在收到Beacon Request后,同一信道的不同PAN的协调器会发出Beacon回应,待入网设备收到后会对其进行筛选,如是否允许入网,节点深度,是否接入当前设备类型。
如果不允许入网 Association Permit为No
Router Capacity 为Yes,表示能入网Router设备
End Device Capacity为Yes ,表示能入网End Device设备
开始入网 Association Request命令
设备筛选出合适的网络(允许入网、节点深度较低、可接入当前设备类型),并向其发出Association Request请求入网
Association Response
收到Association Request后,协调器将根据当前资源情况决定是否允许其加入,若允许,则为其分配短地址,并返回Association response
Transport Key (发送NWK Key)
coordinater将NWK Key使用LNK Key加密发送给设备,而此处LNK key是预配置Pre-configured的,可使用ZigBeeAlliance09(5A:69:67:42:65:65:41:6C:6C:69:61:6E:63:65:30:39)或是利用install code生成。NWK key用于后期网络层通信的加密。
Device Announce
当设备接收到NWK key并且解密成功后,发送广播Device Announce,告知整个网络,我已经加入了
替换LNK key (ZIGBEE 3.0以上要求)
Request key(Link key):子设备向coordinater请求新的Link key以替换前面Pre-configured Link key
Transport Key (发送新的LNK Key)
Transport key(link key):coordinater返回新的Link key
Verify Key Resquest
子设备发送Verify Key Resquest请求Coordinate验证新的LNK Key
Verify Key Confirm
Coordinate验证新的LNK Key通过后,给子设备回复
入网过程中的其他命令
Date Request
Date Request命令是催促目标尽快回复
像在这里 子设备发送了Association Request后,200ms后发送了Date Request催促Coordinate回复
Match Descriptor Request/Response
Request用于询问子设备是否支持某个ClusterId
Response子设备回复哪几个Endpoint支持这个ClusterId
Node Descriptor Request/Response
子设备询问Coordinate的情况
Coordinate的Response
Active Endpoints Request/Response
Coordinate发送Active Endpoint Request查询子设备支持的endpoint
子设备Response
Simple Descriptor Request/Response
Coordinate查询子设备某个endpoint支持的ClusterId信息
子设备的Response