Methods for determining communication links, electronic equipment and products

CN122579257APending Publication Date: 2026-08-14GUANGZHOU HEMI TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-13
Publication Date
2026-08-14

AI Technical Summary

Technical Problem

[0004]本申请实施例提供了一种通信链路的确定方法、电子设备及产品,用于解通讯链路合理性差,容易导致消息传输绕路的技术问题

Benefits of technology

本申请实施例提供的通信链路的确定方法,通过获取包括网关和网关已绑定的多个智能设备的设备集,对于设备集中的每组设备对,指示设备对中的第一设备与设备对汇总的第二设备进行双向交互,基于双向交互过冲中第一设备和第二设备分别检测得到的RSSI值,确定设备对之间的信号强度,实现了基于设备之间的交互信息来确定设备之间的信号强度,提高了设备之间信号强度确定的准确性,为后续通信链路的确定提供了可靠的数据支持;

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122579257A_ABST
    Figure CN122579257A_ABST
Patent Text Reader

Abstract

This application provides a method, electronic device, and product for determining communication links, relating to the field of smart device technology and applied to gateways. The method includes: acquiring a device set, which includes a gateway and smart devices bound to the gateway; for each device pair in the device set, instructing a first device in the device pair to perform bidirectional interaction with a second device in the device pair, and determining the signal strength between the device pairs based on the Received Signal Strength Indicator (RSSI) values ​​detected by the first and second devices respectively during the bidirectional interaction; for each first node device, determining the communication link between the first node device and the second node device based on the signal strength between at least one set of device pairs in the device set. This application improves the rationality of communication link planning and avoids messages being transmitted via detours between devices.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of smart device technology, and more specifically, to a method for determining a communication link, an electronic device, and a product. Background Technology

[0002] With the popularization of smart homes, the number of mesh module devices (such as smart locks, clothes dryers, air conditioners, etc.) in fixed locations in a single home scene is increasing year by year. Although the communication protocol is unified with the ecosystem modules, in actual applications, the rationality of the communication link between modules directly affects the instruction transmission delay, stability and network load balancing.

[0003] However, the communication links identified in the relevant methods are not reasonable and are prone to causing message transmission detours. Summary of the Invention

[0004] This application provides a method, electronic device, and product for determining communication links, which solves the technical problem of poor communication link rationality, which easily leads to message transmission detours.

[0005] According to a first aspect of the embodiments of this application, a method for determining a communication link is provided, applied to a gateway, the method comprising: acquiring a device set, the device set including the gateway and a plurality of smart devices bound to the gateway; For each pair of devices in the device set, the first device in the device pair and the second device in the device pair are instructed to perform bidirectional interaction. Based on the received signal strength RSSI values ​​detected by the first device and the second device respectively during the bidirectional interaction, the signal strength between the device pairs is determined. For each first node device, the communication link between the first node device and the second node device is determined based on the signal strength between at least one pair of devices in the device set; the first node device and the second node device are any devices in the device set.

[0006] In one possible implementation, the communication link includes at least a first node device as the destination node and a second node device as the source node; When the number of nodes in the communication link is greater than 2, the communication link also includes at least one third node device as a relay node; the third node device is any device in the device set other than the first node device and the second node device.

[0007] In another possible implementation, the first node device is used as the destination node of the communication link; If it is determined that the signal strength between the device pair containing the first node device and the second node device meets the communication requirements, then the second node device is taken as the source node of the communication link, and the communication link between the smart device and the gateway is obtained. If it is determined that the signal strength between the device pair containing the first node device and the second node device does not meet the communication requirements, the communication link is iterated multiple times until the fifth device obtained in this round of iteration is the second node device, and the communication link obtained in this round of iteration is used as the communication link between the first node device and the second node device. One iteration includes: The third device to participate in this iteration is determined; for the first iteration, the third device is the first node device, and for iterations other than the first iteration, the third device is the fifth device obtained in the previous iteration. Obtain at least one device pair that includes a third device and meets the communication requirements, and obtain the fourth device in at least one device pair; If a second node device exists in the fourth device of at least one device pair, then the second node device is regarded as the fifth device. If the fourth device in at least one device pair does not contain the second node device, then the fourth device in the device pair with the strongest signal strength is designated as the fifth device. The fifth device is used as a node in the communication link; for the first iteration, the fifth device is used as the node preceding the destination node in the communication link, and for iterations other than the first iteration, the fifth device is used as the node preceding the node in the communication link corresponding to the fifth device obtained in the previous iteration.

[0008] In another possible implementation, in response to a device control message sent by a receiving terminal, the target device associated with the device control message is determined from the bound smart devices; Obtain the communication link corresponding to the target device; If it is determined that the number of nodes in the communication link is no more than 2, then control information is sent directly to the target device. If it is determined that the number of nodes in the communication link is greater than 2, then according to the order relationship of each relay node in the communication link, corresponding indication information is generated for each relay node; the indication information is used to instruct the relay node to forward the device control message and the indication information of each relay node to the next device in the communication link. Send device control messages and indication information of each relay node to the first relay node in the communication link.

[0009] In another possible implementation, the first device in the device pair is instructed to broadcast a broadcast packet, and the first device is instructed to send a first number of first messages to the second device upon receiving a response message from the second device based on the broadcast packet, so that the second device returns a second message to the first device each time it receives a first message; The first message is sent after the first device receives a response message or the second message sent by the second device, and both the first and second messages include the RSSI value.

[0010] In another possible implementation, for each pair of devices, if a first number of first messages and a first number of second messages are obtained for the pair of devices, then for each message in the first and second messages, the RSSI values ​​in the first number of messages are sorted to obtain a sorted sequence. The first K1 RSSI values ​​and the last K2 RSSI values ​​in the sorted sequence are removed to obtain the target sequence of messages; K1 and K2 may be the same or different. The mean RSSI is obtained by averaging all RSSI values ​​in the target sequence of the first message and the target sequence of the second message. The signal strength between device pairs is determined based on the absolute value of the mean RSSI; the smaller the absolute value of the mean RSSI, the stronger the signal strength. For each pair of devices, if a first number of first messages and a first number of second messages for the pair are not obtained, it is determined that the signal strength between the pair of devices does not meet the communication requirements; the signal strength that does not meet the communication requirements is lower than the preset signal strength.

[0011] In another possible implementation, if it is determined that the update conditions are met, then the device set is obtained; The update condition is any of the following: The receiving terminal sends a first instruction; the first instruction is used to instruct the communication link between any first node device and a second node device to be updated; In any communication link between a first node device and a second node device, there is at least one pair of adjacent devices whose signal strength attenuation is greater than a preset threshold. The time elapsed since the last update on the communication link exceeds the preset time.

[0012] In another possible implementation, for each first node device, a backup link for the first node device is determined based on the signal strength between at least one pair of devices in the device set; the backup link and the communication link have at least one of the following relationships: The backup link contains more nodes than the communication link. The sum of the signal strengths between all adjacent nodes in the backup link is less than the sum of the signal strengths between all adjacent nodes in the communication link. The method also includes: If it is determined that transmitting a message to the smart device via the communication link fails, the message will be transmitted to the device via the backup link.

