LoRa-based data transmission method and system, terminal and storage medium

By introducing the receiving confirmation frame and differential retransmission mechanism in LoRa data transmission, combined with unpacking and packaging technology, the data integrity and efficiency problems in LoRa data transmission are solved, and efficient and low-cost data transmission is achieved.

CN119109997APending Publication Date: 2024-12-10SUZHOU DHMS INFORMATION TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411102851.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-13
Publication Date
2024-12-10

AI Technical Summary

Technical Problem

The lack of effective data integrity guarantee and large data packet transmission capabilities in LoRa data transmission lacks transmission efficiency and high cost.

Method used

A reception confirmation frame and differential retransmission mechanism are introduced, and the data transmission process is converted into a bidirectional path through the unpacking and packing mechanism. The sending end can know the data reception status of the receiving end in real time and retransmit targetedly to ensure data integrity and efficiency.

Benefits of technology

It improves the accuracy and efficiency of data transmission, supports large-volume data packet transmission, and reduces implementation costs and operation and maintenance difficulties.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119109997A_ABST
    Figure CN119109997A_ABST
Patent Text Reader

Abstract

The invention relates to a LoRa-based data transmission method and system, a terminal and a storage medium, the method comprises a corresponding data sending process and a data receiving process, a sending end selectively unpacks a complete data packet and then sends the data packet to a receiving end, the receiving end returns a receiving acknowledgement frame in real time, and the receiving end receives the acknowledgement frame in real time. And the sending end responds to the receiving confirmation frame to carry out targeted data retransmission, the receiving end judges whether the received data can form a complete data packet, and if so, packet splicing is carried out to obtain the complete data packet. According to the scheme provided by the invention, the whole data transmission process is changed from a previous one-way path to a two-way path by adding the receiving acknowledgement frame and introducing the differential retransmission mechanism, so that the transmitting end can clearly know the data receiving condition of the receiving end and perform retransmission, and the integrity and accuracy of data transmission are ensured; besides, according to the scheme, the transmission capability for large-volume data packets is obtained by using an unpacking and splicing mechanism, and the adaptation range of the scheme is widened.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of data transmission, and in particular to a LoRa-based data transmission method, system, terminal and storage medium for ensuring the integrity of transmitted data. Background Art

[0002] LoRa (Long Range Radio) is a low-power, ultra-long-distance wireless transmission technology, which aims to solve the contradiction between power consumption and transmission distance. Generally speaking, low power consumption means short transmission distance, and high power consumption means long transmission distance. LoRa achieves a balance between power consumption and transmission distance. Under the same power consumption conditions, LoRa can transmit farther than other wireless methods, and after the devices are connected, LoRa can ensure the accuracy of the transmitted data as much as possible.

[0003] In actual application scenarios, when using LoRa modules for data transmission, the sender will send data to the receiver's LoRa module through its own LoRa module, and the receiver's LoRa module will transmit the data to the receiver after receiving the data. Since the entire data transmission process depends on the LoRa modules in both the sender and the receiver, the defects of this process are also quite significant, mainly concentrated in two aspects.

[0004] First, since both the data sending and receiving processes need to be executed through the LoRa module, the sender cannot obtain effective feedback after completing the data transmission, and cannot know the data reception status of the target receiving end, and cannot guarantee the integrity of data transmission.

[0005] Secondly, since the integrity of data transmission cannot be guaranteed, data cannot be transmitted in packets. In addition, because the LoRa module has a maximum single data transmission limit of 200 bytes, the amount of data that can be transmitted through the above process is limited. The smaller amount of data that can be transmitted is difficult to meet the increasingly complex data transmission needs.

[0006] In view of the various defects existing in the above-mentioned prior art, how to propose a new LoRa-based data transmission solution that can be used in various application scenarios, while ensuring the integrity and accuracy of data transmission, and minimizing the implementation cost and operation and maintenance difficulty of the solution, has become an urgent problem to be solved by technical personnel in this field. Summary of the invention

[0007] In order to meet the needs for data transmission integrity in various application scenarios, the present application provides a LoRa-based data transmission method, system, terminal and storage medium.

[0008] The scheme of the present application changes the entire data transmission process from the previous one-way path to a two-way path by adding a reception confirmation frame and introducing a differential retransmission mechanism. The sending end can clearly know the data reception status of the receiving end and retransmit the data in a targeted manner, thereby ensuring the integrity and accuracy of data transmission. In addition, the scheme also obtains the transmission capability for large-volume data packets by utilizing the unpacking and assembling mechanism, thus broadening the scope of adaptation of the scheme.

[0009] In a first aspect, the present application provides a data transmission method based on LoRa, which adopts the technical solution described below.

[0010] A data transmission method based on LoRa includes a data sending process, which specifically includes the following steps:

[0011] Determine whether a complete data packet needs to be split according to a preset data packet splitting rule, selectively unpack the complete data packet according to the determination result to obtain one or more data frames to be transmitted, and add a frame header field to each of the data packets to be transmitted to obtain communication data frames with the same number and corresponding content as the data frames to be transmitted;

[0012] Adding the communication data frames to a sending buffer, and sequentially sending the communication data frames from the sending buffer to a receiving end;

[0013] Obtain a reception confirmation frame returned by the receiving end, each of the reception confirmation frames corresponding to one or more communication data frames, delete the communication data frames corresponding to the reception confirmation frames from the sending buffer, and repeatedly send the remaining communication data frames in the sending buffer to the receiving end until the sending buffer is cleared.

[0014] By adopting the above technical solution, an unpacking mechanism is introduced in the data sending process. When faced with a large complete data packet, the information sending capability of the sender can be maximized by splitting it into multiple frames and sending them separately. At the same time, the sender can also obtain the data reception status in real time based on the received confirmation frame. For this reason, the sender obtains the ability of differential retransmission. When the transmission of some communication data frames fails, only the data of these communication data frames can be retransmitted, thereby improving the transmission efficiency while ensuring the integrity of data transmission.

