Data transmission method, electronic equipment and storage medium

By using verification data and retransmission mechanisms in embedded systems, the stability problems caused by environmental factors in data transmission are solved, and higher communication stability and error handling capabilities are achieved.

CN119921908APending Publication Date: 2025-05-02SHENZHEN LONGSYS ELECTRONICS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311444802.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-10-31
Publication Date
2025-05-02

AI Technical Summary

Technical Problem

In embedded systems, data transmitted by the bus is easily affected by environmental factors, resulting in data loss or rewritten, which in turn affects the stability of data transmission between devices.

Method used

By generating verification data (including a first timing value and/or a first verification code) in the first device, it is transmitted with the request data packet, and checked in the second device, if the rules are not met, it does not respond to prevent error recognition and processing. In addition, if the reply packet is not received within a predetermined time, the first device may retransmit the request packet to improve stability.

Benefits of technology

This method effectively reduces data transmission failures caused by environmental factors, improves the communication interaction stability between the first device and the second device, and reduces the possibility of error recognition and reaction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119921908A_ABST
    Figure CN119921908A_ABST
Patent Text Reader

Abstract

The invention provides a data transmission method, an electronic device and a storage medium, the data transmission method is applied to a first device, the first device is used for communicating and interacting with a second device, the data transmission method comprises the following steps: in response to generation or reception of request data, generating verification data, the verification data comprising a first time sequence value and / or a first verification code, the first verification code is related to the content of the request data, and the first time sequence value is related to the times of outputting the request data packet to the second equipment; generating a request data packet according to the verification data and the request data; outputting the request data packet to the second equipment; when the response data packet is not received within the response time and the output frequency is smaller than an output frequency threshold value, the request data packet is output to the second device again, and the output frequency is the frequency of outputting the request data packet to the second device; and the second equipment is used for outputting the reply data packet to the first equipment when responding to the request data packet conforming to the verification rule.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of embedded technology, and more specifically to a data transmission method, an electronic device and a storage medium. Background Art

[0002] In the field of embedded systems, multiple electronic devices can be connected via a bus. The software system of an electronic device can be divided into an application (APP) layer and a physical layer. A software unit of an electronic device (hereinafter referred to as the first device) can send request data to a software unit of another electronic device (hereinafter referred to as the second device) via the physical layer, and receive the result data packet output by the software unit of the second device via the physical layer.

[0003] When the bus is transmitting data, it is affected by environmental factors (such as electromagnetic interference, poor connector contact, etc.), which may cause data loss or rewriting. Therefore, there is a possibility that the request data output by the first device is lost or rewritten due to environmental factors, resulting in the second device misidentifying or failing to receive the request data, that is, the data transmission between the first device and the second device has the defect of poor stability. Summary of the invention

[0004] In view of the above, it is necessary to provide a data transmission method, an electronic device and a storage medium to solve the above defects.

[0005] In a first aspect, an embodiment of the present application provides a data transmission method, which is applied to a first device, wherein the first device is used to communicate and interact with a second device, and the data transmission method includes: in response to generating or receiving request data, generating verification data, wherein the verification data includes a first timing value and / or a first verification code, the first verification code is related to the content of the request data, and the first timing value is related to the number of times the request data packet is output to the second device; generating a request data packet according to the verification data and the request data; outputting the request data packet to the second device; in response to not receiving a reply data packet within a reply time, and when the output number is less than an output number threshold, outputting the request data packet to the second device again, wherein the output number is the number of times the request data packet is output to the second device, and the second device is used to output the reply data packet to the first device in response to the request data packet meeting the verification rule.

[0006] Optionally, the first device includes a first application unit and a first transmission unit, the first application unit is arranged at the application layer of the first device, the first transmission unit is arranged at the transmission layer of the first device, the first application unit is used to generate or receive the request data, the first transmission unit is used to generate the verification data, and is used to generate the request data packet according to the verification data and the request data; the generating of the request data packet according to the verification data and the request data includes: generating a corresponding request primitive according to the request data; forming the header of the request data packet with the request primitive and the verification data, and forming the data payload of the request data packet with the request data to generate the request data packet.

[0007] Optionally, generating verification data includes: generating the first timing value according to the number of times the request data is generated or received; and calculating the request data through a verification algorithm to obtain the first verification code.

[0008] Optionally, the data transmission method also includes: in response to receiving the reply data packet within the reply time, and not receiving the result data packet within the result time, determining whether the number of errors is greater than an error number threshold, wherein the number of errors is equal to the number of times the output number is recounted; in response to the number of errors being less than or equal to the error number threshold, outputting the request data packet to the second device again, and recounting the output number.

[0009] In a second aspect, an embodiment of the present application provides a data transmission method, which is applied to a second device, wherein the second device is used to communicate and interact with a first device, and the data transmission method includes: in response to receiving a request data packet output by the first device, verifying the request data packet according to a verification rule, wherein the request data packet includes verification data and request data, and the first device is used to generate or receive the request data, and the verification data includes a first timing value and / or a first verification code, the first verification code is related to the content of the request data, and the first timing value is related to the number of times the request data packet is output to the second device; in response to the request data packet meeting the verification rule, outputting a reply data packet to the first device; and outputting a result data packet to the first device according to the request data.

[0010] Optionally, the verification rule includes that a second verification code is equal to the first verification code, and verifying the request data packet according to the verification rule includes: calculating the request data in the request data packet through a verification algorithm to obtain the second verification code; in response to the second verification code being not equal to the first verification code, determining that the request data packet does not comply with the verification rule.

[0011] Optionally, the verification rule includes that a second timing value is not equal to the first timing value, and verifying the request data packet according to the verification rule includes: in response to the second timing value being equal to the first timing value, outputting an abnormal reminder data packet to the first device, and determining that the request data packet does not comply with the verification rule; in response to the second timing value being not equal to the first timing value, modifying the second timing value to be equal to the first timing value, and determining that the request data packet complies with the verification rule.

[0012] Optionally, the verification rule includes that the length of the request data packet is less than or equal to a length threshold, and verifying the request data packet according to the verification rule includes: in response to the length of the request data packet being less than or equal to the length threshold, continuing to verify whether the request data packet complies with remaining rules in the verification rule according to the verification data.

[0013] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a memory for storing a computer program;

[0014] A processor is used to execute the computer program stored in the memory. When the computer program is executed, the processor is used to execute the data transmission method as described in any one of the above items.

[0015] In a fourth aspect, an embodiment of the present application provides a storage medium, wherein the storage medium includes a computer program, and when the computer program is executed on an electronic device, the electronic device executes any of the data transmission methods described above.

[0016] Through the data transmission method, electronic device and storage medium provided by the implementation method of the present application, when the first device does not receive a reply data packet within the reply time when outputting a request data packet, the first device can re-output the request data packet through a retransmission mechanism to reduce the impact of occasional communication failures between the first device and the second device caused by environmental factors on the transmission of the request data packet, thereby improving the stability of the communication interaction between the first device and the second device. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 It is a connection diagram of the first device and the second device in an embodiment of the present application.

[0018] Figure 2 It is a schematic diagram of the first internal unit of the first device and the second device in an embodiment of the present application.

[0019] Figure 3 It is a schematic diagram of the second internal unit of the first device and the second device in an embodiment of the present application.

