A wi-fi direct communication method and apparatus

By merging different P2P groups into a new P2P group, the problem of devices in different P2P groups being unable to connect in Wi-Fi Direct technology is solved, enabling reliable communication between terminal devices and reducing the impact on services.

CN115802516BActive Publication Date: 2026-04-21HUAWEI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HUAWEI TECH CO LTD
Filing Date
2021-09-10
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

In existing Wi-Fi Direct technology, terminal devices belonging to different P2P groups cannot establish Wi-Fi P2P connections.

Method used

By combining different P2Ps into a new P2P group, using merging rules to determine the GO role after merging, and performing P2P group disconnection and reconnection, Wi-Fi P2P communication between terminal devices is realized.

Benefits of technology

It enabled Wi-Fi P2P connectivity between terminal devices in different P2P groups, ensuring the reliability of existing services and reducing the impact on groups before the merger.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115802516B_ABST
    Figure CN115802516B_ABST
Patent Text Reader

Abstract

This application relates to the field of communications and discloses a Wi-Fi direct communication method and apparatus, providing a technical solution for establishing Wi-Fi P2P connections between terminal devices belonging to different P2P groups. The method comprises: a second terminal device receiving a Wi-Fi P2P connection establishment request initiated by a first terminal device, or the second terminal device initiating a Wi-Fi P2P connection establishment request to the first terminal device, wherein the second terminal device belongs to a second peer-to-peer P2P group and the first terminal device belongs to a first P2P group; the second terminal device and the first terminal device negotiating a P2P group merger, obtaining a negotiation result, which indicates merging the second P2P group and the first P2P group into a third P2P group; and the second terminal device establishing a Wi-Fi P2P connection with the first terminal device in the third P2P group.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of communication technology, and in particular to a Wi-Fi direct communication method and apparatus. Background Technology

[0002] Wireless-fidelity (Wi-Fi Direct) technology (also known as "Wi-Fi P2P") is a typical technology in the Wi-Fi protocol suite. Wi-Fi Direct enables terminal devices to connect to each other without an intermediary wireless access point (AP).

[0003] Currently, in the Wi-Fi Direct technology standard protocol, a P2P group consists of a peer-to-peer (P2P) group owner (GO) and at least one group client (GC) within the P2P group. The GO can exchange data with each GC within the P2P group. However, existing Wi-Fi Direct technologies suffer from the problem of being unable to establish Wi-Fi P2P connections between terminal devices belonging to different P2P groups. Summary of the Invention

[0004] This application provides a Wi-Fi Direct communication method and apparatus to solve the problem in existing Wi-Fi Direct technology that terminal devices belonging to different P2P groups cannot establish Wi-Fi P2P connections.

[0005] In a first aspect, embodiments of this application provide a Wi-Fi Direct communication method, the method comprising: a second terminal device receiving a Wi-Fi P2P connection establishment request initiated by a first terminal device, or the second terminal device initiating a Wi-Fi P2P connection establishment request to the first terminal device, wherein the second terminal device belongs to a second peer-to-peer P2P group and the first terminal device belongs to a first P2P group; the second terminal device and the first terminal device negotiating a P2P group merger to obtain a negotiation result, the negotiation result being used to indicate merging the second P2P group and the first P2P group into a third P2P group; and the second terminal device establishing a Wi-Fi P2P connection with the first terminal device in the third P2P group.

[0006] This method addresses scenarios where a Wi-Fi P2P connection needs to be established between a first terminal device and a second terminal device belonging to different P2P groups. It employs a group merging approach for multiple different P2P groups. Specifically, through negotiation processing of the group merging between the first and second terminal devices, one P2P group is disjointed and then connected to the GO of another P2P group as the GC of that group. This results in a new P2P group containing the terminal devices from the original multiple different P2P groups. This new P2P group then enables the establishment of direct Wi-Fi communication between the terminal devices from the original multiple different P2P groups.

[0007] In one possible design, before the second terminal device and the first terminal device negotiate P2P group merging, the method further includes: the second terminal device sending second P2P status information to the first terminal device, the second P2P status information indicating the second P2P group; and the second terminal device receiving first P2P status information sent by the first terminal device, the first P2P status information indicating the first P2P group. The negotiation between the second terminal device and the first terminal device for P2P group merging includes: the second terminal device negotiating P2P group merging with the first terminal device based on the second P2P status information and the first P2P status information.

[0008] In this design, the second terminal device shares the P2P status information indicating the P2P group with the first terminal device, enabling the second terminal device and the first terminal device to negotiate group merging based on the second and first P2P status information. Therefore, P2P communication between the first terminal device and the second terminal device can be realized in the merged P2P group.

[0009] In one possible design, the second terminal device negotiates a P2P group merging with the first terminal device, including: the second terminal device determining the second group owner (GO) role in the second P2P group and the first GO role in the first P2P group; the second terminal device determining, based on a preset merging rule, that the second GO or the first GO is the third GO in the third P2P group; and the second terminal device outputting a negotiation result based on the third GO; wherein, if the second GO is determined to be the third GO, the negotiation result is to merge the first P2P group into the second P2P group; and if the first GO is determined to be the third GO, the negotiation result is to merge the second P2P group into the first P2P group.

[0010] In this design, the GO role of the merged third P2P group is first determined by the second terminal device and the first terminal device based on the first GO role of the first P2P group and the second GO role of the second P2P group. This allows the P2P groups to which the first terminal device and the second terminal device belong to be merged to obtain the merged P2P group.

[0011] In one possible design, if the negotiation result is to merge the second P2P group into the first P2P group, the method further includes: the second terminal device saving the service information of the second P2P group based on the service status of the second P2P group; the second terminal device disconnecting the P2P group from the second GO, the disconnection being used to break the Wi-Fi P2P connection between the second terminal device and the second GO; the second terminal device initiating a request to establish a Wi-Fi P2P connection to the third GO; and the second terminal device receiving a confirmation message from the third GO, the confirmation message being used to indicate to the third GO that the second terminal device agrees to join the third P2P group.

[0012] In this design, after determining the negotiation result of group merging, one of the P2P groups is disjointed according to the negotiation result, and the multiple terminal devices obtained from the disjoint connection are connected to the GO of another P2P group, thereby obtaining a third P2P group.

[0013] In one possible design, the method further includes: the second terminal device restoring its service status in the second P2P group based on the service information of the second P2P group in the third P2P group.

[0014] This design not only solves the problem in existing technologies where first and second terminal devices belonging to different P2P groups cannot achieve P2P communication, but also ensures the processing of existing services and the reliability of terminal device processing.

[0015] In one possible design, the method further includes: the second terminal device sending the negotiation result to at least one other terminal device in the second P2P group, so that each of the other terminal devices, after disconnecting from the second P2P group, establishes a Wi-Fi P2P connection with the third GO.

[0016] This design allows for the merging of multiple terminal devices in the second P2P group (where the second terminal device is located) into the first P2P group (where the first terminal device is located). This enables the merging of multiple terminal devices in the second P2P group and the first P2P group into the same third P2P group, thereby solving the problem in the prior art where first and second terminal devices belonging to different P2P groups cannot achieve P2P communication.

[0017] In one possible design, the preset merging rules include one or more of the following rules: P2P groups with fewer terminal devices are merged into P2P groups with more terminal devices; P2P groups with low service priority are merged into P2P groups with high service priority; P2P groups with small channel bandwidth are merged into P2P groups with large channel bandwidth; P2P groups with low traffic volume are merged into P2P groups with high traffic volume; P2P groups with weak GO performance are merged into P2P groups with strong GO performance; and P2P groups initiated by Wi-Fi P2P connection request initiators are merged into P2P groups initiated by the recipients.

[0018] In this design, by using preset merging rules, the first terminal device and the second terminal device belonging to different P2P groups can achieve P2P communication, while also reducing the impact on the original services of the first and second P2P groups before the merger.

[0019] In one possible design, the second terminal device establishes a Wi-Fi P2P connection with the first terminal device in the third P2P group, including: if the second terminal device and the first terminal device are both group client GC roles in the third P2P group, the second terminal device and the first terminal device establish a Wi-Fi P2P connection through the GO role in the third P2P group.

[0020] In this design, by using the GO role included in the merged third P2P group, Wi-Fi P2P communication between the first terminal device and the second terminal device belonging to the GC role in the P2P group can be realized.

[0021] Secondly, embodiments of this application provide a Wi-Fi direct communication system, including a first P2P group and a second P2P group. The first P2P group includes a first GO and a first terminal device, and the second P2P group includes a second GO and a second terminal device. The first terminal device is a client GC within the first P2P group, and the second terminal device is a second GC within the second P2P group. The first terminal device initiates a Wi-Fi P2P connection establishment request to the second terminal device, or the second terminal device initiates a Wi-Fi P2P connection establishment request to the first terminal device. The first terminal device and the second terminal device negotiate a P2P group merging process to obtain a negotiation result. The negotiation result is used to indicate merging the second P2P group and the first P2P group into a third P2P group. Based on the negotiation result, the first P2P group and the second P2P group form the third P2P group. The first terminal device and the second terminal device establish a Wi-Fi P2P connection within the third P2P group.

