Communication method and communication device

By carrying RTT judgment of RSSI field and detection packets in the discovery message and selecting the appropriate connection method, the success rate of LAN signaling connection and high-speed WiFi connection is solved, and the connection success rate and service experience of electronic devices are improved.

CN120358631APending Publication Date: 2025-07-22HUAWEI TECH CO LTD
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202410086706.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-01-22
Publication Date
2025-07-22

AI Technical Summary

Technical Problem

How to ensure the success rate of electronic devices establishing signaling connections through LAN in the LAN scenario, and ensure the success rate of establishing high-speed WiFi connections, avoiding waste of resources and connection failures.

Method used

By carrying the received signal strength indication (RSSI) field in the discovery message, the distance between the device and the router is determined, and the signal strength is determined whether the LAN connection conditions are met, and the appropriate connection method is selected; after the signaling connection is established, the feasibility of point-to-point connection is judged by the round-trip delay (RTT) of the probe message, and the optimal transmission method is selected.

Benefits of technology

It improves the success rate of signaling connections and the success rate of high-speed WiFi connections, reduces resource waste, and improves the experience of distributed services.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120358631A_ABST
    Figure CN120358631A_ABST
Patent Text Reader

Abstract

The invention provides a communication method and a communication device. The method comprises: a transmitting end device receives a first message from a receiving end device through a router, the first message comprising a first field for representing the signal strength of the receiving end device, and further comprising a second field for representing the signal strength of the router. And the sending end equipment determines the distance between the receiving end equipment and the router according to the first field, determines the distance between the router and the sending end equipment according to the second field, and establishes signaling connection with the receiving end equipment through the local area network when the two distances meet a certain condition. And when the distance between the transmitting end equipment and the receiving end equipment meets a certain condition, establishing data connection with the receiving end equipment in a point-to-point manner. According to the communication method and the communication device, the success rate of establishing the signaling connection by the electronic equipment through the local area network can be ensured as much as possible, and the success rate of establishing the data connection in a point-to-point manner can be ensured as much as possible.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of communication technologies, and more particularly, to a communication method and a communication device. Background Art

[0002] In current distributed services, electronic devices can usually search for peripheral devices based on the Constrained Application Protocol (CoAP) medium or the Bluetooth Low Energy (BLE) medium. Among them, the electronic device searching for peripheral devices based on the CoAP medium belongs to a search method in a local area network scenario, and the electronic device searching for peripheral devices based on the BLE medium belongs to a search method in a non-local area network scenario. The search rates of the above two media are different.

[0003] Generally speaking, through the CoAP medium, peripheral devices can be searched relatively quickly to complete the discovery process, and a signaling connection can be established with the peripheral devices. Moreover, since the wireless fidelity (WiFi) connection has high efficiency in business transmission, usually after the signaling connection is established, the electronic devices can be guided to establish a high-speed WiFi connection.

[0004] Although electronic devices can discover each other relatively quickly using the CoAP medium in a local area network, it is unknown whether the discovered electronic devices can still establish a signaling connection using CoAP. Blindly using CoAP may result in the failure of establishing a signaling connection. Moreover, even if the electronic devices successfully establish a signaling connection using CoAP, there is still a possibility of failure in establishing a high-speed WIFI connection.

[0005] Therefore, how to ensure the success rate of establishing a signaling connection by electronic devices through a local area network and ensure the success rate of establishing a high-speed WiFi connection is an urgent problem to be solved at present. Summary of the Invention

[0006] This application provides a communication method and a communication device, which can ensure the success rate of establishing a signaling connection by electronic devices through a local area network and ensure the success rate of establishing a high-speed WiFi connection.

[0007] In a first aspect, a communication method is provided. The method is applied to a first electronic device and includes: receiving, by a router, a first message from a second electronic device, where the first message includes a first field for indicating the signal strength of the second electronic device; determining a first parameter according to the first field, where the first parameter is used to characterize the distance between the second electronic device and the router.

[0008] Exemplarily, the first message is a feedback message of a discovery message. Before the second electronic device determines the first message, it receives a discovery message from the first electronic device. When the first electronic device receives a feedback message of the discovery message from the second electronic device, the first electronic device and the second electronic device discover each other. Among them, the discovery message of the first electronic device is a broadcast message, and the first message (the feedback message of the discovery message) is a unicast message. The first electronic device can be understood as a sending device, and the second electronic device can be understood as a receiving device.

[0009] It should be noted that in a local area network scenario, to implement the mutual discovery process between the first electronic device and the second electronic device through a constrained application protocol (CoAP) medium with low discovery latency, the forwarding of messages by a router is required.

[0010] Exemplarily, the first field is a received signal strength indicator (RSSI) field. Before the second electronic device sends the first message, it can add an RSSI field to the first message.

[0011] Based on the above solution, the first electronic device can determine the distance between the second electronic device and the router according to the first field in the feedback message of the discovery message, which is convenient for subsequently determining the specific manner of establishing a signaling connection, thereby improving the success rate of establishing a signal and avoiding waste of resources.

[0012] Combined with the first aspect, in some implementation manners of the first aspect, the first message further includes a second field, and the second field is used to represent the signal strength of the router. The method further includes: determining a second parameter according to the second field, and the second parameter is used to characterize the distance between the router and the first electronic device.

[0013] It should be noted that the first message received by the first electronic device is forwarded by the router. Before the router forwards the first message to the first electronic device, it can carry a second field in the first message, and the second field can be an RSSI field. The first electronic device can calculate the distance between the router and the first electronic device according to the signal strength of the router represented by the RSSI field.

[0014] Exemplarily, the first field can be carried at the tail of the first message, and the second field can be carried at the head of the first message.

[0015] Based on the above solution, the first electronic device can determine the distance between the first electronic device and the router according to the second field in the feedback message of the discovery message, which is convenient for subsequently determining the specific manner of establishing a signaling connection, thereby improving the success rate of establishing a signal and avoiding waste of resources.

[0016] In combination with the first aspect, in certain implementations of the first aspect, the method further includes: when the first parameter and the second parameter meet a first preset condition, establishing a signaling connection with the second electronic device through a local area network.

[0017] Exemplarily, the first preset condition can be understood as that the distance between the devices represented by the parameters meets the condition for establishing a signaling connection through a local area network.

[0018] It should be noted that before the first electronic device and the second electronic device establish a signaling connection through a local area network, it is necessary to first determine whether each communication link for establishing a signaling connection through a local area network meets the conditions for establishing a signaling connection. The first electronic device determines whether the distance represented by the first parameter and the distance represented by the second parameter meet the conditions for establishing a signaling connection through a local area network, that is, the first electronic device determines whether the path between the first electronic device and the router and the path between the router and the second electronic device meet the conditions for establishing a signaling connection through a local area network.

[0019] That is to say, when the signal strength of the second electronic device and the signal strength of the router meet the conditions for establishing a signaling connection through a local area network, a signaling connection can be established with the second electronic device through a local area network.

[0020] Generally speaking, when the distances represented by the first parameter and the second parameter are both close enough, it is suitable for the first electronic device and the second electronic device to establish a signaling connection through a local area network.

[0021] In one implementation, when the first parameter or the second parameter does not meet the first preset condition, a signaling connection is established with the second electronic device through a non-local area network.

[0022] Generally speaking, when any one of the distances represented by the first parameter or the second parameter is far, the attempt to establish a signaling connection between the first electronic device and the second electronic device through a local area network may fail. The first electronic device can attempt to establish a signaling connection with the second electronic device through a non-local area network. For example, a signaling connection is established through a low energy Bluetooth (BLE) medium.

[0023] Based on the above solution, when the first parameter and the second parameter meet certain conditions, the first electronic device and the second electronic device establish a signaling connection through a local area network, avoiding the possibility of failure in blindly attempting to establish a signaling connection through a local area network, thereby reducing resource waste.

[0024] In combination with the first aspect, in certain implementations of the first aspect, the first message is a feedback message of a discovery message.

[0025] In combination with the first aspect, in some implementations of the first aspect, the first field is a received signal strength indication (RSSI) field.

[0026] In combination with the first aspect, in some implementations of the first aspect, the method further includes: obtaining a third parameter, where the third parameter is used to characterize the distance between the first electronic device and the second electronic device; when the third parameter meets a second preset condition, establishing a data connection with the second electronic device in a point-to-point manner.

[0027] Exemplarily, the second preset condition can be understood as that the distance between the devices characterized by the parameter meets the condition for establishing a signaling data connection in a point-to-point manner.

[0028] It should be noted that after the first electronic device and the second electronic device establish a signaling connection through a local area network, first determine whether the communication link between the first electronic device and the second electronic device meets the conditions for point-to-point service transmission. If it meets the conditions, establish a data connection in a point-to-point manner.