[0020] Figure 4This is the first flow chart of the data transmission method according to an embodiment of the present application.

[0021] Figure 5 This is the second flow chart of the data transmission method according to an embodiment of the present application.

[0022] Figure 6 This is the third flow chart of the data transmission method of an embodiment of the present application.

[0023] Figure 7 This is the fourth flow chart of the data transmission method of an embodiment of the present application.

[0024] Figure 8 This is the fifth flow chart of the data transmission method of an embodiment of the present application.

[0025] Fig. 9 This is the sixth flow chart of the data transmission method of an embodiment of the present application.

[0026] Main component symbols

[0027] First device 100

[0028] Second device 200

[0029] First processor 101

[0030] First memory 102

[0031] Second processor 201

[0032] Second memory 202

[0033] First application unit 10

[0034] The first transmission unit 20

[0035] The first processing module 21

[0036] First verification module 22

[0037] The first timing module 23

[0038] Timing module 24

[0039] Counting module 25

[0040] Second application unit 30

[0041] Second transmission unit 40

[0042] The second processing module 41

[0043] Second verification module 42

[0044] The second timing module 43

[0045] Response Unit 50 DETAILED DESCRIPTION

[0046] The following will clearly and completely describe the technical solutions in the implementation mode of the present application in conjunction with the accompanying drawings in the implementation mode of the present application. Obviously, the described implementation mode is only a part of the implementation mode of the present application, rather than the entire implementation mode.

[0047] See also Figure 1 , Figure 1 It is a connection diagram of a first device 100 and a second device 200 provided in an embodiment of the present application.

[0048] In the embodiment of the present application, the first device 100 and the second device 200 are both electronic devices. The electronic device may include a processor and a memory. The processor and the memory may be connected to each other via a bus.

[0049] Wherein, the processor can be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the above program. The memory can be a read-only memory (ROM) or other types of static storage devices that can store static data and instructions, or it can be an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited to this. The memory can be independent and connected to the processor through a bus. The memory can also be integrated with the processor.

[0050] In an embodiment of the present application, the electronic device may be an embedded device, and a plurality of electronic devices may be connected via a bus, and communication interaction may be achieved by using a corresponding communication protocol according to the type of the bus.

[0051] In the embodiments of the present application, the bus type used by the electronic device is not specifically limited. For example, the bus may include, but is not limited to, a serial peripheral interface (Serial Peripheral Interface, SPI) bus, an I2C bus, a controller area network (Controller Area Network, CAN) bus, a universal asynchronous receiver / transmitter (Universal Asynchronous Receiver / Transmitter, UART) or a universal serial bus (Universal Serial Bus, USB), etc.

[0052] In an embodiment of the present application, the software system of the electronic device can be divided into at least three layers, which are, from top to bottom, an application (Application, APP) layer, a transport layer, and a physical layer.

[0053] like Figure 1 As shown, the first device 100 may include a first processor 101 and a first memory 102, and the second device 200 may include a second processor 201 and a second memory 202. The first processor 101 and the second processor 201 may establish a communication connection through a bus, thereby realizing a communication connection between the first device 100 and the second device 200; in this way, the software unit located in the application layer of the first device 100 and the software unit located in the application layer of the second device 200 may realize data interaction through the software units located in the transport layer and physical layer of the first device 100 and the transport layer and physical layer of the second device 200. Among them, the software units located in the physical layer of the first device 100 and the physical layer of the second device 200 may include driver software corresponding to the bus type, etc., and the embodiments of the present application will not repeat the software units in the physical layer of the first device 100 and the physical layer of the second device 200.

[0054] See also Figure 2 , Figure 2 The internal units of the first device 100 and the second device 200 provided by the embodiment of the present application are shown.

[0055] In an embodiment of the present application, the first processor 101 may include a first application unit 10 and a first transmission unit 20. The first application unit 10 is located at an application layer of the first device 100, and the first transmission unit 20 is located at a transmission layer of the first device 100.

[0056] The first application unit 10 is used to receive or generate request data. The first processor 101 can receive request data input to the first device 100 by the user through the first application unit 10 by operating the first device 100 or operating an external device that communicates and interacts with the first device 100; or the first processor 101 can generate preset request data at a preset time point through the first application unit 10.

[0057] It is understood that the staff can realize human-computer interaction with the first device 100 by operating the external device, thereby realizing inputting request data to the first device 100. In the embodiments of the present application, the type of the external device is not specifically limited. For example, the external device can be, but is not limited to, a personal computer, etc.

[0058] Similarly, the second device 200 can be connected to another external device for communication, and the staff can achieve human-computer interaction with the second device 200 by operating the other external device.

[0059] It is understandable that before the processor works, the staff can write the corresponding code of the first application unit 10 so that the first application unit 10 can generate preset data content (such as request data) at a preset time point, thereby realizing the automatic generation of request data by the first processor 101.

[0060] In the embodiment of the present application, the content of the request data is not specifically limited. For example, the content of the request data is used to instruct the second device 200 to output a result data packet to the first device 100.

[0061] In an embodiment of the present application, the first application unit 10 is further configured to output the request data to the first transmission unit 20. The first transmission unit 20 is configured to receive the request data and generate a request data packet according to the request data. The first processor 101 can obtain a request data packet corresponding to the request data through the first transmission unit 20, and the first processor 101 can output the request data packet to the second processor 201.

[0062] Among them, the first transmission unit 20 may include a first processing module 21, a first verification module 22 and a first timing module 23. The first processing module 21 is used to generate a request data packet according to the request data and the verification data related to the request data. The verification data may include a first verification code and a first timing value. The first verification module 22 is used to calculate the request data based on a preset verification algorithm to obtain a first verification code corresponding to the request data. The first timing module 23 is used to generate a first timing value according to the number of times the first device 100 outputs the request data packet to the second device 200.

[0063] It can be understood that when the first transmission unit 20 receives the request data, the first processing module 21, the first verification module 22 and the first timing module 23 can synchronously receive the request data; or, some modules in the first processing module 21, the first verification module 22 and the first timing module 23 directly receive the request data and then transmit the request data to other modules. The embodiments of the present application are not limited to this.

[0064] It can be understood that the first verification code obtained by calculation is a first verification code corresponding to and unique to the request data. The algorithm used by the first verification module 22 to calculate the first verification code can be a common algorithm in the relevant field. In the embodiment of the present application, the verification algorithm used by the first verification module 22 is not specifically limited. For example, the verification algorithm used by the first verification module 22 can be, but is not limited to, a cyclic redundancy check (CRC) algorithm. Exemplarily, the first verification code obtained after the first verification module 22 uses the CRC algorithm to calculate the request data is a CRC code.

[0065] It is understandable that the initial value of the first timing value may be 0. Whenever the first transmission unit 20 receives request data, the first timing module 23 may add 1 to the first timing value to update the first timing value, and use the updated first timing value as the first timing value corresponding to the data received by the first transmission unit 20 .

[0066] Among them, the software unit located at the application layer of the first device 100 (for example, the first application unit 10) can output multiple data to the software unit located at the transmission layer of the first device 100 (for example, the first transmission unit 20), and the multiple data may include internal data and request data. The internal data is only transmitted inside the first processor 101 (for example, transmitted between the software unit located at the application layer and the software unit located at the transmission layer), and does not need to be output to other electronic devices (for example, the second device 200). Therefore, when the first transmission unit 20 receives the internal data, the first timing module 23 does not update the first timing value. The request data is data that needs to be transmitted to other electronic devices (for example, the second device 200). The first timing module 23 updates the first timing value only when it is determined that the data received by the first transmission unit 20 is request data.