[0022] In one possible design, before the first terminal device and the second terminal device negotiate the P2P group merging, the first terminal device sends first P2P status information to the second terminal device, or the second terminal device sends second P2P status information to the first terminal device; the first P2P status information is used to indicate the first P2P group, and the second P2P status information is used to indicate the second P2P group; the negotiation between the first terminal device and the second terminal device for P2P group merging includes: determining the negotiation result based on the second P2P status information and the first P2P status information.

[0023] In one possible design, the first terminal device and the second terminal device negotiate the merging of P2P groups, including: determining, based on a preset merging rule, whether the second GO or the first GO is the third GO in the third P2P group; and outputting a negotiation result according to the third GO; wherein, if the second GO is determined to be the third GO, the negotiation result is to merge the first P2P group into the second P2P group; if the first GO is determined to be the third GO, the negotiation result is to merge the second P2P group into the first P2P group.

[0024] In one possible design, if the negotiation result is to merge the second P2P group into the first P2P group, the second terminal device saves the service information of the second P2P group based on its service status; the second terminal device disconnects the P2P group from the second GO, the disconnection being used to break the Wi-Fi P2P connection between the second terminal device and the second GO; the second terminal device initiates a Wi-Fi P2P connection establishment request to the third GO; and the second GO initiates a Wi-Fi P2P connection establishment request to the third GO; the second terminal device receives a confirmation message from the third GO, indicating that the third GO agrees to the second terminal device joining the third P2P group; and the second GO receives a confirmation message from the third GO, indicating that the third GO agrees to the second GO joining the third P2P group; the second GO plays the role of GC in the third P2P group.

[0025] In one possible design, the second terminal device restores the service status of the second terminal device and the second GO in the second P2P group according to the service information of the second P2P group.

[0026] In one possible design, the second terminal device sends the negotiation result to at least one other terminal device in the second P2P group; and the first terminal device sends the negotiation result to at least one other terminal device in the first P2P group.

[0027] In one possible design, the preset merging rules include one or more of the following rules: P2P groups with fewer terminal devices are merged into P2P groups with more terminal devices; P2P groups with low service priority are merged into P2P groups with high service priority; P2P groups with small channel bandwidth are merged into P2P groups with large channel bandwidth; P2P groups with low traffic volume are merged into P2P groups with high traffic volume; P2P groups with weak GO performance are merged into P2P groups with strong GO performance; and P2P groups initiated by Wi-Fi P2P connection request initiators are merged into P2P groups initiated by the recipients.

[0028] In one possible design, the first terminal device and the second terminal device establish a Wi-Fi P2P connection in the third P2P group, including: the first terminal device and the second terminal device establish a Wi-Fi P2P connection through the GO role in the third P2P group.

[0029] Thirdly, embodiments of this application also provide a terminal device, including: one or more processors; one or more memories; the one or more memories being used to store one or more computer programs and data information; wherein the one or more computer programs include instructions; when the instructions are executed by the one or more processors, the terminal device performs the method as described in any one of the first aspects above.

[0030] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program (also referred to as code or instructions) that, when run on a computer, causes the computer to perform the method in any of the possible implementations of the first aspect described above.

[0031] Fifthly, embodiments of this application provide a computer program product, which includes a computer program (also referred to as code or instructions) that, when run, causes a computer to perform the method in any of the possible implementations of the first aspect described above.

[0032] Sixthly, embodiments of this application also provide a graphical user interface on a terminal device, the terminal device having a display screen, one or more memories, and one or more processors, the one or more processors being used to execute one or more computer programs stored in the one or more memories, the graphical user interface including a graphical user interface displayed when the terminal device executes any possible implementation of the first aspect of the embodiments of this application, or a graphical user interface displayed when executing any possible implementation of the second aspect of the embodiments of this application.

[0033] For details on the beneficial effects of any of the second to sixth aspects mentioned above, please refer to the beneficial effects of the various possible designs in the first aspect mentioned above; they will not be repeated here. Attached Figure Description

[0034] Figure 1 This is a schematic diagram of a P2P group;

[0035] Figure 2 This is a diagram illustrating an application scenario for a P2P group.

[0036] Figure 3 This is a diagram illustrating another application scenario for P2P groups.

[0037] Figure 4 This application provides an example of a Wi-Fi direct communication method.

[0038] Figure 5 This is a schematic diagram of the hardware structure of a possible terminal device provided in an embodiment of this application;

[0039] Figure 6 A software structure block diagram of a terminal device provided in an embodiment of this application;

[0040] Figure 7 Another application scenario of the Wi-Fi direct communication method provided in the embodiments of this application;

[0041] Figure 8 A comparative diagram illustrating an application scenario of a Wi-Fi direct communication method provided in this application embodiment;

[0042] Figure 9 A comparative diagram illustrating another application scenario of a Wi-Fi direct communication method provided in this application embodiment;

[0043] Figure 10 A flowchart illustrating a Wi-Fi direct communication method provided in an embodiment of this application;

[0044] Figure 11 This provides another application scenario for a Wi-Fi direct communication method provided in the embodiments of this application;

[0045] Figure 12 Another application scenario of the Wi-Fi direct communication method provided in the embodiments of this application;

[0046] Figure 13 A combined schematic diagram of a Wi-Fi direct communication method provided in an embodiment of this application;

[0047] Figure 14 Another combined schematic diagram of a Wi-Fi direct communication method provided in the embodiments of this application;

[0048] Figure 15 A schematic diagram of a negotiation process provided in an embodiment of this application;

[0049] Figure 16 This is a schematic diagram of the structure of a terminal device provided in an embodiment of this application. Detailed Implementation

[0050] With the rapid development of society, terminal devices such as mobile phones are becoming increasingly widespread. These devices not only have communication functions but also powerful processing capabilities, storage capacity, and camera functions. Through an operating system, terminal devices execute corresponding applications, allowing users to make calls, send text messages, browse the web, watch videos, and more. Furthermore, to facilitate data sharing between users or file transfer between different terminal devices, P2P groups can be established using Wi-Fi Direct technology. Data packets, such as documents, photos, or videos, can then be exchanged within these P2P groups. Wi-Fi Direct technology, with its high speed, efficiency, and ease of use, is currently widely used in various scenarios involving data sharing between terminal devices. (See also...) Figure 1 This is a schematic diagram of a P2P group. A typical P2P group consists of a group owner (GO) role and at least one group client (GC) role, such as... Figure 1 In this context, there are GO, GC1, ..., GCn. Each GC can communicate with GO to exchange business data packets.

[0051] Wi-Fi Direct is a point-to-point connection technology that allows two terminal devices to establish a Transmission Control Protocol / Internet Protocol (TCP / IP) connection directly, without the need for a traditional Access Point (AP). In a P2P group established using Wi-Fi Direct (also known as Wi-Fi P2P, which may be used interchangeably in the following examples), one terminal device acts as a traditional AP, known as the Go (Go); the other terminal devices in the P2P group are called GCs (GCs). GCs can connect to the GO just like a traditional station (STA) connects to an AP. It should be noted that each P2P group can have one GO and one or more GCs; the relationship between GO and GC can be one-to-one or one-to-many.

[0052] For example, P2P services performed in a P2P group may include: screen mirroring, multi-screen collaboration, distributed image processing, wireless printing, etc.

[0053] Currently, in the Wi-Fi Direct technology standard, when a terminal device is processing P2P services via Wi-Fi Direct, if it initiates a new P2P service that requires connecting to other terminal devices, a channel occupancy issue may occur. For example, ... Figure 2As shown, in P2P group 1, GO and GC1 are performing P2P service processing. If a user has a need to initiate a new P2P service with other terminal devices through GC1, since GC1 already exists in P2P group 1, Wi-Fi P2P between GC1 and other terminal devices outside P2P group 1 cannot be realized.

[0054] Furthermore, even within the same P2P group, GCs cannot establish Wi-Fi P2P connections with each other. Existing technologies allow for P2P service processing between GCs within the same P2P group to be achieved through relay processing by GOs (Gosing Agents). For example... Figure 3 As shown, in P2P group 1, assuming GC 1 needs to initiate Wi-Fi P2P negotiation with GC 2, if GC 1 determines that it belongs to the same P2P group as GC 2, then GC 1 can reuse the GC 1 to GO transmission channel and then use GO as a relay to achieve mutual transmission of service data packets with GC 2. In practice, the service data packets to be transmitted between GC 1 and GC 2 are transmitted at the MAC layer through GO relay, achieving the goal of completing Wi-Fi P2P between GCs at the application layer.