[0013] According to a second aspect of the embodiments of this application, a communication link determination apparatus is provided, the apparatus comprising: The acquisition module is used to acquire the device set, which includes the gateway and multiple smart devices bound to the gateway; The instruction module is used to instruct the first device in each pair of devices in the device set to perform bidirectional interaction with the second device in the pair, and to determine the signal strength between the device pairs based on the received signal strength RSSI values ​​detected by the first device and the second device respectively during the bidirectional interaction. The update module is used to determine the communication link between the first node device and the second node device for each first node device based on the signal strength between at least one pair of devices in the device set; the first node device and the second node device are any devices in the device set.

[0014] According to a third aspect of the embodiments of this application, an electronic device is provided, the electronic device including a memory, a processor and a computer program stored in the memory, wherein the processor executes the program to implement the steps of the method provided in the first aspect.

[0015] According to a fourth aspect of the embodiments of this application, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps of the method provided in the first aspect.

[0016] According to a fifth aspect of the present application, a computer program product is provided, the computer program product including computer instructions stored in a computer-readable storage medium, wherein when a processor of a computer device reads the computer instructions from the computer-readable storage medium, the processor executes the computer instructions, causing the computer device to perform steps implementing the method provided in the first aspect.

[0017] The beneficial effects of the technical solutions provided in this application are: The communication link determination method provided in this application embodiment obtains a device set including a gateway and multiple smart devices bound to the gateway. For each device pair in the device set, it instructs the first device in the device pair to perform bidirectional interaction with the second device in the device pair. Based on the RSSI values ​​detected by the first and second devices respectively during the bidirectional interaction, it determines the signal strength between the device pairs. This realizes the determination of the signal strength between devices based on the interaction information between devices, improves the accuracy of the signal strength determination between devices, and provides reliable data support for the subsequent determination of communication links. For each first node device, the communication link between the first node device and the second node device is determined based on the signal strength between at least one pair of devices in the device set. This allows the determination of the communication link to be made by referring to the signal strength between each pair of devices, rather than relying solely on a single device to determine the device with the strongest signal strength. This improves the rationality of the communication link determination and avoids the problem of detour communication when using the determined communication link. Attached Figure Description

[0018] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments of this application will be briefly introduced below.

[0019] Figure 1 A schematic diagram of the system architecture for implementing the communication link determination method provided in the embodiments of this application; Figure 2 A flowchart illustrating a method for determining a communication link provided in an embodiment of this application; Figure 3 A flowchart illustrating the method for obtaining a communication link in a method for determining a communication link provided in an embodiment of this application; Figure 4 A schematic flowchart of one iteration in a method for determining a communication link provided in an embodiment of this application; Figure 5 A flowchart illustrating the control method in a communication link determination method provided in an embodiment of this application; Figure 6 A flowchart illustrating the signal strength in a method for determining a communication link provided in an embodiment of this application; Figure 7 A schematic diagram of a communication link determination device provided in an embodiment of this application; Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0020] The embodiments of this application are described below with reference to the accompanying drawings. It should be understood that the embodiments described below with reference to the accompanying drawings are exemplary descriptions for explaining the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions of the embodiments of this application.

[0021] Those skilled in the art will understand that, unless otherwise stated, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the terms “comprising” and “including” as used in embodiments of this application mean that the corresponding feature can be implemented as the presented feature, information, data, step, operation, element, and / or component, but do not exclude implementation as other features, information, data, step, operation, element, component, and / or combinations thereof supported by the art. It should be understood that when we say that an element is “connected” or “coupled” to another element, the one element can be directly connected or coupled to the other element, or it can mean that the one element and the other element establish a connection relationship through an intermediate element. Furthermore, “connected” or “coupled” as used herein can include wireless connection or wireless coupling. The term “and / or” as used herein indicates at least one of the items defined by the term; for example, “A and / or B” can be implemented as “A,” or as “B,” or as “A and B.”

[0022] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.

[0023] The relevant technologies are explained below: Related technologies rely solely on the device's local identification of the nearest device, lacking comprehensive signal interaction data between all devices, which can easily lead to "local optimization rather than global optimization" (such as detour transmission). In addition, the one-sided interaction results in issues such as missing signal strength data and signal fluctuation interference. The basic data for communication link calculation is inaccurate, and local sampling requires multiple iterations to cover all devices, which is time-consuming.

[0024] In view of at least one of the above-mentioned technical problems or areas for improvement in the related technologies, this application proposes a method for determining communication links. This method obtains a device set including a gateway and multiple smart devices bound to the gateway. For each device pair in the device set, it instructs the first device in the device pair to perform bidirectional interaction with the second device in the device pair. Based on the RSSI values ​​detected by the first and second devices respectively during the bidirectional interaction, the signal strength between the device pairs is determined. This realizes the determination of signal strength between devices based on the interaction information between devices, improves the accuracy of signal strength determination between devices, and provides reliable data support for the subsequent determination of communication links. For each smart device bound to the gateway, the communication link between the smart device and the gateway is determined based on the signal strength between at least one pair of devices in the device set. This allows the determination of the communication link to be made by referring to the signal strength between each pair of devices, rather than relying solely on a single device to determine the device with the strongest signal strength. This improves the rationality of the communication link determination and avoids the problem of detour communication when using the determined communication link.

[0025] The technical solutions of this application and their effects are described below through several exemplary embodiments. It should be noted that the following embodiments can be referenced, borrowed from, or combined with each other. Identical terms, similar features, and similar implementation steps in different embodiments will not be repeated.

[0026] Figure 1 The system architecture diagram provided for the implementation of this application embodiment includes: gateway 120, server 140, and terminal 160.

[0027] Gateway 120 installs and runs an application that has a method for determining communication links. Gateway 120 is used to determine communication links.

[0028] Gateway 120 is connected to server 140 via a wireless network or a wired network.

[0029] Server 140 includes at least one of a single server, multiple servers, a cloud computing platform, and a virtualization center. Illustratively, server 140 includes a processor 144 and a memory 142, the memory 142 including a display module 1421, a control module 1422, and a receiving module 1423. Server 140 provides background services for an application that determines a communication link.

[0030] Optionally, the device type of the terminal includes at least one of the following: smartphone, tablet computer, e-book reader, Moving Picture Experts Group Audio Layer III (MP3) player, Moving Picture Experts Group Audio Layer IV (MP4) player, laptop computer, and desktop computer.

[0031] Those skilled in the art will understand that the number of terminals described above can be more or less. For example, there may be only one terminal, or there may be dozens or hundreds of terminals, or even more. This application does not limit the number of terminals or the type of device.

[0032] This application provides a method for determining a communication link, such as... Figure 2 As shown, the method includes: S101, Obtain device set.

[0033] In this embodiment of the application, the device set includes a gateway and multiple smart devices bound to the gateway. That is, the device set includes not only the devices bound to the gateway but also the gateway itself. The smart devices bound to the gateway can be smart devices such as smart locks, clothes dryers, and air conditioners.

[0034] In this embodiment, both the gateway and the smart devices bound to it communicate via a Mesh module, a communication component used to build self-organizing, self-healing wireless networks. It allows multiple devices (nodes) to connect wirelessly to form a mesh network structure. In this network, each node can not only send and receive data but also act as a relay for other nodes, thereby enhancing network coverage and reliability.

