A method, system, device, and storage medium for data transmission of a terminal device

Through the server dynamically generating configuration files and database table structures, the terminal equipment encapsulates data packets identified by the data context and performs verification and storage on the server side, solving the problem of terminal equipment communication management in different industrial environments, realizing accurate data storage and simplifying the access process, and improving the ease of use and scalability of the system.

CN119728817BActive Publication Date: 2025-07-04ADVANCED INST OF INFORMATION TECH (AIIT) PEKING UNIV +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510238702.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-03-03
Publication Date
2025-07-04
Estimated Expiration
2045-03-03

AI Technical Summary

Technical Problem

The existing technology lacks a system that uniformly manages and coordinates the communication of IoT devices in different industrial environments, resulting in different types of terminal device data requiring separate parsing scripts due to different protocols, which increases the workload and lacks maintenance and scalability of the system.

Method used

The server dynamically generates configuration files and database table structures based on the data protocol information input by the user. The terminal device encapsulates data packets containing data context identification. The server verifies the integrity of the data packet through the verification mechanism and locates the target database table and stores data.

Benefits of technology

It realizes accurate storage and management of terminal equipment data in different industrial environments, simplifies the equipment access process, improves the flexibility and scalability of the system, and ensures the integrity and reliability of data transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119728817B_ABST
    Figure CN119728817B_ABST
Patent Text Reader

Abstract

The present invention discloses a method, system, device and storage medium for data transmission of a terminal device, relating to the field of communications. The method includes: when the terminal device first accesses, the server generates a target configuration file and a target database table structure according to the data protocol information input by the user; verifying the target data packet, and if the verification passes, parsing the data context identifier from the target data packet; locating the target database table structure according to the data context identifier, and parsing and storing the fields other than the data context identifier in the target data packet into the database table. The server dynamically generates a configuration file and a database table structure according to the data protocol information input by the user. This enables the system to automatically adapt to the data protocols of different devices, eliminating the need to write parsing scripts separately for each device, and enabling unified management of device communications in different industrial environments, reducing the management complexity caused by protocol differences.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communications, and particularly to a method, a system, a device, and a storage medium for data transmission of a terminal device. Background Art

[0002] More and more industrial devices are connected to the network to achieve intelligent management and control. However, due to the complexity and diversity of the industrial environment, devices in different environments often have different communication requirements and protocols, which pose challenges to the interconnection and interoperability of devices.

[0003] Currently, there is a lack of a system in the market that can uniformly manage and coordinate the communication of IoT devices in different industrial environments. Due to different protocols, different types of terminal device data need to be parsed by separate scripts. For devices accessing a large number of IoT terminals, the workload is immeasurable; writing point-to-point communication parsing protocols requires certain software development capabilities and is not very user-friendly for business personnel. In addition, when subsequent data changes, it is necessary to rewrite the script and then republish it, which makes the maintainability and scalability of the system not strong enough. Summary of the Invention

[0004] The main objective of the present invention is to provide a method, a system, a device, and a storage medium for data transmission of a terminal device. When a terminal device first accesses the system, the server dynamically generates a configuration file and a database table structure according to the data protocol information input by the user. The terminal device encapsulates a data packet containing a data context identifier according to the configuration file, and after the server verifies the integrity of the data packet through a verification mechanism, it locates the target database table according to the identifier and stores the data to ensure accurate data storage for subsequent analysis and management.

[0005] To achieve the above objective, the embodiments of the present application provide the following technical solutions:

[0006] According to the first aspect of the embodiments of the present application, a method for data transmission of a terminal device is provided, and the method includes:

[0007] In response to the first access of the terminal device, the server generates a target configuration file and a target database table structure according to the data protocol information input by the user;

[0008] Transmit the target configuration file to the terminal device, so that the terminal device encapsulates the target stored data into a target data packet according to the target configuration file and sends it to the server; the target data packet includes a data context identifier;

[0009] Verify the target data packet, and if the verification passes, parse the data context identifier from the target data packet;

[0010] Locate the target database table structure according to the data context identifier, parse the fields other than the data context identifier in the target data packet, and store them in the database table.

[0011] Optionally, the data protocol information includes the production environment information of the terminal device, as well as the data fields and data types of the target data;

[0012] The server generates a target configuration file and a target database table structure according to the data protocol information input by the user, including:

[0013] Generate an environment identifier and a device identifier according to the data protocol information input by the user;

[0014] Generate a target configuration file according to the environment identifier, the device identifier, and the server IP address;

[0015] Generate a target database table name according to the environment identifier and the device identifier, and generate a target database table structure corresponding to the target database table name according to the data fields and data types of the target data.

[0016] Optionally, the generating an environment identifier and a device identifier according to the data protocol information input by the user includes:

[0017] Incrementally generate the environment identifier from the database data according to the production environment information of the terminal device;

[0018] Calculate a target hash value according to the data protocol information, and intercept a set segment in the target hash value as the device identifier.