[0055] However, as described in the background section, since the terminal device performing P2P service processing has already occupied the channel for P2P service processing, two terminal devices that do not belong to the same P2P group cannot establish a Wi-Fi P2P connection. For example, as... Figure 4 As shown, assuming there are P2P group 1 and P2P group 2, the GO or GC in P2P group 1 cannot perform Wi-Fi P2P with the GO or GC in P2P group 2, and the GO or GC in P2P group 2 also cannot perform Wi-Fi P2P with the GO or GC in P2P group 1.

[0056] In current Wi-Fi technology standards, the Wi-Fi channels that can be used by Wi-Fi signals are mainly concentrated in the 2.4 GHz and 5 GHz bands. Different P2P groups may use different Wi-Fi channels, or different operating frequencies of their physical transmission channels. Even if the Wi-Fi channels and physical transmission channels use the same operating frequency, Wi-Fi P2P cannot be established because no connection relationship is established between the groups (GO and GC).

[0057] In view of this, embodiments of this application provide a Wi-Fi direct communication method. To address the problem that two terminal devices that do not belong to the same P2P group cannot establish a Wi-Fi P2P connection, the method adopts the design concept of combining two different P2P groups into a new P2P group. The new P2P group includes one GO and multiple GCs, thereby realizing the Wi-Fi P2P connection between the GO and each GC, as well as the Wi-Fi P2P connection between GCs at the MAC layer through the GO and at the application layer.

[0058] The embodiments of this application will now be described in detail with reference to the accompanying drawings.

[0059] It is understood that the terminal device in the embodiments of this application can be such as a mobile phone, tablet computer, wearable device (e.g., watch, bracelet, helmet, earphone, etc.), in-vehicle device, augmented reality (AR) / virtual reality (VR) device, laptop computer, ultra-mobile personal computer (UMPC), netbook, personal digital assistant (PDA), smart home device (e.g., smart TV, smart screen, smart speaker, smart camera, etc.), printer, etc. It is understood that the embodiments of this application do not impose any limitations on the specific type of terminal device.

[0060] The terminal devices to which this application's embodiments can be applied include, but are not limited to, those equipped with... Alternatively, it could be a portable terminal device with another operating system. The aforementioned portable terminal device could also be other portable terminal devices, such as a laptop computer with a touch-sensitive surface (e.g., a touch panel).

[0061] Figure 5 A schematic diagram of a possible hardware structure for a terminal device is shown. The terminal device 200 includes components such as: a radio frequency (RF) circuit 210, a power supply 220, a processor 230, a memory 240, an input unit 250, a display unit 260, an audio circuit 270, a communication interface 280, and a wireless-fidelity (Wi-Fi) module 290. Those skilled in the art will understand that... Figure 5 The hardware structure of the terminal device 200 shown in the figure does not constitute a limitation on the terminal device 200. The terminal device 200 provided in the embodiments of this application may include more or fewer components than shown, may combine two or more components, or may have different component configurations. Figure 5 The various components shown can be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and / or application-specific integrated circuits.

[0062] The following is combined with Figure 5 The various components of the terminal device 200 are described in detail below:

[0063] The RF circuit 210 can be used for receiving and transmitting data during communication or a call. Specifically, after receiving downlink data from the base station, the RF circuit 210 sends it to the processor 230 for processing; additionally, it sends uplink data to be transmitted to the base station. Typically, the RF circuit 210 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low-noise amplifier (LNA), a duplexer, etc.

[0064] In addition, the RF circuit 210 can also communicate wirelessly with networks and other devices. The wireless communication can use any communication standard or protocol, including but not limited to Global System for Mobile Communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, and Short Message Service (SMS).

[0065] Wi-Fi technology is a short-range wireless transmission technology. The terminal device 200 can connect to an access point (AP) via the Wi-Fi module 290, thereby enabling access to the data network. The Wi-Fi module 290 can be used for data reception and transmission during communication. In this embodiment, the terminal device 200 can also exchange service data packets with other terminal devices that have established a Wi-Fi P2P connection via the Wi-Fi module 290.

[0066] The terminal device 200 can physically connect to other devices through the communication interface 280. Optionally, the communication interface 280 can be connected to the communication interfaces of other devices via a cable to enable data transmission between the terminal device 200 and other devices.

[0067] Since the terminal device 200 in this embodiment can implement communication services and interact with other terminal devices, the terminal device 200 needs to have data transmission capabilities, that is, the terminal device 200 needs to include a communication module. Although Figure 5 The RF circuit 210, the Wi-Fi module 290, and the communication interface 280 are shown, but it is understood that the terminal device 200 contains at least one of the above components or other communication modules (such as a Bluetooth module) for data transmission.

[0068] For example, when the terminal device 200 is a mobile phone, the terminal device 200 may include the RF circuit 210, and may also include the Wi-Fi module 290, or may include a Bluetooth module. Figure 5 (Not shown in the image); when the terminal device 200 is a computer, the terminal device 200 may include the communication interface 280, and may also include the Wi-Fi module 290, or may include a Bluetooth module (not shown in the image); Figure 5 (Not shown in the image); when the terminal device 200 is a tablet computer, the terminal device 200 may include the Wi-Fi module, or may include a Bluetooth module (not shown in the image); Figure 5 (Not shown in the image).

[0069] The memory 240 can be used to store software programs and modules. The processor 230 executes various functional applications and data processing of the terminal device 200 by running the software programs and modules stored in the memory 240. Optionally, the memory 240 may mainly include a program storage area and a data storage area. The program storage area may store the operating system (mainly including software programs or modules corresponding to the kernel layer, system layer, application framework layer, and application layer). The application layer may contain various applications, among which, by employing the method provided in this embodiment, content recommendation based on user interests can be achieved in the recommended applications.

[0070] In addition, the memory 240 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, or other volatile solid-state storage device.

[0071] The input unit 250 can be used to receive editing operations on various types of data objects, such as numbers or characters, input by the user, and to generate key signal inputs related to user settings and function control of the terminal device 200. Optionally, the input unit 250 may include a touch panel 251 and other input devices 252.

[0072] The touch panel 251, also known as a touch screen, can collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel 251), and drive the corresponding connection device according to a pre-set program.

[0073] Optionally, the other input devices 252 may include, but are not limited to, one or more of the following: physical keyboard, function keys (such as volume control buttons, power buttons, etc.), trackball, mouse, joystick, etc.

[0074] The display unit 260 can be used to display information input by the user or information provided to the user, as well as various menus of the terminal device 200. The display unit 260 is the display system of the terminal device 200, used to present the interface and realize human-computer interaction. The display unit 260 may include a display panel 261. Optionally, the display panel 261 can be configured as a liquid crystal display (LCD), organic light-emitting diode (OLED), or similar form. In this embodiment, for example, the display unit 260 can display service data packets received by the terminal device 200 from other terminal devices transmitted via Wi-Fi P2P through the Wi-Fi module 290. For example, when the terminal device 200 is a smart screen, it can receive content to be projected from a mobile phone transmitted via Wi-Fi P2P connection, and thus display the transmitted content to be projected through the display panel 261.

[0075] The processor 230 is the control center of the terminal device 200. It connects various components via various interfaces and lines, and executes software programs and / or modules stored in the memory 240, as well as calling data stored in the memory 240, to perform various functions and process data of the terminal device 200, thereby realizing multiple services based on the terminal device 200. In this embodiment, the processor 230 is used to implement the method control flow provided in this embodiment, thus providing a technical solution to address the problem in the prior art where terminal devices in different P2P groups cannot achieve Wi-Fi direct connection.

[0076] The terminal device 200 also includes a power supply 220 (such as a battery) for supplying power to various components. Optionally, the power supply 220 can be logically connected to the processor 230 through a power management system, thereby enabling the power management system to manage functions such as charging, discharging, and power consumption.

[0077] like Figure 5As shown, the terminal device 200 also includes an audio circuit 270, a microphone 271, and a speaker 272, providing an audio interface between the user and the terminal device 200. The audio circuit 270 converts audio data into signals recognizable by the speaker 272 and transmits the signals to the speaker 272, where the speaker 272 converts them into sound signals for output. The microphone 271 collects external sound signals (such as human speech or other sounds) and converts the collected external sound signals into signals recognizable by the audio circuit 270, sending them to the audio circuit 270. The audio circuit 270 can also convert the signals transmitted by the microphone 271 into audio data, outputting the audio data to the RF circuit 220 for transmission to, for example, another terminal device, or outputting the audio data to the memory 240 for further processing.

[0078] Although not shown, the terminal device 200 may also include at least one sensor, a camera, etc., which will not be described in detail here. The at least one sensor may include, but is not limited to, a pressure sensor, a barometric pressure sensor, an accelerometer, a distance sensor, a fingerprint sensor, a touch sensor, a temperature sensor, etc.

