组网过程(provisioning)是ble mesh 核心流程,先从宏观上了解整个组网过程,再深入到协议的算法,个人认为更加容易接受一些。
请尊重原创,引用请标明出处https://editor.csdn.net/md/?articleId=104375184
组网流程图
总结为五个步骤:
- beaconing 信标
- 邀请入网,交换设备能力信息(support feature,io cap)
- 交换public key
- 加密,
- 分发组网数据
初步印象,整个过程跟ble smp 流程非常相似。
Beaconning
一个全新的设备,没有加入过任何网络
如果需要加入到mesh 网络,需要向porvisioner 发送ADV
要告诉周围的设备,希望加入mesh 网络,并且现存网络中的设备处于scan 模式,能够收听到这个讯息,注意两点
- provisioner 需要处于scan 模式
- new device 发送Unprovisioned Device beacon
Note:如果一个设备以及配对过,有加入到网络,需要发送匿名广播,或者私有地址广播,区别于Unprovisioned Device beacon
Invitation
provisioner 接收到beacon 之后,会邀请该设备入网,并且会交换一些必要的设备信息,为后续步骤做准备。
这个过程中有一些特殊的数据帧格式需要特别留意:
Provisioning Invite PDU
an Attention Duration field, used to determine how long the primary element of the device identifies itself using the Attention Timer,
告诉新设备,我会等你多久
Provisioning Capabilities PDU
- the number of elements the device supports,
- the set of security algorithms supported,
- the availability of its public key using an OOB technology,
- the ability for this device to output a value to the user,
- the ability for this device to allow a value to be input by the
user, - and if the device has a block of OOB data that can be used for
authentication
*这些信息,决定后后面加密采用的哪种方式,加密