[0029] It should be understood that when the first electronic device and the second electronic device establish a signaling connection through a local area network, it indicates that the distance between the first electronic device and the router, and between the router and the second electronic device is close enough. However, the distance between the first electronic device and the second electronic device will affect the success rate of establishing a data connection in a point-to-point manner. Therefore, it is necessary to pre-determine whether the distance between the first electronic device and the second electronic device meets the conditions for establishing a data connection in a point-to-point manner.

[0030] Based on the above solution, when the third parameter meets certain conditions, the first electronic device and the second electronic device establish a data connection in a point-to-point manner, avoiding the possibility of failure in blindly attempting to establish a data signaling connection in a point-to-point manner, thereby reducing resource waste.

[0031] In combination with the first aspect, in some implementations of the first aspect, obtaining the third parameter includes: obtaining the third parameter through one of the following: Bluetooth signal, ultrasonic signal, ultra-wideband (UWB) wireless carrier communication technology, near field communication (NFC).

[0032] For example, determine the distance between the first electronic device and the second electronic device through the balanced attenuation value of Bluetooth RSSI. If the distance is too far, it indicates that it is not suitable to establish a data connection in a near-field point-to-point manner.

[0033] Exemplarily, the point-to-point communication method includes WiFi P2P communication, or Huawei multi-link direct connection (huaweimagneto link, HML) communication.

[0034] It should be noted that the first electronic device and the second electronic device that establish a data connection in a point-to-point manner can directly perform service transmission. This transmission method has a fast transmission rate and high transmission efficiency.

[0035] In one implementation, when the third parameter does not meet the second preset condition, the first electronic device and the second electronic device establish a data connection through a local area network.

[0036] Exemplarily, when the first electronic device and the second electronic device transmit services or data, they need to be forwarded by a router.

[0037] In a second aspect, a communication method is provided, characterized in that the method is applied to a first electronic device, and the first electronic device and the second electronic device discover each other. The method includes: sending a second message to the second electronic device; receiving a feedback message of the second message from the second electronic device; when the round-trip time RTT of the second message meets the first preset condition, establishing a signaling connection with the second electronic device through a local area network.

[0038] Exemplarily, the second message can be a probe message.

[0039] It should be understood that after the first electronic device and the second electronic device discover each other, it is also possible to determine whether a signaling connection can be established through a local area network by using a probe message.

[0040] It should be noted that when the first electronic device and the second electronic device transmit a probe message and the feedback message of the probe message, they need to be forwarded by a router. Therefore, the RTT can reflect the communication conditions of the paths between the first electronic device and the router, and between the router and the second electronic device.

[0041] Exemplarily, if the RTT of the probe message is low and meets the experienced delay, the first electronic device and the second electronic device can establish a signaling connection through a local area network; if the RTT of the probe message is high and does not meet the experienced delay, the first electronic device and the second electronic device can establish a signaling connection through a non-local area network.

[0042] Based on the above solution, the first electronic device can determine the communication conditions of the paths between the first electronic device and the router, and between the router and the second electronic device according to the RTT of the probe message. When certain conditions are met, the first electronic device and the second electronic device establish a signaling connection through a local area network, avoiding the possibility of failure in blindly attempting to establish a signaling connection through a local area network, thereby reducing resource waste.

[0043] In combination with the second aspect, in some implementations of the second aspect, sending the second message to the second electronic device includes: receiving a third message from the second electronic device; determining the unicast address of the second electronic device according to the third message; and sending the second message to the second electronic device according to the unicast address of the second electronic device.

[0044] It should be noted that after the first electronic device and the second electronic device discover each other, the first electronic device can determine the unicast address of the second electronic device according to the feedback message of the discovery message unicast by the second electronic device, and unicast a probe message to the second electronic device according to the unicast address of the second electronic device.

[0045] In combination with the second aspect, in some implementations of the second aspect, the third message is a feedback message of the discovery message.

[0046] In combination with the second aspect, in some implementations of the second aspect, the method further includes: obtaining a third parameter, where the third parameter is used to characterize the distance between the first electronic device and the second electronic device; and when the third parameter meets a second preset condition, establishing a data connection with the second electronic device in a point-to-point manner.

[0047] Exemplarily, the second preset condition can be understood as that the distance between the devices characterized by the parameter meets the condition for establishing a signaling data connection in a point-to-point manner.

[0048] Based on the above solution, when the third parameter meets certain conditions, the first electronic device and the second electronic device establish a data connection in a point-to-point manner, avoiding the possibility of failure in blindly attempting to establish a data signaling connection in a point-to-point manner, thereby reducing resource waste.

[0049] In combination with the second aspect, in some implementations of the second aspect, obtaining the third parameter includes: obtaining the third parameter through one of the following: Bluetooth signal, ultrasonic signal, ultra-wideband (UWB) wireless carrier communication technology, near field communication (NFC).

[0050] In a third aspect, a communication method is provided, which is applied to a second electronic device. The method includes: determining a first message, where the first message includes a first field; and sending the first message to a first electronic device through a router, where the first field is used for the first electronic device to determine a first parameter, and the first parameter is used to characterize the distance between the second electronic device and the router.

[0051] Exemplarily, the first message is a feedback message of a discovery message. Before the second electronic device determines the first message, it receives a discovery message from the first electronic device. When the first electronic device receives the feedback message of the discovery message from the second electronic device, the first electronic device and the second electronic device discover each other. Among them, the discovery message of the first electronic device is a broadcast message, and the first message (the feedback message of the discovery message) is a unicast message. The first electronic device can be understood as the sending device, and the second electronic device can be understood as the receiving device.

[0052] It should be noted that in a local area network scenario, to implement the mutual discovery process between the first electronic device and the second electronic device through the CoAP medium with low discovery latency, the forwarding of messages by the router is required.

[0053] Exemplarily, the first field is a received signal strength indicator (RSSI) field. Before the second electronic device sends the first message, it can add the RSSI field to the first message.

[0054] Based on the above solution, the second electronic device can add the first field to the feedback message of the discovery message, so that the first electronic device can determine the distance between the second electronic device and the router according to the first field, which is convenient for subsequently determining the specific method of establishing a signaling connection, thereby improving the success rate of establishing a signal and avoiding waste of resources.

[0055] Combined with the third aspect, in some implementation manners of the third aspect, the method further includes: establishing a signaling connection with the first electronic device through a local area network; where the distance between the first electronic device and the router is the second parameter, and the first parameter and the second parameter satisfy a first preset condition.

[0056] Exemplarily, the first preset condition can be understood as that the distance between the devices characterized by the parameters satisfies the condition for establishing a signaling connection through a local area network.

[0057] It should be noted that before the first electronic device and the second electronic device establish a signaling connection through a local area network, it is necessary to first determine whether each communication link for establishing a signaling connection through a local area network satisfies the condition for establishing a signaling connection. When the signal strength of the second electronic device and the signal strength of the router satisfy the condition for establishing a signaling connection through a local area network, a signaling connection can be established with the first electronic device through the local area network.

[0058] Generally speaking, when the distances characterized by the first parameter and the second parameter are both close enough, the first electronic device and the second electronic device are suitable for establishing a signaling connection through a local area network.

[0059] In one implementation, when the first parameter or the second parameter does not meet the first preset condition, the second electronic device establishes a signaling connection with the first electronic device through a non-local area network.

[0060] Generally speaking, when any one of the distances represented by the first parameter or the second parameter is relatively far, the signaling connection established between the first electronic device and the second electronic device through the local area network may fail. The first electronic device can attempt to establish a signaling connection with the second electronic device through a non-local area network. For example, establish a signaling connection through a low energy Bluetooth (BLE) medium.

[0061] Based on the above solution, when the first parameter and the second parameter meet certain conditions, the first electronic device and the second electronic device establish a signaling connection through the local area network, avoiding the possibility of failure in blindly attempting to establish a signaling connection through the local area network, thereby reducing resource waste.

[0062] Combined with the third aspect, in some implementations of the third aspect, the first message is a feedback message of the discovery message.

[0063] Combined with the third aspect, in some implementations of the third aspect, the first field is a received signal strength indication (RSSI) field.

[0064] Combined with the third aspect, in some implementations of the third aspect, the method further includes: when the third parameter meets the second preset condition, establishing a data connection with the first electronic device in a point-to-point manner; wherein, the third parameter is used to represent the distance between the second electronic device and the first electronic device.

[0065] Exemplarily, the second preset condition can be understood as that the distance between the devices represented by the parameter meets the condition for establishing a signaling data connection in a point-to-point manner.