[0079] The operating system (OS) involved in this application embodiment is the most basic system software running on the terminal device 200. Taking a smartphone as an example, the operating system can be HarmonyOS, Android, or iOS. The software system of the terminal device 200 can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This application embodiment uses an operating system with a layered architecture as an example to illustrate the software structure of the terminal device 200.

[0080] Figure 6 This is a software structure block diagram of a terminal device provided in an embodiment of this application. For example... Figure 6 As shown, the software architecture of a terminal device can be a layered architecture. For example, the software can be divided into several layers, each with a clear role and division of labor. Layers communicate with each other through software interfaces. In some embodiments, the operating system is divided into five layers, from top to bottom: the application layer, the application framework layer (framework, FWK), the runtime and system libraries, the kernel layer, and the hardware layer.

[0081] The application layer can include a series of application packages. For example... Figure 6 As shown, the application layer can include camera, settings, skin modules, user interface (UI), third-party applications, etc. Third-party applications can include gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, SMS, etc.

[0082] In some embodiments of this application, the application layer can be used to implement the presentation of the editing interface, which can be used by the user for operation. For example, the user can perform screen projection operations on the editing interface corresponding to the video.

[0083] In one possible implementation, the application can be developed using Java, by calling the application programming interface (API) provided by the application framework layer. Developers can then interact with the underlying operating system layers (such as the hardware layer and kernel layer) to develop their own applications. This application framework layer primarily consists of a series of services and management systems within the operating system.

[0084] The application framework layer provides application programming interfaces and a programming framework for applications within the application layer. The application framework layer includes some predefined functions. For example... Figure 6 As shown, the application framework layer may include a shortcut icon management module, a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, etc.

[0085] The shortcut icon management module is used to manage the shortcut icons displayed on the terminal device, such as creating shortcut icons, removing shortcut icons, and monitoring whether shortcut icons meet the display conditions.

[0086] The window manager is used to manage windowed applications. It can obtain the screen size, determine if a status bar is present, lock the screen, and capture screenshots. The content provider stores and retrieves data, making this data accessible to applications. This data may include videos, images, audio, made and received phone calls, browsing history and bookmarks, phone books, etc.

[0087] 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.

[0088] A phone manager is used to provide communication functions for terminal devices. For example, it manages call status (including connection and disconnection).

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

[0090] The notification manager allows applications to display notifications in the status bar. These notifications can be used to deliver informational messages and can disappear automatically after a short pause, requiring no user interaction. For example, the notification manager can be used to notify users of download completion or message alerts. The notification manager can also display notifications as icons or scrolling text in the top status bar, such as notifications from background applications, or as dialog boxes on the screen. Examples include displaying text messages in the status bar, emitting sounds, vibrating the device, and flashing indicator lights.

[0091] In some embodiments of this application, the application framework layer is mainly responsible for calling the service interface for communication with the hardware layer to pass the user's operation request to the hardware layer. The operation request may include the user's operation request to open a certain APP, or the user's operation request for multi-screen collaboration in a certain APP, etc.

[0092] The runtime includes the core libraries and the virtual machine. The runtime is responsible for the scheduling and management of the operating system.

[0093] The core library consists of two parts: one part contains the functionalities that the Java language needs to call, and the other part contains the core libraries of the operating system. The application layer and application framework layer run in the virtual machine. The virtual machine executes the Java files of the application layer and application framework layer as binary files. The virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.

[0094] 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.

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

[0096] The media library supports playback and recording of various common audio and video formats, as well as still image files. It supports multiple audio and video encoding formats, such as MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG.

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

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

[0099] In some embodiments, a 3D graphics processing library can be used to draw 3D motion trajectory images, and a 2D graphics engine can be used to draw 2D motion trajectory images.

[0100] 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.

[0101] The hardware layer can include various types of sensors, such as accelerometers, gyroscopes, and touch sensors.

[0102] Typically, a terminal device 200 can run multiple applications simultaneously. In a simpler scenario, one application corresponds to one process; in a more complex scenario, one application can correspond to multiple processes. Each process has a unique process ID.

[0103] In combination with the above Figure 5 The text describes the hardware structure of the terminal device, and... Figure 6 The software framework of the terminal device is introduced in the previous section. The following section provides an exemplary description of the working principle of the software and hardware of the terminal device executing the Wi-Fi direct communication method proposed in the embodiments of this application, for scenarios in which terminal devices in different P2P groups need to establish a Wi-Fi P2P connection.

[0104] It should be understood that in the embodiments of this application, "at least one" means one or more, and "more than one" means 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 alone, A and B simultaneously, or B 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, a and b, a and c, b and c, or a, b, and c, where a, b, and c can be single or multiple.

[0105] The multiple instances mentioned in the embodiments of this application refer to two or more.

[0106] In addition, it should be understood that in the description of this application, the words "first" and "second" are used only for the purpose of distinguishing descriptions and should not be construed as indicating or implying relative importance or order.

[0107] Furthermore, in the embodiments of this application, "terminal device", "device", "mobile phone", etc. can be used interchangeably, that is, to refer to various devices that can be used to implement the embodiments of this application; "application" and "application program" in the embodiments of this application can also be used interchangeably, both referring to programs or clients with certain business provision capabilities, that is, applications and clients can also be used interchangeably, for example, video clients and game clients can also be called video applications or game applications, etc.

[0108] It should be understood that the hardware structure of a terminal device can be as follows: Figure 5 As shown, the software architecture can be as follows: Figure 6 As shown, the software programs and / or modules corresponding to the software architecture in the terminal device can be stored in the memory 240, and the processor 230 can run the software programs and applications stored in the memory 240 to execute the flow of a Wi-Fi direct communication method provided in the embodiments of this application.

[0109] To facilitate understanding of the Wi-Fi direct communication method provided in this application, the following is combined with... Figures 7 to 15 The content shown describes the implementation process of the method provided in this application.

[0110] The design concept of the method provided in this application is that, when there are scenarios where a first terminal device and a second terminal device belonging to different P2P groups need to establish a Wi-Fi P2P connection, multiple different P2P groups are merged to build the first terminal device and the second terminal device into a new P2P group. In this new P2P group, the GO can exchange service data packets with each GC via a Wi-Fi P2P connection, or the GCs can exchange service data packets with each other through the GO at the MAC layer and via a Wi-Fi P2P connection at the application layer. This can meet the Wi-Fi P2P transmission needs between terminal devices in more scenarios, improve the efficiency of service data packet transmission, and meet the needs of users in various scenarios, thereby improving the user experience.

[0111] For example, in conjunction with the foregoing description Figure 4 As shown, in the prior art, there is a problem that the first terminal device belonging to P2P group 1 cannot establish a new Wi-Fi direct connection with the second terminal device belonging to P2P group 2 due to channel occupancy. Figure 7This is a schematic diagram showing the result after processing using the method provided in this application. The method provided in this application merges P2P group 1 and P2P group 2 to construct a new P2P group 1', thereby enabling Wi-Fi direct connection between the first terminal device and the second terminal device within P2P group 1'. Based on the Wi-Fi direct connection technology standard protocol, a P2P group typically consists of one GO and multiple GCs. Assuming that P2P group 2 is merged into P2P group 1, the GO and GC in P2P group 2 can be connected as GCs to the GO in P2P group 1, such as... Figure 7 Group 1' of the P2P database contains GO, GC 1, GC 2, and GC 3. Figure 7 In the P2P group 1' shown, GO establishes Wi-Fi P2P connections with GC 1, GC 2, and GC 3 respectively, thus enabling P2P services to be processed via Wi-Fi P2P connections. Between any two terminal devices in GC 1, GC 2, and GC 3, P2P services can be processed via a Wi-Fi P2P connection, relayed through GO at the MAC layer and then at the application layer. The GO in P2P group 1' can be determined according to preset merging rules, the specific merging rules of which are explained in conjunction with the following embodiments and will not be detailed here.

[0112] It should be noted that the embodiments of this application use the merging of two different P2P groups as an example. When there are multiple scenarios where Wi-Fi P2P transmission needs to be established between more terminal devices belonging to different P2P groups, the embodiments described in this application can be referred to to reconstruct multiple different P2P groups into a new P2P group. An optional example is that multiple different P2P groups can be merged step by step. For example, if there are P2P group 1, P2P group 2 and P2P group 3, where the first terminal device in P2P group 1 needs to establish a new Wi-Fi direct connection with the second terminal device in P2P group 2, and the third terminal device in P2P group 2 needs to establish a new Wi-Fi direct connection with the third terminal device in P2P group 3, then P2P group 1 and P2P group 2 can be merged into a new P2P group 1', and then P2P group 1' and P2P group 3 can be merged into a new P2P group 3'. Another alternative example is that terminal devices from multiple different P2P groups negotiate together to determine the GO (Go) method of the new P2P group after the group merger. Following the example of the previous example, the first terminal device, the second terminal device, and the third terminal device can also negotiate together. For example, the negotiation result can be to merge P2P group 1 and P2P group 3 into P2P group 2 to obtain the new P2P group 2'.

