CN118264722A - Multi-protocol adaptation method and device for Internet of things equipment and related equipment - Google Patents

Multi-protocol adaptation method and device for Internet of things equipment and related equipment Download PDF

Info

Publication number
CN118264722A
CN118264722A CN202211675564.6A CN202211675564A CN118264722A CN 118264722 A CN118264722 A CN 118264722A CN 202211675564 A CN202211675564 A CN 202211675564A CN 118264722 A CN118264722 A CN 118264722A
Authority
CN
China
Prior art keywords
internet
client
things
message
communication protocol
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
Application number
CN202211675564.6A
Other languages
Chinese (zh)
Inventor
毛健杰
周涛
马号
马姣
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Mobile Communications Group Co Ltd
China Mobile IoT Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile IoT Co Ltd
Filing date
Publication date
Application filed by China Mobile Communications Group Co Ltd, China Mobile IoT Co Ltd filed Critical China Mobile Communications Group Co Ltd
Publication of CN118264722A publication Critical patent/CN118264722A/en
Pending legal-status Critical Current

Links

Abstract

The application discloses a multi-protocol adaptation method for Internet of things equipment and related equipment. The method comprises the following steps: receiving a first message of a client through a websocket communication protocol, wherein the first message comprises a communication protocol type of the client; generating a simulation client corresponding to the client according to the first message, wherein the simulation client and the communication protocol of the client are the same in type; and handshaking is carried out between the simulation client and the corresponding Internet of things equipment. In this way, the simulation client corresponding to the communication protocol is generated at the server, and then the simulation client corresponding to the communication protocol bridges the client and the Internet of things equipment, so that the compatibility of the Internet of things equipment with various communication protocols is improved.

Description

Multi-protocol adaptation method and device for Internet of things equipment and related equipment
Technical Field
The application relates to the technical field of the Internet of things, in particular to an Internet of things equipment multi-protocol adaptation method and related equipment.
Background
In the process of debugging the internet of things equipment, a corresponding communication protocol needs to be established with the internet of things equipment. Different internet of things devices may have communication modules of different communication protocol types.
In order to enable staff to conveniently debug the Internet of things equipment, a webpage mode is adopted for a client in the Internet of things platform, and the problem that when the client is used as an application program, the application program needs to be downloaded first is avoided.
But the client is used for debugging the Internet of things equipment for the webpage end, and the debugging work of the Internet of things equipment with certain communication protocols cannot be supported due to the environment of the webpage end.
Therefore, when the client in the internet of things platform adopts a webpage mode and has internet of things equipment with various communication protocols, the problem of low compatibility of the client exists.
Disclosure of Invention
The embodiment of the application aims to provide a multi-protocol adaptation method for Internet of things equipment and related equipment, which are used for solving the problem of low compatibility of clients when the clients in an Internet of things platform adopt a webpage mode and have the Internet of things equipment with multiple communication protocols.
In a first aspect, an embodiment of the present application provides a method for adapting multiple protocols of an internet of things device, where the method includes:
Receiving a first message of a client through a websocket communication protocol, wherein the first message comprises a communication protocol type of the client;
Generating a simulation client corresponding to the client according to the first message, wherein the simulation client and the communication protocol of the client are the same in type;
and handshaking is carried out between the simulation client and the corresponding Internet of things equipment.
Optionally, after the handshake is performed between the simulation client and the corresponding internet of things device, the method further includes:
Receiving a second message sent by the Internet of things equipment, wherein the second message comprises state information of the Internet of things equipment;
And sending the second message to the client.
Optionally, before the first message of the client is received through the websocket communication protocol, the method further includes:
receiving a request message of the client, wherein the request message comprises version information of a websocket communication protocol of the client;
And establishing the websocket communication protocol with the client according to the version information of the websocket communication protocol of the client.
Optionally, after the handshake is performed between the simulation client and the corresponding internet of things device, the method further includes:
Receiving an operation instruction input by a user through the client, wherein the operation instruction is used for controlling the Internet of things equipment to be online, offline or reporting self state information;
and sending the operation instruction to the Internet of things equipment.
Optionally, after receiving the second message sent by the internet of things device, the method further includes:
generating instance information of the Internet of things equipment;
And deleting the instance information of the Internet of things equipment and sending third information to the Internet of things equipment under the condition that the instance information exceeds a preset time length and is not updated, wherein the third information is used for controlling the Internet of things equipment to be offline.
Optionally, after generating the instance information of the internet of things device, the method further includes:
The instance information is sent to the client and is used for displaying on an operation interface of the client;
And generating prompt information through the client according to the instance information, wherein the prompt information is used for prompting a user to reconnect the Internet of things equipment.
In a second aspect, an embodiment of the present application provides a multi-protocol adaptation device for an internet of things device, where the device includes:
the first receiving module is used for receiving a first message of a client through a websocket communication protocol, wherein the first message comprises a communication protocol type of the client;
the first generation module is used for generating a simulation client corresponding to the client according to the first message, wherein the simulation client and the client have the same communication protocol type;
And the handshake module is used for handshake with the corresponding internet of things equipment through the simulation client.
Optionally, the internet of things device multi-protocol adaptation method further includes:
The second receiving module is used for receiving a second message sent by the Internet of things equipment, wherein the second message comprises state information of the Internet of things equipment;
and the first sending module is used for sending the second message to the client.
Optionally, the internet of things device multi-protocol adaptation method further includes:
A third receiving module, configured to receive a request message of the client, where the request message includes version information of a websocket communication protocol of the client;
the establishing module is used for establishing the websocket communication protocol with the client according to the version information of the websocket communication protocol of the client.
Optionally, the internet of things device multi-protocol adaptation method further includes:
The fourth receiving module is used for receiving an operation instruction input by a user through the client, and the operation instruction is used for controlling the Internet of things equipment to be on line, off line or report the state information of the Internet of things equipment;
and the second sending module is used for sending the operation instruction to the Internet of things equipment.
Optionally, the internet of things device multi-protocol adaptation method further includes:
the second generation module is used for generating instance information of the Internet of things equipment;
The deleting and sending module is used for deleting the instance information of the internet of things equipment and sending third information to the internet of things equipment under the condition that the instance information is not updated for more than a preset time length, and the third information is used for controlling the internet of things equipment to be disconnected.
Optionally, the internet of things device multi-protocol adaptation method further includes:
The third sending module is used for sending the instance information to the client, wherein the instance information is used for displaying an operation interface of the client;
And the prompt module is used for generating prompt information through the client according to the instance information, and the prompt information is used for prompting a user to reconnect the Internet of things equipment.
In a third aspect, an embodiment of the present application provides a server, including: the system comprises a memory, a processor and a program stored in the memory and capable of running on the processor, wherein the processor is used for executing the program in the memory to realize the steps of the multi-protocol adaptation method of the internet of things equipment.
In a fourth aspect, an embodiment of the present application provides an internet of things platform, including a server, where the server executes a step of the internet of things device multiprotocol adaptation method of any one of the above.
In a fifth aspect, an embodiment of the present application provides a readable storage medium, configured to store a program, where the program when executed by a processor implements the steps of the method for adapting multiple protocols of an internet of things device according to any one of the above.
In the embodiment of the application, a first message of a client is received through a websocket communication protocol, wherein the first message comprises the communication protocol type of the client; generating a simulation client corresponding to the client according to the first message, wherein the simulation client and the communication protocol of the client are the same in type; and handshaking is carried out between the simulation client and the corresponding Internet of things equipment. In this way, the simulation client corresponding to the communication protocol is generated at the server, and then the simulation client corresponding to the communication protocol bridges the client and the Internet of things equipment, so that the compatibility of the Internet of things equipment with various communication protocols is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the description of the embodiments of the present application will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic flow chart of a multi-protocol adaptation method of an internet of things device according to an embodiment of the present application;
Fig. 2 is a schematic structural diagram of a multi-protocol adaptation device of an internet of things device according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of a server according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the application. All other embodiments, which are derived by a person skilled in the art from the embodiments according to the application without creative efforts, fall within the protection scope of the application.
Unless defined otherwise, technical or scientific terms used herein should be given the ordinary meaning as understood by one of ordinary skill in the art to which this application belongs. The terms "first," "second," and the like, as used herein, do not denote any order, quantity, or importance, but rather are used to distinguish one element from another. "upper", "lower", "left", "right", etc. are used merely to indicate a relative positional relationship, which changes accordingly when the absolute position of the object to be described changes.
Referring to fig. 1, fig. 1 is a flowchart of a multi-protocol adaptation method for an internet of things device according to an embodiment of the present application, as shown in fig. 1, including the following steps:
step 101, receiving a first message of a client through a websocket communication protocol, wherein the first message comprises a communication protocol type of the client;
optionally, in some embodiments, the plurality of users are at a plurality of clients
Step 102, generating a simulation client corresponding to the client according to the first message, wherein the simulation client and the communication protocol of the client are the same in type;
optionally, in some embodiments, a device class is first implemented, where the device class has private properties such as a device type, a device identifier, an authentication key, and the like, and has methods of connection, disconnection, reporting of a message, and message timeout detection. And then, respectively realizing four subclasses of the equipment class, and rewriting access, disconnection and reporting methods of different communication protocols.
Optionally, the server side analyzes, judges and executes the behavior logic corresponding to the client side of the simulation equipment by receiving the data of different message channels, realizes the interaction with the access machine, and returns the receipt message to the client side. Each WebSocket communication protocol connection corresponds to one equipment instance, the server stores the instance in the memory for standby, and when the connection is disconnected, the server automatically disconnects the instance from the access machine and clears instance data in the memory. The method comprises the steps that each time of data exchange between a client and a server, the server updates the active time of an instance once, the server detects the active time of each instance at fixed time, if the set time limit (10 minutes) is exceeded, the server also disconnects equipment and an access machine and clears the instance, and meanwhile, the client is informed to prompt a user to reconnect so as to prevent the memory of the server from leaking.
And step 103, handshaking is carried out between the simulation client and the corresponding Internet of things equipment.
In the embodiment of the application, a first message of a client is received through a websocket communication protocol, wherein the first message comprises the communication protocol type of the client; generating a simulation client corresponding to the client according to the first message, wherein the simulation client and the communication protocol of the client are the same in type; and handshaking is carried out between the simulation client and the corresponding Internet of things equipment. In this way, the simulation client corresponding to the communication protocol is generated at the server, and then the simulation client corresponding to the communication protocol bridges the client and the Internet of things equipment, so that the compatibility of the Internet of things equipment with various communication protocols is improved.
Optionally, after the handshake is performed between the simulation client and the corresponding internet of things device, the method further includes:
Receiving a second message sent by the Internet of things equipment, wherein the second message comprises state information of the Internet of things equipment;
And sending the second message to the client.
Optionally, before the first message of the client is received through the websocket communication protocol, the method further includes:
receiving a request message of the client, wherein the request message comprises version information of a websocket communication protocol of the client;
And establishing the websocket communication protocol with the client according to the version information of the websocket communication protocol of the client.
In the embodiment of the application, an on-line and off-line message channel of the equipment, a report message channel of the equipment and a receipt message channel are defined. In the online and offline messages, the communication protocol type of the current equipment is identified; in the service side receipt message, an action field identifier is defined to distinguish various device behaviors, including online/offline/reporting the message/receiving a command/device response. The page sends the relevant parameters to the appointed channel, the server side performs subsequent interaction with the access machine, and returns the access machine information to the client side in real time, so that bridging between the web page of the client side and the access machine is realized.
Optionally, after the handshake is performed between the simulation client and the corresponding internet of things device, the method further includes:
Receiving an operation instruction input by a user through the client, wherein the operation instruction is used for controlling the Internet of things equipment to be online, offline or reporting self state information;
and sending the operation instruction to the Internet of things equipment.
Optionally, after receiving the second message sent by the internet of things device, the method further includes:
generating instance information of the Internet of things equipment;
And deleting the instance information of the Internet of things equipment and sending third information to the Internet of things equipment under the condition that the instance information exceeds a preset time length and is not updated, wherein the third information is used for controlling the Internet of things equipment to be offline.
Optionally, after generating the instance information of the internet of things device, the method further includes:
The instance information is sent to the client and is used for displaying on an operation interface of the client;
And generating prompt information through the client according to the instance information, wherein the prompt information is used for prompting a user to reconnect the Internet of things equipment.
And the fifth step, the client realizes a simulation device graphical operation interface, mainly comprising three modules, namely a product and a device selection module, wherein the gateway device further comprises a selection control of a sub-device below the gateway device, a product created by a user and a device created below the product are selected, and the second step is a device object model display, input and message type selection module, after the device connection is established, the user selects a designated message type (attribute report/expected acquisition/event report) and a corresponding object model function point, the value to be uploaded is filled in, a report button is clicked, the client checks the filled value according to a preset object model, and the message is transmitted back to the server through a device report message channel, and is reported to the access machine by the server. And thirdly, a debugging log display module is used for displaying interaction logs of the simulation equipment and the access machine, providing key information of a debugging stage for a developer, and enabling a clearing button to clear the current page log.
Optionally, in some embodiments, the client implements a graphical operation interface for simulating an application, and mainly includes three modules, a first module for selecting a product and a device, and selecting a product created by a user and a device created under the product, and a second module for displaying, inputting and controlling a command type, and selecting a specified command type (attribute setting/attribute obtaining/attribute expected value setting/service calling) and a corresponding object model function point by the user, filling a value to be issued, clicking a corresponding button, calling a corresponding interface of the server, and receiving a request to invoke an access capability by the server to issue a control command to the device. And thirdly, a debugging log display module displays a simulated application issuing message and a device return message log, and a clearing button can clear the current page log.
In a second aspect, an embodiment of the present application provides a multi-protocol adaptation device for an internet of things device, where the device includes:
the first receiving module is used for receiving a first message of a client through a websocket communication protocol, wherein the first message comprises a communication protocol type of the client;
the first generation module is used for generating a simulation client corresponding to the client according to the first message, wherein the simulation client and the client have the same communication protocol type;
And the handshake module is used for handshake with the corresponding internet of things equipment through the simulation client.
Optionally, the internet of things device multi-protocol adaptation method further includes:
The second receiving module is used for receiving a second message sent by the Internet of things equipment, wherein the second message comprises state information of the Internet of things equipment;
and the first sending module is used for sending the second message to the client.
Optionally, the internet of things device multi-protocol adaptation method further includes:
A third receiving module, configured to receive a request message of the client, where the request message includes version information of a websocket communication protocol of the client;
the establishing module is used for establishing the websocket communication protocol with the client according to the version information of the websocket communication protocol of the client.
Optionally, the internet of things device multi-protocol adaptation method further includes:
The fourth receiving module is used for receiving an operation instruction input by a user through the client, and the operation instruction is used for controlling the Internet of things equipment to be on line, off line or report the state information of the Internet of things equipment;
and the second sending module is used for sending the operation instruction to the Internet of things equipment.
Optionally, the internet of things device multi-protocol adaptation method further includes:
the second generation module is used for generating instance information of the Internet of things equipment;
The deleting and sending module is used for deleting the instance information of the internet of things equipment and sending third information to the internet of things equipment under the condition that the instance information is not updated for more than a preset time length, and the third information is used for controlling the internet of things equipment to be disconnected.
Optionally, the internet of things device multi-protocol adaptation method further includes:
The third sending module is used for sending the instance information to the client, wherein the instance information is used for displaying an operation interface of the client;
And the prompt module is used for generating prompt information through the client according to the instance information, and the prompt information is used for prompting a user to reconnect the Internet of things equipment.
The multi-protocol adaptation device 200 for the internet of things equipment provided by the embodiment of the present application can implement each process in the above method embodiment, and in order to avoid repetition, a description thereof is omitted here.
Referring to fig. 3, fig. 3 is a schematic structural diagram of a server according to an embodiment of the present application, including: a processor 301, a memory 302, and a program 3021 stored on the memory 302 and executable on the processor 301.
The program 3021, when executed by the processor 301, may implement any steps and achieve the same advantageous effects in the method embodiment corresponding to fig. 1, which will not be described herein.
Those of ordinary skill in the art will appreciate that all or a portion of the steps of implementing the methods of the embodiments described above may be implemented by hardware associated with program instructions, where the program may be stored on a readable medium.
The embodiment of the application provides an Internet of things platform, which comprises a server, wherein the server executes any step in the embodiment of the method corresponding to the figure 1.
The embodiment of the present application further provides a readable storage medium, where a computer program is stored, where the computer program when executed by a processor may implement any step in the method embodiment corresponding to fig. 1, and may achieve the same technical effect, so that repetition is avoided, and no further description is given here.
The computer-readable storage media of embodiments of the present application may take the form of any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. The computer readable storage medium may be, for example, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of the computer-readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a storage medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations of the present application may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or terminal. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
While the foregoing is directed to the preferred embodiments of the present application, it will be appreciated by those skilled in the art that various modifications and adaptations can be made without departing from the principles of the present application, and such modifications and adaptations are intended to be comprehended within the scope of the present application.

Claims (10)

1. A method for multi-protocol adaptation of an internet of things device, the method comprising:
Receiving a first message of a client through a websocket communication protocol, wherein the first message comprises a communication protocol type of the client;
Generating a simulation client corresponding to the client according to the first message, wherein the simulation client and the communication protocol of the client are the same in type;
and handshaking is carried out between the simulation client and the corresponding Internet of things equipment.
2. The method for multi-protocol adaptation of an internet of things device according to claim 1, wherein after the handshake with the corresponding internet of things device by the simulation client, further comprises:
Receiving a second message sent by the Internet of things equipment, wherein the second message comprises state information of the Internet of things equipment;
And sending the second message to the client.
3. The internet of things device multi-protocol adaptation method according to claim 1, further comprising, before the receiving the first message of the client via the websocket communication protocol:
receiving a request message of the client, wherein the request message comprises version information of a websocket communication protocol of the client;
And establishing the websocket communication protocol with the client according to the version information of the websocket communication protocol of the client.
4. The internet of things device multi-protocol adaptation method according to claim 1, wherein after the handshaking with the corresponding internet of things device through the simulation client, the method further comprises:
Receiving an operation instruction input by a user through the client, wherein the operation instruction is used for controlling the Internet of things equipment to be online, offline or reporting self state information;
and sending the operation instruction to the Internet of things equipment.
5. The method for multi-protocol adaptation of an internet of things device according to claim 2, wherein after receiving the second message sent by the internet of things device, further comprises:
generating instance information of the Internet of things equipment;
And deleting the instance information of the Internet of things equipment and sending third information to the Internet of things equipment under the condition that the instance information exceeds a preset time length and is not updated, wherein the third information is used for controlling the Internet of things equipment to be offline.
6. The method for multi-protocol adaptation of an internet of things device according to claim 5, wherein after generating the instance information of the internet of things device, further comprising:
The instance information is sent to the client and is used for displaying on an operation interface of the client;
And generating prompt information through the client according to the instance information, wherein the prompt information is used for prompting a user to reconnect the Internet of things equipment.
7. An internet of things device multi-protocol adaptation apparatus, the apparatus comprising:
the first receiving module is used for receiving a first message of a client through a websocket communication protocol, wherein the first message comprises a communication protocol type of the client;
the first generation module is used for generating a simulation client corresponding to the client according to the first message, wherein the simulation client and the client have the same communication protocol type;
And the handshake module is used for handshake with the corresponding internet of things equipment through the simulation client.
8. A server, comprising: a memory, a processor and a program stored on the memory and executable on the processor, wherein the processor is configured to execute the steps of the method for implementing the multi-protocol adaptation method of the internet of things device according to any one of claims 1 to 6.
9. An internet of things platform, comprising a server, the server executing the steps of the internet of things device multi-protocol adaptation method according to any one of claims 1 to 6.
10. A readable storage medium storing a program, wherein the program when executed by a processor implements the steps of the internet of things device multiprotocol adaptation method according to any one of claims 1 to 6.
CN202211675564.6A 2022-12-26 Multi-protocol adaptation method and device for Internet of things equipment and related equipment Pending CN118264722A (en)

Publications (1)

Publication Number Publication Date
CN118264722A true CN118264722A (en) 2024-06-28

Family

ID=

Similar Documents

Publication Publication Date Title
CN100527690C (en) System and method for controlling infomation processing apparatus
JP2017530487A (en) System and method for secure real-time cloud service
CN104536890B (en) Test system, method and apparatus
CN104462237B (en) Show the method and device of public's message
CN113256095B (en) Draggable configuration agile flow service construction method, system, equipment and medium
CN106406851A (en) Webpage image capture method and system
CN104144087A (en) Remote desktop detection system and detection method thereof
CN112437047A (en) Remote server management method, system and related device
CN110708158B (en) Method for remotely maintaining charging pile based on SSH reverse tunnel technology
CN108667817A (en) Message converting system and message forwarding method
CN115333787A (en) Automatic safety testing method, system and storage medium for 5G industrial control network system
CN208188814U (en) A kind of embedded device and its remote update system
CN113691602A (en) Service processing method, system, device, equipment and medium based on cloud mobile phone
CN113296744A (en) Application development system and method
CN112650653A (en) Plug-and-play and visual operation and maintenance system and method for equipment
CN104301419A (en) Non-local-machine remote download control system and method
CN118264722A (en) Multi-protocol adaptation method and device for Internet of things equipment and related equipment
CN106488269A (en) System and method to television equipment control is realized based on third-party application platform
CN116233209A (en) Remote management scheduling method for GPU cloud rendering service
CN108737337B (en) Equipment processing method, device, server and system
CN114679472A (en) Communication system, method, apparatus, storage medium, and electronic device
CN104516883A (en) Webpage sharing method, device and system
CN108092858B (en) For switching the method and device of agent node
CN113672225A (en) User interface processing method, device, equipment and storage medium
CN114691486A (en) Program debugging method and device and computer equipment

Legal Events

Date Code Title Description
PB01 Publication