[0067] In the embodiment of the present application, the manner in which the first timing module 23 determines whether the received data is request data is not specifically limited. For example, after receiving the data, the first processing module 21 may identify the content of the data and determine whether the data is request data according to the content of the data, and then the first processing module 21 may notify the first timing module 23 of the determination result.

[0068] Exemplarily, the data output by the software unit of the application layer of the first device 100 (for example, the first application unit 10) includes an application primitive corresponding to the application layer. The application primitive can indicate that the data is internal data or request data. The first processing module 21 can identify the application primitive from the data and determine whether the data is request data based on the application primitive.

[0069] It is understandable that the correspondence between the application primitive and the internal data or request data may be preset in the first device 100 by the staff before the first device 100 starts working. For example, the application primitive and the internal data or request data may be recorded in a coding table, which may be preset in the first device 100.

[0070] In an embodiment of the present application, the first verification module 22 is further used to generate a corresponding request primitive according to the request data. The request primitive corresponds one-to-one to the application primitive in the request data, and the request primitive is a primitive corresponding to the software unit (e.g., the first transmission unit 20) in the transmission layer of the first device 100.

[0071] For example, the correspondence between the application primitive and the request primitive can be recorded in a coding table, and the coding table can be preset in the first device 100. The first verification module 22 can call the coding table to generate a corresponding request primitive according to the application primitive in the request data and the correspondence between the application primitive and the coding table.

[0072] In the embodiment of the present application, the first verification module 22 is used to output the first verification code to the first processing module 21 after generating the first verification code. The first timing module 23 is used to output the first timing value to the first processing module 21 after updating the first timing value. The first processing module 21 is used to edit the verification data and the request primitive into the header of the request data packet after receiving the verification data (such as the first verification code and the first timing value), and edit the verification data into the data payload of the request data packet, thereby generating a request data packet, and realizing the generation of the request data packet corresponding to the request data by the first transmission unit 20.

[0073] It can be understood that in the process of data exchange between the first device 100 and the second device 200 through the bus, the data packets output by the first device 100 and the second device 200 may be missing or rewritten due to environmental factors. The verification data (such as the first verification code and the first timing value) in the header of the request data packet corresponds to the data load one by one. When the second device 200 receives the request data packet, it can verify the request data packet through the verification data to determine whether the request data in the request data packet is missing or rewritten, and when it is determined that the request data is at risk of missing or rewritten, it will not make further response to the request data, so as to reduce the probability of erroneous operation of the second device 200 due to incorrect identification of the request data.

[0074] It can be understood that the first transmission unit 20 is used to output the generated request data packet to the software unit of the physical layer of the first device 100, the software unit of the physical layer of the first device 100 can output the request data packet to the software unit of the physical layer of the second device 200 through the physical link, and the software unit of the physical layer of the second device 200 can output the request data packet to the software unit of the transmission layer of the second device 200.

[0075] In an embodiment of the present application, the second processor 201 may include a second application unit 30 and a second transmission unit 40. The second application unit 30 is located at the application layer of the second device 200, and the second transmission unit 40 is located at the transmission layer of the second device 200.

[0076] The second transmission unit 40 is used to receive the request data packet output by the first transmission unit 20 from the software unit in the physical layer of the second device 200, and identify and disassemble the content in the request data packet. At the same time, the second transmission unit 40 is also used to verify the request data packet through the verification rule. The second processor 201 can disassemble the request data packet through the second transmission unit 40, so as to extract the request data from the request data packet; the second processor 201 can also verify whether there is data missing or rewritten in the request data packet through the second transmission unit 40, so as to determine whether the received request data packet is credible.

[0077] The second transmission unit 40 may include a second processing module 41, a second verification module 42 and a second timing module 43. The second processing module 41 is used to receive and disassemble the request data packet, thereby obtaining the request primitive, the verification data (such as the first verification code and the first timing value) and the request data. The second processing module 41, the second processing module 41, the second verification module 42 and the second timing module 43 are all used to verify the request data packet through the verification rules.

[0078] It can be understood that the second processing module 41 can adopt the same or similar principle as the first processing module 21 to generate the request data packet, so as to obtain the request primitive and the verification data (such as the first verification code and the first timing value) in the header of the request data packet, and obtain the request data in the data payload of the request data packet. Then, the second processing module 41 can output the first verification code and the request data to the first verification module 22, and output the first timing value to the second timing module 43, so that the second verification module 42 and the second timing module 43 can verify whether the request data packet complies with at least part of the verification rules.

[0079] In an embodiment of the present application, the verification rule may include that the length of the request data packet is less than or equal to the length threshold, the second timing value is not equal to the first timing value, and the second verification code is equal to the first verification code. When the request data packet meets all the rules in the verification rules, it can be determined that the request data packet meets the verification rules. When the request data packet does not meet any rule in the verification rules, it can be determined that the request data packet does not meet the verification rules.

[0080] Among them, the second processing module 41 is used to verify whether the length of the request data packet is less than or equal to the length threshold, the second timing module 43 is used to verify whether the second timing value is equal to the first timing value, and the second verification module 42 is used to verify whether the second verification code is equal to the first verification code.

[0081] It can be understood that the length threshold can be the maximum value of the length of the data packet that the first device 100 and the second device 200 can receive when the first device 100 and the second device 200 communicate and interact. The specific value of the length threshold can be related to the physical performance of the first device 100 and the second device 200 and the communication protocol adopted. Before the first device 100 and the second device 200 work, the staff can preset the length threshold in the first device 100 and the second device 200 according to the physical performance and communication protocol of the first device 100 and the second device 200. In the embodiments of the present application, the value of the length threshold is not specifically limited.

[0082] It is understood that after confirming the length of the request data packet, the second processing module 41 can compare the length of the request data packet with the length threshold, thereby determining whether the length of the request data packet is less than or equal to the length threshold. In the embodiment of the present application, the method for determining the length of the request data packet by the second processing module 41 is not specifically limited.

[0083] For example, the second processing module 41 may read all data in the request data packet before or when the request data packet is disassembled, and count the read data, and use the counting result as the length of the request data packet.

[0084] For another example, when generating a request data packet, the first processing module 21 can calculate the length of the request data packet and record the length of the request data packet in a specified digit of the request data packet header. The second processing module 41 can determine the length of the request data packet by reading the content of the specified digit of the request data packet header.

[0085] It is understandable that during the communication and interaction between the first device 100 and the second device 200, the first device 100 cannot output a request data packet whose length exceeds the length threshold to the second device 200. Therefore, when the second processing module 41 determines that the length of the request data packet is greater than the length threshold, there is a possibility that the request data packet data is missing or overwritten.

[0086] In some embodiments, the second processing module 41 is used to discard the request data packet when determining that the request data packet does not meet the verification rule (for example, the length of the request data packet is greater than the length threshold). Then, the second transmission unit 40 no longer verifies the request data packet, and does not output the request data to the second application unit 30.