[0035] S102, for each pair of devices in the device set, instruct the first device in the pair to perform bidirectional interaction with the second device in the pair, and determine the signal strength between the pair based on the received signal strength RSSI values ​​detected by the first device and the second device respectively during the bidirectional interaction.

[0036] In the embodiments of this application, the device pair in the device set consists of any two groups of devices in the device set. Each device in the device set is combined with other devices to obtain the device pair in the device set. The first device refers to any one device in each device pair, and the second device refers to the other device in each device pair except the first device.

[0037] In this embodiment of the application, for each pair of devices, the gateway instructs the first device and the second device in the pair to perform bidirectional interaction, that is, to send messages to each other. During the process of the first device and the second device sending messages to each other, when the first device receives a message sent by the second device, it can detect the received signal strength between itself and the second device. When the second device receives a message sent by the first device, it can detect the signal strength between itself and the first device. That is, the RSSI values ​​detected by the first device and the second device are obtained respectively.

[0038] In this embodiment of the application, the signal strength between the device pair refers to the signal strength between the first device and the second device in the device pair. Since the RSSI values ​​detected by the first device and the second device are obtained respectively, the signal strength between the first device and the second device is calculated based on the RSSI values ​​detected by the first device and the second device. Instead of relying on the RSSI value detected by a single device in the device pair, the calculation is based on the RSSI values ​​detected by the two devices respectively, which greatly improves the accuracy of the signal strength calculation between the device pair.

[0039] S103, for each first node device, determine the communication link between the first node device and the second node device based on the signal strength between at least one pair of devices in the device set.

[0040] In the embodiments of this application, the first node device and the second node device are either any devices in the device set. That is, the first node device and the second node device can be either gateways or smart devices. Since the sender and receiver of messages in the communication link are different, the first node device and the second node device in the same communication link are also different.

[0041] In this embodiment of the application, the communication link refers to the communication path between any two devices in the device set when sending messages. Depending on the signal strength between the device pairs in the device set, the devices can send messages directly to the smart device, or they can send messages to the smart device through other bound smart devices.

[0042] In this application embodiment, determining the communication link between the first node device and the second node device may refer to updating the existing communication link between the first node device and the second node device, or it may refer to creating a communication link between the smart device and other devices for a smart device that has just established a binding relationship with the gateway.

[0043] In this embodiment of the application, if the signal strength between the device pairs meets the communication requirements, it means that the two devices in the device pair can directly transmit messages. The communication requirements are usually that the signal strength between the device pairs is greater than a certain strength. Therefore, if for each first node device and any second node device, the signal strength of the device pair including the current first node device and the second node device is obtained, and if the signal strength meets the communication requirements, it means that the second node device can directly establish communication with the first node device. Then, the communication link between the first node device and the second node device only includes the first node device and the second node device.

[0044] In this embodiment of the application, if the signal strength between the first node device and the second node device does not meet the communication requirements, it means that the second node device cannot communicate directly with the first node device. Therefore, by obtaining other devices whose signal strength meets the communication requirements with the second node device and other devices whose signal strength meets the communication requirements with the first node device, the gateway can determine a communication link with the strongest overall signal strength based on the device pair whose signal strength meets the signal communication requirements.

[0045] In one example, device A is the first node device, and the gateway is the second node device. The signal strength between the gateway and device A does not meet the communication requirements. The signal strength between the gateway and devices B and C meets the communication requirements, and the signal strength between the gateway and device C is greater than the signal strength between the gateway and device B. The signal strength between device A and devices B and C also meets the communication requirements, and the signal strength between device A and device C is greater than the signal strength between device A and device B. In order to determine the communication link with the strongest overall signal strength, the link consisting of the gateway, device C, and device A is selected as the communication link between device A and the gateway. That is, when the gateway needs to send a message to device A, it first sends the message to device C, and device C forwards it to device A, thereby realizing message transmission between the gateway and device A.

[0046] The communication link determination method provided in this application embodiment obtains a device set including a gateway and multiple smart devices bound to the gateway. For each device pair in the device set, it instructs the first device in the device pair to perform bidirectional interaction with the second device in the device pair. Based on the RSSI values ​​detected by the first and second devices respectively during the bidirectional interaction, it determines the signal strength between the device pairs. This realizes the determination of the signal strength between devices based on the interaction information between devices, improves the accuracy of the signal strength determination between devices, and provides reliable data support for the subsequent determination of communication links. For each first node device, the communication link between the first node device and the second node device is determined based on the signal strength between at least one pair of devices in the device set. This allows the determination of the communication link to be made by referring to the signal strength between each pair of devices, rather than relying solely on a single device to determine the device with the strongest signal strength. This improves the rationality of the communication link determination and avoids the problem of detour communication when using the determined communication link.

[0047] Based on the above embodiments, as an optional embodiment, the communication link includes at least a first node device as the destination node and a second node device as the source node.

[0048] In the embodiments of this application, the communication link includes at least a first node device as the destination node and a second node as the source node. When the communication link includes at least two nodes, it indicates that the first node device and the second node device can interact directly.

[0049] When the number of nodes in the communication link is greater than 2, the communication link also includes at least one third node device as a relay node; the third node device is any device in the device set other than the first node device and the second node device.

[0050] In this embodiment of the application, when the number of nodes in the communication link is greater than 2, it indicates that the first node device and the second node device in the corresponding communication link cannot interact directly or the signal strength for direct interaction is extremely poor, which does not meet the communication requirements. Therefore, in addition to the source node and the destination node, there is also a relay node in the communication link for forwarding messages sent by the second node device. The relay node can be any device in the device set other than the first node device and the second node device. The number of relay nodes is one or more. The signal strength between any two adjacent nodes in the communication link meets the communication requirements.

[0051] Based on the above embodiments, as an optional embodiment, a method for obtaining a communication link is provided, such as... Figure 3 As shown, the specific process is as follows: S201, designate the first node device as the destination node of the communication link; S202-1, If ​​it is determined that the signal strength between the device pair including the first node device and the second node device meets the communication requirements, then the second node device is taken as the source node of the communication link to obtain the communication link between the smart device and the gateway. S202-2 If it is determined that the signal strength between the device pair containing the first node device and the second node device does not meet the communication requirements, the communication link is iterated multiple times until the fifth device obtained in this round of iteration is the second node device, and the communication link obtained in this round of iteration is used as the communication link between the first node device and the second node device.

[0052] In S201 of this application embodiment, based on the existing communication link between the first node device and the second node device, before updating the communication link, it is necessary to clear the existing communication link and use the first node device as the destination node. Thus, the device is selected as a node based on the signal strength between the device pairs and the destination node. Alternatively, before updating the communication link, only the relay nodes in the communication link can be cleared, while the destination node and source node are retained. If there is no communication link between the first node device and the second node device, an empty communication link is created first, and the first node device is used as the destination node.

[0053] In S202-1 of this application embodiment, if it is determined that the signal strength between the device pair including the first node device and the second node device meets the communication requirements, it means that the first node device can directly interact with the second node device. Therefore, the second node device is used as the source node of the communication link to obtain the communication link between the first node device and the second node device.

