Terminal equipment data transmission method, system and equipment and storage medium

By dynamically generating configuration files and database table structures, the terminal equipment encapsulates data packets and sends them to the server, and the server verifies and stores data, solving the problems of insufficient data transmission of terminal equipment and insufficient system maintenance in the prior art, realizing unified management and efficient storage of terminal equipment data.

CN119728817AActive Publication Date: 2025-03-28ADVANCED INST OF INFORMATION TECH (AIIT) PEKING UNIV +1
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202510238702.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-03
Publication Date
2025-03-28
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 that require separate parsing scripts due to different protocols, which increases the workload and reduces the maintainability and scalability of the system.

Method used

In response to the first access of the terminal device, 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 according to the configuration file. The server verifies the integrity of the data packets and stores data through the verification mechanism.

Benefits of technology

It realizes unified management and storage of terminal equipment data in different industrial environments, reduces manual configuration workload, improves system flexibility and scalability, and ensures accurate data storage and convenience of subsequent analysis and management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119728817A_ABST
    Figure CN119728817A_ABST
Patent Text Reader

Abstract

The invention discloses a terminal equipment data transmission method and system, equipment and a storage medium, and relates to the field of communication, and the method comprises the steps that when the terminal equipment is accessed for the first time, a server generates a target configuration file and a target database table structure according to data protocol information input by a user; verifying a target data packet, and if verification is passed, analyzing the data context identifier from the target data packet; and positioning to the target database table structure according to the data context identifier, analyzing fields except the data context identifier in the target data packet, and storing the fields in the database table. And the server dynamically generates a configuration file and a database table structure according to data protocol information input by a user. Therefore, the system can automatically adapt to data protocols of different devices, an analysis script does not need to be written independently for each device, device communication in different industrial environments can be managed in a unified mode, and management complexity caused by protocol differences is reduced.
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 in particular to a terminal device data transmission method, system, device and storage medium. 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 industrial environments, devices in different environments often have different communication requirements and protocols, which brings challenges to the interconnection between devices.

[0003] Currently, there is a lack of a system on the market that can uniformly manage and coordinate the communication of IoT devices in different industrial environments. Different types of terminal device data need to be parsed separately due to different protocols. For devices connected to a large number of IoT terminals, the workload is difficult to estimate; writing point-to-point communication parsing protocols requires certain software development capabilities, which is not friendly to business personnel. In addition, when subsequent data changes, it is necessary to rewrite the script and then publish it, which makes the system maintainability and scalability insufficient. Summary of the invention

[0004] The main purpose of the present invention is to provide a terminal device data transmission method, system, device and storage medium. When the terminal device is connected to the system for the first time, the server dynamically generates a configuration file and a database table structure according to the data protocol information input by the user, and 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 that the data is accurately stored and convenient for subsequent analysis and management.

[0005] In order to achieve the above objectives, the present application provides the following technical solutions: According to a first aspect of an embodiment of the present application, a terminal device data transmission method is provided, the method comprising: 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; Transmitting the target configuration file to the terminal device, so that the terminal device encapsulates the target storage data into a target data packet according to the target configuration file and sends the target data packet to the server; the target data packet includes a data context identifier; Verifying the target data packet, and if the verification passes, parsing the data context identifier from the target data packet; The target database table structure is located according to the data context identifier, and the fields other than the data context identifier in the target data packet are parsed and stored in the database table.

[0006] Optionally, the data protocol information includes terminal device production environment information, and data fields and data types of 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: Generate environment identification and device identification according to 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; A target database table name is generated according to the environment identifier and the device identifier, and a target database table structure corresponding to the target database table name is generated according to the data field and data type of the target data.

[0007] Optionally, generating an environment identifier and a device identifier according to data protocol information input by a user includes: Incrementally generating the environment identifier from database data according to the terminal device production environment information; A target hash value is calculated according to the data protocol information, and a set segment in the target hash value is intercepted as the device identifier.

[0008] Optionally, the configuration file includes an environment identifier and a device identifier, the server IP address, a port number, and target storage data field information; The terminal device encapsulates the target storage data into a target data packet according to the target configuration file and sends the target data packet 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; Encapsulating the collected target storage data into a target data packet according to the target data field information; The target data packet is sent to the server through the established communication connection.