[0066] It should be noted that after the first electronic device and the second electronic device establish a signaling connection through the local area network, first determine whether the communication link between the first electronic device and the second electronic device meets the condition for point-to-point service transmission. If it meets, establish a data connection in a point-to-point manner.

[0067] It should be understood that when the first electronic device and the second electronic device establish a signaling connection through the local area network, it indicates that the distances between the first electronic device and the router, and between the router and the second electronic device are close enough. However, the distance between the first electronic device and the second electronic device affects the success rate of establishing a data connection in a point-to-point manner. Therefore, it is necessary to pre-determine whether the distance between the first electronic device and the second electronic device meets the condition for establishing a data connection in a point-to-point manner.

[0068] Based on the above solution, when the third parameter meets certain conditions, the first electronic device and the second electronic device establish a data connection in a point-to-point manner, avoiding the possibility of failure in blindly attempting to establish a data signaling connection in a point-to-point manner, thereby reducing resource waste.

[0069] In a fourth aspect, a communication method is provided. This method is applied to the second electronic device, and the second electronic device discovers each other with the first electronic device. The method includes: receiving a second message from the first electronic device; sending a feedback message of the second message to the first electronic device; when the round-trip time (RTT) of the second message meets a first preset condition, establishing a signaling connection with the first electronic device through a local area network.

[0070] Exemplarily, the second message may be a probe message.

[0071] It should be understood that after the first electronic device and the second electronic device discover each other, it is also possible to determine whether a signaling connection can be established through a local area network by means of a probe message.

[0072] It should be noted that when transmitting the probe message and the feedback message of the probe message between the first electronic device and the second electronic device, they need to be forwarded by a router. Therefore, the RTT can reflect the communication conditions of the paths between the first electronic device and the router, and between the router and the second electronic device.

[0073] Exemplarily, if the RTT of the probe message is low and meets the experienced delay, the first electronic device and the second electronic device can establish a signaling connection through a local area network; if the RTT of the probe message is high and does not meet the experienced delay, the first electronic device and the second electronic device can establish a signaling connection through a non-local area network.

[0074] Based on the above solution, the communication conditions of the paths between the first electronic device and the router, and between the router and the second electronic device can be determined according to the RTT of the probe message. When certain conditions are met, the first electronic device and the second electronic device establish a signaling connection through a local area network, avoiding the possibility of failure in blindly attempting to establish a signaling connection through a local area network, thereby reducing resource waste.

[0075] Combined with the fourth aspect, in some implementation manners of the fourth aspect, the receiving the second message from the first electronic device includes: sending a third message to the first electronic device, where the third message is used for the first electronic device to determine the unicast address of the second electronic device; receiving the second message from the first electronic device according to the unicast address of the second electronic device.

[0076] It should be noted that after the first electronic device and the second electronic device discover each other, the feedback message of the discovery message sent by the second electronic device may carry the unicast address of the second electronic device, which is convenient for the first electronic device to unicast a detection message to the second electronic device according to the unicast address.

[0077] In combination with the fourth aspect, in some implementation manners of the fourth aspect, the third message is a feedback message of the discovery message.

[0078] In combination with the fourth aspect, in some implementation manners of the fourth aspect, the method further includes: when the third parameter meets the second preset condition, establishing a data connection with the first electronic device in a point-to-point manner; where the third parameter is used to characterize the distance between the second electronic device and the first electronic device.

[0079] Exemplarily, the second preset condition can be understood as that the distance between the devices characterized by the parameter meets the condition for establishing a signaling data connection in a point-to-point manner.

[0080] Based on the above solution, when the third parameter meets certain conditions, the first electronic device and the second electronic device establish a data connection in a point-to-point manner, avoiding the possibility of failure in blindly attempting to establish a data signaling connection in a point-to-point manner, thereby reducing resource waste.

[0081] In a fifth aspect, a communication method is provided. The method is applied to a router and includes: receiving a first message from a second electronic device, where the first message includes a first field; sending the first message to a first electronic device, where the first field is used for the first electronic device to determine a first parameter, and the first parameter is used to characterize the distance between the second electronic device and the router.

[0082] Exemplarily, the first field is a received signal strength indicator (RSSI) field. Before sending the first message, the second electronic device may add an RSSI field to the first message. The router may forward the first message carrying the first field to the first electronic device.

[0083] Based on the above solution, the router sends the first message carrying the first field to the first electronic device, enabling the first electronic device to determine the distance between the second electronic device and the router according to the first field in the first message, facilitating the subsequent determination of the specific manner of establishing a signaling connection, thereby improving the success rate of establishing a signaling and avoiding waste of resources.

[0084] In combination with the fifth aspect, in some implementations of the fifth aspect, the first message further includes a second field, which is used by the first electronic device to determine a second parameter, and the second parameter is used to characterize the distance between the router and the first electronic device.

[0085] It should be noted that when the router forwards the first message to the first electronic device, it may also carry a second field indicating the signal strength of the router, and the second field may be an RSSI field.

[0086] Exemplarily, the first field may be carried at the tail of the first message, and the second field may be carried at the head of the first message.

[0087] Based on the above solution, the router sends the first message carrying the second field to the first electronic device, so that the first electronic device can determine the distance between the first electronic device and the router according to the second field of the first message, which is convenient for subsequently determining the specific manner of establishing a signaling connection, thereby improving the success rate of establishing a signal and avoiding waste of resources.

[0088] In combination with the fifth aspect, in some implementations of the fifth aspect, the first message is a feedback message of a discovery message.

[0089] In combination with the fifth aspect, in some implementations of the fifth aspect, the first field is a received signal strength indication (RSSI) field.

[0090] In a sixth aspect, a communication device is provided. The device is carried on a first electronic device, and the device includes: a transceiver unit, configured to receive a first message from a second electronic device through a router, where the first message includes a first field, and the first field is used to represent the signal strength of the second electronic device; and a processing unit, configured to determine a first parameter according to the first field, and the first parameter is used to characterize the distance between the second electronic device and the router.

[0091] In combination with the sixth aspect, in some implementations of the sixth aspect, the first message further includes a second field, which is used to represent the signal strength of the router, and the processing unit is further configured to determine a second parameter according to the second field, and the second parameter is used to characterize the distance between the router and the device.

[0092] In combination with the sixth aspect, in some implementations of the sixth aspect, the processing unit is further configured to establish a signaling connection with the second electronic device through a local area network when the first parameter and the second parameter meet a first preset condition.

[0093] In combination with the sixth aspect, in some implementations of the sixth aspect, the first message is a feedback message of a discovery message.

[0094] In combination with the sixth aspect, in some implementations of the sixth aspect, the first field is a received signal strength indication (RSSI) field.

[0095] In combination with the sixth aspect, in some implementations of the sixth aspect, the processing unit is further configured to obtain a third parameter, where the third parameter is used to characterize the distance between the device and the second electronic device; the processing unit is further configured to establish a data connection with the second electronic device in a point-to-point manner when the third parameter meets a second preset condition.

[0096] In combination with the sixth aspect, in some implementations of the sixth aspect, the transceiver unit is specifically configured to obtain the third parameter through one of the following: Bluetooth signal, ultrasonic signal, ultra-wideband (UWB) wireless carrier communication technology, near field communication (NFC).

[0097] A seventh aspect provides a communication device, characterized in that the device is carried by a first electronic device, the device discovers the second electronic device, and the device includes: a transceiver unit, configured to send a second message to the second electronic device; and further configured to receive a feedback message of the second message from the second electronic device; a processing unit, configured to establish a signaling connection with the second electronic device through a local area network when the round-trip time (RTT) of the second message meets a first preset condition.

[0098] In combination with the seventh aspect, in some implementations of the seventh aspect, the transceiver unit is specifically configured to receive a third message from the second electronic device; the processing unit is further configured to determine the unicast address of the second electronic device according to the third message; the transceiver unit is further configured to send the second message to the second electronic device according to the unicast address of the second electronic device.

[0099] In combination with the seventh aspect, in some implementations of the seventh aspect, the third message is a feedback message of a discovery message.

[0100] In combination with the seventh aspect, in some implementations of the seventh aspect, the transceiver unit is further configured to obtain a third parameter, where the third parameter is used to characterize the distance between the device and the second electronic device; the processing unit is further configured to establish a data connection with the second electronic device in a point-to-point manner when the third parameter meets a second preset condition.

[0101] In combination with the seventh aspect, in some implementations of the seventh aspect, the transceiver unit is specifically configured to obtain the third parameter through one of the following: Bluetooth signal, ultrasonic signal, ultra-wideband (UWB) wireless carrier communication technology, near field communication (NFC).