[0054] In S202-2 of this application embodiment, if it is determined that the signal strength between the device pair of the first node device and the second node device does not meet the communication requirements, it means that direct interaction is not possible. Therefore, it is necessary to obtain the communication link between the first node device and the second node device by performing multiple iterations on the communication link. In the process of performing multiple iterations, it is a process of continuously determining the fifth device (relay node). Each iteration can determine one relay node. If the fifth device obtained by the iteration is the second node device, it means that there is no need to add a relay node between the first node device and the second node device to forward messages. Therefore, the iteration is stopped, and the communication link obtained in this iteration is used as the communication link between the smart device and the gateway.

[0055] In this application embodiment, a flowchart of a single iteration is also provided, such as... Figure 4 As shown, the specific content is as follows: S301, the third device identified to participate in this iteration; S302, obtain at least one device pair that includes a third device and meets the communication requirements, and obtain the fourth device in the at least one device pair; S303-1, If ​​a second node device exists in the fourth device of at least one device pair, then the second node device shall be regarded as the fifth device; S303-2, If the fourth device in at least one device pair does not contain a second node device, then the fourth device in the device pair with the strongest signal strength shall be designated as the fifth device; S304, which designates the fifth device as a node in the communication link; In S301 of this application embodiment, for the first iteration, the third device is the first node device; for non-first iterations, the third device is the fifth device obtained in the previous iteration. Since the message sent by the second node device needs to be sent to the first node device corresponding to the current communication link, in the first iteration, the nearest neighbor (the fifth device with the strongest signal strength to the destination node) is determined from the side of the destination node, so that the fifth device forwards the message to the destination node. For non-first iterations, since the nearest neighbor of the destination node has been found in the first iteration, in the second iteration, the nearest neighbor of the fifth device with the strongest signal strength to the destination node needs to be found. And so on, each iteration is to find the nearest neighbor of the fifth device determined in the previous iteration. Therefore, for non-first iterations, the third device is the fifth device obtained in the previous iteration.

[0056] In S302 of this application embodiment, according to the communication requirements, a device pair including the fifth device is obtained, and at least one fourth device in the device pair is obtained, that is, the fourth device whose signal strength with the fifth device meets the communication requirements is selected, so that the fifth device for this iteration can be selected from the obtained fourth devices.

[0057] In S303-1 of this application embodiment, if the fourth device has a second node device, it means that the third device in this iteration can directly transmit messages with the second node device. In order to ensure the efficiency of information transmission, on the basis that the signal strength between adjacent nodes of the communication link meets the communication requirements, the fewer nodes contained in the communication link, the faster the message transmission. Therefore, if the fourth device has a second node device, it means that the second node device can be directly used as the fifth device, and the iteration can be stopped directly after the second node device is updated in the communication link.

[0058] In S303-2 of this application embodiment, if there is no second node device in the fourth device, it means that it is necessary to continue to find the device with the strongest signal strength between the third device. Therefore, the fourth device in the pair of devices with the strongest signal strength is taken as the fifth device.

[0059] In S304 of this application embodiment, for the first iteration, the fifth device is designated as the preceding node of the destination node in the communication link. For iterations other than the first iteration, the fifth device is designated as the preceding node of the node in the communication link corresponding to the fifth device obtained in the previous iteration. That is, after determining the fifth device, it needs to be written into the communication link as a node. In the first iteration, since the third device is the destination node, the fifth device obtained in the first iteration is directly designated as the preceding node of the destination node, ensuring that the smart device with the strongest signal strength to the destination node forwards the message to the destination node. For iterations other than the first iteration, since the fifth device is used to find the nearest neighbor of the third device, the fifth device is designated as the preceding node of the node corresponding to the fifth device obtained in the previous iteration, ensuring that the fifth device obtained in this iteration forwards the message to the third device during communication.

[0060] In the above scheme, when the source node in the communication link cannot directly interact with the destination node, the nearest neighbor is found iteratively starting from the destination node's side. The iteration stops directly when the nearest neighbor is the gateway. This not only ensures the maximum signal strength between adjacent nodes in the communication link, but also minimizes the number of nodes in the communication link. It achieves the dual limitation of the number of hops (number of nodes) and signal strength in the communication link, breaking through the limitation of relying on only a single limitation. It ensures the optimal transmission efficiency of the acquired communication link and avoids the problem of detours when any two devices in the device cluster interact with messages.

[0061] Based on the above embodiments, as an optional embodiment, a control method is provided, such as... Figure 5 As shown, the specific content is as follows: S401 responds to the device control message sent by the receiving terminal and determines the target device related to the device control message from the bound smart devices; S402, Obtain the communication link corresponding to the target device; S403-1, If ​​it is determined that the number of nodes in the communication link is no more than 2, then directly send a device control message to the target device; S403-2, If it is determined that the number of nodes in the communication link is greater than 2, then according to the order relationship of each relay node in the communication link, corresponding indication information is generated for each relay node; the indication information is used to instruct the relay node to forward the device control message and the indication information of each relay node to the next device in the communication link. S404 sends device control messages and indication information for each relay node to the first relay node in the communication link.

[0062] In S401 of this application embodiment, when a device control message sent by the terminal is received, the target device to be controlled is determined according to the device control message, that is, the target device related to the device control message is determined from the bound smart devices.

[0063] In S402 of this application embodiment, the communication link corresponding to the target device is obtained, thereby determining how to send device control messages to the target device.

[0064] In S403-1 of this application embodiment, if it is determined that the number of nodes included in the communication link is no more than 2, it means that the current gateway can directly interact with the target device. Therefore, device control messages are sent directly to the target device.

[0065] In S403-2 of this application embodiment, if it is determined that the number of nodes in the communication link is greater than 3, it means that the current gateway cannot directly interact with the target device and needs to forward the device control message to the target device through the relay node in the communication link. Therefore, the order relationship of each relay node in the communication link is obtained. According to the order relationship, it can be determined which device each relay node needs to forward the device control message to. In order to instruct each relay node to forward the device control message to the corresponding device, corresponding indication information is generated for each relay node to instruct the relay node to send the device control message and the relay node's indication information to the next device in the communication link, so that each relay node knows which device the device control message indication information needs to be forwarded to.

[0066] In S404 of this application embodiment, the gateway sends device control messages and indication information of each relay node to adjacent relay nodes in the communication link, that is, it sends device control messages and indication information of each relay node to the first relay node of the communication link terminal.

[0067] In one example, the communication link consists of a gateway, a second device, a fourth device, and a third device arranged in sequence. The second and fourth devices are relay nodes. The indication information for the second device is to send a device control message to the fourth device, and the indication information for the fourth device is to send a device control message to the third device.

[0068] In the above scheme, when the gateway receives a device control message sent by the terminal, it determines the method to send the device control message to the target device based on the communication link of the target device stored locally. When it is necessary to forward the device control message through other smart devices, it generates corresponding indication information for each smart device acting as a relay node. This allows the smart device acting as a relay node to directly forward the device control message according to the indication when it receives the device control message, without having to determine the forwarding path itself, thus improving the efficiency of message transmission between the gateway and the target device.

[0069] Based on the above embodiments, as an optional embodiment, the first device in the device pair broadcasts a broadcast packet and instructs the first device to send a first number of first messages to the second device after receiving a response message returned by the second device based on the broadcast packet, so that the second device returns a second message to the first device each time it receives a first message; wherein the first message is sent after the first device receives the response message or the second message sent by the second device, and both the first message and the second message include an RSSI value.