[0019] Optionally, the configuration file includes the environment identifier, the device identifier, the server IP address, the port number, and the target stored data field information;

[0020] The terminal device encapsulates the target stored data into a target data packet according to the target configuration file and sends it to the server, including:

[0021] The terminal device establishes a communication connection with the server according to the server IP address and the port number in the target configuration file;

[0022] Encapsulate the collected target stored data into a target data packet according to the target data field information;

[0023] Send the target data packet to the server through the established communication connection.

[0024] Optionally, the data context identifier is the environment identifier and the device identifier;

[0025] Wrapping the collected target storage data into a target data packet according to the target data field information includes:

[0026] Analyze the target data field information to obtain the environment identifier, device identifier, collected data field value, and check code required for encapsulation;

[0027] Convert the environment identifier and the device identifier according to the first target format;

[0028] Convert the collected data field value according to the second target format;

[0029] Calculate the target check code of the target storage data;

[0030] Concatenate the environment identifier, the device identifier, the collected data field value, and the target check code into a complete data packet in a preset order.

[0031] Optionally, verifying the target data packet includes:

[0032] Extract the target check code from the target data packet according to the preset order;

[0033] Verify the fields in the target data packet except the target check code to obtain a reference check code;

[0034] Compare whether the target check code is consistent with the reference check code. If they are consistent, the verification passes; if not, discard the target data packet.

[0035] Optionally, parsing out the data context identifier from the target data packet includes:

[0036] Parse the environment identifier and the device identifier in the target data packet according to the preset order.

[0037] According to the second aspect of the embodiments of the present application, a terminal device data transmission system is provided. The system includes:

[0038] A file generation module, configured to generate a target configuration file and a target database table structure according to data protocol information input by a user by a server when a terminal device is first accessed;

[0039] A file transmission module, configured to transmit the target configuration file to the terminal device, so that the terminal device encapsulates target storage data into a target data packet according to the target configuration file and sends it to the server; the target data packet includes a data context identifier;

[0040] A verification and parsing module, configured to verify the target data packet, and if the verification passes, parse out the data context identifier from the target data packet;

[0041] A storage module, configured to locate the target database table structure according to the data context identifier, parse fields other than the data context identifier in the target data packet, and store them in the database table.

[0042] According to a third aspect of the embodiments of the present application, an electronic device is provided, including: a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor runs the computer program, the method described in the first aspect above is implemented.

[0043] According to a fourth aspect of the embodiments of the present application, a computer-readable storage medium is provided, on which computer-readable instructions are stored. The computer-readable instructions can be executed by a processor to implement the method described in the first aspect above.

[0044] In summary, the embodiments of the present application provide a method, a system, a device, and a storage medium for terminal device data transmission. When a terminal device first accesses, the server generates a target configuration file and a target database table structure according to the data protocol information input by the user; transmits the target configuration file to the terminal device, so that the terminal device encapsulates the target stored data into a target data packet according to the target configuration file and sends it to the server; the target data packet includes a data context identifier; verifies the target data packet, and if the verification passes, parses the data context identifier from the target data packet; locates the target database table structure according to the data context identifier, parses fields other than the data context identifier in the target data packet, and stores them in the database table. When a terminal device first accesses the system, the server dynamically generates a configuration file and a database table structure according to the data protocol information input by the user. The terminal device encapsulates a data packet containing a data context identifier according to the configuration file. After the server verifies the integrity of the data packet through a verification mechanism, it locates the target database table according to the identifier and stores the data, ensuring accurate data storage and facilitating subsequent analysis and management. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on the structures shown in these drawings.

[0046] The structures, proportions, sizes, etc. illustrated in this specification are only used to cooperate with the content disclosed in the specification for those skilled in this technology to understand and read, and are not used to limit the limiting conditions for the implementation of the present invention. Therefore, they do not have substantial technical significance. Any modification of the structure, change in the proportional relationship, or adjustment of the size, without affecting the effects that the present invention can produce and the purposes that can be achieved, should still fall within the scope covered by the technical content disclosed in the present invention.

[0047] Figure 1 It is a schematic flowchart of the terminal device data transmission method provided by an embodiment of the present application;

[0048] Figure 2 It is a schematic diagram of the industrial Internet of Things device cluster communication interaction system provided by an embodiment of the present application;

[0049] Figure 3 It is a schematic diagram of the terminal device data transmission system provided by an embodiment of the present application;

[0050] Figure 4 It shows the structural diagram of an electronic device provided by an embodiment of the present application;

[0051] Figure 5 It shows the diagram of a computer-readable storage medium provided by an embodiment of the present application.

[0052] The realization of the object of the present invention, functional features and advantages will be further described in conjunction with the embodiments with reference to the accompanying drawings. Specific embodiments

[0053] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without making creative efforts belong to the scope of protection of the present invention.

