Communication method and electronic device

By directly determining the target connection information through electronic devices and sending it via Bluetooth broadcast messages, the Wi-Fi P2P connection process is simplified, the problem of long connection time is solved, connection efficiency and data transmission efficiency are improved, and the user experience is enhanced.

WO2026113457A1PCT designated stage Publication Date: 2026-06-04HONOR DEVICE CO LTD

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
HONOR DEVICE CO LTD
Filing Date
2025-07-25
Publication Date
2026-06-04

AI Technical Summary

Technical Problem

In existing technologies, electronic devices need to interact multiple times and establish Bluetooth links when establishing a Wi-Fi P2P connection, resulting in long connection times, which affects the efficiency of business data transmission and user experience.

Method used

Electronic devices can directly determine the target connection information and send it via Bluetooth broadcast messages, simplifying the Wi-Fi P2P connection process, reducing Bluetooth connection latency, and ensuring connection success by using either a fast connection method or a normal connection method.

Benefits of technology

It shortens the Wi-Fi P2P connection establishment time, improves connection efficiency and business data transmission efficiency, reduces Bluetooth wake-up times, and enhances user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025110651_04062026_PF_FP_ABST
    Figure CN2025110651_04062026_PF_FP_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of communications, and provides a communication method and an electronic device. In response to an operation of a user, a device A initiates a service, and needs to establish a Wi-Fi P2P connection with a device B. The device A directly serves as a GO, and determines first target connection information, the target connection information being used for establishing a Wi-Fi P2P connection. Then, the device A sends a Bluetooth broadcast message carrying the target connection information. The device B receives the Bluetooth broadcast message, and in the role of a GC, establishes a Wi-Fi P2P connection with the device A on the basis of the target connection information in the Bluetooth broadcast message, so as to transmit service data by means of the Wi-Fi P2P connection. In this way, since the device A unilaterally determines the target connection information, negotiation can be implemented by sending a Bluetooth broadcast message only once, instead of being able to complete negotiation only after a Bluetooth link is established and Bluetooth interaction is performed a plurality of times, thereby shortening the duration for establishing a Wi-Fi P2P connection and improving the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

A communication method and electronic device

[0001] This application claims priority to Chinese Patent Application No. 202411755818.4, filed with the State Intellectual Property Office of China on November 28, 2024, entitled "A Communication Method and Electronic Device", the entire contents of which are incorporated herein by reference. Technical Field

[0002] This application relates to the field of communication technology, and in particular to a communication method and electronic device. Background Technology

[0003] With the continuous development of electronic device technology and the increasing variety of electronic devices, the transmission of business data between electronic devices is frequently involved. Electronic devices can transmit business data (such as business data corresponding to collaborative services) through Wi-Fi peer-to-peer (P2P) connections, which facilitates user operation.

[0004] Currently, before establishing a Wi-Fi P2P connection, electronic devices can first establish a Bluetooth link and then interact multiple times through the Bluetooth link to negotiate information related to establishing a Wi-Fi P2P connection, such as network address and channel, so that the electronic devices can establish a Wi-Fi P2P connection based on this information.

[0005] However, multiple interactions and the establishment of Bluetooth links increase the time required, which in turn increases the time needed to establish a Wi-Fi P2P connection between electronic devices, reduces the efficiency of establishing a Wi-Fi P2P connection, and consequently affects the efficiency of business data transmission, resulting in a poor user experience. Summary of the Invention

[0006] This application provides a communication method and electronic device for shortening the time required to establish a Wi-Fi P2P connection between electronic devices, improving the efficiency of P2P connection establishment, and thereby improving the transmission efficiency of service data.

[0007] To achieve the above objectives, the embodiments of this application adopt the following technical solutions:

[0008] In a first aspect, this application provides a communication method applied to a first device. The first device receives a first operation. The first operation is used to initiate a first service. In response to the first operation, the first device can act as a Go to send a first Bluetooth broadcast message carrying first target connection information to a second device, whereby the second device acts as a Gc, and the first target connection information is used to establish a Wi-Fi P2P connection between the first device and the second device.

[0009] Subsequently, the first device establishes a Wi-Fi P2P connection with the second device based on the first target connection information, so as to exchange service data corresponding to the first service with the second device based on the aforementioned Wi-Fi P2P connection.

[0010] In this application, after receiving a first operation to initiate a first service, the first device indicates a need to establish a Wi-Fi P2P connection with another device (such as a second device). The first device directly assigns itself as the Go role and the second device as the Gc role. Furthermore, the first device can directly determine the first target connection information and send a first Bluetooth broadcast message carrying this information to the second device, enabling the second device to become aware of the first target connection information. Subsequently, the first and second devices can establish a Wi-Fi P2P connection based on this first target connection information, thereby transmitting service data corresponding to the first service. Based on this, the first and second devices do not need to negotiate roles or the first target connection information, simplifying the Wi-Fi P2P connection establishment process and effectively shortening the establishment time required for the Wi-Fi P2P connection, improving the efficiency of P2P connection establishment, and thus improving the efficiency of service data transmission. Moreover, since the first and second devices send information via Bluetooth broadcast messages without establishing a Bluetooth connection, the latency overhead caused by establishing a Bluetooth connection is reduced, improving the efficiency of P2P connection establishment and ensuring a better user experience.

[0011] In one possible design, the aforementioned first target connection information includes first information and second information. The first information includes one or more of the following: network address, target frequency band, target channel, target network protocol status, target P2P network interface number, or role. The second information includes one or more of the following: network name, network password, or Go's hardware address.

[0012] The target network protocol state indicates the Wi-Fi protocol used to establish the Wi-Fi P2P connection. Roles include the role of the first device and / or the role of the second device. These roles are either Go or Gc.

[0013] Based on this, the first device directly determines the information related to establishing a Wi-Fi P2P connection and obtains the first target connection information without needing to negotiate with the second device, thus achieving rapid determination of the first target connection information.

[0014] Optionally, the aforementioned first target connection information further includes a fast connection mode flag. The fast connection mode flag indicates that a Wi-Fi P2P connection is established using a fast connection mode. The fast connection mode signifies that the Wi-Fi P2P connection is established by sending a Bluetooth broadcast message carrying target connection information for establishing the Wi-Fi P2P connection.

[0015] Based on this, by carrying a fast connection mode flag in the first target connection information, the second device receiving the first target connection information can quickly know that the Wi-Fi P2P connection is using the fast connection mode through the fast connection mode flag.

[0016] In one possible design approach, the aforementioned first target connection information is valid, meaning that each type of information in the first target connection information matches the preset value corresponding to that type, and / or that the network resource indicated by the information in the first target connection information is in an idle state.

[0017] Based on this, the first device can establish a Wi-Fi P2P connection with the second device by using legitimate first target connection information, which can improve the success rate of Wi-Fi P2P connection establishment.

[0018] In one possible design, if the aforementioned first target connection information is invalid, the first device can establish a Wi-Fi P2P connection with the second device using a normal connection method. That is, the first device can first establish a Bluetooth connection with the second device instead of a Wi-Fi P2P connection. Invalid first target connection information indicates that at least one type of information in the first target connection information does not match the preset value corresponding to that type, or that the network resource indicated by the information in the first target connection information is not in an idle state.

[0019] Then, the first device can send a negotiation request to the second device via Bluetooth. This negotiation request indicates the communication capabilities supported by the first device. The first device then receives the negotiation result from the second device. This negotiation result indicates the communication capabilities jointly supported by both the first and second devices. Based on the negotiation result, the first device can then disconnect the Bluetooth connection and establish a Wi-Fi P2P connection with the second device.

[0020] Based on this, if the first target connection information is invalid, it indicates that the success rate of the first device establishing a Wi-Fi P2P connection with the second device using the first target connection information is low. Therefore, the first device can use a normal connection method to establish a Wi-Fi P2P connection with the second device to improve the success rate of the Wi-Fi P2P connection, thereby ensuring the normal transmission of the service data corresponding to the first service.

[0021] In another possible design, if the aforementioned first target connection information is invalid, the first device can also output a prompt message. This prompt message indicates a Wi-Fi P2P connection error, thus informing the user of the reason why the first service cannot function properly.

[0022] Secondly, this application provides a communication method applied to a second device. The second device receives a first Bluetooth broadcast message sent by a first device, carrying first target connection information, which is used to establish a Wi-Fi P2P connection between the first device and the second device. The first device acts as the Go.

[0023] Subsequently, the second device can establish a Wi-Fi P2P connection with the first device as the Gc based on the first target connection information. Then, the second device can interact with the first device using the Wi-Fi P2P connection to exchange service data corresponding to the first service.

[0024] In one possible design approach, the aforementioned first target connection information is valid, meaning that each type of information in the first target connection information matches the preset value corresponding to that type, and / or that the network resource indicated by the information in the first target connection information is in an idle state.

[0025] In one possible design, if the aforementioned first target connection information is invalid, the second device can establish a Wi-Fi P2P connection with the first device using a normal connection method. That is, the second device can first establish a Bluetooth connection with the first device instead of a Wi-Fi P2P connection. Invalid first target connection information indicates that at least one type of information in the first target connection information does not match the preset value corresponding to that type, or that the network resource indicated by the information in the first target connection information is not in an idle state.

[0026] Then, the second device can send a negotiation request to the first device via Bluetooth. This negotiation request indicates the communication capabilities supported by the second device. The second device then receives the negotiation result from the first device. This negotiation result indicates the communication capabilities jointly supported by both the first and second devices. Based on the negotiation result, the second device can then disconnect the Bluetooth connection and establish a Wi-Fi P2P connection with the first device.

[0027] Optionally, the second device can trigger the first device to establish a Wi-Fi P2P connection with the second device using a normal connection method.

