Communication method, device and message queue telemetry transmission protocol client
By obtaining parameter information and using the direct communication between the prompt instruction module and the target communication module, the problem that the client needs a specific protocol stack interface in the prior art is solved, efficient and lightweight MQTT client communication is achieved, and embeddedness is improved portability and resource utilization of a type of system.
Patent Information
- Application Number
- CN202110748452.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-01
- Publication Date
- 2024-12-31
- Estimated Expiration
- 2041-07-01
AI Technical Summary
In the prior art, the message queue telemetry transmission protocol client needs to pass a specific protocol stack interface to perform data communication, resulting in poor portability of the communication module, increasing development and resource occupation, and making it difficult to apply in resource-intensive embedded systems.
By obtaining parameter information, the target communication module is determined, and the prompt instruction module is used to communicate directly with the target communication module. It adopts a variety of communication protocols and adaptive functions, including execution, receiving and parsing instruction functions, avoiding the specific protocol stack dependency.
It realizes direct communication with different communication modules, reduces development complexity and resource utilization, improves application portability and efficiency, and is suitable for resource-intensive IoT embedded systems.
Smart Images

Figure CN115567619B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a communication method, device and message queue telemetry transmission protocol client. Background Art
[0002] Message Queuing Telemetry Transport (MQTT), as a low-overhead, low-bandwidth instant messaging protocol, is widely used in IoT embedded systems. With the continuous development of communication technology, more and more manufacturers support the MQTT protocol in communication modules and provide Attention (AT) instruction sets to control communication modules to connect to cloud platforms and servers through the MQTT protocol. However, due to the large differences in AT instruction sets of different types of communication modules, the application software developed based on a specific AT instruction set has poor portability and high product replacement costs.
[0003] In some existing technical solutions for implementing embedded MQTT clients, the AT instruction set for controlling the Transmission Control Protocol / Internet Protocol (TCP / IP) function in the communication module is usually encapsulated as a socket interface, and then the MQTT protocol and client are implemented on the basis of the socket interface. The disadvantage of these solutions is that users are required to implement the MQTT protocol and client on the basis of the socket, which adds a burden to the writing of user network applications. Moreover, the implementation of the MQTT protocol and client requires more resources, which makes these solutions difficult to apply in resource-constrained embedded systems.
[0004] To sum up, the message queue telemetry transmission protocol client of the prior art needs to communicate data through a specific protocol stack interface, and cannot directly communicate with the communication module with the MQTT protocol through the MQTT client, resulting in poor portability of the communication module with the MQTT protocol in the prior art. Summary of the invention
[0005] The embodiments of the present application provide a communication method, an apparatus, and a message queue telemetry transmission protocol client to solve the problem that the message queue telemetry transmission protocol client in the prior art needs to communicate data through a specific protocol stack interface.
[0006] In order to solve the above technical problems, this application adopts the following technical solutions:
[0007] The embodiment of the present application provides a communication method, which is applied to a message queue telemetry transmission protocol client, wherein the message queue telemetry transmission server client includes a prompt instruction module and multiple communication modules, including:
[0008] Acquire first parameter information, where the first parameter information is used to determine a target communication module that communicates with the prompt instruction module;
[0009] Control the prompt instruction module to communicate with the target communication module.
[0010] Optionally, the communication module can use a first type of communication protocol and / or a second type of communication protocol;
[0011] The first type of communication protocols include: message queue telemetry transmission protocol;
[0012] The second type of communication protocol includes at least one of the following: third generation mobile communication technology, third generation mobile communication technology, third generation mobile communication technology, narrowband Internet of Things and wireless communication technology.
[0013] Optionally, controlling the prompt instruction module to communicate with the target communication module includes:
[0014] According to the target communication module, determining a target adaptation function corresponding to the target communication module;
[0015] According to the target adaptation function, the prompt instruction module is controlled to communicate with the target communication module.
[0016] Optionally, when the target adaptation function is an execution instruction function, controlling the prompt instruction module to communicate with the target communication module according to the target adaptation function includes:
[0017] Control the prompt instruction module and the target communication module to execute the operation corresponding to the execution instruction function through the preset interface transmission;
[0018] Wherein, the preset interface includes a universal asynchronous receiver / transmitter interface, a serial peripheral interface, or a universal serial bus interface.
[0019] Optionally, when the target adaptation function is a receiving instruction function, controlling the prompt instruction module to communicate with the target communication module according to the target adaptation function further includes:
[0020] According to the receiving instruction function, controlling the prompt instruction module to receive the response data and / or the actively reported data sent by the target communication module;
[0021] Among them, the response data is the response data after the target communication module executes at least one of the target adaptation functions; the actively reported data is the response data after the target communication module fails to execute the target adaptation function.
[0022] Optionally, when the target adaptation function is a parsing instruction function, controlling the prompt instruction module to communicate with the target communication module according to the target adaptation function further includes:
[0023] According to the parsing instruction function, the prompt instruction module is controlled to parse the received response data and / or the actively reported data.
[0024] Optionally, the multiple communication modules are configured in the same adaptation layer.
[0025] Optionally, the method further includes:
[0026] Sending a first message to a message queue telemetry transmission protocol server through the target communication module, wherein the first message includes a topic subscription message and / or a topic publishing message;
[0027] The prompt instruction fed back by the message queue telemetry transmission protocol server is received through the target communication module.
[0028] The embodiment of the present application further provides a communication device, which is applied to a message queue telemetry transmission protocol client, wherein the client includes a prompt instruction module and multiple communication modules, including:
[0029] An acquisition module, used for acquiring first parameter information, where the first parameter information is used for determining a target communication module for communicating with the prompt instruction module;
[0030] The control module is used to control the prompt instruction module to communicate with the target communication module.
[0031] An embodiment of the present application also provides a message queue telemetry transmission protocol client, comprising: a processor, a memory, and a program stored in the memory and executable on the processor, wherein the program implements the steps of the communication method described above when executed by the processor.
[0032] An embodiment of the present application further provides a readable storage medium, on which a program is stored, and when the program is executed by a processor, the steps of the communication method described above are implemented.
[0033] The beneficial effects of this application are:
[0034] In the above technical solution, the method is applied to a message queue telemetry transmission protocol client, and the client includes a prompt instruction module and multiple communication modules, including: obtaining first parameter information, the first parameter information is used to determine the target communication module for communicating with the prompt instruction module; controlling the prompt instruction module to communicate with the target communication module. The technical solution of the present application determines the corresponding target communication module through the first parameter information, and can directly realize communication with the prompt instruction module, which solves the disadvantage of the prior art that the client needs to go through a specific protocol stack interface to communicate data. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 A system schematic diagram showing an MQTT client provided in an embodiment of the present application;
[0036] Figure 2 A schematic diagram showing a flow chart of a communication method provided in an embodiment of the present application;
[0037] Figure 3 A schematic diagram showing the connection between the embedded system and the cloud platform provided in an embodiment of the present application;
[0038] Figure 4 It represents the workflow diagram of the MQTT client embodiment provided by the embodiment of the present application;
[0039] Figure 5 A schematic diagram showing a module of a communication device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0040] In order to make the technical problems, technical solutions and advantages to be solved by the application clearer, the following will be described in detail in conjunction with the accompanying drawings and specific embodiments. In the following description, specific details such as specific configurations and components are provided only to help fully understand the embodiments of the application. Therefore, it should be clear to those skilled in the art that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the application. In addition, for clarity and brevity, the description of known functions and structures has been omitted.
[0041] It should be understood that the references to "one embodiment" or "an embodiment" throughout the specification mean that the specific features, structures, or characteristics associated with the embodiment are included in at least one embodiment of the present application. Therefore, the references to "in one embodiment" or "in an embodiment" appearing throughout the specification do not necessarily refer to the same embodiment. In addition, these specific features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
[0042] In the various embodiments of the present application, it should be understood that the size of the serial numbers of the following processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0043] The present application aims to solve the problem that a message queue telemetry transmission protocol server client in the prior art needs to use a specific protocol stack interface to perform data communication, and provides a communication method, device and message queue telemetry transmission protocol client.
[0044] like Figure 1 As shown, Figure 1 The system diagram of the message queue telemetry transmission protocol (MQTT) client includes: an MQTT client application programming interface 1, and the MQTT application programming interface 2 includes programming interfaces such as MQTT client creation, destruction, connection, subscription, publication, and disconnection, providing basic capabilities for MQTT client application development; multiple communication modules 2, such as the first communication module, the second communication module, and the third communication module, and the three communication modules all include corresponding adaptation functions; a prompt instruction module (AT instruction module) 3, and the AT instruction module executes AT instructions according to the adaptation function of the communication module; further, AT is Attention, and the AT instruction is an instruction for communication sent from a terminal equipment (Terminal Equipment, TE) or a data terminal equipment (Data Terminal Equipment, DTE) to a terminal adapter (Terminal Adapter, TA) or a data circuit terminal equipment (Data Circuit Terminal Equipment, DCE); and a microcontroller not shown in the figure. In this system diagram, the communication module can be understood as an abstract layer module with an MQTT protocol, and each abstract module has a corresponding adaptation function. Here, multiple communication modules are configured in the same MQTT communication module adaptation layer. The following method embodiments are applied to the content of the MQTT client system diagram.
[0045] like Figure 2 As shown, an embodiment of the present application provides a communication method, which is applied to a message queue telemetry transmission protocol MQTT client, wherein the MQTT client includes a prompt instruction module (AT instruction module) and multiple communication modules, including:
[0046] Step 100, obtaining first parameter information, where the first parameter information is used to determine a target communication module that communicates with the prompt instruction module;
[0047] Step 200: Control the prompt instruction module to communicate with the target communication module.
[0048] In this embodiment, step 100 can be performed by Figure 1 The MQTT client application programming interface 1 obtains the first parameter information, and the corresponding target communication module can be identified according to the first parameter information, and the target communication module is controlled through the AT command module to realize the MQTT client communication function.
[0049] It should be noted that the multiple communication modules included in the MQTT client are all abstract layer modules. The abstract layer module identifies the corresponding target adaptation function according to the first parameter, and calls the corresponding target adaptation function to achieve information interaction with the AT command module.
[0050] It should be known that any communication module or target communication module not specifically explained in the present application is understood to be an abstract layer module with an adaptation function.
[0051] Specifically, the multiple communication modules are configured in the same adaptation layer.
[0052] Furthermore, the adaptation layer is a collection of communication terminals that have been adapted to the application programming interfaces of multiple communication modules, providing the ability to control the communication terminals through corresponding AT instruction sets.
[0053] In this embodiment, the multiple communication modules are configured in the same adaptation layer, that is, communication modules with multiple different function combinations are configured in the same adaptation layer, and the adaptation function of each communication module refers to the function that matches the function, parameters, and return value requirements of the MQTT application programming interface by executing specific AT instructions.
[0054] Specifically, the communication module can use a first type of communication protocol and / or a second type of communication protocol;
[0055] The first type of communication protocol includes: message queue telemetry transmission protocol MQTT;
[0056] The second type of communication protocol includes at least one of the following: third-generation mobile communication technology 3G, third-generation mobile communication technology 4G, third-generation mobile communication technology 5G, narrowband Internet of Things NB-IoT and wireless communication technology Wi-Fi.
[0057] Here, the communication module uses the first type of communication protocol, and communicates with the actual communication terminal through at least one second type of communication protocol through the AT command module, eliminating the process of building a TCP / IP network protocol stack and realizing the function of communicating with a communication terminal having the first type of communication protocol and / or the second type of communication protocol.
[0058] Optionally, the step 200 includes:
[0059] Step 210, determining a target adaptation function corresponding to the target communication module according to the target communication module;
[0060] It should be known that the target adaptation function refers to a set of AT commands for communicating with the communication module through a hardware interface such as a serial port.
[0061] Step 220: Control the prompt instruction module to communicate with the target communication module according to the target adaptation function.
[0062] In this embodiment, the target adaptation function determined by the target communication module can notify the prompt instruction module to communicate with the target communication module according to the instruction of the target adaptation function. Here, the target adaptation function at least includes an execution instruction function, a reception instruction function and a parsing instruction function. According to each different instruction function, the communication content between the prompt instruction module and the target communication module is different.
[0063] Specifically, when the target adaptation function is an execution instruction function, step 220 includes:
[0064] Control the prompt instruction module and the target communication module to execute the operation corresponding to the execution instruction function through the preset interface transmission;
[0065] The preset interface includes a universal asynchronous receiver / transmitter (UART) interface, a serial peripheral interface (SPI) interface, or a universal serial bus (USB) interface.
[0066] In this embodiment, the preset interface is provided in the hardware driver layer of the MQTT client, and the preset interface includes one or more of USB, SPI, and UART.
[0067] Here, USB, the full name of which is Universal Serial Bus, is an external bus standard used to regulate the connection and communication between computers and external devices. SDIO, the full name of which is Secure Digital Input and Output, defines a peripheral interface, which mainly includes two types of applications: removable and non-removable. SPI, the full name of which is Serial Peripheral Interface, is a high-speed, full-duplex, synchronous communication bus. I2C, the full name of which is Inter-Integrated Circuit, is a communication bus that only needs two wires to transmit information between devices connected to the bus. UART, the full name of which is Universal Asynchronous Receiver / Transmitter, is a universal serial data bus used for asynchronous communication. The bus has bidirectional communication and can achieve full-duplex transmission and reception.
[0068] Through the above-mentioned preset interface, data can be transmitted between the prompt instruction module and the target communication module, thereby realizing control of the communication connection between the prompt instruction module and the target communication module.
[0069] Specifically, when the target adaptation function is a receiving instruction function, step 220 includes:
[0070] According to the receiving instruction function, controlling the prompt instruction module to receive the response data and / or the actively reported data sent by the target communication module;
[0071] Among them, the response data is the response data after the target communication module executes at least one of the target adaptation functions; the actively reported data is the response data after the target communication module fails to execute the target adaptation function.
[0072] In this embodiment, analysis or data cleaning can be performed based on the response data and / or actively reported data sent by the target communication module; here, the data cleaning includes: data filtering, the original data includes the response data and / or actively reported data sent by the target communication module, and the response data sent by the target communication module is filtered out; data classification, the actively reported data includes heartbeat data, status data of the target communication module, alarm data and other sampling data, which can determine whether this communication is abnormal.
[0073] Specifically, when the target adaptation function is a parsing instruction function, the step 220 further includes:
[0074] According to the parsing instruction function, the prompt instruction module is controlled to parse the received response data and / or the actively reported data.
[0075] In this embodiment, the data is mainly parsed to determine the result of this communication. Further, the parsing instruction function will call the prompt instruction module to receive the response data and / or the active reporting data, and use the parsing result of the AT instruction parsing module as the basis for the return value of the parsing instruction function.
[0076] Optionally, the method further includes:
[0077] Step 300, sending a first message to the MQTT server through the target communication module, wherein the first message includes a topic subscription message and / or a topic publishing message;
[0078] Step 400: receiving a prompt instruction fed back by the MQTT server through the target communication module.
[0079] In this embodiment, before sending the first message to the MQTT server, the target communication module needs to establish a communication connection with the MQTT server. The following explains steps 300 to 400 with a specific embodiment.
[0080] Specifically, initialize the MQTT client, call the MQTT client initialization interface, and set various parameters of the MQTT client. The MQTT client identifies the need to call the first target module initialization adaptation function through the first parameter; the second step: connect to the MQTT broker (Broker), call the MQTT client connection interface; the third step: subscribe to the MQTT topic, call the MQTT client subscription interface through step 300, or publish the MQTT topic message, call the MQTT client publishing interface, and implement the topic subscription message and / or topic publishing message through the first message; through step 400, receive the prompt instruction fed back by the MQTT server, and perform corresponding operations according to the prompt instruction fed back. That is, receive the subscribed topic MQTT message, the target communication module actively reports the MQTT message of the topic subscribed by the client according to the feedback prompt instruction, the MQTT client receives the MQTT message, and executes the corresponding callback function to notify the user that the subscribed message has arrived and performs the corresponding processing. Of course, if you want to disconnect, you can also send a second message to the MQTT server through the target communication module, and the second message includes disconnecting the connection with the MQTT agent.
[0081] In summary, the method of the present application realizes MQTT client communication interaction by directly calling the AT instruction set that controls MQTT-related functions in the communication module, avoiding the burden of additional transplantation or implementation of the MQTT protocol; the communication module adaptation layer of the present application realizes compatibility with multiple AT instruction sets, shields the differences in AT instruction sets between different communication modules, and improves the development of application programs. The present application avoids the implementation of the intermediate socket adaptation layer and the MQTT protocol, is lightweight and concise, and is more suitable for resource-constrained IoT embedded systems.
[0082] In a specific embodiment, if Figure 3 As shown, Figure 3 A schematic diagram of a connection between an embedded system and a cloud platform is shown, wherein the embedded system includes: an MQTT client 4, an actual communication module 5 and other peripherals and sensors 6; the structure of the MQTT client 4 is Figure 1 On the basis of the client shown, an application (which can be understood as a cloud platform application) and an operating system are connected; the actual communication module 5 communicates with the communication module of the MQTT client 4. In the embedded system, the information of the application is obtained by calling the MQTT client application programming interface of the MQTT client 4, and the data of the other peripherals and sensors 6 are obtained through other related interfaces, and then the obtained data is published to the cloud platform 7 through the MQTT client 4 and subscribed to related topics (Topic) to obtain data published by other terminal devices.
[0083] Specifically, through Figure 4 The workflow diagram of the MQTT client embodiment is described. Here, the workflow of the MQTT client embodiment is described by taking the ML302 module as an example. However, the present invention is compatible with communication modules of different AT instruction sets and is not limited thereto:
[0084] Step 1: Initialize the MQTT client, call the MQTT client initialization interface, and set various parameters of the MQTT client. The MQTT client recognizes that it needs to call the ML302 module initialization adaptation function through the first parameter information, and the adaptation function executes the first AT command. The first AT command is:
[0085] "AT+MQTTCFG=" <host> , <port> , <id> , <keepalive> , <user> , <passwd>,<
[0086] clean>, <version> , <encrypt>”.
[0087] Step 2: MQTT client connection, calling the MQTT client connection interface. In this embodiment, the MQTT connection is a preset cloud platform. The corresponding adaptation function is identified through the first parameter information and the second AT command is executed. The second AT command is:
[0088] "AT+MQTTOPEN= <usrflag> , <pwdflag> , <willflag> , <willretain>,<will
[0089] Qos>, <will-topic> , <will-mesg>”.
[0090] Step 3: MQTT client subscription (topic subscription), call the MQTT client subscription interface, identify the corresponding adaptation function through the first parameter information and execute the third AT command "AT+MQTTSUB= <topic> , <qos>”.
[0091] Step 4: The MQTT client subscribes (topic publishing), calls the MQTT client publishing interface, identifies the corresponding adaptation function through the first parameter information, and executes the fourth AT instruction.
[0092] The fourth AT command is: "AT+MQTTPUB= <topic> , <qos> , <retain> , <dup> , <message>”;
[0093] Step 5: The MQTT client receives the subscribed topic MQTT message, and the communication module actively reports the MQTT message of the topic subscribed by the client according to the fifth AT command.
[0094] The fifth AT command is:
[0095] "+MQTTPUBLISH: <dup> , <qos> , <retained> , <packid> , <topic>,<msg_le
[0096] n>, <mesg>”;
[0097] The MQTT client receives the MQTT message and executes the corresponding callback function to notify the user that a subscribed message has arrived and performs corresponding processing.
[0098] Step 6: The MQTT client disconnects; that is, disconnects from the cloud platform, calls the MQTT client disconnection interface, identifies the corresponding adaptation function through the first parameter information, and executes the AT command "AT+MQTTDISC".
[0099] Here, the embodiment of the present application only takes one communication module as an example. The present application supports communication among multiple communication modules that can use the first type of communication protocol and / or the second type of communication protocol, and realizes direct communication between the communication module and the MQTT client.
[0100] like Figure 5 As shown, an embodiment of the present application further provides a communication device, which is applied to a message queue telemetry transmission protocol MQTT client, wherein the MQTT client includes a prompt instruction module and multiple communication modules, including:
[0101] An acquisition module 10, used for acquiring first parameter information, where the first parameter information is used for determining a target communication module for communicating with the prompt instruction module;
[0102] The control module 20 is used to control the prompt instruction module to communicate with the target communication module.
[0103] It should be noted that the communication module can use the first type of communication protocol and / or the second type of communication protocol;
[0104] The first type of communication protocol includes: message queue telemetry transmission protocol MQTT;
[0105] The second type of communication protocol includes at least one of the following: third-generation mobile communication technology 3G, third-generation mobile communication technology 4G, third-generation mobile communication technology 5G, narrowband Internet of Things NB-IoT and wireless communication technology Wi-Fi.
[0106] Optionally, the control module 20 includes:
[0107] A first determining unit, configured to determine a target adaptation function corresponding to the target communication module according to the target communication module;
[0108] The first control unit is used to control the prompt instruction module to communicate with the target communication module according to the target adaptation function.
[0109] Optionally, the first control unit includes:
[0110] A first control subunit, used for controlling the prompt instruction module and the target communication module to execute the operation corresponding to the execution instruction function through transmission via a preset interface;
[0111] The preset interface includes a universal asynchronous receiver / transmitter (UART) interface, a serial peripheral interface (SPI) interface, or a universal serial bus (USB) interface.
[0112] Optionally, the first control unit includes:
[0113] A second control subunit, configured to control the prompt instruction module to receive the response data and / or the active reporting data sent by the target communication module according to the receiving instruction function;
[0114] Among them, the response data is the response data after the target communication module executes at least one of the target adaptation functions; the actively reported data is the response data after the target communication module fails to execute the target adaptation function.
[0115] Optionally, the first control unit further includes:
[0116] The third control subunit is used to control the prompt instruction module to parse the received response data and / or the actively reported data according to the parsing instruction function.
[0117] It should also be noted that the multiple communication modules are configured in the same adaptation layer.
[0118] Optionally, the device further comprises:
[0119] A sending module, used to send a first message to the MQTT server through the target communication module, wherein the first message includes a topic subscription message and / or a topic publishing message;
[0120] The receiving module is used to receive the prompt instruction fed back by the MQTT server through the target communication module.
[0121] An embodiment of the present application also provides a message queue telemetry transport protocol (MQTT) client, including: a processor, a memory, and a program stored in the memory and executable on the processor. When the program is executed by the processor, the various processes of the embodiment of the communication method as described above are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0122] The embodiment of the present application also provides a readable storage medium, on which a program is stored, and when the program is executed by a processor, each process of the embodiment of the communication method described above is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. The readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0123] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "including a..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0124] The above is a preferred embodiment of the present application. It should be pointed out that for ordinary personnel in this technical field, several improvements and modifications can be made without departing from the principles described in the present application. These improvements and modifications are also within the scope of protection of the present application.< / mesg> < / topic> < / packid> < / retained> < / qos> < / dup> < / message> < / dup> < / retain> < / qos> < / topic> < / qos> < / topic> < / will-topic> < / willretain> < / willflag> < / pwdflag> < / usrflag> < / encrypt> < / version> < / passwd> < / user> < / keepalive> < / id> < / port> < / host>
Claims
1. A communication method, applied to an embedded message queue telemetry transmission protocol MQTT client, the embedded MQTT client includes an MQTT client application programming interface, a prompt instruction module and multiple communication modules, the MQTT client application programming interface includes MQTT client creation, destruction, connection, subscription, publication, disconnection programming interfaces, characterized in that: include: Acquire first parameter information through the MQTT client application programming interface, where the first parameter information is used to determine a target communication module for communicating with the prompt instruction module; Controlling the prompt instruction module to communicate with the target communication module; Wherein, the multiple communication modules are configured in the same adaptation layer; the adaptation layer is a collection of communication terminals that have been adapted to the application programming interfaces of the multiple communication modules, providing the ability to control the communication terminals through the corresponding prompt AT instruction set; the adaptation function of each of the communication modules is a function that matches the function, parameter, and return value requirements of the MQTT application programming interface; Wherein, controlling the prompt instruction module to communicate with the target communication module includes: According to the target communication module, a target adaptation function corresponding to the target communication module is determined; the target adaptation function refers to a set of prompt instructions for communicating with the communication module through a hardware interface; the target adaptation function at least includes an execution instruction function, a reception instruction function and a parsing instruction function; the multiple communication modules included in the MQTT client are all abstract layer modules, and the abstract layer module identifies the corresponding target adaptation function according to the first parameter, and calls the corresponding target adaptation function; According to the target adaptation function, controlling the prompt instruction module to communicate with the target communication module; Among them, the communication module is able to use a first type of communication protocol and / or a second type of communication protocol; the first type of communication protocol includes: message queue telemetry transmission protocol MQTT; the second type of communication protocol includes at least one of the following: third generation mobile communication technology 3G, fourth generation mobile communication technology 4G, fifth generation mobile communication technology 5G, narrowband Internet of Things NB-IoT and wireless communication technology Wi-Fi; the communication module uses the first type of communication protocol, and communicates with the actual communication terminal through the prompt instruction module through at least one of the second type of communication protocols.
2. The method according to claim 1, characterized in that In the case where the target adaptation function is an execution instruction function, controlling the prompt instruction module to communicate with the target communication module according to the target adaptation function includes: Control the prompt instruction module and the target communication module to execute the operation corresponding to the execution instruction function through the preset interface transmission; The preset interface includes a universal asynchronous receiver / transmitter (UART) interface, a serial peripheral interface (SPI) interface, or a universal serial bus (USB) interface.
3. The method according to claim 1, characterized in that In the case where the target adaptation function is a receiving instruction function, controlling the prompt instruction module to communicate with the target communication module according to the target adaptation function includes: According to the receiving instruction function, controlling the prompt instruction module to receive the response data and / or the actively reported data sent by the target communication module; The response data is the response data after the target communication module executes at least one of the target adaptation functions; and the actively reported data is the response data after the target communication module does not execute the target adaptation function.
4. The method according to claim 3, characterized in that In the case where the target adaptation function is a parsing instruction function, controlling the prompt instruction module to communicate with the target communication module according to the target adaptation function further includes: According to the parsing instruction function, the prompt instruction module is controlled to parse the received response data and / or the actively reported data.
5. The method according to claim 1, characterized in that Also includes: Sending a first message to the MQTT server through the target communication module, wherein the first message includes a topic subscription message and / or a topic publishing message; The target communication module receives the prompt instruction fed back by the MQTT server.
6. A communication device, applied to an embedded message queue telemetry transmission protocol MQTT client, the embedded MQTT client includes an MQTT client application programming interface, a prompt instruction module and multiple communication modules, the MQTT client application programming interface includes MQTT client creation, destruction, connection, subscription, publication, disconnection programming interfaces, characterized in that: include: An acquisition module, used for acquiring first parameter information, where the first parameter information is used for determining a target communication module for communicating with the prompt instruction module; Obtaining the first parameter information through the MQTT client application programming interface; A control module, used for controlling the prompt instruction module to communicate with the target communication module; Wherein, the multiple communication modules are configured in the same adaptation layer; the adaptation layer is a collection of communication terminals that have been adapted to the application programming interfaces of the multiple communication modules, providing the ability to control the communication terminals through the corresponding prompt AT instruction set; the adaptation function of each of the communication modules is a function that matches the function, parameter, and return value requirements of the MQTT application programming interface; Wherein, the control module includes: A first determination unit is used to determine a target adaptation function corresponding to the target communication module according to the target communication module; the target adaptation function refers to a set of prompt instructions for communicating with the communication module through a hardware interface; the target adaptation function at least includes an execution instruction function, a reception instruction function and a parsing instruction function; the multiple communication modules included in the MQTT client are all abstract layer modules, and the abstract layer module identifies the corresponding target adaptation function according to the first parameter and calls the corresponding target adaptation function; A first control unit, configured to control the prompt instruction module to communicate with the target communication module according to the target adaptation function; Among them, the communication module is able to use a first type of communication protocol and / or a second type of communication protocol; the first type of communication protocol includes: message queue telemetry transmission protocol MQTT; the second type of communication protocol includes at least one of the following: third generation mobile communication technology 3G, fourth generation mobile communication technology 4G, fifth generation mobile communication technology 5G, narrowband Internet of Things NB-IoT and wireless communication technology Wi-Fi; the communication module uses the first type of communication protocol, and communicates with the actual communication terminal through the prompt instruction module through at least one of the second type of communication protocols.
7. A message queue telemetry transmission protocol MQTT client, characterized in that: include: A processor, a memory, and a program stored in the memory and executable on the processor, wherein when the program is executed by the processor, the steps of the communication method according to any one of claims 1 to 5 are implemented.