[0009] Optionally, the data context identifier is the environment identifier and the device identifier; The step of encapsulating the collected target storage 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, device identifier, collected data field value and check code required for encapsulation; converting the environment identifier and the device identifier according to a first target format; Convert the collected data field value according to a second target format; Calculating a target check code of the target storage data; The environment identifier and the device identifier, the collected data field value and the target check code are spliced ​​into a complete data packet in a preset order.

[0010] Optionally, the verifying the target data packet includes: Extracting the target check code in the target data packet according to the preset order; Verifying the fields in the target data packet except the target check code to obtain a reference check code; The target check code is compared with the reference check code to see if they are consistent. If they are consistent, the check is passed; if they are inconsistent, the target data packet is discarded.

[0011] Optionally, parsing the data context identifier from the target data packet includes: The environment identifier and the device identifier in the target data packet are parsed according to the preset order.

[0012] According to a second aspect of an embodiment of the present application, a terminal device data transmission system is provided, the system comprising: A file generation module, used for generating a target configuration file and a target database table structure according to the data protocol information input by the user in response to the first access of the terminal device; A file transmission module, used for transmitting the target configuration file to the terminal device, so that the terminal device encapsulates the target storage data into a target data packet according to the target configuration file and sends the target data packet to the server; the target data packet includes a data context identifier; A verification and parsing module, used for verifying the target data packet, and if the verification passes, parsing the data context identifier from the target data packet; The storage module is used 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.

[0013] According to a third aspect of an embodiment of the present application, an electronic device is provided, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method described in the first aspect above.

[0014] According to a fourth aspect of an embodiment 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.

[0015] In summary, the embodiments of the present application provide a method, system, device and storage medium for data transmission of a terminal device. 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 target configuration file is transmitted to the terminal device, so that the terminal device encapsulates the 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; the target data packet is verified, and if the verification passes, the data context identifier is parsed from the target data packet; the target database table structure is located according to the data context identifier, and the fields other than the data context identifier in the target data packet are parsed and stored in the database table. When the 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, and 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 that the data is accurately stored, which is convenient for subsequent analysis and management. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the structures shown in these drawings without paying creative work.

[0017] The structures, proportions, sizes, etc. illustrated in this specification are only used to match the contents disclosed in the specification so as to facilitate understanding and reading by persons familiar with the technology. They are not used to limit the conditions under which the present invention can be implemented, and therefore have no substantial technical significance. Any structural modification, change in proportion or adjustment of size shall still fall within the scope of the technical contents disclosed in the present invention without affecting the effects and purposes that can be achieved by the present invention.

[0018] Figure 1 A schematic diagram of a method for transmitting data via a terminal device provided in an embodiment of the present application; Figure 2 A schematic diagram of an industrial IoT device cluster communication interaction system provided in an embodiment of the present application; Figure 3 A schematic diagram of a terminal device data transmission system provided in an embodiment of the present application; Figure 4 A structural diagram of an electronic device provided in an embodiment of the present application is shown; Figure 5A diagram showing a computer-readable storage medium provided by an embodiment of the present application.

[0019] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0020] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

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

[0022] In addition, in the present invention, descriptions such as "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.

[0023] In the present invention, unless otherwise clearly specified and limited, the terms "connection", "fixation", etc. should be understood in a broad sense. For example, "fixation" can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements, unless otherwise clearly defined. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0024] In addition, the technical solutions between the various embodiments of the present invention can be combined with each other, but it must be based on the fact that ordinary technicians in the field can implement it. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by the present invention.

[0025] The technical terms involved in the embodiments of the present application are described in detail below.

[0026] Terminal devices: In the Industrial Internet of Things, terminal devices usually refer to IoT 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, covering 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, quality monitoring, etc., to improve production efficiency and quality; in the field of logistics, Industrial Internet of Things terminal devices can realize functions such as cargo tracking, warehouse management, and transportation route optimization to improve logistics operation efficiency; in the fields of energy and mining, Industrial Internet of Things terminal devices can realize functions such as equipment monitoring, fault prediction, and energy consumption management to improve production efficiency and energy utilization efficiency.

[0027] Backstage management module: The backstage management module is used to register and manage IoT devices in each industrial scenario. When a new terminal device is online, the business personnel input the device scenario and the data information to be collected, and the backstage automatically generates configuration files and corresponding data tables based on the information.