[0087] The second processing module 41 is used to output the first verification code and the request data to the second verification module 42 when it is determined that the request data packet meets the verification rule corresponding to the second processing module 41 (for example, the length of the request data packet is less than or equal to the length threshold). The second verification module 42 is used to calculate the second verification code according to the request data and the verification algorithm after receiving the first verification code and the request data, and verify whether the second verification code is equal to the first verification code.

[0088] It can be understood that the way in which the second verification module 42 calculates the second verification code may be the same as or similar to the way in which the first verification module 22 calculates the first verification code, and will not be described in detail herein.

[0089] It can be understood that the second verification code and the first verification code are verification codes calculated using the same algorithm and the same calculation materials. Therefore, when the second verification code is not equal to the first verification code, there is a possibility that the request data packet data is missing or has been rewritten.

[0090] In some embodiments, the second verification module 42 is used to output the corresponding verification result to the second processing module 41 after verifying whether the first verification code is the same as the second verification code. The second timing module 43 is used to modify the second timing value assignment to be equal to the first timing value when determining that the first timing value is not equal to the second timing value, and output the verification result to the second processing module 41.

[0091] The second processing module 41 is used to discard the request data packet when it is determined that the request data packet does not meet the verification rule (for example, the first verification code is not equal to the second verification code). Then, the second transmission unit 40 no longer verifies the request data packet and does not output the request data to the second application unit 30.

[0092] The second processing module 41 is used to output the first timing value to the second timing module 43 when determining that the request data packet meets the verification rule corresponding to the second verification module 42 (for example, the first verification code is equal to the second verification code). The second timing module 43 is used to verify whether the first timing value is equal to the second timing value after receiving the first timing value.

[0093] It can be understood that the initial value of the second timing value can be 0. When the request data packet is the first data packet outputted from the first device 100 to the second device 200 after the first device 100 and the second device 200 work, since the first timing module 23 adds 1 to the first timing value each time the first transmission unit 20 receives the request data, the first timing value in the request data packet must not be 0.

[0094] It can be understood that the second timing value can be continuously updated as the second timing module 43 successfully verifies the request data packet. The first timing value can be continuously increased as the first timing module 23 receives the request data, that is, the first timing value can be continuously increased as the first device 100 outputs the request data packet to the second device 200. Therefore, before the first device 100 and the second device 200 are initialized, the first timing value in the first data packet output by the first device 100 can remain unequal to the second timing value. In this case, if the second timing value is equal to the first timing value, there is a possibility that the request data packet data is indeed or is rewritten, and there is a possibility that the first device 100 mistakenly sends a request data packet that has been sent.

[0095] It can be understood that when it is determined that the request data packet meets all the verification rules (for example, the length of the request data packet is less than or equal to the length threshold, the second timing value is not equal to the first timing value, and the second verification code is equal to the first verification code), it can be determined that the request data packet is not affected by environmental factors during the pure process and data is missing or rewritten. At this time, the request data packet is successfully verified, and the second device 200 can make further responses to the request data packet.

[0096] In the embodiment of the present application, when the second processing module 41 determines that the request data packet meets all the verification rules, the second processing module 41 is configured to output a reply data packet to the first processing module 21 .

[0097] It can be understood that when the first device 100 outputs a request data packet to the second device 200, a confirmation mode is used to implement the transmission of the request data packet. After receiving and verifying the request data packet, the second device 200 needs to output a reply data packet to the first device 100 in accordance with the rules of confirmation mode transmission.

[0098] It can be understood that the reply data packet can be transmitted to the first processing module 21 through the software unit of the physical layer of the second device 200 and the software unit of the physical layer of the first device 100. The reply information is used to indicate that the second transmission unit 40 successfully verifies the request data packet.

[0099] In an embodiment of the present application, the first processing module 21 may have the same or similar functions as the second processing module 41, the second processing module 41 may have the same or similar functions as the first processing module 21, the first verification module 22 may have the same or similar functions as the second verification module 42, the second verification module 42 may have the same or similar functions as the first verification module 22, the first timing module 23 may have the same or similar functions as the second timing module 43, the second timing module 43 may have the same or similar functions as the first timing module 23, which will not be repeated here.

[0100] It can be understood that the format of the reply data packet can be the same as the format of the request data packet. When the second processing module 41 generates a reply data packet, the reply primitive can be recorded in the packet header. The reply primitive is used to instruct the first processing module 21 not to transmit the content of the reply data packet to the first application unit 10, and not to resend the request data packet that has been sent. After receiving the reply data packet, the first processing module 21 can identify the reply primitive, so as not to resend the request data packet, and not output the content of the data payload in the reply data packet to the first application unit 10.

[0101] In the embodiment of the present application, after the second processing module 41 determines that the request data packet does not comply with the verification rule corresponding to the second timing module 43 , the second processing module 41 is configured to output an abnormality reminder data packet to the first processing module 21 .

[0102] It can be understood that the format of the abnormality reminder data packet can be the same as the format of the request data packet. When the second processing module 41 generates the abnormality reminder data packet, the reply primitive can be recorded in the packet header. After receiving the abnormality reminder data packet, the first processing module 21 can identify the reply primitive, so as not to resend the request data packet, and not output the content of the data payload in the abnormality reminder data packet to the first application unit 10.

[0103] It can be understood that when the request data packet does not meet the verification rule corresponding to the second timing module 43, the first timing value is equal to the second timing value, and the request data packet received by the second device 200 may be a request data packet that has been sent by the first device 100. Therefore, the second device 200 can output an abnormal reminder data packet to the first device 100 to instruct the first device 100 to stop sending the request data packet. At the same time, the event of receiving the abnormal reminder data packet can be recorded in the log corresponding to the transmission layer of the first device 100. The staff can check the abnormal situation of the first device 100 by checking the log.

[0104] In other embodiments, the first timing value or the first verification code in the verification data can be omitted, and the second timing value in the verification rule is not equal to the first timing value or the second verification code is equal to the first verification code can be omitted. Correspondingly, the second verification module 42 and / or the second timing module 43 in the second transmission unit 40 can be omitted, and the first verification module 22 and / or the first timing module 23 in the first transmission unit 20 can be omitted, which will not be repeated here.

[0105] In other embodiments, the order in which the second processing module 41 , the second verification module 42 , and the second timing module 43 respectively verify the request data packet may be different from the order described in the above embodiment, which will not be described in detail herein.

[0106] In an embodiment of the present application, the first transmission unit 20 may further include a timing module 24 and a counting module 25. The timing module 24 is used to time when the first transmission unit 20 outputs a request data packet, and the counting module 25 is used to count the number of times the request data packet is output when the first transmission unit 20 outputs the request data packet.

[0107] The first processing module 21 is used to obtain the timing duration from the timing module 24 and the output times from the counting module 25. The first processing module 21 is used to determine whether the first transmission unit 20 receives a reply data packet within the reply time after outputting the request data packet.

[0108] It can be understood that when the first transmission unit 20 receives the reply data packet and determines that the reply data packet meets the verification rule, it can be determined that the first transmission unit 20 has received the reply data packet. The principle of the first transmission unit 20 verifying the reply data packet can be the same or similar to the principle of the second transmission unit 40 verifying the request data packet, which will not be repeated here.

