Communication method and communication apparatus
By carrying the RSSI field in the discovery message, determining the distance between the device and the router, and optimizing the connection method, the problem of low success rates of signaling connections and high-speed WiFi connections is solved, and more efficient resource utilization and service experience is achieved.
Patent Information
- Application Number
- PCT/CN2025/070436
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-01-22
- Filing Date
- 2025-01-03
- Publication Date
- 2025-07-31
AI Technical Summary
In distributed services, when electronic devices search peripheral devices through local area networks and non-local area network media, the success rate of signaling connections and high-speed WiFi connections is low, and resources are seriously wasted.
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 optimal connection method is selected according to preset conditions, including local or non-local network connections, and point-to-point communication, optimize signaling and data connections.
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.
Smart Images

Figure CN2025070436_31072025_PF_FP_ABST
Abstract
Description
Communication method and communication device
[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office of China on January 22, 2024, with application number 202410086706.8 and invention name “Communication Method and Communication Device”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of communication technology, and more specifically, to a communication method and a communication device. Background Art
[0003] Electronic devices in current distributed services 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 searches for peripheral devices based on the CoAP medium, which is a search method in a local area network scenario. The electronic device searches for peripheral devices based on the BLE medium, which is a search method in a non-local area network scenario. The search rates of the above two media are different.
[0004] Generally speaking, using CoAP as a medium allows for faster discovery of surrounding devices and establishing signaling connections with them. Furthermore, due to the high efficiency of high-speed wireless fidelity (WiFi) connections for service transmission, high-speed WiFi connections can often be established between electronic devices after the signaling connection is established.
[0005] While electronic devices can quickly discover each other using CoAP over a local area network, it's unclear whether these devices can also establish a signaling connection using CoAP. Blindly using CoAP can lead to signaling connection failures. Furthermore, even if a signaling connection is successfully established using CoAP, there's still a chance that establishing a high-speed Wi-Fi connection will fail.
[0006] Therefore, how to ensure the success rate of electronic devices establishing signaling connections through local area networks and the success rate of establishing high-speed WiFi connections are currently urgent issues to be solved. Summary of the Invention
[0007] The present application provides a communication method and a communication device, which can maximize the success rate of electronic devices establishing signaling connections through local area networks and ensure the success rate of establishing high-speed WiFi connections.
[0008] In a first aspect, a communication method is provided, which is applied to a first electronic device. The method includes: receiving a first message from a second electronic device via a router, the first message including a first field, the first field being used to represent the signal strength of the second electronic device; and determining a first parameter based on the first field, the first parameter being used to characterize the distance between the second electronic device and the router.
[0009] 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. 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.
[0010] It should be noted that, in a local area network scenario, the mutual discovery process between the first electronic device and the second electronic device through the constrained application protocol (CoAP) medium with low discovery latency requires the forwarding of messages by a router.
[0011] 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.
[0012] 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 facilitates the subsequent determination of the specific method for establishing the signaling connection, thereby improving the success rate of establishing the signaling and avoiding waste of resources.
[0013] In combination with the first aspect, in certain implementations of the first aspect, the first message also includes a second field, which is used to indicate the signal strength of the router. The method also includes: determining a second parameter based on the second field, which is used to characterize the distance between the router and the first electronic device.
[0014] 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, the first message may include a second field, which may be an RSSI field. The first electronic device may calculate the distance between the router and the first electronic device based on the signal strength of the router indicated by the RSSI field.
[0015] Illustratively, the first field may be carried at the end of the first message, and the second field may be carried at the head of the first message.
[0016] 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 facilitates the subsequent determination of the specific method for establishing the signaling connection, thereby improving the success rate of establishing the signaling and avoiding waste of resources.
[0017] In combination with the first aspect, in some 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.
[0018] Exemplarily, the first preset condition may be understood as the distance between devices represented by the parameter meeting the condition for establishing a signaling connection through the local area network.
[0019] It should be noted that before the first electronic device and the second electronic device establish a signaling connection via the local area network, it is necessary to first determine whether each communication link for establishing the signaling connection via the local area network satisfies the conditions for establishing the signaling connection. The first electronic device determines whether the distance represented by the first parameter and the distance represented by the second parameter satisfy the conditions for establishing the signaling connection via the local area network. In other words, 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, satisfy the conditions for establishing the signaling connection via the local area network.
[0020] That is, 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.
[0021] Generally speaking, when the distance represented by the first parameter and the distance represented by the second parameter are both close enough, the first electronic device and the second electronic device are suitable for establishing a signaling connection through the local area network.
[0022] In one implementation, when the first parameter or the second parameter does not satisfy the first preset condition, a signaling connection is established with the second electronic device via a non-local area network.
[0023] Generally speaking, when either the distance represented by the first parameter or the distance represented by the second parameter is greater than the maximum value, the first electronic device may fail to establish a signaling connection with the second electronic device via the local area network. The first electronic device may attempt to establish a signaling connection with the second electronic device via a non-local area network, for example, via a Bluetooth low energy (BLE) medium.
[0024] 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.
[0025] In combination with the first aspect, in some implementations of the first aspect, the first message is a feedback message of the discovery message.
[0026] In combination with the first aspect, in some implementations of the first aspect, the first field is a received signal strength indication RSSI field.
[0027] In combination with the first aspect, in certain implementations of the first aspect, the method further includes: obtaining a third parameter, which is used to characterize the distance between the first electronic device and the second electronic device; when the third parameter meets the second preset condition, establishing a data connection with the second electronic device in a point-to-point manner.
[0028] Exemplarily, the second preset condition may be understood as the distance between the devices represented by the parameter meeting the condition for establishing a signaling data connection in a point-to-point manner.
[0029] It should be noted that after the first electronic device and the second electronic device establish a signaling connection through the local area network, it is first determined whether the communication link between the first electronic device and the second electronic device meets the conditions for point-to-point service transmission. If so, a data connection is established in a point-to-point manner.
[0030] It should be understood that when a first electronic device and a second electronic device establish a signaling connection via a local area network, the distance between the first electronic device and the router, and between the router and the second electronic device, is sufficiently close. However, the distance between the first and second electronic devices can affect the success rate of establishing a point-to-point data connection. Therefore, it is necessary to determine in advance whether the distance between the first and second electronic devices satisfies the conditions for establishing a point-to-point data connection.
[0031] 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 a point-to-point data signaling connection, thereby reducing resource waste.
[0032] In combination with the first aspect, in certain implementations of the first aspect, obtaining the third parameter includes: obtaining the third parameter through one of the following: Bluetooth signal, ultrasonic signal, wireless carrier communication technology UWB, near field communication NFC.
[0033] For example, the distance between the first electronic device and the second electronic device is determined by the balanced attenuation value of the 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.
[0034] Exemplarily, the point-to-point communication mode includes WiFi P2P communication or Huawei magneto link (HML) communication.
[0035] 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 transmit services, and this transmission method has a fast transmission rate and high transmission efficiency.
[0036] In one implementation, when the third parameter does not meet the second preset condition, the first electronic device establishes a data connection with the second electronic device via a local area network.
[0037] Exemplarily, the services or data transmitted between the first electronic device and the second electronic device need to be forwarded through a router.
[0038] In a second aspect, a communication method is provided, which is applied to a first electronic device, where the first electronic device and a second electronic device discover each other, and 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.
[0039] Exemplarily, the second message may be a detection message.
[0040] It should be understood that after the first electronic device and the second electronic device discover each other, they can also determine whether a signaling connection can be established through the local area network through a detection message.
[0041] It should be noted that the transmission of the detection message between the first electronic device and the second electronic device, as well as the feedback message of the detection message need to be forwarded through the router. Therefore, RTT can reflect the communication status of the path between the first electronic device and the router, and between the router and the second electronic device.
[0042] For example, if the RTT of the detection message is low and meets the experiential 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 detection message is high and does not meet the experiential delay, the first electronic device and the second electronic device can establish a signaling connection through a non-local area network.
[0043] Based on the above scheme, the first electronic device can determine the communication status of the path between the first electronic device and the router, and between the router and the second electronic device according to the RTT of the detection message. When certain conditions are met, 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.
[0044] In combination with the second aspect, in certain 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 based on the third message; and sending the second message to the second electronic device based on the unicast address of the second electronic device.
[0045] 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 based on the feedback message of the discovery message unicast by the second electronic device, and unicast a detection message to the second electronic device based on the unicast address of the second electronic device.
[0046] In combination with the second aspect, in some implementations of the second aspect, the third message is a feedback message of the discovery message.
[0047] In combination with the second aspect, in certain implementations of the second aspect, the method further includes: obtaining a third parameter, which is used to characterize the distance between the first electronic device and the second electronic device; when the third parameter meets the second preset condition, establishing a data connection with the second electronic device in a point-to-point manner.
[0048] Exemplarily, the second preset condition may be understood as the distance between the devices represented by the parameter meeting the condition for establishing a signaling data connection in a point-to-point manner.
[0049] 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 a point-to-point data signaling connection, thereby reducing resource waste.
[0050] In combination with the second aspect, in certain implementations of the second aspect, obtaining the third parameter includes: obtaining the third parameter through one of the following: Bluetooth signal, ultrasonic signal, wireless carrier communication technology UWB, near field communication NFC.
[0051] In a third aspect, a communication method is provided, which is applied to a second electronic device, the method comprising: determining a first message, the first message comprising a first field; sending the first message to the first electronic device through a router, wherein 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 second electronic device and the router.
[0052] 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. 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.
[0053] It should be noted that, in a local area network scenario, the mutual discovery process between the first electronic device and the second electronic device through the CoAP medium with low discovery latency requires the forwarding of messages by a router.
[0054] 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.
[0055] Based on the above scheme, the second electronic device can add a first field in 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 based on the first field, which facilitates the subsequent determination of the specific method for establishing a signaling connection, thereby improving the success rate of establishing signaling and avoiding waste of resources.
[0056] In combination with the third aspect, in certain implementations of the third aspect, the method further includes: establishing a signaling connection with the first electronic device through a local area network; wherein 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.
[0057] Exemplarily, the first preset condition may be understood as the distance between devices represented by the parameter meeting the condition for establishing a signaling connection through the local area network.
[0058] It should be noted that before the first electronic device and the second electronic device establish a signaling connection via the local area network, it is necessary to first determine whether each communication link for establishing the signaling connection via the local area network meets the conditions for establishing the signaling connection. When the signal strength of the second electronic device and the signal strength of the router meet the conditions for establishing the signaling connection via the local area network, a signaling connection can be established with the first electronic device via the local area network.
[0059] Generally speaking, when the distance represented by the first parameter and the distance represented by the second parameter are both close enough, the first electronic device and the second electronic device are suitable for establishing a signaling connection through the local area network.
[0060] In one implementation, when the first parameter or the second parameter does not satisfy the first preset condition, the second electronic device establishes a signaling connection with the first electronic device through the non-local area network.
[0061] Generally speaking, when either the distance represented by the first parameter or the distance represented by the second parameter is greater than the maximum value, the first electronic device may fail to establish a signaling connection with the second electronic device via the local area network. The first electronic device may attempt to establish a signaling connection with the second electronic device via a non-local area network, for example, via a Bluetooth low energy (BLE) medium.
[0062] 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.
[0063] In combination with the third aspect, in some implementations of the third aspect, the first message is a feedback message of the discovery message.
[0064] In combination with the third aspect, in some implementations of the third aspect, the first field is a received signal indication RSSI field.
[0065] In combination with the third aspect, in certain implementations of the third aspect, the method further includes: when a third parameter meets a 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 characterize the distance between the second electronic device and the first electronic device.
[0066] Exemplarily, the second preset condition may be understood as the distance between the devices represented by the parameter meeting the condition for establishing a signaling data connection in a point-to-point manner.
[0067] It should be noted that after the first electronic device and the second electronic device establish a signaling connection through the local area network, it is first determined whether the communication link between the first electronic device and the second electronic device meets the conditions for point-to-point service transmission. If so, a data connection is established in a point-to-point manner.
[0068] It should be understood that when a first electronic device and a second electronic device establish a signaling connection via a local area network, the distance between the first electronic device and the router, and between the router and the second electronic device, is sufficiently close. However, the distance between the first and second electronic devices can affect the success rate of establishing a point-to-point data connection. Therefore, it is necessary to determine in advance whether the distance between the first and second electronic devices satisfies the conditions for establishing a point-to-point data connection.
[0069] 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 a point-to-point data signaling connection, thereby reducing resource waste.
[0070] In a fourth aspect, a communication method is provided, which is applied to a second electronic device, where the second electronic device and the first electronic device discover each other, and 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.
[0071] Exemplarily, the second message may be a detection message.
[0072] It should be understood that after the first electronic device and the second electronic device discover each other, they can also determine whether a signaling connection can be established through the local area network through a detection message.
[0073] It should be noted that the transmission of the detection message between the first electronic device and the second electronic device, as well as the feedback message of the detection message need to be forwarded through the router. Therefore, RTT can reflect the communication status of the path between the first electronic device and the router, and between the router and the second electronic device.
[0074] For example, if the RTT of the detection message is low and meets the experiential 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 detection message is high and does not meet the experiential delay, the first electronic device and the second electronic device can establish a signaling connection through a non-local area network.
[0075] Based on the above scheme, the communication status of the path 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 detection message. When certain conditions are met, 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.
[0076] In combination with the fourth aspect, in certain implementations of the fourth aspect, the receiving of the second message from the first electronic device includes: sending a third message to the first electronic device, the third message being used by the first electronic device to determine the unicast address of the second electronic device; and receiving the second message from the first electronic device according to the unicast address of the second electronic device.
[0077] 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 can carry the unicast address of the second electronic device, so that the first electronic device can unicast the detection message to the second electronic device according to the unicast address.
[0078] In combination with the fourth aspect, in certain implementations of the fourth aspect, the third message is a feedback message of the discovery message.
[0079] In combination with the fourth aspect, in certain implementations of the fourth aspect, the method further includes: when a third parameter meets a 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 characterize the distance between the second electronic device and the first electronic device.
[0080] Exemplarily, the second preset condition may be understood as the distance between the devices represented by the parameter meeting the condition for establishing a signaling data connection in a point-to-point manner.
[0081] 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 a point-to-point data signaling connection, thereby reducing resource waste.
[0082] In a fifth aspect, a communication method is provided, which is applied to a router, and the method includes: receiving a first message from a second electronic device, the first message including a first field; sending the first message to a first electronic device, wherein 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 second electronic device and the router.
[0083] Exemplarily, the first field is a received signal strength indicator (RSSI) field. Before sending the first message, the second electronic device may add the RSSI field to the first message. The router may forward the first message carrying the first field to the first electronic device.
[0084] Based on the above scheme, the router sends the first message carrying the first field to the first electronic device, so that the first electronic device can determine the distance between the second electronic device and the router based on the first field in the first message, which facilitates the subsequent determination of the specific method for establishing a signaling connection, thereby improving the success rate of establishing signaling and avoiding waste of resources.
[0085] In combination with the fifth aspect, in some implementations of the fifth aspect, the first message further includes a second field, where the second field is used by the first electronic device to determine a second parameter, where the second parameter is used to characterize the distance between the router and the first electronic device.
[0086] It should be noted that the first message forwarded by the router to the first electronic device may also carry a second field indicating the signal strength of the router, and the second field may be an RSSI field.
[0087] Illustratively, the first field may be carried at the end of the first message, and the second field may be carried at the head of the first message.
[0088] Based on the above scheme, 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 based on the second field of the first message, which facilitates the subsequent determination of the specific method for establishing a signaling connection, thereby improving the success rate of establishing signaling and avoiding waste of resources.
[0089] In combination with the fifth aspect, in certain implementations of the fifth aspect, the first message is a feedback message of the discovery message.
[0090] In combination with the fifth aspect, in some implementations of the fifth aspect, the first field is a received signal strength indication RSSI field.
[0091] In a sixth aspect, a communication device is provided, which is carried by a first electronic device and includes: a transceiver unit for receiving a first message from a second electronic device through a router, the first message including a first field, the first field being used to represent the signal strength of the second electronic device; a processing unit for determining a first parameter based on the first field, the first parameter being used to characterize the distance between the second electronic device and the router.
[0092] In combination with the sixth aspect, in certain implementations of the sixth aspect, the first message also includes a second field, which is used to indicate the signal strength of the router. The processing unit is also used to determine a second parameter based on the second field, and the second parameter is used to characterize the distance between the router and the device.
[0093] In combination with the sixth aspect, in certain implementations of the sixth aspect, the processing unit is further used to establish a signaling connection with the second electronic device through the local area network when the first parameter and the second parameter meet a first preset condition.
[0094] In combination with the sixth aspect, in certain implementations of the sixth aspect, the first message is a feedback message of the discovery message.
[0095] In combination with the sixth aspect, in some implementations of the sixth aspect, the first field is a received signal strength indication RSSI field.
[0096] In combination with the sixth aspect, in certain implementations of the sixth aspect, the processing unit is further used to obtain a third parameter, which is used to characterize the distance between the device and the second electronic device; the processing unit is also used 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.
[0097] In combination with the sixth aspect, in certain implementations of the sixth aspect, the transceiver unit is specifically used to obtain the third parameter through one of the following: Bluetooth signal, ultrasonic signal, wireless carrier communication technology UWB, and near field communication NFC.
[0098] In the seventh aspect, a communication device is provided, which carries a first electronic device and discovers each other with a second electronic device. The device includes: a transceiver unit for sending a second message to the second electronic device; and a processing unit for establishing a signaling connection with the second electronic device through a local area network when the round-trip delay RTT of the second message meets a first preset condition.
[0099] In combination with the seventh aspect, in certain implementations of the seventh aspect, the transceiver unit is specifically used to receive a third message from the second electronic device; the processing unit is also used to determine the unicast address of the second electronic device based on the third message; the transceiver unit is also used to send the second message to the second electronic device based on the unicast address of the second electronic device.
[0100] In combination with the seventh aspect, in certain implementations of the seventh aspect, the third message is a feedback message of the discovery message.
[0101] In combination with the seventh aspect, in certain implementations of the seventh aspect, the transceiver unit is further used to obtain a third parameter, which is used to characterize the distance between the device and the second electronic device; the processing unit is further used 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.
[0102] In combination with the seventh aspect, in certain implementations of the seventh aspect, the transceiver unit is specifically used to obtain the third parameter through one of the following: Bluetooth signal, ultrasonic signal, wireless carrier communication technology UWB, and near field communication NFC.
[0103] In an eighth aspect, a communication device is provided, which is carried by a second electronic device, and includes: a processing unit for determining a first message, the first message including a first field; a transceiver unit for sending the first message to the first electronic device through a router, wherein 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.
[0104] In combination with the eighth aspect, in certain implementations of the eighth aspect, the processing unit is further used to establish a signaling connection with the first electronic device through a local area network; wherein 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.
[0105] In combination with the eighth aspect, in certain implementations of the eighth aspect, the first message is a feedback message of the discovery message.
[0106] In combination with the eighth aspect, in certain implementations of the eighth aspect, the first field is a received signal indication RSSI field.
[0107] In combination with the eighth aspect, in certain implementations of the eighth aspect, the processing unit is further used to establish a data connection with the first electronic device in a point-to-point manner when the third parameter meets the second preset condition; wherein the third parameter is used to characterize the distance between the device and the first electronic device.
[0108] In the ninth aspect, a communication device is provided, which is carried by a second electronic device and discovers each other with the first electronic device. The device includes: a transceiver unit for receiving a second message from the first electronic device; the transceiver unit is also used to send a feedback message of the second message to the first electronic device; and a processing unit for establishing a signaling connection with the first electronic device through a local area network when the round-trip delay RTT of the second message meets a first preset condition.
[0109] In combination with the ninth aspect, in certain implementations of the ninth aspect, the transceiver unit is specifically used to send a third message to the first electronic device, and the third message is used by the first electronic device to determine the unicast address of the device; the transceiver unit is also used to receive the second message from the first electronic device based on the unicast address of the device.
[0110] In combination with the ninth aspect, in certain implementations of the ninth aspect, the third message is a feedback message of the discovery message.
[0111] In combination with the ninth aspect, in certain implementations of the ninth aspect, the processing unit is further used to establish a data connection with the first electronic device in a point-to-point manner when the third parameter meets the second preset condition; wherein the third parameter is used to characterize the distance between the device and the first electronic device.
[0112] In the tenth aspect, a communication device is provided, which is carried by a router and includes: a transceiver unit for receiving a first message from a second electronic device, the first message including a first field; the transceiver unit is also used to send the first message to the first electronic device, wherein 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 second electronic device and the device.
[0113] In combination with the tenth aspect, in certain implementations of the tenth aspect, the first message also includes a second field, and the second field is used by 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.
[0114] In combination with the tenth aspect, in certain implementations of the tenth aspect, the first message is a feedback message of the discovery message.
[0115] In combination with the tenth aspect, in certain implementations of the tenth aspect, the first field is a received signal strength indication RSSI field.
[0116] In the eleventh aspect, a communication system is provided, comprising a first electronic device, a second electronic device and a router as in the method in the first aspect and any possible implementation thereof, or the method in the second aspect and any possible implementation thereof, or the method in the third aspect and any possible implementation thereof, or the method in the fourth aspect and any possible implementation thereof, or the method in the fifth aspect and any possible implementation thereof.
[0117] In the twelfth aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a computer, the computer executes the above-mentioned first aspect and any method that can be implemented in the first aspect, or executes the above-mentioned second aspect and any method that can be implemented in the second aspect, or executes the above-mentioned third aspect and any method that can be implemented in the third aspect, or executes the above-mentioned fourth aspect and any method that can be implemented in the fourth aspect, or executes the above-mentioned fifth aspect and any method that can be implemented in the fifth aspect.
[0118] In the thirteenth aspect, a computer program product comprising instructions is provided. When the computer program product is run on a computer, the computer is caused to execute the first aspect and any method that can be implemented in the first aspect, or execute the second aspect and any method that can be implemented in the second aspect, or execute the third aspect and any method that can be implemented in the third aspect, or execute the fourth aspect and any method that can be implemented in the fourth aspect, or execute the fifth aspect and any method that can be implemented in the fifth aspect.
[0119] In the fourteenth aspect, a chip is provided, which includes a processor and a data interface. The processor reads instructions stored in a memory through the data interface to execute the above-mentioned first aspect and any method that can be implemented in the first aspect, or execute the above-mentioned second aspect and any method that can be implemented in the second aspect, or execute the above-mentioned third aspect and any method that can be implemented in the third aspect, or execute the above-mentioned fourth aspect and any method that can be implemented in the fourth aspect, or execute the above-mentioned fifth aspect and any method that can be implemented in the fifth aspect.
[0120] In combination with the fourteenth aspect, in one possible implementation, the processor is coupled to the memory through an interface.
[0121] In combination with the fourteenth aspect, in a possible implementation, the chip system also includes a memory, in which a computer program or computer instructions are stored. BRIEF DESCRIPTION OF THE DRAWINGS
[0122] FIG1 is a schematic diagram of a communication system to which the communication method provided in an embodiment of the present application is applicable.
[0123] FIG2 is a system architecture diagram provided in an embodiment of the present application.
[0124] FIG3 is a schematic flow chart of a communication method provided in an embodiment of the present application.
[0125] FIG4 is a schematic flow chart of a communication method provided in an embodiment of the present application.
[0126] FIG5 is a schematic block diagram of a device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0127] The technical solution in this application will be described below with reference to the accompanying drawings.
[0128] First, the technical terms that may be involved in the embodiments of the present application are introduced.
[0129] WiFi peer-to-peer (WiFi P2P)
[0130] It is a WiFi-based technology launched by the WiFi Alliance that allows electronic devices to connect directly to each other. It can conduct one-to-one or one-to-many communication without the need for a local area network or access point (AP). In the embodiments of this application, it can be referred to as P2P.
[0131] Access point (AP)
[0132] A wireless local area network (WLAN) system may include an AP, through which electronic devices can access external networks, such as a router.
[0133] Station (STA)
[0134] A WLAN system may include STAs, which can associate with an AP and access the network through the AP. For example, electronic devices such as mobile phones and tablet computers can be included.
[0135] Huawei Magneto Link (HML)
[0136] A more optimized solution than P2P can support one electronic device to establish multiple connections with multiple electronic devices.
[0137] Dynamic host configuration protocol (DHCP)
[0138] It is a network protocol used in Internet Protocol (IP) networks. It is located in the application layer of the Open System Interconnection (OSI) model. It can be used by intranets or network service providers to automatically assign IP addresses to users. It can also be used by intranet administrators to centrally manage all computers.
[0139] Address Resolution Protocol (ARP)
[0140] ARP is a protocol that obtains a physical address based on an IP address. When a host sends information, it broadcasts an ARP request containing the target IP address to all hosts on the local network. It then receives a reply message, which determines the target's physical address. Upon receiving the reply, the host stores the IP and physical addresses in its ARP cache and retains them for a specified period. The next request can then query the ARP cache directly, saving resources. The Address Resolution Protocol (ARP) relies on mutual trust between hosts on the network. Hosts on the local network can autonomously send ARP reply messages. When other hosts receive a reply message, they do not verify its authenticity and instead enter it into their local ARP cache. This allows an attacker to send a forged ARP reply message to a specific host, causing it to fail to reach the intended host or to reach the wrong host. This constitutes ARP spoofing. ARP commands can be used to query the local ARP cache for the correspondence between IP addresses and media access control (MAC) addresses, as well as to add or delete static correspondences.
[0141] When electronic devices involved in distributed services are on a local area network (LAN), they can communicate with each other through a router. Furthermore, in near-field communication scenarios, electronic devices can also communicate using a point-to-point method similar to WiFi P2P technology. This communication technology has a fast transmission rate and is independent of the LAN. Current distributed services can use this technology to implement functions such as file sharing and screen projection.
[0142] Before electronic devices transmit services through routers or in a point-to-point manner, multiple electronic devices need to discover each other and establish signaling connections. Under current distributed services, electronic devices generally discover each other based on WiFi or Bluetooth technology. Normally, when electronic devices discover each other, they need to search for surrounding electronic devices, including searches on local area networks and searches on non-local area networks. The search medium for local area networks is the constrained application protocol (CoAP), and the search medium for non-local area networks is bluetooth low energy (BLE). The search rates of different media are different. The rate of searching the surrounding area through the CoAP medium is faster, while the search rate of non-local area network BLE is relatively slower.
[0143] As shown in Figure 1, a schematic diagram of a communication system to which a communication method provided by the present application can be applied is shown. The communication system may include a router 110, a sending device 120 and a receiving device 130. Among them, the sending device can be understood as a device that initiates a discovery process, a device that broadcasts a discovery message, such as the mobile phone terminal shown in Figure 1. The receiving device can be understood as a device that unicasts a feedback message of a discovery message, such as the tablet computer shown in Figure 1. Figure 1 shows two discovery processes, including a LAN discovery process and a non-LAN discovery process. In the LAN discovery process, the discovery message or the feedback message of the discovery message can be forwarded by a router.
[0144] When the sending device sends a discovery message, it can be sent simultaneously through the CoAP medium and the BLE medium, which means that the LAN discovery and non-LAN discovery processes can be triggered simultaneously. However, due to the low discovery latency of the CoAP medium, the sending device will first receive the feedback message from the discovery message returned by the receiving device via the CoAP medium. In other words, although the sending device will send discovery messages 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, they need to establish a signaling connection. Generally speaking, CoAP or Bluetooth can also be used to establish a signaling connection.
[0145] Establishing a signaling connection using CoAP is often 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 CoAP allows for faster discovery between the sending and receiving devices, if the distance between the sending device and the router is long, or if the distance between the receiving device and the router is long, the sending and receiving devices will not be able to establish a signaling connection using CoAP. Even if the sending and receiving devices establish a signaling connection using CoAP, the signaling connection between the sending and receiving devices may be easily disconnected and unstable due to low signal strength between the sending device and the router, or low signal strength between the receiving device and the router.
[0146] However, the delay in establishing a signaling connection using Bluetooth is relatively long, and Bluetooth cannot be used every time a signaling connection is established. This is because electronic devices require the help of Bluetooth to implement many functions, such as headphone pairing, calls, file sharing, collaboration, etc. These functions share the ability of Bluetooth short-range connection. When there are too many networking devices and multiple services request Bluetooth connections, Bluetooth short-range transmission may reject the request of distributed services to establish a signaling connection based on resource usage, resulting in the failure of establishing a signaling connection using Bluetooth.
[0147] Each time a signaling connection is established, redundant communication can be used, that is, an attempt to establish a signaling connection is made through the above two media (including CoAP media and Bluetooth media). This method will obviously lead to high upper-layer logic responsibility and waste of power consumption. In addition, establishing a signaling connection at the same time may cause disorder in the underlying state, thereby causing failure to establish a signaling connection.
[0148] In a local area network (LAN) scenario, if the sending and receiving devices successfully establish a signaling connection using CoAP, they can use a point-to-point approach or a router-mediated approach for service transmission.
[0149] Before services are transmitted via a router, both the sending and receiving devices need to be connected to the router. For example, if the trust domains of the receiving device and the router are different, the receiving device will not be able to connect to the router. Furthermore, since the router architecture itself does not have a separate network processor (NP) forwarding chip, data packets need to be sent to the central processing unit (CPU) for processing. This requires a large amount of CPU to process data that should be processed at the NP layer, causing the CPU to be too busy. In addition, during each service interaction, the air interface needs to be competed for twice, which will result in performance degradation in terms of efficiency. The point-to-point method can meet the needs of high-speed transmission services or high-reliability transmission services. Therefore, after the sending and receiving devices successfully establish a signaling connection, the point-to-point method can be used as much as possible for service transmission. However, if the point-to-point method is used for service transmission, certain conditions must be met.
[0150] If the sending and receiving devices can successfully establish a signaling connection using CoAP, this indicates that the distances between the sending and receiving devices and the router meet the requirements for establishing a CoAP signaling connection. However, the distances between the sending and receiving devices may be too far to establish a point-to-point high-speed Wi-Fi connection.
[0151] Therefore, the present application provides a communication method and communication device that, in a local area network scenario, determines an appropriate method for establishing a signaling connection before a transmitting device and a receiving device establish a signaling connection, thereby improving the success rate of establishing the signaling connection. Furthermore, after the signaling connection is established, it determines whether the distance between the transmitting 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.
[0152] As shown in Figure 2, a system architecture diagram provided by the present application is shown. This system architecture can be hosted on the above-mentioned transmitting device, such as a mobile phone terminal, tablet computer, or other electronic device. The system structure includes a WiFi framework layer, a STA / P2P service layer, a WiFi hardware abstraction layer, a WPA service layer, and a hardware layer. The WiFi framework layer (FWK) is an external application programming interface (API) interface layer through which system applications and third-party applications can access information from the underlying service layer. The STA / P2P service layer is used to manage STA and P2P services. It is a service layer that operates at the bottom layer and can encapsulate relevant information such as protocol status into a high-level layer. For example, the transmitting device includes two interfaces: one interface is used to connect to a router (AP) when the transmitting device is a STA; the other interface is used to connect to another electronic device when the transmitting device is used as one of the electronic devices in a point-to-point communication mode. The WiFi hardware abstraction layer (HAL) provides an interface for the upper layer and interacts 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, which is a basic service for operating hardware. The hardware layer can include the radio frequency front end and hardware chips.
[0153] As shown in FIG3 , a communication method provided in an embodiment of the present application is shown. This method can be applied to the communication system shown in FIG1 in a local area network scenario. The method is described in detail below.
[0154] S301: The sending device and the receiving device discover each other.
[0155] For example, the sending device can be a mobile phone terminal as shown in Figure 1, and the receiving device can be a tablet computer as shown in Figure 1. The sending device can be understood as the device that initiates the discovery process and can broadcast a discovery message. The receiving device can receive the discovery message and return a feedback message in response to the discovery message.
[0156] It should be noted that in LAN scenarios, the sending device can send discovery messages via CoAP and BLE. This means that the sending and receiving devices can discover each other over the LAN or a non-LAN. During discovery via CoAP or a LAN, messages between the sending and receiving devices must be forwarded by a router. During discovery via BLE or a non-LAN, messages can be transmitted directly between the sending and receiving devices.
[0157] 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.
[0158] Specifically, the mutual discovery process between a sending device and a receiving device using CoAP involves the following: the sending device broadcasts a discovery message to surrounding devices, of which the receiving device is a neighboring device. The discovery message broadcast by the sending device is forwarded by a router to the receiving device, and the receiving device returns a response message to the discovery message via unicast. The response message is then forwarded to the receiving device via the router.
[0159] 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 return message 1, and the message transmitted from the router to the sending device is return message 2. Return message 2 can be understood as return message 1 forwarded by the router. When the sending device receives the return message from the receiving device, it indicates that the sending device and the receiving device have discovered each other, and the discovery process is complete. It is necessary to further establish a signaling connection between the sending device and the receiving device.
[0160] As we've seen, establishing a signaling connection over CoAP is often 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 and receiving devices discover each other, if the path between them meets the requirements, a signaling connection can be established over CoAP.
[0161] S302: The transmitting device obtains a first signal strength and a second signal strength.
[0162] In one implementation, a signal field, for example, a received signal strength indicator (RSSI) field, may be carried in return message 1 and return message 2. The RSSI field may be used to reflect the signal strength of the device that sends the message carrying the RSSI field, so that the distance to the device (that is, the distance between the two devices in direct communication) may be calculated based on the signal strength. When the sending device receives the return message, the first signal strength and the second signal strength may be obtained based on the RSSI in the return message. The first signal strength may be the signal strength of the receiving device, and the second signal strength may be the signal strength of the router. The sending device may calculate the distance between the receiving device and the router based on the first signal strength, and calculate the distance between the router and the sending device based on the second signal strength.
[0163] For ease of understanding, Table 1 shows the message structure of the return message.
[0164] Table 1 Message structure
[0165] It should be noted that the message structure shown in Table 1 is used to exemplify the message structure of the return message sent by the receiving device. In the message sent by the receiving device, a new RSSI field is added, and the RSSI field is used to indicate the signal strength of the receiving device from the router. The sending device receives the return message sent by the receiving device through the router. 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, the 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 message, the RSSI field indicating the distance between the router and the sending device may also be added to the message.
[0166] S303: Determine whether the first signal strength and the second signal strength meet a condition.
[0167] It should be noted that during the mutual discovery process between the transmitting and receiving devices via the CoAP medium, the transmitting device can determine the distance between the receiving device and the router, and the distance between the router and the transmitting device, based on the RSSI field in the return message from the receiving device. In other words, it determines whether the signal strength indicated by the RSSI field meets a condition. If so, the subsequent step S304 can be executed. If not, the subsequent step S305 can be executed.
[0168] For example, the signal level can be divided into certain levels according to the value of the RSSI field:
[0169] [-126, -88) or [156, 168) indicates that the signal is 0 grid;
[0170] [-88, -78) or [168, 178) means the signal is 1 grid;
[0171] [-78, -67) or [178, 189), indicating a signal of 2 grids;
[0172] [-67, -55) or [189, 200), indicating a signal of 3 grids;
[0173] [-55, 0] means the signal is 4 grids.
[0174] Generally speaking, 0 to -50 indicates the device has the highest signal strength, -50 to -70 indicates the signal strength deviation, less than -70 indicates that the device's signal strength is very poor, and there is a possibility of being unable to connect or being disconnected, and -200 indicates that the device has lost the WiFi connection.
[0175] It should be noted that in addition to adding the RSSI field used to indicate the device signal strength in the return message as described above, it is also possible to determine whether the path between the receiving device and the router, and between the router and the sending device meets the conditions through the detection message.
[0176] 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 end based on the unicast return message of the receiving end. The sending device sends a probe message to the receiving device based on the unicast address, and receives a feedback message of the probe message from the receiving device. The sending device determines whether the path between the receiving device and the router, and between the router and the sending device meets the conditions based on the round-trip time (RTT) of the probe message. It should be noted that the transmission of the probe message between the sending device and the receiving device, as well as the feedback message of the probe message, need to be forwarded through the router. Therefore, the RTT can reflect the communication status of the path 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).
[0177] Exemplarily, if the probe message meets the experienced delay, the subsequent step S304 may be executed, that is, a CoAP signaling connection is established preferentially; if the probe message does not meet the experienced delay, the subsequent step S305 may be executed.
[0178] It should be noted that for probe messages, the latency of a reliable connection is usually in the millisecond level. If the latency of a probe message reaches several hundred milliseconds, or even seconds, it indicates that the availability of the path is average. Optionally, relevant logs can be recorded after the probe message is returned.
[0179] S304: The transmitting device and the receiving device establish a signaling connection via the local area network.
[0180] S305: The transmitting device and the receiving device establish a signaling connection via a non-local area network.
[0181] Exemplarily, when the transmitting device determines, based on the RSSI field in the returned message, that the first signal strength and the second signal strength meet the conditions, a signaling connection may be established with the receiving device via a local area network (eg, CoAP).
[0182] It should be noted that the first signal strength condition being met indicates that the signal strength of the receiving device meets the condition, that is, the distance between the receiving device and the router meets the condition. The second signal strength condition being met indicates that the signal strength of the router meets the condition, that is, the distance between the router and the sending device meets the condition. In other words, when the distance between the receiving device and the router meets the condition, and the distance between the router and the sending device meets the condition, the sending and receiving devices can establish a signaling connection over the local area network.
[0183] Illustratively, when the sending end device determines that a condition is met based on the delay of the detection message, a signaling connection may be established with the receiving end device through the local area network.
[0184] Exemplarily, when the transmitting device determines based on the RSSI field that the first signal strength or the second signal strength does not meet the condition, or when the delay of the detection message does not meet the condition, a signaling connection can be established with the receiving device via a non-local area network, for example, via a BLE medium.
[0185] Optionally, if the delay of the probe message reaches hundreds of milliseconds or seconds, 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 that a signaling connection has been established with the receiving device through the Bluetooth medium without waiting for the probe message to be returned.
[0186] Furthermore, after the sending and receiving devices establish a signaling connection via the local area network, they can use a high-speed point-to-point communication method to transmit services. To ensure the success rate of point-to-point transmission between the sending and receiving devices, it is also necessary to determine whether the sending and receiving devices currently meet the conditions for point-to-point service transmission.
[0187] Optionally, in S306 , a distance between the transmitting device and the receiving device is obtained.
[0188] Optionally, S307 , determine whether the distance between the transmitting device and the receiving device meets a condition.
[0189] For example, during the high-speed WiFi connection establishment phase, the distance between the transmitting device and the receiving device can be determined by any one of Bluetooth signals, ultrasonic signals, ultra wide band (UWB) wireless carrier communication technology, near field communication (NFC), etc. Bluetooth signals can include BLE and basic rate (BR).
[0190] For example, during the high-speed WiFi connection establishment phase, the Bluetooth signal (Bluetooth RSSI) is detected. If the Bluetooth signal is strong, the subsequent step S308 can be executed; if the Bluetooth signal is weak, the subsequent step S309 can be executed. When the transmitting 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 remind the user that local area network communication is currently in progress.
[0191] It should be noted that the RSSI field can be used to measure distance. The approximate distance between the sending device and the receiving device can be determined by the balanced attenuation value of the Bluetooth RSSI. If the distance between the sending device and the receiving device is too far, it means that it is not suitable to establish a near-field point-to-point communication connection.
[0192] Optionally, in S308 , a point-to-point connection is established between the transmitting device and the receiving device.
[0193] Exemplarily, the point-to-point connection may be WiFi P2P communication or HML communication.
[0194] Optionally, in S309 , a local area network connection is established between the transmitting device and the receiving device.
[0195] It should be noted that establishing a LAN 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 through a router.
[0196] It should be noted that in method 300, steps S301 to S305 determine whether a signaling connection can be established between the transmitting device and the receiving device via a local area network, thereby maximizing the success rate of electronic devices establishing signaling connections via the local area network. Steps S306 to S309 are optional steps. After the transmitting device and the receiving device establish a signaling connection via the local area network, steps S306 to S309 can be used to further determine whether point-to-point service transmission is suitable between the transmitting device and the receiving device, thereby maximizing the success rate of establishing high-speed WiFi connections.
[0197] Based on this solution, in distributed service scenarios, the suitability of CoAP for signaling connections is determined during the mutual discovery phase between electronic devices. Furthermore, prior to service transmission, the suitability of high-speed Wi-Fi for point-to-point connections between devices is determined. This maximizes the success rate of CoAP signaling connections and high-speed Wi-Fi connections, improving the distributed service experience.
[0198] As shown in Figure 4, a communication method provided by the present application is illustrated. This method can be applied to a communication system comprising a first electronic device, a second electronic device, and a router. The first electronic device can be understood as the transmitting device mentioned above, and the second electronic device can be understood as the receiving device. Method 400 is described in detail below.
[0199] S401: The second electronic device determines a first message.
[0200] S402: The second electronic device sends a first message, and correspondingly, the router receives the first message.
[0201] S403: The router sends a first message, and correspondingly, the first electronic device receives the first message.
[0202] 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. 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.
[0203] It should be noted that, in a local area network scenario, the mutual discovery process between the first electronic device and the second electronic device through the CoAP medium with low discovery latency requires the forwarding of messages by a router.
[0204] It should be understood that the first message includes a first field, and the first field is used to indicate the signal strength of the second electronic device.
[0205] Exemplarily, the first field is an RSSI field. Before sending the first message, the second electronic device may add an RSSI field to the first message. The field structure of the first message may be as shown in Table 1 above, which will not be repeated here.
[0206] S404: The first electronic device determines a first parameter according to the first field.
[0207] It should be understood that the first parameter is used to represent 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 can calculate the distance between the second electronic device and the router based on the signal strength of the second electronic device represented by the RSSI field.
[0208] S405: The first electronic device determines a second parameter according to the second field.
[0209] It should be understood that the first message also includes a second field, which is used to indicate the signal strength of the router. The first electronic device determines a second parameter based on the second field in the first message, which is used to indicate the distance between the router and the first electronic device.
[0210] 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, the first message may include a second field, which may be an RSSI field. The first electronic device may calculate the distance between the router and the first electronic device based on the signal strength of the router indicated by the RSSI field.
[0211] Illustratively, the first field may be carried at the end of the first message, and the second field may be carried at the head of the first message.
[0212] S406: When the first parameter and the second parameter meet a first preset condition, the first electronic device establishes a signaling connection with the second electronic device via the local area network.
[0213] Exemplarily, the first preset condition may be understood as the distance between devices represented by the parameter meeting the condition for establishing a signaling connection through the local area network.
[0214] It should be noted that before the first electronic device and the second electronic device establish a signaling connection via the local area network, it is necessary to first determine whether each communication link for establishing the signaling connection via the local area network satisfies the conditions for establishing the signaling connection. The first electronic device determines whether the distance represented by the first parameter and the distance represented by the second parameter satisfy the conditions for establishing the signaling connection via the local area network. In other words, 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, satisfy the conditions for establishing the signaling connection via the local area network.
[0215] That is, 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.
[0216] Generally speaking, when the distance represented by the first parameter and the distance represented by the second parameter are both close enough, the first electronic device and the second electronic device are suitable for establishing a signaling connection through the local area network.
[0217] In one implementation, when the first parameter or the second parameter does not satisfy the first preset condition, a signaling connection is established with the second electronic device via a non-local area network.
[0218] Generally speaking, when either the distance represented by the first parameter or the distance represented by the second parameter is greater, the first electronic device and the second electronic device may fail to establish a signaling connection via the local area network. The first electronic device may attempt to establish a signaling connection with the second electronic device via a non-local area network, for example, via a BLE medium.
[0219] It should be noted that the above description describes how the first and second parameters are determined, respectively, using the first and second fields in the first message, and when the first and second parameters meet a first preset condition, the first and second electronic devices can establish a signaling connection via the local area network. Furthermore, after the first and second electronic devices discover each other, they can also determine whether a signaling connection can be established via the local area network using a detection message.
[0220] 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.
[0221] Exemplarily, the second message is a detection message.
[0222] 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.
[0223] Exemplarily, the third message is a feedback message of the discovery message, and the third message is a unicast message.
[0224] 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 based on the feedback message of the discovery message unicast by the second electronic device, and unicast a detection message to the second electronic device based on 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 path between the second electronic device and the router, and between the router and the first electronic device meets the conditions based on the RTT of the detection message. It should be noted that the transmission of the detection message between the first electronic device and the second electronic device, as well as the feedback message of the detection message, need to be forwarded through the router. Therefore, the RTT can reflect the communication status of the path between the first electronic device and the router, and between the router and the second electronic device.
[0225] If the RTT of the detection message is low and meets the experiential 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 experiential delay, the first electronic device and the second electronic device can establish a signaling connection through a non-local area network.
[0226] 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.
[0227] Exemplarily, the second preset condition may be understood as the distance between the devices represented by the parameter meeting the condition for establishing a signaling data connection in a point-to-point manner.
[0228] For example, after a first electronic device establishes a signaling connection with a second electronic device via a local area network, the first electronic device may obtain a third parameter. Before establishing a point-to-point data connection with the second electronic device, it is necessary to determine whether the third parameter satisfies a second preset condition. The third parameter represents the distance between the first and second electronic devices.
[0229] It should be noted that after the first electronic device and the second electronic device establish a signaling connection through the local area network, it is first determined whether the communication link between the first electronic device and the second electronic device meets the conditions for point-to-point service transmission. If so, a data connection is established in a point-to-point manner.
[0230] It should be understood that when a first electronic device and a second electronic device establish a signaling connection via a local area network, the distance between the first electronic device and the router, and between the router and the second electronic device, is sufficiently close. However, the distance between the first and second electronic devices can affect the success rate of establishing a point-to-point data connection. Therefore, it is necessary to determine in advance whether the distance between the first and second electronic devices satisfies the conditions for establishing a point-to-point data connection.
[0231] Specifically, the first electronic device may obtain the third parameter in one of the following ways: Bluetooth signal, ultrasonic signal, UWB, and NFC.
[0232] For example, the distance between the first electronic device and the second electronic device is determined by the balanced attenuation value of the 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.
[0233] Exemplarily, the point-to-point communication mode includes WiFi P2P communication or HML communication.
[0234] 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 transmit services, and this transmission method has a fast transmission rate and high transmission efficiency.
[0235] In one implementation, when the third parameter does not meet the second preset condition, the first electronic device establishes a data connection with the second electronic device via a local area network.
[0236] Exemplarily, the services or data transmitted between the first electronic device and the second electronic device need to be forwarded through a router.
[0237] It should be noted that in method 400, steps S401 to S406 determine whether a signaling connection can be established between the first electronic device and the second electronic device via a local area network, thereby maximizing the success rate of the electronic devices establishing signaling connections via the local area network. Step S407 is an optional step. After the first electronic device and the second electronic device have established a signaling connection via the local area network, step S407 can further determine whether point-to-point service transmission is suitable between the first electronic device and the second electronic device, thereby maximizing the success rate of establishing a high-speed WiFi connection.
[0238] Based on this solution, in distributed service scenarios, the mutual discovery phase between electronic devices determines whether a signaling connection via the LAN is suitable. Furthermore, before service transmission, it determines whether a point-to-point connection between devices can be established using high-speed WiFi. This maximizes the success rate of electronic devices establishing signaling connections via the LAN and high-speed WiFi connections, improving the distributed service experience.
[0239] Figure 5 is a schematic block diagram of a 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. The device 500 shown in Figure 5 includes: a processor 510, a transceiver 520, and a memory 530. The processor 510, the transceiver 520, and the memory 530 are connected via 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 may be coupled to the processor 510 via an interface or integrated with the processor 510.
[0240] It should be noted that the transceiver 520 may include but is not limited to a transceiver device such as an input / output interface to achieve communication between devices.
[0241] During implementation, each step of the above method can be completed by an integrated logic circuit of the hardware in the processor 510 or by instructions in the form of software. The method disclosed in conjunction with the embodiments of the present application can be directly embodied as being executed by a hardware processor, or can be executed by a combination of hardware and software modules in the processor. The software module can be located in a storage medium mature 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. The storage medium is located in the memory 530, and the processor 510 reads the information in the memory 530 and completes the steps of the above method in combination with its hardware. To avoid repetition, it will not be described in detail here.
[0242] The present application provides a computer program product that, when executed on a device, enables the device to execute the technical solution in the above embodiment. The implementation principle and technical effects are similar to those of the above method-related embodiments and will not be described in detail here.
[0243] The present embodiment provides a readable storage medium containing instructions that, when executed on a device, cause the device to execute the technical solution of the above embodiment. The implementation principles and technical effects are similar and will not be further described here.
[0244] The present application provides a chip for executing instructions. When the chip is running, the technical solution in the above embodiment is executed. The implementation principle and technical effect are similar and will not be described in detail here.
[0245] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the embodiments of this application.
[0246] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and units (modules) can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0247] In the several embodiments provided in this 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 schematic. For example, the division of the unit is merely a logical function division. In actual implementation, there may be other division methods, such as 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 mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0248] The units described above as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0249] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0250] If the above functions are implemented in the form of software functional 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 embodiment of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0251] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection 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, wherein 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, characterized in that, 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, characterized in that 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; Wherein, 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, wherein 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, characterized in that, The first field is a received signal strength indication (RSSI) field.
23. A communication device, characterized in that, A processor coupled to a memory, where 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, characterized in that, 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 a 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 an instruction 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
Patent Citations
Communication method and communication device
CN120358631A
Automatic seamless context sharing across multiple devices
US20140141714A1
Wireless discovery location and ranging
US20150139213A1
Fine timing measurements protocol in establishing tunneled direct link setup connection
US20180054842A1
Electronic device and method for operating access point information by electronic device
US20200154348A1