[0028] Communication module: responsible for data transmission and communication between devices. Supports multiple communication protocols (Ethernet, WiFi, 4G, 5G) to ensure that devices in different environments can communicate seamlessly.

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

[0030] Equipment data: Different production environments in the Industrial Internet of Things require the collection of 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 for transmission according to the agreed format. After receiving this data, the server needs to restore the data according to the agreed format for storage and display.

[0031] Hash function: A method of creating a small digital "fingerprint" from any kind of data. The hash function calculates the message or data into a summary, making the data smaller and fixing the format of the data.

[0032] Figure 1 A terminal device data transmission method provided in an embodiment of the present application is shown, the method comprising: Step 101: In response to the first access of a terminal device, the server generates a target configuration file and a target database table structure according to data protocol information input by the user; Step 102: transmitting the target configuration file to the terminal device, so that the terminal device encapsulates the target storage data into a target data packet according to the target configuration file and sends the target data packet to the server; the target data packet includes a data context identifier; Step 103: verifying the target data packet, and if the verification passes, parsing the data context identifier from the target data packet; Step 104: 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.

[0033] In a possible implementation, the data protocol information includes terminal device production environment information, and data fields and data types of 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: 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 field and data type of the target data.

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

[0035] In a possible implementation manner, generating an environment identifier and a device identifier according to data protocol information input by a user includes: According to the terminal equipment production environment information, the environment identifier is incrementally generated from the database data; the target hash value is calculated according to the data protocol information, and a set segment in the target hash value is intercepted as the equipment identifier.

[0036] By generating environment identifiers and device identifiers, context information is provided for the data to ensure that the data can be accurately parsed and stored in the corresponding database table. The target configuration file is used to guide the terminal device to encapsulate the data packet to ensure the consistency and correctness of the data format.

[0037] In a possible implementation, the configuration file includes an environment identifier and a device identifier, the server IP address, a port number, and target storage data field information; in step 102, the terminal device encapsulates the target storage 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; encapsulates the collected target storage 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.

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

[0039] In a possible implementation manner, the data context identifier is the environment identifier and the device identifier; and the step of encapsulating the collected target storage 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, device identifier, collected data field value and check code required for encapsulation; convert the environment identifier and the device identifier according to a first target format; convert the collected data field value according to a second target format; calculate the target check code of the target stored data; splice 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.

[0040] By calculating the checksum 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 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. The configuration file guides the terminal device to establish a communication connection, encapsulate the data packet and send the data, ensuring the efficiency, standardization and integrity of data transmission. At the same time, the data context identifier (environment identifier and device identifier) ​​simplifies the data parsing and storage process on the server side, improving the overall performance and maintainability of the system.

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

[0042] 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. The integrity of the target data packet is verified through the verification mechanism to ensure that the data has not been tampered with or damaged during transmission. Only 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 wrong data packet to prevent the wrong data from entering the subsequent processing flow, thereby improving the stability of the system and data quality.

[0043] In a possible implementation, 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.

[0044] By parsing and verifying data packets in a preset order, unnecessary processing steps are reduced and the overall efficiency of the system is improved. The integrity and accuracy of data transmission are ensured through the parsing of the verification mechanism and data context identifiers, while simplifying the data parsing and storage process. 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.

[0045] The present invention aims at the diversity of devices and environments in the current industrial IoT environment, which makes it difficult to uniformly manage the communication interactions of various devices. A cluster communication and interaction system for industrial IoT devices is proposed, which aims to reduce the complexity of communication for new devices to access the network and improve the usability of the communication system. Allow users to define data formats according to industrial scenarios and device functions, and save them synchronously to the platform database. Data from different terminal devices will be parsed into normal data streams through a unified transceiver interface. This system is implemented purely in software, providing a unified information transceiver interface without the need for secondary development; through page configuration, the complexity of new IoT terminal devices accessing the system is reduced.

[0046] Figure 2 An industrial IoT device cluster communication interaction system provided in an embodiment of the present application is shown. The industrial IoT device cluster communication interaction system realizes 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.

[0047] The first module involves data entry, configuration file generation, and database table generation. Business personnel enter 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 of new device access.