[0109] It can be understood that the reply time is a time threshold preset in the first device 100 before the first device 100 and the second device 200 work. The length of the reply time may be related to the bus type. In the case where the communication interaction between the first device 100 and the second device 200 is smooth, after the first transmission unit 20 outputs the request data packet, the reply time is calculated from the time when the first transmission unit 20 outputs the request data packet as the starting point, and the first transmission unit 20 may receive the reply data packet before the end of the reply time.

[0110] In the embodiments of the present application, the length of the response time is not specifically limited. For example, the response time may be 1.68 times the normal time required for the corresponding bus to implement a data exchange obtained through experiments by staff.

[0111] It can be understood that the initial value of the output times can be 0. Each time when the first processing module 21 outputs a request data packet once, the first processing module 21 can notify the counting module 25 to count, and the counting module 25 can add 1 to the output times.

[0112] In an embodiment of the present application, when the first processing module 21 determines that the first transmission unit 20 receives a reply data packet within the reply time, the timing module 24 stops timing and resets the timing, and the counting module 25 adjusts the output times to the initial value.

[0113] It can be understood that when the first transmission unit 20 receives a reply data packet, according to the rules of the confirmation mode transmission, the transmission process of the first transmission unit 20 for the corresponding request data packet has been completed. At this time, the first processing module 21 can notify the timing module 24 to stop timing, and notify the counting module 25 to end counting, the timing module 24 can stop timing and reset the timing, and the counting module 25 can adjust the output times to the initial value.

[0114] In the embodiment of the present application, when the first processing module 21 determines that the first transmission unit 20 has not received the reply data packet within the reply time, and the output times are less than the output times threshold, the first processing module 21 is used to output the corresponding request data packet again. At the same time, the counting module 25 is used to update the output times, the timing module 24 is used to restart the timing, and the first processing module 21 is used to determine again whether the reply data packet is received within the reply time.

[0115] It can be understood that the output number threshold is a number threshold preset in the first device 100 before the first device 100 and the second device 200 work. The output number threshold can be obtained through experiments by staff. In the embodiments of the present application, the output number threshold is not specifically limited. For example, the output number threshold can be, but is not limited to, 3 times.

[0116] In an embodiment of the present application, when the first processing module 21 determines that the first transmission unit 20 has not received a reply data packet within the reply time and the output number is greater than or equal to the output number threshold, the first processing module 21 is used to end the transmission process of the corresponding request data packet.

[0117] It can be understood that after the first processing module 21 finishes the transmission process of the request data packet, the counting module 25 can adjust the output times to the initial value, and the timing module 24 can stop timing and reset the timing.

[0118] In some embodiments, the second transmission unit 40 may include a counting module 25 and a timing module 24, and the function of the counting module 25 in the second transmission unit 40 is the same or similar to that of the counting module 25 in the first transmission unit 20, and the function of the timing module 24 in the second transmission unit 40 is the same or similar to that of the timing module 24 in the first transmission unit 20. No further details will be given here.

[0119] It can be understood that when the first transmission unit 20 does not receive the reply data packet within the reply time, the possible situations include: the request data packet is lost during the transmission process, the request data packet is missing or rewritten during the transmission process, resulting in the second transmission unit 40 failing to verify the request data packet, the reply data packet output by the second transmission unit 40 is lost during the transmission process, and the reply data packet is confirmed or rewritten during the transmission process, resulting in the first transmission unit 20 failing to verify the reply data packet, etc. At this time, if the output number is less than the output number threshold, the first transmission unit 20 can output the corresponding request data packet again and wait for the response of the second transmission unit 40 to eliminate the occasional communication failure between the first device 100 and the second device 200 caused by environmental factors. In this way, a retransmission mechanism for eliminating the influence of the request data packet transmission caused by occasional communication failures can be formed in the first transmission unit 20.

[0120] If the output times are greater than or equal to the times threshold, it can be determined that there may be a continuous communication failure between the first device 100 and the second device 200 that is not caused by environmental factors and requires staff intervention. At this time, the first transmission unit 20 can stop the transmission process and record the abnormal situation in the log or notify the staff.

[0121] When the second transmission unit 40 has received a request data packet and output a reply data packet, and the reply data packet is lost during the transmission process, or the data is missing or overwritten during the transmission process, there is a situation where the second transmission unit 40 receives the same request data packet again. At this time, since the second transmission unit 40 has received the request data packet, the second timing value is the same as the first timing value in the request data packet, that is, the second transmission unit 40 fails to verify the request data packet, and the second transmission unit 40 will output an abnormal reminder data packet to the first transmission unit 20. After receiving the abnormal reminder data packet, the first transmission unit 20 will stop the transmission process of the corresponding request data packet. Even if the abnormal reminder data packet is lost during the transmission process, or the data is indeed or is overwritten, so that the first transmission unit 20 cannot recognize the abnormal reminder data, the first transmission unit 20 can still stop the transmission of the corresponding request data packet when the output number is greater than or less than the output number threshold.

[0122] In this way, when the number of request data packets output by the first device 100 is less than the output number threshold, the retransmission mechanism of the first transmission unit 20 can reduce the situation where the request data packets output by the first device 100 cannot reach the second device 200, and improve the stability of the communication interaction between the first device 100 and the second device 200. At the same time, the verification rule can reduce the possibility of the second device 200 misidentifying and making an erroneous response to the request data packet, and improve the accuracy of the communication interaction between the first device 100 and the second device 200.

[0123] It can be understood that the application layer of the first device 100 implements the call of related functions through the interface set in the transport layer to perform various actions; correspondingly, the transport layer of the first device 100 implements the call of related functions through the interface set in the physical layer to meet the application layer's call to the function.

[0124] In the embodiment of the present application, the transport layer of the first device 100 can preset interfaces corresponding to multiple bus types. When the second device 200 connected to the first device 100 is replaced, and the bus type used by the replaced second device 200 is different from the bus type used by the original second device 200, due to the setting of multiple interfaces in the transport layer, the staff only needs to update the code related to the interface called by the application layer in the application layer; compared with the solution of only setting the application layer and the physical layer in the first device 100 in the related field, the staff does not need to modify all the codes related to the communication bus in the application layer, which can reduce the manpower loss in modifying the code after the second device 200 is replaced, and at the same time can improve the versatility of the first device 100.

[0125] In the embodiment of the present application, after the second transmission unit 40 outputs the request data to the second application unit 30 , the second application unit 30 is used to execute an action corresponding to the request data and output result data to the second transmission unit 40 .

[0126] It is understood that the content of the result data can be adjusted according to the content of the request data. For example, when the request data is used to instruct the second application unit 30 to return a specified data, the content of the result data includes the specified data. For another example, when the request data is used to instruct the second device 200 to output a control instruction to other devices, the result data is used to indicate that the second device 200 has completed the corresponding action.

[0127] In the embodiment of the present application, when the second transmission unit 40 receives the result data, the second transmission unit 40 is used to generate verification data according to the result data, generate a result data packet according to the result data and the verification data, and output the result data packet to the first transmission unit 20. Among them, the principle of the second transmission unit 40 generating the result data packet is the same or similar to the principle of the first transmission unit 20 generating the request data packet, and the details can be referred to the above embodiment, which will not be repeated here.

[0128] After receiving the result data packet, the first transmission unit 20 is used to verify the result data packet according to the verification rule, and after determining that the result data packet satisfies the verification rule, output the result data to the first application unit 10. The principle of the first transmission unit 20 verifying the result data packet is the same as or more detailed than the principle of the second transmission unit 40 verifying the request data packet, and will not be repeated here.