[0028] In another possible design, if the aforementioned first target connection information is invalid, the second device can also output a prompt message. This prompt message indicates a Wi-Fi P2P connection error, thus informing the user of the reason why the first service cannot function properly.

[0029] In one possible design, the aforementioned first target connection information includes first information and second information. The first information includes one or more of the following: network address, target frequency band, target channel, target network protocol status, target P2P network interface number, or role. The second information includes one or more of the following: network name, network password, or Go's hardware address.

[0030] The target network protocol state indicates the Wi-Fi protocol used to establish the Wi-Fi P2P connection. Roles include the role of the first device and / or the role of the second device. The role is either Go or Gc.

[0031] Optionally, the aforementioned first target connection information further includes a fast connection mode flag. The fast connection mode flag indicates that a Wi-Fi P2P connection is established using a fast connection mode. The fast connection mode signifies that the Wi-Fi P2P connection is established by sending a Bluetooth broadcast message carrying target connection information for establishing the Wi-Fi P2P connection.

[0032] Thirdly, this application provides a communication method applied to a first device. The first device receives a first operation input by a user. The first operation is used to initiate a first service.

[0033] In response to receiving the first operation, the first device, acting as Gc, sends a second Bluetooth broadcast message carrying second target connection information to the second device. The second device is acting as Gc. The second target connection information represents information used to establish a Wi-Fi P2P connection between the first and second devices, excluding information determined by Gc in a normal connection mode. A normal connection mode refers to establishing a Wi-Fi P2P connection through Bluetooth connection negotiation.

[0034] Subsequently, the first device can establish a Wi-Fi P2P connection with the second device based on the second target connection information and the third target connection information. The third target connection information represents information determined by Go in the normal connection method. The second and third target connection information are used together to establish a Wi-Fi P2P connection between the first and second devices.

[0035] Then, the first device can use a Wi-Fi P2P connection to interact with the second device and exchange service data corresponding to the first service.

[0036] In this application, after receiving a first operation to initiate a first service, the first device indicates a need to establish a Wi-Fi P2P connection with another device (such as the second device). The first device directly assigns itself as the Gc role and the second device as the Go role. Furthermore, the first device can directly determine the second target connection information and send a second Bluetooth broadcast message carrying this information to the second device, enabling the second device to become aware of it. Subsequently, the first and second devices can establish a Wi-Fi P2P connection based on the second and third target connection information, thereby enabling the transmission of service data corresponding to the first service. Based on this, the first and second devices do not need to negotiate roles or the second and third target connection information, simplifying the Wi-Fi P2P connection establishment process. This effectively shortens the establishment time required for the Wi-Fi P2P connection, improves the efficiency of P2P connection establishment, and ultimately improves the efficiency of service data transmission. Furthermore, the first and second devices communicate via Bluetooth broadcast messages, eliminating the need to establish a Bluetooth connection. This reduces the latency overhead associated with establishing a Bluetooth connection, improves the efficiency of P2P connection establishment, and ensures a better user experience.

[0037] In one possible design, the aforementioned third target connection information is carried in a third Bluetooth broadcast message sent by the second device. Based on this, the first and second devices can transmit the third target connection information without establishing a Bluetooth connection, reducing the latency overhead associated with establishing a Bluetooth connection.

[0038] In one possible design approach, the aforementioned second target connection information may include one or more of the following: network address, target frequency band, target channel, target network protocol status, target P2P network interface number, or role.

[0039] The aforementioned third target connection information may include one or more of the following: network name, network password, or Go's hardware address.

[0040] In one possible design approach, the aforementioned second target connection information and third target connection information are valid.

[0041] In one possible design, if the second or third target connection information is invalid, the first device can establish a Wi-Fi P2P connection with the second device using a normal connection method. Alternatively, the first device can output a prompt message indicating a Wi-Fi P2P connection error.

[0042] Fourthly, this application provides a communication method applied to a second device. The second device receives a second Bluetooth broadcast message carrying second target connection information sent by a first device. The second connection information represents information used to establish a Wi-Fi P2P connection between the first and second devices, excluding information determined by G in a normal connection method. The first device acts as Gc.

[0043] Then, the second device can establish a Wi-Fi P2P connection with the first device as Go, based on the second target connection information and the third target connection information. The third target connection information refers to the information determined by Go in a normal connection method.

[0044] Then, the second device can use a Wi-Fi P2P connection to interact with the first device and exchange service data corresponding to the first service.

[0045] Fifthly, this application provides an electronic device, which can serve as a first device or a second device, comprising a memory and one or more processors. The memory and processors are coupled. The memory stores computer program code, which includes computer instructions. When the processor executes the computer instructions, it causes the electronic device to perform the communication method described above.

[0046] Sixthly, this application provides a chip, which includes a communication interface and at least one processor:

[0047] A communication interface used for inputting and / or outputting signaling or data.

[0048] At least one processor is used to execute a computer program to implement the communication method described above.

[0049] In a seventh aspect, this application provides a computer-readable storage medium including computer instructions that, when executed on an electronic device, cause the electronic device to perform the communication method described above.

[0050] Eighthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the communication method described above.

[0051] Understandably, the beneficial effects achieved by the communication methods of the second, third, and fourth aspects, the electronic devices of the fifth aspect, the chips of the sixth aspect, the computer-readable storage media of the seventh aspect, and the computer program products of the eighth aspect provided above can be referred to the beneficial effects of the first aspect and any of its possible design embodiments, and will not be repeated here. Attached Figure Description

[0052] Figure 1 is a schematic diagram of a process for establishing a P2P connection according to an embodiment of this application;

[0053] Figure 2 is a schematic diagram of a process for establishing a P2P connection provided in an embodiment of this application;

[0054] Figure 3 is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application;

[0055] Figure 4 is a schematic diagram of the software structure of an electronic device provided in an embodiment of this application;

[0056] Figure 5 is a schematic diagram of a process for establishing a P2P connection according to an embodiment of this application;

[0057] Figure 6 is a schematic diagram of a trust ring device list refresh provided in an embodiment of this application;

[0058] Figure 7 is a schematic diagram of a trust loop provided in an embodiment of this application;

[0059] Figure 8 is a schematic diagram of a full-scenario service provided in an embodiment of this application;

[0060] Figure 9 is a schematic diagram of a process for establishing a P2P connection according to an embodiment of this application;

[0061] Figure 10 is a schematic diagram of a process for establishing a P2P connection according to an embodiment of this application;

[0062] Figure 11 is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application;

[0063] Figure 12 is a schematic diagram of a chip system provided in an embodiment of this application. Detailed Implementation

[0064] To facilitate a clear description of the technical solutions in the embodiments of this application, the terms "exemplary" or "for example" are used in the embodiments of this application to indicate examples, illustrations, or explanations. Any embodiment or design scheme described as "exemplary" or "for example" in this application should not be construed as being more preferred or advantageous than other embodiments or design schemes. Specifically, the use of terms such as "exemplary" or "for example" is intended to present related concepts in a specific manner. In the embodiments of this application, "at least one" refers to one or more, and "more" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple. In the embodiments of this application, "first," "second," "1," and "2" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, features defined with "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this embodiment, unless otherwise stated, "multiple" means two or more.

[0065] To more clearly describe the solution of this application, some knowledge related to the embodiments of this application will be introduced below.

[0066] Wi-Fi IP2P connection: also known as Wi-Fi Direct. Wi-Fi IP2P connection (hereinafter referred to as P2P connection) allows two or more electronic devices to form a P2P network (also called a P2P group) and communicate with each other without an access point (such as a router). A P2P network includes a group owner (Go) and at least one group client (Gc). Go manages the network, and Gc, as a client connected to Go, can use the network provided by Go.

[0067] Trust ring: The same user account can log in on different electronic devices. When two or more electronic devices under the same user account trust each other, they form a trust ring. For an electronic device in the trust ring (e.g., electronic device 1), all other electronic devices in the trust ring (e.g., electronic device 2) can be understood as trusted devices of electronic device 1. Electronic devices in the trust ring are intelligently interconnected, supporting functions such as service flow and service sharing.

[0068] Full-scenario services: These are services that utilize distributed technologies for multi-device collaboration to enable cross-system and cross-device collaboration among multiple electronic devices, achieving resource sharing and collaborative operation. Full-scenario services can include various collaborative features such as screen extension, screen casting, super calling, screen mirroring, super notifications, multi-screen collaboration, keyboard and mouse sharing, file sharing, and remote control.

[0069] Before engaging in full-scenario business, electronic devices need to establish a communication connection, such as a peer-to-peer (P2P) connection. For example, after discovering each other, electronic devices enter a negotiation phase. During this phase, a Bluetooth link (or Bluetooth connection) is established between the electronic devices. This Bluetooth link can be a basic Bluetooth (BR) link or a Bluetooth Low Energy (BLE) link.

[0070] Afterwards, electronic devices can interact multiple times via Bluetooth to negotiate and establish information related to the P2P connection, such as the roles of both ends in the P2P link and network information (e.g., frequency band, channel, network protocol status). Among these, the network protocol status indicates the supported Wi-Fi protocols, such as Wi-Fi 5, Wi-Fi 6, or next-generation Wi-Fi protocols.

[0071] During the connection phase, electronic devices establish a P2P connection based on this information, enabling the transmission of full-scenario business data. However, establishing a P2P connection requires creating a Bluetooth link and multiple interactions, making the process cumbersome and time-consuming, resulting in low efficiency. Furthermore, interactions may require waking up Bluetooth, which can take time (e.g., 600ms for BLE and 1-2 seconds for BR), adding further latency overhead.

[0072] For example, as shown in Figure 1, during the discovery phase, device A and device B discover each other. Then, during the negotiation phase, device A and device B establish a Bluetooth link. Afterwards, device A sends a negotiation request to device B based on the Bluetooth link. This negotiation request indicates the communication capabilities of device A and may include information about the communication capabilities supported by device A, such as one or more of the following: available channels, frequency bands, network protocol status, and P2P network interface number. The P2P network interface number represents the currently available P2P network interface number of device A, such as P2P0 and / or P2P1.