[0048] 1. Data entry: Business personnel are responsible for entering data protocol information into the system, including variable names, data types, and the production environment and remarks of the equipment.

[0049] 2. Configuration file generation: The system automatically generates a configuration file based on 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 corresponding to each data.

[0050] 3. Database table generation: The system automatically generates the database fields that need to collect data in the database according to the configuration file. The database fields include data field ID, type, device number, remarks, etc.

[0051] The terminal configuration file generation unit provides a configuration page for users to configure. When a new device needs to be connected, the user enters the variable name, variable type, and remark information according to the data type collected by the new device scene. The back-end 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 remark information corresponding to each data. In the database field configuration unit, the back-end program automatically generates database information based on the information entered by the user, including data field ID, type, device number, remark information, etc.

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

[0053] 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. During the data transmission process, the device ID and the ID of the data being sent will be included for easy recognition and processing by the server.

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

[0055] 1. Data parsing: After receiving the communication data, the server first performs a CRC-32 check to ensure the integrity and accuracy of the data. If the check succeeds, the server starts parsing the data, including the device ID, data ID, and actual data value. 2. Data storage: The server automatically locates the corresponding database table based on the parsed device ID and data ID. The parsed data is saved to the specified database information to complete the data storage. Including server data parsing and data storage. After receiving the communication data, the server parses the data. According to the parsed device ID number and data ID number, the data is automatically parsed 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 collected data for subsequent data analysis and application use.

[0056] 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.

[0057] 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: Table 1

[0058] 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: 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.

[0059] Step 1: Business personnel enter data agreement: 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.

[0060] Step 2: The background program generates the environment ID and device ID: 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.

[0061] 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.

[0062] Step 3: Generate configuration file: The background program automatically generates a configuration file based on the environment ID, device ID, cloud server IP address and other information. The configuration file is saved in JSON format and 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: data field and type collected by the device. Based on the entered data protocol information, a unique device identifier and configuration file are generated to prepare for communication between the device and the server.

[0063] Step 4: Generate database table: After the configuration file is generated, the background server dynamically generates a new data table based on the environment ID and data format to store the data collected by the device.

[0064] The input of device data protocol is the basis for generating configuration files. The background program 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 device data protocol, the generation of environment ID and device ID, the creation of configuration files and the generation of database tables, laying the foundation for subsequent data collection and communication interaction.

[0065] Phase 2: The terminal device imports the configuration file and communicates.

[0066] Step 1: The terminal device imports the configuration file: After the terminal device is started, 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. The terminal device obtains all the parameters and data format definitions required to communicate with the server. The device is ready to communicate with the server.

[0067] Step 2: The terminal device starts the communication module: The device establishes a socket connection with the remote server through its own network module (4G, 5G, ETH) according to the IP and port in the configuration file. Establish a communication link between the terminal device and the remote server.

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

[0069] Step 4: The terminal device sends data to the server: The device encapsulates the collected data into a data packet according to a predefined format (such as hexadecimal) and sends it to the server through a socket. The terminal device sends the collected environmental data directly to the server. The data sent is in the form of a hexadecimal data stream, which contains the device ID and the values ​​of each data field. The following is an example: 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 The terminal device collects environmental data and sends it to the server in a predefined format.

[0070] The configuration file import provides the device with communication parameters and data format. The socket connection establishment ensures that the device can send data to the server. Data collection and transmission 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 the foundation for subsequent data analysis and storage.

[0071] Phase 3: The server receives and parses the data: After receiving the data, the server performs a CRC-32 check, parses the data, and stores the data in the corresponding database according to the device ID and data ID.

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

[0073] Step 2: CRC-32 check to ensure that the received data is complete and has not been tampered with. The server intercepts the last 8 hexadecimal data of the data (such as C8 C2 6C A5) as the check code. Perform CRC-32 check on the previous data. If the check fails, discard the data. If the check succeeds, continue to parse the data. CRC-32 is a commonly used data check method to detect whether there is an error in the data transmission process. If the check fails, it means that the data may be damaged during the transmission process, and the server will discard the data.

[0074] Step 3: Parse the data and store it into the corresponding database table.

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

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

