Specific embodiment
Below in conjunction with the attached drawing in the embodiment of the present application, technical solutions in the embodiments of the present application carries out clear, completeSite preparation description, it is clear that described embodiments are only a part of embodiments of the present application, instead of all the embodiments.It is based onEmbodiment in the application, it is obtained by those of ordinary skill in the art without making creative efforts every otherEmbodiment shall fall in the protection scope of this application.
The network architecture of LoRaWAN is as shown in Figure 1, include terminal device 100, gateway 110-130 and server 140.ThisIn, it is only illustrated so that LoRaWAN includes 1 terminal device, 3 gateways and 1 server as an example, does not do other restrictions.
Terminal device 100 is before being added server 140, with the DevEUI (End-device of terminal device 100Identifier, Terminal Equipment Identifier) mark as terminal device 100 in LoRaWAN.I.e. terminal device 100 is being addedBefore server 140, DevEUI is carried in uplink message.
Terminal device 100 is after being added server 140, the DevAddr that is distributed using server as terminal device 100The mark of (End-device address, terminal device address) as terminal device 100 in LoRaWAN.That is terminal device100 after server 140 is added, carry DevAddr in uplink message.
Currently, terminal device 100 includes the following steps to the process that server 140 sends uplink message.
Step 11,100 broadcast upstream message 11 of terminal device.
Step 12, gateway 110-130 is respectively received uplink message 11, and uplink message 11 is sent to server 140.
At this point, server 140 will receive 3 uplink messages 11.The message of redundancy is more.
Based on this, when the number of terminal device in LoRaWAN reaches certain amount, the message of the received redundancy of serverQuantity will be quite huge, this will necessarily cause to bear to server.
In order to reduce the received redundancy of server in LoRaWAN message quantity, mitigate the negative of server in LoRaWANLoad, the embodiment of the present application provide a kind of message forwarding method.In the message forwarding method, the uplink message of end-point device broadcastIn include intended gateway mark, if the mark of gateway match with the mark of intended gateway, gateway to server forwarding uplinkMessage.If the mark of gateway and the mark of intended gateway mismatch, gateway abandons uplink message, is never sent to server.This is effectively reduced the quantity of the message of the received redundancy of server in LoRaWAN, alleviates the negative of server in LoRaWANLoad.
Below by specific embodiment, the application is illustrated.
With reference to Fig. 2, Fig. 2 is the first flow diagram of message forwarding method provided by the embodiments of the present application.The messageRetransmission method is applied to the gateway in LoRaWAN, includes the following steps.
Step 201:The uplink message of receiving terminal apparatus broadcast.Wherein, uplink message includes the mark of intended gateway.
In the embodiment of the present application, when terminal device needs to send message to server, end-point device broadcast carries targetThe uplink message of the mark of gateway.The mark for the intended gateway that uplink message includes, to be preassigned as on terminal deviceThe mark of the gateway of row of channels.
In the embodiment of the present application, when gateway receives the downlink message that server is sent to terminal device, can also it broadcast downRow message, at this point, terminal device and other gateways can receive the downlink message of gateway broadcasts.
The message transmitted between message, gateway and the gateway transmitted between terminal device and gateway is LoRa message.OneIn a implementation, for convenient for gateway determine the LoRa message that receives be end-point device broadcast uplink message or otherThe downlink message of gateway broadcasts, can add the type of message in the type field in LoRa message, and the type identification of message is seenWith reference to as shown in table 1.Here, type field can be the MType field in LoRa message.
Table 1
After gateway receives LoRa message, such as above-mentioned table 1, if detect content in type field be 000,010 or100, it is determined that received LoRa message is the uplink message of end-point device broadcast.If detecting, the content in type field is001,011 or 101, then gateway determines that received LoRa message is the downlink message of other gateway broadcasts.
In a kind of implementation, the mark of intended gateway can be preassigned for user, or server according toThe mark for the gateway that certain rule is selected from multiple gateways that terminal device connects.In one example, terminal is setIt is standby when server is added, the gateway that server is selected from multiple gateways that terminal device connects, as target networkIt closes, the mark of intended gateway is sent to terminal device.
In a kind of implementation, uplink message includes the device address of terminal device, and device address includes intended gatewayMark.In one example, when server is added, server is terminal device and connects from terminal device multiple terminal deviceThe gateway selected in gateway, as intended gateway.Server is distributed using the mark of intended gateway as terminal deviceDevAddr a part, and then DevAddr is sent to terminal device.
It can include the device address of terminal device from uplink message when the uplink message of gateway receiving terminal apparatus broadcastIn get the mark of intended gateway.
In the embodiment of the present application, the format of DevAddr be can refer to shown in table 2.
Table 2
Wherein, 31:25 this highest 7 be NwkID (Network Identifier, network identity), NwkID be used for areaDivide the heterogeneous networks operator for thering is region to be overlapped, and the network for making up routing issue.24:0 this 25 be NwkAddr(Network Address, network address).NwkID and NwkAddr constitute DevAddr.
The format of NwkAddr can refer to as shown in table 3.
Table 3
| 24:13 | 12:0 |
| Gataway ID | Device ID |
Wherein, 24:13 this 12 be Gataway ID (mark of gateway), Gataway ID be gateway be added serverLater, server is the mark of gateway distribution.12:0 this 13 be Device ID (mark of equipment), Device ID be terminalFor equipment after server is added, server is the mark of terminal device distribution.Gataway ID and Device ID are constitutedNwkAddr。
In a kind of implementation, in order to improve the forward efficiency of message, the message of each gateway of acquisition of server timingStatistical information.Wherein, the counting messages information of gateway includes but is not limited to that receive the total quantity of message, gateway currently processed for gatewayMessage total quantity etc..Server determines the loading condition of each gateway according to the counting messages information of each gateway, from eachA gateway is selected in a gateway, as intended gateway.For example, server selects the smallest gateway of counting messages information as meshMark gateway;Or select a gateway as intended gateway in multiple gateways of the server from counting messages information lower than threshold value.
Server is sent to terminal device after determining intended gateway, by the mark of intended gateway.
In one example, each gateway timing sends counting messages information to server, so that server timing obtainsTake the counting messages information of each gateway.In another example, server timing sends acquisition request to each gateway.Each netIt closes according to acquisition request, sends counting messages information to server, so that the message system of each gateway of acquisition of server timingCount information.
Step 202:The intended gateway that detection uplink message includes identifies whether to match with the mark of gateway.
If mismatching, 203 are thened follow the steps.If matching, thens follow the steps 204.
Step 203:Abandon uplink message.
If gateway detects that the mark of the intended gateway in uplink message is not identical as the mark of itself, it is determined that uplink reportThe mismatch of the mark of intended gateway in text and itself, determining gateway not is the data feedback channel of terminal device, to reduce serviceThe quantity of the message of the received redundancy of device abandons uplink message.
Step 204:Uplink message is sent to server.
If gateway detects that the mark of the intended gateway in uplink message is identical as the mark of itself, it is determined that uplink messageIn intended gateway mark and matching itself, determine that gateway is the data feedback channel of terminal device, uplink message be sent toServer.
In the embodiment of the present application, the message that transmits between terminal device and gateway is LoRa message, gateway and server itBetween the message that transmits be IP packet.Gateway, will after the mark and the matching of itself for determining the intended gateway in uplink messageUplink message is encapsulated as IP packet and is sent to server.
In a kind of implementation, if gateway receives the first downlink message of other gateways transmission, the first downlink report is abandonedText is sent to server for the first downlink message as uplink message to avoid gateway, and the problem of cause loop.
In one example, after gateway receives LoRa message, in such as above-mentioned table 1, if the content in detection type field is001,011 or 101, then the received LoRa message of gateway is the first downlink message of other gateway broadcasts, by the first downlink message.
In a kind of implementation, if gateway receives the second downlink message of server transmission, the second downlink is directly broadcastedSecond downlink message is sent to terminal device by message.
Specifically, gateway receives IP packet, it is determined that the IP packet is the second downlink message that server is sent, by IPMessage is encapsulated as LoRa message, and LoRa message is sent to terminal device.
Below with reference to LoRaWAN shown in FIG. 1, message forwarding method provided by the embodiments of the present application is illustrated.EventuallyThe network identity of end equipment 100 is NwkID1.
Step 21, after server 140 is added in gateway 110-130, server 140 is that the distribution of gateway 110 Gataway ID isG_ID1, be gateway 120 distribute Gataway ID be G_ID2, be gateway 130 distribution Gataway ID be G_ID3.
Later, gateway 110-130 distinguish timing to server 140 send counting messages information.
Step 22, after server 140 is added in terminal device 100, server 140 is that terminal device 100 distributes Device IDFor D_ID1.
In addition, the counting messages information that server 140 is sent according to gateway 110-130, selects one from gateway 110-130A gateway, such as selected gateway 110.In conjunction with the NwkID1 of terminal device 100, the G_ID1 and terminal device of gateway 110100 D_ID1 determines that the DevAddr of terminal device 100 is NwkID1:G_ID1:D_ID1.
Step 23, the DevAddr that server 140 will distribute for terminal device 100, i.e. NwkID1:G_ID1:D_ID1 is sentTo terminal device 100.
Step 24, when terminal device 100 needs to send message to server 140, the broadcast of terminal device 100 is carriedNwkID1:G_ID1:The LoRa message 1 of D_ID1.
Step 25, after gateway 110 receives LoRa message 1, such as table 1, detect that the MType field of LoRa message 1 is000,010 or 100, and detect the NwkID1 that LoRa message 1 carries:G_ID1:G_ID1 and gateway 110 in D_ID1Gataway ID is identical, it is determined that LoRa message 1 is the uplink message of end-point device broadcast, and determines that gateway 110 sets for terminalThe gateway of standby 100 data feedback channels.
LoRa message 1 is encapsulated as IP packet 1 by gateway 110, and IP packet 1 is sent to server 140.
Step 26, after gateway 120 receives LoRa message 1, such as table 1, detect that the MType field of LoRa message 1 is000,010 or 100, and detect the NwkID1 that LoRa message 1 carries:G_ID1:G_ID1 and gateway 120 in D_ID1Gataway ID is different, it is determined that LoRa message 1 is the uplink message of end-point device broadcast, and determines that gateway 120 is not terminalThe gateway of 100 data feedback channel of equipment.Gateway 120 abandons LoRa message 1.
Similarly, gateway 130 determines that LoRa message 1 is the uplink message of end-point device broadcast, and determines that gateway 130 is not eventuallyThe gateway of 100 data feedback channel of end equipment.Gateway 130 abandons LoRa message 1.
This is effectively reduced the quantity of the message of the received redundancy of server in LoRaWAN, mitigates and services in LoRaWANThe burden of device.
Step 27, after server 140 receives LoRa message 1, IP packet 1 is sent to gateway 110.
Step 28, after gateway 110 receives IP packet 1, IP packet 1 is encapsulated as LoRa message 2, LoRa message will be broadcasted2, LoRa message 2 is sent to terminal device 100.
Step 29, after gateway 120 receives LoRa message 2, such as table 1, detect that the MType field of LoRa message 2 is001,011 or 101, it is determined that LoRa message 2 is the downlink message of other gateway broadcasts.Gateway 120 abandons LoRa message 2.
Similarly, gateway 130 determines that LoRa message 2 is the downlink message of other gateway broadcasts.Gateway 130 abandons LoRa message2。
This is effectively avoided gateway from being sent to server for the downlink message of other gateway broadcasts as uplink message, and is madeThe problem of at loop.
Based on identical inventive concept, according to the above-mentioned message forwarding method embodiment applied to the gateway in LoRaWAN,The embodiment of the present application also provides a kind of message forwarding methods applied to the server in LoRaWAN.It is this with reference to Fig. 3, Fig. 3Apply for second of flow diagram of the message forwarding method that embodiment provides.The message forwarding method is applied in LoRaWANServer, include the following steps.
Step 301, the addition request message of receiving terminal apparatus broadcast.
When terminal device needs that server is added, request message is added in broadcast.The gateway of connection terminal device receivesAfter request message is added, request message will be added and be sent to server.
Here, request message being added can be Join Request message.
Step 302, a gateway is selected from multiple gateways that terminal device connects, as intended gateway.
In a kind of implementation, in order to improve the forward efficiency of message, the message of each gateway of acquisition of server timingStatistical information.
Server determines the loading condition of each gateway according to the counting messages information of each gateway, from each gatewayA gateway is selected, as intended gateway.For example, server selects the smallest gateway of counting messages information as intended gateway;Or select a gateway as intended gateway in multiple gateways of the server from counting messages information lower than threshold value.
In one example, each gateway timing sends counting messages information to server, so that server timing obtainsTake the counting messages information of each gateway.In another example, server timing sends acquisition request to each gateway.Each netIt closes according to acquisition request, sends counting messages information to server, so that the message system of each gateway of acquisition of server timingCount information.
Step 303, the mark of intended gateway is carried and is sent in for the addition response message that request message is addedTerminal device.
Here, response message being added can be Join Accept message.
End-point device broadcast carries the uplink message of the mark of intended gateway.Each gateway is detecting that uplink message includesIntended gateway mark in the unmatched situation of mark of the gateway, abandon uplink message, detecting uplink message packetUplink message is sent to server in the matched situation of mark of the gateway by the mark of the intended gateway included.
It include the mark of intended gateway using the embodiment of the present application, in the uplink message of end-point device broadcast, if gatewayMark is matched with the mark of intended gateway, then gateway forwards uplink message to server.If the mark of gateway and intended gatewayMark mismatches, then gateway abandons uplink message, is never sent to server.This is effectively reduced server in LoRaWANThe quantity of the message of received redundancy alleviates the burden of server in LoRaWAN.
Based on identical inventive concept, according to the above-mentioned message forwarding method embodiment applied to the gateway in LoRaWAN,The embodiment of the present application also provides a kind of apparatus for forwarding message applied to the gateway in LoRaWAN.It is this Shen with reference to Fig. 4, Fig. 4Please embodiment provide apparatus for forwarding message the first structural schematic diagram, applied to the gateway in LoRaWAN, the device packetIt includes:
Receiving module 401, the uplink message for receiving terminal apparatus broadcast;Uplink message includes the mark of intended gatewayKnow;
Detection module 402 identifies whether to match with the mark of gateway for detecting intended gateway;
Processing module 403, for abandoning uplink message in the case where the testing result of detection module 402 is no;It is examiningThe testing result for surveying module 402 is that in the case where being, uplink message is sent to server.
In a kind of implementation, receiving module 401 can be also used for the first downlink message for receiving other gateway broadcasts;
Processing module 403 can be also used for abandoning the first downlink message.
In a kind of implementation, receiving module 401 can be also used for receiving the second downlink message that server is sent;
Processing module 403 can be also used for the second downlink message of broadcast.
In a kind of implementation, above-mentioned apparatus for forwarding message can also include:
Sending module (is not shown) in Fig. 4, counting messages information is sent to server for timing, so that server rootIntended gateway is determined according to the counting messages information sent on each gateway, and the mark of intended gateway is sent to terminal device.
In a kind of implementation, uplink message includes the device address of terminal device, and device address includes intended gatewayMark.
It include the mark of intended gateway using the embodiment of the present application, in the uplink message of end-point device broadcast, if gatewayMark is matched with the mark of intended gateway, then gateway forwards uplink message to server.If the mark of gateway and intended gatewayMark mismatches, then gateway abandons uplink message, is never sent to server.This is effectively reduced server in LoRaWANThe quantity of the message of received redundancy alleviates the burden of server in LoRaWAN.
Based on identical inventive concept, implemented according to the above-mentioned message forwarding method applied to the server in LoRaWANExample, the embodiment of the present application also provides a kind of apparatus for forwarding message applied to the server in LoRaWAN.With reference to Fig. 5, Fig. 5It should applied to the server in LoRaWAN for second of structural schematic diagram of apparatus for forwarding message provided by the embodiments of the present applicationDevice includes:
Receiving module 501, the addition request message for receiving terminal apparatus broadcast;
Selecting module 502, for selecting a gateway from multiple gateways that terminal device connects, as intended gateway;
Sending module 503, for carrying the mark of intended gateway for the addition response message that request message is addedIn be sent to terminal device so that end-point device broadcast carry intended gateway mark uplink message so that each netIt closes in the case where detecting the mark of intended gateway and the unmatched situation of mark of the gateway that uplink message includes, abandons uplink reportText, in the case where detecting the mark of intended gateway and the matched situation of mark of the gateway that uplink message includes, by uplink messageIt is sent to server.
In a kind of implementation, above-mentioned apparatus for forwarding message can also include:
It obtains module (being not shown in Fig. 5), the counting messages information of each gateway of acquisition for timing;
Selecting module (is not shown) in Fig. 5, is specifically used for:According to the counting messages information of each gateway, from terminal deviceOne counting messages information of selection is lower than the gateway of threshold value in multiple gateways of connection, as intended gateway.
It include the mark of intended gateway using the embodiment of the present application, in the uplink message of end-point device broadcast, if gatewayMark is matched with the mark of intended gateway, then gateway forwards uplink message to server.If the mark of gateway and intended gatewayMark mismatches, then gateway abandons uplink message, is never sent to server.This is effectively reduced server in LoRaWANThe quantity of the message of received redundancy alleviates the burden of server in LoRaWAN.
Based on identical inventive concept, according to the above-mentioned message forwarding method embodiment applied to the gateway in LoRaWAN,The embodiment of the present application also provides a kind of gateways, as shown in fig. 6, including processor 601 and machine readable storage medium 602, machineDevice readable storage medium storing program for executing 602 is stored with the machine-executable instruction that can be executed by processor 601.
In addition, as shown in fig. 6, electronic equipment can also include:Communication interface 603 and communication bus 604;Wherein, it handlesDevice 601, machine readable storage medium 602, communication interface 603 complete mutual communication, communication interface by communication bus 604603 for the communication between above-mentioned gateway and other equipment.
Processor 601 is promoted to realize that the above-mentioned message applied to the gateway in LoRaWAN is forwarded by machine-executable instructionMethod.Specifically, this method includes:
The uplink message of receiving terminal apparatus broadcast;Uplink message includes the mark of intended gateway;
Detection intended gateway identifies whether to match with the mark of gateway;
If mismatching, uplink message is abandoned;
If matching, is sent to server for uplink message.
It include the mark of intended gateway using the embodiment of the present application, in the uplink message of end-point device broadcast, if gatewayMark is matched with the mark of intended gateway, then gateway forwards uplink message to server.If the mark of gateway and intended gatewayMark mismatches, then gateway abandons uplink message, is never sent to server.This is effectively reduced server in LoRaWANThe quantity of the message of received redundancy alleviates the burden of server in LoRaWAN.
Based on identical inventive concept, implemented according to the above-mentioned message forwarding method applied to the server in LoRaWANExample, the embodiment of the present application also provides a kind of servers, as shown in fig. 7, comprises processor 701 and machine readable storage medium702, machine readable storage medium 702 is stored with the machine-executable instruction that can be executed by processor 701.
In addition, as shown in fig. 7, electronic equipment can also include:Communication interface 703 and communication bus 704;Wherein, it handlesDevice 701, machine readable storage medium 702, communication interface 703 complete mutual communication, communication interface by communication bus 704703 for the communication between above-mentioned server and other equipment.
Processor 701 is promoted to realize that the above-mentioned message applied to the server in LoRaWAN turns by machine-executable instructionForwarding method.Specifically, this method includes:
The addition request message of receiving terminal apparatus broadcast;
A gateway is selected from multiple gateways that terminal device connects, as intended gateway;
The mark of intended gateway is carried and is sent to terminal device in for the addition response message that request message is added,So that end-point device broadcast carries the uplink message of the mark of intended gateway, so that each gateway is detecting uplink messageIncluding intended gateway mark in the unmatched situation of mark of the gateway, abandon uplink message, detecting uplink reportUplink message is sent to server in the matched situation of mark of the gateway by the mark for the intended gateway that text includes.
It include the mark of intended gateway using the embodiment of the present application, in the uplink message of end-point device broadcast, if gatewayMark is matched with the mark of intended gateway, then gateway forwards uplink message to server.If the mark of gateway and intended gatewayMark mismatches, then gateway abandons uplink message, is never sent to server.This is effectively reduced server in LoRaWANThe quantity of the message of received redundancy alleviates the burden of server in LoRaWAN.
Above-mentioned communication bus can be PCI (Peripheral Component Interconnect, Peripheral Component InterconnectStandard) bus or EISA (Extended Industry Standard Architecture, expanding the industrial standard structure) busDeng.The communication bus can be divided into address bus, data/address bus, control bus etc..
Above-mentioned machine readable storage medium may include RAM (Random Access Memory, random access memory),It also may include NVM (Non-Volatile Memory, nonvolatile memory), for example, at least a magnetic disk storage.SeparatelyOutside, machine readable storage medium can also be that at least one is located remotely from the storage device of aforementioned processor.
Above-mentioned processor can be general processor, including CPU (Central Processing Unit, central processingDevice), NP (Network Processor, network processing unit) etc.;Can also be DSP (Digital Signal Processing,Digital signal processor), ASIC (Application Specific Integrated Circuit, specific integrated circuit),It is FPGA (Field-Programmable Gate Array, field programmable gate array) or other programmable logic device, discreteDoor or transistor logic, discrete hardware components.
Based on identical inventive concept, according to the above-mentioned message forwarding method embodiment applied to the gateway in LoRaWAN,The embodiment of the present application also provides a kind of machine readable storage mediums, are stored with machine-executable instruction, call by processorWhen with executing, machine-executable instruction promotes the processor to realize any message forwarding method step shown in Fig. 2.
Based on identical inventive concept, implemented according to the above-mentioned message forwarding method applied to the server in LoRaWANExample, the embodiment of the present application also provides a kind of machine readable storage mediums, machine-executable instruction are stored with, by processor tuneWhen with executing, machine-executable instruction promotes the processor to realize any message forwarding method step shown in Fig. 3.
It should be noted that, in this document, relational terms such as first and second and the like are used merely to a realityBody or operation are distinguished with another entity or operation, are deposited without necessarily requiring or implying between these entities or operationIn any actual relationship or order or sequence.Moreover, the terms "include", "comprise" or its any other variant are intended toNon-exclusive inclusion, so that the process, method, article or equipment including a series of elements is not only wanted including thoseElement, but also including other elements that are not explicitly listed, or further include for this process, method, article or equipmentIntrinsic element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded thatThere is also other identical elements in process, method, article or equipment including the element.
Each embodiment in this specification is all made of relevant mode and describes, same and similar portion between each embodimentDividing may refer to each other, and each embodiment focuses on the differences from other embodiments.Turn especially for messageFor transmitting apparatus, gateway, server and machine readable storage medium embodiment, since it is substantially similar to message forwarding method realityExample is applied, so being described relatively simple, related place illustrates referring to the part of message forwarding method embodiment.
The foregoing is merely the preferred embodiments of the application, are not intended to limit the protection scope of the application.It is allAny modification, equivalent replacement, improvement and so within spirit herein and principle are all contained in the protection scope of the applicationIt is interior.