[0054] It should be noted that all directional indications (such as up, down, left, right, front, back...) in the embodiments of the present invention are only used to explain the relative position relationship and movement conditions between components in a specific posture (as shown in the accompanying drawings). If this specific posture changes, the directional indications will also change accordingly.

[0055] In addition, in the present invention, descriptions such as "first", "second", etc. are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the quantity of the indicated technical features. Thus, features defined with "first", "second" may explicitly or implicitly include at least one such feature. In the description of the present invention, the meaning of "a plurality" is at least two, such as two, three, etc., unless otherwise specifically defined.

[0056] In the present invention, unless otherwise clearly specified and defined, terms such as "connection", "fixation", etc. should be understood in a broad sense. For example, "fixation" can be a fixed connection, a detachable connection, or integrated; it can be a mechanical connection or an electrical connection; it can be directly connected or indirectly connected through an intermediate medium, and can be the communication inside two components or the interaction relationship between two components, unless otherwise clearly defined. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0057] In addition, the technical solutions between various embodiments of the present invention can be combined with each other, but it must be based on the ability of those of ordinary skill in the art to implement. When the combination of technical solutions results in contradictions or cannot be implemented, it should be considered that such a combination of technical solutions does not exist and is not within the protection scope required by the present invention.

[0058] The following describes in detail the technical terms related to the embodiments of the present application.

[0059] Terminal device: In the industrial Internet of Things, terminal devices usually refer to Internet of Things devices used in the industrial production process. These devices can be various sensors, controllers, actuators, robots, etc., which are used to collect, process, and transmit data to achieve automated production and intelligent control. The application scope of industrial Internet of Things terminal devices is very wide and can cover multiple fields such as manufacturing, logistics, energy, mining, agriculture, etc. In the manufacturing industry, industrial Internet of Things terminal devices can realize functions such as production automation, equipment intelligence, and quality monitoring, improving production efficiency and quality; in the logistics field, industrial Internet of Things terminal devices can realize functions such as cargo tracking, warehouse management, and transportation route optimization, improving logistics operation efficiency; in the energy and mining fields, industrial Internet of Things terminal devices can realize functions such as equipment monitoring, fault prediction, and energy consumption management, improving production efficiency and energy utilization efficiency.

[0060] Backend management module: The backend management module is used to register and manage the Internet of Things devices in each industrial scenario. When a new terminal device goes online, the business personnel input the device scenario and the data information to be collected, and the backend automatically generates a configuration file and a corresponding data table according to the information.

[0061] Communication module: Responsible for data transmission and communication between devices. It supports multiple communication protocols (Ethernet, WiFi, 4G, 5G) to ensure seamless communication between devices in different environments.

[0062] Socket: A socket is an abstraction of the endpoints for two-way communication between application processes on different hosts in a network. A socket is one end of the communication between processes on the network, providing a mechanism for application layer processes to exchange data using network protocols. In terms of its position, a socket is connected to the application process above and the network protocol stack below. It is the interface for the application program to communicate through the network protocol and the interface for the application program to interact with the network protocol stack.

[0063] Device data: In the industrial Internet of Things, different production environments require collecting different data from different devices or environments. Different data types mean different data fields and data types. These data types will be uniformly converted into hexadecimal data according to the agreed format for transmission. After the server receives this data, it needs to restore the data according to the agreed format for storage and display.

[0064] Hash function hashfunction: A method for creating a small digital "fingerprint" from any kind of data. The hash function calculates a digest of the message or data, making the data volume smaller and fixing the data format.

[0065] Figure 1 There is shown a method for terminal device data transmission provided by an embodiment of the present application. The method includes:

[0066] Step 101: In response to the first access of the terminal device, the server generates a target configuration file and a target database table structure according to the data protocol information input by the user;

[0067] Step 102: Transmit the target configuration file to the terminal device so that the terminal device encapsulates the target stored data into a target data packet according to the target configuration file and sends it to the server; the target data packet includes a data context identifier;

[0068] Step 103: Verify the target data packet. If the verification passes, parse out the data context identifier from the target data packet;

[0069] Step 104: Locate the target database table structure according to the data context identifier, parse the fields in the target data packet other than the data context identifier, and store them in the database table.

[0070] In a possible implementation, the data protocol information includes the production environment information of the terminal device, as well as the data fields and data types of the target data; in step 101, the server generates a target configuration file and a target database table structure according to the data protocol information input by the user, including:

[0071] Generate an environment identifier and a device identifier according to the data protocol information input by the user; generate a target configuration file according to the environment identifier, the device identifier, and the server IP address; generate a target database table name according to the environment identifier and the device identifier, and generate a target database table structure corresponding to the target database table name according to the data fields and data types of the target data.

[0072] Through the data protocol information input by the user, the server can automatically generate a target configuration file and a database table structure, reducing the manual configuration workload and improving the flexibility and scalability of the system. The generated configuration file and database table structure can adapt to different production environments and device types, supporting the rapid access of terminal devices. Through the dynamic generation of the target configuration file and database table structure, the complexity during system initialization and device access is reduced, and the usability of the system is improved.

