WO2025195177A9 - Communication method, terminal device, and computer-readable storage medium - Google Patents
Communication method, terminal device, and computer-readable storage mediumInfo
- Publication number
- WO2025195177A9 WO2025195177A9 PCT/CN2025/080762 CN2025080762W WO2025195177A9 WO 2025195177 A9 WO2025195177 A9 WO 2025195177A9 CN 2025080762 W CN2025080762 W CN 2025080762W WO 2025195177 A9 WO2025195177 A9 WO 2025195177A9
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- information
- identifier
- connection
- short
- long
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L41/00—Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
- H04L41/04—Network management architectures or arrangements
- H04L41/042—Network management architectures or arrangements comprising distributed management centres cooperatively managing the network
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L41/00—Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
- H04L41/50—Network service management, e.g. ensuring proper service fulfilment according to agreements
Definitions
- This application relates to the field of communication technology, and in particular to communication methods, terminal devices, and computer-readable storage media.
- IoT Internet of Things
- mobile phones 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.
- IoT Internet of Things
- the initiating device 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).
- Wi-Fi Direct Wireless Fidelity Direct
- the number of concurrent connections that the initiating device can support is limited.
- 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.
- a communication method applied to a first device, the method comprising:
- 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.
- 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.
- a module such as a processor, chip, or chip system
- the first device responds to the second operation by determining whether the current communication conditions meet the requirements for short-distance connection.
- 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.
- 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.
- 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.
- the first device 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.
- the first response information also includes a third identifier, which is used to establish a first long-distance connection with the second device.
- 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.
- the broadcast information also includes third instruction information, which instructs the second device to send a third identifier.
- 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.
- 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.
- the first device when it 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.
- 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.
- the first device 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.
- the available connection method such as a long-range connection
- 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.
- 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.
- 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.
- 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.
- the method before determining the current role of the first device, 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.
- 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.
- 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.
- the first device and the second device can establish an interconnection through a short-distance connection to reduce the resource costs of data sharing.
- 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.
- the first device and the second device have established a first short-distance connection
- 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.
- 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.
- 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.
- the second device is the device corresponding to the contact of the first device.
- 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.
- Another communication method for use in the second device, the method comprising:
- 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 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.
- 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).
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- the second device 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.
- 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.
- the first device when it 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.
- 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.
- 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.
- 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.
- the first device and the second device have established a first short-distance connection
- 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.
- 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.
- 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.
- embodiments of this application provide a terminal device, which includes a processor and a memory.
- the memory is used to store a computer program
- 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.
- embodiments of this application provide a terminal device, which includes a processor and a memory.
- the memory is used to store a computer program
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- the chip system may also include a communication interface for enabling communication between the chip system and a receiving device.
- FIGS 1A and 1B are schematic diagrams of application scenarios provided by embodiments of this application.
- Figure 2 is a schematic diagram of the hardware structure of a terminal device 100 provided in an embodiment of this application;
- Figure 3 is a schematic diagram of the software architecture of a terminal device 100 provided in an embodiment of this application.
- Figure 4 is a schematic diagram of the software architecture of the first device provided in an embodiment of this application.
- FIG. 5 is a flowchart illustrating a communication method 500 provided in an embodiment of this application.
- Figure 6A is a schematic diagram of a first device discovery receiving device provided in an embodiment of this application.
- Figure 6B is a schematic diagram of another first device discovery receiving device provided in an embodiment of this application.
- Figure 7A is a schematic diagram of a network connection for a first device provided in an embodiment of this application.
- 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;
- 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;
- 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.
- Figure 9 is a flowchart illustrating another communication method 500 provided in an embodiment of this application.
- 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;
- Figure 11A is a schematic diagram of the architecture of a far-field P2P hole punching method provided in an embodiment of this application;
- Figure 11B is a schematic diagram of the architecture of a far-field P2P relay method provided in an embodiment of this application.
- Figures 12A to 12D are schematic diagrams of a screen projection scenario provided by an embodiment of this application.
- Figures 13A to 13D are schematic diagrams of another screen projection scenario provided by the embodiments of this application.
- Figures 14A to 14F are schematic diagrams of another screen projection scenario provided by the embodiments of this application.
- Figures 15A and 15B are schematic diagrams of another screen projection scenario provided by the embodiments of this application.
- Figures 16A to 16D are schematic diagrams of an image sharing scenario provided by an embodiment of this application.
- FIGS 17A to 17D are schematic diagrams of another image sharing scenario provided by the embodiments of this application.
- Figure 18 is a schematic diagram of the structure of a terminal device provided in an embodiment of this application.
- Wireless Fidelity Peer-to-Peer Wi P2P
- Wi-Fi P2P also known as Wi-Fi Direct
- 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 points (APs).
- LAN local area network
- APs wireless access points
- Wi-Fi P2P technology allows devices in a wireless network to connect to each other without a router.
- P2P group owner P2P GO
- a P2P GO is a role that functions similarly to an AP in a basic service set (BSS) infrastructure.
- BSS basic service set
- a P2P group has only one GO, and a GO can support one or more clients.
- 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.
- GC group client
- STA station
- 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.
- the GO and multiple GCs form a group. This group can be permanent or temporary.
- 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.
- 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.
- An access point 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.
- a wireless local area network (WLAN) system includes an AP for accessing the external network, such as a home router.
- 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.
- a WLAN system includes an AP and a STA, with the STA associated with the AP and accessing the network through the AP.
- DHCP Dynamic Host Configuration Protocol
- DHCP also known as Dynamic Host Configuration Protocol
- IP Internet Protocol
- OSI Open System Interconnection
- UDP User Datagram Protocol
- ARP is a protocol for obtaining the physical address from an IP address.
- 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.
- 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.
- Wi-Fi Direct technology also known as near-field Wi-Fi P2P technology
- Wi-Fi P2P technology allows devices to connect without an access point (AP).
- AP access point
- 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.
- terminal devices 1 through 7 all support Wi-Fi Direct.
- Terminal device 1 acts as the GO (Goal Controller) 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 with terminal device 7, also acting as a GC (see 102 in Figure 1A).
- GO Goal Controller
- GC GC
- a master Bluetooth device can simultaneously connect to up to seven slave Bluetooth devices.
- the master Bluetooth device can connect to seven slave Bluetooth devices simultaneously, i.e., it connects to slave Bluetooth devices 1 through 7.
- 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.
- RF radio frequency
- a Bluetooth device playing the role of a slave i.e., a slave Bluetooth device
- the slave Bluetooth device switches to playing the role of a master Bluetooth device i.e., a master Bluetooth device
- slave Bluetooth device 4 cannot directly establish a connection with slave Bluetooth device 9 (see 104 shown in Figure 1B).
- this application proposes a communication method that can solve the problem of limited number of concurrent device connections.
- 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.
- 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.
- the first device (or second device) described above may be a terminal device or a user equipment (UE).
- UE user equipment
- 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.
- FIG. 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.
- a processor 110 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.
- USB universal serial bus
- 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.
- AP application processor
- GPU graphics processing unit
- DSP digital signal processor
- the processor 110 can generate operation control signals based on the instruction opcode and timing signals to control the instruction fetching and execution.
- the processor 110 may also include a memory for storing instructions and data.
- 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.
- 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.
- 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.
- 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.
- 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.
- power management module 141 and charging management module 140 may also be housed in the same device.
- 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.
- 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.
- LNA low noise amplifier
- 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.
- 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.
- 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.
- the modem processor may be a separate device.
- 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.
- the wireless communication module 160 can provide wireless communication solutions for use on the terminal device 100, including wireless local area networks (WLAN) (such as Wi-Fi networks), Bluetooth (BT), and near field communication (NFC) technologies.
- WLAN wireless local area networks
- BT Bluetooth
- NFC near field communication
- 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.
- 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.
- 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.
- 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.).
- 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 located in the processor.
- 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.
- the display screen 170 is used to display interface information such as Bluetooth search, contact list, and image sharing.
- 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.
- the terminal device 100 may include one or more display screens 190.
- the display screen may be a foldable or rollable display screen.
- 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.
- 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.
- FIG 3 illustrates a schematic diagram of the software architecture of the terminal device 100 provided in an embodiment of this application.
- the layered architecture of the terminal device 100 divides the software into several layers, each with a clear role and division of labor. Layers communicate with each other through software interfaces.
- 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.
- APP application
- FW application framework
- ART Android runtime
- HAL hardware abstraction layer
- the application layer also known as the application layer, can include a series of application packages.
- an application layer package may include a gallery application, a screen mirroring application, a video application, and a settings application.
- API application programming interface
- 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.
- 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 (such as videos and 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.
- 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.
- 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 technologies.
- 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.
- 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.
- the Hardware Abstraction Layer 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- near-field-assisted far-field can also be understood as short-distance connection assisting long-distance connection.
- 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.
- Far-field assisted near-field can also be understood as long-distance connection assisting short-distance connection.
- 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.
- 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.
- 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.
- 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.
- 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).
- 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.
- 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.
- 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.
- 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.
- COAP constrained application protocol
- BLE Bluetooth Low Energy
- 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.
- COAP constrained application protocol
- BLE Bluetooth Low Energy
- 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 is used to determine the connection method required for the first device to establish a connection with a nearby receiving device (e.g., the second device).
- connection methods include P2P traversal and P2P relay.
- P2P traversal also known as P2P hole punching
- 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.
- 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.
- the first device can activate security authentication, authorization, and P2P data transmission functions to start transmitting data to the second device.
- 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.
- 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.
- short-range services or near-field services
- RIL radio layer interface
- 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
- the Wi-Fi/Bluetooth module is used to provide the communication interface between Wi-Fi and Bluetooth.
- the software architecture of the first device is not limited to the hardware and software system structure shown in Figures 2 to 4.
- 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.
- Figure 5 shows a flowchart of a communication method 500 provided in an embodiment of 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.
- 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.
- the above method 500 includes steps 501 to 504, which are described in detail below.
- Step 501 The first device receives the first operation, which is used to start the distributed service.
- 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).
- 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.
- the gesture operation can be a single-click operation or a double-click operation, or a hover gesture operation, etc.
- 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.
- 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.
- 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.
- 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.
- 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).
- 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
- 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
- the far-field P2P method includes, but is not limited to, far-field P2P hole punching and far-field P2P relay (or relay) methods.
- 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.
- the first device after receiving the first operation, 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.
- short-range communication methods such as Bluetooth broadcasting or receiving heartbeat packets
- 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.
- 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).
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- the first device can establish a connection with the second device via either Bluetooth or a long-range connection.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- the first device responds to the second operation by determining whether the current communication conditions meet the requirements for short-distance connection.
- 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.
- 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.
- 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.
- 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).
- 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).
- the first device 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.
- 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.
- 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.
- 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.
- the first device when current communication conditions meet the requirements for a short-range connection, 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.
- 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.
- the first device 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.
- 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.
- the first device 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.
- the first device establishes an interconnection with receiving device 1 (or receiving device 2, etc.) through short-range connection
- 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.
- the first device 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.
- 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.
- the first 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.
- 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.
- the networks of the first device and the nearby receiving devices may be different.
- 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.
- the first device and the second device can use mobile data traffic to access the Internet.
- 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.
- 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.
- the communication method 500 further includes steps 505 and 506, as detailed below:
- steps 505 and 506 are executed before the icon of the second device is displayed on the first device.
- 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.
- 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.
- 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.
- the aforementioned first request information can be carried through fields in the broadcast information.
- certain fields in the broadcast information can be used to carry the first request information.
- 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
- short-range connection and long-range connection can also be described with other essentially similar meanings, and this application does not limit them.
- the first device can broadcast information to surrounding (or nearby) devices.
- 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).
- response information e.g., the first response information
- 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
- 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.
- the information structure of the first response information can use the data structure form of Table 1.
- 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
- the second instruction information can be carried through the second instruction field.
- other fields such as the account identifier field
- the second device 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.
- 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.
- 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.
- 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.
- the first device 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.
- 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 receiving device that receives the broadcast information 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.
- the receiving device e.g., the second device
- replies to the first device with a 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.
- 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.
- 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.
- 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).
- the first device 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.
- step 502 can also be performed via step 507:
- Step 507 The first device displays the icon of the second device based on the first response information.
- 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.
- the first device 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.
- 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.
- 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.
- 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.
- the first device can obtain a third identifier locally and establish a long-range connection with the second device through the third identifier.
- the first device can establish a short-range connection with the second device.
- the second device 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.
- 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.
- 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.
- 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.
- the first device when it 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.
- the second device 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.
- first device and the second device cannot establish a short-range connection through channel multiplexing and may need to establish a long-range connection.
- first device and the second device can also establish a short-range connection through other channels, and this application does not limit this.
- 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.
- the first device 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.
- a response message e.g., the first response message
- other nearby receiving devices e.g., the second device
- 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.
- 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.
- 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.
- the first device may be temporarily unable to establish a connection with other nearby devices due to the restrictions of its current role.
- 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.
- GC GC
- 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.
- 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).
- the first device can establish an interconnection with the second device through a long-range connection (such as far-field P2P).
- 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.
- 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.
- 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.
- an interconnection can be established via a long-distance connection (e.g., far-field P2P).
- 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.
- 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.
- the first device and the second device have established a first short-range connection (e.g., Bluetooth connection)
- a first short-range connection e.g., Bluetooth connection
- 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.
- 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.
- 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.
- the rate threshold e.g. 100Kb/s
- the first device 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.
- 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.
- 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).
- a short-range communication link e.g., a Bluetooth communication link or a Wi-Fi direct communication link.
- 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.
- 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.
- 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.
- 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.
- a Bluetooth control link or Bluetooth data channel
- a Wi-Fi control link or Wi-Fi data channel
- 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.
- 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.
- 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.
- the second device 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.
- Step 1003 The first device establishes a second long-distance connection with the second device based on the third identifier.
- the first device 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.
- 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.
- 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.
- the first device receives and parses the second response information and stores the third identifier in the second response information locally; when it is necessary 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).
- a far-field P2P hole punching connection method i.e., far-field P2P hole punching method
- a far-field P2P relay connection method i.e., far-field P2P relay method
- 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):
- 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.
- the first device 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).
- 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.
- 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.
- 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.
- 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.
- 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) conditions.
- 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.
- Figure 11A illustrates an architecture diagram of a far-field P2P NAT tracing method.
- 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
- the distributed service 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.
- the first device and the second device establish a communication connection (e.g., a communication session).
- the first device 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.
- 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.
- FIG 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 device and the second device.
- IP Internet Protocol
- 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.
- 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.
- the first device can also receive data sent by the second device through server S via communication link 1.
- 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.
- the communication method 500 has been described in detail above.
- 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).
- Mobile phone 1 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.
- mobile phone 1 enters the settings interface 1203, as shown in Figure 12C.
- 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.
- 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).
- 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).
- 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.
- 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.
- a nearby receiving device e.g., a second device
- 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.
- 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.
- the screen mirroring interface 1205 can display information such as the "Searching" time (e.g., 12 seconds).
- 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.
- mobile phone 1 can establish a long-distance connection with a 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.
- phone 1 can display eligible devices separately from eligible friend devices.
- 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.
- My Devices refers to devices near phone 1 that are registered with the same account.
- phone 1 can display eligible devices separately from my device, friend devices, and non-friend devices.
- the icons of other devices are also displayed in the "Other Devices” area.
- the "Other Devices” area displays the icons of devices other than friend devices and my device.
- 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.
- 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.
- FIG. 13D For details, please refer to the relevant description of the first device displaying the second device in step 507 above.
- FIG. 13D 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.
- mobile phone 1 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.
- the device display interface 1301 such as short-distance connection, long-distance connection, or dual-path parallel 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 ...
- devices e.g., device 001, device 002, device 101, etc.
- 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.
- the interconnection between mobile phone 1 and at least one device 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.
- the device display interface 1301 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.
- 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.
- 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.
- 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.
- phone 1 can carry contact information when sending broadcast information to nearby devices. For details, please refer to the above.
- 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.
- a response information e.g., a first response information
- 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
- mobile phone 1 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.
- icons for other devices please refer to the relevant descriptions of the first device displaying the second device in steps 506 and 507 above.
- user A selects devices 101 and 102 on device display interface 1603 to establish an interconnection for image sharing.
- mobile phone 1 executes steps 503 and 504 in method 500 above.
- 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.
- 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.
- 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.
- FIG. 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.
- a connection e.g., short-range connection or long-range connection
- 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.
- device 101 may fail to receive images.
- 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.
- 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.
- the terminal device includes corresponding hardware structures and/or software modules for executing each function.
- the terminal device includes corresponding hardware structures and/or software modules for executing each function.
- 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.
- 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).
- 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.
- 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).
- 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.
- 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.
- 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.
- memory 1802 may also store data.
- 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.
- the processor 1801 and memory 1802 can be configured separately or integrated together, for example, integrated on the system-on-chip (SOC) of the terminal device.
- SOC system-on-chip
- the specific manner in which the processor 1801 executes the communication method can be found in the relevant description in the method embodiments.
- 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 gates, transistor logic devices, or discrete hardware components.
- DSP digital signal processor
- FPGA field-programmable gate array
- 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.
- 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.
- 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.
- RAM Static Random Access Memory
- DRAM Dynamic Random Access Memory
- SDRAM Synchronous DRAM
- DDR SDRAM Double Data Rate SDRAM
- ESDRAM Enhanced Synchronous DRAM
- SLDRAM SynchLink DRAM
- DRRAM Direct Rambus RAM
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Mobile Radio Communication Systems (AREA)
- Computer And Data Communications (AREA)
Abstract
Description
本申请要求于2024年03月22日提交国家知识产权局、申请号为202410340157.2、申请名称为“通信方法、终端设备和计算机可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。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.
本申请涉及通信技术领域,尤其涉及通信方法、终端设备和计算机可读存储介质。This application relates to the field of communication technology, and in particular to communication methods, terminal devices, and computer-readable storage media.
随着个人智能终端以及家庭物联网(internet of things,IOT)终端设备的种类越来越多,比如,手机、平板、PC、智能汽车、智慧屏、可穿戴设备、摄像头、扫地机器人、智能窗帘等,终端设备之间的互联和数据共享成为使用者的一个重要诉求。在一些复杂的分布式业务场景下,比如,投屏、文件分享等场景,当发起设备通过广播消息发现多个支持分布式服务(比如,投屏服务)的接收设备时,发起设备需要与这些接收设备通过蓝牙(bluetooth)或者无线保真直连(wireless fidelity direct,Wifi-direct)等方式建立连接。但是,在一些需要发起设备与多个接收设备建立并发连接的情况下,发起设备存在并发连接数量受限的问题。With the increasing variety of personal smart terminals and 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 that the initiating device can support is limited.
为此,本申请提供一种通信方法、终端设备和计算机可读存储介质,能够解决设备并发连接数量受限的问题。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.
为达到上述目的,本申请采用如下技术方案:To achieve the above objectives, this application adopts the following technical solution:
第一方面,提供了一种通信方法,应用于第一设备,该方法包括:In a first aspect, a communication method is provided, applied to a first device, the method comprising:
接收第一操作,第一操作用于启动分布式服务;响应于第一操作,显示第二设备的图标,第二设备为基于短距离通信方式发现的支持分布式服务、短距离连接和长距离连接的设备;响应于第二操作,确定当前通信条件,第二操作包括作用于第二设备的图标的操作,第二操作指示第一设备与第二设备共享数据;当当前通信条件不满足短距离连接要求时,与第二设备建立第一长距离连接。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.
其中,第一设备可以指终端设备,该通信方法可以由终端设备执行,也可以由应用于终端设备中的模块(例如处理器、芯片、或芯片系统等)执行,还可以由能实现全部或部分终端设备功能的逻辑模块或软件实现。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.
本申请中,第一设备响应于第二操作,确定当前通信条件是否满足短距离连接要求,当当前通信条件不满足短距离连接要求时,说明第一设备暂时无法通过短距离连接与第二设备建立互连,为了第一设备可以并发连接更多的外部设备(比如,第二设备),第一设备可以使用长距离连接的方式与第二设备建立第一长距离连接,从而避免因当前通信条件不满足短距离连接要求而导致设备并发连接数量受限的问题。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.
在一种可能的实现方式中,该方法还包括:在显示第二设备的图标之前:发送广播信息,广播信息包括第一标识、第一请求信息和第二请求信息,第一标识为第一设备的标识,第一请求信息用于询问是否支持分布式服务,第二请求信息用于询问是否支持短距离连接和/或长距离连接;接收第一响应信息,第一响应信息包括第二标识、第一指示信息和第二指示信息,第二标识为第二设备的标识,第一指示信息指示第二设备支持分布式服务,第二指示信息指示第二设备支持短距离连接和/或长距离连接;显示第二设备的图标,包括:根据第一响应信息显示第二设备的图标。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.
第一设备在显示第二设备的图标之前,会通过广播信息询问第二设备是否支持分布式服务以及是否支持短距离连接和/或长距离连接;其中,第二设备是第一设备附近的设备;之后,第一设备再根据第二设备回复的第一响应信息确定第二设备支持短距离连接以及长距离连接的情况,从而确定与第二设备的连接方式。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.
在一种可能的实现方式中,第一响应信息还包括第三标识,第三标识用于与第二设备建立第一长距离连接。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.
在一些情况下,第二设备通过第一响应信息将第三标识发送给第一设备,无需第一设备通过新的消息或者控制信令来获取第三标识,减少了资源消耗。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.
在一种可能的实现方式中,广播信息还包括第三指示信息,第三指示信息指示第二设备发送第三标识。In one possible implementation, the broadcast information also includes third instruction information, which instructs the second device to send a third identifier.
在一些情况下,为了第一设备必要时与第二设备快速建立起长距离连接,以确保通信质量,第一设备在发送广播信息时,会携带第三指示信息,以指示第二设备发送第三标识(比如,第二设备可以在回复第一响应信息时,携带第三标识),以便于第一设备根据第三标识拉起与第二设备的长距离连接。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.
在一种可能的实现方式中,广播信息还包括第一信道信息,第一信道信息为第一设备当前所使用的短距离连接的信道的信息。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.
在一些情况下,第一设备在发送广播信息时,会将第一信道信息携带在广播信息中,以便于附近其他设备(比如,第二设备)确定是否可以通过信道复用方式与第一设备建立短距离连接。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.
在一种可能的实现方式中,确定当前通信条件,包括:确定当前连接数量,当前连接数量为第一设备已建立的短距离连接的数量;其中,当前通信条件不满足短距离连接要求,包括:当前连接数量等于数量阈值,其中,数量阈值为第一设备支持的短距离连接的最大数量。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.
在一些情况下,当当前连接数量达到数量阈值后,第一无法再通过短距离连接与附近其他设备(比如,第二设备)建立连接;此时,第一设备接收到第二操作后,会确定当前连接数量;当当前连接数量达到数量阈值时,说明当前通信条件不满足短距离连接要求,第一设备当前不能使用短距离连接与第二设备建立连接;由此可见,第一设备通过对当前连接数量的判断,为第二设备确定可用的连接方式(比如,长距离连接的方式),从而避免出现第一设备因数量阈值限制而无法连接的情况。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.
在一种可能的实现方式中,确定当前连接数量,该方法还包括:在确定当前连接数量之前,确定第一设备的当前角色;确定当前连接数量,包括:当当前角色允许第一设备连接第二设备时,确定当前连接数量。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.
在一些情况下,即使当前连接数量并未达到数量阈值,但是由于当前角色的限制,导致第一设备暂时不能与附近其他设备建立连接;因此,第一设备在确定当前连接数量之前,可以先确定第一设备的当前角色;当当前角色允许第一设备连接第二设备时,再确定当前连接数量,从而避免出现因角色限制而导致无法建立连接的情况。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.
在一种可能的实现方式中,确定当前通信条件,包括:确定第一设备的当前角色;其中,当前通信条件不满足短距离连接要求,包括:当前角色不允许第一设备连接第二设备。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.
在一些情况下,由于当前角色的限制,导致第一设备的当前通信条件不满足短距离连接要求;因此,第一设备可以通过判断自身的当前角色确定当前通信条件是否满足短距离连接要求,以便于第一设备进一步确定与第二设备的连接方式。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.
在一种可能的实现方式中,在确定第一设备的当前角色之前,方法还包括:确定当前连接数量,当前连接数量为第一设备已建立的短距离连接的数量;确定第一设备的当前角色,包括:当当前连接数量小于数量阈值时,确定当前通信条件满足短距离连接要求,数量阈值为第一设备支持的短距离连接的最大数量。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.
在一些情况下,即使第一设备的当前角色允许第一设备与附近其他设备(比如,第二设备)建立连接,但是由于当前连接数量的限制,导致第一设备暂时不能与其他接收设备建立连接;因此,第一设备在确定第一设备的当前角色之前,可以先确定当前连接数量;当当前连接数量小于数量阈值时,说明当前通信条件满足短距离连接要求,再判断当前角色是否允许连接第二设备,从而避免出现因当前连接数量限制而导致无法建立连接的情况。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.
在一种可能的实现方式中,该方法还包括:当当前通信条件满足短距离连接要求时,与第二设备建立第一短距离连接。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.
在一些场景下,当前通信条件满足短距离连接要求时,第一设备与第二设备通过短距离连接建立互连,以降低数据互享的资源成本。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.
在一种可能的实现方式中,该方法还包括:当第一短距离连接的传输资源不满足传输要求时,与第二设备建立第二长距离连接。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.
在一些场景下,虽然第一设备与第二设备建立了第一短距离连接,但是,当第一短距离连接的传输资源不满足传输要求时,第一设备可以从短距离连接快速切换至长距离连接的方式,与第二设备建立第二长距离连接,从而确保第一设备与第二设备之间数据的正常传输。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.
在一种可能的实现方式中,与第二设备建立第二长距离连接,包括:在未从第二设备接收到第三标识的情况下,通过第一短距离连接向第二设备发送控制信息,控制信息包括第一标识和指令信息,指令信息用于指示第二设备发送第三标识,第三标识还用于与第二设备建立第二长距离连接;接收第二设备的第二响应信息,第二响应信息包括第二标识和第三标识,第二标识为第二设备的标识;根据第三标识与第二设备建立第二长距离连接。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.
在一些场景下,第一设备与第二设备已经建立了短距离连接的通信链路,比如,通过短距离连接已经建立了蓝牙通信链路;第一设备可以通过第一短距离连接的通信链路向第二设备发送控制信息,以获取第二设备的第三标识,从而确保在第一短距离连接的传输资源不满足传输要求时,第一设备可以快速与第二设备建立起长距离连接;由此可见,第一设备通过第一短距离连接的通信链路获取第三标识,无需重新通过蓝牙广播方式获取第三标识,交互方式简单、资源消耗小。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.
在一种可能的实现方式中,第二设备为第一设备的联系人对应的设备。In one possible implementation, the second device is the device corresponding to the contact of the first device.
在一些情况下,用户可能希望将数据(比如,文件、视频等)共享给自己的好友设备,此时,第一设备在广播信息时可以携带联系人信息,以便于附近其他设备(比如,第二设备)根据广播信息中的联系人信息判断自己是否属于第一设备的好友设备(即第一设备的联系人对应的设备)。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.
第二方面,提供了又一种通信方法,应用于第二设备,该方法包括:Secondly, another communication method is provided for use in the second device, the method comprising:
接收第一设备的广播信息,广播信息包括第一标识、第一请求信息和第二请求信息,第一标识为第一设备的标识,第一请求信息用于询问是否支持分布式服务,第二请求信息用于询问是否支持短距离连接和/或长距离连接,分布式服务为第一设备响应于第一操作启动的服务;在广播信息不包括联系人信息的情况下,向第一设备发送第一响应信息,第一响应信息包括第二标识、第一指示信息、第二指示信息和第三标识,第二标识为第二设备的标识,第一指示信息指示第二设备支持分布式服务,第二指示信息指示第二设备支持短距离连接和/或长距离连接,第三标识用于与第一设备建立第一长距离连接,联系人信息用于确定第二设备是否为联系人对应的设备。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.
其中,第二设备可以指终端设备,该通信方法可以由终端设备执行,也可以由应用于终端设备中的模块(例如处理器、芯片、或芯片系统等)执行,还可以由能实现全部或部分终端设备功能的逻辑模块或软件实现。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.
在上述方法中,第二设备接收第一设备发送的广播信息;在广播信息不包括联系人信息的情况下,第二设备无需判断自己是否为第一设备的好友设备就可以根据广播信息回复第一响应信息,以向第一设备反馈自己支持短距离连接以及长距离连接的情况,从而便于第一设备确定与自己(即第二设备)的连接方式。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).
在一种可能的实现方式中,广播信息还包括第一信道信息,第一信道信息为第一设备当前所使用的短距离连接的信道的信息;在向第一设备发送第一响应信息之前,方法还包括:当第二信道信息与第一信道信息不一致时,获取第三标识,第二信道信息为第二设备当前所使用的短距离连接的信道的信息。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.
当广播信息包括第一信道信息时,第二设备可以判断第二信道信息与第一信道信息是否一致;当第二信道信息与第一信道信息不一致时,说明第二设备不能复用第一信道信息对应的信道,可能需要建立长距离连接或者使用其他信道建立短距离连接;此时,第二设备可以获取第三标识,比如,从远端服务器获取第三标识,以便于与第一设备建立长距离连接。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.
在一种可能的实现方式中,广播信息还包括第三指示信息,第三指示信息指示第二设备发送第三标识,第三标识用于与第一设备建立第一长距离连接,第一响应信息还包括第三标识。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.
在一些情况下,为了第一设备必要时与第二设备快速建立起长距离连接,以确保数据的正常传输,第一设备在发送广播信息时,会携带第三指示信息,以指示第二设备发送第三标识;第二设备可以通过第一响应信息携带第三标识;这样以便于第一设备拉起与第二设备的长距离连接。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.
在一种可能的实现方式中,上述方法还包括:在广播信息包括联系人信息的情况下,当第二设备是联系人信息对应的设备时,向第一设备发送第一响应信息;或者,当第二设备不是联系人信息对应的设备时,确定不向第一设备发送第一响应信息。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.
在一些情况下,用户可能希望将数据(比如,文件、视频等)共享给自己的好友设备,此时,第一设备在广播信息时可以携带联系人信息,以便于附近其他设备(比如,第二设备)根据广播信息中的联系人信息判断自己是否属于第一设备的好友设备;当第二设备属于第一设备的好友设备(即第二设备是联系人信息对应的设备)时,向第一设备回复第一响应信息;当第二设备不属于第一设备的好友设备(即第二设备不是联系人信息对应的设备)时,确定不向第一设备回复第一响应信息。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.
在一种可能的实现方式中,该方法还包括:当第二信道信息与第一信道信息一致时,确定不获取第三标识;与第一设备建立第一短距离连接。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.
在一些情况下,第一设备在发送广播信息时,将第一信道信息携带在广播信息中,以便于附近其他设备(比如,第二设备)确定是否可以通过信道复用方式与第一设备建立短距离连接。当广播信息包括第一信道信息时,第二设备可以判断第二信道信息与第一信道信息是否一致;当第二信道信息与第一信道信息一致时,说明第二设备可以复用第一信道信息对应的信道,与第一设备建立短距离连接;此时,第二设备可以暂时不用获取第三标识;由于第二设备暂时不用从远端服务器获取第三标识,因此可以节省部分网络资源以用于其他业务数据传输。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.
在一种可能的实现方式中,方法还包括:当第一短距离连接的传输资源不满足传输要求时,与第一设备建立第二长距离连接。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.
在一些场景下,虽然第一设备与第二设备建立了第一短距离连接,但是,当第一短距离连接的传输资源不满足传输要求时,第一设备可以从短距离连接快速切换至长距离连接,与第二设备建立第二长距离连接,从而确保第一设备与第二设备之间的通信质量。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.
在一种可能的实现方式中,与第二设备建立第二长距离连接,包括:当第一设备未保存第三标识时,通过第一短距离连接接收第一设备的控制信息,控制信息包括第一标识和指令信息,指令信息用于指示第二设备发送第三标识,第三标识用于与第一设备建立第二长距离连接;向第一设备发送第二响应信息,第二响应信息包括第二标识和第三标识;通过第三标识与第一设备建立第二长距离连接。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.
在一些场景下,第一设备与第二设备已经建立了短距离连接的通信链路,比如,通过短距离连接已经建立了蓝牙通信链路;第一设备可以通过第一短距离连接的通信链路向第二设备发送控制信息,以获取第二设备的第三标识,从而确保在第一短距离连接的传输资源不满足传输要求时,第一设备可以快速与第二设备建立起长距离连接;由此可见,第一设备通过第一短距离连接的通信链路获取第三标识,无需重新通过蓝牙广播方式获取第三标识,交互方式简单、资源消耗小。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.
第三方面,本申请实施例提供了一种终端设备,终端设备包括处理器和存储器,存储器用于存储计算机程序,处理器用于从存储器中调用并运行计算机程序,使得终端设备执行第一方面以及第一方面的各种可能的实现中描述的方法。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.
第四方面,本申请实施例提供了一种终端设备,终端设备包括处理器和存储器,存储器用于存储计算机程序,处理器用于从存储器中调用并运行计算机程序,使得终端设备执行第二方面以及第二方面的各种可能的实现中描述的方法。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.
第五方面,本申请实施例提供了一种计算机可读存储介质,计算机可读存储介质存储了计算机程序,当计算机程序被处理器执行时,使得处理器执行第一方面以及第一方面的各种可能的实现中描述的方法。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.
第六方面,本申请实施例提供了一种计算机可读存储介质,计算机可读存储介质存储了计算机程序,当计算机程序被处理器执行时,使得处理器执行第二方面以及第二方面的各种可能的实现中描述的方法。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.
第七方面,本申请实施例提供了一种计算机程序产品,计算机程序产品包括:计算机程序代码,当计算机程序代码被终端设备运行时,使得该终端设备执行第一方面以及第一方面的各种可能的实现中描述的方法。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.
第八方面,本申请实施例提供了一种计算机程序产品,计算机程序产品包括:计算机程序代码,当计算机程序代码被终端设备运行时,使得该终端设备执行第二方面以及第二方面的各种可能的实现中描述的方法。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.
第九方面,本申请实施例提供了一种芯片系统,该芯片系统包括处理电路、存储介质,存储介质中存储有计算机程序指令;计算机程序指令被处理电路执行时实现第一方面及第一方面的各种可能的实现中描述的方法。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.
第十方面,本申请实施例提供了一种芯片系统,该芯片系统包括处理电路、存储介质,存储介质中存储有计算机程序指令;计算机程序指令被处理电路执行时实现第二方面及第二方面的各种可能的实现中描述的方法。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.
可选的,上述芯片系统中的处理电路可以由处理器替换,存储介质可以由存储器替换。可选的,该芯片系统还可以包括通信接口,通信接口用于实现该芯片系统与接收设备的通信。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.
在本申请的第三方面至第十方面的技术方案的有益效果可以参与第一方面或第二方面的技术方案的有益效果相同,此处不再赘述。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.
图1A至图1B为本申请实施例提供的应用场景示意图;Figures 1A and 1B are schematic diagrams of application scenarios provided by embodiments of this application;
图2为本申请实施例提供的一种终端设备100的硬件结构示意图;Figure 2 is a schematic diagram of the hardware structure of a terminal device 100 provided in an embodiment of this application;
图3为本申请实施例提供的一种终端设备100的软件架构示意图;Figure 3 is a schematic diagram of the software architecture of a terminal device 100 provided in an embodiment of this application;
图4为本申请实施例提供的第一设备的软件架构示意图;Figure 4 is a schematic diagram of the software architecture of the first device provided in an embodiment of this application;
图5为本申请实施例提供的一种通信方法500的流程示意图;Figure 5 is a flowchart illustrating a communication method 500 provided in an embodiment of this application;
图6A为本申请实施例提供的一种第一设备发现接收设备的示意图;Figure 6A is a schematic diagram of a first device discovery receiving device provided in an embodiment of this application;
图6B为本申请实施例提供的又一种第一设备发现接收设备的示意图;Figure 6B is a schematic diagram of another first device discovery receiving device provided in an embodiment of this application;
图7A为本申请实施例提供的一种第一设备网络连接的示意图;Figure 7A is a schematic diagram of a network connection for a first device provided in an embodiment of this application;
图7B为本申请实施例提供的一种第一设备接入外部网络的过程示意图;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;
图8A为本申请实施例提供的一种第一设备和第二设备所处网络的示意图;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;
图8B为本申请实施例提供的又一种第一设备和第二设备所处网络的示意图;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.
图9为本申请实施例提供的又一种通信方法500的流程示意图;Figure 9 is a flowchart illustrating another communication method 500 provided in an embodiment of this application;
图10为本申请实施例提供的一种第一设备与第二设备建立第二长距离连接的示意图;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;
图11A为本申请实施例提供的一种远场P2P打洞方式的架构示意图;Figure 11A is a schematic diagram of the architecture of a far-field P2P hole punching method provided in an embodiment of this application;
图11B为本申请实施例提供的一种远场P2P中转方式的架构示意图;Figure 11B is a schematic diagram of the architecture of a far-field P2P relay method provided in an embodiment of this application;
图12A至图12D为本申请实施例提供的一种投屏场景示意图;Figures 12A to 12D are schematic diagrams of a screen projection scenario provided by an embodiment of this application;
图13A至图13D为本申请实施例提供的又一种投屏场景示意图;Figures 13A to 13D are schematic diagrams of another screen projection scenario provided by the embodiments of this application;
图14A至图14F为本申请实施例提供的再一种投屏场景示意图;Figures 14A to 14F are schematic diagrams of another screen projection scenario provided by the embodiments of this application;
图15A至图15B为本申请实施例提供的又一种投屏场景示意图;Figures 15A and 15B are schematic diagrams of another screen projection scenario provided by the embodiments of this application;
图16A至图16D为本申请实施例提供的一种图片分享场景示意图;Figures 16A to 16D are schematic diagrams of an image sharing scenario provided by an embodiment of this application;
图17A至图17D为本申请实施例提供的又一种图片分享场景示意图;Figures 17A to 17D are schematic diagrams of another image sharing scenario provided by the embodiments of this application;
图18为本申请实施例提供的一种终端设备的结构示意图。Figure 18 is a schematic diagram of the structure of a terminal device provided in an embodiment of this application.
为了清楚地描述本申请实施例的技术方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述;需要说明的是,本申请所描述的实施例仅是本申请一部分实施例,而不是全部的实施例。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.
在本申请的描述中,除非另有说明,“/”表示或的意思,例如,A/B可以表示A或B。在本申请的描述中,“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。“至少一个”是指一个或者多个,“多个”是指两个或两个以上。在本申请的说明书和权利要求书中的术语“第一”和“第二”等是用于区别不同的对象,或者用于区别对同一对象的不同处理,而不是用于描述对象的特定顺序。例如,第一终端和第二终端等是用于区别不同的终端设备,而不是用于描述终端设备的特定顺序。本领域技术人员可以理解“第一”、“第二”等字样并不对数量和执行次序进行限定,并且“第一”、“第二”等字样也并不限定一定不同。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.
需要说明的是,本申请中,“示例性的”或者“例如”等词用于表示作例子、例证或说明。本申请中被描述为“示例性的”或者“例如”的任何实施例或设计方案不应被解释为比其他实施例或设计方案更优选或更具优势。确切而言,使用“示例性的”或者“例如”等词旨在以具体方式呈现相关概念。术语“包括”、“包含”、“具有”及它们的变形都意味着“包括但不限于”,除非是以其他方式另外特别强调。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.
为便于理解本申请,以下对本申请涉及的部分技术术语进行解释说明。To facilitate understanding of this application, some of the technical terms involved in this application are explained below.
1、无线保真点对点(wireless fidelity peer-to-peer,Wifi P2P)1. Wireless Fidelity Peer-to-Peer (Wifi P2P)
Wifi P2P也称Wifi直连,是指Wifi联盟推出的一项基于原来WIfi技术的允许设备与设备之间直接连接的技术,该技术不需要借助局域网或者无线接入点(access point,AP)就可以进行一对一或一对多通信。换句话说,Wifi P2P技术允许无线网络中的设备无需通过路由器就可以相互连接。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 points (APs). In other words, Wi-Fi P2P technology allows devices in a wireless network to connect to each other without a router.
2、P2P组所有者(P2P group owner,P2P GO)2. P2P group owner (P2P GO)
P2P GO是一种角色,其作用类似于基础服务集(basic service set,BSS)基础架构(infrastructure)中的AP;一个P2P组只有一个GO,一个GO可以支持一个或者多个客户端(client)。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.
3、P2P客户端(P2P client)3. P2P client
P2P客户端是另外一种角色,也称为组客户端(group client,GC),其作用类似于BSS基础架构中的站点(station,STA)。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.
需要说明的是,在P2P连接中,有一个设备扮演GO的角色(即充当AP),而其他设备扮演GC的角色,其中,GO可以理解为主设备,GC可以理解为从设备。在组建P2P后,GO和多个GC会组成一个组(group),该group可以是永久性的,也可以是临时性的;其中,在永久性的group中,GO由指定设备来扮演,且配置信息以及组信息生成后,通常不会变化,后续使用时,可以直接利用该配置信息以及组信息,以减少连接时间。而在临时性的group中,GO和GC的角色分配通常由设备双方协商确定;由于临时性的group中的信息都是临时的,后续每次使用都要重新创建,连接时间相比永久性的group要长。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.
4、无线接入点AP4. Wireless Access Point (AP)
AP是连接有线网和无线网的桥梁,它可通过将流量从无线网桥接到有线网中,为现有的有线网增加无线功能。无线接入点可充当独立设备,也可作为路由器的组件使用。示例性的,无线局域网(wireless local area network,WLAN)系统包括AP,用于访问外网,比如,家庭路由器。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.
5、站点STA5. Station STA
STA在WLAN系统中通常指客户端,可以是装有无线网卡的计算机,也可以是有Wifi模块的智能手机,可以是移动的,也可以是固定的。示例性的,WLAN系统包括AP和STA,该STA关联到AP,通过AP接入网络。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.
6、动态主机设置协议(dynamic host configuration protocol,DHCP)6. Dynamic Host Configuration Protocol (DHCP)
DHCP又称动态主机组态协定,是一个用于网际协议(internet protocol,IP)网络的网络协议,位于开放式系统互联(open systeminterconnect,OSI)模型的应用层,使用用户数据报协议(user datagram protocol,UDP)协议工作,主要有两个用途:一种是用于内部网或网络服务供应商自动分配IP地址给用户;另一种是用于内部网管理员对所有电脑作中央管理。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 System 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.
7、地址解析协议(address resolution protocol,ARP)7. Address Resolution Protocol (ARP)
ARP是根据IP地址获取物理地址的一个协议;主机发送信息时将包含目标IP地址的ARP请求广播到局域网络上的所有主机,并接收返回信息,以此确定目标主机的物理地址;当主机收到返回信息后,将该IP地址和目标主机的物理地址存入本机ARP缓存中并保留一定时间,以便于下次请求时可以直接查询ARP缓存以节约资源。ARP是建立在网络中各个主机互相信任的基础上的,局域网络上的主机可以自主发送ARP应答信息,其他主机收到应答报文时不会检测该报文的真实性就会将其记入本机ARP缓存;在这种情况下,攻击者可以向某一主机发送伪ARP应答报文,使其发送的信息无法到达预期的主机或到达错误的主机,从而构成一个ARP欺骗。ARP命令可用于查询本机ARP缓存中IP地址和媒体访问控制地址(media access control address,MAC)地址的对应关系、添加或删除静态对应关系等。相关协议有RARP、代理ARP。邻居发现协议(neighbor discovery protocol,NDP)是互联网协议版本6(internet protocol version 6,IPv6)的一个关键协议;该NDP在IPv6中代替ARP。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.
下面结合图1A和图1B介绍两种实际应用场景,以此引出本申请需要解决的技术问题。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.
在一种场景中,Wifi直连(direct)技术,也可以称作近场的Wifi P2P技术,在近场的P2P连接中,设备之间可以不通过AP进行连接;需要说明的是,在P2P组(group)中,设备通常有2种角色:GO和GC,其中,扮演GO角色的设备具有像AP一样的功能,扮演GC角色的设备会连接GO;通常支持Wifi直连功能的设备都可以称为GO或GC;其中,GO可以简单地理解为主设备,GC是从设备。如图1A所示,在P2P group中,终端设备1至终端设备7均支持Wifi直连功能,其中,终端设备1扮演GO角色,最多支持并发连接的数量为4,即终端设备1最多可以同时与4个GC设备连接,比如,终端设备1与终端设备2至终端设备5分别建立连接;而终端设备1与终端设备6不能再建立连接(参见图1A所示的101);原因在于,终端设备1的Wifi硬件资源有限(比如,Wifi芯片中射频资源的数量有限),导致没有更多的硬件资源支持其与更多的终端设备建立连接。此外,由于角色的限制,导致扮演GC角色的终端设备之间也不能建立连接,比如,扮演GC角色的终端设备4与扮演GC角色的终端设备7之间不能直接建立连接(参见图1A所示的102)。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 (Goal Controller) 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 with terminal device 7, also acting as a GC (see 102 in Figure 1A).
在另一种场景中,通过蓝牙技术规定可知,每一对蓝牙设备进行通信时,必须一个为主角色(master),另一个为从角色(slave),才能进行正常通信;通信时,必须由主设备进行查找,发起配对,建链成功后,双方可以收发数据。通常一台主蓝牙设备可以同时与7台从蓝牙设备建立连接;比如,如图1B所示,主蓝牙设备可以同时与7台从蓝牙设备建立连接,即主蓝牙设备分别与从蓝牙设备1至从蓝牙设备7建立连接;连接超过7台从蓝牙设备后,主蓝牙设备1就不能再与其他从蓝牙设备(比如,从蓝牙设备8)建立连接(参见图1B所示的103);原因在于,主蓝牙设备中蓝牙芯片的射频资源数量有限,超过射频资源支持的最大连接数量时,就不能与更多的从蓝牙设备建立连接,除非断开已连接的从蓝牙设备。此外,由于蓝牙通信也有角色的限制,导致扮演从角色的蓝牙设备(即从蓝牙设备)不能与其他从蓝牙设备建立连接,除非,扮演从角色的蓝牙设备切换为扮演主角色的蓝牙设备(即称为主蓝牙设备),才可以与其他从蓝牙设备建立连接,比如,从蓝牙设备4不能与从蓝牙设备9直接建立连接(参见图1B所示的104)。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).
通过以上两种场景的举例发现,无论是蓝牙技术还是Wifi直连技术或者是其他未列举出的部分近距离通信技术,可能都存在短距离连接(也可以称为近场连接或近距离连接)时设备并发连接数量受限的问题,为此,本申请提出了一种通信方法,该通信方法能够解决设备并发连接数量受限的问题。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.
在该通信方法中,当第一设备(也可以称为发起设备)的当前通信条件(比如,设备的当前连接数量或者当前角色等)不满足短距离连接要求时,可以通过启动长距离连接(也可以称为远场连接或远距离连接)与第二设备(也可以称为接收设备)进行互连,以解决短距离连接所出现的设备并发连接数量受限的问题。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.
需要说明的是,由于长距离连接没有当前连接数量和当前角色的限制,因此,当第一设备暂时不能使用短距离连接互连外部设备(比如,第二设备)时,可以使用长距离连接互连更多的外部设备,从而实现真正的高并发量连接。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.
在一些实施例中,上述第一设备(或第二设备)可以是终端设备或用户设备(user equipment,UE)。In some embodiments, the first device (or second device) described above may be a terminal device or a user equipment (UE).
其中,终端设备可以是手机(mobile phone)、智慧屏、智能电视、平板电脑(Pad)、可穿戴式设备、虚拟现实(virtual reality,VR)设备、增强现实(augmented reality,AR)设备、显示器、投影仪、车载播放系统等具有Wifi功能和蓝牙功能的设备。对于终端设备的具体类型,本申请实施例不作任何限制。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.
为了能够更好地理解本申请的实施例,下面对本申请实施例的终端设备的结构进行介绍。To better understand the embodiments of this application, the structure of the terminal device of the embodiments of this application will be described below.
如图2所示,示出了一种终端设备100的硬件结构示意图。终端设备100可以包括处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接头130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160以及显示屏170等。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.
其中,处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),控制器,数字信号处理器(digital signal processor,DSP),基带处理器等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。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.
处理器110可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。The processor 110 can generate operation control signals based on the instruction opcode and timing signals to control the instruction fetching and execution.
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器可以为高速缓冲存储器。该存储器可以保存处理器110用过或使用频率较高的指令或数据。如果处理器110需要使用该指令或数据,可从该存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。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.
在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路(inter-integrated circuit,I2C)接口,集成电路内置音频(inter-integrated circuit sound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purpose input/output,GPIO)接口,用户标识模块(subscriber identity module,SIM)接口,和/或通用串行总线(universal serial bus,USB)接口等。处理器110可以通过以上至少一种接口连接无线通信模块、显示器等模块。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.
可以理解的是,本申请实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对终端设备100的结构限定。在本申请另一些实施例中,终端设备100也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。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.
USB接头130是一种符合USB标准规范的接口,可以用于连接终端设备100和外围设备。充电管理模块140用于接收充电器的充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110,内部存储器121,显示屏170和无线通信模块160等供电。在另一些实施例中,电源管理模块141和充电管理模块140也可以设置于同一个器件中。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.
终端设备100的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。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.
移动通信模块150可以提供应用在终端设备100上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。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.
调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频设备(比如,扬声器等)输出声音信号,或通过显示屏170显示图像、视频、联系人列表以及蓝牙操作界面等。在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器110,与移动通信模块150或其他功能模块设置在同一个器件中。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.
无线通信模块160可以提供应用在终端设备100上的包括无线局域网(wireless local area networks,WLAN)(如Wifi网络),蓝牙(bluetooth,BT),近距离无线通信技术(near field communication,NFC)等无线通信的解决方案。The wireless communication module 160 can provide wireless communication solutions for use on the terminal device 100, including wireless local area networks (WLAN) (such as Wi-Fi networks), Bluetooth (BT), and near field communication (NFC) technologies.
在一些实施例中,终端设备100的天线1和移动通信模块150耦合,天线2和无线通信模块160耦合,使得终端设备100可以通过无线通信技术与网络和其他终端设备通信。该无线通信技术可以包括全球移动通讯系统(global system for mobile communications,GSM),通用分组无线服务(general packet radio service,GPRS),码分多址接入(code division multiple access,CDMA)等。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.
终端设备100可以通过GPU,显示屏170,以及应用处理器等实现显示功能。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。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.
外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展终端设备100的存储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将音频,视频等文件保存在外部存储卡中。或将音频,视频等文件从终端设备100传输至外部存储卡中。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.
内部存储器121可以用于存储计算机可执行程序代码,该可执行程序代码包括指令。内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,至少一个功能所需的应用程序(比如,投屏功能或图片分享等应用)等。存储数据区可存储终端设备100使用过程中所创建的数据(比如,联系人信息,外部待连接设备信息等)等。此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。处理器110通过运行存储在内部存储器121的指令,和/或存储在设置于处理器中的存储器的指令,执行终端设备100的各种功能方法或数据处理。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 located in the processor.
终端设备100可以通过显示屏170显示蓝牙搜索过程中发现的周围(或附近)可用设备的列表信息等。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.
显示屏170用于显示蓝牙搜索、联系人列表、图片分享等界面信息,比如,显示屏170可以用于显示图片等信息。显示屏170包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting diode,OLED)等。在一些实施例中,终端设备100可以包括一个或多个显示屏190。在一些实施例中,该显示屏可以是可折叠的、或卷轴性质的显示屏。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.
可以理解的是,本申请实施例示意的结构并不构成对终端设备100的具体限定。在本申请的另一些实施例中,终端设备100还可以包括比图2更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图2中的部件可以以硬件,软件或软件和硬件的组合实现。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.
上述终端设备100的软件系统可以采用分层架构或服务架构等方式,本发明实施例以分层架构的安卓操作系统为例,示例性地说明终端设备100的软件架构。应理解的是,本申请提供的方案也可以应用于鸿蒙(Harmony)系统、苹果操作系统、windows操作系统等其它类型的操作系统。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.
图3示出了本申请实施例提供的终端设备100的软件架构示意图。如图3所示,终端设备100的分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。在一些实施例中,软架构件从上至下分别为应用程序(application,APP)层,应用程序框架(framework,FW)层,安卓运行时(android runtime,ART)和原生C/C++库,硬件抽象层(hardware abstract layer,HAL)以及内核层(kernel)。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. 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.
应用程序层,也称应用层,可以包括一系列应用程序包。例如,应用程序层包可以包括图库应用,投屏应用,视频应用和设置应用等。当上述应用程序包被运行时,可以通过应用编程接口(application programming interface,API)访问应用程序框架层提供的各个服务模块,并且执行相应的智能化业务。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.
应用程序框架层(framework,FWK)为应用程序层的应用程序提供应用编程接口(application programming interface,API)和编程框架。应用程序框架层包括一些预先定义的函数。如图3所示,应用程序框架层可以包括窗口管理器,内容提供器,视图系统,资源管理器,通知管理器,活动管理器,输入管理器等。其中,窗口管理器用于管理系统中的所有窗口;内容提供器用来存放和获取数据(比如,视频、图片等),并使这些数据可以被应用程序访问;视图系统包括可视控件,例如显示文字的控件,显示图片的控件等。显示界面可以由一个或多个视图组成的。例如,包括短信通知图标的显示界面,可以包括显示文字的视图以及显示图片的视图;资源管理器为应用程序提供各种资源,比如图片、视频文件等;通知管理器负责对手机顶部状态栏的提示信息进行管理。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 (such as videos and 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.
安卓运行时包括核心库和安卓运行时。安卓运行时负责将源代码转换为机器码。安卓运行时主要包括采用提前(ahead or time,AOT)编译技术和及时(just in time,JIT)编译技术。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 technologies.
核心库主要用于提供基本的Java类库的功能,例如基础数据结构、数学、IO、工具、数据库、网络等库。核心库为用户进行安卓应用开发提供了API。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.
原生C/C++库可以包括多个功能模块。例如:表面管理器(surface manager),媒体框架(media framework)等。其中,表面管理器用于对显示子系统进行管理,并且为多个应用程序提供了2D和3D图层的融合。媒体框架支持多种常用的音频,视频格式回放和录制,以及静态图像文件等。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.
硬件抽象层运行于用户空间(user space),对内核层驱动进行封装,向上层提供调用接口;硬件抽象层包括:显示模块、蓝牙模块、Wifi模块等。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.
内核层是硬件和软件之间的层。内核层至少包含显示驱动,蓝牙驱动、Wifi驱动等,以驱动显示屏、蓝牙和Wifi工作。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.
下面以第一设备为具有图2和图3所示结构的终端设备为例,结合图4示出的第一设备的软件架构图,示例性的,说明第一设备执行上述通信方法的整体流程。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.
该软件架构包括融合模块(或者称为远近融合层)、短距离通信模块(或称为近场通信模块)和长距离通信模块(或称为远场通信模块),其中,融合模块可以处于应用层,也可以处于框架层,实际应用中,可以根据实际场景设计,本申请不作限定;此处,以融合模块处于应用层为例,示例性说明本申请提出的通信方法;该融合模块用于控制短距离通信模块和长距离通信模块的启动和切换。需要说明的是,投屏、图片分享、文件共享等应用也运行在应用层上。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.
上述融合模块包括融合发现模块、智能决策模块和融合传输模块,其中,融合发现模块包括近场发现模块,该近场发现模块通常用于第一设备发现附近其他接收设备,比如,近场发现模块用于启动短距离通信模块发现附近其他接收设备(比如,第二设备);再比如,短距离通信模块通过广播发现功能向附近其他接收设备发送广播信息,并接收其他接收设备回复的响应信息(比如,第一响应信息);短距离通信模块通过响应信息可以确定其他设备(比如,第二设备)是否支持短距离连接和/或长距离连接;其中,关于短距离连接和长距离连接的详细介绍可以参考下文相关介绍,此处先不赘述。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.
上述智能决策模块具有近场辅助远场、远场辅助近场以及链路评级等功能,该智能决策模块用于控制近场辅助远场、远场辅助近场以及链路评级等功能的启动和模块之间的切换;其中,近场辅助远场,也可以理解为短距离连接辅助长距离连接,当长距离连接的带宽不足时,智能决策模块可以启动近场辅助远场功能,使得第一设备与附近设备(比如,第二设备)的连接状态从长距离连接切回至短距离连接。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.
远场辅助近场,也可以理解为长距离连接辅助短距离连接,比如,当短距离连接的当前通信条件(比如,连接数量、当前角色等)不满足要求时,智能决策模块可以启动远场辅助近场功能,使得第一设备与附近设备(比如,第二设备)通过长距离连接建立互连;或者,当短距离连接的传输资源不满足传输要求时,智能决策模块也可以启动远场辅助近场功能,使得第一设备与附近其他接收设备(比如,第二设备)的连接状态从短距离连接切回至长距离连接。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.
链路评级功能主要用于对当前连接链路的传输资源(比如,信号质量、时频域资源、负载等情况)进行评估,比如,智能决策模块可以启动链路评级功能对当前短距离连接的信号质量或者负载等情况进行评估,并根据评估结果确定适合当前通信需求的优选连接方式,并将优选连接方式反馈给智能决策模块;该智能决策模块可以根据优选连接方式启动相应地近场辅助远场功能或远场辅助近场功能,以便于为第一设备通过较优的连接方式与附近其他接收设备建立互连,从而为用户提供高质量的通信。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.
上述融合传输模块具有多路并行和切换等功能,其中,切换功能用于控制短距离通信模块和长距离通信模块的切换;在一些场景中,第一设备刚开始与附近设备建立的是长距离连接,但是,一段时间后,检测到远场数据传输量大、带宽不足,此时,第一设备也可以启动多路并行功能建立近场连接,比如,第一设备与第二设备既建立了长距离连接,也建立了短距离连接,从而实现多路并行(也可以称为双路并行)。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).
在一些实施例中,比如,智能决策模块确定启动远场协助近场功能,此时,智能决策模块向融合传输模块发送指示信息X1,以指示融合传输模块进行连接方式切换;此时,融合传输模块控制长距离通信模块启动,使得第一设备的连接状态从短距离连接切换至长距离连接。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.
再比如,智能决策模块确定启动近场协助远场功能,此时,智能决策模块向融合传输模块发送指示信息X2,以指示融合传输模块进行连接方式切换;此时,融合传输模块控制短距离通信模块启动,使得第一设备的连接状态从长距离连接切换至短距离连接。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.
在另一些实施例中,第一设备开启蓝牙和Wifi功能后,融合发现模块会启动短距离通信模块;该短距离通信模块通过广播发现功能发送广播信息,以发现附近其他接收设备;发现附近接收设备后,通过约束应用协议(constrained application protocol,COAP)或者低功耗蓝牙(bluetooth low energy,BLE)信令功能执行第一设备与附近设备(比如,第二设备)的信令交互和数据传输资源的协商等;第一设备通过连接&鉴权模块与附近设备(比如第二设备)建立安全连接;第一设备与附近接收设备(比如第二设备)建立安全连接之后,启动数据传输模块进行数据的发送和接收。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.
在一些场景下,当第一设备启动长距离通信模块后,长距离通信模块可以控制第一设备与第二设备建立长距离连接;其中,长距离通信模块包括远程过程调用(remote procedure call,RPC)服务和长距离P2P模块(也可以称为远场P2P模块),该RPC服务用于实现融合模块与长距离通信模块之间的交互和通讯;长距离P2P模块包括信令通道、P2P连接智能决策功能和P2P数据传输功能,其中,信令通道用于第一设备与外部设备的信令交互;P2P连接智能决策功能用于确定第一设备与附近接收设备(比如,第二设备)建立连接需要使用的打通方式。In some scenarios, after 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 is used to determine the connection method required for the first device to establish a connection with a nearby receiving device (e.g., the second device).
比如,打通方式包括P2P穿越方式和P2P中继方式,其中,P2P穿越方式,又称为P2P打洞方式,是指第一设备与第二设备建立长距离连接时,需要中间服务器作为引导,实现第一设备与第二设备的打通(即实现第一设备与第二设备的长距离连接),具体可参考下文实施例的相关描述;P2P中继方式,又称为P2P中转方式,是指第一设备与第二设备建立长距离连接时,需要中间服务器作为中转服务器,将第一设备的数据通过中间服务器转发给第二设备,相应地,第二设备通过中间服务器接收第一设备发送的数据,具体可参考下文实施例的相关描述。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.
需要说明的是,中间服务器是一种通用服务器,用于实现第一设备与第二设备建立长距离连接;此外,中间服务器可以由第三方厂商提供、也可以由第一设备的厂商提供,还可以由第二设备的厂商提供,本申请对此不作限定。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.
当第一设备与第二设备通过中间服务器打通以后(即第一设备与第二设备建立长距离连接以后),第一设备可以启动安全认证、鉴权和P2P数据传输功能,开始向第二设备传输数据。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.
需要说明的是,长距离通信模块和短距离通信模块可以处于框架层,也可以处于应用层,本申请对此不作限定,此处,以长距离通信模块和短距离通信模块处于框架层为例,介绍第一设备执行上述通信方法的过程。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.
该软件架构图还包括短距离服务(或者称为近场服务)、无线接口层(radio layer interface,RIL)、Wifi/蓝牙模块、调制解调器0、调制解调器1、Wifi和蓝牙,其中,短距离服务结合RPC服务控制调制解调器0、调制解调器1、Wifi以及蓝牙的工作,RIL用于提供长距离通信模块和短距离通信模块的通信接口,Wifi/蓝牙模块用于提供Wifi/蓝牙的通信接口。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.
需要说明的是,第一设备的软件架构不局限于图2至图4所示的软硬件系统结构,实际应用中可以根据具体应用场景对图2至图4所示的软硬件系统结构进行变形,本申请对此不作限定。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.
下面结合附图对本申请实施例提供的通信方法进行示例说明。The communication method provided in the embodiments of this application will be illustrated below with reference to the accompanying drawings.
如图5所示,为本申请实施例提供的一种通信方法500的流程示意图。在介绍本申请提供的通信方法之前,先对本申请实施例涉及的执行主体进行简单的说明。本申请中第一设备和第二设备可以为终端设备;上述通信方法可以由终端设备执行,也可以由应用于终端设备中的模块(例如处理器、芯片、或芯片系统等)执行,还可以由能实现全部或部分终端设备功能的逻辑模块或软件实现。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.
本申请实施例以第一设备(或第二设备)为终端设备为例来示意本申请提供的方法500,但本申请并不限制执行主体。需要说明的是,第一设备与第二设备均支持蓝牙、Wifi和蜂窝通信;本申请的第一设备和第二设备在执行通信方法之前,蓝牙、Wifi和/或移动数据流量处于开启状态。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.
上述方法500包括步骤501至步骤504,下面对这些步骤进行详细描述。The above method 500 includes steps 501 to 504, which are described in detail below.
步骤501,第一设备接收第一操作,第一操作用于启动分布式服务。Step 501: The first device receives the first operation, which is used to start the distributed service.
其中,第一设备通常指发起设备或主设备或共享设备,第一设备通常需要将自己的资源(比如,视频资源、文件资源、图片资源等)共享(或分享或发送)给附近其他接收设备(比如,第二设备)。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).
上述第一操作可以指用户在第一设备的显示界面上所执行的操作,该第一操作可以是手势操作,也可以是鼠标点击操作,当然也可以是遥控指令操作等,本申请对此不作限定;其中,手势操作可以是手指单击操作或者双击操作,也可以指悬浮手势操作等;需要说明的是,悬浮手势操作可以指用户手势处于悬浮状态时所做的手势操作,比如,悬浮上滑操作、悬浮慢滑操作等。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.
上述分布式服务通常运行于第一设备的应用层和/或框架层,包括但不限于投屏服务、图片分享服务、文件分享服务和键鼠穿越服务。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.
在一些实施例中,用户想要使用分布式服务,需要在第一设备上通过第一操作启动该分布式服务,比如,用户想要启动投屏服务,此时,用户需要在第一设备的设置界面上找到投屏服务的图标,并点击该图标即可启动该投屏服务。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.
步骤502,第一设备响应于第一操作,显示第二设备的图标,第二设备为基于短距离通信方式发现的支持分布式服务、短距离连接和长距离连接的设备;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.
其中,第二设备通常指接收设备或从设备或待共享设备,第二设备可以指基于短距离通信方式发现后需要建立连接以及资源共享的设备;第二设备通常处于第一设备的附近,与第一设备可以通过蓝牙、Wifi直连等方式建立短距离连接,或者与第一设备通过远场P2P方式(或者远距离P2P方式)建立长距离连接。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).
其中,短距离连接可以指第一设备通过近距离(或者短距离或近场)无线连接方式与第二设备建立连接的方式,而长距离连接可以指第一设备通过远场P2P方式与第二设备建立连接的方式;其中,近距离无线连接方式包括但不限于Wifi直连方式和蓝牙方式,远场P2P方式包括但不限于远场P2P打洞方式和远场P2P中转(或中继)方式,关于远场P2P打洞方式和远场P2P中转方式可以参考下文实施例的相关描述,此处先不赘述。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.
在一些实施例中,第一设备接收到第一操作后,响应于第一操作,通过短距离通信方式(比如,蓝牙广播方式或接收心跳包等方式)发现附近多个设备,并接收多个设备回复的响应信息,比如,在发现的多个设备中,有些设备支持分布式服务,有些设备不支持分布式服务,有些设备支持短距离连接或者长距离连接,有些设备短距离连接和长距离连接均支持。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.
再比如,在一些示例中,第一发现的多个设备均可以向第一设备回复响应信息,并通过该响应信息将自己是否支持分布式服务,以及短距离连接和/或长距离连接的情况反馈给第一设备,第一设备可以根据需求显示符合要求的设备,例如,第一设备仅显示支持分布式服务、短距离连接和长距离连接的设备。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.
在又一些示例中,在发现的多个设备中规定支持分布式服务、短距离连接和长距离连接的设备回复响应信息,比如,若第二设备既支持分布式服务,也支持短距离连接和长距离连接,则第二设备可以通过响应信息回复第一设备;第一设备收到响应信息后,将第二设备显示在显示屏(或者显示界面)上。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).
步骤503,第一设备响应于第二操作,确定当前通信条件,第二操作包括作用于第二设备的图标的操作,第二操作指示第一设备与第二设备共享数据。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.
其中,第二操作也可以指用户在第一设备的显示界面上所执行的操作,类似第一操作,第二操作也可以是手势操作或鼠标点击等操作,当然也可以是遥控指令操作等,本申请对此不作限定。比如,第二操作为手势操作,用户通过手势操作选择第二设备的图标,以触发第一设备与第二设备建立互连。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.
其中,当前通信条件包括但不限于第一设备的当量连接数量以及当前角色。用户通过第二操作选择第一设备需要共享数据(或共享资源)的第二设备;比如,第一设备支持两种与外部设备的连接方式,一种是短距离连接方式,另一种是长距离连接方式,第一设备在响应第二操作时,需要判断当前通信条件,以进一步确定采用哪种连接方式与第二设备建立连接。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.
需要说明的是,当前连接数量为第一设备已建立的短距离连接的数量,数量阈值为第一设备支持的短距离连接的最大数量。比如,短距离连接为蓝牙连接,第一设备通过蓝牙方式最多可连接的外部设备数量为7(即数量阈值为7);若第一设备通过蓝牙方式已经与5个外部蓝牙设备建立连接,则当前连接数量为5,剩余可用的连接数量为2;理论上,第一设备与第二设备建立连接,既可以通过蓝牙方式建立连接,也可以通过长距离连接方式建立连接;通常情况下,第一设备可以先通过蓝牙方式与第二设备建立连接,在蓝牙链路信号不好或者近场负载过多的情况下,可以选择长距离连接的方式;当然,也可以先通过长距离连接的方式与第二设备建立连接,当长距离连接所使用的带宽不足时,再使用蓝牙方式建立连接。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.
上述共享数据(或互发数据)包括但不限于图片数据、文件数据、视频数据、音频数据和控制数据。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.
步骤504,当当前通信条件不满足短距离连接要求时,与第二设备建立第一长距离连接。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.
上述短距离连接要求包括但不限于当前连接数量的要求和当前角色的要求,其中,当前连接数量的要求可以指当前连接数量不大于数量阈值的要求;当前角色的要求可以指当前角色允许连接外部的要求。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.
当第一设备判断当前通信条件不满足短距离连接要求时,说明第一设备暂时不能通过短距离连接与第二设备建立连接;此时,第一设备可以通过长距离连接与第二设备建立第一长距离连接。其中,第一长距离连接是指第一设备通过远场P2P方式与第二设备建立连接的过程。当第一设备与第二设备建立长距离连接后,就可以进行后续服务发现、安全认证处理和数据传输过程。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.
综上所述,在方法500中,第一设备响应于第二操作,确定当前通信条件是否满足短距离连接要求,当当前通信条件不满足短距离连接要求时,说明第一设备暂时无法通过短距离连接与第二设备建立互连,为了第一设备可以并发连接更多的外部设备(比如,第二设备),第一设备可以使用长距离连接的方式与第二设备建立第一长距离连接,从而避免因当前通信条件不满足短距离连接要求而导致设备并发连接数量受限的问题。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.
在方法500中,短距离通信方式可以包括但不限于短距离无线通信方式和发送心跳包的方式;其中,短距离无线通信方式包括但不限于蓝牙广播方式和局域网方式。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.
比如,在一些实施例中,如图6A所示,第一设备可以通过短距离无线通信方式发现附近的接收设备(比如,第二设备);例如,对于第一设备与第二设备连接在同一个路由器(即第一设备与第二设备处于同一个局域网内)的情况,第一设备可以使用局域网方式给附近处于同一网段的终端设备发送广播信息,以请求与已发现的终端设备(比如,第二设备)建立互连;再例如,第一设备也可以通过蓝牙广播方式给附近的终端设备发送广播信息,以请求与已发现的终端设备(比如,第二设备)建立互连。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).
在另一些实施例中,当第一设备需要与附近同账号的设备建立分布式服务时,第一设备可以通过接收附近同账号的设备发送的心跳包来确定与该设备建立连接的方式。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.
需要说明的是,同账号的设备可以指设备的账号信息(比如,账号名称、账号密码等)与第一设备的账号信息一致。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.
比如,上述第二设备为第一设备附近同账号的设备中的一个,第二设备可以通过蓝牙广播心跳包(或者蓝牙发送心跳包)的方式通知第一设备自己当前的状态信息(比如,在线状态、能力信息等),该心跳包包括第二设备的能力信息,其中,能力信息包括但不限于是否支持分布式服务、短距离连接和长距离连接。例如,第二设备通过蓝牙广播心跳包,第一设备接收到该心跳包,并对该心跳包进行解析,得到能力信息;当该能力信息指示第二设备支持分布式服务、短距离连接和长距离连接时,说明第一设备可以确定第二设备既支持短距离连接也支持长距离连接;此时,第一设备可以根据当前通信条件是否满足短距离连接要求,确定与第二设备建立连接的方式。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.
例如,当当前通信条件满足短距离连接要求时,第一设备可以与第二设备建立短距离连接(比如,第一短距离连接);当当前通信条件不满足短距离连接要求或者短距离连接(比如,第一短距离连接)的传输资源不满足传输要求时,第一设备可以与第二设备建立长距离连接。当然,第一设备与第二设备也可以既有短距离连接也有长距离连接,并以双路并行的方式进行数据传输。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.
需要说明的是,由于第一设备与第二设备属于同账号的设备,因此,第一设备有第二设备的第三标识;比如,第一设备的本地存储有第二设备的第三标识;当第一设备需要与第二设备建立长距离连接时,可以直接根据第三标识与第二设备建立长距离连接。其中,第一设备与第二设备建立短距离连接和长距离连接的方式,可以参考下文实施例,此处先不赘述。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.
在一些实施例中,如图6B所示,第一设备通过短距离通信方式发现附近的多个接收设备后,一方面,可以通过短距离连接与接收设备建立互连,另一方面,可以通过长距离连接与接收设备建立互连,比如,第一设备通过短距离连接与接收设备1(或接收设备2等)建立互连,第一设备通过长距离连接与接收设备n-1(或接收设备n等)建立互连,其中,n为大于1的正整数。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.
在另一些实施例中,如图7A所示,第一设备发现2个接收设备(即第二设备和第三设备)后,可以通过短距离连接分别与第二设备和第三设备建立互连;需要说明的是,第一设备、第二设备和第三设备处于同一局域网(或者说同一路由器)下,第一设备至第三设备通过路由器与云服务集群中的服务器进行通信;比如,实际应用中,第一设备(或第二设备或第三设备)通过家庭路由器的有线或者无线资源加入家庭局域网中,路由器再通过小区宽带接入,将家庭局域网与外部因特网(internet)进行互连,从而实现日常上网的需求。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.
比如,如图7B所示,以家庭局域网中的第一设备为例,简单介绍一下第一设备接入外部网络(比如,城域网)的过程;第一设备通过处于接入汇聚层的无源光网络(passive optical network,PON)系统接入处于业务控制层的宽带接入服务器(broadband remote access server,BRAS);BRAS对第一设备进行认证鉴权、建立会话,并对用户上网进行管理和计费;其中,接入汇聚层包括PON系统和交换机(switch,SW),用于管理用户的接入;业务控制层包括BRAS和业务路由器(service router,SR),用于处理业务分发和调用等;核心层包括核心路由器(core router,CR);城域网和骨干网构成整个传输网的主干,负责把各地的家庭用户、政企用户和数据中心连接起来。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.
还需要说明的是,第一设备和附近发现的接收设备(比如,第二设备)所处的网络可能不同;比如,如图8A所示,第一设备通过基站1接入,经承载网分别连接至核心网和骨干网;第二设备通过基站2接入,经承载网分别连接至核心网和骨干网络,换句话说,第一设备和第二设备可以使用移动数据流量上网;当第一设备与第二设备需要建立长距离连接时,可以使用移动数据流量进行互相通信。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.
再比如,如图8B所示,第一设备通过基站路由器连接至云服务集群中的服务器1;第二设备通过基站接入,经核心网连接至云服务集群中的服务器2;服务器1和服务器2可以互相通信;换句话说,第一设备可以通过Wifi上网,第二设备可以使用移动数据流量上网;当第一设备与第二设备需要建立长距离连接时,第一设备可以通过服务器1与服务器2协商与第二设备建立长距离连接;例如,用户1的平板使用的是Wifi登录APP1,用户1的手机使用移动数据流量登录APP2,虽然平板和手机使用的通信网络不同,但是,平板和手机仍然可以通过远场P2P方式建立连接,以实现APP1与APP2的互相通信。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.
如图9所示,在一些实施例中,上述通信方法500还包括:步骤505和步骤506,具体如下:As shown in Figure 9, in some embodiments, the communication method 500 further includes steps 505 and 506, as detailed below:
需要说明的是,步骤505和步骤506在第一设备显示第二设备的图标之前执行。It should be noted that steps 505 and 506 are executed before the icon of the second device is displayed on the first device.
步骤505:第一设备发送广播信息,相应地,第二设备接收该广播信息,其中,第二设备为第一设备附近的一个设备;广播信息包括第一标识、第一请求信息和第二请求信息,第一标识为第一设备的标识,第一请求信息用于询问是否支持分布式服务,第二请求信息用于询问是否支持短距离连接和/或长距离连接。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.
其中,广播信息可以是蓝牙广播信息,也可以是Wifi的UDP广播信息,当然也可以是其他短距离连接方式的广播信息,本申请对此不作限定。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.
上述第一标识,又称为第一设备标识符,用于标识第一设备的唯一身份,它可以是一串字符,例如,数字串、字母串或者混合字符串(包括数字、字母和特殊字符);比如,第一标识为0001041005或者5157RQ0194。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.
上述第一请求信息(或第二请求信息)可以通过广播信息中的字段携带,比如,广播信息中的某些字段可以用于携带第一请求信息。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.
需要说明的是,短距离连接,也可以替代描述为近场连接或近距离连接;长距离连接,也可以替代描述为远场连接或远距离连接或远场P2P连接;当然,短距离连接和长距离连接也可以有其他本质含义相近的描述,本申请对此不作限定。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.
在一些实施例中,第一设备可以通过广播方式向周围(或附近)的设备发送广播信息,附近的设备接收到该广播信息后,会对该广播信息进行解析;比如,第二设备为第一设备附近的一个设备,第二设备接收到广播信息后,根据第一请求信息判断自己是否支持分布式服务,以及根据第二请求信息判断自己是否支持短距离连接和/或长距离连接。若第二设备同时支持分布式服务、短距离连接和长距离连接,则第二设备可以通过向第一设备回复响应信息(比如,第一响应信息)告诉第一设备自己支持哪些服务能力。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).
步骤506:第一设备接收第一响应信息,相应地,第二设备发送第一响应信息,该第一响应信息包括第二标识、第一指示信息和第二指示信息,第一指示信息指示第二设备支持分布式服务,第二指示信息指示第二设备支持短距离连接和/或长距离连接,第二标识为第二设备的标识。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.
其中,第一响应信息的信息结构可以使用表1的数据结构形式,比如,第一响应信息中的第二标识可以通过设备标识(DeviceId)字段携带,第一指示信息可以通过第一指示字段携带、第二指示信息可以通过第二指示字段携带;当然,第一响应信息使用表1的数据结构回复响应信息时,除了一些必选字段以外,还可以携带其他的字段(比如,账户标识字段等),本申请对此不作限定。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.
需要说明的是,第二标识的作用以及构成与第一标识类似,可以参考第一标识的相关描述,此处不再赘述。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.
表1
Table 1
在一些实施例中,第二设备向第一设备发送第一响应信息时,可以根据广播信息指示的内容进行回复;比如,第一响应信息可以包括第二标识、第一指示信息和第二指示信息,以回复第一设备支持分布式服务、支持短距离连接和/或长距离连接。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.
需要说明的是,第一指示信息和第二指示信息可以通过不同字段携带,也可以通过同一字段携带,本申请对此不作限定。类似地,第一请求信息和第二请求信息也可以通过不同字段携带或者同一字段携带,本申请对此不作限定。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.
在另一些实施例中,第一设备在回复第一响应信息时,还可以包括第三标识,其中,第三标识可以指第二设备在业务云上(或远端云服务器上)分配的令牌(token)值;该第三标识用于第一设备与第二设备建立第一长距离连接;虽然第一设备发送的广播信息并未明确指示第二设备发送第三标识,但是,第二设备回复时携带第三标识的方式,有利于:当第一设备需要与第二设备建立长连接时,可以调取本地事先保存的第三标识,而无需通过新的消息或者控制信令来获取第三标识,从而减少了资源消耗。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.
需要说明的是,当广播信息不包括联系人信息时,接收到该广播信息的接收设备(比如,第二设备),如果判断支持分布式服务以及支持短距离连接和长距离连接,均可以向第一设备发送第一响应信息;换句话说,向第一设备回复响应信息(比如,第一响应信息)的接收设备(比如,第二设备)可能是第一设备的好友设备(或联系人设备),也可能不是第一设备的好友设备;其中,好友设备(或联系人设备)可以指第一设备的联系人对应的设备;联系人信息包括至少一个联系人信息,该联系人信息用于确定附近的接收设备(比如,第二设备)是否为联系人对应的设备;该联系人信息可以是联系人标识的哈希值,也可以是其他数据形式的信息,本申请对此不作限定。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.
需要说明的是,在一些情况下,用户可能希望将数据(比如,文件、视频等)分享给自己的好友设备,此时,第一设备在广播信息时可以携带联系人信息,以便于附近设备(比如,第二设备)根据广播信息中的联系人信息判断自己是否属于第一设备的好友设备(即第一设备的联系人对应的设备)。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.
比如,在步骤505中,当广播信息包括联系人信息时,第二设备根据联系人信息判断后,若自己为第一设备的联系人对应的设备时,则向第一设备发送第一响应信息,若不是,则第二设备可以不向第一设备发送第一响应信息,也可以在回复第一响应信息时,指示自己不属于第一设备的好友设备,以便于第一设备在显示第二设备时,可以根据第二设备是否为好友设备而为第二设备确定合适的显示区域(比如,若第二设备为好友设备,则将第二设备显示在好友设备区域,若第二设备不是好友设备,则将第二设备显示在其他设备区域,可以参考下文界面实施例)。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).
在又一些实施例中,为了第一设备必要时能与第二设备快速建立起长距离连接,以确保通信质量,第一设备在发送广播信息时,会携带第三指示信息,以指示第二设备在回复第一响应信息时,可以携带自己对应的第三标识;相应地,第二设备接收到广播信息时,会根据第三指示信息在第一响应信息中携带第三标识;这样第一设备可以将第一响应信息中携带的第三标识存储在本地,以方便拉起长距离连接时使用。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.
在一些实施例中,第一设备接收到第一响应信息后,步骤502还可以通过步骤507执行:In some embodiments, after the first device receives the first response information, step 502 can also be performed via step 507:
步骤507:第一设备根据第一响应信息显示第二设备的图标。Step 507: The first device displays the icon of the second device based on the first response information.
其中,第二设备的图标用于启动第一设备与第二设备建立连接,以实现分布式服务的资源共享的目的;第二设备的图标可以通过用户手势操作启动,也可以通过鼠标等点击启动。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.
在一些实施例中,当广播信息不包括联系人信息时,第一设备接收到第一响应信息后,直接将第二设备的图标显示在“可用设备”区域。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.
在另一些实施例中,当广播信息不包括联系人信息时,第二设备在回复第一响应信息时,可以携带自己的账号名称的哈希值;当第一设备接收到第一响应信息后,根据第二标识和账号名称的哈希值判断第二设备是否为好友设备,若是,则将第二设备的图标显示在“好友设备”区域,若不是,则将第二设备的图标显示在“其他设备”区域。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.
可选的,在一些实施例中,第一设备还可以根据第二标识和账号名称的哈希值判断第二设备是否自己的同账号的设备,若是,则将第二设备的图标显示在“我的设备”区域。比如,第一设备可以比较第二设备的账号名称与自己的账号名称,若两者名称一致,则说明第二设备为自己的同账号设备。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.
在另一些实施例中,第一设备可以与附近同账号的设备(比如,第二设备)建立连接(比如,短距离连接或长距离连接等),具体可参考上文相关描述,此处不再赘述;第一设备可以将同账号的第二设备的图标显示在“我的设备”区域;在一些情况下,当用户在“我的设备”区域选择第二设备的图标时,第一设备可以从本地获取第三标识,并通过第三标识与第二设备建立起长距离连接;在另一些情况下(比如,在当前通信条件满足短距离连接要求的情况下),当用户在“我的设备”区域选择第二设备的图标时,第一设备可以与第二设备建立起短距离连接。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.
在又一些实施例中,当广播信息包括联系人信息时,第二设备接收到该广播信息时,根据联系人信息判断自己是否为第一设备的好友设备;当第二设备是第一设备的好友设备时,第二设备才回复第一响应信息,该第一响应信息可以包括第二设备的账号名称;当第一设备接收到第一响应信息后,可以根据第二设备的账号名称判断第二设备是不是自己(即第一设备对应的)的好友设备或者自己的同账号的设备,若是第一设备的同账号的设备,则将第二设备的图标显示在“我的设备”区域;若是第一设备的好友设备,则将第二设备的图标显示在“好友设备(或联系人设备)”区域;若两者都不是,则将第二设备的图标显示在“其他设备”区域。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.
需要说明的是,关于第一设备显示第二设备的图标的方式,可以参考下文界面实施例,此处先不赘述。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.
在一些实施例中,上述步骤506中的广播信息还包括第一信道信息,其中,第一信道信息为第一设备当前所使用的短距离连接的信道的信息。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.
在一些实施例中,第一信道信息可以指蓝牙广播信道信息,当然也可以指其他短距离通信的信道信息,本申请对此不作限定。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.
在一些情况下,第一设备在发送广播信息时,可以将第一信道信息携带在广播信息中,以便于附近其他设备(比如,第二设备)确定是否可以通过信道复用方式与第一设备建立短距离连接。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.
相应地,第二设备在接收到包括第一信道信息的广播信息后,先判断自己当前正在使用的短距离连接的信道(即第二信道信息所指示的短距离连接的信道)与第一信道信息所指示的短距离连接的信道是否相同;若相同,则说明第一设备与第二设备可以通过信道复用方式建立短距离连接,而不需要建立长距离连接;此时,第二设备确定先不获取第三标识,并在回复第一响应信息时,可以不用携带第三标识;由于第二设备先不用从远端服务器获取第三标识,因此可以节省部分网络资源用于其他业务数据传输;若不相同,则说明第一设备与第二设备不可以通过信道复用方式建立短距离连接,可能需要建立长距离连接;但是,需要说明的是,第一设备与第二设备还可以通过其他信道建立短距离连接,本申请对此不作限定;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.
比如,第一设备通过长距离连接与第二设备建立互连,此时,第二设备需要从远端服务器获取第三标识,并在回复第一响应信息时,携带该第三标识。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.
当第一设备接收到附近其他接收设备(比如,第二设备)回复的响应信息(比如,第一响应信息)后,需要判断当前通信条件,并根据当前通信条件的具体情况,确定使用哪种连接方式与各个接收设备建立互连。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.
在步骤503中,第一设备确定当前通信条件,包括:确定当前连接数量,其中,当前连接数量为第一设备已建立的短距离连接的数量,数量阈值为第一设备支持的短距离连接的最大数量。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.
在一些情况下,第一设备的当前连接数量达到数量阈值后,无法再通过短距离连接与附近其他设备建立连接;此时,第一设备接收到第二操作后,会确定当前连接数量;当当前连接数量已经达到数量阈值(即当前连接数量等于数量阈值),说明第一设备的前通信条件不满足短距离连接要求,不能使用短距离连接与第二设备建立连接;当当前连接数量小于数量阈值时,说明第一设备的前通信条件满足短距离连接要求,可以使用短距离连接与第二设备建立连接;由此可见,第一设备通过对当前连接数量的判断,可以为第二设备确定可用的连接方式,从而避免无法建立连接的情况出现。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.
比如,第一设备通过蓝牙方式最多与7个外部蓝牙设备建立连接,若当前连接数量已经达到7个,则第一设备的当前通信条件已经不满足与第二设备建立蓝牙连接了,此时,需要通过长距离连接与第二设备建立互连。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.
在一些实施例中,即使当前连接数量并未达到数量阈值,但是由于第一设备的当前角色的限制,导致第一设备暂时不能与附近其他设备建立连接;此时,第一设备在确定当前连接数量之前,会先确定第一设备的当前角色;当当前角色允许第一设备连接第二设备时,才确定当前连接数量,或者,当当前角色不允许第一设备连接第二设备时,不确定当前连接数量,从而避免因角色限制而导致无法建立连接的情况出现。比如,在Wifi直连场景下,若第一设备的角色为GC,则第一设备是不允许连接第二设备的。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.
在又一些实施例中,第一设备可以先确定第一设备的当前角色是否可以连接外部设备;比如,当第一设备确定自己的当前角色不允许第一设备连接第二设备时,确定当前通信条件不满足短距离连接要求,若第一设备与第二设备建立互连,则需要使用长距离连接;再比如,当第一设备确定自己的当前角色允许第一设备连接第二设备时,确定当前通信条件满足短距离连接要求。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.
比如,第一设备的当前角色为GC,第二设备的角色也是GC,此时,第一设备的当前角色不允许与第二设备通过短距离连接(比如,蓝牙方式或者Wifi直连方式)建立互连,此时,第一设备可以通过长距离连接(比如,远场P2P方式)与第二设备建立互连。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).
在一些情况下,即使第一设备的当前角色允许第一设备与附近其他设备(比如,第二设备)建立连接,但是由于当前连接数量的限制,导致第一设备暂时不能与附近其他设备建立连接;因此,第一设备在确定第一设备的当前角色之前,会先确定当前连接数量;当当前连接数量小于数量阈值时,说明当前通信条件满足短距离连接要求,再判断当前角色是否允许连接第二设备,由此可以避免因当前连接数量限制而导致无法建立连接的情况出现。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.
比如,第一设备的当前角色为GO,第二设备的角色是GC,第一设备的当前角色允许与第二设备通过Wifi直连方式建立互连;但是,第一设备通过Wifi直连方式可以连接的设备数量已经达到上限(即数量阈值),第一设备不能通过Wifi直连方式与第二设备建立互连,此时,可以通过长距离连接(比如,远场P2P方式)与第二设备建立互连。当第一设备使用Wifi直连方式连接的当前连接数量未达到数量阈值时,说明当前通信条件满足短距离连接要求,则可以与第二设备通过Wifi直连方式建立互连。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.
需要说明的是,在一些场景下,当前通信条件满足短距离连接要求时,第一设备可以与第二设备优先通过短距离连接建立第一短距离连接,以降低数据共享的资源成本。其中,第一短距离连接可以是蓝牙连接,也可以是Wifi直连,也可以是其他短距离连接方式,本申请对此不作限定。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.
在另一些场景中,虽然第一设备与第二设备已经建立了第一短距离连接(比如,蓝牙连接),但是,当第一短距离连接的传输资源不满足传输要求时,第一设备可以从短距离连接快速切换至长距离连接,与第二设备建立第二长距离连接,从而确保第一设备与第二设备之间的通信质量。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.
其中,传输资源包括但不限于信号强度、负载数量、数据大小(比如,视频文件大小、图片大小等)传输速率、传输时间和信道质量。第二长距离连接可以指远场P2P连接。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.
比如,当第一短距离连接的传输速率小于速率阈值(比如,100Kb/s)时,第一设备可以从短距离连接切换至长距离连接,并通过第三标识与第二设备建立第二长距离连接,以确保第一设备与第二设备之间的通信质量。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.
再比如,在第一设备通过第一短距离连接与第二设备传输高清视频数据时,由于高清视频数据文件过大,若使用短距离连接,则不仅传输时间长,还有可能中断,此时,第一设备可以根据第三标识与第二设备建立起长距离连接,这样第一设备不仅可以通过第一短距离连接向第二设备传输高清视频数据,也可以通过长距离连接向第二设备传输高清视频数据,这种双路并行的数据传输方式,不仅传输效率高,还可靠性高。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.
当然,当第一设备向第二设备传输的数据量较大时,第一设备也可以从短距离连接切换至长距离连接,以通过长距离连接的通信链路来传输较大数量级的数据。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.
在一些实施例中,第一设备与第二设备已经建立了短距离连接的通信链路(比如,蓝牙通信链路、Wifi直连通信链路),但是,当短距离连接突然中断(比如,第一设备在向第二设备传输数据期间,第一设备被用户拿走,第一设备可能与第二设备的短距离连接会中断)或者短距离连接的传输资源不满足传输要求(比如,第一设备向第二设备共享的文件过大,传输时间过长)时,第一设备可以与第二设备通过长距离连接建立互连。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.
在一些情况下,第一设备未从第二设备接收到第三标识(也即第二设备未向第一设备发送第三标识),此时,第一设备可以通过第一短距离连接的通信链路获取第二设备的第三标识,以便于在短距离连接突然中断或者短距离连接的传输资源不满足传输要求时,第一设备可以与第二设备快速建立起长距离连接,以确保数据的正常传输。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.
比如,如图10所示,第一设备通过第一短距离连接的通信链路获取第三标识,并在短距离连接突然中断或短距离连接的传输资源不满足传输要求或需要双路并行数据传输时,根据第三标识与第二设备建立第二长距离连接的流程步骤: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:
步骤1001:第一设备通过第一短距离连接的通信链路向第二设备发送控制信息,其中,控制信息包括第一标识和指令信息,指令信息用于指示第二设备发送第三标识,第三标识还用于与第二设备建立第二长距离连接。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.
其中,第一短距离连接的通信链路可以是第一设备与第二设备通过蓝牙连接建立的蓝牙控制链路(或蓝牙数据通道),也可以是第一设备与第二设备通过Wifi直连建立的Wifi控制链路(或Wifi数据通道)。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.
上述控制信息可以是一些蓝牙或者Wifi等短距离通信的信令,也可以是一些协议层的请求信息,实际应用中,也可以是一些其他的消息或者信息形式,本申请对此不作限定。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.
第一设备通过已经建立的短距离连接的通信链路向第二设备发送控制信息,该控制信息携带指令信息,该指令信息用于指示第二设备向第一设备发送第三标识,其中,第三标识可以以响应信息的形式回复,也可以通过信令发送,本申请对此不作限定。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.
步骤1002:第一设备接收第二设备的第二响应信息,第二响应信息包括第二标识和第三标识,第二标识为第二设备的标识。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.
第一设备向第二设备发送控制信息后,第二设备根据指令信息,从本地或者服务器侧获取第三标识,并将第三标识通过第二响应信息发送给第一设备。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.
步骤1003:第一设备根据第三标识与第二设备建立第二长距离连接。Step 1003: The first device establishes a second long-distance connection with the second device based on the third identifier.
需要说明的是,第一设备获取到第三标识后,可以立即与第二设备建立起第二长距离连接,也可以在第一短距离连接中断后再建立第二长距离连接,本申请对此不作限定。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.
实际应用中,可以预先设置切换规则,比如,当短距离连接中断时,第一设备可以使用第三标识与第二设备建立长距离连接;也可以在短距离连接的传输资源不满足传输要求或需要双路并行数据传输时,第一设备与第二设备建立长距离连接,以通过长距离连接辅助短距离连接完成数据传输;换句话说,无论是以下哪一种场景:短距离连接突然中断、短距离连接的传输资源不满足传输要求或需要双路并行数据传输,第一设备通过第三标识与第二设备建立的第二长距离连接,既可以单独作为一种传输方式完成第一设备与第二设备之间的数据传输,也可以辅助短距离连接(即短距离连接可以不断开)以双路并行的方式完成第一设备与第二设备之间的数据传输。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.
作为一种示例,第一设备接收和解析第二响应信息,并将第二响应信息中的第三标识存储在本地;当需要与第二设备建立第二长距离连接时,可以通过第三标识快速拉起与第二设备的长距离连接;其中,长距离连接可以远场P2P打洞的连接方式(即远场P2P打洞方式),也可以是远场P2P中转的连接方式(即远场P2P中转方式)。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 is necessary 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).
示例性地,如图10所示,第一设备与第二设备可以通过远场P2P中转方式建立第二长距离连接,具体包括(前提条件是第一设备和第二设备分别与中转服务器可以互相通信):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):
步骤1004:第一设备向中转服务器发送请求信息X1,该请求信息X1包括第一标识和第二标识,该请求信息X1用于请求中转服务器向第二设备转发来自第一设备的共享数据。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.
需要说明的是,由于第一设备与第二设备已经建立了短距离连接,因此,第一设备有第二设备的标识(即第二标识)。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).
步骤1005:中转服务器接收到请求信息X1,向第二设备发送指示信息R1,该指示信息R1包括第一标识,该指示信息R1用于通知第二设备准备接收第一设备通过中转服务器发送的数据。第二设备接收到指示信息R1后,可以为接收第一设备通过中转服务器发送的数据分配存储资源、时频域资源等。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.
由此可见,在第一短距离连接的传输资源不满足传输要求时,第一设备可以通过第一短距离连接的通信链路向第二设备发送控制信息,以获取第二设备的第三标识;由于第三标识是第一设备通过已建立的第一短距离连接的通信链路获取的,而无需再通过蓝牙广播方式获取第三标识,交互方式简单、资源消耗小。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.
由于当前互联网存在一些中间件(比如,网络地址转换插件和防火墙),使得第一设备与第二设备无法直接通信;若第一设备与第二设备需要建立长距离连接,则需要借助服务器打洞或中转,才能实现第一设备与第二设备的互联。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.
下面结合图11A和图11B介绍两种长距离连接的方式,其中,一种是远场P2P打洞方式(或远场P2P穿越方式),另一种是远场P2P中转方式(或远场P2P中继方式),需要说明的是,远场P2P打洞方式不局限于图11A所示出的方式,图11A仅给出了两个设备处于不同网络地址转换(network address translation,NAT)下的远场P2P打洞方式,对于两个设备处于同一NAT或者处于多级NAT的远场P2P打洞方式也可以实现第一设备与第二设备的互相通信,本申请对此不做限定。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) conditions. 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.
如图11A所示,示出了一种远场P2P打洞方式的架构示意图;图11A中,第一设备和第二设备的地址都是内网地址,且处于不同的路由器(即处于不同的NAT)下面,其中,第一设备处于路由器1下面,第二设备处于路由器2下面;第一设备(或第二设备)可以与服务器(即中间服务器的一个示例)互相通信。第一设备、第二设备上运行的分布式服务(或共享应用或P2P应用)和服务器均使用了X端口0001(比如,UDP端口0001),第一设备和第二设备分别初始化了与服务器的X通信,地址映射如图11A所示;比如,第一设备与第二设备建立一个通信连接(比如,通信会话)。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).
当第一设备给第二设备的公网地址2发送信息S1时,给服务器的公网地址3发送一个中继请求R1;该中继请求R1包括第二标识,服务器可以根据第二标识定位到第二设备;该中继请求R1用于请求第二设备给第一设备的公网地址1发送信息S2。该第二设备向第一设备发送的信息S2会使得路由器1打开一个第一设备的内网地址与第二设备的公网地址2之间的新通信会话(比如,新的UDP通信会话),以便于第一设备通过新通信会话将信息S1发送给第二设备;类似地,当第二设备向第一设备的公网地址1发送信息S3时,给服务器的公网地址3发送一个中继请求R2;该中继请求R2包括第一标识,服务器可以根据第一标识定位到第一设备;该中继请求R2用于请求第一设备给第二设备的公网地址2发送信息S4;该第一设备向第二设备发送的信息S4会使得路由器2打开一个第二设备的内网地址与第一设备的公网地址1之间的新通信会话(比如,新的UDP通信会话),以便于第二设备通过新通信会话将信息S3发送给第二设备。当新通信会话在两个方向都打开之后,第一设备和第二设备就可以直接通信,即第一设备与第二设备实现穿越(或第一设备与第二设备打洞成功),成功建立长距离连接,后续设备之间的数据传输无须再通过服务器中转,数据传输时延小、效率高。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.
如图11B所示,示出了一种远场P2P中转方式的架构示意图;其中,远场P2P中转方式是指通过一个有公网互联网协议(internet protocol,IP)地址的服务器S作为中转服务器(即中间服务器的一个示例),对第一设备和第二设备的数据进行转发(或中继传递),其中,服务器S是云服务集群中的一个服务器。由于第一设备与第二设备不直接通信,第一设备和第二需要先分别服务器S建立连接,比如,第一设备通过路由器1与服务器S进行连接,形成通信链路1;第一设备通过通信链路1向服务器S发送中转请求R2;该中转请求R2包括第三标识和请求信息1,其中,请求信息1用于指示服务器S通过通信链路1中转来自第二设备的数据;第二设备通过路由器2与服务器S进行连接,形成通信链路2;服务器S通过通信链路2接收服务器S发送中转请求R3,该中转请求R3包括第一标识和请求信息2,请求信息2用于指示第二设备通过通信链路2接收服务器S中转来的第一设备的数据;由于服务器S分别与第一设备和第二设备建立了通信链路1和通信链路2,因此,第二设备可以通过通信链路2接收第一设备通过服务器S转发的分布式服务的数据,相应地,第一设备也可以通过通信链路1接收第二设备通过服务器S发送的数据,至此,第一设备与第二设备通过服务器S建立了长距离连接。这种第一设备通过服务器中转来与第二设备建立长距离连接(比如,第一长距离连接),不仅能够实现数据快速安全的传输,还能提高网络连接的稳定性。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 device and the second device. 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.
上面详细介绍了通信方法500,下面结合界面实施例,以第一设备为手机1、第二设备为手机2为例,介绍一下方法500在投屏场景和图片分享场景中的应用。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.
如图12A所示,用户A可以在手机1(即第一设备的一个示例)的状态控制栏1201中,开启Wifi、蓝牙和移动数据流量;打开Wifi、蓝牙和移动数据流量后,如图12B所示,用户A可以在手机1的主界面上点击“设置”图标1202,此时,手机1进入设置界面1203,如图12C所示;当用户在设置界面1203上点击投屏选项1204时,手机1从设置界面1203上接收到点击操作,并响应于该点击操作进入投屏界面1205,如图12D所示;用户A可以在投屏界面1205上进行权限设置,比如,可以在远场连接方式选项中设置手机1在建立长距离连接时使用的流量方式:一种是使用蜂窝或Wifi;另一种是蜂窝和Wifi(即蜂窝&Wifi)两种方式均使用;其中,蜂窝可以理解为手机1使用移动数据流量方式与附近的其他设备(比如,第二设备)建立长距离连接,Wifi可以理解为手机1使用Wifi方式与附近的其他设备(比如,第二设备)建立长距离连接;再比如,在搜索权限选项中设置仅联系人或者所有人,其中,在用户A设置为“仅联系人”的情况下,手机1在向附近设备发送广播信息时,可以携带联系人信息,具体可以参考上文步骤506介绍中关于广播信息携带联系人部分的相关描述;相应地,手机1接收到附近的接收设备(比如,第二设备)回复的响应信息时,可以将好友设备显示在“好友设备”区域,而非好友设备显示在“其他设备”区域,具体可以参考上文步骤506介绍中关于第一设备显示第二设备部分的相关描述。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.
比如,如图12D所示,用户A在投屏界面1205的远场连接方式选项中设置“蜂窝&Wifi”选项1206,以及在搜索权限选项中设置“仅联系人”选项1207,然后点击“开始搜索”按钮,此时,手机1开始执行上述方法500中发送广播信息的步骤;由于用户选择了“仅联系人”选项,因此,手机1在发送广播信息时可以携带联系人信息;搜索过程中,投屏界面1205上可以显示“正在搜索”的时间(比如,12秒)等信息;当手机1搜索到符合要求的设备(即支持分布式服务、短距离连接和长距离连接的设备)时,即手机1接收到附近的接收设备(比如,第二设备)发送的响应信息(比如,第一响应信息),此时,手机1可以与符合要求的设备建立互连,并将符合要求的设备显示在图13A所示的“设备显示界面1301”上,如图13A所示。需要说明的是,当手机1会与符合要求的设备建立长距离连接时,由于用户选择了“蜂窝&Wifi”选项,因此,手机1既可以通过蜂窝方式与符合要求的设备建立长距离连接,也可以通过Wifi方式与符合要求的设备建立长距离连接,手机1可以根据当前网络环境的情况,使用合适的流量方式与符合要求的设备建立长距离连接。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.
还需要说明的是,在限定只有符合要求的好友设备才可以回复响应信息的情况下,手机1在显示符合要求的设备时,可以将符合要求的我的设备与符合要求的好友设备分开显示,比如,如图13A所示,在设备显示界面1301的“我的设备”区域显示我的设备的图标和在“好友设备”区域显示好友设备的图标,其中,“我的设备”是手机1附近的同账号的设备;在不限定只有符合要求的好友设备才可以回复响应信息的情况下,手机1在显示符合要求的设备时,可以将我的设备、好友设备和非好友设备分开显示,比如,如图13B所示,在设备显示界面1301上除了显示“我的设备”的图标和“好友设备”的图标,还在“其他设备”区域显示其他设备的图标,其中,“其他设备”区域显示的是除好友设备和我的设备以外的设备的图标,具体可以参考上文步骤506和步骤507中关于第一设备显示第二设备部分的相关描述。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.
在又一些实施例中,如图13C所示,用户A在投屏界面1205的权限设置选项中选择“所有人”选项1302,然后点击“开始搜索”按钮进行搜索;当手机1搜索到符合要求的多个接收设备时,无论这些接收设备是否为好友设备,手机1都会将这些设备的图标显示在“可用设备”区域,如图13D所示,具体可以参考上文步骤507中关于第一设备显示第二设备部分的相关描述。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.
比如,如图13D所示,用户A选择002设备(如图13D中的1303所示),并点击“请求投屏1304”按钮进行投屏连接;此时,手机1执行上述方法500中的步骤503和步骤504;与此同时,设备显示界面1301出现“连接中…”的状态信息1401,如图14A所示;当设备显示界面1301出现“已连接”的状态信息1402时,说明手机1与002设备已经建立连接,如图14B所示;但是,这种显示方式,用户只知道手机1与002设备建立了互连,而无法知道手机1与002设备当前正在使用的连接方式;因此,在一种可选的实现方式中,手机1在与002设备建立互连后,可以在设备显示界面1301上实时显示当前正在使用的连接方式,比如,短距离连接或长距离连接或双路并行,以便于用户及时知道手机1与002设备当前正在使用的连接方式。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.
比如,以用户A选择手机1与002设备建立互连为例,如图14C所示,当手机1与002设备建立连接后,可以在设备显示界面1301上动态显示“短距离连接中…”的信息1403,以告诉用户手机1与002设备当前正在使用短距离连接进行数据传输;又比如,以用户A选择手机1与多个设备(比如,001设备、002设备、101设备等)建立互连为例,如图14D所示,当手机1与多个设备建立连接后,可以在设备显示界面1301上动态显示手机1与不同设备当前正在使用的连接方式,例如,在设备显示界面1301上动态显示“长距离连接中…”的信息1404,可以告诉用户A手机1与001设备当前正在使用短距离连接进行数据传输;再例如,在设备显示界面1301上动态显示“双路连接中…”的信息1405,可以告诉用户A手机1与102设备当前正在同时使用短距离连接和长距离连接以双路并行的方式进行数据传输。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.
需要说明的是,手机1与至少一个设备(比如,002设备)可能是通过短距离连接建立的互联,也可能是通过长距离连接建立的互联,还可能是在投屏过程中,短距离连接和长距离连接相互辅助以双路并行的方式建立的互连;对于手机1与002设备具体使用哪种方式建立互连,需要根据当前通信条件或传输资源等确定,具体可以参考上文步骤503以及步骤1003中的相关描述,此处不再赘述。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.
再比如,仍以手机1与002设备建立连接为例,如图14E所示,当设备显示界面1301出现“连接失败”的状态信息1406时,说明手机1与002设备建立连接失败;此时,设备显示界面1301上还可以显示“消息通知”对话框1407,用户A可以选择“重新请求”或者“停止请求”的操作,如图14E所示;若用户A选择“重新请求”,此时,手机1执行方法500中的步骤504和步骤504;与此同时,设备显示界面1301重新出现图14A所示的界面;若用户A选择“停止请求”,则设备显示界面1301返回到图13D所示的界面,用户A可以在设备显示界面1301上重新选择需要投屏的设备(比如,设备102)。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.
又比如,如图14F所示,手机1已经与002设备成功建立连接,在视频界面1408上,“当前连接设备”的区域会显示002设备的图标;若用户A想要断开与002设备的投屏,则可以在“当前连接设备”的区域长按“002设备的图标”就可以打开状态切换栏1409,在状态切换栏1409上选择“断开”选项,即可断开手机1与002设备的连接;若断开后想重新连接,则可以在图13D所示的设备显示界面1301上选择“请求投屏1304”按钮重新连接(即手机1重新执行步骤503和步骤504,确定与002设备的连接方式)。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).
相应地,如图15A所示,手机1向002设备(即第二设备的一个示例)发送投屏连接时,002设备的显示界面1501上会显示“手机1请求投屏?”的消息提醒1502;若002设备的用户B接受投屏请求,则手机1与002设备建立投屏连接;手机1上播放的视频内容会同步显示在002设备的显示界面1501上,如图15B所示;若002设备的用户B不接受投屏请求,则手机1与002设备的投屏连接失败。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.
再比如,如图16A所示,用户A在手机1的设置界面1203上点击图片分享选项1601,此时,手机1从设置界面1203上接收到点击操作,并响应于该点击操作进入图片分享界面1602,如图16B所示;用户A可以在图片分享界面1602上进行权限设置,比如,远场连接方式设置为蜂窝、搜索权限设置为仅联系人,然后点击“开始搜索”按钮,此时,手机1在向附近设备发送广播信息时,可以携带联系人信息,具体可以参考上文步骤506介绍中关于广播信息携带联系人部分的相关描述;搜索过程中,图片分享界面1602上会显示“正在搜索”的时间等信息;当手机1搜索到符合要求(即支持分布式服务、短距离连接和长距离连接的设备)的设备时,即手机1接收到附近的接收设备(比如,第二设备)发送的响应信息(比如,第一响应信息),此时,手机1可以与符合要求的设备建立互连,并将符合要求的设备显示在图16C所示的“设备显示界面1603”上。由于用户选择了“蜂窝”选项,因此,手机1可以通过蜂窝方式与符合要求的设备建立长距离连接。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.
比如,如图16C所示,手机1在设备显示界面1603上除了显示“我的设备”的图标和“好友设备”的图标,还在“其他设备”区域显示其他设备的图标,具体可以参考上文步骤506和步骤507中关于第一设备显示第二设备部分的相关描述。比如,用户A在设备显示界面1603上分别选择101设备和102设备建立互连,以进行图片分享;此时,手机1执行上述方法500中的步骤503和步骤504;与此同时,选择后的101设备的图标和102设备的图标变为灰色已选中状态,如图16C的1605所示;用户可以点击“进入图片选择”按钮1604,此时,手机1从设备显示界面1603跳转至图片选择界面1606,如图16D所示;用户A在图片选择界面1606上选择需要分享的图片,选择好图片后,可以点击“开始分享”按钮1607,进行图片分享,其中,“好友设备”区域的“+”可以添加需要分享的设备,如图16D所示。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.
相应地,如图17A所示,以101设备接收到手机1发送的图片分享请求为例,首先,用户C可以在101设备(即第二设备的又一个示例)的状态控制栏1701中,开启Wifi、蓝牙和移动数据流量;打开Wifi、蓝牙和移动数据流量后,如图17B所示,101设备的主界面1702上显示接收到的图片分享消息提醒1703;若用户C选择“接受”,则手机1与101设备成功建立连接(比如,短距离连接或者长距离连接等);此时,手机1可以向101设备分享图片;若用户C选择“拒绝”,则手机1与101设备的图片分享失败;比如,当用户C选择“接受”时,主界面1702上出现手机1分享的图片信息1704,如图17C所示,用户C可以查看或者另存为接收到的图片;在一些情况下,比如,网络信号不好,101设备可能存在图片接收失败的情况;如图17D所示,101设备将接收失败的图片信息以消息提醒1705的形式显示在主界面1702上,用户C可以选择“重新接收”或者“放弃”操作;若用户C选择“重新接收”,则101设备继续接收手机1分享的图片;若用户C选择“放弃”,则101设备中断与手机1的连接,图片分享失败或者结束。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.
需要说明的是,本申请提出的通信方法不局限于投屏、图片分享等场景,对于一些键鼠穿越、文件共享、多屏协同等场景均适用,本申请对适用上述通信方法的应用场景不作限定。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.
上文详细介绍了本申请提供的通信方法的示例。可以理解的是,终端设备为了实现上述功能,其包含了执行各个功能相应的硬件结构和/或软件模块。本领域技术人员应该很容易意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,本申请能够以硬件或硬件和计算机软件的结合形式来实现。某个功能究竟以硬件还是计算机软件驱动硬件的方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。本申请可根据上述方法示例对通信方法进行功能单元的划分,如,可将各个功能划分为各个功能单元,也可以将两个或两个以上的功能集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。需要说明的是,本申请中对单元的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。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.
图18示出了本申请提供了一种终端设备的结构示意图。图18中虚线表示该单元或该模块为可选的。终端设备1800可用于实现上述方法实施例中描述的方法。终端设备1800可以是服务器或芯片(系统)。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).
终端设备1800包括一个或多个处理器1801,该一个或多个处理器1801可支持终端设备1800实现图5所对应方法实施例中的方法。处理器1801可以是通用处理器或者专用处理器。例如,处理器1801可以是中央处理器(Central Processing Unit,CPU)。CPU可以用于对终端设备1800进行控制,执行软件程序,处理软件程序的数据。终端设备1800还可以包括通信单元1805,用以实现信号的输入(接收)和输出(发送)。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).
上述终端设备1800可以是一种芯片(系统),该芯片(系统)包括存储器和处理器,其中,处理器被配置为执行该存储器中存储的计算机程序,以实现上述各个实施例中示出的方法。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.
通信单元1805可以是该芯片(系统)的输入和/或输出电路,或者,通信单元1805可以是该芯片(系统)的通信接口,该芯片(系统)可以作为终端设备1800的组成部分。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.
又例如,通信单元1805可以是该终端设备1800的收发器,或者,通信单元1805可以是该终端设备1800的收发电路。终端设备1800中可以包括一个或多个存储器1802,其上存有程序1804,程序1804可被处理器1801运行,生成指令1803,使得处理器1801根据指令1803执行上述方法实施例中描述的方法。可选地,存储器1802中还可以存储有数据。可选地,处理器1801还可以读取存储器1802中存储的数据,该数据可以与程序1804存储在相同的存储地址,该数据也可以与程序1804存储在不同的存储地址。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.
处理器1801和存储器1802可以单独设置,也可以集成在一起,例如,集成在终端设备的系统级芯片(System On Chip,SOC)上。处理器1801执行通信方法的具体方式可以参见方法实施例中的相关描述。The processor 1801 and memory 1802 can be configured separately or integrated together, for example, integrated on the 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.
应理解,上述方法实施例的各步骤可以通过处理器1801中的硬件形式的逻辑电路或者软件形式的指令完成。处理器1801可以是CPU、数字信号处理器(Digital Signal Processor,DSP)、现场可编程门阵列(Field Programmable Gate Array,FPGA)或者其它可编程逻辑器件,例如,分立门、晶体管逻辑器件或分立硬件组件。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 gates, transistor logic devices, or discrete hardware components.
本申请还提供了一种计算机程序产品,该计算机程序产品被处理器1801执行时实现本申请中任一方法实施例的方法。该计算机程序产品可以存储在存储器1802中,例如是程序1804,程序1804经过预处理、编译、汇编和链接等处理过程最终被转换为能够被处理器1801执行的可执行目标文件。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.
本申请还提供了一种计算机可读存储介质,其上存储有计算机程序,该计算机程序被计算机执行时实现本申请中任一方法实施例的方法。该计算机程序可以是高级语言程序,也可以是可执行目标程序。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.
该计算机可读存储介质例如是存储器1802。存储器1802可以是易失性存储器或非易失性存储器,或者,存储器1802可以同时包括易失性存储器和非易失性存储器。其中,非易失性存储器可以是只读存储器(Read-Only Memory,ROM)、可编程只读存储器(Programmable ROM,PROM)、可擦除可编程只读存储器(Erasable PROM,EPROM)、电可擦除可编程只读存储器(Electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(Random Access Memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(Static RAM,SRAM)、动态随机存取存储器(Dynamic RAM,DRAM)、同步动态随机存取存储器(Synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(Double Data Rate SDRAM,DDR SDRAM)、增强型同步动态随机存取存储器(Enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(SynchLink DRAM,SLDRAM)和直接内存总线随机存取存储器(Direct Rambus RAM,DRRAM)。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 Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDR SDRAM), Enhanced Synchronous DRAM (ESDRAM), SynchLink DRAM (SLDRAM), and Direct Rambus RAM (DRRAM).
本领域的技术人员可以清楚地了解到,为了描述的方便和简洁,上述描述的装置和设备的具体工作过程以及产生的技术效果,可以参考前述方法实施例中对应的过程和技术效果,在此不再赘述。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.
在本申请所提供的几个实施例中,所揭露的系统、装置和方法,可以通过其它方式实现。例如,以上描述的方法实施例的一些特征可以忽略,或不执行。以上所描述的装置实施例仅仅是示意性的,单元的拆分,仅仅为一种逻辑功能拆分,实际实现时可以有另外的拆分方式,多个单元或组件可以结合或者可以集成到另一个系统。另外,各单元之间的耦合或各个组件之间的耦合可以是直接耦合,也可以是间接耦合,上述耦合包括电的、机械的或其它形式的连接。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.
上述实施例仅用以说明本申请的技术方案,而非对其限制。尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换,而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。最后,以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何在本申请揭露的技术范围内的变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。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 (23)
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202410340157.2 | 2024-03-22 | ||
| CN202410340157.2A CN120692137A (en) | 2024-03-22 | 2024-03-22 | Communication method, terminal device, and computer-readable storage medium |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| WO2025195177A1 WO2025195177A1 (en) | 2025-09-25 |
| WO2025195177A9 true WO2025195177A9 (en) | 2025-12-04 |
Family
ID=97079591
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2025/080762 Pending WO2025195177A1 (en) | 2024-03-22 | 2025-03-05 | Communication method, terminal device, and computer-readable storage medium |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN120692137A (en) |
| WO (1) | WO2025195177A1 (en) |
Family Cites Families (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US8249605B2 (en) * | 2006-09-28 | 2012-08-21 | Samsung Electronics Co., Ltd. | Systems and methods for optimizing the topology of a bluetooth scatternet for social networking |
| CN104010269A (en) * | 2014-05-21 | 2014-08-27 | 广州三星通信技术研究有限公司 | Method and device for sending file in communication terminal |
| CN104936137B (en) * | 2015-06-09 | 2018-08-24 | 深圳市文鼎创数据科技有限公司 | Bluetooth binding method and bluetooth equipment |
| CN115278616A (en) * | 2021-04-30 | 2022-11-01 | 华为技术有限公司 | File sharing method and electronic equipment |
| CN116668938A (en) * | 2022-02-21 | 2023-08-29 | 荣耀终端有限公司 | Image display method, electronic device and terminal device |
-
2024
- 2024-03-22 CN CN202410340157.2A patent/CN120692137A/en active Pending
-
2025
- 2025-03-05 WO PCT/CN2025/080762 patent/WO2025195177A1/en active Pending
Also Published As
| Publication number | Publication date |
|---|---|
| CN120692137A (en) | 2025-09-23 |
| WO2025195177A1 (en) | 2025-09-25 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| EP3550888B1 (en) | Wireless connection switching method and terminal | |
| US10091826B2 (en) | Wireless LAN connection handover by docking system and generic network device driver | |
| JP5985765B2 (en) | Peer connectivity using a mutual wireless connection | |
| JP6251481B2 (en) | Method and apparatus for assigning IP address in wireless communication network | |
| US20130176903A1 (en) | Methods and Apparatus for Establishing a Tunneled Direct Link Setup (TDLS) Session Between Devices in a Wireless Network | |
| US20240121840A1 (en) | Network connection method, related apparatus, and system | |
| US20230345221A1 (en) | Method for transmitting data in near field, device, and system | |
| US20150208454A1 (en) | Method and apparatus for discovering device based on location information | |
| CN114390491B (en) | A networking method, device and system | |
| US11375575B2 (en) | Apparatus and method of performing a group communication | |
| CN114697879B (en) | Bluetooth pairing method, electronic device, chip and storage medium | |
| EP3114821B1 (en) | Method and devices for establishing a connection between a seeker device and a target device | |
| WO2017214137A1 (en) | Methods, devices and systems for supporting wireless communication | |
| CN115967933A (en) | Networking method, related device and system | |
| US12273586B2 (en) | Multimedia apparatus and cast method | |
| CN117319981A (en) | Device discovery method, device and system | |
| US20170163737A1 (en) | Wireless station and method for managing a multi-band session in wi-fi direct services | |
| WO2025195177A9 (en) | Communication method, terminal device, and computer-readable storage medium | |
| US20250008312A1 (en) | Device discovery method, device, and system | |
| CN117715050B (en) | Network sharing method and electronic equipment | |
| KR20190091423A (en) | Method and apparatus for providing ip address in wireless communication network | |
| WO2025118640A1 (en) | Channel selection method, electronic device, chip system, and storage medium | |
| WO2024017167A1 (en) | Rule processing method, communication device, and network side device | |
| WO2023231883A1 (en) | Method for repairing wlan information, main configurator, and internet of things device and system | |
| CN120419137A (en) | Data transmission method of electronic device, electronic device and storage medium |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 25772885 Country of ref document: EP Kind code of ref document: A1 |