[0015] Preferably, judging whether a complete data packet needs to be split according to a preset data packet splitting rule, selectively unpacking the complete data packet according to the judgment result to obtain one or more data frames to be transmitted, adding a frame header field to each of the data packets to be transmitted, and obtaining communication data frames with the same number and corresponding content as the data frames to be transmitted, specifically includes the following steps:

[0016] Compare the byte length of the complete data packet with the preset maximum transmission unit number; if the byte length of the complete data packet does not exceed the maximum transmission unit number, directly treat the complete data packet as a data frame to be transmitted; if the byte length of the complete data packet exceeds the maximum transmission unit number, split the complete data packet based on the maximum transmission unit number to obtain multiple data frames to be transmitted;

[0017] A frame header field is added to each of the data frames to be transmitted respectively, wherein the frame header field includes at least a frame check code for valid frame identification and a frame sequence number for packet assembly, and each of the data frames to be transmitted to which the frame header field is added is used as a communication data frame.

[0018] By adopting the above technical solution, the unpacking mechanism within the data sending process in the solution is refined and limited, and the introduction of specific parameters such as the frame check code in the frame header field also enables the receiver in the subsequent operation process to verify and evaluate the data source and data validity, further ensuring the accuracy and completeness of the sent data.

[0019] Preferably, the obtaining of the reception confirmation frame returned by the receiving end, each of the reception confirmation frames corresponding to one or more communication data frames, deleting the communication data frames corresponding to the reception confirmation frames from the sending buffer, and repeatedly sending the remaining communication data frames in the sending buffer to the receiving end until the sending buffer is cleared, specifically comprises the following steps:

[0020] Obtaining a reception confirmation frame returned by the receiving end according to a preset response rule, each of the reception confirmation frames corresponding to one or more communication data frames;

[0021] Determine all the communication data frames corresponding to the reception confirmation frame, delete the determined communication data frames from the sending buffer, and resend the remaining communication data frames in the sending buffer to the receiving end;

[0022] When all the communication data frames in the sending buffer are deleted, it is confirmed that the receiving end has completely received all the complete data packets, and then the acquisition of the reception confirmation frame from the receiving end is stopped.

[0023] By adopting the above technical solution, the differential retransmission mechanism within the data sending process in the solution is refined and limited. The sending end can selectively perform subsequent operations by judging the reception confirmation frame from the receiving end. When some communication data frames fail to be transmitted or are not received, the sending end will directly resend these communication data frames, thereby maximizing the transmission efficiency and avoiding the waste of resources caused by full data retransmission in conventional operations.

[0024] The present application also provides another LoRa-based data transmission method, which adopts the technical solution described below.

[0025] A data transmission method based on LoRa includes a data receiving process, which specifically includes the following steps:

[0026] Receiving a communication data frame from a transmitting end, judging whether the current communication data frame is valid according to a frame header field of the communication data frame, and selectively adding the communication data frame to a receiving buffer according to the judging result;

[0027] Generate a reception confirmation frame in the form of an incremental sequence number or a bit mask according to a preset response rule, and return the reception confirmation frame to the sending end, each of the reception confirmation frames corresponding to one or more of the communication data frames;

[0028] When it is confirmed that there are communication data frames in the receiving buffer that can be pieced together to form a complete data packet based on the frame header field of the communication data frame, the corresponding communication data frames are pieced together to obtain a complete data packet, the communication data frames that have completed the pieced together processing are deleted from the receiving buffer, and the communication data frames from the sending end are continuously received until the receiving buffer is cleared.

[0029] By adopting the above technical solution, a packing mechanism corresponding to the aforementioned unpacking mechanism is introduced into the data receiving process. By identifying and processing the frame header field, the receiving end can ensure that the obtained communication data frame is accurate and effective and can smoothly complete the reorganization of the complete data packet; at the same time, the generated and returned reception confirmation frame also helps the sending end to know the data reception status in real time, ensuring the smooth execution of the differential retransmission mechanism of the sending end.

[0030] Preferably, the receiving of the communication data frame from the transmitting end, judging whether the current communication data frame is valid according to the frame header field of the communication data frame, and selectively adding the communication data frame to the receiving buffer according to the judgment result specifically comprises the following steps:

[0031] Receive the communication data frame sent by the sending end, parse the frame header field of each communication data frame one by one, the frame header field at least includes a frame check code for valid frame identification and a frame sequence number used as a basis for packet assembly; if the frame header field conforms to a preset format and the frame check code is correct, add the communication data frame to a receiving buffer; if the frame header field does not conform to a preset format or the frame check code is incorrect, discard the communication data frame.

[0032] By adopting the above technical solution, the communication data frame verification operation in the data receiving process of the solution is refined and limited, so that the communication data frames that can enter the subsequent packet assembly processing are accurate and valid, further ensuring the accuracy and integrity of the received data.

[0033] Preferably, the generating of a reception confirmation frame in the form of an incremental sequence number or a bit mask according to a preset response rule, returning the reception confirmation frame to the transmitting end, each reception confirmation frame corresponding to one or more communication data frames, specifically comprises the following steps:

[0034] When the received communication data frame includes a response request or the number of the received communication data frames reaches a preset response threshold, generating a first confirmation frame in the form of an incremental sequence number and a second confirmation frame in the form of a bit mask according to the received communication data frame;

[0035] Compare the data volume of the first confirmation frame and the second confirmation frame, take the one with the smaller data volume as the reception confirmation frame, each of the reception confirmation frames corresponds to one or more of the communication data frames, and return the reception confirmation frame to the sending end.