[0070] In this embodiment, the gateway can determine whether it can currently engage in bidirectional interaction with the second device by instructing the first device to broadcast a broadcast packet. Upon receiving a response from the second device, it indicates that bidirectional interaction with the second device is currently possible. The gateway can also detect the RSSI value upon receiving the response. Therefore, after determining that the first device has received the response, the gateway instructs the first device to send a first number of first messages to the second device. Each time the second device receives a first message from the first device, it can detect the RSSI value and send the latest detected RSSI value in the returned second message to the first device. The first device also detects the RSSI value upon receiving both the response and the first messages. This allows the first device to send the latest detected RSSI value in the first message to the second device. Therefore, both the first and second messages include the RSSI value.

[0071] In this embodiment, since both the first message and the second message need to carry the latest detected RSSI value, and RSSI value detection is necessarily accompanied by the receipt of a new message, the first device will only continue to send the first message to the second device after receiving the latest response message or the second message sent by the second device. Similarly, the second device can only perform the latest RSSI value detection and send the first message to the first device when it receives the latest first message sent by the first device. Therefore, if the first device does not receive a new message from the other party while sending the first number of first messages to the second device, the first device will not be able to complete the sending of the first number of first messages.

[0072] In the above scheme, bidirectional interaction is achieved by instructing the first device to send a first number of first messages to the second device, which provides sufficient calculation data for subsequent calculation of the signal strength between the first device and the second device, thereby improving the accuracy of signal strength confirmation.

[0073] Based on the above embodiments, as an optional embodiment, a method for determining signal strength is provided, such as... Figure 6 As shown, the specific content is as follows: S501-1, if the device obtains a first number of first messages and a first number of second messages, then for each message in the first message and the second message, sort the RSSI values ​​in the first number of messages to obtain a sorted sequence, remove the first K1 RSSI values ​​and the last K2 RSSI values ​​in the sorted sequence to obtain the target sequence of messages. S502, calculate the mean of all RSSI values ​​in the target sequence of the first message and the target sequence of the second message to obtain the mean RSSI; S503 determines the signal strength between device pairs based on the absolute value of the mean RSSI. S501-2, if the first number of first messages and the first number of second messages of the device pair are not obtained, it is determined that the signal strength between the device pairs does not meet the communication requirements; the signal strength that does not meet the communication requirements is lower than the preset signal strength.

[0074] In S501-1 of this application embodiment, if a first number of first messages and a first number of second messages of a device pair are obtained, it indicates that the first device and the second device have completed the bidirectional interaction process of the gateway indication. Therefore, the signal strength between the device pair can be further determined based on the RSSI values ​​in the first message and the second message. For each message in the first message and the second message, the RSSI values ​​in each message of the first number are sorted according to the numerical value of the RSSI values ​​from high to low or the strength from low to high to obtain a sorted sequence. The first K1 RSSI values ​​and the last K2 RSSI values ​​in the sorted sequence are removed, which means removing the largest K1 RSSI values ​​and the smallest K2 RSSI values ​​in the sorted sequence to obtain the target sequence of the first message and the target sequence of the second message. K1 and K2 are positive integers, and the specific values ​​of K1 and K2 are determined according to the first number.

[0075] It should be noted that K1 and K2 can be the same or different.

[0076] In S502 of this application embodiment, all RSSI values ​​in the target sequence of the first message and the target sequence of the second message are obtained, all RSSI values ​​in the two target sequences are summed, and the mean RSSI value is obtained based on the ratio between the obtained sum and the number of all RSSI values.

[0077] In S503 of this application embodiment, the smaller the absolute value of the RSSI mean, the stronger the signal strength. Therefore, the absolute value of the RSSI mean is obtained, and the signal strength between the device pairs is determined based on the absolute value of the RSSI mean.

[0078] In S501-2 of this application embodiment, the signal strength that does not meet the communication requirements is lower than the preset signal strength. Therefore, if the first number of first messages and the first number of second messages of the device pair are not obtained, it indicates that the bidirectional interaction process indicated by the gateway has not been completed between the first device and the second device. Therefore, it indicates that the first device and the second device cannot interact or the signal strength is too weak to meet the communication requirements. Therefore, it is determined that the signal strength between the device pair does not meet the communication requirements.

[0079] In one example, if the first device or the second device does not receive a message from the other party within 5ms, the first device is instructed to stop bidirectional interaction with the second device.

[0080] In one example, the gateway instructs the first device in the device pair to send 100 first messages to the second device. The second device will then send 100 second messages to the first device. Both the first and second messages include the device identifier of the message sender, the device identifier of the message receiver, the RSSI value, the sequence number, and the timestamp. After completing the above bidirectional interaction process, the RSSI value in the first message is obtained. The top 5% maximum value and the bottom 5% minimum value of the 100 RSSI values ​​are removed, i.e., K is 5 here. The remaining 180 RSSI values ​​are averaged to obtain the RSSI mean. Based on the absolute value of the RSSI mean, the signal strength between the device pairs is determined.

[0081] In the above scheme, the signal strength between the devices is determined by instructing the devices in the pair to send a first number of messages bidirectionally, and the RSSI values ​​detected during the sending of the first number of messages are used to determine the signal strength between the devices. In the process of determining the signal strength based on the RSSI values, the RSSI values ​​are sorted according to their numerical values, and the largest and smallest RSSI values ​​are removed to ensure the stability of the RSSI values ​​involved in the signal strength calculation. Furthermore, in the process of calculating the signal strength, the RSSI values ​​detected by the two devices are combined by averaging to determine the signal strength, which improves the accuracy of the signal strength calculation between the devices.

[0082] Based on the above embodiments, as an optional embodiment, if it is determined that the update conditions are met, then the device set is obtained; The update condition is any of the following: The receiving terminal sends a first instruction; the first instruction is used to instruct the communication link between any first node device and the second node device to be updated. In any communication link between a first node device and a second node device, there is at least one pair of adjacent devices whose signal strength attenuation is greater than a preset threshold. The time elapsed since the last update on the communication link exceeds the preset time.

[0083] In the embodiments of this application, the determination of the communication link can be initiated by the user or by the gateway.

[0084] In this embodiment of the application, when a first instruction sent by the terminal is received to update the communication link between any first node device and the second node device, it indicates that the current user needs to update the communication link, and therefore, the communication link acquisition process is started.

[0085] In this embodiment of the application, if it is determined that there is at least one pair of adjacent devices in the communication link between any first node device and second node device with signal strength attenuation greater than a preset threshold, it indicates that there is a weakening signal strength between adjacent devices in the communication link. In order to avoid the weakening of the adjacent devices affecting the message transmission of the current communication link and other communication links, the gateway automatically starts the communication link acquisition process.

[0086] In one example, the smart devices bound to the gateway report the signal strength between themselves and neighboring devices every hour. If the signal strength attenuation of the communication link is determined to be ≥10dBm based on the reported signal strength, the communication link acquisition process begins.

[0087] In this embodiment, if the gateway determines that the time elapsed since the last update of the communication link has exceeded a preset time, it indicates that the communication link has not been updated for a long time, and the signal strength between the devices may have changed. In order to ensure that the gateway uses the best communication link when transmitting messages, the gateway automatically starts the communication link acquisition process.