[0113] To better understand this application, the following section will introduce several possible application scenarios.

[0114] Scenario 1 Figure 8 A comparison diagram illustrating application scenarios of a Wi-Fi direct communication method provided in this application embodiment. For example... Figure 8 As shown in (a), suppose a first terminal device (phone 1) is projecting onto a smart screen in P2P group 1, with phone 1 acting as GC 1 and the smart screen as GO 1 in P2P group 1; and suppose a second terminal device (phone 2) is collaborating with a tablet computer in P2P group 2, with phone 2 acting as GC 2 and the tablet computer as GO 2 in P2P group 2. In this case, if a user triggers a photo sharing operation from phone 1 to phone 2 via face-to-face file transfer, the existing technology suffers from P2P channel occupancy issues because phone 1 and phone 2 belong to different P2P groups' GCs. This prevents the establishment of a Wi-Fi direct connection, thus causing photo sharing to fail. Face-to-face file transfer methods, such as "Huawei Share" and "Face-to-Face Quick Transfer," are file transfer methods based on Wi-Fi P2P connections.

[0115] Using the method provided in this application, if a user triggers a photo sharing operation from mobile phone 1 to mobile phone 2 via face-to-face file transfer, mobile phone 1 and mobile phone 2 can negotiate a group merging process to merge P2P group 1 and P2P group 2 into P2P group 1'. Figure 8 The content shown in (b) is as follows. In P2P group 1', the smart screen can be used as GO 1', and mobile phone 1, mobile phone 2, and tablet computer can be used as GCs in P2P group 1'. In this way, mobile phone 1 and mobile phone 2 can establish a Wi-Fi direct connection in P2P group 1', enabling users to share pictures by transferring files face-to-face. In P2P group 1', mobile phone 1 and mobile phone 2, as GCs, can achieve Wi-Fi P2P connection by relaying service data packets through GO. For example, service data packets can be relayed by GO at the MAC layer, thereby enabling mobile phone 1 and mobile phone 2 to establish a Wi-Fi P2P connection at the application layer.

[0116] Scenario 2 Figure 9 This is a comparative diagram illustrating another application scenario of the Wi-Fi Direct Communication method provided in the embodiments of this application. (Continued...) Figure 8 In the example provided, users can also trigger image sharing to a tablet via a face-to-face file transfer method using a smart screen. However, in existing technologies, since the smart screen (GO1) and the tablet (GO2) belong to different P2P groups, the P2P channel is also occupied, which can lead to sharing failure. Figure 9The content shown in (a) is illustrated. Using the method provided in this application, a Wi-Fi P2P connection can be established between the smart screen (GO1) and the tablet computer (GO2) in P2P group 1', which is also obtained by merging P2P group 1 and P2P group 2, as shown in [example image]. Figure 9 The content shown in (b) is shown in the middle.

[0117] Furthermore, in real-world scenarios, there may be needs for multi-screen collaboration between a smart screen (GO1) and a mobile phone 2 (GC2). This application will not list all other possible application scenarios. It is understood that in the prior art, if the first terminal device has already established a Wi-Fi P2P connection in P2P group 1, establishing a Wi-Fi P2P connection with a second terminal device belonging to P2P group 2 will fail due to P2P channel occupancy. However, this application, by merging P2P group 1 and P2P group 2, can achieve the establishment of a Wi-Fi P2P connection between the first and second terminal devices.

[0118] based on Figure 8 and Figure 9 The application scenarios shown below, combined with Figure 10 The specific implementation process of the method provided in this application is described in detail. For ease of understanding, Figure 10 Continued use Figure 8 The example described illustrates a scenario where a first terminal device (phone 1) is projecting onto a smart screen in P2P group 1, and a second terminal device (phone 2) is collaborating with a tablet in P2P group 2. If a user initiates a photo sharing operation from phone 1 to phone 2 using the face-to-face quick transfer method, the specific processing procedures for multiple terminal devices within different P2P groups will be explained. It should be noted that... Figure 10 China and Israel Figure 8 The examples provided are for illustrative purposes only, but this application does not limit the scope of these examples. It is understood that the methods provided in this application are applicable to various possible scenarios where a first terminal device and a second terminal device belonging to different P2P groups need to establish a Wi-Fi P2P connection.

[0119] Furthermore, in the embodiments described below, smartphones are used as examples of the first and second terminal devices. However, this application is not limited to smartphones. Any terminal device that can establish a Wi-Fi P2P connection can be used as the first or second terminal device in this application. For example, the first or second terminal device can also be a laptop computer, a car computer, etc.

[0120] See Figure 10 This is a flowchart illustrating a Wi-Fi direct communication method provided in an embodiment of this application. Specifically, it may include the following steps:

[0121] S1001: The first terminal device initiates a Wi-Fi P2P connection establishment request to the second terminal device. For example, there can be various application scenarios where the first terminal device initiates a Wi-Fi P2P connection establishment request to the second terminal device. For instance, the first terminal device may need to initiate a face-to-face file transfer request to the second terminal device, or the first terminal device may initiate a screen mirroring request to the second terminal device. It should be understood that the terms "first terminal device" and "second terminal device" in this application embodiment are only used for distinguishing description.

[0122] One possible scenario is illustrated by taking the application scenario where the first terminal device initiates a Huawei sharing request to the second terminal device as an example. (See also...) Figure 11 In a scenario where mobile phone 1 (GC1) is casting to a smart screen (GO1) in P2P group 1, and mobile phone 2 (GC2) is collaborating with a tablet computer (GO2) in P2P group 2, user 1 may also want to share a picture from their gallery while using mobile phone 1. Specifically, this could involve user 1 clicking the "Share" control on the display screen showing the picture to be shared. Figure 11 The user operation is shown in (1) above. Then, if the "Huawei Share" function on phone 1 was not enabled before this, user 1 can... Figure 11 In the display interface shown in (2), click operation 2 to enable Huawei Share function on mobile phone 1 (GC1); according to click operation 2, mobile phone 1 can refresh the display interface by searching for other Wi-Fi P2P connections with Huawei Share function enabled. Figure 11 (3) shows the identifiers of multiple other terminal devices that can be found through Wi-Fi P2P search; finally, user 1 can click operation 3 on the control displayed as user 2's mobile phone 2 (GC2), and mobile phone 1 can initiate a Wi-Fi P2P connection request to mobile phone 2 based on click operation 3. Alternatively, if the "Huawei Share" function in mobile phone 1 has been enabled before this, mobile phone 1 can also directly refresh the display interface based on click operation 1. Figure 11 (3) The subsequent processing is similar to the above-mentioned content, and will not be repeated here.

[0123] In another possible scenario, the request from the first terminal device to establish a Wi-Fi P2P connection to the second terminal device might be triggered by a switchover from a local area network transmission method based on a Wi-Fi hotspot. See also... Figure 12In a scenario where mobile phone 1 (GC1) is projecting its screen onto a smart screen (GO1) in P2P group 1, and mobile phone 2 (GC2) is collaborating with a tablet computer (GO2) in P2P group 2, there may also be instances where mobile phone 1 and mobile phone 2 share photos via a local area network (LAN) based on a Wi-Fi hotspot. However, LANs established via Wi-Fi hotspots may experience transmission instability, leading to lag. In this application, when either the first or second terminal device detects a deterioration or abnormality in data transmission status at the service level, it can switch to a Wi-Fi P2P-based transmission method, thereby improving data transmission efficiency. Optionally, if both mobile phone 1 and mobile phone 2 have Huawei Share enabled, mobile phone 1 can initiate a request to mobile phone 2 to establish a Wi-Fi P2P connection via Huawei Share. Alternatively, if both mobile phone 1 and mobile phone 2 have Bluetooth enabled, mobile phone 1 can also initiate a request to mobile phone 2 to establish a Wi-Fi P2P connection via Bluetooth.

[0124] S1002: The first terminal device and the second terminal device establish an information transmission channel. For example, the first terminal device and the second terminal device can establish a trusted information transmission channel using Bluetooth or a wireless local area network (WLAN). Through this information transmission channel, the first terminal device and the second terminal device can exchange P2P status information, thereby enabling group merging negotiation.

[0125] S1003: The first terminal device and the second terminal device exchange P2P status information through the information transmission channel.

[0126] The first terminal device can send first P2P status information to the second terminal device. The first P2P status information may include, but is not limited to, the following information: group information of P2P group 1 and service information of P2P group 1.