[0036] By adopting the above technical scheme, the generation and return operations of the reception confirmation frame in the data receiving process of the scheme are refined and limited. The reception confirmation frame contains repetition and missing information for the received communication data frame, so that the sending end only needs to resend the missing part of the communication data frame in a targeted manner, which greatly reduces the communication overhead; and in this operation, in order to maximize the transmission efficiency, the selection of the reception confirmation frame will also directly select the one with smaller data volume.

[0037] Preferably, when it is confirmed that there are communication data frames in the receiving buffer that can be pieced together into a complete data packet based on the frame header field of the communication data frame, the corresponding communication data frames are pieced together to obtain a complete data packet, the communication data frames that have completed the pieced together processing are deleted from the receiving buffer, and the communication data frames from the sending end are continuously received until the receiving buffer is cleared, which specifically includes the following steps:

[0038] The frame header fields of all the communication data frames in the receiving buffer are counted in real time, and whether there are communication data frames that can be pieced together into a complete data packet in the current receiving buffer according to the frame header fields; if so, all the communication data frames that can be pieced together are selected, and the selected communication data frames are sorted and pieced together according to the frame sequence numbers to obtain a complete data packet, and then the selected communication data frames are deleted from the receiving buffer; if not, the communication data frames sent by the sending end are continuously received;

[0039] When at least one complete data packet is obtained and all the communication data frames in the receiving buffer are deleted, it is confirmed that the sending end has completely sent all the complete data packets, and then the reception of the communication data frames from the sending end, the generation and return of the reception confirmation frame are stopped.

[0040] By adopting the above technical scheme, the packet splicing mechanism within the data receiving process in the scheme is refined and limited, and the introduction of specific parameters such as the frame check code in the frame header field not only serves as a prompt and helps to trigger the packet splicing operation, but also provides a basis for the splicing of communication data frames in subsequent operation processes.

[0041] In a second aspect, the present application provides a LoRa-based data transmission system, which adopts the technical solution described below.

[0042] A data transmission system based on LoRa, including a data sending module, specifically including the following modules:

[0043] A data packet splitting module is configured to determine whether a complete data packet needs to be split according to a preset data packet splitting rule, and selectively unpack the complete data packet according to the determination result to obtain one or more data frames to be transmitted, and respectively add a frame header field to each of the data packets to be transmitted to obtain communication data frames with the same number and corresponding content as the data frames to be transmitted;

[0044] A data frame sending module, configured to add the communication data frames to a sending buffer, and send the communication data frames in sequence from the sending buffer to a receiving end;

[0045] A confirmation frame processing module is configured to obtain a reception confirmation frame returned by the receiving end, each of the reception confirmation frames corresponding to one or more communication data frames, delete the communication data frames corresponding to the reception confirmation frames from the sending buffer, and repeatedly send the remaining communication data frames in the sending buffer to the receiving end until the sending buffer is cleared.

[0046] The present application also provides another LoRa-based data transmission system, which adopts the technical solution described below.

[0047] A LoRa-based data transmission system includes a data receiving module, which specifically includes the following modules:

[0048] A data frame receiving module is configured to receive a communication data frame from a transmitting end, determine whether the current communication data frame is valid according to a frame header field of the communication data frame, and selectively add the communication data frame to a receiving buffer according to the determination result;

[0049] A confirmation frame generation module is configured to generate a reception confirmation frame in the form of an incremental sequence number or a bit mask according to a preset response rule, and return the reception confirmation frame to the sending end, each of the reception confirmation frames corresponding to one or more of the communication data frames;

[0050] The data packet splicing module is configured to, when confirming, based on the frame header field of the communication data frame, that there are communication data frames in the receiving buffer that can be spliced ​​into a complete data packet, perform splicing processing on the corresponding communication data frames to obtain a complete data packet, delete the communication data frames that have completed the splicing processing from the receiving buffer, and continue to receive the communication data frames from the sending end until the receiving buffer is cleared.

[0051] By adopting the above technical solution, the above two LoRa-based data transmission methods are implemented at the hardware level. It can be seen that the system constructed by the solution is relatively clear and easy to work at the hardware level. There is no need to make major changes to the existing data transmission system. It only needs to be compatible with related communication and analysis protocols. The solution has low implementation costs and is conducive to large-scale promotion and application of the system.

[0052] In a third aspect, the present application provides a smart terminal, which adopts the following technical solution:

[0053] A smart terminal comprises a memory and a processor, wherein the memory stores at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by the processor to implement the LoRa-based data transmission method as described above.

[0054] In a fourth aspect, the present application provides a computer-readable storage medium, which adopts the following technical solution:

[0055] A computer-readable storage medium, wherein at least one instruction, at least one program, code set or instruction set is stored in the readable storage medium, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by a processor to implement the LoRa-based data transmission method as described above.

[0056] In summary, the present application includes at least one of the following beneficial technical effects:

[0057] 1. The solution of the present application introduces a package unpacking and package assembly mechanism. When faced with a large complete data packet, the sender can split it into multiple frames and send them separately, while the receiver can piece together the complete data packet after receiving the communication data frame. This mechanism maximizes the data transmission capability of the solution, enabling the solution to obtain the transmission capability for large-volume data packets.

[0058] 2. The solution of the present application also adds a receiving confirmation frame and introduces a differential retransmission mechanism, so that once a communication data frame is lost or omitted during the data transmission process, the sender only needs to specifically resend the missing communication data frame, thereby greatly reducing the communication overhead while ensuring the accuracy and integrity of the transmitted data.

[0059] 3. The solution of the present application is easy to apply and has low implementation cost. There is no need to make major changes to the existing data transmission solution or change the architecture of the data application layer and the data transmission layer. Only adaptive adjustments need to be made between the data application layer and the data transmission layer. It has strong adaptability and compatibility. BRIEF DESCRIPTION OF THE DRAWINGS

[0060] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, they can also refer to these drawings to obtain other drawings without paying creative work.