[0073] In a possible implementation, the generating an environment identifier and a device identifier according to the data protocol information input by the user includes:

[0074] Incrementally generate the environment identifier from the database data according to the production environment information of the terminal device; calculate a target hash value according to the data protocol information, and intercept a set segment in the target hash value as the device identifier.

[0075] By generating the environment identifier and the device identifier, context information is provided for the data, ensuring that the data can be accurately parsed and stored in the corresponding database table. The target configuration file guides the terminal device to encapsulate data packets, ensuring the consistency and correctness of the data format.

[0076] In a possible implementation, the configuration file includes the environment identifier, the device identifier, the server IP address, the port number, and the target stored data field information; in step 102, the terminal device encapsulates the target stored data into a target data packet according to the target configuration file and sends it to the server, including:

[0077] The terminal device establishes a communication connection with the server according to the server IP address and the port number in the target configuration file; encapsulates the collected target stored data into a target data packet according to the target data field information; and sends the target data packet to the server through the established communication connection.

[0078] By providing the server IP address and port number through a configuration file, the terminal device can quickly establish a communication connection and reduce the complexity of connection establishment. According to the data field information in the configuration file, the terminal device can encapsulate the collected data into target data packets to ensure the consistency and correctness of the data format.

[0079] In a possible implementation manner, the data context identifier is the environment identifier and the device identifier; the encapsulating the collected target storage data into a target data packet according to the target data field information includes:

[0080] Analyze the target data field information to obtain the environment identifier, device identifier, collected data field value, and check code required for encapsulation; convert the environment identifier and the device identifier according to the first target format; convert the collected data field value according to the second target format; calculate the target check code of the target storage data; concatenate the environment identifier and the device identifier, the collected data field value, and the target check code into a complete data packet in a preset order.

[0081] By calculating the check code and including it in the data packet, the server can verify the integrity of the data packet and avoid data corruption caused by transmission errors. The data packet contains the environment identifier and the device identifier (data context identifier), and the server can quickly locate the target database table structure, parse the data, and store it in the correct table. By guiding the terminal device to establish a communication connection, encapsulate data packets, and send data through a configuration file, the efficiency, standardization, and integrity of data transmission are ensured. At the same time, by using the data context identifier (environment identifier and device identifier), the data parsing and storage process on the server side is simplified, improving the overall performance and maintainability of the system.

[0082] In a possible implementation manner, in step 103, the verifying the target data packet includes: extracting the target check code from the target data packet in the preset order; verifying the fields in the target data packet except the target check code to obtain a reference check code; comparing whether the target check code is consistent with the reference check code. If they are consistent, the verification passes; if not, the target data packet is discarded.

[0083] By parsing the data context identifier (environment identifier and device identifier), the server can quickly locate the target database table structure to ensure that the data can be stored in the correct location. By using the verification mechanism to verify the integrity of the target data packet, it is ensured that the data is not tampered with or damaged during transmission. Only the data packets that pass the verification will be further processed, thereby improving the reliability of the system. If the verification fails, the system will discard the incorrect data packets to prevent incorrect data from entering the subsequent processing flow, thereby improving the stability and data quality of the system.

[0084] In a possible implementation manner, in step 103, parsing the data context identifier from the target data packet includes: parsing the environment identifier and the device identifier in the target data packet according to the preset order.

[0085] Parsing and verifying the data packet in a preset order reduces unnecessary processing steps and improves the overall efficiency of the system. Through the verification mechanism and the parsing of the data context identifier, the integrity and accuracy of data transmission are ensured, and at the same time, the data parsing and storage processes are simplified. This design significantly improves the reliability, fault tolerance and efficiency of the system, and can effectively manage the communication of IoT devices in different industrial environments.

[0086] In view of the diversity of devices and environments in the current industrial IoT environment, it is difficult to uniformly manage the communication and interaction of each device. The present invention proposes an industrial IoT device cluster communication and interaction system, which aims to reduce the complexity of new device access network communication and improve the usability of the communication system. It allows users to define data formats according to industrial scenarios and device functions, and synchronously save them to the platform database. The data of different terminal devices will be parsed into normal data streams through a unified transceiver interface. This system is implemented purely by software, provides a unified transceiver information interface, and does not require secondary development; through the page configuration form, it reduces the complexity of new IoT terminal devices accessing the system.

[0087] Figure 2 The industrial IoT device cluster communication and interaction system provided by the embodiment of the present application is shown. The industrial IoT device cluster communication and interaction system realizes the unified management of device communication and data interaction through three main modules: the system method includes a first module, a second module, and a third module.

[0088] The first module is involved in data entry, configuration file generation, and database table generation. Business personnel input information such as data types and variable names through the configuration page, and the system automatically generates configuration files and database fields, simplifying the configuration process for new device access.

[0089] 1. Data entry: Business personnel are responsible for entering data protocol information into the system. This includes information such as variable names, data types, as well as the production environment where the device is located and remarks information.