[0129] It can be understood that the second transmission unit 40 outputs the result data packet to the first transmission unit 20 in a non-confirmation mode. In this case, the first transmission unit 20 does not need to output a reply data packet to the second transmission unit 40 after receiving the result data packet.

[0130] It can be understood that after the first application unit 10 receives the result data, the process related to the request data generated or received by the first application unit 10 ends.

[0131] In an embodiment of the present application, when the number of outputs is less than the output number threshold, and the timing of the timing module 24 has not reached the reply time, and the first transmission unit 20 receives the reply data packet, the timing module 24 is used to re-time, and the first processing module 21 is used to determine whether the result data packet is received within the result time.

[0132] It can be understood that the result time is a time threshold preset in the first device 100 before the first device 100 and the second device 200 work. The length of the result time may be related to the bus type and the action corresponding to the request data. In the case where the communication interaction between the first device 100 and the second device 200 is smooth, after the first transmission unit 20 outputs the request data packet, the result time is calculated from the output of the request data packet by the first transmission unit 20 as the starting point, and the first transmission unit 20 may receive the result data packet before the end of the result time.

[0133] It is understood that the result time can be obtained through experiments by staff. In the embodiments of the present application, the duration of the result time is not specifically limited.

[0134] It can be understood that the principle by which the first processing module 21 determines whether a result data packet is received within the result time may be the same or similar to the principle by which the first processing module 21 determines whether a reply data packet is received within the reply time, and will not be repeated here.

[0135] In some embodiments, when it is determined that the first transmission unit 20 has not received the result data packet within the result time, the first processing module 21 records the situation in the log of the transport layer and terminates the relevant process of requesting data. At the same time, the timing module 24 stops timing and resets the timing, and the counting module 25 adjusts the output times to the initial value.

[0136] See also Figure 3 In some other embodiments, the software system of the first device 100 may include a session layer. The software system of the first device 100 includes an application layer, a session layer, a transport layer, and a physical layer from top to bottom. The session layer does not affect the transmission of the request data and the result data.

[0137] The first processor 101 may further include a response unit 50, which is located in the session layer of the first device 100. When it is determined that the first transmission unit 20 does not receive the result data packet within the result time, the first processing module 21 is used to output error reminder data to the response unit 50. After receiving the error reminder data, the response unit 50 is used to determine whether the number of errors is greater than the error number threshold.

[0138] When the number of errors is less than or equal to the error number threshold, the response unit 50 updates the number of errors and triggers the first transmission unit 20 to restart outputting the request data packet to the second transmission unit 40 and restart the retransmission mechanism.

[0139] When the number of errors is greater than the error number threshold, the response unit 50 terminates the relevant process of requesting data. At the same time, the timing module 24 stops timing and resets the timing, and the counting module 25 adjusts the output number to the initial value.

[0140] It is understandable that the initial value of the number of errors may be 0. When the relevant process of requesting data is terminated, the number of errors may be adjusted to the initial value.

[0141] In the embodiment of the present application, the error number threshold is not specifically limited. For example, the error number threshold may be, but is not limited to, 3 times.

[0142] It can be understood that when the response unit 50 determines that the number of errors is less than or equal to the error number threshold, it can output retransmission trigger data to the first processing module 21, so that the first processing module 21 again outputs the corresponding request data packet to the second transmission unit 40, and then the counting module 25 starts to recount the output times, and the timing module 24 starts timing, and the first processing module 21 determines whether a reply data packet is received within the result time.

[0143] In other embodiments, a network layer may be further provided in the software system of the first device 100 and the software system of the second device 200. The network layer may be located between the transport layer and the physical layer, or may replace the transport layer. Figure 2 and Figure 3 In this way, the first device 100 and the second device 200 can communicate and interact through a wireless network, and participate in Figure 2 , Figure 3 And the principles in the related text description are used to realize the transmission of the request data packet by the first device 100, the reception of the reply data packet and the result data packet, and the verification of the request data packet by the second device 200.

[0144] See also Figure 4 , Figure 4 The data transmission method provided by the embodiment of the present application is shown. Figure 4 The data transmission method shown can be applied to Figure 2 and Figure 3 A first device 100 and a second device 200 are shown.

[0145] like Figure 4 As shown, the data transmission method may include steps S41 to S411:

[0146] Step S41: The first application unit 10 generates or receives request data.

[0147] Step S42 : the first application unit 10 outputs the request data to the first transmission unit 20 .

[0148] Step S43: the first transmission unit 20 generates a request data packet according to the request data.

[0149] Step S44 : the first transmission unit 20 outputs the request data packet to the second transmission unit 40 .

[0150] Step S45 : the second transmission unit 40 outputs the reply data packet to the first transmission unit 20 .

[0151] Step S46 : the second transmission unit 40 outputs the request data to the second application unit 30 .

[0152] Step S47: The second application unit 30 executes an action corresponding to the request data and generates result data.

[0153] Step S48 : the second application unit 30 outputs the result data to the second transmission unit 40 .

[0154] Step S49: the second transmission unit 40 generates a result data packet according to the result data.

[0155] Step S410 : the second transmission unit 40 outputs the result data packet to the first transmission unit 20 .

[0156] Step S411 : the first transmission unit 20 outputs the result data to the first application unit 10 .

[0157] It is understood that the first device 100 and the second device 200 can be connected by Figure 2 The first application unit 10, the first transmission unit 20, the second transmission unit 40 and the second application unit 30 shown perform the above steps S41 to S411, which will not be repeated here.

[0158] See also Figure 5 In some embodiments, the data transmission method may include steps S51 to S56. Figure 5 The data transmission method shown in the figure can be applied to Figure 2 A first device 100 is shown.

[0159] Step S51: Generate or receive request data.

[0160] The first device 100 can receive or generate the request data through the first application unit 10. The principle of the first application unit 10 receiving or generating the request data can be referred to in Figure 2 , Figure 3 And the related description will not be repeated here.

[0161] Step S52: Generate verification data according to the request data.

[0162] The first device 100 can generate verification data through the first transmission unit 20. The principle of the first transmission unit 20 generating verification data can be referred to in Figure 2 , Figure 3 And the related description will not be repeated here.

[0163] Step S53: Generate a request data packet according to the request data and the verification data.

[0164] Step S54: output a request data packet to the second device 200.

[0165] The first device 100 can generate a request data packet having a header and a data payload through the first transmission unit 20, and output the request data packet to the second device 200. The principle of the first transmission unit 20 generating and outputting the request data packet can be referred to in Figure 2 , Figure 3 And the related description will not be repeated here.

[0166] Step S55: Determine whether a reply data packet is received within the reply time.

[0167] The first device 100 can perform timing through the first transmission unit 20, and determine whether to receive the reply data packet output by the second device 200 within the reply time through the first transmission unit 20. The principle of the first transmission unit 20 performing timing and determining whether to receive the reply data packet within the reply time can be referred to. Figure 2 , Figure 3 And the related description will not be repeated here.

[0168] It can be understood that under the rule of confirmation mode transmission, the reply data packet is a data packet outputted to the first device 100 after the second device 200 receives the request data packet and verifies the request data packet. The reply data packet is used to indicate that the second device 200 has received and verified the request data packet.

