Summary of the invention
It is an object of the invention to overcome the deficiencies in the prior art, propose a kind of to realize multicasting based on LoRaWAN
Method and system, identical data DL synchronization to multiple terminal nodes realize Broadcasting Control and multicast control.
The technical solution adopted by the present invention to solve the technical problems is:
On the one hand, a method of multicasting is realized based on LoRaWAN, comprising:
Each LoRaWAN terminal node presets multiple identity;The multiple identity includes a unicast identity, a broadcast
Identity and at least one reserved multicast identity;Wherein, each identity includes device address DevAddr, for data frame check
NwkSKey and AppSKey for data frame encryption;The device address of each LoRaWAN terminal node unicast identity is respectively not
It is identical;The device address of each LoRaWAN terminal node broadcast identity is all the same;
Each LoRaWAN terminal node reports multicast identity to LoRaWAN server and monitors matching for LoRaWAN server
Set request;The LoRaWAN server carries out configuration storage and the configuration payroll management of multicast;
The LoRaWAN server sends broadcast message to LoRaWAN terminal node to configure LoRaWAN terminal node
Multicast identity.
Preferably, the LoRaWAN server sends broadcast message to LoRaWAN terminal node to configure LoRaWAN end
The multicast identity of end node, specifically includes:
LoRaWAN server sends to LoRaWAN terminal node and broadcasts the message;It fills the device address of the broadcast message
For the device address for broadcasting identity;The MAC layer load FRMPayload of the broadcast message includes needing to carry out multicast
The device address of the unicast identity device address of LoRaWAN terminal node and multicast identity to be placed;
LoRaWAN terminal node receives the broadcast message, judges whether the device address of the broadcast message is broadcast
The device address of identity, if so, judge in FRMPayload field whether include itself unicast identity device address;If
Including obtaining the device address of corresponding multicast identity.
Preferably, LoRaWAN terminal node judges whether the device address of the broadcast message is the equipment for broadcasting identity
Before address further include:
Judge whether the device address of the broadcast message is the device address of itself unicast identity, if so, showing to connect
The message received is unicast messages, responds corresponding request;If it is not, judge the broadcast message device address whether be
Broadcast the device address of identity.
Preferably, LoRaWAN terminal node reports multicast identity to LoRaWAN server, comprising:
Terminal node reports current multicast body with unicast identity to LoRaWAN server in restarting or initialization
Part;
Terminal node report multicast identity message in comprising multicast identity address and for data check
NwkSKey and AppSKey for data frame encryption.
Preferably, LoRaWAN server carries out configuration storage and the configuration payroll management of multicast, comprising:
LoRaWAN server receives creation broadcast group request, and arbitrary broadcast group is added in any LoRaWAN terminal node
In;
LoRaWAN server stores the mapping relations of terminal node and broadcast group according to the setting of broadcast group;
The multicast identity of LoRaWAN server monitor terminal node is reported, and the state in real-time update broadcast group, in conjunction with
The mapping relations determine the multicast configuration message for needing to issue.
Preferably, during LoRaWAN server and LoRaWAN terminal node carry out interacting message, it is used for data frame
The NwkSKey of verification and AppSKey for data frame encryption are encrypted or are decrypted using AES128.
On the other hand, it is a kind of based on LoRaWAN realize multicasting system, comprising: several LoRaWAN terminal nodes and
LoRaWAN server;
Wherein, each LoRaWAN terminal node is preset with multiple identity;The multiple identity include a unicast identity,
One broadcast identity and at least one reserved multicast identity;Each identity includes device address DevAddr, for data frame school
The NwkSKey tested the and AppSKey for data frame encryption;The device address of each LoRaWAN terminal node unicast identity is each
It is not identical;The device address of each LoRaWAN terminal node broadcast identity is all the same;
The LoRaWAN terminal node includes: with LoRaWAN server exchange method
Each LoRaWAN terminal node reports multicast identity to LoRaWAN server and monitors matching for LoRaWAN server
Set request;The LoRaWAN server carries out the update of multicast identity state and Multicast configuration command set.
The LoRaWAN server LoRaWAN terminal node sends broadcast message to configure the group of LoRaWAN terminal node
Broadcast identity.
Preferably, the LoRaWAN server sends broadcast message to LoRaWAN terminal node to configure LoRaWAN end
The multicast identity of end node, specifically includes:
LoRaWAN server sends to LoRaWAN terminal node and broadcasts the message;It fills the device address of the broadcast message
For the device address for broadcasting identity;The MAC layer load FRMPayload of the broadcast message includes needing to carry out multicast
The continuous data that the unicast identity device address of LoRaWAN terminal node and the device address of multicast identity to be placed are constituted
Group;
LoRaWAN terminal node receives the broadcast message, judges whether the device address of the broadcast message is broadcast
The device address of identity, if so, judge in FRMPayload field whether include itself unicast identity device address;If
Including obtaining the device address of corresponding multicast identity.
Preferably, the system also includes one or more LoRaWAN gateways;The LoRaWAN gateway setting exists
Between the LoRaWAN terminal node and LoRaWAN server, and with the LoRaWAN terminal node and LoRaWAN server
It is respectively connected with to realize that message forwards.
Preferably, if the LoRaWAN gateway includes multiple, the default delay of LoRaWAN server use
Mode carries out intermittent send to avoid frequency point collision.
The invention has the following beneficial effects:
(1) a kind of method and system that multicasting is realized based on LoRaWAN of the present invention, LoRaWAN terminal node are passed through
It presets identical broadcast identity and carries out broadcast configuration to LoRaWAN server, realize LoRaWAN server simultaneously to multiple ends
It is synchronous with setting that end node carries out data downstream;
(2) present invention it is a kind of based on LoRaWAN realize multicasting method and system, LoRaWAN server pass through to
LoRaWAN terminal node sends broadcast message with the multicast identity of rapid configuration LoRaWAN terminal node, to realize to terminal
Node carries out Dynamic Packet, and sends multicast message to one group of LoRaWAN terminal node by multicast identity, realizes to each group end
The difference of end node controls;Compared with unicast configuration mode, a collection of terminal node can be dynamically distributed with broadcast type and be subtracted
The probability of packet loss caused by few frequency point collides and the efficiency for promoting configuration;
(3) a kind of method and system that multicasting is realized based on LoRaWAN of the present invention, same LoRaWAN terminal node
Multiple multicast identity can be configured by broadcast message, to form multiple groups from other different LoRaWAN terminal nodes, often
A group of realization individually controls;
(4) a kind of method and system that multicasting is realized based on LoRaWAN of the present invention, LoRaWAN terminal node side benefit
The AES128 encryption carried with MAC, multiple identities share encryption, and can saving resource consumption, problem of data safety is protected simultaneously
Barrier;LoRaWAN terminal node, which is surveyed, uses identical AES128 cryptographic means, and each multicast identity possesses independent safety guarantee,
After receiving the response parameter by LoRaWAN server design in configuration identity message simultaneously, can voluntarily it be prolonged according to parameter
Response server is responded with late and in the alternately identity of channel, improves the success rate and efficiency of entire configuration closed loop.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on
Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other
Embodiment shall fall within the protection scope of the present invention.
It is shown in Figure 1, on the one hand, a kind of method that multicasting is realized based on LoRaWAN of the present invention, comprising:
S101, each LoRaWAN terminal node preset multiple identity;The multiple identity includes unicast identity, one
A broadcast identity and at least one reserved multicast identity;Wherein, each identity includes device address DevAddr, for data
The NwkSKey of frame check and AppSKey for data frame encryption;The equipment of each LoRaWAN terminal node unicast identity
Location is different;The device address of each LoRaWAN terminal node broadcast identity is all the same;
S102, each LoRaWAN terminal node report multicast identity to LoRaWAN server and monitor LoRaWAN service
The configuring request of device;The LoRaWAN server carries out the update of multicast identity state and Multicast configuration command set;
S103, the LoRaWAN server send broadcast message to LoRaWAN terminal node to configure LoRaWAN terminal
The multicast identity of node.
Specifically, shown in Figure 2, LoRaWAN terminal node reports multicast identity to LoRaWAN server and monitors clothes
The configuring request of business device, comprising:
LoRaWAN terminal node opens broadcast and the monitoring of multicast message.
LoRaWAN terminal node sends itself multicast identity information to LoRaWAN server with unicast identity;The group
It broadcasts device address DevAddr that identity information includes multicast identity, add for the NwkSKey of data frame check and for data frame
Close AppSKey.
It should be noted that if the device address of LoRaWAN terminal node multicast identity not yet passes LoRaWAN service
Device configuration, the then device address that the LoRaWAN terminal node is sent to LoRaWAN server are the address of initialization;Otherwise, should
Address is the preceding device address once configured.
Specifically, LoRaWAN server carries out the update of multicast identity state and Multicast configuration command set, comprising:
Itself multicast identity information that server receiving node unicast identity reports is good by user configuration with server end
Broadcast group state compare, if inconsistent, server will need the Multicast configuration order that updates to be added into need to broadcast
In the command set issued, if unanimously, it is synchronous with server holding to be considered as terminal node, without further setting.
For example, being stored with the broadcast group A that multicast address is 00000001 in LoRaWAN server, include in broadcast group A
Have LoRaWAN terminal node 1, if LoRaWAN terminal node 1 be reported to LoRaWAN server multicast identity be include wide
The multicast address 00000001 for broadcasting group A then illustrates that the configuration of actual current device 1 and server are consistent, that is, locates
In synchronous regime, otherwise illustrate inconsistent.
Specifically, before the update that LoRaWAN server carries out multicast identity state and Multicast configuration command set, also
Include:
Creation and management broadcast group, the identity of setting broadcast group and corresponding key;
LoRaWAN terminal node is added in broadcast group, will need to be added the unicast identity of the node of the broadcast group and is somebody's turn to do
Broadcast group identity carries out relationship map storage;
Specifically, dynamic is deleted and addition terminal node can equally trigger expectation and broadcast body when creation and management broadcast group
The variation of state part synchronizes, the Multicast configuration command set that server will also update storage in order to which further progress configures;
The flow chart of the creation of LoRaWAN server and management broadcast group is referring to Fig. 3
It is shown in Figure 4, broadcast group is created in LoRaWAN server and has updated configuration order collection to be issued
Afterwards, can operation according to particular user or preset opportunity, broadcast configuration message, tool can be sent to LoRaWAN terminal node
Body includes:
LoRaWAN terminal node, which is opened, receives window waiting reception data;
Server broadcasts issuing message according to command set assembly, and sends configuration life to the preset broadcast identity of terminal node
Enable message;
LoRaWAN terminal node receives downlink data and carries out data parsing;Judge data packet device address whether be
The device address of unicast identity;If so, perhaps carrying out other processing in response command;If it is not, judging setting for data packet
Standby address whether be multicast identity device address;If so, perhaps carrying out other processing in response command.
According to above-mentioned process, further, the LoRaWAN server sends to LoRaWAN terminal node and broadcasts the message
To configure the multicast identity of LoRaWAN terminal node, specifically include:
LoRaWAN server sends to LoRaWAN terminal node and broadcasts the message;It fills the device address of the broadcast message
For the device address for broadcasting identity;The MAC layer load FRMPayload of the broadcast message includes multiple needing to carry out multicast
Device address, identity key and the response of the unicast identity device address, multicast identity to be placed of LoRaWAN terminal node
Parameter;
LoRaWAN terminal node receives the broadcast message, judges whether the device address of the broadcast message is broadcast
The device address of identity, if so, judge in FRMPayload field whether include itself unicast identity device address;If
Including obtaining the device address of corresponding multicast identity from FRMPayload field.
Specifically, the unicast identity of multiple LoRaWAN terminal nodes for needing to carry out multicast is set in above-mentioned process
Standby address, the device address of multicast identity to be placed, identity key and response parameter, that is, assembled according to command set
Broadcast issuing message will use specific agreement to communicate as the sub-protocol of FRMPayload, include: as shown in Figure 5
The operation mark ctl of command set identifies whether this broadcast configuration message is " newly-increased " or " deletion " identity;
The multicast identity key collection keys_dict for including in command set, the identity for the configuration of agreement subsequent terminal node
Key is chosen, and may include multiple multicast identity keys, and sequentially serial number is identified as selection;
The multicast ID address collection addrs_dict for including in command set, the identity for the configuration of agreement subsequent terminal node
Address is chosen, and may include multiple multicast ID address, and sequentially serial number is identified as selection;
The terminal node needed to configure and its multicast setting information collection cmd_payload for including in command set, for filling
Specific terminal node and its configuration of corresponding multicast identity are carried, includes close to multicast identity in command set in each configuration information
The selection of key and address, to indicate the actual disposition of each terminal node.
What is filled after the configuration information of each terminal node in cmd_payload is response parameter, is by server
Preset parameter is carried out, will be used to determine that equipment to carry out the opportunity that a new multicast identity reports after application Multicast configuration,
Wherein comprising that can determine therefrom that delay time and the factor ack_ for reporting the communication frequency used that terminal node reports
option。
After configuring LoRaWAN terminal node multicast identity by broadcast message, LoRaWAN server can pass through group
The LoRaWAN terminal node that identity is broadcast to same group sends multicast message.The transmission flow of multicast message is same to broadcast the message, but only
There is the LoRaWAN terminal node ability response command content with corresponding multicast identity to carry out corresponding processing.
It should be noted that being used for during LoRaWAN server and LoRaWAN terminal node carry out interacting message
The NwkSKey of data frame check and AppSKey for data frame encryption are encrypted or are decrypted using AES128.It is specific real
Shi Shi, in order to guarantee data security and in order to be parsed to message, each LoRaWAN terminal node unicast identity
NwkSKey and AppSKey is arranged to different;The NwkSKey and AppSKey of each LoRaWAN terminal node broadcast identity are set
It is set to the same;As the NwkSKey of each LoRaWAN terminal node multicast identity in same multicast is arranged to AppSKey,
The NwkSKey and AppSKey of its multicast identity of the LoRaWAN terminal node of difference group are arranged to different.
It will be illustrated as follows with a specific example.
The number of LoRaWAN terminal node publicly-owned 100, this 100 terminal nodes is needed to be grouped broadcast, wherein
30 terminal nodes are needed through multicast identity (group 1) downstream data message<11 11 11>, and 50 terminal node needs pass through
Multicast identity (group 2) downlink data<22 22 22>, 20 terminal nodes are needed through multicast identity (group 3) downstream data message
<33 33 33>。
Implementation process is as follows:
1, hardware is pre-configured with:
1.1LoRaWAN terminal node burning LoRaWAN CLASS C code has been provided with 3 identity in code, it is assumed that
The device address of the unicast identity of this 100 terminal nodes is respectively 10000000~10000099, with broadcasting the equipment of identity
Location is all FFFFFFFF, and it is that 00000000 reservation is to be used that the device address of multicast identity, which powers on whole default initializations,.
1.2 LoRaWAN terminal nodes are tied to LoRaWAN server, guarantee LoRaWAN terminal node can normally with
LoRaWAN server carries out conventional communications.
2, broadcast group 1,2,3 is added respectively in LoRaWAN server, and according to above-mentioned requirement respectively by corresponding section
Broadcast group is added in point.
3, LoRaWAN server issues addition multicast identity process by broadcast message.
Framing is realized by LoRaWAN server interface, 100 terminal nodes is grouped, in downlink frame
Devaddr replaces with the device address (FFFFFFFF) of broadcast identity, and ordered multicast is shown in Figure 6.
The frame format of each node of packet frames setting is referring to referring to the protocol frame in Fig. 5.
Herein since for initialisation packet, for terminal node, configuration order is " addition ", so in protocol frame, ctl
Field is 1, indicates addition identity operation.
Secondly, multicast identity key collection and multicast ID address are assumed to correspond, in protocol frame keys_dict and
Addrs_dict part such as the following table 1.
Table 1
Then in this example preceding two group node specific instructions information such as the following table 2, the cmd_payload tool in presentation protocol frame
Hold in vivo.
Table 2
From table 2 it can be seen that in the present embodiment, the device address DEVADDR of unicast identity is 10000000~
Terminal node between 10000030 is set as group 1, and the device address DEVADDR of unicast identity is 10000031~10000080
Terminal node be set as group 2, similar, the end that the device address DEVADDR of unicast identity is 10000081~10000100
End node is set as group 3.
It is directly issued toward gateway after the good frame of LoRaWAN server group, gateway receives corresponding message
It will be data frame be broadcast in the air after frame.
At this point, removing the sequence of operations such as the parsing of standard LORAWAN after LoRaWAN terminal node receives data frame
Later, DevAddr can be judged first, since terminal node all has this broadcast identity of FFFFFFFF, so s can be
Remaining data frame all receives, and then operates to the data frame in FRMPayload.Following terminal node can be first
First judge whether identity 1 matches with the device address of itself unicast identity, just the occurrence in grouping 1 is assigned to if matching
Multicast identity so then completes first part's configuration multicast identity.
In the case where for multiple gateway equipment, LoRaWAN server can the frame to downlink carry out delay be sent to gateway.
4, LoRaWAN server, which refers to, sends multicast message process.
Due to being configured the value of multicast identity in above-mentioned steps, framing is replaced in following LoRaWAN server
DevAddr is the value of multicast identity terminal device, and fills and need to be then sent to gateway to corresponding grouping particular content and set
Standby, gateway is re-send in the air, and framing format is as shown in Figure 7.
Equally first judge whether DevAddr is consistent with itself after terminal node receives corresponding frame, then next
Start to receive the particular content in corresponding FRMPayload, and to making corresponding response or other operations.
On the other hand, shown in Figure 8, a kind of system that multicasting is realized based on LoRaWAN of the present invention, comprising: if
Dry LoRaWAN terminal node 801 and LoRaWAN server 802;
Wherein, each LoRaWAN terminal node is preset with multiple identity;The multiple identity include a unicast identity,
One broadcast identity and at least one reserved multicast identity;Each identity includes device address DevAddr, for data frame school
The NwkSKey tested the and AppSKey for data frame encryption;The device address of each LoRaWAN terminal node unicast identity is each
It is not identical;The device address of each LoRaWAN terminal node broadcast identity is all the same;
The LoRaWAN terminal node includes: with LoRaWAN server exchange method
Each LoRaWAN terminal node reports multicast identity to LoRaWAN server and monitors matching for LoRaWAN server
Set request;The LoRaWAN server carries out the update of multicast identity state and Multicast configuration command set.
The LoRaWAN server sends broadcast message to LoRaWAN terminal node to configure LoRaWAN terminal node
Multicast identity.
The LoRaWAN server sends broadcast message to LoRaWAN terminal node to configure LoRaWAN terminal node
Multicast identity, specifically includes:
LoRaWAN server sends to LoRaWAN terminal node and broadcasts the message;It fills the device address of the broadcast message
For the device address for broadcasting identity;The MAC layer load FRMPayload of the broadcast message includes needing to carry out multicast
The device address of the unicast identity device address of LoRaWAN terminal node and multicast identity to be placed;
LoRaWAN terminal node receives the broadcast message, judges whether the device address of the broadcast message is broadcast
The device address of identity, if so, judge in FRMPayload field whether include itself unicast identity device address;If
Including obtaining the device address of corresponding multicast identity.
Further, the system also includes one or more LoRaWAN gateways 803;The LoRaWAN gateway is set
It sets between the LoRaWAN terminal node and LoRaWAN server, and is taken with the LoRaWAN terminal node and LoRaWAN
Business device is respectively connected with to realize that message forwards.If the LoRaWAN gateway includes multiple, the LoRaWAN service
Device can carry out intermittent send according to related method thereof appropriate (as passed through setting delay parameter) and be prolonged to avoid frequency point collision
It is tardy to send to avoid frequency point collision.
A kind of tool for realizing LoRaWAN terminal node and LoRaWAN server in the system of multicasting based on LoRaWAN
Body is realized and interaction flow is realized in the method for multicasting unanimously with a kind of based on LoRaWAN, is not repeated to illustrate herein.
Specific embodiment is applied in the present invention, and principle and implementation of the present invention are described, above embodiments
Explanation be merely used to help understand method and its core concept of the invention;At the same time, for those skilled in the art,
According to the thought of the present invention, there will be changes in the specific implementation manner and application range, in conclusion in this specification
Appearance should not be construed as limiting the invention.