[0088] In this embodiment, a machine learning model can also be introduced to calculate the communication link failure probability based on the historical signal strength data of the device pair and the machine learning model. When the failure probability is determined to be greater than the probability threshold, the communication link is actively updated, thus avoiding the low message transmission efficiency caused by the passive switching of the communication link.

[0089] In the above scheme, by setting update conditions, the update of the communication link is started when the update conditions are met. This ensures that the communication link is not updated frequently, thus avoiding the waste of gateway computing resources, and also ensures that the optimal communication link is used when the gateway uses the communication link for transmission, thereby improving the efficiency of message transmission.

[0090] Based on the above embodiments, as an optional embodiment, for each first node device, a backup link for the first node device is determined based on the signal strength between at least one pair of devices in the device set; the backup link and the communication link have at least one of the following relationships: The backup link contains more nodes than the communication link. The sum of the signal strengths between all adjacent nodes in the backup link is less than the sum of the signal strengths between all adjacent nodes in the communication link.

[0091] In this embodiment, there is not only a communication link between any first node device and the second node device, but also a backup link. The backup link is also determined based on the signal strength between the device pairs. Since the communication link is the best link for any first node device to transmit messages to the second node device, the difference between the backup link and the communication link may be that the backup link has more relay nodes for forwarding messages, and the number of nodes contained in the backup link is greater than the number of nodes contained in the communication link. Alternatively, the overall signal strength of the backup link may be greater than that of other links, but less than the total signal strength of the communication link. That is, the sum of the signal strengths between all adjacent nodes in the backup link is less than the sum of the signal strengths between all adjacent nodes in the communication link.

[0092] In this embodiment of the application, if it is determined that transmitting a message to the smart device through the communication link fails, the message is transmitted to the device through the backup link.

[0093] In this embodiment of the application, in order to improve the efficiency of message transmission, a communication link and a backup link are generated for each smart device. When it fails to transmit a message to the smart device using the communication link, the message is transmitted through the backup link to avoid excessive message transmission delay caused by real-time path exploration.

[0094] In the above solution, by setting up a backup link, the efficiency of message transmission is further guaranteed, and the failure to transmit messages to smart devices in a timely manner is avoided.

[0095] The communication link determination method provided in this application is applicable to a single smart home environment, and specific scenarios include: Equipment configuration: a single smart gateway + multiple fixed-location mesh module smart devices (such as smart locks, clothes dryers, air conditioners, lights, drivers, smart switches, etc.); Ecosystem limitations: Mesh module smart devices of the same brand / ecosystem.

[0096] In one example, a method for determining a communication link for use in a smart home environment is provided, wherein the device set includes: gateway M1, living room light fixture M2, air conditioner M3, bedroom switch M4, and clothes dryer M5.

[0097] The user triggers the "Start Communication Link Update" function through the terminal, and the terminal displays "Updating, estimated remaining time 1 minute". The gateway responds to the terminal's instruction and starts the update process. For each pair of devices in the device set, the gateway instructs the first and second devices of the pair to interact bidirectionally. For example, if the pair of devices includes M1 and M2, the gateway instructs M1 to enter "Discovery Mode" and start broadcasting a broadcast packet, and M2 to enter "Listen Mode" to respond to the broadcast packet. After M1 confirms that it has received the response information, M1 starts to send and receive 100 first messages bidirectionally with M2 (once every 10ms). Example of the first message: [M1]+[M2]+[-51dBm]+

[001] +[169000]; after M2 receives each first message, it sends back a second message within 5ms. Example of the second message: [M2]+[M1]+[-52dBm]+

[001] +[169005].

[0098] After calculating the signal strength between M1 and M2, M1 sequentially performs the same bidirectional transmission and reception and signal strength calculation process 100 times with M3, M4, and M5. Then, M2 starts bidirectional transmission and reception with M3 until all device pairs complete bidirectional transmission and reception.

[0099] Based on the acquired RSSI values ​​between each device pair, the gateway constructs the following signal strength matrix, and then determines the communication link and backup link according to the signal strength matrix. The signal strength matrix is ​​shown in Table 1, and the specific contents are as follows:

[0100] Table 1 For example, for M3, M3 and M1 cannot interact directly. The communication link is determined to be M1→M2→M3 (-52.1dBm, -55.3dBm), and the backup link is M1→M4→M3 (-61.8dBm, -57.5dBm). The gateway stores the above communication link and backup link. When the user sends a command to turn off the air conditioner through an interrupt, M1 sends the command to turn off the air conditioner through M1→M2→M3. After receiving the command to turn off the air conditioner, M3 responds immediately and turns off the air conditioner.

[0101] This application provides a device for determining a communication link, such as... Figure 7 As shown, the communication link determination device 70 may include: an acquisition module 701, an indication module 702, and an update module 703.

[0102] Specifically, the acquisition module 701 is used to acquire a device set, which includes a gateway and multiple smart devices bound to the gateway; The instruction module 702 is used to instruct the first device in each pair of devices in the device set to perform bidirectional interaction with the second device in the device pair, and to determine the signal strength between the device pairs based on the received signal strength RSSI values ​​detected by the first device and the second device respectively during the bidirectional interaction. The update module 703 is used to determine, for each first node device, the communication link between the first node device and the second node device based on the signal strength between at least one pair of devices in the device set; the first node device and the second node device are any devices in the device set.

[0103] The communication link determination device provided in this application embodiment acquires a device set including a gateway and multiple smart devices bound to the gateway. For each device pair in the device set, it instructs the first device in the device pair to perform bidirectional interaction with the second device in the device pair. Based on the RSSI values ​​detected by the first device and the second device respectively during the bidirectional interaction, it determines the signal strength between the device pairs. This realizes the determination of the signal strength between devices based on the interaction information between devices, improves the accuracy of the determination of the signal strength between devices, and provides reliable data support for the subsequent determination of the communication link. For each first node device, the communication link between the first node device and the second node device is determined based on the signal strength between at least one pair of devices in the device set. This allows the determination of the communication link to be made by referring to the signal strength between each pair of devices, rather than relying solely on a single device to determine the device with the strongest signal strength. This improves the rationality of the communication link determination and avoids the problem of detour communication when using the determined communication link.

[0104] The apparatus in this application embodiment can execute the method provided in this application embodiment, and the implementation principle is similar. The actions performed by each module in the apparatus of each embodiment of this application correspond to the steps in the method of each embodiment of this application. For detailed functional descriptions of each module of the apparatus, please refer to the descriptions in the corresponding methods shown above, which will not be repeated here.

[0105] Furthermore, in one possible implementation, the communication link includes at least a first node device as the destination node and a second node device as the source node; When the number of nodes in the communication link is greater than 2, the communication link also includes at least one third node device as a relay node; the third node device is any device in the device set other than the first node device and the second node device.

[0106] In another possible implementation, the first node device is used as the destination node of the communication link; If it is determined that the signal strength between the device pair containing the first node device and the second node device meets the communication requirements, then the second node device is taken as the source node of the communication link, and the communication link between the smart device and the gateway is obtained. If it is determined that the signal strength between the device pair containing the first node device and the second node device does not meet the communication requirements, the communication link is iterated multiple times until the fifth device obtained in this round of iteration is the second node device, and the communication link obtained in this round of iteration is used as the communication link between the first node device and the second node device. One iteration includes: The third device to participate in this iteration is determined; for the first iteration, the third device is the first node device, and for iterations other than the first iteration, the third device is the fifth device obtained in the previous iteration. Obtain at least one device pair that includes a third device and meets the communication requirements, and obtain the fourth device in at least one device pair; If a second node device exists in the fourth device of at least one device pair, then the second node device is regarded as the fifth device. If the fourth device in at least one device pair does not contain the second node device, then the fourth device in the device pair with the strongest signal strength is designated as the fifth device. The fifth device is used as a node in the communication link; for the first iteration, the fifth device is used as the node preceding the destination node in the communication link, and for iterations other than the first iteration, the fifth device is used as the node preceding the node in the communication link corresponding to the fifth device obtained in the previous iteration.

[0107] In another possible implementation, in response to a device control message sent by a receiving terminal, the target device associated with the device control message is determined from the bound smart devices; Obtain the communication link corresponding to the target device; If it is determined that the number of nodes in the communication link is no more than 2, then control information is sent directly to the target device. If it is determined that the number of nodes in the communication link is greater than 2, then according to the order relationship of each relay node in the communication link, corresponding indication information is generated for each relay node; the indication information is used to instruct the relay node to forward the device control message and the indication information of each relay node to the next device in the communication link. Send device control messages and indication information of each relay node to the first relay node in the communication link.

[0108] In another possible implementation, the first device in the device pair is instructed to broadcast a broadcast packet, and the first device is instructed to send a first number of first messages to the second device upon receiving a response message from the second device based on the broadcast packet, so that the second device returns a second message to the first device each time it receives a first message; The first message is sent after the first device receives a response message or the second message sent by the second device, and both the first and second messages include the RSSI value.

[0109] In another possible implementation, for each pair of devices, if a first number of first messages and a first number of second messages are obtained for the pair of devices, then for each message in the first and second messages, the RSSI values ​​in the first number of messages are sorted to obtain a sorted sequence. The first K1 RSSI values ​​and the last K2 RSSI values ​​in the sorted sequence are removed to obtain the target sequence of messages; K1 and K2 may be the same or different. The mean RSSI is obtained by averaging all RSSI values ​​in the target sequence of the first message and the target sequence of the second message. The signal strength between device pairs is determined based on the absolute value of the mean RSSI; the smaller the absolute value of the mean RSSI, the stronger the signal strength. For each pair of devices, if a first number of first messages and a first number of second messages for the pair are not obtained, it is determined that the signal strength between the pair of devices does not meet the communication requirements; the signal strength that does not meet the communication requirements is lower than the preset signal strength.

[0110] In another possible implementation, if it is determined that the update conditions are met, then the device set is obtained; The update condition is any of the following: The receiving terminal sends a first instruction; the first instruction is used to instruct the communication link between any first node device and a second node device to be updated; In any communication link between a first node device and a second node device, there is at least one pair of adjacent devices whose signal strength attenuation is greater than a preset threshold. The time elapsed since the last update on the communication link exceeds the preset time.

[0111] In another possible implementation, for each first node device, a backup link for the first node device is determined based on the signal strength between at least one pair of devices in the device set; the backup link and the communication link have at least one of the following relationships: The backup link contains more nodes than the communication link. The sum of the signal strengths between all adjacent nodes in the backup link is less than the sum of the signal strengths between all adjacent nodes in the communication link. The method also includes: If it is determined that transmitting a message to the smart device via the communication link fails, the message will be transmitted to the device via the backup link.

[0112] This application provides an electronic device (computer device / equipment / system) including a memory, a processor, and a computer program stored in the memory. The processor executes the computer program to implement the steps of a method for determining a communication link. Compared with related technologies, this method can achieve the following: by acquiring a device set including a gateway and multiple smart devices bound to the gateway, for each pair of devices in the device set, instructing the first device in the pair to perform bidirectional interaction with the second device in the pair, and determining the signal strength between the pair based on the RSSI values ​​detected by the first and second devices respectively during the bidirectional interaction. This realizes the determination of the signal strength between devices based on the interaction information between devices, improves the accuracy of the determination of the signal strength between devices, and provides reliable data support for the subsequent determination of the communication link. For each first node device, the communication link between the first node device and the second node device is determined based on the signal strength between at least one pair of devices in the device set. This allows the determination of the communication link to be made by referring to the signal strength between each pair of devices, rather than relying solely on a single device to determine the device with the strongest signal strength. This improves the rationality of the communication link determination and avoids the problem of detour communication when using the determined communication link.

[0113] In one alternative embodiment, an electronic device is provided, such as Figure 8 As shown, Figure 8 The illustrated electronic device 4000 includes a processor 4001 and a memory 4003. The processor 4001 and the memory 4003 are connected, for example, via a bus 4002. Optionally, the electronic device 4000 may further include a transceiver 4004, which can be used for data interaction between the electronic device and other electronic devices, such as sending and / or receiving data. It should be noted that in practical applications, the transceiver 4004 is not limited to one type, and the structure of the electronic device 4000 does not constitute a limitation on the embodiments of this application.

[0114] Processor 4001 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It can implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. Processor 4001 may also be a combination that implements computational functions, such as including one or more microprocessor combinations, a combination of a DSP and a microprocessor, etc.

[0115] Bus 4002 may include a pathway for transmitting information between the aforementioned components. Bus 4002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. Bus 4002 can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 8 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.

[0116] The memory 4003 may be ROM (Read Only Memory) or other types of static storage devices capable of storing static information and instructions, RAM (Random Access Memory) or other types of dynamic storage devices capable of storing information and instructions, or EEPROM (Electrically Erasable Programmable Read Only Memory), CD-ROM (Compact Disc Read Only Memory) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media, other magnetic storage devices, or any other medium capable of carrying or storing computer programs and capable of being read by a computer, without limitation herein.

[0117] The memory 4003 stores computer programs that execute embodiments of this application, and its execution is controlled by the processor 4001. The processor 4001 executes the computer programs stored in the memory 4003 to implement the steps shown in the foregoing method embodiments.

[0118] The electronic device package may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital radio receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), and in-vehicle terminals (such as in-vehicle navigation terminals), as well as fixed terminals such as digital TVs and desktop computers. Figure 8 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments disclosed herein.

[0119] This application provides a computer-readable storage medium storing a computer program. When executed by a processor, the computer program can implement the steps and corresponding content of the aforementioned method embodiments. Compared with the prior art, it can achieve the following: by acquiring a device set including a gateway and multiple smart devices bound to the gateway, for each device pair in the device set, instructing the first device in the device pair to perform bidirectional interaction with the second device in the device pair, and determining the signal strength between the device pairs based on the RSSI values ​​detected by the first and second devices respectively during the bidirectional interaction, it realizes the determination of the signal strength between devices based on the interaction information between devices, improves the accuracy of the determination of the signal strength between devices, and provides reliable data support for the subsequent determination of the communication link; For each first node device, the communication link between the first node device and the second node device is determined based on the signal strength between at least one pair of devices in the device set. This allows the determination of the communication link to be made by referring to the signal strength between each pair of devices, rather than relying solely on a single device to determine the device with the strongest signal strength. This improves the rationality of the communication link determination and avoids the problem of detour communication when using the determined communication link.

[0120] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium, a computer-readable medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.

