Communication method, terminal device, and computer-readable storage medium
By using long-distance connections when short-distance connection resources are limited, the problem of limited concurrent connections to devices is solved, thus achieving high-concurrency connections and ensuring data transmission quality.
Patent Information
- Application Number
- PCT/CN2025/080762
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-03-22
- Filing Date
- 2025-03-05
- Publication Date
- 2025-12-04
AI Technical Summary
In complex distributed business scenarios, when the initiating device establishes concurrent connections with multiple receiving devices, there is a limitation on the number of concurrent connections, especially when short-distance connection resources are limited.
When current communication conditions do not meet the requirements for short-distance connections, a long-distance connection method is used to establish an interconnection with the receiving device, thus avoiding the limitation on the number of concurrent connections of the device.
This technology enables the increase of concurrent connections to devices by using long-distance connections when short-distance connection resources are limited, thus solving the problem of limited concurrent connections and ensuring high concurrency of data transmission.
Smart Images

Figure CN2025080762_04122025_PF_FP_ABST
Abstract
Description
Communication methods, terminal devices and computer-readable storage media
[0001] This application claims priority to Chinese Patent Application No. 202410340157.2, filed on March 22, 2024, entitled "Communication Method, Terminal Equipment and Computer-Readable Storage Medium", the entire contents of which are incorporated herein by reference. Technical Field
[0002] This application relates to the field of communication technology, and in particular to communication methods, terminal devices, and computer-readable storage media. Background Technology
[0003] With the increasing variety of personal smart terminals and home Internet of Things (IoT) terminal devices, such as mobile phones, tablets, PCs, smart cars, smart screens, wearable devices, cameras, robot vacuums, and smart curtains, interconnectivity and data sharing between terminal devices have become an important demand for users. In some complex distributed business scenarios, such as screen mirroring and file sharing, when the initiating device discovers multiple receiving devices that support distributed services (such as screen mirroring) through broadcast messages, the initiating device needs to establish connections with these receiving devices via Bluetooth or Wireless Fidelity Direct (Wi-Fi Direct). However, in situations where the initiating device needs to establish concurrent connections with multiple receiving devices, the number of concurrent connections is limited. Summary of the Invention
[0004] To address this issue, this application provides a communication method, a terminal device, and a computer-readable storage medium that can solve the problem of limited concurrent connections to a device.
[0005] To achieve the above objectives, this application adopts the following technical solution:
[0006] In a first aspect, a communication method is provided, applied to a first device, the method comprising:
[0007] The system receives a first operation to initiate a distributed service; in response to the first operation, it displays an icon for a second device, which is a device that supports distributed services, short-range connections, and long-range connections, discovered based on short-range communication; in response to a second operation, it determines the current communication conditions, the second operation including an operation on the icon of the second device, the second operation instructing the first device to share data with the second device; when the current communication conditions do not meet the requirements for short-range connections, it establishes a first long-range connection with the second device.
[0008] The first device may refer to a terminal device. The communication method may be executed by the terminal device, or by a module (such as a processor, chip, or chip system) applied in the terminal device, or by a logic module or software that can implement all or part of the functions of the terminal device.
[0009] In this application, the first device responds to the second operation by determining whether the current communication conditions meet the requirements for short-distance connection. When the current communication conditions do not meet the requirements for short-distance connection, it means that the first device cannot establish an interconnection with the second device through a short-distance connection. In order for the first device to connect to more external devices (such as the second device) concurrently, the first device can use a long-distance connection to establish a first long-distance connection with the second device, thereby avoiding the problem that the number of concurrent connections of the device is limited due to the current communication conditions not meeting the requirements for short-distance connection.
[0010] In one possible implementation, the method further includes: before displaying the icon of the second device: sending broadcast information, the broadcast information including a first identifier, a first request information and a second request information, the first identifier being the identifier of the first device, the first request information being used to inquire whether distributed services are supported, and the second request information being used to inquire whether short-range connections and / or long-range connections are supported; receiving first response information, the first response information including a second identifier, a first indication information and a second indication information, the second identifier being the identifier of the second device, the first indication information indicating that the second device supports distributed services, and the second indication information indicating that the second device supports short-range connections and / or long-range connections; and displaying the icon of the second device, including: displaying the icon of the second device according to the first response information.
[0011] Before displaying the icon of the second device, the first device will broadcast a message to inquire whether the second device supports distributed services and whether it supports short-distance and / or long-distance connections; wherein the second device is a device near the first device; then, the first device will determine whether the second device supports short-distance and long-distance connections based on the first response information from the second device, thereby determining the connection method with the second device.
[0012] In one possible implementation, the first response information also includes a third identifier, which is used to establish a first long-distance connection with the second device.
[0013] In some cases, the second device sends the third identifier to the first device through the first response information, without the first device needing to obtain the third identifier through new messages or control signaling, thus reducing resource consumption.
[0014] In one possible implementation, the broadcast information also includes third instruction information, which instructs the second device to send a third identifier.
[0015] In some cases, in order for the first device to quickly establish a long-distance connection with the second device when necessary to ensure communication quality, the first device may carry a third instruction message when sending broadcast information, instructing the second device to send a third identifier (for example, the second device may carry a third identifier when replying to the first response message), so that the first device can establish a long-distance connection with the second device based on the third identifier.
[0016] In one possible implementation, the broadcast information also includes first channel information, which is information about the channel of the short-range connection currently used by the first device.
[0017] In some cases, when the first device sends a broadcast message, it will carry the first channel information in the broadcast message so that other nearby devices (such as the second device) can determine whether a short-range connection can be established with the first device through channel multiplexing.
[0018] In one possible implementation, determining the current communication conditions includes: determining the current number of connections, where the current number of connections is the number of short-range connections already established by the first device; wherein, if the current communication conditions do not meet the short-range connection requirements, it includes: the current number of connections is equal to a number threshold, where the number threshold is the maximum number of short-range connections supported by the first device.
[0019] In some cases, when the current number of connections reaches a threshold, the first device can no longer establish a connection with other nearby devices (such as the second device) via a short-range connection. In this case, after receiving the second operation, the first device will determine the current number of connections. When the current number of connections reaches the threshold, it means that the current communication conditions do not meet the requirements for short-range connections, and the first device cannot currently use a short-range connection to establish a connection with the second device. Thus, by judging the current number of connections, the first device determines the available connection method (such as a long-range connection) for the second device, thereby avoiding the situation where the first device cannot connect due to the limit on the number of connections.
[0020] In one possible implementation, the method for determining the current number of connections further includes: determining the current role of the first device before determining the current number of connections; determining the current number of connections includes: determining the current number of connections when the current role allows the first device to connect to the second device.
[0021] In some cases, even if the current number of connections has not reached the threshold, the first device may be temporarily unable to establish a connection with other nearby devices due to the restrictions of the current role. Therefore, before determining the current number of connections, the first device can first determine its current role. When the current role allows the first device to connect to the second device, the current number of connections can then be determined, thereby avoiding the situation where a connection cannot be established due to role restrictions.
[0022] In one possible implementation, determining the current communication conditions includes: determining the current role of the first device; wherein, if the current communication conditions do not meet the short-range connection requirements, the current role does not allow the first device to connect to the second device.
[0023] In some cases, due to the limitations of the current role, the current communication conditions of the first device do not meet the requirements for short-range connection. Therefore, the first device can determine whether the current communication conditions meet the requirements for short-range connection by judging its own current role, so that the first device can further determine the connection method with the second device.
[0024] In one possible implementation, before determining the current role of the first device, the method further includes: determining the current number of connections, where the current number of connections is the number of short-range connections that the first device has established; determining the current role of the first device includes: when the current number of connections is less than a number threshold, determining that the current communication conditions meet the short-range connection requirements, where the number threshold is the maximum number of short-range connections supported by the first device.
[0025] In some cases, even if the current role of the first device allows it to establish a connection with other nearby devices (such as the second device), the first device may be temporarily unable to establish a connection with other receiving devices due to the limitation on the number of current connections. Therefore, before determining the current role of the first device, it can first determine the number of current connections. When the number of current connections is less than the threshold, it means that the current communication conditions meet the requirements for short-distance connection. Then, it can determine whether the current role allows the connection to the second device, thereby avoiding the situation where a connection cannot be established due to the limitation on the number of current connections.
[0026] In one possible implementation, the method further includes: establishing a first short-range connection with a second device when the current communication conditions meet the short-range connection requirements.
[0027] In some scenarios, when current communication conditions meet the requirements for short-distance connections, the first device and the second device can establish an interconnection through a short-distance connection to reduce the resource costs of data sharing.
[0028] In one possible implementation, the method further includes: establishing a second long-distance connection with a second device when the transmission resources of the first short-distance connection do not meet the transmission requirements.
[0029] In some scenarios, although the first device and the second device have established a first short-distance connection, when the transmission resources of the first short-distance connection do not meet the transmission requirements, the first device can quickly switch from the short-distance connection to a long-distance connection to establish a second long-distance connection with the second device, thereby ensuring the normal transmission of data between the first device and the second device.
[0030] In one possible implementation, establishing a second long-distance connection with the second device includes: sending control information to the second device via a first short-distance connection if a third identifier is not received from the second device; the control information includes a first identifier and instruction information, the instruction information being used to instruct the second device to send a third identifier, the third identifier also being used to establish a second long-distance connection with the second device; receiving second response information from the second device, the second response information including a second identifier and a third identifier, the second identifier being an identifier of the second device; and establishing a second long-distance connection with the second device based on the third identifier.
[0031] In some scenarios, the first device and the second device have already established a short-range communication link, such as a Bluetooth communication link established through a short-range connection. The first device can send control information to the second device through the first short-range communication link to obtain the second device's third identifier, thereby ensuring that when the transmission resources of the first short-range connection do not meet the transmission requirements, the first device can quickly establish a long-range connection with the second device. It can be seen that the first device obtains the third identifier through the first short-range communication link without having to obtain the third identifier again through Bluetooth broadcast, which simplifies the interaction method and reduces resource consumption.
[0032] In one possible implementation, the second device is the device corresponding to the contact of the first device.
[0033] In some cases, users may want to share data (such as files, videos, etc.) with their friends' devices. In this case, the first device can include contact information when broadcasting the information so that other nearby devices (such as the second device) can determine whether they are friends of the first device (i.e., the device corresponding to the first device's contact) based on the contact information in the broadcast information.
[0034] Secondly, another communication method is provided for use in the second device, the method comprising:
[0035] The system receives broadcast information from a first device. The broadcast information includes a first identifier, a first request message, and a second request message. The first identifier is the identifier of the first device. The first request message is used to inquire whether distributed services are supported. The second request message is used to inquire whether short-range connections and / or long-range connections are supported. Distributed services are services initiated by the first device in response to a first operation. If the broadcast information does not include contact information, the system sends a first response message to the first device. The first response message includes a second identifier, a first indication message, a second indication message, and a third identifier. The second identifier is the identifier of the second device. The first indication message indicates that the second device supports distributed services. The second indication message indicates that the second device supports short-range connections and / or long-range connections. The third identifier is used to establish a first long-range connection with the first device. The contact information is used to determine whether the second device is the device corresponding to the contact.
[0036] The second device can refer to a terminal device. The communication method can be executed by the terminal device, or by a module (such as a processor, chip, or chip system) applied in the terminal device, or by a logic module or software that can implement all or part of the functions of the terminal device.
[0037] In the above method, the second device receives broadcast information sent by the first device. If the broadcast information does not include contact information, the second device does not need to determine whether it is a friend device of the first device to reply with the first response information based on the broadcast information, so as to provide feedback to the first device on whether it supports short-distance and long-distance connections, thereby making it easier for the first device to determine the connection method with itself (i.e., the second device).
[0038] In one possible implementation, the broadcast information further includes first channel information, which is information about the channel of the short-range connection currently used by the first device; before sending the first response information to the first device, the method further includes: when the second channel information is inconsistent with the first channel information, obtaining a third identifier, where the second channel information is information about the channel of the short-range connection currently used by the second device.
[0039] When the broadcast information includes the first channel information, the second device can determine whether the second channel information is consistent with the first channel information. When the second channel information is inconsistent with the first channel information, it means that the second device cannot reuse the channel corresponding to the first channel information, and it may be necessary to establish a long-distance connection or use other channels to establish a short-distance connection. At this time, the second device can obtain a third identifier, for example, obtain the third identifier from a remote server, so as to establish a long-distance connection with the first device.
[0040] In one possible implementation, the broadcast information also includes third instruction information, which instructs the second device to send a third identifier for establishing a first long-distance connection with the first device, and the first response information also includes the third identifier.
[0041] In some cases, in order for the first device to quickly establish a long-distance connection with the second device when necessary to ensure normal data transmission, the first device may carry a third instruction message when sending a broadcast message to instruct the second device to send a third identifier; the second device may carry the third identifier through a first response message; this facilitates the first device to establish a long-distance connection with the second device.
[0042] In one possible implementation, the method further includes: when the broadcast information includes contact information, if the second device is the device corresponding to the contact information, sending a first response message to the first device; or, if the second device is not the device corresponding to the contact information, determining not to send the first response message to the first device.
[0043] In some cases, users may want to share data (such as files, videos, etc.) with their friends' devices. In this case, the first device can include contact information when broadcasting the message, so that other nearby devices (such as the second device) can determine whether they are friends of the first device based on the contact information in the broadcast message. When the second device is a friend of the first device (i.e., the second device is the device corresponding to the contact information), it replies with a first response message to the first device; when the second device is not a friend of the first device (i.e., the second device is not the device corresponding to the contact information), it determines not to reply with a first response message to the first device.
[0044] In one possible implementation, the method further includes: when the second channel information is consistent with the first channel information, determining not to acquire the third identifier; and establishing a first short-range connection with the first device.
[0045] In some cases, when the first device sends broadcast information, it includes the first channel information in the broadcast message so that other nearby devices (such as the second device) can determine whether a short-range connection can be established with the first device through channel multiplexing. When the broadcast message includes the first channel information, the second device can determine whether the second channel information is consistent with the first channel information. If the second channel information is consistent with the first channel information, it means that the second device can reuse the channel corresponding to the first channel information to establish a short-range connection with the first device. At this time, the second device does not need to obtain the third identifier temporarily. Since the second device does not need to obtain the third identifier from the remote server temporarily, some network resources can be saved for other service data transmission.
[0046] In one possible implementation, the method further includes: establishing a second long-distance connection with the first device when the transmission resources of the first short-distance connection do not meet the transmission requirements.
[0047] In some scenarios, although the first device and the second device have established a first short-distance connection, when the transmission resources of the first short-distance connection do not meet the transmission requirements, the first device can quickly switch from the short-distance connection to a long-distance connection to establish a second long-distance connection with the second device, thereby ensuring the communication quality between the first device and the second device.
[0048] In one possible implementation, establishing a second long-distance connection with the second device includes: when the first device does not store a third identifier, receiving control information from the first device via a first short-distance connection, the control information including a first identifier and instruction information, the instruction information being used to instruct the second device to send a third identifier, the third identifier being used to establish a second long-distance connection with the first device; sending second response information to the first device, the second response information including a second identifier and a third identifier; and establishing a second long-distance connection with the first device via the third identifier.
[0049] In some scenarios, the first device and the second device have already established a short-range communication link, such as a Bluetooth communication link established through a short-range connection. The first device can send control information to the second device through the first short-range communication link to obtain the second device's third identifier, thereby ensuring that when the transmission resources of the first short-range connection do not meet the transmission requirements, the first device can quickly establish a long-range connection with the second device. It can be seen that the first device obtains the third identifier through the first short-range communication link without having to obtain the third identifier again through Bluetooth broadcast, which simplifies the interaction method and reduces resource consumption.
[0050] Thirdly, embodiments of this application provide a terminal device, which includes a processor and a memory. The memory is used to store a computer program, and the processor is used to call and run the computer program from the memory, so that the terminal device performs the methods described in the first aspect and various possible implementations of the first aspect.
[0051] Fourthly, embodiments of this application provide a terminal device, which includes a processor and a memory. The memory is used to store a computer program, and the processor is used to call and run the computer program from the memory, causing the terminal device to perform the methods described in the second aspect and various possible implementations of the second aspect.
[0052] Fifthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by a processor, causes the processor to perform the methods described in the first aspect and various possible implementations of the first aspect.
[0053] In a sixth aspect, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by a processor, causes the processor to perform the methods described in the second aspect and various possible implementations of the second aspect.
[0054] In a seventh aspect, embodiments of this application provide a computer program product, which includes computer program code that, when executed by a terminal device, causes the terminal device to perform the methods described in the first aspect and various possible implementations of the first aspect.
[0055] Eighthly, embodiments of this application provide a computer program product comprising: computer program code, which, when executed by a terminal device, causes the terminal device to perform the methods described in the second aspect and various possible implementations of the second aspect.
[0056] Ninthly, embodiments of this application provide a chip system including a processing circuit and a storage medium storing computer program instructions; when the computer program instructions are executed by the processing circuit, they implement the methods described in the first aspect and various possible implementations of the first aspect.
[0057] In a tenth aspect, embodiments of this application provide a chip system including a processing circuit and a storage medium storing computer program instructions; when the computer program instructions are executed by the processing circuit, they implement the methods described in the second aspect and various possible implementations of the second aspect.
[0058] Optionally, the processing circuitry in the above-mentioned chip system can be replaced by a processor, and the storage medium can be replaced by a memory. Optionally, the chip system may also include a communication interface for enabling communication between the chip system and a receiving device.
[0059] The beneficial effects of the technical solutions in the third to tenth aspects of this application can be the same as the beneficial effects of the technical solutions in the first or second aspects, and will not be repeated here. Attached Figure Description
[0060] Figures 1A and 1B are schematic diagrams of application scenarios provided by embodiments of this application;
[0061] Figure 2 is a schematic diagram of the hardware structure of a terminal device 100 provided in an embodiment of this application;
[0062] Figure 3 is a schematic diagram of the software architecture of a terminal device 100 provided in an embodiment of this application;
[0063] Figure 4 is a schematic diagram of the software architecture of the first device provided in an embodiment of this application;
[0064] Figure 5 is a flowchart illustrating a communication method 500 provided in an embodiment of this application;
[0065] Figure 6A is a schematic diagram of a first device discovery receiving device provided in an embodiment of this application;
[0066] Figure 6B is a schematic diagram of another first device discovery receiving device provided in an embodiment of this application;
[0067] Figure 7A is a schematic diagram of a network connection for a first device provided in an embodiment of this application;
[0068] Figure 7B is a schematic diagram of a process in which a first device accesses an external network according to an embodiment of this application;
[0069] Figure 8A is a schematic diagram of a network in which a first device and a second device are located, according to an embodiment of this application;
[0070] Figure 8B is a schematic diagram of a network in which the first device and the second device are located, according to another embodiment of this application.
[0071] Figure 9 is a flowchart illustrating another communication method 500 provided in an embodiment of this application;
[0072] Figure 10 is a schematic diagram of a first device and a second device establishing a second long-distance connection according to an embodiment of this application;
[0073] Figure 11A is a schematic diagram of the architecture of a far-field P2P hole punching method provided in an embodiment of this application;
[0074] Figure 11B is a schematic diagram of the architecture of a far-field P2P relay method provided in an embodiment of this application;
[0075] Figures 12A to 12D are schematic diagrams of a screen projection scenario provided by an embodiment of this application;
[0076] Figures 13A to 13D are schematic diagrams of another screen projection scenario provided by the embodiments of this application;
[0077] Figures 14A to 14F are schematic diagrams of another screen projection scenario provided by the embodiments of this application;
[0078] Figures 15A and 15B are schematic diagrams of another screen projection scenario provided by the embodiments of this application;
[0079] Figures 16A to 16D are schematic diagrams of an image sharing scenario provided by an embodiment of this application;
[0080] Figures 17A to 17D are schematic diagrams of another image sharing scenario provided by the embodiments of this application;
[0081] Figure 18 is a schematic diagram of the structure of a terminal device provided in an embodiment of this application. Detailed Implementation
[0082] To clearly describe the technical solutions of the embodiments of this application, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. It should be noted that the embodiments described in this application are only some embodiments of this application, and not all embodiments.
[0083] In the description of this application, unless otherwise stated, " / " means "or," for example, A / B can mean A or B. In the description of this application, "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. "At least one" means one or more, and "more" means two or more. The terms "first" and "second," etc., in the specification and claims of this application are used to distinguish different objects or to distinguish different treatments of the same object, not to describe a specific order of objects. For example, "first terminal" and "second terminal," etc., are used to distinguish different terminal devices, not to describe a specific order of terminal devices. Those skilled in the art will understand that the words "first," "second," etc., do not limit the quantity or execution order, and that "first," "second," etc., do not necessarily imply difference.
[0084] It should be noted that, in this application, the terms "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary" or "for example" in this application should not be construed as being more preferred or advantageous than other embodiments or design solutions. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a specific manner. The terms "comprising," "including," "having," and variations thereof all mean "including but not limited to," unless otherwise specifically emphasized.
[0085] To facilitate understanding of this application, some of the technical terms involved in this application are explained below.
[0086] 1. Wireless fidelity peer-to-peer (Wifi P2P)
[0087] Wi-Fi P2P, also known as Wi-Fi Direct, is a technology introduced by the Wi-Fi Alliance that allows direct connections between devices based on existing Wi-Fi technology. This technology enables one-to-one or one-to-many communication without the need for a local area network (LAN) or wireless access point (AP). In other words, Wi-Fi P2P technology allows devices in a wireless network to connect to each other without a router.
[0088] 2. P2P group owner (P2P GO)
[0089] A P2P GO is a role that functions similarly to an AP in a basic service set (BSS) infrastructure. A P2P group has only one GO, and a GO can support one or more clients.
[0090] 3. P2P client
[0091] The P2P client is another type of role, also known as the group client (GC), which functions similarly to a station (STA) in the BSS infrastructure.
[0092] It's important to note that in a P2P connection, one device acts as the GO (Access Provider) and the other devices act as GCs. The GO can be understood as the master device, and the GCs as slave devices. After establishing a P2P connection, the GO and multiple GCs form a group. This group can be permanent or temporary. In a permanent group, the GO is assigned to a specific device, and its configuration and group information typically remain unchanged after generation. Subsequent connections can directly utilize this configuration and group information to reduce connection time. In a temporary group, the role allocation between the GO and GC is usually determined through negotiation between the devices. Because the information in a temporary group is temporary, it must be recreated for each subsequent use, resulting in a longer connection time compared to a permanent group.
[0093] 4. Wireless Access Point (AP)
[0094] An access point (AP) acts as a bridge between wired and wireless networks. It adds wireless functionality to an existing wired network by bridging traffic from the wireless network to the wired network. A wireless access point can function as a standalone device or as a component of a router. For example, a wireless local area network (WLAN) system includes an AP for accessing the external network, such as a home router.
[0095] 5. Station STA
[0096] In a WLAN system, STA typically refers to a client device, which can be a computer equipped with a wireless network card or a smartphone with a Wi-Fi module. It can be mobile or fixed. For example, a WLAN system includes an AP and a STA, with the STA associated with the AP and accessing the network through the AP.
[0097] 6. Dynamic Host Configuration Protocol (DHCP)
[0098] DHCP, also known as Dynamic Host Configuration Protocol, is a network protocol used in Internet Protocol (IP) networks. It is located at the application layer of the Open Systems Interconnection (OSI) model and works using the User Datagram Protocol (UDP). It has two main uses: one is to automatically assign IP addresses to users on intranets or by network service providers; the other is for intranet administrators to centrally manage all computers.
[0099] 7. Address Resolution Protocol (ARP)
[0100] ARP is a protocol for obtaining the physical address from an IP address. When a host sends a message, it broadcasts an ARP request containing the target IP address to all hosts on the local area network and receives the return information to determine the physical address of the target host. After receiving the return information, the host stores the IP address and the target host's physical address in its local ARP cache for a certain period, so that it can directly query the ARP cache for the next request, saving resources. ARP is based on mutual trust among hosts on the network. Hosts on the local area network can send ARP reply messages independently. When other hosts receive the reply messages, they do not check the authenticity of the messages but simply record them in their local ARP cache. In this case, an attacker can send a fake ARP reply message to a host, causing the message to fail to reach the intended host or reach the wrong host, thus constituting an ARP spoofing attack. ARP commands can be used to query the mapping between IP addresses and media access control addresses (MAC addresses) in the local ARP cache, add or delete static mappings, etc. Related protocols include RARP and proxy ARP. The Neighbor Discovery Protocol (NDP) is a key protocol in Internet Protocol version 6 (IPv6); NDP replaces ARP in IPv6.
[0101] The following sections, with reference to Figures 1A and 1B, introduce two practical application scenarios, thereby highlighting the technical problems that this application aims to solve.
[0102] In one scenario, Wi-Fi Direct technology, also known as near-field Wi-Fi P2P technology, allows devices to connect without an access point (AP). It's important to note that within a P2P group, devices typically have two roles: GO (Go) and GC (Controller). A GO device functions like an AP, while a GC device connects to a GO. Devices supporting Wi-Fi Direct are generally referred to as either GO or GC; GO can be simply understood as the master device, and GC as the slave device. As shown in Figure 1A, in the P2P group, terminal devices 1 through 7 all support Wi-Fi Direct. Terminal device 1 acts as the GO (Go-Order) and supports a maximum of 4 concurrent connections, meaning it can connect to a maximum of 4 GC (GC) devices simultaneously. For example, terminal device 1 can establish connections with terminal devices 2 through 5 respectively. However, terminal device 1 cannot establish a connection with terminal device 6 (see 101 in Figure 1A). This is because terminal device 1 has limited Wi-Fi hardware resources (e.g., the number of radio frequency resources in the Wi-Fi chip is limited), resulting in insufficient hardware resources to support connections with more terminal devices. Furthermore, due to role limitations, terminal devices acting as GCs cannot establish connections with each other. For example, terminal device 4 acting as a GC cannot directly connect to terminal device 7 acting as a GC (see 102 in Figure 1A).
[0103] In another scenario, according to Bluetooth technology specifications, for each pair of Bluetooth devices to communicate, one must act as the master and the other as the slave for normal communication. During communication, the master device must initiate pairing and establish a connection. Once established, both devices can send and receive data. Typically, a master Bluetooth device can simultaneously connect to up to seven slave Bluetooth devices. For example, as shown in Figure 1B, the master Bluetooth device can connect to seven slave Bluetooth devices simultaneously, i.e., it connects to slave Bluetooth devices 1 through 7. After connecting to more than seven slave Bluetooth devices, master Bluetooth device 1 can no longer connect to other slave Bluetooth devices (e.g., slave Bluetooth device 8) (see 103 in Figure 1B). This is because the master Bluetooth device has a limited number of radio frequency (RF) resources in its Bluetooth chip. When the maximum number of connections supported by these RF resources is exceeded, it cannot connect to more slave Bluetooth devices unless the already connected slave Bluetooth devices are disconnected. Furthermore, due to the role restrictions in Bluetooth communication, a Bluetooth device playing the role of a slave (i.e., a slave Bluetooth device) cannot establish a connection with other slave Bluetooth devices unless the slave Bluetooth device switches to playing the role of a master Bluetooth device (i.e., a master Bluetooth device), in which case it can establish a connection with other slave Bluetooth devices. For example, slave Bluetooth device 4 cannot directly establish a connection with slave Bluetooth device 9 (see 104 shown in Figure 1B).
[0104] Through the examples of the two scenarios above, it can be found that whether it is Bluetooth technology, Wi-Fi Direct technology, or other short-range communication technologies not listed, there may be a problem of limited number of concurrent device connections when short-range connection (also known as near-field connection or short-range connection). To this end, this application proposes a communication method that can solve the problem of limited number of concurrent device connections.
[0105] In this communication method, when the current communication conditions of the first device (also known as the initiating device) (e.g., the current number of connections or the current role of the device) do not meet the requirements for short-distance connection, a long-distance connection (also known as a far-field connection or long-distance connection) can be initiated to interconnect with the second device (also known as the receiving device) in order to solve the problem of limited concurrent connections of devices in short-distance connection.
[0106] It should be noted that since long-distance connections are not limited by the number of current connections or the current role, when the first device cannot temporarily use a short-distance connection to interconnect external devices (such as the second device), a long-distance connection can be used to interconnect more external devices, thereby achieving truly high-concurrency connections.
[0107] In some embodiments, the first device (or the second device) described above may be a terminal device or a user equipment (UE).
[0108] The terminal device can be a mobile phone, smart screen, smart TV, tablet computer, wearable device, virtual reality (VR) device, augmented reality (AR) device, monitor, projector, in-vehicle playback system, or any other device with Wi-Fi and Bluetooth capabilities. This application does not impose any restrictions on the specific type of terminal device.
[0109] To better understand the embodiments of this application, the structure of the terminal device of the embodiments of this application will be described below.
[0110] Figure 2 shows a schematic diagram of the hardware structure of a terminal device 100. The terminal device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) connector 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, and a display screen 170, etc.
[0111] The processor 110 may include one or more processing units, such as an application processor (AP), a modem processor, a graphics processing unit (GPU), a controller, a digital signal processor (DSP), a baseband processor, etc. These different processing units may be independent devices or integrated into one or more processors.
[0112] The processor 110 can generate operation control signals based on the instruction opcode and timing signals to control the instruction fetching and execution.
[0113] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 may be a cache memory. This memory can store instructions or data that the processor 110 has used or that are used frequently. If the processor 110 needs to use the instruction or data, it can directly retrieve it from this memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0114] In some embodiments, the processor 110 may include one or more interfaces. These interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc. The processor 110 can connect to modules such as wireless communication modules and displays through at least one of these interfaces.
[0115] It is understood that the interface connection relationships between the modules illustrated in the embodiments of this application are merely illustrative and do not constitute a structural limitation on the terminal device 100. In other embodiments of this application, the terminal device 100 may also adopt different interface connection methods or a combination of multiple interface connection methods as described in the above embodiments.
[0116] USB connector 130 is a USB standard-compliant interface used to connect terminal device 100 and peripheral devices. Charging management module 140 receives charging input from a charger, which can be either a wireless or wired charger. Power management module 141 connects to battery 142, and charging management module 140 connects to processor 110. Power management module 141 receives input from battery 142 and / or charging management module 140 to power processor 110, internal memory 121, display screen 170, and wireless communication module 160, etc. In some embodiments, power management module 141 and charging management module 140 may also be housed in the same device.
[0117] The wireless communication function of the terminal device 100 can be implemented through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor, etc.
[0118] The mobile communication module 150 can provide solutions for wireless communication, including 2G / 3G / 4G / 5G, applied to the terminal device 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. In some embodiments, at least some functional modules of the mobile communication module 150 may be housed in the same device as at least some modules of the processor 110.
[0119] The modem processor may include a modulator and a demodulator. The modulator modulates the low-frequency baseband signal to be transmitted into a mid-to-high frequency signal. The demodulator demodulates the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After processing by the baseband processor, the low-frequency baseband signal is transmitted to the application processor. The application processor outputs sound signals through an audio device (e.g., a speaker), or displays images, videos, contact lists, and Bluetooth operation interfaces on the display screen 170. In some embodiments, the modem processor may be a separate device. In other embodiments, the modem processor may be independent of the processor 110 and may be housed in the same device as the mobile communication module 150 or other functional modules.
[0120] The wireless communication module 160 can provide solutions for wireless communication applications on the terminal device 100, including wireless local area networks (WLAN) (such as Wi-Fi networks), Bluetooth (BT), and near field communication (NFC) technologies.
[0121] In some embodiments, antenna 1 of terminal device 100 is coupled to mobile communication module 150, and antenna 2 is coupled to wireless communication module 160, enabling terminal device 100 to communicate with networks and other terminal devices via wireless communication technology. This wireless communication technology may include Global System for Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), etc.
[0122] The terminal device 100 can implement display functions through a GPU, a display screen 170, and an application processor. The processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.
[0123] The external storage interface 120 can be used to connect an external storage card, such as a Micro SD card, to expand the storage capacity of the terminal device 100. The external storage card communicates with the processor 110 through the external storage interface 120 to perform data storage functions. For example, audio and video files can be stored on the external storage card, or audio and video files can be transferred from the terminal device 100 to the external storage card.
[0124] Internal memory 121 can be used to store computer executable program code, including instructions. Internal memory 121 may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application required for a function (e.g., screen mirroring or image sharing), etc. The data storage area may store data created during the use of terminal device 100 (e.g., contact information, information about external devices to be connected, etc.). In addition, internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc. Processor 110 executes various functional methods or data processing of terminal device 100 by running instructions stored in internal memory 121 and / or instructions stored in memory disposed in the processor.
[0125] Terminal device 100 can display a list of available devices in the vicinity (or nearby) discovered during the Bluetooth search process on display screen 170.
[0126] The display screen 170 is used to display interface information such as Bluetooth search, contact list, and image sharing. For example, the display screen 170 can be used to display images and other information. The display screen 170 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like. In some embodiments, the terminal device 100 may include one or more display screens 190. In some embodiments, the display screen may be a foldable or rollable display screen.
[0127] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the terminal device 100. In other embodiments of this application, the terminal device 100 may also include more or fewer components than those in FIG. 2, or combine some components, or split some components, or have different component arrangements. The components in FIG. 2 may be implemented in hardware, software, or a combination of software and hardware.
[0128] The software system of the aforementioned terminal device 100 can adopt a layered architecture or a service architecture, etc. This embodiment of the invention uses the layered architecture of the Android operating system as an example to exemplify the software architecture of the terminal device 100. It should be understood that the solution provided in this application can also be applied to other types of operating systems such as HarmonyOS, Apple operating systems, and Windows operating systems.
[0129] Figure 3 illustrates a schematic diagram of the software architecture of the terminal device 100 provided in an embodiment of this application. As shown in Figure 3, the layered architecture of the terminal device 100 divides the software into several layers, each with a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the software architecture components, from top to bottom, are the application (APP) layer, the application framework (FW) layer, the Android runtime (ART) and native C / C++ libraries, the hardware abstraction layer (HAL), and the kernel layer.
[0130] The application layer, also known as the application layer, can include a series of application packages. For example, an application layer package may include a gallery application, a screen mirroring application, a video application, and a settings application. When these application packages are run, they can access the various service modules provided by the application framework layer through the application programming interface (API) and execute corresponding intelligent business logic.
[0131] The Application Framework (FWK) layer provides application programming interfaces (APIs) and a programming framework for applications within the application layer. The FWK layer includes predefined functions. As shown in Figure 3, the FWK layer may include a window manager, content providers, a view system, a resource manager, a notification manager, an activity manager, and an input manager. The window manager manages all windows in the system; the content provider stores and retrieves data (e.g., videos, images) and makes this data accessible to applications; the view system includes visual controls, such as controls for displaying text and controls for displaying images. The display interface can consist of one or more views. For example, the display interface including the SMS notification icon may include a view for displaying text and a view for displaying images; the resource manager provides various resources to the application, such as images and video files; and the notification manager manages the notification information in the phone's top status bar.
[0132] The Android runtime consists of the core libraries and the Android runtime itself. The Android runtime is responsible for converting source code into machine code. The Android runtime primarily employs ahead-of-time (AOT) compilation and just-in-time (JIT) compilation techniques.
[0133] The core library primarily provides basic Java class library functionalities, such as libraries for fundamental data structures, mathematics, I / O, tools, databases, and networking. It also provides APIs for users to develop Android applications.
[0134] Native C / C++ libraries can include multiple functional modules. Examples include a surface manager and a media framework. The surface manager manages the display subsystem and provides blending of 2D and 3D layers for multiple applications. The media framework supports playback and recording of various common audio and video formats, as well as still image files.
[0135] The Hardware Abstraction Layer (HAL) runs in user space, encapsulates kernel-level drivers, and provides calling interfaces to the upper layers. The HAL includes modules such as display, Bluetooth, and Wi-Fi.
[0136] The kernel layer is the layer between hardware and software. At a minimum, the kernel layer contains display drivers, Bluetooth drivers, and Wi-Fi drivers to power the display, Bluetooth, and Wi-Fi.
[0137] The following example uses a terminal device with the structure shown in Figures 2 and 3 as the first device, and combines it with the software architecture diagram of the first device shown in Figure 4 to illustrate the overall process of the first device executing the above communication method.
[0138] The software architecture includes a fusion module (or near-field fusion layer), a short-range communication module (or near-field communication module), and a long-range communication module (or far-field communication module). The fusion module can reside in the application layer or the framework layer; in practical applications, it can be designed according to the actual scenario, and this application does not impose any limitations. Here, taking the fusion module residing in the application layer as an example, this application exemplifies the communication method proposed in this application. This fusion module is used to control the startup and switching of the short-range and long-range communication modules. It should be noted that applications such as screen mirroring, image sharing, and file sharing also run on the application layer.
[0139] The aforementioned fusion module includes a fusion discovery module, an intelligent decision-making module, and a fusion transmission module. The fusion discovery module includes a near-field discovery module, which is typically used by the first device to discover other nearby receiving devices. For example, the near-field discovery module can activate the short-range communication module to discover other nearby receiving devices (e.g., a second device). Alternatively, the short-range communication module can send broadcast information to other nearby receiving devices via a broadcast discovery function and receive response information from other receiving devices (e.g., a first response message). The short-range communication module can determine whether other devices (e.g., the second device) support short-range and / or long-range connections based on the response information. Detailed information on short-range and long-range connections can be found in the relevant descriptions below, and will not be elaborated upon here.
[0140] The aforementioned intelligent decision-making module has functions such as near-field-assisted far-field, far-field-assisted near-field, and link rating. This intelligent decision-making module is used to control the activation of functions such as near-field-assisted far-field, far-field-assisted near-field, and link rating, as well as the switching between modules. Among them, near-field-assisted far-field can also be understood as short-distance connection assisting long-distance connection. When the bandwidth of the long-distance connection is insufficient, the intelligent decision-making module can activate the near-field-assisted far-field function, so that the connection status between the first device and the nearby device (e.g., the second device) switches from long-distance connection back to short-distance connection.
[0141] Far-field assisted near-field can also be understood as long-distance connection assisting short-distance connection. For example, when the current communication conditions of the short-distance connection (such as the number of connections, current role, etc.) do not meet the requirements, the intelligent decision module can activate the far-field assisted near-field function, so that the first device can establish interconnection with nearby devices (such as the second device) through a long-distance connection; or, when the transmission resources of the short-distance connection do not meet the transmission requirements, the intelligent decision module can also activate the far-field assisted near-field function, so that the connection status of the first device with other nearby receiving devices (such as the second device) can be switched from short-distance connection back to long-distance connection.
[0142] The link rating function is mainly used to evaluate the transmission resources (such as signal quality, time-frequency domain resources, load, etc.) of the current connection link. For example, the intelligent decision module can activate the link rating function to evaluate the signal quality or load of the current short-distance connection, and determine the preferred connection method suitable for the current communication needs based on the evaluation results, and feed back the preferred connection method to the intelligent decision module. The intelligent decision module can then activate the corresponding near-field assisted far-field function or far-field assisted near-field function according to the preferred connection method, so as to enable the first device to establish interconnection with other nearby receiving devices through a better connection method, thereby providing users with high-quality communication.
[0143] The aforementioned fusion transmission module has functions such as multi-path parallel processing and switching. The switching function is used to control the switching between the short-range communication module and the long-range communication module. In some scenarios, the first device initially establishes a long-range connection with the nearby device. However, after a period of time, it is detected that the far-field data transmission volume is large and the bandwidth is insufficient. At this time, the first device can also start the multi-path parallel processing function to establish a near-field connection. For example, the first device establishes both a long-range connection and a short-range connection with the second device, thereby realizing multi-path parallel processing (also known as dual-path parallel processing).
[0144] In some embodiments, for example, the intelligent decision module determines to activate the far-field assist near-field function. At this time, the intelligent decision module sends an instruction message X1 to the fusion transmission module to instruct the fusion transmission module to switch the connection mode. At this time, the fusion transmission module controls the long-distance communication module to start, so that the connection state of the first device switches from short-distance connection to long-distance connection.
[0145] For example, when the intelligent decision-making module determines to activate the near-field assist far-field function, it sends instruction information X2 to the fusion transmission module to instruct the fusion transmission module to switch the connection mode. At this time, the fusion transmission module controls the short-range communication module to start, so that the connection state of the first device switches from long-range connection to short-range connection.
[0146] In other embodiments, after the first device enables Bluetooth and Wi-Fi, the fusion discovery module activates the short-range communication module. This short-range communication module broadcasts information via a broadcast discovery function to discover other nearby receiving devices. Upon discovering nearby receiving devices, it performs signaling interaction and data transmission resource negotiation between the first device and nearby devices (e.g., the second device) through a constrained application protocol (COAP) or Bluetooth Low Energy (BLE) signaling function. The first device establishes a secure connection with the nearby device (e.g., the second device) via a connection and authentication module. After establishing a secure connection with the nearby receiving device (e.g., the second device), the first device activates the data transmission module to send and receive data.
[0147] In some scenarios, when the first device activates the long-distance communication module, the long-distance communication module can control the first device to establish a long-distance connection with the second device. The long-distance communication module includes a remote procedure call (RPC) service and a long-distance P2P module (also known as a far-field P2P module). The RPC service is used to enable interaction and communication between the fusion module and the long-distance communication module. The long-distance P2P module includes a signaling channel, a P2P connection intelligent decision-making function, and a P2P data transmission function. The signaling channel is used for signaling interaction between the first device and external devices. The P2P connection intelligent decision-making function determines the connection method required for the first device to establish a connection with a nearby receiving device (e.g., the second device).
[0148] For example, the connection methods include P2P traversal and P2P relay. P2P traversal, also known as P2P hole punching, refers to the need for an intermediate server to guide the establishment of a long-distance connection between the first and second devices. This enables the connection to be established over a long distance. For details, please refer to the relevant descriptions in the embodiments below. P2P relay, also known as P2P relay, refers to the need for an intermediate server to act as a relay server when establishing a long-distance connection between the first and second devices. The intermediate server forwards the data from the first device to the second device, and the second device receives the data sent by the first device through the intermediate server. For details, please refer to the relevant descriptions in the embodiments below.
[0149] It should be noted that the intermediate server is a general-purpose server used to establish long-distance connections between the first device and the second device; furthermore, the intermediate server can be provided by a third-party vendor, the vendor of the first device, or the vendor of the second device, and this application does not limit this.
[0150] Once the first device and the second device are connected through an intermediate server (i.e., after the first device and the second device establish a long-distance connection), the first device can activate security authentication, authorization, and P2P data transmission functions to start transmitting data to the second device.
[0151] It should be noted that the long-distance communication module and the short-distance communication module can be located in the framework layer or the application layer. This application does not limit this. Here, we take the example of the long-distance communication module and the short-distance communication module being located in the framework layer to introduce the process of the first device executing the above communication method.
[0152] The software architecture diagram also includes short-range services (or near-field services), a radio layer interface (RIL), a Wi-Fi / Bluetooth module, modem 0, modem 1, Wi-Fi, and Bluetooth. The short-range services, combined with RPC services, control the operation of modem 0, modem 1, Wi-Fi, and Bluetooth. The RIL is used to provide the communication interface between the long-range communication module and the short-range communication module, and the Wi-Fi / Bluetooth module is used to provide the communication interface between Wi-Fi and Bluetooth.
[0153] It should be noted that the software architecture of the first device is not limited to the hardware and software system structure shown in Figures 2 to 4. In actual applications, the hardware and software system structure shown in Figures 2 to 4 can be modified according to the specific application scenario. This application does not limit this.
[0154] The communication method provided in the embodiments of this application will be illustrated below with reference to the accompanying drawings.
[0155] Figure 5 shows a flowchart of a communication method 500 provided in an embodiment of this application. Before introducing the communication method provided in this application, the execution entities involved in the embodiments of this application will be briefly described. In this application, the first device and the second device can be terminal devices; the above-mentioned communication method can be executed by the terminal device, or by a module applied in the terminal device (such as a processor, chip, or chip system, etc.), or by a logic module or software that can implement all or part of the functions of the terminal device.
[0156] This application uses a first device (or a second device) as an example to illustrate the method 500 provided by this application, but this application does not limit the executing subject. It should be noted that both the first device and the second device support Bluetooth, Wi-Fi, and cellular communication; before executing the communication method, Bluetooth, Wi-Fi, and / or mobile data traffic are enabled on both the first device and the second device.
[0157] The above method 500 includes steps 501 to 504, which are described in detail below.
[0158] Step 501: The first device receives the first operation, which is used to start the distributed service.
[0159] In this context, the first device usually refers to the initiating device, the main device, or the sharing device. The first device typically needs to share (or send) its own resources (such as video resources, file resources, image resources, etc.) to other nearby receiving devices (such as the second device).
[0160] The aforementioned first operation can refer to the operation performed by the user on the display interface of the first device. The first operation can be a gesture operation, a mouse click operation, or a remote control command operation, etc., which are not limited in this application. Among them, the gesture operation can be a single-click operation or a double-click operation, or a hover gesture operation, etc. It should be noted that the hover gesture operation can refer to the gesture operation performed when the user's gesture is in a hovering state, such as a hover swipe-up operation or a hover swipe operation, etc.
[0161] The aforementioned distributed services typically run at the application layer and / or framework layer of the first device, including but not limited to screen mirroring services, image sharing services, file sharing services, and keyboard and mouse traversal services.
[0162] In some embodiments, if a user wants to use a distributed service, the user needs to start the distributed service on the first device through a first operation. For example, if a user wants to start a screen mirroring service, the user needs to find the screen mirroring service icon on the settings interface of the first device and click the icon to start the screen mirroring service.
[0163] Step 502: In response to the first operation, the first device displays the icon of the second device, which is a device that supports distributed services, short-range connections and long-range connections, discovered based on short-range communication.
[0164] The second device typically refers to a receiving device, a slave device, or a device to be shared. The second device can refer to a device that needs to establish a connection and share resources after being discovered based on short-range communication. The second device is usually located near the first device and can establish a short-range connection with the first device through Bluetooth, Wi-Fi Direct, or other means, or establish a long-range connection with the first device through far-field P2P (or long-range P2P).
[0165] In this context, short-range connection can refer to the method by which the first device establishes a connection with the second device through a near-range (or short-range or near-field) wireless connection, while long-range connection can refer to the method by which the first device establishes a connection with the second device through a far-field P2P method. The near-range wireless connection method includes, but is not limited to, Wi-Fi direct connection and Bluetooth connection, while the far-field P2P method includes, but is not limited to, far-field P2P hole punching and far-field P2P relay (or relay) methods. For details on far-field P2P hole punching and far-field P2P relay methods, please refer to the relevant descriptions in the embodiments below, which will not be elaborated here.
[0166] In some embodiments, after receiving the first operation, the first device responds to the first operation by discovering multiple nearby devices through short-range communication methods (such as Bluetooth broadcasting or receiving heartbeat packets) and receiving response information from the multiple devices. For example, among the discovered multiple devices, some devices support distributed services, some devices do not support distributed services, some devices support short-range connections or long-range connections, and some devices support both short-range and long-range connections.
[0167] For example, in some cases, multiple devices that are discovered first can respond to the first device with response information, and through this response information, they can provide feedback to the first device on whether they support distributed services, as well as the status of short-distance and / or long-distance connections. The first device can then display devices that meet the requirements, for example, the first device can only display devices that support distributed services, short-distance connections, and long-distance connections.
[0168] In some other examples, among the multiple devices discovered, devices that support distributed services, short-range connections, and long-range connections are specified to respond with response information. For example, if a second device supports both distributed services and short-range and long-range connections, the second device can respond to the first device with response information. After receiving the response information, the first device displays the second device on the display screen (or display interface).
[0169] Step 503: The first device responds to the second operation by determining the current communication conditions. The second operation includes an operation on the icon of the second device, and the second operation instructs the first device and the second device to share data.
[0170] The second operation can also refer to an operation performed by the user on the display interface of the first device. Similar to the first operation, the second operation can be a gesture operation, a mouse click, or a remote control command, etc. This application does not limit the scope of the second operation. For example, if the second operation is a gesture operation, the user selects the icon of the second device through a gesture operation to trigger the first device to establish an interconnection with the second device.
[0171] The current communication conditions include, but are not limited to, the equivalent number of connections and the current role of the first device. The user selects the second device with which the first device needs to share data (or resources) through the second operation; for example, the first device supports two connection methods with external devices, one is a short-distance connection method and the other is a long-distance connection method. When responding to the second operation, the first device needs to determine the current communication conditions in order to further determine which connection method to use to establish a connection with the second device.
[0172] It should be noted that the current connection count refers to the number of short-range connections already established by the first device, and the threshold number is the maximum number of short-range connections supported by the first device. For example, if the short-range connection is a Bluetooth connection, the first device can connect to a maximum of 7 external devices via Bluetooth (i.e., the threshold number is 7). If the first device has already established connections with 5 external Bluetooth devices, then the current connection count is 5, and the remaining available connection count is 2. Theoretically, the first device can establish a connection with the second device via either Bluetooth or a long-range connection. Typically, the first device can first establish a connection with the second device via Bluetooth, and then choose a long-range connection if the Bluetooth link signal is weak or there is too much near-field load. Alternatively, the first device can first establish a connection with the second device via a long-range connection, and then switch to Bluetooth when the bandwidth used for the long-range connection is insufficient.
[0173] The shared data (or data exchanged) mentioned above includes, but is not limited to, image data, file data, video data, audio data, and control data.
[0174] Step 504: When the current communication conditions do not meet the requirements for short-distance connection, establish a first long-distance connection with the second device.
[0175] The aforementioned short-range connection requirements include, but are not limited to, requirements for the number of current connections and requirements for the current role. The requirement for the number of current connections may refer to the requirement that the number of current connections does not exceed a certain threshold. The requirement for the current role may refer to the requirement that the current role is allowed to connect to external networks.
[0176] When the first device determines that the current communication conditions do not meet the requirements for a short-range connection, it means that the first device cannot establish a connection with the second device temporarily through a short-range connection. At this time, the first device can establish a first long-range connection with the second device through a long-range connection. The first long-range connection refers to the process of the first device establishing a connection with the second device via a far-field P2P method. After the first device and the second device establish a long-range connection, subsequent service discovery, security authentication processing, and data transmission can proceed.
[0177] In summary, in method 500, the first device responds to the second operation by determining whether the current communication conditions meet the requirements for short-distance connection. When the current communication conditions do not meet the requirements for short-distance connection, it means that the first device cannot establish an interconnection with the second device through a short-distance connection. In order for the first device to connect to more external devices (such as the second device) concurrently, the first device can use a long-distance connection to establish a first long-distance connection with the second device, thereby avoiding the problem of limited number of concurrent connections due to the current communication conditions not meeting the requirements for short-distance connection.
[0178] In method 500, the short-range communication method may include, but is not limited to, short-range wireless communication method and heartbeat packet sending method; wherein, the short-range wireless communication method includes, but is not limited to, Bluetooth broadcasting method and local area network method.
[0179] For example, in some embodiments, as shown in Figure 6A, the first device can discover nearby receiving devices (e.g., the second device) through short-range wireless communication. For example, if the first device and the second device are connected to the same router (i.e., the first device and the second device are in the same local area network), the first device can use the local area network to send broadcast information to nearby terminal devices in the same network segment to request to establish an interconnection with the discovered terminal device (e.g., the second device). As another example, the first device can also send broadcast information to nearby terminal devices through Bluetooth broadcasting to request to establish an interconnection with the discovered terminal device (e.g., the second device).
[0180] In other embodiments, when the first device needs to establish a distributed service with a nearby device with the same account, the first device can determine how to establish a connection with that device by receiving a heartbeat packet sent by the nearby device with the same account.
[0181] It should be noted that devices with the same account can refer to devices whose account information (such as account name, account password, etc.) is consistent with the account information of the first device.
[0182] For example, if the second device is one of the devices with the same account near the first device, the second device can notify the first device of its current status information (e.g., online status, capability information) via Bluetooth broadcast heartbeat (or Bluetooth heartbeat). This heartbeat includes the second device's capability information, which includes, but is not limited to, whether it supports distributed services, short-range connections, and long-range connections. For instance, if the second device broadcasts a heartbeat via Bluetooth, the first device receives the heartbeat and parses it to obtain the capability information. If the capability information indicates that the second device supports distributed services, short-range connections, and long-range connections, it means that the first device can determine that the second device supports both short-range and long-range connections. In this case, the first device can determine how to establish a connection with the second device based on whether the current communication conditions meet the requirements for short-range connections.
[0183] For example, when current communication conditions meet the requirements for a short-range connection, the first device can establish a short-range connection with the second device (e.g., a first short-range connection); when current communication conditions do not meet the requirements for a short-range connection, or when the transmission resources of the short-range connection (e.g., the first short-range connection) do not meet the transmission requirements, the first device can establish a long-range connection with the second device. Of course, the first device and the second device can also have both short-range and long-range connections, and data transmission can be performed in a dual-path parallel manner.
[0184] It should be noted that since the first device and the second device belong to the same account, the first device has a third identifier of the second device; for example, the first device locally stores the third identifier of the second device. When the first device needs to establish a long-distance connection with the second device, it can directly establish a long-distance connection with the second device based on the third identifier. The methods for establishing short-distance and long-distance connections between the first device and the second device can be referred to the embodiments below, which will not be elaborated here.
[0185] In some embodiments, as shown in FIG6B, after the first device discovers multiple nearby receiving devices through short-range communication, it can establish an interconnection with the receiving devices through short-range connection on the one hand, and on the other hand, it can establish an interconnection with the receiving devices through long-range connection on the other hand. For example, the first device establishes an interconnection with receiving device 1 (or receiving device 2, etc.) through short-range connection, and the first device establishes an interconnection with receiving device n-1 (or receiving device n, etc.) through long-range connection, where n is a positive integer greater than 1.
[0186] In other embodiments, as shown in Figure 7A, after the first device discovers two receiving devices (i.e., the second device and the third device), it can establish interconnection with the second device and the third device respectively through a short-range connection. It should be noted that the first device, the second device, and the third device are under the same local area network (or the same router). The first device communicates with the server in the cloud service cluster through the router. For example, in practical applications, the first device (or the second device or the third device) joins the home local area network through the wired or wireless resources of the home router. The router then connects the home local area network to the external Internet through the community broadband access, thereby meeting the daily Internet access needs.
[0187] For example, as shown in Figure 7B, taking the first device in a home LAN as an example, the process of the first device accessing an external network (e.g., a metropolitan area network) is briefly described. The first device accesses the broadband remote access server (BRAS) in the service control layer through a passive optical network (PON) system in the access aggregation layer. The BRAS authenticates and authorizes the first device, establishes a session, and manages and bills the user's internet access. The access aggregation layer includes the PON system and switches (SW) for managing user access. The service control layer includes the BRAS and service routers (SR) for handling service distribution and invocation. The core layer includes core routers (CR). The metropolitan area network and the backbone network constitute the backbone of the entire transmission network, responsible for connecting home users, government and enterprise users, and data centers in various locations.
[0188] It should also be noted that the networks of the first device and the nearby receiving devices (such as the second device) may be different. For example, as shown in Figure 8A, the first device accesses the network through base station 1 and is connected to the core network and backbone network through the bearer network; the second device accesses the network through base station 2 and is connected to the core network and backbone network through the bearer network. In other words, the first device and the second device can use mobile data traffic to access the Internet. When the first device and the second device need to establish a long-distance connection, they can use mobile data traffic to communicate with each other.
[0189] For example, as shown in Figure 8B, the first device connects to server 1 in the cloud service cluster via a base station router; the second device accesses the network via a base station and connects to server 2 in the cloud service cluster via the core network; server 1 and server 2 can communicate with each other; in other words, the first device can access the internet via Wi-Fi, and the second device can access the internet via mobile data; when the first device and the second device need to establish a long-distance connection, the first device can negotiate with server 2 through server 1 to establish a long-distance connection with the second device; for example, user 1's tablet uses Wi-Fi to log in to APP1, and user 1's mobile phone uses mobile data to log in to APP2. Although the tablet and mobile phone use different communication networks, they can still establish a connection through far-field P2P to enable communication between APP1 and APP2.
[0190] As shown in Figure 9, in some embodiments, the communication method 500 further includes steps 505 and 506, as detailed below:
[0191] It should be noted that steps 505 and 506 are executed before the icon of the second device is displayed on the first device.
[0192] Step 505: The first device sends a broadcast message, and the second device receives the broadcast message accordingly. The second device is a device near the first device. The broadcast message includes a first identifier, a first request message, and a second request message. The first identifier is the identifier of the first device. The first request message is used to inquire whether distributed services are supported. The second request message is used to inquire whether short-distance connections and / or long-distance connections are supported.
[0193] The broadcast information can be Bluetooth broadcast information, Wi-Fi UDP broadcast information, or broadcast information from other short-range connection methods. This application does not limit the scope of the broadcast information.
[0194] The aforementioned first identifier, also known as the first device identifier, is used to uniquely identify the first device. It can be a string of characters, such as a string of numbers, a string of letters, or a mixed string (including numbers, letters, and special characters); for example, the first identifier is 0001041005 or 5157RQ0194.
[0195] The aforementioned first request information (or second request information) can be carried through fields in the broadcast information. For example, certain fields in the broadcast information can be used to carry the first request information.
[0196] It should be noted that short-range connection can also be described as near-field connection or short-range connection; long-range connection can also be described as far-field connection or far-range connection or far-field P2P connection; of course, short-range connection and long-range connection can also be described with other essentially similar meanings, and this application does not limit them.
[0197] In some embodiments, the first device can broadcast information to surrounding (or nearby) devices. Upon receiving the broadcast information, nearby devices will parse it. For example, if the second device is near the first device, after receiving the broadcast information, the second device will determine whether it supports distributed services based on the first request information, and whether it supports short-range and / or long-range connections based on the second request information. If the second device supports distributed services, short-range connections, and long-range connections simultaneously, it can inform the first device which service capabilities it supports by replying with response information (e.g., the first response information).
[0198] Step 506: The first device receives the first response information, and correspondingly, the second device sends the first response information, which includes a second identifier, a first indication information and a second indication information. The first indication information indicates that the second device supports distributed services, and the second indication information indicates that the second device supports short-distance connections and / or long-distance connections. The second identifier is the identifier of the second device.
[0199] The information structure of the first response information can use the data structure form of Table 1. For example, the second identifier in the first response information can be carried through the DeviceId field, the first instruction information can be carried through the first instruction field, and the second instruction information can be carried through the second instruction field. Of course, when the first response information replies to the response information using the data structure of Table 1, in addition to some required fields, other fields (such as the account identifier field) can also be carried. This application does not limit this.
[0200] It should be noted that the function and composition of the second mark are similar to those of the first mark, and can be referred to the relevant description of the first mark, which will not be repeated here.
[0201] Table 1
[0202] In some embodiments, when the second device sends a first response message to the first device, it may reply according to the content indicated by the broadcast message; for example, the first response message may include a second identifier, a first indication message and a second indication message, to reply that the first device supports distributed services, supports short-distance connections and / or long-distance connections.
[0203] It should be noted that the first instruction information and the second instruction information can be carried in different fields or in the same field, and this application does not limit this. Similarly, the first request information and the second request information can also be carried in different fields or in the same field, and this application does not limit this.
[0204] In other embodiments, when the first device replies to the first response information, it may also include a third identifier, wherein the third identifier may refer to a token value allocated by the second device on the business cloud (or a remote cloud server); the third identifier is used by the first device to establish a first long-distance connection with the second device; although the broadcast information sent by the first device does not explicitly instruct the second device to send the third identifier, the way in which the second device carries the third identifier in its reply is advantageous: when the first device needs to establish a long connection with the second device, it can retrieve the third identifier that has been stored locally in advance, without having to obtain the third identifier through new messages or control signaling, thereby reducing resource consumption.
[0205] It should be noted that when the broadcast information does not include contact information, the receiving device that receives the broadcast information (e.g., the second device) may send a first response message to the first device if it determines that it supports distributed services and both short-distance and long-distance connections. In other words, the receiving device (e.g., the second device) that replies to the first device with a response message (e.g., the first response message) may be a friend device (or contact device) of the first device, or it may not be a friend device of the first device. Here, a friend device (or contact device) may refer to the device corresponding to a contact of the first device. The contact information includes at least one contact information, which is used to determine whether a nearby receiving device (e.g., the second device) is the device corresponding to a contact. The contact information may be a hash value of a contact identifier or other data forms, which are not limited in this application.
[0206] It should be noted that in some cases, users may want to share data (such as files, videos, etc.) with their friends' devices. In this case, the first device can include contact information when broadcasting the information so that nearby devices (such as the second device) can determine whether they are friends of the first device (i.e., the device corresponding to the first device's contact) based on the contact information in the broadcast information.
[0207] For example, in step 505, when the broadcast information includes contact information, the second device determines whether it is the device corresponding to the contact of the first device based on the contact information. If it is, it sends a first response message to the first device. If not, the second device may not send a first response message to the first device, or it may indicate that it is not a friend device of the first device when replying to the first response message. This allows the first device to determine a suitable display area for the second device based on whether it is a friend device (for example, if the second device is a friend device, it is displayed in the friend device area; if the second device is not a friend device, it is displayed in the other device area, as can be seen in the interface embodiment below).
[0208] In some other embodiments, in order for the first device to quickly establish a long-distance connection with the second device when necessary to ensure communication quality, the first device carries a third indication information when sending broadcast information, instructing the second device to carry its corresponding third identifier when replying to the first response information; accordingly, when the second device receives the broadcast information, it carries the third identifier in the first response information according to the third indication information; in this way, the first device can store the third identifier carried in the first response information locally for convenient use when establishing a long-distance connection.
[0209] In some embodiments, after the first device receives the first response information, step 502 can also be performed via step 507:
[0210] Step 507: The first device displays the icon of the second device based on the first response information.
[0211] The icon of the second device is used to initiate a connection between the first and second devices to achieve resource sharing in distributed services. The icon of the second device can be initiated by user gestures or by clicking with a mouse.
[0212] In some embodiments, when the broadcast information does not include contact information, after receiving the first response information, the first device directly displays the icon of the second device in the "Available Devices" area.
[0213] In other embodiments, when the broadcast information does not include contact information, the second device may carry the hash value of its own account name when replying to the first response information; after the first device receives the first response information, it determines whether the second device is a friend device based on the hash value of the second identifier and the account name. If it is, the icon of the second device is displayed in the "Friend Devices" area; if it is not, the icon of the second device is displayed in the "Other Devices" area.
[0214] Optionally, in some embodiments, the first device can also determine whether the second device is a device with the same account as its own based on the hash value of the second identifier and the account name. If so, the icon of the second device is displayed in the "My Devices" area. For example, the first device can compare the account name of the second device with its own account name. If the two names match, it means that the second device is a device with the same account as its own.
[0215] In other embodiments, the first device can establish a connection (e.g., a short-range connection or a long-range connection) with a nearby device under the same account (e.g., a second device), as detailed in the above description, which will not be repeated here. The first device can display the icon of the second device under the same account in the "My Devices" area. In some cases, when the user selects the icon of the second device in the "My Devices" area, the first device can obtain a third identifier locally and establish a long-range connection with the second device through the third identifier. In other cases (e.g., when the current communication conditions meet the requirements for a short-range connection), when the user selects the icon of the second device in the "My Devices" area, the first device can establish a short-range connection with the second device.
[0216] In some other embodiments, when the broadcast information includes contact information, when the second device receives the broadcast information, it determines whether it is a friend device of the first device based on the contact information. Only when the second device is a friend device of the first device will the second device reply with a first response message, which may include the account name of the second device. After receiving the first response message, the first device can determine whether the second device is a friend device of itself (i.e., the device corresponding to the first device) or a device with the same account as itself based on the account name of the second device. If it is a device with the same account as the first device, the icon of the second device is displayed in the "My Devices" area; if it is a friend device of the first device, the icon of the second device is displayed in the "Friend Devices (or Contact Devices)" area; if neither is the case, the icon of the second device is displayed in the "Other Devices" area.
[0217] It should be noted that the method of displaying the icon of the second device on the first device can be referred to the interface embodiment below, which will not be repeated here.
[0218] In some embodiments, the broadcast information in step 506 above may further include first channel information, wherein the first channel information is information about the channel of the short-range connection currently used by the first device.
[0219] In some embodiments, the first channel information may refer to Bluetooth broadcast channel information, or it may refer to channel information for other short-range communications. This application does not limit this.
[0220] In some cases, when the first device sends broadcast information, it can carry the first channel information in the broadcast information so that other nearby devices (such as the second device) can determine whether a short-range connection can be established with the first device through channel multiplexing.
[0221] Accordingly, after receiving the broadcast information including the first channel information, the second device first determines whether the channel of the short-range connection it is currently using (i.e., the short-range connection channel indicated by the second channel information) is the same as the short-range connection channel indicated by the first channel information. If they are the same, it means that the first device and the second device can establish a short-range connection through channel multiplexing without establishing a long-range connection. In this case, the second device decides not to obtain the third identifier and does not need to carry the third identifier when replying to the first response information. Since the second device does not need to obtain the third identifier from the remote server, some network resources can be saved for other service data transmission. If they are different, it means that the first device and the second device cannot establish a short-range connection through channel multiplexing and may need to establish a long-range connection. However, it should be noted that the first device and the second device can also establish a short-range connection through other channels, and this application does not limit this.
[0222] For example, if the first device establishes an interconnection with the second device through a long-distance connection, the second device needs to obtain a third identifier from the remote server and carry the third identifier when replying to the first response information.
[0223] When the first device receives a response message (e.g., the first response message) from other nearby receiving devices (e.g., the second device), it needs to determine the current communication conditions and, based on the specific circumstances of the current communication conditions, determine which connection method to use to establish interconnection with each receiving device.
[0224] In step 503, the first device determines the current communication conditions, including: determining the current number of connections, wherein the current number of connections is the number of short-range connections that the first device has established, and the number threshold is the maximum number of short-range connections supported by the first device.
[0225] In some cases, once the number of current connections of the first device reaches a threshold, it can no longer establish connections with other nearby devices via short-range connections. In this situation, after receiving the second operation, the first device will determine the current number of connections. If the current number of connections has reached the threshold (i.e., the current number of connections equals the threshold), it means that the first device's prior communication conditions do not meet the requirements for short-range connections, and it cannot use short-range connections to establish a connection with the second device. If the current number of connections is less than the threshold, it means that the first device's prior communication conditions meet the requirements for short-range connections, and it can use short-range connections to establish a connection with the second device. Thus, by judging the current number of connections, the first device can determine the available connection methods for the second device, thereby avoiding situations where connections cannot be established.
[0226] For example, the first device can establish a connection with a maximum of 7 external Bluetooth devices via Bluetooth. If the current number of connections has reached 7, the current communication conditions of the first device are no longer sufficient to establish a Bluetooth connection with the second device. In this case, a long-distance connection is required to establish an interconnection with the second device.
[0227] In some embodiments, even if the current number of connections has not reached the threshold, the first device may be temporarily unable to establish a connection with other nearby devices due to the restrictions of its current role. In this case, the first device will first determine its current role before determining the current number of connections. The current number of connections will only be determined if the current role allows the first device to connect to the second device; otherwise, the current number of connections will not be determined if the current role does not allow the first device to connect to the second device. This avoids situations where connections cannot be established due to role restrictions. For example, in a Wi-Fi direct connection scenario, if the first device's role is GC (GC), then the first device is not allowed to connect to the second device.
[0228] In some other embodiments, the first device may first determine whether its current role allows it to connect to an external device; for example, when the first device determines that its current role does not allow it to connect to the second device, it determines that the current communication conditions do not meet the requirements for a short-distance connection. If the first device and the second device establish an interconnection, then a long-distance connection is required; or, for another example, when the first device determines that its current role allows it to connect to the second device, it determines that the current communication conditions meet the requirements for a short-distance connection.
[0229] For example, if the current role of the first device is GC and the role of the second device is also GC, then the current role of the first device does not allow it to establish an interconnection with the second device through a short-range connection (such as Bluetooth or Wi-Fi Direct). In this case, the first device can establish an interconnection with the second device through a long-range connection (such as far-field P2P).
[0230] In some cases, even if the current role of the first device allows it to establish a connection with other nearby devices (such as the second device), the first device may be temporarily unable to establish a connection with other nearby devices due to the limitation on the number of current connections. Therefore, before determining the current role of the first device, it will first determine the number of current connections. When the number of current connections is less than the threshold, it means that the current communication conditions meet the requirements for short-distance connection. Then, it will determine whether the current role allows the connection to the second device. This can avoid the situation where a connection cannot be established due to the limitation on the number of current connections.
[0231] For example, the first device's current role is GO (Go), and the second device's role is GC (Controller). The first device's current role allows it to establish an interconnection with the second device via Wi-Fi Direct. However, the first device has reached its maximum number of devices it can connect to via Wi-Fi Direct (i.e., the number threshold). Therefore, the first device cannot establish an interconnection with the second device via Wi-Fi Direct. In this case, an interconnection can be established via a long-distance connection (e.g., far-field P2P). When the first device's current number of connections using Wi-Fi Direct has not reached the number threshold, it indicates that the current communication conditions meet the requirements for a short-distance connection, and thus, an interconnection with the second device can be established via Wi-Fi Direct.
[0232] It should be noted that in some scenarios, when the current communication conditions meet the requirements for short-range connection, the first device can prioritize establishing a first short-range connection with the second device to reduce the resource cost of data sharing. This first short-range connection can be a Bluetooth connection, a direct Wi-Fi connection, or other short-range connection methods; this application does not limit the specific method used.
[0233] In other scenarios, although the first device and the second device have established a first short-range connection (e.g., Bluetooth connection), when the transmission resources of the first short-range connection do not meet the transmission requirements, the first device can quickly switch from the short-range connection to a long-range connection to establish a second long-range connection with the second device, thereby ensuring the communication quality between the first device and the second device.
[0234] Transmission resources include, but are not limited to, signal strength, payload capacity, data size (e.g., video file size, image size), transmission rate, transmission time, and channel quality. The second type of long-distance connection can refer to far-field P2P connections.
[0235] For example, when the transmission rate of the first short-distance connection is less than the rate threshold (e.g., 100Kb / s), the first device can switch from the short-distance connection to the long-distance connection and establish a second long-distance connection with the second device through the third identifier to ensure the communication quality between the first device and the second device.
[0236] For example, when the first device transmits high-definition video data to the second device through the first short-range connection, the high-definition video data file is too large. If the short-range connection is used, not only will the transmission time be long, but it may also be interrupted. At this time, the first device can establish a long-range connection with the second device based on the third identifier. In this way, the first device can transmit high-definition video data to the second device not only through the first short-range connection, but also through the long-range connection. This dual-path parallel data transmission method is not only highly efficient, but also highly reliable.
[0237] Of course, when the amount of data transmitted from the first device to the second device is large, the first device can also switch from a short-distance connection to a long-distance connection in order to transmit a larger number of data through the long-distance communication link.
[0238] In some embodiments, the first device and the second device have established a short-range communication link (e.g., a Bluetooth communication link or a Wi-Fi direct communication link). However, if the short-range connection is suddenly interrupted (e.g., the first device is taken away by the user while transmitting data to the second device, and the short-range connection between the first device and the second device may be interrupted) or if the transmission resources of the short-range connection do not meet the transmission requirements (e.g., the file shared by the first device to the second device is too large and the transmission time is too long), the first device can establish an interconnection with the second device through a long-range connection.
[0239] In some cases, the first device may not receive the third identifier from the second device (i.e., the second device may not send the third identifier to the first device). In this case, the first device may obtain the third identifier of the second device through the communication link of the first short-range connection. This will enable the first device to quickly establish a long-range connection with the second device when the short-range connection is suddenly interrupted or the transmission resources of the short-range connection do not meet the transmission requirements, so as to ensure the normal transmission of data.
[0240] For example, as shown in Figure 10, the process steps for the first device to obtain a third identifier through the communication link of the first short-distance connection, and to establish a second long-distance connection with the second device based on the third identifier when the short-distance connection is suddenly interrupted, the transmission resources of the short-distance connection do not meet the transmission requirements, or dual-path parallel data transmission is required:
[0241] Step 1001: The first device sends control information to the second device through the communication link of the first short-distance connection. The control information includes a first identifier and instruction information. The instruction information is used to instruct the second device to send a third identifier. The third identifier is also used to establish a second long-distance connection with the second device.
[0242] The first short-range communication link can be a Bluetooth control link (or Bluetooth data channel) established between the first device and the second device via Bluetooth connection, or a Wi-Fi control link (or Wi-Fi data channel) established between the first device and the second device via Wi-Fi direct connection.
[0243] The aforementioned control information may be signaling for short-range communication such as Bluetooth or Wi-Fi, or it may be request information from the protocol layer. In practical applications, it may also be other message or information formats, which are not limited in this application.
[0244] The first device sends control information to the second device through an established short-range communication link. The control information carries instruction information, which instructs the second device to send a third identifier to the first device. The third identifier can be sent in the form of a response message or via signaling. This application does not limit the specific type of identifier.
[0245] Step 1002: The first device receives the second response information from the second device. The second response information includes a second identifier and a third identifier, whereby the second identifier is the identifier of the second device.
[0246] After the first device sends control information to the second device, the second device obtains the third identifier from the local or server side according to the instruction information, and sends the third identifier to the first device through the second response information.
[0247] Step 1003: The first device establishes a second long-distance connection with the second device based on the third identifier.
[0248] It should be noted that after the first device obtains the third identifier, it can immediately establish a second long-distance connection with the second device, or it can establish a second long-distance connection after the first short-distance connection is interrupted. This application does not limit this.
[0249] In practical applications, switching rules can be pre-set. For example, when a short-distance connection is interrupted, the first device can use a third identifier to establish a long-distance connection with the second device. Alternatively, when the transmission resources of the short-distance connection do not meet the transmission requirements or dual-path parallel data transmission is required, the first device can establish a long-distance connection with the second device to assist the short-distance connection in completing data transmission. In other words, regardless of the following scenarios—sudden interruption of the short-distance connection, insufficient transmission resources of the short-distance connection, or the need for dual-path parallel data transmission—the second long-distance connection established by the first device with the second device through the third identifier can either be used as a standalone transmission method to complete data transmission between the first and second devices, or it can assist the short-distance connection (i.e., the short-distance connection can remain open) to complete data transmission between the first and second devices in a dual-path parallel manner.
[0250] As an example, the first device receives and parses the second response information and stores the third identifier in the second response information locally; when it needs to establish a second long-distance connection with the second device, it can quickly establish a long-distance connection with the second device through the third identifier; wherein, the long-distance connection can be a far-field P2P hole punching connection method (i.e., far-field P2P hole punching method) or a far-field P2P relay connection method (i.e., far-field P2P relay method).
[0251] For example, as shown in Figure 10, the first device and the second device can establish a second long-distance connection through a far-field P2P relay method, specifically including (provided that the first device and the second device can communicate with the relay server respectively):
[0252] Step 1004: The first device sends a request message X1 to the relay server. The request message X1 includes a first identifier and a second identifier. The request message X1 is used to request the relay server to forward the shared data from the first device to the second device.
[0253] It should be noted that since the first device and the second device have established a short-distance connection, the first device has the identifier of the second device (i.e., the second identifier).
[0254] Step 1005: Upon receiving request information X1, the relay server sends indication information R1 to the second device. Indication information R1 includes a first identifier and is used to notify the second device to prepare to receive data sent by the first device through the relay server. After receiving indication information R1, the second device can allocate storage resources, time-frequency domain resources, etc., for receiving the data sent by the first device through the relay server.
[0255] Therefore, when the transmission resources of the first short-range connection do not meet the transmission requirements, the first device can send control information to the second device through the communication link of the first short-range connection to obtain the third identifier of the second device. Since the third identifier is obtained by the first device through the established communication link of the first short-range connection, there is no need to obtain the third identifier through Bluetooth broadcasting. The interaction method is simple and the resource consumption is small.
[0256] Because of the existence of some middleware on the current Internet (such as network address translation plugins and firewalls), the first device and the second device cannot communicate directly. If the first device and the second device need to establish a long-distance connection, they need to use a server to punch holes or relay the connection in order to achieve interconnection between the first device and the second device.
[0257] The following describes two long-distance connection methods with reference to Figures 11A and 11B. One is the far-field P2P hole punching method (or far-field P2P traversal method), and the other is the far-field P2P relay method (or far-field P2P relay method). It should be noted that the far-field P2P hole punching method is not limited to the method shown in Figure 11A. Figure 11A only shows the far-field P2P hole punching method where the two devices are under different network address translation (NAT) environments. The far-field P2P hole punching method can also achieve mutual communication between the first device and the second device when the two devices are under the same NAT or under multiple levels of NAT. This application does not limit this.
[0258] Figure 11A illustrates an architecture diagram of a far-field P2P NAT tracing method. In Figure 11A, the addresses of the first device and the second device are both internal network addresses, and they are under different routers (i.e., under different NATs). The first device is under router 1, and the second device is under router 2. The first device (or the second device) can communicate with the server (i.e., an example of an intermediate server). The distributed service (or shared application or P2P application) running on the first device and the second device, as well as the server, all use port X 0001 (e.g., UDP port 0001). The first device and the second device respectively initialize X communication with the server, and the address mapping is shown in Figure 11A. For example, the first device and the second device establish a communication connection (e.g., a communication session).
[0259] When the first device sends information S1 to the public network address 2 of the second device, it sends a relay request R1 to the public network address 3 of the server. The relay request R1 includes a second identifier, and the server can locate the second device based on the second identifier. The relay request R1 is used to request the second device to send information S2 to the public network address 1 of the first device. The information S2 sent by the second device to the first device will cause router 1 to open a new communication session (e.g., a new UDP communication session) between the internal network address of the first device and the public network address 2 of the second device, so that the first device can send information S1 to the second device through the new communication session; similarly, when the second device sends information S3 to the public network address 1 of the first device, it sends a relay request R2 to the public network address 3 of the server; the relay request R2 includes a first identifier, which the server can use to locate the first device; the relay request R2 is used to request the first device to send information S4 to the public network address 2 of the second device; the information S4 sent by the first device to the second device will cause router 2 to open a new communication session (e.g., a new UDP communication session) between the internal network address of the second device and the public network address 1 of the first device, so that the second device can send information S3 to the second device through the new communication session. Once a new communication session is opened in both directions, the first and second devices can communicate directly, meaning the first and second devices can achieve a traversal (or the first and second devices can successfully punch a hole), thus establishing a long-distance connection. Subsequent data transmission between devices no longer needs to be relayed through a server, resulting in low data transmission latency and high efficiency.
[0260] Figure 11B shows a schematic diagram of a far-field P2P relay architecture. The far-field P2P relay refers to using a server S with a public Internet Protocol (IP) address as a relay server (i.e., an example of an intermediate server) to forward (or relay) data between the first and second devices. Server S is a server in a cloud service cluster. Since the first device and the second device do not communicate directly, they need to establish connections with server S separately. For example, the first device connects to server S through router 1, forming communication link 1. The first device sends a relay request R2 to server S through communication link 1. This relay request R2 includes a third identifier and request information 1, where request information 1 instructs server S to relay data from the second device through communication link 1. The second device connects to server S through router 2, forming communication link 2. Server S receives a relay request R3 through communication link 2. This relay request R3 includes a first identifier and request information 2, where request information 2 instructs the second device to receive data from the first device relayed by server S through communication link 2. Since server S has established communication links 1 and 2 with the first and second devices respectively, the second device can receive distributed service data forwarded by the first device through server S via communication link 2. Correspondingly, the first device can also receive data sent by the second device through server S via communication link 1. Thus, the first device and the second device establish a long-distance connection through server S. This method, where the first device establishes a long-distance connection with the second device via a server (e.g., a first long-distance connection), not only enables fast and secure data transmission but also improves the stability of the network connection.
[0261] The communication method 500 has been described in detail above. The following section, in conjunction with an interface embodiment, using mobile phone 1 as the first device and mobile phone 2 as the second device, introduces the application of method 500 in screen projection and image sharing scenarios.
[0262] As shown in Figure 12A, User A can enable Wi-Fi, Bluetooth, and mobile data in the status control bar 1201 of mobile phone 1 (i.e., an example of the first device). After enabling Wi-Fi, Bluetooth, and mobile data, as shown in Figure 12B, User A can click the "Settings" icon 1202 on the main interface of mobile phone 1. At this time, mobile phone 1 enters the settings interface 1203, as shown in Figure 12C. When the user clicks the screen mirroring option 1204 on the settings interface 1203, mobile phone 1 receives the click operation from the settings interface 1203 and responds to the click operation to enter the screen mirroring interface 1205, as shown in Figure 12D. User A can set permissions on the screen mirroring interface 1205. For example, in the far-field connection method option, the data method used by mobile phone 1 when establishing a long-distance connection can be set: one is to use cellular or Wi-Fi; the other is to use both cellular and Wi-Fi (i.e., both cellular & Wi-Fi). Used for: Cellular can be understood as mobile data traffic used by phone 1 to establish a long-distance connection with other nearby devices (e.g., a second device), and Wi-Fi can be understood as Wi-Fi used by phone 1 to establish a long-distance connection with other nearby devices (e.g., a second device). For example, in the search permission options, you can set either "Contacts Only" or "Everyone." When user A sets it to "Contacts Only," phone 1 can include contact information when sending broadcast messages to nearby devices. See step 506 above for details regarding including contacts in broadcast messages. Correspondingly, when phone 1 receives a response from a nearby receiving device (e.g., a second device), it can display friend devices in the "Friend Devices" area and non-friend devices in the "Other Devices" area. See step 506 above for details regarding displaying second devices from the first device.
[0263] For example, as shown in Figure 12D, user A sets the "Cellular & Wifi" option 1206 in the far-field connection mode options of the screen mirroring interface 1205 and the "Contacts Only" option 1207 in the search permission options, and then clicks the "Start Search" button. At this time, mobile phone 1 begins to execute the step of sending broadcast information in the above method 500. Since the user selected the "Contacts Only" option, mobile phone 1 can carry contact information when sending broadcast information. During the search, the screen mirroring interface 1205 can display information such as the "Searching" time (e.g., 12 seconds). When mobile phone 1 finds a device that meets the requirements (i.e., a device that supports distributed services, short-range connections, and long-range connections), that is, mobile phone 1 receives the response information (e.g., the first response information) sent by a nearby receiving device (e.g., a second device), mobile phone 1 can establish an interconnection with the device that meets the requirements and display the device that meets the requirements on the "Device Display Interface 1301" shown in Figure 13A. It should be noted that when mobile phone 1 establishes a long-distance connection with a qualified device, since the user has selected the "Cellular & Wi-Fi" option, mobile phone 1 can establish a long-distance connection with the qualified device via either cellular or Wi-Fi. Mobile phone 1 can use the appropriate data method to establish a long-distance connection with the qualified device based on the current network environment.
[0264] It should also be noted that, when limiting responses to only eligible friend devices, phone 1 can display eligible devices separately from eligible friend devices. For example, as shown in Figure 13A, the icon of my device is displayed in the "My Devices" area of the device display interface 1301, and the icon of friend devices is displayed in the "Friend Devices" area. Here, "My Devices" refers to devices near phone 1 that are registered with the same account. When not limiting responses to only eligible friend devices, phone 1 can display eligible devices separately from my device, friend devices, and non-friend devices. For example, as shown in Figure 13B, in addition to displaying the icons of "My Devices" and "Friend Devices" on the device display interface 1301, the icons of other devices are also displayed in the "Other Devices" area. Here, the "Other Devices" area displays the icons of devices other than friend devices and my device. For details, please refer to the relevant descriptions of the first device displaying the second device in steps 506 and 507 above.
[0265] In some other embodiments, as shown in Figure 13C, user A selects the "Everyone" option 1302 in the permission settings of the screen mirroring interface 1205, and then clicks the "Start Search" button to perform a search. When mobile phone 1 finds multiple receiving devices that meet the requirements, regardless of whether these receiving devices are friends' devices, mobile phone 1 will display the icons of these devices in the "Available Devices" area, as shown in Figure 13D. For details, please refer to the relevant description of the first device displaying the second device in step 507 above.
[0266] For example, as shown in Figure 13D, user A selects device 002 (as shown in 1303 of Figure 13D) and clicks the "Request Screen Casting 1304" button to connect for screen casting. At this time, mobile phone 1 executes steps 503 and 504 in the above method 500. At the same time, the device display interface 1301 displays the status information 1401 of "Connecting...", as shown in Figure 14A. When the device display interface 1301 displays the status information 1402 of "Connected", it means that mobile phone 1 and device 002 have established a connection, as shown in Figure 14B. However, in this display method, the user only knows that mobile phone 1 and device 002 have established an interconnection, but cannot know the connection method currently being used by mobile phone 1 and device 002. Therefore, in an optional implementation, after mobile phone 1 establishes an interconnection with device 002, it can display the current connection method being used in real time on the device display interface 1301, such as short-distance connection, long-distance connection, or dual-path parallel connection, so that the user can know the current connection method being used by mobile phone 1 and device 002 in a timely manner.
[0267] For example, taking user A's choice to establish an interconnection between mobile phone 1 and device 002 as shown in Figure 14C, after mobile phone 1 and device 002 establish a connection, the message "Short-range connection in progress..." can be dynamically displayed on the device display interface 1301 1403 to inform the user that mobile phone 1 and device 002 are currently using a short-range connection for data transmission; as another example, taking user A's choice to establish an interconnection between mobile phone 1 and multiple devices (e.g., device 001, device 002, device 101, etc.) as shown in Figure 14D, after mobile phone 1 establishes a connection with multiple devices, the message "Short-range connection in progress..." can be dynamically displayed on the device display interface 1301 1403 ... The device display interface 1301 dynamically displays the connection methods currently being used by mobile phone 1 and different devices. For example, displaying the message "Long-distance connection in progress..." on the device display interface 1301 can tell the user that mobile phone 1 and device 001 are currently using a short-distance connection for data transmission. As another example, displaying the message "Dual-path connection in progress..." on the device display interface 1301 can tell the user that mobile phone 1 and device 102 are currently using both short-distance and long-distance connections simultaneously for data transmission in a dual-path parallel manner.
[0268] It should be noted that the interconnection between mobile phone 1 and at least one device (e.g., device 002) may be established through a short-range connection, or through a long-range connection, or during the screen projection process, the short-range connection and the long-range connection may be mutually assisted and established in a dual-path parallel manner. The specific method used to establish the interconnection between mobile phone 1 and device 002 needs to be determined based on the current communication conditions or transmission resources, etc. For details, please refer to the relevant descriptions in steps 503 and 1003 above, which will not be repeated here.
[0269] For example, taking the connection establishment between mobile phone 1 and device 002 as an example, as shown in Figure 14E, when the device display interface 1301 displays the status message 1406 of "connection failed", it means that the connection establishment between mobile phone 1 and device 002 has failed. At this time, the device display interface 1301 can also display a "message notification" dialog box 1407, and user A can choose to "re-request" or "stop request", as shown in Figure 14E. If user A chooses to "re-request", mobile phone 1 executes steps 504 and 505 in method 500. At the same time, the device display interface 1301 reappears the interface shown in Figure 14A. If user A chooses to "stop request", the device display interface 1301 returns to the interface shown in Figure 13D, and user A can reselect the device to be cast to (for example, device 102) on the device display interface 1301.
[0270] For example, as shown in Figure 14F, mobile phone 1 has successfully established a connection with device 002. On the video interface 1408, the icon of device 002 will be displayed in the "Currently Connected Devices" area. If user A wants to disconnect the screen mirroring with device 002, they can long-press the icon of device 002 in the "Currently Connected Devices" area to open the status switch bar 1409. On the status switch bar 1409, select the "Disconnect" option to disconnect mobile phone 1 from device 002. If they want to reconnect after disconnecting, they can select the "Request Screen Mirroring 1304" button on the device display interface 1301 shown in Figure 13D to reconnect (that is, mobile phone 1 re-executes steps 503 and 504 to confirm the connection method with device 002).
[0271] Accordingly, as shown in Figure 15A, when mobile phone 1 sends a screen mirroring connection to device 002 (i.e., an example of the second device), the display interface 1501 of device 002 will display a message notification 1502 saying "Mobile phone 1 requests screen mirroring?"; if user B of device 002 accepts the screen mirroring request, then mobile phone 1 and device 002 establish a screen mirroring connection; the video content played on mobile phone 1 will be displayed synchronously on the display interface 1501 of device 002, as shown in Figure 15B; if user B of device 002 does not accept the screen mirroring request, then the screen mirroring connection between mobile phone 1 and device 002 fails.
[0272] For example, as shown in Figure 16A, user A clicks the image sharing option 1601 on the settings interface 1203 of phone 1. At this time, phone 1 receives the click operation from the settings interface 1203 and responds to the click operation by entering the image sharing interface 1602, as shown in Figure 16B. User A can set permissions on the image sharing interface 1602, such as setting the far-field connection mode to cellular and the search permission to contacts only. Then, by clicking the "Start Search" button, phone 1 can carry contact information when sending broadcast information to nearby devices. For details, please refer to the above. The description of the contact information in step 506 is as follows: During the search process, the image sharing interface 1602 will display information such as the "Searching" time; when mobile phone 1 finds a device that meets the requirements (i.e., supports distributed services, short-range connections, and long-range connections), that is, when mobile phone 1 receives a response information (e.g., a first response information) sent by a nearby receiving device (e.g., a second device), mobile phone 1 can establish an interconnection with the qualified device and display the qualified device on the "Device Display Interface 1603" shown in Figure 16C. Since the user selected the "Cellular" option, mobile phone 1 can establish a long-range connection with the qualified device via cellular mode.
[0273] For example, as shown in Figure 16C, in addition to displaying the icons for "My Device" and "Friends' Devices" on the device display interface 1603, mobile phone 1 also displays icons for other devices in the "Other Devices" area. For details, please refer to the relevant descriptions of the first device displaying the second device in steps 506 and 507 above. For example, user A selects devices 101 and 102 on device display interface 1603 to establish an interconnection for image sharing. At this time, mobile phone 1 executes steps 503 and 504 in method 500 above. Simultaneously, the icons of the selected devices 101 and 102 turn gray and are selected, as shown in 1605 of Figure 16C. The user can click the "Enter Image Selection" button 1604. At this time, mobile phone 1 jumps from device display interface 1603 to image selection interface 1606, as shown in Figure 16D. User A selects the image to be shared on image selection interface 1606. After selecting the image, the user can click the "Start Sharing" button 1607 to share the image. The "+" in the "Friend Devices" area can be used to add devices to be shared, as shown in Figure 16D.
[0274] Accordingly, as shown in Figure 17A, taking the image sharing request received by device 101 from mobile phone 1 as an example, firstly, user C can enable Wi-Fi, Bluetooth, and mobile data in the status control bar 1701 of device 101 (another example of the second device); after enabling Wi-Fi, Bluetooth, and mobile data, as shown in Figure 17B, the received image sharing message notification 1703 is displayed on the main interface 1702 of device 101; if user C selects "Accept", then mobile phone 1 and device 101 successfully establish a connection (e.g., short-range connection or long-range connection); at this time, mobile phone 1 can share images with device 101; if user C selects "Reject", then image sharing between mobile phone 1 and device 101 fails. For example, when user C selects "Accept", the image information 1704 shared by mobile phone 1 appears on the main interface 1702, as shown in Figure 17C. User C can view or save the received image. In some cases, such as when the network signal is poor, device 101 may fail to receive images. As shown in Figure 17D, device 101 displays the image information of the failed reception on the main interface 1702 in the form of a message notification 1705. User C can choose to "Re-receive" or "Abandon". If user C selects "Re-receive", device 101 continues to receive images shared by mobile phone 1. If user C selects "Abandon", device 101 disconnects from mobile phone 1, and image sharing fails or ends.
[0275] It should be noted that the communication method proposed in this application is not limited to scenarios such as screen projection and image sharing. It is applicable to scenarios such as keyboard and mouse crossing, file sharing, and multi-screen collaboration. This application does not limit the application scenarios for which the above communication method is applicable.
[0276] The foregoing has detailed examples of the communication methods provided in this application. It is understood that, in order to implement the above functions, the terminal device includes corresponding hardware structures and / or software modules for executing each function. Those skilled in the art should readily recognize that, based on the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application. This application can divide the communication methods into functional units based on the above method examples; for example, each function can be divided into separate functional units, or two or more functions can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. It should be noted that the unit division in this application is illustrative and only represents a logical functional division; other division methods may exist in actual implementation.
[0277] Figure 18 shows a schematic diagram of the structure of a terminal device provided in this application. The dashed lines in Figure 18 indicate that the unit or module is optional. The terminal device 1800 can be used to implement the methods described in the above method embodiments. The terminal device 1800 can be a server or a chip (system).
[0278] Terminal device 1800 includes one or more processors 1801, which can support the terminal device 1800 in implementing the methods in the corresponding method embodiment of FIG5. Processor 1801 can be a general-purpose processor or a special-purpose processor. For example, processor 1801 can be a central processing unit (CPU). The CPU can be used to control the terminal device 1800, execute software programs, and process data from the software programs. Terminal device 1800 may also include a communication unit 1805 for implementing signal input (reception) and output (transmission).
[0279] The aforementioned terminal device 1800 may be a chip (system) including a memory and a processor, wherein the processor is configured to execute a computer program stored in the memory to implement the methods shown in the various embodiments above.
[0280] The communication unit 1805 may be an input and / or output circuit of the chip (system), or the communication unit 1805 may be a communication interface of the chip (system), and the chip (system) may be a component of the terminal device 1800.
[0281] For example, communication unit 1805 may be a transceiver of terminal device 1800, or communication unit 1805 may be a transceiver circuit of terminal device 1800. Terminal device 1800 may include one or more memories 1802, which store program 1804. Program 1804 may be executed by processor 1801 to generate instructions 1803, causing processor 1801 to execute the method described in the above method embodiments according to instructions 1803. Optionally, memory 1802 may also store data. Optionally, processor 1801 may also read data stored in memory 1802, which may be stored at the same memory address as program 1804, or the data may be stored at a different memory address than program 1804.
[0282] The processor 1801 and memory 1802 can be configured separately or integrated together, for example, integrated on a system-on-chip (SOC) of the terminal device. The specific manner in which the processor 1801 executes the communication method can be found in the relevant description in the method embodiments.
[0283] It should be understood that the steps of the above method embodiments can be implemented by hardware logic circuits or software instructions in the processor 1801. The processor 1801 may be a CPU, a digital signal processor (DSP), a field programmable gate array (FPGA), or other programmable logic devices, such as discrete gate, transistor logic devices, or discrete hardware components.
[0284] This application also provides a computer program product that, when executed by processor 1801, implements the method of any of the method embodiments in this application. The computer program product can be stored in memory 1802, for example, as program 1804. Program 1804 undergoes preprocessing, compilation, assembly, and linking processes to ultimately be converted into an executable object file that can be executed by processor 1801.
[0285] This application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a computer, implements the method of any of the method embodiments of this application. The computer program may be a high-level language program or an executable object program.
[0286] The computer-readable storage medium is, for example, memory 1802. Memory 1802 can be volatile memory or non-volatile memory, or memory 1802 can include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDR SDRAM), Enhanced Synchronous DRAM (ESDRAM), SynchLink DRAM (SLDRAM), and Direct Rambus RAM (DRRAM).
[0287] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process and technical effects of the above-described apparatus and equipment can be referred to the corresponding processes and technical effects in the foregoing method embodiments, and will not be repeated here.
[0288] The systems, apparatuses, and methods disclosed in the embodiments provided in this application can be implemented in other ways. For example, some features of the method embodiments described above may be omitted or not performed. The apparatus embodiments described above are merely illustrative; the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Multiple units or components may be combined or integrated into another system. Furthermore, the coupling between units or components can be direct or indirect, including electrical, mechanical, or other forms of connection.
[0289] The above embodiments are merely illustrative of the technical solutions of this application and are not intended to limit it. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application. Finally, the above descriptions are merely specific implementations of this application, but the protection scope of this application is not limited thereto. Any changes or substitutions within the technical scope disclosed in this application should be covered within the protection scope of this application. Therefore, the protection scope of this application should be determined by the protection scope of the claims.
Claims
1. A communication method characterized by comprising: Applied to a first device, the method includes: Receive a first operation, which is used to start a distributed service; In response to the first operation, an icon of a second device is displayed, which is a device that supports distributed services, short-range connections, and long-range connections based on short-range communication methods. In response to a second operation, current communication conditions are determined, the second operation including an operation on an icon of the second device, the second operation indicating that the first device and the second device share data; When the current communication conditions do not meet the requirements for short-distance connection, a first long-distance connection is established with the second device.
2. The method according to claim 1, characterized in that, The method further includes: Before displaying the icon for the second device: Sending broadcast information, the broadcast information including a first identifier, a first request information and a second request information, the first identifier being the identifier of the first device, the first request information being used to inquire whether distributed services are supported, and the second request information being used to inquire whether the short-distance connection and / or the long-distance connection are supported; Receive a first response information, the first response information including a second identifier, a first indication information and a second indication information, the second identifier being the identifier of the second device, the first indication information indicating that the second device supports the distributed service, and the second indication information indicating that the second device supports the short-distance connection and / or the long-distance connection; The icon for displaying the second device includes: The icon of the second device is displayed based on the first response information.
3. The method according to claim 2, characterized in that, The first response information also includes a third identifier, which is used to establish the first long-distance connection with the second device.
4. The method according to claim 3, characterized in that, The broadcast information also includes third instruction information, which instructs the second device to send the third identifier.
5. The method according to any one of claims 2 to 4, characterized in that, The broadcast information also includes first channel information, which is information about the short-range connection channel currently used by the first device.
6. The method according to any one of claims 1 to 5, characterized in that, Determining the current communication conditions includes: Determine the current number of connections, which is the number of short-range connections already established by the first device; Wherein, the current communication conditions do not meet the short-distance connection requirements, including the current number of connections being equal to a number threshold.
7. The method according to claim 6, characterized in that, The method for determining the current number of connections further includes: Before determining the current number of connections, the current role of the first device is determined; Determining the current number of connections includes: When the current role allows the first device to connect to the second device, the current number of connections is determined.
8. The method according to any one of claims 1 to 5, characterized in that, Determining the current communication conditions includes: Determine the current role of the first device; Wherein, the current communication conditions do not meet the short-distance connection requirements, including: the current role does not allow the first device to connect to the second device.
9. The method according to claim 8, characterized in that, Before determining the current role of the first device, the method further includes: Determine the current number of connections, which is the number of short-range connections already established by the first device; Determining the current role of the first device includes: When the current number of connections is less than the number threshold, it is determined that the current communication conditions meet the short-distance connection requirements.
10. The method according to any one of claims 1 to 9, characterized in that, The method further includes: When the current communication conditions meet the short-range connection requirements, a first short-range connection is established with the second device.
11. The method according to claim 10, characterized in that, The method further includes: When the transmission resources of the first short-distance connection do not meet the transmission requirements, a second long-distance connection is established with the second device.
12. The method according to claim 10, characterized in that, Establishing a second long-distance connection with the second device includes: If no third identifier is received from the second device, control information is sent to the second device through the first short-range connection. The control information includes the first identifier and instruction information. The instruction information is used to instruct the second device to send the third identifier. The third identifier is used to establish the second long-range connection with the second device. Receive second response information from the second device, the second response information including a second identifier and the third identifier, the second identifier being the identifier of the second device; The second long-distance connection is established with the second device based on the third identifier.
13. The method according to any one of claims 1 to 12, characterized in that, The second device is the device corresponding to the contact of the first device.
14. A communication method, characterized in that, Applied to a second device, the method includes: Receive broadcast information from a first device, the broadcast information including a first identifier, a first request information and a second request information, the first identifier being the identifier of the first device, the first request information being used to inquire whether distributed services are supported, the second request information being used to inquire whether short-distance connections and / or long-distance connections are supported, the distributed service being a service initiated by the first device in response to a first operation; If the broadcast information does not include contact information, a first response information is sent to the first device. The first response information includes a second identifier, a first indication information, a second indication information, and a third identifier. The second identifier is the identifier of the second device. The first indication information indicates that the second device supports the distributed service. The second indication information indicates that the second device supports the short-range connection and / or the long-range connection. The third identifier is used to establish a first long-range connection with the first device. The contact information is used to determine whether the second device is the device corresponding to the contact.
15. The method according to claim 14, characterized in that, The broadcast information also includes first channel information, which is information about the short-range connection channel currently used by the first device. Before sending the first response information to the first device, the method further includes: When the second channel information is inconsistent with the first channel information, the third identifier is obtained, where the second channel information is the information of the short-range connection channel currently used by the second device.
16. The method according to claim 14, characterized in that, The broadcast information also includes third indication information, which instructs the second device to send a third identifier, and the first response information also includes the third identifier.
17. The method according to any one of claims 14 to 16, characterized in that, The method further includes: If the broadcast information includes the contact information, and the second device is the device corresponding to the contact information, the first response information is sent to the first device; or, if the second device is not the device corresponding to the contact information, it is determined not to send the first response information to the first device.
18. The method according to claim 15, characterized in that, The method further includes: When the second channel information is consistent with the first channel information, it is determined that the third identifier will not be acquired; Establish a first short-range connection with the first device.
19. The method according to claim 18, characterized in that, The method further includes: When the transmission resources of the first short-distance connection do not meet the transmission requirements, a second long-distance connection is established with the first device.
20. The method according to claim 19, characterized in that, Establishing a second long-distance connection with the second device includes: If no third identifier is received from the second device, control information from the first device is received via the first short-range connection. The control information includes the first identifier and instruction information. The instruction information is used to instruct the second device to send the third identifier. The third identifier is used to establish the second long-range connection with the first device. Send a second response message to the first device, the second response message including a second identifier and the third identifier; The second long-distance connection is established with the first device through the third identifier.
21. A terminal device, characterized in that, The terminal device includes a processor and a memory, the memory being used to store a computer program, and the processor being used to call and run the computer program from the memory, causing the terminal device to perform the method of any one of claims 1 to 13, or causing the terminal device to perform the method of any one of claims 14 to 20.
22. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, causes the processor to perform the method of any one of claims 1 to 13, or causes the processor to perform the method of any one of claims 14 to 20.
23. A chip system, characterized in that, The chip system includes a memory and a processor, the processor being configured to execute a computer program stored in the memory to implement the method as described in any one of claims 1 to 13, or to implement the method as described in any one of claims 14 to 20.