[0073] In response to the negotiation request, device B determines the negotiation result based on its own communication capabilities and those of device A. This negotiation result may include device A's role and network information 1. Network information 1 represents the network configuration information of the P2P link, which may include one or more of the following: target frequency band, target channel, target network protocol status, network address, and target P2P network interface number. The network address may include the network address of Go and the network address of Gc. Optionally, the network address may be an Internet Protocol (IP) address. Device A's role indicates its position in the P2P network; device A's role may be Gc or Go. Besides the device A's role and network information 1 described above, the negotiation result may also include other information, which this application does not limit.

[0074] During the connection phase, based on the negotiation results, device A determines its role as Go. Device A initiates the Go mechanism and sends Go information to device B as Go. This Go information includes one or more of the following: the network name, password, and Go's hardware address (media access control address, MAC). After receiving the Go information, device B disconnects the Bluetooth link with device A (as shown in Figure 1, the "X" at the Bluetooth link indicates disconnection), initiates the Gc mechanism, and establishes a P2P connection with device A based on the Go information and the aforementioned negotiation results. This allows device A and device B to transmit full-scenario business data via the P2P connection. It should be understood that the aforementioned Go information and negotiation results are all information related to establishing a P2P connection as described above. In addition to the network name, password, and Go's hardware address described above, the Go information may also include other information, which this application does not limit.

[0075] However, to determine the information related to establishing a P2P connection, device A and device B need to interact at least three times: an interaction negotiation request, a negotiation result, and a Go message. This makes the P2P connection establishment process cumbersome and also involves establishing a Bluetooth link, adding additional latency and resulting in a longer connection establishment time. Furthermore, after device A / device B sends information via the Bluetooth link, their Bluetooth may enter sleep mode. Therefore, when interaction is needed again, Bluetooth needs to be woken up, increasing the impact of Bluetooth wake-up on the latency required for the P2P connection.

[0076] It should be noted that the network address here is a static address, so when establishing a P2P connection, device A or device B can use a pre-assigned static address without having to dynamically assign a network address through the Dynamic Host Configuration Protocol (DHCP).

[0077] Therefore, to address the aforementioned issues, this application provides a fast connection method to simplify the implementation process of the P2P connection method (or ordinary connection method) described above. This fast connection method primarily simplifies the negotiation process. For example, as shown in Figure 2, after entering the negotiation phase, device A, as the sender, directly defaults to its own role as Go, unilaterally determining the information related to establishing the P2P connection without needing to negotiate with device B. The information related to establishing the P2P connection includes one or more of the following: target network information 2, device B's role, and Go information. Target network information 2 represents the configuration information of the P2P link, which may include one or more of the following: target channel, target frequency band, target network protocol status, network address, network name, network password, and target P2P network interface number. Go information may include the hardware address of device A. The network address may include the network address of Go and the network address of Gc.

[0078] During the connection phase, Device A initiates the Go mechanism, sending a Bluetooth broadcast message carrying information related to establishing a P2P connection as the Go role. Device B then receives the Bluetooth broadcast message and reads the information related to establishing the P2P connection from it. Based on this information, Device B initiates the Gc mechanism. Then, as the Gc role, Device B establishes a P2P connection with Device A based on the target network information 2 and the Go information from the P2P connection information. This allows Device B and Device A to transmit full-scenario service data based on the P2P connection. Therefore, Device A can determine the relevant information for establishing the P2P link unilaterally, without requiring multiple interactions and negotiations, and without needing to establish a Bluetooth link. Device A and Device B only need a single Bluetooth broadcast message to complete the negotiation, effectively simplifying the negotiation and connection phases of the P2P connection, thereby shortening the time required to establish the P2P connection, improving the efficiency of service data transmission, and increasing user satisfaction. Furthermore, by reducing the number of Bluetooth wake-ups and minimizing the additional latency overhead caused by Bluetooth wake-ups, the latency of P2P connections is optimized from 3-5 seconds to 1.2 seconds. It should be understood that the description of the discovery phase shown in Figure 2 can be referenced from the description of the discovery phase in the corresponding normal connection method in Figure 1.

[0079] For example, the aforementioned electronic devices (such as Device A and Device B) may be mobile phones, tablets, wearable devices (such as smartwatches), Bluetooth headsets, personal digital assistants (PDAs), laptops, in-vehicle devices, IoT devices, and other electronic devices with wireless communication capabilities. This application embodiment does not impose any special restrictions on the specific form of the electronic device.

[0080] Figure 3 shows a schematic diagram of the structure of the electronic device 100.

[0081] Electronic device 100 may include processor 110, external memory interface 120, internal memory 121, universal serial bus (USB) interface 130, charging management module 140, power management module 141, battery 142, antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193, display screen 194, and subscriber identification module (SIM) card interface 195, etc.

[0082] It is understood that the structures illustrated in the embodiments of the present invention do not constitute a specific limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0083] Processor 110 may include one or more processing units, such as: application processor (AP), modem processor, graphics processing unit (GPU), image signal processor (ISP), controller, memory, video codec, digital signal processor (DSP), baseband processor, and / or neural network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.

[0084] The controller can be the nerve center and command center of the electronic device 100. The controller can generate operation control signals according to the instruction opcode and timing signals to complete the control of fetching and executing instructions.

[0085] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0086] The charging management module 140 receives charging input from the charger. The power management module 141 receives input from the battery 142 and / or the charging management module 140 to power the devices in the electronic device 100.

[0087] The wireless communication function of electronic device 100 can be realized through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor, etc.

[0088] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover one or more communication frequency bands. Different antennas can also be multiplexed to improve antenna utilization. For example, antenna 1 can be multiplexed as a diversity antenna for a wireless local area network. In some other embodiments, the antennas can be used in conjunction with tuning switches.

[0089] The mobile communication module 150 can provide wireless communication solutions, including 2G / 3G / 4G / 5G, for use on electronic devices 100.

[0090] The wireless communication module 160 can provide solutions for wireless communication applications on the electronic device 100, including wireless local area networks (WLAN) (such as Wi-Fi), Bluetooth, Global Navigation Satellite System (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR) technologies. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via antenna 2, performs frequency modulation and filtering of the electromagnetic wave signals, and sends the processed signal to processor 110. The wireless communication module 160 can also receive signals to be transmitted from processor 110, perform frequency modulation and amplification, and convert them into electromagnetic waves for radiation via antenna 2.

[0091] In some embodiments, antenna 1 of electronic device 100 is coupled to mobile communication module 150, and antenna 2 is coupled to wireless communication module 160, enabling electronic device 100 to communicate with networks and other devices via wireless communication technology. The wireless communication technology may include Global System for Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Time-Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technologies, etc. The GNSS may include the Global Positioning System (GPS), the Global Navigation Satellite System (GLONASS), the BeiDou Navigation Satellite System (BDS), the Quasi-Zenith Satellite System (QZSS), and / or satellite-based augmentation systems (SBAS).

[0092] Electronic device 100 implements display functions through GPU, display screen 194, and application processor.

[0093] The display screen 194 is used to display images, videos, etc. In some embodiments, the electronic device 100 may include one or N display screens 194, where N is a positive integer greater than 1.

[0094] Electronic device 100 can perform shooting functions through ISP, camera 193, video codec, GPU, display 194 and application processor.

[0095] The ISP is used to process data fed back by the camera 193. The camera 193 is used to capture still images or videos. In some embodiments, the electronic device 100 may include one or N cameras 193, where N is a positive integer greater than 1.

[0096] 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 electronic device 100.

[0097] Internal memory 121 can be used to store computer executable program code, which includes instructions. Processor 110 executes various functional applications and data processing of electronic device 100 by running the instructions stored in internal memory 121. 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 program required for a function (such as sound playback, image playback, etc.), etc. The data storage area may store data created during the use of electronic device 100 (such as audio data, phonebook, etc.). Furthermore, 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.

[0098] Electronic device 100 can implement audio functions, such as music playback and recording, through audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, and application processor.

[0099] The sensor module 180 may include pressure sensors, gyroscope sensors, barometric pressure sensors, magnetic sensors, accelerometers, distance sensors, proximity sensors, fingerprint sensors, temperature sensors, touch sensors, ambient light sensors, bone conduction sensors, etc.

[0100] Buttons 190 include a power button, volume buttons, etc. A motor 191 can generate vibration feedback. An indicator 192 can be an indicator light. A SIM card interface 195 is used to connect a SIM card. Electronic device 100 can support one or N SIM card interfaces, where N is a positive integer greater than 1.

[0101] For example, the software system of electronic device 100 can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This embodiment of the invention uses the layered architecture Android system as an example to illustrate the software structure of electronic device 100.

[0102] Figure 4 is a software structure block diagram of an electronic device 100 according to an embodiment of the present invention.

[0103] A layered architecture divides software into several layers, each with a clear role and function. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: the application layer, the application framework layer, the Android runtime and system libraries, and the kernel layer.

[0104] The application layer can include a series of application packages.

[0105] As shown in Figure 4, the application package may include applications such as Internet, calling, maps, navigation, WLAN, Bluetooth, music, and video.

[0106] Among them, interconnected applications are used to realize the above-mentioned full-scenario business.

[0107] The application framework layer provides application programming interfaces (APIs) and a programming framework for applications in the application layer. The application framework layer includes some predefined functions.

[0108] As shown in Figure 4, the application framework layer may include a Wi-Fi service module, an air link module, a window manager, a content provider, a view system, a resource manager, etc.

[0109] The Wi-Fi service module provides a set of interfaces for application control or other software modules to control Wi-Fi. For example, application control or other software modules can use these interfaces to call the Wi-Fi service module to establish Wi-Fi peer-to-peer (P2P) connections.