[0061] Figure 1 It is a flow chart of a data transmission process in a LoRa-based data transmission method in an embodiment of the present application;

[0062] Figure 2 It is a schematic diagram of the content of the frame header field in a LoRa-based data transmission method in an embodiment of the present application;

[0063] Figure 3 It is a flow chart of a data receiving process in a LoRa-based data transmission method in an embodiment of the present application;

[0064] Figure 4It is a schematic diagram of the contents of a reception confirmation frame in the form of an incremental sequence number in a LoRa-based data transmission method in an embodiment of the present application;

[0065] Figure 5 It is a schematic diagram of the contents of a reception confirmation frame in a bit mask form in a LoRa-based data transmission method in an embodiment of the present application;

[0066] Figure 6 It is a schematic diagram of the architecture of a data sending module in a LoRa-based data transmission system in an embodiment of the present application;

[0067] Figure 7 It is a schematic diagram of the architecture of a data receiving module in a LoRa-based data transmission system according to an embodiment of the present application. DETAILED DESCRIPTION

[0068] The present application provides a LoRa-based data transmission method, system, terminal and storage medium for ensuring the integrity of the transmitted data. In order to make the purpose, technical solution and advantages of the present application clearer, the implementation method of the present application will be further described below.

[0069] The following is a detailed description of a LoRa-based data transmission method, system, terminal and storage medium of the present application in conjunction with the drawings of the specification.

[0070] First, a data transmission method based on LoRa in the embodiment of the present application is introduced, which can be further broken down into a data transmission process and a data receiving process. The method in this embodiment is essentially to add a layer of communication protocol between the transmitter / receiver and their respective LoRa modules, which is used to process communication data to ensure the integrity of data transmission and the correct unpacking and packaging during large data transmission. At the hardware level, it is only necessary for the transmitter and the receiver to have the functions of timing, memory management or flash reading and writing.

[0071] A data transmission method based on LoRa in this embodiment, such as Figure 1 As shown, the data sending process specifically includes the following steps:

[0072] S11. Determine whether a complete data packet needs to be split according to a preset data packet splitting rule, and selectively unpack the complete data packet according to the determination result to obtain one or more data frames to be transmitted, and add a frame header field to each of the data packets to be transmitted to obtain communication data frames that are consistent in number and corresponding in content to the data frames to be transmitted; this step specifically includes the following process.

[0073] S111, comparing the byte length of the complete data packet with a preset maximum transmission unit number;

[0074] If the byte length of the complete data packet does not exceed the maximum number of transmission units, directly treating the complete data packet as a data frame to be transmitted;

[0075] If the byte length of the complete data packet exceeds the maximum number of transmission units, the complete data packet is split based on the maximum number of transmission units to obtain a plurality of data frames to be transmitted.

[0076] It should be noted here that, since this solution is based on the LoRa module, the setting of the maximum transmission unit number (Maximum Transmission Unit, MTU) should also take into account the hardware limitations of the LoRa module. In this embodiment, the maximum transmission unit number is the same as the maximum length of data supported by the LoRa module, which is 200.

[0077] S112, respectively add a frame header field to each of the data frames to be transmitted, wherein the frame header field includes at least a frame check code for valid frame identification and a frame sequence number for packet assembly, and each of the data frames to be transmitted to which the frame header field is added is used as a communication data frame.

[0078] In this embodiment, the format of the frame header field is fixed, such as Figure 2 As shown, the length of each frame header field is 34 bytes, and each frame header field includes the following content from the beginning to the end.

[0079] Content length (Payload Length), with a length of 2 bytes, is used to indicate the length of the frame content (FramePayload) in the frame.

[0080] The version number (Version) is 1 byte long and is used to indicate the version number of the communication protocol currently used by the sending device.

[0081] The source terminal device serial number (Src Series No.) is 8 bytes long and is used to correspond to the current sending end device. In this embodiment, the source terminal device serial number of each sending end device is unique.

[0082] The target terminal device serial number (Dest Series No.) is 8 bytes long and is used to correspond to the current receiving device. In this embodiment, the target terminal device serial number of each receiving device is unique. And according to the specific content of the target terminal device serial number, the receiving device as the data receiver will be different. For example, when the target terminal device serial number is all 0, the communication data frame is only received by the central device; when it is all FF, the communication data frame is only received by the peripheral device.

[0083] Packet sequence number (Pack Sequence), 4 bytes in length, is used to indicate the sequence number of a complete data packet, and is accumulated from zero; the packet sequence number in the subsequent received confirmation frame is the same as the packet sequence number in the corresponding communication data frame.

[0084] Frame flag, 1 byte in length, is used to indicate the attributes of the frame, marked with bits. More specifically, bit 0 indicates that the receiving end is required to return a reception confirmation frame, i.e., a response request; bit 1 indicates the type of reception confirmation, 1 is a bit mask, 0 is an incremental sequence number; bit 2 indicates a communication data frame; bit 3 indicates a reception confirmation frame; bit 6 indicates the start frame of a complete data packet; bit 7 indicates the end frame of a complete data packet.

[0085] The frame sequence number (Frame Sequence) is 4 bytes long and is used to indicate the sequence number of the frame in the complete data packet. It is accumulated from zero. The frame sequence number in the subsequent received confirmation frame is the same as the frame sequence number in the corresponding communication data frame.

[0086] Frame Length: 4 bytes long, used to indicate the length of the frame.

[0087] The frame checksum (Checksum) is 2 bytes long and is used to verify whether the frame is a valid frame. It is generated using the standard CRC16 algorithm.

[0088] S12, adding the communication data frames to a sending buffer, and sending the communication data frames in sequence from the sending buffer to a receiving end.

[0089] S13, obtaining a reception confirmation frame (Ack frame) returned by the receiving end, each of the reception confirmation frames corresponding to one or more of the communication data frames, deleting the communication data frames corresponding to the reception confirmation frames from the sending buffer, and repeatedly sending the remaining communication data frames in the sending buffer to the receiving end until the sending buffer is cleared; this step specifically includes the following process.

