Protocol processing method, communication module and communication module system
By providing a protocol processing method for intelligent communication modules, obtaining and associating protocols for multiple IoT platforms, the problem of insufficient compatibility in the prior art is solved, and the effect of the same module being compatible with multiple platforms is achieved.
Patent Information
- Application Number
- CN202211711398.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-29
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2042-12-29
AI Technical Summary
In the prior art, intelligent communication modules need to develop different firmware for different IoT platforms, resulting in insufficient compatibility and difficulty in compatible with multiple IoT platforms.
Provide a protocol processing method, by obtaining the protocols of multiple IoT platforms and associating each set of protocols with an operation handle, combining multiple platform protocols, conversion protocols and terminal device protocols, and generating corresponding lists for processing data of terminal devices or IoT platforms.
It realizes that the same communication module can be compatible with multiple IoT platforms, improving the compatibility and flexibility of the module.
Smart Images

Figure CN116155938B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of Internet of Things, and in particular to a protocol processing method, a communication module and a communication module system. Background Art
[0002] The Internet of Things is a new type of relationship structure that uses cloud platforms as computing cores, smart devices as information carriers, and the Internet as a transmission medium. For the IoT cloud platform, whether it is cloud-to-cloud docking or device direct connection, smart devices, as terminal nodes, are an indispensable and important component. Smart devices have the functions of sensing detection, control execution, or a combination of these; the IoT cloud platform and smart devices communicate through network connections. Major IoT companies have defined a set of relative standards for how smart devices connect to the network, how they connect to the platform, and how they connect to the platform.
[0003] At present, more and more companies have deployed IoT cloud platforms. Faced with so many IoT cloud platforms, more frequently used intelligent communication modules have emerged. For each IoT platform, different versions of communication module firmware need to be developed, resulting in insufficient compatibility.
[0004] Based on this, the existing technology needs to be improved urgently. Summary of the invention
[0005] The embodiments of the present application provide a protocol processing method, a communication module and a communication module system to enable the same communication module to be compatible with multiple Internet of Things platforms.
[0006] In a first aspect, an embodiment of the present application provides a protocol processing method, which is applied to a communication module, and the method includes:
[0007] Obtain at least two groups of protocols, and associate each group of protocols with an operation handle in a one-to-one correspondence, wherein each group of protocols corresponds to an Internet of Things platform, and each group of protocols includes a platform protocol, a conversion protocol, and a terminal device protocol;
[0008] Combining multiple platform protocols to generate a platform protocol list, and combining multiple conversion protocols to generate a conversion protocol list, and combining multiple terminal device protocols to generate a terminal device protocol list;
[0009] When acquiring data from a terminal device or an IoT platform, searching a terminal device protocol list or a platform protocol list to determine the protocol corresponding to the data from the terminal device or the IoT platform;
[0010] Determine the group protocol corresponding to the data of the terminal device or the Internet of Things platform according to the protocol corresponding to the data of the terminal device or the Internet of Things platform;
[0011] Access the operation handle associated with the group protocol corresponding to the data of the terminal device or the Internet of Things platform to process the data of the terminal device or the Internet of Things platform.
[0012] In some embodiments, each platform protocol corresponds to a platform protocol operation handle, each conversion protocol corresponds to a conversion protocol operation handle, and each terminal device protocol corresponds to a terminal device protocol operation handle;
[0013] Retrieve the terminal device protocol list or platform protocol list to determine the protocol corresponding to the data of the terminal device or IoT platform, including:
[0014] Retrieve the terminal device protocol list and obtain the terminal device protocol operation handle corresponding to the terminal device protocol list;
[0015] Based on the parsing interface corresponding to the terminal device protocol operation handle, the data of the terminal device is processed to determine the protocol corresponding to the data of the terminal device;
[0016] or,
[0017] Retrieve the platform protocol list and obtain the platform protocol operation handle corresponding to the platform protocol list;
[0018] Based on the parsing interface corresponding to the platform protocol operation handle, the data of the Internet of Things platform is processed to determine the protocol corresponding to the data of the Internet of Things platform.
[0019] In some embodiments, the method further comprises:
[0020] Determine whether the data of the terminal device is processed successfully;
[0021] If the data processing of the terminal device is successful, the operation handle of the conversion protocol list is accessed according to the association relationship between the operation handle of the terminal device protocol list and the operation handle of the conversion protocol list;
[0022] By using the operation handle of the conversion protocol list, the conversion interface is called to convert the data of the terminal device into a protocol, and the converted terminal device data is obtained;
[0023] By converting the association between the operation handle of the protocol list and the operation handle of the platform protocol list, the parsing interface of the Internet of Things platform is called to parse the converted terminal device data to obtain the parsed terminal device data.
[0024] In some embodiments, the method further comprises:
[0025] If the data processing of the terminal device fails, the next terminal device protocol operation handle in the terminal device protocol list is retrieved until all the terminal device protocol operation handles in the terminal device protocol list are traversed.
[0026] In some embodiments, the method further comprises:
[0027] Determine whether the data on the IoT platform has been processed successfully;
[0028] If the data processing of the IoT platform is successful, the operation handle of the conversion protocol list is accessed according to the association relationship between the operation handle of the platform protocol list and the operation handle of the conversion protocol list;
[0029] By converting the operation handle of the protocol list, calling the conversion interface, the data of the IoT platform is converted into a protocol, and the converted data of the IoT platform is obtained;
[0030] By converting the association between the operation handle of the protocol list and the operation handle of the terminal device protocol list, the parsing interface of the terminal device protocol is called to parse the converted data of the Internet of Things platform to obtain the parsed data of the Internet of Things platform.
[0031] In some embodiments, the method further comprises:
[0032] If the data processing of the Internet of Things platform fails, the next platform protocol operation handle in the platform protocol list is retrieved until all platform protocol operation handles in the platform protocol list are traversed.
[0033] In some embodiments, the method further comprises:
[0034] If a new IoT platform protocol is obtained, the new IoT platform protocol is added to the platform protocol list, and the new IoT platform protocol is associated with a conversion protocol and a terminal device protocol to form a set of protocols.
[0035] In some embodiments, the method further comprises:
[0036] The operation handles associated with multiple group protocols are stored in a linked list structure to form an operation handle linked list.
[0037] In a second aspect, an embodiment of the present application provides a communication module, including:
[0038] at least one processor; and
[0039] a memory communicatively connected to at least one processor; wherein,
[0040] The memory stores instructions that can be executed by at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the protocol processing method of the first aspect.
[0041] In a third aspect, an embodiment of the present application provides a communication module system, including:
[0042] The communication module of the second aspect;
[0043] Terminal equipment;
[0044] Multiple IoT platforms.
[0045] In a fourth aspect, an embodiment of the present application provides a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a server to execute the above-mentioned protocol processing method.
[0046] The beneficial effect of the embodiments of the present application is that, different from the prior art, the embodiments of the present application provide a protocol processing method, a communication module and a communication module system, the protocol processing method comprising: obtaining at least two groups of protocols, and associating each group of protocols with an operation handle in a one-to-one correspondence, wherein each group of protocols corresponds to an Internet of Things platform, and each group of protocols includes a platform protocol, a conversion protocol, and a terminal device protocol; combining multiple platform protocols to generate a platform protocol list, and combining multiple conversion protocols to generate a conversion protocol list, and combining multiple terminal device protocols to generate a terminal device protocol list; when obtaining data of a terminal device or an Internet of Things platform, retrieving the terminal device protocol list or the platform protocol list to determine the protocol corresponding to the data of the terminal device or the Internet of Things platform; determining the group protocol corresponding to the data of the terminal device or the Internet of Things platform according to the protocol corresponding to the data of the terminal device or the Internet of Things platform; accessing the operation handle associated with the group protocol corresponding to the data of the terminal device or the Internet of Things platform to process the data of the terminal device or the Internet of Things platform.
[0047] By associating each group of protocols with an operation handle in a one-to-one correspondence, when the data of the terminal device or the Internet of Things platform is obtained, the terminal device protocol list or the platform protocol list is retrieved to determine the protocol corresponding to the data of the terminal device or the Internet of Things platform, and further determine the group protocol corresponding to the data of the terminal device or the Internet of Things platform, and access the operation handle associated with the group protocol corresponding to the data of the terminal device or the Internet of Things platform to process the data of the terminal device or the Internet of Things platform. This application can achieve compatibility of the same communication module with multiple Internet of Things platforms. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0049] Figure 1 It is a structural diagram of a communication module system provided in an embodiment of the present application;
[0050] Figure 2It is a general architecture diagram of a communication module system provided in an embodiment of the present application;
[0051] Figure 3 It is a structural diagram of an operating system provided in an embodiment of the present application;
[0052] Figure 4 It is a schematic diagram of the structure of a database provided in an embodiment of the present application;
[0053] Figure 5 It is a structural diagram of a communication interface provided in an embodiment of the present application;
[0054] Figure 6 is a schematic diagram of a data queue provided in an embodiment of the present application;
[0055] Figure 7 It is a schematic diagram of a linear linked list structure of a data queue provided in an embodiment of the present application;
[0056] Figure 8 It is a flowchart of a protocol processing method provided in an embodiment of the present application;
[0057] Fig. 9 It is a schematic diagram of a protocol analysis provided by an embodiment of the present application;
[0058] Fig.10 It is a schematic diagram of a platform protocol list, a conversion protocol list, and a terminal device protocol list provided in an embodiment of the present application;
[0059] Fig.11 yes Figure 8 A detailed flow chart of step S803 in FIG.
[0060] Fig.12 It is a schematic diagram of a data processing flow of a terminal device provided in an embodiment of the present application;
[0061] Fig.13 yes Figure 8 Another detailed flow chart of step S803 in FIG.
[0062] Fig.14 It is a schematic diagram of a data processing flow of a platform provided in an embodiment of the present application;
[0063] Fig.15 It is a structural diagram of a communication module provided in an embodiment of the present application. DETAILED DESCRIPTION
[0064] In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0065] It should be noted that, if there is no conflict, the various features in the embodiments of the present application can be combined with each other, all within the scope of protection of the present application. In addition, although the functional module division is performed in the device schematic diagram and the logical order is shown in the flow chart, in some cases, the steps shown or described can be performed in a sequence different from the module division in the device or the flow chart. Furthermore, the words "first", "second", "third", etc. used in this application do not limit the data and execution order, but only distinguish the same items or similar items with basically the same functions and effects.
[0066] Before explaining the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.
[0067] (1) Communication module refers to the interface component responsible for communication between objects and between people in the Internet of Things. It enables terminal devices without Internet access to access the Internet of Things and solves the communication problem of all things.
[0068] (2) Operation handle refers to the abstract resource access interface at the software level. All members and variables within the handle can be accessed through the operation handle.
[0069] (3) IoT platform refers to IoT service providers, including IoT cloud service platforms and IoT local service platforms.
[0070] See also Figure 1 , Figure 1 It is a structural diagram of a communication module system provided in an embodiment of the present application;
[0071] like Figure 1 As shown, the communication module system 100 includes: an Internet of Things platform 10, a communication module 20, an application 30 and a terminal device 40, wherein:
[0072] The IoT platform 10 is an IoT service provider, including a cloud service platform and a local service platform, wherein the local service platform is generally deployed in a near-field gateway, and the local service platform includes an optical modem supporting IoT, etc. In some embodiments, the number of IoT platforms 10 can be one or more, and the IoT platform 10 can be a computer terminal, a server, a mobile terminal, and other devices.
[0073] The communication module 20 is an interface for the terminal device 40 to interact with the IoT platform 10, and is also an interface for the terminal device to interact with the application (APP). The communication module is used to enable the terminal device 40 without networking capability to access the IoT platform 10, so that the terminal device 40 can communicate with the application 30, and can also enable the terminal devices 40 to communicate with each other.
[0074] The application 30 is a human-computer interaction terminal for users to interact with, and is used to realize the interconnection between users and objects.
[0075] The terminal device 40 is a product device without networking capability, including various Internet of Things terminals.
[0076] Please refer to Figure 2 , Figure 2 It is a general architecture diagram of a communication module system provided in an embodiment of the present application;
[0077] like Figure 2 As shown, the communication module system adopts a layered structure, including: hardware layer, system layer, transmission layer, data layer and protocol layer.
[0078] Each layer is connected through an access medium interface; functionally, except for the hardware layer, each other layer is composed of many functional sub-modules, and the functional modules are independent.
[0079] The hardware layer is the most basic physical carrier and is the original dependency development kit provided by the module chip manufacturer. It includes access to physical interfaces (such as UART, I2S, SPI, etc.), memory management, CPU scheduling management, registers, memory access, etc.
[0080] The system layer is the core functional carrier, located between the hardware layer and the transport layer. It calls the hardware layer interface downward and provides an interface upward for the transport layer and above. The system layer includes the operating system submodule, the standard C library submodule, the tool library submodule, the database submodule and the hardware abstraction layer submodule. The system layer provides an operation interface to the outside for the upper layer to call. Among them, the operating system supports mainstream kernel systems such as FreeRTOS and Linux, and generally uses the tailored version of the module chip manufacturer; the standard C library is a general library formulated according to the C language standard. According to the different implementation strengths of each module chip manufacturer, the interface in the general library is supplemented to make the entire system interface richer; in addition to using tools provided by third parties, the tool library has expanded some of its own tool library interfaces. The database provides dynamic shared data and non-volatile data for the entire system based on the minimum system support to apply to most kernel systems and hardware platforms. The hardware abstraction layer formulates a set of unified operation interfaces and adapts them according to different hardware platforms, so that the upper layer can better decouple when accessing hardware resources or system resources.
[0081] The transport layer is responsible for data transmission and processing. It lies between the system layer and the data layer, calls the system layer interface, and provides access interfaces for the data layer and the protocol layer. According to business capabilities, the transport layer is divided into a transport interface submodule, a transport process management submodule, and a transport task management submodule. Among them, the transport interface is divided into a network interface and a serial interface. The network interface is mainly responsible for platform connection and data transmission, and the serial interface is responsible for terminal device communication and data transmission. Network interface methods include wired networks, wireless networks (WiFi, 4G, etc.), and serial port methods include USB, U(S)ART, SPI, etc.
[0082] The data layer is mainly responsible for data processing. Between the transport layer and the protocol layer, it calls the transport layer and lower layer interfaces to provide access interfaces for the protocol layer. According to business capabilities, the data layer is divided into data interface submodules, data flow management submodules, and data task management submodules. The data interface is mainly composed of the sending data queue, receiving data queue, and backup data queue. Each group of queues provides a data access interface, which is implemented using a ring cache and a linked list.
[0083] The protocol layer is responsible for parsing the data protocol, including packaging and unpacking. It is located above the data layer and is the top layer of the entire communication module system, calling the lower layer interface. According to business capabilities, the protocol layer is divided into a protocol interface submodule, a protocol process management submodule, and a protocol task management submodule. The protocol interface consists of three major parts: the terminal device protocol submodule, the conversion protocol submodule, and the platform protocol submodule. These three are also interrelated functional submodule components. Using the input and output concept, after receiving data from a certain section, after being processed by the protocol interface component, the input data is parsed and converted by the protocol, and finally outputs another protocol data, which is processed by the lower layer interface and finally transmitted to the receiver.
[0084] In the embodiment of the present application, the communication module system adopts a modular design, and is divided into the following according to the functions: hardware module, operating system module, hardware abstraction layer module, tool library module, standard C library module, database module, transmission interface module, data queue module, protocol parsing module, process management module, and task management module. Among them, the transmission interface module includes a network port interface module and a serial port interface module; the data queue module includes a receiving queue module, a sending queue module, and a backup queue module; the protocol parsing module includes a terminal device protocol module (user protocol module), a protocol conversion module, a platform or application protocol module, and an interactive information module; the process management module includes a transmission process module, a data process module, and a protocol process module; the task management module is divided into a transmission management task module, a data management task module, and a protocol management task module.
[0085] At the overall architecture level, coupling is achieved through upper and lower layer access interfaces, so that interface access has strong decoupling capabilities; decoupling capabilities are achieved between modules through data structures (databases, public interfaces).
[0086] The communication module system in the embodiment of the present application is based on a modular design concept, and the internal functions of the module can be added or deleted according to the needs. Each submodule supports cutting or adding functional attributes according to different communication module hardware platforms. For example, in the serial port interface module, according to the communication mode, one of UART, SPI, USB or a combination thereof can be implemented, and other serial communication modes such as I2S can be added. In addition, adding a new platform, application program, and terminal device protocol set in the protocol analysis module not only increases the support of a platform, but also expands the protocol level compatibility of the communication module system.
[0087] The communication module system in the embodiment of the present application runs on an embedded hardware platform, and the entire communication module system is implemented in C language. Except for the mbedtls library (which is oriented to small embedded devices, has compact code, and is the smallest and most complete encryption algorithm library), each functional module has little dependence on third-party libraries. In addition, it supports a variety of compilation environments such as IDEs (integrated development environments) such as IAR, Keil, and Eclipse, command terminal development environments such as GNU (development environment in Linux systems), MinGW (development environment in Windows systems), and MSYS32 (development environment in Windows systems).
[0088] Please refer to Figure 3 , Figure 3 It is a structural diagram of an operating system provided in an embodiment of the present application;
[0089] Among them, the operating system provides task processing and management interfaces for the communication module system.
[0090] like Figure 3 As shown, the operating system adopts a layered structure, which includes the kernel layer, system call layer, and system interface layer from the inside to the outside.
[0091] The kernel layer refers to the operating system kernel for embedded solutions. Currently, there are mainly FreeRTOS and Linux. It is also applicable to other embedded operating systems. The kernel adaptation work depends on the module chip manufacturer.
[0092] The system call layer refers to the kernel-based access interface. The system call layer is released together with the kernel. The difference in kernels determines the difference in system calls. For example, when creating an interface call for a thread, FreeRTOS uses one interface to implement all thread-related parameter passing, while Linux sets these parameters before creation. In addition, their interfaces are not unified.
[0093] The system interface layer refers to a unified access interface adapted according to the differences in the system call layer. The communication module system implements task management and operation through the system interface.
[0094] Please refer to Figure 4 , Figure 4 It is a schematic diagram of the structure of a database provided in an embodiment of the present application;
[0095] like Figure 4 As shown, the database includes volatile data and non-volatile data.
[0096] Among them, the volatile data is dynamic shared data (Ram Data). Ram Data is data information dynamically generated by the communication module. It will not be saved to the memory after the communication module system loses power and is volatile data. During the operation of the communication module system, some process data or power-on information needs to be transmitted to the platform or device terminal. This information includes communication module status information, upgrade information, local authentication information, and communication module information.
[0097] Communication module status information is used to describe the operating status of the communication module system, including network connection status information, signal quality, and dynamic memory usage. Among them, network connection status information includes router connection status, server (local, remote) connection status, and signal quality includes signal quality strength, network delay, etc.
[0098] The upgrade information is used to record the upgrade status information and upgrade process information of the communication module system and provided to the terminal device. It is understandable that the upgrade information will be released or cleared after the upgrade is completed.
[0099] The local authentication information is consistent with the platform authentication information in the non-volatile data (Rom Data). The difference is that the local authentication information only exists when the local service platform provides services and is a temporary storage information.
[0100] Communication module information refers to some inherent information that describes the communication module system, including physical address (MAC, IMEI\CMEI and other operator serial codes), device identification code (SN number, serial number, etc.), communication module network address (IP address), version information (software version, hardware version), etc.
[0101] Among them, non-volatile data (Rom Data) is the data information generated at a certain location during the operation of the communication module. This information will be saved in the memory and is non-volatile data. According to the rules of each platform, the data that needs to be saved in the memory include terminal device information, router information, platform authentication information, and log control information.
[0102] Terminal device information includes product information and terminal device code information of products created on the platform. The product information includes product code and product authentication key; the terminal device code information includes device code and device authentication key. The terminal device information includes the mainstream product and device authentication methods of one machine and one secret key, one model and one secret key, to ensure information security and communication security.
[0103] Router information refers to the router information of the module system that uses WiFi communication. The router information contains some basic information about the WiFi module connected to the router, such as: hotspot name (also known as SSID), password information (KEY, encryption method, etc.) and other information.
[0104] Platform authentication information refers to the authentication information returned to the communication module after the product device is activated (registered) on the platform for the first time, including the data service platform address, authentication key, account password and other authentication-related information.
[0105] Log control information refers to the log control parameters for online debugging of the communication module system, including log level, log statistics duration, log category (distinguished by submodule system), log switch, etc.
[0106] Please refer to Figure 1 ,like Figure 1 As shown in the figure, the communication module system uses a communication interface to realize communication between modules, where the communication interface is the data source acquisition interface and data output output port of the communication module system, and consists of a network port and a serial port. The network port is responsible for the interaction between the communication module and the IoT platform and application, and the serial port is used for the interaction between the communication module and the terminal device.
[0107] For details, please refer to Figure 5 , Figure 5 It is a structural diagram of a communication interface provided in an embodiment of the present application;
[0108] like Figure 5 As shown in the figure, the communication interface is physical interface, interface driver, protocol stack, hardware abstraction layer, standard protocol, and application protocol from bottom to top. Among them, the serial port does not include protocol stack and standard protocol except interface driver, and the application protocol is directly on the hardware abstraction layer, that is, the device terminal serial protocol.
[0109] The physical interface is controlled by physical medium-related registers, including network ports and serial ports. Network ports are divided into wired network cards and wireless network cards. Wired network cards are RJ45 plug-in network interfaces, and wireless network cards include WiFi, 2G\3G\4G\5G and other operator wireless frequency bands. Serial ports include U(S)ART (asynchronous (synchronous) transceiver and transmitter), USB (universal serial bus), and SPI (serial peripheral interface). U(S)ART is divided into RS232 serial port and RS485 serial port according to physical electrical classification.
[0110] Interface driver refers to the interface component in the communication module system that controls the registers of the physical interface to realize the data receiving capability, so that the system can access the physical medium.
[0111] The protocol stack is a protocol for the upper layer of the network interface driver. It adopts the current mainstream LWIP (Light weight IP) lightweight TCP / IP protocol and the protocol stack in the BSD (Berkeley Software Distribution) network branch.
[0112] The Hardware Abstraction Layer (HAL) is a set of universal access interfaces implemented on top of the interface driver and standard protocol stack. It is used to decouple upper-layer applications from the communication module chip platform. The interfaces above the hardware abstraction layer are applicable to all hardware platforms.
[0113] In the embodiment of the present application, the interface of the hardware abstraction layer realizes the unified access interface of the operating system and the network interface in addition to the hardware access interface. The hardware access interface is mainly the hardware platform peripheral access interface and the internal register access interface, such as the serial port UART access interface, the system watchdog access interface, the system reset interface, etc.; the operating system access interface is mainly a layer of interface encapsulated for different operating systems. There are many operating systems at present, such as Linux and FreeRTOS operating systems, but their interfaces can be unified, such as the thread task creation interface and the thread task release interface; the network layer interface is implemented in principle using socket sockets. It only needs to realize the unification of the socket socket interface layer to realize the unification of upper-layer applications such as UDP, TCP, HTTP and other protocols to achieve the purpose of compatibility.
[0114] Standard protocols, for network ports, mainly include TCP, UDP, HTTP(S), COAP, MQTT, etc. The basic standard protocols used by major platform specifications are not necessarily the same. The communication module system in the embodiment of the present application integrates a universal standard protocol, making the upper-layer application protocol more convenient.
[0115] Application protocols are divided into platform protocols and terminal device serial protocols according to different underlying interfaces. Application protocols enable the communication module system to interact with the platform, application program, and terminal device. The platform protocol is the protocol for the communication module system to interact with the platform or application program, and the terminal device serial protocol is the protocol for the communication module system to interact with the terminal device.
[0116] The unification of the protocol layer interface is mainly for sharing with other sub-modules within the communication module system. Because the protocol processes of various IoT platforms are generally the same, the only difference is the protocol level and the corresponding protocol strategy. You only need to follow the process and use a unified interface to implement the differences at the IoT protocol level, such as registration interface, authentication interface, networking interface, etc., to ensure the protocol compatibility of the entire system and achieve the purpose of sharing protocols of multiple IoT platforms in one system.
[0117] It is understandable that each IoT manufacturer formulates platform protocols and terminal device serial protocols according to its own characteristics. The communication module system in the embodiment of the present application supports the protocol integration of each manufacturer, so that the communication module can be used for multiple purposes.
[0118] Please refer to Figure 6 , Figure 6 is a schematic diagram of a data queue provided in an embodiment of the present application;
[0119] like Figure 6 As shown in the figure, the data queue consists of three parts: input queue, output queue and backup queue, which are used to store the response processing data. The input queue caches the data received from the platform or device terminal, or the data generated by the communication module system for transmission; the output queue caches the data to be sent to the platform, application or to the device terminal; the backup queue is divided into input backup queue and output backup queue, which are used to cache the data stored after the input queue or output queue processes an exception for exception processing.
[0120] Please refer to Figure 7 , Figure 7 It is a schematic diagram of a linear linked list structure of a data queue provided in an embodiment of the present application;
[0121] like Figure 7 As shown, the data queue adopts a linear linked list structure, which can process high-priority data content according to data priority, and the data cache size is continuously and dynamically adjusted to achieve a buffering effect.
[0122] Among them, the linear linked list node contains data priority, data, and pointer parts. The priority of the head of the linked list is higher than the priority of the tail of the linked list. The pointer represents the pointer of the linear linked list node to the next node.
[0123] It is understandable that the data queue is mainly used to solve the problem of too much received or sent data to be processed in time, and is suitable for temporary storage of data caused by network delays or busy processing tasks.
[0124] Specifically, the data received from the receiving interface is stored in the input queue as input data, and is unpacked by the data processing task to find the corresponding protocol. After being processed by the protocol, a protocol data is generated and packaged, and then placed in the output queue. Finally, it is sent out through the data processing task as output data applicable to the sending interface. Among them, once the data is stored in the input queue, until there is a data processing exception in the packaging process, the data in the input queue will be placed in the backup queue. The backup queue is also processed by the data processing task. Except for the addition of the processing times and timeout processing mechanism, the other processing mechanisms are the same as the input queue processing mechanism; similarly, the data stored in the output queue will also be stored in the backup queue when the data is sent abnormally. The backup queue is processed by the data processing task, and the processing times and timeout mechanism are also added. The other processing is the same as the output queue.
[0125] The following introduces the task management and process management of the communication module system.
[0126] Among them, task management includes transmission management tasks, data management tasks, and protocol management tasks.
[0127] Specifically, the transmission management task is mainly responsible for polling the original data of the communication interface, and then putting the original data into the data cache to be parsed. After the parsing is completed, it is stored in the input queue and handed over to the data management task for processing.
[0128] The communication interface includes the network port and the serial port. The network port includes the application network port and the platform network port. After parsing the data, according to the source of the communication interface: source application, source platform, source terminal device, and then stored in the input queue with the parsed data; data reception uses the polling communication interface to obtain the original data.
[0129] Specifically, the data management task is divided into two parallel tasks: data input management task and data output management task. The data input management task is mainly responsible for the data processing of the input queue and the input backup queue, which is handled by the data input processing process; the data output management task is responsible for the data processing of the output queue and the output backup queue, which is handled by the data output transmission process.
[0130] In the data input management task, the processed data comes from the input queue and the input backup queue. After being processed by the data input processing flow, the output is divided into the following situations according to the processing results:
[0131] (1) If no abnormality occurs during the entire processing, if data needs to be output, it is output to the output queue;
[0132] (2) If there is no abnormality in the entire processing process, if the data does not need to be output, and it is the data required by the communication module system, it will be stored in the database for use by the internal sub-modules of the communication module system;
[0133] (3) If an exception occurs during the processing, it is stored in the input backup queue as needed.
[0134] In the data output management task, the data to be processed comes from the output queue and the output backup queue, is processed through the data output transmission process, and is transmitted using the communication interface (including the application network port, platform network port, and terminal device serial port).
[0135] If the communication interface transmission fails, it is stored in the output backup queue as needed.
[0136] Specifically, the protocol management task is the main management task, which is responsible for the main control process of the entire communication module system, processing the communication module system's own data services and providing interactive services between terminal devices, platforms, and applications.
[0137] In the protocol management task, the first task is to handle the initialization of the communication module system, including hardware resource initialization and system resource initialization; then the core process is the main task process, the data source for processing is the database, and the processing result output is divided into three situations:
[0138] (1) If there is an upgrade requirement in the main task process, it is output to the upgrade task process for processing. The upgrade task process is a sub-process under the main task, which is mainly responsible for the communication module system and terminal equipment upgrade services;
[0139] (2) The main task process may have data to output according to the business process node, and the data will be stored in the output queue and handed over to the data output management task for processing;
[0140] (3) The main task process node may generate data required by this process, which will be stored in the database and wait for other nodes in the main task process to process the data.
[0141] Among them, all processes of process management use the finite-state machine (FSM) mechanism, where the finite state machine is a mathematical model that represents a finite number of states and the transitions and actions between these states. The transitions between processes are implemented using state node jumps. The state machine runs in the main task process and is responsible for the operation of all processes in the entire system.
[0142] Among them, process management includes transmission process, data flow, and main task process.
[0143] Specifically, the transmission process is divided into a data input transmission process, a data output transmission process and a backup data output transmission process according to input and output.
[0144] Specifically, the data input transmission process includes the following steps:
[0145] (1) The data input transmission process runs in the data input management task and polls to obtain data from the communication interface (network port, serial port);
[0146] (2) If data is received, the data source is recorded through the communication interface source, which includes the network port APP data source, the network port platform (including the cloud service platform and the local service platform) data source, and the serial port terminal device data source;
[0147] (3) The recorded data source and data are stored as a whole in the data input queue;
[0148] (4) If no data is received or the data has been stored in the input queue, continue to poll to obtain the communication interface data and repeat the above process.
[0149] Specifically, the data output transmission process includes the following steps:
[0150] (1) The data output transmission process runs in the data output management task, queries the data output queue, and obtains the output data;
[0151] (2) If there is data, the corresponding communication interface is called according to the data source (application data source, terminal device data source, platform data source). The application data source uses the network port to send data, the terminal device source uses the serial port to send data, and the platform data source uses the network port to send data;
[0152] If there is no data, continue to query the data output queue and repeat the process;
[0153] (3) If the data fails to be sent using the communication interface, determine whether the data needs to be backed up;
[0154] If the data is sent successfully using the communication interface, continue to query the data output queue and repeat the process;
[0155] (4) If backup is required, store the data intact into the output backup queue;
[0156] If backup is not required, continue to query the data output queue and repeat the process;
[0157] The backup conditions are determined by the result code of the communication interface failure and the necessity of data backup (necessity determined by protocol analysis). The backup time limit and number limit conditions are given during the backup process for use in the output backup data transmission process.
[0158] (5) The backup data is processed using the output backup data transfer process.
[0159] Specifically, the backup data output transmission process includes the following steps:
[0160] (1) The backup data output transmission process runs in the data output management task, queries the data output backup queue, and obtains the output data;
[0161] (2) If there is data, the corresponding communication interface is called according to the data source (application data source, terminal device data source, platform data source). The application data source uses the network port to send data, the terminal device source uses the serial port to send data, and the platform data source uses the network port to send data;
[0162] If there is no data, continue to query the data output backup queue and repeat the process.
[0163] (3) If the data fails to be sent using the communication interface, determine whether the data needs to be backed up;
[0164] If the data is sent successfully using the communication interface, continue to query the data output backup queue and repeat the process.
[0165] (4) If backup is required, the data is stored in the output backup queue as is;
[0166] If you do not need to continue backing up, continue to query the data output backup queue and repeat the process;
[0167] Among them, the conditions for continuing backup are: time limit and number limit, which are determined in the data output transmission process.
[0168] Among them, the data flow mainly processes the data of the input queue and the input backup queue, including the data input processing flow and the backup data input processing flow.
[0169] Specifically, the data input processing flow includes the following steps:
[0170] (1) The data input processing flow runs in the data input management task, queries the data input queue, and obtains input data;
[0171] (2) If there is data, perform data protocol analysis and execute source processing based on the analysis result, i.e., the data; if there is no data, continue to query the data input queue and repeat the process.
[0172] (3) If the data execution source is the communication module system data, after being processed by the communication module system, the data of the internal interaction of the communication module system is stored in the database, and the process is repeated after being stored;
[0173] (4) If the data execution source is interface data (from the terminal device data source to the application or platform data source, or from the application or platform data source to the terminal device data source), protocol conversion is required to convert one data format (terminal device data format, application or platform data format) into another data format (application or platform data format, terminal device data format), and then store it in the input queue. After the storage is completed, the process is repeated;
[0174] (5) If an exception occurs during the data execution source processing, the exception handling process is used. The exception handling process mainly backs up the input queue data that needs to be backed up and stores it in the input backup queue. After the storage is completed, the process is repeated; the input backup queue data is processed in the backup data input processing process.
[0175] Specifically, the backup data input processing flow includes the following steps:
[0176] (1) The backup data input processing flow runs in the data input management task;
[0177] (2) The process is basically the same as the data input process, except that the backup data input process starts by obtaining input data from the data input backup queue for processing. If an exception occurs during the processing, backup processing is performed according to the backup conditions.
[0178] (3) If you need to continue backing up, store the data in the input backup queue. After the storage is completed, repeat the process.
[0179] (4) If no backup is required, repeat the process.
[0180] (5) Backup conditions: time limit and number limit, confirmed in protocol analysis.
[0181] Among them, the main task process is responsible for the power-on initialization and business sequence control of the entire communication module system. Business sequence control includes network configuration, networking, local service discovery and connection, registration, authentication, connection, and normal business processes.
[0182] Specifically, the main task process includes the following steps:
[0183] (1) The main task process runs in the protocol management task;
[0184] (2) When the communication module system is powered on, the entire system is initialized, which is divided into hardware resource (memory, peripherals, etc.) initialization and system resource (queue, data structure, database, etc.) initialization;
[0185] (3) Checking the network status: whether the IP address is obtained;
[0186] (4) If there is no network connection, check whether there is network connection information, and obtain the network connection information through the database interface; if there is network connection information, connect to the network; if there is no network connection information, for WiFi communication modules, it is necessary to obtain network connection information by entering the network configuration process; among them, the network configuration process is mainly responsible for obtaining router information (SSID, KEY, encryption method, etc.), and the network configuration methods used in the network configuration process mainly include AP network configuration, Bluetooth network configuration, SmartConfig (multicast broadcast sniffing information) network configuration, automatic network configuration (network configuration through local gateway) or their mixed forms;
[0187] (5) If connected to the Internet, perform local service discovery;
[0188] The support level of each platform is different, and the local service discovery process may or may not exist. If there is no such process, it is equivalent to an empty task process here. No operation is required and it goes directly to the next process node.
[0189] (6) If a local service is found, start the local service and check whether it has been registered. The check flag comes from the database.
[0190] (7) If no local service is found, check whether it has been registered.
[0191] (8) If you have not registered, proceed with the registration process; after the registration process is completed, enter the authentication process.
[0192] (9) If you have already registered, proceed directly to the authentication process.
[0193] (10) After the authentication is completed, the connection process is carried out. Connection means that the communication module is connected to the platform data service and enjoys the services provided by the platform.
[0194] (11) Perform authentication and connection according to the strategies of different platforms.
[0195] (12) After the connection is completed, the communication module system acts as an interface between the terminal device and the application or platform to perform normal business interaction.
[0196] It is understandable that since the data formats between IoT platforms, applications and terminal devices are not unified, format conversion is required. Protocol parsing refers to converting one data format into another data format, so that the terminals (IoT platforms, applications, terminal devices) that were originally unable to interact can interact well with each other. Protocol parsing includes two aspects. On the one hand, the data from the device terminal is converted into the platform data protocol through the protocol from the terminal device to the IoT platform after being parsed by the terminal device protocol, and then transmitted to the IoT platform according to the platform protocol; on the other hand, the platform data is converted into the terminal device data protocol through the protocol from the platform to the device terminal after being parsed by the platform protocol, and then transmitted to the terminal device according to the terminal device protocol.
[0197] See also Figure 8 , Figure 8 It is a flowchart of a protocol processing method provided in an embodiment of the present application;
[0198] The protocol processing method is applied to a communication module. Specifically, the execution subject of the protocol processing method is one or at least two processors of the communication module.
[0199] like Figure 8 As shown, the protocol processing method includes:
[0200] Step S801: obtaining at least two groups of protocols, and associating each group of protocols with an operation handle in a one-to-one correspondence, wherein each group of protocols corresponds to an IoT platform, and each group of protocols includes a platform protocol, a conversion protocol, and a terminal device protocol;
[0201] Specifically, each protocol is used to process data on the corresponding end side or to convert formats. For example, the platform protocol is used to process data on the IoT platform, the conversion protocol is used to convert data on one end side into data in a format that conforms to another end side, and the terminal device protocol is used to process data on the terminal device.
[0202] In the embodiment of the present application, each group of protocols is associated with an operation handle one by one through a registration mechanism. Among them, the registration mechanism is mainly reflected in protocol parsing. The principle is to associate the communication interface, terminal device protocol interface, application protocol interface, platform protocol interface and corresponding resources together through an operation handle. Each group of protocols corresponds to an operation handle, and the data and protocol-related interfaces and resources can be accessed by accessing the operation handle later.
[0203] Furthermore, by registering the terminal device protocol list, conversion protocol list, and platform protocol list through the registration mechanism, and associating the operation handles of the terminal device protocol list, conversion protocol list, and platform protocol list, it is possible to support multiple terminal device protocol operation handles being associated with multiple conversion protocol operation handles, and multiple conversion protocol operation handles being associated with multiple platform protocol operation handles.
[0204] By combining multiple protocols into a group protocol and corresponding the group protocol to the operation handle, the present application can realize a communication module system solution shared by multiple platforms, that is, one set for multiple uses, thereby improving the compatibility of the communication module.
[0205] Please refer to Fig. 9 , Fig. 9 It is a schematic diagram of a protocol analysis provided by an embodiment of the present application;
[0206] like Fig. 9As shown, the platform data stream is converted into a data stream that complies with the terminal device protocol after passing through the platform protocol and the conversion protocol, so that the data stream that complies with the terminal device protocol can be transmitted to the terminal device; or, the terminal device data stream is converted into a data stream that complies with the platform protocol after passing through the terminal device protocol and the conversion protocol, so that the data stream that complies with the platform protocol can be transmitted to the platform, that is, the Internet of Things platform.
[0207] It is understandable that the processing of application data streams is similar to the processing of platform data streams, and will not be repeated here.
[0208] In the embodiment of the present application, the communication module system supports multiple groups of protocols, each of which consists of a terminal device protocol, a conversion protocol, and a platform protocol. By associating this group of protocols with an operation handle, the resources corresponding to the group of protocols can be accessed through the operation handle later.
[0209] It is understandable that each group of protocols corresponds to an operation handle, and multiple groups of protocols correspond to multiple operation handles. The embodiment of the present application stores the operation handles associated with multiple groups of protocols through a linked list structure to form an operation handle linked list. The corresponding protocol matches are found one by one through the operation handle linked list, so as to find the corresponding group of protocols, and then the data is subjected to protocol parsing. Among them, the data includes platform data, terminal device data, or application data. It is understandable that the operation handle linked list includes a pointer, which is used to point to the current group protocol.
[0210] Each group of protocols also includes an application protocol, that is, each group of protocols includes a platform protocol, a conversion protocol, a terminal device protocol and an application protocol.
[0211] By acquiring at least two groups of protocols and associating each group of protocols with an operation handle in a one-to-one correspondence, resources in the group of protocols can be accessed by accessing the operation handle corresponding to the group protocol, thereby improving data access efficiency.
[0212] Step S802: combining multiple platform protocols to generate a platform protocol list, and combining multiple conversion protocols to generate a conversion protocol list, and combining multiple terminal device protocols to generate a terminal device protocol list;
[0213] Specifically, since different platforms correspond to different platform protocols, the present application combines multiple platform protocols to generate a platform protocol list, wherein the platform protocol list includes multiple platform protocols; similarly, different platforms and different terminal devices need to be converted through different conversion protocols, therefore, multiple conversion protocols are combined to generate a conversion protocol list, wherein the conversion protocol list includes multiple conversion protocols; similarly, different terminal devices correspond to different terminal device protocols, and multiple terminal device protocols are combined to generate a terminal device protocol list, wherein the terminal device protocol list includes multiple terminal device protocols.
[0214] Please refer to Fig.10 , Fig.10 It is a schematic diagram of a platform protocol list, a conversion protocol list, and a terminal device protocol list provided in an embodiment of the present application;
[0215] like Fig.10 As shown, the platform protocol list includes platform protocol 1, platform protocol 2, ..., platform protocol n; the conversion protocol list includes conversion protocol 1, conversion protocol 2, ..., conversion protocol n; the terminal device protocol list includes terminal device protocol 1, terminal device protocol 2, ..., terminal device protocol n.
[0216] Among them, a platform protocol, a conversion protocol and a terminal device protocol are combined into a group protocol, for example: platform protocol 1, conversion protocol 1 and terminal device protocol 1 are combined into the first group protocol, platform protocol 2, conversion protocol 2 and terminal device protocol 2 are combined into the second group protocol, ..., platform protocol n, conversion protocol n and terminal device protocol n are combined into the nth group protocol, wherein each group protocol includes a platform protocol, a conversion protocol and a terminal device protocol. In the embodiment of the present application, each group protocol also includes an application protocol, which is used to connect the data of the application.
[0217] Step S803: when the data of the terminal device or the IoT platform is obtained, the terminal device protocol list or the platform protocol list is retrieved to determine the protocol corresponding to the data of the terminal device or the IoT platform;
[0218] Specifically, when the data of the terminal device is obtained, the terminal device protocol list is retrieved to determine the protocol corresponding to the data of the terminal device, that is, the terminal device protocol corresponding to the data of the terminal device.
[0219] Please refer to Fig.11 , Fig.11 yes Figure 8 A detailed flow chart of step S803 in FIG.
[0220] like Fig.11As shown, step S803 includes:
[0221] Step S8031: Retrieve the terminal device protocol list and obtain the terminal device protocol operation handle corresponding to the terminal device protocol list;
[0222] Specifically, the terminal device protocol list includes multiple terminal device protocols, each terminal device protocol corresponds to a terminal device protocol operation handle, and through the terminal device protocol list, a terminal device protocol is obtained, and the terminal device protocol operation handle corresponding to the terminal device protocol is obtained, wherein each terminal device protocol in the terminal device protocol list corresponds one by one to a terminal device protocol operation handle.
[0223] Step S8033: Based on the parsing interface corresponding to the terminal device protocol operation handle, the data of the terminal device is processed to determine the protocol corresponding to the data of the terminal device.
[0224] Specifically, after obtaining the terminal device protocol operation handle corresponding to the terminal device protocol list, determine the parsing interface corresponding to the terminal device protocol operation handle, process the data of the terminal device based on the parsing interface corresponding to the terminal device protocol operation handle, and determine the protocol corresponding to the data of the terminal device. Processing the data of the terminal device includes: performing data protocol processing on the data of the terminal device, if the data of the terminal device conforms to the protocol specification of the current terminal device protocol, then determining that the protocol corresponding to the data of the terminal device is the current terminal device protocol, that is, the protocol matching is successful; if the data of the terminal device does not conform to the protocol specification of the current terminal device protocol, then determining that the protocol matching fails.
[0225] Please refer to Fig.12 , Fig.12 It is a schematic diagram of a data processing flow of a terminal device provided in an embodiment of the present application;
[0226] like Fig.12 As shown, the data processing flow of the terminal device includes:
[0227] Step S1201: Obtain a terminal device protocol list;
[0228] Step S1202: Determine the current terminal device protocol;
[0229] Specifically, a terminal device protocol in the terminal device protocol list is determined as the current terminal device protocol, for example, a terminal device protocol is randomly determined as the current terminal device protocol, or the first terminal device protocol in the terminal device protocol list is determined as the current terminal device protocol.
[0230] Step S1203: Determine whether the current terminal device protocol is matched successfully;
[0231] Specifically, based on the parsing interface corresponding to the terminal device protocol operation handle of the current terminal device protocol, the terminal device data is processed. If the processing is successful, it is determined that the current terminal device protocol matches successfully, and the process goes to step S1206; if the processing fails, it is determined that the current terminal device protocol matches unsuccessfully, and the process goes to step S1204.
[0232] Step S1204: whether the current terminal device protocol is the last protocol in the terminal device protocol list;
[0233] Specifically, if the current terminal device protocol fails to match, it is further determined whether the current terminal device protocol is the last terminal device protocol in the terminal device protocol list. If so, it proceeds to step S1205; if not, it proceeds to the next terminal device protocol and returns to step S1202.
[0234] It can be understood that entering the next terminal device protocol means taking the next terminal device protocol as the current terminal device protocol and repeating the above steps until the protocol is matched successfully, or traversing to the last terminal device protocol in the terminal device protocol list.
[0235] Step S1205: data processing fails;
[0236] Specifically, determining that the data processing fails means that the data of the current terminal device cannot be processed by the terminal device protocol in the terminal device protocol list. At this time, the terminal device data processing flow is exited.
[0237] Step S1206: Data processing is successful;
[0238] Specifically, if the data processing is successful, it means that the data of the current terminal device can be processed by the terminal device protocol in the terminal device protocol list. At this time, step S1207 is entered.
[0239] Step S1207: accessing the operation handle of the conversion protocol list according to the association relationship between the operation handle of the terminal device protocol list and the operation handle of the conversion protocol list;
[0240] Specifically, Fig.10 As shown, each terminal device protocol in the terminal device protocol list corresponds to a group of protocols, which associates the platform protocol, the conversion protocol and the terminal device protocol. Thus, the operation handle corresponding to each platform protocol is associated with an operation handle of the conversion protocol and an operation handle of the terminal device protocol. The operation handle of the current terminal device protocol is used to obtain the operation handle of the conversion protocol associated with the operation handle of the current terminal device protocol.
[0241] Step S1208: calling the conversion interface through the operation handle of the conversion protocol list, performing protocol conversion on the data of the terminal device, and obtaining the converted terminal device data;
[0242] Specifically, the conversion interface corresponding to the conversion protocol operation handle in the conversion protocol list corresponding to the current terminal device protocol is called to perform protocol conversion on the terminal device data to obtain the converted terminal device data.
[0243] Step S1209: by converting the association between the operation handle of the protocol list and the operation handle of the platform protocol list, calling the parsing interface of the Internet of Things platform, parsing the converted terminal device data, and obtaining the parsed terminal device data.
[0244] Specifically, the operation handle corresponding to each platform protocol is associated with an operation handle of a conversion protocol and an operation handle of a terminal device protocol. The operation handle of the conversion protocol is used to obtain the operation handle of the platform protocol corresponding to the operation handle of the conversion protocol. According to the operation handle of the platform protocol, the parsing interface corresponding to the operation handle of the platform protocol is called to parse the converted terminal device data to obtain the parsed terminal device data, and the parsed terminal device data is passed to the transport layer for data transmission.
[0245] In an embodiment of the present application, by traversing the terminal device protocol list, it is possible to determine the terminal device protocol corresponding to the data of the terminal device, so as to convert and parse the data of the terminal device, thereby facilitating data interaction between the Internet of Things platform and the terminal device and improving the stability of data interaction.
[0246] like Fig.10 As shown, when the data of the terminal device is obtained, the terminal device protocols in the terminal device protocol list are retrieved one by one. For example: according to the arrangement order of the terminal device protocols in the terminal device protocol list, starting from terminal device protocol 1, they are retrieved one by one. If the current terminal device protocol matches the data of the terminal device, it is determined that the protocol corresponding to the data of the terminal device is the current terminal device protocol.
[0247] It is understandable that if all terminal device protocols in the terminal device protocol list are traversed and still no data of the terminal device is matched, the data processing of the terminal device fails and the terminal device data processing flow is exited.
[0248] Specifically, when the platform data is obtained, the platform protocol list is retrieved to determine the protocol corresponding to the platform data, that is, the platform protocol corresponding to the platform data.
[0249] Please refer to Fig.13 , Fig.13 yes Figure 8 Another detailed flow chart of step S803 in FIG.
[0250] like Fig.13 As shown, step S803 includes:
[0251] Step S8032: Retrieve the platform protocol list and obtain the platform protocol operation handle corresponding to the platform protocol list;
[0252] Specifically, the platform protocol list includes multiple platform protocols, each platform protocol corresponds to a platform protocol operation handle, and through the platform protocol list, a certain platform protocol is obtained, and the platform protocol operation handle corresponding to the platform protocol is obtained, wherein each platform protocol in the platform protocol list corresponds to a platform protocol operation handle one by one.
[0253] Step S8034: Based on the parsing interface corresponding to the platform protocol operation handle, the data of the Internet of Things platform is processed to determine the protocol corresponding to the data of the Internet of Things platform.
[0254] Specifically, after obtaining the platform protocol operation handle corresponding to the platform protocol list, determine the parsing interface corresponding to the platform protocol operation handle, process the data of the Internet of Things platform based on the parsing interface corresponding to the platform protocol operation handle, and determine the protocol corresponding to the data of the Internet of Things platform. Processing the data of the Internet of Things platform includes: performing data protocol processing on the data of the Internet of Things platform, if the data of the Internet of Things platform conforms to the protocol specification of the current platform protocol, then determine that the protocol corresponding to the data of the Internet of Things platform is the current platform protocol, that is, the protocol matching is successful; if the data of the Internet of Things platform does not conform to the protocol specification of the current platform protocol, then determine that the protocol matching fails.
[0255] Please refer to Fig.14 , Fig.14 It is a schematic diagram of a data processing flow of a platform provided in an embodiment of the present application;
[0256] like Fig.14 The data processing flow of the platform includes:
[0257] Step S1401: Obtain a platform protocol list;
[0258] Step S1402: Determine the current platform protocol;
[0259] Specifically, a platform protocol in the platform protocol list is determined as the current platform protocol, for example, a platform protocol is randomly determined as the current platform protocol, or the first platform protocol in the platform protocol list is determined as the current platform protocol.
[0260] Step S1403: Determine whether the current platform protocol is matched successfully;
[0261] Specifically, based on the parsing interface corresponding to the platform protocol operation handle of the current platform protocol, the data of the Internet of Things platform is processed. If the processing is successful, it is determined that the current platform protocol is matched successfully, and the process goes to step S1406; if the processing fails, it is determined that the current platform protocol is matched unsuccessfully, and the process goes to step S1404.
[0262] Step S1404: whether the current platform protocol is the last protocol in the platform protocol list;
[0263] Specifically, if the current platform protocol fails to match, it is further determined whether the current platform protocol is the last platform protocol in the platform protocol list. If so, it proceeds to step S1405; if not, it proceeds to the next platform protocol and returns to step S1402.
[0264] It can be understood that entering the next platform protocol means taking the next platform protocol as the current platform protocol and repeating the above steps until the protocol is successfully matched, or traversing to the last platform protocol in the platform protocol list.
[0265] Step S1405: data processing fails;
[0266] Specifically, determining that data processing fails means that the data of the current IoT platform cannot be processed by the platform protocol in the platform protocol list. At this time, exit the platform data processing flow.
[0267] Step S1406: Data processing is successful;
[0268] Specifically, if the data processing is successful, it means that the data of the current Internet of Things platform can be processed by the platform protocol in the platform protocol list. At this time, step S1407 is entered.
[0269] Step S1407: accessing the operation handle of the conversion protocol list according to the association relationship between the operation handle of the platform protocol list and the operation handle of the conversion protocol list;
[0270] Specifically, Fig.10 As shown, each platform protocol in the platform protocol list corresponds to a group of protocols, which associates the platform protocol, the conversion protocol and the terminal device protocol. Thus, the operation handle corresponding to each platform protocol is associated with an operation handle of the conversion protocol and an operation handle of the terminal device protocol. The operation handle of the current platform protocol is used to obtain the operation handle of the conversion protocol associated with the operation handle of the current platform protocol.
[0271] Step S1408: calling the conversion interface through the operation handle of the conversion protocol list, performing protocol conversion on the data of the Internet of Things platform, and obtaining the converted data of the Internet of Things platform;
[0272] Specifically, the operation handle of the conversion protocol corresponding to the current platform protocol in the conversion protocol list is used to call the conversion interface corresponding to the operation handle of the conversion protocol, and the data of the Internet of Things platform is converted into a protocol to obtain the converted data of the Internet of Things platform.
[0273] Step S1409: by converting the association between the operation handle of the protocol list and the operation handle of the terminal device protocol list, calling the parsing interface of the terminal device protocol, parsing the converted IoT platform data, and obtaining the parsed IoT platform data.
[0274] Specifically, the operation handle corresponding to each platform protocol is associated with an operation handle of a conversion protocol and an operation handle of a terminal device protocol. Through the operation handle of the conversion protocol, the operation handle of the terminal device protocol corresponding to the operation handle of the conversion protocol is obtained. According to the operation handle of the terminal device protocol, the parsing interface corresponding to the operation handle of the terminal device protocol is called to parse the converted data of the Internet of Things platform to obtain the parsed data of the Internet of Things platform, and the parsed data of the Internet of Things platform is passed to the transport layer for data transmission.
[0275] In an embodiment of the present application, by traversing the platform protocol list, it is possible to determine the platform protocol corresponding to the data of the Internet of Things platform, so as to convert and parse the data of the Internet of Things platform, thereby facilitating data interaction between the Internet of Things platform and the terminal device and improving the stability of data interaction.
[0276] like Fig.10 As shown, when the data of the Internet of Things platform is obtained, the platform protocols in the platform protocol list are searched one by one. For example: according to the arrangement order of the platform protocols in the platform protocol list, starting from platform protocol 1, they are searched one by one. If the current platform protocol matches the data of the Internet of Things platform, it is determined that the protocol corresponding to the data of the Internet of Things platform is the current platform protocol.
[0277] It is understandable that if all platform protocols in the platform protocol list are traversed and still no data of the IoT platform is matched, the data processing of the IoT platform fails and the platform data processing flow is exited.
[0278] Step S804: Determine the group protocol corresponding to the data of the terminal device or the Internet of Things platform according to the protocol corresponding to the data of the terminal device or the Internet of Things platform;
[0279] Specifically, Fig.10As shown, after determining the protocol corresponding to the data of the terminal device or the Internet of Things platform, since each terminal device protocol or platform protocol corresponds to a group protocol, the group protocol corresponding to the data of the terminal device or the Internet of Things platform can be determined according to the protocol corresponding to the data of the terminal device or the Internet of Things platform. For example: the protocol corresponding to the data of the terminal device is terminal device protocol 1, then the group protocol corresponding to the data of the terminal device is the first group protocol.
[0280] Step S805: Access the operation handle associated with the group protocol corresponding to the data of the terminal device or the Internet of Things platform to process the data of the terminal device or the Internet of Things platform.
[0281] Specifically, access the operation handle associated with the group protocol corresponding to the data of the terminal device or the Internet of Things platform, and through the operation handle associated with the group protocol corresponding to the data of the terminal device or the Internet of Things platform, access the data and protocol-related interfaces and resources corresponding to the operation handle associated with the group protocol, such as: platform protocol interface, conversion protocol interface, terminal device protocol interface and other interfaces.
[0282] In an embodiment of the present application, by associating each group of protocols with an operation handle in a one-to-one correspondence, interfaces and resources related to data and protocols can be accessed by accessing the operation handle subsequently, thereby achieving compatibility with multiple IoT platforms.
[0283] It should be noted that the processing process of application data is similar to that of the data of the IoT platform, which will not be repeated here. The specific process can be referred to the above content.
[0284] In an embodiment of the present application, if a new IoT platform protocol appears, the new IoT platform protocol is added to the platform protocol list, and the new IoT platform protocol is associated with a conversion protocol and a terminal device protocol to form a set of protocols.
[0285] It is understandable that if a new terminal device protocol or conversion protocol appears, its processing process is similar to the processing process of a new IoT platform protocol, for example:
[0286] If a new terminal device protocol appears, the new terminal device protocol is added to the terminal device protocol list, and the new terminal device protocol is associated with a conversion protocol and a platform protocol to form a group of protocols.
[0287] If a new conversion protocol appears, the new conversion protocol is added to the conversion protocol list, and the new conversion protocol is associated with a terminal device protocol and a platform protocol to form a group of protocols.
[0288] In an embodiment of the present application, a protocol processing method is provided, which includes: obtaining at least two groups of protocols, and associating each group of protocols with an operation handle in a one-to-one correspondence, wherein each group of protocols corresponds to an Internet of Things platform, and each group of protocols includes a platform protocol, a conversion protocol, and a terminal device protocol; combining multiple platform protocols to generate a platform protocol list, and combining multiple conversion protocols to generate a conversion protocol list, and combining multiple terminal device protocols to generate a terminal device protocol list; when obtaining data of a terminal device or an Internet of Things platform, retrieving the terminal device protocol list or the platform protocol list to determine the protocol corresponding to the data of the terminal device or the Internet of Things platform; determining the group protocol corresponding to the data of the terminal device or the Internet of Things platform according to the protocol corresponding to the data of the terminal device or the Internet of Things platform; accessing the operation handle associated with the group protocol corresponding to the data of the terminal device or the Internet of Things platform to process the data of the terminal device or the Internet of Things platform.
[0289] By associating each group of protocols with an operation handle in a one-to-one correspondence, when the data of the terminal device or the Internet of Things platform is obtained, the terminal device protocol list or the platform protocol list is retrieved to determine the protocol corresponding to the data of the terminal device or the Internet of Things platform, and further determine the group protocol corresponding to the data of the terminal device or the Internet of Things platform, and access the operation handle associated with the group protocol corresponding to the data of the terminal device or the Internet of Things platform to process the data of the terminal device or the Internet of Things platform. This application can achieve compatibility of the same communication module with multiple Internet of Things platforms.
[0290] Please refer to Fig.15 , Fig.15 It is a structural schematic diagram of a communication module provided in an embodiment of the present application;
[0291] like Fig.15 As shown, the communication module 150 includes one or more processors 151 and a memory 152. Fig.15 A processor 151 is taken as an example.
[0292] The processor 151 and the memory 152 may be connected via a bus or other means. Fig.15 The example of connecting through bus is taken in the following.
[0293] The memory 152 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules, such as program instructions / modules corresponding to the protocol processing method in the embodiment of the present application. The processor 151 executes various functional applications and data processing by running the non-volatile software programs, instructions and modules stored in the memory 152, that is, realizing the protocol processing method provided in the above method embodiment and the functions of each module or unit in the above device embodiment.
[0294] The memory 152 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage devices. In some embodiments, the memory 152 may optionally include a memory remotely arranged relative to the processor 151, and these remote memories may be connected to the processor 151 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0295] The program instructions / modules are stored in the memory 152 and when executed by one or more processors 151 , the protocol processing method in any of the above method embodiments is executed.
[0296] The communication module 150 of the embodiment of the present application exists in various forms. Figure 8 The various steps shown; when the functions of each unit can also be implemented, the above-mentioned communication module 150 includes but is not limited to: electronic devices, mobile terminals, fixed terminals, computers, communication equipment, tower servers, rack servers, blade servers, cloud servers and other equipment.
[0297] An embodiment of the present application also provides a non-volatile computer storage medium, which stores computer executable instructions. The computer executable instructions are executed by one or more processors, so that the one or more processors can execute the protocol processing method in any of the above method embodiments.
[0298] An embodiment of the present application also provides a computer program product, which includes a computer program stored on a non-volatile computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a server, the server executes the above-mentioned protocol processing method.
[0299] The above-described device or equipment embodiments are merely illustrative, wherein the unit modules described as separate components may or may not be physically separated, and the components displayed as module units may or may not be physical units, that is, they may be located in one place, or may be distributed on multiple network module units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment.
[0300] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods of each embodiment or some parts of the embodiment.
[0301] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Under the concept of the present application, the technical features in the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other changes in different aspects of the present application as above, which are not provided in detail for the sake of simplicity. Although the present application has been described in detail with reference to the aforementioned embodiments, a person of ordinary skill in the art should understand that the technical solutions described in the aforementioned embodiments can still be modified, or some of the technical features can be replaced by equivalents. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A protocol processing method, characterized in that: Applied to a communication module, the method comprises: Obtain at least two groups of protocols, and associate each group of protocols with an operation handle in a one-to-one correspondence, wherein each group of protocols corresponds to an Internet of Things platform, and each group of protocols includes a platform protocol, a conversion protocol, and a terminal device protocol; Combining a plurality of the platform protocols to generate a platform protocol list, and combining a plurality of the conversion protocols to generate a conversion protocol list, and combining a plurality of the terminal device protocols to generate a terminal device protocol list; When acquiring data from a terminal device or an IoT platform, retrieving the terminal device protocol list or the platform protocol list to determine the protocol corresponding to the data from the terminal device or the IoT platform; Determine the group protocol corresponding to the data of the terminal device or the Internet of Things platform according to the protocol corresponding to the data of the terminal device or the Internet of Things platform; Access the operation handle associated with the group protocol corresponding to the data of the terminal device or the Internet of Things platform to process the data of the terminal device or the Internet of Things platform.
2. The method according to claim 1, characterized in that Each of the platform protocols corresponds to a platform protocol operation handle, each of the conversion protocols corresponds to a conversion protocol operation handle, and each of the terminal device protocols corresponds to a terminal device protocol operation handle; The retrieving the terminal device protocol list or the platform protocol list to determine the protocol corresponding to the data of the terminal device or the Internet of Things platform includes: Retrieving the terminal device protocol list, and obtaining the terminal device protocol operation handle corresponding to the terminal device protocol list; Based on the parsing interface corresponding to the terminal device protocol operation handle, the data of the terminal device is processed to determine the protocol corresponding to the data of the terminal device; or, Retrieve the platform protocol list, and obtain the platform protocol operation handle corresponding to the platform protocol list; Based on the parsing interface corresponding to the platform protocol operation handle, the data of the Internet of Things platform is processed to determine the protocol corresponding to the data of the Internet of Things platform.
3. The method according to claim 2, characterized in that The method further comprises: Determining whether the data of the terminal device is processed successfully; If the data processing of the terminal device is successful, accessing the operation handle of the conversion protocol list according to the association relationship between the operation handle of the terminal device protocol list and the operation handle of the conversion protocol list; By using the operation handle of the conversion protocol list, the conversion interface is called to perform protocol conversion on the data of the terminal device to obtain the converted terminal device data; By converting the association between the operation handle of the protocol list and the operation handle of the platform protocol list, the parsing interface of the Internet of Things platform is called to parse the converted terminal device data to obtain the parsed terminal device data.
4. The method according to claim 3, characterized in that The method further comprises: If the data processing of the terminal device fails, the next terminal device protocol operation handle in the terminal device protocol list is retrieved until all the terminal device protocol operation handles in the terminal device protocol list are traversed.
5. The method according to claim 2, characterized in that: The method further comprises: Determine whether the data of the Internet of Things platform is processed successfully; If the data processing of the Internet of Things platform is successful, accessing the operation handle of the conversion protocol list according to the association relationship between the operation handle of the platform protocol list and the operation handle of the conversion protocol list; The conversion interface is called through the operation handle of the conversion protocol list to perform protocol conversion on the data of the Internet of Things platform to obtain the converted data of the Internet of Things platform; By converting the association between the operation handle of the protocol list and the operation handle of the terminal device protocol list, the parsing interface of the terminal device protocol is called, and the converted data of the Internet of Things platform is parsed to obtain the parsed data of the Internet of Things platform.
6. The method according to claim 5, characterized in that The method further comprises: If the data processing of the Internet of Things platform fails, the next platform protocol operation handle of the platform protocol list is retrieved until all the platform protocol operation handles of the platform protocol list are traversed.
7. The method according to claim 1, characterized in that The method further comprises: If a new IoT platform protocol is obtained, the new IoT platform protocol is added to the platform protocol list, and the new IoT platform protocol is associated with a conversion protocol and a terminal device protocol to form a group of protocols.
8. The method according to claim 1, characterized in that The method further comprises: The operation handles associated with the plurality of groups of protocols are stored in a linked list structure to form an operation handle linked list.
9. A communication module, characterized in that: include: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the protocol processing method according to any one of claims 1 to 8.
10. A communication module system, characterized in that: include: The communication module as claimed in claim 9; Terminal equipment; Multiple IoT platforms.
Citation Information
Patent Citations
Multi-source polymorphic massive heterogeneous terminal pan-access interconnection protocol conversion method and system
CN114157692A
Network connection control method and device for multi-source heterogeneous data
CN114760345A