[0110] The air link module is used to enable data pass-through between interconnected applications and Wi-Fi service modules.

[0111] The window manager is used to manage windowed applications. It can retrieve screen size, determine the presence of a status bar, lock the screen, and capture screenshots, among other things.

[0112] Content providers store and retrieve data, making that data accessible to applications. This data may include videos, images, audio, made and received phone calls, browsing history and bookmarks, phone books, etc.

[0113] A view system includes visual controls, such as controls for displaying text and controls for displaying images. View systems can be used to build applications. A display interface can consist of one or more views. For example, a display interface including a text notification icon could include views for displaying text and views for displaying images.

[0114] The file explorer provides applications with various resources, such as localized strings, icons, images, layout files, video files, and more.

[0115] The Android Runtime consists of core libraries and a virtual machine. The Android runtime is responsible for the scheduling and management of the Android system.

[0116] The core library consists of two parts: one part is the functionalities that need to be called by the Java language, and the other part is the Android core library.

[0117] The application layer and application framework layer run in a virtual machine.

[0118] System libraries can include multiple functional modules. For example: surface manager, media libraries, 3D graphics processing libraries (e.g., OpenGL ES), 2D graphics engines (e.g., SGL), etc.

[0119] The Surface Manager is used to manage the display subsystem and provides the blending of 2D and 3D layers for multiple applications.

[0120] The media library supports playback and recording of various commonly used audio and video formats, as well as still image files.

[0121] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.

[0122] A 2D graphics engine is a drawing engine for 2D drawing.

[0123] The kernel layer is the layer between hardware and software. The kernel layer contains at least the display driver, camera driver, audio driver, and sensor driver.

[0124] It is understood that the structure shown in Figure 4 above is merely an example, and electronic devices can be divided into software layers according to their needs. For example, an electronic device may include not only the software layers mentioned above, but also other software layers. Alternatively, an electronic device may include one or more of the software layers mentioned above. Similarly, the content included in each software layer is also merely an example, and this application does not impose any limitations on it.

[0125] In some embodiments, electronic devices (such as device A and device B) can establish a P2P connection using the normal connection method shown in Figure 1. The process of establishing a P2P connection using the normal connection method will be described in detail below, based on the software module shown in Figure 4 and in conjunction with Figure 5. As shown in Figure 5, this process may include:

[0126] S201. After device A is powered on, the interconnect application A in device A starts.

[0127] S202. Connected application A obtains the list of trust ring devices in which device A is located from the device cloud. The trust ring device list includes at least one device identifier.

[0128] The trust ring device list where device A is located includes the trust ring device list corresponding to the user account logged into by device A. Optionally, the trust ring device list also includes the key, such as a public key, corresponding to each device identifier.

[0129] For example, as shown in Figure 6, after device A is powered on, device A (such as the interconnected application A within device A) sends request 1 to the device cloud. Request 1 is used to obtain the list of trust ring devices in which device A is located. For example, request 1 includes the user account 1 that device A is logged into. In response to request 1, the device cloud searches for the list of trust ring devices corresponding to user account 1 and returns it to device A.

[0130] S203-1. Connected application A sends message 1 to Bluetooth application A. Message 1 is used to trigger Bluetooth application A to send BLE broadcast message 1.

[0131] Optionally, message 1 may carry the user account 1 logged into by device A. Specifically, the interconnected application A triggers the Bluetooth application A to send BLE broadcast message 1 carrying user account 1 to begin scanning for and discovering the trusted ring device corresponding to user account 1. Of course, message 1 may also not carry user account 1, but instead carry relevant indication information, which will trigger the Bluetooth application A to send BLE broadcast message 1 carrying user account 1.

[0132] It is understood that when a software module (or software module 1) in the device involved in this application sends broadcast messages, requests (such as negotiation requests), results (such as negotiation results), or other data objects through another software module (or software module 2), software module 1 can directly send the data object to software module 2, and then software module 2 can send the data object. Alternatively, software module 1 can send relevant instruction information to software module 2, and then software module 2 can send the corresponding data object based on the instruction information. This application does not limit the specific content sent by software module 1 to software module 2.

[0133] S203-2, In response to message 1, Bluetooth application A sends BLE broadcast message 1. BLE broadcast message 1 is used to scan and discover trusted ring devices.

[0134] Optionally, BLE broadcast message 1 may carry the user account 1 logged into on device A.

[0135] S204, Bluetooth application B in device B receives BLE broadcast message 1.

[0136] S205, Bluetooth application B sends BLE broadcast message 1 to interconnected application B in device B.

[0137] For example, after detecting BLE broadcast message 1, Bluetooth application B sends BLE broadcast message 1 to connected application B. Connected application B reads user account 1 from BLE broadcast message 1. If it is determined that user account 1 is consistent with the account used by device B when registering the trust ring, connected application B discovers device A and can then perform the following steps to establish a Bluetooth link with device A.

[0138] S206-1, Connected application B sends message 2 to Bluetooth application B. Message 2 is used to trigger Bluetooth application B to send BLE broadcast message 2.

[0139] Optionally, message 2 may include the identifier of device B. Specifically, the interconnected application B triggers the Bluetooth application B to send BLE broadcast message 2 so that device A can discover device B.

[0140] S206-2, In response to message 2, Bluetooth application B sends BLE broadcast message 2. BLE broadcast message 2 includes the identifier of device B.

[0141] S207-1, Bluetooth application A receives BLE broadcast message 2.

[0142] S207-2, Bluetooth application A sends the identifier of device B to connected application A.

[0143] For example, after receiving BLE broadcast message 2, Bluetooth application A can parse the BLE broadcast message 2 to obtain the identifier of device B, and then send a message carrying the identifier of device B to interconnected application A. Of course, this message may include not only the identifier of device B in BLE broadcast message 2, but also other information, and this application does not limit it. Simply put, after receiving BLE broadcast message 2, Bluetooth application A can send a message including some or all of the information in BLE broadcast message 2 to interconnected application A.

[0144] Alternatively, after receiving BLE broadcast message 2, Bluetooth application A can send BLE broadcast message 2 to interconnected application A, so that interconnected application A can parse BLE broadcast message 2 and obtain the identifier of device B.

[0145] Furthermore, it is understood that after a software module (or software module 3) in the device of this application receives data object 1 such as a message, request, or result, when another software module (or software module 4) needs to know the information in data object 1, software module 3 can send data object 2 to software module 4. Data object 2 may be the same as data object 1, or data object 2 may include some or all of the information in data object 1.

[0146] S208. Interconnected application A determines that the identifier of device B belongs to the trust ring device list.

[0147] S209-1, Connected application A sends message 3 to Bluetooth application A. Message 3 is used to trigger the establishment of a BLE connection with device B.

[0148] Optionally, message 3 may carry the identifier of device B.

[0149] S209-2, In response to message 3, Bluetooth application A and Bluetooth application B establish a BLE connection 1.

[0150] For example, if the connected application A determines that the identifier of device B in the BLE broadcast message 2 belongs to the trusted ring device list, it can discover device B and establish a Bluetooth link with device B.

[0151] S210, Connected Application A authenticates with Connected Application B based on BLE connection 1.

[0152] In this process, application A can authenticate with application B based on a key. After successful authentication, device A can determine that device B is a device in the trust ring corresponding to user account 1. The user can view the discovered devices in the trust ring through the interface provided by device A. For example, this interface could be as shown in Figure 7, displaying the devices in the trust ring corresponding to user account 1 (i.e., device A and device B). Similarly, device B can also determine that device A is a device in the trust ring corresponding to user account 1.

[0153] S211. After a period of time, Bluetooth application A disconnects from BLE connection 1.

[0154] In this embodiment, since maintaining the Bluetooth connection has a significant impact on power consumption, the BLE connection 1 between device A and device B can be disconnected when data transmission via BLE connection 1 is no longer needed. Additionally, the Bluetooth applications on devices A and B can enter sleep mode.

[0155] It should be noted that the above power-on is only one example of triggering device A to discover other devices. Device A can also perform the device discovery operation in other situations, such as receiving relevant user operations that trigger device discovery.

[0156] The discovery phase of a Wi-Fi P2P connection has been described above. When a service is initiated, device A enters the negotiation phase of the Wi-Fi P2P connection to negotiate information related to establishing the P2P connection. The implementation process of the negotiation phase will be described below.

[0157] S212. In response to Operation 1, the interconnected application A wakes up the Bluetooth application A. Operation 1 is used to initiate a full-scenario service.

[0158] For example, as shown in Figure 8, in response to a user's trigger operation on icon 20 of device A, device A displays screen sharing control 21. Then, the user drags screen sharing control 21 to icon 22 of device B. This dragging of screen sharing control 21 to icon 22 of device B can be operation 1, which triggers device A to initiate screen sharing.

[0159] S213-1, Connected application A sends message 4 to Bluetooth application A. Message 4 is used to trigger the establishment of a BLE connection with device B.

[0160] S213-2, In response to message 4, Bluetooth application A and Bluetooth application B establish a BLE connection 2.

[0161] S214. The interconnected application A sends connection request 1 to the Wi-Fi service module A. Connection request 1 is used to trigger the establishment of a P2P connection with device B.

[0162] Optionally, the interconnected application A can send connection request 1 to the Wi-Fi service module A through the air link module A (not shown in the figure) to achieve the air link of connection request 1.

[0163] S215, in response to connection request 1, Wi-Fi service module A sends a negotiation request to interconnected application A. Negotiation request 1 is used to trigger negotiation with device B for the information needed to establish a P2P connection.

[0164] For example, the negotiation request includes information about the communication capabilities supported by device A.