[0090] S131, obtaining a reception confirmation frame returned by the receiving end according to a preset response rule, each of the reception confirmation frames corresponds to one or more communication data frames, and contains relevant information reflecting the data reception of the receiving end.

[0091] It should be noted that the response rules in this embodiment can have multiple forms. In addition to the response requirements in the aforementioned frame header field and frame attributes, the receiving end can also automatically generate and return the reception confirmation frame after receiving a total of i communication data frames. i is the response threshold, and the specific numerical setting can be adjusted according to the actual application scenario.

[0092] S132. Determine all the communication data frames corresponding to the reception confirmation frame, delete the determined communication data frames from the sending buffer, and resend the remaining communication data frames in the sending buffer to the receiving end.

[0093] S133. When all the communication data frames in the sending buffer are deleted, confirm that the receiving end has completely received all the complete data packets, and then stop acquiring the reception confirmation frame from the receiving end.

[0094] It should be noted that the deletion of all the communication data frames in the sending buffer is essentially the termination condition of the data sending process. In the actual application of the method, when there are still communication data frames that have not been deleted in the sending buffer, it directly returns to step S12 to send the communication data frames in sequence from the sending buffer to the receiving end, so as to realize a local loop of the data sending process.

[0095] A data transmission method based on LoRa in this embodiment, such as Figure 3 As shown, the data receiving process specifically includes the following steps:

[0096] S21, receiving the communication data frame from the transmitting end, judging whether the current communication data frame is valid according to the frame header field of the communication data frame, and selectively adding the communication data frame to the receiving buffer according to the judgment result; this step specifically includes the following process.

[0097] Receiving the communication data frame sent by the sending end, and parsing the frame header field of each communication data frame one by one;

[0098] If the frame header field conforms to the preset format and the frame check code is correct, then the communication data frame is added to the receiving buffer;

[0099] If the frame header field does not conform to the preset format or the frame check code is incorrect, the communication data frame is discarded.

[0100] S22. Generate the reception confirmation frame in the form of an incremental sequence number or a bit mask according to the preset response rule, and return the reception confirmation frame to the sending end, each of the reception confirmation frames corresponds to one or more communication data frames; this step specifically includes the following process.

[0101] S221. When the received communication data frame contains the response request or the number of the received communication data frames reaches the preset response threshold, a first confirmation frame is generated in the form of an incremental sequence number and a second confirmation frame is generated in the form of a bit mask according to the received communication data frame.

[0102] There are two points that need to be explained here. First, the response rules here are as described above.

[0103] Secondly, in this embodiment, the reception confirmation frame uses a selective response method to accurately respond to the communication data frame obtained by splitting the received complete data packet, that is, by responding to the repeated parts and missing parts in the current complete data packet, the sending end only retransmits the missing parts according to the reception confirmation frame, thereby reducing the number of retransmissions and improving transmission efficiency. In this regard, the reception confirmation frame can have the following two forms.

[0104] Incremental sequence number is a method used to indicate lost data. It tells the sender which data is lost by sending a message from the receiving end. This message contains the sequence number of the lost communication data frame. After receiving this message, the sender will resend the lost communication data frame to reduce communication overhead.

[0105] like Figure 4 As shown, the reception confirmation frame in the form of an incremental sequence number includes at least the following contents in addition to the frame header field.

[0106] The missing gap information block (Gap Block) is filled with the gap start (Gap Start) and gap end (Gap End) that appear in pairs.

[0107] Gap start, 4 bytes in length, used to indicate the start position of a gap.

[0108] The gap end is 4 bytes long and is used to indicate the end position of a gap.

[0109] Specifically, assuming that the sending end executes a frame-by-frame transmission process starting with a sequence number of 0, and the sequence number increases by a value each time a communication data frame is sent, if the receiving end receives a communication data frame at a certain moment, whose sequence number is n, and then suddenly loses the next m communication data frames, in this case, the sequence numbers of the lost m communication data frames can be expressed as n+1 to n+m.

[0110] For example, if the receiving end loses the next three communication data frames, that is, the three communication data frames with frame sequence numbers 6 to 8, after receiving the communication data frame with sequence number 5, then it is only necessary to fill in the two values ​​6 and 8 in the missing gap information block in the reception confirmation frame. The sending end can know that the three communication data frames with frame sequence numbers 6 to 8 are lost and retransmit them.

[0111] Bit masks are also a method used to indicate missing data. When bit masks are used in communication protocols, the following steps are usually involved.

[0112] The transmitting end sends a series of the communication data frames, and these communication data frames can be continuous or discrete.

[0113] The receiving end receives the communication data frames and uses a bit mask to track which communication data frames have been received and which communication data frames have been lost. The receiving end compares the bit mask with the received communication data frames and sets the corresponding bits. For example, if the receiving end receives the first communication data frame, the first bit of the bit mask is set to 1. If the receiving end does not receive a certain communication data frame, the corresponding bit is set to 0. For example, if the second communication data frame is lost, the second bit of the bit mask is set to 0.

[0114] The receiving end sends the bit mask to the sending end to inform the sending end which communication data frames are lost, so that the sending end can resend these communication data frames. In this way, both communicating parties can ensure the integrity and reliability of the transmitted data, and the use of the bit mask can also effectively detect and process the loss of data packets, thereby improving the quality and stability of communication.

[0115] like Figure 5 As shown, the reception confirmation frame in the bit mask form includes at least the following contents except the frame header field.

[0116] The mask information block (Mask Block) is filled with pairs of lost frame sequence numbers (Lost Seq) and subsequent frame status (Mask).

[0117] The lost frame sequence number is 4 bytes long and is used to indicate the sequence number of the lost communication data frame.

