Article Directory
一、Model layer
model defines a node support
功能特性
, each model defines its ownop code
andstatus
.
- For example
generic onoff model
, definedGeneric ON/OFF/GET/STATUS
. - such as……
When Provisioner is networking
- It will pass
get composition data
command to get all the support node model id - Then Provisioner can know what functions the node specifically supports
- Then the Provisioner knows what to send to the node
op code
Model is divided into server model and client model.
server model
: It is a controlled character with its own state, which can be changed and acquired by other nodes- For example, a Led device with
onoff server model
- You may receive
onoff set/get
commands (issued by the command control switch App) - Can reply
onoff status
command (command App query Led state) - But the LED can not own it sends out
onoff set/get 命令
andonoff status
command
- For example, a Led device with
client model
: It is a role that controls the server node, without its own state- For example, a Bluetooth remote control with
onoff client model
- May send a
onoff set/get
command (remote control LED or other device) - You may send a
onoff status
command (Check status LED or other device) - But can not reply to received
onoff status
commands, it will not process the receivedonoff set/get
command
- For example, a Bluetooth remote control with
二、Foundation Model layer
Foundation Model and the model is basically the same model, is the foundation model, includes Configuration Server model
, Configuration Client model
, Health Server model
, Health Client model
.
- All nodes to be distributed must contain
Configuration Server model
- The provisioner node must contain
Configuration Client model
The common op codes contained in these two models are subscription add/delete (group number addition/delete), etc., and the encryption of the access layer layer of these two models uses the device key, so generally speaking, only the provisioner node can send the configuration The set/get commands of model.
Three, Access layer
In short, one sentence
Combine op code and parameter in a prescribed format.
四、Transport layer
Use app key or device key (used by configuration model) for encryption and decryption. Determine and confirm whether it is necessary to implement subcontracting and grouping agreements.
At present, in order to be compatible with devices that do not support long broadcast packets such as BLE4.2, the maximum payload of adv is uniformly set to 31 bytes.
Five, Network layer
For the sending process
- Add a sequence number to the data packet, etc.
- And use network key, iv index to encrypt the data
- After sending, the sequence number will perform the "plus 1" operation
For the receiving process
- Use network key, iv index to decrypt the data
- After decryption, determine whether the sequence number is valid (that is, whether it is greater than the received value)
- If it is invalid, discard it
六、Bearer layer
The encrypted data has been performed by the packet type
is LL_TYPE_ADV_NONCONN_IND(0x02)
transmitted to the broadcast packet mesh
networks.
If you think it’s good, just one click for three consecutive chants (Like+Favorite+Follow)