[0169] It can be understood that when it is determined that the reply data packet is received within the reply time, the first device 100 can stop timing and reset the timing, adjust the output times to the initial value, and enter step S57. When it is determined that the reply data packet is not received within the reply time, the first device 100 can stop timing and reset the timing, and enter step S56. The first device 100 can adjust the timing and output times through the first transmission unit 20. The principle of the first transmission unit 20 adjusting the timing and output times can be referred to. Figure 2 , Figure 3 And the related description will not be repeated here.

[0170] Step S56: Determine whether the output times is greater than the output times threshold.

[0171] The first device 100 can record the number of outputs through the first transmission unit 20 and determine whether the number of outputs is greater than the output number threshold. The principle of the first transmission unit 20 counting the number of outputs and determining whether the number of outputs is greater than the output number threshold can be referred to. Figure 2 , Figure 3 And the related description will not be repeated here.

[0172] It is understood that when it is determined that the number of outputs is greater than the output number threshold, the first device 100 can end the transmission process of the request data packet or end all processes related to the request data, and record the abnormal situation in the log. When it is determined that the number of outputs is less than the output number threshold, the first device 100 can return to step S54 to output the request data packet to the second device 200 again, update the output number and start timing again. The first device 100 can output the request data packet, update the output number and timing through the first transmission unit 20.

[0173] Step S57: Determine whether the result data packet is received within the result time.

[0174] The first device 100 can perform timing through the first transmission unit 20, and determine whether to receive the result data packet output by the second device 200 within the result time through the first transmission unit 20. The principle of the first transmission unit 20 determining whether to receive the result data packet within the result time can be referred to in Figure 2 , Figure 3 And the related description will not be repeated here.

[0175] It can be understood that the result data packet is a data packet output to the first device 100 after the second device 200 completes the action corresponding to the request data packet. The result data packet is used to indicate that the second device 200 has completed the action corresponding to the request data packet, or the result data in the result data packet is the data that the first device 100 requests the second device 200 to output through the request data packet.

[0176] It is understood that when it is determined that the result data packet is received within the result time, the first device 100 can end all processes related to the request data. When it is determined that the result data packet is not received within the result time, the first device 100 can adjust the output times to the initial value, stop timing and reset the timing, and enter step S58.

[0177] Step S58: Determine whether the number of errors is greater than the error number threshold.

[0178] The first device 100 can count the number of errors through the response unit 50 and determine whether the number of errors is greater than the error number threshold. The principle of the response unit 50 counting the number of errors and determining whether the number of errors is greater than the error number threshold can be referred to. Figure 2 , Figure 3 and its related description.

[0179] It is understood that when it is determined that the number of errors is greater than the error number threshold, the first device 100 can end all processes related to the request data and record the abnormal situation. When it is determined that the number of errors is less than or equal to the error number threshold, the first device 100 can return to step S54 to output the request data packet to the second device 200 again, update the output number and start timing again.

[0180] See also Figure 6 In some embodiments, the method for the first device 100 to generate verification data according to the request data may include step S61 and step S62. It can be understood that step S61 and step S62 may be Figure 5 Sub-steps of step S52 shown.

[0181] Step S61: Generate a first timing value according to the number of times request data is generated or received.

[0182] Step S62: Calculate the request data using a verification algorithm to obtain a first verification code.

[0183] The first device 100 can realize the generation and update of the first timing value through the first transmission unit 20, and can realize the calculation of the first verification code through the first transmission unit 20. The principle of the first transmission unit 20 generating and updating the first timing value and calculating the first verification code can be referred to. Figure 2 , Figure 3 And the related description will not be repeated here.

[0184] In the embodiment of the present application, the execution order of step S61 and step S62 is not specifically limited. For example, step S61 can be executed before or after step S62. For another example, step S61 and step S62 can be executed simultaneously.

[0185] It can be understood that after step S61 and step S62 are executed, the first device 100 can execute step S53.

[0186] See also Figure 7 In some embodiments, the method for the first device 100 to generate a request data packet according to the request data and the verification data may include steps S71 and S72. It can be understood that steps S71 and S72 may be Figure 5 Sub-steps of step S53 shown.

[0187] Step S71: Generate a corresponding request primitive according to the request data.

[0188] Step S72: The request primitive and the verification data are formed into a header of a request data packet, and the request data are formed into a data payload of the request data packet to generate a request data packet.

[0189] The first device 100 can realize the generation of the request primitive and the generation of the request data packet through the first transmission unit 20. The principle of the first transmission unit 20 generating the request primitive and the request data packet can be referred to in Figure 2 , Figure 3 And the related description will not be repeated here.

[0190] See also Figure 8 In some embodiments, the data transmission method may include steps S81 to S85. Figure 8 The data transmission method shown in the figure can be applied to Figure 2 or Figure 3 A second device 200 is shown.

[0191] Step S81: receiving a request data packet output by the first device 100.

[0192] The second device 200 may receive the request data packet through the second transmission unit 40. The principle of the second transmission unit 40 receiving the request data packet may be referred to in Figure 2 , Figure 3 And the related description will not be repeated here.

[0193] Step S82: Determine whether the request data packet complies with the verification rules.

[0194] The second device 200 can verify the request data packet through the second transmission unit 40 to determine whether the request data packet complies with the verification rule. The principle of the second transmission unit 40 determining whether the request data packet complies with the verification rule can be referred to in Figure 2 , Figure 3 And the related description will not be repeated here.

[0195] It can be understood that when it is determined that the request data packet meets all the verification rules, the process proceeds to step S83. When it is determined that the request data packet does not meet the verification rules, the process proceeds to step S85.

[0196] Step S83: Output a reply data packet to the first device 100.

[0197] The second device 200 can generate and output a reply data packet through the second transmission unit 40. The principle of the second transmission unit 40 generating and outputting the reply data packet can be referred to in Figure 2 , Figure 3 And the related description will not be repeated here.

[0198] Step S84: Outputting a corresponding result data packet to the first device 100 according to the request data.

[0199] The second device 200 may generate result data through the second application unit 30, and generate and output the result data packet through the second transmission unit 40. The principle of the second application unit 30 generating the result data and the second transmission unit 40 generating and outputting the result data packet may be referred to in Figure 2 , Figure 3 And the related description will not be repeated here.

[0200] Step S85: discard the request data packet.

[0201] It can be understood that after determining that the request data packet does not comply with the verification rules, in order to avoid the second device 200 from misidentifying the request data packet and causing the second device 200 to perform an action that does not correspond to the request data in the first device 100, the second device 200 drops the request data packet and no longer responds to the request data packet after the drop.

[0202] See also Fig. 9 In some embodiments, the method in which the second device 200 verifies the request data packet according to the verification rule may include steps S91 to S96. It can be understood that steps S91 to S96 may be sub-steps of step S82.

[0203] Step S91: Determine whether the length of the request data packet is less than or equal to a length threshold.

[0204] The second device 200 can determine whether the length of the request data packet is less than or equal to the length threshold through the second processing module 41. The principle of the second processing module 41 determining whether the request data packet is less than or equal to the length threshold can be referred to. Figure 2 , Figure 3 And the related description will not be repeated here.