[0118] Subsequent frame status, 4 bytes in length, is used to indicate the status of 32 communication data frames after the lost frame.

[0119] S222. In order to maximize the transmission efficiency, the data volume of the first confirmation frame is compared with that of the second confirmation frame, and the one with the smaller data volume is taken as the reception confirmation frame, each of the reception confirmation frames corresponds to one or more of the communication data frames, and the reception confirmation frame is returned to the sending end.

[0120] S23. When it is confirmed that there are communication data frames in the receiving buffer that can be pieced together to form the complete data packet based on the frame header field of the communication data frame, the corresponding communication data frames are pieced together to obtain the complete data packet, the communication data frames that have completed the pieced together processing are deleted from the receiving buffer, and the communication data frames from the sending end are continuously received until the receiving buffer is cleared; this step specifically includes the following process.

[0121] S231, counting the frame header fields of all the communication data frames in the receiving buffer in real time, and judging whether there are communication data frames that can be used to piece together the complete data packet in the current receiving buffer according to the frame header fields;

[0122] If so, all the communication data frames that can be spliced ​​are selected, the selected communication data frames are sorted and spliced ​​according to the frame sequence numbers to obtain the complete data packet, and then the selected communication data frames are deleted from the receiving buffer;

[0123] If not, continue to receive the communication data frame sent by the sending end;

[0124] S232. When at least one complete data packet is obtained and all the communication data frames in the receiving buffer are deleted, confirm that the sending end has completely sent all the complete data packets, and then stop receiving the communication data frames from the sending end, stop generating and returning the reception confirmation frame.

[0125] It should be noted here that there are two specific termination conditions for the data receiving process, namely, obtaining at least one complete data packet and the receiving buffer being empty. When the two termination conditions cannot be met at the same time, it directly returns to the beginning of the data receiving process, that is, step S21, to realize the loop of the data receiving process.

[0126] The above two termination conditions are set to ensure that data transmission achieves the expected results, further improve data transmission efficiency, and avoid the situation where the received communication data frame does not meet the valid frame verification requirements, resulting in the receiving buffer being empty throughout the entire data receiving process, thereby causing the data receiving process to terminate prematurely.

[0127] Based on the above data sending process and data receiving process, it can be known that a LoRa-based data transmission method in this application basically includes the following steps from the perspective of both the sending end and the receiving end:

[0128] In the first step, the sender selectively unpacks the complete data packet according to the data volume of the complete data packet and completes the addition of the frame header field, generates one or more communication data frames and sends them to the receiver;

[0129] In the second step, the receiving end receives the communication data frame and returns the reception confirmation frame generated by the corresponding communication data frame in real time;

[0130] In the third step, the sending end responds to the reception confirmation frame. If the communication data frame is lost, the lost communication data frame is resent until all the communication data frames are received by the receiving end.

[0131] In the fourth step, the receiving end determines whether the received communication data frame can constitute a complete data packet. If so, it performs packet splicing to obtain a complete data packet.

[0132] Based on the same inventive concept above, the present application embodiment also discloses a data transmission system based on LoRa, such as Figure 6 As shown, the system includes a data sending module, which specifically includes the following modules:

[0133] A data packet splitting module is configured to determine whether a complete data packet needs to be split according to a preset data packet splitting rule, and selectively unpack the complete data packet according to the determination result to obtain one or more data frames to be transmitted, and respectively add a frame header field to each of the data packets to be transmitted to obtain communication data frames with the same number and corresponding content as the data frames to be transmitted;

[0134] A data frame sending module, configured to add the communication data frames to a sending buffer, and send the communication data frames in sequence from the sending buffer to a receiving end;

[0135] A confirmation frame processing module is configured to obtain a reception confirmation frame returned by the receiving end, each of the reception confirmation frames corresponding to one or more communication data frames, delete the communication data frames corresponding to the reception confirmation frames from the sending buffer, and repeatedly send the remaining communication data frames in the sending buffer to the receiving end until the sending buffer is cleared.

[0136] In a possible implementation, the data packet splitting module specifically includes the following units:

[0137] A data packet splitting unit is configured to compare the byte length of a complete data packet with a preset maximum transmission unit number; if the byte length of the complete data packet does not exceed the maximum transmission unit number, directly use the complete data packet as a data frame to be transmitted; if the byte length of the complete data packet exceeds the maximum transmission unit number, split the complete data packet based on the maximum transmission unit number to obtain a plurality of data frames to be transmitted;

[0138] The frame header field adding unit is configured to add a frame header field to each of the data frames to be transmitted respectively, and the frame header field includes at least a frame check code for valid frame identification and a frame sequence number used as a basis for packet assembly, and each of the data frames to be transmitted that has completed the addition of the frame header field is used as a communication data frame.

[0139] In a possible implementation, the confirmation frame processing module specifically includes the following units:

[0140] A confirmation frame acquisition unit is configured to acquire a reception confirmation frame returned by the receiving end according to a preset response rule, each of the reception confirmation frames corresponding to one or more communication data frames;

[0141] A confirmation frame response unit, configured to determine all the communication data frames corresponding to the reception confirmation frame, delete the determined communication data frames from the sending buffer, and resend the remaining communication data frames in the sending buffer to the receiving end;

[0142] The sending process termination unit is configured to confirm that the receiving end has completely received all the complete data packets when all the communication data frames in the sending buffer are deleted, and then stop obtaining the reception confirmation frame from the receiving end.

[0143] A LoRa-based data transmission system in this embodiment, such as Figure 7 As shown, the system includes a data receiving module, which specifically includes the following modules:

[0144] A data frame receiving module is configured to receive a communication data frame from a transmitting end, determine whether the current communication data frame is valid according to a frame header field of the communication data frame, and selectively add the communication data frame to a receiving buffer according to the determination result;