[0165] As mentioned above, the negotiation request may include one or more of the following: available channels, frequency bands, network protocol status, P2P network interface number, etc. Additionally, the negotiation request may include other information, such as the Wi-Fi information of device A. This Wi-Fi information may include Wi-Fi information scanned by device A or information about the Wi-Fi networks that device A is connected to. The Wi-Fi information may include the name of the Wi-Fi network. Optionally, the Wi-Fi information may also include the Wi-Fi signal strength to determine which Wi-Fi network has a stronger signal. This application does not limit the specific information included in the negotiation request.

[0166] In this embodiment, in response to connection request 1, Wi-Fi service module A determines the P2P communication capabilities supported by device A, that is, the network capabilities supported by device A. Then, Wi-Fi service module A sends a negotiation request carrying the information about the network capabilities supported by device A to the interconnected application A.

[0167] Optionally, Wi-Fi service module A can send negotiation requests to interconnected application A through transparent transmission module A.

[0168] In some embodiments, the information on the network capabilities supported by the device A may also be determined by the interconnection application A.

[0169] S216-1, Connected application A wakes up Bluetooth application A.

[0170] S216-2, Connected application A sends a negotiation request to Bluetooth application A.

[0171] S216-3. Bluetooth application A sends a negotiation request to Bluetooth application B via BLE connection 2.

[0172] S216-4, Bluetooth application B sends a negotiation request to Internet application B.

[0173] Optionally, connected application A can also send the identifier of the full-scenario service initiated by operation 1 to connected application B, such as the screen sharing identifier shown in Figure 8, so that connected application B can know the service to be performed.

[0174] Optionally, if BLE connection 2 has been lost, Bluetooth application A can re-establish a BLE connection with Bluetooth application B.

[0175] It should be understood that if Bluetooth application A is not in sleep mode when sending a Bluetooth request, then connected application A does not need to wake up connected application A.

[0176] S217. The Internet application B sends a negotiation request to the Wi-Fi service module B.

[0177] Optionally, after recognizing the negotiation request, the Internet application B can send the negotiation request to the Wi-Fi service module B through the pass-through module B (not shown in the figure).

[0178] S218. In response to the negotiation request, Wi-Fi service module B compares the communication capabilities supported by device B with the communication capabilities supported by device A to determine the negotiation result. The negotiation result includes network information 1 and the role of device A.

[0179] The specific content of Network Information 1 can be found in the information included in Network Information 1 as described above.

[0180] In this embodiment, the Wi-Fi service module B compares the network capabilities supported by device B with those supported by device A to determine the network capabilities commonly supported by both devices. For example, if device A's network status includes both Wi-Fi 5 and Wi-Fi 6 protocols, and device B's network status includes Wi-Fi 5, then device B can decide that the target network status includes Wi-Fi 5. As another example, if device A uses 4G and 5G frequency bands, and device B uses 4G frequency bands, then device B can decide that the target frequency band can be 4G.

[0181] Furthermore, device B assigns a network address to Gc to obtain Gc's network address, and assigns a network address to Go to obtain Go's network address, thereby determining network information 1. Additionally, device B can also determine the roles of device B and device A.

[0182] S219-1, Wi-Fi service module B wakes up Bluetooth application B.

[0183] S219-2, Wi-Fi service module B sends the negotiation result to Bluetooth application B.

[0184] S219-3, Bluetooth application B sends the negotiation result to Bluetooth application A through BLE connection 2.

[0185] S219-4. Bluetooth application A sends the negotiation result to Wi-Fi service module A.

[0186] For example, Wi-Fi service module B sends the aforementioned negotiation result to connected application B via BLE connection 2. Then, connected application B sends the negotiation result to connected application A via BLE connection 2. Finally, connected application A sends negotiation result 1 to Wi-Fi service module A.

[0187] In this embodiment, Bluetooth application B in device B may enter a sleep state after receiving a negotiation request. Therefore, Wi-Fi service module B (or via interconnected application B) needs to wake up Bluetooth application B so that the negotiation result can be transmitted via the Bluetooth link using Bluetooth application B.

[0188] Additionally, if the BLE connection 2 between Bluetooth application B and Bluetooth application A is lost after Bluetooth application B enters sleep mode, then Bluetooth application B and Bluetooth application A need to re-establish a Bluetooth connection, such as a BLE connection. It should be understood that if Bluetooth application B is not in sleep mode when the negotiation result needs to be sent, then the interconnected application B does not need to wake up Bluetooth application B.

[0189] Optionally, the Wi-Fi service module B can send the above negotiation results to the interconnected application B through the transparent transmission module B.

[0190] The negotiation phase of a P2P connection has been described above. After the negotiation phase, device A and device B enter the connection phase. The implementation process of the connection phase will be described below.

[0191] S220 and Wi-Fi service module A parse the negotiation result to obtain network information 1 and the role information of device A. Among them, the role of device A is indicated as Go.

[0192] S221, Wi-Fi service module A determines Go information.

[0193] As mentioned earlier, Go information can include one or more of the following: network name, network password, and Go hardware address. Taking a Go information consisting of a network name, network password, and Go hardware address as an example, if Wi-Fi service module A determines that device A's role is Go, Wi-Fi service module A can then determine the network name and network password corresponding to the P2P link. Afterward, device A can send the Go information, including the network name, network password, and Go hardware address, to device B.

[0194] S222-1, Wi-Fi service module A wakes up Bluetooth application A.

[0195] S222-2, Wi-Fi service module A sends message 5 to Bluetooth application A. Message 5 is used to trigger the sending of Go information to device B in the Go role.

[0196] Optionally, message 5 may include Go information, Go roles, etc.

[0197] S222-3. Bluetooth application A, acting as Go, sends Go information to Bluetooth application B via BLE connection 2.

[0198] For example, Wi-Fi service module A initiates the Go mechanism, which involves configuring relevant parameters for Go, enabling Wi-Fi service module A to send Go information to device B via BLE connection 2 as the Go role. Furthermore, if device A has already established a P2P link with other devices as the Go role, device A can directly reuse the already initiated Go mechanism without needing to initiate it again.

[0199] In this embodiment, Bluetooth application A in device A may be in a sleep state when it needs to send Go information. Therefore, Wi-Fi service module A (or via interconnected application A) needs to wake up Bluetooth application A. Similarly, Bluetooth application A in device B may also enter a sleep state after sending the negotiation result. Therefore, Bluetooth application B also needs to end its sleep state to receive Go information. Of course, Bluetooth application A / Bluetooth application B may not be in a sleep state, in which case it does not need to end its sleep state.

[0200] S223. After receiving the Go information, Bluetooth application B disconnects the BLE connection 2.

[0201] S224. Wi-Fi service module B, acting as Gc, establishes a P2P connection with Wi-Fi service module A based on Go information and network information 1.

[0202] In some embodiments, after a P2P connection is established, device A and device B can transmit service data, such as by performing the following steps.

[0203] S225. Connected application A sends full-scenario business data to connected application B based on a P2P connection.

[0204] In this embodiment, the Wi-Fi service module B initiates the Gc mechanism, which involves configuring relevant parameters for Gc, enabling the Wi-Fi service module B to send Go information to device B via BLE connection 2 in the role of Gc.

[0205] In some embodiments, the scenario where device A is Go and device B is Gc is only one possibility. Of course, it's also possible that device A could be Gc and device B could be Go. When negotiating that device A is Gc and device B is Go, the Go information could also be sent by device B. This Go information could be sent separately or included in the negotiation result.

[0206] In this embodiment of the application, as can be seen from S212-S224 above, during the negotiation and connection phases of the normal connection method, device A and device B need to perform multiple interactive negotiations before determining the information related to establishing a P2P connection (such as the aforementioned network information 1, role, and Go information). This makes the process of determining the information related to establishing a P2P connection cumbersome, resulting in a cumbersome P2P connection establishment process, low P2P connection efficiency, and consequently reduced efficiency of business data transmission. Furthermore, during the protocol and connection phases, device A or device B may need to wake up the Bluetooth application multiple times, incurring additional latency overhead and further reducing P2P connection efficiency.

[0207] Therefore, to improve P2P connection efficiency, this application provides a fast connection method, enabling device A and device B to establish a P2P connection based on this fast connection method. The implementation process of this fast connection method will be described below, referring to the software modules shown in Figure 4 and Figure 9. As shown in Figure 9, this process can also be divided into a discovery phase, a negotiation phase, and a connection phase. The discovery phase will be described first.

[0208] S301. After device A is powered on, the interconnect application A in device A starts.

[0209] S302. Connected application A obtains the list of trust ring devices in which device A is located from the device cloud. The trust ring device list includes at least one device identifier.

[0210] S303-1, Interconnected application A triggers Bluetooth application A to send message 1. Message 1 is used to trigger Bluetooth application A to send BLE broadcast message 1.

[0211] S303-2, In response to message 1, Bluetooth application A sends BLE broadcast message 1. BLE broadcast message 1 is used to scan and discover trusted ring devices.

[0212] S304, Bluetooth application B in device B receives BLE broadcast message 1.

[0213] S305, Bluetooth application B sends BLE broadcast message 1 to interconnected application B in device B.

[0214] S306-1, Connected application B sends message 2 to Bluetooth application B. Message 2 is used to trigger Bluetooth application B to send BLE broadcast message 2.

[0215] S306-2, In response to message 2, Bluetooth application B sends BLE broadcast message 2. BLE broadcast message 2 includes the identifier of device B.

[0216] S307-1, Bluetooth application A receives BLE broadcast message 2.

[0217] S307-2, Bluetooth application A sends the identifier of device B to connected application A.

[0218] S308. Interconnected application A determines that the identifier of device B belongs to the trust ring device list.

[0219] S309-1, Connected application A sends message 3 to Bluetooth application A. Message 3 is used to trigger the establishment of a BLE connection with device B.