[0102] In an eighth aspect, a communication device is provided. The device is carried by a second electronic device and includes: a processing unit configured to determine a first message, where the first message includes a first field; and a transceiver unit configured to send the first message to a first electronic device via a router. The first field is used by the first electronic device to determine a first parameter, and the first parameter is used to characterize the distance between the device and the router.

[0103] In combination with the eighth aspect, in some implementation manners of the eighth aspect, the processing unit is further configured to establish a signaling connection with the first electronic device via a local area network. The distance between the first electronic device and the router is a second parameter, and the first parameter and the second parameter satisfy a first preset condition.

[0104] In combination with the eighth aspect, in some implementation manners of the eighth aspect, the first message is a feedback message of a discovery message.

[0105] In combination with the eighth aspect, in some implementation manners of the eighth aspect, the first field is a received signal strength indication (RSSI) field.

[0106] In combination with the eighth aspect, in some implementation manners of the eighth aspect, the processing unit is further configured to establish a data connection with the first electronic device in a point-to-point manner when a third parameter satisfies a second preset condition. The third parameter is used to characterize the distance between the device and the first electronic device.

[0107] In a ninth aspect, a communication device is provided. The device is carried by a second electronic device and discovers each other with a first electronic device. The device includes: a transceiver unit configured to receive a second message from the first electronic device; the transceiver unit is further configured to send a feedback message of the second message to the first electronic device; and a processing unit configured to establish a signaling connection with the first electronic device via a local area network when the round-trip time (RTT) of the second message satisfies a first preset condition.

[0108] In combination with the ninth aspect, in some implementation manners of the ninth aspect, the transceiver unit is specifically configured to send a third message to the first electronic device, where the third message is used by the first electronic device to determine the unicast address of the device. The transceiver unit is further configured to receive the second message from the first electronic device according to the unicast address of the device.

[0109] In combination with the ninth aspect, in some implementation manners of the ninth aspect, the third message is a feedback message of a discovery message.

[0110] In combination with the ninth aspect, in some implementations of the ninth aspect, the processing unit is further configured to establish a data connection with the first electronic device in a point-to-point manner when a third parameter meets a second preset condition; wherein, the third parameter is used to characterize the distance between the device and the first electronic device.

[0111] The tenth aspect provides a communication device carried by a router. The device includes: a transceiver unit configured to receive a first message from a second electronic device, the first message including a first field; the transceiver unit is further configured to send the first message to a first electronic device, wherein the first field is used for the first electronic device to determine a first parameter, and the first parameter is used to characterize the distance between the second electronic device and the device.

[0112] In combination with the tenth aspect, in some implementations of the tenth aspect, the first message further includes a second field, and the second field is used for the first electronic device to determine a second parameter, and the second parameter is used to characterize the distance between the device and the first electronic device.

[0113] In combination with the tenth aspect, in some implementations of the tenth aspect, the first message is a feedback message of a discovery message.

[0114] In combination with the tenth aspect, in some implementations of the tenth aspect, the first field is a received signal strength indication (RSSI) field.

[0115] The eleventh aspect provides a communication system including a first electronic device, a second electronic device, and a router in the method of the first aspect and any possible implementation manner thereof, or the method of the second aspect and any possible implementation manner thereof, or the method of the third aspect and any possible implementation manner thereof, or the method of the fourth aspect and any possible implementation manner thereof, or the method of the fifth aspect and any possible implementation manner thereof as described above.

[0116] The twelfth aspect provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a computer, the computer is caused to execute the method of the first aspect and any implementable method in the first aspect, or execute the method of the second aspect and any implementable method in the second aspect, or execute the method of the third aspect and any implementable method in the third aspect, or execute the method of the fourth aspect and any implementable method in the fourth aspect, or execute the method of the fifth aspect and any implementable method in the fifth aspect.

[0117] In a thirteenth aspect, there is provided a computer program product including instructions, which, when running on a computer, cause the computer to execute the method according to the first aspect above and any implementable method in the first aspect, or execute the method according to the second aspect above and any implementable method in the second aspect, or execute the method according to the third aspect above and any implementable method in the third aspect, or execute the method according to the fourth aspect above and any implementable method in the fourth aspect, or execute the method according to the fifth aspect above and any implementable method in the fifth aspect.

[0118] In a fourteenth aspect, there is provided a chip, which includes a processor and a data interface. The processor reads instructions stored in a memory through the data interface to execute the method according to the first aspect above and any implementable method in the first aspect, or execute the method according to the second aspect above and any implementable method in the second aspect, or execute the method according to the third aspect above and any implementable method in the third aspect, or execute the method according to the fourth aspect above and any implementable method in the fourth aspect, or execute the method according to the fifth aspect above and any implementable method in the fifth aspect.

[0119] In combination with the fourteenth aspect, in a possible implementation, the processor is coupled to the memory through an interface.

[0120] In combination with the fourteenth aspect, in a possible implementation, the chip system further includes a memory, and computer programs or computer instructions are stored in the memory. Description of the Drawings

[0121] Figure 1 It is a schematic diagram of a communication system applicable to the communication method provided by an embodiment of the present application.

[0122] Figure 2 It is a schematic diagram of a system architecture provided by an embodiment of the present application.

[0123] Figure 3 It is a schematic flowchart of a communication method provided by an embodiment of the present application.

[0124] Figure 4 It is a schematic flowchart of a communication method provided by an embodiment of the present application.

[0125] Figure 5 It is a schematic block diagram of a device provided by an embodiment of the present application. Detailed Embodiments

[0126] Next, the technical solutions in the present application will be described with reference to the drawings.

[0127] First, technical terms that may be involved in the embodiments of the present application will be introduced.

[0128] WiFi peer-to-peer(WiFi P2P)

[0129] It is a technology based on WiFi launched by the WiFi Alliance, which enables direct connections between electronic devices. One-to-one or one-to-many communications can be carried out without relying on a local area network or an access point (AP). In the embodiments of this application, it can be abbreviated as P2P for short.

[0130] Access point (AP)

[0131] An AP can be included in a wireless local area networks (WLAN) system, and electronic devices can access the external network through the AP. For example, a router.

[0132] Station (STA)

[0133] An STA can be included in a WLAN system. The STA can be associated with an AP and access the network through the AP. For example, electronic devices such as mobile phone terminals and tablet computers.

[0134] Huawei Magneto Link (HML)

[0135] A more optimized solution compared to P2P, which can support an electronic device to establish multiple connections with multiple electronic devices.

[0136] Dynamic Host Configuration Protocol (DHCP)

[0137] It is a network protocol used for Internet Protocol (IP) networks, located at the application layer of the Open System Interconnection (OSI) model. It can be used for an intranet or an Internet service provider to automatically assign IP addresses to users, and can also be used for an intranet administrator to centrally manage all computers.

[0138] Address Resolution Protocol (ARP)

[0139] It is a protocol for obtaining the physical address based on the IP address. When a host sends information, it can broadcast an ARP request containing the target IP address to all hosts on the local area network and receive the return message to determine the physical address of the target. After receiving the return message, the IP address and the physical address are stored in the local ARP cache of this machine and retained for a certain period of time. The next time a request is made, the ARP cache can be directly queried to save resources. The Address Resolution Protocol is based on the mutual trust among all hosts in the network. Hosts on the local area network can independently send ARP reply messages. When other hosts receive the reply packet, they will record it in the local ARP cache without detecting the authenticity of the packet. Thus, an attacker can send a fake ARP reply packet to a certain host, causing the information it sends to fail to reach the expected host or reach the wrong host, which constitutes an ARP spoofing. The ARP command can be used to query the correspondence between the IP address and the media access control (MAC) address in the local ARP cache, add or delete static correspondence relationships, etc.

[0140] When the electronic devices of distributed services are in a local area network, the electronic devices can communicate through the router relay method. Further, in the near-field communication scenario, the electronic devices can also communicate in a point-to-point manner similar to the WiFi P2P technology. This communication technology has a fast transmission rate and can be independent of the local area network. The current distributed services can use this technology to implement functions such as file sharing and screen mirroring.

[0141] Before the electronic devices perform service transmission through the router relay or point-to-point method, multiple electronic devices need to discover each other and establish a signaling connection. Under the current distributed services, the electronic devices generally discover each other based on the WiFi or Bluetooth technology. Usually, when the electronic devices discover each other, they need to search for the surrounding electronic devices, including the search for the local area network and the non-local area network. Among them, the search medium for the local area network is the Constrained Application Protocol (CoAP), and the search medium for the non-local area network is Bluetooth Low Energy (BLE). The search rates of different media are different. The search rate for the surrounding area through the CoAP medium is relatively fast, while the search rate for BLE in the non-local area network is relatively slow.