[0090] 2. Configuration file generation: The system automatically generates a configuration file according to the entered data information. The configuration file includes the device unique ID, communication IP address and port number, as well as the ID number and remarks information corresponding to each data.

[0091] 3. Database table generation: The system automatically generates database fields for the data to be collected in the database according to the configuration file. The database fields include data field ID, type, device number, remarks information, etc.

[0092] The terminal configuration file generation unit provides a configuration page for users to make configurations. When a new device needs to be connected, the user inputs variable names, variable types, and remarks according to the data types collected in the new device scenario. The backend program automatically parses the input information and generates a configuration file for the new terminal. The configuration file includes the device's unique ID, communication IP address and port number, as well as the ID number and remarks corresponding to each piece of data. The database field configuration unit, based on the information input by the user, the backend program automatically generates database information, including data field ID, type, device number, remarks, etc.

[0093] The second module includes data collection and data forwarding. The terminal device interacts with the server for data through communication methods such as 4G, 5G, or Ethernet according to the imported configuration file. Each communication carries the device ID and data ID to ensure the accuracy and traceability of the data.

[0094] 1. Data collection: The terminal device starts the communication module (such as 4G, 5G, or Ethernet) to connect to the server for communication according to the imported configuration file. The terminal device collects data, such as air quality data. 2. Data forwarding: The terminal device sends the collected data to the server through the communication module. The data will carry the device ID and the ID of the sent data during the sending process to facilitate the server to identify and process.

[0095] The third module involves data parsing and data storage. After receiving the data, the server parses the data according to the device ID and data ID and stores it in the corresponding database.

[0096] 1. Data parsing: After receiving the communication data, the server first performs CRC-32 verification to ensure the integrity and accuracy of the data. If the verification is successful, the server starts to parse the data, including the device ID, data ID, and actual data value. 2. Data storage: The server automatically locates the corresponding database table according to the parsed device ID and data ID. The parsed data is saved to the specified database information to complete the data storage. It includes the server's data parsing and data entry into the database. After receiving the communication data, the server parses the data. According to the parsed device ID number and data ID number, it automatically parses the data according to the ID table. The parsed data is saved to the specified database information. The database is the data storage center of the entire system. It receives the database table structure generated by the first module and the data parsed by the third module. The database is responsible for storing all the collected data for subsequent data analysis and application use.

[0097] Through the collaborative work of these three modules, the system realizes the full process management of data entry, configuration, collection, forwarding, analysis and storage of Industrial Internet of Things equipment, improving the uniformity and ease of use of equipment communication interaction in the Industrial Internet of Things environment.

[0098] Taking the terminal device W0000A1 as an example, the air quality data in the factory production environment is collected. The data format is shown in Table 1 below:

[0099] Table 1

[0100]

[0101] This process involves entering the device data protocol, generating the configuration file, communicating between the terminal device and the server, and receiving and parsing the data:

[0102] Phase 1: Equipment data protocol entry and configuration file generation: In the first module, business personnel enter the data protocol, including variable name, data type, and remarks. The system automatically generates configuration files and database table structures based on these inputs.

[0103] Step 1: Business personnel enter data agreement:

[0104] Business personnel enter the device data protocol information in the first module. The device data protocol information includes the number of protocol variables (such as 6 variables), remark information (such as air quality data for the production environment of a certain factory), variable name and data type. Further, enter each variable name and data type in turn. For example: ozone (ppb), the data type is int32. Define the format and content of data collection for the terminal device to ensure that the data collected by the device can be correctly parsed by the server. Generate the definition of the device data protocol to provide a basis for subsequent configuration file generation.

[0105] Step 2: The background program generates the environment ID and device ID:

[0106] Step 2-1: Generate environment ID: According to the production environment where the equipment is located (such as the air quality data of the production environment of a certain factory), the background program increments the environment ID (for example, 782) from the existing library data.

[0107] Step 2-2: Generate device ID: The background program calculates a hash value (such as SHA-256) based on all input information (including environment ID, device data protocol, etc.). The first 8 bits of the hash value are intercepted as the device ID number (for example, JCD98D2a). A unique device ID number is generated through a hash algorithm to ensure that each device has a unique identification.

[0108] Step 3: Generate a configuration file: The background program automatically generates a configuration file based on information such as the environment ID, device ID, and cloud server IP address. The configuration file is saved in JSON format and its content includes the environment ID, device ID, IP address, port number, and data field information. ENV_ID: Environment ID. ID: Device ID. ip: Server IP address. port: Server port number. data: The data fields collected by the device and their types. Generate the unique identifier of the device and the configuration file according to the input data protocol information to prepare for the communication between the device and the server.

[0109] Step 4: Generate a database table: After the generation of the configuration file is completed, the background server dynamically generates a new data table according to the environment ID and data format to store the data collected by the device.

