Multi-protocol equipment communication state machine monitoring system of Internet of Things acquisition platform
By introducing a multi-protocol device communication status machine monitoring system into the Internet of Things acquisition platform, the compatibility problem of the Internet of Things platform for different communication protocols is solved, accurate monitoring and alarm of device status is achieved, and the efficiency and reliability of remote management are improved.
Patent Information
- Application Number
- CN202510547960.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-28
- Publication Date
- 2025-07-08
AI Technical Summary
The Internet of Things platform is difficult to be compatible with multiple communication protocols, resulting in inaccurate monitoring of equipment status, lack of effective alarm mechanisms, and inability to detect communication quality problems in a timely manner.
Design a multi-protocol device communication state machine monitoring system for the Internet of Things acquisition platform, including a communication access module, an adapter module, a storage module and a monitoring module. The state machine adapter realizes the state perception and monitoring of equipment of different protocols, and configures the protocol state inference table for state conversion logic and monitoring.
It realizes the accuracy and reliability of device status monitoring of multiple communication protocols, supports rapid expansion of new protocols, provides full-process communication status traceability and alarm mechanism, and improves the remote management capabilities of IoT devices.
Smart Images

Figure CN120281796A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of Internet of Things technology and communication technology, and particularly to a multi-protocol device communication state machine monitoring system for an Internet of Things acquisition platform. Background Art
[0002] For an industrial Internet of Things platform (IoT, Internet of Things), especially for an Internet of Things acquisition platform in industries such as transportation, energy, and environment, it is often necessary to collect data through a variety of Internet of Things devices to achieve business operation or management. Therefore, the industrial Internet of Things platform also needs to remotely monitor and manage these Internet of Things devices with different communication protocols to clarify the working status of each Internet of Things device, so as to facilitate the adoption of appropriate remote scheduling or management measures. However, since these Internet of Things devices are usually produced by different manufacturers, have multiple models, and adopt different communication protocols and data message protocols, this brings a series of problems to the acquisition platform for supervising the device communication status and managing and scheduling the devices:
[0003] 1. Protocol compatibility: Different devices adopt different communication protocols (such as TCP / UDP, MQTT, HTTP, etc.), resulting in the need for the Internet of Things platform to support multiple protocols. Each communication protocol has its specific data format and parsing method, and the acquisition platform needs to write corresponding parsing codes for each protocol to correctly process data from different devices.
[0004] 2. Communication status perception differences: The Internet of Things platform needs to monitor the communication status of each device in real time (such as online, offline, message sending and receiving, etc.). However, due to the differences in device types and communication protocols, it is very difficult to achieve comprehensive status monitoring through a single interface or status perception method. For example, devices using the TCP protocol can use IO multiplexing mechanisms such as select, poll, and epoll to monitor abnormal events on the connection. When an abnormal event occurs (such as the read event of the socket is triggered but the result of reading data is 0), it can be determined that the connection has been disconnected. Since UDP is a connectionless protocol, UDP devices cannot use this method. It is necessary to judge from mechanisms such as timeout and heartbeat. MQTT devices need to design the judgment of the status from their own characteristics. For example, the last will and testament message mechanism, the subscription and publication mechanism, the session persistence mechanism, etc.
[0005] 3. Inaccurate status perception: For IoT devices with different communication protocols, due to the complex network environment and faults in the devices or service platforms themselves, it is possible that the device status received by the acquisition platform or the device communication status deduced by the acquisition platform through various mechanisms is inconsistent with the true status of the device. For example, for a device using the TCP protocol to connect to a server, in the network environment, there may be multiple devices such as gateways, routers, and switches. Due to the connection caching in these network devices, when the device disconnects, the server may not be able to perceive the true disconnected status. At this time, the problem that the acquisition platform shows the device as online while the instruction sending fails and the device messages cannot be received will occur.
[0006] 4. Weak monitoring and alarming capabilities: Most IoT systems have relatively weak monitoring capabilities for the communication status of devices. For stateful connections (such as TCP, MQTT), after the device status changes, the device status is modified and an alarm is issued. For devices using stateless connections (such as UDP / HTTP), there is a lack of a mechanism for status inference and they cannot be effectively monitored and alarmed. The monitoring of the device communication process (such as communication frequency, number of bytes, etc.) is even more lacking, and the communication quality cannot be effectively analyzed, so potential risks cannot be discovered in a timely manner.
[0007] These factors all lead to possible deviations in the monitoring of the communication status and quality of IoT devices by the IoT platform, which in turn has an adverse impact on the remote monitoring and management of IoT devices. Summary of the Invention
[0008] Aiming at the deficiencies existing in the prior art, the present invention provides a multi-protocol device communication state machine monitoring system for an IoT acquisition platform, which provides a monitoring mechanism that can be compatible with and implement the monitoring of communication state machines of various different communication protocols, and improves the accuracy of perceiving the communication status of IoT devices with different communication protocols.
[0009] To solve the above technical problems, the present invention adopts the following technical solutions:
[0010] A multi-protocol device communication state machine monitoring system for an IoT acquisition platform, including a communication access module, an adapter module, a storage module, and a monitoring module;
[0011] The communication access module is provided with a number of communication access points for accessing IoT devices of different protocol types;
[0012] In the adapter module, a state machine adapter is respectively linked and set for each communication access point, mapping the Internet of Things devices communicating through the communication access point to the corresponding state machine adapter; the state machine adapter is used to obtain the running data of the Internet of Things devices through the corresponding communication access point, sense and analyze the communication status of the Internet of Things devices based on the running data, and send the parsed communication status information and abnormal event information of the Internet of Things devices to the monitoring module;
[0013] In the storage module, an adaptation protocol database is configured for each state machine adapter. A protocol state inference table is set in the adaptation protocol database, and the state machine inference logic information of the Internet of Things devices of the corresponding protocol type is configured in the protocol state inference table;
[0014] The monitoring module is used to monitor and record the running data, communication status information and abnormal event information of the Internet of Things devices, and give an alarm for the abnormal events occurring to the Internet of Things devices.
[0015] As a preferred solution, the state machine inference logic information configured in the protocol state inference table includes state definition information, state transition logic information or / and state monitoring information, where:
[0016] The state definition information is used to indicate the different communication states existing in the running process of the Internet of Things devices, including the initial communication state after the Internet of Things devices are accessed;
[0017] The state transition logic information is used to indicate the state inference actions executed on the Internet of Things devices, the execution priorities of each state inference action, and the types of running data that need to be associated and monitored for different state inference actions, and also includes the state transition relationship between different communication states and their corresponding state transition trigger conditions;
[0018] The state monitoring information is used to indicate the data information that needs to be continuously monitored and uploaded to the monitoring module during the running process of the Internet of Things devices, and clarify the scope of abnormal events.
[0019] As a preferred solution, the state machine adapter includes an access layer, a state perception layer and an operation monitoring layer;
[0020] The access layer is used to establish communication interaction with the accessed Internet of Things devices;
[0021] The state perception layer is used to sense and analyze the communication status of the accessed Internet of Things devices according to the configured protocol state inference table, and obtain the communication status information and abnormal event information of the Internet of Things devices;
[0022] The operation monitoring layer is used to send the communication status information, abnormal event information of the Internet of Things devices obtained by parsing, and the data information that needs to be continuously monitored during the operation of the Internet of Things devices to the monitoring module.
[0023] As a preferred solution, the specific way for the state machine adapter to sense and parse the communication status of the Internet of Things devices includes:
[0024] Establish communication interaction with the connected Internet of Things devices through the access layer;
[0025] The state perception layer obtains the configured protocol state inference table and confirms the state machine inference logic information configured in the protocol state inference table;
[0026] The state perception layer executes the state inference action according to the execution priority indicated by the state machine inference logic information, obtains the operation data to be associated and monitored for the corresponding state inference action from the Internet of Things devices, and synchronously forwards the obtained operation data to the monitoring module through the operation monitoring layer;
[0027] When the state perception layer determines that the operation data reaches any state transition trigger condition, it updates the communication status of the Internet of Things devices according to the state transition relationship corresponding to the reached state transition trigger condition, and determines the existing abnormal events;
[0028] The operation monitoring layer continuously monitors the required state monitoring information after the Internet of Things devices are connected, and sends the communication status information, abnormal event information and continuously monitored data information of the Internet of Things devices to the monitoring module.
[0029] As a preferred solution, the Internet of Things devices include TCP protocol devices, and the communication access points in the communication access module include communication access points for TCP protocol devices;
[0030] In the state machine inference logic information configured in the protocol state inference table corresponding to the state machine adapter linked and set by the communication access point for TCP protocol devices:
[0031] The state definition information includes:
[0032] The device connection state information is used to indicate whether the TCP protocol device is in an online state or an offline state; the initial communication state after the TCP protocol device is connected is the online state;
[0033] The communication operation state information is used to indicate the communication operation state of the TCP protocol device in the online state, including normal communication state, communication timeout state, communication instability state or no communication state;
[0034] The state transition logic information includes:
[0035] The heartbeat mechanism refers to sending heartbeat packets to TCP protocol devices at a preset frequency and receiving heartbeat responses for status monitoring. If the heartbeat responses from the TCP protocol device are not received continuously for a1 times, the TCP protocol device is determined to be in a communication timeout state. If the heartbeat responses from the TCP protocol device are not received continuously for a2 times, the TCP protocol device is determined to be in an offline state. If the heartbeat response from the TCP protocol device is received again after the offline state, the TCP protocol device is determined to resume the online state. Here, a1 and a2 are both heartbeat response count thresholds preset for the TCP protocol, and a1 < a2.
[0036] The timeout mechanism refers to performing a timeout judgment on the data reception time interval of the data sent by the TCP protocol device. If the data reception time interval exceeds t1, the TCP protocol device is determined to be in a no-communication state. If the data reception time interval exceeds t2, the TCP protocol device is determined to be in an offline state. If the TCP protocol device is determined to be in a no-communication state multiple times in a row, but the trigger condition for determining the TCP protocol device to be in an offline state is not met, the TCP protocol device is determined to be in an unstable communication state. Here, t1 and t2 are both timeout thresholds preset for the TCP protocol, and t1 < t2.
[0037] I / O multiplexing monitoring refers to using the I / O multiplexing method to monitor the read and write events of the TCP protocol device-side socket. If the continuous monitoring of the read and write events is normal and the data length of the socket is not 0, it is determined that the TCP protocol device maintains a normal communication state in the online state. If an abnormal read and write event is monitored or the data length of the socket is 0, the TCP protocol device is determined to be in an offline state.
[0038] Among them, the execution priorities from first to last are I / O multiplexing monitoring, the timeout mechanism, and the heartbeat mechanism.
[0039] The status monitoring information includes:
[0040] Continuously monitor the online frequency, offline frequency, communication traffic, and abnormal events of the TCP protocol device. The abnormal events include other device connection states and communication operation state events except when the TCP protocol device is in the online state and the communication running state.
[0041] As a preferred solution, the Internet of Things device includes a UDP protocol device, and the communication access points in the communication access module include communication access points for the UDP protocol device.
[0042] In the state machine inference logic information configured in the protocol state inference table corresponding to the state machine adapter linked to the communication access point for the UDP protocol device:
[0043] The status definition information includes:
[0044] Device connection status information, which is used to indicate whether the UDP protocol device is in an online state or an offline state; when data from the UDP protocol device is received, the initial communication state is set to the online state;
[0045] Communication operation status information, which is used to indicate the communication operation status of the UDP protocol device in the online state, including normal communication status, communication timeout status, communication instability status, or no communication status;
[0046] The state transition logic information includes:
[0047] The heartbeat mechanism refers to sending heartbeat packets to the UDP protocol device at a preset frequency and receiving heartbeat responses for status monitoring; if the heartbeat response from the UDP protocol device is not received for a consecutive a3 times, it is determined that the UDP protocol device is in the offline state; if the heartbeat response from the UDP protocol device is received again after the offline state, it is determined that the UDP protocol device has resumed the online state; where a3 is the threshold of the number of heartbeat response times preset for the UDP protocol;
[0048] The timeout mechanism refers to performing a timeout judgment on the data reception time interval of the data sent by the UDP protocol device in the normal communication state; if the data reception time interval exceeds t3, it is determined that the UDP protocol device is in the communication timeout state; if the communication timeout state is determined a4 times within the duration of t4 but not consecutively, it is determined that the UDP protocol device is in the communication instability state; if the communication timeout state is determined a consecutive a4 times, it is determined that the UDP protocol device is in the no communication state; where a4 is the threshold of the number of timeout times preset for the UDP protocol, and both t3 and t4 are the timeout thresholds preset for the UDP protocol, and t3 < t4;
[0049] Receiving function monitoring refers to monitoring the data length of the recvfrom receiving function of the UDP protocol; if the data length of the recvfrom receiving function is not 0, it is determined that the UDP protocol device is in the normal communication state in the online state; if the data length of the recvfrom receiving function is 0, it is determined that the UDP protocol device is in the offline state;
[0050] I / O multiplexing monitoring refers to using the I / O multiplexing method to monitor the read and write events of the UDP protocol device - side socket; if the continuous monitoring of the read and write events is normal and the data length of the socket is not 0, it is determined that the UDP protocol device remains in the normal communication state in the online state; if an abnormal read and write event is monitored or the data length of the socket is 0, it is determined that the UDP protocol device is in the offline state;
[0051] Among them, the execution priorities from first to last are I / O multiplexing monitoring, receiving function monitoring, timeout mechanism, and heartbeat mechanism;
[0052] The status monitoring information includes:
[0053] Continuously monitor the online frequency, offline frequency, communication traffic, and abnormal events of UDP protocol devices; the abnormal events include other device connection status and communication operation status events except when the UDP protocol device is in the online state and communication operation state.
[0054] As a preferred solution, the Internet of Things device includes an MQTT protocol device, and the communication access points in the communication access module include communication access points for MQTT protocol devices;
[0055] In the state machine inference logic information configured in the protocol state inference table corresponding to the state machine adapter set for the communication access point of the MQTT protocol device:
[0056] The status definition information includes:
[0057] Device connection status information, which is used to indicate whether the MQTT protocol device is in the online state or the offline state; among them, the online state includes the connecting, connected, subscribed, and published states in the MQTT protocol; the offline state includes the unconnected, disconnected, and already-disconnected states in the MQTT protocol; the initial communication state after the MQTT protocol device is accessed is the online state;
[0058] Communication operation status information, which is used to indicate the communication operation state of the MQTT protocol device when it is in the online state, including the communication normal state, communication timeout state, communication instability state, or no communication state;
[0059] The state transition logic information includes:
[0060] Connection state inference refers to inferring the connection state of the MQTT protocol device based on the connection management type messages of the MQTT protocol device; if a connection request message of the MQTT protocol device is received, after establishing a communication connection with it, it is determined that the MQTT protocol device is in the online state; if a connection error message feedback by the MQTT protocol device is received during the establishment of the communication connection, it is determined that the MQTT protocol device is in the offline state; if a disconnection request message of the MQTT protocol device is received in the online state, the established communication connection with it is disconnected, and it is determined that the MQTT protocol device is in the offline state;
[0061] The heartbeat mechanism refers to monitoring the status of an MQTT protocol device by listening to its heartbeat keep-alive messages. If the heartbeat response messages of the MQTT protocol device are not received for a consecutive a5 times, the MQTT protocol device is determined to be in a communication timeout state. If the heartbeat response messages of the MQTT protocol device are not received for a consecutive a6 times, the MQTT protocol device is determined to be in an offline state. If the heartbeat response messages of the MQTT protocol device are received again after the offline state, the MQTT protocol device is determined to resume the online state. Among them, both a5 and a6 are the preset heartbeat response count thresholds for the TCP protocol, and a5 < a6;
[0062] The timeout mechanism refers to performing a timeout judgment by listening to the receiving time interval of message publishing messages or subscription messages of the MQTT protocol device. If the receiving time interval exceeds t5, the MQTT protocol device is determined to be in a non-communication state. If the receiving time interval exceeds t6, the MQTT protocol device is determined to be in an offline state. If the MQTT protocol device is determined to be in a non-communication state multiple times but does not meet the triggering condition for determining the MQTT protocol device to be in an offline state, the MQTT protocol device is determined to be in an unstable communication state. Among them, both t5 and t6 are the preset timeout thresholds for the MQTT protocol, and t5 < t6;
[0063] Among them, the execution priorities from first to last are connection status inference, timeout mechanism, and heartbeat mechanism;
[0064] The status monitoring information includes:
[0065] Continuously monitor the online frequency, offline frequency, communication traffic, and abnormal events of the MQTT protocol device; the abnormal events include other device connection status and communication operation status events except for the MQTT protocol device being in an online state and a communication running state.
[0066] As a preferred solution, the Internet of Things device includes an HTTP protocol device, and the communication access points in the communication access module include communication access points for the HTTP protocol device;
[0067] In the state machine inference logic information configured in the protocol state inference table corresponding to the state machine adapter set for the communication access point link of the communication access point for the HTTP protocol device:
[0068] The status definition information includes:
[0069] Device connection status information, which is used to indicate whether the HTTP protocol device is in an online state or an offline state; when a data request from the HTTP protocol device is received, the initial communication state is set to the online state;
[0070] Communication operation status information, which is used to indicate the communication operation status of HTTP protocol devices in the online state, including normal communication status, communication timeout status or communication instability status;
[0071] The status conversion logic information includes:
[0072] Connection status inference refers to inferring the connection status of an HTTP protocol device based on the request message type of the HTTP protocol device; if an online request message of the HTTP protocol device is received, it is determined that the HTTP protocol device is in the online state; if an offline request message of the HTTP protocol device is received, it is determined that the HTTP protocol device is in the offline state;
[0073] The heartbeat mechanism refers to sending heartbeat packets to the HTTP protocol device at a preset frequency and receiving heartbeat responses for status monitoring; if the heartbeat response of the HTTP protocol device is not received continuously for a7 times, it is determined that the HTTP protocol device is in the communication timeout state; if the heartbeat response of the HTTP protocol device is not received continuously for a8 times, it is determined that the HTTP protocol device is in the communication instability state; if the heartbeat response of the HTTP protocol device is received again after the communication instability state, it is determined that the HTTP protocol device resumes to the normal communication state; where a7 and a8 are both heartbeat response times thresholds preset for the HTTP protocol, and a7 < a8;
[0074] Among them, the execution priorities from first to last are connection status inference and heartbeat mechanism;
[0075] The status monitoring information includes:
[0076] Continuously monitor the online frequency, offline frequency, communication traffic and abnormal events of the HTTP protocol device; the abnormal events include other device connection status and communication operation status events except for the online state and communication operation status of the HTTP protocol device.
[0077] As a preferred solution, it further includes an external service module, which is used to externally provide query or message push services for the communication status information, abnormal events and / or alarm information of Internet of Things devices.
[0078] As a preferred solution, the query or message push services provided by the external service module include:
[0079] Provide query services for the communication status information, abnormal events and / or alarm information of Internet of Things devices through the API interface;
[0080] Push the communication status information, abnormal events and / or alarm information of Internet of Things devices through the synchronous idempotent interface;
[0081] Provide a subscription service for communicating the communication status information, abnormal events, and / or alarm information of Internet of Things devices externally through an asynchronous non-idempotent message queue.
[0082] Compared with the prior art, the present invention has the following beneficial effects:
[0083] 1. The multi-protocol device communication state machine monitoring system of the Internet of Things acquisition platform of the present invention realizes the monitoring mechanism of the communication state machines of multiple different communication protocols by means of the state machine adapters of different protocols. Each protocol's state machine adapter is configured with an adapter protocol database, enabling the state perception parsing operations executed by different state machine adapters to obtain different inferential logic data supports respectively. According to the characteristics of the corresponding communication protocol, the state quantity perception of Internet of Things devices is abstracted and simplified, and clear state conversion and inference logics are configured, thereby ensuring good accuracy and reliability for the state monitoring of Internet of Things devices of each different protocol type.
[0084] 2. In the multi-protocol device communication state machine monitoring system of the Internet of Things acquisition platform of the present invention, different state machine adapters in the adapter module adopt a modular design. Different protocol state inference tables are used for different communication protocols to support a state machine adapter to execute state perception parsing, and each protocol's state machine adapter is developed using the structure of "access layer - state perception layer - operation monitoring layer". Therefore, if new protocol expansion access is required, the writing of the protocol state inference table and the rapid development of the state machine adapter structure can be carried out according to this mode, which can be quickly accessed and does not interfere with the state machine adapters of other communication protocols. Therefore, it has good adaptation access ability and multi-protocol expansion ability.
[0085] 3. The multi-protocol device communication state machine monitoring system of the Internet of Things acquisition platform of the present invention ensures the presumption and monitoring of the communication state and communication quality of Internet of Things devices from connection to communication and then to disconnection, records the logs and alarm information in the monitoring module, and provides traceability for the whole process of Internet of Things device communication.
[0086] 4. The multi-protocol device communication state machine monitoring system of the Internet of Things acquisition platform of the present invention can also provide message query or push services for external third-party platforms or external terminal devices, and provides multiple query or configurable push methods, facilitating external third-party platforms or external terminal devices to select according to their own needs, and having good technical application flexibility. BRIEF DESCRIPTION OF THE DRAWINGS
[0087] In order to make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be described in preferred detail below in conjunction with the accompanying drawings, where:
[0088] Figure 1It is a schematic diagram of the architecture of an implementation of the multi - protocol device communication state machine monitoring system of the Internet of Things acquisition platform of the present invention.
[0089] Figure 2 It is a flow chart for the state machine adapter to perform communication status perception and analysis. Detailed implementation mode
[0090] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Usually, the components of the embodiments of the present invention described and illustrated herein can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without any creative work fall within the protection scope of the present invention.
[0091] The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without any creative work fall within the protection scope of the present invention.
[0092] To solve the problems of difficult remote monitoring of the communication status and quality of multi - protocol Internet of Things devices by the Internet of Things platform and insufficient monitoring accuracy, the present invention provides a multi - protocol device communication state machine monitoring system for the Internet of Things acquisition platform, providing a monitoring mechanism for communication state machines that can be compatible and implemented for multiple different communication protocols, and improving the accuracy of perceiving the communication status of Internet of Things devices with different communication protocols.
[0093] Figure 1 It shows a schematic diagram of the architecture of an implementation of the multi - protocol device communication state machine monitoring system of the Internet of Things acquisition platform of the present invention. As Figure 1As shown in the figure, the multi - protocol device communication state machine monitoring system of the Internet of Things acquisition platform of the present invention includes a communication access module, an adapter module, a storage module, and a monitoring module. In this system, the communication access module is provided with a number of communication access points for accessing Internet of Things devices of different protocol types; in the adapter module, a state machine adapter is respectively linked and set corresponding to each communication access point, mapping the Internet of Things devices that establish communication through the communication access point to the corresponding state machine adapter; the state machine adapter is used to obtain the operation data of the Internet of Things device through the corresponding communication access point, sense and analyze the communication state of the Internet of Things device based on the operation data, and send the parsed communication state information and abnormal event information of the Internet of Things device to the monitoring module; in the storage module, an adaptation protocol database is configured corresponding to each state machine adapter, and a protocol state inference table is set in the adaptation protocol database, and the protocol state inference table is configured with state machine inference logic information of Internet of Things devices of the corresponding protocol type; the monitoring module is used to monitor and record the operation data, communication state information, and abnormal event information of the Internet of Things device, and give an alarm for the abnormal events occurring to the Internet of Things device.
[0094] When it comes to specific application implementation, the multi - protocol device communication state machine monitoring system of the present invention can be developed using cross - platform development languages (such as Java, etc.) technology, enabling it to support single - machine or distributed deployment on devices of different platforms such as Windows or Linux. The protocol types of the specific Internet of Things (IoT) devices it targets can be different common protocol types such as TCP protocol, UDP protocol, MQTT protocol, HTTP protocol, etc. For IoT devices with different protocols, different state machine adapters in the adapter module can respectively perform state perception and inference parsing according to the corresponding adaptation protocol databases, and compatibly implement the monitoring mechanism for the communication state machines of multiple different communication protocols. Among them, each protocol's state machine adapter is configured with an adaptation protocol database. Therefore, each protocol database can correspond to one protocol; at the same time, there can be multiple items in the protocol state inference table in a protocol database, which can be used to respectively correspond to multiple devices under the same protocol. Each item in the protocol state inference table corresponds to the state machine inference logic information of one device. Therefore, different IoT devices of the same protocol type can also be separately configured with state machine inference logic; since the state perception and parsing operations performed by different state machine adapters can respectively obtain different inference logic data supports, abstract and simplify the perception of the state quantities of IoT devices according to the characteristics of the corresponding communication protocol, and configure clear state conversion and inference logics, thus ensuring that the state monitoring for each different protocol type of IoT devices can have good accuracy and reliability. In addition, since the multi - protocol device communication state machine monitoring system of the IoT acquisition platform of the present invention adopts the design idea of modular architecture and functional componentization, it is more convenient to adapt and access different types of IoT platforms, and it is also convenient to set and add state machine adapters for new protocols in the adapter module, having good multi - protocol expansion ability.
[0095] The following further elaborates on the main functional modules in the multi - protocol device communication state machine monitoring system of the IoT acquisition platform of the present invention.
[0096] I. Adapter Module and Storage Module
[0097] In the system of the present invention, since the adapter module and the storage module need to work together to perform state machine perception and parsing and are closely related, they are described together.
[0098] The system of the present invention needs to design state inference logic according to the respective protocol characteristics of various communication protocols (such as TCP protocol, UDP protocol, MQTT protocol, HTTP protocol, etc.). For example, after some devices (such as TCP protocol devices) establish a network connection, due to their own problems, the heartbeat may fail; or there is a heartbeat mechanism, but no useful data has been transmitted for a long time. Such Internet of Things devices are difficult to be discovered in the first place on traditional Internet of Things acquisition platforms. For another example, some UDP or HTTP protocol devices use a stateless communication protocol, and it is difficult for traditional Internet of Things acquisition platforms to define their online / offline status. These problems need to be perceived, identified, and accurately located through targeted state inference logic. To this end, the system of the present invention adopts a solution that cooperates an adaptation protocol database with a state machine adapter to jointly execute communication state perception and analysis.
[0099] Specifically, in the adapter module of the system, a state machine adapter is respectively linked to each communication access point corresponding to a different protocol type. At the same time, an adaptation protocol database is configured for each state machine adapter in the storage module. A protocol state inference table is set in the adaptation protocol database, and the table is configured with state machine inference logic information of Internet of Things devices of the corresponding protocol type to support the state machine adapter to perform communication state perception and analysis of this protocol type.
[0100] In specific application implementation, the state machine inference logic information configured in the protocol state inference table of the state machine adapter includes: state definition information, which is used to indicate different communication states existing during the operation of the Internet of Things device, including the initial communication state after the Internet of Things device is accessed; state transition logic information, which is used to indicate the state inference actions performed on the Internet of Things device, the execution priorities of each state inference action, and the types of operation data to be associated and monitored for different state inference actions, and also includes the state transition relationship between different communication states and their corresponding state transition trigger conditions; and / or, state monitoring information, which is used to indicate the data information that needs to be continuously monitored and uploaded to the monitoring module during the operation of the Internet of Things device, and defines the scope of abnormal events.
[0101] As Figure 1 shown, the architecture of the state machine adapter includes an access layer, a state perception layer, and an operation monitoring layer; among them, the access layer is used to establish communication interaction with the accessed Internet of Things devices; the state perception layer is used to perceive and analyze the communication state of the accessed Internet of Things devices according to the configured protocol state inference table to obtain the communication state information and abnormal event information of the Internet of Things devices; the operation monitoring layer is used to send the parsed communication state information, abnormal event information of the Internet of Things devices, and the data information that needs to be continuously monitored during the operation of the Internet of Things devices to the monitoring module.
[0102] The specific process of the state machine adapter perceiving and analyzing the communication state of IoT devices with the support of the configuration of the protocol state inference table is as follows Figure 2 as shown, including:
[0103] S1. Establish communication interaction with the accessed IoT devices through the access layer;
[0104] S2. The state perception layer obtains the configured protocol state inference table and confirms the state machine inference logic information configured in the protocol state inference table;
[0105] S3. The state perception layer performs state inference actions according to the execution priority indicated by the state machine inference logic information, obtains the operation data to be monitored associated with the corresponding state inference actions from the IoT devices, and synchronously forwards the obtained operation data to the monitoring module through the operation monitoring layer;
[0106] S4. When the state perception layer determines that the operation data reaches any state transition trigger condition, it updates the communication state of the IoT device according to the state transition relationship corresponding to the reached state transition trigger condition and determines the existing abnormal events;
[0107] S5. The operation monitoring layer continuously monitors the required state monitoring information after the IoT device is accessed, and sends the communication state information, abnormal event information, and continuously monitored data information of the IoT device to the monitoring module.
[0108] Through the above process, the state machine adapter, with the support of the configuration of the protocol state inference table in the adaptation protocol database, realizes the effective parsing and monitoring of the communication state of the corresponding protocol IoT devices. At the same time, it can also be seen that different state machine adapters in the adapter module adopt a modular design. Different protocol state inference tables are used for different communication protocols to support a state machine adapter to perform state perception and parsing. And the state machine adapters for each protocol are developed with the structure of "access layer - state perception layer - operation monitoring layer". Therefore, if new protocol expansion access is required, the protocol state inference table can be written and the state machine adapter structure can be quickly developed according to this mode, which can be quickly accessed and does not interfere with the state machine adapters of other communication protocols. Therefore, it has good adaptation access ability and multi-protocol expansion ability.
[0109] Specifically, for different IoT devices of TCP protocol, UDP protocol, MQTT protocol, and HTTP protocol, the state machine inference logic information configured in the protocol state inference table and the communication state perception and parsing actions of the state machine adapter will be different due to protocol differences. The following are detailed examples for illustration respectively.
[0110] 1.1. Communication state perception and parsing of TCP protocol devices
[0111] In the communication access module of the system, by setting the communication access points for TCP protocol devices, the TCP protocol devices establishing communication are mapped to the state machine adapters corresponding to the TCP protocol.
[0112] Correspondingly, in the storage module, a protocol state inference table corresponding to the state machine adapter for TCP protocol devices also needs to be configured. The state machine inference logic information configured in this protocol state inference table includes:
[0113] 1.1.1 State definition information:
[0114] Device connection state information: used to indicate whether the TCP protocol device is in an online state or an offline state; the initial communication state after the TCP protocol device is accessed is the online state.
[0115] Communication operation state information: used to indicate the communication operation state of the TCP protocol device in the online state, including normal communication state, communication timeout state, communication instability state, or no communication state.
[0116] The TCP protocol has state indication, and the state of the TCP protocol device can be determined by the state of the network connection.
[0117] 1.1.2 State transition logic information:
[0118] Heartbeat mechanism: It refers to sending heartbeat packets to the TCP protocol device at a preset frequency and receiving heartbeat responses for state monitoring; if the heartbeat responses of the TCP protocol device are not received continuously for a1 times, it is determined that the TCP protocol device is in a communication timeout state; if the heartbeat responses of the TCP protocol device are not received continuously for a2 times, it is determined that the TCP protocol device is in an offline state; if the heartbeat response of the TCP protocol device is received again after the offline state, it is determined that the TCP protocol device resumes to the online state; if the TCP protocol device is determined to be in a communication timeout state multiple times at intervals, but the triggering condition for determining the TCP protocol device to be in an offline state is not met, it is determined that the TCP protocol device is in a communication instability state; where a1 and a2 are both heartbeat response count thresholds preset for the TCP protocol, and a1 < a2.
[0119] Timeout mechanism: It refers to performing a timeout judgment on the data reception time interval of the data sent by the TCP protocol device; if the data reception time interval exceeds t1, it is determined that the TCP protocol device is in a no communication state; if the data reception time interval exceeds t2, it is determined that the TCP protocol device is in an offline state; where t1 and t2 are both timeout thresholds preset for the TCP protocol, and t1 < t2.
[0120] I / O multiplexing monitoring: It refers to using the I / O multiplexing method (such as using the select or epoll function) to monitor the read and write events of the TCP protocol device-side socket; if the continuous monitoring of read and write events is normal and the data length of the socket is not 0, it is determined that the TCP protocol device maintains the normal communication state in the online state; if an abnormal read and write event is monitored or the data length of the socket is 0, it is determined that the TCP protocol device is in the offline state.
[0121] Among them, the execution priorities from first to last are I / O multiplexing monitoring, timeout mechanism, and heartbeat mechanism.
[0122] 1.1.3 Status monitoring information:
[0123] Continuously monitor the online frequency, offline frequency, communication traffic, and abnormal events of the TCP protocol device. Among them, abnormal events include other device connection states and communication operation state events except when the TCP protocol device is in the online state and communication operation state. Of course, it can also include other abnormal events reported by the TCP protocol device.
[0124] With the support of the state machine inference logic information configured in the above protocol state inference table, after establishing communication interaction with the connected TCP protocol device, the state machine adapter of the TCP protocol performs state inference actions according to the execution priority indicated by the state machine inference logic information, and sends the obtained communication state information, abnormal event information, and continuously monitored data information to the monitoring module.
[0125] For example:
[0126] The state machine adapter first sets the initial communication state after the TCP protocol device is connected to the online state;
[0127] Subsequently, use the select or epoll function for I / O multiplexing monitoring. If it is determined that the TCP protocol device is in the offline state, update the communication state information to device offline and record it as an abnormal event;
[0128] When the I / O multiplexing monitoring does not trigger device offline, use the timeout mechanism to determine whether the device has disconnected; for example, if t1 is set to 10 minutes and t2 is set to 30 minutes in the timeout threshold, then, if the TCP protocol device has not reported new data for more than 10 minutes, it can be determined that the TCP protocol device is in a non-communication state and recorded as an abnormal event; if it has not reported new data for more than 30 minutes, it can be determined that the TCP protocol device is in the offline state and recorded as an abnormal event;
[0129] When the timeout mechanism fails to trigger the device to go offline, the heartbeat mechanism is used to determine whether the device has an abnormality. For example, if a1 is set to 2 times and a2 is set to 5 times in the heartbeat response count threshold, then for a TCP protocol device, if it fails to feedback a heartbeat response continuously for 2 times, the TCP protocol device is determined to be in a communication timeout state; if it fails to feedback a heartbeat response continuously for 5 times, the TCP protocol device is determined to be in an offline state; if a heartbeat response from the TCP protocol device is received again after the offline state, the TCP protocol device is determined to resume the online state; if the heartbeat response feedback by the TCP protocol device is intermittent, for example, the TCP protocol device is determined to be in a communication timeout state after multiple intervals, but does not meet the trigger condition for determining the TCP protocol device to be in an offline state (no continuous 5 times of failure to feedback a heartbeat response), the TCP protocol device is determined to be in a communication unstable state.
[0130] In specific application implementations, the values of the heartbeat response count thresholds a1 and a2 and the timeout thresholds t1 and t2 preset for the TCP protocol can be set according to the actual application requirements.
[0131] For some special TCP protocol devices that may not have a heartbeat mechanism set, the I / O multiplexing listening and timeout mechanism are used to monitor their communication status.
[0132] During the communication status monitoring process, continuously monitor the online / offline frequency of the TCP protocol device, calculate the network traffic and frequency through the upstream and downstream packets, and record them in real time for realizing the multi-dimensional monitoring and management of the TCP protocol device; then, send the monitored communication status information, as well as the statistically calculated online frequency, offline frequency, communication traffic, and abnormal events to the monitoring module, so that the monitoring module can record its implementation status for the TCP protocol device, generate corresponding device logs and service logs, and generate alarm information for the occurrence of abnormal events.
[0133] The state machine adapter design for the TCP protocol accurately maps the effective state characteristics of the TCP protocol through a two-layer state system of connection state and communication running state. Combining the joint state detection means of I / O multiplexing monitoring, heartbeat mechanism, and timeout mechanism ensures consistency with the behavior of the TCP protocol stack. Moreover, the gradient state monitoring logic with the priority order of I / O multiplexing monitoring, timeout mechanism, and heartbeat mechanism conforms to the network event-driven characteristics of the TCP protocol while avoiding excessive consumption of CPU resources (such as the occupation of CPU resources by the high-frequency heartbeat mechanism) or memory resources (such as the occupation of memory resources due to excessive accumulation of timeout queues) by a single mechanism, which helps reduce system resource consumption and better adapt to the state monitoring requirements of weak network and high-concurrency scenarios. In addition, during the state monitoring process, information in different dimensions such as online frequency, offline frequency, communication traffic, and abnormal events is comprehensively monitored, enabling the state monitoring information to be used to support subsequent correlation analysis of abnormal events between the TCP protocol layer and the application layer, and providing better data support for QoS optimization, root cause location of faults, etc.
[0134] 1.2. Communication State Perception and Analysis of UDP Protocol Devices
[0135] In the communication access module of the system, by setting communication access points for UDP protocol devices, the UDP protocol devices establishing communication are mapped to the corresponding state machine adapters of the UDP protocol.
[0136] Correspondingly, in the storage module, a protocol state inference table corresponding to the state machine adapter for UDP protocol devices also needs to be configured. The state machine inference logic information configured in this protocol state inference table includes:
[0137] 1.2.1 State Definition Information:
[0138] Device connection state information: Used to indicate whether the UDP protocol device is in an online state or an offline state; when data is received from the UDP protocol device, the initial communication state is set to the online state.
[0139] Communication running state information: Used to indicate the communication running state of the UDP protocol device in the online state, including normal communication state, communication timeout state, communication instability state, or no communication state.
[0140] The UDP protocol is a connectionless protocol, so there is no direct concept of establishing and disconnecting connections. It is necessary to judge whether the device is online or offline through logical inference. If data is received from the UDP protocol device, it can be judged that the device has been successfully accessed, and the initial communication state is set to the online state.
[0141] 1.2.2 State Transition Logic Information:
[0142] Heartbeat mechanism: It refers to sending heartbeat packets to UDP protocol devices at a preset frequency and receiving heartbeat responses for status monitoring. If the heartbeat responses from the UDP protocol device are not received continuously for a3 times, the UDP protocol device is determined to be in an offline state. If the heartbeat response from the UDP protocol device is received again after the offline state, the UDP protocol device is determined to resume the online state. Here, a3 is the threshold of the number of heartbeat response times preset for the UDP protocol. In UDP laundry communication, although there is no direct connection concept, the active state of the device can be judged by regularly sending and receiving heartbeat packets. The heartbeat mechanism needs to be implemented at the application layer because the UDP protocol itself does not provide any form of timeout or retransmission mechanism.
[0143] Timeout mechanism: It refers to judging the timeout of the data reception time interval of the data sent by the UDP protocol device in the normal communication state. If the data reception time interval exceeds t3, the UDP protocol device is determined to be in a communication timeout state. If the communication timeout state is determined a4 times within the duration of t4 but not continuously, the UDP protocol device is determined to be in an unstable communication state. If the communication timeout state is determined continuously a4 times, the UDP protocol device is determined to be in a no-communication state. Here, a4 is the threshold of the number of timeout times preset for the UDP protocol, and both t3 and t4 are the timeout thresholds preset for the UDP protocol, and t3 < t4. The timeout mechanism is set to prevent waiting indefinitely for the packets sent by the UDP protocol device.
[0144] Receiving function monitoring: It refers to monitoring the status of the data length of the recvfrom receiving function of the UDP protocol. If the data length of the recvfrom receiving function is not 0, the UDP protocol device is determined to be in a normal communication state in the online state. If the data length of the recvfrom receiving function is 0, the UDP protocol device is determined to be in an offline state. The recvfrom receiving function will return some information, such as the address and port number of the UDP protocol device, the length of the data, etc. If the data length returned by the recvfrom receiving function is 0, it means that no data is received, which may indicate that the UDP protocol device has been disconnected.
[0145] I / O multiplexing monitoring: It refers to monitoring the read and write events of the UDP protocol device-side socket in the way of I / O multiplexing (such as using the select or epoll function); if the continuous monitoring of read and write events is normal and the data length of the socket is not 0, it is determined that the UDP protocol device maintains the normal communication state in the online state; if the monitored read and write events are abnormal or the data length of the socket is 0, then it is determined that the UDP protocol device is in the offline state. Although UDP is a connectionless protocol, the I / O multiplexing monitoring mechanism can be used to monitor the readable state of the UDP protocol device segment socket. If the socket becomes readable but the length of the read data is 0, it means that the UDP protocol device has disconnected.
[0146] Among them, the execution priorities from first to last are I / O multiplexing monitoring, receiving function monitoring, timeout mechanism, and heartbeat mechanism.
[0147] 1.2.3 Status monitoring information:
[0148] Continuously monitor the online frequency, offline frequency, communication traffic, and abnormal events of the UDP protocol device; the abnormal events include other device connection states and communication operation state events except for the UDP protocol device being in the online state and communication running state. Of course, it can also include other abnormal events reported by the UDP protocol device.
[0149] With the support of the state machine inference logic information configured in the above protocol state inference table, after establishing communication interaction with the connected UDP protocol device, the state machine adapter of the UDP protocol performs state inference actions according to the execution priority indicated by the state machine inference logic information, and sends the obtained communication state information, abnormal event information, and continuously monitored data information to the monitoring module.
[0150] For example:
[0151] Once the UDP protocol device has data exchange with the system, it can be determined that the UDP protocol device has been successfully connected, and its initial communication state is set to the online state.
[0152] Subsequently, with the help of the I / O multiplexing monitoring and receiving function monitoring mechanisms, the connection state and communication operation state of the UDP protocol device are inferred. If it is determined that the UDP protocol device is in the offline state, the communication state information is updated to device offline and recorded as an abnormal event;
[0153] When the I / O multiplexing monitoring and receiving function monitoring do not trigger device offline, the timeout mechanism and heartbeat mechanism are used to judge the connection state and communication operation state of the device; if a communication timeout state, communication instability state, no communication state, or offline state occurs, the communication state information is updated and recorded as an abnormal event.
[0154] In specific application implementations, the values of the heartbeat response count threshold a3, timeout count threshold a4, and timeout thresholds t3 and t4 preset for the UDP protocol can all be set according to the requirements of the actual application situation.
[0155] During the communication status monitoring process, continuously monitor the online / offline frequency of UDP protocol devices, calculate the network traffic and frequency through the uplink and downlink packets, and record them in real time for realizing multi-dimensional monitoring and management of UDP protocol devices; then, send the monitored communication status information, as well as the statistically obtained online frequency, offline frequency, communication traffic, and abnormal events to the monitoring module, facilitating the monitoring module to record the implementation status of UDP protocol devices, generate corresponding device logs and service logs, and generate alarm information for abnormal events.
[0156] The design of the state machine adapter for the UDP protocol, through the coordination of the application layer heartbeat mechanism, timeout mechanism, receive function monitoring, and I / O multiplexing monitoring, constructs a virtual "connection state" based on the UDP connectionless feature, realizes the accurate inference of device state activity and state migration, and makes up for the defect that the UDP protocol has no built-in connection management; with the gradient state monitoring logic with the priority order of I / O multiplexing monitoring, receive function monitoring, timeout mechanism, and heartbeat mechanism, it avoids a single mechanism from excessively occupying CPU resources (such as the high-frequency heartbeat mechanism occupying CPU resources) or memory resources (such as excessive accumulation of timeout queues occupying memory resources), helps reduce system resource consumption, and can better adapt to the state monitoring requirements of weak network and high-concurrency scenarios; in addition, during the state monitoring process, different-dimensional information such as online frequency, offline frequency, communication traffic, and abnormal events is also comprehensively monitored, enabling the state monitoring information to define and expand abnormal types (such as ICMP port unreachable, packet truncation, etc.) in combination with UDP characteristics in the later stage, providing data support for quickly locating network problems such as firewall interception and MTU mismatch.
[0157] 1.3. Communication Status Perception and Analysis of MQTT Protocol Devices
[0158] In the communication access module of the system, set the communication access point for MQTT protocol devices to map the established communication MQTT protocol devices to the corresponding state machine adapter of the MQTT protocol.
[0159] Correspondingly, in the storage module, a protocol state inference table corresponding to the state machine adapter for MQTT protocol devices also needs to be configured. The state machine inference logic information configured in this protocol state inference table includes:
[0160] 1.3.1 State Definition Information:
[0161] Device connection status information: used to indicate whether an MQTT protocol device is in an online state or an offline state; among them, the online state includes the connecting, connected, subscribed, and publishing states in the MQTT protocol; the offline state includes the unconnected, disconnected, and already-disconnected states in the MQTT protocol; the initial communication state after the MQTT protocol device is accessed is the online state.
[0162] Communication operation status information: used to indicate the communication operation status of an MQTT protocol device in the online state, including normal communication state, communication timeout state, communication instability state, or no communication state.
[0163] The MQTT protocol is a lightweight instant messaging protocol based on the publish / subscribe paradigm. The protocol itself defines 7 connection states. This solution classifies and summarizes the 7 connection states, classifying the connecting, connected, subscribed, and publishing states as the online state, and classifying the unconnected, disconnecting, and already-disconnected states as the offline state.
[0164] 1.3.2 State transition logic information:
[0165] Connection state inference: refers to inferring the connection state of an MQTT protocol device based on the connection management type messages of the MQTT protocol device; if a connection request message (CONNECT message) of the MQTT protocol device is received, after establishing a communication connection with it, it is determined that the MQTT protocol device is in the online state; if a connection error message (ERR_CODE message) feedback by the MQTT protocol device is received during the establishment of the communication connection, it is determined that the MQTT protocol device is in the offline state; if a disconnection request message (DISCONNECT message) of the MQTT protocol device is received in the online state, the established communication connection with it is disconnected, and it is determined that the MQTT protocol device is in the offline state.
[0166] Heartbeat mechanism: refers to monitoring the status of an MQTT protocol device by listening to its heartbeat keep-alive type messages; the heartbeat keep-alive type messages include PINGREQ message (heartbeat request), PINGRESP message (heartbeat response); if the heartbeat response message of the MQTT protocol device is not received continuously for a5 times, it is determined that the MQTT protocol device is in the communication timeout state; if the heartbeat response message of the MQTT protocol device is not received continuously for a6 times, it is determined that the MQTT protocol device is in the offline state; if the heartbeat response message of the MQTT protocol device is received again after the offline state, it is determined that the MQTT protocol device resumes to the online state; if the MQTT protocol device is determined to be in the communication timeout state multiple times at intervals, but does not meet the trigger condition for determining that the MQTT protocol device is in the offline state, it is determined that the MQTT protocol device is in the communication instability state; among them, both a5 and a6 are the preset heartbeat response times thresholds for the TCP protocol, and a5 < a6.
[0167] Timeout mechanism: It refers to making a timeout judgment by listening to the receiving time interval of message publishing messages or subscription messages of MQTT protocol devices; Message publishing messages include PUBLISH messages (publishing messages), PUBACK messages (responses to publishing messages), PUBREC messages (the published message has been received), PUBREL messages (releasing the message source), and PUBCOMP messages (message processing completed); Subscription messages include SUBSCRIBE messages (subscribing to topics), SUBACK messages (responses to subscribing to topics), UNSUBSCRIBE messages (canceling subscriptions to topics), and UNSUBACK messages (responses to canceling subscriptions to topics); If the receiving time interval exceeds t5, it is determined that the MQTT protocol device is in a non-communication state; If the receiving time interval exceeds t6, it is determined that the MQTT protocol device is in an offline state; Among them, both t5 and t6 are preset timeout thresholds for the MQTT protocol, and t5 < t6.
[0168] Among them, the execution priorities from first to last are connection status inference, timeout mechanism, and heartbeat mechanism.
[0169] 1.3.3 Status monitoring information:
[0170] Continuously monitor the online frequency, offline frequency, communication traffic, and abnormal events of MQTT protocol devices; The abnormal events include other device connection status and communication operation status events except for the MQTT protocol device being in an online state and a communication running state. Of course, it can also include other abnormal events reported by the MQTT protocol device.
[0171] With the support of the state machine inference logic information configured in the above protocol status inference table, after establishing communication interaction with the connected MQTT protocol device, the state machine adapter of the MQTT protocol performs state inference actions according to the execution priority indicated by the state machine inference logic information, and sends the obtained communication status information, abnormal event information, and continuously monitored data information to the monitoring module.
[0172] For example:
[0173] The state machine adapter first infers the connection status of the MQTT protocol device based on the connection management messages of the MQTT protocol device. After receiving the connection request message (CONNECT message) of the MQTT protocol device and establishing a communication connection, it confirms that the MQTT protocol device is connected and sets it to the online state.
[0174] Subsequently, use the timeout mechanism to infer whether the MQTT protocol device has been disconnected; If it is determined that the MQTT protocol device is in a non-communication state or an offline state, update the communication status information and record it as an abnormal event.
[0175] When the timeout mechanism fails to trigger device offline, the heartbeat mechanism is used to determine whether the device is abnormal; if a communication timeout state, an unstable communication state, or an offline state occurs, the communication status information is updated and recorded as an abnormal event.
[0176] In specific application implementations, the values of the preset heartbeat response count thresholds a5 and a6 and the timeout thresholds t5 and t6 for the MQTT protocol can be set according to the actual application requirements.
[0177] During the communication status monitoring process, continuously monitor the online / offline frequency of MQTT protocol devices, calculate the network traffic and frequency through the uplink and downlink packets, and record them in real time for multi-dimensional monitoring and management of MQTT protocol devices; then, send the monitored communication status information, the statistically calculated online frequency, offline frequency, communication traffic, and abnormal events to the monitoring module, facilitating the monitoring module to record the implementation status of MQTT protocol devices, generate corresponding device logs and service logs, and generate alarm information for abnormal events.
[0178] The state machine adapter design for the MQTT protocol realizes state synchronization inference by directly parsing MQTT protocol packets, aligns the 7 connection states of MQTT, and reuses the built-in heartbeat mechanism of the protocol to reduce additional overhead, constructing a zero-loss state mapping from the MQTT protocol layer to the system layer; establishing a state monitoring logic with connection state inference, timeout mechanism, and heartbeat mechanism in order of priority, mainly using passive listening of protocol packets, helps to reduce the state detection delay, and at the same time covers the state monitoring requirements of abnormal scenarios such as network jitter and device freezing; in addition, during the state monitoring process, different dimensions of information such as online frequency, offline frequency, communication traffic, and abnormal events are also comprehensively monitored, enabling the state monitoring information to define and extend abnormal types (such as QoS mismatch, will message trigger, etc.) in combination with MQTT characteristics in the later stage, providing data support for quickly locating problems such as network partitions and Broker failures.
[0179] 1.4. Communication Status Perception and Analysis of HTTP Protocol Devices
[0180] In the communication access module of the system, set the communication access point for HTTP protocol devices to map the established communication HTTP protocol devices to the state machine adapter corresponding to the HTTP protocol.
[0181] Correspondingly, the protocol state inference table corresponding to the state machine adapter for HTTP protocol devices also needs to be configured in the storage module. The state machine inference logic information configured in this protocol state inference table includes:
[0182] 1.4.1 State Definition Information:
[0183] Device connection status information: used to indicate whether the HTTP protocol device is in an online state or an offline state; when a data request is received from the HTTP protocol device, the initial communication state is set to the online state.
[0184] Communication operation status information: used to indicate the communication operation status of the HTTP protocol device in the online state, including normal communication state, communication timeout state, or communication instability state.
[0185] The HTTP protocol is also a stateless protocol. It is sent by the HTTP protocol device client, and the Internet of Things platform server responds and returns. Therefore, the HTTP protocol also does not have a direct method to judge online or offline, and it is necessary to infer the connection status of the HTTP protocol device through the HTTP request and its carried parameters.
[0186] 1.4.2 State transition logic information:
[0187] Connection status inference: refers to inferring the connection status of the HTTP protocol device according to the request message type of the HTTP protocol device; if an online request message from the HTTP protocol device is received, it is determined that the HTTP protocol device is in the online state; if an offline request message from the HTTP protocol device is received, it is determined that the HTTP protocol device is in the offline state. In the application layer of the HTTP protocol, a custom protocol can be implemented to represent the online or offline state of the device through specific message types. Therefore, it is possible to define that the HTTP protocol device sends an online request message when starting up, and sends an offline request message when disconnecting or shutting down.
[0188] Heartbeat mechanism: refers to sending heartbeat packets to the HTTP protocol device at a preset frequency and receiving heartbeat responses for status monitoring; if the heartbeat response from the HTTP protocol device is not received continuously for a7 times, it is determined that the HTTP protocol device is in the communication timeout state; if the heartbeat response from the HTTP protocol device is not received continuously for a8 times, it is determined that the HTTP protocol device is in the communication instability state; if the heartbeat response from the HTTP protocol device is received again after the communication instability state, it is determined that the HTTP protocol device resumes to the normal communication state; where a7 and a8 are both heartbeat response count thresholds preset for the HTTP protocol, and a7 < a8.
[0189] Among them, the execution priorities are connection status inference and heartbeat mechanism in the order from first to last.
[0190] 1.4.3 State monitoring information:
[0191] Continuously monitor the online frequency, offline frequency, communication traffic, and abnormal events of HTTP protocol devices; the abnormal events include other device connection status and communication operation status events except when the HTTP protocol device is in an online state and a communication running state. Of course, it can also include other abnormal events returned during the HTTP protocol device's call to the HTTP interface and data interaction.
[0192] With the support of the state machine inference logic information configured in the above protocol status inference table, after establishing communication interaction with the accessed HTTP protocol device, the state machine adapter of the HTTP protocol performs state inference actions according to the execution priority indicated by the state machine inference logic information, and sends the obtained communication status information, abnormal event information, and continuously monitored data information to the monitoring module.
[0193] For example:
[0194] The state machine adapter first infers the connection status of the HTTP protocol device according to the request message type of the HTTP protocol device. If it receives an online request message from the HTTP protocol device, it confirms that the HTTP protocol device is accessed and sets it to the online state;
[0195] Subsequently, it uses the heartbeat mechanism to determine whether the device is abnormal; if a communication timeout state or an unstable communication state occurs, it updates the communication status information and records it as an abnormal event;
[0196] If it receives an offline request message from the HTTP protocol device, it determines that the HTTP protocol device is in the offline state, updates the communication status information, and records it as an abnormal event.
[0197] In specific application implementations, the values of the preset heartbeat response count thresholds a7 and a8 for the HTTP protocol can be set according to the actual application requirements.
[0198] During the communication status monitoring process, continuously monitor the online / offline frequency of the HTTP protocol device, calculate the network traffic and frequency of HTTP interface calls and data returns, and record them in real time for realizing multi-dimensional monitoring and management of the HTTP protocol device; then, send the monitored communication status information, as well as the statistically calculated online frequency, offline frequency, communication traffic, and abnormal events to the monitoring module, so that the monitoring module can record the implementation status of the HTTP protocol device, generate corresponding device logs and service logs, and generate alarm information for abnormal events.
[0199] The state machine adapter design for the HTTP protocol, in response to the stateless and connectionless protocol characteristics of HTTP, constructs a virtual connection state through custom online and offline requests and an application layer heartbeat mechanism to achieve lightweight state communication; combines connection state inference and the heartbeat mechanism for a state monitoring logic with priority order, mainly by passive listening to HTTP requests, which helps reduce server resource consumption, reduce state detection latency, and can cover the state monitoring requirements of passive offline scenarios such as network interruption and device downtime; in addition, during the state monitoring process, the online frequency, offline frequency, communication traffic, and abnormal events are also comprehensively monitored, enabling the state monitoring information to define and extend abnormal types (such as error codes, request body truncation, etc.) in combination with HTTP characteristics in the later stage, providing data support for quickly locating problems such as DNS resolution failure and load balancing failure.
[0200] II. Monitoring Module
[0201] The monitoring module is used to monitor, record, and alarm the operation data, communication status information, and abnormal event information of IoT devices. In specific application implementations, the monitoring module can be designed to perform the following monitoring service functions.
[0202] 2.1. Real-time State Monitoring:
[0203] Through the monitoring dashboard and device details list, real-time display status information such as the connection status (online or offline status) and communication operation status (normal communication status, communication timeout status, communication instability status, or no communication status) of the devices.
[0204] 2.2. Device Logs:
[0205] A. Provide query and display of information such as the status change situation, time point of status change, and trigger reason for status conversion of each IoT device;
[0206] B. Provide query and display of abnormal event information generated by IoT devices during connection and communication.
[0207] 2.3. Alarm Information:
[0208] A. Timely alarm IoT devices with abnormal communication status events (communication timeout status, communication instability status, or no communication status);
[0209] B. Alarm IoT devices that are offline or have not come online for more than a certain period of time;
[0210] C. Timely alarm IoT devices whose communication traffic reaches the threshold.
[0211] 2.4. Service Logs:
[0212] A. Status query HTTP / HTTPS API interface call logs.
[0213] B. Synchronous idempotent HTTP / HTTPS interface push logs, as well as interface return record logs and retry record logs.
[0214] C. Asynchronous non-idempotent message queue push logs.
[0215] With the monitoring service function provided by the monitoring module, it is possible to achieve full-state traceability of IoT devices. Each state machine adapter connected to IoT devices of each communication protocol has a design of an operation monitoring layer, which ensures the presumption and monitoring of the communication status and communication quality of IoT devices from connection to communication to disconnection, and the logs and alarm information are recorded in the monitoring module, and data interfaces for querying or pushing are provided. Therefore, the entire process of IoT device communication can be traced through the monitoring module.
[0216] III. External service module
[0217] In order to give fuller play to the open services of the multi-protocol device communication state machine monitoring system to external third-party platforms or external terminal devices, as Figure 1 shown, in the multi-protocol device communication state machine monitoring system of the IoT acquisition platform of the present invention, an external service module can also be set up. This external service module is used to provide external query or message push services for the communication status information, abnormal events, and / or alarm information of IoT devices.
[0218] In specific application implementations, multiple query or configurable push methods can be provided to facilitate external third-party platforms or external terminal devices to select according to their own needs. Specifically, it includes:
[0219] 3.1. Status query HTTP / HTTPS API
[0220] Provide query services for the communication status information, abnormal events, and / or alarm information of IoT devices through the HTTP / HTTPS API interface.
[0221] In specific implementations, a Restful-style API can be provided for third-party queries. It is possible to query the real-time status, logs, alarm information, etc. of single or batch devices.
[0222] 3.2. Synchronous idempotent HTTP / HTTPS interface push
[0223] Push the communication status information, abnormal events, and / or alarm information of IoT devices externally through the synchronous idempotent HTTP / HTTPS interface.
[0224] The specific application method is: the multi-protocol device communication state machine monitoring system calls the HTTP / HTTPS interface of the third-party system to push the communication status information, abnormal events and / or alarm information of the IoT device to the outside world; after the external third-party platform or device receives the push information through the interface, it returns the processing result to ensure that both parties achieve idempotent results; if the third-party system interface fails to be called successfully, or the third-party system interface returns an incorrect result, the multi-protocol device communication state machine monitoring system can retry the operation according to certain rules, such as retrying every 5 / 20 / 60 minutes, to ensure that the various states of the device can be unified as much as possible.
[0225] 3.3. Asynchronous non-idempotent message queue push
[0226] The subscription service for the communication status information, abnormal events and / or alarm information of IoT devices is provided to the outside world through asynchronous non-idempotent message queues.
[0227] When the uniqueness of the IoT device status is not a necessary requirement for the third-party platform or device, a subscription service for the communication status information, abnormal events and / or alarm information of the IoT device can be provided through the message queue. The multi-protocol device communication state machine monitoring system acts as the message publisher, and the third-party platform or device acts as the message subscriber, obtaining information through the subscription service.
[0228] In summary, the multi-protocol device communication state machine monitoring system of the Internet of Things acquisition platform of the present invention realizes the communication state machine monitoring mechanism for multiple different communication protocols by means of the compatibility of state machine adapters of different protocols. The state machine adapter of each protocol is configured with an adaptation protocol database, so that the state perception and parsing operations performed by different state machine adapters can be supported by different inference logic data respectively, and the state quantity perception of the devices of the Internet of Things is abstracted and simplified according to the characteristics of the corresponding communication protocol, and clear state conversion and reasoning logic are configured, so as to ensure that the state monitoring of the Internet of Things devices of each different protocol type can have good accuracy and reliability; the different state machine adapters in the adapter module adopt a modular design, the expansion of new protocols can be quickly developed and accessed, and do not interfere with the state machine adapters of other communication protocols, and have good adaptation access capabilities and multi-protocol expansion capabilities; and, it ensures the whole process tracing of the communication state and communication quality of the Internet of Things device from connection to communication to disconnection, and can also provide a variety of message query or push services to external third-party platforms or external terminal devices, with good information tracing capabilities and technical application flexibility.
[0229] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit them. Those of ordinary skill in the art should understand that any modifications or equivalent replacements made to the technical solutions of the present invention without departing from the spirit and scope of the present technical solutions shall be covered by the scope of the claims of the present invention.
Claims
1. A multi-protocol device communication state machine monitoring system for an Internet of Things acquisition platform, characterized in that, It includes a communication access module, an adapter module, a storage module and a monitoring module; The communication access module is provided with a number of communication access points for accessing Internet of Things devices of different protocol types; In the adapter module, a state machine adapter is respectively linked and set corresponding to each communication access point, mapping the Internet of Things devices communicating through the communication access point to the corresponding state machine adapter; the state machine adapter is used to obtain the operation data of the Internet of Things devices through the corresponding communication access point, sense and analyze the communication state of the Internet of Things devices based on the operation data, and send the parsed communication state information and abnormal event information of the Internet of Things devices to the monitoring module; In the storage module, an adaptation protocol database is configured corresponding to each state machine adapter, a protocol state inference table is set in the adaptation protocol database, and state machine inference logic information of Internet of Things devices of corresponding protocol types is configured in the protocol state inference table; The monitoring module is used to monitor and record the operation data, communication state information and abnormal event information of the Internet of Things devices, and give an alarm for the abnormal events occurring to the Internet of Things devices.
2. The multi-protocol device communication state machine monitoring system of the Internet of Things acquisition platform according to claim 1, wherein The state machine inference logic information configured in the protocol state inference table includes state definition information, state transition logic information or / and state monitoring information, where: The state definition information is used to indicate different communication states existing in the operation process of the Internet of Things devices, including the initial communication state after the Internet of Things devices are accessed; The state transition logic information is used to indicate the state inference actions performed on the Internet of Things devices, the execution priorities of each state inference action, and the types of operation data that need to be associated and monitored for different state inference actions, and also includes the state transition relationship between different communication states and their corresponding state transition trigger conditions; The state monitoring information is used to indicate the data information that needs to be continuously monitored and uploaded to the monitoring module during the operation of the Internet of Things devices, and clarify the scope of abnormal events.
3. The multi-protocol device communication state machine monitoring system of the Internet of Things acquisition platform according to claim 2, wherein, The state machine adapter includes an access layer, a state perception layer and an operation monitoring layer; The access layer is used to establish communication interaction with the accessed Internet of Things devices; The state perception layer is used to sense and analyze the communication state of the accessed Internet of Things devices according to the configured protocol state inference table to obtain the communication state information and abnormal event information of the Internet of Things devices; The operation monitoring layer is used to send the parsed communication state information, abnormal event information of the Internet of Things devices and the data information that needs to be continuously monitored during the operation of the Internet of Things devices to the monitoring module.
4. The multi-protocol device communication state machine monitoring system of the Internet of Things acquisition platform according to claim 3, characterized in that, The specific way for the state machine adapter to sense and analyze the communication state of the Internet of Things devices includes: Establish communication interaction with the accessed Internet of Things devices through the access layer; The state perception layer obtains the configured protocol state inference table and confirms the state machine inference logic information configured in the protocol state inference table; The state perception layer executes the state inference actions according to the execution priorities indicated by the state machine inference logic information, obtains the operation data that needs to be associated and monitored for the corresponding state inference actions from the Internet of Things devices, and synchronously forwards the obtained operation data to the monitoring module through the operation monitoring layer; When the status perception layer determines that the operation data reaches any status transition trigger condition, it updates the communication status of the IoT device according to the status transition relationship corresponding to the reached status transition trigger condition, and determines the existing abnormal events; After the IoT device is connected, the operation monitoring layer continuously monitors the required status monitoring information, and sends the communication status information, abnormal event information, and continuously monitored data information of the IoT device to the monitoring module.
5. The multi-protocol device communication state machine monitoring system of the Internet of Things acquisition platform according to claim 2, characterized in that, The IoT device includes; In the state machine inference logic information configured in the protocol state inference table corresponding to the state machine adapter for the communication access point link setting of the TCP protocol device: The status definition information includes: The device connection status information is used to indicate whether the TCP protocol device is in an online state or an offline state; the initial communication state after the TCP protocol device is connected is the online state; The communication operation status information is used to indicate the communication operation status of the TCP protocol device in the online state, including the communication normal state, the communication timeout state, the communication unstable state, or the no communication state; The status transition logic information includes: The heartbeat mechanism refers to sending heartbeat packets to the TCP protocol device at a preset frequency and receiving heartbeat responses for status monitoring; if the heartbeat responses of the TCP protocol device are not received continuously for a1 times, it is determined that the TCP protocol device is in the communication timeout state; if the heartbeat responses of the TCP protocol device are not received continuously for a2 times, it is determined that the TCP protocol device is in the offline state; if the heartbeat response of the TCP protocol device is received again after the offline state, it is determined that the TCP protocol device resumes to the online state; if the TCP protocol device is determined to be in the communication timeout state multiple times at intervals, but the trigger condition for determining the TCP protocol device to be in the offline state is not met, it is determined that the TCP protocol device is in the communication unstable state; where a1 and a2 are both heartbeat response count thresholds preset for the TCP protocol, and a1 < a2; The timeout mechanism refers to performing a timeout judgment on the data reception time interval of the data sent by the TCP protocol device; if the data reception time interval exceeds t1, it is determined that the TCP protocol device is in the no communication state; if the data reception time interval exceeds t2, it is determined that the TCP protocol device is in the offline state; where t1 and t2 are both timeout thresholds preset for the TCP protocol, and t1 < t2; I / O multiplexing listening refers to using the I / O multiplexing method to listen to the read and write events of the TCP protocol device side socket; if the continuous listening of the read and write events is normal and the data length of the socket is not 0, it is determined that the TCP protocol device remains in the communication normal state in the online state; if the abnormal occurrence of the read and write events is monitored or the data length of the socket is 0, it is determined that the TCP protocol device is in the offline state; Among them, the execution priorities from first to last are I / O multiplexing listening, the timeout mechanism, and the heartbeat mechanism; The status monitoring information includes: Continuously monitor the online frequency, offline frequency, communication traffic, and abnormal events of the TCP protocol device; the abnormal events include other device connection status and communication operation status events except for the TCP protocol device being in the online state and the communication operation state.
6. The multi-protocol device communication state machine monitoring system of the Internet of Things acquisition platform according to claim 2, characterized in that, The Internet of Things device includes a UDP protocol device, and the communication access point in the communication access module includes a communication access point for the UDP protocol device; In the state machine inference logic information configured by the protocol state inference table corresponding to the state machine adapter set by the communication access point for the UDP protocol device: The state definition information includes: Device connection status information, which is used to indicate whether the UDP protocol device is in an online state or an offline state; when data from the UDP protocol device is received, the initial communication state is set to the online state; Communication operation status information, which is used to indicate the communication operation status of the UDP protocol device in the online state, including normal communication status, communication timeout status, communication instability status, or no communication status; The state transition logic information includes: The heartbeat mechanism refers to sending heartbeat packets to the UDP protocol device at a preset frequency and receiving heartbeat responses for status monitoring; if the heartbeat responses from the UDP protocol device are not received continuously for a3 times, it is determined that the UDP protocol device is in an offline state; if the heartbeat response from the UDP protocol device is received again after the offline state, it is determined that the UDP protocol device has resumed the online state; where a3 is the threshold of the number of heartbeat response times preset for the UDP protocol; The timeout mechanism refers to performing a timeout judgment on the data reception time interval of the data sent by the UDP protocol device in the normal communication state; if the data reception time interval exceeds t3, it is determined that the UDP protocol device is in a communication timeout state; if the communication timeout state is determined a4 times within the duration of t4 but not continuously, it is determined that the UDP protocol device is in a communication instability state; if the communication timeout state is determined continuously a4 times, it is determined that the UDP protocol device is in a no communication state; where a4 is the threshold of the number of timeout times preset for the UDP protocol, and both t3 and t4 are the timeout thresholds preset for the UDP protocol, and t3 < t4; Receive function monitoring refers to monitoring the data length of the recvfrom receive function of the UDP protocol; if the data length of the recvfrom receive function is not 0, it is determined that the UDP protocol device is in the normal communication state in the online state; if the data length of the recvfrom receive function is 0, it is determined that the UDP protocol device is in an offline state; I / O multiplexing monitoring refers to using the I / O multiplexing method to monitor the read and write events of the UDP protocol device-side socket; if the read and write events are continuously monitored normally and the data length of the socket is not 0, it is determined that the UDP protocol device remains in the normal communication state in the online state; if an abnormal read and write event is monitored or the data length of the socket is 0, it is determined that the UDP protocol device is in an offline state; Among them, the execution priority order from first to last is I / O multiplexing monitoring, receive function monitoring, timeout mechanism, and heartbeat mechanism; The state monitoring information includes: Continuously monitoring the online frequency, offline frequency, communication traffic, and abnormal events of the UDP protocol device; the abnormal events include other device connection status and communication operation status events except for the UDP protocol device being in the online state and communication operation state.
7. The multi-protocol device communication state machine monitoring system of the Internet of Things acquisition platform according to claim 2, wherein, The Internet of Things device includes an MQTT protocol device, and the communication access point in the communication access module includes a communication access point for the MQTT protocol device; In the state machine inference logic information configured in the protocol state inference table corresponding to the state machine adapter linked and set for the communication access point for the MQTT protocol device: The state definition information includes: Device connection status information, which is used to indicate whether the MQTT protocol device is in an online state or an offline state; among them, the online state includes the connecting, connected, subscribed, and published states in the MQTT protocol; the offline state includes the unconnected, disconnecting, and disconnected states in the MQTT protocol; the initial communication state after the MQTT protocol device is accessed is the online state; Communication operation status information, which is used to indicate the communication operation status of the MQTT protocol device in the online state, including normal communication state, communication timeout state, communication instability state, or no communication state; The state transition logic information includes: Connection state inference refers to inferring the connection state of the MQTT protocol device based on the connection management type message of the MQTT protocol device; if a connection request message of the MQTT protocol device is received, after establishing a communication connection with it, it is determined that the MQTT protocol device is in the online state; if a connection error message feedback by the MQTT protocol device is received during the establishment of the communication connection, it is determined that the MQTT protocol device is in the offline state; if a disconnection request message of the MQTT protocol device is received in the online state, the established communication connection with it is disconnected, and it is determined that the MQTT protocol device is in the offline state; The heartbeat mechanism refers to monitoring its status by listening to the heartbeat keep-alive type message of the MQTT protocol device; if the heartbeat response message of the MQTT protocol device is not received continuously for a5 times, it is determined that the MQTT protocol device is in the communication timeout state; if the heartbeat response message of the MQTT protocol device is not received continuously for a6 times, it is determined that the MQTT protocol device is in the offline state; if the heartbeat response message of the MQTT protocol device is received again after the offline state, it is determined that the MQTT protocol device resumes to the online state; if the MQTT protocol device is determined to be in the communication timeout state multiple times at intervals, but does not meet the trigger condition for determining that the MQTT protocol device is in the offline state, it is determined that the MQTT protocol device is in the communication instability state; among them, a5 and a6 are both heartbeat response times thresholds preset for the TCP protocol, and a5 < a6; The timeout mechanism refers to performing timeout judgment by listening to the receiving time interval of the message publishing type message or subscription type message of the MQTT protocol device; if the receiving time interval exceeds t5, it is determined that the MQTT protocol device is in the no communication state; if the receiving time interval exceeds t6, it is determined that the MQTT protocol device is in the offline state; among them, t5 and t6 are both timeout thresholds preset for the MQTT protocol, and t5 < t6; Among them, the execution priorities from first to last are connection state inference, timeout mechanism, and heartbeat mechanism; The state monitoring information includes: Continuously monitor the online frequency, offline frequency, communication traffic, and abnormal events of MQTT protocol devices; the abnormal events include other device connection status and communication operation status events except for the online status and communication operation status of MQTT protocol devices.
8. The multi-protocol device communication state machine monitoring system of the Internet of Things acquisition platform according to claim 2, characterized in that The Internet of Things devices include HTTP protocol devices, and the communication access points in the communication access module include communication access points for HTTP protocol devices; In the state machine inference logic information configured by the protocol state inference table corresponding to the state machine adapter linked to the communication access point settings for HTTP protocol devices: The state definition information includes: Device connection status information, which is used to indicate whether the HTTP protocol device is in an online state or an offline state; when a data request from the HTTP protocol device is received, the initial communication state is set to the online state; Communication operation status information, which is used to indicate the communication operation status of the HTTP protocol device in the online state, including normal communication state, communication timeout state, or communication instability state; The state transition logic information includes: Connection state inference refers to inferring the connection state of the HTTP protocol device based on the request message type of the HTTP protocol device; if an online request message from the HTTP protocol device is received, it is determined that the HTTP protocol device is in the online state; if an offline request message from the HTTP protocol device is received, it is determined that the HTTP protocol device is in the offline state; The heartbeat mechanism refers to sending heartbeat packets to the HTTP protocol device at a preset frequency and receiving heartbeat responses for status monitoring; if the heartbeat response from the HTTP protocol device is not received continuously for a7 times, it is determined that the HTTP protocol device is in the communication timeout state; if the heartbeat response from the HTTP protocol device is not received continuously for a8 times, it is determined that the HTTP protocol device is in the communication instability state; if the heartbeat response from the HTTP protocol device is received again after the communication instability state, it is determined that the HTTP protocol device has recovered to the normal communication state; where a7 and a8 are both heartbeat response count thresholds preset for the HTTP protocol, and a7 < a8; Among them, the execution priorities from first to last are connection state inference and the heartbeat mechanism; The state monitoring information includes: Continuously monitor the online frequency, offline frequency, communication traffic, and abnormal events of HTTP protocol devices; the abnormal events include other device connection status and communication operation status events except for the online state and communication operation state of HTTP protocol devices.
9. The multi-protocol device communication state machine monitoring system of the Internet of Things acquisition platform according to claim 1, wherein It also includes an external service module, which is used to provide query or message push services for the communication status information, abnormal events, and / or alarm information of the Internet of Things devices externally.
10. The multi-protocol device communication state machine monitoring system of the Internet of Things acquisition platform according to claim 9, characterized in that, The query or message push services provided by the external service module include: Provide query services for the communication status information, abnormal events, and / or alarm information of the Internet of Things devices externally through the API interface; Push the communication status information, abnormal events, and / or alarm information of the Internet of Things devices externally through the synchronous idempotent interface; Provide subscription services for the communication status information, abnormal events, and / or alarm information of the Internet of Things devices externally through the asynchronous non-idempotent message queue.
Citation Information
Cited By
Power conversion cabinet instruction control method fusing MQTT and HTTP synchronous and asynchronous protocols
CN121000502A