[0077] Step 3-3: Parse the data and write it to the database: The remaining data is parsed according to the data field definition in the configuration file: For example: 00 00 00 20: Ozone 32 ppb 00 00 02 D6: Carbon dioxide 726 ppb 00 00 00 16: Oxygen 22%VOL 00 00 00 07: PM1.0 7 ug / m³ 00 00 00 12: PM2.5 18 ug / m³ 00 00 00 05: PM10 5 ug / m³ 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 stores the data in the corresponding database table to provide support for subsequent data analysis and monitoring. If the data is mistakenly written into a mismatched database table, it may cause data confusion or system errors. Locating the database table first can prevent this error and ensure that the data is processed correctly. Through the above steps, the server completes the reception, verification, parsing and storage of the data, ensuring the accuracy and integrity of the data, and saves it to the database for subsequent analysis and use. The whole process includes the entry of device data protocol, the generation of configuration files, the communication between the terminal device and the server, and the reception and parsing of data. Each step is closely linked to ensure that the terminal device can correctly collect data and transmit it to the server, and 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.

[0078] The data of different terminal devices are processed through a unified transceiver interface, which simplifies the parsing and processing of data streams. Through page configuration, the complexity of new IoT terminal devices accessing the system is reduced, and no secondary development is required. The system is completely software-based and provides a unified information transceiver interface, which improves the flexibility and scalability of the system. It allows users to define data formats according to industrial scenarios and device functions, and save them to the platform database synchronously, which improves the usability of the system. According to different industrial scenarios, users can customize the data format.

[0079] In summary, the embodiment of the present application provides a terminal device data transmission method, 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 target configuration file is transmitted to the terminal device, so that the terminal device encapsulates the 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; the target data packet is verified, and if the verification passes, the data context identifier is parsed from the target data packet; the target database table structure is located according to the data context identifier, and the fields other than the data context identifier in the target data packet are parsed and stored in the database table. When the 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, and 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 that the data is accurately stored, which is convenient for subsequent analysis and management.

[0080] Based on the same technical concept, the embodiment of the present application also provides a terminal device data transmission system, such as Figure 3As shown, the system comprises: The file generation module 301 is used to generate a target configuration file and a target database table structure according to the data protocol information input by the user in response to the first access of the terminal device; A file transmission module 302, configured to transmit the target configuration file to the terminal device, so that the terminal device encapsulates the target storage data into a target data packet according to the target configuration file and sends the target data packet to the server; the target data packet includes a data context identifier; A verification and parsing module 303 is used to verify the target data packet, and if the verification passes, parse the data context identifier from the target data packet; The storage module 304 is used 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.

[0081] The present application also provides an electronic device corresponding to the method provided in the above embodiment. Figure 4 , which shows an electronic device diagram provided by 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, wherein the processor 200, the communication interface 203 and the memory 201 are connected via the bus 202; the memory 201 stores a computer program that can be run on the processor 200, and the processor 200 executes the method provided by any of the aforementioned embodiments of the present application when running the computer program.

[0082] The memory 201 may include a high-speed random access memory (RAM), 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 may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used.

[0083] The bus 202 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. The memory 201 is used to store programs, and the processor 200 executes the programs after receiving execution instructions. The method disclosed in any implementation of the aforementioned embodiment of the present application may be applied to the processor 200, or implemented by the processor 200.

[0084] The processor 200 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 200. The above processor 200 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a readily available programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware decoding processor to be executed, or the hardware and software modules in the decoding processor can be executed. The software module can be located in a mature storage medium in the field 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. The storage medium is located in the memory 201, and the processor 200 reads the information in the memory 201 and completes the steps of the above method in combination with its hardware.

[0085] The electronic device provided in the embodiment of the present application and the method provided in the embodiment of the present application are based on the same inventive concept and have the same beneficial effects as the method adopted, operated or implemented by them.

[0086] The present application also provides a computer-readable storage medium corresponding to the method provided in the above embodiment. Figure 5 The computer-readable storage medium shown is a CD 30 on which a computer program (ie, a program product) is stored. When the computer program is run by a processor, the method provided in any of the aforementioned embodiments is executed.

[0087] 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 or magnetic storage media, which are not listed here one by one.

[0088] The computer-readable storage medium provided in the above-mentioned embodiments of the present application and the method provided in 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 therein.