[0142] As Figure 1 shown, it shows a schematic diagram of a communication system to which a communication method provided by this application can be applied. The communication system can include a router 110, a sending-end device 120, and a receiving-end device 130. Among them, the sending-end device can be understood as the device that initiates the discovery process and broadcasts the discovery packet. For example Figure 1The mobile terminal shown. The receiving device can be understood as the device that unicasts the feedback message of the discovery message, such as Figure 1 The tablet computer shown. Figure 1 Two discovery processes are shown in Figure 1 , including the local area network discovery process and the non-local area network discovery process. In the local area network discovery process, the discovery message or the feedback message of the discovery message can be forwarded by the router.

[0143] When the sending device sends the discovery message, it can be sent through the CoAP medium and the BLE medium at the same time, that is, the local area network discovery and the non-local area network discovery processes can be triggered at the same time. Since the discovery delay of the CoAP medium is relatively low, the sending device will first receive the feedback message of the discovery message returned by the receiving device through the CoAP medium. That is to say, although the sending device will send the discovery message through the above two media at the same time, it will first discover the receiving device that returns the message through the CoAP medium. After the sending device and the receiving device discover each other, a signaling connection needs to be established. Generally speaking, CoAP or Bluetooth can also be used to establish the signaling connection.

[0144] Using CoAP to establish a signaling connection is usually limited by the distance between the sending device and the router, the distance between the receiving device and the router, or the signal strength. Although the discovery between the sending device and the receiving device can be achieved relatively quickly through the CoAP medium, however, if the distance between the sending device and the router is relatively far, or the distance between the receiving device and the router is relatively far, the sending device and the receiving device will not be able to use CoAP to establish a signaling connection; or even if the sending device and the receiving device establish a signaling connection through CoAP, it may also be due to the low signal strength between the sending device and the router, or the low signal strength between the receiving device and the router, resulting in the signaling connection established by the sending device and the receiving device through CoAP being easily disconnected and unstable.

[0145] However, using Bluetooth to establish a signaling connection has a relatively large delay, and Bluetooth cannot be used every time a signaling connection is established. This is because there are many functions that electronic devices need to achieve with the help of Bluetooth. For example, headset pairing, calls, file sharing, collaboration, etc. These functions will share the short-distance connection ability of Bluetooth. When there are too many networking devices and multiple services request Bluetooth connections, the Bluetooth short-distance transmission may reject the request to establish a signaling connection for distributed services according to the resource usage situation, resulting in the failure to establish a signaling connection using Bluetooth.

[0146] When establishing a signaling connection each time, it is also possible to attempt to establish a signaling connection through redundant communication, that is, through the above two media (including CoAP medium and Bluetooth medium). This method will obviously lead to high responsibility of the upper-layer logic, resulting in waste of power consumption. And establishing a signaling connection simultaneously may cause disorder in the underlying state, resulting in failure to establish a signaling connection.

[0147] In a local area network scenario, if the sending device and the receiving device successfully establish a signaling connection using CoAP, the point-to-point method or the method of relaying through a router can be selected for service transmission.

[0148] Among them, before using the method of relaying through a router for service transmission, both the sending device and the receiving device need to be connected to the router. For example, when the trust domain of the receiving device is different from that of the router, the receiving device will not be able to connect to the router. And because the router itself does not have a separate network processor (NP) forwarding chip, the data packet needs to be sent to the central processing unit (CPU) for processing, which requires a large amount of CPU to process the data that should be processed at the NP layer, causing the CPU to be too busy. In addition, during each service interaction process, it is necessary to compete for the air interface twice, which will lead to performance degradation in terms of efficiency. The point-to-point method can meet the requirements of high-rate transmission services or highly reliable transmission services. Therefore, after the sending device and the receiving device successfully establish a signaling connection, the point-to-point method can be preferably selected for service transmission as much as possible. However, if the point-to-point method is selected for service transmission, certain conditions need to be met.

[0149] The fact that the sending device and the receiving device can successfully establish a signaling connection using CoAP indicates that the distance between the sending device and the router, and the distance between the receiving device and the router meet the conditions for establishing a signaling connection using CoAP. But there may be a situation where the distance between the sending device and the receiving device is relatively far, thus unable to meet the condition for establishing a high-speed WiFi service connection in point-to-point mode.

[0150] Therefore, the present application provides a communication method and a communication device. In a local area network scenario, before the sending device and the receiving device establish a signaling connection, a suitable way to establish the signaling connection is determined, thereby improving the success rate of establishing the signaling connection. And after the signaling connection is established, it is determined whether the distance between the sending device and the receiving device meets the conditions for a high-speed WiFi service connection, thereby improving the success rate of establishing a point-to-point connection and enhancing the service experience in the local area network.

[0151] Such as Figure 2As shown in the figure, a system architecture diagram provided by the present application is shown. This system architecture can be carried on the above-mentioned sending-end device. For example, electronic devices such as mobile phone terminals and tablet computers. This system structure includes a WiFi framework layer, an STA / P2P service layer, a WiFi hardware abstraction layer, a WPA service layer, and a hardware layer. Among them, the WiFi framework layer (framework, FWK) is an external application programming interface (application programming interface, API) interface layer. System applications and third-party applications can access the information of the underlying service layer through this interface. The STA / P2P service layer is used to manage STA services and P2P services. It is a service layer that operates on the bottom layer and can encapsulate high-level relevant information such as the state of the protocol. For example, the sending-end device includes two interfaces. One interface is used to connect to a router (AP) when the sending-end device is an STA. The other interface is used to connect to another electronic device when the sending-end device is one of the electronic devices in the peer-to-peer communication mode. The WiFi hardware abstraction layer (hardware abstraction layer, HAL) can provide an interface for the upper layer and interact with the Wi-Fi protected access (WPA) service layer. The WPA service layer (WPA supplicant) is a service layer of the WiFi hardware abstraction layer and is a basic service for operating the hardware. The hardware layer can include a radio frequency front end and a hardware chip.

[0152] As Figure 3 shown, a communication method provided by an embodiment of the present application is shown. This method can be applied to a communication system as Figure 1 shown below. The method will be specifically introduced below.

[0153] S301, the sending-end device and the receiving-end device discover each other.

[0154] Exemplarily, the sending-end device can be a mobile phone terminal as Figure 1 shown, and the receiving-end device can be a tablet computer as Figure 1 shown. The sending-end device can be understood as the device that initiates the discovery process and can broadcast discovery messages. The receiving-end device can receive the discovery messages and return feedback messages of the discovery messages.

[0155] It should be noted that in the local area network scenario, the sending device can send discovery messages through the CoAP medium and the BLE medium, that is, the sending device and the receiving device can discover each other through the local area network or a non-local area network. Among them, in the process of discovery through the CoAP medium or the local area network, the messages transmitted between the sending device and the receiving device need to be forwarded by the router. In the process of discovery through the BLE medium or a non-local area network, the messages can be directly transmitted between the sending device and the receiving device.

[0156] It should be noted that since the latency of discovery through the CoAP medium is low and the message transmission rate is fast, the sending device usually discovers the receiving device through the CoAP medium first.

[0157] Specifically, the process of mutual discovery between the sending device and the receiving device through the CoAP medium includes: the sending device broadcasts a discovery message to the surrounding devices, and the receiving device belongs to the surrounding devices. The discovery message broadcast by the sending device can be sent to the receiving device through the forwarding of the router, and the receiving device returns a feedback message of the discovery message in a unicast manner, and the feedback message of the discovery message can be forwarded to the receiving device through the router.

[0158] It should be noted that the feedback message of the discovery message fed back by the receiving device needs to pass through two communication channels, including the channel between the receiving device and the router, and the channel between the router and the sending device. Among them, the message transmitted from the receiving device to the router is the return message 1, and the message transmitted from the router to the sending device is the return message 2. The return message 2 can be understood as the return message 1 forwarded by the router. When the sending device receives the return message from the receiving device, it means that the sending device and the receiving device have discovered each other and the discovery process is completed, and a signaling connection needs to be further established between the sending device and the receiving device.

[0159] As can be seen from the above, establishing a signaling connection through the CoAP medium is usually limited by the distance between devices. For example, the distance between the sending device and the router, and the distance between the receiving device and the router. Therefore, after the sending device and the receiving device discover each other, if the channels between the devices meet the conditions, a signaling connection between the devices can be established through the CoAP medium.

[0160] S302, the sending device obtains the first signal strength and the second signal strength.