[0220] S309-2, In response to message 3, Bluetooth application A and Bluetooth application B establish a BLE connection 1.

[0221] S310, Connected Application A authenticates with Connected Application B based on BLE connection 1.

[0222] S311. After a period of time, Bluetooth application A disconnects the BLE connection with Bluetooth application B.

[0223] The implementation process of S301-S311 can be referred to the implementation process of S201-S211 above, and will not be repeated here.

[0224] The discovery phase of a Wi-Fi P2P connection has been described above. When a service is initiated, device A enters the negotiation phase of the Wi-Fi P2P connection to negotiate information such as the channel and port number. The implementation process of the negotiation phase will be described below.

[0225] S312. In response to operation 1, the interconnected application A identifies device A as Go and determines connection information 1. Connection information 1 includes information related to establishing a P2P connection, excluding the network address.

[0226] The connection information 1 may include network information 2 and roles. For example, network information 2 may include one or more of the following: target frequency band, target channel (freq), target network protocol status, target P2P network interface number (forcelface), network name (SSID), network password (password), and Go's hardware address (go mac).

[0227] Optionally, network information 2 may include the aforementioned Go information and the information in network information 1 other than the network address. Of course, the content included in network information 2 described here is only an example, and may also include other content, such as the Wi-Fi information of device A.

[0228] The roles mentioned above include the role of device A (or the first device) and / or the role of device B (or the second device).

[0229] In this embodiment of the application, in response to operation 1 (or the first operation), the interconnected application A independently assigns roles, and by default, the sending end (here referring to device A) is designated as Go, and the receiving end (here referring to device B) is designated as Gc.

[0230] S313, Connected Application A sends Connection Information 1 and Quick Connection Method Identifier to Wi-Fi Service Module A.

[0231] In this embodiment, after determining connection information 1, the interconnected application A can directly determine to establish a P2P connection using the fast connection method. Then, the interconnected application A can send connection information 1 and the fast connection method identifier (e.g., mode=1) to the Wi-Fi service module A. Specifically, the interconnected application A can use connection information 1 and the fast connection method identifier as input parameters to the Wi-Fi service module A.

[0232] Here, 'mode' can be a newly added flag indicating the connection mode of the P2P connection. Of course, 'mode' is just an example, and other characters can also be used to represent this connection mode, such as 'fastConnectMode'.

[0233] Optionally, the connected application A can determine whether a P2P connection can be established using the fast connection method. If it can, the connected application A sends connection information 1 and the fast connection method identifier to the Wi-Fi service module A.

[0234] If it cannot be used, then Internet application A can establish a P2P connection using a normal connection method. Accordingly, Internet application A can send a normal connection method identifier (such as mode=2) to Wi-Fi service module A. After receiving the connection request, Wi-Fi service module A will send the negotiation request to Internet application A based on the normal connection method identifier.

[0235] Optionally, if the Bluetooth connection between device A and device B is a long-lived connection, or if the Bluetooth application A of device A is not in a sleep state, it means that there is no need to wake up the Bluetooth application multiple times. This can reduce the latency overhead of establishing a P2P connection, and the interconnected application A can determine that a normal connection method can be used to establish a P2P connection.

[0236] S314. In response to the fast connection mode identifier, Wi-Fi service module A determines whether connection information 1 is valid.

[0237] In this context, "connection information 1 is valid" means that all information in connection information 1 is correct, that is, it means that connection information 1 is not abnormal. In other words, connection information 1 can be used to establish a P2P connection.

[0238] An invalid connection indicates that connection information 1 is faulty, meaning that connection information 1 is abnormal. In other words, connection information 1 cannot be used to establish a P2P connection.

[0239] In this embodiment of the application, if the connection information is invalid, it indicates that there is an error in connection information 1, which does not meet the requirements. The possibility of successfully establishing a P2P link based on connection information 1 is small. Therefore, Wi-Fi service module A can execute S315.

[0240] If the connection information 1 is valid, it indicates that the connection information 1 is correct and there is a high probability that a P2P link can be successfully established based on the connection information 1. Therefore, Wi-Fi service module A can execute S317.

[0241] In some embodiments, the above-mentioned legality judgment may include determining whether the information of each type in connection information 1 matches the preset value corresponding to that type. If all match, connection information 1 is legal; otherwise, connection information is invalid. For example, each type of information in connection information 1 may be in the form of key-value pairs. For instance, connection information 1 includes network name (SSID), network password (password), target P2P network interface number (forcelface), and target channel (freq). Accordingly, connection information 1 may include SSID: XX; password: XX; role: XX; freq: XX; forcelface: XX. For each key-value pair in connection information 1, Wi-Fi service module A may determine whether the value of each key-value pair matches the preset value corresponding to that key-value pair. If they match, Wi-Fi service module A may determine that the key-value pair is correct. If they do not match, Wi-Fi service module A may determine that the key-value pair is incorrect. It should be understood that if the value of a key-value pair is empty, then the Wi-Fi service module A can determine that the value does not match the preset value, that is, determine that the key-value pair is incorrect.

[0242] For example, the value of a role can be 1 or 2, where 1 represents Go and 2 represents Gc. Therefore, the default value for a role is either 1 or 2. Thus, if the value of a role is 3, the Wi-Fi service module A can determine that the key-value pair associated with that role is incorrect.

[0243] In some embodiments, the above-mentioned validity determination may include an availability determination, that is, determining whether the network resource indicated by the information in connection information 1 is in an idle state. If it is in an idle state, then connection information 1 is valid; otherwise, connection information 1 is invalid. For example, the target P2P network interface number is P2P0. If Wi-Fi service module A determines that P2P0 is in a busy state, rather than an idle state, then it determines that the target P2P network interface number is unavailable, that is, the value of forcelface is invalid.

[0244] S315, Wi-Fi service module A sends a failure result to connected application A. The failure result indicates that connection information 1 is invalid.

[0245] In some embodiments, the failure result may include an error code. For example, the error code is P2P_LINK_FAILED_REASON_BUSY = 1, which indicates that the target P2P network interface number in connection information 1 is in an unavailable (busy) state.

[0246] Optionally, "1" here can be a level 1 error code, and can also include a level 2 error code, which represents a sub-reason, that is, a specific reason. For example, a level 2 error code is 0, 1, or 2. 1 = P2P0 busy in fast connect, which means that P2P0 is in a busy state; 2 = P2P1 busy in fast connect, which means that P2P1 is in a busy state; 0 represents the default reason.

[0247] For example, the error code P2P_LINK_FAILED_REASON_NO_SERVICE = 4 indicates that connection information 1 is abnormal. Optionally, "4" here can be a first-level error code, or it can include a second-level error code, which represents a sub-reason, that is, a specific reason. For example, the second-level error code is 0 or 1. 0 indicates that there is no connection information 1, that is, connection information 1 is null. 1 indicates that connection information 1 is incomplete, that is, some values ​​in connection information 1 are null.

[0248] S316. In response to the failure result, Internet application A establishes a P2P connection with Internet application B using a normal connection method.

[0249] The process of establishing a P2P connection between Internet application A and Internet application B using a normal connection method can be referred to the implementation process of the normal connection method described above.

[0250] Optionally, in response to the failure result, the interconnected application A may output a prompt message to notify the user that the P2P connection has failed. This output may include voice output and / or display. Alternatively, the interconnected application A may adjust the corresponding connection information 1 based on the failure result, so that the adjusted connection information 1 can be used to attempt to establish a P2P connection.

[0251] S317, Wi-Fi service module A determines the network address of Go and the network address of Gc.

[0252] For example, Wi-Fi service module A can invoke the IP allocation process to assign network addresses to Go and Gc respectively. Specifically, the network address can be an IP address. For instance, device A might assign the IP address 192.168.49.1 to Go and the IP address 192.168.49.2 to the first Gc. Furthermore, if device C subsequently connects to device A as a Gc, then device C becomes the second Gc, and its IP address could be 192.168.49.3.

[0253] S318, Wi-Fi service module A uses the aforementioned connection information 1, the network address of Go, and the network address of Gc as target connection information 1. Target connection information 1 represents information related to establishing P2P.

[0254] Among them, Wi-Fi service module A can construct target connection information 1, namely Negoresult, based on the above connection information 1, Go's network address and Gc's network address, combined with a preset format.

[0255] It should be noted that the types of information determined by the Wi-Fi service module A (such as the network address mentioned above) and the types of information determined by the interconnection application A (such as the information included in the connection information 1 mentioned above) described above are only examples, and this application does not limit the specific types of information determined by either of them.

[0256] For example, target connection information 1 includes network address, target frequency band, target channel, target network protocol status, target P2P network interface number, role, network name, network password, and Go's hardware address.

[0257] Wi-Fi service module A not only determines the network address, but also one or more of the following: target frequency band, target channel, target network protocol status, target P2P network interface number, role, etc. Other information in target connection information 1 is determined by interconnection application A.

[0258] In addition, the target connection information 1 (or first target connection information) described above is only an example. The target connection information 1 can be set according to requirements, such as including first information and second information. The first information includes one or more of the following: network address, target frequency band, target channel, target network protocol status, target P2P network interface number or role. The second information includes one or more of the following: network name, network password or Go hardware address.

[0259] In some embodiments, the target connection information 1 may also include a connection method identifier, such as a quick connection method identifier, to indicate the method of establishing this P2P connection, so that device B can quickly know the method used to establish the P2P connection, making it easier for device B to parse the target connection information 1.

[0260] Of course, the quick connection method identifier can also be omitted. After receiving the target connection information 1, device B can determine the method for establishing this P2P connection based on the format of the target connection information 1. Furthermore, the information included in the target connection information 1 can be configured according to requirements. For example, if the target connection information 1 does not include roles, since the Go information is determined by the Go device, when the target connection information 1 includes Go information, device B can determine that device A's role is Go, and device B's own role is Gc.

