Internet of Things communication protocol processing method, system and device and storage medium
By establishing access configuration of physical devices in the Internet of Things system and creating device instances, the problems of high degree of customization and insufficient compatibility of IoT communication protocols in the prior art are solved, and flexible adaptation of multiple communication protocols are achieved. Dynamic configuration reduces system maintenance costs and improves compatibility.
Patent Information
- Application Number
- CN202411517936.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-29
- Publication Date
- 2025-02-18
AI Technical Summary
The existing IoT systems have a high degree of customization of communication protocols during device access, and lack reusability and flexible configuration capabilities, resulting in increased system maintenance costs and reduced compatibility.
By establishing the access configuration of physical devices in the Internet of Things system, creating device instances and assigning device identifiers, establishing a binding relationship between the device and the device access gateway, flexible adaptation and dynamic configuration of multiple communication protocols are achieved.
It realizes flexible adaptation of IoT systems to multiple communication protocols, supports access to different manufacturers and models of equipment, reduces system maintenance costs, and improves system compatibility.
Smart Images

Figure CN119484657A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of Internet of Things communication technology, and in particular to an Internet of Things communication protocol processing method, system, device and storage medium. Background Art
[0002] With the rapid development of Internet of Things technology, more and more physical devices are connected to the network to achieve intelligent management and data interaction. At present, when hardware physical devices are connected to the Internet of Things software system, they are usually customized according to the specific communication protocols and message parsing protocols of the physical devices, and one-to-one development coding is performed for different types of devices. Although this solution can support different devices to access the Internet of Things system, after the development of the Internet of Things system is completed, the communication protocol and message parsing protocol are in a fixed format and do not have the reusability and flexible configuration capabilities of the developed communication protocol and message parsing protocol. If new or modified protocols are required, it is often necessary to redesign and modify the code program, which not only increases a lot of coding work, but also increases the customization of the system, reduces system compatibility, and increases system maintenance costs. Summary of the invention
[0003] The main purpose of this application is to overcome the shortcomings and deficiencies of the prior art, and to provide an Internet of Things communication protocol processing method, system, device and storage medium that can flexibly adapt to a variety of communication protocols to meet the needs of dynamically adding and configuring a variety of network communication protocols, and solve the problems of high degree of customization of Internet of Things communication protocols and insufficient compatibility of data parsing protocols during device access in the prior art.
[0004] In order to achieve the above objectives, this application adopts the following technical solutions:
[0005] In a first aspect, the present application provides an Internet of Things communication protocol processing method, comprising the following steps:
[0006] Establishing access configuration of the physical device in the Internet of Things system, wherein establishing access configuration of the physical device includes establishing network components of the physical device, establishing a device access gateway, and uploading a message parsing protocol package corresponding to the physical device;
[0007] Creating a corresponding device instance for the physical device in the Internet of Things system, assigning a device identifier to the device instance, and establishing a binding relationship between the physical device and the corresponding device access gateway;
[0008] The physical device and the Internet of Things system establish a connection relationship through the network component;
[0009] Based on the connection relationship, the Internet of Things system receives the original data message of the physical device;
[0010] Based on the configuration relationship between the network component corresponding to the communication protocol type of the physical device and the device access gateway, the device identifier, and the binding relationship between the physical device and the corresponding device access gateway, the original data message of the physical device is transmitted to the message parsing protocol package corresponding to the physical device through the device access gateway;
[0011] The message parsing protocol package corresponding to the physical device decodes the original data message of the physical device into a message in a unified format with the Internet of Things system.
[0012] As a preferred technical solution, when establishing the device access gateway, it also includes binding the device access gateway with the communication protocol type of the physical device, the network component and the message parsing protocol package.
[0013] As a preferred technical solution, the communication protocol types include: MQTT protocol, MQTT Broker protocol, CoAP protocol, HTTP protocol, WebSocket protocol, TCP protocol and UDP protocol.
[0014] As a preferred technical solution, when uploading the message parsing protocol package corresponding to the physical device, based on the physical device of the TCP protocol and the UDP protocol type, the correspondence between the physical device IP information and the device identifier of the Internet of Things system is defined in the message parsing protocol package.
[0015] As a preferred technical solution, when the communication protocol type is MQTT protocol, MQTT Broker protocol, CoAP protocol, HTTP protocol or WebSocket protocol, the first configuration relationship between the network component and the device access gateway is 1:N, and the first configuration relationship between the network component and the device access gateway is 1:N, which means that one network component corresponds to multiple device access gateways and multiple message parsing protocol packages;
[0016] When the communication protocol type is the TCP protocol or the UDP protocol, the second configuration relationship between the network component and the device access gateway is 1:1, and the second configuration relationship between the network component and the device access gateway is 1:1, which means that one network component corresponds to one device access gateway and one message parsing protocol package.
[0017] As a preferred technical solution, the configuration relationship between the network component corresponding to the communication protocol type of the physical device and the device access gateway, the device identifier, and the binding relationship between the physical device and the corresponding device access gateway, transmitting the original data message of the physical device to the message parsing protocol package corresponding to the physical device through the device access gateway, includes:
[0018] When the communication protocol type is MQTT protocol, MQTT Broker protocol, CoAP protocol, HTTP protocol or WebSocket protocol, based on the first configuration relationship between the network component and the device access gateway, the Internet of Things system identifies the corresponding physical device according to the device identifier;
[0019] Finding a device access gateway bound to the physical device through the corresponding physical device;
[0020] The corresponding message parsing package is found according to the device access gateway, and the original data message of the physical device is transmitted to the corresponding message parsing package.
[0021] As a preferred technical solution, the configuration relationship between the network component corresponding to the communication protocol type of the physical device and the device access gateway, the device identifier, and the binding relationship between the physical device and the corresponding device access gateway, transmitting the original data message of the physical device to the message parsing protocol package corresponding to the physical device through the device access gateway, also includes:
[0022] When the communication protocol type is TCP protocol or UDP protocol, finding a corresponding message parsing protocol packet based on a second configuration relationship between the network component and the device access gateway;
[0023] Find the device identifier of the corresponding Internet of Things system based on the correspondence between the physical device IP information defined in the corresponding message parsing protocol package and the device identifier of the Internet of Things system;
[0024] The original data message of the physical device is transmitted to the message parsing protocol package corresponding to the physical device according to the device identifier of the corresponding Internet of Things system.
[0025] In a second aspect, the present application provides an Internet of Things communication protocol processing system, which is applied to an Internet of Things communication protocol processing method, including an access configuration module, an instance creation module, a connection relationship establishment module, a data message receiving module, a data message transmission module and a decoding module;
[0026] The access configuration module is used to establish access configuration of the physical device in the Internet of Things system, wherein establishing access configuration of the physical device includes establishing network components of the physical device, establishing a device access gateway, and uploading a message parsing protocol package corresponding to the physical device;
[0027] The instance creation module is used to create a corresponding device instance for the physical device in the Internet of Things system, allocate a device identifier to the device instance, and establish a binding relationship between the physical device and the corresponding device access gateway;
[0028] The connection relationship establishment module is used for the physical device to establish a connection relationship with the Internet of Things system through the network component;
[0029] The data message receiving module is used for the Internet of Things system to receive the original data message of the physical device based on the connection relationship;
[0030] The data message transmission module is used to transmit the original data message of the physical device to the message parsing protocol package corresponding to the physical device through the device access gateway based on the configuration relationship between the network component corresponding to the communication protocol type of the physical device and the device access gateway, the device identifier, and the binding relationship between the physical device and the corresponding device access gateway;
[0031] The decoding module is used for the message parsing protocol package to decode the original data message of the physical device into a message in a unified format with the Internet of Things system.
[0032] In a third aspect, the present application provides an electronic device, the electronic device comprising:
[0033] at least one processor; and a memory communicatively coupled to the at least one processor;
[0034] The memory stores computer program instructions that can be executed by the at least one processor, and the computer program instructions are executed by the at least one processor so that the at least one processor can execute the Internet of Things communication protocol processing method.
[0035] In a fourth aspect, the present application provides a computer-readable storage medium storing a program, which, when executed by a processor, implements the method for processing an Internet of Things communication protocol.
[0036] In summary, compared with the prior art, the effective effects brought about by the technical solution provided by this application include at least:
[0037] The present application proposes a method for processing an Internet of Things communication protocol, which includes establishing access configuration of a physical device in an Internet of Things system; creating a corresponding device instance for the physical device in the Internet of Things system, assigning a device identifier to the device instance, and establishing a binding relationship between the physical device and the corresponding device access gateway; establishing a connection relationship between the physical device and the Internet of Things system through a network component, and the Internet of Things system receiving the original data message of the physical device; based on the configuration relationship between the network component corresponding to the communication protocol type of the physical device and the device access gateway, the device identifier, and the binding relationship between the physical device and the corresponding device access gateway, transmitting the original data message of the physical device to the Internet of Things system through the device access gateway. A message parsing protocol package corresponding to the physical device; the message parsing protocol package decodes the original data message of the physical device into a message in a unified format with the Internet of Things system to obtain a decoded message; the present application can flexibly adapt to a variety of communication protocols, that is, it supports the access of terminal devices of different manufacturers, different models, and different protocols, and meets the needs of dynamically adding and configuring a variety of network communication protocols; in addition, the Internet of Things system defines a unified format message to encode and decode the original message, and realizes two-way message conversion and transmission between different types of devices and the Internet of Things system; at the same time, the Internet of Things system can dynamically load the message parsing protocol package and automatically identify the content in the message parsing protocol package to realize the decoupling of the system and device protocols. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0039] Figure 1 A flowchart of an Internet of Things communication protocol processing method provided by an embodiment of the present application;
[0040] Figure 2 A block diagram of an Internet of Things communication protocol processing system provided for one embodiment of the present application. DETAILED DESCRIPTION
[0041] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present application.
[0042] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described in this application may be combined with other embodiments.
[0043] Example:
[0044] See also Figure 1 In one embodiment of the present application, a method for processing an Internet of Things communication protocol is provided, comprising the following steps:
[0045] S1. Establishing access configuration of a physical device in an Internet of Things system, wherein establishing access configuration of the physical device includes establishing a network component of the physical device, establishing a device access gateway, and uploading a message parsing protocol package corresponding to the physical device.
[0046] Furthermore, the IoT system will dynamically monitor the port usage of network components and establish corresponding network components for each new physical device, with the goal of establishing network communication conditions between the physical device and the IoT system. Physical devices usually use specific ports to communicate with the IoT system, and it is necessary to ensure that the ports used by the new physical device do not conflict with other devices that have established connections with the IoT system to ensure the stability of communication.
[0047] It should be noted that the network protocols supported by this application include MQTT server, MQTT client, TCP server, UDP server, CoAP server, HTTP server, and WebSocket server, so that new physical devices can establish a connection with the IoT system through this network component. When accessing, determine the communication protocol type according to the needs of the physical device, create the corresponding network component, and configure the network component parameters, which includes setting the IP, port number, and other communication protocol-specific settings.
[0048] Furthermore, in this embodiment, when creating a network component instance, the Internet of Things system will automatically and dynamically detect available ports. The specific implementation method is: develop a static method to monitor whether a port is available, the method receives an integer parameter port, indicating the port number to be checked, and returns a Boolean value indicating whether the port is available.
[0049] Specifically, based on protocol characteristics, MQTT protocol, MQTT Broker protocol, HTTP protocol, and WebSocket protocol are application layer protocols, and their transport layer protocols all use TCP protocol. TCP protocol is a connection-oriented protocol. When determining whether a port is available, the TCP port detects whether the port is occupied by trying to establish a connection. A successful connection indicates that the port is occupied. The steps to verify whether a port is available using a static method include:
[0050] When the protocol type is TCP, MQTT, MQTT Broker, HTTP, or WebSocket:
[0051] (1) Define static methods, including:
[0052] The method name isPortAvailable (check whether the port is available); parameter: port (integer parameter, indicating the port number to be checked); return value: boolean (defines a Boolean return value, indicating whether the port is available).
[0053] (2) Port validity check, including:
[0054] Checks whether the port number is in the valid range (0-65535). If not, returns false (error), indicating that the port is invalid; checks whether the port belongs to the system reserved port range (0-1024). If it does, returns false (error), indicating that the port is invalid.
[0055] (3) Attempt to connect, including:
[0056] Create a Socket instance and try to connect to the specified port of the local host. If the connection fails, it means that the server does not have the port and the port is not occupied. Therefore, true (correct) is returned in the isPortAvailable method, indicating that the port can be created in the network component, that is, the port is available. On the contrary, if the connection is successful, it means that the server already has the port and the port is occupied. Therefore, false is returned in the isPortAvailable method, indicating that the port cannot be created in the network component, that is, the port is unavailable.
[0057] Based on the protocol characteristics, the CoAP protocol is an application layer protocol, and its transport layer protocol adopts the UDP protocol.
[0058] UDP is a connectionless protocol, which means that it does not need to establish a connection like TCP; therefore, it is not possible to detect whether a UDP port is occupied by trying to establish a connection. UDP ports detect whether a port is occupied by trying to bind the port directly. Successful binding means that the port is not occupied.
[0059] When the protocol type is UDP or CoAP;
[0060] (1) Define static methods, including:
[0061] Method name: isPortAvailable; parameter: port (integer parameter, indicating the port number to be checked); return value: boolean (defines a Boolean return value, indicating whether the port is available).
[0062] (2) Port validity check, including:
[0063] Checks whether the port number is in the valid range (0-65535). If not, returns false (error), indicating that the port is invalid; checks whether the port belongs to the system reserved port range (0-1024). If it does, returns false (error), indicating that the port is invalid.
[0064] (3) Attempt to connect, including:
[0065] Create a DatagramSocket instance and try to bind directly to the specified port. If no BindException (BindException is an exception class in Java, used to indicate that the binding operation failed) exception is thrown, it means that the port is not occupied, so true (correct) is returned in the isPortAvailable method, indicating that the port can be created in the network component, that is, the port is available. On the contrary, if the BindException exception class is thrown, it means that the port is occupied, so false is returned in the isPortAvailable method. It means that the port cannot be created in the network component, that is, the port is unavailable.
[0066] The purpose of uploading the message parsing protocol package corresponding to the physical device is to ensure that the IoT system can correctly understand the data formats from different physical devices; its specific implementation methods include:
[0067] First, use the Java programming language to implement the DeviceMessageCodec (device message encoding and decoding) interface and rewrite the decoding method of the interface. In the decoding method, the device original data is encoded into a unified message specification defined by the platform according to the message parsing protocol document of the specific device provided by the device manufacturer, and finally packaged into a message parsing protocol jar package;
[0068] Secondly, when uploading the message parsing protocol package corresponding to the physical device, the physical device based on the TCP protocol and UDP protocol type needs to define the correspondence between the physical device IP information and the device identifier of the IoT system in the message parsing protocol package. Finally, create a message parsing instance and upload the jar package to the IoT system.
[0069] When establishing the device access gateway, it also includes binding the device access gateway with the communication protocol type of the physical device, the network component and the message parsing protocol package, the purpose of which is to establish a unified access point, through which all device-related communication and data processing tasks are processed, and the implementation method includes:
[0070] First of all, it should be noted that the communication protocol types of this application include: MQTT protocol, MQTT Broker protocol, CoAP protocol, HTTP protocol, WebSocket protocol, TCP protocol and UDP protocol. When accessing, determine the communication protocol type according to the needs of the physical device, create the corresponding device access gateway, and configure the device access gateway parameters, which contains all the necessary information for the user's physical device access;
[0071] Secondly, create a device access gateway instance and bind the device's communication protocol type (MQTT protocol, MQTTBroker protocol, TCP protocol, UDP protocol, CoAP protocol, HTTP protocol, or WebSocket protocol), network component, and message parsing protocol package.
[0072] When the communication protocol type is the MQTT protocol, the MQTT Broker protocol, the CoAP protocol, the HTTP protocol or the WebSocket protocol, the first configuration relationship between the network component and the device access gateway is 1:N, and the first configuration relationship between the network component and the device access gateway is 1:N, which means that one network component corresponds to multiple device access gateways and multiple message parsing protocol packages; when the communication protocol type is the TCP protocol or the UDP protocol, the second configuration relationship between the network component and the device access gateway is 1:1, and the second configuration relationship between the network component and the device access gateway is 1:1, which means that one network component corresponds to one device access gateway and one message parsing protocol package.
[0073] S2. Create a corresponding device instance for the physical device in the Internet of Things system, assign a device identifier to the device instance, and establish a binding relationship between the physical device and the corresponding device access gateway.
[0074] Furthermore, when creating a corresponding device instance for the physical device in the Internet of Things system, it also includes defining physical model attributes of the device instance.
[0075] The purpose of creating a corresponding device instance for the physical device and defining the physical model attributes of the device instance in the IoT system is to add a digital mapping relationship of the physical device in the IoT system and configure the monitoring attributes that the device needs to report to the system. The specific implementation methods include:
[0076] S21. Create a device instance and configure device instance parameters, including binding a device access gateway, configuring a device identifier for a physical device corresponding to the device instance, and establishing a binding relationship between the physical device and the corresponding device access gateway.
[0077] S22. When the protocol type of the device is TCP protocol or UDP protocol, the device identifier of the Internet of Things system is consistent with the device identifier defined in the above-mentioned uploaded message parsing protocol package.
[0078] S23. In the device instance, a new physical model attribute is added, that is, a digital expression of the device monitoring attribute, and the physical model attribute parameters are configured including an attribute identifier, an attribute name, and an attribute format.
[0079] S3. The physical device and the Internet of Things system establish a connection relationship through the network component.
[0080] Furthermore, the physical device and the IoT system establish a connection relationship through the network component in order to connect the network between the physical device and the IoT system so that they have the conditions for communication.
[0081] In the network components, IP and port numbers have been configured to ensure that the IP and port numbers of the device (physical device) are consistent with those of the IoT system, which means that communication conditions are met. Different communication protocol types have different specific implementation methods for physical devices and IoT systems to establish a connection relationship through network components. Specifically:
[0082] For the HTTP protocol, WebSocket protocol, and CoAP protocol, when a physical device establishes a connection with an IoT system, the device sends a message to the IoT system through the specified URL (Uniform Resource Locator). The IoT system identifies whether the URL is compliant, including parameters such as the URL format, IP, Port, and device identifier. After verifying compliance, the IoT system returns an OK value, indicating that the physical device has completed the connection with the system.
[0083] For MQTT-type protocols, when a physical device establishes a connection with an IoT system, the device side becomes an MQTT client and directly establishes a connection with the MQTT server side. After verification of compliance through parameters such as IP, Port, and ClientId, it indicates that the physical device has completed the connection with the IoT system.
[0084] For the MQTT Broker protocol, when a physical device establishes a connection with an IoT system, the device sends a message to the IoT system through a specified Topic (Topic is used to define the channel and path for message transmission). The IoT system identifies whether the IP, port, and Topic are compliant. The Topic needs to include parameters such as the device identifier. After verification of compliance, it indicates that the physical device has completed the connection with the IoT system.
[0085] For TCP and UDP protocols, the device side directly establishes a connection with the IoT system through IP and port. At this time, the IoT system cannot directly find the device identifier through the established connection. That is, in this step, the IoT system only knows that a physical device is connected and can obtain the IP information of the physical device, but does not know which device this is created in the IoT system. This needs to be achieved by identifying the device identifier.
[0086] S4. Based on the connection relationship, the Internet of Things system receives the original data message of the physical device.
[0087] S5. Based on the configuration relationship between the network component corresponding to the communication protocol type of the physical device and the device access gateway, the device identifier, and the binding relationship between the physical device and the corresponding device access gateway, the original data message of the physical device is transmitted to the message parsing protocol package corresponding to the physical device through the device access gateway.
[0088] S51. When the communication protocol type is MQTT protocol, MQTT Broker protocol, CoAP protocol, HTTP protocol or WebSocket protocol, the step of transmitting the original data message of the physical device to the message parsing protocol package corresponding to the physical device through the device access gateway includes:
[0089] S51.1. Based on the first configuration relationship between the network component and the device access gateway, the Internet of Things system identifies the corresponding physical device according to the device identifier;
[0090] S51.2. Find the device access gateway bound to the physical device through the corresponding physical device;
[0091] S51.3. Find the corresponding message parsing package according to the device access gateway, and transmit the original data message of the physical device to the corresponding message parsing package.
[0092] S52: When the communication protocol type is TCP or UDP, the step of transmitting the original data message of the physical device to the message parsing protocol package corresponding to the physical device through the device access gateway includes:
[0093] S52.1. Find a corresponding message parsing protocol packet based on a second configuration relationship between the network component and the device access gateway;
[0094] S52.2. Find the device identifier of the corresponding Internet of Things system based on the correspondence between the physical device IP information defined in the corresponding message parsing protocol package and the device identifier of the Internet of Things system;
[0095] S52.3. Transmit the original data message of the physical device to the message parsing protocol package corresponding to the physical device according to the device identifier of the corresponding Internet of Things system.
[0096] S6. The message parsing protocol package corresponding to the physical device decodes the original data message of the physical device into a message in a unified format with the Internet of Things system.
[0097] Furthermore, for physical devices that use a custom data format, it is necessary to convert the binary data or other custom format data reported by the physical device into the JSON data format supported by the IoT system; the implementation methods include:
[0098] After finding the message parsing protocol package, call the decode method of the Java class that implements the DeviceMessageCodec interface in the jar package to obtain the parsed message in a unified format (that is, the JSON data format supported by the system). The IoT system calls the decode method, regardless of what is encoded in the method. Based on this feature, the encoded content in the message parsing protocol package can be adjusted arbitrarily according to the protocol document provided by the device manufacturer, which is highly flexible and reduces the operation and maintenance costs of the message protocol.
[0099] Furthermore, after receiving the message decoded into a unified format with the IoT system, the IoT system stores the object model attribute data, including:
[0100] 1. Perform format check on the defined device object model attributes. The check steps include: in the above device instance creation, add object model attributes and configure attribute parameters, including attribute identifier, attribute name, and attribute format; the attribute format defines its data type, including int, float, double and other data types; when the original data message of the physical device is decoded into a message in the unified format of the Internet of Things system, the data type reported by the device attribute will be obtained; finally, determine whether the data type reported by the device is consistent with the object model attribute format defined by the system. If the check is inconsistent, ignore the data.
[0101] 2. Store the device data that has passed the verification, that is, convert the verified data into the system-defined physical model table structure and store it in the time series database.
[0102] In summary, the Internet of Things communication protocol processing method provided by the present application can flexibly adapt to multiple communication protocols, that is, it supports the access of terminal devices of different manufacturers, different models, and different protocols, and meets the needs of dynamically adding and configuring multiple network communication protocols. In the process of communication between different types of physical devices and the Internet of Things system, the Internet of Things system dynamically monitors the device network status by automatically identifying the communication protocol mounted on its device, which solves the problems of high customization of the Internet of Things communication protocol and insufficient compatibility of the data analysis protocol during the device access process in the prior art. At the same time, it can support flexible configuration of different message analysis protocols, that is, the Internet of Things system defines a unified format message to encode and decode the original message, and realizes two-way message conversion and transmission of different types of devices and platforms. At the same time, the Internet of Things system dynamically loads the message analysis package and automatically identifies the content in the message analysis package to realize the decoupling of the Internet of Things system and the physical device protocol.
[0103] It should be noted that, for the sake of convenience of description, the aforementioned method embodiments are all expressed as a series of action combinations, but those skilled in the art should know that the present application is not limited to the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously.
[0104] Based on the same idea as the IoT communication protocol processing method in the above embodiment, the present application also provides an IoT communication protocol processing system, which can be used to execute the above IoT communication protocol processing method. For ease of explanation, the structural diagram of an IoT communication protocol processing system embodiment only shows the parts related to the embodiment of the present application. Those skilled in the art can understand that the illustrated structure does not constitute a limitation on the system, and may include more or fewer components than shown in the diagram, or combine certain components, or arrange the components differently.
[0105] See also Figure 2 In another embodiment of the present application, an Internet of Things communication protocol processing system is provided, the system comprising an access configuration module 101, an instance creation module 102, a connection relationship establishment module 103, a data message receiving module 104, a data message transmission module 105 and a decoding module 106;
[0106] The access configuration module 101 is used to establish access configuration of a physical device in the Internet of Things system, wherein establishing access configuration of the physical device includes establishing a network component of the physical device, establishing a device access gateway, and uploading a message parsing protocol package corresponding to the physical device;
[0107] The instance creation module 102 is used to create a corresponding device instance for the physical device in the Internet of Things system, assign a device identifier to the device instance, and establish a binding relationship between the physical device and the corresponding device access gateway;
[0108] The connection relationship establishment module 103 is used for the physical device to establish a connection relationship with the Internet of Things system through the network component;
[0109] The data message receiving module 104 is used for the Internet of Things system to receive the original data message of the physical device based on the connection relationship;
[0110] The data message transmission module 105 is used to transmit the original data message of the physical device to the message parsing protocol package corresponding to the physical device through the device access gateway based on the configuration relationship between the network component corresponding to the communication protocol type of the physical device and the device access gateway, the device identifier, and the binding relationship between the physical device and the corresponding device access gateway;
[0111] The decoding module 106 is used for decoding the original data message of the physical device into a message in a unified format with the Internet of Things system through the message parsing protocol package.
[0112] It should be noted that an Internet of Things communication protocol processing system of the present application corresponds one-to-one to an Internet of Things communication protocol processing method of the present application. The technical features and beneficial effects described in the embodiment of the above-mentioned Internet of Things communication protocol processing method are applicable to the embodiment of an Internet of Things communication protocol processing system. For specific contents, please refer to the description in the embodiment of the method of the present application. It will not be repeated here. This is hereby declared.
[0113] In addition, in the implementation of an Internet of Things communication protocol processing system in the above embodiment, the logical division of each program module is only an example. In actual applications, the above functions can be assigned to different program modules as needed, for example, for the configuration requirements of the corresponding hardware or the convenience of software implementation. That is, the internal structure of the Internet of Things communication protocol processing system is divided into different program modules to complete all or part of the functions described above.
[0114] In another embodiment, an electronic device for implementing an Internet of Things communication protocol processing method is provided, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor; when the processor executes the computer program, an Internet of Things communication protocol processing method of any embodiment of the present application is implemented.
[0115] Exemplarily, in this embodiment, the computer program may be divided into one or more modules, which are stored in the memory and executed by the processor to complete the present application. The one or more module elements may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program in the device.
[0116] The device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The device may include, but is not limited to, a processor and a memory.
[0117] The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the device, and various interfaces and lines are used to connect various parts of the entire device.
[0118] The memory can be used to store the computer program and / or module, and the processor realizes various functions of the device by running or executing the computer program and / or module stored in the memory, and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required for a function, etc.; in addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0119] Accordingly, the present application also provides a computer-readable storage medium, which includes a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute an Internet of Things communication protocol processing method as described in any one of the above embodiments.
[0120] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a non-volatile computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0121] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0122] The above embodiments are preferred implementation modes of the present application, but the implementation modes of the present application are not limited to the above embodiments. Any other changes, modifications, substitutions, combinations, and simplifications that do not deviate from the spirit and principles of the present application should be equivalent replacement methods and are included in the protection scope of the present application.
Claims
1. A method for processing an Internet of Things communication protocol, characterized in that: The steps include: Establishing access configuration of the physical device in the Internet of Things system, wherein establishing access configuration of the physical device includes establishing network components of the physical device, establishing a device access gateway, and uploading a message parsing protocol package corresponding to the physical device; Creating a corresponding device instance for the physical device in the Internet of Things system, assigning a device identifier to the device instance, and establishing a binding relationship between the physical device and the corresponding device access gateway; The physical device and the Internet of Things system establish a connection relationship through the network component; Based on the connection relationship, the Internet of Things system receives the original data message of the physical device; Based on the configuration relationship between the network component corresponding to the communication protocol type of the physical device and the device access gateway, the device identifier, and the binding relationship between the physical device and the corresponding device access gateway, the original data message of the physical device is transmitted to the message parsing protocol package corresponding to the physical device through the device access gateway; The message parsing protocol package corresponding to the physical device decodes the original data message of the physical device into a message in a unified format with the Internet of Things system.
2. According to claim 1, a method for processing an Internet of Things communication protocol is characterized in that: The establishment of the device access gateway also includes binding the device access gateway with the communication protocol type of the physical device, the network component and the message parsing protocol package.
3. According to claim 2, a method for processing an Internet of Things communication protocol, characterized in that: The communication protocol types include: MQTT protocol, MQTT Broker protocol, CoAP protocol, HTTP protocol, WebSocket protocol, TCP protocol and UDP protocol.
4. According to claim 3, a method for processing an Internet of Things communication protocol is characterized in that: When uploading the message parsing protocol package corresponding to the physical device, based on the physical device of the TCP protocol and the UDP protocol type, the corresponding relationship between the physical device IP information and the device identifier of the Internet of Things system is defined in the message parsing protocol package.
5. According to claim 4, a method for processing an Internet of Things communication protocol is characterized in that: When the communication protocol type is MQTT protocol, MQTT Broker protocol, CoAP protocol, HTTP protocol or WebSocket protocol, the first configuration relationship between the network component and the device access gateway is 1:N, and the first configuration relationship between the network component and the device access gateway is 1:N, which means that one network component corresponds to multiple device access gateways and multiple message parsing protocol packages; When the communication protocol type is the TCP protocol or the UDP protocol, the second configuration relationship between the network component and the device access gateway is 1:1, and the second configuration relationship between the network component and the device access gateway is 1:1, which means that one network component corresponds to one device access gateway and one message parsing protocol package.
6. According to claim 5, a method for processing an Internet of Things communication protocol is characterized in that: The configuration relationship between the network component corresponding to the communication protocol type of the physical device and the device access gateway, the device identifier, and the binding relationship between the physical device and the corresponding device access gateway, transmitting the original data message of the physical device to the message parsing protocol package corresponding to the physical device through the device access gateway, includes: When the communication protocol type is MQTT protocol, MQTT Broker protocol, CoAP protocol, HTTP protocol or WebSocket protocol, based on the first configuration relationship between the network component and the device access gateway, the Internet of Things system identifies the corresponding physical device according to the device identifier; Finding a device access gateway bound to the physical device through the corresponding physical device; The corresponding message parsing package is found according to the device access gateway, and the original data message of the physical device is transmitted to the corresponding message parsing package.
7. The method for processing an Internet of Things communication protocol according to claim 5, characterized in that: The configuration relationship between the network component corresponding to the communication protocol type of the physical device and the device access gateway, the device identifier and the binding relationship between the physical device and the corresponding device access gateway, transmitting the original data message of the physical device to the message parsing protocol package corresponding to the physical device through the device access gateway, also includes: When the communication protocol type is TCP protocol or UDP protocol, finding a corresponding message parsing protocol packet based on a second configuration relationship between the network component and the device access gateway; Find the device identifier of the corresponding Internet of Things system based on the correspondence between the physical device IP information defined in the corresponding message parsing protocol package and the device identifier of the Internet of Things system; The original data message of the physical device is transmitted to the message parsing protocol package corresponding to the physical device according to the device identifier of the corresponding Internet of Things system.
8. An Internet of Things communication protocol processing system, characterized in that: An Internet of Things communication protocol processing method applied to any one of claims 1-7, comprising an access configuration module, an instance creation module, a connection relationship establishment module, a data message receiving module, a data message transmission module and a decoding module; The access configuration module is used to establish access configuration of the physical device in the Internet of Things system, wherein establishing access configuration of the physical device includes establishing network components of the physical device, establishing a device access gateway, and uploading a message parsing protocol package corresponding to the physical device; The instance creation module is used to create a corresponding device instance for the physical device in the Internet of Things system, allocate a device identifier to the device instance, and establish a binding relationship between the physical device and the corresponding device access gateway; The connection relationship establishment module is used for the physical device to establish a connection relationship with the Internet of Things system through the network component; The data message receiving module is used for the Internet of Things system to receive the original data message of the physical device based on the connection relationship; The data message transmission module is used to transmit the original data message of the physical device to the message parsing protocol package corresponding to the physical device through the device access gateway based on the configuration relationship between the network component corresponding to the communication protocol type of the physical device and the device access gateway, the device identifier, and the binding relationship between the physical device and the corresponding device access gateway; The decoding module is used for the message parsing protocol package to decode the original data message of the physical device into a message in a unified format with the Internet of Things system.
9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively coupled to the at least one processor; Wherein, the memory stores computer program instructions that can be executed by the at least one processor, and the computer program instructions are executed by the at least one processor so that the at least one processor can execute an Internet of Things communication protocol processing method as described in any one of claims 1-7.
10. A computer-readable storage medium storing a program, characterized in that: When the program is executed by a processor, an Internet of Things communication protocol processing method as described in any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Secondary development system and method based on industrial Internet of Things gateway
CN120499237A