[0161] In one implementation, a signal field can be carried in Return Message 1 and Return Message 2. For example, a received signal strength indicator (RSSI) field. The RSSI field can be used to reflect the signal strength of the device that sends the message carrying the RSSI field, so that the distance between the device and the other device (i.e., the distance between the two directly communicating devices) can be calculated based on the signal strength. When the sending device receives the return message, it can obtain the first signal strength and the second signal strength according to the RSSI in the return message. Among them, the first signal strength can be the signal strength of the receiving device, and the second signal strength can be the signal strength of the router. The sending device can calculate the distance between the receiving device and the router according to the first signal strength, and calculate the distance between the router and the sending device according to the second signal strength.

[0162] For easy understanding, Table 1 shows the message structure of the return message.

[0163] Table 1 Message Structure

[0164]

[0165]

[0166] It should be noted that the message structure shown in Table 1 is used to exemplarily represent the message structure of the return message sent by the receiving device. In the message sent by the receiving device, an RSSI field is newly added, and this RSSI field is used to represent the signal strength of the receiving device from the router. The sending device is forwarded by the router and receives the return message sent by the receiving device. This process includes the receiving device sending the return message to the router, and the router forwarding the return message to the sending device. Before the receiving device sends the return message, an RSSI field indicating the distance between the receiving device and the router is added to the return message; before the router forwards the return message to the sending device, an RSSI field indicating the distance between the router and the sending device can also be added to the message.

[0167] S303, determine whether the first signal strength and the second signal strength meet the conditions.

[0168] It should be noted that in the process of the sending device and the receiving device discovering each other through the CoAP medium, the sending device can respectively determine the distance between the receiving device and the router, and the distance between the router and the sending device according to the RSSI field in the return message of the receiving device. That is, determine whether the signal strength represented by the RSSI field meets the conditions. If the conditions are met, the subsequent step S304 can be executed. If the conditions are not met, the subsequent step S305 can be executed.

[0169] Exemplarily, it can be divided into certain signal levels according to the value of the RSSI field:

[0170] [-126, -88) or [156, 168) indicates that the signal is at level 0;

[0171] [-88, -78) or [168, 178) indicates that the signal is at level 1;

[0172] [-78, -67) or [178, 189) indicates that the signal is at level 2;

[0173] [-67, -55) or [189, 200) indicates that the signal is at level 3;

[0174] [-55, 0] indicates that the signal is at level 4.

[0175] Generally speaking, 0 to -50 indicates the highest signal strength of the device, -50 to -70 indicates a deviation in the signal strength of the device, less than -70 indicates a very poor signal strength of the device, there is a possibility of being unable to connect or dropping the line, and -200 indicates that the device has disconnected from the WiFi connection.

[0176] It should be noted that in addition to adding the RSSI field for indicating the signal strength of the device in the return message introduced above, it is also possible to determine whether the paths between the receiving device and the router, and between the router and the sending device meet the conditions through the probe message.

[0177] In one implementation, the sending device and the receiving device discover each other through the CoAP medium. After the sending device receives the return message sent by the receiving device, the sending device obtains the unicast address of the receiving device according to the unicast return message of the receiving device. The sending device sends a probe message to the receiving device according to the unicast address and receives the feedback message of the probe message from the receiving device. The sending device determines whether the paths between the receiving device and the router, and between the router and the sending device meet the conditions according to the round-trip time (RTT) of the probe message. It should be noted that the transmission of the probe message and the feedback message of the probe message between the sending device and the receiving device need to be forwarded by the router. Therefore, the RTT can reflect the communication conditions of the paths between the sending device and the router, and between the router and the receiving device. Among them, the probe message can be a probe message of the Internet Control Message Protocol (ICMP).

[0178] Exemplarily, if the detection message meets the experienced latency, the subsequent step S304 can be executed, that is, a CoAP signaling connection is preferentially established; if the detection message does not meet the experienced latency, the subsequent step S305 can be executed.

[0179] It should be noted that for the detection message, the latency of a general reliable connection is usually in the millisecond level. If the latency of the detection message reaches several hundred milliseconds or the latency reaches the second level, it indicates that the availability of this path is average. Optionally, relevant logs can be recorded when the detection message is returned.

[0180] S304, the sending device and the receiving device establish a signaling connection through the local area network.

[0181] S305, the sending device and the receiving device establish a signaling connection through a non-local area network.

[0182] Exemplarily, when the sending device determines that the first signal strength and the second signal strength meet the conditions according to the RSSI field in the return message, a signaling connection can be established with the receiving device through the local area network (for example, CoAP).

[0183] It should be noted that the first signal strength meeting the conditions means that the signal strength of the receiving device meets the conditions, that is, the distance between the receiving device and the router meets the conditions. The second signal strength meeting the conditions means that the signal strength of the router meets the conditions, that is, the distance between the router and the sending device meets the conditions. That is to say, when the distance between the receiving device and the router meets the conditions and the distance between the router and the sending device meets the conditions, the sending device and the receiving device can establish a signaling connection through the local area network.

[0184] Exemplarily, when the sending device determines that the conditions are met according to the latency of the detection message, a signaling connection can be established with the receiving device through the local area network.

[0185] Exemplarily, when the sending device determines that the first signal strength or the second signal strength does not meet the conditions according to the RSSI field, or does not meet the conditions according to the latency of the detection message, a signaling connection can be established with the receiving device through a non-local area network. For example, a signaling connection is established through the BLE medium.

[0186] Optionally, if the latency of the detection message reaches several hundred milliseconds or the second level, at this time, the feedback message in the mutual discovery process through the BLE medium will be received by the sending device. At this time, the sending device can determine to establish a signaling connection with the receiving device through the Bluetooth medium without waiting for the detection message to return.

[0187] Further, after a signaling connection is established between the sending device and the receiving device via a local area network, the sending device and the receiving device can use a point-to-point communication method with a fast transmission rate for service transmission. To ensure the success rate of point-to-point transmission between the sending device and the receiving device, it is also necessary to determine whether the current sending device and receiving device meet the conditions for point-to-point service transmission.

[0188] Optionally, in S306, obtain the distance between the sending device and the receiving device.

[0189] Optionally, in S307, determine whether the distance between the sending device and the receiving device meets the conditions.

[0190] Exemplarily, during the high-speed WiFi connection establishment phase, the distance between the sending device and the receiving device can be determined by any one of methods such as Bluetooth signal, ultrasonic signal, ultra wide band (UWB) wireless carrier communication technology, and near field communication (NFC). Bluetooth signals can include BLE and basic rate (BR).

[0191] For example, during the high-speed WiFi connection establishment phase, detect the Bluetooth signal (Bluetooth RSSI). If the Bluetooth signal is strong, subsequent step S308 can be executed; if the Bluetooth signal is weak, subsequent step S309 can be executed. When the sending device and the receiving device are connected via a local area network, a prompt message can be displayed on the user interface of the electronic device to prompt the user that local area network communication is currently in progress.

[0192] It should be noted that the RSSI field can be used to measure the distance. The approximate distance between the sending device and the receiving device can be determined through the balanced attenuation value of the Bluetooth RSSI. If the distance between the sending device and the receiving device is too far, it indicates that it is not suitable to establish a near-field point-to-point communication connection.

[0193] Optionally, in S308, establish a point-to-point connection between the sending device and the receiving device.

[0194] Exemplarily, the point-to-point connection can be WiFi P2P communication or HML communication.

[0195] Optionally, in S309, establish a local area network connection between the sending device and the receiving device.

[0196] It should be noted that establishing a local area network connection between the sending device and the receiving device can be understood as that the service transmission between the sending device and the receiving device needs to be forwarded by a router.

[0197] It should be noted that in method 300, it is determined whether a signaling connection can be established between the sending device and the receiving device through the local area network from step S301 to step S305, so as to ensure the success rate of establishing a signaling connection between the electronic devices through the local area network as much as possible. Steps S306 to S309 are optional steps. After the sending device and the receiving device establish a signaling connection through the local area network, it can be further determined whether the sending device and the receiving device are suitable for point-to-point service transmission from step S306 to step S309, so as to ensure the success rate of establishing a high-speed WiFi connection.

[0198] Based on the above solution, in a distributed service scenario, during the mutual discovery phase between electronic devices, it is determined whether it is suitable to establish a signaling connection through CoAP, and before service transmission, it is determined whether a point-to-point connection between devices can be established using high-speed WiFi. Thus, it is ensured as much as possible that the electronic devices use CoAP to establish a signaling connection and the success rate of establishing a high-speed WiFi connection, improving the experience of distributed services.

[0199] As Figure 4 shown, a communication method provided by the present application is shown. This method can be applied to a communication system, which includes a first electronic device, a second electronic device, and a router. Among them, the first electronic device can be understood as the sending device in the above text, and the second electronic device can be understood as the receiving device. The following specifically introduces this method 400.