[0127] For example, the group information of P2P group 1 may include, but is not limited to: service set identifier (SSID) used to distinguish different P2P groups, name of basic service set (BSS) BSSID, Wi-Fi channel used, operating frequency of physical transmission channel, channel bandwidth, GO role and GC role, media access control (MAC) address and Internet protocol (IP) address of GO, MAC address and IP address of each GC, etc.

[0128] The business information for P2P Group 1 may include, but is not limited to: business type (such as screen mirroring, multi-screen collaboration, or face-to-face file transfer), business priority, amount of business data to be transmitted, and current average business transmission speed.

[0129] The second terminal device can send second P2P status information to the first terminal device. The second P2P status information can refer to the first P2P status information and includes relevant information about the P2P group 2 to which the second terminal device belongs. This will not be elaborated further.

[0130] In this way, the first terminal device and the second terminal device can learn about the status of the Wi-Fi P2P that the other has established through the sharing of P2P status information, and thus negotiate the group merging.

[0131] S1004: Negotiation between the first terminal device and the second terminal device for group merging.

[0132] Optionally, the first terminal device (mobile phone 1) performs group merging negotiation based on locally stored first P2P state information and received second P2P state information. Alternatively, the second terminal device (mobile phone 2) performs group merging negotiation based on locally stored second P2P state information and received first P2P state information. During implementation, the terminal device performing the group merging negotiation can be determined based on information such as the type of terminal device and / or the request initiator. For example, if the processor of mobile phone 1 has stronger performance than the processor of mobile phone 2, then mobile phone 1 can perform the group merging negotiation. The first or second terminal device can also share the negotiation results. This means that if mobile phone 1 performs the group merging negotiation, after obtaining the negotiation results, mobile phone 1 can send them to mobile phone 2 through an information transmission channel.

[0133] For example, taking the negotiation process of group merging by a first terminal device as an example, the first terminal device can perform the negotiation process according to a preset merging rule. The preset merging rule may include, but is not limited to, the rules shown below:

[0134] Rule 1: P2P groups with a small number of terminal devices are merged into P2P groups with a large number of terminal devices. For example, Figure 13This is a schematic diagram illustrating the merging of a Wi-Fi direct communication method according to an embodiment of this application. Assume that P2P group 1 contains 3 terminal devices and P2P group 2 contains 2 terminal devices. Considering that a P2P group with more terminal devices may have more service transmissions, such as service transmissions between GO and GC 1 in P2P group 1, service transmissions between GO and GC 2, and service transmissions between GC 1 and GC 2 via GO, in order to reduce the impact of merging P2P group 1 and P2P group 2 on the original P2P connection, P2P group 2 can be merged into P2P group 1. This can be understood as connecting the GO and GC contained in P2P group 2 as GCs to the GO in P2P group 1, resulting in a new P2P group 1'.

[0135] Rule 2: P2P groups with low service priority are merged into P2P groups with high service priority. For example, if all services in P2P group 1 are at the normal level, and the services processed in P2P group 2 include the urgent level, then the GOs and at least one GCs in P2P group 1 are connected as GCs to the GOs in P2P group 2 to minimize the impact on the urgent level services in P2P group 2.

[0136] Rule 3: P2P groups with smaller channel bandwidth are merged into P2P groups with larger channel bandwidth. For example, Figure 14 This is another combined schematic diagram of a Wi-Fi direct communication method provided in an embodiment of this application. Assume P2P group 1 operates on channel 1, with a physical transmission channel operating at a frequency of 5180 kHz and a bandwidth of 80 MHz. P2P group 21 operates on channel 6, with a physical transmission channel operating at a frequency of 2437 kHz and a bandwidth of 20 MHz. Considering that channels with larger bandwidth have higher transmission efficiency for service data packets, P2P group 2 can be merged into P2P group 1. This can be understood as connecting the GO and GC contained in P2P group 2 as GC to the GO in P2P group 1, resulting in a new P2P group 1'. The operating channel of P2P group 1' is multiplexed from the operating channel of P2P group 1, which is channel 1.

[0137] Rule 4: P2P groups with low traffic should be merged into P2P groups with high traffic. This reduces the impact on existing P2P connections in high-traffic P2P groups.

[0138] Rule 5: P2P groups with weaker GO performance are merged into P2P groups with stronger GO performance. For example, device performance can be processing power. If the GO in P2P group 1 is a mobile phone and the GO in P2P group 2 is a tablet computer (tablet computers typically have stronger processing power), then the GO in P2P group 1 and at least one GC are connected as a GC to the GO in P2P group 2. Another example is power consumption performance. If the GO in P2P group 1 has a larger battery capacity or more remaining battery power than the GO in P2P group 2, then P2P group 2 can be merged into P2P group 1. Other examples include radio frequency performance or a combination of multiple performance aspects, which will not be detailed here. This ensures the performance of the GO in the merged new P2P group for multiple connected GCs, thereby guaranteeing the service transmission capacity and stability within the P2P group.

[0139] Rule 6: The P2P group of the Wi-Fi P2P connection request initiator is merged into the P2P group of the requestee.

[0140] In one possible merging scenario, Figure 15 This is a schematic diagram illustrating a negotiation process provided in an embodiment of this application. It should be noted that... Figure 15 The illustration shows one possible merging scenario. In practice, this application may employ more or fewer rules, and the order of judgment for multiple different rules may be changed; this application does not limit these aspects. The first terminal device in P2P group 1 can perform group merging negotiation processing according to the following flow:

[0141] S1501: The first terminal device determines whether the number of terminals contained in P2P group 2 and P2P group 1 are equal. If they are equal, the first terminal device executes S1502b; otherwise, it executes S1502a.

[0142] S1502a, The first terminal device merges the P2P group containing a small number of terminal devices into the P2P group containing a large number of terminal devices.

[0143] S1502b: The first terminal device determines whether the service priorities of P2P group 2 and P2P group 1 are equal. If they are equal, the first terminal device executes S1503b; otherwise, it executes S1503a.

[0144] S1503a, The first terminal device merges P2P groups with low service priority into P2P groups with high service priority.

[0145] S1503b: The first terminal device determines whether the channel bandwidths of P2P group 2 and P2P group 1 are equal. If they are equal, the first terminal device executes S1504b; otherwise, it executes S1504a.

[0146] S1504a, The first terminal device merges the P2P groups with smaller channel bandwidth into the P2P groups with larger channel bandwidth.

[0147] S1504b: The first terminal device determines whether the service volume of P2P group 2 and P2P group 1 are equal. If they are equal, the first terminal device executes S1505b; otherwise, it executes S1505a.

[0148] S1505a, The first terminal device merges P2P groups with low traffic into P2P groups with high traffic.

[0149] S1505b: The first terminal device determines whether the GO performance of P2P group 2 and P2P group 1 is equal. If they are equal, the first terminal device executes S1506b; otherwise, it executes S1506a.

[0150] S1506a, The first terminal device merges P2P groups with weak GO performance into P2P groups with strong GO performance.

[0151] S1506b, The first terminal device merges the P2P group 1 to which the request initiator, the first terminal device, belongs into the P2P group 2 to which the request recipient, the second terminal device, belongs.

[0152] It should be noted that if the group merging negotiation is handled by a second terminal device, the process is similar and will not be repeated here.

[0153] Following the aforementioned S1004, the embodiments of this application may further include the following steps:

[0154] S1005a: The first terminal device sends the negotiation result to at least one other terminal device included in P2P group 1. For example, in... Figure 10 If the content shown includes a smart screen in P2P group 1, then the first terminal device (mobile phone 1) will send the negotiation result to the smart screen.

[0155] The information included in the negotiation result may include, but is not limited to, the merging method and the group information of the target merging group. For example, the merging method may be to merge P2P group 1 into P2P group 2, or to merge P2P group 2 into P2P group 1. Furthermore, assuming the target merging group is P2P group 1, the group information of the target merging group can be as illustrated in the example described in S1003 above, so that the terminal devices involved in the P2P group that needs to be merged can promptly determine the status of the P2P group, thereby ensuring the efficiency of the P2P service.

[0156] S1005b: The second terminal device sends the negotiation result to at least one other terminal device included in P2P group 2. For example, in... Figure 10 If the content shown includes a tablet computer in P2P group 2, then the second terminal device (mobile phone 2) will send the negotiation results to the tablet computer.

[0157] Assuming that the negotiation result sent by S1005a and S1005b is to merge P2P group 2 into P2P group 1, the multiple terminal devices contained in P2P group 2 can perform a chain-breaking process on the original P2P connection. Then, the multiple terminal devices contained in P2P group 2 after the chain-breaking process are connected as GCs to the GO of P2P group 1. It can be understood that each terminal device in P2P group 2 initiates a Wi-Fi P2P connection establishment request to the GO in P2P group 1 according to the MAC address and IP address of the GO role in P2P group 1 contained in the negotiation result, so as to achieve the purpose of connecting with the GO in P2P group 1 respectively.