[0261] In this embodiment, device A acts as the sender, i.e. the service initiator, and directly determines the information related to establishing a P2P connection without needing to interact and negotiate with device B. This reduces the number of interactions, simplifies the steps of establishing a P2P connection, and thus improves the efficiency of establishing a P2P link.

[0262] The above describes the negotiation phase of a P2P connection based on the fast connection method. After determining the information related to establishing a P2P connection, device A and device B can quickly establish a P2P connection based on this information. The connection phase of a P2P connection will be described below.

[0263] S319, Wi-Fi service module A starts the Go mechanism, or reuses the Go mechanism.

[0264] S320, Wi-Fi service module A sends target connection information 1 to Internet application A.

[0265] S321-1, Connected application A wakes up Bluetooth application A.

[0266] S321-2, Connected application A sends target connection information 1 to Bluetooth application A.

[0267] Understandably, if Bluetooth application A is not in a sleep state, then connected application A cannot wake up Bluetooth application A, but can directly send target connection information 1 to Bluetooth application A.

[0268] S321-3, Bluetooth application A sends a Bluetooth broadcast message. The Bluetooth broadcast message includes target connection information 1.

[0269] Optionally, the Bluetooth broadcast message (or first Bluetooth broadcast message) can be a low-power broadcast message or a classic Bluetooth broadcast message.

[0270] S322-1, Bluetooth application B receives Bluetooth broadcast messages.

[0271] S322-2, Bluetooth application B sends target connection information 1 to interconnected application B.

[0272] S323, Internet application B sends target connection information 1 and fast connection identifier to Wi-Fi service module B.

[0273] S324. In response to the quick connection mode identifier, Wi-Fi service module B determines whether the target connection information 1 is valid.

[0274] In this embodiment, the Wi-Fi service module B determines whether the target connection information 1 is valid. If valid, the Wi-Fi service module B can execute S325. If invalid, the Wi-Fi service module B can execute S327.

[0275] The process of determining the legality of target connection information 1 can be referred to the legality determination process described above, and will not be repeated here.

[0276] Optionally, the aforementioned quick connection method identifier may also belong to target connection information 1.

[0277] S325, Wi-Fi service module B starts the GC mechanism.

[0278] S326. Based on the target connection information 1, Wi-Fi service module B establishes a P2P connection with Wi-Fi service module A.

[0279] In this embodiment, Wi-Fi service module B sends a connection request to Wi-Fi service module A based on target connection information 1. The connection request is used to access device B and establish a P2P connection with device B.

[0280] For example, Wi-Fi service module B can splice the target connection information 1 according to a preset splicing format to generate connectioninfo, so that the relevant underlying modules in device B can use connectioninfo to establish a P2P connection with device A.

[0281] S327, Wi-Fi service module B does not start the GC mechanism.

[0282] In some embodiments, if the target connection information 1 is invalid, the Wi-Fi service module B can also establish a P2P connection with device A based on a normal connection method. Specifically, the Wi-Fi service module B can send a negotiation request, or trigger device A to send a negotiation request.

[0283] In some embodiments, after a P2P connection is established, device A and device B can transmit service data, such as by performing the following steps.

[0284] S328. Connected application A sends full-scenario business data to connected application B based on a P2P connection.

[0285] In this embodiment, when establishing a P2P connection based on the fast connection method, device A only needs to send a Bluetooth broadcast message once, i.e., send one Bluetooth data packet, during the negotiation and connection phases. This reduces the number of interactions between device A and device B, and eliminates the need to establish a Bluetooth link, effectively simplifying the P2P connection establishment process and thus improving the efficiency of P2P connection establishment, which in turn improves the efficiency of business data transmission. Furthermore, the reduced number of interactions also reduces the number of times Bluetooth needs to be woken up, thereby lowering latency overhead.

[0286] In some embodiments, the implementation process of the steps corresponding to FIG9 can also refer to the implementation process of the relevant steps corresponding to FIG5 above. For example, the wake-up of Bluetooth application A shown in FIG9 can refer to the process of waking up the relevant Bluetooth application corresponding to FIG5 above.

[0287] In addition, the discovery phase shown in Figure 9 or Figure 5 above may not belong to the Wi-Fi P2P connection establishment phase.

[0288] In some embodiments, since device A independently determines the information related to establishing a P2P connection, connection failures may occur in multi-link connection scenarios. Therefore, the fast connection method provided in this application is mainly applicable to scenarios where device A does not utilize the P2P connection to transmit other service data, or where, although it has already established a P2P connection with other devices as a Go, the Go can be reused, and device B has an idle network card.

[0289] In addition, compared to the normal connection method, the fast connection method restricts the role of the sender (i.e., the Go). Therefore, when the sender needs to act as the GC, a P2P link can be established through the normal connection method.

[0290] It should be noted that the full-scenario service data transmitted via the P2P link described above is only an example; the P2P link can also transmit other types of service data. In other words, operation 1 described above can be used not only to initiate full-scenario services but also to trigger other services, and this application does not limit it. The full-scenario service can be used as an example of the first service, and the full-scenario service data can be used as an example of the service data corresponding to the first service.

[0291] Furthermore, the above-described default setting, where the sending end (such as device A) is designated as Go and the receiving end (such as device B) as Gc, is merely an example. Device A can also be designated as Gc and device B as Go by default. Accordingly, the target connection information 1 (here referred to as the second target connection information) that device A can determine includes one or more of the following: network address, target frequency band, target channel, target network protocol status, target P2P network interface number, and role. Then, device A sends Bluetooth broadcast message 1 (here referred to as the second Bluetooth broadcast message) carrying this target connection information 1. After receiving Bluetooth broadcast message 1, device B determines that its assigned role is Go and sends Bluetooth broadcast message 2 (here referred to as the third Bluetooth broadcast message) carrying Go information to device A. This Go information may include one or more of the following: network name, network password, and Go hardware address.

[0292] Then, based on the target connection information 1 and the Go information, device A establishes a P2P connection with device B. Device A acts as the Gc (Controller), and device B acts as the Go (Controller).

[0293] Based on this, two Bluetooth broadcast messages are sufficient for Device A and Device B to receive information related to establishing a P2P connection, without requiring a Bluetooth link to be established between them. Furthermore, Device A does not need to compare the communication capabilities supported by both devices to directly determine their roles, target frequency bands, and other information relevant to establishing a P2P connection. Compared to ordinary connection methods, this also shortens the time required to establish a P2P connection.

[0294] It is understood that the operations performed by the software modules (such as the Bluetooth application, Wi-Fi service module, and interconnection application) in the aforementioned devices (such as device A and device B) can also be performed by other software modules. This application does not impose any restrictions on the software modules that perform the above steps. Furthermore, the operations performed by the software modules are actually performed by the device itself. In other words, the execution subject of the connection method (such as the ordinary connection method or the fast connection method) described in this application, i.e., the communication method, is the device. For example, as shown in Figure 10, the implementation process of this communication method may include:

[0295] S401, In response to user input operation 1, device A sends a Bluetooth broadcast message carrying target connection information 1. Target connection information 1 is used to establish a P2P connection. Operation 1 is used to initiate a full-scenario service.

[0296] S402. After receiving the Bluetooth broadcast message, device B establishes a P2P connection with device A based on target connection information 1.

[0297] S403. Device A transmits service data corresponding to all scenarios of services to Device B based on P2P connection.

[0298] In one implementation, device A is Go, and device B is Gc. Accordingly, device A can determine all the information related to establishing a P2P connection. For example, target connection information 1 includes one or more of the following: network address, target frequency band, target channel, target network protocol status, target P2P network interface number, role, etc., and one or more of the following: network name, network password, and Go's hardware address, etc.

[0299] In another implementation, device A is Gc and device B is Go. Since device A is Gc, device A cannot determine the aforementioned Go information. The aforementioned target connection information 1 may include one or more of the following: network address, target frequency band, target channel, target network protocol status, target P2P network interface number, role, etc.

[0300] After receiving the target connection information 1, device B sends a Bluetooth broadcast message carrying the target connection information 2 (i.e., Go information) so that device A can establish a P2P connection with device B based on the target connection information 2 and the target connection information 1.

[0301] The target connection information 2 mentioned above may include one or more of the following: network name, network password, and Go's hardware address. In addition to the information included in the target connection information described above (such as target connection information 1 and target connection information 2), the target connection information may also include other information, which this application does not limit.

[0302] Optionally, after receiving a Bluetooth broadcast message carrying the target connection information, device B may choose not to send a Bluetooth broadcast message carrying the Go information. Accordingly, the Go information used to establish this P2P connection can be the same Go information used by device A and device B to establish a previous P2P connection.

[0303] Alternatively, the Go information used to establish the P2P connection can be the Go information corresponding to the initiated full-scenario service. For example, each full-scenario service has a preset network name and network password. When conducting a full-scenario service, the network name and network password corresponding to that service can be used to establish a P2P connection.

[0304] The above primarily describes the solutions provided by the embodiments of this application from a methodological perspective. It is understood that, in order to achieve the above functions, the electronic device includes hardware structures and / or software modules corresponding to the execution of each function. Based on the units and algorithm steps of the various examples described in the embodiments disclosed in this application, the embodiments of this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by a computer 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 to exceed the scope of the technical solutions of the embodiments of this application.

[0305] This application provides embodiments for dividing an electronic device into functional modules based on the above method examples. For example, each function can be divided into its own functional modules, or two or more functions can be integrated into a single processing unit. The integrated unit can be implemented in hardware or as a software functional module. It should be noted that the unit division in this application embodiment is illustrative and represents only one logical functional division; in actual implementation, other division methods may be used.