[0200] S401, the second electronic device determines a first message.

[0201] S402, the second electronic device sends the first message. Correspondingly, the router receives the first message.

[0202] S403, the router sends the first message. Correspondingly, the first electronic device receives the first message.

[0203] Exemplarily, the first message is a feedback message of a discovery message. Before the second electronic device determines the first message, it receives a discovery message from the first electronic device. When the first electronic device receives the feedback message of the discovery message from the second electronic device, the first electronic device and the second electronic device discover each other. Among them, the discovery message of the first electronic device is a broadcast message, and the first message (the feedback message of the discovery message) is a unicast message.

[0204] It should be noted that in a local area network scenario, to implement the mutual discovery process between the first electronic device and the second electronic device through the CoAP medium with low discovery latency, the forwarding of messages by the router is required.

[0205] It should be understood that the first message includes a first field, and the first field is used to represent the signal strength of the second electronic device.

[0206] Exemplarily, the first field is an RSSI field. Before the second electronic device sends the first message, it may add an RSSI field to the first message. The field structure of the first message may be as shown in Table 1 above and will not be elaborated here.

[0207] S404. The first electronic device determines a first parameter according to the first field.

[0208] It should be understood that the first parameter is used to characterize the distance between the second electronic device and the router. In the first message from the second electronic device, an RSSI field is newly added. The first electronic device may calculate the distance between the second electronic device and the router according to the signal strength of the second electronic device indicated by the RSSI field.

[0209] S405. The first electronic device determines a second parameter according to the second field.

[0210] It should be understood that the first message further includes a second field, and the second field is used to represent the signal strength of the router. The first electronic device determines a second parameter according to the second field in the first message, and the second parameter is used to characterize the distance between the router and the first electronic device.

[0211] It should be noted that the first message received by the first electronic device is forwarded by the router. Before the router forwards the first message to the first electronic device, it may carry the second field in the first message, and the second field may be an RSSI field. The first electronic device may calculate the distance between the router and the first electronic device according to the signal strength of the router indicated by the RSSI field.

[0212] Exemplarily, the first field may be carried at the tail of the first message, and the second field may be carried at the head of the first message.

[0213] S406. When the first parameter and the second parameter meet the first preset condition, the first electronic device establishes a signaling connection with the second electronic device through the local area network.

[0214] Exemplarily, the first preset condition may be understood as that the distance between the devices characterized by the parameters meets the condition for establishing a signaling connection through the local area network.

[0215] It should be noted that before the first electronic device and the second electronic device establish a signaling connection through the local area network, it is necessary to first determine whether each communication link for establishing the signaling connection through the local area network meets the conditions for establishing the signaling connection. The first electronic device determines whether the distance characterized by the first parameter and the distance characterized by the second parameter meet the conditions for establishing a signaling connection through the local area network. That is, the first electronic device determines whether the path between the first electronic device and the router and the path between the router and the second electronic device meet the conditions for establishing a signaling connection through the local area network.

[0216] That is to say, when the signal strength of the second electronic device and the signal strength of the router meet the conditions for establishing a signaling connection through the local area network, a signaling connection can be established with the second electronic device through the local area network.

[0217] Generally speaking, when the distances characterized by the first parameter and the second parameter are both close enough, it is suitable for the first electronic device and the second electronic device to establish a signaling connection through the local area network.

[0218] In one implementation, when the first parameter or the second parameter does not meet the first preset condition, a signaling connection is established with the second electronic device through a non-local area network.

[0219] Generally speaking, when either of the distances characterized by the first parameter or the second parameter is relatively far, the establishment of a signaling connection between the first electronic device and the second electronic device through the local area network may fail. The first electronic device can attempt to establish a signaling connection with the second electronic device through a non-local area network. For example, a signaling connection is established through the BLE medium.

[0220] It should be noted that the above describes determining the first parameter and the second parameter through the first field and the second field in the first message respectively, and when the first parameter and the second parameter meet the first preset condition, the first electronic device and the second electronic device can establish a signaling connection through the local area network. In addition, after the first electronic device and the second electronic device discover each other, it is also possible to determine whether a signaling connection can be established through the local area network through a probe message.

[0221] Specifically, the first electronic device sends a second message to the second electronic device; receives a feedback message of the second message from the second electronic device; when the RTT of the second message meets the first preset condition, the first electronic device establishes a signaling connection with the second electronic device through the local area network.

[0222] Exemplarily, the second message is a probe message.

[0223] Specifically, the first electronic device receives a third message from the second electronic device; determines the unicast address of the second electronic device according to the third message; and sends a second message to the second electronic device according to the unicast address of the second electronic device.

[0224] Exemplarily, the third message is a feedback message of the discovery message, and the third message is a unicast message.

[0225] It should be noted that after the first electronic device and the second electronic device discover each other, the first electronic device can determine the unicast address of the second electronic device according to the feedback message of the discovery message unicast by the second electronic device, and unicast a detection message to the second electronic device according to the unicast address of the second electronic device, and receive the feedback message of the detection message sent by the second electronic device. The first electronic device determines whether the paths between the second electronic device and the router, and between the router and the first electronic device meet the conditions according to the RTT of the detection message. It should be noted that the transmission of the detection message and the feedback message of the detection message between the first electronic device and the second electronic device need to be forwarded by the router. Therefore, the RTT can reflect the communication conditions of the paths between the first electronic device and the router, and between the router and the second electronic device.

[0226] If the RTT of the detection message is low and meets the experience delay, the first electronic device and the second electronic device can establish a signaling connection through the local area network; if the RTT of the detection message is high and does not meet the experience delay, the first electronic device and the second electronic device can establish a signaling connection through a non-local area network.

[0227] Optionally, in S407, when the third parameter meets the second preset condition, the first electronic device establishes a data connection with the second electronic device in a point-to-point manner.

[0228] Exemplarily, the second preset condition can be understood as that the distance between the devices characterized by the parameter meets the condition for establishing a signaling data connection in a point-to-point manner.

[0229] Exemplarily, after the first electronic device and the second electronic device establish a signaling connection through the local area network, the first electronic device can obtain the third parameter. Before the first electronic device and the second electronic device establish a data connection in a point-to-point manner, it is necessary to determine whether the third parameter meets the second preset condition. Among them, the third parameter is used to characterize the distance between the first electronic device and the second electronic device.

[0230] It should be noted that after the first electronic device and the second electronic device establish a signaling connection through the local area network, first determine whether the communication link between the first electronic device and the second electronic device meets the conditions for point-to-point service transmission. If it meets, establish a data connection in a point-to-point manner.

[0231] It should be understood that when the first electronic device and the second electronic device establish a signaling connection through a local area network, it indicates that the distance between the first electronic device and the router, and between the router and the second electronic device is close enough. However, the distance between the first electronic device and the second electronic device affects the success rate of establishing a data connection in a point-to-point manner. Therefore, it is necessary to pre-determine whether the distance between the first electronic device and the second electronic device meets the conditions for establishing a point-to-point data connection.

[0232] Specifically, the first electronic device can obtain the third parameter through one of the following methods: Bluetooth signal, ultrasonic signal, UWB, NFC.

[0233] For example, the distance between the first electronic device and the second electronic device is determined by the balanced attenuation value of Bluetooth RSSI. If the distance is too far, it means that it is not suitable to establish a near-field point-to-point data connection.

[0234] Exemplarily, the point-to-point communication method includes WiFi P2P communication or HML communication.

[0235] It should be noted that the first electronic device and the second electronic device that establish a data connection in a point-to-point manner can directly perform service transmission. This transmission method has a fast transmission rate and high transmission efficiency.

[0236] In one implementation, when the third parameter does not meet the second preset condition, the first electronic device and the second electronic device establish a data connection through the local area network.

[0237] Exemplarily, the first electronic device and the second electronic device need to forward services or data through the router.

[0238] It should be noted that in method 400, it is determined whether the first electronic device and the second electronic device can establish a signaling connection through the local area network through steps S401 to S406 to ensure the success rate of the electronic device establishing a signaling connection through the local area network as much as possible. Step S407 is an optional step. After the first electronic device and the second electronic device establish a signaling connection through the local area network, it can be further determined whether the first electronic device and the second electronic device are suitable for point-to-point service transmission through step S407 to ensure the success rate of establishing a high-speed WiFi connection.

[0239] Based on the above solution, in a distributed service scenario, during the mutual discovery phase between electronic devices, it is determined whether it is suitable to establish a signaling connection through the local area network, and before service transmission, it is determined whether a high-speed WiFi point-to-point connection can be established between devices. Thus, it ensures the success rate of the electronic device establishing a signaling connection through the local area network and establishing a high-speed WiFi connection as much as possible, improving the experience of distributed services.