[0110] The input of the device data protocol is the basis for generating the configuration file. The background program processes and converts the input information into specific environment ID, device ID, and configuration file, providing the necessary parameters for the communication between the device and the server. Through the above steps, the system realizes the input of the device data protocol, the generation of the environment ID and device ID, the creation of the configuration file, and the generation of the database table, laying a foundation for subsequent data collection and communication interaction.

[0111] The second stage: The terminal device imports the configuration file and communicates.

[0112] Step 1: The terminal device imports the configuration file: After the terminal device starts, it first imports the previously generated configuration file. The device reads the environment ID, device ID, server IP address, port number, and data field information in the configuration file, enabling the terminal device to obtain all the parameters and data format definitions required for communication with the server. The device is ready to communicate with the server.

[0113] Step 2: The terminal device starts the communication module: The device establishes a Socket connection with the remote server through its built-in network module (4G, 5G, ETH) according to the ip and port in the configuration file, establishing a communication link between the terminal device and the remote server.

[0114] Step 3: The terminal device collects environmental data: The device collects environmental data (such as ozone, carbon dioxide, etc.) according to the definition of the data field in the configuration file. The terminal device collects the air quality data in the factory production environment according to the data fields defined in the configuration file. The collected data includes five indicators: ozone, carbon dioxide, oxygen, PM1.0, PM2.5, and PM10.

[0115] Step 4: The terminal device sends data to the server: The device encapsulates the collected data into data packets according to a predefined format (such as hexadecimal) and sends them to the server via Socket. The terminal device directly sends the collected environmental data to the server. The data format for sending is a hexadecimal data stream, and the data stream contains the device ID and the values of each data field. The example is as follows:

[0116] 00 00 03 0E 4a 43 44 39 38 44 32 61 00 00 00 20 00 00 02 D6 00 00 0016 00 00 00 07 00 00 00 12 00 00 00 05 C8 C2 6C A5

[0117] The terminal device collects environmental data and sends it to the server according to a predefined format.

[0118] The import of the configuration file provides the communication parameters and data format for the device. The establishment of the Socket connection ensures that the device can send data to the server. Data collection and sending are the core functions of the device, and the collected data is sent to the server according to the definition of the configuration file. Through the above steps, the terminal device completes the import of the configuration file, the startup of the communication module, the collection of environmental data, and the sending of data to the server. These steps ensure that the data can be accurately transmitted from the terminal device to the server, laying a foundation for subsequent data parsing and storage.

[0119] The third stage: The server receives and parses the data: After receiving the data, the server performs CRC-32 verification, parses the data, and stores the data in the corresponding database according to the device ID and data ID.

[0120] Step 1: The server receives data from the terminal device. The server receives a hexadecimal data stream from the terminal device.

[0121] Step 2: CRC-32 verification to ensure that the received data is complete and not tampered with. The server intercepts the last 8 hexadecimal data (such as C8 C2 6C A5) of the data as the verification code. Perform CRC-32 verification on the previous data. If the verification fails, discard the data. If the verification is successful, continue to parse the data. CRC-32 is a commonly used data verification method for detecting whether errors occur in the data during transmission. If the verification fails, it means that the data may be damaged during transmission, and the server will discard this data.

[0122] Step 3: Parse the data and store it in the corresponding database table.

[0123] Step 3-1: Parse the environment ID and device ID: The first 8 hexadecimal data of the data (such as 00 00 03 0E) correspond to the environment ID (ID782), and the following 16 hexadecimal data (such as 4a 43 44 39 38 44 32 61) correspond to the device ID number (JCD98D2a).

[0124] Step 3-2: Locate the database table: Based on the environment ID and device ID, the server locates the corresponding database table.

[0125] Step 3-3: Parse the data and write it into the database: The remaining data is parsed according to the definition of the data field in the configuration file. For example:

[0126] 00 00 00 20: Ozone 32 ppb

[0127] 00 00 02 D6: Carbon dioxide 726 ppb

[0128] 00 00 00 16: Oxygen 22%VOL

[0129] 00 00 00 07: PM1.0 7 ug / m³

[0130] 00 00 00 12: PM2.5 18 ug / m³

[0131] 00 00 00 05: PM10 5 ug / m³

[0132] The parsed data is written into the database table. Data reception and verification ensure the integrity and accuracy of the data. Data parsing and storage store the data into the corresponding database table, providing support for subsequent data analysis and monitoring. If the data is wrongly written into a mismatched database table, it may lead to data chaos or system errors. Locating the database table first can prevent such errors and ensure that the data is correctly processed. Through the above steps, the server has completed the reception, verification, parsing, and storage of the data, ensuring the accuracy and integrity of the data and saving it into the database for subsequent analysis and use. The entire process includes the entry of the device data protocol, the generation of the configuration file, the communication between the terminal device and the server, and the reception and parsing of the data. Each step is closely linked to ensure that the terminal device can correctly collect data and transmit it to the server, while the server can correctly parse and store the data. This process reflects the complete process of data collection, transmission, and processing in the Internet of Things system.

