Equipment communication method and system based on Internet of Things
By detecting the servers in the Internet of Things system in a delay and selecting the server with the lowest latency in real time for message forwarding, the problem of high message forwarding delay in the Internet of Things system is solved, and the message forwarding delay is reduced.
Patent Information
- Application Number
- CN202411005381.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-25
- Publication Date
- 2024-11-12
AI Technical Summary
The delay in message forwarding in the Internet of Things system is high and there is a lack of effective solutions.
By obtaining the list of servers connected to the cloud, the server is detected by delay, determining the target server with the lowest delay, and establishing a connection with it, selecting the server with the lowest delay in real time for message forwarding, including the device information of the terminal device and the processing of user requests. .
It effectively reduces the delay of message forwarding and solves the problem of high message forwarding delay in IoT systems.
Smart Images

Figure CN118945168A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of Internet of Things, and in particular to a device communication method, system, electronic device and storage medium based on Internet of Things. Background Art
[0002] With the rapid development of IoT technology, more and more devices are connected to IoT platforms. These devices use different protocols to communicate, such as vendor-defined protocols based on TCP, general lightweight open source MQTT protocol, CoAP protocol, HTTP protocol, etc.
[0003] In traditional IoT systems, IoT platforms and devices usually only support one protocol, and message forwarding delays are high.
[0004] Currently, no effective solution has been proposed for the problem of high message forwarding delay in IoT systems in related technologies. Summary of the invention
[0005] The embodiments of the present application provide a device communication method, system, electronic device and storage medium based on the Internet of Things, so as to at least solve the problem of high message forwarding delay in the Internet of Things system in the related art.
[0006] In a first aspect, an embodiment of the present application provides a device communication method based on the Internet of Things, the method being applied to a terminal device, the method comprising:
[0007] Obtain a list of servers connected to the cloud, perform latency detection on the servers in the server list to determine a target server, and establish a connection with the target server;
[0008] After successfully connecting to the target server, the device information of the terminal device is sent to a preset application, so that the preset application sends the device information to the home cloud for storage;
[0009] A user request forwarded by the target server is received, and response information is generated according to the user request, wherein the user request is sent through the preset application and includes device information of the terminal device.
[0010] In some embodiments, performing delay detection on the servers in the server list to determine the target server includes:
[0011] Performing delay detection on the servers in the server list to obtain the response delay of each server;
[0012] The server with the smallest response delay is taken as the target server.
[0013] In some embodiments, performing delay detection on the servers in the server list to obtain the delay of each server includes:
[0014] Sending a preset number of detection data packets to all servers in the server list to obtain the time delay of each server responding to the detection data packet;
[0015] The average value of the corresponding delays of the servers is taken as the response delay of the server.
[0016] In some embodiments, the user request is configured to:
[0017] The preset application receives a user instruction;
[0018] Acquire a device list and device information from the home cloud, and determine a target terminal device in the device list based on the user instruction;
[0019] A user request is generated according to the user instruction and the device information of the target terminal device, wherein the device information includes protocol mode information and encryption mode information.
[0020] In some embodiments, before obtaining the list of servers connected to the cloud, the method further includes:
[0021] An access request is sent to the preset application so that the preset application configures the network for the terminal device.
[0022] In some embodiments, after generating response information according to the user request, the method further includes:
[0023] The response information is sent to the target server to instruct the target server to send the response information to the control cloud for parsing, and send the parsed response information to the preset application. The target server supports multiple protocol modes.
[0024] In a second aspect, an embodiment of the present application provides a device communication method based on the Internet of Things, the method is applied to a control cloud, and the method includes:
[0025] Receiving a user request sent by a preset application, wherein the user request includes a protocol mode and an encryption mode of a terminal device;
[0026] The user request is processed according to the protocol method and the encryption method, and the processed user request is sent to the target server to instruct the target server to forward the processed user request to the terminal device.
[0027] In some embodiments, the method further comprises:
[0028] receiving response information of the terminal device forwarded by the target server, wherein the response information is generated according to the processed user request;
[0029] The response information is parsed, and the parsed response information is sent to the preset application.
[0030] In a third aspect, an embodiment of the present application provides a device communication system based on the Internet of Things, the system comprising a terminal device, a preset application and an IOT platform, the IOT platform comprising a control cloud, an access cloud and a home cloud, the terminal device is configured to execute the device communication method based on the Internet of Things described in the first aspect, and / or,
[0031] The control cloud is configured to execute the device communication method based on the Internet of Things described in the second aspect.
[0032] In a fourth aspect, an embodiment of the present application provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the device communication method based on the Internet of Things as described in the first aspect or the device communication method based on the Internet of Things as described in the second aspect is implemented.
[0033] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the device communication method based on the Internet of Things as described in the first aspect or the device communication method based on the Internet of Things as described in the second aspect.
[0034] Compared with the related art, the device communication method based on the Internet of Things provided in the embodiment of the present application is applied to the terminal device, and obtains the server list connected to the cloud, performs delay detection on the servers in the server list to determine the target server, and establishes a connection with the target server. After successfully connecting to the target server, the device information of the terminal device is sent to the preset application, so that the preset application sends the device information to the home cloud for storage, receives the user request forwarded by the target server, and generates response information according to the user request. The user request is sent through the preset application, including the device information of the terminal device, which solves the problem of high message forwarding delay in the Internet of Things system, and reduces the message forwarding delay by selecting the server with the lowest delay in real time. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0036] Figure 1 is a schematic diagram of an application environment of a device communication method based on the Internet of Things according to an embodiment of the present application;
[0037] Figure 2 is a flow chart of a device communication method based on the Internet of Things according to an embodiment of the present application;
[0038] Figure 3 This is a schematic diagram of an Internet of Things device access according to an embodiment of the present application;
[0039] Figure 4 This is a schematic diagram of device communication based on the Internet of Things according to an embodiment of the present application;
[0040] Figure 5 is a flowchart of another device communication method based on the Internet of Things according to an embodiment of the present application
[0041] Figure 6 is a structural block diagram of a device communication system based on the Internet of Things according to an embodiment of the present application;
[0042] Figure 7 It is a schematic diagram of the internal structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments provided in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0044] Obviously, the drawings described below are only some examples or embodiments of the present application. For ordinary technicians in this field, the present application can also be applied to other similar scenarios based on these drawings without creative work. In addition, it can also be understood that although the efforts made in this development process may be complicated and lengthy, for ordinary technicians in this field related to the content disclosed in this application, some changes in design, manufacturing or production based on the technical content disclosed in this application are just conventional technical means, and should not be understood as insufficient content disclosed in this application.
[0045] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those of ordinary skill in the art that the embodiments described in this application may be combined with other embodiments without conflict.
[0046] Unless otherwise defined, the technical terms or scientific terms involved in this application should be understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "a", "a", "the" and the like involved in this application do not indicate a quantitative limitation, and may represent the singular or plural. The terms "include", "comprise", "have" and any of their variations involved in this application are intended to cover non-exclusive inclusions; for example, a process, method, system, product or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may also include steps or units that are not listed, or may also include other steps or units inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The "multiple" involved in this application refers to two or more. "And / or" describes the association relationship of associated objects, indicating that there may be three relationships, for example, "A and / or B" can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects before and after are in an "or" relationship. The terms "first", "second", "third", etc. involved in this application are only used to distinguish similar objects and do not represent a specific ordering of the objects.
[0047] Figure 1 : is a schematic diagram of an application environment of a device communication method based on the Internet of Things according to an embodiment of the present application. The device communication method based on the Internet of Things provided by the present application can be applied to Figure 1 In the application environment shown. Figure 1 As shown, the terminal device 10 , the IOT platform 11 and the preset application 12 communicate with each other through the network, and the IOT platform 11 includes an access cloud 111 , a control cloud 112 and a home cloud 113 .
[0048] The process of the terminal device accessing the Internet of Things includes: the terminal device 10 obtains the server list of the access cloud 111, performs delay detection on the servers in the server list to determine the target server 1110, and establishes a connection with the target server 1110. After the terminal device successfully connects to the target server 1110, it sends its own device information to the preset application 12, and the preset application 12 sends the device information to the home cloud 113 for storage. After the device terminal is connected to the Internet of Things, the preset application 12 sends the user request to the terminal device 10 through the target server 1110.
[0049] This embodiment provides a device communication method based on the Internet of Things, and the method is applied to a terminal device. Figure 2 is a flow chart of a device communication method based on the Internet of Things according to an embodiment of the present application, such as Figure 2 As shown, the process includes the following steps:
[0050] Step S201, obtain a list of servers connected to the cloud, perform latency detection on the servers in the server list to determine a target server, and establish a connection with the target server.
[0051] The access cloud is used for terminal devices to connect to the cloud, supports multiple protocol connections for terminal devices, and transparently transmits messages between terminal devices and the IOT platform.
[0052] In some embodiments, before obtaining the list of servers connected to the cloud, the method further includes:
[0053] The access request is sent to the preset application so that the preset application configures the network for the terminal device.
[0054] Use a preset application (APP) to configure the network for terminal devices that request to access the Internet of Things.
[0055] In some embodiments, the delay detection of the servers in the server list in step S201 to determine the target server includes:
[0056] Step S2011, performing delay detection on the servers in the server list to obtain the response delay of each server.
[0057] In some embodiments, step S2011 specifically includes:
[0058] Step S301, sending a preset number of detection data packets to all servers in the server list, and obtaining the time delay of each server responding to the detection data packet.
[0059] Step S302: taking the average value of the corresponding delays of each server as the response delay of the server.
[0060] The servers accessing the cloud are deployed in different regions. The terminal device sends a preset number of (for example, 5) detection data packets based on the UDP port of the server. The server responds to the data packet, and the terminal device calculates the delay of receiving the response and obtains the average value of the response delay of each server.
[0061] Step S2012: select the server with the shortest response delay as the target server.
[0062] The server with the smallest average delay is used as the target server for subsequent information forwarding.
[0063] Step S202, after successfully connecting to the target server, the device information of the terminal device is sent to a preset application, so that the preset application sends the device information to the home cloud for storage.
[0064] It should be noted that the home cloud is used to store terminal devices and device information added by users. The device information includes but is not limited to the MAC address, interaction protocol and encryption method of the terminal device.
[0065] Figure 3 is a schematic diagram of an Internet of Things device access according to an embodiment of the present application, such as Figure 3 As shown, after the terminal device successfully connects to the target server, it calls back the protocol and data encryption method used by itself to the preset application, and the preset application adds the device to the home cloud. After the preset application adds the device to the home cloud, the home cloud returns information on success or failure of the addition.
[0066] Step S203, receiving the user request forwarded by the target server, and generating response information according to the user request, the user request is sent through a preset application, and includes device information of the terminal device.
[0067] In some of the embodiments, the user request is configured as follows: a preset application receives user instructions, obtains a device list and device information from the home cloud, determines a target terminal device in the device list based on the user instructions, and generates a user request based on the user instructions and the device information of the target terminal device, wherein the device information includes protocol mode information and encryption mode information.
[0068] Figure 4 is a schematic diagram of device communication based on the Internet of Things according to an embodiment of the present application, such as Figure 4When a user needs to control a terminal device, the preset application determines the target terminal device that the user wants to control from the device list of the home cloud according to the user's instructions, generates a user request according to the user's instructions and the target terminal device, and sends the user request to the control cloud. The control cloud processes the user request according to the device protocol and encryption method in the user request, and forwards the processed user request to the target server connected to the cloud, and sends it to the target terminal device through the target server.
[0069] The control cloud processes user requests according to the protocol and encryption method of the terminal device included in the user request. There is no need to obtain the device protocol and encryption method from the database, which simplifies the processing flow.
[0070] In some embodiments, after generating response information according to the user request, the method further includes:
[0071] The response information is sent to the target server to instruct the target server to send the response information to the control cloud for parsing, and send the parsed response information to the preset application. The target server supports multiple protocol methods.
[0072] Continue to refer to Figure 4 After receiving the user request forwarded by the target server, the terminal device responds to the user request and sends the response information to the control cloud through the target server in the access cloud. The control cloud parses the response information and sends the parsing result to the preset application.
[0073] Through the above steps, the terminal device obtains a list of servers connected to the cloud, performs delay detection on the servers in the server list to determine the target server, and establishes a connection with the target server. After successfully connecting to the target server, the device information of the terminal device is sent to the preset application, so that the preset application sends the device information to the home cloud for storage, receives the user request forwarded by the target server, and generates response information based on the user request. The user request is sent through the preset application, including the device information of the terminal device, which solves the problem of high message forwarding delay in the Internet of Things system and reduces the message forwarding delay by selecting the server with the lowest delay in real time.
[0074] This embodiment provides a device communication method based on the Internet of Things, and the method is applied to a control cloud. Figure 5 is a flow chart of another device communication method based on the Internet of Things according to an embodiment of the present application, such as Figure 5 As shown, the process includes the following steps:
[0075] Step S501: receiving a user request sent by a preset application, where the user request includes a protocol mode and an encryption mode of a terminal device.
[0076] Step S502: Process the user request according to the protocol mode and encryption mode, and send the processed user request to the target server to instruct the target server to forward the processed user request to the terminal device.
[0077] When a user needs to control a terminal device, the preset application determines the target terminal device that the user wants to control from the device list of the home cloud according to the user's instructions, generates a user request according to the user's instructions and the target terminal device, and sends the user request to the control cloud. The control cloud processes the user request according to the device protocol and encryption method in the user request, and forwards the processed user request to the target server connected to the cloud, and then sends it to the target terminal device through the target server.
[0078] In some embodiments, the method further comprises:
[0079] Step S503: receiving response information of the terminal device forwarded by the target server, where the response information is generated according to the processed user request.
[0080] Step S504: parse the response information, and send the parsed response information to a preset application.
[0081] After receiving the user request forwarded by the target server, the terminal device responds to the user request and sends the response information to the control cloud through the target server in the access cloud. The control cloud parses the response information and sends the parsed result to the preset application.
[0082] The control cloud processes user requests according to the protocol and encryption method of the terminal device included in the user request. There is no need to obtain the device protocol and encryption method from the database, which simplifies the processing flow.
[0083] It should be noted that the steps shown in the above process or the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0084] This embodiment also provides a device communication system based on the Internet of Things, which is used to implement the above-mentioned embodiments and preferred implementation modes, and will not be repeated hereafter. As used below, the terms "module", "unit", "subunit", etc. can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0085] Figure 6is a structural block diagram of a device communication system based on the Internet of Things according to an embodiment of the present application, such as Figure 6 As shown, the system includes: a terminal device 61, a preset application 62 and an IOT platform 63, the IOT platform includes a control cloud, an access cloud and a home cloud, and the system is used to execute the above-mentioned device communication method based on the Internet of Things.
[0086] It should be noted that the above modules can be functional modules or program modules, and can be implemented by software or hardware. For modules implemented by hardware, the above modules can be located in the same processor; or the above modules can be located in different processors in any combination.
[0087] This embodiment further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0088] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0089] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0090] S1, obtain a list of servers connected to the cloud, perform latency detection on the servers in the server list to determine the target server, and establish a connection with the target server.
[0091] S2, after successfully connecting to the target server, the device information of the terminal device is sent to a preset application, so that the preset application sends the device information to the home cloud for storage.
[0092] S3, receiving the user request forwarded by the target server and generating response information according to the user request. The user request is sent through a preset application, including device information of the terminal device.
[0093] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.
[0094] In one embodiment, Figure 7 is a schematic diagram of the internal structure of an electronic device according to an embodiment of the present application, such as Figure 7 As shown, an electronic device is provided, which may be a server, and its internal structure diagram may be as shown in Figure 7As shown. The electronic device includes a processor, a memory, a network interface and a database connected via a system bus. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the electronic device is used to store data. The network interface of the electronic device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a device communication method based on the Internet of Things is implemented.
[0095] Those skilled in the art will understand that Figure 7 The structure shown in the figure is merely a block diagram of a partial structure related to the scheme of the present application, and does not constitute a limitation on the electronic device to which the scheme of the present application is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0096] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0097] Those skilled in the art should understand that the technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0098] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A device communication method based on the Internet of Things, characterized in that: The method is applied to a terminal device, and the method comprises: Obtain a list of servers connected to the cloud, perform latency detection on the servers in the server list to determine a target server, and establish a connection with the target server; After successfully connecting to the target server, the device information of the terminal device is sent to a preset application, so that the preset application sends the device information to the home cloud for storage; A user request forwarded by the target server is received, and response information is generated according to the user request, wherein the user request is sent through the preset application and includes device information of the terminal device.
2. The method according to claim 1, characterized in that The performing delay detection on the servers in the server list to determine the target server comprises: Performing delay detection on the servers in the server list to obtain the response delay of each server; The server with the smallest response delay is taken as the target server.
3. The method according to claim 2, characterized in that The performing delay detection on the servers in the server list to obtain the delay of each server includes: Sending a preset number of detection data packets to all servers in the server list to obtain the time delay of each server responding to the detection data packet; The average value of the corresponding delays of the servers is taken as the response delay of the server.
4. The method according to claim 1, characterized in that: The user request is configured as: The preset application receives a user instruction; Acquire a device list and device information from the home cloud, and determine a target terminal device in the device list based on the user instruction; A user request is generated according to the user instruction and the device information of the target terminal device, wherein the device information includes protocol mode information and encryption mode information.
5. The method according to claim 1, characterized in that Before obtaining the list of servers connected to the cloud, the method further includes: An access request is sent to the preset application so that the preset application configures the network for the terminal device.
6. The method according to claim 1, characterized in that After generating response information according to the user request, the method further includes: The response information is sent to the target server to instruct the target server to send the response information to the control cloud for parsing, and send the parsed response information to the preset application. The target server supports multiple protocol modes.
7. A device communication method based on the Internet of Things, characterized in that: The method is applied to control cloud, and the method comprises: Receiving a user request sent by a preset application, wherein the user request includes a protocol mode and an encryption mode of a terminal device; The user request is processed according to the protocol method and the encryption method, and the processed user request is sent to the target server to instruct the target server to forward the processed user request to the terminal device.
8. The method according to claim 7, characterized in that The method further comprises: receiving response information of the terminal device forwarded by the target server, wherein the response information is generated according to the processed user request; The response information is parsed, and the parsed response information is sent to the preset application.
9. A device communication system based on the Internet of Things, characterized in that: The system includes a terminal device, a preset application and an IOT platform, the IOT platform includes a control cloud, an access cloud and a home cloud, the terminal device is configured to execute the device communication method based on the Internet of Things according to any one of claims 1 to 6, and / or, The control cloud is configured to execute the device communication method based on the Internet of Things according to any one of claims 7 to 8.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the device communication method based on the Internet of Things according to any one of claims 1 to 6 or the device communication method based on the Internet of Things according to any one of claims 7 to 8 is implemented.
Citation Information
Cited By
Data synchronization method and device, server and program product
CN119946073A
A data synchronization method, device, server and program product
CN119946073B