[0240] Figure 5 is a schematic block diagram of the device according to an embodiment of the present application. The device may be the first electronic device or the second electronic device as described above. Figure 5 The illustrated device 500 includes: a processor 510, a transceiver 520, and a memory 530. Among them, the processor 510, the transceiver 520, and the memory 530 are connected through an internal connection path. The memory 530 is used to store programs, the processor 510 is used to execute the programs stored in the memory 530, and the transceiver 520 receives / sends messages. Optionally, the memory 530 can be coupled to the processor 510 through an interface or integrated with the processor 510.

[0241] It should be noted that the above transceiver 520 may include, but is not limited to, a transceiver device such as an input / output interface to implement communication between devices.

[0242] In the implementation process, each step of the above method can be completed by the integrated logic circuit of the hardware in the processor 510 or the instructions in software form. The method disclosed in combination with the embodiments of the present application can be directly embodied as being executed and completed by the hardware processor, or executed and completed by the combination of the hardware and software modules in the processor. The software module can be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. This storage medium is located in the memory 530, and the processor 510 reads the information in the memory 530 and combines its hardware to complete the steps of the above method. To avoid repetition, it will not be described in detail here.

[0243] The embodiments of the present application provide a computer program product. When the computer program product runs on a device, the device is enabled to execute the technical solutions in the above embodiments. Its implementation principle and technical effects are similar to those of the related embodiments of the above method, and will not be elaborated here.

[0244] The embodiments of the present application provide a readable storage medium. The readable storage medium contains instructions. When the instructions run on a device, the device is enabled to execute the technical solutions of the above embodiments. Its implementation principle and technical effects are similar, and will not be elaborated here.

[0245] The embodiments of the present application provide a chip. The chip is used to execute instructions. When the chip runs, it executes the technical solutions in the above embodiments. Its implementation principle and technical effects are similar, and will not be elaborated here.

[0246] Those of ordinary skill in the art will recognize that the units and algorithm steps of each example described in connection with the embodiments disclosed herein can be implemented in electronic hardware, or in a combination of computer software and electronic hardware. Whether these functions are executed in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods for each specific application to implement the described functions, but such implementation should not be considered to exceed the scope of the embodiments of the present application.

[0247] Those skilled in the art can clearly understand that for the convenience and conciseness of description, the specific working processes of the above-described devices and units (modules) can refer to the corresponding processes in the foregoing method embodiments, and will not be elaborated herein.

[0248] In several embodiments provided in the present application, it should be understood that the disclosed devices, apparatuses, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the unit is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces. The indirect couplings or communication connections of the devices or units can be in electrical, mechanical, or other forms.

[0249] The units described as separate components may or may not be physically separated. The components shown as units may or may not be physical units, that is, they can be located in one place, or can be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0250] In addition, in each embodiment of the present application, the functional units can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit.

[0251] If the above functions are implemented in the form of software function units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiments of the present application, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical discs that can store program codes.

[0252] The above is only the specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present application can easily think of changes or substitutions, which should all be covered by the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A communication method, characterized in that, The method is applied to a first electronic device, and the method includes: Receiving, by a router, a first message from a second electronic device, where the first message includes a first field for indicating the signal strength of the second electronic device; Determining a first parameter according to the first field, where the first parameter is used to characterize the distance between the second electronic device and the router.

2. The method according to claim 1, characterized in that, The first message further includes a second field for indicating the signal strength of the router, and the method further includes: Determining a second parameter according to the second field, where the second parameter is used to characterize the distance between the router and the first electronic device.

3. The method according to claim 2, characterized in that, The method further includes: When the first parameter and the second parameter meet a first preset condition, establishing a signaling connection with the second electronic device through a local area network.

4. The method according to any one of claims 1 to 3, characterized in that, The first message is a feedback message of a discovery message.

5. The method according to any one of claims 1 to 4, characterized in that, The first field is a received signal strength indication (RSSI) field.

6. A communication method, characterized in that, The method is applied to a first electronic device, and the first electronic device discovers the second electronic device mutually. The method includes: Sending a second message to the second electronic device; Receiving a feedback message of the second message from the second electronic device; When the round-trip time (RTT) of the second message meets a first preset condition, establishing a signaling connection with the second electronic device through a local area network.

7. The method according to claim 6, wherein The sending the second message to the second electronic device includes: Receiving a third message from the second electronic device; Determining the unicast address of the second electronic device according to the third message; Sending the second message to the second electronic device according to the unicast address of the second electronic device.

8. The method according to claim 7, wherein The third message is a feedback message of a discovery message.

9. The method according to any one of claims 3-5 or 6-8, characterized in that, The method further includes: Obtaining a third parameter for characterizing the distance between the first electronic device and the second electronic device; When the third parameter meets a second preset condition, establishing a data connection with the second electronic device in a point-to-point manner.

10. The method according to claim 9, wherein The obtaining the third parameter includes: Obtaining the third parameter through one of the following: Bluetooth signal, ultrasonic signal, ultra-wideband (UWB) wireless carrier communication technology, near field communication (NFC).

11. A communication method, characterized in that, The method is applied to a second electronic device, and the method includes: Determining a first message, where the first message includes a first field; Sending the first message to a first electronic device through a router, where the first field is used for the first electronic device to determine a first parameter for characterizing the distance between the second electronic device and the router.

12. The method according to claim 11, wherein The method further includes: Establishing a signaling connection with the first electronic device through a local area network; Where the distance between the first electronic device and the router is a second parameter, and the first parameter and the second parameter meet a first preset condition.

13. The method according to claim 11 or 12, characterized in that, The first message is a feedback message of a discovery message.

14. The method according to any one of claims 11 to 13, characterized in that, The first field is a received signal indication (RSSI) field.

15. A communication method, characterized in that, The method is applied to a second electronic device, and the second electronic device discovers the first electronic device mutually. The method includes: Receiving a second message from the first electronic device; Send a feedback message of the second message to the first electronic device; When the round-trip time (RTT) of the second message meets a first preset condition, establish a signaling connection with the first electronic device through a local area network.

16. The method according to claim 15, wherein The receiving the second message from the first electronic device includes: Send a third message to the first electronic device, where the third message is used for the first electronic device to determine the unicast address of the second electronic device; Receive the second message from the first electronic device according to the unicast address of the second electronic device.

17. The method according to claim 16, characterized in that The third message is a feedback message of a discovery message.

18. The method according to any one of claims 12 - 14 or 15 - 17, characterized in that, The method further includes: When a third parameter meets a second preset condition, establish a data connection with the first electronic device in a point-to-point manner; Wherein, the third parameter is used to characterize the distance between the second electronic device and the first electronic device.

19. A communication method, characterized in that, The method is applied to a router, and the method includes: Receive a first message from a second electronic device, where the first message includes a first field; Send the first message to a first electronic device, where the first field is used for the first electronic device to determine a first parameter, and the first parameter is used to characterize the distance between the second electronic device and the router.

20. The method according to claim 19, wherein The first message further includes a second field, and the second field is used for the first electronic device to determine a second parameter, and the second parameter is used to characterize the distance between the router and the first electronic device.

21. The method according to claim 19 or 20, characterized in that, The first message is a feedback message of a discovery message.

22. The method according to any one of claims 19 to 21, wherein The first field is a received signal strength indication (RSSI) field.

23. A communication device, characterized in that, A processor coupled to a memory, the memory is used to store a computer program, and the processor is used to run the computer program so that the communication device executes the method according to any one of claims 1-10, 11-18, 19-22.

24. The communication device according to claim 23, wherein It further includes one or more of the memory and a transceiver, and the transceiver is used to receive signals and / or send signals.

25. A communication system, characterized in that, Includes a first electronic device, a second electronic device and a router according to any one of claims 1-10, 11-18, 19-22.

26. A computer-readable storage medium, characterized in that, A computer program is stored thereon, and when the computer program is executed by the computer, the computer is caused to implement the method according to any one of claims 1-10, 11-18, 19-22.

27. A computer program product comprising instructions, characterized in that, When the computer program product runs on a computer, the computer is caused to execute the method according to any one of claims 1-10, 11-18, 19-22.

28. A chip, characterized in that, The chip includes a processor and a data interface, and the processor reads instructions stored on a memory through the data interface to execute the method according to any one of claims 1-10, 11-18, 19-22.

Citation Information

Cited By

  • A method and apparatus for connecting a terminal to a device in a local area network

    CN122554986A

  • Communication method and communication apparatus

    EP4727254A1

  • Communication method and communication apparatus

    WO2025156973A1