Classification processing method and device for internet of things message
By combining key-value pairs and hashing the JSON data of IoT messages, fingerprint features are generated, which solves the problem of insufficient classification of IoT messages, improves the software development efficiency and quality of the device communication layer, and supports the optimization and upgrading of the device communication layer.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING QISHENG SCIENCE AND TECHNOLOGY CO LTD
- Filing Date
- 2024-12-17
- Publication Date
- 2026-06-19
AI Technical Summary
The classification and processing of IoT messages in existing technologies are not detailed enough, resulting in low efficiency and quality of device communication layer software development, an inability to effectively understand IoT messages on the device communication side, and an impact on protocol uniformity.
By acquiring JSON data from IoT messages, combining and hashing key-value pairs, fingerprint features are generated. Based on these fingerprint features, IoT messages are classified to determine their protocol or protocol version.
It enables detailed classification of IoT messages, saves running time, quickly identifies problematic messages and associated devices, and supports the optimization and upgrade of device communication layers.
Smart Images

Figure CN122241328A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method and apparatus for classifying and processing Internet of Things (IoT) messages. Background Technology
[0002] With the continuous growth of massive IoT data traffic, the number of devices and firmware hardware associated with the server is also increasing, generating hundreds of millions of IoT messages on the communication side of IoT devices. Therefore, in order to avoid inconsistencies in protocol implementation and development during the software development process for IoT devices on the communication side due to insufficient understanding of IoT messages or inconsistencies caused by different protocols or different protocol versions, resulting in errors on the server, devices, and firmware hardware, it is crucial to classify and process IoT messages effectively.
[0003] Typically, data monitoring and analysis of software systems are performed at the upper business layer, such as specific domain data like battery level and charge / discharge cycles. However, the data obtained in this way has already undergone processing, transformation, and filtering, meaning it cannot cover IoT messages at the device's communication layer, nor can it perform a complete analysis at the fine-grained level of the device's communication layer. This approach cannot analyze and monitor IoT messages, nor can it provide a standardized description of IoT messages, resulting in a lack of clarity regarding the IoT messages on the device's communication side and affecting the efficiency and quality of software development at the device's communication layer. Summary of the Invention
[0004] This application aims to at least partially address one of the technical problems in the related art.
[0005] Therefore, the first objective of this application is to propose a classification and processing method for Internet of Things (IoT) messages. This method classifies IoT messages to determine the protocol or protocol version to which the IoT messages belong. By pre-classifying and processing IoT messages, it is easier to find the required IoT message data from the large number of IoT messages generated by the interaction between the server and IoT devices, thus saving running time.
[0006] The second objective of this application is to propose a classification and processing device for Internet of Things (IoT) messages.
[0007] The third objective of this application is to propose an electronic device.
[0008] The fourth objective of this application is to provide a computer-readable storage medium.
[0009] The fifth objective of this application is to provide a computer program product.
[0010] To achieve the above objectives, a first aspect of this application proposes a method for classifying and processing Internet of Things (IoT) messages, comprising: acquiring multiple IoT messages, wherein any IoT message includes Object Notation (JSON) data, the JSON data being used to indicate multiple key-value pairs and the structural relationships between the multiple key-value pairs; for any IoT message, combining the multiple key-value pairs according to the structural relationships to obtain target information; hashing the target information of each IoT message to obtain fingerprint features of each IoT message; and classifying the multiple IoT messages according to the fingerprint features of each IoT message to obtain the category to which each IoT message belongs, wherein the category is used to indicate the protocol or protocol version to which the message belongs.
[0011] To achieve the above objectives, a second aspect of this application provides a classification and processing apparatus for Internet of Things (IoT) messages, comprising: a first acquisition module for acquiring multiple IoT messages, wherein any IoT message includes Object Notation (JSON) data, the JSON data indicating multiple key-value pairs and the structural relationship between the multiple key-value pairs; a first obtaining module for combining multiple key-value pairs according to the structural relationship to obtain target information for any IoT message; a second obtaining module for hashing the target information of each IoT message to obtain fingerprint features of each IoT message; and a classification processing module for classifying the multiple IoT messages according to the fingerprint features of each IoT message to obtain the category to which each IoT message belongs, wherein the category indicates the protocol or protocol version to which it belongs.
[0012] To achieve the above objectives, a third aspect of this application provides an electronic device, comprising: a processor; and a memory for storing processor-executable instructions; wherein the processor is configured to execute the instructions to implement the IoT message classification and processing method as described in the first aspect of this application.
[0013] At least one memory is coupled to the at least one processing unit and stores instructions for execution by the at least one processing unit, which, when executed by the at least one processing unit, cause the electronic device to perform the above-described IoT message classification processing method.
[0014] To achieve the above objectives, a fourth aspect of this application provides a computer-readable storage medium having a computer program stored thereon, characterized in that the computer program can be executed by a processor to implement the above-described method for classifying and processing Internet of Things (IoT) messages.
[0015] To achieve the above objectives, a fifth aspect of this application provides a computer program product comprising computer-executable instructions that, when executed by a processor, implement the above-described method for classifying and processing Internet of Things (IoT) messages.
[0016] The IoT message classification processing method and apparatus provided in this application acquire multiple IoT messages, wherein each IoT message includes Object Notation (JSON) data, which indicates multiple key-value pairs and the structural relationships between them. For each IoT message, the method combines multiple key-value pairs according to the structural relationships to obtain target information. The method then performs hash processing on the target information of each IoT message to obtain fingerprint features. Based on the fingerprint features of each IoT message, the method classifies the multiple IoT messages to determine the category to which each IoT message belongs, where the category indicates the protocol or protocol version. Thus, by using the structural relationships between multiple key-value pairs in each IoT message, the method concatenates and combines multiple keys and / or values in the IoT message to determine the target information of the IoT message. Finally, the method performs hash operations on the IoT messages to obtain the individual target information of each IoT message. Fingerprint features allow for the classification of IoT messages without the need for extensive analysis, identifying the protocol or version to which each message belongs. This pre-classification facilitates the retrieval of specific IoT messages generated from interactions between the server and IoT devices, saving time and providing insights into the similarities and differences between messages belonging to different protocols or versions. This not only enables the rapid identification of problematic IoT messages and their associated devices (or even physical hardware), but also allows for various applications based on message category, providing data support for subsequent optimization and upgrades of the IoT device communication layer.
[0017] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description
[0018] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, wherein:
[0019] Figure 1 A flowchart illustrating a method for classifying and processing Internet of Things (IoT) messages provided in the first embodiment of this application;
[0020] Figure 2 A flowchart illustrating a method for classifying and processing Internet of Things (IoT) messages provided in the second embodiment of this application;
[0021] Figure 3A flowchart illustrating a method for classifying and processing Internet of Things (IoT) messages provided in the third embodiment of this application;
[0022] Figure 4 A flowchart illustrating a method for classifying and processing Internet of Things (IoT) messages provided in the fourth embodiment of this application;
[0023] Figure 5 This is a schematic diagram of the structure of an IoT message classification and processing device provided in an embodiment of this application;
[0024] Figure 6 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0025] The embodiments of this application are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this application, and should not be construed as limiting this application.
[0026] Currently, the typical approach is to perform customized monitoring and data analysis on software system data at the upper business layer, such as specific domain data like battery level and charge / discharge cycles. However, this approach has the following problems:
[0027] 1. The obtained data has already undergone processing, transformation, and filtering, meaning it cannot cover IoT messages at the device's communication layer, nor does it provide a complete, fine-grained analysis of the device's communication layer.
[0028] 2. This method cannot perform detailed analysis of IoT messages, nor can it provide a standardized description of IoT messages.
[0029] The following description, with reference to the accompanying drawings, describes a method and apparatus for classifying and processing IoT messages according to embodiments of this application.
[0030] Figure 1 This is a flowchart illustrating a method for classifying and processing Internet of Things (IoT) messages, as provided in the first embodiment of this application.
[0031] This application example illustrates the configuration of the IoT message classification and processing method in an IoT message classification and processing device. The IoT message classification and processing device can be applied to any electronic device so that the electronic device can perform the IoT message classification and processing function.
[0032] Among them, electronic devices can be any device with computing capabilities, such as personal computers, mobile terminals, servers (or cloud computing), etc. Mobile terminals can be hardware devices with various operating systems, touch screens and / or displays, such as in-vehicle devices, mobile phones, tablets, personal digital assistants, wearable devices, etc.
[0033] like Figure 1 As shown, the classification and processing method for this IoT message includes the following steps:
[0034] Step 101: Obtain multiple IoT messages, wherein any IoT message includes JSON data in object representation, which is used to indicate multiple key-value pairs and the structural relationship between the multiple key-value pairs.
[0035] It should be noted that the IoT message classification processing method provided in this application embodiment can be executed by an IoT message classification processing device (also referred to as an IoT message classification processor), which can be implemented by software and / or hardware. The IoT message classification processing device can be an electronic device or can be configured within an electronic device to implement the IoT message classification processing function. This application embodiment uses the example of the IoT message classification processing method being configured within an electronic device for illustration.
[0036] Among them, electronic devices can be any device with computing capabilities, such as personal computers, mobile terminals, servers, etc. Mobile terminals can be hardware devices with various operating systems, touch screens and / or displays, such as in-vehicle devices, mobile phones, tablets, personal digital assistants, wearable devices, etc.
[0037] IoT messages are data units used in the IoT environment for exchanging and transmitting communication protocol information between devices and with servers.
[0038] It is important to understand that the number of devices associated with the server is quite large. In reality, the communication data generated between devices and between the devices and the server is in the hundreds of millions. Moreover, the initial communication data is the source data, which cannot be processed directly. Therefore, the source data of the communication side can be encoded and decoded, and the encoded and decoded data can be processed to obtain multiple IoT messages and JSON data in the IoT messages.
[0039] In order to accurately obtain multiple IoT messages from the communication source data generated by interactions between devices and with the server, as a possible implementation method, the communication source data is encoded and decoded to obtain multiple IoT messages and any IoT message including JSON data in object representation.
[0040] As an example, the process involves acquiring communication-side source data, encoding and decoding the communication-side source data to obtain encoded and decoded communication-side data, modeling the encoded and decoded communication-side data to obtain a data model for describing the communication-side data, determining the JSON data during encoding and decoding based on the data model, and determining the IoT message associated with the JSON data based on the JSON data.
[0041] Step 102: For any IoT message, combine multiple key-value pairs according to the structural relationship to obtain the target information.
[0042] It is important to understand that multiple IoT messages can originate from the same protocol or version, or from different protocols or versions. These messages share similarities and differences. Understanding these similarities and differences can prevent inconsistencies caused by different protocols or versions. Therefore, determining the information used to identify IoT messages is crucial for classifying them and facilitating more detailed analysis.
[0043] It is understandable that the target information obtained from the IoT messages is used for subsequent classification of the IoT messages.
[0044] It is understandable that different IoT messages will yield different target information.
[0045] Step 103: Hash the target information of each IoT message to obtain the fingerprint features of each IoT message.
[0046] In order to obtain the complete fingerprint characteristics of each IoT message, as a possible implementation method, a fixed-length hash value obtained by hashing the target information of the IoT message is used as the fingerprint characteristics of the IoT message.
[0047] As an example, for any IoT message, the target information of the IoT message is hashed, and the target information of the IoT message is pre-mapped into a fixed-length hash value. The fixed-length hash value is used as the fingerprint feature of the IoT message.
[0048] It is understandable that for each IoT message, the corresponding fingerprint feature is unique.
[0049] Step 104: Based on the fingerprint characteristics of each IoT message, classify the multiple IoT messages to obtain the category to which each IoT message belongs. The category is used to indicate the protocol or protocol version to which the message belongs.
[0050] It is important to understand that by using fingerprint features to classify multiple IoT messages and determine their category, we can understand the protocol or protocol version to which the IoT message belongs. This allows for a more detailed understanding of the IoT message and enables various applications to be made using it.
[0051] For example, given protocol versions 4 and 6, to gain a detailed understanding of the similarities and differences between IoT messages belonging to protocol versions 4 and 6, such as differences in certain specific fields, we can use categories to identify IoT messages belonging to protocol version 4 and IoT messages belonging to protocol version 6 from multiple IoT messages. This allows us to retrieve IoT messages belonging to protocol versions 4 and 6, providing data support for a further understanding of protocol versions 4 and 6.
[0052] The IoT message classification and processing method provided in this application obtains multiple IoT messages, each of which includes JSON data in Object Notation. The JSON data indicates multiple key-value pairs and the structural relationships between these pairs. For any given IoT message, the method combines the key-value pairs according to the structural relationships to obtain target information. The target information of each IoT message is then hashed to obtain a fingerprint feature. Based on the fingerprint features of each IoT message, the multiple IoT messages are classified to determine the category to which each IoT message belongs. The category indicates the protocol or protocol version to which the message belongs. Thus, by using the structural relationships between the key-value pairs in each IoT message, multiple keys and / or values in the IoT message are concatenated and combined to determine the target information of the IoT message. Finally, a hash operation is performed on the IoT messages to obtain their respective identifiers. Fingerprint features, by analyzing massive amounts of IoT messages, can classify them to determine the protocol or version to which each message belongs. Pre-classifying IoT messages facilitates the retrieval of specific data from the large volume of messages generated by server-device interactions, saving time. It also allows for a deeper understanding of the similarities and differences between messages belonging to different protocols or versions. This not only enables the rapid identification of problematic IoT messages and their associated devices (or even physical hardware), but also allows for various applications based on message category, providing data support for subsequent optimization and upgrades of the IoT device communication layer.
[0053] To clearly illustrate how the above embodiments combine multiple key-value pairs based on structural relationships to obtain target information for any IoT message, this application proposes another IoT message classification and processing method.
[0054] Figure 2 This is a flowchart illustrating the classification and processing method for IoT messages shown in the second embodiment of this application.
[0055] like Figure 2 As shown, the classification and processing method for this IoT message includes the following steps:
[0056] Step 201: Obtain multiple IoT messages, wherein any IoT message includes Object Notation JSON data, which is used to indicate multiple key-value pairs and the structural relationship between the multiple key-value pairs.
[0057] It should be noted that the execution process of step 201 can be implemented in any of the embodiments of this application. The embodiments of this application do not limit this, nor will they be described in detail.
[0058] Step 202: For any IoT message, determine the parent-child relationship between multiple nodes in the JSON data based on the structural relationship, where nodes are used to indicate the corresponding key-value pairs.
[0059] To fully determine the parent-child relationships between multiple nodes in JSON data, as an example, for any IoT message, based on the structural relationships, the corresponding tree structure is determined, the tree structure is traversed, and the nodes used to indicate the corresponding key-value pairs and the parent-child relationships between multiple nodes are determined from the tree structure.
[0060] Step 203: Based on the parent-child relationship between multiple nodes, concatenate the keys and / or values in the key-value pairs indicated by multiple nodes to obtain the identifier string.
[0061] To ensure the uniqueness of the fingerprint features of the subsequently obtained IoT messages and to accurately obtain the identification string, as one possible implementation is to concatenate the keys and / or values in the key-value pairs indicated by the nodes according to the output order of each node to obtain the identification string.
[0062] As an example, the output order of each node is determined based on the parent-child relationship; for each node, the keys and / or values in the key-value pairs indicated by the node are concatenated according to the output order to obtain the identifier string.
[0063] For example, suppose there are 8 nodes: A, B, C, D, E, F, G, V, and I. Node A is the parent node of nodes B, C, and D; node B is the parent node of nodes E, F, and G; and node D is the parent node of nodes V and I. Following the output order of nodes A, B, C, D, E, F, G, V, and I, the keys and / or values in the key-value pairs indicated by nodes A, B, C, D, E, F, G, V, and I are concatenated to obtain the identifier string.
[0064] Step 204: Determine the target information based on the identifier string.
[0065] It is understandable that the identifier string can be used directly as the target information, or the magnitude of the identifier string can be judged. If the magnitude of the identifier string exceeds the preset magnitude standard value, in order to avoid hash collisions, the identifier string is hashed and the processed identifier string is used as the target information.
[0066] As an example, the magnitude of the identifier string is obtained; it is determined whether the magnitude of the identifier string exceeds the preset magnitude standard value. If the magnitude of the identifier string exceeds the preset magnitude standard value, the identifier string is hashed, and the processed identifier string is used as the target information.
[0067] Step 205: Hash the target information of each IoT message to obtain the fingerprint features of each IoT message.
[0068] Step 206: Based on the fingerprint characteristics of each IoT message, classify the multiple IoT messages to obtain the category to which each IoT message belongs. The category is used to indicate the protocol or protocol version to which the message belongs.
[0069] It should be noted that the execution processes of steps 205 and 206 can be implemented in any of the embodiments of this application. The embodiments of this application do not limit this, nor will they be described in detail.
[0070] In summary, for any IoT message, the parent-child relationship between multiple nodes in the JSON data is determined based on the structural relationship, where nodes indicate corresponding key-value pairs. Based on the parent-child relationship between multiple nodes, the keys and / or values in the key-value pairs indicated by multiple nodes are concatenated to obtain an identifier string. Based on the identifier string, the target information is determined. Thus, according to the output order of each node, the keys and / or values in the key-value pairs indicated by the nodes are concatenated to obtain an identifier string, which in turn determines the target information. The target information obtained in this way is unique for the corresponding IoT message, thereby ensuring the uniqueness of the fingerprint features of the subsequently obtained IoT messages, so as to quickly classify IoT messages using unique fingerprint features.
[0071] To clearly illustrate how multiple IoT messages are classified and processed based on the fingerprint characteristics of each IoT message in the above embodiments, this application proposes another method for classifying and processing IoT messages.
[0072] Figure 3 This is a flowchart illustrating the classification and processing method for IoT messages shown in the third embodiment of this application.
[0073] like Figure 3 As shown, the classification and processing method for this IoT message includes the following steps:
[0074] Step 301: Obtain multiple IoT messages, wherein any IoT message includes Object Notation JSON data, which is used to indicate multiple key-value pairs and the structural relationship between the multiple key-value pairs.
[0075] Step 302: For any IoT message, combine multiple key-value pairs according to the structural relationship to obtain the target information.
[0076] Step 303: Hash the target information of each IoT message to obtain the fingerprint features of each IoT message.
[0077] It should be noted that the execution process of steps 301 to 303 can be implemented in any of the embodiments of this application. The embodiments of this application do not limit this, nor will they be described in detail.
[0078] Step 304: Store each IoT message and its corresponding fingerprint feature in the data details table.
[0079] It is understandable that the data details table also includes device identifiers, which are used to indicate the devices associated with IoT messages.
[0080] Step 305: Based on the fingerprint characteristics of each IoT message in the data details table, identify multiple IoT messages belonging to the same fingerprint characteristic.
[0081] It is important to understand that each IoT message also includes a corresponding type field. Considering the complexity of IoT messages, if we only classify each IoT message by its fingerprint characteristics, we can distinguish the protocol or protocol version to which the IoT message belongs. However, for IoT messages belonging to the same protocol or protocol version, we do not make more detailed divisions, and the granularity of classification is insufficient.
[0082] To classify and process IoT messages more precisely, as one possible implementation method, multiple IoT messages are classified into different levels based on the type field and fingerprint characteristics of each IoT message.
[0083] As an example, based on the type field of each IoT message in the data details table, the message type of each IoT message is determined; the message type is used as the first classification level to classify multiple IoT messages, resulting in IoT messages under the same message type; for IoT messages under the same message type, fingerprint features are used as the second classification level to classify them, resulting in IoT messages corresponding to each fingerprint feature under the same message type; the category to which each IoT message belongs is determined based on the first and second classification levels.
[0084] It should be noted that there are differences in at least one of the message type and fingerprint characteristics between different categories of IoT messages, while IoT messages of the same category have the same message type and fingerprint characteristics.
[0085] It is understandable that the type field of an IoT message is used to indicate the type of certain fields or data contained in the IoT message. For example, the IoT message may contain enumerated data.
[0086] Step 306: Classify multiple IoT messages that belong to the same fingerprint feature.
[0087] In this example, multiple IoT messages are classified into primary categories based on the IoT messages belonging to the same message type to obtain multiple IoT messages that have been classified into primary categories. Then, based on the fingerprint features of each message belonging to the same message type, the multiple IoT messages that have been classified into primary categories are classified into secondary categories to determine the category to which each IoT message belongs.
[0088] Step 307: Generate an aggregated classification table based on the IoT messages under each category.
[0089] To obtain the aggregated classification table, as one possible implementation, from multiple IoT messages under a category, the last example IoT message stored in the data details table in chronological order is identified, and the example IoT message is stored in the aggregated classification table.
[0090] As an example, for any category, based on the time order in which multiple IoT messages under the category are stored in the data details table, the last example IoT message in the time order is determined; the example IoT messages corresponding to each category, as well as the fingerprint features of the example IoT messages, are stored in the aggregated classification table.
[0091] It should be noted that the aggregated classification table is used to query the corresponding example IoT message based on the fingerprint features indicated by the first query statement.
[0092] It's important to understand that in reality, devices are constantly running, generating IoT messages in real time. Consequently, the data detail table is constantly being updated, and the aggregation classification table also needs to be updated in real time. However, the aggregation classification table stores sample IoT messages and does not need to be updated in real time to avoid data corruption. Instead, a preset time period can be used to periodically aggregate the data detail table and generate the aggregation classification table based on the IoT messages belonging to each category in the data detail table.
[0093] In this example, for each period, the aggregation frequency of the data detail table is incremented by one; the initial value of the aggregation frequency is zero; and the aggregation frequency is maintained in the aggregation category table.
[0094] It should be noted that the specific time period of the preset time period is determined according to actual needs, and this embodiment does not impose a specific limitation, for example, one month.
[0095] It is important to understand that, in order to facilitate various applications of IoT packets based on data detail tables and aggregated classification tables, and to enable the retrieval of required IoT packets through query statements, it is necessary to clearly understand the distribution of IoT packets of different protocols or protocol versions. This provides data support for subsequent system optimization and upgrades, protocol integration, or device power consumption and traffic reduction. The data detail tables and aggregated classification tables can be processed to determine the target classification table used to store the data detail tables and aggregated classification tables.
[0096] In order to obtain the target classification table completely based on the data detail table and the aggregate classification table, as a possible implementation method, the target classification table is determined based on the first structured data file corresponding to the data detail table and the second structured data file corresponding to the aggregate classification table.
[0097] As an example, the IoT messages and their corresponding fingerprint features stored in the data details table are transformed to obtain a first structured data file; the example IoT messages under each category in the aggregated classification table are transformed to obtain a second structured data file; the first structured data file and the second structured data file are mapped to a target classification table respectively; wherein, the target classification table is used to query IoT messages of any category in response to IoT message query instructions from the application layer.
[0098] For example, the first structured data file and the second structured data file can be written into the Hive data warehouse to obtain a Hive table. The Hive table can be used as a target classification table so that the first query statement carried by the IoT message query instruction can be used to query the target classification table to find IoT messages of any category.
[0099] To clearly illustrate how the IoT message query command in the above embodiments is used to retrieve the IoT messages required by the application layer through the target classification table, this application proposes another IoT message classification and processing method.
[0100] Figure 4 This is a flowchart illustrating the classification and processing method for IoT messages shown in the fourth embodiment of this application.
[0101] like Figure 4 As shown, the classification and processing method for this IoT message includes the following steps:
[0102] Step 401: In response to the IoT message query instruction from the application layer, the target classification table is invoked to determine the first structured data file mapped by the target classification table; wherein, the IoT message query instruction carries a first query statement from the application layer, the first query statement being used to indicate the first message type and the corresponding first fingerprint feature of the IoT message to be queried.
[0103] Step 402: Based on the first query statement, query the first structured data file through the target classification table to determine the target example IoT message that matches the first fingerprint feature under the first message type, and send the target example IoT message to the application layer for display.
[0104] It's important to understand that the aggregated category table stores sample IoT packets. This is to facilitate quick responses to IoT packet query commands. In practice, it can quickly retrieve the IoT packets required by the application layer from hundreds of millions of IoT packets. However, this query method cannot fully display multiple IoT packets under any category. If the application layer does not find the target sample IoT packet, it can continue to query.
[0105] For example, when an IoT system reports an error, in order to trace and troubleshoot the problem in the IoT messages, a target example IoT message is obtained. Because there are too few examples, the problematic IoT message is usually not displayed. Therefore, it is still possible to continue querying in the second structured data file.
[0106] Step 403: If a query instruction to continue is received from the application layer, a query is performed in the second structured data file mapped by the target classification table to obtain the target IoT message that matches the first fingerprint feature, and the target IoT message is sent to the application layer for display.
[0107] It is important to understand that retrieved target IoT messages can be used for a variety of applications. For example, the application layer may need to understand IoT messages of protocol version 4. Based on the first query statement carried by the IoT message query instruction, multiple IoT messages of protocol version 4 can be obtained through the target classification table. The obtained multiple IoT messages of protocol version 4 can then be used to create a protocol document, thereby gaining a detailed understanding of protocol version 4.
[0108] For example, during the software development process for IoT devices on the communication side, to avoid inconsistencies between protocol implementation and development, which could lead to errors in the server, device, and firmware hardware, the initial IoT messages generated through software development can be compared with classified IoT messages to check for any IoT messages in the initial IoT messages that are inconsistent with the protocol or protocol version. Assuming software development is performed under protocol version 4, the first query statement carried by the IoT message query instruction can be used to obtain multiple IoT messages belonging to protocol version 4 through the target classification table. These multiple IoT messages belonging to protocol version 4 are used as test cases and compared with the initial IoT messages developed under protocol version 4 to check for any IoT messages in the initial IoT messages that are inconsistent with protocol version 4.
[0109] In summary, in response to an IoT message query command from the application layer, a target classification table is invoked to determine the first structured data file mapped to the target classification table. The IoT message query command carries a first query statement from the application layer, indicating the first message type and corresponding first fingerprint feature of the IoT message to be queried. Based on the first query statement, a query is performed in the first structured data file using the target classification table to identify a target example IoT message matching the first fingerprint feature under the first message type, and this target example IoT message is sent to the application layer for display. If a further query command is received from the application layer, a query is performed in the second structured data file mapped to the target classification table to obtain a target IoT message matching the first fingerprint feature, and this target IoT message is sent to the application layer for display. Thus, by using the first query statement from the application layer carried by the IoT message query command, and through the target classification table, queries are performed step-by-step in both the first and second structured data files to meet the application layer's various detailed requirements for IoT messages. Consequently, various applications can be performed on IoT messages of different categories.
[0110] Figure 5 This is a schematic diagram of the structure of an IoT message classification and processing device provided in an embodiment of this application.
[0111] like Figure 5 As shown, the IoT message classification and processing device includes: a first acquisition module 501, a first obtaining module 502, a second obtaining module 503, and a classification processing module 504.
[0112] The first acquisition module 501 is used to acquire multiple IoT messages, wherein any IoT message includes JSON data in object representation, and the JSON data is used to indicate multiple key-value pairs and the structural relationship between the multiple key-value pairs;
[0113] The first obtaining module 502 is used to combine multiple key-value pairs according to structural relationships to obtain target information for any IoT message;
[0114] The second module 503 is used to perform hash processing on the target information of each IoT message to obtain the fingerprint features of each IoT message.
[0115] The classification processing module 504 is used to classify multiple IoT messages according to the fingerprint characteristics of each IoT message to obtain the category to which each IoT message belongs, wherein the category is used to indicate the protocol or protocol version to which it belongs.
[0116] In one embodiment of this application, the first obtaining module 502 is specifically used for:
[0117] For any IoT message, determine the parent-child relationship between multiple nodes in the JSON data based on the structural relationship, where nodes are used to indicate the corresponding key-value pairs;
[0118] Based on the parent-child relationship between multiple nodes, the keys and / or values in the key-value pairs indicated by multiple nodes are concatenated to obtain the identifier string;
[0119] Determine the target information based on the identifier string.
[0120] In one embodiment of this application, the first obtaining module 502 is specifically used for:
[0121] The output order of each node is determined based on the parent-child relationship;
[0122] For each node, the keys and / or values in the key-value pairs indicated by the node are concatenated in the output order to obtain the identifier string.
[0123] In one embodiment of this application, the classification processing module 504 is specifically used for:
[0124] Store each IoT message and its corresponding fingerprint feature in a data detail table;
[0125] Based on the fingerprint characteristics of each IoT message in the data details table, identify multiple IoT messages belonging to the same fingerprint characteristics.
[0126] Classify IoT messages based on the same fingerprint characteristics;
[0127] Generate an aggregated classification table based on the IoT messages under each category.
[0128] In one embodiment of this application, the classification processing module 504 is specifically used for:
[0129] Based on the type field of each IoT message in the data details table, determine the message type of each IoT message;
[0130] Multiple IoT messages are classified using message type as the first classification level to obtain IoT messages of the same message type.
[0131] For IoT messages of the same message type, fingerprint features are used as the second classification level to classify them, thereby obtaining IoT messages corresponding to each fingerprint feature of the same message type.
[0132] The category to which each IoT message belongs is determined based on the first classification level and the second classification level. Among them, there are differences in at least one of the message type and fingerprint characteristics between IoT messages of different categories, while IoT messages of the same category have the same message type and the fingerprint characteristics.
[0133] In one embodiment of this application, the classification processing module 504 is specifically used for:
[0134] For any category, based on the time order in which multiple IoT messages under the category are stored in the data details table, determine the last example IoT message in the time order;
[0135] The example IoT messages corresponding to each category, as well as the fingerprint features of the example IoT messages, are stored in an aggregated classification table; wherein, the aggregated classification table is used to query the corresponding example IoT message according to the fingerprint features indicated by the first query statement.
[0136] In one embodiment of this application, the device further includes a target classification table module, specifically used for:
[0137] The IoT messages and corresponding fingerprint features stored in the data details table are converted to obtain the first structured data file;
[0138] The example IoT messages under each category in the aggregated classification table are transformed to obtain a second structured data file;
[0139] The first structured data file and the second structured data file are mapped to the target classification table respectively; wherein, the target classification table is used to query IoT messages of any category in response to IoT message query commands from the application layer.
[0140] In one embodiment of this application, the target classification table module is specifically used for:
[0141] In response to the IoT message query command from the application layer, the target classification table is invoked to determine the first structured data file mapped by the target classification table; wherein, the IoT message query command carries a first query statement from the application layer, the first query statement is used to indicate the first message type and the corresponding first fingerprint feature of the IoT message to be queried;
[0142] Based on the first query statement, the target classification table is used to query the first structured data file to determine the target example IoT message that matches the first fingerprint feature under the first message type, and the target example IoT message is sent to the application layer for display.
[0143] If a query instruction to continue is received from the application layer, a query is performed in the second structured data file mapped by the target classification table to obtain the target IoT message that matches the first fingerprint feature, and the target IoT message is sent to the application layer for display.
[0144] It should be noted that the explanation of the above-described embodiment of the method for classifying and processing IoT messages also applies to the IoT message classification and processing device of this embodiment, and will not be repeated here.
[0145] The IoT message classification and processing apparatus provided in this application acquires multiple IoT messages, wherein each IoT message includes Object Notation (JSON) data, which indicates multiple key-value pairs and the structural relationships between them. For each IoT message, the apparatus combines the multiple key-value pairs according to the structural relationships to obtain target information. The target information of each IoT message is hashed to obtain the fingerprint features of each IoT message. Based on the fingerprint features of each IoT message, the multiple IoT messages are classified to determine the category to which each IoT message belongs. The category indicates the protocol or protocol version to which the message belongs. Thus, by using the structural relationships between multiple key-value pairs in each IoT message, multiple keys and / or values in the IoT message are concatenated and combined to determine the target information of the IoT message. Finally, a hash operation is performed on the IoT messages to obtain their respective identifiers. Fingerprint features, by analyzing massive amounts of IoT messages, can classify them to determine the protocol or version to which each message belongs. Pre-classifying IoT messages facilitates the retrieval of specific data from the large volume of messages generated by server-device interactions, saving time. It also allows for a deeper understanding of the similarities and differences between messages belonging to different protocols or versions. This not only enables the rapid identification of problematic IoT messages and their associated devices (or even physical hardware), but also allows for various applications based on message category, providing data support for subsequent optimization and upgrades of the IoT device communication layer.
[0146] In an exemplary embodiment, an electronic device is also proposed.
[0147] The electronic devices include:
[0148] processor;
[0149] Memory used to store processor-executable instructions;
[0150] The processor is configured to execute instructions to implement the IoT message classification and processing method proposed in any of the foregoing embodiments.
[0151] As an example, Figure 6 This is a schematic diagram of the structure of an electronic device 600 shown in an exemplary embodiment of this application, as follows: Figure 6 As shown, the aforementioned electronic device 600 may further include:
[0152] The system includes a memory 610 and a processor 620, and a bus 630 connecting different components (including the memory 610 and the processor 620). The memory 610 stores a computer program, which, when executed by the processor 620, implements the IoT message classification and processing method described in this application embodiment.
[0153] Bus 630 represents one or more of several bus architectures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of the various bus architectures. Examples of these architectures include, but are not limited to, the Industry Standard Architecture (ISA) bus, the Micro Channel Architecture (MAC) bus, the Enhanced ISA bus, the Video Electronics Standards Association (VESA) local bus, and the Peripheral Component Interconnect (PCI) bus.
[0154] Electronic device 600 typically includes a variety of electronic device readable media. These media can be any available media that can be accessed by electronic device 600, including volatile and non-volatile media, removable and non-removable media.
[0155] Memory 610 may also include computer system readable media in the form of volatile memory, such as random access memory (RAM) 640 and / or cache memory 650. Server 600 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 660 may be used to read and write non-removable, non-volatile magnetic media (… Figure 6 Not shown; usually referred to as a "hard drive package"). Although Figure 6 As not shown, disk drive packages for reading and writing to removable non-volatile disks (e.g., "floppy disks") and optical disk drive packages for reading and writing to removable non-volatile optical discs (e.g., CD-ROMs, DVD-ROMs, or other optical media) may be provided. In these cases, each drive package may be connected to bus 630 via one or more data media interfaces. Memory 610 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of this application.
[0156] A program / utility 680 having a set (at least one) of program modules 670 may be stored, for example, in memory 610. Such program modules 670 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Program modules 670 typically perform the functions and / or methods described in the embodiments of this application.
[0157] Electronic device 600 can also communicate with one or more external devices 660 (e.g., keyboard, pointing device, display 691, etc.), and with one or more devices that enable a user to interact with electronic device 600, and / or with any device that enables electronic device 600 to communicate with one or more other computing devices (e.g., network card, modem, etc.). This communication can be performed via input / output (I / O) interface 692. Furthermore, electronic device 600 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 693. As shown, network adapter 693 communicates with other modules of electronic device 600 via bus 630. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 600, including but not limited to: microcode, device driver packages, redundant processing units, external disk drive package arrays, RAID systems, tape drive packages, and data backup storage systems.
[0158] The processor 620 executes various functional applications and data processing by running programs stored in the memory 610.
[0159] It should be noted that the implementation process and technical principles of the electronic device in this embodiment are explained in the foregoing description of the classification and processing method of IoT messages in the embodiments of this application, and will not be repeated here.
[0160] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory including instructions, which can be executed by a processor of an electronic device to complete the classification and processing method for IoT messages proposed in any of the above embodiments. Optionally, the computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.
[0161] In an exemplary embodiment, a computer program product is also provided, including a computer program / instructions, characterized in that, when the computer program / instructions are executed by a processor, they implement the IoT message classification and processing method proposed in any of the above embodiments.
[0162] The collection, storage, access, processing, transmission, provision, and application of user personal information involved in this application all comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0163] It should be noted that personal information collected from users should be used for legitimate and reasonable purposes and should not be shared or sold outside of these legitimate accesses. Furthermore, such collection / sharing should only be conducted after receiving the user's informed consent, including but not limited to notifying the user to read the user agreement / user notice and sign an agreement / authorization that includes authorization of relevant user information before the user accesses the function. In addition, any necessary steps must be taken to protect and safeguard access to such personal information data and ensure that others authorized to access personal information data comply with their privacy policies and procedures.
[0164] This application is intended to provide an implementation scheme for users to selectively block access to or access to personal information data. Specifically, this application is intended to provide hardware and / or software to prevent or block access to such personal information data. Once personal information data is no longer needed, risks can be minimized by restricting data collection and deleting data. Furthermore, where applicable, such personal information is de-identified to protect user privacy.
[0165] In the foregoing descriptions of the embodiments, the terms "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.
[0166] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "multiple" means at least two, such as two, three, etc., unless otherwise explicitly specified.
[0167] Any process or method description in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing custom logic functions or processes, and the scope of the preferred embodiments of this application includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as should be understood by those skilled in the art to which embodiments of this application pertain.
[0168] Those skilled in the art will understand that all or part of the steps of the methods in the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, the program includes one or a combination of the steps of the method embodiments.
[0169] Furthermore, the functional units in the various embodiments of this application can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or accessed as an independent product, it can also be stored in a computer-readable storage medium.
[0170] The storage medium mentioned above can be a read-only memory, a disk, or an optical disk, etc. Although embodiments of this application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting this application. Those skilled in the art can make changes, modifications, substitutions, and variations to the above embodiments within the scope of this application.
Claims
1. A method for classifying and processing Internet of Things (IoT) messages, characterized in that, include: Obtain multiple IoT messages, wherein any one of the IoT messages includes JSON data in Object Notation, the JSON data being used to indicate multiple key-value pairs and the structural relationship between the multiple key-value pairs; For any of the IoT messages, the target information is obtained by combining the multiple key-value pairs according to the structural relationship; The target information of each IoT message is hashed to obtain the fingerprint features of each IoT message; Based on the fingerprint characteristics of each IoT message, the multiple IoT messages are classified to obtain the category to which each IoT message belongs, wherein the category is used to indicate the protocol or protocol version to which it belongs.
2. The method according to claim 1, characterized in that, The step of combining the multiple key-value pairs according to the structural relationship to obtain target information for any of the IoT messages includes: For any of the IoT messages, the parent-child relationship between multiple nodes of the JSON data is determined according to the structural relationship, wherein the nodes are used to indicate the corresponding key-value pairs; Based on the parent-child relationship between the multiple nodes, the keys and / or values in the key-value pairs indicated by the multiple nodes are concatenated to obtain the identifier string; The target information is determined based on the identifier string.
3. The method according to claim 2, characterized in that, The step of concatenating the keys and / or values in the key-value pairs indicated by the multiple nodes based on the parent-child relationships between the multiple nodes to obtain an identifier string includes: Based on the parent-child relationship, the output order of each node is determined; For each node, the key and / or value in the key-value pair indicated by the node are concatenated according to the output order to obtain the identifier string.
4. The method according to claim 1, characterized in that, The step of classifying the multiple IoT messages based on their fingerprint characteristics includes: Each IoT message and its corresponding fingerprint feature are stored in a data detail table; Based on the fingerprint features of each IoT message in the data details table, multiple IoT messages belonging to the same fingerprint feature are identified. Classify the IoT messages based on the same fingerprint feature; Generate an aggregated classification table based on the IoT messages under each category.
5. The method according to claim 4, characterized in that, The classification based on multiple IoT messages belonging to the same fingerprint feature includes: The message type of each IoT message is determined based on the type field of each IoT message in the data details table; The message type is used as the first classification level to classify multiple IoT messages to obtain IoT messages under the same message type; For IoT messages of the same message type, the fingerprint features are classified as a second classification level to obtain IoT messages corresponding to each fingerprint feature of the same message type. The category to which each IoT message belongs is determined based on the first classification level and the second classification level, wherein at least one of the message type and the fingerprint feature differs between IoT messages of different categories, and IoT messages of the same category have the same message type and the fingerprint feature.
6. The method according to claim 4, characterized in that, The process of generating an aggregated classification table based on IoT messages under each category includes: For any category, based on the time order in which multiple IoT messages under the category are stored in the data detail table, determine the last example IoT message in the time order; The example IoT messages corresponding to each category, and the fingerprint features of the example IoT messages, are stored in the aggregated classification table; wherein, the aggregated classification table is used to query the corresponding example IoT messages according to the fingerprint features indicated by the first query statement.
7. The method according to claim 6, characterized in that, After classifying the multiple IoT messages based on their fingerprint characteristics, the process includes: The IoT messages and corresponding fingerprint features stored in the data details table are converted to obtain a first structured data file; The example IoT messages under each category in the aggregated classification table are transformed to obtain a second structured data file; The first structured data file and the second structured data file are respectively mapped to a target classification table; wherein, the target classification table is used to query IoT messages of any category in response to IoT message query instructions from the application layer.
8. The method according to claim 7, characterized in that, The method includes: In response to an IoT message query instruction from the application layer, the target classification table is invoked to determine the first structured data file mapped by the target classification table; wherein, the IoT message query instruction carries a first query statement from the application layer, the first query statement being used to indicate the first message type and the corresponding first fingerprint feature of the IoT message to be queried; Based on the first query statement, the target classification table is used to query the first structured data file to determine the target example IoT message that matches the first fingerprint feature under the first message type, and the target example IoT message is sent to the application layer for display. If a query instruction to continue is received from the application layer, a query is performed in the second structured data file mapped by the target classification table to obtain a target IoT message that matches the first fingerprint feature, and the target IoT message is sent to the application layer for display.
9. A classification and processing device for Internet of Things (IoT) messages, characterized in that, include: The first acquisition module is used to acquire multiple IoT messages, wherein any of the IoT messages includes JSON data in Object Notation, and the JSON data is used to indicate multiple key-value pairs and the structural relationship between the multiple key-value pairs; The first obtaining module is used to combine the multiple key-value pairs according to the structural relationship to obtain target information for any of the IoT messages; The second obtaining module is used to perform hash processing on the target information of each IoT message to obtain the fingerprint features of each IoT message; The classification processing module is used to classify the multiple IoT messages according to the fingerprint characteristics of each IoT message to obtain the category to which each IoT message belongs, wherein the category is used to indicate the protocol or protocol version.