[0158] In this application embodiment, the execution order of S1005a and S1005b is not limited.

[0159] Based on such Figure 10 The content shown includes a second terminal device and a tablet computer. The following describes the disconnection process of the second terminal device and the tablet computer, as well as the Wi-Fi P2P reconnection process after disconnection.

[0160] The implementation process of the second terminal device may include the following steps S1006a to S1010a.

[0161] S1006a. The second terminal device saves the service information of the second P2P group (P2P group 2) based on the service status of the second P2P group (P2P group 2). The service information of P2P group 2 may include, but is not limited to, pairing relationships and service transmission status. The pairing relationship indicates the allocation relationship of GO and GC roles in P2P group 2, as well as the MAC addresses and IP addresses of other terminal devices that have established P2P connections with the second terminal device in P2P group 2, to facilitate service recovery in the new P2P group after group merging. The service transmission status information indicates the service type, service transmission progress, service caller packet name, and average service transmission speed of the P2P service processed by the second terminal device in P2P group 2, so that after group merging, the second terminal device can accurately restore the service in the new P2P group, restoring the service transmission status of the disconnected P2P group 2 before disconnection, thereby ensuring the continued processing of the original P2P service.

[0162] S1007a. The second terminal device and the tablet computer disconnect the P2P connection. For example, the second terminal device (GC) initiates a Wi-Fi P2P disconnect request (such as a P2P disconnect command) to the tablet computer (GO) to notify the tablet computer to destroy the Wi-Fi P2P connection established between the second terminal device and the tablet computer.

[0163] S1008a, The second terminal device initiates a request to establish a Wi-Fi P2P connection to the GO in P2P group 1.

[0164] S1009a, the connection between the second terminal device and the first terminal device is a Wi-Fi P2P connection relayed by the GO in P2P group 1. For example, after the second terminal device establishes a Wi-Fi P2P connection with the GO in P2P group 1, the second terminal device and the first terminal device are both GCs of the same GO (smart screen), which can realize the relay of service data packets through the GO at the MAC layer and the implementation of P2P service processing at the application layer.

[0165] S1010a: The second terminal device resumes the original service processing according to the P2P group 2 service information. For example, after the second terminal device establishes a Wi-Fi P2P connection with the GO in P2P group 1, and determines that the tablet computer has also established a Wi-Fi P2P connection with the GO, it re-initiates the P2P service with the tablet computer according to the P2P group 2 service information; for example, if the last character of the original P2P service transmission is obtained from the P2P group 2 service information, the second terminal device restarts sending or receiving from the character following the last character.

[0166] It should be noted that this application does not limit the execution order between S1009a and S1010a. In practice, S1010a can be executed first and then S1009a can be executed, or S1010a and S1009a can be executed synchronously through multiple processes.

[0167] The implementation process of a tablet computer may include the following steps S1006b to S1010b.

[0168] S1006b: The tablet computer stores the P2P Group 2 service information. The P2P Group 2 service information can be referenced from the P2P Group 2 service information stored by the second terminal device described in S1006a above, and will not be repeated here.

[0169] S1007b: The tablet computer and the second terminal device perform P2P group disconnection. For example, the tablet computer (GO) initiates a Wi-Fi P2P disconnection request (such as a P2P disconnect command) to the second terminal device (GC). After receiving a confirmation message from the second terminal device, the tablet computer performs the P2P disconnection process. Alternatively, upon receiving the Wi-Fi P2P disconnection request initiated by the second terminal device, the tablet computer suspends the ongoing P2P service in its current P2P group 2, saves the P2P group 2 service information, and then performs P2P disconnection processing for the Wi-Fi P2P connection between the second terminal devices.

[0170] S1008b: The tablet computer establishes a Wi-Fi P2P connection with the GO in P2P group 1.

[0171] S1009b, the connection between the tablet and the second terminal device is a Wi-Fi P2P connection relayed by GO in P2P group 1.

[0172] S1010b: The tablet computer resumes the original service processing according to the P2P group 2 service information. For example, the tablet computer receives the P2P service request re-initiated by the second terminal device and receives or sends the original P2P service transmission data according to the P2P group 2 service information.

[0173] It should be noted that this application does not limit the execution order between S1009b and S1010b. In practice, S1010b can be executed first and then S1009b can be executed, or S1010b and S1009b can be executed synchronously through multiple processes.

[0174] The Wi-Fi direct communication method provided in this application addresses scenarios where a Wi-Fi P2P connection needs to be established between a first terminal device and a second terminal device belonging to different P2P groups. It employs a group merging approach for multiple different P2P groups. Specifically, through negotiation processing of the group merging between the first and second terminal devices, one P2P group is disjointed and then connected as the GC of another P2P group to the GO of that other P2P group. This results in a new P2P group containing the terminal devices from the original multiple different P2P groups. Wi-Fi direct communication between the terminal devices from the original multiple different P2P groups can then be established through this new P2P group.

[0175] Based on the same technological concept Figure 16The illustration shows a terminal device 1600 provided in an embodiment of this application. The terminal device 1600 can be a second terminal device or a first terminal device in the above method embodiments. The terminal device 1600 includes one or more processors 1601; one or more memories 1602; a communication interface 1603; and one or more computer programs 1604. These components can be connected via one or more communication buses 1605. The communication interface 1603 is used to communicate with other devices (e.g., if the terminal device 1600 is a first terminal device, the other devices can be second terminal devices), such as a transceiver. The one or more computer programs 1604 are stored in the memory 1602 and configured to be executed by the one or more processors 1601. The one or more computer programs 1604 include instructions that can be used to perform the following steps:

[0176] The second terminal device receives a Wi-Fi P2P connection establishment request initiated by the first terminal device, or the second terminal device initiates a Wi-Fi P2P connection establishment request to the first terminal device. The second terminal device belongs to a second peer-to-peer P2P group, and the first terminal device belongs to a first P2P group. The second terminal device and the first terminal device negotiate the merging of P2P groups and obtain a negotiation result. The negotiation result is used to indicate that the second P2P group and the first P2P group are merged into a third P2P group. The second terminal device establishes a Wi-Fi P2P connection with the first terminal device in the third P2P group.

[0177] In one possible design, before the second terminal device negotiates P2P group merging with the first terminal device, the second terminal device sends second P2P status information to the first terminal device, the second P2P status information indicating the second P2P group; and the second terminal device receives first P2P status information sent by the first terminal device, the first P2P status information indicating the first P2P group. The negotiation between the second terminal device and the first terminal device for P2P group merging includes: the second terminal device negotiating P2P group merging with the first terminal device based on the second P2P status information and the first P2P status information.

[0178] In one possible design, the second terminal device negotiates a P2P group merging with the first terminal device, including: the second terminal device determining the second group owner (GO) role in the second P2P group and the first GO role in the first P2P group; the second terminal device determining, based on a preset merging rule, that the second GO or the first GO is the third GO in the third P2P group; and the second terminal device outputting a negotiation result based on the third GO; wherein, if the second GO is determined to be the third GO, the negotiation result is to merge the first P2P group into the second P2P group; and if the first GO is determined to be the third GO, the negotiation result is to merge the second P2P group into the first P2P group.

[0179] In one possible design, if the negotiation result is to merge the second P2P group into the first P2P group, the second terminal device saves the service information of the second P2P group based on the service status of the second P2P group; the second terminal device disconnects the P2P group from the second GO, the disconnection being used to break the Wi-Fi P2P connection between the second terminal device and the second GO; the second terminal device initiates a request to the third GO to establish a Wi-Fi P2P connection; the second terminal device receives a confirmation message from the third GO, the confirmation message indicating that the third GO agrees to the second terminal device joining the third P2P group.

[0180] In one possible design, the second terminal device restores its service status in the second P2P group based on the service information of the second P2P group in the third P2P group.

[0181] In one possible design, the second terminal device sends the negotiation result to at least one other terminal device in the second P2P group, so that each of the other terminal devices can establish a Wi-Fi P2P connection with the third GO after disconnecting from the second P2P group.

[0182] In one possible design, the preset merging rules include one or more of the following rules: P2P groups with fewer terminal devices are merged into P2P groups with more terminal devices; P2P groups with low service priority are merged into P2P groups with high service priority; P2P groups with small channel bandwidth are merged into P2P groups with large channel bandwidth; P2P groups with low traffic volume are merged into P2P groups with high traffic volume; P2P groups with weak GO performance are merged into P2P groups with strong GO performance; and P2P groups initiated by Wi-Fi P2P connection request initiators are merged into P2P groups initiated by the recipients.

