CN115604870A - Communication method, terminal device and storage medium - Google Patents

Communication method, terminal device and storage medium Download PDF

Info

Publication number
CN115604870A
CN115604870A CN202211449017.6A CN202211449017A CN115604870A CN 115604870 A CN115604870 A CN 115604870A CN 202211449017 A CN202211449017 A CN 202211449017A CN 115604870 A CN115604870 A CN 115604870A
Authority
CN
China
Prior art keywords
layer
data
network
data link
lpwan
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202211449017.6A
Other languages
Chinese (zh)
Other versions
CN115604870B (en
Inventor
张健宁
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Kaihong Digital Industry Development Co Ltd
Original Assignee
Shenzhen Kaihong Digital Industry Development Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Kaihong Digital Industry Development Co Ltd filed Critical Shenzhen Kaihong Digital Industry Development Co Ltd
Priority to CN202211449017.6A priority Critical patent/CN115604870B/en
Publication of CN115604870A publication Critical patent/CN115604870A/en
Application granted granted Critical
Publication of CN115604870B publication Critical patent/CN115604870B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W84/00Network topologies
    • H04W84/18Self-organising networks, e.g. ad-hoc networks or sensor networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W80/00Wireless network protocols or protocol adaptations to wireless operation
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

The application discloses a communication method, terminal equipment and a storage medium, wherein the method is applied to an LPWAN ad hoc network framework based on an OpenHarmony system and comprises a physical layer, a kernel space and a user space, wherein the kernel space comprises a data link layer, a network layer and a transmission layer, and the user space comprises an application layer; the physical layer includes a non-cellular network based LPWAN chip, the method comprising: sequentially encapsulating data from an application layer by layer in a transmission layer, a network layer and a data link layer, and transmitting the data after layer-by-layer encapsulation through an LPWAN chip which is not based on a cellular network; and receiving data through the LPWAN chip which is not based on the cellular network, and sequentially decapsulating the received data layer by layer at a data link layer, a network layer and a transmission layer and then sending the decapsulated data to an application layer. Through the mode, the method and the system can provide a perfect frame, and reduce the development difficulty and the development period on the basis of ensuring the degree of freedom and the safety.

Description

Communication method, terminal device, and storage medium
Technical Field
The present application relates to the field of communications technologies, and in particular, to a communication method, a terminal device, and a storage medium.
Background
In order to meet the connection requirements of more and more remote internet of things devices, low Power Wide Area Networks (LPWANs) are in force. LPWANs can be divided into two categories: one is non-cellular based LPWAN, including Long Range Radio (LoRa), sigFox, etc., and the other is cellular based LPWAN, including enhanced Coverage Global System for Mobile Communications (EC-GSM), long Term Evolution User Equipment class (LTE Cat-m), narrow Band Internet of Things (NB-IoT, narrow Band-Internet of Things), etc. The LPWAN market share at this stage is mostly occupied by NB-IoT and LoRa. Compared with NB-IoT, the power consumption of LoRa is lower in performance, and LoRa has an extremely high degree of freedom in degree of freedom.
However, the high degree of freedom of LoRa comes at the cost of: at present, loRa has no perfect frame, so that the development difficulty of LoRa is high, and the development period is long; the service of customizing the LoRa network for enterprises exists in the market, and the degree of freedom and the safety of the LoRa are greatly reduced.
Disclosure of Invention
Based on this, the application provides a communication method, a terminal device and a storage medium, which can provide a perfect framework and reduce the development difficulty and the development cycle on the basis of ensuring the degree of freedom and the safety.
In a first aspect, the present application provides a communication method, where the method is applied to an LPWAN ad-hoc network framework based on an OpenHarmony system, where the LPWAN ad-hoc network framework based on the OpenHarmony system includes a physical layer, a kernel space and a user space, the kernel space includes a data link layer, a network layer and a transport layer, and the user space includes an application layer; the physical layer comprises a non-cellular network based LPWAN chip, and the method comprises:
sequentially encapsulating data from an application layer of the user space layer by layer in a transmission layer, a network layer and a data link layer of the kernel space, and sending the data after layer by layer through a non-cellular network-based LPWAN chip of the physical layer;
and receiving data through the LPWAN chip of the physical layer, which is not based on the cellular network, and sequentially decapsulating the received data layer by layer in the data link layer, the network layer and the transmission layer of the kernel space and then sending the decapsulated data to the application layer of the user space.
In a second aspect, the present application provides a terminal device, where the terminal device is configured with an LPWAN ad-hoc network framework based on an OpenHarmony system, the LPWAN ad-hoc network framework based on the OpenHarmony system includes a physical layer, a kernel space, and a user space, the kernel space includes a data link layer, a network layer, and a transport layer, and the user space includes an application layer; the physical layer comprises a non-cellular network-based LPWAN chip, the terminal equipment comprises a communication module, a processor and a memory, the communication module is used for communicating with the outside, and the memory is used for storing a computer program; the processor is adapted to execute the computer program and, when executing the computer program, to implement the communication method as described above.
In a third aspect, the present application provides a computer-readable storage medium storing a computer program which, when executed by a processor, causes the processor to implement the communication method as described above.
The LPWAN ad hoc network framework based on the OpenHarmony system comprises a physical layer, a kernel space and a user space, wherein the kernel space comprises a data link layer, a network layer and a transmission layer, and the user space comprises an application layer; the physical layer includes a non-cellular network based LPWAN chip, the method comprising: the method comprises the steps that data from an application layer of a user space are sequentially packaged layer by layer in a transmission layer, a network layer and a data link layer of a kernel space, and the data after layer by layer are sent through a non-cellular network-based LPWAN chip of a physical layer; the data is received through a non-cellular network-based LPWAN chip of a physical layer, and the received data is sequentially decapsulated layer by layer in a data link layer, a network layer and a transmission layer of a kernel space and then sent to an application layer of a user space. Because the LPWAN and the OpenHarmony system are combined, the support of the LPWAN is realized by OpenHarmony which is widely applied at present, on one hand, a perfect framework can be provided for the LPWAN, on the basis of ensuring the freedom degree and the safety of the LPWAN which is not based on a cellular network, the development difficulty and the development period are reduced, the framework is convenient for enterprises to use, and secondary development can be carried out on the basis of the framework; on the other hand, the application scenes of OpenHarmony in multiple fields of industry and agriculture can be greatly widened.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
Drawings
FIG. 1 is a schematic flow chart diagram illustrating an embodiment of a communication method of the present application;
fig. 2 is a schematic diagram of an embodiment of an LPWAN ad-hoc network framework based on the OpenHarmony system in the communication method of the present application;
FIG. 3 is a diagram illustrating an embodiment of a frame structure in the communication method of the present application;
FIG. 4 is a schematic flow chart diagram of another embodiment of the communication method of the present application;
FIG. 5 is a schematic flow chart diagram of another embodiment of the communication method of the present application;
FIG. 6 is a schematic diagram illustrating a change from a chained topology to a star topology in an application scenario of the communication method of the present application;
FIG. 7 is a schematic diagram of a star topology changed to a bus topology in another application scenario of the communication method of the present application;
fig. 8 is a schematic diagram illustrating dynamic adjustment of a network after a certain node terminal device leaves the network abnormally in another application scenario of the communication method of the present application;
fig. 9 is a schematic structural diagram of an embodiment of a terminal device according to the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some, but not all, embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The flow diagrams depicted in the figures are merely illustrative and do not necessarily include all of the elements and operations/steps, nor do they necessarily have to be performed in the order depicted. For example, some operations/steps may be decomposed, combined or partially combined, so that the actual execution order may be changed according to the actual situation.
In order to meet the connection requirements of more and more remote internet of things equipment, the LPWAN comes. LPWANs can be divided into two categories: one type is a non-cellular based LPWAN, including LoRa, sigFox, etc., and the other type is a cellular based LPWAN, including EC-GSM, LTE Cat-m, NB-IoT, etc. The LPWAN market share at the present stage is mostly occupied by NB-IoT and LoRa. Compared with NB-IoT, the power consumption of LoRa is lower in performance, and LoRa has an extremely high degree of freedom in degree of freedom. However, the high degree of freedom of LoRa comes at the cost of: at present, loRa has no perfect frame, so that the development difficulty of LoRa is high, and the development period is long; the service of the LoRa network is customized for enterprises existing in the market, and the degree of freedom and the safety of the LoRa network are greatly reduced.
The LPWAN ad hoc network framework based on the OpenHarmony system comprises a physical layer, a kernel space and a user space, wherein the kernel space comprises a data link layer, a network layer and a transmission layer, and the user space comprises an application layer; the physical layer comprises a non-cellular network based LPWAN chip, and the method comprises the following steps: the method comprises the steps that data from an application layer of a user space are sequentially packaged layer by layer in a transmission layer, a network layer and a data link layer of a kernel space, and the data after layer by layer are sent through a non-cellular network-based LPWAN chip of a physical layer; the method comprises the steps that data are received through a non-cellular network-based LPWAN chip of a physical layer, and the received data are sequentially unpackaged layer by layer in a data link layer, a network layer and a transmission layer of a kernel space and then sent to an application layer of a user space. Because the LPWAN is combined with the OpenHarmony system, the OpenHarmony which is widely applied at present realizes the support of the LPWAN, on one hand, a perfect frame can be provided for the LPWAN, on the basis of ensuring the freedom and the safety of the LPWAN which is not based on a cellular network, the development difficulty and the development period are reduced, the frame is not only convenient for enterprises to use, but also can be secondarily developed on the basis of the frame; on the other hand, the application scenes of OpenHarmony in multiple fields of industry and agriculture can be greatly widened.
Some embodiments of the present application will be described in detail below with reference to the accompanying drawings. The embodiments described below and the features of the embodiments can be combined with each other without conflict.
Referring to fig. 1, fig. 1 is a schematic flowchart of an embodiment of a communication method of the present application, where the method is applied to an OpenHarmony system-based LPWAN ad hoc network framework, where the OpenHarmony system-based LPWAN ad hoc network framework includes a physical layer, a kernel space and a user space, the kernel space includes a data link layer, a network layer and a transport layer, and the user space includes an application layer; the physical layer includes LPWAN chips that are not based on a cellular network, as shown in fig. 2.
In the embodiment of the present application, the LPWAN chip that is not based on the cellular network may be a chip that uses LPWAN technology that is not based on the cellular network, the LPWAN technology that is not based on the cellular network generally does not require license and does not depend on an operator, and the LPWAN technology that is not based on the cellular network includes but is not limited to: loRa, sigFox, etc., and currently, the LoRa technique is widely used. The LPWAN chip not based on the cellular network may be an LoRa chip.
LoRa is a low-power consumption local area network wireless standard developed by semtech company, and the name of LoRa is Long Range Radio (Long Range Radio), which is characterized in that the distance of propagation is longer than that of other wireless modes under the same power consumption condition, the unification of low power consumption and Long Range is realized, and the distance of the communication is enlarged by 3-5 times than that of the traditional wireless Radio frequency communication under the same power consumption condition. The LoRa is an autonomous network, the LoRa deployment can be completed without depending on an operator, the layout is fast, the cost is lower, the safety is higher, a network owner can independently control the network quality, the operation data of the network can be completely mastered, and the network can be expanded according to own service requirements.
The physical layer can refer to an official bare computer driver provided by Semtech corporation, the migration from the bare computer driver to a Linux system driver needs to be completed, the adaption work of KHDVK-3566B is completed, and the physical layer is mainly responsible for setting the power of a transmitting antenna, transmitting and receiving data and the like. The data link layer is the core of the protocol, and not only needs to complete the adaptation of the network layer, but also needs to package the final data frame of the data delivered by the network layer; the channel detection before transmission, multi-hop forwarding in transmission and error check after transmission are realized. The network layer is responsible for the establishment and maintenance of the network and the dynamic adjustment of the data transmission path. The transport layer is responsible for providing a connection between a Transmission Control Protocol (TCP) and a User Datagram Protocol (UDP).
The method comprises the following steps: step S101 and step S102.
Step S101: and sequentially encapsulating the data from the application layer of the user space layer by layer in the transmission layer, the network layer and the data link layer of the kernel space, and transmitting the data after layer by layer through the LPWAN chip of the physical layer, which is not based on the cellular network.
In step S101, when there is data to be sent in the application layer of the user space, the data to be sent may be sent to the kernel space, and the data is sequentially encapsulated layer by layer through the transport layer, the network layer, and the data link layer, where the data encapsulated layer by layer is finally a frame (i.e., the data that is finally encapsulated by the data link layer), and the frame is sent out through the LPWAN chip of the physical layer that is not based on the cellular network.
Step S102: and receiving data through the LPWAN chip of the physical layer, which is not based on the cellular network, and sequentially decapsulating the received data layer by layer in the data link layer, the network layer and the transmission layer of the kernel space and then sending the decapsulated data to the application layer of the user space.
In step S102, the LPWAN chip of the physical layer, which is not based on the cellular network, may also receive data, and then send the received data to the kernel space, and perform layer-by-layer decapsulation in the data link layer, the network layer, and the transport layer in sequence, and send the layer-by-layer decapsulated data to the application layer of the user space.
It should be noted that step S101 and step S102 are not sequentially distinguished.
The LPWAN ad hoc network framework based on the OpenHarmony system comprises a physical layer, a kernel space and a user space, wherein the kernel space comprises a data link layer, a network layer and a transmission layer, and the user space comprises an application layer; the physical layer includes a non-cellular network based LPWAN chip, the method comprising: sequentially encapsulating data from an application layer of a user space layer by layer in a transmission layer, a network layer and a data link layer of a kernel space, and transmitting the data after layer-by-layer encapsulation through a non-cellular network-based LPWAN chip of a physical layer; the data is received through a non-cellular network-based LPWAN chip of a physical layer, and the received data is sequentially decapsulated layer by layer in a data link layer, a network layer and a transmission layer of a kernel space and then sent to an application layer of a user space. Because the LPWAN is combined with the OpenHarmony system, the OpenHarmony which is widely applied at present realizes the support of the LPWAN, on one hand, a perfect frame can be provided for the LPWAN, on the basis of ensuring the freedom and the safety of the LPWAN which is not based on a cellular network, the development difficulty and the development period are reduced, the frame is not only convenient for enterprises to use, but also can be secondarily developed on the basis of the frame; on the other hand, the application scenes of OpenHarmony in multiple industrial and agricultural fields can be greatly expanded.
Referring to fig. 3, in some embodiments, a frame finally encapsulated by the data link layer includes a Media Access Control (MAC) address forwarding table, and when the MAC address forwarding table is not filled, a terminal device that needs to receive the frame data forwards the frame data.
In the LoRaWAN protocol of the LoRa technology, a frame structure does not have an MAC address forwarding table, a data link layer decapsulates data from a physical layer and transmits the decapsulated data to a network layer of an upper layer, and encapsulates the data from the network layer of the upper layer into a frame.
Referring to fig. 3, fig. 3 is a schematic diagram of an embodiment of a frame structure in the communication method of the present application, where the frame structure of the embodiment of the present application includes an MAC address forwarding table, and after receiving decapsulation of data in a physical layer, a data link layer checks whether a destination MAC address is an MAC address of a local terminal device, if the destination MAC address is not an MAC address of the local terminal device, it indicates that the data is not sent to the local terminal device, and then checks whether the MAC address forwarding table is filled up, if the MAC address forwarding table is not filled up, it indicates that the data needs to be forwarded by the local terminal device, and after filling up the MAC address of the local terminal device in the MAC address forwarding table, the data link layer returns the frame to the physical layer again, and forwards the frame by the physical layer. By the method, multi-hop forwarding in transmission can be realized, and compared with single hop, multi-hop has better reliability and expansibility.
Referring to fig. 3, in some embodiments, the frame resulting from the final encapsulation by the data link layer includes an opcode, which is used to classify the frame. In the embodiment of the application, the operation codes are mainly used for classifying frames, and different operation codes are given according to different functions, so that different frames are distinguished. For example: connection request frames, connection acknowledgement frames, data frames, and the like.
The structure of the frame may also include length, destination MAC address, source MAC address, IP datagrams, CRC check codes, and the like. The length is used to define the extent of the frame. The CRC check code performs error checking on the frame. The physical layer hardware can carry out CRC check on the data once, so that the accuracy of the data below a network layer can be basically ensured.
In some embodiments, in step S102, the receiving data by the LPWAN chip of the physical layer that is not based on the cellular network, and sequentially performing layer-by-layer decapsulation on the data link layer, the network layer, and the transport layer of the kernel space and then sending the received data to the application layer of the user space may include: substep S1021, substep S1022, and substep S1023, as shown in fig. 4.
Substep S1021: and receiving data through the LPWAN chip of the physical layer, which is not based on the cellular network.
Substep S1022: and judging whether the destination MAC address of the received data is the MAC address of the local terminal equipment or not through the data link layer of the kernel space.
Substep S1023: and if the destination MAC address of the received data is the MAC address of the local terminal equipment, the received data is sequentially decapsulated layer by layer at the data link layer, the network layer and the transmission layer of the kernel space and then sent to the application layer of the user space.
In this embodiment of the application, because the data received by the LPWAN chip of the physical layer, which is not based on the cellular network, may not be sent to the local terminal device, the data link layer is required to determine whether the destination MAC address of the received data is the MAC address of the local terminal device, and if the determination result is that the destination MAC address is sent to the local terminal device, the received data is sequentially sent to the application layer of the user space after being decapsulated layer by layer in the data link layer, the network layer, and the transport layer of the kernel space.
In some embodiments, the method further comprises: step S103, step S104, and step S105 are shown in fig. 5.
Step S103: and if the destination MAC address of the received data is not the MAC address of the local terminal equipment, judging whether an MAC address forwarding table of the received data is filled up or not through the data link layer.
Step S104: and if the MAC address forwarding table of the received data is not filled, filling the MAC address of the local terminal equipment into the MAC address forwarding table of the received data, and forwarding the received data through the LPWAN chip of the physical layer, which is not based on the cellular network.
Step S105: and if the MAC address forwarding table of the received data is filled, discarding the received data.
According to the embodiment of the application, when the data is not sent to the local terminal equipment according to the judgment result, whether the MAC address forwarding table of the received data is filled up is further judged, and the received data needs to be forwarded by the local terminal equipment if the MAC address forwarding table is not filled up, so that the MAC address of the local terminal equipment is filled into the MAC address forwarding table of the received data, and the received data is forwarded through the LPWAN chip of the physical layer, which is not based on the cellular network. If the MAC address forwarding table of the received data is filled, the MAC address of the local terminal device cannot be filled in the MAC address forwarding table of the received data, and thus the received data is discarded. In this way, multi-hop forwarding can be achieved. The MAC address forwarding table is a key for realizing multi-hop forwarding, and when a node receives a frame, whether the MAC address forwarding table is forwarded or not is determined by judging whether the MAC address forwarding table is completely filled or not. The conventional LoRaWan protocol only supports single hop, and multi-hop is better in reliability and expansibility compared with single hop.
The non-cellular network based LPWAN chip is exemplified as the LoRa chip. Because of the low power consumption and long-distance performance of the LoRa itself, there are many developers who choose to directly perform star topology networking-terminals are directly connected to the LoRa gateway. But the topological structure is certainly not satisfactory to the idea of interconnection of everything. On one hand, the coverage area of the network is limited in the transmission distance of the LoRa, and the terminals cannot directly communicate with each other and must transfer through the LoRa gateway, so that the efficiency of data transmission is reduced. On the other hand, the size of the network nodes depends on the number of nodes to which the gateway can be connected, and the size of the network cannot be controlled as desired.
The embodiment of the application can realize multi-hop forwarding, can absorb the networking concept of the wireless mesh network, and does not distinguish clear terminal equipment nodes and routing nodes. The local server is responsible for the establishment and maintenance of the network, and the rest nodes are terminal equipment nodes. The network topology structure of the system is dynamically determined according to the communication situation, and can be a chain topology, a star topology, a tree topology or a mesh topology.
Fig. 6 shows that when the server position changes, the network topology changes from the chain topology to the star topology. Fig. 7 illustrates the dynamic adjustment performed by the network when the communication quality changes: in the figure, the left node, namely the terminal device 1, cannot directly communicate with the server due to a large number of building group obstacles between the node and the server, so that the right node, namely the terminal device 2, is used for forwarding and reestablishing the communication with the server, and the network topology structure is changed from a star topology to a bus topology. Fig. 8 shows that when a terminal device node leaves the network abnormally, the network can complete dynamic adjustment: if the node in the figure, i.e. the terminal device 2, exits the network for some reason, the two nodes, i.e. the terminal device 5 and the terminal device 6, cannot be connected to the server through the terminal device 2. Then, the terminal device 5 restores the connection to the server by using the path of the terminal device 5 → the terminal device 4 → the terminal device 1 → the server, and the terminal device 6 restores the connection to the server by using the path of the terminal device 6 → the terminal device 3 → the server, with the dynamic adjustment according to the communication quality.
In some embodiments, before the step S101, before the sending the layer-by-layer encapsulated data through the LPWAN chip of the physical layer that is not based on the cellular network, the method may further include: and detecting whether a channel is idle or not through a data link layer of the kernel space. At this time, in step S101, the sending the layer-by-layer encapsulated data through the LPWAN chip of the physical layer that is not based on the cellular network may further include: and when the data link layer detects that the channel is idle, transmitting the data after layer-by-layer encapsulation on the idle channel through the LPWAN chip of the physical layer, which is not based on the cellular network.
If data is directly transmitted without channel detection before being transmitted, the probability of collision of data of a plurality of terminal device nodes on a channel is greatly increased as the number of terminal devices is increased or the number of transmitted data is increased. Therefore, the data is subjected to channel detection before being transmitted, which helps to reduce the probability of collision of the data on the channel.
In some embodiments, the method further comprises: and when the data link layer detects that the channel is not idle, a delay back-off mechanism is adopted to carry out delay sending on the data.
In the embodiment of the application, when the channel is not idle, a delay back-off mechanism is adopted to delay and send the data, so that on one hand, the probability of collision of the data on the channel can be reduced, and on the other hand, the sending of the data is also ensured.
In some embodiments, the delaying sending the data by using a delayed backoff mechanism when the data link layer detects that the channel is not idle may include:
A. and when the data link layer detects that the channel is not idle, starting to time the delay time, and returning to the step of detecting whether the channel is idle through the data link layer of the kernel space.
B. If the delay time exceeds the maximum delay time threshold, retrying and returning to the step of detecting whether the channel is idle through the data link layer of the kernel space.
C. And if the retry times exceed the time threshold, determining that the data transmission fails.
In the embodiment of the present application, when the data link layer detects that the channel is not idle, the channel detection is continued, and meanwhile, the time for delayed transmission is timed, if it is detected that the channel is still not idle and the delay time exceeds the maximum delay time threshold, retry is performed, the channel detection is continued, and the number of retries (that is, the time for one retry is the maximum delay time threshold) exceeds the number threshold, it is determined that the data transmission fails.
In some embodiments, the detecting, by the data link layer of the kernel space, whether a channel is idle includes: and detecting whether a channel is idle or not through a data link layer of the kernel space based on a non-slotted Carrier Sense Multiple Access/Collision Avoidance (CSMA/CA) algorithm.
In some embodiments, the detecting, by the data link layer of the kernel space, whether a channel is idle includes: and performing Channel Activity Detection (CAD) on the Channel through the data link layer.
The LoRa communication uses spread spectrum modulation technique, and if a Signal lower than the noise of the receiver uses a channel, it is clearly impossible to use a Received Signal Strength Indicator (RSSI) value to determine whether the channel is idle. It was decided to use the LoRa-own channel activity detection CAD function. The CAD detects the LoRa preamble on the wireless channel with as high power consumption efficiency as possible, and reliability is much higher than the way to directly detect RSSI. If the channel is found to be free after CAD detection, data transmission can be directly carried out. If the channel is occupied, the terminal equipment needs to carry out random delay back-off and then continues to carry out CAD detection until data is successfully transmitted or the longest back-off time is exceeded.
In some embodiments, the method further comprises: writing the data failed to be sent into a buffer area, and periodically retransmitting the data of the buffer area; if the number of retransmissions exceeds a threshold number of times, the data is discarded.
In the embodiment of the application, the data transmission failure is temporarily stored in the buffer area, and the data in the buffer area is continuously and periodically retransmitted, so that the data can be transmitted as far as possible. If the number of times of retransmission exceeds the threshold number of times, the data is discarded, so that the resource is prevented from being wasted infinitely.
In some embodiments, the method further comprises: broadcasting a network access connection request; receiving a new device number distributed to the new network access terminal device and sent by the server after the server determines that the terminal device is the new network access terminal device according to the network access connection request, or receiving information corresponding to the network access terminal device and sent by the server after the server determines that the terminal device is the network access terminal device according to the network access connection request; and performing network access connection according to the new equipment number or the corresponding information.
When the terminal equipment is started to access the network, the network access connection request of the terminal equipment is broadcasted, the server firstly checks whether the terminal equipment is the new network access terminal equipment after receiving the network access connection request, if so, the server allocates resources such as a new equipment number for the terminal equipment, and otherwise, the server directly sends the existing information to the terminal equipment through encapsulation. By the method, the phenomenon that the terminal equipment is disconnected from the network due to some reasons, and the repeated network access is caused without checking during reconnection, so that the maintenance resource is wasted can be prevented.
In some embodiments, the method further comprises: periodically receiving heartbeat detection information sent by a server; and sending response information to the server to respond to the heartbeat detection information.
The network maintenance is that the server performs heartbeat detection once every a period of time, namely periodically sends heartbeat detection information, if the server fails to receive response information of a certain terminal device for a long time, the server judges that the terminal device has quitted the network, and deletes all relevant information of the terminal device. If the terminal device does not receive the heartbeat detection information for a long time, the terminal device is disconnected from the network, and a network access connection request needs to be sent again to apply for network access.
Referring to fig. 9, fig. 9 is a schematic structural diagram of an embodiment of a terminal device according to the present application, where the terminal device is configured with an LPWAN ad-hoc networking framework based on an OpenHarmony system, the LPWAN ad-hoc networking framework based on the OpenHarmony system includes a physical layer, a kernel space, and a user space, the kernel space includes a data link layer, a network layer, and a transport layer, and the user space includes an application layer; the physical layer includes a non-cellular network based LPWAN chip. It should be noted that the terminal device according to the embodiment of the present application can implement the above-mentioned communication method, and for detailed description of related contents, please refer to the above-mentioned method section, which is not described in detail herein.
The terminal device 10 comprises a communication module 101, a processor 102 and a memory 103, wherein the communication module 101 is used for communicating with the outside, and the memory 103 is used for storing a computer program; the processor 102 is adapted to execute the computer program and, when executing the computer program, to implement the communication method as described above. The communication module 101 and the memory 103 are connected to the processor 102 via a bus.
The processor 102 may be a micro-control unit, a central processing unit, a digital signal processor, or the like. The memory 103 may be a Flash chip, a read-only memory, a magnetic disk, an optical disk, a usb-disk, or a removable hard disk, etc.
The present application also provides a computer-readable storage medium storing a computer program which, when executed by a processor, causes the processor to implement the communication method as described above.
The computer-readable storage medium may be an internal storage unit of the terminal device, such as a hard disk or a memory. The computer readable storage medium may also be an external storage device of the terminal device, such as a plug-in hard disk, a smart memory card, a secure digital card, a flash memory card, etc. provided.
It is to be understood that the terminology used in the description of the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application.
It should also be understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
The above description is only for the specific embodiment of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive various equivalent modifications or substitutions within the technical scope of the present application, and these modifications or substitutions should be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (16)

1. A communication method is applied to an LPWAN ad hoc network framework based on an OpenHarmony system, the LPWAN ad hoc network framework based on the OpenHarmony system comprises a physical layer, a kernel space and a user space, the kernel space comprises a data link layer, a network layer and a transmission layer, and the user space comprises an application layer; the physical layer comprises a non-cellular network based LPWAN chip, and the method comprises:
sequentially encapsulating data from the application layer of the user space layer by layer in a transmission layer, a network layer and a data link layer of the kernel space, and transmitting the data after layer by layer through a non-cellular network-based LPWAN chip of the physical layer;
and receiving data through the LPWAN chip of the physical layer, which is not based on the cellular network, and sequentially decapsulating the received data layer by layer in the data link layer, the network layer and the transmission layer of the kernel space and then sending the decapsulated data to the application layer of the user space.
2. The method of claim 1, wherein the receiving data through the LPWAN chip of the physical layer that is not based on the cellular network, and sequentially layer-by-layer decapsulating the received data at the data link layer, the network layer, and the transport layer of the kernel space, and then sending the decapsulated data to the application layer of the user space comprises:
receiving data through a non-cellular network based LPWAN chip of the physical layer;
judging whether the destination MAC address of the received data is the MAC address of the local terminal equipment or not through a data link layer of the kernel space;
and if the destination MAC address of the received data is the MAC address of the local terminal equipment, the received data is sequentially decapsulated layer by layer at a data link layer, a network layer and a transmission layer of the kernel space and then sent to an application layer of the user space.
3. The method of claim 2, further comprising:
if the destination MAC address of the received data is not the MAC address of the local terminal equipment, judging whether an MAC address forwarding table of the received data is filled up or not through the data link layer;
if the MAC address forwarding table of the received data is not filled, the MAC address of the local terminal equipment is filled into the MAC address forwarding table of the received data, and the received data is forwarded through the LPWAN chip of the physical layer, which is not based on the cellular network;
and if the MAC address forwarding table of the received data is filled up, discarding the received data.
4. The method according to any one of claims 1-3, wherein before sending the layer-by-layer encapsulated data through the non-cellular network based LPWAN chip of the physical layer, the method comprises:
detecting whether a channel is idle or not through a data link layer of the kernel space;
the step of sending the data after layer-by-layer encapsulation through the LPWAN chip of the physical layer, which is not based on the cellular network, comprises the following steps:
and when the data link layer detects that the channel is idle, transmitting the data after layer-by-layer encapsulation on the idle channel through the LPWAN chip of the physical layer, which is not based on the cellular network.
5. The method of claim 4, further comprising:
and when the data link layer detects that the channel is not idle, a delay back-off mechanism is adopted to carry out delay sending on the data.
6. The method of claim 5, wherein the delaying sending the data by using a delayed backoff mechanism when the data link layer detects that the channel is not idle comprises:
when the data link layer detects that the channel is not idle, starting to time delay time, and returning to the step of detecting whether the channel is idle through the data link layer of the kernel space;
if the delay time exceeds the maximum delay time threshold, retrying and returning to the step of detecting whether the channel is idle through a data link layer of the kernel space;
and if the retry times exceed the time threshold, determining that the data transmission fails.
7. The method of claim 4, wherein the detecting whether a channel is idle by a data link layer of the kernel space comprises:
and detecting whether the channel is idle or not through a data link layer of the kernel space based on a non-time slot carrier sense multiple access/collision avoidance CSMA/CA algorithm.
8. The method of claim 7, wherein the detecting whether the channel is idle by the data link layer of the kernel space comprises:
and performing Channel Activity Detection (CAD) on the channel through the data link layer.
9. The method of claim 1, further comprising:
writing the data failed to be sent into a buffer area, and periodically retransmitting the data in the buffer area;
if the number of retransmissions exceeds a threshold number of times, the data is discarded.
10. The method of claim 1, further comprising:
broadcasting a network access connection request;
receiving a new device number distributed to the new network access terminal device and sent by the server after the server determines that the terminal device is the new network access terminal device according to the network access connection request, or receiving information corresponding to the network access terminal device and sent by the server after the server determines that the terminal device is the network access terminal device according to the network access connection request;
and performing network access connection according to the new equipment number or the corresponding information.
11. The method of claim 1, further comprising:
periodically receiving heartbeat detection information sent by a server;
and sending response information to the server to respond to the heartbeat detection information.
12. The method of claim 1, wherein the frame resulting from the final encapsulation by the data link layer comprises a MAC address forwarding table, and wherein when the MAC address forwarding table is not filled, the end device that receives the frame data is required to forward the frame data.
13. The method of claim 1, wherein the frame resulting from the final encapsulation by the data link layer comprises an opcode, the opcode being used to classify the frame.
14. The method of claim 1, wherein the non-cellular network based LPWAN chip comprises a LoRa chip.
15. A terminal device is characterized in that the terminal device is configured with an LPWAN ad hoc network framework based on an OpenHarmony system, the LPWAN ad hoc network framework based on the OpenHarmony system comprises a physical layer, a kernel space and a user space, the kernel space comprises a data link layer, a network layer and a transmission layer, and the user space comprises an application layer; the physical layer comprises a non-cellular network-based LPWAN chip, the terminal equipment comprises a communication module, a processor and a memory, the communication module is used for communicating with the outside, and the memory is used for storing a computer program; the processor is adapted to execute the computer program and, when executing the computer program, to carry out the communication method according to any of claims 1-14.
16. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program which, when executed by a processor, causes the processor to implement the communication method according to any one of claims 1 to 14.
CN202211449017.6A 2022-11-18 2022-11-18 Communication method, terminal device and storage medium Active CN115604870B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211449017.6A CN115604870B (en) 2022-11-18 2022-11-18 Communication method, terminal device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211449017.6A CN115604870B (en) 2022-11-18 2022-11-18 Communication method, terminal device and storage medium

Publications (2)

Publication Number Publication Date
CN115604870A true CN115604870A (en) 2023-01-13
CN115604870B CN115604870B (en) 2023-05-02

Family

ID=84852469

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211449017.6A Active CN115604870B (en) 2022-11-18 2022-11-18 Communication method, terminal device and storage medium

Country Status (1)

Country Link
CN (1) CN115604870B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190139153A1 (en) * 2017-11-06 2019-05-09 Alan William Howe Grant Method and system for analysing, improving, and monitoring the co-prosperity of networks
CN112783269A (en) * 2021-01-22 2021-05-11 聊城市孩室宝家俱有限公司 Book end based on thing networking eyesight health management
US20220182857A1 (en) * 2020-12-07 2022-06-09 International Business Machines Corporation Global and local measures of centrality for signed and unsigned networks
CN114866976A (en) * 2022-04-22 2022-08-05 重庆大学 Intelligent sensing terminal device and method based on LoRa ad hoc network

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190139153A1 (en) * 2017-11-06 2019-05-09 Alan William Howe Grant Method and system for analysing, improving, and monitoring the co-prosperity of networks
US20220182857A1 (en) * 2020-12-07 2022-06-09 International Business Machines Corporation Global and local measures of centrality for signed and unsigned networks
CN112783269A (en) * 2021-01-22 2021-05-11 聊城市孩室宝家俱有限公司 Book end based on thing networking eyesight health management
CN114866976A (en) * 2022-04-22 2022-08-05 重庆大学 Intelligent sensing terminal device and method based on LoRa ad hoc network

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
李超凡: ""基于鸿蒙OS的多源数据融合水质监测系统设计"", 《物联网技术》 *

Also Published As

Publication number Publication date
CN115604870B (en) 2023-05-02

Similar Documents

Publication Publication Date Title
US20220132611A1 (en) Multi-link communications of a wireless network
US10554795B2 (en) Uplink transmission method, related device, and system
JP4875156B2 (en) Repeater
JP2005102228A (en) Method and apparatus for rate fallback in radio communication system
WO2022082679A1 (en) Communication method and related device
US9572132B2 (en) Method and apparatus for communicating data packets in a cloud cell
US20100260092A1 (en) Method and apparatus for implementing cooperative mimo in a wireless local area network
CN116017751A (en) Random access method and communication device
US11432370B2 (en) D2D communication method and terminal device
KR102602455B1 (en) Relay transmission method and relay node
KR20200135766A (en) Data transmission method and terminal device
JP2007208830A (en) Radio relay method
KR20220089708A (en) Implementation of multipath communication
CN111510951A (en) Data sending method and terminal equipment
CN111543116B (en) Method for forwarding data between nodes in relay network and network node
US20070217443A1 (en) Communication apparatus, communication method, and computer program product
EP2342857B1 (en) Communication system, dependent station thereof and dependent-station relay transmission method
Mortimer et al. A MAC protocol for multihop RP-CDMA ad hoc wireless networks
CN1964353A (en) A protocol stack facing wireless industrial control network
CN115604870B (en) Communication method, terminal device and storage medium
CN105337637A (en) Node and communication system
CN108235374A (en) Terminal wireless data transmission method, device, terminal, server and storage medium
CN111869246B (en) Message transmission method, BLE equipment and BLE chip
CN109618566A (en) Method and terminal device for listening to
US20210297198A1 (en) Operation of automatic repeat request

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant