CN115567619A - Communication method and device and message queue telemetry transmission protocol client - Google Patents
Communication method and device and message queue telemetry transmission protocol client Download PDFInfo
- Publication number
- CN115567619A CN115567619A CN202110748452.8A CN202110748452A CN115567619A CN 115567619 A CN115567619 A CN 115567619A CN 202110748452 A CN202110748452 A CN 202110748452A CN 115567619 A CN115567619 A CN 115567619A
- Authority
- CN
- China
- Prior art keywords
- module
- target
- communication
- communication module
- mqtt
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000004891 communication Methods 0.000 title claims abstract description 202
- 230000006854 communication Effects 0.000 title claims abstract description 202
- 238000000034 method Methods 0.000 title claims abstract description 46
- 230000005540 biological transmission Effects 0.000 title abstract description 17
- 230000006870 function Effects 0.000 claims description 89
- 230000006978 adaptation Effects 0.000 claims description 59
- 230000004044 response Effects 0.000 claims description 24
- 238000005516 engineering process Methods 0.000 claims description 16
- 238000010295 mobile communication Methods 0.000 claims description 13
- 230000002093 peripheral effect Effects 0.000 claims description 9
- 238000010586 diagram Methods 0.000 description 9
- 230000008569 process Effects 0.000 description 9
- 230000009471 action Effects 0.000 description 3
- 238000011161 development Methods 0.000 description 3
- 230000000694 effects Effects 0.000 description 2
- 238000001914 filtration Methods 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 230000001360 synchronised effect Effects 0.000 description 2
- 230000002159 abnormal effect Effects 0.000 description 1
- 230000003044 adaptive effect Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000007175 bidirectional communication Effects 0.000 description 1
- 238000004140 cleaning Methods 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 230000006378 damage Effects 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000000717 retained effect Effects 0.000 description 1
- 238000005070 sampling Methods 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/26—Special purpose or proprietary protocols or architectures
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/18—Multiprotocol handlers, e.g. single devices capable of handling multiple protocols
Landscapes
- Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computing Systems (AREA)
- Computer And Data Communications (AREA)
Abstract
The application provides a communication method, a communication device and a message queue telemetry transmission protocol client, and relates to the technical field of communication. The method is applied to a message queue telemetry transport protocol (MQTT) client, the MQTT client comprises a prompt instruction module and a plurality of communication modules, and the method comprises the following steps: acquiring first parameter information, wherein the first parameter information is used for determining a target communication module communicated with the prompt instruction module; and controlling the prompt instruction module to communicate with the target communication module. The technical scheme of this application is used on the client of a plurality of communication module, confirms corresponding target communication module through first parameter information, can directly realize with suggestion instruction module communication, has solved prior art's MQTT client and need can carry out data communication's drawback through specific protocol stack interface.
Description
Technical Field
The present application relates to the field of communications technologies, and in particular, to a communication method, an apparatus, and a message queue telemetry transport protocol client.
Background
The message queue telemetry transport protocol (MQTT) is widely applied to an embedded system of the Internet of things as an instant messaging protocol with low cost and low bandwidth occupation. With the continuous development of communication technology, more and more manufacturers support the MQTT protocol in the communication module, and provide an Attention (AT) instruction set to control the communication module to connect to the cloud platform and the server through the MQTT protocol. However, because the AT instruction sets of different types of communication modules have great differences, the portability of application software developed based on a specific AT instruction set is poor, and the update cost of products is high.
In the technical solutions of some existing embedded MQTT client implementation methods, an AT instruction set that controls a Transmission Control Protocol/Internet Protocol (TCP/IP) function in a package communication module is generally used as a socket interface, and then an MQTT Protocol and a client are implemented on the basis of the socket interface. The disadvantages of these schemes are that users are required to implement MQTT protocol and clients on the basis of sockets, which increases burden for writing network applications for users. Moreover, the MQTT protocol and the implementation of the client occupy more resources, which makes these schemes difficult to be applied in resource-intensive embedded systems.
In summary, the message queue telemetry transport protocol client in the prior art needs to communicate data through a specific protocol stack interface, but cannot directly communicate with the communication module having the MQTT protocol through the MQTT client, which results in poor portability of the communication module having the MQTT protocol in the prior art.
Disclosure of Invention
The embodiment of the application provides a communication method and device and a message queue telemetry transmission protocol client, so as to solve the problem that the message queue telemetry transmission protocol client in the prior art can only perform data communication through a specific protocol stack interface.
In order to solve the technical problem, the following technical scheme is adopted in the application:
the embodiment of the application provides a communication method, which is applied to a message queue telemetry transmission protocol client, wherein the message queue telemetry transmission server client comprises a prompt instruction module and a plurality of communication modules, and the method comprises the following steps:
acquiring first parameter information, wherein the first parameter information is used for determining a target communication module communicated with the prompt instruction module;
and controlling the prompt instruction module to communicate with the target communication module.
Optionally, the communication module can use a first type communication protocol and/or a second type communication protocol;
the first type of communication protocol includes: a message queue telemetry transport protocol;
the second type of communication protocol includes at least one of: the system comprises a third-generation mobile communication technology, a narrow-band Internet of things and a wireless communication technology.
Optionally, the controlling the prompt instruction module to communicate with the target communication module includes:
determining a target adaptation function corresponding to the target communication module according to the target communication module;
and controlling the prompt instruction module to communicate with the target communication module according to the target adaptation function.
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:
the prompt instruction module and the target communication module are controlled to execute the operation corresponding to the execution instruction function through transmission of a preset interface;
the preset interface comprises a universal asynchronous receiving and transmitting transmitter interface, a serial peripheral interface or a universal serial bus interface.
Optionally, when the target adaptation function is a received instruction function, the controlling, according to the target adaptation function, the prompt instruction module to communicate with the target communication module further includes:
controlling the prompt instruction module to receive response data and/or actively report data sent by the target communication module according to the received instruction function;
wherein, the response data is the response data after the target communication module executes at least one target adaptation function; the active reported data is response data of the target communication module number which does not execute the target adaptation function.
Optionally, when the target adaptation function is an analysis instruction function, the controlling, according to the target adaptation function, the prompt instruction module to communicate with the target communication module further includes:
and controlling the prompt instruction module to analyze the received response data and/or the actively reported data according to the analysis instruction function.
Optionally, the plurality of communication modules are configured in the same adaptation layer.
Optionally, the method further includes:
sending a first message to a message queue telemetry transmission protocol server through the target communication module, wherein the first message comprises a topic subscription message and/or a topic publishing message;
and receiving a prompt instruction fed back by the message queue telemetry transmission protocol server through the target communication module.
The embodiment of the present application further provides a communication device, which is applied to a client of a message queue telemetry transmission protocol, where the client includes a prompt instruction module and a plurality of communication modules, including:
the acquisition module is used for acquiring first parameter information, and the first parameter information is used for determining a target communication module which is communicated with the prompt instruction module;
and the control module is used for controlling the prompt instruction module to communicate with the target communication module.
An embodiment of the present application further provides a message queue telemetry transport protocol client, including: a processor, a memory and a program stored on the memory and executable on the processor, which program, when executed by the processor, carries out the steps of the communication method as described above.
Embodiments of the present application also provide a readable storage medium, which stores a program, and when the program is executed by a processor, the program implements the steps of the communication method as described above.
The beneficial effect of this application is:
in the above technical solution, the method is applied to a message queue telemetry transport protocol client, where the client includes a prompt instruction module and a plurality of communication modules, and includes: acquiring first parameter information, wherein the first parameter information is used for determining a target communication module which is communicated with the prompt instruction module; and controlling the prompt instruction module to communicate with the target communication module. According to the technical scheme, the corresponding target communication module is determined through the first parameter information, communication with the prompt instruction module can be directly achieved, and the defect that data communication can be carried out only through a specific protocol stack interface by a client in the prior art is overcome.
Drawings
Fig. 1 is a schematic system diagram of an MQTT client according to an embodiment of the present application;
fig. 2 is a schematic flowchart of a communication method according to an embodiment of the present application;
fig. 3 is a schematic connection diagram of an embedded system and a cloud platform according to an embodiment of the present disclosure;
FIG. 4 shows a workflow diagram of an embodiment of the MQTT client provided by an embodiment of the present application;
fig. 5 is a block diagram of a communication device according to an embodiment of the present disclosure.
Detailed Description
To make the technical problems, technical solutions and advantages to be solved by the present application clearer, the following detailed description is made with reference to the accompanying drawings and specific embodiments. In the following description, specific details such as specific configurations and components are provided only to facilitate a thorough understanding of embodiments of the present application. Accordingly, it will be apparent to those skilled in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present application. In addition, descriptions of well-known functions and constructions are omitted for clarity and conciseness.
It should be appreciated that reference throughout this specification to "one embodiment" or "an embodiment" means that a particular feature, structure or characteristic described in connection with the embodiment is included in at least one embodiment of the present application. Thus, the appearances of the phrases "in one embodiment" or "in an embodiment" in various places throughout this specification are not necessarily all referring to the same embodiment. Furthermore, the particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
In various embodiments of the present application, it should be understood that the sequence numbers of the following processes do not mean the execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
The application aims at the problem that a client of a message queue telemetry transmission protocol server in the prior art can only carry out data communication through a specific protocol stack interface, and provides a communication method, a communication device and a message queue telemetry transmission protocol client.
As shown in fig. 1, fig. 1 is a system diagram of a message queue telemetry transport protocol (MQTT) client, where the MQTT client includes: the MQTT client application programming interface 1, the MQTT application programming interface 2 comprises programming interfaces of MQTT client creation, destruction, connection, subscription, release, disconnection and the like, and provides basic capability of MQTT client application development; a plurality of communication modules 2, such as a first communication module, a second communication module and a third communication module, each of which includes a corresponding adaptation function; a prompt instruction module (AT instruction module) 3, which executes AT instructions according to the adaptation function of the communication module; further, the AT, that is, the Attention, AT command is a command for communication sent from a Terminal Equipment (Terminal Equipment, TE) or a Data Terminal Equipment (Data Terminal Equipment, DTE) to a Terminal Adapter (TA) or a Data Circuit Terminal Equipment (DCE); and a microcontroller not shown in the figure. In the system diagram, the communication module can be understood as an abstraction layer module having MQTT protocol, each abstraction module having a corresponding adaptation function. Here, a plurality of communication modules are arranged in the same MQTT communication module adaptation layer. The following method embodiments apply to the contents of the MQTT client-system diagram.
As shown in fig. 2, an embodiment of the present application provides a communication method, which is applied to an MQTT client of a message queue telemetry transport protocol, where the MQTT client includes a prompt instruction module (AT instruction module) and multiple communication modules, and includes:
and 200, controlling the prompt instruction module to communicate with the target communication module.
In this embodiment, in step 100, the MQTT client application programming interface 1 in fig. 1 may obtain first parameter information, identify a corresponding target communication module according to the first parameter information, and control the target communication module through the AT instruction module, so as to implement the MQTT client communication function.
It should be noted that the plurality of communication modules included in the MQTT client are all abstraction layer modules, and the abstraction layer modules identify corresponding target adaptation functions according to the first parameters, and call the corresponding target adaptation functions, so as to implement information interaction with the AT instruction module.
It should be understood that a communication module or a target communication module, which is not specifically explained in the present application, is understood to be an abstraction layer module with adaptation functions.
Specifically, the plurality of communication modules are configured on the same adaptation layer.
Further, the adaptation layer is a collection of communication terminals that have been adapted for application programming interfaces of a plurality of communication modules, providing the capability to control the communication terminals through respective AT instruction sets.
In this embodiment, the plurality of communication modules are configured in the same adaptation layer, that is, the communication modules with different function combinations are configured in the same adaptation layer, the adaptation function of each communication module is a function that is required by executing a specific AT instruction, and the adaptation function of each communication module is a function that matches functions, parameters, and return values of an MQTT application programming interface.
Specifically, the communication module can use a first type communication protocol and/or a second type communication protocol;
the first type of communication protocol includes: message queue telemetry transport protocol MQTT;
the second type of communication protocol includes at least one of: the mobile communication system comprises a third generation mobile communication technology 3G, a third generation mobile communication technology 4G, a third generation mobile communication technology 5G, a narrow-band internet of things NB-IoT and a wireless communication technology Wi-Fi.
Here, the communication module uses a first type communication protocol and communicates with an actual communication terminal through the AT instruction module via AT least one second type communication protocol, so that a process of building a TCP/IP network protocol stack is omitted, and a function of communicating with a communication terminal having the first type communication protocol and/or the second type communication protocol is realized.
Optionally, the step 200 includes:
step 210, determining a target adaptation function corresponding to the target communication module according to the target communication module;
it should be noted that the target adaptation function refers to a set of AT commands that communicate with the communication module through a hardware interface such as a serial port.
And step 220, controlling the prompt instruction module to communicate with the target communication module according to the target adaptation function.
In this embodiment, the prompt instruction module and the target communication module may be notified to communicate according to the instruction of the target adaptation function through the target adaptation function determined by the target communication module. Here, the target adaptation function includes at least an execution instruction function, a reception instruction function, and a parsing instruction function. According to each different instruction function, the communication contents of the prompt instruction module and the target communication module are different.
Specifically, in the case that the target adaptation function is an execution instruction function, the step 220 includes:
transmitting through a preset interface, and controlling the prompt instruction module and the target communication module to execute the operation corresponding to the execution instruction function;
the preset interface comprises a universal asynchronous receiver-transmitter (UART) interface, a Serial Peripheral Interface (SPI) interface or a Universal Serial Bus (USB) interface.
In this embodiment, the preset interface is arranged in a hardware driver layer of the MQTT client, and the preset interface includes one or more of a USB, an SPI, a UART, and the like.
USB, referred to as Universal Serial Bus (Universal Serial Bus), is an external Bus standard for connecting and communicating with external devices. SDIO, known as secure digital Input and Output card (secure digital Input and Output), defines a peripheral interface, mainly including two types of applications, i.e. removable and non-removable. SPI, collectively referred to as Serial Peripheral Interface (Serial Peripheral Interface), is a high-speed, full-duplex, synchronous communication bus. I2C, commonly referred to as a bi-directional two-wire synchronous serial bus (Inter-Integrated Circuit), is a communication bus that requires only two wires to communicate information between devices connected to the bus. UART, known as Universal Asynchronous Receiver/Transmitter (Universal Asynchronous Receiver/Transmitter), is a Universal serial data bus used for Asynchronous communication, and the bus performs bidirectional communication to realize full duplex transmission and reception.
Through the preset interface, data transmission can be carried out between the prompt instruction module and the target communication module, and communication connection between the prompt instruction module and the target communication module is controlled.
Specifically, in the case that the target adaptation function is a received instruction function, the step 220 includes:
controlling the prompt instruction module to receive response data and/or actively report data sent by the target communication module according to the received instruction function;
wherein, the response data is the response data after the target communication module executes at least one target adaptation function; the active reported data is response data of the target communication module number which does not execute the target adaptation function.
In this embodiment, the analysis or data cleaning may be performed according to the received response data and/or the actively reported data sent by the target communication module; here, the data cleansing includes: filtering data, wherein original data comprises response data and/or active report data sent by the target communication module, and filtering the response data sent by the target communication module; and data classification, wherein the active reported data comprises sampling data such as heartbeat data, state data of the target communication module, alarm data and the like, and whether the communication is abnormal can be determined.
Specifically, in the case that the target adaptation function is an analytic instruction function, the step 220 further includes:
and controlling the prompt instruction module to analyze the received response data and/or the actively reported data according to the analysis instruction function.
In this embodiment, data is mainly analyzed here to determine the result of the current communication. Furthermore, the analysis instruction function calls the prompt instruction module to receive the response data and/or the active report data, and takes the analysis result of the AT instruction analysis module as the basis of the return value of the analysis instruction function.
Optionally, the method further includes:
step 300, sending a first message to an MQTT server through the target communication module, wherein the first message comprises a topic subscription message and/or a topic publishing message;
and step 400, receiving a prompt instruction fed back by the MQTT server through the target communication module.
In this embodiment, before sending the first message to the MQTT server, the target communication module further needs to establish a communication connection with the MQTT server. The steps 300 to 400 are explained below in specific embodiments.
Specifically, an MQTT client is initialized, an MQTT client initialization interface is called, and various parameters of the MQTT client are set. The MQTT client identifies that a first target module needs to be called to initialize the adaptation function through a first parameter; the second step is that: connecting an MQTT agent (Broker), and calling an MQTT client connection interface; the third step: subscribing an MQTT topic, calling an MQTT client subscription interface through the step 300, or publishing an MQTT topic message and calling an MQTT client publishing interface to realize topic subscription message and/or topic publishing message through the first message; through the step 400, a prompt instruction fed back by the MQTT server is received, and corresponding operation is executed according to the fed-back prompt instruction. The method comprises the steps that subscribed MQTT messages are received, a target communication module actively reports the subscribed MQTT messages of a client according to feedback prompt instructions, the MQTT client receives the MQTT messages, executes corresponding callback functions to inform a user that the subscribed messages arrive, and executes corresponding processing. Of course, if the connection is to be disconnected, a second message may be sent to the MQTT server through the target communication module, where the second message includes the disconnection from the MQTT proxy.
In summary, the method of the application realizes the communication interaction of the MQTT client by directly calling the AT instruction set for controlling the MQTT related function in the communication module, and avoids the burden of additionally transplanting or realizing the MQTT protocol; the communication module adaptation layer realizes compatibility of various AT instruction sets, shields the difference of the AT instruction sets among different communication modules, and improves the development of application programs. The method and the device avoid the realization of an intermediate socket adaptation layer and an MQTT protocol, are light and concise, and are more suitable for the Internet of things embedded system with short resources.
In an embodiment, as shown in fig. 3, fig. 3 is a schematic diagram illustrating a connection between an embedded system and a cloud platform, where the embedded system includes: MQTT client 4, an actual communication module 5 and other peripherals and sensors 6; the MQTT client 4 is connected to an application program (which may be understood as a cloud platform application program) and an operating system on the basis of the client shown in fig. 1; the actual communication module 5 communicates with the communication module of the MQTT client 4. In the embedded system, information of an application program is obtained by calling an MQTT client application programming interface of the MQTT client 4, data of other peripherals and the sensor 6 are obtained through other related interfaces, and the obtained data is published to the cloud platform 7 through the MQTT client 4 and is subscribed to a related theme (Topic) to obtain data published by other terminal equipment.
Specifically, a workflow diagram of the MQTT client embodiment is illustrated by fig. 4, where the ML302 module is taken as an example to illustrate the workflow of the MQTT client embodiment, but the present invention is compatible with communication modules of different AT instruction sets, and is not limited thereto:
the first step is as follows: and initializing the MQTT client, calling an initialization interface of the MQTT client, and setting various parameters of the MQTT client. The MQTT client identifies that an ML302 module needs to be called to initialize an adaptation function through first parameter information, and the adaptation function executes a first AT instruction. The first AT command is as follows:
“AT+MQTTCFG=<host>,<port>,<id>,<keepAlive>,<user>,<passwd>,<
clean>,<version>,<encrypt>”。
the second step: the MQTT client is connected, and an MQTT client connection interface is called, wherein the MQTT connection is a preset cloud platform in the embodiment. And identifying a corresponding adaptation function through the first parameter information and executing a second AT instruction. The second AT command is:
“AT+MQTTOPEN=<usrFlag>,<pwdFlag>,<willFlag>,<willRetain>,<will
Qos>,<will-topic>,<will-mesg>”。
the third step: and (3) subscribing the MQTT client (topic subscription), calling an MQTT client subscription interface, and identifying a corresponding adaptation function through the first parameter information to execute a third AT instruction of 'AT + MQTTSUB = < topic >, < qos >'.
The fourth step: and (4) subscribing (topic publishing) by the MQTT client, calling a publishing interface of the MQTT client, and identifying a corresponding adaptation function through the first parameter information to execute a fourth AT instruction.
The fourth AT command is: "AT + mqtpub = < topic >, < qos >, < retain >, < dup >, < message >";
the fifth step: and the MQTT client receives the subscribed MQTT messages of the topics, and the communication module actively reports the subscribed MQTT messages of the topics to the client according to a fifth AT instruction.
The fifth AT command is:
“+MQTTPUBLISH:<dup>,<qos>,<retained>,<packId>,<topic>,<msg_le
n>,<mesg>”;
the MQTT client receives the MQTT message, executes the corresponding callback function to inform the user that the subscribed message arrives and executes the corresponding processing.
And a sixth step: the MQTT client is disconnected; namely, the connection with the cloud platform is disconnected, the MQTT client disconnection interface is called, and the corresponding adaptive function is identified through the first parameter information to execute the AT command of 'AT + MQTTDISC'.
Here, the embodiment of the present application is only an example of a communication module, and the present application supports communication of a plurality of communication modules capable of using a first type communication protocol and/or a second type communication protocol, so that direct communication between the communication modules and the MQTT client is realized.
As shown in fig. 5, an embodiment of the present application further provides a communication device, which is applied to an MQTT client of a message queue telemetry transport protocol, where the MQTT client includes a prompt instruction module and a plurality of communication modules, and includes:
an obtaining module 10, configured to obtain first parameter information, where the first parameter information is used to determine a target communication module that communicates with the prompt instruction module;
and the control module 20 is used for controlling the prompt instruction module to communicate with the target communication module.
It should be noted that the communication module can use a first type communication protocol and/or a second type communication protocol;
the first type of communication protocol includes: message queue telemetry transport protocol MQTT;
the second type of communication protocol includes at least one of: the mobile communication system comprises a third generation mobile communication technology 3G, a third generation mobile communication technology 4G, a third generation mobile communication technology 5G, a narrow-band Internet of things NB-IoT and a wireless communication technology Wi-Fi.
Optionally, the control module 20 includes:
the first determining unit is used for determining a target adaptation function corresponding to the target communication module according to the target communication module;
and the first control unit is used for controlling the prompt instruction module to communicate with the target communication module according to the target adaptation function.
Optionally, the first control unit includes:
the first control subunit is used for controlling the prompt instruction module and the target communication module to execute the operation corresponding to the execution instruction function through transmission of a preset interface;
the preset interface comprises a universal asynchronous receiver-transmitter (UART) interface, a Serial Peripheral Interface (SPI) interface or a Universal Serial Bus (USB) interface.
Optionally, the first control unit includes:
the second control subunit is used for controlling the prompt instruction module to receive response data and/or active report data sent by the target communication module according to the received instruction function;
wherein, the response data is the response data after the target communication module executes at least one target adaptation function; the active reported data is response data of the target communication module number which does not execute the target adaptation function.
Optionally, the first control unit further includes:
and the third control subunit is used for controlling the prompt instruction module to analyze the received response data and/or the actively reported data according to the analysis instruction function.
It should be noted that the plurality of communication modules are disposed in the same adaptation layer.
Optionally, the apparatus further comprises:
the sending module is used for sending a first message to the MQTT server through the target communication module, wherein the first message comprises a topic subscription message and/or a topic publishing message;
and the receiving module is used for receiving the prompt instruction fed back by the MQTT server through the target communication module.
An embodiment of the present application further provides a message queue telemetry transport protocol (MQTT) client, including: the processor, the memory and the program stored in the memory and capable of running on the processor implement the processes of the embodiment of the communication method described above when the program is executed by the processor, and can achieve the same technical effect, and the details are not repeated here to avoid repetition.
An embodiment of the present application further provides a readable storage medium, where a program is stored, and when the program is executed by a processor, the program implements the processes of the embodiment of the communication method described above, and can achieve the same technical effects, and in order to avoid repetition, details are not described here again. The readable storage medium may be a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "include", "including" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or terminal apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising one of 8230; \8230;" 8230; "does not exclude the presence of additional like elements in a process, method, article, or apparatus that comprises the element.
While the foregoing is directed to the preferred embodiment of the present application, it will be understood by those skilled in the art that various changes and modifications may be made without departing from the principles of the disclosure and, therefore, the scope of the disclosure is to be defined by the appended claims.
Claims (10)
1. A communication method is applied to a message queue telemetry transport protocol (MQTT) client, wherein the MQTT client comprises a prompt instruction module and a plurality of communication modules, and the communication method is characterized by comprising the following steps:
acquiring first parameter information, wherein the first parameter information is used for determining a target communication module which is communicated with the prompt instruction module;
and controlling the prompt instruction module to communicate with the target communication module.
2. The method according to claim 1, characterized in that the communication module is capable of using a first type of communication protocol and/or a second type of communication protocol;
the first type of communication protocol includes: message queue telemetry transport protocol MQTT;
the second type of communication protocol includes at least one of: the mobile communication system comprises a third generation mobile communication technology 3G, a third generation mobile communication technology 4G, a third generation mobile communication technology 5G, a narrow-band internet of things NB-IoT and a wireless communication technology Wi-Fi.
3. The method of claim 1, wherein the controlling the cued instruction module to communicate with the target communication module comprises:
determining a target adaptation function corresponding to the target communication module according to the target communication module;
and controlling the prompt instruction module to communicate with the target communication module according to the target adaptation function.
4. The method according to claim 3, wherein in a case that the target adaptation function is an execution instruction function, said controlling the prompt instruction module to communicate with the target communication module according to the target adaptation function comprises:
transmitting through a preset interface, and controlling the prompt instruction module and the target communication module to execute the operation corresponding to the execution instruction function;
the preset interface comprises a universal asynchronous receiver-transmitter (UART) interface, a Serial Peripheral Interface (SPI) interface or a Universal Serial Bus (USB) interface.
5. The method according to claim 3, wherein in a case that the target adaptation function is a received instruction function, the controlling the prompt instruction module to communicate with the target communication module according to the target adaptation function comprises:
controlling the prompt instruction module to receive response data and/or actively report data sent by the target communication module according to the received instruction function;
wherein, the response data is the response data after the target communication module executes at least one target adaptation function; the active reported data is response data of the target communication module number which does not execute the target adaptation function.
6. The method according to claim 5, wherein in a case that 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 comprises:
and controlling the prompt instruction module to analyze the received response data and/or the actively reported data according to the analysis instruction function.
7. The method of claim 1, wherein the plurality of communication modules are configured in a same adaptation layer.
8. The method of claim 1, further comprising:
sending a first message to an MQTT server through the target communication module, wherein the first message comprises a topic subscription message and/or a topic publishing message;
and receiving a prompt instruction fed back by the MQTT server through the target communication module.
9. The utility model provides a communication device, is applied to message queue telemetry transport protocol MQTT customer end, MQTT customer end is including suggestion instruction module and a plurality of communication module, its characterized in that includes:
the acquisition module is used for acquiring first parameter information, and the first parameter information is used for determining a target communication module which is communicated with the prompt instruction module;
and the control module is used for controlling the prompt instruction module to communicate with the target communication module.
10. A message queue telemetry transport protocol, MQTT, client, comprising: processor, memory and program stored on the memory and executable on the processor, which when executed by the processor implements the steps of the communication method according to any of claims 1 to 8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110748452.8A CN115567619A (en) | 2021-07-01 | 2021-07-01 | Communication method and device and message queue telemetry transmission protocol client |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110748452.8A CN115567619A (en) | 2021-07-01 | 2021-07-01 | Communication method and device and message queue telemetry transmission protocol client |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115567619A true CN115567619A (en) | 2023-01-03 |
Family
ID=84737030
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110748452.8A Pending CN115567619A (en) | 2021-07-01 | 2021-07-01 | Communication method and device and message queue telemetry transmission protocol client |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115567619A (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN202309736U (en) * | 2011-10-25 | 2012-07-04 | 康才畯 | Intelligent terminal of Internet of things |
CN207541442U (en) * | 2017-09-29 | 2018-06-26 | 嘉兴天控信息科技有限公司 | A kind of intelligent acquisition control system based on MQTT transport protocols |
CN112333237A (en) * | 2020-09-30 | 2021-02-05 | 宇龙计算机通信科技(深圳)有限公司 | 5G industrial module and electronic equipment |
GB202105097D0 (en) * | 2021-04-09 | 2021-05-26 | Vodafone Group Services Ltd | Secure sensor data distribution |
-
2021
- 2021-07-01 CN CN202110748452.8A patent/CN115567619A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN202309736U (en) * | 2011-10-25 | 2012-07-04 | 康才畯 | Intelligent terminal of Internet of things |
CN207541442U (en) * | 2017-09-29 | 2018-06-26 | 嘉兴天控信息科技有限公司 | A kind of intelligent acquisition control system based on MQTT transport protocols |
CN112333237A (en) * | 2020-09-30 | 2021-02-05 | 宇龙计算机通信科技(深圳)有限公司 | 5G industrial module and electronic equipment |
GB202105097D0 (en) * | 2021-04-09 | 2021-05-26 | Vodafone Group Services Ltd | Secure sensor data distribution |
Non-Patent Citations (3)
Title |
---|
佚名: "BMG8200智慧路灯杆网关", Retrieved from the Internet <URL:http://1500536942.spaces.eepw.com.cn/articles/article/item/197278> * |
白昊;屈军锁;孙阳;占伟;: "基于串口转WiFi的物联网终端远程控制实现方法", 计算机测量与控制, no. 01, 25 January 2017 (2017-01-25) * |
谭宸;孙小进;姜楠;郭朋飞;: "基于MQTT协议的战场环境监测系统", 单片机与嵌入式系统应用, no. 03, 1 March 2020 (2020-03-01) * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107231606B (en) | WiFi network access method, intelligent hardware equipment and electronic terminal | |
WO2019205907A1 (en) | Intelligent device communication platform based on mqtt message protocol | |
CN105763619B (en) | The method and device that client and server-side are communicated | |
CN102035893A (en) | Method and system for pushing data actively by server | |
WO2005089139A2 (en) | Remote usb port system and method | |
US10594768B2 (en) | Method and apparatus of performing remote command dispatching | |
CN111064771B (en) | Network request processing method and system | |
CN103312528A (en) | Heartbeat message sending method and user terminal | |
CN110557321B (en) | Information transmission method, network equipment and terminal | |
US8156209B1 (en) | Aggregation devices processing keep-alive messages of point-to-point sessions | |
CN108989157B (en) | Method and device for controlling intelligent equipment | |
CN106657076B (en) | TCP service implementation method and device for network name space | |
CN111404739B (en) | System for configuring serial port networking attribute | |
CN115567619A (en) | Communication method and device and message queue telemetry transmission protocol client | |
CN114157725B (en) | Method, device, server, electronic equipment and storage medium for equipment linkage | |
CN101465783B (en) | Connection method, device and connection network bridge for isomery household network appliances | |
CN113885816A (en) | Method, system, device and storage medium for printing by virtual printing device | |
CN111030925B (en) | Multi-gateway communication method and system based on remote procedure call | |
CN114281563A (en) | Application program reconstruction method and device | |
CN112565458B (en) | Platform remote control method and device, storage medium and electronic equipment | |
CN112637086B (en) | Communication method, system and medium based on module automatic compiling | |
CN114900558A (en) | Universal equipment management protocol control method and device | |
WO2012051840A1 (en) | Protocol stack system for simple mail transfer protocol (smtp) and implementation method thereof | |
CN117135011B (en) | Method for adapting gateway to multiple cloud platforms based on MQTT communication and gateway system | |
CN112187698B (en) | Communication method, service system, electronic equipment and host MCU (micro control Unit) of electronic equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |