Internet of Things device access method, device, electronic device and storage medium
By deploying protocol plug-ins and dynamically loading access protocols on the IoT server, messages from IoT devices are directly processed, solving the problem of low efficiency of protocol conversion gateways and achieving efficient and fast device access and data transmission.
Patent Information
- Application Number
- CN202211600986.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-12
- Publication Date
- 2024-10-25
- Estimated Expiration
- 2042-12-12
AI Technical Summary
When an IoT device is connected to an IoT server, the protocol conversion gateway needs to adapt to multiple protocols, resulting in low access efficiency and high cost, which affects the data transmission speed of the device.
Deploy protocol plug-ins on the IoT server, dynamically load access protocols, and directly process messages from IoT devices through protocol ports, eliminating the need for protocol conversion steps and achieving direct access.
It improves the efficiency and speed of IoT devices accessing IoT servers, reduces access costs, enhances horizontal expansion capabilities, and simplifies protocol management.
Smart Images

Figure CN116016005B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of Internet of Things, and in particular to an Internet of Things device access method, device, electronic device and storage medium. Background Art
[0002] With the continuous development of IoT technology and the rapid growth of the number of IoT devices, the access protocols used by IoT devices to access IoT servers have also become diverse. Different industries have their own industry access protocols, and different enterprises also have their own private access protocols. Different access protocols have different data transmission standards. The IoT server is a platform for unified access of IoT devices, facing the problem of many types of protocols and difficult adaptation. In related technologies, the IoT server needs to deploy an additional protocol conversion gateway to uniformly convert the access protocols used by different IoT devices into the MQTT (Message Queuing Telemetry Transport) protocol, and then the IoT devices can be connected to the IoT server to meet the data transmission in various business scenarios. The protocol conversion gateway needs to perform protocol conversion for each data interaction when the IoT device accesses the IoT server. The slow protocol conversion speed affects the efficiency of IoT devices accessing the IoT server. Summary of the invention
[0003] The embodiments of the present application provide an Internet of Things device access method, device, electronic device and storage medium to solve the problems existing in the related technologies.
[0004] In the first aspect, an embodiment of the present application provides an Internet of Things device access method, which is applied to an Internet of Things server, including: obtaining a protocol plug-in corresponding to an access protocol; loading the protocol plug-in and configuring a protocol port to deploy the access protocol; based on the deployed access protocol, processing messages transmitted when the Internet of Things device accesses the Internet of Things server.
[0005] In the second aspect, an embodiment of the present application provides an Internet of Things device access method, which is applied to an Internet of Things server, including: obtaining messages transmitted by the Internet of Things device through a protocol port; determining an access protocol deployed corresponding to the protocol port; and decoding messages transmitted by the Internet of Things device based on the deployed access protocol.
[0006] In the third aspect, an embodiment of the present application provides an Internet of Things device access device, which is deployed on an Internet of Things server, and includes: an acquisition unit, configured to acquire a protocol plug-in corresponding to an access protocol; a deployment unit, configured to load the protocol plug-in and configure a protocol port to deploy the access protocol; and a processing unit, configured to process messages transmitted when the Internet of Things device accesses the Internet of Things server based on the deployed access protocol.
[0007] In a fourth aspect, an embodiment of the present application provides an Internet of Things device access device, which is deployed on an Internet of Things server, and includes: a message acquisition unit, configured to acquire messages transmitted by the Internet of Things device through a protocol port; a protocol determination unit, configured to determine the access protocol deployed corresponding to the protocol port; and a message decoding unit, configured to decode messages transmitted by the Internet of Things device based on the deployed access protocol.
[0008] In a fifth aspect, an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory, wherein the processor implements any of the methods described above when executing the computer program.
[0009] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, any of the methods described above is implemented.
[0010] Compared with the prior art, this application has the following advantages:
[0011] According to the embodiment of the present application, the IoT server can obtain the protocol plug-in corresponding to any access protocol, and process the messages sent by the IoT device when it is accessed by deploying the access protocol. IoT devices using any access protocol are directly connected to the IoT server, eliminating the step of protocol conversion by the protocol conversion gateway, making the interactive link shorter, and the access efficiency and speed high.
[0012] According to the embodiment of the present application, multiple protocols are deployed on the IoT server, and the IoT server obtains messages transmitted by IoT devices through protocol ports, and uses the access protocol corresponding to the protocol port to process the obtained data. The IoT server can quickly distinguish the access protocol used by the IoT device that uploads data, and use the access protocol to process the obtained data, thereby improving the efficiency of uploading or obtaining messages when the IoT device accesses the IoT server.
[0013] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] In the accompanying drawings, unless otherwise specified, the same reference numerals throughout the multiple drawings represent the same or similar parts or elements. These drawings are not necessarily drawn to scale. It should be understood that these drawings only depict some embodiments according to the present application and should not be regarded as limiting the scope of the present application.
[0015] Figure 1 It is a schematic diagram showing a solution for realizing the access of IoT devices by related technologies;
[0016] Figure 2 is a schematic diagram showing an Internet of Things device access solution according to an embodiment of the present application;
[0017] Figure 3 is a flow chart showing an IoT device access method according to an embodiment of the present application;
[0018] Figure 4 is a flow chart showing an IoT device access method according to another embodiment of the present application;
[0019] Figure 5 is a flow chart showing an IoT device access method according to another embodiment of the present application;
[0020] Figure 6 is a structural block diagram showing an Internet of Things device access device according to an embodiment of the present application;
[0021] Figure 7 is a structural block diagram showing an IoT device access device according to another embodiment of the present application; and
[0022] Figure 8 is a block diagram showing an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0023] In the following, only some exemplary embodiments are briefly described. As those skilled in the art will appreciate, the described embodiments may be modified in various ways without departing from the concept or scope of the present application. Therefore, the drawings and descriptions are considered to be exemplary in nature and not restrictive.
[0024] To facilitate understanding of the technical solutions of the embodiments of the present application, the following describes the related technologies of the embodiments of the present application. The following related technologies can be combined with the technical solutions of the embodiments of the present application as optional solutions, and they all belong to the protection scope of the embodiments of the present application.
[0025] In a related technology before this application, in order to connect IoT devices using different access protocols to the IoT server and realize data interaction between IoT devices and the IoT server, the IoT server uses a protocol conversion gateway to convert the industry or private protocols used by different IoT devices into a unified MQTT protocol for data interaction. The MQTT protocol is a lightweight communication protocol based on the publish / subscribe model and is widely used in the field of IoT. Figure 1It is a schematic diagram showing a scheme for realizing the access of IoT devices by related technologies. For example, the IoT devices of manufacturer 1 use private access protocol 1, and the IoT devices of manufacturer 2 use private access protocol 2. When the IoT device of manufacturer 1 accesses the IoT server and transmits data to the IoT server, the protocol conversion gateway needs to convert the private access protocol 1 used by the IoT device into the MQTT protocol used by the IoT server; similarly, when the IoT device of manufacturer 2 accesses the IoT server, the protocol conversion gateway also needs to convert the private access protocol 2 into the MQTT protocol. In the process of transmitting data from the IoT server to the IoT device, the protocol conversion gateway needs to convert the MQTT protocol into the industry or private access protocol (for example, private access protocol 1 and private access protocol 2) used by the IoT device. The protocol conversion gateway needs to adapt to multiple protocols and debug the conversion between protocols, which increases the cost of IoT device access, and the protocol conversion speed is slow and inefficient, which affects the efficiency of IoT devices accessing the IoT server.
[0026] In view of this, the embodiments of the present application provide a new IoT device access solution to fully or partially solve the problems existing in the above-mentioned related technologies. In order to more clearly demonstrate the IoT device access solution provided in the embodiments of the present application, a specific application example of the solution of the embodiments of the present application is given below. Figure 2 Schematic diagram showing an IoT device access solution according to an embodiment of the present application. Figure 2 As shown, the protocol developers of the IoT device manufacturers (for example, manufacturer 1, manufacturer 2, and manufacturer N) upload the developed protocol plug-in to the IoT server, and the IoT server dynamically loads the received protocol plug-in in the device access layer, so that the IoT server deploys the protocol without stopping, so as to realize that each IoT device accesses the IoT server based on the protocol developed by each manufacturer to interact with data. After the IoT server completes the protocol deployment, the IoT devices of manufacturer 1, manufacturer 2, and manufacturer N can use the corresponding protocol (for example, private access protocol 1, private access protocol 2, and private access protocol N) to interact with the IoT server. Compared with the above-mentioned related technologies, the technical solution of the embodiment of the present application can realize the direct connection of each IoT device to the IoT server, saving the time and cost of protocol conversion, and the IoT device can access the IoT server with higher efficiency, complete the data interaction with the IoT server at a faster speed, and the IoT server can dynamically load more protocol plug-ins without stopping, thereby improving the horizontal expansion capability.
[0027] An embodiment of the present application provides an IoT device access method 300, which is applied to an IoT server, which can be deployed in a public cloud, a private cloud, a hybrid cloud, or other environments. Figure 3The IoT device access method 300 of the present application is described. Figure 3 FIG. 3 is a flow chart showing an IoT device access method 300 according to an embodiment of the present application. Figure 3 As shown, the IoT device access method 300 may include the following steps S301 to S303. Steps S301 to S303 will be described in detail below in conjunction with a specific embodiment.
[0028] First, proceed to step S301. In step S301, a protocol plug-in corresponding to the access protocol is obtained.
[0029] In one embodiment, the IoT device manufacturer may store the protocol plug-in corresponding to the access protocol in a server, allowing the IoT server to obtain the protocol plug-in. In another embodiment, the IoT device manufacturer may upload the protocol plug-in to the target server of the IoT server via FTP (File Transfer Protocol). The IoT device manufacturer may also upload the protocol plug-in to the target server of the IoT server via HTTP (Hyper Text Transfer Protocol). The above description of the method for the IoT server to obtain the protocol plug-in corresponding to the access protocol is only exemplary, and those skilled in the art may choose the method for obtaining the protocol plug-in according to actual conditions.
[0030] In some embodiments, the Internet of Things server publishes a protocol service programming interface (SPI) specification, which is defined by the Internet of Things server, and the above-mentioned protocol plug-in is developed based on the protocol service programming interface specification. The Internet of Things server can publish the protocol service programming interface specification on a file server or a web page, allowing each Internet of Things device manufacturer to obtain the protocol service programming interface specification by accessing the file server or web page. The Internet of Things server can also send the protocol service programming interface specification to each Internet of Things device manufacturer through network transmission (for example, email, TCP communication).
[0031] In some embodiments, the protocol service programming interface specification includes at least one of a coding specification, a security authentication specification, and a packet sticking and unpacking specification. The protocol service programming interface specification may include a series of interface functions, further including the name of the function, the functional description of the function, the parameters required to be passed in to the function, and the return value of the function.
[0032] In some embodiments, some IoT devices are powered by batteries and have high requirements for power saving, so these IoT devices use data in binary format to reduce power consumption. Some IoT servers use data in JSON (JavaScript Object Notation, JS object notation) format, while other IoT servers use data in XML (Extensible Markup Language) format. In one embodiment, the IoT server uses data in JSON format, and the IoT server needs to define a codec specification to achieve the conversion between the data format used by the IoT device and the data format used by the IoT server. For example, the codec specification includes a series of interface functions for converting binary format data and JSON format data. For example, the name of the decoding function in the codec specification can be Decode, and the function of the decoding function is to convert binary data into JSON data. The parameter passed in is the binary data value, and the return value is JSON data.
[0033] In some embodiments, during the TCP (Transmission Control Protocol) transmission process, TCP will split or assemble the data packets according to the actual situation of the sending buffer. For example, the sending end sends two data packets P1 and P2 to the receiving end. Since TCP is a connection-oriented protocol, there will be no packet loss. If the receiving end only receives one data packet, this data packet contains the information of the two data packets P1 and P2. This is a sticky packet; if the receiving end receives two data packets, the first data packet contains the complete P1 packet and part of the P2 packet, and the second data packet contains the remaining content of the P2 packet. This is a packet unpacking. Therefore, the IoT server also needs to define the sticky and unpacking specifications to parse out the complete data sent by the IoT device.
[0034] IoT device manufacturers can develop and debug protocol plug-ins based on the protocol service programming interface specification. For example, an IoT device manufacturer belongs to the hydrological industry. The hydrological monitoring IoT devices produced by the manufacturer need to comply with the data transmission standard of SL651-2014 "Hydrological Monitoring Data Communication Protocol". The manufacturer can develop protocol plug-ins based on the various interface functions in the protocol service programming interface specification so that the functions of the protocol plug-ins meet the above-mentioned hydrological monitoring data transmission standards. IoT device manufacturers also need to debug the developed protocol plug-ins to ensure that the protocol plug-ins can operate normally. IoT device manufacturers can also optimize the performance of the protocol plug-ins so that the protocol plug-ins can operate with higher efficiency.
[0035] In some embodiments, the Internet of Things service end can define the protocol service programming interface specification based on the Java language. Correspondingly, the Internet of Things device manufacturer needs to use the Java language to develop the protocol plug-in, and the protocol plug-in can be in the form of a Jar (Java Archive) file. In another embodiment, the Internet of Things service end can define the protocol service programming interface specification based on the C language. Correspondingly, the Internet of Things device manufacturer needs to use the C language to develop the protocol plug-in, and the protocol plug-in can be a DLL (Dynamic-Link Library) file. Corresponding to the sticky package and unpacking specifications, encoding and decoding specifications, and security authentication specifications in the protocol service programming interface specification, the protocol plug-in developed by the Internet of Things device manufacturer may also include a sticky package and unpacking module, an encoding and decoding module, and a security authentication module. The above definition of the protocol service programming interface specification based on the programming language by the Internet of Things service end is only exemplary, and those skilled in the art can select the programming language of the protocol service programming interface specification according to actual conditions.
[0036] Next, the process proceeds to step S302. In step S302, the protocol plug-in is loaded, and the protocol port is configured to deploy the access protocol.
[0037] In some embodiments, the IoT server uses hot loading technology to dynamically load the received protocol plug-in. For example, the IoT server obtains the protocol plug-in Jar developed by the IoT device manufacturer based on the Java language, and the IoT server uses Java ClassLoader in its JVM (Java Virtual Machine) to dynamically load the above protocol plug-in Jar, so that the IoT server can load the protocol plug-in Jar without shutting down the IoT server, so as to deploy the access protocol and realize horizontal expansion of the protocol.
[0038] In some embodiments, the IoT server and the IoT device manufacturer need to agree on a port for the protocol developed by the IoT device manufacturer. The port can be defined by the IoT server or by the IoT device manufacturer, as long as the two parties negotiate and agree. The port is used to distinguish which process a data packet received in a computer should be transferred to for processing. Each access protocol corresponds to a port, and the same port cannot correspond to multiple protocols. The port number is an integer ranging from 0 to 65535. For example, the IoT server can agree with an IoT device manufacturer in the hydrology industry to select port 10001 to correspond to the protocol developed by the IoT device manufacturer. The IoT device of the manufacturer can access the IoT server through the IP address of the IoT server and the port number, and exchange information. For example, the IP address of the IoT server is 110.242.101.101, and an IoT device in the hydrology industry needs to report the current water level of a river. The IoT device can access the IoT server through 110.242.101.101:10001 and transmit the current river water level information.
[0039] In some embodiments, the IoT server configures a protocol port on its access gateway. The access gateway is a bridge for information exchange between IoT devices and IoT servers. The access gateway can provide routing services and forward received IoT device request messages to the corresponding service nodes of the IoT server. When there are too many request messages sent by IoT devices, the access gateway can also use current limiting or fuse methods to block the request messages of IoT devices to ensure the availability of the entire IoT server. Configuring the protocol port on the access gateway can expose the access gateway to expose the port, and the access gateway can wait to receive messages transmitted by IoT devices from the port.
[0040] In some embodiments, the IoT server starts the access gateway and monitors the protocol port. After starting the access gateway, the IoT server monitors whether an IoT device transmits a message through the port exposed to the outside through the access gateway. If a message transmitted by an IoT device is received, the IoT server can process the received message based on the deployed protocol.
[0041] Next, the process proceeds to step S303. In step S303, based on the deployed access protocol, the message transmitted when the IoT device accesses the IoT server is processed.
[0042] In some embodiments, the IoT server decodes, responds, encodes, sends, and processes messages sent by the IoT device through the deployed access protocol to complete the business request of the IoT device to access the IoT server.
[0043] Another embodiment of the present application provides an IoT device access method 400, which is applied to an IoT server. Figure 4 The IoT device access method 400 of the present application is described. Figure 4 FIG. 4 is a flow chart showing an IoT device access method 400 according to another embodiment of the present application. Figure 4 As shown, the IoT device access method 400 may include the following steps S401 to S403. Steps S401 to S403 will be described in detail below in conjunction with a specific embodiment.
[0044] First, proceed to step S401. In step S401, a message transmitted by the IoT device is obtained through a protocol port.
[0045] In some embodiments, the IoT server receives messages transmitted by the IoT device by monitoring the configured protocol port. For example, the IoT server configures port 10001 for a hydrology industry IoT device manufacturer, and the IoT server can continuously monitor port 10001 to receive messages transmitted by the manufacturer's IoT device.
[0046] Next, the process proceeds to step S402. In step S402, the access protocol deployed corresponding to the protocol port is determined.
[0047] In some embodiments, multiple access protocols (e.g., hydrological industry access protocol, smart furniture industry access protocol, and Internet of Vehicles industry access protocol) are deployed in the IoT server, and the IoT server needs to determine which access protocol to use to process the message based on the port where the message is received. For example, the port number of the message received by the IoT server is 10001, and the IoT server determines that the access protocol is the hydrological industry access protocol based on the correspondence between the protocol port and the access protocol. The IoT server needs to use the access protocol to process the message received from the IoT device.
[0048] Next, the process proceeds to step S403. In step S403, the message transmitted by the IoT device is decoded based on the deployed access protocol.
[0049] Decoding is the process of converting information from one form or format to another. Encoding is the reverse process of decoding. For example, some IoT devices use binary data because they are powered by batteries and have high requirements for power saving. The IoT server has no resource restrictions and uses JSON format data. Therefore, after the IoT server receives the binary data of the IoT device, it needs to use the codec module in the deployed access protocol to convert the binary data into JSON data that the IoT server can process. For example, an IoT device produced by a hydrological industry IoT device manufacturer transmits binary data such as 0x00110111 to the IoT server. The IoT server uses the codec module in the hydrological industry access protocol to decode the first four bits of the binary data 0011 into waterlevel (water level), and the last four bits of the binary data into 7. The binary data is decoded as a whole into JSON data such as {waterlevel:7}, so that the IoT server can further process the JSON data.
[0050] In some embodiments, the IoT device is connected to the IoT server through a TCP transmission channel, and the IoT server also needs to perform packet sticking or unpacking on the messages transmitted by the IoT device based on the deployed access protocol. When the IoT device is connected to the IoT server by establishing a TCP transmission channel, packet sticking or unpacking means that when the IoT device transmits a message, TCP will divide the data packet according to the actual situation of the buffer. In this case, a complete data packet can be split into multiple data packets for transmission, and several small data packets can also be encapsulated into a large data packet for transmission. Therefore, the IoT server can use the packet sticking and unpacking module in the deployed access protocol to process the received data packets to obtain a complete message transmitted by the IoT device.
[0051] Another embodiment of the present application provides an IoT device access method 500, which is applied to an IoT server. In one embodiment, the access method 500 is executed after the access method 400. Figure 5 The IoT device access method 500 of the present application is described. Figure 5 FIG. 5 is a flow chart showing an IoT device access method 500 according to another embodiment of the present application. Figure 5 As shown, the IoT device access method 500 may include the following steps S501 to S502. Steps S501 to S502 will be described in detail below in conjunction with a specific embodiment.
[0052] First, proceed to step S501. In step S501, the message type of the decoding result is determined, and a response message is generated based on the message type.
[0053] In some embodiments, the Internet of Things service end generates a corresponding response message based on the type of the message of the decoding result according to its own processing logic. For example, a hydrological Internet of Things device sends a PUBLISH message to the Internet of Things service end, and the PUBLISH message contains the water level of a current river. After the Internet of Things service end decodes the message, it identifies that the message is of the PUBLISH type. The Internet of Things service end can store the information of the river water level in the PUBLISH message, and return a PUBACK (publish confirmation) message to the Internet of Things device to tell the Internet of Things device that the publication is successful. For another example, a smart speaker Internet of Things device sends a SUBSCRIBE (subscription) message to the Internet of Things service end, and the SUBSCRIBE message contains a subscription topic for the river water level. After the Internet of Things service end decodes the message, it identifies that the message is of the SUBSCRIBE type. The Internet of Things service end can return a SUBACK (subscription confirmation) message to the Internet of Things device, telling the Internet of Things device that the subscription is successful, and can push the river water level information to the Internet of Things device at a preset time.
[0054] In some embodiments, the IoT server stores authentication information corresponding to the IoT device. Before the IoT server generates a response message based on the message type of the decoding result, if the message type is a security authentication type, the IoT server needs to verify the decoding result according to the authentication message of the IoT device. The IoT server can register the IoT device that needs to be connected to the IoT server in advance. After the registration is completed, the IoT server can also save the authentication information of the IoT device (for example, key, product serial number, MAC address (Media Access Control Address)). In one embodiment, the IoT device can use its own key to digitally sign the product serial number, and send the digital signature as the message body of the security authentication message to the IoT server. The IoT server verifies the digital signature in the security authentication message according to the stored authentication information of the IoT device. If the verification is successful, the IoT server can issue an Access Token to the IoT device, and the IoT device can carry the Access Token in the message interacting with the IoT server later, indicating that it has obtained the access authorization of the IoT server; if the verification is not successful, the IoT server disconnects the connection with the IoT device and denies the access of the IoT device.
[0055] Next, the process proceeds to step S502. In step S502, the response message is encoded based on the deployed access protocol, and the encoded response message is sent to the IoT device.
[0056] In some embodiments, the message generated by the IoT server is in JSON format, and the IoT device can only recognize binary data. The IoT server needs to use the codec module in the deployed access protocol to encode the JSON data into binary data and return the binary data to the IoT device.
[0057] Corresponding to the application scenario and access method 300 provided in the embodiment of the present application, the embodiment of the present application also provides an IoT device access device 600, which is deployed on the IoT server. Figure 6 The Internet of Things device access device 600 of the present application is described. Figure 6 1 is a block diagram showing a structure of an Internet of Things access device according to an embodiment of the present application. Figure 6 As shown, the IoT device access apparatus 600 may include: an acquisition unit 601 , a deployment unit 602 , and a processing unit 603 .
[0058] The acquisition unit 601 is configured to acquire a protocol plug-in corresponding to an access protocol.
[0059] The acquisition unit 601 may be a component in the IoT server, through which the IoT server acquires the protocol plug-in corresponding to the access protocol. The IoT server may be deployed in a private cloud, a public cloud, a hybrid cloud, or other environments.
[0060] In some embodiments, the Internet of Things server publishes a protocol service programming interface (SPI) specification, which is defined by the Internet of Things server, and the above-mentioned protocol plug-in is developed based on the protocol service programming interface specification. The Internet of Things server can publish the protocol service programming interface specification on a file server or a web page, allowing each Internet of Things device manufacturer to obtain the protocol service programming interface specification by accessing the file server or web page. The Internet of Things server can also send the protocol service programming interface specification to each Internet of Things device manufacturer through network transmission (for example, email, TCP communication).
[0061] For descriptions of features such as protocol plug-ins and protocol service programming interface specifications, please refer to the above content about the Internet of Things device access method 300. For the sake of simplicity of the specification, a detailed description of such features will be omitted here.
[0062] The deployment unit 602 is configured to load the protocol plug-in and configure the protocol port to deploy the access protocol.
[0063] The deployment unit 602 may be a component in the IoT server, and the IoT server deploys the access protocol through the component.
[0064] In some embodiments, the IoT server uses hot loading technology to dynamically load the received protocol plug-in. For example, the IoT server obtains the protocol plug-in Jar developed by the IoT device manufacturer based on the Java language, and the IoT server uses Java ClassLoader in its JVM (Java Virtual Machine) to dynamically load the above protocol plug-in Jar, so that the IoT server can load the protocol plug-in Jar without shutting down the IoT server, so as to deploy the access protocol and realize horizontal expansion of the protocol.
[0065] In some embodiments, the IoT server configures a protocol port on its access gateway. The access gateway is a bridge for information exchange between IoT devices and IoT servers. The access gateway can provide routing services and forward received IoT device request messages to the corresponding service nodes of the IoT server. When there are too many request messages sent by IoT devices, the access gateway can also use current limiting or fuse methods to block the request messages of IoT devices to ensure the availability of the entire IoT server. Configuring the protocol port on the access gateway can expose the access gateway to expose the port, and the access gateway can wait to receive messages transmitted by IoT devices from the port.
[0066] The processing unit 603 is configured to process the message transmitted when the IoT device accesses the IoT server based on the deployed access protocol.
[0067] The processing unit 603 may be a component in the IoT server, and the IoT server processes messages transmitted by the IoT devices through the component.
[0068] In one embodiment, the apparatus 600 may further include:
[0069] The publishing unit is configured to publish the protocol service programming interface specification defined by the Internet of Things server, and the protocol plug-in is developed based on the protocol service programming interface specification.
[0070] The functions of each module in the device of the embodiment of the present application can refer to the corresponding description in the above-mentioned access method 300, and have corresponding beneficial effects, which will not be repeated here.
[0071] Corresponding to the application scenario and access method 400 provided in the embodiment of the present application, the embodiment of the present application also provides an IoT device access device 700, which is deployed on the IoT server, and will be referred to below. Figure 7 The Internet of Things device access device 700 of the present application is described. Figure 7 1 is a block diagram showing a structure of an Internet of Things access device according to an embodiment of the present application. Figure 7As shown, the IoT device access apparatus 700 may include: a message acquisition unit 701 , a protocol determination unit 702 , and a message decoding unit 703 .
[0072] The message acquisition unit 701 is configured to acquire the message transmitted by the IoT device through the protocol port.
[0073] The message acquisition unit 701 may be a component in the IoT server, and the IoT server acquires messages transmitted by IoT devices through the component.
[0074] The protocol determination unit 702 is configured to determine the access protocol deployed corresponding to the protocol port.
[0075] The protocol determination unit 702 may be a component in the IoT server, and the IoT server determines the access protocol deployed corresponding to the protocol port through the component.
[0076] The message decoding unit 703 is configured to decode the message transmitted by the IoT device based on the deployed access protocol.
[0077] The message decoding unit 703 may be a component in the IoT server, through which the IoT server decodes the message transmitted by the IoT device based on the deployed access protocol.
[0078] The functions of each module in the device of the embodiment of the present application can refer to the corresponding description in the above-mentioned access method 400, and have corresponding beneficial effects, which will not be repeated here.
[0079] According to the embodiment of the present application, the IoT server can obtain the protocol plug-in corresponding to any access protocol, and process the messages sent by the IoT device when it is accessed by deploying the access protocol. IoT devices using any access protocol are directly connected to the IoT server, eliminating the step of protocol conversion by the protocol conversion gateway, making the interactive link shorter, and the access efficiency and speed high.
[0080] According to the embodiment of the present application, multiple protocols are deployed on the IoT server, and the IoT server obtains messages transmitted by IoT devices through protocol ports, and uses the access protocol corresponding to the protocol port to process the obtained data. The IoT server can quickly distinguish the access protocol used by the IoT device that uploads data, and use the access protocol to process the obtained data, thereby improving the efficiency of uploading or obtaining messages when the IoT device accesses the IoT server.
[0081] Figure 8 FIG. 1 is a block diagram of an electronic device used to implement an embodiment of the present application. Figure 8As shown, the electronic device includes: a memory 801 and a processor 802. The memory 801 stores a computer program that can be run on the processor 802. When the processor 802 executes the computer program, the method in the above embodiment is implemented. The number of the memory 801 and the processor 802 can be one or more.
[0082] The electronic device also includes:
[0083] The communication interface 803 is used to communicate with external devices and perform data exchange transmission.
[0084] If the memory 801, the processor 802 and the communication interface 803 are implemented independently, the memory 801, the processor 802 and the communication interface 803 can be connected to each other through a bus and communicate with each other. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 8 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0085] Optionally, in a specific implementation, if the memory 801, the processor 802 and the communication interface 803 are integrated on a chip, the memory 801, the processor 802 and the communication interface 803 can communicate with each other through an internal interface.
[0086] An embodiment of the present application provides a computer-readable storage medium storing a computer program, which implements the method provided in the embodiment of the present application when the program is executed by a processor.
[0087] An embodiment of the present application also provides a chip, which includes a processor for calling and executing instructions stored in the memory from the memory, so that a communication device equipped with the chip executes the method provided by the embodiment of the present application.
[0088] An embodiment of the present application also provides a chip, including: an input interface, an output interface, a processor and a memory, wherein the input interface, the output interface, the processor and the memory are connected via an internal connection path, and the processor is used to execute the code in the memory. When the code is executed, the processor is used to execute the method provided in the embodiment of the application.
[0089] It should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. It is worth noting that the processor may be a processor supporting the Advanced RISC Machines (ARM) architecture.
[0090] Further, optionally, the above-mentioned memory may include a read-only memory and a random access memory. The memory may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memory. Among them, the non-volatile memory may include a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may include a random access memory (RAM), which is used as an external cache. By way of exemplary but not limiting description, many forms of RAM are available. For example, static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM) and direct memory bus random access memory (DR RAM).
[0091] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium.
[0092] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine different embodiments or examples described in this specification and the features of different embodiments or examples, unless they are contradictory.
[0093] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of this application, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0094] Any process or method described in the flow chart or otherwise described herein can be understood as a module, fragment or portion of a code representing one or more executable instructions for implementing the steps of a specific logical function or process. And the scope of the preferred embodiment of the present application includes other implementations, in which the functions may not be performed in the order shown or discussed, including in a substantially simultaneous manner or in a reverse order according to the functions involved.
[0095] The logic and / or steps described in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, which can be specifically implemented in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or used in combination with these instruction execution systems, devices or apparatuses.
[0096] It should be understood that the various parts of the present application can be implemented with hardware, software, firmware or a combination thereof. In the above embodiments, multiple steps or methods can be implemented with software or firmware stored in a memory and executed by a suitable instruction execution system. All or part of the steps of the above embodiment method can be completed by instructing the relevant hardware through a program, which can be stored in a computer-readable storage medium, and when the program is executed, it includes one of the steps of the method embodiment or a combination thereof.
[0097] In addition, each functional unit in each embodiment of the present application can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into one module. The above-mentioned integrated module can be implemented in the form of hardware or in the form of a software functional module. If the above-mentioned integrated module is implemented in the form of a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. The storage medium can be a read-only memory, a disk or an optical disk, etc.
[0098] The above is only an exemplary embodiment of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various changes or substitutions within the technical scope recorded in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A method for accessing an IoT device, applied to an IoT server, wherein the IoT device is connected to the IoT server via a TCP transmission channel, comprising: Get the protocol plug-in corresponding to the access protocol; Loading the protocol plug-in and configuring the protocol port to deploy the access protocol; Based on the deployed access protocol, process the message transmitted when the IoT device accesses the IoT server; The IoT devices include IoT devices produced by IoT device manufacturers in the hydrological industry. The IoT devices define encoding and decoding specifications to achieve conversion between the data format used by the IoT devices and the data format used by the IoT server; the encoding and decoding specifications include a series of interface functions for converting between binary format data and JSON format data.
2. The access method according to claim 1, further comprising: The protocol service programming interface specification defined by the Internet of Things server is published, and the protocol plug-in is developed based on the protocol service programming interface specification.
3. The access method according to claim 1 or 2, wherein: The configuration protocol port includes: Configuring the protocol port on the access gateway of the Internet of Things server; Start the access gateway and monitor the protocol port.
4. The access method according to claim 2, wherein: The protocol service programming interface specification includes at least one of a coding and decoding specification, a security authentication specification, and a packet sticking and unpacking specification.
5. The access method according to claim 1 or 2, wherein: The protocol plug-in is dynamically loaded using hot loading technology.
6. A method for accessing an IoT device, applied to an IoT server, wherein the IoT device is connected to the IoT server via a TCP transmission channel, comprising: Obtaining messages transmitted by the IoT device through a protocol port; Determine the access protocol deployed corresponding to the protocol port; Decoding the message transmitted by the IoT device based on the deployed access protocol; The IoT devices include IoT devices produced by IoT device manufacturers in the hydrological industry. The IoT devices define encoding and decoding specifications to achieve conversion between the data format used by the IoT devices and the data format used by the IoT server; the encoding and decoding specifications include a series of interface functions for converting between binary format data and JSON format data.
7. The access method according to claim 6, further comprising: Determining a message type of the decoding result, and generating a response message based on the message type; The response message is encoded based on the deployed access protocol, and the encoded response message is sent to the Internet of Things device.
8. The access method according to claim 7, wherein: The Internet of Things server stores authentication information corresponding to the Internet of Things device. Before generating a response message based on the message type, the access method further includes: If the message type is a security authentication type, the decoding result is verified according to the authentication information.
9. The access method according to claim 7 or 8, wherein: The access method further includes: Based on the deployed access protocol, messages transmitted by the IoT device are packaged or unpacked.
10. An IoT device access device, deployed on an IoT server, wherein the IoT device is connected to the IoT server via a TCP transmission channel, comprising: An acquisition unit, configured to acquire a protocol plug-in corresponding to an access protocol; A deployment unit configured to load the protocol plug-in and configure the protocol port to deploy the access protocol; A processing unit configured to process a message transmitted when the IoT device accesses the IoT server based on the deployed access protocol; The IoT devices include IoT devices produced by IoT device manufacturers in the hydrological industry. The IoT devices define encoding and decoding specifications to achieve conversion between the data format used by the IoT devices and the data format used by the IoT server; the encoding and decoding specifications include a series of interface functions for converting between binary format data and JSON format data.
11. The access device according to claim 10, further comprising: The publishing unit is configured to publish the protocol service programming interface specification defined by the Internet of Things server, and the protocol plug-in is developed based on the protocol service programming interface specification.
12. An IoT device access device, deployed on an IoT server, wherein the IoT device is connected to the IoT server via a TCP transmission channel, comprising: A message acquisition unit, configured to acquire a message transmitted by the IoT device through a protocol port; A protocol determination unit configured to determine an access protocol deployed corresponding to the protocol port; A message decoding unit is configured to decode the message transmitted by the IoT device based on the deployed access protocol; the IoT device includes an IoT device produced by an IoT device manufacturer in the hydrological industry, and the IoT device defines a coding and decoding specification to achieve conversion between the data format used by the IoT device and the data format used by the IoT server; the coding and decoding specification includes a series of interface functions for converting binary format data and JSON format data.
13. An electronic device comprising a memory, a processor and a computer program stored in the memory, wherein the processor implements the method according to any one of claims 1 to 9 when executing the computer program.
14. A computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.