[0306] Figure 11 shows a schematic diagram of an electronic device provided in an embodiment of this application. This electronic device can be either device A or device B. The electronic device 1000 can be used to implement the methods executed by the electronic devices (such as device A and device B) described in the above method embodiments. For example, the electronic device 1000 may include a processing unit 1001, a communication unit 1002, and a display unit 1003. The processing unit 1001 is used to support the electronic device 1000 in executing the processing functions of the electronic devices (such as device A and device B) as described in any one of Figures 1 to 9. The communication unit 1002 is used to support the communication functions of the electronic device 1000. The display unit 1003 is used to support the display functions of the electronic device 1000.

[0307] Optionally, the electronic device 1000 shown in FIG11 may further include a storage unit (not shown in FIG11) storing a program or instructions. When the processing unit 1001 executes the program or instructions, the electronic device 1000 shown in FIG11 can perform the method described in the above-described method embodiments.

[0308] The technical effects of the electronic device 1000 shown in Figure 11 can be referred to the technical effects described in the above method embodiments, and will not be repeated here. The processing unit 1001 involved in the electronic device 1000 shown in Figure 11 can be implemented by a processor or processor-related circuit components, and can be a processor or processing module. The communication unit 1002 can be implemented by a transceiver or transceiver-related circuit components, and can be a transceiver or transceiver module. The display unit 1003 can be implemented by display screen-related components.

[0309] This application also provides a chip system, as shown in FIG12, which includes at least one processor 1101 and at least one interface circuit 1102. The processor 1101 and the interface circuit 1102 are interconnected via lines. For example, the interface circuit 1102 can be used to receive signals from other devices. As another example, the interface circuit 1102 can be used to send signals to other devices (e.g., the processor 1101). Exemplarily, the interface circuit 1102 can read instructions stored in a memory and send the instructions to the processor 1101. When the instructions are executed by the processor 1101, the electronic device can perform the various steps performed by the electronic device (e.g., device A or device B) in the above embodiments. Of course, the chip system may also include other discrete devices, which are not specifically limited in this application.

[0310] Optionally, the chip system may contain one or more processors. These processors can be implemented in hardware or software. When implemented in hardware, the processor can be a logic circuit, an integrated circuit, etc. When implemented in software, the processor can be a general-purpose processor, implemented by reading software code stored in memory.

[0311] Optionally, the chip system may contain one or more memories. The memory may be integrated with the processor or disposed separately from it; this application does not limit this. For example, the memory may be a non-transient processor, such as a read-only memory (ROM), which may be integrated with the processor on the same chip or disposed separately on different chips. This application does not specifically limit the type of memory or the arrangement of the memory and processor.

[0312] For example, the chip system can be a field-programmable gate array (FPGA), an application-specific integrated circuit (ASIC), a system-on-a-chip (SoC), a central processing unit (CPU), a network processor (NP), a digital signal processor (DSP), a microcontroller unit (MCU), a programmable logic device (PLD), or other integrated chips. It should be understood that the steps in the above method embodiments can be implemented by integrated logic circuits in the processor's hardware or by instructions in software form. The method steps disclosed in the embodiments of this application can be directly implemented by a hardware processor, or by a combination of hardware and software modules in the processor.

[0313] This application also provides a computer storage medium storing computer instructions, which, when executed on an electronic device, cause the electronic device to perform the communication method described in the above method embodiments.

[0314] This application provides a computer program product, which includes a computer program or instructions that, when executed on an electronic device, cause the electronic device to perform the communication method described in the above method embodiments.

[0315] In addition, this application embodiment also provides an apparatus, which may specifically be a chip, component, or module. The apparatus may include a connected processor and a memory; wherein the memory is used to store computer execution instructions. When the apparatus is running, the processor can execute the computer execution instructions stored in the memory to cause the apparatus to perform the communication methods in the above-described method embodiments. The electronic devices, computer storage media, computer program products, or chips provided in this embodiment are all used to execute the corresponding methods provided above. Therefore, the beneficial effects they can achieve can be referred to in the beneficial effects of the corresponding methods provided above, and will not be repeated here.

[0316] Through the above description of the embodiments, those skilled in the art will understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0317] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. The embodiments can be combined with or referenced to each other without conflict. The apparatus embodiments described above are merely illustrative; for example, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

[0318] The units described as separate components may or may not be physically separate. A component shown as a unit can be one or more physical units; that is, it can be located in one place or distributed in multiple different locations. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0319] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0320] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, in essence, or the parts that contribute to the prior art, or all or part of the technical solutions, can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0321] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A communication method, characterized in that, Applied to a first device, the method includes: In response to receiving the first operation, Go, as the group owner, sends a first Bluetooth broadcast message carrying first target connection information to the second device; wherein, the first operation is used to initiate a first service, the second device is used as a group client Gc, and the first target connection information is used to establish a Wi-Fi peer-to-peer (P2P) connection between the first device and the second device; Based on the first target connection information, establish a Wi-Fi P2P connection with the second device; Based on the Wi-Fi P2P connection, the service data corresponding to the first service is exchanged with the second device.

2. The method according to claim 1, characterized in that, The first target connection information includes first information and second information; the first information includes one or more of the following: network address, target frequency band, target channel, target network protocol status, target P2P network interface number or role; the second information includes one or more of the following: network name, network password or Go hardware address. The target network protocol status is used to indicate the Wi-Fi protocol used to establish the Wi-Fi P2P connection; the role includes the role of the first device and / or the role of the second device; the role is Go or Gc.

3. The method according to claim 2, characterized in that, The first target connection information also includes a fast connection mode flag; the fast connection mode flag is used to indicate that a Wi-Fi P2P connection is established using a fast connection mode; the fast connection mode indicates that a Wi-Fi P2P connection is established by sending a Bluetooth broadcast message carrying target connection information for establishing a Wi-Fi P2P connection.

4. The method according to any one of claims 1 to 3, characterized in that, The first target connection information is valid, meaning that each type of information in the first target connection information matches the preset value corresponding to that type, and / or that the network resource indicated by the information in the first target connection information is in an idle state.

5. The method according to claim 4, characterized in that, The method further includes: If the first target connection information is invalid, a Bluetooth connection is established with the second device instead of a Wi-Fi P2P connection; wherein, the invalidity means that at least one type of information in the first target connection information does not match the preset value corresponding to that type, or the network resource indicated by the information in the first target connection information is not in an idle state; The negotiation request is sent to the second device via the Bluetooth connection; wherein the negotiation request is used to indicate the communication capabilities supported by the first device. Receive negotiation results from the second device; wherein the negotiation results are used to indicate the communication capabilities jointly supported by the first device and the second device; Based on the negotiation result, the Bluetooth connection is disconnected, and a Wi-Fi P2P connection is established with the second device.

6. The method according to claim 4, characterized in that, The method further includes: If the first target connection information is invalid, a prompt message is output; wherein, the prompt message is used to indicate that the Wi-Fi P2P connection is abnormal.

7. A communication method, characterized in that, Applied to a first device, the method includes: In response to receiving the first operation, the group client Gc sends a second Bluetooth broadcast message carrying second target connection information to the second device; wherein, the first operation is used to initiate a first service, and the second device is the group owner Go; the second target connection information represents information used to establish a Wi-Fi P2P connection between the first device and the second device, excluding information determined by Go in the normal connection mode; the normal connection mode refers to the method of establishing a Wi-Fi P2P connection through Bluetooth connection negotiation; Based on the second target connection information and the third target connection information, a Wi-Fi P2P connection is established with the second device; wherein, the third target connection information represents information determined by Go in the normal connection method; Based on the Wi-Fi P2P connection, the service data corresponding to the first service is exchanged with the second device.

8. The method according to claim 7, characterized in that, The third target connection information is carried in the third Bluetooth broadcast message sent by the second device.

9. The method according to claim 7 or 8, characterized in that, The second target connection information includes one or more of the following: network address, target frequency band, target channel, target network protocol status, target P2P network interface number, or role; The third target connection information includes one or more of the following: network name, network password, or Go's hardware address.

10. A communication method, characterized in that, Applied to a second device, the method includes: Receive a first Bluetooth broadcast message sent by a first device carrying first target connection information; wherein, the first target connection information is used to establish a Wi-Fi P2P connection between the first device and the second device, and the first device acts as the group owner Go; Based on the first target connection information, the group client Gc establishes a Wi-Fi P2P connection with the first device. Based on the Wi-Fi P2P connection, the service data corresponding to the first service is exchanged with the first device.

11. The method according to claim 10, characterized in that, The first target connection information is valid, meaning that each type of information in the first target connection information matches the preset value corresponding to that type, and / or that the network resource indicated by the information in the first target connection information is in an idle state.

12. A communication method, characterized in that, Applied to a second device, the method includes: The system receives a second Bluetooth broadcast message from a first device carrying second target connection information; wherein the second connection information represents information used to establish a Wi-Fi P2P connection between the first device and the second device, excluding information determined by the group owner Go in the normal connection mode, the normal connection mode being a method of establishing a Wi-Fi P2P connection through Bluetooth connection negotiation; the first device acts as a group client Gc; Based on the second target connection information and the third target connection information, Go establishes a Wi-Fi P2P connection with the first device; wherein, the third target connection information represents information determined by Go in the normal connection method; Based on the Wi-Fi P2P connection, the service data corresponding to the first service is exchanged with the first device.

13. An electronic device, characterized in that, The electronic device includes a memory, a wireless communication module, and one or more processors; the memory, the wireless communication module, and the processors are coupled; the memory is used to store computer program code, the wireless communication module is used to perform wireless communication, and the computer program code includes computer instructions; when the processor executes the computer instructions, the electronic device performs the communication method as described in any one of claims 1 to 12.

14. A computer-readable storage medium, characterized in that, It includes computer instructions that, when executed on an electronic device, cause the electronic device to perform the communication method as described in any one of claims 1 to 12.

15. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the communication method as described in any one of claims 1 to 12.