[0133] Data from different terminal devices is processed through a unified transceiver interface, simplifying the parsing and processing of data streams. Through the page configuration form, the complexity of new IoT terminal devices accessing the system is reduced, eliminating the need for secondary development. The system is fully software-based, providing a unified information transceiver interface, enhancing the flexibility and scalability of the system. It allows users to define data formats according to industrial scenarios and device functions and synchronously save them to the platform database, improving the usability of the system. The data format is user-defined according to different industrial scenarios.

[0134] In summary, the embodiment of the present application provides a method for transmitting terminal device data. When the terminal device is first accessed, the server generates a target configuration file and a target database table structure according to the data protocol information input by the user; transmits the target configuration file to the terminal device so that the terminal device encapsulates the target stored data into a target data packet according to the target configuration file and sends it to the server; the target data packet includes a data context identifier; verifies the target data packet, and if the verification passes, parses the data context identifier from the target data packet; locates the target database table structure according to the data context identifier, parses the fields other than the data context identifier in the target data packet, and stores them in the database table. When the terminal device is first accessed to the system, the server dynamically generates a configuration file and a database table structure according to the data protocol information input by the user. The terminal device encapsulates a data packet containing a data context identifier according to the configuration file. After the server verifies the integrity of the data packet through the verification mechanism, it locates the target database table according to the identifier and stores the data, ensuring accurate data storage for subsequent analysis and management.

[0135] Based on the same technical concept, the embodiment of the present application also provides a terminal device data transmission system, as Figure 3 shown, the system includes:

[0136] A file generation module 301, configured to, when the terminal device is first accessed, the server generates a target configuration file and a target database table structure according to the data protocol information input by the user;

[0137] A file transmission module 302, configured to transmit the target configuration file to the terminal device so that the terminal device encapsulates the target stored data into a target data packet according to the target configuration file and sends it to the server; the target data packet includes a data context identifier;

[0138] A verification and parsing module 303, configured to verify the target data packet, and if the verification passes, parse the data context identifier from the target data packet;

[0139] A storage module 304 is configured to locate the target database table structure according to the data context identifier, parse the fields other than the data context identifier in the target data packet, and store them in the database table.

[0140] An embodiment of the present application also provides an electronic device corresponding to the method provided in the foregoing embodiment. Please refer to Figure 4 , which shows a diagram of an electronic device provided in some embodiments of the present application. The electronic device 20 may include: a processor 200, a memory 201, a bus 202, and a communication interface 203. The processor 200, the communication interface 203, and the memory 201 are connected through the bus 202. A computer program that can run on the processor 200 is stored in the memory 201. When the processor 200 runs the computer program, it executes the method provided in any of the foregoing embodiments of the present application.

