Data transmission method and system, electronic equipment and storage medium
By constructing a lightweight environmental monitoring reporting protocol data frame, encapsulating sensor data using a TLV structure, and optimizing the transmission protocol, the problems of high protocol overhead and low efficiency in environmental monitoring data transmission are solved, achieving efficient high-frequency, low-volume reporting.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHINA UNITED NETWORK COMM GRP CO LTD
- Filing Date
- 2026-02-13
- Publication Date
- 2026-04-17
AI Technical Summary
Existing methods for transmitting data in environmental monitoring suffer from high protocol overhead, low data transmission efficiency, and are not suitable for high-frequency, low-volume reporting scenarios.
The data frame is constructed using the lightweight environmental reporting protocol, which includes a fixed header and multiple data items. The header includes a frame start symbol, device ID, Unix timestamp, and number of data items. The data items encapsulate sensor data using a TLV structure and are transmitted via UDP or TCP protocol. The monitoring server parses and confirms the data.
It significantly reduces protocol overhead, improves data transmission efficiency, is suitable for periodic reporting scenarios with high frequency and small data volume, supports concurrent transmission of massive environmental devices, and reduces network interaction frequency and traffic load.
Smart Images

Figure CN121887834A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of data center technology, and in particular to a data transmission method, system, electronic device, and storage medium. Background Technology
[0002] In the operation and maintenance of data center infrastructure, the environmental monitoring system (monitoring power, environment, security, etc.) is the cornerstone of ensuring its safe and stable operation. This system relies on a large number of sensors and devices (such as temperature and humidity sensors, power meters, water immersion detectors, etc.) to continuously report operational data.
[0003] Currently, the industry commonly uses traditional and universal protocols such as SNMP (Simple Network Management Protocol) and Modbus TCP (Transmission Control Protocol) in environmental monitoring data transmission scenarios. However, these protocols are not designed for the "high-frequency, multi-parameter, low-overhead" data reporting requirements of environmental monitoring equipment in data centers, and therefore exhibit significant compatibility deficiencies in practical applications, as follows:
[0004] (1) SNMP protocol: It usually adopts a polling mechanism, in which the server actively queries the device, and the interaction is frequent. Its data packets (especially Trap alarm packets) contain a lot of protocol header information such as version identifier, community word, PDU (Packet Data Unit) type, etc. When used to transmit data from a single sensor, the effective payload ratio is low and the protocol overhead is large.
[0005] (2) Modbus TCP protocol: Although it is suitable for industrial control scenarios, its message structure corresponds to a function code and a set of register addresses for each request / response. For environmental devices that need to report multiple types of data (such as temperature, humidity, and switch status) at the same time, if this protocol is used, either multiple requests are required, or a predefined, inflexible composite reading function is used, resulting in low data transmission efficiency or transmission of unnecessary data when the data changes.
[0006] (3) Insufficient adaptability: Neither of the above two protocols is suitable for high-frequency, low-data-volume reporting scenarios. Environmental monitoring devices typically need to report small-scale monitoring data frequently, but the interaction model and message structure of traditional protocols are cumbersome in this scenario, generating a large amount of "useless" traffic.
[0007] In summary, existing data transmission methods for environmental monitoring suffer from problems such as high protocol overhead, low data transmission efficiency, and unsuitability for high-frequency, low-volume reporting scenarios. Summary of the Invention
[0008] This disclosure provides a data transmission method, system, electronic device, and storage medium to solve the problems of existing data transmission methods for environmental monitoring, which suffer from high protocol overhead, low data transmission efficiency, and are not suitable for high-frequency, low-volume reporting scenarios.
[0009] In a first aspect, this disclosure provides a data transmission method applied to environmental equipment, the method comprising:
[0010] Collect monitoring data from multiple sensors;
[0011] A lightweight environmental monitoring reporting protocol data frame is constructed based on the collected monitoring data. The data frame includes a fixed header and multiple data items. The fixed header includes a frame start character, the device ID of the environmental monitoring device, a Unix timestamp, and the number of data items. Each of the multiple data items is used to encapsulate the monitoring data of a sensor.
[0012] The data frame is sent to the monitoring server, so that the monitoring server can receive the data frame and parse it based on the fixed header and multiple data items to obtain the monitoring data of the corresponding sensor.
[0013] Furthermore, the dynamic environment lightweight reporting protocol runs at the application layer of the Transmission Control Protocol (TCP) / Internet Protocol (IP) stack;
[0014] Each data item adopts a TLV structure, which sequentially contains a sensor type identifier, a data value length, and the actual sensor data of variable length;
[0015] Sending the data frame to the monitoring server specifically includes:
[0016] The data frames are sent to the monitoring server based on the User Datagram Protocol (UDP) or TCP protocol.
[0017] Furthermore, the step of constructing a lightweight environmental reporting protocol data frame based on the collected monitoring data specifically includes:
[0018] The number of sensors N that need to be reported is determined based on the collected monitoring data, where N is a positive integer;
[0019] The fixed header of the data frame is filled with a preset frame start character, the device ID of the environmental device, the Unix timestamp corresponding to the data acquisition, and the number of sensors N as the number of data items;
[0020] For each sensor that needs to report, a TLV structure is generated, including a sensor type identifier, data value length, and actual sensor data items, which are then sequentially appended to the fixed header.
[0021] Furthermore, after sending the data frame to the monitoring server, the method further includes:
[0022] If a simplified confirmation packet is received from the monitoring server within the preset timeout period, the data transmission is confirmed to be complete. The simplified confirmation packet contains the device ID of the environmental monitoring device and the receiving timestamp corresponding to the data frame.
[0023] If a simplified confirmation packet is not received from the monitoring server within the preset timeout period, the data frame is retransmitted to the monitoring server.
[0024] Secondly, this disclosure provides a data transmission method applied to a monitoring server, the method comprising:
[0025] The system receives a lightweight reporting protocol data frame from the environmental monitoring device. The data frame is constructed by the environmental monitoring device after collecting monitoring data from multiple sensors. The data frame includes a fixed header and multiple data items. The fixed header includes a frame start character, the device ID of the environmental monitoring device, a Unix timestamp, and the number of data items. Each of the multiple data items is used to encapsulate the monitoring data of one sensor.
[0026] Based on the fixed head and multiple data items, the monitoring data of the corresponding sensor is obtained through parsing.
[0027] Furthermore, the dynamic environment lightweight reporting protocol runs at the application layer of the Transmission Control Protocol (TCP) / Internet Protocol (IP) stack;
[0028] Each data item adopts a TLV structure, which sequentially contains a sensor type identifier, a data value length, and the actual sensor data of variable length;
[0029] The received environmental monitoring device sends a lightweight environmental reporting protocol data frame, specifically including:
[0030] Receive the data frames sent by the environmental monitoring device based on the User Datagram Protocol (UDP) or TCP protocol.
[0031] Furthermore, after obtaining the monitoring data of the corresponding sensor based on the fixed head and multiple data items, the method further includes:
[0032] A simplified confirmation packet is sent to the environmental monitoring device. The simplified confirmation packet contains the device ID of the environmental monitoring device and the receiving timestamp corresponding to the data frame.
[0033] Thirdly, this disclosure provides a data transmission system, including environmental monitoring equipment and a monitoring server;
[0034] The dynamic environment device is used to perform the data transmission method described in the first aspect;
[0035] The monitoring server is used to execute the data transmission method described in the second aspect.
[0036] Fourthly, this disclosure provides an electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores one or more computer programs executable by the at least one processor, the one or more computer programs being executed by the at least one processor to enable the at least one processor to perform the data transmission method described in the first or second aspect above.
[0037] Fifthly, this disclosure provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the data transmission method described in the first or second aspect above.
[0038] The data transmission method, system, electronic device, and storage medium disclosed herein construct a data frame with a specific structure using a lightweight environmental monitoring reporting protocol. This protocol uses a fixed header to concisely include essential information such as the frame start symbol, the device ID of the environmental monitoring device, the Unix timestamp, and the number of data items. Combined with a design where each data item independently encapsulates monitoring data from a single sensor, this significantly increases the proportion of effective data payload in the data packet, substantially reduces protocol transmission overhead, and enables a single data frame to efficiently encapsulate monitoring data from multiple sensors on the same device. This greatly improves data transmission efficiency while ensuring data integrity and timeliness, making it particularly suitable for high-frequency, low-volume periodic reporting scenarios. It can support concurrent transmission from a large number of environmental monitoring devices, reducing network interaction frequency and overall traffic load. This solves the problems of existing data transmission methods for environmental monitoring data transmission, which suffer from high protocol overhead, low data transmission efficiency, and unsuitability for high-frequency, low-volume reporting scenarios. Attached Figure Description
[0039] The accompanying drawings are provided to further illustrate the present disclosure and form part of the specification. They are used together with the embodiments of the present disclosure to explain the disclosure and do not constitute a limitation thereof. In the drawings:
[0040] Figure 1 A flowchart illustrating a data transmission method provided in this embodiment of the disclosure;
[0041] Figure 2 This is a schematic diagram of the structure of a lightweight environmental reporting protocol data frame provided in an embodiment of this disclosure;
[0042] Figure 3 A flowchart illustrating yet another data transmission method provided in this disclosure embodiment;
[0043] Figure 4 A block diagram of a data transmission system provided in an embodiment of this disclosure;
[0044] Figure 5 This is a block diagram of an electronic device provided in an embodiment of the present disclosure. Detailed Implementation
[0045] To enable those skilled in the art to better understand the technical solutions of this disclosure, exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments of this disclosure to aid understanding. These should be considered merely exemplary. Therefore, those skilled in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0046] Where there is no conflict, the various embodiments of this disclosure and the features thereof in the embodiments may be combined with each other.
[0047] As used herein, the term “and / or” includes any and all combinations of one or more related enumerated entries.
[0048] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit this disclosure. As used herein, the singular forms “a” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will also be understood that when the terms “comprising” and / or “made of” are used in this specification, the presence of the stated feature, integral, step, operation, element, and / or component is specified, but the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or groups thereof is not excluded. Words such as “connected” or “linked” are not limited to physical or mechanical connections but can include electrical connections, whether direct or indirect.
[0049] Unless otherwise specified, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and this disclosure, and will not be interpreted as having an idealized or overly formal meaning, unless expressly so defined herein.
[0050] Figure 1 A flowchart illustrating a data transmission method provided in this disclosure embodiment, wherein the data transmission method is applied to an environmental device, referencing... Figure 1 The method includes:
[0051] Step S101: Collect monitoring data from multiple sensors.
[0052] Specifically, the environmental monitoring equipment collects monitoring data from multiple sensors at preset intervals, such as temperature data in degrees Celsius collected by the temperature sensor, percentage humidity data collected by the humidity sensor, and A / B / C three-phase current values collected by the three-phase current sensor.
[0053] Step S102: Construct a lightweight environmental reporting protocol data frame based on the collected monitoring data. The data frame includes a fixed header and multiple data items. The fixed header includes a frame start symbol, the device ID of the environmental device, a Unix timestamp, and the number of data items. Each of the multiple data items is used to encapsulate the monitoring data of one sensor.
[0054] Specifically, when the reporting time point is reached or the monitoring data of any sensor exceeds a preset threshold, the environmental monitoring device constructs a lightweight environmental monitoring reporting protocol data frame based on the collected monitoring data. The lightweight environmental monitoring reporting protocol runs at the application layer of the TCP / IP (Internet Protocol) protocol stack. The corresponding data frame structure includes a fixed header and a variable-length data item part. In order to reduce protocol transmission overhead, a very simple fixed header is adopted, which only contains a 1-byte frame start character, a 4-byte device ID, a 4-byte Unix timestamp, and a 1-byte data item count. At the same time, in order to enable a single data frame to flexibly and efficiently encapsulate multiple sensor data of different types and lengths on the same environmental monitoring device and avoid the overhead caused by multiple requests / responses, a TLV (Type-Length-Value) structure is used to flexibly encapsulate multiple sensor data. That is, each data item adopts a TLV structure, which sequentially contains a sensor type identifier, a data value length, and the actual sensor data of variable length.
[0055] It should be noted that the TLV structure is a data encapsulation format. It defines Type as the sensor type identifier, Length as the data value length, and Value as the actual data encapsulated by the sensor. Each sensor is assigned a unique "sensor type identifier". For example, if a dynamic environment device has multiple temperature sensors (such as the internal temperature of the device and the ambient temperature of the computer room), the sensor type identifiers can be set as 0x01 = internal temperature of the device and 0x06 = ambient temperature of the computer room.
[0056] In some embodiments, constructing a lightweight environmental reporting protocol data frame based on the collected monitoring data specifically includes:
[0057] The number of sensors N that need to be reported is determined based on the collected monitoring data, where N is a positive integer;
[0058] The fixed header of the data frame is filled with a preset frame start character, the device ID of the environmental device, the Unix timestamp corresponding to the data acquisition, and the number of sensors N as the number of data items;
[0059] For each sensor that needs to report, a TLV structure is generated, including a sensor type identifier, data value length, and actual sensor data items, which are then sequentially appended to the fixed header.
[0060] Specifically, the environmental monitoring device first fills in the preset frame start character (e.g., 0xAA), its own globally unique device ID, the Unix timestamp corresponding to the data acquisition, and the number of sensors N to be reported into the corresponding positions according to the field order of the fixed header. Then, for each sensor, a TLV structure data item is generated and sequentially concatenated after the fixed header to form a complete environmental monitoring lightweight reporting protocol data frame.
[0061] Step S103: Send the data frame to the monitoring server so that the monitoring server can obtain the monitoring data of the corresponding sensor based on the fixed header and multiple data items after receiving the data frame.
[0062] Specifically, the environmental monitoring device sends data frames to the monitoring server based on UDP (User Datagram Protocol) or TCP protocol. To further reduce connection overhead, UDP is preferred. Upon receiving a data frame, the monitoring server first checks if the frame start character is a preset one (e.g., 0xAA) to determine if the data frame is valid. If valid, it further parses the device ID, records the data time according to the Unix timestamp, reads the number of data items N, and then loops N times, accurately extracting the value of each sensor based on the Type and Length fields each time.
[0063] In some embodiments, after sending the data frame to the monitoring server, the method further includes:
[0064] If a simplified confirmation packet is received from the monitoring server within the preset timeout period, the data transmission is confirmed to be complete. The simplified confirmation packet contains the device ID of the environmental monitoring device and the receiving timestamp corresponding to the data frame.
[0065] If a simplified confirmation packet is not received from the monitoring server within the preset timeout period, the data frame is retransmitted to the monitoring server.
[0066] Specifically, after the monitoring server successfully parses the data, it can send a very simple acknowledgment packet to the environmental monitoring device. This packet only contains the device ID of the environmental monitoring device and the receiving timestamp of the data frame. If the environmental monitoring device does not receive the acknowledgment packet within the timeout period, it can retransmit.
[0067] It should be noted that this "minimalist acknowledgment packet" is in contrast to the acknowledgment mechanisms of traditional protocols. For example, a TCP acknowledgment (ACK) message needs to carry more than ten bytes of protocol information, such as the sequence number and window size; an SNMP response message needs to reuse the complete protocol header. In this embodiment, the "minimalist acknowledgment packet" specifically refers to an acknowledgment message designed at the application layer for reliable transmission, containing only the device ID of the environmental monitoring device and the timestamp of the data frame received by the server. Its application layer payload can be simplified to 8 bytes (calculated as 4 bytes for the device ID and 4 bytes for the timestamp), thereby minimizing the acknowledgment overhead.
[0068] It should be noted that the data transmission method provided in this disclosure has the following beneficial effects:
[0069] 1) Significantly reduce protocol overhead: By designing a minimalist, customized message header structure and eliminating redundant fields in general protocols, the proportion of effective payload in data packets is maximized.
[0070] 2) Improve data transmission efficiency: While ensuring data reliability, reduce the size of each data packet, thereby supporting concurrent reporting by more devices under the same bandwidth, or reducing overall network traffic.
[0071] 3) Optimize high-frequency, low-data-volume transmission: Design a lightweight, push-based communication mechanism that is more suitable for the characteristics of environmental equipment that actively and periodically report data.
[0072] In one specific embodiment, a lightweight data transmission protocol (i.e., lightweight environmental reporting protocol) and data transmission method for use in a data center environmental monitoring system are provided. By designing a novel data frame structure and defining corresponding communication rules, the problems of high protocol overhead, low data transmission efficiency, and insufficient adaptability to high-frequency, small-volume reporting in traditional general protocols (such as SNMP and Modbus TCP) in environmental monitoring scenarios are solved. Specifically, the following are included:
[0073] 1. Protocol stack location and communication model
[0074] The lightweight environmental monitoring (EGM) reporting protocol runs at the application layer of the TCP / IP protocol stack, based on UDP or TCP transmission. UDP is preferred to further reduce connection overhead, and reliability is ensured through an application-layer acknowledgment mechanism. The communication model is as follows: the EGM device acts as a client, actively reporting data to the monitoring server. The EGM device is an intelligent monitoring terminal deployed within a data center, integrating sensors, microcontrollers, and communication modules. It serves as the data source and execution end of this protocol, collecting monitoring data such as power status, environmental parameters, and security signals, and actively reporting the data to the monitoring server based on preset rules.
[0075] 2. Data Frame Structure
[0076] The lightweight environmental reporting protocol's data frames consist of a fixed header and variable-length data items; a single data frame can contain readings from multiple sensors.
[0077] Fixed header: contains necessary information such as frame synchronization (i.e., frame start character), device identifier, timestamp, and number of data items;
[0078] Data item section: It adopts the TLV (Type-Length-Value) structure to flexibly encapsulate data from multiple sensors.
[0079] Specifically, the structural diagram of the dynamic environment lightweight reporting protocol data frame can be shown as follows: Figure 2 As shown, the descriptions of each part are as follows:
[0080] Fixed header: Includes only the start of frame character, device ID, timestamp, and number of data items;
[0081] Start of frame (1 byte): Fixed as 0xAA, used to identify the beginning of a data frame, facilitating frame synchronization by the receiver.
[0082] Device ID (4 bytes): A globally unique device identifier.
[0083] Timestamp (4 bytes): Unix timestamp of data acquisition.
[0084] Number of data items (1 byte): Indicates the number of data items (N) contained in this frame.
[0085] Data Item: Each data item uses a TLV structure to flexibly describe the data from a sensor.
[0086] Type (1 byte): Indicates the sensor type (e.g., 0x01 represents temperature, 0x02 represents humidity, 0x03 represents three-phase current, etc.).
[0087] Length (length, 1 byte): Indicates the length in bytes of the subsequent Value field.
[0088] Value (variable length): The actual numerical value read by the sensor, with a customizable encoding format (e.g., 4-byte floating-point number, 2-byte integer, etc.).
[0089] The TLV data item type definition example is shown in Table 1:
[0090] Table 1: Example of TLV data item type definition
[0091]
[0092] 3. Workflow and Examples
[0093] (1) Data Packaging: The environmental monitoring equipment collects data from each sensor according to a preset cycle. When the reporting time point is reached or the data change exceeds the threshold, the equipment begins to construct a data frame.
[0094] Fill in the fixed header: Frame start character 0xAA, local device ID, current timestamp.
[0095] Enter the number of sensors N that need to be reported into the "Number of Data Items" field.
[0096] For each sensor, a data item with a TLV structure is generated and sequentially appended to the header.
[0097] (2) Data transmission: The environmental monitoring equipment sends the assembled complete data frame to the designated port of the monitoring server via UDP packets.
[0098] (3) Monitoring server resolution: The monitoring server listens on the port and, upon receiving a UDP packet:
[0099] Check if the start-of-frame character is 0xAA to confirm that it is a valid frame.
[0100] Parse the device ID to identify the data source.
[0101] Record data time based on timestamps.
[0102] Read the number of data items N, then loop N times, and each time accurately extract the value of each sensor based on the Type and Length fields.
[0103] (4) Reliability Guarantee (Optional Enhancement): After the monitoring server successfully parses the data, it can send a very simple acknowledgment packet to the environmental monitoring device (e.g., containing only the device ID of the environmental monitoring device and the timestamp of the received data frame). If the environmental monitoring device does not receive the acknowledgment packet within the timeout period, it can retransmit.
[0104] It should be noted that the data transmission method provided in this disclosure has the following characteristics:
[0105] a) The minimalist fixed header design significantly reduces protocol overhead compared to traditional protocols by precisely defining a header that contains only necessary information such as frame synchronization, device identification, timestamps, and the number of data items.
[0106] b) Data items are organized using a TLV structure. This approach allows a single data frame to flexibly and efficiently encapsulate multiple sensor data of different types and lengths on the same device, avoiding the overhead of multiple requests / responses.
[0107] c) Overall protocol communication model. Combining a lightweight communication method based on UDP and initiated by devices, data transmission efficiency in environmental monitoring scenarios has been specifically optimized.
[0108] The data transmission method provided in this disclosure constructs a data frame with a specific structure using a lightweight environmental monitoring reporting protocol. This method uses a fixed header to streamline essential information including the frame start symbol, the device ID of the environmental monitoring device, the Unix timestamp, and the number of data items. Combined with a design where each data item independently encapsulates monitoring data from a single sensor, this significantly increases the proportion of effective data payload in the data packet, significantly reduces protocol transmission overhead, and allows a single data frame to efficiently encapsulate monitoring data from multiple sensors on the same device. This greatly improves data transmission efficiency while ensuring data integrity and timeliness, making it particularly suitable for high-frequency, low-volume periodic reporting scenarios. It can support concurrent transmission from a large number of environmental monitoring devices, reducing network interaction frequency and overall traffic load. This solves the problems of existing data transmission methods for environmental monitoring data transmission, which suffer from high protocol overhead, low data transmission efficiency, and unsuitability for high-frequency, low-volume reporting scenarios.
[0109] Figure 3 A flowchart of another data transmission method provided in this disclosure embodiment is shown below. Figure 3 This data transmission method is applied to monitoring servers and includes:
[0110] Step S201: Receive the lightweight reporting protocol data frame sent by the environmental monitoring device. The data frame is constructed by the environmental monitoring device after collecting monitoring data from multiple sensors. The data frame includes a fixed header and multiple data items. The fixed header includes a frame start character, the device ID of the environmental monitoring device, a Unix timestamp, and the number of data items. Each of the multiple data items is used to encapsulate the monitoring data of one sensor.
[0111] Specifically, the environmental monitoring equipment collects monitoring data from multiple sensors at a preset cycle. When the reporting time point is reached or the monitoring data of any sensor exceeds a preset threshold, the environmental monitoring equipment constructs a lightweight reporting protocol data frame based on the collected monitoring data and sends it to the monitoring server.
[0112] In some embodiments, the dynamic environment lightweight reporting protocol runs at the application layer of the Transmission Control Protocol (TCP) / Internet Protocol (IP) stack.
[0113] Each data item adopts a TLV structure, which sequentially contains a sensor type identifier, a data value length, and the actual sensor data of variable length;
[0114] The received environmental monitoring device sends a lightweight environmental reporting protocol data frame, specifically including:
[0115] Receive the data frames sent by the environmental monitoring device based on the User Datagram Protocol (UDP) or TCP protocol.
[0116] Specifically, the lightweight environmental reporting protocol runs at the application layer of the TCP / IP protocol stack. The corresponding data frame structure includes a fixed header and variable-length data items. To reduce protocol transmission overhead, a simplified fixed header is used, containing only a 1-byte start-of-frame character, a 4-byte device ID, a 4-byte Unix timestamp, and a 1-byte number of data items. Meanwhile, to enable a single data frame to flexibly and efficiently encapsulate multiple sensor data of different types and lengths on the same environmental device, avoiding the overhead of multiple requests / responses, a TLV structure is used to flexibly encapsulate multiple sensor data. That is, each data item adopts a TLV structure, which sequentially contains a sensor type identifier, a data value length, and the actual sensor data of variable length.
[0117] Specifically, the environmental monitoring device sends data frames to the monitoring server based on UDP or TCP protocols. In order to further reduce connection overhead, the environmental monitoring device preferably uses the UDP protocol to send the data frames to the monitoring server.
[0118] Step S202: Based on the fixed head and multiple data items, obtain the monitoring data of the corresponding sensor.
[0119] Specifically, after receiving a data frame, the monitoring server first checks whether the frame start character is the preset frame start character (e.g., 0xAA) to determine whether the data frame is a valid frame. If it is a valid frame, it further parses the device ID, records the data time according to the Unix timestamp, reads the number of data items N, and then loops N times. Each time, it accurately extracts the value of each sensor based on the Type and Length fields.
[0120] In some embodiments, after obtaining the monitoring data of the corresponding sensor based on the fixed head and multiple data items, the method further includes:
[0121] A simplified confirmation packet is sent to the environmental monitoring device. The simplified confirmation packet contains the device ID of the environmental monitoring device and the receiving timestamp corresponding to the data frame.
[0122] Specifically, after the monitoring server successfully parses the data, it can send a very simple acknowledgment packet to the environmental monitoring device. This packet only contains the device ID of the environmental monitoring device and the receiving timestamp of the data frame. If the environmental monitoring device does not receive the acknowledgment packet within the timeout period, it can retransmit.
[0123] It is understood that the various method embodiments mentioned above in this disclosure can be combined with each other to form combined embodiments without violating the principle and logic. Due to space limitations, this disclosure will not elaborate further. Those skilled in the art will understand that in the above methods of specific implementation, the specific execution order of each step should be determined by its function and possible internal logic.
[0124] Figure 4 This is a block diagram of a data transmission system provided in an embodiment of the present disclosure.
[0125] Reference Figure 4 This disclosure provides a data transmission system, including an environmental monitoring device 31 and a monitoring server 32.
[0126] The dynamic environment device 31 is used to execute the data transmission method on the dynamic environment device side described above;
[0127] The monitoring server 32 is used to execute the data transmission method described above on the monitoring server side.
[0128] Figure 5 This is a block diagram of an electronic device provided in an embodiment of the present disclosure.
[0129] Reference Figure 5 This disclosure provides an electronic device, which includes: at least one processor 701; at least one memory 702; and one or more I / O interfaces 703 connected between the processor 701 and the memory 702; wherein the memory 702 stores one or more computer programs that can be executed by the at least one processor 701, and the one or more computer programs are executed by the at least one processor 701 to enable the at least one processor 701 to perform the above-described data transmission method.
[0130] This disclosure also provides a computer-readable storage medium storing a computer program thereon, wherein the computer program, when executed by a processor, implements the aforementioned data transmission method. The computer-readable storage medium may be volatile or non-volatile.
[0131] In summary, the data transmission method, system, electronic device, and storage medium provided in this disclosure construct a data frame with a specific structure using a lightweight environmental monitoring reporting protocol. This involves fixing the header and simplifying it to include essential information such as the frame start symbol, the device ID of the environmental monitoring device, the Unix timestamp, and the number of data items. Combined with a design where each data item independently encapsulates monitoring data from a single sensor, this significantly increases the proportion of effective data payload in the data packet, significantly reduces protocol transmission overhead, and enables a single data frame to efficiently encapsulate monitoring data from multiple sensors on the same device. This greatly improves data transmission efficiency while ensuring data integrity and timeliness, making it particularly suitable for high-frequency, low-volume periodic reporting scenarios. It can support concurrent transmission from a large number of environmental monitoring devices, reducing network interaction frequency and overall traffic load. This solves the problems of existing data transmission methods for environmental monitoring data transmission, which suffer from high protocol overhead, low data transmission efficiency, and unsuitability for high-frequency, low-volume reporting scenarios.
[0132] Those skilled in the art will understand that all or some of the steps, systems, and apparatuses disclosed above, and their functional modules / units, can be implemented as software, firmware, hardware, or suitable combinations thereof. In hardware implementations, the division between functional modules / units mentioned above does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed collaboratively by several physical components. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit (ASIC). Such software can be distributed on a computer-readable storage medium, which may include computer storage media (or non-transitory media) and communication media (or transient media).
[0133] As is known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information, such as computer-readable program instructions, data structures, program modules, or other data. Computer storage media includes, but is not limited to, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), static random access memory (SRAM), flash memory or other memory technologies, portable compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and is accessible to a computer. Furthermore, it is known to those skilled in the art that communication media typically contain computer-readable program instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.
[0134] The computer-readable program instructions described herein can be downloaded from computer-readable storage media to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to the computer-readable storage media in the respective computing / processing device.
[0135] Computer program instructions used to perform the operations of this disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, status setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages such as Smalltalk, C++, etc., and conventional procedural programming languages such as the "C" language or similar programming languages. The computer-readable program instructions may execute entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuitry, such as programmable logic circuitry, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), is personalized by utilizing the status information of the computer-readable program instructions to implement various aspects of this disclosure.
[0136] This disclosure has disclosed exemplary embodiments, and although specific terminology has been used, it is for general illustrative purposes only and should not be construed as limiting. In some instances, it will be apparent to those skilled in the art that features, characteristics, and / or elements described in conjunction with particular embodiments may be used alone, or in combination with features, characteristics, and / or elements described in conjunction with other embodiments, unless otherwise expressly indicated. Therefore, those skilled in the art will understand that various changes in form and detail may be made without departing from the scope of this disclosure as set forth by the appended claims.
Claims
1. A data transmission method, characterized by, Applied to environmental equipment, the method includes: Collect monitoring data from multiple sensors; A lightweight environmental monitoring reporting protocol data frame is constructed based on the collected monitoring data. The data frame includes a fixed header and multiple data items. The fixed header includes a frame start character, the device ID of the environmental monitoring device, a Unix timestamp, and the number of data items. Each of the multiple data items is used to encapsulate the monitoring data of one sensor. The data frame is sent to the monitoring server, so that the monitoring server can receive the data frame and parse it based on the fixed header and multiple data items to obtain the monitoring data of the corresponding sensor.
2. The method of claim 1, wherein, The dynamic environment lightweight reporting protocol runs at the application layer of the Transmission Control Protocol (TCP) / Internet Protocol (IP) stack. Each data item adopts a TLV structure, which sequentially contains a sensor type identifier, a data value length, and the actual sensor data of variable length; Sending the data frame to the monitoring server specifically includes: The data frames are sent to the monitoring server based on the User Datagram Protocol (UDP) or TCP protocol.
3. The method of claim 2, wherein, The construction of the lightweight environmental reporting protocol data frame based on the collected monitoring data specifically includes: The number of sensors N that need to be reported is determined based on the collected monitoring data, where N is a positive integer; The fixed header of the data frame is filled with a preset frame start character, the device ID of the environmental device, the Unix timestamp corresponding to the data acquisition, and the number of sensors N as the number of data items; For each sensor that needs to report, a TLV structure is generated, including a sensor type identifier, data value length, and actual sensor data items, which are then sequentially appended to the fixed header.
4. The method of claim 2, wherein, After sending the data frame to the monitoring server, the method further includes: If a simplified confirmation packet is received from the monitoring server within the preset timeout period, the data transmission is confirmed to be complete. The simplified confirmation packet contains the device ID of the environmental monitoring device and the receiving timestamp corresponding to the data frame. If a simplified confirmation packet is not received from the monitoring server within the preset timeout period, the data frame is retransmitted to the monitoring server.
5. A data transmission method, characterized by, Applied to a monitoring server, the method includes: The system receives a lightweight reporting protocol data frame from the environmental monitoring device. The data frame is constructed by the environmental monitoring device after collecting monitoring data from multiple sensors. The data frame includes a fixed header and multiple data items. The fixed header includes a frame start character, the device ID of the environmental monitoring device, a Unix timestamp, and the number of data items. Each of the multiple data items is used to encapsulate the monitoring data of one sensor. Based on the fixed head and multiple data items, the monitoring data of the corresponding sensor is obtained through parsing.
6. The method of claim 5, wherein, The dynamic environment lightweight reporting protocol runs at the application layer of the Transmission Control Protocol (TCP) / Internet Protocol (IP) stack. Each data item adopts a TLV structure, which sequentially contains a sensor type identifier, a data value length, and the actual sensor data of variable length; The received environmental monitoring device sends a lightweight environmental reporting protocol data frame, specifically including: Receive the data frames sent by the environmental monitoring device based on the User Datagram Protocol (UDP) or TCP protocol.
7. The method of claim 6, wherein, After obtaining the monitoring data of the corresponding sensor based on the fixed head and multiple data items, the method further includes: A simplified confirmation packet is sent to the environmental monitoring device. The simplified confirmation packet contains the device ID of the environmental monitoring device and the receiving timestamp corresponding to the data frame.
8. A data transmission system, characterized by This includes environmental monitoring equipment and monitoring servers; The dynamic environment device is used to perform the data transmission method according to any one of claims 1-4; The monitoring server is used to execute the data transmission method according to any one of claims 5-7.
9. An electronic device, comprising: The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores one or more computer programs that can be executed by the at least one processor, the one or more computer programs being executed by the at least one processor to enable the at least one processor to perform the data transmission method as described in any one of claims 1-4, or the data transmission method as described in any one of claims 5-7.
10. A computer-readable storage medium having stored thereon a computer program, characterized in that, When the computer program is executed by the processor, it implements the data transmission method as described in any one of claims 1-4, or the data transmission method as described in any one of claims 5-7.