Data transmission method, electronic device, medium and product
By introducing pluggable modules and network data frame transmission methods into the serial communication system, the fixed compatibility and complex configuration issues of the serial communication method are solved, flexible adaptation to different interfaces and efficient remote data transmission are achieved, and system maintenance costs are reduced.
Patent Information
- Application Number
- CN202510888379.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-27
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2045-06-27
AI Technical Summary
In the existing technology, the fixed serial communication mode makes it difficult to cope with different application scenarios and changes in demand, has poor compatibility, complex configuration, cannot meet the needs of diversity and flexibility, and has low remote data transmission efficiency.
A data transmission method is provided, which reads the data to be transmitted from the data transmission end, encrypts it and encapsulates it according to a preset protocol, sends it to the data receiving end using the transmission method of network data frames, and stores it in a preset time series database. It supports pluggable serial port module interfaces and multiple communication protocols.
It achieves flexible adaptation to different interface standards and rapid configuration of communication protocols, improves the flexibility and scalability of the system, supports remote and efficient data transmission, and reduces maintenance costs.
Smart Images

Figure CN120415899B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technologies, and in particular to data transmission methods, electronic equipment, media, and products. Background Art
[0002] Serial communication is a common and important data transmission method in numerous industrial automation, intelligent monitoring, and data acquisition applications. However, when faced with different project requirements, different types of serial port modules are often required to adapt to specific device interface standards and communication protocols.
[0003] Related technologies usually require a dedicated serial communication system designed and configured for each project, which not only increases development costs and cycles, but also creates numerous inconveniences in actual applications when serial port modules need to be expanded or replaced, including poor compatibility and complex configuration. This makes it impossible to meet the diverse and flexible requirements of different projects.
[0004] At the same time, with the development of network technology, the demand for remote data transmission is increasing. How to transmit serial port data efficiently and stably through the remote network has become a problem that needs to be solved urgently. Summary of the Invention
[0005] The present invention provides a data transmission method, electronic device, medium and product to at least solve the problems of the related technology that the fixed serial port communication mode makes it difficult to cope with different application scenarios and changing requirements, has poor compatibility, and is complex to configure.
[0006] The present invention provides a data transmission method, comprising the following steps:
[0007] Read the data to be transmitted from the data transmission end;
[0008] Encrypting the data to be transmitted, encapsulating the encrypted data to be transmitted according to a preset protocol to obtain a network data frame, and obtaining a transmission mode of the network data frame;
[0009] The network data frame is sent to a data receiving end according to the transmission mode of the network data frame, so that the network data frame is parsed by the data receiving end and then stored in a preset time series database.
[0010] The present invention also provides a data transmission device, comprising:
[0011] A reading module is used to read the data to be transmitted from the data transmission end;
[0012] An encryption module, configured to encrypt the data to be transmitted, encapsulate the encrypted data to be transmitted according to a preset protocol to obtain a network data frame, and obtain a transmission mode of the network data frame;
[0013] The transmission module is used to send the network data frame to the data receiving end according to the transmission mode of the network data frame, so that the network data frame is parsed by the data receiving end and then stored in a preset time series database.
[0014] The present invention also provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the data transmission method as described in the above embodiment.
[0015] The present invention also provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned data transmission methods are implemented.
[0016] The present invention also provides a computer program product, comprising a computer program, which implements the steps of any of the above-mentioned data transmission methods when executed by a processor.
[0017] The present invention reads the data to be transmitted from the data transmission end, encrypts the data to be transmitted, and encapsulates the encrypted data to be transmitted according to a preset protocol to obtain a network data frame. The network data frame transmission method is then obtained, and the network data frame is sent to the data receiving end according to the network data frame transmission method. The network data frame is parsed by the data receiving end and stored in a preset time series database. This solves the problems of the related art that the fixed serial port communication method makes it difficult to adapt to different application scenarios and changing needs, has poor compatibility, and is complex to configure. The present invention can be configured and expanded according to actual needs, has high flexibility, strong versatility, and high transmission efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the embodiments of the present invention, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0019] Figure 1 A schematic diagram of an integrated board provided in an embodiment of the present invention;
[0020] Figure 2 A schematic diagram of an initialization and configuration process of an integrated board provided in an embodiment of the present invention;
[0021] Figure 3 A flowchart of a data transmission method provided by an embodiment of the present invention;
[0022] Figure 4 A schematic diagram of reading data to be transmitted from a data transmission end according to an embodiment of the present invention;
[0023] Figure 5 A schematic diagram of a data encapsulation and encryption process provided for an embodiment of the present application;
[0024] Figure 6 A schematic diagram of a data transmission process provided for an embodiment of the present application;
[0025] Figure 7 A schematic diagram of a remote server-side data processing provided for an embodiment of the present application;
[0026] Figure 8 A schematic diagram of a data transmission method provided for an embodiment of the present application;
[0027] Figure 9 A block schematic diagram of a data transmission apparatus provided for an embodiment of the present application;
[0028] Figure 10 A schematic diagram of the structure of an electronic device provided according to an embodiment of the present application. DETAILED DESCRIPTION
[0029] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments of the present application. Based on the embodiments in the present application, any other embodiments obtained by those of ordinary skill in the art without creative work fall within the protection scope of the present application.
[0030] It should be noted that, in the description of the present application, the terms “comprise”, “contain” or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device comprising a series of elements not only includes those elements, but also includes other elements not explicitly listed, or includes elements inherent to such process, method, article or device. The terms “first”, “second” and the like in the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence.
[0031] In order for those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the drawings and specific embodiments.
[0032] Before introducing the data transmission method of the present invention, an integrated board used in the present invention is first introduced. The integrated board is provided with a power interface, a network interface, a data transmission interface, an integrated board chip, a Bluetooth wireless module, a first step-down device, a second step-down device, a storage register and a display. The power interface is used to connect an external power supply to power the integrated board; the data transmission interface is used to connect an external serial port expansion module to obtain data to be transmitted; the integrated board chip user obtains the data to be transmitted and the transmission requirements and determines the data transmission mode according to the transmission requirements, and transmits the data to be transmitted through the determined data transmission mode; the network interface is used to connect an external network to transmit the data to be transmitted through the network according to the transmission requirements. Perform data transmission; the Bluetooth wireless module is used to transmit the data to be transmitted through wireless Bluetooth according to the transmission requirements. One end of the first step-down transformer is connected to the power interface, and the other end is connected to the network interface and the data transmission interface respectively, and is used to provide a first stable voltage for the network interface and the data transmission interface; one end of the second step-down transformer is connected to the first step-down transformer, and the other end is connected to the Bluetooth wireless module, the storage register and the display respectively, and is used to provide a second stable voltage for the Bluetooth wireless module, the storage register and the display. The storage register is used to store data to ensure that the data will not be lost even in the event of a power outage. The display is used to display the status of the integrated board and provide an interactive port for the user.
[0033] In one embodiment of the present invention, the integrated board is configured as follows Figure 1 As shown, the power interface is Type-C (Type C interface), the network interface is RJ45 (Registered Jack 45), the data transmission interface is USB (Universal Serial Bus), the integrated board chip is STM32H743, the first buck is TPS5430, the second buck is AMS1117, and the storage register is EEPROM.
[0034] A Type-C interface is set on the integrated board for power input to ensure stable operation of the system; a USB interface is used for serial port module connection to realize communication with various devices, and the integrated board is integrated with network communication and Bluetooth modules, supporting wired network or Bluetooth wireless connection to ensure remote transmission of data, as well as a basic display screen for displaying and setting basic setting information such as baud rate, data bit, check bit, stop bit, flow control, etc., to facilitate user monitoring and management; according to the specific needs of different projects, select a suitable serial port expansion module and insert it into the corresponding interface of the integrated board to complete the configuration of the integrated board on the serial port expansion module adapted to the project.
[0035] It should be noted that, in addition to the existing serial port module interface, the integrated board proposed in the embodiment of the present invention may consider adding other types of interfaces, such as CAN (Controller Area Network) bus interface, etc., to adapt to more types of local devices and further improve the versatility of the integrated board; in addition, an efficient power management system can also be designed to reduce the power consumption of the integrated board in different working states and extend the working time of the device when powered by battery, which is suitable for some mobile or remote deployment scenarios; in terms of application scenarios, the integrated board of the embodiment of the present invention can be connected to smart home devices via Bluetooth to achieve remote control and data monitoring.
[0036] Therefore, the integrated board provided based on the embodiment of the present invention can solve the problems of fixed serial port communication mode, which is difficult to adjust and adapt quickly when facing different application scenarios and changes in demand, resulting in poor communication flexibility, and when new equipment or functions need to be added, the fixed serial port communication mode is difficult to expand, which is not conducive to system upgrades and expansions, resulting in limited communication scalability. By setting a pluggable serial port expansion module interface, the serial port expansion modules of different projects can be easily replaced, and various interface standards and communication protocol requirements can be quickly adapted without the need to redesign and configure the system for each project, thereby greatly improving the flexibility and scalability of the system.
[0037] In adopting Figure 1 When the integrated board shown in the figure implements the data transmission method of the present invention, the following steps need to be performed: Figure 2 The initialization and configuration process shown is as follows:
[0038] The Type-C interface is connected to the power supply (5-20V), and the first step-down converter (AMS1117) and the second step-down converter (TPS5430) generate a 3.3V / 5V system power supply. This power supply is used to power the display, storage register (EEPROM), integrated board chip (STM32H743), Bluetooth wireless module, network interface, and data transmission interface (serial port expansion module).
[0039] After the integrated board chip (STM32H743) is powered on, the preset firmware is loaded and the peripherals (Ethernet, Bluetooth, display, and serial port module interface) are initialized.
[0040] User interactive configuration: Users can set serial port parameters through the display: baud rate (such as 115200bps), data bits (8 bits), parity bit (none / odd / even), stop bit (1 bit), flow control (none / RTS-CTS); set the network transmission mode (Ethernet / Bluetooth), and configure the target server IP / domain name and port.
[0041] Serial port module linking and adaptation: Insert the corresponding serial port expansion module according to project requirements. The integrated board chip (STM32H743) automatically detects the type of serial port expansion module (through ID pin or protocol feature code) and loads the corresponding driver (such as Modbus RTU parsing logic).
[0042] Specifically, Figure 3 A flowchart of a data transmission method provided by an embodiment of the present invention.
[0043] like Figure 3 As shown, the data transmission method includes the following steps:
[0044] In step S301, the data to be transmitted at the data transmission end is read.
[0045] According to one embodiment of the present invention, reading the data to be transmitted at the data transmission end includes: based on a preset loop detection strategy, detecting the buffer non-empty flag of the target register to obtain a flag detection result; based on the flag detection result, reading the data to be transmitted from the data transmission end according to the polling strategy or the interrupt strategy, and storing the data to be transmitted in the target cache area.
[0046] Among them, the polling strategy is an active detection method, and the processor will continuously check the target register status flag to determine whether there is data that needs to be processed; the interrupt strategy is a passive detection method. When the processor is performing other tasks, the target register will send an interrupt signal to the processor when a specific event occurs (such as receiving data), requesting the processor to suspend the current task and process the event instead; the data transmission end refers to the end that sends data. In an embodiment of the present invention, the data transmission end is connected to the integrated board through a serial port expansion module to send the data to be transmitted.
[0047] Specifically, combined Figure 4 As shown in the figure, the process of reading the data to be transmitted from the data transmission end mainly includes two key steps. First, based on a preset loop detection strategy, the buffer not empty flag (RXNE) of the target register (such as the UART status register USART_ISR) is detected. By continuously looping and checking this flag, it can be determined in real time whether the data transmission end's receive buffer contains data to be transmitted. Second, based on the flag detection result, a polling strategy or an interrupt strategy is selected to read the data to be transmitted from the data transmission end and store the read data in the target buffer area (such as the target buffer area). This design can flexibly select the appropriate data reading method based on the actual situation, while ensuring that data is stored in a timely and accurate manner, avoiding data loss or overflow.
[0048] In actual execution process, the serial port expansion module is connected with the data transmission port of the integrated board, the indicator light of the integrated board is always on, and the data transmission end corresponding to the serial port expansion module can read the to-be-transmitted data of the data transmission end. For example, when the data transmission port receives data, the RXNE flag bit of the USART_ISR register is set to 1, indicating that the receiving buffer is not empty. The system detects the RXNE flag bit by circulation, and once it is detected to be 1, data reading is performed according to a preset strategy. If a polling strategy is adopted, after the RXNE is detected to be 1, the data is taken out from the receiving buffer byte by byte through a reading operation and stored in a target buffer area; if an interrupt strategy is adopted, when the RXNE is 1, an interrupt service program is triggered, and the interrupt service program automatically takes out the data from the receiving buffer and stores it in the target buffer area. In this way, the embodiment of the application can efficiently store the data received by the serial port, and prepare for subsequent data processing. In addition, the size of the target buffer area of the embodiment of the application can be dynamically adjusted according to the baud rate, for example, when the baud rate is 115200bps, the target buffer area is allocated 4KB, to avoid data overflow.
[0049] Therefore, the embodiment of the application can realize real-time and accurate sensing of whether the data transmission end has data to be read by detecting the flag bit by circulation, greatly improving the timeliness of data acquisition and avoiding data loss caused by untimely detection. Secondly, the polling or interrupt strategy can be flexibly selected according to the detection result of the flag bit, so that the respective advantages can be fully played in different application scenarios. For example, in the case of small data flow and low real-time requirement, the polling strategy can simplify system design; and in the case of large data flow and high real-time requirement, the interrupt strategy can effectively improve the response speed and data processing efficiency of the system. Finally, storing the read data into the target buffer area and dynamically adjusting the size of the target buffer area according to the baud rate can effectively avoid data overflow and ensure the integrity of the data, thereby improving the stability and reliability of data reading.
[0050] According to one embodiment of the application, before storing the to-be-transmitted data into the target buffer area, it further includes: eliminating invalid data frames in the to-be-transmitted data; and performing timestamp synchronization on the to-be-transmitted data after eliminating the invalid data frames based on a preset timestamp synchronization strategy.
[0051] The invalid data frames refer to those data frames that do not conform to the expected format, have meaningless content or cannot be used for subsequent processing; and the preset timestamp synchronization strategy is a strategy for ensuring consistency of data time marks, which aligns the timestamp of the data with a unified time reference, to ensure that the data from different sources is comparable and consistent in time.
[0052] Specifically, in this embodiment of the present invention, two key steps are included before storing the data to be transmitted in the target buffer: first, invalid data frames, such as all-zero frames, are removed from the data to be transmitted to ensure data validity and reliability; second, based on a preset timestamp synchronization strategy, the data to be transmitted, after the invalid data frames have been removed, is timestamp synchronized to facilitate subsequent chronological management and analysis of the data. Performing these two steps before data is transmitted effectively improves data quality and availability.
[0053] For example, when the data transmission port receives data, the integrated board chip (STM32H743) checks the RXNE flag in the target register USART_ISR, reads the data byte by byte, and stores it in the target buffer (4KB). Before storing the data in the buffer, the system first checks the content of the data frame. For example, if the received data frame is all zeros (such as 0x000x00 0x00), it is identified as an invalid data frame and discarded. The system then inserts timestamps for the remaining valid data frames according to the preset timestamp synchronization strategy. For example, a timestamp (such as 2025-06-16 10:00:01) is inserted before each valid data frame to mark the time the data frame was received.
[0054] Therefore, the embodiment of the present invention can effectively avoid the interference of invalid data on subsequent processing by eliminating invalid data frames, thereby improving the validity and reliability of data; by inserting timestamps, the time sequence of data frames can be clarified, which is convenient for subsequent data analysis and processing. In addition, eliminating invalid data frames can reduce the occupancy of the target cache area, avoid invalid data occupying storage space, and thus improve the overall performance of the system.
[0055] In step S302, the data to be transmitted is encrypted, and the encrypted data to be transmitted is encapsulated according to a preset protocol to obtain a network data frame, and a transmission mode of the network data frame is obtained.
[0056] According to one embodiment of the present invention, a network data frame is obtained by encapsulating the encrypted data to be transmitted according to a preset protocol, including: using a preset byte identifier and a preset byte timestamp as frame header data; using the encrypted data to be transmitted as payload data; using a preset byte check code and a byte terminator as frame tail data; and obtaining a network data frame based on the frame header data, payload data and frame tail data.
[0057] Among them, the preset protocol refers to the pre-defined data frame format and related rules during the data encapsulation and transmission process. The preset byte identifier refers to the frame header part of the data frame, which is used to identify the beginning of the data frame to ensure that the receiving end can accurately identify the starting position of the data frame; the preset byte timestamp is in the frame header part of the data frame, which is used to record the time when the data frame is generated, facilitating subsequent data analysis and processing; the preset byte check code is in the frame tail part of the data frame, which is used to verify the integrity and correctness of the data frame; the byte terminator is in the frame tail part of the data frame, which is used to identify the end of the data frame to ensure that the receiving end can accurately identify the end position of the data frame.
[0058] Specifically, combined Figure 5 As shown, according to one embodiment of the present invention, the data to be transmitted is encrypted and then encapsulated according to a preset protocol to obtain a network data frame. The specific process includes: using a preset byte identifier (e.g., 0xAA55) and a preset byte timestamp (e.g., a 4-byte timestamp) as frame header data; using the encrypted data to be transmitted as payload data; and using a preset byte checksum (e.g., a 4-byte CRC32 checksum) and a byte terminator (e.g., 0x0D0A) as frame trailer data. By combining the header data, payload data, and frame trailer data, a complete network data frame is obtained. This process ensures data security and integrity and provides a standardized format for data transmission.
[0059] For example, the AES-256-CTR mode is used to encrypt the data to be transmitted. The encryption key is stored in the external EEPROM, and the session key is updated every 10 minutes through the ECDH protocol. Then, the data to be transmitted is encapsulated:
[0060] Frame header: Add a 2-byte identifier 0xAA55 and a 4-byte timestamp (for example, 0x20250616 represents June 16, 2025).
[0061] Payload: The encrypted data is used as the payload, and the length changes dynamically according to the actual data.
[0062] Frame tail: Calculate the 4-byte CRC32 checksum of the entire data frame (such as 0x12345678) and add the 2-byte terminator 0x0D0A.
[0063] Finally, the frame header, payload, and frame trailer are combined to form a complete network data frame.
[0064] Thus, by encrypting the data to be transmitted and incorporating a dynamic key mechanism, the embodiments of the present invention significantly enhance data security during transmission, effectively preventing data theft or tampering. Furthermore, the integrity of data frames is verified using a preset byte checksum, combined with standardized header and trailer formats, ensuring data integrity and reliability and facilitating rapid identification and parsing at the receiving end. Furthermore, the pre-set protocol encapsulation method not only enhances system compatibility and scalability, but also facilitates fault diagnosis and data recovery through the inclusion of timestamps and checksums, thereby improving the performance and reliability of the entire system.
[0065] In step S303 , the network data frame is sent to the data receiving end according to the transmission mode of the network data frame, so that the network data frame is parsed by the data receiving end and then stored in a preset time series database.
[0066] According to an embodiment of the present invention, the transmission mode of the network data frame includes network mode transmission and / or Bluetooth mode transmission.
[0067] Among them, the data receiving end is a port for receiving data. In an embodiment of the present invention, the data receiving end is a remote server; the preset time series database is a pre-set database for storing timestamps to facilitate subsequent data analysis and processing; the network mode transmission method is to transmit network data frames through a wired network (for example, Ethernet) or a wireless network (for example, Wi-Fi), and the Bluetooth mode transmission method is to transmit network data frames through Bluetooth technology.
[0068] It's understood that in network-mode transmission (e.g., TCP mode), a persistent connection is established between the sender and receiver. Once the connection is established, data can be transmitted bidirectionally between the two ends until the connection is explicitly closed. This persistent connection ensures the continuity and stability of data transmission and is suitable for scenarios requiring long-term, stable transmission. In addition, network-mode transmission supports full-duplex communication, meaning that data can be transmitted in both directions simultaneously, meaning that the sender and receiver can send and receive data simultaneously.
[0069] Bluetooth mode transmission is a low-power wireless communication technology, usually used for short-distance data transmission. In this mode, data needs to be divided into multiple small packets for transmission. The size of each data packet usually does not exceed 20 bytes. By subpacketizing the data, the amount of data transmitted in a single time can be reduced, thereby reducing power consumption and improving transmission reliability. In addition, the receiving end needs to recombine these packets in a certain order and rules to restore the integrity and correctness of the original data. This usually requires the implementation of a buffer and reassembly algorithm on the receiving end to ensure the integrity and order of the data.
[0070] Users can choose network mode transmission and / or Bluetooth mode transmission according to actual needs and application scenarios. For example, in scenarios where users require long distance, high bandwidth, stable connection and full-duplex communication, network mode transmission can be selected. In scenarios where users require short distance and low power consumption, especially when small data packets need to be transmitted frequently, Bluetooth mode transmission can be selected.
[0071] Specifically, combined Figure 6 As shown, based on the user's selected transmission method, an appropriate communication interface (such as a network interface or Bluetooth module) is selected to send the network data frame to the data receiving end. For example, if the network mode is selected for transmission, the network data frame will be sent to the data receiving end via the TCP / IP protocol; if the Bluetooth mode is selected for transmission, the network data frame will be sent to the data receiving end via the Bluetooth protocol. After receiving the network data frame, the data receiving end parses the data frame according to the preset protocol, extracting the frame header, payload, and frame trailer information. After parsing, the data is stored in a preset time series database.
[0072] Therefore, the embodiment of the present invention supports multiple transmission modes, enabling the system to flexibly select the most suitable transmission mode according to actual needs, thereby enhancing the adaptability of the system; network mode transmission supports high-bandwidth data transmission, while Bluetooth mode transmission is suitable for low-power scenarios, thereby improving the overall efficiency of the system; the parsed data is stored in a time series database, which facilitates subsequent data analysis, query and management, further improving the practicality of the system.
[0073] According to one embodiment of the present invention, the transmission method of the network data frame includes network mode transmission, and the network data frame is sent to the data receiving end according to the transmission method of the network data frame, including: establishing a connection with the data receiving end; when the connection establishment is completed, detecting the communication connection status between the data receiving end and the data receiving end, and when there is no abnormality in the communication connection status, sending the network data frame to the data receiving end.
[0074] Specifically, combined Figure 6 As shown, in network mode transmission, the process of sending network data frames to the data receiving end includes the following steps: first, establishing a connection with the data receiving end; when the connection establishment is completed, detecting the communication connection status between the data receiving end and the data receiving end; if there is no abnormality in the communication connection status, sending the network data frame to the data receiving end. This process ensures the reliability and stability of data transmission and avoids data loss or transmission failure due to connection abnormalities.
[0075] Therefore, the embodiments of the present invention reduce data transmission failures by ensuring the reliability and stability of the connection, thereby improving the reliability of data transmission and user experience.
[0076] According to one embodiment of the present invention, establishing a connection with a data receiving end includes: sending a first data packet containing a first flag bit to the data receiving end, wherein the sequence number of the first data packet is a first initial sequence number; receiving a second data packet containing a first flag bit and a second flag bit sent by the data receiving end, wherein the sequence number of the second data packet is the initial sequence number of the data receiving end; based on the second data packet, sending a third data packet containing a third flag bit to the data receiving end, so as to confirm that the connection is established when the data receiving end receives the third data packet.
[0077] The flag bit is a specific field in the data packet that indicates the type or status of the data packet. For example, the SYN (Synchronize Sequence Numbers) flag bit is used to establish a connection, and the ACK (Acknowledgment) flag bit is used to confirm receipt.
[0078] Specifically, combined Figure 6 As shown, the process of establishing a connection with a data receiver includes three key steps: first, sending a first data packet containing a first flag bit to the data receiver, with the first initial sequence number as the sequence number of the data packet; second, receiving a second data packet sent by the data receiver, containing the first and second flag bits, with the sequence number of the data receiver's initial sequence number; and finally, based on the received second data packet, sending a third data packet containing a third flag bit to the data receiver. When the data receiver receives the third data packet, it confirms that the connection is established. This process is similar to the three-way handshake of the TCP protocol, ensuring the reliability and stability of the connection.
[0079] For example, the integrated board generates a first data packet containing a first flag (e.g., a SYN flag) and a first initial sequence number (e.g., seq=100). The integrated board sends the first data packet to the data receiving end. For example, the content of the first data packet is: SYN, seq=100.
[0080] After receiving the first data packet, the data receiver generates a second data packet containing the first flag bit (SYN) and the second flag bit (ACK). The sequence number of the second data packet is the initial sequence number of the data receiver (for example, seq=200), and the acknowledgment number is the serial number of the integrated board plus 1 (that is, ack=101). For example, the content of the second data packet is: SYN, ACK, seq=200, ack=101.
[0081] After receiving the second data packet, the integrated board generates a third data packet containing a third flag (e.g., ACK). The sequence number of the third data packet is the device's initial sequence number plus 1 (i.e., seq=101), and the acknowledgment number is the server's sequence number plus 1 (i.e., ack=201). For example, the content of the third data packet is: ACK, seq=101, ack=201.
[0082] When the data receiving end receives the third data packet, it confirms that the connection has been successfully established and both parties can start data transmission.
[0083] Therefore, the embodiment of the present invention ensures that the establishment of the connection is reliable and stable by establishing a connection with the data receiving end. Each step has a clear flag bit and sequence number, which can effectively detect and handle abnormal situations in the connection process and avoid connection failures caused by network problems. Moreover, during the connection establishment process, the loss or duplication of data packets can be detected through the mechanism of sequence numbers and confirmation numbers. If a data packet is lost, the device can resend the data packet, thereby improving the success rate of connection establishment.
[0084] According to one embodiment of the present invention, detecting the communication connection status with a data receiving end includes: sending a heartbeat packet to the data receiving end based on a preset period; obtaining a first duration of feedback based on the heartbeat packet from the data receiving end that has not been received; if the first duration is greater than a first preset duration, determining that there is an abnormality in the communication connection status, otherwise determining that there is no abnormality in the communication connection status.
[0085] Among them, the heartbeat packet is a data packet sent periodically to detect whether the communication link is working normally; the first preset duration can be pre-set by the user, obtained through a limited number of experiments, or obtained through a limited number of computer simulations, and is not specifically limited here.
[0086] For example, the integrated board sends a heartbeat packet to the data receiver every 10 seconds (preset period). A heartbeat packet is a small data packet that typically contains only simple identification information, such as "HEARTBEAT." The integrated board records the time from sending the heartbeat packet to receiving feedback from the data receiver. If the integrated board does not receive feedback from the data receiver within 30 seconds (a first preset duration), it determines that the communication connection status is abnormal. If the integrated board receives feedback (such as "ACK") from the data receiver within 30 seconds, the communication connection status is considered normal.
[0087] Therefore, by regularly sending heartbeat packets and monitoring feedback, the embodiments of the present invention can promptly discover problems in the communication connection, such as network interruption, equipment failure or signal interference, thereby avoiding delays or failures in data transmission, and promptly detecting and processing communication connection anomalies, reducing user waiting time, and improving the system's response speed and user experience.
[0088] According to an embodiment of the present invention, when it is determined that there is an abnormality in the communication connection state, the method further includes: generating a first reminder message based on the communication connection state; and sending the first reminder message to a preset mobile terminal.
[0089] Among them, the preset mobile terminal is a mobile phone, tablet or computer, etc.
[0090] For example, if the integrated board does not receive a response to the heartbeat packet from the server within a first preset time (e.g., 30 seconds), it determines that there is an abnormality in the communication connection status and automatically generates a first reminder message with the content: "Warning: The communication connection between the device and the server has been interrupted. Please check the network status in time." The reminder message is sent to a preset mobile terminal (e.g., the administrator's mobile phone or tablet) via SMS or push notification.
[0091] Therefore, the embodiment of the present invention can immediately notify relevant personnel when a communication connection anomaly is detected by generating and sending a reminder message, thereby reducing fault response time and improving system reliability and availability. The reminder message can include specific information about the anomaly (such as time, device ID, etc.), providing technicians with detailed fault clues to facilitate rapid troubleshooting and repair of the problem.
[0092] According to one embodiment of the present invention, the transmission method of the network data frame includes Bluetooth mode transmission, and the network data frame is sent to the data receiving end according to the transmission method of the network data frame, including: determining the maximum payload; based on the maximum payload, dividing the network data frame into multiple data packets, and sending them to the data receiving end in sequence based on the order of the multiple data packets.
[0093] The maximum payload is the maximum amount of data in a single Bluetooth data packet.
[0094] Specifically, combined Figure 6 As shown, if the Bluetooth protocol stipulates that the maximum payload of a single data packet is 20 bytes, then the maximum data amount of each data packet is determined to be 20 bytes. Assuming that the total length of the network data frame is 100 bytes, the network data frame is divided into 5 data packets, each with 20 bytes, and these data packets are sent to the data receiving end in the order of the data packets.
[0095] Therefore, the embodiment of the present invention can effectively avoid transmission failure caused by a single data packet being too large by dividing the network data frame into multiple small data packets and sending them in sequence. The Bluetooth protocol has restrictions on the size of data packets, and small data packets are easier to transmit reliably on the Bluetooth link; sending data packets in sequence can ensure the integrity of the data, and the data receiving end can more easily reassemble the data frame. This method avoids repeated transmission due to data packet loss or disordered sequence, and improves transmission efficiency.
[0096] According to one embodiment of the present invention, when multiple data packets are sent to the data receiving end in sequence, it also includes: in a case where the feedback information sent by the data receiving end based on the current data packet is not received, obtaining a second duration of the feedback information sent by the data receiving end based on the current data packet; in a case where the second duration is greater than a second preset duration, generating a second reminder message; and sending the first reminder message to the preset mobile terminal.
[0097] The second preset duration may be pre-set by the user, obtained through a limited number of experiments, or obtained through a limited number of computer simulations, and is not specifically limited here.
[0098] For example, an embodiment of the present invention sequentially transmits each data packet, waits for feedback (e.g., ACK) from the data receiving end, and records the duration from the transmission of the data packet to the current time (a second duration). If the second duration exceeds a preset second duration (e.g., 30 seconds), the data packet transmission is considered abnormal, and a second reminder message is generated, such as "Warning: Data packet transmission failed, no feedback received, please check the Bluetooth connection." The second reminder message is also sent to a preset mobile terminal (e.g., an administrator's phone) to notify relevant personnel to handle the issue promptly.
[0099] Therefore, by monitoring the transmission status of each data packet and setting a timeout mechanism, data packet transmission failures can be discovered in a timely manner, the risk of data loss can be reduced, and the reliability of data transmission can be improved. When data packet transmission anomalies are detected, reminder information can be generated and sent in a timely manner, so that relevant personnel can quickly understand the problem and take measures, reducing fault response time and improving system availability.
[0100] It should be noted that, in the process of sending network data frames to the data receiving end according to the transmission mode of the network data frames, the embodiment of the present application can also monitor the network status or Bluetooth status, for example, monitoring the packet loss rate (ping test) or delay (RTT) of the network connection, or monitoring the signal strength (RSSI) and connection interval of the Bluetooth signal. When the packet loss rate is detected to be greater than 5% or the delay is greater than 500ms, an abnormal information is triggered to prompt the front end. When the Bluetooth is disconnected, the pairing is automatically retried (up to 3 times). If the matching fails, an abnormal information is triggered to prompt the front end. For critical data (such as alarm signals), if an ACK is not received, it is immediately retransmitted (up to 3 times). For non-critical data: batch retransmission is performed after the buffer is accumulated to 80% full.
[0101] According to one embodiment of the present invention, after sending the network data frame to the data receiving end according to the transmission mode of the network data frame, it also includes: judging whether a retransmission instruction sent by the data receiving end is received, wherein the retransmission instruction is issued by the data receiving end when the network data frame verification fails; in the case of receiving the retransmission instruction sent by the data receiving end, re-executing the step of sending the network data frame to the data receiving end according to the transmission mode of the network data frame.
[0102] For example, combining Figure 7 As shown, assume that an embodiment of the present invention sends an encapsulated network data frame (including a frame header, encrypted payload, and frame trailer) to a data receiving end. The data receiving end monitors a designated port and checks the CRC32 and frame integrity after receiving the data frame. If the check fails, the data receiving end returns a retransmission instruction (e.g., RETRY). After receiving the retransmission instruction from the data receiving end, the integrated board determines whether the data frame needs to be retransmitted. If so, it re-executes the steps for sending the network data frame and resends the data frame to the data receiving end. The data receiving end then receives the data frame and performs a check. If the check succeeds, the data receiving end returns an ACK message (e.g., ACK, status = 200), indicating that the network data frame has been correctly received.
[0103] During actual execution, the data receiver listens to a designated port, checks the CRC32 and frame integrity of received data frames, and returns an ACK message (including a receipt status code). If the check fails, a retransmission is requested. If the check succeeds, the timestamp and device ID are extracted from the frame header identifier. The payload data is decrypted using AES-256-CTR and the session key, restoring the original serial port data format (such as Modbus RTU messages). The data is then stored in a time series database for use by the visualization platform. Furthermore, the data receiver sends SMS / email alerts when incoming data exceeds the limit. When no data is collected, the main control enters sleep mode (only the network module maintains a heartbeat connection), reducing power consumption to below 10mA.
[0104] Therefore, the retransmission mechanism ensures that data can be transmitted correctly even if verification fails during transmission, which reduces the risk of data loss and improves the reliability of data transmission. When data verification fails, the system can automatically trigger the retransmission mechanism instead of directly discarding the data frame. This fault-tolerant mechanism improves the robustness of the system and ensures the integrity and accuracy of the data. The retransmission mechanism is only triggered when necessary, avoiding unnecessary data transmission, thereby optimizing the utilization of network resources and reducing bandwidth waste.
[0105] In summary, combined Figure 8 As shown, based on the discussion of the above embodiments, the present invention can achieve the following beneficial effects:
[0106] (1) High flexibility: By setting up a pluggable serial port module interface, the serial port modules of different projects can be easily replaced, and the system can be quickly adapted to various interface standards and communication protocol requirements. There is no need to redesign and configure the system for each project, which greatly improves the flexibility and scalability of the system.
[0107] (2) High transmission efficiency: Network communication technology is used to achieve remote transmission of serial port data. Compared with traditional serial port communication methods, it is not restricted by distance and wiring, and can achieve remote data transmission more efficiently and conveniently.
[0108] (3) Strong versatility: The technical solution of the present invention is applicable to various serial communication scenarios and has strong versatility and adaptability.
[0109] (4) Reduce maintenance costs: The system adopts a modular design and can be configured and expanded according to actual needs. There is no need to make large-scale changes to the entire system, which reduces the cost of upgrades and expansions.
[0110] According to the data transmission method proposed in an embodiment of the present invention, the data to be transmitted is read from the data transmission end, encrypted, and encapsulated according to a preset protocol to obtain a network data frame. The transmission mode of the network data frame is obtained, and the network data frame is sent to the data receiving end according to the transmission mode of the network data frame. The network data frame is parsed by the data receiving end and stored in a preset time series database. This solves the problems of the related technology that the fixed serial port communication mode makes it difficult to cope with different application scenarios and demand changes, has poor compatibility, and is complex to configure. The present invention can be configured and expanded according to actual needs, has high flexibility, strong versatility, and high transmission efficiency.
[0111] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method.
[0112] An embodiment of the present invention further provides a data transmission device.
[0113] Figure 9 It is a block diagram of an exemplary data transmission device according to an embodiment of the present invention.
[0114] like Figure 9 As shown, the data transmission device 10 includes: a reading module 100 , an encryption module 200 and a transmission module 300 .
[0115] The reading module 100 is used to read the data to be transmitted from the data transmission end.
[0116] The encryption module 200 is used to encrypt the data to be transmitted, encapsulate the encrypted data to be transmitted according to a preset protocol to obtain a network data frame, and obtain a transmission method of the network data frame.
[0117] The transmission module 300 is used to send the network data frame to the data receiving end according to the transmission mode of the network data frame, so that the data receiving end can parse the network data frame and store it in a preset time series database.
[0118] According to an embodiment of the present invention, the transmission mode of the network data frame includes network mode transmission and / or Bluetooth mode transmission.
[0119] According to an embodiment of the present invention, the transmission mode of the network data frame includes network mode transmission, and the transmission module 300 includes: an establishing unit and a first detecting unit.
[0120] The establishing unit is used to establish a connection with the data receiving end.
[0121] The first detection unit is used to detect the communication connection status between the data receiving end and the data receiving end when the connection establishment is completed, and send the network data frame to the data receiving end when there is no abnormality in the communication connection status.
[0122] According to one embodiment of the present invention, the establishing unit includes: a first sending subunit, a receiving subunit and a second sending subunit.
[0123] The first sending subunit is configured to send a first data packet including a first flag bit to a data receiving end, wherein the sequence number of the first data packet is a first initial sequence number.
[0124] The receiving subunit is configured to receive a second data packet sent by a data receiving end and containing a first flag bit and a second flag bit, wherein the sequence number of the second data packet is an initial sequence number of the data receiving end.
[0125] The second sending subunit is used to send a third data packet including a third flag bit to the data receiving end based on the second data packet, so as to confirm that the connection establishment is completed when the data receiving end receives the third data packet.
[0126] According to one embodiment of the present invention, the detection unit includes: a third sending subunit, a first acquiring subunit and a determining subunit.
[0127] The third sending subunit is configured to send a heartbeat packet to the data receiving end based on a preset period.
[0128] The first acquiring subunit is configured to acquire a first duration of time during which the receiving end performs feedback based on the heartbeat packet when no data is received.
[0129] The determination subunit is configured to determine that the communication connection state is abnormal if the first duration is greater than a first preset duration, and otherwise determine that the communication connection state is not abnormal.
[0130] According to one embodiment of the present invention, when it is determined that the communication connection state is abnormal, the determination subunit further includes: generating a subcomponent and sending a subcomponent.
[0131] The generating sub-component is used to generate the first reminder information based on the communication connection status.
[0132] The sending sub-component is used to send the first reminder information to a preset mobile terminal.
[0133] According to an embodiment of the present invention, the transmission mode of the network data frame includes Bluetooth mode transmission, and the transmission module 300 includes: a determination unit and a division unit.
[0134] The determination unit is used to determine the maximum payload.
[0135] The dividing unit is used to divide the network data frame into multiple data packets based on the maximum effective load, and send the multiple data packets to the data receiving end in sequence based on the order of the multiple data packets.
[0136] According to an embodiment of the present invention, when multiple data packets are sequentially sent to the data receiving end, the dividing unit further includes: a second acquiring subunit, a generating subunit and a fourth sending subunit.
[0137] The second obtaining subunit is configured to obtain a second duration of not receiving the feedback information sent by the data receiving end based on the current data packet when the feedback information sent by the data receiving end based on the current data packet is not received.
[0138] The generating subunit is configured to generate a second reminder message when the second duration is greater than a second preset duration.
[0139] The fourth sending subunit is configured to send the first reminder information to a preset mobile terminal.
[0140] According to an embodiment of the present invention, after sending the network data frame to the data receiving end according to the transmission mode of the network data frame, the transmission module 300 further includes: a judgment unit and an execution unit.
[0141] The judgment unit is used to judge whether a retransmission instruction sent by the data receiving end is received, wherein the retransmission instruction is issued by the data receiving end when the network data frame verification fails.
[0142] The execution unit is configured to re-execute the step of transmitting the network data frame to the data receiving end according to the transmission mode of the network data frame in the case that the retransmission instruction sent by the data receiving end is received.
[0143] According to one embodiment of the present application, the encryption module 200 comprises a first encryption unit, a second encryption unit, a third encryption unit and a fourth encryption unit.
[0144] The first encryption unit is configured to take the preset byte identifier and the preset byte timestamp as the frame header data.
[0145] The second encryption unit is configured to take the encrypted to-be-transmitted data as the payload data.
[0146] The third encryption unit is configured to take the preset byte check code and the byte end symbol as the frame tail data.
[0147] The fourth encryption unit is configured to obtain the network data frame according to the frame header data, the payload data and the frame tail data.
[0148] According to one embodiment of the present application, the reading module 100 comprises a second detection unit and a reading unit.
[0149] The second detection unit is configured to detect the buffer non-empty flag bit of the target register based on a preset cycle detection strategy to obtain a flag bit detection result.
[0150] The reading unit is configured to read the to-be-transmitted data from the data transmission end according to a polling strategy or an interrupt strategy based on the flag bit detection result, and store the to-be-transmitted data to the target buffer area.
[0151] According to one embodiment of the present application, before the to-be-transmitted data is stored to the target buffer area, the reading unit further comprises a rejection subunit and a synchronization subunit.
[0152] The rejection subunit is configured to reject the invalid data frame in the to-be-transmitted data.
[0153] The synchronization subunit is configured to perform timestamp synchronization on the to-be-transmitted data after the invalid data frame is rejected based on a preset timestamp synchronization strategy.
[0154] In summary, the features of the embodiments of the data transmission device can be referred to the related descriptions of the embodiments of the data transmission method, which will not be repeated here.
[0155] The embodiments of the present application also provide an electronic device, which can comprise:
[0156] The electronic device can comprise a memory 1001, a processor 1002 and a computer program stored in the memory 1001 and executable on the processor 1002.
[0157] When the processor 1002 executes the program, the data transmission method provided in the above embodiment is implemented.
[0158] Furthermore, the electronic device further includes:
[0159] The communication interface 1003 is used for communication between the memory 1001 and the processor 1002 .
[0160] The memory 1001 is used to store computer programs that can be run on the processor 1002 .
[0161] The memory 1001 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0162] If the memory 1001, processor 1002, and communication interface 1003 are implemented independently, the communication interface 1003, memory 1001, and processor 1002 can be connected to each other via a bus and communicate with each other. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. Buses can be divided into address buses, data buses, control buses, etc. For ease of representation, Figure 10 Only one thick line is used in the diagram, but this does not mean that there is only one bus or one type of bus.
[0163] Optionally, in a specific implementation, if the memory 1001, the processor 1002 and the communication interface 1003 are integrated on a chip, the memory 1001, the processor 1002 and the communication interface 1003 can communicate with each other through an internal interface.
[0164] The processor 1002 may be a central processing unit (CPU), an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention.
[0165] An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored. The computer program is configured to execute the steps of any of the above-mentioned data transmission method embodiments when running.
[0166] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.
[0167] An embodiment of the present invention further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in any one of the above-mentioned data transmission method embodiments are implemented.
[0168] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present invention.
[0169] The above is a detailed introduction to a data transmission method provided by the present invention. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only intended to help understand the method and core concept of the present invention. It should be noted that, for those skilled in the art, without departing from the principles of the present invention, several improvements and modifications may be made to the present invention, and such improvements and modifications also fall within the scope of protection of the claims of the present invention.
Claims
1. A data transmission method, characterized in that: The method is applied to an integrated board, which is provided with a power interface, a network interface, a data transmission interface, an integrated board chip, a Bluetooth wireless module, a first step-down converter, a second step-down converter, a storage register, and a display, and includes the following steps: When the external serial port module of the data transmission interface is connected to the data transmission end, the data to be transmitted of the data transmission end is read through the integrated board chip; Encrypting the data to be transmitted, encapsulating the encrypted data to be transmitted according to a preset protocol to obtain a network data frame, and obtaining a transmission mode of the network data frame through the integrated board chip; When the transmission mode of the network data frame is network mode transmission, the network data frame is sent to the data receiving end through the network externally connected to the network interface; when the transmission mode of the network data frame is Bluetooth mode transmission, the network data frame is sent to the data receiving end through the Bluetooth wireless module, so that the network data frame is parsed by the data receiving end and then stored in a preset time series database, wherein, The power interface is used to connect an external power source to power the integrated board; one end of the first voltage dropper is connected to the power interface, and the other end of the first voltage dropper is respectively connected to the network interface and the data transmission interface, for providing a first stable voltage for the network interface and the data transmission interface; one end of the second voltage dropper is connected to the first voltage dropper, and the other end of the second voltage dropper is respectively connected to the Bluetooth wireless module, the storage register and the display, for providing a second stable voltage for the Bluetooth wireless module, the storage register and the display, the storage register is used to store data, and the display is used to display the status of the integrated board and provide an interactive port for the user; The transmission mode of the network data frame includes Bluetooth mode transmission, and sending the network data frame to the data receiving end includes: determining a maximum payload; dividing the network data frame into multiple data packets based on the maximum payload, and sending the multiple data packets to the data receiving end in sequence based on the order of the multiple data packets; The method of reading the data to be transmitted from the data transmission end includes: based on a preset loop detection strategy, detecting the buffer non-empty flag of the target register to obtain a flag detection result; based on the flag detection result, reading the data to be transmitted from the data transmission end according to a polling strategy or an interrupt strategy, and storing the data to be transmitted in the target buffer area.
2. The method according to claim 1, characterized in that The transmission mode of the network data frame includes network mode transmission and / or Bluetooth mode transmission.
3. The method according to claim 2, characterized in that The transmission mode of the network data frame includes network mode transmission, and sending the network data frame to the data receiving end according to the transmission mode of the network data frame includes: Establishing a connection with the data receiving end; When the connection establishment is completed, the communication connection status with the data receiving end is detected, and when there is no abnormality in the communication connection status, the network data frame is sent to the data receiving end.
4. The method according to claim 3, characterized in that The establishing of a connection with the data receiving end includes: Sending a first data packet including a first flag bit to the data receiving end, wherein the sequence number of the first data packet is a first initial sequence number; receiving a second data packet sent by the data receiving end and including the first flag bit and the second flag bit, wherein the sequence number of the second data packet is an initial sequence number of the data receiving end; Based on the second data packet, a third data packet including a third flag bit is sent to the data receiving end, so as to confirm that the connection establishment is completed when the data receiving end receives the third data packet.
5. The method according to claim 3, characterized in that The detecting of the communication connection status with the data receiving end includes: Based on a preset period, sending a heartbeat packet to the data receiving end; Obtaining a first duration of time during which the data receiving end does not receive feedback based on the heartbeat packet; If the first duration is greater than a first preset duration, it is determined that the communication connection state is abnormal; otherwise, it is determined that the communication connection state is not abnormal.
6. The method according to claim 5, characterized in that When it is determined that the communication connection state is abnormal, the method further includes: generating first reminder information based on the communication connection status; The first reminder information is sent to a preset mobile terminal.
7. The method according to claim 1, characterized in that When the plurality of data packets are sequentially sent to the data receiving end based on the order of the plurality of data packets, the method further includes: In a case where feedback information sent by the data receiving end based on the current data packet is not received, acquiring a second duration of not receiving the feedback information sent by the data receiving end based on the current data packet; When the second duration is greater than a second preset duration, generating a second reminder message; Send a second reminder message to a preset mobile terminal.
8. The method according to claim 1, characterized in that After sending the network data frame to the data receiving end according to the transmission mode of the network data frame, the method further includes: Determining whether a retransmission instruction sent by the data receiving end is received, wherein the retransmission instruction is issued by the data receiving end when a check of the network data frame fails; In case of receiving a retransmission instruction sent by the data receiving end, the step of sending the network data frame to the data receiving end according to the transmission mode of the network data frame is re-executed.
9. The method according to claim 1, characterized in that The encapsulating the encrypted data to be transmitted according to the preset protocol to obtain a network data frame includes: Using the preset byte identifier and the preset byte timestamp as frame header data; Using the encrypted data to be transmitted as payload data; Use the preset byte check code and byte terminator as frame tail data; The network data frame is obtained according to the frame header data, the payload data and the frame tail data.
10. The method according to claim 1, characterized in that Before storing the data to be transmitted in the target buffer area, the method further includes: Eliminating invalid data frames in the data to be transmitted; Based on the preset timestamp synchronization strategy, the timestamp synchronization is performed on the data to be transmitted after invalid data frames are removed.
11. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the data transmission method according to any one of claims 1 to 10.
12. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the data transmission method according to any one of claims 1 to 10.
13. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the data transmission method according to any one of claims 1 to 10 are implemented.
Citation Information
Patent Citations
Long connection device and network system
CN113765948A
Virtual power plant communication protocol simulation method and system in ad hoc network mode
CN118175076A