[0121] This application also provides a computer program product, including a computer program that, when executed by a processor, can implement the steps and corresponding content of the aforementioned method embodiments. Compared with the prior art, it can achieve: By acquiring a device set including a gateway and multiple smart devices bound to the gateway, for each device pair in the device set, the first device in the device pair is instructed to perform bidirectional interaction with the second device in the device pair. Based on the RSSI values ​​detected by the first and second devices respectively during the bidirectional interaction, the signal strength between the device pairs is determined. This realizes the determination of the signal strength between devices based on the interaction information between devices, improves the accuracy of the determination of the signal strength between devices, and provides reliable data support for the determination of subsequent communication links. For each first node device, the communication link between the first node device and the second node device is determined based on the signal strength between at least one pair of devices in the device set. This allows the determination of the communication link to be made by referring to the signal strength between each pair of devices, rather than relying solely on a single device to determine the device with the strongest signal strength. This improves the rationality of the communication link determination and avoids the problem of detour communication when using the determined communication link.

[0122] The terms "first," "second," "third," "fourth," "1," "2," etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in a sequence other than that shown in the illustrations or text descriptions.

[0123] It should be understood that although arrows indicate various operation steps in the flowcharts of this application's embodiments, the order in which these steps are implemented is not limited to the order indicated by the arrows. Unless explicitly stated herein, in some implementation scenarios of this application's embodiments, the implementation steps in each flowchart can be executed in other orders as required. Furthermore, some or all steps in each flowchart, based on the actual implementation scenario, may include multiple sub-steps or multiple stages. Some or all of these sub-steps or stages can be executed at the same time, and each sub-step or stage can also be executed at different times. In scenarios where execution times differ, the execution order of these sub-steps or stages can be flexibly configured according to requirements, and this application's embodiments do not limit this.

[0124] The above are only optional implementation methods for some implementation scenarios of this application. It should be noted that for those skilled in the art, other similar implementation methods based on the technical concept of this application, without departing from the technical concept of this application, also fall within the protection scope of the embodiments of this application.

Claims

1. A method for determining a communication link, characterized in that, Applied to a gateway, the method includes: Obtain a device set, which includes the gateway and multiple smart devices bound to the gateway; For each pair of devices in the device set, the first device in the pair is instructed to perform bidirectional interaction with the second device in the pair. Based on the received signal strength (RSSI) values ​​detected by the first device and the second device respectively during the bidirectional interaction, the signal strength between the pair of devices is determined. For each first node device, a communication link between the first node device and the second node device is determined based on the signal strength between at least one pair of devices in the device set; the first node device and the second node device are both any devices in the device set.

2. The method according to claim 1, characterized in that, The communication link includes at least the first node device as the destination node and the second node device as the source node; When the number of nodes included in the communication link is greater than 2, the communication link also includes at least one third node device as a relay node; the third node device is any device in the device set other than the first node device and the second node device.

3. The method according to claim 2, characterized in that, Determining the communication link between the first node device and the second node device based on the signal strength between at least one pair of devices in the device set includes: The first node device is designated as the destination node of the communication link; If it is determined that the signal strength between the device pair containing the first node device and the second node device meets the communication requirements, then the second node device is used as the source node of the communication link to obtain the communication link between the smart device and the gateway. If it is determined that the signal strength between the device pair containing the first node device and the second node device does not meet the communication requirements, the communication link is iterated multiple times until the fifth device obtained in this round of iteration is the second node device, and the communication link obtained in this round of iteration is used as the communication link between the first node device and the second node device. One iteration includes: The third device to participate in this iteration is determined; for the first iteration, the third device is the first node device, and for iterations other than the first iteration, the third device is the fifth device obtained in the previous iteration. Obtain at least one device pair that includes the third device and satisfies the communication requirements, and obtain the fourth device in the at least one device pair; If the second node device exists in the fourth device of the at least one device pair, then the second node device is regarded as the fifth device; If the second node device is not present in the fourth device of the at least one device pair, then the fourth device in the device pair with the strongest signal strength shall be designated as the fifth device. The fifth device is used as a node in the communication link; wherein, for the first iteration, the fifth device is used as the node preceding the destination node of the communication link, and for iterations other than the first iteration, the fifth device is used as the node preceding the node in the communication link corresponding to the fifth device obtained in the previous iteration.

4. The method according to claim 2, characterized in that, The method further includes: In response to a device control message sent by a receiving terminal, a target device associated with the device control message is determined from among the bound smart devices; Obtain the communication link corresponding to the target device; If it is determined that the number of nodes in the communication link is no more than 2, then the device control message is sent directly to the target device. If it is determined that the number of nodes in the communication link is greater than 2, then according to the order relationship of each relay node in the communication link, corresponding indication information is generated for each relay node; the indication information is used to instruct the relay node to forward the device control message and the indication information of each relay node to the next device in the communication link; The device control message and the indication information of each relay node are sent to the first relay node in the communication link.

5. The method according to claim 1, characterized in that, The instruction to the first device in the device pair and the second device in the device pair to perform bidirectional interaction includes: The device instructs the first device in the device pair to broadcast a broadcast packet, and instructs the first device to send a first number of first messages to the second device upon receiving a response message from the second device based on the broadcast packet, so that the second device returns a second message to the first device each time it receives the first message; The first message is sent after the first device receives a response message or a second message from the second device, and both the first message and the second message include an RSSI value.

6. The method according to claim 5, characterized in that, The step of determining the signal strength between the device pairs based on the received signal strength (RSSI) values ​​detected by the first device and the second device respectively during the bidirectional interaction includes: If the device obtains a first number of first messages and a first number of second messages, then for each of the first and second messages, the RSSI values ​​in the first number of messages are sorted to obtain a sorted sequence. The first K1 RSSI values ​​and the last K2 RSSI values ​​in the sorted sequence are removed to obtain the target sequence of the messages; where K1 and K2 are the same or different. The mean RSSI is obtained by averaging all RSSI values ​​in the target sequence of the first message and the target sequence of the second message. The signal strength between the device pairs is determined based on the absolute value of the mean RSSI; the smaller the absolute value of the mean RSSI, the stronger the signal strength. If a first number of first messages and a first number of second messages for the device pair are not obtained, it is determined that the signal strength between the device pair does not meet the communication requirements.

7. The method according to claim 1, characterized in that, The acquired device set includes: If the update conditions are determined to be met, then the device set is obtained; The update condition is any one of the following: The receiving terminal sends a first instruction; the first instruction is used to instruct the communication link between any first node device and a second node device to be updated; In any communication link between a first node device and a second node device, there is at least one pair of adjacent devices whose signal strength attenuation is greater than a preset threshold. The time elapsed since the last update on the communication link exceeds a preset time.

8. The method according to claim 1, characterized in that, After determining the communication link between the first node device and the second node device, the process further includes: For each first node device, a backup link for the first node device is determined based on the signal strength between at least one pair of devices in the device set; the backup link and the communication link have at least one of the following relationships: The number of nodes in the backup link is greater than the number of nodes in the communication link. The sum of the signal strengths between all adjacent nodes in the backup link is less than the sum of the signal strengths between all adjacent nodes in the communication link; The method further includes: If it is determined that transmitting a message to the smart device via the communication link fails, then the message is transmitted to the device via the backup link.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the method according to any one of claims 1-8.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the method described in any one of claims 1-8.