Data transmission method, device, equipment and system
By introducing preset data protocols and cyclic retransmission mechanisms in the data transmission in the automotive electronics field, the problem of low efficiency of data transmission protocols in the prior art is solved, and reliable data transmission between the host computer and the domain controller is realized.
Patent Information
- Application Number
- CN202411351451.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-26
- Publication Date
- 2025-01-03
- Estimated Expiration
- 2044-09-26
AI Technical Summary
The existing data transmission protocol in the field of automotive electronics is inefficient, especially in the data interaction between the upper computer and the domain controller. The lack of reliability and rigorous timeout retransmission mechanisms lead to network storms and inefficient transmission.
The data to be transmitted is encapsulated using a preset data protocol, sends request data packets and detects response data packets, determines the transmission status based on the detection results, and ensures reliable data transmission through a cyclic retransmission mechanism and a timer mechanism.
By introducing data request and reply protocols, a reliable transmission framework is built, which improves the reliability and efficiency of data transmission, avoids network storms, and ensures reliable data transmission between the host computer and the domain controller.
Smart Images

Figure CN119254857A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of automotive electronic technology, and in particular to data transmission methods, devices, equipment and systems. Background Art
[0002] In the field of automotive electronics, the executable program running in the domain controller is called the lower computer, which usually implements related algorithm functions. However, in the development and debugging stage, in order to improve R&D efficiency, it is usually used in conjunction with the upper computer running on the PC. The most common interaction between the upper computer on the PC and the lower computer on the domain controller is data interaction. The reliability of data interaction is an important factor. Due to problems such as the network and the CPU scheduling of the domain controller, the data interaction between the upper computer and the domain controller is likely to be lost, so a reliable communication protocol is required. On the other hand, the amount of data interaction between the upper computer and the domain controller is large, so the communication efficiency also needs to be considered. The existing inter-board data interaction generally does not set reliable transmission. Even if there is a simple timeout retransmission mechanism, there is no strict timeout retransmission mechanism. This simple timeout retransmission mechanism will cause network storms and low transmission efficiency. Summary of the invention
[0003] The main purpose of this application is to provide a data transmission method, device, equipment and system, aiming to solve the technical problem of low efficiency of existing data transmission protocols.
[0004] To achieve the above object, the present application proposes a data transmission method, which is applied to a data sending end and includes: Encapsulate the data to be transmitted according to the preset data protocol to obtain a request data packet; Sending the request data packet to a data receiving end, so that the data receiving end feeds back a response data packet according to the request data packet; Detecting whether a response data packet fed back by the data receiving end is received within a preset time length, and obtaining a detection result; The data to be transmitted is transmitted according to the detection result.
[0005] In one embodiment, the step of transmitting the data to be transmitted according to the detection result includes: When the detection result is that a response data packet fed back by the data receiving end is received within a preset time period, determining a corresponding data transmission state according to the response data packet; When the data transmission status is a transmission success status, the transmission of the data to be transmitted is completed.
[0006] In one embodiment, the step of transmitting the data to be transmitted according to the detection result includes: When the detection result is that no response data packet fed back by the data receiving end is received within a preset time period, determining the corresponding data protocol type, module function type and current cyclic retransmission times according to the request data packet; Determine a corresponding timeout number threshold and a cyclic retransmission number threshold according to the data protocol type and the module function type; When the current timeout number is less than the timeout number threshold, data transmission is performed according to the current cyclic retransmission number and the cyclic retransmission number threshold.
[0007] In one embodiment, when the current timeout number is less than the timeout number threshold, the step of performing data transmission according to the current cyclic retransmission number and the cyclic retransmission number threshold includes: When the current timeout number is less than the timeout number threshold, comparing the current cyclic retransmission number with the cyclic retransmission number threshold; When the current cyclic retransmission number is less than the cyclic retransmission number threshold, updating the current cyclic retransmission number according to the preset cyclic number to obtain an updated cyclic retransmission number; An updated request data packet is obtained according to the update cycle retransmission times, and the updated request data packet is sent to a data receiving end.
[0008] In one embodiment, when the detection result is that a response data packet fed back by the data receiving end is received within a preset time period, after the step of determining the corresponding data transmission status according to the response data packet, the step further includes: When the data transmission state is a transmission failure state, determining the corresponding data protocol type, module function type and current cyclic retransmission times according to the request data packet; Determine a corresponding cyclic retransmission number threshold according to the data protocol type and the module function type; When the current cyclic retransmission number is less than the cyclic retransmission number threshold, updating the current cyclic retransmission number according to the preset cyclic number to obtain an updated cyclic retransmission number; An updated request data packet is obtained according to the update cycle retransmission times, and the updated request data packet is sent to a data receiving end.
[0009] To achieve the above object, the present application proposes a data transmission method, which is applied to a data receiving end and includes: When receiving a request data packet sent by a data sending end, performing a verification calculation on the request data packet according to a preset verification algorithm to obtain a target verification value; Compare the target check value with the initial check value in the request data packet to obtain a data check result; When the data verification result is that the data verification is successful, comparing the data protocol type of the request data packet with the target protocol type; When the data protocol type of the request data packet is inconsistent with the target protocol type, data transmission is stopped.
[0010] In one embodiment, when the data verification result is that the data verification is successful, after the step of comparing the data protocol type of the request data packet with the target protocol type, the method further includes: When the data protocol type of the request data packet is consistent with the target protocol type, updating the request data packet according to the successful response protocol to obtain a response data packet; Send the response data packet to the data sending end.
[0011] In addition, to achieve the above-mentioned purpose, the present application also proposes a data transmission device, which is applied to a data sending end, and the data transmission device includes: An encapsulation module is used to encapsulate the data to be transmitted according to a preset data protocol to obtain a request data packet; A sending module, used for sending the request data packet to a data receiving end, so that the data receiving end feeds back a response data packet according to the request data packet; A processing module, used to detect whether a response data packet fed back by the data receiving end is received within a preset time length, and obtain a detection result; A transmission module is used to transmit the data to be transmitted according to the detection result.
[0012] In addition, to achieve the above objectives, the present application also proposes a data transmission device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the data transmission method described above.
[0013] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the data transmission method described above are implemented.
[0014] In addition, to achieve the above-mentioned purpose, the present application also provides a data transmission system, characterized in that the data transmission system includes a data sending end as described in any one of claims 1 to 5 and a data receiving end as described in any one of claims 6 to 7.
[0015] This application encapsulates the data to be transmitted according to a preset data protocol to obtain a request data packet; sends the request data packet to the data receiving end so that the data receiving end feeds back a response data packet according to the request data packet; detects whether the response data packet fed back by the data receiving end is received within a preset time length to obtain a detection result; and transmits the data to be transmitted according to the detection result. By introducing two data types, data request and response, a framework of a reliable protocol is built, so that data between the host computer and the domain controller can be reliably transmitted. Finally, according to the functionality of each module, two mechanisms, timer and loop value, are added according to the loop algorithm, which can ensure the efficiency of the data protocol on the basis of user customization while ensuring reliable retransmission of the data protocol. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0017] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0018] Figure 1 A flowchart of a data transmission method embodiment 1 of the present application applied to a data sending end is provided; Figure 2 A data protocol diagram provided for the first embodiment of the data transmission method of the present application applied to a data sending end; Figure 3 A schematic diagram of a data protocol type interaction model provided for the first embodiment of the data transmission method of the present application applied to a data sending end; Figure 4 A schematic diagram of the overall framework of a data protocol provided in Embodiment 1 of the data transmission method of the present application applied to a data sending end; Figure 5 A schematic diagram of a REQ protocol reliability verification process provided in Embodiment 1 of the data transmission method of the present application applied to a data sending end; Figure 6 A flowchart diagram of a second embodiment of a data transmission method for a data receiving end provided by the present application; Figure 7 A schematic diagram of a data receiving end protocol processing flow provided in Embodiment 2 of the data transmission method applied to a data receiving end of the present application; Figure 8 A schematic diagram of a cycle value calculation algorithm for each module provided in Embodiment 2 of the data transmission method applied to a data receiving end of the present application; Fig. 9 This is a schematic diagram of the module structure of a data transmission device applied to a data sending end in the present application; Fig.10 A schematic diagram of the device structure of the hardware operating environment involved in the data transmission method in the embodiment of the present application; Fig.11 This is a schematic diagram of the module structure of the data transmission system according to an embodiment of the present application.
[0019] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0020] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0021] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0022] The main solution of the embodiment of the present application is: encapsulate the data to be transmitted according to a preset data protocol to obtain a request data packet; send the request data packet to the data receiving end so that the data receiving end feeds back a response data packet according to the request data packet; detect whether the response data packet fed back by the data receiving end is received within a preset time length to obtain a detection result; transmit the data to be transmitted according to the detection result.
[0023] In the field of automotive electronics, the executable program running in the domain controller is called the lower computer, which usually implements related algorithm functions. However, in the development and debugging stage, in order to improve R&D efficiency, it is usually used in conjunction with the upper computer running on the PC. The most common interaction between the upper computer on the PC and the lower computer on the domain controller is data interaction. The reliability of data interaction is an important factor. Due to problems such as the network and the CPU scheduling of the domain controller, the data interaction between the upper computer and the domain controller is likely to be lost, so a reliable communication protocol is required. On the other hand, the amount of data interaction between the upper computer and the domain controller is large, so the communication efficiency also needs to be considered. The existing inter-board data interaction generally does not set reliable transmission. Even if there is a simple timeout retransmission mechanism, there is no strict timeout retransmission mechanism. This simple timeout retransmission mechanism will cause network storms and low transmission efficiency.
[0024] This application encapsulates the data to be transmitted according to a preset data protocol to obtain a request data packet; sends the request data packet to the data receiving end so that the data receiving end feeds back a response data packet according to the request data packet; detects whether the response data packet fed back by the data receiving end is received within a preset time length to obtain a detection result; and transmits the data to be transmitted according to the detection result. By introducing two data types, data request and response, a framework of a reliable protocol is built, so that data between the host computer and the domain controller can be reliably transmitted. Finally, according to the functionality of each module, two mechanisms, timer and loop value, are added according to the loop algorithm, which can ensure the efficiency of the data protocol on the basis of user customization while ensuring reliable retransmission of the data protocol.
[0025] It should be noted that the execution subject of this embodiment may be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or a data transmission device capable of realizing the above functions, etc. The following takes the data transmission device as the execution subject as an example to illustrate this embodiment and the following embodiments.
[0026] Based on this, an embodiment of the present application provides a data transmission method, which is applied to a data sending end, referring to Figure 1 , Figure 1 This is a flow chart of a first embodiment of a data transmission method of the present application applied to a data sending end.
[0027] In this embodiment, the data transmission method includes steps S10 to S40: Step S10, encapsulating the data to be transmitted according to a preset data protocol to obtain a request data packet; It should be noted that the domain controller and the host computer in this embodiment exchange data through the network, use the lightweight communication group LCM protocol for underlying data transmission, and in order to achieve reliable communication, a custom data protocol packet is encapsulated in the application layer. The custom data protocol design scheme is as follows: Figure 2 The custom data protocol consists of an 18-byte header and an M-byte data field. The M bytes are filled with actual data. The protocol header is used for data verification and reliable communication information transmission. The protocol data is uniformly packaged before sending, and the received data segment is unpacked. The specific definition of the 18-byte header is shown in Table 1.
[0028] Table 1
[0029] It should be noted that the data types between the domain controller and the host computer in this embodiment are of two types: request and response. Figure 3As shown: When the data sender needs to send data, the data type is the request protocol REQ, and the timer will start after the data is sent. When the data receiver receives the correct REQ request protocol data, it will immediately send the response protocol ACK. After the data sender receives the response protocol ACK of the same ID, the timer stops timing, and a complete data protocol process is completed.
[0030] It should be understood that the overall framework of the data protocol in this embodiment is as follows Figure 4 As shown. It mainly includes three types: sending data callback function, receiving data callback function and error event. These three types of events are included in both the host computer and the domain controller. 101 is the data sending callback function, which is mainly responsible for sending data, including filling the packet, starting the timer after sending the packet and waiting for a response; 102 is the receiving data callback function, which is mainly responsible for receiving data, including unpacking, checking CRC and feedback; 103 is the error event module, which is mainly responsible for judging whether the data packet is correct, including the judgment of the timer exceeding the threshold and the CRC check judgment.
[0031] It can be understood that the preset data protocol refers to a pre-set request data protocol (REQ, Request Data Protocol), that is, a custom data protocol in this embodiment, the data to be transmitted refers to the actual data to be transmitted, and the request data packet refers to an encapsulated data packet whose data type is the request protocol.
[0032] In a specific implementation, the actual data to be transmitted is encapsulated according to a preset request data protocol to obtain an encapsulated data packet whose data type is the request protocol, that is, the actual data to be transmitted is filled into the M-byte data field in the custom data protocol for encapsulation, and finally an encapsulated data packet whose data type is the request protocol is obtained from the 18-byte byte header and the M-byte data field.
[0033] Step S20, sending the request data packet to the data receiving end, so that the data receiving end feeds back a response data packet according to the request data packet; It can be understood that the response data packet refers to a data packet whose data type is a response protocol.
[0034] In a specific implementation, an encapsulated data packet whose data type is a request protocol is sent to a data receiving end, so that after the data receiving end receives the correct REQ request protocol data, it immediately feeds back a data packet of an acknowledgement protocol ACK to the data sending end, wherein the acknowledgement protocol ACK includes an acknowledgement OK ACK protocol and an acknowledgement FAIL ACK protocol. In the acknowledgement mechanism, OK ACK and FAIL ACK are usually used to indicate whether the message is processed correctly.
[0035] Step S30, detecting whether a response data packet fed back by the data receiving end is received within a preset time length, and obtaining a detection result; It can be understood that the preset duration refers to the preset duration for monitoring whether the ACK protocol is received, and the detection result refers to the result of monitoring whether the ACK protocol data packet is received.
[0036] In the specific implementation, when the data sending end sends the request REQ data packet, the timer will be started immediately. The timer will count every 1 second, and then wait for the response ACK protocol data packet from the data receiving end. If the response ACK protocol is not received within the preset monitoring time of whether the response ACK protocol is received, the timer will wait for the timer to time out; if the above-mentioned FAIL ACK type is received, the timer will end actively, which means that the receiving end has not received the data or the received data is incorrect and the sender needs to send the data again; if the above-mentioned OK ACK type is received, it means that the data interaction is successful and the process ends.
[0037] Step S40: transmitting the data to be transmitted according to the detection result.
[0038] It can be understood that the detection results include the results of receiving the response ACK protocol data packet and the results of not receiving the response ACK protocol data packet, and the results of receiving the response ACK protocol data packet include FAIL ACK type and OK ACK type data packets. Therefore, different data transmission methods are adopted according to different detection results to transmit the data to be transmitted.
[0039] In a feasible implementation, step S40 may include steps A41-A42: Step A41, when the detection result is that a response data packet fed back by the data receiving end is received within a preset time period, determining a corresponding data transmission state according to the response data packet; It can be understood that the data transmission status includes a transmission failure status and a transmission success status.
[0040] In a specific implementation, when the detection result is that a response data packet fed back by the data receiving end is received within a preset time length, it is necessary to determine whether the protocol type Type in the protocol header is FAIL ACK to determine the data transmission status, where if the protocol type is FAIL ACK, the data transmission status is a transmission failure status; if the protocol type is OK ACK, the data transmission status is a transmission success status.
[0041] In a feasible implementation, step A41 may include steps B411 to B414: Step B411, when the data transmission state is a transmission failure state, determining the corresponding data protocol type, module function type and current cyclic retransmission times according to the request data packet; It can be understood that the data protocol types include REQ protocol and ACK protocol (OK ACK and FAIL ACK), the module function types include Common, APA, Fusion, AVM and MidWare, and the current cycle retransmission number refers to the protocol cycle transmission number recorded in the byte header of the current request data packet.
[0042] In the specific implementation, when the data transmission status is a transmission failure status, it indicates that the data receiving end has not received the data or the received data is incorrect and the data sending end needs to repeat the data transmission, and then determine the corresponding data protocol type, module function type and the current protocol cycle transmission times according to the byte header of the request data packet.
[0043] Step B412, determining a corresponding cyclic retransmission number threshold according to the data protocol type and the module function type; It can be understood that the cyclic retransmission number threshold refers to a critical value of the number of times used to determine whether to send the current protocol data packet.
[0044] In the specific implementation, in this embodiment, the same message cannot be sent repeatedly indefinitely, which will waste network bandwidth and cause subsequent messages to fail to be sent. Therefore, it is determined whether the current protocol data packet is the same message based on the data protocol type. If it is the same message, the critical value of the number of times used to determine whether to send the current protocol data packet is determined based on the corresponding module function type.
[0045] Step B413, when the current cyclic retransmission number is less than the cyclic retransmission number threshold, updating the current cyclic retransmission number according to the preset cyclic number to obtain an updated cyclic retransmission number; It can be understood that the preset number of cycles refers to the preset increased number of cycles 1, and the updated number of cycle retransmissions refers to the updated number of protocol cycle transmissions.
[0046] In a specific implementation, the number of protocol cycle sending times recorded in the byte header of the current request data packet is compared with the critical value of the number used to determine whether to send the current protocol data packet. When the number of protocol cycle sending times recorded in the byte header of the current request data packet is less than the critical value of the number of times used to determine whether to send the current protocol data packet, it indicates that the data sending end needs to repeatedly send data, and then the sum of the pre-set increased cycle number 1 and the protocol cycle sending number recorded in the byte header of the current request data packet is calculated to obtain an updated protocol cycle sending number.
[0047] Step B414, obtaining an updated request data packet according to the update cycle retransmission times, and sending the updated request data packet to the data receiving end.
[0048] In a specific implementation, the cycle code (CYCLE) in the byte header of the request data packet is adjusted based on the updated number of protocol cycle transmissions to obtain an updated request data packet, and the updated request data packet is sent to the data receiving end to complete the repeated transmission of data.
[0049] Step A42, when the data transmission status is a transmission success status, completing the transmission of the data to be transmitted.
[0050] In the specific implementation, if a response ACK protocol data packet is received, it is necessary to determine whether the protocol type Type in the protocol header is FAIL ACK. If not, it means that the data transmission status is a successful transmission status (the protocol type is OKACK), that is, the data interaction is successful and the process ends.
[0051] In a feasible implementation, step S40 may include steps B41 to B43: Step B41, when the detection result is that no response data packet fed back by the data receiving end is received within a preset time period, determining the corresponding data protocol type, module function type and current cyclic retransmission times according to the request data packet; In a specific implementation, when the detection result is that no response data packet is received from the data receiving end within a preset time period, it indicates that the waiting timer has timed out, that is, it is necessary to determine the number of timer timeouts based on the protocol type (Type) and module type (Module) of the sent data protocol packet, and then determine the corresponding data protocol type, module function type and the number of times the current protocol is sent in a cycle based on the byte header of the request data packet.
[0052] Step B42, determining a corresponding timeout number threshold and a cyclic retransmission number threshold according to the data protocol type and the module function type; It can be understood that the timeout number threshold refers to the critical value of the timeout number used to determine whether to resend data.
[0053] In the specific implementation, in this embodiment, the same message cannot be sent repeatedly indefinitely, which will waste network bandwidth and cause subsequent messages to fail to be sent. Therefore, it is determined whether the current protocol data packet is the same message based on the data protocol type. If it is the same message, the critical value of the number of times used to determine whether to send the current protocol data packet and the critical value of the timeout number used to determine whether to resend the data are determined based on the corresponding module function type.
[0054] Step B43: When the current timeout number is less than the timeout number threshold, data transmission is performed according to the current cyclic retransmission number and the cyclic retransmission number threshold.
[0055] In a specific implementation, when the number of times the current waiting timer times out is less than the critical value of the number of timeouts used to determine whether to resend data, it indicates that the conditions for resending data are met, and when the number of protocol cycle transmissions recorded in the byte header of the current request data packet is less than the critical value of the number of times used to determine whether to send the current protocol data packet, it indicates that the data sending end needs to repeat the data transmission, and then the sum of the pre-set increased cycle number 1 and the protocol cycle transmission number recorded in the byte header of the current request data packet is calculated to obtain an updated protocol cycle transmission number, and the cycle code (CYCLE) in the byte header of the request data packet is adjusted based on the updated protocol cycle transmission number to obtain an updated request data packet, and the updated request data packet is sent to the data receiving end to complete the repeated transmission of data.
[0056] In a feasible implementation, step B43 may include steps C431 to C433: Step C431, when the current timeout number is less than the timeout number threshold, compare the current cyclic retransmission number with the cyclic retransmission number threshold; It can be understood that the number of times the current waiting timer times out is compared with the critical value of the timeout number used to determine whether to resend the data. When the number of times the current waiting timer times out is less than the critical value of the timeout number used to determine whether to resend the data, the number of protocol cycle sending times recorded in the byte header of the current request data packet is compared with the critical value of the number of times used to determine whether to send the current protocol data packet.
[0057] Step C432, when the current cyclic retransmission number is less than the cyclic retransmission number threshold, updating the current cyclic retransmission number according to the preset cyclic number to obtain an updated cyclic retransmission number; In a specific implementation, when the number of protocol cycle sending times recorded in the byte header of the current request data packet is less than the critical value used to determine whether to send the current protocol data packet, it indicates that the data sending end needs to repeatedly send data, and then the sum of the pre-set increased cycle number 1 and the protocol cycle sending number recorded in the byte header of the current request data packet is calculated to obtain the updated protocol cycle sending number.
[0058] Step C433, obtaining an updated request data packet according to the update cycle retransmission times, and sending the updated request data packet to the data receiving end.
[0059] In a specific implementation, the cycle code (CYCLE) in the byte header of the request data packet is adjusted based on the updated number of protocol cycle transmissions to obtain an updated request data packet, and the updated request data packet is sent to the data receiving end to complete the repeated transmission of data.
[0060] It should be noted that if the interactive data in this embodiment is a REQ request data packet, it is also necessary to start a timer and a subsequent transmission reliability verification process, such as Figure 5 As shown. When the data sending callback function sends the request REQ data packet, the timer will be started immediately, and the timer will count every 1 second. Then wait for the response ACK protocol data packet from the data receiving end. If the response ACK protocol data packet is received, it is necessary to determine whether the protocol type Type in the protocol header is FAILACK. If not, it means that the data interaction is successful and the process ends. If the above-mentioned FAIL ACK type is received, the timer will automatically end, which means that the receiver has not received the data or the received data is incorrect and the sender needs to send the data again. Before repeated transmission, it is necessary to determine whether CYCLE exceeds the threshold based on the protocol type Type and Module. If it does not exceed the threshold, the ID in the protocol header of the data being sent remains unchanged and still indicates that the data needs to be sent, but the CYCLE field needs to be increased by 1 at this time. On the contrary, if it exceeds the threshold, the protocol packet will no longer be sent, indicating that the link is not connected at this time and no network resources are wasted. If the sender does not receive the response ACK protocol, it will wait for the timer to time out. The timer will determine the number of timer timeouts based on the Type and Module of the data protocol packet being sent. After the timer times out, the repeated transmission stage will be carried out in the same way as the above process.
[0061] This embodiment encapsulates the data to be transmitted according to a preset data protocol to obtain a request data packet; sends the request data packet to the data receiving end so that the data receiving end feeds back a response data packet according to the request data packet; detects whether the response data packet fed back by the data receiving end is received within a preset time length to obtain a detection result; and transmits the data to be transmitted according to the detection result. By introducing two data types, data request and response, a reliable protocol framework is built, so that data between the host computer and the domain controller can be reliably transmitted. Finally, according to the functionality of each module, two mechanisms, timer and loop value, are added according to the loop algorithm, which can ensure the efficiency of the data protocol on the basis of user customization while ensuring reliable retransmission of the data protocol.
[0062] In addition, the present application embodiment provides a data transmission method, which is applied to a data receiving end. Figure 6 , Figure 6 This is a flow chart of a first embodiment of a data transmission method of the present application applied to a data receiving end.
[0063] In this embodiment, the data transmission method applied to the data receiving end includes steps S01 to S04: Step S01, when receiving a request data packet sent by a data sending end, performing verification calculation on the request data packet according to a preset verification algorithm to obtain a target verification value; It can be understood that the preset check algorithm refers to a pre-set CRC check algorithm, and the target check value refers to a check value calculated by the data receiving end.
[0064] In the specific implementation, after receiving the protocol data, the data receiving end needs to unpack it, and first needs to perform a CRC check on the protocol header to verify the correctness of the protocol packet. That is, the check value of the request data packet is calculated by a pre-set CRC check algorithm, and finally the check value calculated by the data receiving end is obtained.
[0065] Step S02, comparing the target check value with the initial check value in the request data packet to obtain a data check result; It can be understood that the initial check value refers to the check value in the byte header of the request data packet, and the data check result includes a data check success result and a data check failure result.
[0066] In a specific implementation, the check value calculated by the data receiving end is compared with the check value in the byte header of the request data packet. When the check value calculated by the data receiving end is consistent with the check value in the byte header of the request data packet, the data verification result is determined to be a successful data verification result; when the check value calculated by the data receiving end is inconsistent with the check value in the byte header of the request data packet, the data verification result is determined to be a failed data verification result.
[0067] Step S03, when the data verification result is that the data verification is successful, comparing the data protocol type of the request data packet with the target protocol type; It can be understood that the target protocol type refers to a preset protocol type (request protocol).
[0068] In a specific implementation, when the data verification result is that the data verification is successful, it continues to check whether it is a request REQ protocol packet, thereby obtaining the data type corresponding to the request data packet, and then comparing the data protocol type of the request data packet with the target protocol type to determine whether the data protocol type of the request data packet is a pre-set protocol type (request protocol).
[0069] Step S04, when the data protocol type of the request data packet is inconsistent with the target protocol type, stop data transmission.
[0070] In a specific implementation, when the data protocol type of the request data packet is inconsistent with the target protocol type, it means that the received protocol data packet is not a request REQ packet but a response ACK packet, so no subsequent process is required, that is, data transmission is stopped.
[0071] In a feasible implementation, step S04 may include steps A041-A042: Step A041, when the data protocol type of the request data packet is consistent with the target protocol type, the request data packet is updated according to the successful response protocol to obtain a response data packet; In a specific implementation, when the data protocol type of the request data packet is consistent with the target protocol type, indicating that the received protocol data packet is a request REQ protocol packet, it is necessary to respond to the send packet to send a response ACK protocol packet to the data sender, and then obtain a response data packet, wherein the ID and CYCLE in the packet header of the response ACK protocol packet remain unchanged, only the Type is changed to the OK ACK protocol type.
[0072] Step A042, sending the response data packet to the data sending end.
[0073] In a specific implementation, the response data packet is sent to the data sending end, so that the data sending end determines whether the protocol type of the response data packet is FAIL ACK. If not, it means that the data interaction is successful and the data transmission process is completed.
[0074] It should be noted that the protocol processing flow of the data receiving end of this embodiment is as follows: Figure 7 As shown: After receiving the protocol data, the data receiving end needs to unpack it. First, it needs to perform a CRC check on the protocol header to verify the correctness of the protocol packet. If the CRC check is correct, continue to check whether it is a request REQ protocol packet. If it is not a request REQ packet, it means it is a response ACK packet and no subsequent process is required. If it is a request REQ protocol packet, it is necessary to respond to the sending packet and send a response ACK protocol packet. The ID and CYCLE in the packet header of this response ACK protocol packet remain unchanged, but the Type is changed to the OK ACK protocol type. If the data receiving end finds an error when performing a data CRC check on the received protocol packet, it means that the packet is wrong and it is necessary to send a failure response FAIL ACK protocol packet to the data sending end. The ID of this protocol packet remains unchanged, but the CYCLE needs to be increased by 1.
[0075] It should be noted that, in addition to ensuring the interaction of data packets through a confirmation response mechanism, the communication protocol of this embodiment also adds a timer Timer for a timeout retransmission mechanism. This timer allows the sender to resend the message if it does not receive feedback from the receiver within a specified time, thereby ensuring reliable transmission of the message. However, the same message cannot be sent repeatedly indefinitely, which will waste network bandwidth and cause subsequent messages to fail to be sent. Therefore, a cycle limitation mechanism, namely the CYCLE field, is added. Each protocol packet has a fixed number of retransmissions. When the CYCLE value of the number of retransmissions is exceeded, the protocol packet will no longer be sent regardless of whether it is sent correctly. In a large project, different modules have primary and secondary functions, and message transmission also needs to have primary and secondary functions. Therefore, the timer Timer and the number of cyclic retransmissions CYCLE in the present invention are based on different modules according to the following Figure 8 The algorithm shown is calculated. Figure 8 Each module accumulates the cyclic value according to four conditions: whether it is the main functional module, whether the functional module cycle period is less than 10ms, whether the single transfer byte is less than 1024Byte, and whether the parameters in the transfer byte are common to multiple modules.
[0076] It can be understood that the FAPA system of this embodiment obtains the main module cycle values in Table 2 according to the module cycle value calculation algorithm, among which the Common module and Midware module have a cycle value greater than 1 because they are the common parts of each module.
[0077] Table 2
[0078] This embodiment verifies and calculates the request data packet sent by the data sending end according to a preset verification algorithm to obtain a target verification value when receiving the request data packet sent by the data sending end; compares the target verification value with the initial verification value in the request data packet to obtain a data verification result; when the data verification result is that the data verification is successful, compares the data protocol type of the request data packet with the target protocol type; when the data protocol type of the request data packet is inconsistent with the target protocol type, stops data transmission. The above method improves the efficiency of data transmission.
[0079] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the data transmission method of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.
[0080] This application also provides a data transmission device, please refer to Fig. 9 , the data transmission device is applied to the data sending end, and the data transmission device applied to the data sending end includes: The encapsulation module 10 is used to encapsulate the data to be transmitted according to a preset data protocol to obtain a request data packet; A sending module 20, configured to send the request data packet to a data receiving end, so that the data receiving end feeds back a response data packet according to the request data packet; The processing module 30 is used to detect whether a response data packet fed back by the data receiving end is received within a preset time period, and obtain a detection result; The transmission module 40 is used to transmit the data to be transmitted according to the detection result.
[0081] In one embodiment, the transmission module 40 is further used for: When the detection result is that a response data packet fed back by the data receiving end is received within a preset time period, determining a corresponding data transmission state according to the response data packet; When the data transmission status is a transmission success status, the transmission of the data to be transmitted is completed.
[0082] In one embodiment, the transmission module 40 is further used for: When the detection result is that no response data packet fed back by the data receiving end is received within a preset time period, determining the corresponding data protocol type, module function type and current cyclic retransmission times according to the request data packet; Determine a corresponding timeout number threshold and a cyclic retransmission number threshold according to the data protocol type and the module function type; When the current timeout number is less than the timeout number threshold, data transmission is performed according to the current cyclic retransmission number and the cyclic retransmission number threshold.
[0083] In one embodiment, the transmission module 40 is further used for: When the current timeout number is less than the timeout number threshold, comparing the current cyclic retransmission number with the cyclic retransmission number threshold; When the current cyclic retransmission number is less than the cyclic retransmission number threshold, updating the current cyclic retransmission number according to the preset cyclic number to obtain an updated cyclic retransmission number; An updated request data packet is obtained according to the update cycle retransmission times, and the updated request data packet is sent to a data receiving end.
[0084] In one embodiment, the transmission module 40 is further used for: When the data transmission state is a transmission failure state, determining the corresponding data protocol type, module function type and current cyclic retransmission times according to the request data packet; Determine a corresponding cyclic retransmission number threshold according to the data protocol type and the module function type; When the current cyclic retransmission number is less than the cyclic retransmission number threshold, updating the current cyclic retransmission number according to the preset cyclic number to obtain an updated cyclic retransmission number; An updated request data packet is obtained according to the update cycle retransmission times, and the updated request data packet is sent to a data receiving end.
[0085] The present application also provides a data transmission device, which is applied to a data receiving end. The data transmission device applied to the data receiving end includes: The receiving module 01 is used to perform verification calculation on the request data packet according to a preset verification algorithm to obtain a target verification value when receiving the request data packet sent by the data sending end; Comparison module 02, used to compare the target verification value with the initial verification value in the request data packet to obtain a data verification result; The comparison module 02 is further configured to compare the data protocol type of the request data packet with the target protocol type when the data verification result is that the data verification is successful; The control module 03 is used to stop data transmission when the data protocol type of the request data packet is inconsistent with the target protocol type.
[0086] In one embodiment, the comparison module 02 is further configured to: When the data protocol type of the request data packet is consistent with the target protocol type, updating the request data packet according to the successful response protocol to obtain a response data packet; Send the response data packet to the data sending end.
[0087] The data transmission device provided by the present application adopts the data transmission method in the above embodiment, which can solve the technical problem of low efficiency of the existing data transmission protocol. Compared with the prior art, the beneficial effects of the data transmission device provided by the present application are the same as the beneficial effects of the data transmission method provided by the above embodiment, and other technical features in the data transmission device are the same as the features disclosed in the above embodiment method, which will not be repeated here.
[0088] The present application provides a data transmission device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the data transmission method in the above-mentioned embodiment one.
[0089] Reference below Fig.10, which shows a schematic diagram of the structure of a data transmission device suitable for implementing the embodiment of the present application. The data transmission device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Fig.10 The data transmission device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0090] like Fig.10 As shown, the data transmission device may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which may perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the data transmission device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems may be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the data transmission device to communicate with other devices wirelessly or by wire to exchange data. Although the data transmission device with various systems is shown in the figure, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.
[0091] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0092] The data transmission device provided by the present application adopts the data transmission method in the above embodiment, which can solve the technical problem of low efficiency of the existing data transmission protocol. Compared with the prior art, the beneficial effects of the data transmission device provided by the present application are the same as the beneficial effects of the data transmission method provided by the above embodiment, and other technical features in the data transmission device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0093] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0094] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0095] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, wherein the computer-readable program instructions are used to execute the data transmission method in the above-mentioned embodiment.
[0096] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM: Random Access Memory), a read-only memory (ROM: Read Only Memory), an erasable programmable read-only memory (EPROM: Erasable Programmable Read Only Memory or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM: CD-Read Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency: Radio Frequency), etc., or any suitable combination of the above.
[0097] The computer-readable storage medium may be included in the data transmission device; or may exist independently without being assembled into the data transmission device.
[0098] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by a data transmission device, the data transmission device: encapsulates the data to be transmitted according to a preset data protocol to obtain a request data packet; sends the request data packet to a data receiving end, so that the data receiving end feeds back a response data packet according to the request data packet; detects whether a response data packet fed back by the data receiving end is received within a preset time length to obtain a detection result; and transmits the data to be transmitted according to the detection result.
[0099] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0100] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0101] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0102] The readable storage medium provided in the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned data transmission method, and can solve the technical problem of low efficiency of existing data transmission protocols. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in the present application are the same as the beneficial effects of the data transmission method provided in the above-mentioned embodiment, and will not be described in detail here.
[0103] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned data transmission method when executed by a processor.
[0104] The computer program product provided by the present application can solve the technical problem of low efficiency of existing data transmission protocols. Compared with the prior art, the beneficial effects of the computer program product provided by the present application are the same as the beneficial effects of the data transmission method provided by the above embodiment, which will not be repeated here.
[0105] In addition, to achieve the above purpose, Fig.11 As shown, the present invention further proposes a data transmission system, which includes the data sending end 10 and the data receiving end 20 mentioned above.
[0106] Since the transmission system adopts all the technical solutions of all the above embodiments, it has at least all the beneficial effects brought by the technical solutions of the above embodiments, which will not be described one by one here.
[0107] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A data transmission method, characterized in that: The data transmission method is applied to a data sending end, and the method comprises: Encapsulate the data to be transmitted according to the preset data protocol to obtain a request data packet; Sending the request data packet to a data receiving end, so that the data receiving end feeds back a response data packet according to the request data packet; Detecting whether a response data packet fed back by the data receiving end is received within a preset time length, and obtaining a detection result; The data to be transmitted is transmitted according to the detection result.
2. The method according to claim 1, characterized in that The step of transmitting the data to be transmitted according to the detection result includes: When the detection result is that a response data packet fed back by the data receiving end is received within a preset time period, determining a corresponding data transmission state according to the response data packet; When the data transmission status is a transmission success status, the transmission of the data to be transmitted is completed.
3. The method according to claim 1, characterized in that The step of transmitting the data to be transmitted according to the detection result includes: When the detection result is that no response data packet fed back by the data receiving end is received within a preset time period, determining the corresponding data protocol type, module function type and current cyclic retransmission times according to the request data packet; Determine a corresponding timeout number threshold and a cyclic retransmission number threshold according to the data protocol type and the module function type; When the current timeout number is less than the timeout number threshold, data transmission is performed according to the current cyclic retransmission number and the cyclic retransmission number threshold.
4. The method according to claim 3, characterized in that The step of performing data transmission according to the current cyclic retransmission number and the cyclic retransmission number threshold when the current timeout number is less than the timeout number threshold comprises: When the current timeout number is less than the timeout number threshold, comparing the current cyclic retransmission number with the cyclic retransmission number threshold; When the current cyclic retransmission number is less than the cyclic retransmission number threshold, updating the current cyclic retransmission number according to the preset cyclic number to obtain an updated cyclic retransmission number; An updated request data packet is obtained according to the update cycle retransmission times, and the updated request data packet is sent to a data receiving end.
5. The method according to claim 2, characterized in that After the step of determining the corresponding data transmission status according to the response data packet when the detection result is that the response data packet fed back by the data receiving end is received within a preset time period, the method further includes: When the data transmission state is a transmission failure state, determining the corresponding data protocol type, module function type and current cyclic retransmission times according to the request data packet; Determine a corresponding cyclic retransmission number threshold according to the data protocol type and the module function type; When the current cyclic retransmission number is less than the cyclic retransmission number threshold, updating the current cyclic retransmission number according to the preset cyclic number to obtain an updated cyclic retransmission number; An updated request data packet is obtained according to the update cycle retransmission times, and the updated request data packet is sent to a data receiving end.
6. A data transmission method, characterized in that: The data transmission method is applied to a data receiving end, and the method comprises: When receiving a request data packet sent by a data sending end, performing a verification calculation on the request data packet according to a preset verification algorithm to obtain a target verification value; Compare the target check value with the initial check value in the request data packet to obtain a data check result; When the data verification result is that the data verification is successful, comparing the data protocol type of the request data packet with the target protocol type; When the data protocol type of the request data packet is inconsistent with the target protocol type, data transmission is stopped.
7. The method according to claim 6, characterized in that After the step of comparing the data protocol type of the request data packet with the target protocol type when the data verification result is that the data verification is successful, the method further includes: When the data protocol type of the request data packet is consistent with the target protocol type, updating the request data packet according to the successful response protocol to obtain a response data packet; Send the response data packet to the data sending end.
8. A data transmission device, characterized in that: The data transmission device is applied to a data transmitting end, and the device comprises: An encapsulation module is used to encapsulate the data to be transmitted according to a preset data protocol to obtain a request data packet; A sending module, used for sending the request data packet to a data receiving end, so that the data receiving end feeds back a response data packet according to the request data packet; A processing module, used to detect whether a response data packet fed back by the data receiving end is received within a preset time length, and obtain a detection result; A transmission module is used to transmit the data to be transmitted according to the detection result.
9. A data transmission device, characterized in that: The device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the data transmission method applied to the data sending end as described in any one of claims 1 to 5 or the steps of the data transmission method applied to the data receiving end as described in claim 6 or 7.
10. A data transmission system, characterized in that: The data transmission system comprises a data transmitting end as described in any one of claims 1 to 5 and a data receiving end as described in any one of claims 6 to 7.
Citation Information
Patent Citations
Method for information dissemination in a communication network
CN101652964A
Vehicle positioning method based on protocol cross-layer optimization
CN105338497A
Distributed real-time communication middleware
CN108040034A
Live streaming data transmission control method and device, live streaming equipment and storage medium
CN108833930A
Vehicle-mounted intelligent data connectionless reliable transmission method
CN113965959A