[0141] Among them, the memory 201 may include a high-speed random access memory (RAM: Random Access Memory), and may also include a non-volatile memory, such as at least one disk memory. The communication connection between the system network element and at least one other network element is realized through at least one physical port (which can be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. can be used.

[0142] The bus 202 may be an ISA bus, a PCI bus, an EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. Among them, the memory 201 is used to store a program. After receiving an execution instruction, the processor 200 executes the program. The method disclosed in any of the foregoing embodiments of the present application can be applied to the processor 200 or implemented by the processor 200.

[0143] The processor 200 may be an integrated circuit chip with the ability to process signals. In the implementation process, each step of the above method can be completed by the integrated logic circuit of the hardware in the processor 200 or the instructions in the form of software. The above-mentioned processor 200 may be a general-purpose processor, including a central processing unit (CPU for short), a network processor (NP for short), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. It can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in combination with the embodiments of the present application can be directly embodied as being executed by the hardware decoding processor, or executed by the combination of the hardware and software modules in the decoding processor. The software module may be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. This storage medium is located in the memory 201, and the processor 200 reads the information in the memory 201 and combines its hardware to complete the steps of the above method.

[0144] The electronic device provided by the embodiments of the present application and the method provided by the embodiments of the present application are based on the same inventive concept and have the same beneficial effects as the method adopted, run or implemented by it.

[0145] The embodiments of the present application also provide a computer-readable storage medium corresponding to the method provided by the foregoing embodiments. Please refer to Figure 5 , which shows that the computer-readable storage medium is an optical disc 30, on which a computer program (i.e., a program product) is stored. When the computer program is run by a processor, it will execute the method provided by any of the foregoing embodiments.

[0146] It should be noted that examples of the computer-readable storage medium may also include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other optical and magnetic storage media, which will not be elaborated here one by one.

[0147] The computer-readable storage medium provided by the above embodiments of the present application and the method provided by the embodiments of the present application are based on the same inventive concept and have the same beneficial effects as the method adopted, run or implemented by the application program stored in it.

[0148] It should be noted that the above embodiments are illustrative of the present application rather than restrictive thereof, and those skilled in the art can design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in the claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present application can be implemented by means of hardware including several different elements and by means of a suitably programmed computer. In a unit claim listing several devices, several of these devices can be embodied by the same item of hardware. The use of the words first, second, and third, etc. does not denote any order. These words can be interpreted as names.

[0149] As described above, the above are only the preferred specific embodiments of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by those skilled in the art within the technical scope disclosed by the present application should be covered within the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the said claims.

[0150] The above are only the preferred embodiments of the present invention, and do not limit the patent scope of the present invention accordingly. Any equivalent structural transformations made by using the content of the specification and drawings of the present invention under the concept of the present invention, or direct / indirect applications in other related technical fields are included within the patent protection scope of the present invention.

Claims

1. A method for data transmission of a terminal device, characterized in that, The method includes: In response to the first access of the terminal device, the server generates a target configuration file and a target database table structure according to the data protocol information input by the user; the data protocol information includes the production environment information of the terminal device, as well as the data fields and data types of the target data. Transmit the target configuration file to the terminal device, so that the terminal device encapsulates the target stored data into a target data packet according to the target configuration file and sends it to the server; the target data packet includes a data context identifier. Verify the target data packet, and if the verification passes, parse the data context identifier from the target data packet. Locate the target database table structure according to the data context identifier, parse the fields other than the data context identifier in the target data packet, and store them in the database table. Among them, the server generates a target configuration file and a target database table structure according to the data protocol information input by the user, including: generating an environment identifier and a device identifier according to the data protocol information input by the user; generating a target configuration file according to the environment identifier, the device identifier, and the server IP address; generating a target database table name according to the environment identifier and the device identifier, and generating a target database table structure corresponding to the target database table name according to the data fields and data types of the target data.

2. The method according to claim 1, wherein The generating an environment identifier and a device identifier according to the data protocol information input by the user includes: Incrementally generate the environment identifier from the database data according to the production environment information of the terminal device. Calculate a target hash value according to the data protocol information, and intercept a set segment in the target hash value as the device identifier.

3. The method according to claim 1, wherein The configuration file includes an environment identifier, a device identifier, the server IP address, a port number, and target stored data field information. The terminal device encapsulates the target stored data into a target data packet according to the target configuration file and sends it to the server, including: The terminal device establishes a communication connection with the server according to the server IP address and the port number in the target configuration file. Encapsulate the collected target stored data into a target data packet according to the target data field information. Send the target data packet to the server through the established communication connection.

4. The method according to claim 3, characterized in that, The data context identifier is the environment identifier and the device identifier. The encapsulating the collected target stored data into a target data packet according to the target data field information includes: Parse the target data field information to obtain the environment identifier, the device identifier, the collected data field value, and the check code required for encapsulation. Convert the environment identifier and the device identifier according to the first target format. Convert the collected data field value according to the second target format. Calculate the target check code of the target stored data. Concatenate the environment identifier, the device identifier, the collected data field value, and the target check code into a complete data packet in a preset order.

5. The method according to claim 4, characterized in that The verifying the target data packet includes: Extract the target check code in the target data packet according to the preset order. Verify the fields in the target data packet except the target check code to obtain a reference check code; Compare whether the target check code is consistent with the reference check code. If they are consistent, the verification passes; if not, discard the target data packet.

6. The method according to claim 4, wherein Parse the data context identifier from the target data packet, including: Parse the environment identifier and device identifier in the target data packet in the preset order.

7. A terminal device data transmission system, characterized in that, The system includes: A file generation module, which is used to generate a target configuration file and a target database table structure in response to the first access of the terminal device. The server generates them according to the data protocol information input by the user. The data protocol information includes the production environment information of the terminal device, as well as the data fields and data types of the target data. The server generates a target configuration file and a target database table structure according to the data protocol information input by the user, including: generating an environment identifier and a device identifier according to the data protocol information input by the user; generating a target configuration file according to the environment identifier, the device identifier, and the server IP address; generating a target database table name according to the environment identifier and the device identifier, and generating a target database table structure corresponding to the target database table name according to the data fields and data types of the target data; A file transmission module, which is used to transmit the target configuration file to the terminal device so that the terminal device encapsulates the target stored data into a target data packet according to the target configuration file and sends it to the server. The target data packet includes a data context identifier; A verification and parsing module, which is used to verify the target data packet. If the verification passes, parse the data context identifier from the target data packet; A storage module, which is used to locate the target database table structure according to the data context identifier, parse the fields in the target data packet other than the data context identifier, and store them in the database table.

8. An electronic device, comprising: A memory, a processor, and a computer program stored on the memory and executable on the processor, wherein when the processor runs the computer program, it is executed to implement the method according to any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, A computer-readable instruction is stored thereon, and the computer-readable instruction can be executed by the processor to implement the method according to any one of claims 1-6.

Citation Information

Patent Citations

  • Unmanned vehicle test data acquisition, transmission and processing method

    CN113691888A

  • Intelligent analysis method and system for file import

    CN117435662A