[0183] In one possible design, the second terminal device establishes a Wi-Fi P2P connection with the first terminal device in the third P2P group, including: if the second terminal device and the first terminal device are both group client GC roles in the third P2P group, the second terminal device and the first terminal device establish a Wi-Fi P2P connection through the GO role in the third P2P group.

[0184] Through the above description of the embodiments, those skilled in the art will clearly understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In practical 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. The specific working process of the system, device, and unit described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0185] In the embodiments of this application, the functional units 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.

[0186] 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 computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, essentially, 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 computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as flash memory, portable hard disk, read-only memory, random access memory, magnetic disk, or optical disk.

[0187] The above description is merely a specific implementation of the embodiments of this application, but the protection scope of the embodiments of this application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the embodiments of this application should be covered within the protection scope of the embodiments of this application. Therefore, the protection scope of the embodiments of this application should be determined by the protection scope of the claims.

Claims

1. A wireless fidelity Wi-Fi direct communication method, characterized in that, The method includes: The second terminal device receives a Wi-Fi P2P connection establishment request initiated by the first terminal device, or the second terminal device initiates a Wi-Fi P2P connection establishment request to the first terminal device. The second terminal device belongs to the second peer-to-peer P2P group, and the first terminal device belongs to the first P2P group. The first terminal device is a client GC within the first P2P group, and the second terminal device is a second GC within the second P2P group. The second terminal device negotiates with the first terminal device to merge the P2P groups and obtains a negotiation result. The negotiation result is used to indicate that the second P2P group and the first P2P group are merged into a third P2P group. The second terminal device establishes a Wi-Fi P2P connection with the first terminal device in the third P2P group.

2. The method according to claim 1, characterized in that, Before the second terminal device and the first terminal device negotiate P2P group merging, the method further includes: The second terminal device sends second P2P status information to the first terminal device, the second P2P status information being used to indicate the second P2P group; and The second terminal device receives the first P2P status information sent by the first terminal device, and the first P2P status information is used to indicate the first P2P group; The second terminal device negotiates a P2P group merge with the first terminal device, including: The second terminal device negotiates with the first terminal device to merge P2P groups based on the second P2P status information and the first P2P status information.

3. The method according to claim 1 or 2, characterized in that, The second terminal device negotiates a P2P group merge with the first terminal device, including: The second terminal device determines the second group owner GO role in the second P2P group and the first GO role in the first P2P group; The second terminal device determines the second GO or the first GO as the third GO in the third P2P group based on a preset merging rule; The second terminal device outputs a negotiation result based on the third GO; wherein, if the second GO is determined to be the third GO, the negotiation result is to merge the first P2P group into the second P2P group; if the first GO is determined to be the third GO, the negotiation result is to merge the second P2P group into the first P2P group.

4. The method according to claim 3, characterized in that, If the negotiation result is to merge the second P2P group into the first P2P group, the method further includes: The second terminal device saves the service information of the second P2P group based on the service status of the second P2P group; The second terminal device disconnects from the second GO via P2P group disconnection, which is used to disconnect the Wi-Fi P2P connection between the second terminal device and the second GO. The second terminal device initiates a Wi-Fi P2P connection establishment request to the third GO; The second terminal device receives a confirmation message from the third GO, which indicates that the third GO agrees to the second terminal device joining the third P2P group.

5. The method according to claim 4, characterized in that, The method further includes: The second terminal device restores its service status in the second P2P group according to the service information of the second P2P group in the third P2P group.

6. The method according to claim 3, characterized in that, The method further includes: The second terminal device sends the negotiation result to at least one other terminal device in the second P2P group, so that each of the other terminal devices can disconnect from the second P2P group and establish a Wi-Fi P2P connection with the third GO respectively.

7. The method according to claim 3, characterized in that, The preset merging rules include one or more of the following rules: P2P groups with a small number of terminal devices are merged into P2P groups with a large number of terminal devices; P2P groups with low business priority are merged into P2P groups with high business priority. P2P groups with smaller channel bandwidth are merged into P2P groups with larger channel bandwidth; P2P groups with low business volume are merged into P2P groups with high business volume. P2P groups with weak GO performance are merged into P2P groups with strong GO performance; The P2P group of the Wi-Fi P2P connection request initiator is merged into the P2P group of the request recipient.

8. The method according to claim 1 or 2, characterized in that, The second terminal device establishes a Wi-Fi P2P connection with the first terminal device in the third P2P group, including: If the second terminal device and the first terminal device are GC roles in the third P2P group, the second terminal device and the first terminal device establish a Wi-Fi P2P connection through the GO role in the third P2P group.

9. A Wi-Fi direct communication system, characterized in that, The system includes a first P2P group and a second P2P group. The first P2P group includes a first owner (GO) and a first terminal device. The second P2P group includes a second GO and a second terminal device. The first terminal device is a first client GC within the first P2P group, and the second terminal device is a second GC within the second P2P group. The first terminal device initiates a Wi-Fi P2P connection establishment request to the second terminal device, or the second terminal device initiates a Wi-Fi P2P connection establishment request to the first terminal device; The first terminal device and the second terminal device negotiate the merging of P2P groups and obtain a negotiation result. The negotiation result is used to indicate that the second P2P group and the first P2P group are merged into a third P2P group. Based on the negotiation results, the first P2P group and the second P2P group form the third P2P group; The first terminal device and the second terminal device establish a Wi-Fi P2P connection in the third P2P group.

10. The system according to claim 9, characterized in that, Before the first terminal device and the second terminal device negotiate the P2P group merging, The first terminal device sends first P2P status information to the second terminal device, or the second terminal device sends second P2P status information to the first terminal device; the first P2P status information is used to indicate the first P2P group, and the second P2P status information is used to indicate the second P2P group. The negotiation between the first terminal device and the second terminal device for merging P2P groups includes: determining the negotiation result based on the second P2P status information and the first P2P status information.

11. The system according to claim 9 or 10, characterized in that, The negotiation between the first terminal device and the second terminal device for P2P group merging includes: Based on preset merging rules, the second GO or the first GO is determined to be the third GO in the third P2P group; The negotiation result is output according to the third GO; wherein, if the second GO is determined to be the third GO, the negotiation result is to merge the first P2P group into the second P2P group; if the first GO is determined to be the third GO, the negotiation result is to merge the second P2P group into the first P2P group.

12. The system according to claim 11, characterized in that, If the negotiation result is to merge the second P2P group into the first P2P group, the second terminal device saves the service information of the second P2P group based on the service status of the second P2P group. The second terminal device disconnects from the second GO via P2P group disconnection, which is used to disconnect the Wi-Fi P2P connection between the second terminal device and the second GO. The second terminal device initiates a Wi-Fi P2P connection establishment request to the third GO; and the second GO initiates a Wi-Fi P2P connection establishment request to the third GO; The second terminal device receives a confirmation message from the third GO, the confirmation message being used to instruct the third GO to agree to the second terminal device joining the third P2P group; The second GO receives a confirmation message from the third GO, the confirmation message indicating that the third GO agrees to the second GO joining the third P2P group; the second GO is the GC in the third P2P group.

13. The system according to claim 12, characterized in that, The second terminal device restores the service status of the second terminal device and the second GO in the second P2P group according to the service information of the second P2P group.

14. The system according to claim 9 or 10, characterized in that, The second terminal device sends the negotiation result to at least one other terminal device in the second P2P group; and, The first terminal device sends the negotiation result to at least one other terminal device in the first P2P group.

15. The system according to claim 11, characterized in that, The preset merging rules include one or more of the following rules: P2P groups with a small number of terminal devices are merged into P2P groups with a large number of terminal devices; P2P groups with low business priority are merged into P2P groups with high business priority. P2P groups with smaller channel bandwidth are merged into P2P groups with larger channel bandwidth; P2P groups with low business volume are merged into P2P groups with high business volume. P2P groups with weak GO performance are merged into P2P groups with strong GO performance; The P2P group of the Wi-Fi P2P connection request initiator is merged into the P2P group of the request recipient.

16. The system according to claim 11, characterized in that, The first terminal device and the second terminal device establish a Wi-Fi P2P connection in the third P2P group, including: The first terminal device and the second terminal device establish a Wi-Fi P2P connection through the GO role in the third P2P group.

17. A terminal device, characterized in that, include: One or more processors; one or more memories; The one or more memories are used to store one or more computer programs and data information; wherein the one or more computer programs include instructions; When the instructions are executed by the one or more processors, the terminal device performs the method as described in any one of claims 1 to 8.

18. A computer-readable storage medium, characterized in that, Includes a computer program or instructions that, when run on a computer, cause the method as described in any one of claims 1 to 8 to be performed.

19. A computer program product, characterized in that, Includes a computer program that, when run on a computer, causes the computer to perform the method as described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Method and apparatus for handling topology in wireless communication system

    CN104429155A

  • Group formation control in multi-group peer-to-peer network

    US20190014172A1