A data parsing method compatible with multiple Internet of Things transmission protocols
By configuring the parsing service and function code comparison table, and selecting a universal transmission protocol for IoT device data parsing, the problem of low data parsing efficiency caused by differences in transmission protocols in the existing technology is solved, and efficient data parsing and warehousing are achieved.
Patent Information
- Application Number
- CN202411025448.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-30
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2044-07-30
AI Technical Summary
Existing IoT device data parsing methods require repeated programming and parsing for different transmission protocols, resulting in long data parsing time and low work efficiency.
Generate parsing services by configuring manufacturer codes, device type codes, data frame fields, message text fields, function codes, encryption methods and verification methods, establish a comparison table between function codes and data items, and select a common transmission protocol for data analysis and storage. , unified analysis of data of different transmission protocols.
It improves data parsing efficiency and work efficiency, realizes unified parsing of different transmission protocols, eliminates the need to repeatedly develop parsing codes, and is suitable for IoT systems of different sizes and fields.
Smart Images

Figure CN118573755B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data analysis of Internet of Things devices, and in particular to a data analysis method compatible with multiple Internet of Things transmission protocols. Background Art
[0002] With the rapid development of the Internet of Things, IoT device manufacturers emerge in an endless stream. Since manufacturers have not formed a unified protocol specification, IoT devices from different manufacturers are different in transmission protocols, data formats, etc., which leads to IoT devices with the same purpose also being different in transmission protocols, data formats, etc. This multi-source heterogeneity situation requires software to be repeatedly programmed for various transmission protocols when communicating with IoT devices, and to repeatedly parse and build tables for various messages when parsing and storing data reported by IoT devices.
[0003] At present, the existing IoT device data parsing methods often parse the received data of multiple protocol types through corresponding parsing methods. When entering the data into the database, the data parsed by different parsing methods are saved in tables in the database respectively. Faced with massive IoT device data, the time for data parsing and entering the data into the database is greatly increased, which reduces work efficiency. Summary of the invention
[0004] In view of the above analysis, the present invention aims to provide a data parsing method compatible with multiple Internet of Things transmission protocols, so as to solve the problem that the existing Internet of Things device data parsing method parses the received data in a corresponding manner, and saves the parsed data in tables in the database when entering the data, which greatly increases the time for data parsing and entering the data and reduces work efficiency.
[0005] The present invention provides a data parsing method compatible with multiple Internet of Things transmission protocols, the method comprising the following steps:
[0006] According to the manufacturer and IoT devices and the protocol documents they provide, configure the manufacturer code, device type code, data frame field, message body field, message body code, function code, encryption method, and verification method to generate the parsing service corresponding to each transmission protocol;
[0007] Obtain all data items collected by IoT devices, establish a function code and data item comparison table based on business requirements, uniquely encode the data items to establish a data item coding table, and configure the manufacturer rules, device type rules, and device rules corresponding to the general transmission protocol of each IoT device according to the manufacturer code, device type code, message body field, function code and data item comparison table, and data item coding table;
[0008] Parse the received IoT device reported data through the parsing service to obtain the corresponding message body fields and field data values; obtain the corresponding manufacturer rules or device type rules or device rules based on the message body fields and field data values and transmit the transmission data; disassemble and store the received transmission data according to the corresponding manufacturer rules or device type rules or device rules.
[0009] Furthermore, the data frames transmitted by the manufacturer's IoT device are disassembled according to the protocol document provided by the manufacturer, thereby configuring the data frame field and the message body field, and configuring the message body encoding for the message body field according to the encoding method.
[0010] Furthermore, the IoT device is used to obtain data in different application scenarios, and the acquisition module is used to report the data obtained by the IoT device; the collected data items are obtained through the acquisition module, and the address and its corresponding manufacturer code, device type code, application scenario, and function code are obtained through the IoT device; according to actual business needs and the data items, the IoT device address and its corresponding manufacturer code, device type code, application scenario, and function code, a function code and data item comparison table for each IoT device is established.
[0011] Furthermore, the data items in the function code and data item comparison table of all IoT devices are uniquely coded, and the measurement units are configured for the data items with units therein, thereby establishing a data item coding table.
[0012] Furthermore, according to the message body field configuration corresponding to each IoT device, for the case where the same manufacturer only provides one type of IoT device or all types of IoT devices from the same manufacturer use the same message body field configuration, configure the manufacturer rules corresponding to the general transmission protocol of each IoT device; for the case where multiple manufacturers provide the same type of IoT devices using the same message body field configuration or the same manufacturer provides different types of IoT devices using different message body field configurations, configure the device type rules corresponding to the general transmission protocol of each IoT device; for the case where each IoT device uses a different message body field configuration, configure the device rules corresponding to the general transmission protocol of each IoT device.
[0013] Furthermore, the address of the Internet of Things device is obtained according to the message body field configuration corresponding to the Internet of Things device, the function code and data item corresponding to the Internet of Things device are obtained according to the function code and data item comparison table and the Internet of Things device address, and the corresponding data item code is obtained according to the data item coding table and the data item corresponding to the Internet of Things device; a universal transmission protocol is selected, and the manufacturer rules corresponding to the universal transmission protocol selected by the Internet of Things device are configured according to the manufacturer code, Internet of Things device address, function code, and data item code corresponding to the Internet of Things device; the device type rules corresponding to the universal transmission protocol selected by the Internet of Things device are configured according to the manufacturer code, device type code, Internet of Things device address, function code, and data item code corresponding to the Internet of Things device; and the device rules corresponding to the universal transmission protocol selected by the Internet of Things device are configured according to the Internet of Things device address, function code, and data item code corresponding to the Internet of Things device.
[0014] Furthermore, the data frame fields include: frame start character, function code, length, message start character, message body, message end character, check code, and key.
[0015] Furthermore, the received IoT device reported data is parsed through the manufacturer's corresponding parsing service to obtain the manufacturer code, data frame field configuration, message body field configuration, and message body encoding configuration corresponding to the IoT device; the data frame field value is obtained according to the number of bytes configured in the data frame field; it is determined whether the number of key bytes is 0, and if not 0, the message body is decrypted according to the obtained key content; the message body field value is obtained according to the number of bytes configured in the message body field; the message body field value is decoded according to the message body encoding configuration to obtain the data value of each field of the message body.
[0016] Furthermore, the IoT device address is obtained through the message body field and the data value of the field, and the rules corresponding to the IoT device are queried through the IoT device address, and the rules include manufacturer rules, device type rules, and device rules; if there are corresponding device rules, the data format of the universal transmission protocol is generated according to the device rules; otherwise, if there are corresponding device type rules, the data format of the universal transmission protocol is generated according to the device type rules; otherwise, the data format of the universal transmission protocol is generated according to the corresponding manufacturer rules.
[0017] Furthermore, the corresponding rules in the database are queried according to the received universal transmission protocol data format. If there are corresponding device rules, the universal transmission protocol data format is disassembled according to the device rules and put into storage; otherwise, if there are corresponding device type rules, the universal transmission protocol data format is disassembled according to the device type rules and put into storage; otherwise, if there are corresponding manufacturer rules, the universal transmission protocol data format is disassembled according to the manufacturer rules and put into storage; otherwise, record and prompt.
[0018] Compared with the prior art, the present invention can achieve at least one of the following beneficial effects:
[0019] 1. The present invention obtains the manufacturer code, device type code, data frame field, message body field, message body code, function code, encryption method and verification method corresponding to the data reported by each IoT device by configuring the parsing service, thereby parsing the data reported by each IoT device according to different transmission protocols, thereby improving the efficiency of parsing the reported data. In addition, the present invention realizes unified parsing of data reported by different transmission protocols by configuring the parsing service corresponding to each transmission protocol, without the need to repeatedly develop parsing codes for various different protocols, thereby improving work efficiency.
[0020] 2. The present invention uniquely encodes the data items and configures the manufacturer, device type and device rules corresponding to the universal transmission protocol message, converts the data reported by each IoT device into a universal transmission protocol message and stores it in the database at one time, establishes a unified data table in the database, and improves the efficiency of storing the data reported by the IoT devices.
[0021] 3. The present invention is applicable to Internet of Things systems of different scales and fields by flexibly selecting a universal transmission protocol, thereby improving the versatility of data parsing and warehousing.
[0022] 4. The present invention extracts useful function codes according to the protocol documents provided by the manufacturer, and establishes a comparison table of function codes and data items based on different application scenarios, and reasonably classifies the collected data items according to actual business needs, which not only simplifies the data format of the general transmission protocol, but also provides a basis for subsequent business systems to efficiently use the stored data.
[0023] In the present invention, the above-mentioned technical solutions can also be combined with each other to achieve more preferred combination solutions. Other features and advantages of the present invention will be described in the subsequent description, and some advantages can become obvious from the description, or can be understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained through the contents particularly pointed out in the description and the drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The accompanying drawings are only used for the purpose of illustrating specific embodiments and are not to be considered as limiting the present invention. In the entire drawings, the same reference symbols represent the same components;
[0025] Figure 1 A flowchart of a data parsing method compatible with multiple IoT transmission protocols according to an embodiment of the present invention;
[0026] Figure 2 A schematic diagram of the overall architecture of a data parsing method compatible with multiple IoT transmission protocols according to an embodiment of the present invention;
[0027] Figure 3 A schematic diagram of a process for analyzing data reported by an IoT device according to an embodiment of the present invention;
[0028] Figure 4 A schematic diagram of a process of converting an embodiment of the present invention into a universal transmission protocol data format;
[0029] Figure 5 Schematic diagram of error information according to an embodiment of the present invention. DETAILED DESCRIPTION
[0030] The preferred embodiments of the present invention are described in detail below in conjunction with the accompanying drawings, wherein the accompanying drawings constitute a part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not used to limit the scope of the present invention.
[0031] A specific embodiment of the present invention discloses a data parsing method compatible with multiple Internet of Things transmission protocols. Figure 1 As shown, the method comprises the following steps:
[0032] Step S1: Configure the manufacturer code, device type code, data frame field, message body field, message body code, function code, encryption method, and verification method according to the manufacturer, IoT device, and transmission protocol document provided by the manufacturer to generate the parsing service corresponding to each transmission protocol;
[0033] Step S2, obtaining all data items collected by IoT devices, establishing a function code and data item comparison table based on business requirements, uniquely encoding the data items to establish a data item coding table, and configuring the manufacturer rules, device type rules and device rules corresponding to the general transmission protocol of each IoT device according to the manufacturer code, device type code, message body field, function code and data item comparison table, and data item coding table;
[0034] Step S3, parse the received IoT device reported data through the parsing service to obtain the corresponding message body field and the data value of the field; obtain the corresponding manufacturer rule or device type rule or device rule based on the message body field and the data value of the field and transmit the transmission data; disassemble and store the received transmission data according to the corresponding manufacturer rule or device type rule or device rule.
[0035] Specifically, in step S1, the manufacturer code is configured according to the manufacturer name of the IoT device. Different manufacturers correspond to different manufacturer codes, and different device types of the same manufacturer correspond to the same manufacturer code. The device type code is configured according to the device type name. The same type of IoT devices of different manufacturers correspond to the same device type code, and different types of IoT devices of the same manufacturer correspond to different device type codes.
[0036] For example, manufacturer A has device type codes A100 and A200, and manufacturer B has device type code BF. The manufacturer codes corresponding to manufacturers A and B are shown in Table 1:
[0037] Table 1 Manufacturer codes corresponding to manufacturers A and B
[0038]
[0039] It should be noted that if Figure 2 As shown, the types of IoT devices faced in this application are diverse, such as soil moisture meters, meteorological moisture meters, telemetry terminals RTU (Remote Terminal Unit), programmable logic controller PLC (Programmable Logic Controller), etc. The same manufacturer may have multiple IoT devices of different types, and the same type of IoT devices may also come from different manufacturers. Since the transmission protocols provided by different manufacturers may be different, the transmission protocols of different types of devices from the same manufacturer may also be different. Therefore, manufacturer coding and device type coding are required to provide a basis for the subsequent generation of parsing services corresponding to each transmission protocol.
[0040] Furthermore, the data frames transmitted by the manufacturer's IoT device are disassembled according to the protocol document provided by the manufacturer, thereby configuring the data frame field and the message body field, and configuring the message body encoding for the message body field according to the encoding method.
[0041] Specifically, disassemble the data frame transmitted by the manufacturer's IoT device, and configure the number of bytes in the data frame field and the number of bytes in the message body field; the data frame field includes: frame start character, function code, length, message start character, message body, message end character, check code, and key.
[0042] For example, the data frame field configuration corresponding to the IoT device of manufacturer A whose device type is A100 is shown in Table 2, and the corresponding message body field configuration is shown in Table 3:
[0043] Table 2 Data frame field configuration
[0044]
[0045] Table 3 Message body field configuration
[0046]
[0047] It should be noted that the basic format of the data frame of the Internet of Things device is: frame header + data + frame tail. Different manufacturers expand on this basis to form data frames of different formats, resulting in inconsistencies in the transmission protocols of various Internet of Things devices, which in turn leads to inconsistencies in the parsing methods corresponding to the data transmitted by each Internet of Things device. Therefore, this application sets the above-mentioned data frame fields based on actual experience, and disassembles the data frames transmitted by the Internet of Things devices according to the protocol documents provided by the manufacturer, thereby configuring the number of bytes for the above-mentioned data frame fields and the message body fields, and providing a basis for generating parsing services corresponding to each transmission protocol. If there is no content of the corresponding data frame field after disassembling the data frame, the number of bytes of the data frame field is configured to 0. For example, after disassembling the data frame, there is no content of the corresponding key, that is, the transmitted data is not encrypted, then the number of bytes of the key is configured to 0.
[0048] It is understandable that the data items collected by each IoT device are not the same, so the content of the message body they transmit is not the same, and thus the message body fields corresponding to each IoT device are also different. This application disassembles the data frame transmitted by the IoT device according to the protocol document provided by the manufacturer, thereby obtaining the specific message body field and configuring the corresponding number of bytes for it, which not only obtains the valid message body information, but also does not generate redundant fields, saving storage space and message parsing time, and improving the efficiency of message parsing.
[0049] Specifically, according to the protocol document provided by the manufacturer, the encoding method corresponding to the message body field is obtained, and the message body encoding is configured for the message body field according to the corresponding encoding method.
[0050] Exemplarily, the message body encoding configuration corresponding to Table 3 is shown in Table 4:
[0051] Table 4 Message body encoding configuration
[0052]
[0053] It should be noted that the encoding methods corresponding to the message body fields may be different. HEX represents hexadecimal encoding; BCD represents binary encoding, that is, each digit in the decimal number is encoded as a four-digit binary number.
[0054] Furthermore, based on the protocol documents provided by the manufacturers and actual business needs, the functions that can be realized by the IoT devices of each manufacturer are extracted and function codes are configured for the extracted functions.
[0055] For example, the functions extracted from the IoT device of manufacturer A with device type A100 and the corresponding function code configuration are shown in Table 5:
[0056] Table 5 Function code configuration
[0057]
[0058] It should be noted that after the present invention parses and stores the data reported by each IoT device, each subsequent business module will query the stored data in the database and display it according to actual business needs. The present invention extracts useful function codes based on the protocol documents provided by the manufacturer, and reasonably classifies the collected data items according to actual business needs, providing a basis for the subsequent business system to efficiently use the stored data.
[0059] Furthermore, according to the protocol document provided by the manufacturer, the encryption method and verification method corresponding to the data frame transmitted by the manufacturer's Internet of Things device are obtained, the encryption method of the key is configured according to the corresponding encryption method, and the verification method of the verification code is configured according to the corresponding verification method.
[0060] It should be noted that the encryption method corresponding to the data frame refers to the encryption of the message body, and the encryption method includes open source encryption algorithms such as Blowfish and Twofish. The check methods corresponding to the data frame include parity check, CRC check, LRC check, checksum, Gray code check, XOR check, and MD5 check.
[0061] Furthermore, a parsing service engine is designed, which parses the reported data received from each IoT device through a parsing service corresponding to the transmission protocol of the IoT device; the parsing service corresponding to the manufacturer is configured according to the above-mentioned manufacturer code, device type code, data frame field, message body field, message body code, function code, encryption method, and verification method; the parsing service disassembles the data frame according to the above-mentioned configuration to realize the parsing of the reported data.
[0062] It should be noted that, since the Internet of Things currently does not have a unified transmission protocol, the data transmission formats provided by Internet of Things devices from different manufacturers may be different, and even the data transmission formats of different types of Internet of Things devices from the same manufacturer may be different. Therefore, it is necessary to disassemble the data frame and configure the corresponding parsing service according to the protocol document provided by the manufacturer. If there is no corresponding parsing service for the reported data of a certain Internet of Things device, it is necessary to configure it according to the protocol document provided by the manufacturer and the method in step S1, and add the corresponding parsing service.
[0063] It can be understood that the present invention realizes unified parsing of data reported by different transmission protocols by configuring parsing services corresponding to each transmission protocol, eliminating the need to repeatedly develop parsing codes for various different protocols, thereby improving work efficiency.
[0064] Specifically, in step S2, the IoT device is used to obtain data in different application scenarios, and the acquisition module is used to report the data obtained by the IoT device; the collected data items are obtained through the acquisition module, and the address and its corresponding manufacturer code, device type code, application scenario, and function code are obtained through the IoT device; according to actual business needs and the data items, the IoT device address and its corresponding manufacturer code, device type code, application scenario, and function code, a function code and data item comparison table for each IoT device is established.
[0065] It should be noted that an IoT acquisition module can be connected to different IoT devices and applied to different scenarios. Therefore, the same acquisition module can collect different data items through different IoT devices in different application scenarios. Moreover, in different application scenarios, since the IoT devices can be different, the data items corresponding to the same function code can also be different.
[0066] For example, there are two IoT devices of manufacturer A with device type A100, and their application scenarios are main pipeline and field water extraction respectively. According to the actual business needs and the data items collected by the collection module, the IoT device address and its corresponding manufacturer code, device type code, application scenario, and function code, a comparison table of function codes and data items of the two IoT devices is established as shown in Table 6:
[0067] Table 6 Comparison table of function codes and data items of two IoT devices
[0068]
[0069] Furthermore, the data items in the function code and data item comparison table of all IoT devices are uniquely coded, and the measurement units are configured for the data items with units therein, thereby establishing a data item coding table.
[0070] It should be noted that all data items collected by the IoT devices are included in the function code and data item comparison table. Therefore, the present invention encodes the data items in the function code and data item comparison table of all IoT devices, that is, encodes all data items collected by the IoT devices.
[0071] Exemplarily, the data items in Table 6 are coded and the measurement units are configured for the data items with units therein, and a data item coding table is established as shown in Table 7:
[0072] Table 7 Data item codes and measurement units
[0073]
[0074] It should be noted that the present invention does not limit the unique coding algorithm. In Table 7, data items such as pressure and flow have units, while data items such as user number and IC card number do not have units. Therefore, the present invention only configures measurement units for data items with units. Subsequent business modules will query the stored data in the database according to actual business needs and query the corresponding measurement units through the data item coding table, and display them on the interface.
[0075] Furthermore, according to the message body field configuration corresponding to each IoT device, for the case where the same manufacturer only provides one type of IoT device or all types of IoT devices from the same manufacturer use the same message body field configuration, configure the manufacturer rules corresponding to the general transmission protocol of each IoT device; for the case where multiple manufacturers provide the same type of IoT devices using the same message body field configuration or the same manufacturer provides different types of IoT devices using different message body field configurations, configure the device type rules corresponding to the general transmission protocol of each IoT device; for the case where each IoT device uses a different message body field configuration, configure the device rules corresponding to the general transmission protocol of each IoT device.
[0076] Specifically, the address of the Internet of Things device is obtained according to the message body field configuration corresponding to the Internet of Things device, the function code and data item corresponding to the Internet of Things device are obtained according to the function code and data item comparison table and the Internet of Things device address, and the corresponding data item code is obtained according to the data item coding table and the data item corresponding to the Internet of Things device; a universal transmission protocol is selected, and the manufacturer rules corresponding to the universal transmission protocol selected by the Internet of Things device are configured according to the manufacturer code, Internet of Things device address, function code, and data item code corresponding to the Internet of Things device; the device type rules corresponding to the universal transmission protocol selected by the Internet of Things device are configured according to the manufacturer code, device type code, Internet of Things device address, function code, and data item code corresponding to the Internet of Things device; and the device rules corresponding to the universal transmission protocol selected by the Internet of Things device are configured according to the Internet of Things device address, function code, and data item code corresponding to the Internet of Things device.
[0077] Exemplarily, the address of the IoT device is obtained as "address" according to the message body field configuration corresponding to the IoT device shown in Table 3, the function code and data item corresponding to the IoT device are obtained according to the function code and data item comparison table and the IoT device address shown in Table 6, and the corresponding data item code is obtained according to the data item coding table shown in Table 7 and the data item corresponding to the IoT device; the general transmission protocol is selected as MQTT, and the manufacturer rules corresponding to the IoT device MQTT are configured according to the manufacturer code A001 corresponding to the IoT device, the IoT device address address, the function code 32H and 4CH, and the data item code as shown in Table 8:
[0078] Table 8 Manufacturer rule configuration corresponding to an IoT device under the MQTT transmission protocol
[0079]
[0080] According to the manufacturer code A001, device type codes A100 and A200, IoT device address address, function codes 32H and 4CH, and data item code corresponding to the IoT device, the device type rules corresponding to the IoT device MQTT are configured as shown in Table 9:
[0081] Table 9 Device type rule configuration corresponding to an IoT device under the MQTT transport protocol
[0082]
[0083] According to the IoT device address, function codes 33H and 34H, and data item code corresponding to the IoT device, the device rules corresponding to the IoT device MQTT are configured as shown in Table 10: Table 10 Device rule configuration corresponding to an IoT device under the MQTT transmission protocol
[0084]
[0085] In another embodiment of the present invention, the general transmission protocol is selected as Rabbit MQ, and the manufacturer rules corresponding to the IoT device Rabbit MQ are configured according to the manufacturer code A001 corresponding to the IoT device, the IoT device address address, the function codes 32H and 4CH, and the data item code as shown in Table 11:
[0086] Table 11 Manufacturer rule configuration corresponding to an IoT device under Rabbit MQ transport protocol
[0087]
[0088] According to the manufacturer code A001, device type codes A100 and A200, IoT device address, function codes 32H and 4CH, and data item code corresponding to the IoT device, the device type rules corresponding to Rabbit MQ are configured as shown in Table 12:
[0089] Table 12 Device type rule configuration corresponding to an IoT device under Rabbit MQ transport protocol
[0090]
[0091] According to the IoT device address address, function codes 33H and 34H, and data item encoding corresponding to the IoT device, the device rules corresponding to the IoT device Rabbit MQ are configured as shown in Table 13:
[0092] Table 13 Device rule configuration corresponding to an IoT device under Rabbit MQ transport protocol
[0093]
[0094] It should be noted that the manufacturer rules, device type rules and device rules are related to the selected universal transmission protocol. For example, when the MQTT protocol is selected, the above rules represent the subject and message of the MQTT protocol. When the Rabbit MQ protocol is selected, the above rules represent the message queue and message of the Rabbit MQ protocol. The present invention simplifies the data format of the universal transmission protocol by configuring the above rules and only configuring the relevant manufacturer code, device type code, IoT device address, function code and data item code. The corresponding data item and its unit of measurement can be obtained through the data item code and the data item code table.
[0095] It can be understood that the present invention establishes a comparison table of function codes and data items based on different application scenarios, and reasonably classifies the collected data items according to actual business needs, which not only simplifies the data format of the general transmission protocol, but also provides a basis for subsequent business systems to efficiently use the stored data. The present invention is applicable to Internet of Things systems of different scales and fields by flexibly selecting a general transmission protocol, and improves the versatility of data parsing and storage.
[0096] Specifically, in step S3, if Figure 3 As shown, the received IoT device reported data is parsed through the manufacturer's corresponding parsing service to obtain the manufacturer code, data frame field configuration, message body field configuration, and message body encoding configuration corresponding to the IoT device; the data frame field value is obtained according to the number of bytes configured in the data frame field; it is determined whether the number of key bytes is 0, if not 0, the message body is decrypted according to the obtained key content; the message body field value is obtained according to the number of bytes configured in the message body field; the message body field value is decoded according to the message body encoding configuration to obtain the data value of each field of the message body.
[0097] It can be understood that the present invention obtains the manufacturer code, device type code, data frame field, message body field, message body code, function code, encryption method and verification method corresponding to the data reported by each IoT device by configuring the parsing service, thereby parsing the data reported by each IoT device according to different transmission protocols, thereby improving the efficiency of parsing the reported data.
[0098] Furthermore, if Figure 4As shown, the IoT device address is obtained through the message body field and the data value of the field, and the rules corresponding to the IoT device are queried through the IoT device address, and the rules include manufacturer rules, device type rules, and device rules; if there are corresponding device rules, the data format of the general transmission protocol is generated according to the device rules; otherwise, if there are corresponding device type rules, the data format of the general transmission protocol is generated according to the device type rules; otherwise, the data format of the general transmission protocol is generated according to the corresponding manufacturer rules.
[0099] Specifically, according to the selected general transmission protocol, the generated data format is transmitted to the warehousing service in a publish-subscribe or message queue manner. Exemplarily, MQTT is selected as the general transmission protocol, the parsing service publishes the MQTT topic and the corresponding message as the publisher in the MQTT architecture, and the warehousing service subscribes to the MQTT topic and the corresponding message as the subscriber in the MQTT architecture.
[0100] Furthermore, the corresponding rules in the database are queried according to the received universal transmission protocol data format. If there are corresponding device rules, the universal transmission protocol data format is disassembled according to the device rules and put into storage; otherwise, if there are corresponding device type rules, the universal transmission protocol data format is disassembled according to the device type rules and put into storage; otherwise, if there are corresponding manufacturer rules, the universal transmission protocol data format is disassembled according to the manufacturer rules and put into storage; otherwise, record and prompt.
[0101] Specifically, the data is stored in the form of key-value. For example, the MQTT message in Table 8 is disassembled according to the manufacturer's rules, and the disassembled data is: W001: 100, W002: 200, W003: 300, W004: 09:00:00, W005: 19:00:00, where key is W001 to W005, value is the corresponding data value, and it is saved in the database in the form of key-value.
[0102] Specifically, Figure 5 As shown, if there is no corresponding rule in the database, the error information is recorded in the database and displayed. According to the displayed error information, the corresponding rule can be added.
[0103] It can be understood that the present invention converts the data reported by each IoT device into a universal transmission protocol message and stores it in the database at one time by uniquely encoding the data items and configuring the manufacturer, device type and device rules corresponding to the universal transmission protocol message, thereby establishing a unified data table in the database, thereby improving the efficiency of storing the data reported by the IoT devices.
[0104] Compared with the prior art, the data parsing method provided by the present invention that is compatible with multiple IoT transmission protocols has the following beneficial effects:
[0105] 1. The present invention obtains the manufacturer code, device type code, data frame field, message body field, message body code, function code, encryption method and verification method corresponding to the data reported by each IoT device by configuring the parsing service, thereby parsing the data reported by each IoT device according to different transmission protocols, thereby improving the efficiency of parsing the reported data. In addition, the present invention realizes unified parsing of data reported by different transmission protocols by configuring the parsing service corresponding to each transmission protocol, without the need to repeatedly develop parsing codes for various different protocols, thereby improving work efficiency.
[0106] 2. The present invention uniquely encodes the data items and configures the manufacturer, device type and device rules corresponding to the universal transmission protocol message, converts the data reported by each IoT device into a universal transmission protocol message and stores it in the database at one time, establishes a unified data table in the database, and improves the efficiency of storing the data reported by the IoT devices.
[0107] 3. The present invention is applicable to Internet of Things systems of different scales and fields by flexibly selecting a universal transmission protocol, thereby improving the versatility of data parsing and warehousing.
[0108] 4. The present invention extracts useful function codes according to the protocol documents provided by the manufacturer, and establishes a comparison table of function codes and data items based on different application scenarios, and reasonably classifies the collected data items according to actual business needs, which not only simplifies the data format of the general transmission protocol, but also provides a basis for subsequent business systems to efficiently use the stored data.
[0109] Those skilled in the art will appreciate that all or part of the processes of the above-mentioned embodiments can be implemented by instructing related hardware through a computer program, and the program can be stored in a computer-readable storage medium, wherein the computer-readable storage medium is a disk, an optical disk, a read-only storage memory, or a random access memory, etc.
[0110] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by any technician familiar with the technical field within the technical scope disclosed by the present invention should be covered within the protection scope of the present invention.
Claims
1. A data parsing method compatible with multiple Internet of Things transmission protocols, characterized in that: The method comprises the following steps: According to the manufacturer, IoT device and the transmission protocol documents provided by the manufacturer, configure the manufacturer code, device type code, data frame field, message body field, message body code, function code, encryption method and verification method to generate the parsing service corresponding to each transmission protocol; Obtain all data items collected by IoT devices, establish a function code and data item comparison table based on business requirements, uniquely encode the data items to establish a data item coding table, and configure the manufacturer rules, device type rules, and device rules corresponding to the general transmission protocol of each IoT device according to the manufacturer code, device type code, message body field, function code and data item comparison table, and data item coding table; Parse the received IoT device reported data through the parsing service to obtain the corresponding message body field and the data value of the field; obtain the corresponding transmission data under the manufacturer rule or device type rule or device rule based on the message body field and the data value of the field and transmit it; disassemble and store the received transmission data according to the corresponding manufacturer rule or device type rule or device rule; The IoT device is used to obtain data in different application scenarios, and the acquisition module is used to report the data obtained by the IoT device; the collected data items are obtained through the acquisition module, and the address and its corresponding manufacturer code, device type code, application scenario, and function code are obtained through the IoT device; a comparison table of function codes and data items for each IoT device is established based on actual business needs and the data items, IoT device addresses and their corresponding manufacturer codes, device type codes, application scenarios, and function codes; Uniquely encode the data items in the function code and data item comparison table of all IoT devices, and configure the measurement units for the data items with units, so as to establish a data item coding table; According to the message body field configuration corresponding to each IoT device, if the same manufacturer only provides one type of IoT device or all types of IoT devices from the same manufacturer use the same message body field configuration, configure the manufacturer rules corresponding to the general transmission protocol of each IoT device; if multiple manufacturers provide the same type of IoT devices using the same message body field configuration or the same manufacturer provides different types of IoT devices using different message body field configurations, configure the device type rules corresponding to the general transmission protocol of each IoT device; if each IoT device uses a different message body field configuration, configure the device rules corresponding to the general transmission protocol of each IoT device.
2. The data parsing method compatible with multiple Internet of Things transmission protocols according to claim 1 is characterized in that: According to the protocol document provided by the manufacturer, the data frame transmitted by the manufacturer's IoT device is disassembled to configure the data frame field and the message body field, and the message body encoding is configured for the message body field according to the encoding method.
3. The data parsing method compatible with multiple Internet of Things transmission protocols according to claim 1 is characterized in that: Obtain the address of the IoT device according to the message body field configuration corresponding to the IoT device, obtain the function code and data item corresponding to the IoT device according to the function code and data item comparison table and the IoT device address, and obtain the corresponding data item code according to the data item coding table and the data item corresponding to the IoT device; select a general transmission protocol, and configure the manufacturer rules corresponding to the general transmission protocol selected by the IoT device according to the manufacturer code, IoT device address, function code, and data item code corresponding to the IoT device; configure the device type rules corresponding to the general transmission protocol selected by the IoT device according to the manufacturer code, device type code, IoT device address, function code, and data item code corresponding to the IoT device; configure the device rules corresponding to the general transmission protocol selected by the IoT device according to the IoT device address, function code, and data item code corresponding to the IoT device.
4. The data parsing method compatible with multiple Internet of Things transmission protocols according to claim 1 is characterized in that: The data frame fields include: frame start character, function code, length, message start character, message body, message end character, check code, and key.
5. The data parsing method compatible with multiple Internet of Things transmission protocols according to claim 4 is characterized in that: Parse the received IoT device reported data through the manufacturer's corresponding parsing service to obtain the manufacturer code, data frame field configuration, message body field configuration, and message body encoding configuration corresponding to the IoT device; obtain the data frame field value according to the number of bytes configured in the data frame field; determine whether the number of key bytes is 0, and if not, decrypt the message body according to the obtained key content; The message body field value is obtained according to the number of bytes configured in the message body field; the message body field value is decoded according to the message body encoding configuration to obtain the data value of each field of the message body.
6. The data parsing method compatible with multiple Internet of Things transmission protocols according to claim 5 is characterized in that: The IoT device address is obtained through the message body field and the data value of the field, and the rules corresponding to the IoT device are queried through the IoT device address, wherein the rules include manufacturer rules, device type rules, and device rules; if there are corresponding device rules, the data format of the universal transmission protocol is generated according to the device rules; otherwise, if there are corresponding device type rules, the data format of the universal transmission protocol is generated according to the device type rules; otherwise, the data format of the universal transmission protocol is generated according to the corresponding manufacturer rules.
7. The data parsing method compatible with multiple Internet of Things transmission protocols according to claim 6 is characterized in that: According to the received universal transmission protocol data format, the corresponding rules in the database are queried, and if there are corresponding device rules, the universal transmission protocol data format is disassembled according to the device rules and stored; Otherwise, if there is a corresponding device type rule, the universal transmission protocol data format is disassembled according to the device type rule and stored; Otherwise, if there is a corresponding manufacturer rule, the universal transmission protocol data format is disassembled according to the manufacturer rule and stored; otherwise, it is recorded and prompted.
Citation Information
Patent Citations
Industrial Internet of Things multi-protocol analysis method and system
CN117278661A
Information interaction method based on Internet of Things multi-protocol adaptation
CN117478765A