[0145] A confirmation frame generation module is configured to generate a reception confirmation frame in the form of an incremental sequence number or a bit mask according to a preset response rule, and return the reception confirmation frame to the sending end, each of the reception confirmation frames corresponding to one or more of the communication data frames;

[0146] The data packet splicing module is configured to, when confirming, based on the frame header field of the communication data frame, that there are communication data frames in the receiving buffer that can be spliced ​​into a complete data packet, perform splicing processing on the corresponding communication data frames to obtain a complete data packet, delete the communication data frames that have completed the splicing processing from the receiving buffer, and continue to receive the communication data frames from the sending end until the receiving buffer is cleared.

[0147] In a possible implementation, the data frame receiving module specifically includes the following units:

[0148] A data frame receiving unit is configured to receive communication data frames sent by a sending end, and parse the frame header fields of each communication data frame one by one, wherein the frame header field at least includes a frame check code for valid frame identification and a frame sequence number for packet assembly; if the frame header field conforms to a preset format and the frame check code is correct, the communication data frame is added to a receiving buffer; if the frame header field does not conform to a preset format or the frame check code is incorrect, the communication data frame is discarded.

[0149] In a possible implementation, the confirmation frame generation module specifically includes the following units:

[0150] A confirmation frame generating unit, configured to generate a first confirmation frame in the form of an incremental sequence number and a second confirmation frame in the form of a bit mask according to the received communication data frame when the received communication data frame contains a response request or the number of the received communication data frames reaches a preset response threshold;

[0151] The confirmation frame determination unit is configured to compare the data volume of the first confirmation frame and the second confirmation frame, and take the one with the smaller data volume as the reception confirmation frame, each of the reception confirmation frames corresponds to one or more of the communication data frames, and return the reception confirmation frame to the sending end.

[0152] In a possible implementation, the data packet assembly module specifically includes the following units:

[0153] The data packet assembly unit is configured to count the frame header fields of all the communication data frames in the receiving buffer in real time, and judge whether there are communication data frames that can be assembled into a complete data packet in the current receiving buffer according to the frame header fields; if there are, select all the communication data frames that can be assembled, sort and assemble the selected communication data frames according to the frame sequence numbers to obtain a complete data packet, and then delete the selected communication data frames from the receiving buffer; if there are no communication data frames, continue to receive the communication data frames sent by the sending end;

[0154] The receiving process termination unit is configured to confirm that the sending end has completely sent all the complete data packets when at least one complete data packet is obtained and all the communication data frames in the receiving buffer are deleted, and then stop receiving the communication data frames from the sending end and stop generating and returning the receiving confirmation frame.

[0155] Based on the same inventive concept mentioned above, an embodiment of the present application also discloses an intelligent terminal, including a memory and a processor, wherein the memory stores at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by the processor to implement any one of the LoRa-based data transmission methods described above.

[0156] It should be understood that the "plurality" mentioned in this article refers to two or more. "And / or" describes the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects are in an "or" relationship.

[0157] Also based on the same inventive concept above, an embodiment of the present application also discloses a computer-readable storage medium, wherein the readable storage medium stores at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by a processor to implement any one of the LoRa-based data transmission methods described above.

[0158] Those skilled in the art should understand that all or part of the steps to implement the above embodiments may be completed by hardware, or may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium. The above-mentioned storage medium may include, for example: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.

[0159] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.

Claims

1. A data transmission method based on LoRa, characterized in that: Contains the data sending process, which specifically includes the following steps: Determine whether a complete data packet needs to be split according to a preset data packet splitting rule, selectively unpack the complete data packet according to the determination result to obtain one or more data frames to be transmitted, and add a frame header field to each of the data packets to be transmitted to obtain communication data frames with the same number and corresponding content as the data frames to be transmitted; Adding the communication data frames to a sending buffer, and sequentially sending the communication data frames from the sending buffer to a receiving end; Obtain a reception confirmation frame returned by the receiving end, each of the reception confirmation frames corresponding to one or more communication data frames, delete the communication data frames corresponding to the reception confirmation frames from the sending buffer, and repeatedly send the remaining communication data frames in the sending buffer to the receiving end until the sending buffer is cleared.

2. The data transmission method based on LoRa according to claim 1, characterized in that: The method of judging whether a complete data packet needs to be split according to a preset data packet splitting rule, selectively unpacking the complete data packet according to the judgment result to obtain one or more data frames to be transmitted, adding a frame header field to each of the data packets to be transmitted, and obtaining communication data frames with the same number and corresponding content as the data frames to be transmitted specifically includes the following steps: Compare the byte length of the complete data packet with the preset maximum transmission unit number; if the byte length of the complete data packet does not exceed the maximum transmission unit number, directly treat the complete data packet as a data frame to be transmitted; if the byte length of the complete data packet exceeds the maximum transmission unit number, split the complete data packet based on the maximum transmission unit number to obtain multiple data frames to be transmitted; A frame header field is added to each of the data frames to be transmitted respectively, wherein the frame header field includes at least a frame check code for valid frame identification and a frame sequence number for packet assembly, and each of the data frames to be transmitted to which the frame header field is added is used as a communication data frame.

3. The data transmission method based on LoRa according to claim 1, characterized in that: The step of obtaining a reception confirmation frame returned by the receiving end, each of the reception confirmation frames corresponding to one or more communication data frames, deleting the communication data frames corresponding to the reception confirmation frames from the sending buffer, and repeatedly sending the remaining communication data frames in the sending buffer to the receiving end until the sending buffer is cleared, specifically comprises the following steps: Obtaining a reception confirmation frame returned by the receiving end according to a preset response rule, each of the reception confirmation frames corresponding to one or more communication data frames; Determine all the communication data frames corresponding to the reception confirmation frame, delete the determined communication data frames from the sending buffer, and resend the remaining communication data frames in the sending buffer to the receiving end; When all the communication data frames in the sending buffer are deleted, it is confirmed that the receiving end has completely received all the complete data packets, and then the acquisition of the reception confirmation frame from the receiving end is stopped.