[0205] It can be understood that when it is determined that the length of the request data packet is less than or equal to the length threshold, the process proceeds to step S92. When it is determined that the length of the request data packet is greater than the length threshold, it can be determined that the request data packet does not meet the verification rule and the process proceeds to step S83.

[0206] Step S92: Calculate the request data using a verification algorithm to obtain a second verification code.

[0207] Step S93: Determine whether the second verification code is equal to the first verification code.

[0208] The second device 200 can calculate the second verification code through the second verification module 42 and determine whether the second verification code is equal to the first verification code. The principle of the second verification module 42 calculating the second verification code and determining whether the second verification code is equal to the first verification code can be referred to. Figure 2 , Figure 3 And the related description will not be repeated here.

[0209] It can be understood that when it is determined that the second verification code is equal to the first verification code, step S94 is entered. When it is determined that the second verification code is not equal to the first verification code, it can be determined that the request data packet does not meet the verification rule and step S83 is entered.

[0210] Step S94: Determine whether the second timing value is equal to the first timing value.

[0211] The second device 200 can determine whether the second timing value is equal to the first timing value through the second timing module 43. The principle of the second timing module 43 determining whether the second timing value is equal to the first timing value can be referred to. Figure 2 , Figure 3 And the related description will not be repeated here.

[0212] It can be understood that when it is determined that the second timing value is equal to the first timing value, it can be determined that the request data packet meets the verification rule, and the process proceeds to step S95 and step S84. When it is determined that the second timing value is not equal to the first timing value, it can be determined that the request data packet does not meet the verification rule, and the process proceeds to step S96 and step S83.

[0213] Step S95: modify the second timing value to be equal to the first timing value.

[0214] The second device 200 can modify the second timing value through the second timing module 43. The principle of the second timing module 43 modifying the second timing value can be referred to in Figure 2 , Figure 3 And the related description will not be repeated here.

[0215] In the embodiment of the present application, the execution order of step S95 and step S84 is not specifically limited. For example, step S95 can be executed before or after step S84. For another example, step S95 and step S84 can be executed synchronously.

[0216] Step S96: outputting an abnormality reminder data packet to the first device 100 .

[0217] The second device 200 can generate and output an abnormality reminder data packet through the second transmission unit 40. The principle of the second transmission unit 40 generating and outputting an abnormality reminder data packet can be referred to in Figure 2 , Figure 3 And the related description will not be repeated here.

[0218] In the embodiment of the present application, the execution order of step S96 and step S83 is not specifically limited. For example, step S96 can be executed before or after step S83. For another example, step S96 and step S83 can be executed simultaneously.

[0219] The beneficial effects of the data transmission method provided by the embodiment of the present application are as follows: Figure 2 and Figure 3 The beneficial effects of the first device 100 and the second device 200 shown in the figure are the same and will not be repeated here.

[0220] Based on the same concept, an embodiment of the present application also provides a storage medium, which includes a computer program. When the computer program runs on the first device 100 and / or the second device 200, the first device 100 executes the data transmission method provided by the embodiment of the present application.

[0221] It is obvious to those skilled in the art that the present application is not limited to the details of the above exemplary embodiments, and that the present application can be implemented in other specific forms without departing from the spirit or basic features of the present application. Therefore, no matter from which point of view, the above embodiments of the present application should be regarded as exemplary and non-restrictive, and the scope of the present application is defined by the attached claims rather than the above description, and therefore it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present application.

Claims

1. A data transmission method, applied to a first device, wherein the first device is used to communicate and interact with a second device, characterized in that: The data transmission method comprises: In response to generating or receiving the request data, generating verification data, wherein the verification data includes a first timing value and / or a first verification code, the first verification code is related to the content of the request data, and the first timing value is related to the number of times the request data packet is output to the second device; Generate a request data packet according to the verification data and the request data; Outputting the request data packet to the second device; In response to not receiving a reply data packet within the reply time and the output number is less than the output number threshold, the request data packet is output to the second device again, wherein the output number is the number of times the request data packet is output to the second device, and the second device is used to output the reply data packet to the first device in response to the request data packet meeting the verification rule.

2. The data transmission method according to claim 1, characterized in that: The first device includes a first application unit and a first transmission unit, the first application unit is arranged at an application layer of the first device, the first transmission unit is arranged at a transmission layer of the first device, the first application unit is used to generate or receive the request data, the first transmission unit is used to generate the verification data, and is used to generate the request data packet according to the verification data and the request data; Generating a request data packet according to the verification data and the request data comprises: Generate a corresponding request primitive according to the request data; The request primitive and the verification data are used to form a header of the request data packet, and the request data is used to form a data payload of the request data packet, so as to generate the request data packet.

3. The data transmission method according to claim 1, characterized in that: Generating verification data comprises: generating the first timing value according to the number of times the request data is generated or received; The request data is calculated using a verification algorithm to obtain the first verification code.

4. The data transmission method according to claim 1, characterized in that: The data transmission method further comprises: In response to receiving the reply data packet within the reply time and not receiving the result data packet within the result time, determining whether the number of errors is greater than an error number threshold, wherein the number of errors is equal to the number of times the output number is recounted; In response to the number of errors being less than or equal to the error number threshold, the request data packet is output again to the second device, and the output number is recounted.

5. A data transmission method, applied to a second device, the second device being used to communicate and interact with a first device, characterized in that: The data transmission method comprises: In response to receiving a request data packet output by the first device, verifying the request data packet according to a verification rule, wherein the request data packet includes verification data and request data, the first device is used to generate or receive the request data, the verification data includes a first timing value and / or a first verification code, the first verification code is related to the content of the request data, and the first timing value is related to the number of times the request data packet is output to the second device; In response to the request data packet meeting the verification rule, outputting a reply data packet to the first device; Output a result data packet to the first device according to the request data.

6. The data transmission method according to claim 5, characterized in that: The verification rule includes that the second verification code is equal to the first verification code, and verifying the request data packet according to the verification rule includes: Calculating the request data in the request data packet by using a verification algorithm to obtain the second verification code; In response to the second verification code not being equal to the first verification code, it is determined that the request data packet does not comply with the verification rule.

7. The data transmission method according to claim 5, characterized in that: The verification rule includes that the second timing value is not equal to the first timing value, and verifying the request data packet according to the verification rule includes: In response to the second timing value being equal to the first timing value, outputting an abnormality reminder data packet to the first device, and determining that the request data packet does not comply with the verification rule; In response to the second timing value not being equal to the first timing value, the second timing value is modified to be equal to the first timing value, and it is determined that the request data packet complies with the verification rule.

8. The data transmission method according to claim 5, characterized in that: The verification rule includes that the length of the request data packet is less than or equal to a length threshold, and verifying the request data packet according to the verification rule includes: In response to the length of the request data packet being less than or equal to the length threshold, continuing to verify whether the request data packet complies with the remaining rules in the verification rules according to the verification data.

9. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to execute the computer program stored in the memory; when the computer program is executed, the processor is configured to execute the data transmission method as described in any one of claims 1 to 4, and / or to execute the data transmission method as described in any one of claims 5 to 8.

10. A storage medium, characterized in that: The storage medium includes a computer program, and when the computer program is executed on an electronic device, the electronic device executes the data transmission method as claimed in any one of claims 1 to 4, and / or executes the data transmission method as claimed in any one of claims 5 to 8.