[0089] It should be noted that the above embodiments illustrate the present application rather than limit the present application, and that those skilled in the art may design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference symbol between brackets should not be constructed as a limitation to the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "one" or "an" preceding an element does not exclude the presence of multiple such elements. The present application may be implemented by means of hardware including several different elements and by means of a suitably programmed computer. In a unit claim that lists several devices, several of these devices may be embodied by the same hardware item. The use of the words first, second, and third, etc. does not indicate any order. These words may be interpreted as names.

[0090] The above is only a preferred specific implementation 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 a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.

[0091] The above description is only a preferred embodiment of the present invention, and does not limit the patent scope of the present invention. All equivalent structural changes made by using the contents of the present invention specification and drawings under the concept of the present invention, or directly / indirectly applied in other related technical fields are included in the patent protection scope of the present invention.

Claims

1. A terminal device data transmission method, characterized in that: The method comprises: 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; Transmitting the target configuration file to the terminal device, so that the terminal device encapsulates the target storage data into a target data packet according to the target configuration file and sends the target data packet to the server; the target data packet includes a data context identifier; Verifying the target data packet, and if the verification passes, parsing the data context identifier from the target data packet; The target database table structure is located according to the data context identifier, and the fields other than the data context identifier in the target data packet are parsed and stored in the database table.

2. The method according to claim 1, characterized in that The data protocol information includes terminal equipment production environment information, as well as data fields and data types of 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: Generate environment identification and device identification according to 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; A target database table name is generated according to the environment identifier and the device identifier, and a target database table structure corresponding to the target database table name is generated according to the data field and data type of the target data.

3. The method according to claim 2, characterized in that The step of generating an environment identifier and a device identifier according to the data protocol information input by the user includes: Incrementally generating the environment identifier from database data according to the terminal device production environment information; A target hash value is calculated according to the data protocol information, and a set segment in the target hash value is intercepted as the device identifier.

4. The method according to claim 2, characterized in that The configuration file includes an environment identifier and a device identifier, the server IP address, a port number, and target storage data field information; The terminal device encapsulates the target storage data into a target data packet according to the target configuration file and sends the target data packet 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; Encapsulating the collected target storage data into a target data packet according to the target data field information; The target data packet is sent to the server through the established communication connection.

5. The method according to claim 4, characterized in that The data context identifier is the environment identifier and the device identifier; The step of encapsulating the collected target storage 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, device identifier, collected data field value and check code required for encapsulation; converting the environment identifier and the device identifier according to a first target format; Convert the collected data field value according to a second target format; Calculating a target check code of the target storage data; The environment identifier and the device identifier, the collected data field value and the target check code are spliced ​​into a complete data packet in a preset order.

6. The method according to claim 5, characterized in that The verifying the target data packet comprises: Extracting the target check code in the target data packet according to the preset order; Verifying the fields in the target data packet except the target check code to obtain a reference check code; The target check code is compared with the reference check code to see if they are consistent. If they are consistent, the check is passed; if they are inconsistent, the target data packet is discarded.

7. The method according to claim 5, characterized in that Parsing the data context identifier from the target data packet includes: The environment identifier and the device identifier in the target data packet are parsed according to the preset order.

8. A terminal device data transmission system, characterized in that: The system comprises: A file generation module, used for generating a target configuration file and a target database table structure according to the data protocol information input by the user in response to the first access of the terminal device; A file transmission module, used for transmitting the target configuration file to the terminal device, so that the terminal device encapsulates the target storage data into a target data packet according to the target configuration file and sends the target data packet to the server; the target data packet includes a data context identifier; A verification and parsing module, used for verifying the target data packet, and if the verification passes, parsing the data context identifier from the target data packet; The storage module is used 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.

9. An electronic device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: Computer-readable instructions are stored thereon, and the computer-readable instructions can be executed by a processor to implement the method according to any one of claims 1-7.

Citation Information

Patent Citations

  • Unmanned vehicle test data acquisition, transmission and processing method

    CN113691888A

  • Interface scheduling optimization method and device for front and back end interaction, equipment and storage medium

    CN113806111A

  • Intelligent analysis method and system for file import

    CN117435662A

  • System and method for collecting and analyzing data

    WO2017101606A1

  • Data storage server and client devices for securely storing data

    WO2022002351A1