4. A data transmission method based on LoRa, characterized in that: Contains the data receiving process, which specifically includes the following steps: Receiving a communication data frame from a transmitting end, judging whether the current communication data frame is valid according to a frame header field of the communication data frame, and selectively adding the communication data frame to a receiving buffer according to the judging result; Generate a reception confirmation frame in the form of an incremental sequence number or a bit mask according to a preset response rule, and return the reception confirmation frame to the sending end, each of the reception confirmation frames corresponding to one or more of the communication data frames; When it is confirmed that there are communication data frames in the receiving buffer that can be pieced together to form a complete data packet based on the frame header field of the communication data frame, the corresponding communication data frames are pieced together to obtain a complete data packet, the communication data frames that have completed the pieced together processing are deleted from the receiving buffer, and the communication data frames from the sending end are continuously received until the receiving buffer is cleared.

5. The LoRa-based data transmission method according to claim 4, characterized in that: The receiving of the communication data frame from the transmitting end, judging whether the current communication data frame is valid according to the frame header field of the communication data frame, and selectively adding the communication data frame to the receiving buffer according to the judging result, specifically comprises the following steps: Receive the communication data frame sent by the sending end, parse the frame header field of each communication data frame one by one, the frame header field at least includes a frame check code for valid frame identification and a frame sequence number used as a basis for packet assembly; if the frame header field conforms to a preset format and the frame check code is correct, add the communication data frame to a receiving buffer; if the frame header field does not conform to a preset format or the frame check code is incorrect, discard the communication data frame.

6. The LoRa-based data transmission method according to claim 4, characterized in that: The step of generating a reception confirmation frame in the form of an incremental sequence number or a bit mask according to a preset response rule, and returning the reception confirmation frame to the transmitting end, wherein each reception confirmation frame corresponds to one or more communication data frames, specifically comprises the following steps: When the received communication data frame includes a response request or the number of the received communication data frames reaches a preset response threshold, generating a first confirmation frame in the form of an incremental sequence number and a second confirmation frame in the form of a bit mask according to the received communication data frame; Compare the data volume of the first confirmation frame and the second confirmation frame, take the one with the smaller data volume as the reception confirmation frame, each of the reception confirmation frames corresponds to one or more of the communication data frames, and return the reception confirmation frame to the sending end.

7. The LoRa-based data transmission method according to claim 5, characterized in that: When it is confirmed that there are communication data frames in the receiving buffer that can be pieced together into a complete data packet according to the frame header field of the communication data frame, the corresponding communication data frames are pieced together to obtain a complete data packet, the communication data frames that have completed the pieced together processing are deleted from the receiving buffer, and the communication data frames from the sending end are continuously received until the receiving buffer is cleared, which specifically includes the following steps: The frame header fields of all the communication data frames in the receiving buffer are counted in real time, and whether there are communication data frames that can be pieced together into a complete data packet in the current receiving buffer according to the frame header fields; if so, all the communication data frames that can be pieced together are selected, and the selected communication data frames are sorted and pieced together according to the frame sequence numbers to obtain a complete data packet, and then the selected communication data frames are deleted from the receiving buffer; if not, the communication data frames sent by the sending end are continuously received; When at least one complete data packet is obtained and all the communication data frames in the receiving buffer are deleted, it is confirmed that the sending end has completely sent all the complete data packets, and then the reception of the communication data frames from the sending end, the generation and return of the reception confirmation frame are stopped.

8. A data transmission system based on LoRa, characterized in that: Contains data sending module, including the following modules: A data packet splitting module is configured to determine whether a complete data packet needs to be split according to a preset data packet splitting rule, and selectively unpack the complete data packet according to the determination result to obtain one or more data frames to be transmitted, and respectively add a frame header field to each of the data packets to be transmitted to obtain communication data frames with the same number and corresponding content as the data frames to be transmitted; A data frame sending module, configured to add the communication data frames to a sending buffer, and send the communication data frames in sequence from the sending buffer to a receiving end; A confirmation frame processing module is configured to obtain a reception confirmation frame returned by the receiving end, each of the reception confirmation frames corresponding to one or more communication data frames, delete the communication data frames corresponding to the reception confirmation frames from the sending buffer, and repeatedly send the remaining communication data frames in the sending buffer to the receiving end until the sending buffer is cleared.

9. A data transmission system based on LoRa, characterized in that: Contains data receiving module, including the following modules: A data frame receiving module is configured to receive a communication data frame from a transmitting end, determine whether the current communication data frame is valid according to a frame header field of the communication data frame, and selectively add the communication data frame to a receiving buffer according to the determination result; A confirmation frame generation module is configured to generate a reception confirmation frame in the form of an incremental sequence number or a bit mask according to a preset response rule, and return the reception confirmation frame to the sending end, each of the reception confirmation frames corresponding to one or more of the communication data frames; The data packet splicing module is configured to, when confirming, based on the frame header field of the communication data frame, that there are communication data frames in the receiving buffer that can be spliced ​​into a complete data packet, perform splicing processing on the corresponding communication data frames to obtain a complete data packet, delete the communication data frames that have completed the splicing processing from the receiving buffer, and continue to receive the communication data frames from the sending end until the receiving buffer is cleared.

10. An intelligent terminal, characterized in that: It includes a memory and a processor, wherein the memory stores at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by the processor to implement the LoRa-based data transmission method as described in any one of claims 1 to 3 or 4 to 7.

11. A computer-readable storage medium, characterized in that: The readable storage medium stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, at least one program, a code set or an instruction set is loaded and executed by a processor to implement the LoRa-based data transmission method as described in any one of claims 1 to 3 or 4 to 7.