P2P communication method, P2P communication discovery method, terminal device and storage medium

By modifying the work list of the wireless communication chip and deleting the DFS channel identification, the problem of low stability and reliability between terminal devices supporting DFS channels and not supporting DFS channels is solved, and a more stable P2P connection is achieved.

CN119767441APending Publication Date: 2025-04-04HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311295598.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-09-28
Publication Date
2025-04-04

AI Technical Summary

Technical Problem

When the prior art establishes a P2P connection between a terminal device that supports a DFS channel and a terminal device that does not support a DFS channel, the connection stability and reliability are not high, and connection failure or connection disconnection is prone to occur.

Method used

By modifying the work list of the wireless communication chip, deleting the DFS channel identification, ensuring that the connection is successfully established on the terminal device that does not support the DFS channel.

Benefits of technology

Improve the stability and reliability of P2P connection, avoiding the problems of connection failure and disconnection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119767441A_ABST
    Figure CN119767441A_ABST
Patent Text Reader

Abstract

The application discloses a P2P communication method, a P2P communication discovery method, a terminal device and a storage medium, which relate to the field of storage technology. The method is applied to a first terminal device, and in response to a request for establishing a P2P communication connection, the first communication information of the first terminal device and the second communication information of the second terminal device are obtained; when at least one channel list in the first channel list and the second channel list does not include the identifier of the dynamic frequency selection DFS channel, and the third channel list includes the identifier of the DFS channel, the identifier of the DFS channel in the third channel list is deleted; based on the first communication information, the second communication information and the third channel list, a P2P communication connection is established between the first terminal device and the second terminal device on the first channel. By changing the working list of the wireless communication chip of the terminal device, when a terminal device that does not support the DFS channel establishes a P2P connection with a device that supports the DFS channel, the stability and reliability of the P2P connection are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a P2P communication method, a P2P communication discovery method, a terminal device, and a storage medium. Background Art

[0002] With the development of communication technology, more and more terminal devices can achieve wireless communication through wireless fidelity (WiFi) technology. The radio frequency bands used by WiFi technology include the 2.4GHz band and the 5GHz band. The 5GHz working frequency band commonly used by Wi-Fi includes the working frequency range of radar equipment (such as military radars and weather radars) (such as the frequency range of 5250Mhz to 5350MHz). Therefore, if the terminal device communicates with other devices through WiFi on this frequency band, it may interfere with the radar signal. According to local regulations, terminal devices that support working in channels in the 5GHz frequency band must have dynamic frequency selection (DFS) features. When a terminal device with the DFS feature detects a radar signal on the currently used working channel when the working channel it uses is within the working frequency range of the radar device, it needs to switch from the currently used working channel to other channels to avoid interference with the radar signal. Generally, channels within the working frequency range of radar equipment can also be called DFS channels.

[0003] In addition, with the development of WiFi technology, the application of building intelligent interconnection and multi-screen collaboration between multiple devices through Wi-Fi peer-to-peer (P2P) technology is becoming more and more widespread. In Wi-Fi P2P technology, in order to avoid interference with radar signals, and because most terminal devices do not have DFS characteristics and radar signal detection functions, the use of DFS channels is not supported when connecting between terminal devices in WiFi P2P (hereinafter referred to as P2P connection), that is, the DFS channels will not be scanned, nor will the P2P connection be established on the DFS channel. With the gradual increase in the number of terminal devices with DFS characteristics and radar signal detection functions, there are now solutions that support the use of DFS channels for P2P connections.

[0004] However, with the current solution, when the P2P connection supports the use of the DFS channel, there may be a situation where the P2P connection fails or the P2P connection is successfully established but then disconnected, resulting in low stability and reliability of the P2P connection. Summary of the invention

[0005] In view of this, the present application provides a P2P communication method, a P2P communication discovery method, a terminal device and a storage medium, which can improve the stability and reliability of the P2P connection when a terminal device that does not support a DFS channel establishes a P2P connection with a device that supports a DFS channel by changing the working list of the wireless communication chip of the terminal device.

[0006] In a first aspect, the present application provides a point-to-point P2P communication method, which is applied to a first terminal device, wherein the first terminal device obtains first communication information of the first terminal device and second communication information of the second terminal device in response to a request for establishing a P2P communication connection; the first communication information includes a first channel list supported by the first terminal device, and the second communication information includes a second channel list supported by the second terminal device; when there is at least one channel list in the first channel list and the second channel list that does not include an identifier of a dynamic frequency selection DFS channel, and the third channel list includes an identifier of the DFS channel, the identifier of the DFS channel in the third channel list is deleted, and the third channel list is a working list of a wireless communication chip of the first terminal device; based on the first communication information, the second communication information and the third channel list, a P2P communication connection is established between the first terminal device and the second terminal device on the first channel, and the first channel is a channel corresponding to the identifiers included in the first communication information, the second communication information and the third channel list.

[0007] In some examples, the request to establish a P2P communication connection may be initiated by the first terminal device. For example, the first terminal device may regard the detection by the first terminal device of a user initiating a screen projection operation as a request to establish a P2P communication connection. In other examples, the request to establish a P2P communication connection may be initiated by the second terminal device. For example, when the second terminal device detects that a user has initiated a screen projection operation, the second terminal device may send a request to establish a P2P communication connection to the first terminal device via a Bluetooth connection.

[0008] Among them, the first channel list supported by the first terminal device can be called the P2P channel list supported by the first terminal device, the second channel list supported by the second terminal device can be called the P2P channel list supported by the second terminal device, and the third list can be called the working list supported by GO.

[0009] In this way, the first terminal device can modify the third channel list of the P2P connection channel determined by the wireless communication chip of the first terminal device based on the first channel list supported by the first terminal device and the second channel list supported by the second terminal device. When the second terminal device does not support establishing a P2P connection on the DFS channel, the identifier of the DFS channel is deleted from the third channel list, thereby ensuring that the first terminal device successfully establishes a P2P connection with the second terminal device based on the first communication information, the second communication information and the third channel list.

[0010] In a possible implementation manner of the first aspect, the first terminal device is a group manager GO of a P2P communication connection, wherein the first terminal device supports a radar signal detection function, and the second terminal device does not support the radar signal detection function; or, when both the first terminal device and the second terminal device support the radar signal detection function, the first terminal device is a display terminal in the P2P communication connection network.

[0011] The first terminal device as GO supports the radar signal detection function, which can avoid the P2P connection being established on the DFS channel when a radar signal is detected, so that the terminal device can establish the P2P connection in compliance with regulations.

[0012] In some examples, the first terminal device as a GO may also support the DFS feature, and the first terminal device supporting the DFS feature may implement the switching of the P2P channel. If the P2P connection of the first terminal device has been established on the DFS channel, then when the first terminal device as a GO detects a radar signal, in order to avoid the P2P connection from interfering with the radar signal, the first terminal device may switch the channel of the P2P connection from the DFS channel to the non-DFS channel, so that the terminal device can establish the P2P connection in compliance with the regulations.

[0013] The P2P channel refers to a channel used for P2P communication between a terminal device and other terminal devices.

[0014] In a possible implementation manner of the first aspect, the second communication information also includes: first indication information used to indicate whether the second terminal device supports the radar signal detection function; then, the first terminal device can determine the GO of the P2P communication connection based on the first indication information and whether the first terminal device supports the radar signal detection function.

[0015] In this way, when the first terminal device serving as the GO has a radar signal detection function, the first terminal device can detect a radar signal and switch the channel of the P2P connection from the DFS channel to the non-DFS channel, thereby avoiding interference of the P2P connection to the radar signal, so that the terminal device can establish P2P in compliance with regulations.

[0016] In a possible implementation manner of the first aspect, when both the first channel list and the second channel list include identifiers of DFS channels, and the third channel list does not include identifiers of DFS channels, the identifiers of DFS channels are added to the third channel list.

[0017] In a possible implementation manner of the first aspect, an application of a first terminal device determines whether both a first channel list and a second channel list include an identifier of a DFS channel; when at least one channel list in the first channel list and the second channel list does not include an identifier of a dynamic frequency selection DFS channel, and the third channel list includes an identifier of a DFS channel, the identifier of the DFS channel in the third channel list is deleted, including: when at least one channel list in the first channel list and the second channel list does not include an identifier of a DFS channel, the application of the first terminal device sends a deletion instruction to the wireless communication chip, the deletion instruction includes the identifier of the DFS channel; when the wireless communication chip determines that the third channel list includes the identifier of the DFS channel, the identifier of the DFS channel in the third channel list is deleted.

[0018] In some examples, the application of the first terminal device is a software application for triggering a process for establishing a P2P connection.

[0019] In a possible implementation manner of the first aspect, when the first channel list and the second channel list both include the identifier of the DFS channel, and the third channel list does not include the identifier of the DFS channel, adding the identifier of the DFS channel to the third channel list includes: when the first channel list and the second channel list both include the identifier of the DFS channel, an application of the first terminal device sends an add instruction to the wireless communication chip, and the add instruction includes the identifier of the DFS channel; when the wireless communication chip determines that the third channel list does not include the identifier of the DFS channel, adding the identifier of the DFS channel to the third channel list.

[0020] In a possible implementation manner of the first aspect, a P2P communication connection is established between a first terminal device and a second terminal device on a first channel based on first communication information, second communication information and a third channel list, including: an application of the first terminal device determines an identifier of the first channel based on the first communication information and the second communication information; the application of the first terminal device sends the identifier of the first channel to a wireless communication chip; and the wireless communication chip establishes a P2P communication connection between the first terminal device and the second terminal device on the first channel based on the identifier of the first channel and the third channel list.

[0021] In the above process, the wireless communication chip only uses the channel identifier determined by the application of the first terminal device as a reference. The wireless communication chip finally determines the P2P connection working channel based on the channel selection logic set internally, referring to the channel identifier determined by the application of the first terminal device.

[0022] In a possible implementation manner of the first aspect, the first communication information further includes: an STA channel of the first terminal device, and the second communication information further includes an STA channel of the second terminal device.

[0023] The STA channel refers to a communication channel used between the first terminal device as a STA and the AP.

[0024] In a possible implementation manner of the first aspect, the first terminal device is connected to the access point AP, and the method further includes:

[0025] When the working channel of the first terminal device connected to the AP is switched from the second channel to the third channel, and the second terminal device supports channel switching, the first terminal device switches the first channel to the third channel, and the identifier of the third channel is included in the third channel list. In this way, the first terminal device can avoid the situation of the same frequency and different channels.

[0026] In some examples, when the working channel of the first terminal device connected to the AP is switched from the second channel to the third channel, and the second terminal device does not support channel switching, the first terminal device and the second terminal device maintain a P2P connection through the first channel. In this way, it can be ensured that the P2P connection will not fail due to the switching of the STA channel and the second terminal device does not support channel switching, thereby improving the stability of the P2P connection.

[0027] In a possible implementation manner of the first aspect, the first terminal device may also obtain second indication information for indicating whether the second terminal device supports channel switching, where the second indication information is included in the management request frame.

[0028] In some examples, the second terminal device sends a first indication message of radar signal detection.

[0029] In a second aspect, the present application provides a point-to-point P2P communication discovery method, which is applied to a first terminal device, where the first terminal device is connected to an access point AP on a dynamic frequency selection DFS channel, and the method includes:

[0030] In response to a request for establishing a P2P communication connection, first communication information of a first terminal device is acquired; the first communication information includes a first channel list supported by the first terminal device, and the first channel list includes an identifier of a DFS channel;

[0031] In a case where the third channel list includes an identifier of a DFS channel, deleting the identifier of the DFS channel in the third channel list, where the third channel list is a working list of the wireless communication chip of the first terminal device;

[0032] The working channel of the first terminal device is set to a non-DFS channel supported by the first terminal device, so that the second terminal device can discover the first terminal device on the non-DFS channel.

[0033] In the case that it is unknown whether terminal device A supports the DFS feature and whether it supports establishing P2P on the DFS channel, terminal device B first establishes a P2P connection with terminal device A on a non-DFS channel.

[0034] In a possible implementation of the second aspect, a first terminal device receives a probe request frame from a second terminal device on a non-DFS channel; sends a probe response frame to the second terminal device on the non-DFS channel; establishes a P2P communication connection between the first terminal device and the second terminal device on the non-DFS channel; obtains second communication information of the second terminal device when the first terminal device supports channel switching; the second communication information includes a second channel list supported by the second terminal device and indication information for indicating whether the second terminal device supports channel switching; when the second channel list includes an identifier of a DFS channel, the identifier of the DFS channel is added to a third channel list; when the indication information indicates that the second terminal device supports channel switching, switches a working channel of the P2P communication connection from a non-DFS channel to a DFS channel.

[0035] In this way, after the terminal device A establishes a P2P connection with the terminal device B, the terminal device B determines whether the working channel of the P2P connection can be switched based on the association request frame of the terminal device A obtained when the P2P connection is established. In this way, while ensuring that the P2P connection can be established between the terminal device A and the terminal device B, the STA channel of the terminal device B is the same as the working channel of the P2P connection.

[0036] In a third aspect, the present application provides a terminal device, which includes a wireless communication chip, a memory and one or more processors; the wireless communication chip, the memory and the processor are coupled; the wireless communication chip is used to establish a point-to-point P2P communication connection, and the memory is used to store computer program code, and the computer program code includes computer instructions.

[0037] When the processor executes the computer instruction, the terminal device executes:

[0038] In response to a request for establishing a P2P communication connection, first communication information of a first terminal device and second communication information of a second terminal device are obtained; the first communication information includes a first channel list supported by the first terminal device, and the second communication information includes a second channel list supported by the second terminal device; when at least one of the first channel list and the second channel list does not include an identifier of a dynamic frequency selection DFS channel, and the third channel list includes an identifier of a DFS channel, the identifier of the DFS channel in the third channel list is deleted, and the third channel list is a working list of a wireless communication chip of the first terminal device; based on the first communication information, the second communication information and the third channel list, a P2P communication connection is established between the first terminal device and the second terminal device on a first channel, and the first channel is a channel corresponding to the identifiers included in the first communication information, the second communication information and the third channel list.

[0039] The first terminal device is a group manager GO of a P2P communication connection; wherein the first terminal device supports a radar signal detection function, and the second terminal device does not support the radar signal detection function; or, when both the first terminal device and the second terminal device support the radar signal detection function, the first terminal device is a display terminal in the P2P communication connection network.

[0040] The second communication information also includes: first indication information for indicating whether the second terminal device supports the radar signal detection function; when the processor executes the computer instructions, it also enables the terminal device to execute: based on the first indication information and whether the first terminal device supports the radar signal detection function, determine the GO of the P2P communication connection.

[0041] When the processor executes the computer instructions, the terminal device is also caused to execute: when the first channel list and the second channel list both include the identifier of the DFS channel, and the third channel list does not include the identifier of the DFS channel, adding the identifier of the DFS channel to the third channel list.

[0042] When the processor executes the computer instructions, the terminal device also executes: the application of the first terminal device determines whether the first channel list and the second channel list both include the identification of the DFS channel; when there is at least one channel list in the first channel list and the second channel list that does not include the identification of the DFS channel, the application of the first terminal device sends a deletion instruction to the wireless communication chip, and the deletion instruction includes the identification of the DFS channel; when the wireless communication chip determines that the third channel list includes the identification of the DFS channel, the wireless communication chip deletes the identification of the DFS channel in the third channel list.

[0043] When the processor executes the computer instructions, it also causes the terminal device to execute: when the first channel list and the second channel list both include the identifier of the DFS channel, the application of the first terminal device sends an add instruction to the wireless communication chip, and the add instruction includes the identifier of the DFS channel; when the wireless communication chip determines that the third channel list does not include the identifier of the DFS channel, the DFS channel identifier is added to the third channel list.

[0044] When the processor executes the computer instructions, it also causes the terminal device to execute: the application of the first terminal device determines the identifier of the first channel based on the first communication information and the second communication information; the application of the first terminal device sends the identifier of the first channel to the wireless communication chip; the wireless communication chip establishes a P2P communication connection between the first terminal device and the second terminal device on the first channel based on the identifier of the first channel and the third channel list.

[0045] When the processor executes the computer instructions, the first communication information further includes: the STA channel of the first terminal device, and the second communication information further includes the STA channel of the second terminal device.

[0046] The first terminal device is connected to the access point AP. When the processor executes the computer instructions, it also causes the terminal device to execute: when the working channel connecting the first terminal device and the AP is switched from the second channel to the third channel, and the second terminal device supports channel switching, the first terminal device switches the first channel to the third channel, and the identifier of the third channel is included in the third channel list.

[0047] When the processor executes the computer instructions, it also causes the terminal device to execute: obtaining second indication information for indicating whether the second terminal device supports channel switching, the second indication information being included in the management request frame.

[0048] In a fourth aspect, the present application provides a terminal device, which includes a wireless communication chip, a memory and one or more processors; the wireless communication chip, the memory and the processor are coupled; the wireless communication chip is used to establish a point-to-point P2P communication connection, and the memory is used to store computer program code, and the computer program code includes computer instructions; a first terminal device is connected to an access point AP on a dynamic frequency selection DFS channel, and when the processor executes the computer instructions, the terminal device executes: in response to a request for establishing a P2P communication connection, obtaining first communication information of the first terminal device; the first communication information includes a first channel list supported by the first terminal device, and the first channel list includes an identifier of the DFS channel; in the case where a third channel list includes an identifier of the DFS channel, deleting the identifier of the DFS channel in the third channel list, and the third channel list is a working list of the wireless communication chip of the first terminal device; setting the working channel of the first terminal device to a non-DFS channel supported by the first terminal device, so that the second terminal device can discover the first terminal device on the non-DFS channel.

[0049] When the processor executes the computer instructions, the terminal device is also caused to execute: receiving a detection request frame from the second terminal device on a non-DFS channel; sending a detection response frame to the second terminal device on a non-DFS channel; establishing a P2P communication connection between the first terminal device and the second terminal device on the non-DFS channel; obtaining second communication information of the second terminal device when the first terminal device supports channel switching; the second communication information includes a second channel list supported by the second terminal device and indication information for indicating whether the second terminal device supports channel switching; when the second channel list includes an identifier of a DFS channel, adding the identifier of the DFS channel to a third channel list; when the indication information indicates that the second terminal device supports channel switching, switching a working channel of the P2P communication connection from a non-DFS channel to a DFS channel.

[0050] In a fifth aspect, the present application provides a computer-readable storage medium comprising computer instructions. When the computer instructions are executed on a terminal device, the terminal device executes the method described in the first aspect above and any possible design thereof.

[0051] In a sixth aspect, the present application provides a computer-readable storage medium comprising computer instructions. When the computer instructions are executed on a terminal device, the terminal device executes the method described in the second aspect above and any possible design thereof.

[0052] In a seventh aspect, the present application provides a computer program product, which, when executed on a terminal device, enables the terminal device to execute the method described in the first aspect and any possible design thereof.

[0053] In an eighth aspect, the present application provides a computer program product, which, when executed on a terminal device, enables the terminal device to execute the method described in the second aspect above and any possible design thereof.

[0054] In a ninth aspect, the present application provides a device, which is included in a terminal device, and the device has the function of implementing the behavior of the terminal device in any of the above aspects and possible implementation methods. The function can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes at least one module or unit corresponding to the above function. For example, an allocation module or unit, a scanning module or unit, a recycling module or unit, a moving module or unit, and a storage module or unit, etc.

[0055] It can be understood that the terminal device described in the second aspect and any possible design method provided above, the computer-readable storage medium described in the third aspect, and the computer program product described in the fourth aspect are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] Figure 1 A schematic diagram of the structure of a communication system provided in an embodiment of the present application;

[0057] Figure 2 A schematic diagram of a standard P2P connection process provided in an embodiment of the present application;

[0058] Figure 3 A schematic diagram of a P2P optimized connection process provided in an embodiment of the present application;

[0059] Figure 4 A schematic diagram of another process of optimizing P2P connection provided in an embodiment of the present application;

[0060] Figure 5 A schematic diagram of the hardware structure of a terminal device provided in an embodiment of the present application;

[0061] Figure 6 A schematic diagram of the software architecture of a terminal device provided in an embodiment of the present application;

[0062] Figure 7 A schematic flow chart of a P2P connection establishment method provided in an embodiment of the present application;

[0063] Figure 8 A schematic flowchart of another P2P connection establishment method provided in an embodiment of the present application;

[0064] Fig. 9A schematic flow chart of a P2P communication method provided in an embodiment of the present application;

[0065] Fig.10 A schematic diagram of the structure of a terminal device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0066] In order to clearly describe the technical solutions of the embodiments of the present application, in the embodiments of the present application, words such as "first" and "second" are used to distinguish the same or similar items with substantially the same functions and effects. Those skilled in the art can understand that words such as "first" and "second" do not limit the quantity and execution order, and words such as "first" and "second" do not necessarily limit the difference.

[0067] It should be noted that in the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.

[0068] In the embodiments of the present application, "at least one" refers to one or more, and "plurality" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple.

[0069] Before introducing the embodiments of the present application, the technologies involved in the embodiments of the present application are first introduced in detail.

[0070] 1. DFS feature: In order to prevent terminal devices using WiFi technology (hereinafter referred to as WiFi devices) from interfering with radar signals, various regions require that WiFi devices working in the main mode must support the DFS feature when the working channel used is within the working frequency range of the radar device. Specifically, the WiFi device is required to shut down the transmission within a specified time (such as 1 second) after detecting the radar signal, and switch to other channels within a specified time (such as 10 seconds).

[0071] 2. DFS channels: The 5GHz frequency band includes the operating frequency range of radar equipment such as military radars and weather radars. In this embodiment, the channels within the operating frequency range of the radar equipment are referred to as DFS channels. Correspondingly, in this embodiment, channels within other frequency ranges in WiFi technology can be referred to as non-DFS channels. Among them, the operating frequency ranges of radar equipment vary from region to region, so the DFS channels in different regions are also different. For example, in a certain area A, the frequency range of 5250Mhz to 5350MHz is the operating frequency range of radar equipment, and the channels within this frequency range are DFS channels. For example, common DFS channels in area A include channel 52, channel 56, channel 60, channel 64, etc., and common non-DFS channels include channel 36, channel 40, channel 44, channel 48, channel 149, channel 153, channel 157, channel 161, channel 165, etc.

[0072] Generally, common terminal devices support establishing P2P connections on all non-DFS channels by default, and only some terminal devices support establishing P2P connections on all non-DFS channels and DFS channels.

[0073] 3. Master mode, slave mode, master device and slave device: In wireless communication, the devices on both sides of the communication can be divided into two roles according to their working modes, namely master device and slave device.

[0074] Among them, a wireless access device (such as a WiFi device) working in a master mode can be called a master device, and a wireless access device (such as a WiFi device) working in a slave mode can be called a slave device.

[0075] The master mode refers to a mode in which a wireless access device can select a working channel, send signals to other wireless access devices to initialize the network, and control signal transmission of wireless access devices working in the slave mode.

[0076] The slave mode refers to a mode in which the signal transmission of the wireless access device is controlled by the wireless access device operating in the master mode.

[0077] Generally, wireless access points (AP), such as wireless routers, are WiFi devices that work in master mode, i.e. master devices. Stations (STA), such as mobile phones, tablets, and laptop computers, are WiFi devices that work in slave mode, i.e. slave devices.

[0078] In addition, Wi-Fi P2P technology, also known as Wi-Fi Direct, supports two or more devices to form a P2P network (also known as a P2P group) and communicate with each other without a wireless access point. The P2P network includes a group owner (group owner, Go) and at least one group client (group client, Gc). The group owner is equivalent to AP, that is, the master device, and the group client is equivalent to STA, that is, the slave device.

[0079] The working channel of the slave device is generally determined by the master device. Therefore, in order to avoid interference with radar signals, WiFi devices that do not have DFS characteristics and radar signal detection functions are usually not allowed to be used as master devices, while slave devices do not have this requirement.

[0080] The technical solution in this application will be described below in conjunction with the accompanying drawings.

[0081] In order to better understand the embodiments of the present application, the terminal device provided in the embodiments of the present application is first introduced.

[0082] Terminal equipment may also be called terminal, user equipment (UE), mobile station (MS), mobile terminal (MT), etc. Terminal equipment may be a mobile phone, smart TV, wearable device, tablet computer (Pad), computer with wireless transceiver function, virtual reality (VR) terminal equipment, augmented reality (AR) terminal equipment, wireless terminal in industrial control, wireless terminal in self-driving, wireless terminal in remote medical surgery, wireless terminal in smart grid, wireless terminal in transportation safety, wireless terminal in smart city, wireless terminal in smart home, etc.

[0083] Terminal devices can communicate with other terminal devices in P2P mode to realize full-scenario services, such as multi-screen collaboration, wireless screen projection, mirroring control, file transfer, or super terminal services. Terminal devices can also communicate with APs as STAs.

[0084] For example, Figure 11 shows a schematic diagram of a communication system 100. Figure 1 As shown, the communication system 100 may include a terminal device 101, a terminal device 102 and an AP 103.

[0085] The terminal device 101 can communicate with the terminal device 102 in P2P mode, for example, the terminal device 101 can implement a super terminal service with the terminal device 102. The terminal device 101 can communicate with the AP 103, and the terminal device 102 can also communicate with the AP 103. In other words, the terminal device 101 can communicate with the terminal device 102 or with the AP 103, and the terminal device 102 can communicate with the terminal device 101 or with the AP 103.

[0086] It should be noted that Figure 1 The communication between the devices in the communication system shown is only an example and does not constitute a limitation of the present application. Figure 1 In the system shown, terminal devices, such as terminal device 102, communicate only with terminal device 101, but not with AP 103.

[0087] In some embodiments, the terminal device 101 and the terminal device 102 may establish a P2P connection using the WiFi P2P protocol. For example, the standard P2P connection process may be as follows: Figure 2 As shown. In the detection phase, the terminal device 102 can send a detection request frame. After receiving the detection request frame sent by the terminal device 102, the terminal device 101 returns a detection response frame to the terminal device 102. After that, the terminal device 101 and the terminal device 102 enter the configuration discovery phase. In the configuration discovery phase, the terminal device 102 can send a configuration discovery request frame to the terminal device 101, so that the terminal device 101 can return a configuration discovery response frame to the terminal device 102. The terminal device 101 and the terminal device 102 can determine the configuration method of the WiFi simple configuration in the configuration discovery phase. After that, the negotiation phase can be entered. In the negotiation phase, the terminal device 101 negotiates with the terminal device 102 to determine the GO in the P2P network (or referred to as a P2P group). The determined GO can select a channel as a working channel so that the GC in the P2P network can establish a P2P connection with the GO through the working channel. In the negotiation phase, the terminal device 102 and the terminal device 101 can complete the negotiation process through a negotiation request frame, a negotiation response frame and a negotiation confirmation frame. For example, through the negotiation phase, Figure 2The terminal device 101 negotiates to be GO, and the terminal device 102 negotiates to be GC. Then, the terminal device 101 can select a channel as the working channel. The terminal device 102 can scan the working channel and perform the interactive process of accessing the network with the terminal device 101 through the working channel, that is, enter the network access stage. In the network access stage, the terminal device 102 can obtain the authentication credential from the terminal device 101 through the configuration method for determining the simple configuration of WiFi determined in the configuration discovery stage. After that, the terminal device 102 can perform a 4-way handshake with the terminal device 101 based on the obtained authentication credential. In this way, the terminal device 102 obtains the authentication credential for establishing a P2P connection from the terminal device 101 based on the configuration method, which can improve the security of the terminal device in establishing a P2P connection. Finally, the terminal device 101 and the terminal device 102 complete the process of establishing a P2P connection.

[0088] In the above standard P2P connection process, the two terminal devices dynamically negotiate GO according to the GO intention value during the connection process, without considering whether the terminal device supports the DFS feature and radar signal detection function. If a terminal device that does not support the DFS feature or radar signal detection function acts as a GO and establishes a P2P connection on a DFS channel, it will violate the regulatory requirements of the country where the terminal device is located and may interfere with the radar signal. Therefore, at present, in order to avoid affecting the radar signal, most terminal devices do not support the use of DFS channels by default, whether they are GC or GO, that is, P2P connections do not support DFS channels. In other words, when the above GO selects the working channel, it will not select the DFS channel as the working channel for the P2P connection by default. For example, the DFS channel is not included in the list of working channels supported by the terminal device. In this way, the P2P connection will not be established on the DFS channel, and will not affect the radar signal.

[0089] However, if Figure 1 In the communication system shown, the terminal devices, such as the terminal device 101 and the terminal device 102, not only transmit data through a P2P connection, such as realizing smart interconnection services or multi-screen collaboration, but also the terminal device, such as the terminal device 101, is connected to the AP 103 as a STA. In this case, if the channel through which the terminal device 101 is connected to the AP 103 as a STA is a DFS channel, that is, the working channel of the terminal device 101 as a STA is a DFS channel, such as Figure 1 The P2P connection between the terminal device 101 as GO and the terminal device 102 is established on a non-DFS channel, such as Figure 1The channel 149 shown in FIG. Then, the terminal device 101 will be in a dual band adaptive concurrent (DBAC) time division working mode, also known as a same frequency different channel working mode. This will cause a large transmission delay of the P2P connection and a problem of packet loss during transmission, which will have a serious impact on the user experience.

[0090] As some terminal devices begin to support the DFS feature and radar signal detection function, and software applications optimize the P2P connection process, the terminal device that acts as the GO role can no longer be determined through the standard P2P negotiation process during the P2P connection process. Instead, the GO is directly determined by the software application. At this time, if the software application directly determines the GO, and the terminal device that acts as the GO supports the DFS feature and radar signal detection function, and the working channel of the terminal device when acting as a STA is the DFS channel, then the software application will correspondingly select the DFS channel as the working channel of the GO, so as to avoid the terminal device being in the same frequency but different channel working mode. Currently, there are such Figure 3 as well as Figure 4 Two P2P connection establishment optimization processes are shown.

[0091] It is understandable that, for the sake of ease of description, the following embodiments only take the application software program as a screen projection application as an example to illustrate the point-to-point P2P communication method provided by this application, and are not actually limited to screen projection applications. For example, the application software program may also include multi-screen collaboration applications, video playback applications that support screen projection, mirror control applications, file transfer applications, and other applications that have the function of establishing a P2P connection.

[0092] like Figure 3 As shown, in the optimization process of establishing the P2P connection, a Bluetooth connection is first established between the terminal device 101 and the terminal device 102 to exchange the information of the terminal devices with each other through the Bluetooth connection. The information sent by the terminal device 101 to the terminal device 102 through the Bluetooth connection includes the working channel when the terminal device 101 is a STA and the working channel supported when the terminal device 101 performs a P2P connection. Similarly, the information sent by the terminal device 102 to the terminal device 101 through the Bluetooth connection includes the working channel when the terminal device 102 is a STA and the working channel supported when the terminal device 102 performs a P2P connection. In this way, in the case where one of the terminal devices acts as a GO, the terminal device as a GO can establish a P2P connection based on the information of the two terminal devices, thereby ensuring that the P2P connection is established on a channel supported by both terminal devices. And, on this basis, the terminal device as a GO can also refer to the working channel of each terminal device when it acts as a STA, and try to select the same channel as the STA working channel from the channels supported by both terminal devices to establish a P2P connection.

[0093] For example, when terminal device 101 acts as a GO and terminal device 102 acts as a GC, and both terminal devices are not connected to the AP as a STA. If both terminal devices support DFS channels and non-DFS channels as P2P working channels, the terminal device 101 can select a channel from the DFS channels and non-DFS channels supported by both terminal devices to establish a P2P connection. If terminal device 101 supports DFS channels and non-DFS channels as P2P working channels, but terminal device 102 only supports non-DFS channels as P2P working channels, the terminal device 101 will select a channel from the non-DFS channels supported by both terminal devices to establish a P2P connection. In this way, it can be ensured that the P2P connection can be established on a channel supported by both terminal devices.

[0094] For another example, when terminal device 101 acts as a GO and terminal device 102 acts as a GC, and terminal device 101 is connected to AP as a STA, the STA channel is DFS channel 52, and terminal device 102 is not connected to AP as a STA. If both terminal devices support DFS channels and non-DFS channels as P2P working channels, terminal device 101 can choose to establish a P2P connection with terminal device 102 on channel 52. If terminal device 101 supports DFS channels and non-DFS channels as P2P working channels, and terminal device 102 only supports non-DFS channels as P2P working channels, that is, terminal device 102 does not support channel 52 as a P2P working channel, terminal device 101 selects a channel from the non-DFS channels to establish a P2P connection.

[0095] In other P2P connection establishment optimization processes, the software application can determine the terminal device as GO. In some embodiments, when the software application is a screen casting application, the software application can use the display end of the screen casting as GO. Generally, the display end of the screen casting is the default of the software. For example, when the screen casting software running on the TV is running, the TV will be used as the display end by default. For another example, when the screen casting software running on the mobile phone is running, the mobile phone will be used as the display end by default. Exemplarily, when the terminal device detects that the user has started the screen casting function in the screen casting application, the screen casting application can determine that the terminal device is GO. If Figure 4As shown, taking the terminal device 101 as a GO as an example, after the terminal device 101 creates the GO, it starts to work on the working channel of the GO. The terminal device 102 can send a probe request frame so that the terminal device 101 can discover the terminal device 102. After receiving the probe request frame sent by the terminal device 102, or discovering the terminal device 102, the terminal device 101 can feedback the probe response frame to the terminal device 102 to inform the terminal device 102 that the role of the terminal device 101 in the P2P network is the GO, and the terminal device 102 is the GC. Then, the terminal device 101 and the terminal device 102 determine the configuration method of the WiFi simple configuration by configuring the discovery request frame and the configuration discovery response frame, so that the GC can subsequently obtain the authentication credentials for establishing the P2P connection from the GO based on the configuration method of the WiFi simple configuration. Afterwards, the terminal device 101 and the terminal device 102 implement scanning and discovery between the GO and the GC through the detection request frame and the detection response frame to establish the P2P connection.

[0096] However, with the current solution, when the P2P connection supports the use of the DFS channel, there may be a situation where the P2P connection fails or the P2P connection is successfully established but then disconnected, resulting in low stability and reliability of the P2P connection.

[0097] First, the applicant found that although the two terminal devices exchanged the channels that each terminal device can support to establish a P2P connection before establishing a P2P connection, in the implementation of the WiFi chip, avoiding the same frequency and different channels has the highest priority. Therefore, when determining the working channel, the actual GO will give priority to referring to the working channel of the terminal device when it is currently connected to the AP as a STA, and establish a P2P connection on this working channel.

[0098] Specifically, the current software application can optimize the P2P connection process, and the process of the software application setting the channel for the P2P connection is essentially an interactive process between the software application and the WiFi chip. For example, if the software application selects channel 52 as the working channel for the P2P connection, then the software application will inform the WiFi chip to establish a P2P connection on channel 52. In addition, the WiFi chip has a single channel concurrency (SCC) channel selection logic preset by the chip manufacturer according to the WiFi protocol. The SCC channel selection logic refers to the use of the same channel for different functions of the WiFi chip. For example, the STA working channel of the terminal device is channel 52. If the WiFi chip of the terminal device supports the establishment of a P2P connection on channel 52, then the P2P channel selected by the WiFi chip of the terminal device is also channel 52. The use of the SCC channel selection logic can avoid the terminal device being in the DBAC working mode. Therefore, the SCC channel selection logic has the highest priority, or the priority of avoiding the same frequency and different channels is the highest. In this way, after receiving the channel setting message of the software application, the WiFi chip may not use the channel setting message for channel setting.

[0099] For example, the working channel of the terminal device 101 as a STA is channel 52, and the P2P channels supported by the terminal device 101 include DFS channels and non-DFS channels, specifically: channel 52, channel 36, channel 40, channel 44, channel 48, channel 149, channel 153, channel 157, channel 161, channel 165. If the terminal device 102 is not connected to the AP as a STA, and the P2P channels supported by the terminal device 102 include non-DFS channels, specifically: channel 36, channel 40, channel 44, channel 48, channel 149, channel 153, channel 157, channel 161, channel 165. According to Figure 3In the P2P establishment process shown, although the STA working channel of the terminal device 101 is channel 52, since the P2P channels supported by the terminal device 102 do not include channel 52, the software application will select a channel from channel 36, channel 40, channel 44, channel 48, channel 149, channel 153, channel 157, channel 161, and channel 165 as the working channel for the P2P connection, thereby ensuring that the P2P connection can be successfully established. In the case where the software application selects channel 149, the software application will inform the WiFi chip of the message used to establish a P2P connection on channel 149. The WiFi chip receives the message, but the WiFi chip determines that the STA working channel of the terminal device 101 is channel 52 according to the preset, highest priority SCC channel selection logic, and the P2P channels supported by the terminal device 101 include channel 52, and then chooses to establish a P2P connection on channel 52. In this way, the software application cannot set the working channel of the WiFi chip, so through Figure 3 When the method shown establishes a P2P connection, a terminal device that supports establishing a P2P connection on a DFS channel acts as a STA. When connecting to an AP through a DFS channel, the terminal device acts as a GO and also establishes a P2P connection on the DFS channel, which causes the P2P connection to fail.

[0100] Secondly, the applicant found that even if the two terminal devices establishing the P2P connection both support establishing the P2P connection on the DFS channel, Figure 4 When establishing a P2P connection in the manner shown, there is a situation where the terminal device 101, as a GO, directly selects the working channel of the P2P connection as the DFS channel. At this time, although the terminal device 102 also supports the establishment of a P2P connection on the DFS channel, in the conventional P2P connection communication protocol, it is stipulated that the terminal device only scans on the non-DFS channel during the discovery phase, and the terminal device 102 does not scan on the DFS channel, so the terminal device 102 cannot discover the terminal device 101, resulting in the failure to establish a P2P connection.

[0101] Furthermore, the applicant also found that by Figure 3 or Figure 4After establishing a P2P connection, if the terminal device not only establishes a P2P connection with other devices, but also connects to the AP as a STA (for ease of description, this situation will be referred to as the terminal being in concurrent mode), the working channel corresponding to the P2P connection may be affected by the working channel of the connection between the terminal device and the AP and switch. However, other terminal devices in the P2P network, that is, the terminal device as a GC, may not support the establishment of a P2P connection on the switched channel, or the terminal device as a GC may support the establishment of a P2P connection on the switched channel but does not support the channel switching action. In this case, if the terminal device as a GO switches the working channel of the P2P connection, the established P2P connection will be disconnected.

[0102] For example, continue to combine Figure 1 , the channel connecting the terminal device 101 as a STA and AP103 is a non-DFS channel, such as channel 149, and the terminal device 101 as a GO selects channel 149 as the working channel for the P2P connection. Afterwards, the working channel connecting the terminal device 101 as a STA and AP103 is switched from a non-DFS channel to a DFS channel, such as switching from channel 149 to channel 52. In order to avoid DBAC in the terminal device 101, the terminal device 101, as a GO, generally changes the working channel corresponding to the P2P connection to the same channel as the working channel between the STA and the AP, that is, the working channel corresponding to the P2P connection will also be switched from channel 149 to channel 52. In this case, if the terminal device as a GC in the P2P network, such as the terminal device 102, does not support working in the DFS channel, the P2P connection between the terminal device 101 and the terminal device 102 will be disconnected. Even if the terminal device acting as a GC in the P2P network, such as terminal device 102, supports working in the DFS channel, but does not support the DFS feature, that is, terminal device 102 does not have the extended channel switch announcement (ECSA) / channel switch announcement (CSA) function, the P2P connection between terminal device 101 and terminal device 102 will be disconnected.

[0103] In summary, under the premise of complying with regulatory requirements, it is an urgent problem to avoid DBAC and connection failure when WiFi devices that support DFS features and radar signal detection functions and WiFi devices that do not support DFS features or radar signal detection functions establish P2P connections.

[0104] In view of this, an embodiment of the present application provides a P2P communication method, which can modify the working channel list for determining GO in the wireless communication chip of a terminal device serving as a GO through a P2P channel supported by both communicating parties, so that when the terminal device serving as a GC does not support establishing a P2P connection on the DFS channel, the identifier of the DFS channel is deleted from the working channel list of the GO, thereby ensuring that a terminal device successfully establishes a P2P connection with another terminal device based on the first communication information, the second communication information and the third channel list.

[0105] In addition, the method provided in the embodiment of the present application determines that the terminal device supporting radar signal detection is a GO, thereby preventing the P2P connection from interfering with the radar signal.

[0106] In addition, the method provided in the embodiment of the present application can also ensure that the P2P connection will not be disconnected when the STA channel of the terminal device serving as the GO is switched from a non-DFS channel to a DFS channel, and the terminal device serving as the GC does not support establishing a P2P connection on the DFS channel, or the terminal device serving as the GC does not support channel switching.

[0107] Next, the hardware structure of the terminal device provided in the embodiment of the present application is described.

[0108] Figure 5 The schematic diagram of the structure of the terminal device 100 is shown. The terminal device 100 may include a processor 510, an external memory interface 520, an internal memory 521, a universal serial bus (USB) interface 530, a charging management module 540, a power management module 541, a battery 542, an antenna 1, an antenna 2, a mobile communication module 550, a wireless communication module 560, an audio module 570, a speaker 570A, a receiver 570B, a microphone 570C, an earphone interface 570D, a sensor module 580, a button 590, a motor 591, an indicator 592, a camera 593, a display screen 594, and a subscriber identification module (SIM) card interface 595, etc.

[0109] It is to be understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the terminal device 100. In other embodiments of the present application, the terminal device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0110] The processor 510 may include one or more processing units, for example: the processor 510 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), a controller, a memory, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and / or a neural network processor (neural-network processing unit, NPU), etc. Among them, different processing units can be independent devices or integrated in one or more processors. Among them, the controller can be the nerve center and command center of the terminal device 500. The controller can generate an operation control signal according to the instruction opcode and the timing signal to complete the control of fetching and executing instructions.

[0111] The processor 510 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 510 is a cache memory. The memory may store instructions or data that the processor 510 has just used or cyclically used. If the processor 510 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 510, and thus improves the efficiency of the system.

[0112] In some embodiments, the processor 510 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.

[0113] Among them, the I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL). The I2S interface can be used for audio communication. The PCM interface can also be used for audio communication to sample, quantize and encode analog signals. The UART interface is a universal serial data bus for asynchronous communication. The bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. The MIPI interface can be used to connect the processor 510 with peripheral devices such as the display screen 594 and the camera 593. The MIPI interface includes a camera serial interface (CSI), a display serial interface (DSI), etc. The GPIO interface can be configured by software. The GPIO interface can be configured as a control signal or as a data signal. The USB interface 530 is an interface that complies with the USB standard specification, and can specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 530 can be used to connect a charger to charge the terminal device 500, and can also be used to transmit data between the terminal device 500 and peripheral devices. It can also be used to connect headphones and play audio through them. This interface can also be used to connect other terminal devices, such as AR devices.

[0114] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present invention is only a schematic illustration and does not constitute a structural limitation on the terminal device 500. In other embodiments of the present application, the terminal device 500 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.

[0115] The charging management module 540 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 540 may receive charging input from a wired charger through the USB interface 530. In some wireless charging embodiments, the charging management module 540 may receive wireless charging input through a wireless charging coil of the terminal device 500. While the charging management module 540 is charging the battery 542, it may also power the terminal device through the power management module 541.

[0116] The power management module 541 is used to connect the battery 542, the charging management module 540 and the processor 510. The power management module 541 receives input from the battery 542 and / or the charging management module 540, and supplies power to the processor 510, the internal memory 521, the external memory, the display screen 594, the camera 593, and the wireless communication module 560. The power management module 541 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 541 can also be set in the processor 510. In other embodiments, the power management module 541 and the charging management module 540 can also be set in the same device.

[0117] The wireless communication function of the terminal device 100 can be implemented through antenna 1, antenna 2, mobile communication module 550, wireless communication module 560, modem processor and baseband processor.

[0118] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in terminal device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization.

[0119] The mobile communication module 550 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the terminal device 100. The mobile communication module 550 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 550 can receive electromagnetic waves from the antenna 1, and filter, amplify, etc. the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 550 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1.

[0120] The modem processor may include a modulator and a demodulator. The modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 570A, a receiver 570B, etc.), or displays an image or video through a display screen 594.

[0121] The wireless communication module 560 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), etc. applied to the terminal device 100. The wireless communication module 560 can be one or more devices integrating at least one communication processing module. The wireless communication module 560 receives electromagnetic waves via the antenna 2, modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 510. The wireless communication module 560 can also receive the signal to be sent from the processor 510, modulate the frequency, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0122] In some embodiments of the present application, the wireless communication module 560 may include: a WiFi chip. The WiFi chip includes a microcontroller unit (MCU), which can be used to support the terminal device to implement DFS characteristics and radar signal detection functions. In addition, the WiFi chip may also include an analog-to-digital converter (ADC). After the wireless signal is received by the antenna 2, signal characteristics such as pulses, intervals, and periodic modulation can be obtained through processing by the ADC. Afterwards, the WiFi chip, such as the MCU of the WiFi chip, performs feature matching, such as matching the obtained signal characteristics with the characteristics of the radar signal, and then the wireless signal can be identified as a radar signal.

[0123] In some embodiments, the antenna 1 of the terminal device 100 is coupled to the mobile communication module 550, and the antenna 2 is coupled to the wireless communication module 560, so that the terminal device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology.

[0124] The terminal device 100 implements the display function through a GPU, a display screen 594, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 594 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 510 may include one or more GPUs, which execute program instructions to generate or change display information.

[0125] The display screen 594 is used to display images, videos, etc. The display screen 594 includes a display panel. In some embodiments, the terminal device 100 may include 1 or N display screens 594, where N is a positive integer greater than 1.

[0126] The terminal device 100 can realize the shooting function through ISP, camera 593, video codec, GPU, display screen 594 and application processor.

[0127] The ISP is used to process the data fed back by the camera 593. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye. The ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. The ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, the ISP can be set in the camera 593.

[0128] The camera 593 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element converts the optical signal into an electrical signal, which is then transmitted to the ISP for conversion into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the terminal device 100 may include 1 or N cameras 593, where N is a positive integer greater than 1.

[0129] The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the terminal device 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.

[0130] Video codecs are used to compress or decompress digital videos. The terminal device 100 may support one or more video codecs. Thus, the terminal device 100 may play or record videos in various coding formats, such as Moving Picture Experts Group (MPEG) 5, MPEG2, MPEG3, MPEG4, etc.

[0131] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. Through NPU, applications such as intelligent cognition of the terminal device 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.

[0132] The external memory interface 520 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the terminal device 100. The external memory card communicates with the processor 510 through the external memory interface 520 to implement a data storage function. For example, files such as music and videos are stored in the external memory card.

[0133] The internal memory 521 can be used to store computer executable program codes, which include instructions. The processor 510 executes various functional applications and data processing of the terminal device 100 by running the instructions stored in the internal memory 521. The internal memory 521 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a screen projection function, a video playback function, etc.), etc. The data storage area may store data created during the use of the terminal device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 521 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.

[0134] The terminal device 100 can implement audio functions through an audio module 570, a speaker 570A, a receiver 570B, a microphone 570C, an earphone interface 570D, and an application processor. For example, music playback, recording, etc. Among them, the audio module 570 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into a digital audio signal. The audio module 570 can also be used to encode and decode audio signals. The speaker 570A is used to convert an audio electrical signal into a sound signal. The receiver 570B is used to convert an audio electrical signal into a sound signal. When the terminal device 100 answers a call or voice message, the voice can be answered by placing the receiver 570B close to the human ear. The microphone 570C is used to convert the sound signal into an electrical signal. When making a call or sending a voice message, the user can make a sound by approaching the microphone 570C with the human mouth, and the sound signal is input into the microphone 570C. The terminal device 100 can set at least one microphone 570C according to the application.

[0135] The sensor module 580 may include a pressure sensor 580A, a fingerprint sensor 580H, a touch sensor 580K, and the like.

[0136] The pressure sensor 580A is used to sense the pressure signal and convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 580A can be set on the display screen 594. The fingerprint sensor 580H is used to collect fingerprints. The terminal device 100 can use the collected fingerprint characteristics to realize fingerprint unlocking, access application locks, fingerprint photography, fingerprint answering calls, etc. The touch sensor 580K can be set on the display screen 594, and the touch sensor 580K and the display screen 594 form a touch screen. The touch sensor 580K is used to detect touch operations acting on or near it.

[0137] The key 590 includes a power key, a volume key, etc. The key 590 may be a mechanical key or a touch key. The terminal device 100 may receive key input and generate key signal input related to user settings and function control of the terminal device 100.

[0138] Motor 591 can generate vibration prompts. Motor 591 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. Different application scenarios (for example: time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects.

[0139] Indicator 592 may be an indicator light, which may be used to indicate charging status, power changes, messages, missed calls, notifications, etc.

[0140] The SIM card interface 595 is used to connect a SIM card. The SIM card can be connected to or disconnected from the terminal device 100 by inserting the SIM card interface 595 or pulling the SIM card interface 595 out. The terminal device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 595 can support Nano SIM cards, Micro SIM cards, SIM cards, and the like. Multiple cards can be inserted into the same SIM card interface 595 at the same time. The types of the multiple cards can be the same or different. The SIM card interface 595 can also be compatible with different types of SIM cards. The SIM card interface 595 can also be compatible with external memory cards. The terminal device 100 interacts with the network through the SIM card to implement functions such as calls and data communications.

[0141] It should be noted that for other components included in the terminal device, reference may be made to the introduction in the relevant technology, and this embodiment will not be described in detail here.

[0142] Next, the software structure of the terminal device provided in the embodiment of the present application is described.

[0143] The software system of the terminal device 100 may adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture. Taking the system as an example, the software structure of the terminal device 100 is exemplified.

[0144] Figure 6 It is a software structure block diagram of the terminal device 100 according to an embodiment of the present invention.

[0145] The layered architecture divides the software into several layers, each with a clear role and division of labor. The layers communicate with each other through software interfaces. The system is divided into four layers, from top to bottom: application layer, application framework layer, Android runtime ( runtime) and system libraries, as well as the kernel layer.

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

[0147] like Figure 6 As shown, the application package may include camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, screen projection and other applications.

[0148] The application framework layer provides application programming interface (API) and programming framework for the applications in the application layer. The application framework layer includes some predefined functions. Figure 6 As shown, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, and the like.

[0149] The application layer and the application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.

[0150] The system library may include multiple functional modules, such as surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.

[0151] The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, audio driver, camera driver, wireless communication driver (such as WiFi driver).

[0152] The following is an illustrative description of the software and hardware workflow of the terminal device 100 in conjunction with a communication scenario.

[0153] When the touch sensor 580K receives a touch operation, the corresponding hardware interrupt is sent to the kernel layer. The kernel layer processes the touch operation into raw input events (including touch coordinates, timestamp of the touch operation and other information). The raw input events are stored in the kernel layer. The application framework layer obtains the raw input events from the kernel layer and identifies the controls corresponding to the input events. Taking the case where the touch operation is a touch single-click operation and the control corresponding to the single-click operation is the control of the screen projection application as an example, the screen projection application calls the interface of the application framework layer to start the screen projection application, and then starts the wireless communication driver, such as the WiFi driver, by calling the kernel layer, and establishes a P2P connection with the terminal device as the screen projection object through a wireless communication module (such as a WiFi chip), thereby realizing screen projection through a P2P connection.

[0154] The following is a detailed description of the P2P communication method provided in the embodiments of the present application.

[0155] It can be understood that the P2P communication method provided in the embodiment of the present application will be explained later using the screen projection application as an example. Applications in actual terminal devices that have the function of establishing a P2P connection can use the P2P communication method to establish a P2P connection.

[0156] Figure 7 A schematic flow chart of a method for establishing a P2P connection is shown, such as Figure 7 As shown, the method comprises the following steps:

[0157] S701. In response to detecting an operation to initiate screen projection, terminal device A sends communication information 1 of terminal device A to terminal device B.

[0158] Among them, the communication information 1 of the terminal device A may include: a list of channels supported by the terminal device A, and information used to indicate whether the terminal device A supports the radar signal detection function.

[0159] The channel list supported by terminal device A includes: the identifiers of the channels supported by terminal device A when establishing a P2P connection. The number of channel identifiers included in the channel list may be one or more, and the embodiments of the present application do not limit this. The channels supported by terminal device A for establishing a P2P connection are generally preset by the manufacturer. For example, terminal device A supports establishing a P2P connection on channel 36, channel 40, channel 44, channel 48, channel 149, channel 153, channel 157, channel 161, and channel 165, then the identifiers of these channels are included in the above channel list. As an example, the above channel list can be pre-configured in the WiFi chip of terminal device A. Whether terminal device A supports the radar signal detection function can also be preset by the manufacturer.

[0160] In this embodiment, the channel list may include the identifier of the DFS channel, or may not include the identifier of the DFS channel. The channel list generally also includes the identifier of the non-DFS channel.

[0161] In some cases, whether the channel list includes the DFS channel identifier is related to whether the terminal device A supports the DFS feature and the radar signal detection function. If the WiFi chip supports the DFS feature and the radar signal detection function, the WiFi chip manufacturer can configure the DFS channel identifier in the WiFi chip to indicate that the WiFi chip supports the DFS channel.

[0162] For example, if terminal device A supports the DFS feature and the radar signal detection function, and the region where terminal device A is located is Region A, the manufacturer configures the identifiers of all DFS channels and non-DFS channels commonly used in Region A in the WiFi chip of terminal device A, such as configuring a channel list including the identifier of channel 52, the identifier of channel 56, the identifier of channel 60, the identifier of channel 64, the identifier of channel 36, the identifier of channel 40, the identifier of channel 44, the identifier of channel 48, the identifier of channel 149, the identifier of channel 153, the identifier of channel 157, the identifier of channel 161, and the identifier of channel 165 in the WiFi chip.

[0163] In other cases, if terminal device A does not support the DFS feature and / or radar signal detection function, then terminal device A may support establishing P2P connections on DFS channels and non-DFS channels, or may only support establishing P2P connections on non-DFS channels. In this case, the specific channels supported by terminal device A are determined by the WiFi chip manufacturer, that is, whether the channel list includes the DFS channel identifier is determined by the WiFi chip manufacturer.

[0164] For example, the WiFi chip manufacturer configures a channel list including the identifier of channel 52, the identifier of channel 56, the identifier of channel 60, the identifier of channel 64, the identifier of channel 36, the identifier of channel 40, the identifier of channel 44, the identifier of channel 48, the identifier of channel 149, the identifier of channel 153, the identifier of channel 157, the identifier of channel 161, and the identifier of channel 165 in the WiFi chip of terminal device A. Then, terminal device A can support the establishment of P2P connection on common DFS channels and non-DFS channels in area A. The WiFi chip manufacturer configures a channel list including the identifier of channel 36, the identifier of channel 40, the identifier of channel 44, the identifier of channel 48, the identifier of channel 149, the identifier of channel 153, the identifier of channel 157, the identifier of channel 161, and the identifier of channel 165 in the WiFi chip of terminal device A. Then, terminal device A can support the establishment of P2P connection on common non-DFS channels in area A.

[0165] In some examples, such as when terminal device A is in concurrent mode, communication information 1 may also include an identifier of a working channel when terminal device A acts as a STA.

[0166] Terminal device A may include a screen projection application and a WiFi chip. Therefore, terminal device A may detect the operation of initiating screen projection through the screen projection application. In response to the screen projection application detecting the operation of initiating screen projection, the screen projection application may send a communication information sending instruction to the WiFi chip, so that the WiFi chip sends communication information 1 to terminal device B. In some examples, the WiFi chip may send communication information 1 through a wireless communication module. Alternatively, in response to the screen projection application detecting the operation of initiating screen projection, the screen projection application may obtain communication information 1 from the WiFi chip and send the obtained communication information 1 to terminal device B, such as the screen projection application may send communication information 1 to terminal device B through a wireless communication module. The wireless communication module may be a Bluetooth module.

[0167] In some embodiments, after terminal device A detects the operation of initiating screen projection, terminal device A can first establish a Bluetooth connection with terminal device B.

[0168] In some examples, after terminal device A detects the operation of initiating screen projection, if the Bluetooth function of terminal device A is not turned on, terminal device A can automatically start the Bluetooth function to establish a Bluetooth connection with terminal device B. Alternatively, after terminal device A detects the operation of initiating screen projection, if the Bluetooth function of terminal device A is not turned on, a prompt message can be displayed to prompt the user to start the Bluetooth function. In this way, after receiving the user's operation to start the Bluetooth function, the Bluetooth function can be turned on and a Bluetooth connection can be established with terminal device B.

[0169] In some examples, when terminal device A detects the operation of initiating screen projection and activates the Bluetooth function, terminal device A can obtain a list of connectable devices through Bluetooth scanning, and the list of connectable devices can include the identifiers of the scanned devices, such as the identifier of the above-mentioned terminal device B. Afterwards, terminal device A can establish a Bluetooth connection with terminal device B in response to the user selecting the identifier of terminal device B in the list of connectable devices.

[0170] Then, the terminal device A may send the communication information 1 to the terminal device B via the established Bluetooth connection.

[0171] S702. Terminal device B obtains communication information 2 of terminal device B.

[0172] Among them, communication information 2 may include: a list of channels supported by terminal device B.

[0173] Similar to the introduction to communication information 1, the channel list supported by terminal device B includes identifiers of channels supported by terminal device B when establishing a P2P connection. The channel list may be pre-configured in the WiFi chip of terminal device B.

[0174] Similar to the introduction of the channel list supported by terminal device A, in some examples, the channel list supported by terminal device B includes the identifiers of DFS channels and non-DFS channels. For example, the manufacturer configures a channel list including the identifier of channel 52, the identifier of channel 56, the identifier of channel 60, the identifier of channel 64, the identifier of channel 36, the identifier of channel 40, the identifier of channel 44, the identifier of channel 48, the identifier of channel 149, the identifier of channel 153, the identifier of channel 157, the identifier of channel 161, and the identifier of channel 165 in the WiFi chip of terminal device B. In some other examples, the channel list supported by terminal device B may also only include the identifiers of non-DFS channels.

[0175] In some embodiments, the terminal device B may include a screen projection application and a WiFi chip. Therefore, S702 may specifically include: the screen projection application of the terminal device B obtains the communication information 2 from the WiFi chip.

[0176] In some examples, such as when terminal device B is in concurrent mode, communication information 2 may also include an identifier of a working channel when terminal device B acts as a STA.

[0177] It can be understood that in the above process, the user initiates the screen projection operation on terminal device A as an example, and the actual user can also initiate the screen projection operation on terminal device B. When the user initiates the screen projection operation on terminal device B, terminal device B sends its communication information to terminal device A.

[0178] S703: Terminal device B determines a GO in the P2P network based on the information in communication information 1 indicating whether terminal device A supports the radar signal detection function and whether terminal device B supports the radar signal detection function.

[0179] In some embodiments, terminal device B may determine a terminal device supporting the radar signal detection function as a GO in the P2P network based on information in communication information 1 indicating whether terminal device A supports the radar signal detection function and whether terminal device B supports the radar signal detection function.

[0180] For example, if terminal device A supports the radar signal detection function and terminal device B does not support the radar signal detection function, terminal device B can determine that terminal device A is a GO based on the above communication information 1 and communication information 2. If terminal device A does not support the radar signal detection function and terminal device B supports the radar signal detection function, terminal device B can determine that terminal device B is a GO based on the above communication information 1 and communication information 2.

[0181] By using a terminal device that supports radar signal detection as a GO, it can be ensured that when a P2P connection is established on a DFS channel, the terminal device as a GO can detect radar signals, and when a radar signal is detected, the terminal device as a GO can promptly switch the P2P connection from the DFS channel to a non-DFS channel. In this way, interference with the radar signal can be avoided.

[0182] In some examples, if both terminal device A and terminal device B support radar signal detection function, terminal device B can determine the terminal device that is the display end in the P2P communication network as GO. For example, if terminal device A detects that a screen projection operation is initiated, and the screen projection operation is used to display the content in terminal device A in terminal device B, then terminal device B is the display end, that is, terminal device B can be determined as GO.

[0183] In this embodiment, when terminal device B determines that terminal device A is the GO, terminal device B may send a GO confirmation result to terminal device A to inform terminal device A to perform subsequent P2P connection establishment work. When terminal device B determines that it is the GO, terminal device B may temporarily not send a GO confirmation result to terminal device A and directly perform subsequent P2P connection establishment work.

[0184] In other embodiments, terminal device B may also send communication information 2 to terminal device A, so that terminal device A can determine the GO in the P2P network based on communication information 1 and communication information 2. In this embodiment, the communication information 2 may include information indicating whether terminal device B supports the radar signal detection function in addition to the channel list supported by terminal device B. The process of determining the GO by terminal device A is similar to the process of determining the GO by terminal device B, and will not be repeated here.

[0185] It can be understood that in this embodiment, when terminal device A or terminal device B determines that the other terminal device is a GO, terminal device A or terminal device B can send a GO confirmation result to the other terminal to notify the other terminal device to perform subsequent P2P connection establishment work as a GO. For example, when terminal device A determines that terminal device A is a GO and terminal device B is a GC, terminal device A creates a GO and determines the working channel of GO, and sends the result of determining that terminal device B is a GC and the working channel of GO to terminal device B, so that terminal device B creates a GC and establishes the same working channel of GC as the working channel of GO. For another example, when terminal device B determines that terminal device B is a GO and terminal device A is a GC, terminal device B creates a GO and determines the working channel of GO, and sends the result of determining that terminal device A is a GC and the working channel of GO to terminal device A, so that terminal device A creates a GC and establishes the same working channel of GC as the working channel of GO.

[0186] In some cases, if terminal device A determines that terminal device A is a GO, and receives a determination result sent by terminal device B indicating that terminal device A is a GC, that is, terminal device B determines that terminal device B is also a GO, then the terminal device serving as the display terminal can be determined as a GO.

[0187] In this way, in the P2P network, by supporting the radar signal detection function as GO, preparations are made for subsequent P2P connections to be established on the DFS channel, thereby improving the stability and reliability of subsequent P2P connections. At the same time, GO can detect radar signals, thereby preparing for subsequent interference and impact on radar signals.

[0188] The following description is made by taking the terminal device B as a GO in the P2P network as an example. The terminal device B as a GO can establish a P2P connection with the terminal device A through the following process (S704-S710).

[0189] S704: Terminal device B determines whether terminal device A and terminal device B both support establishing a P2P connection on the DFS channel based on communication information 1 and communication information 2.

[0190] According to the above embodiment, the communication information 1 includes a channel list supported by the terminal device A. Based on the identification of the channels included in the channel list, the terminal device B can determine whether the terminal device A supports the establishment of a P2P connection on the DFS channel. For example, the channel list supported by the terminal device A includes the identification of channel 52, the identification of channel 56, the identification of channel 60, the identification of channel 64, the identification of channel 36, the identification of channel 40, the identification of channel 44, the identification of channel 48, the identification of channel 149, the identification of channel 153, the identification of channel 157, the identification of channel 161, and the identification of channel 165. Among them, channel 52, channel 56, channel 60, and channel 64 are DFS channels. In this way, the terminal device B can determine that the terminal device A supports the establishment of a P2P connection on the DFS channel. The communication information 2 includes a channel list supported by the terminal device B. If the channel list supported by the terminal device B includes the identification of the DFS channel, the terminal device B can determine that the terminal device B supports the establishment of a P2P connection on the DFS channel. For example, the channel list supported by terminal device B includes the identifier of channel 52, the identifier of channel 56, the identifier of channel 60, the identifier of channel 64, the identifier of channel 36, the identifier of channel 40, the identifier of channel 44, the identifier of channel 48, the identifier of channel 149, the identifier of channel 153, the identifier of channel 157, the identifier of channel 161, and the identifier of channel 165. Among them, channel 52, channel 56, channel 60, and channel 64 are DFS channels. According to this example, it can be seen that terminal device A and terminal device B both support establishing a P2P connection on a DFS channel.

[0191] For another example, the channel list supported by terminal device A includes the identifier of channel 36, the identifier of channel 40, the identifier of channel 44, the identifier of channel 48, the identifier of channel 149, the identifier of channel 153, the identifier of channel 157, the identifier of channel 161, and the identifier of channel 165. Among them, channel 52, channel 56, channel 60, and channel 64 are DFS channels. In this way, terminal device B can determine that terminal device A does not support establishing a P2P connection on the DFS channel. Communication information 2 includes a channel list supported by terminal device B. If the channel list supported by terminal device B includes the identifier of the DFS channel, terminal device B can determine that terminal device B supports establishing a P2P connection on the DFS channel. For example, the channel list supported by terminal device B includes the identifier of channel 52, the identifier of channel 56, the identifier of channel 60, the identifier of channel 64, the identifier of channel 36, the identifier of channel 40, the identifier of channel 44, the identifier of channel 48, the identifier of channel 149, the identifier of channel 153, the identifier of channel 157, the identifier of channel 161, and the identifier of channel 165. Among them, channel 52, channel 56, channel 60, and channel 64 are DFS channels. According to this example, it can be seen that terminal device A does not support the establishment of P2P connection on the DFS channel, while terminal device B supports the establishment of P2P connection on the DFS channel.

[0192] In some embodiments, two channel lists are stored in the terminal device, in which the identifiers of the channels included in one channel list are not allowed to be changed, i.e., the channel list supported by P2P, and the identifiers of the channels included in the other channel list are allowed to be changed, i.e., the channel list supported by GO. For example, two channel lists can be maintained in a WiFi chip, or one channel list is maintained in the WiFi chip, and the other channel list is saved by the screen projection application. The channel list that is not allowed to be changed is used to determine whether terminal device A and terminal device B both support establishing a P2P connection on the DFS channel in step S704, and the channel list that is allowed to be changed is used for the WiFi chip to set the working channel for the P2P connection.

[0193] In some examples, the list of channels that are allowed to be changed can be changed by the screen projection application.

[0194] In the case of two channel lists stored in the WiFi chip, one of the channel lists can be pre-set by the WiFi chip manufacturer, and the other channel list can be automatically backed up by the terminal device. For example, when the terminal device is turned on for the first time, an automatic backup operation can be performed and a channel list can be obtained. Among them, the channel list that is allowed to be changed can be the factory setting of the device, or it can be automatically backed up.

[0195] In the case where there is a channel list saved in the WiFi chip and there is a channel list saved in the screen projection application, the channel list saved in the WiFi chip is pre-set by the WiFi chip manufacturer, and the other channel list saved in the screen projection application is automatically backed up. Among them, the channel list saved in the WiFi chip is a channel list that is allowed to be changed, and the channel list saved in the screen projection application is a channel list that is not allowed to be changed. Based on the above situation, in step S701, terminal device A can obtain the channel list supported by terminal device A in communication information 1 based on the channel list saved in the screen projection application, and in step S702, terminal device B can obtain the channel list supported by terminal device B in communication information 2 based on the channel list saved in the screen projection application. In some examples, if terminal device B is in concurrent mode, communication information 2 can also include the identification of the working channel when terminal device B is STA, and the screen projection application of terminal device B also needs to obtain the identification of the working channel when terminal device B is STA in communication information 2 from the WiFi chip.

[0196] It can be understood that the channel list supported by the terminal device P2P in steps S701 to S704 is a channel list Q that is not allowed to be changed. In subsequent steps S705 and S706, the channel list supported by the terminal device that is allowed to be changed is called a channel list Q'.

[0197] S705. In response to the fact that terminal device A does not support establishing a P2P connection on a DFS channel, terminal device B supports establishing a P2P connection on a DFS channel, and the channel list Q' supported by terminal device B includes the identifier of the DFS channel, terminal device B deletes the identifier of the DFS channel from the channel list Q' supported by terminal device B.

[0198] In some embodiments, the terminal device B deletes the identifier of the DFS channel from the channel list Q' supported by the terminal device B, which may be because the screen projection application of the terminal device B changes the channel list Q' set in the WiFi chip. For example, in S705, the identifier of the DFS channel is deleted from the channel list Q' supported by the terminal device B. Specifically, it may be that the screen projection application of the terminal device B sends a channel deletion instruction to the WiFi chip, and the channel deletion instruction carries the identifier of the DFS channel. After receiving the channel deletion instruction, the WiFi chip deletes the identifier of the DFS channel from the P2P supported channel list Q' set in the WiFi chip.

[0199] In the case where terminal device A does not support establishing a P2P connection on a DFS channel, and terminal device B supports establishing a P2P connection on a DFS channel, it means that the P2P connection between terminal device A and terminal device B cannot be established on the DFS channel. However, if the channel list Q' supported by terminal device B includes the identifier of the DFS channel, then when terminal device B acts as a GO, the WiFi chip of terminal device B will select the working channel of GO based on the channel list Q' supported by terminal device B, and there is a channel that the working channel is not supported by terminal device A to establish a P2P connection. For example, terminal device A does not support establishing a P2P connection on DFS channel 52, and terminal device B supports establishing a P2P connection on DFS channel 52. If the channel list Q' supported by terminal device B includes the identifier of DFS channel 52, and the STA working channel of terminal device B is channel 52, when terminal device B acts as a GO, the WiFi chip of terminal device B will preferentially select channel 52 as the working channel of GO from the channel list Q' supported by terminal device B based on the SCC channel selection logic. At this time, since terminal device A does not support establishing a P2P connection on the DFS channel 52, a P2P connection cannot be successfully established between terminal device A and terminal device B.

[0200] In this way, through step S705, after the terminal device B deletes the identifier of the DFS channel from the channel list Q' supported by the terminal device B, the WiFi chip of the terminal device B cannot establish the working channel of GO on the DFS channel. Therefore, it can be guaranteed that the terminal device A that cannot establish a P2P connection on the DFS channel can successfully establish a P2P connection with the terminal device B.

[0201] S706: In response to the fact that both terminal device A and terminal device B support establishing a P2P connection on the DFS channel, and the channel list Q' supported by terminal device B does not include the DFS channel identifier, terminal device B adds the DFS channel identifier to the channel list Q' supported by terminal device B.

[0202] In some embodiments, the terminal device B adds the identifier of the DFS channel to the channel list Q' supported by the terminal device B. This may be because the screen projection application of the terminal device B changes the channel list Q' set in the WiFi chip. The specific adding process can be referred to the description of deleting the identifier of the DFS channel from the channel list Q' in the above embodiment, which will not be repeated here.

[0203] In the case where both terminal device A and terminal device B support establishing a P2P connection on a DFS channel, it means that the P2P connection between terminal device A and terminal device B can be established on the DFS channel. However, if the channel list Q' supported by terminal device B does not include the identifier of the DFS channel, then when terminal device B acts as a GO, the WiFi chip of terminal device B will not establish the working channel of GO on the DFS channel based on the channel list Q' supported by terminal device B. Then, the identifier of the DFS channel can be added to the channel list Q' supported by terminal device B through step S706 to facilitate establishing a P2P connection on the DFS channel.

[0204] For example, terminal device A supports establishing a P2P connection on a DFS channel, and the channel list included in communication information 1 includes: the identifier of channel 52, the identifier of channel 56, the identifier of channel 60, the identifier of channel 64, the identifier of channel 36, the identifier of channel 40, the identifier of channel 44, the identifier of channel 48, the identifier of channel 149, the identifier of channel 153, the identifier of channel 157, the identifier of channel 161, and the identifier of channel 165. Communication information 2 of terminal device B shows that terminal device B supports establishing a P2P connection on a DFS channel and a non-DFS channel, that is, the channel list included in communication information 2 includes: the identifier of channel 52, the identifier of channel 56, the identifier of channel 60, the identifier of channel 64, the identifier of channel 36, the identifier of channel 40, the identifier of channel 44, the identifier of channel 48, the identifier of channel 149, the identifier of channel 153, the identifier of channel 157, the identifier of channel 161, and the identifier of channel 165. However, the identifier of the DFS channel does not exist in the channel list Q' supported by the terminal device B, and the channel list Q' includes: the identifier of channel 36, the identifier of channel 40, the identifier of channel 44, the identifier of channel 48, the identifier of channel 149, the identifier of channel 153, the identifier of channel 157, the identifier of channel 161, and the identifier of channel 165. Then, the terminal device B can add the identifier of the DFS channel to the channel list Q'. The identifiers of the DFS channels added to the channel list Q' include: the identifier of channel 52, the identifier of channel 56, the identifier of channel 60, the identifier of channel 64, the identifier of channel 36, the identifier of channel 40, the identifier of channel 44, the identifier of channel 48, the identifier of channel 149, the identifier of channel 153, the identifier of channel 157, the identifier of channel 161, and the identifier of channel 165.

[0205] It is understandable that when the screen projection function is used for different times, the identifier of the DFS channel in the channel list Q' supported by the terminal device B will be dynamically changed, such as added or deleted, according to the judgment result of S704 in the current execution logic.

[0206] S707 . Terminal device B creates a GO, and sets a working channel of the GO to channel M based on communication information 1 , communication information 2 , and channel list Q′.

[0207] The channel list Q' supported by the terminal device B includes the identifier of the channel M.

[0208] The screen projection application of terminal device B sets the identifier of GO's working channel M based on communication information 1, communication information 2, and channel list Q', which exists in the channel list supported by terminal device A in communication information 1 and the channel list Q supported by terminal device B in communication information 2, as well as in channel list Q'. For example, the channel list supported by terminal device A in communication information 1 includes the identifier of channel 149, and the channel list supported by terminal device B in communication information 2 includes the identifier of channel 149.

[0209] When Q includes the identifier of channel 52 and the identifier of channel 149, the screen projection application of terminal device B is based on the communication information

[0210] 1. Communication information 2 sets the working channel of GO to channel 149, so that terminal device A and terminal device B can establish a P2P connection through channel 149. However, since the highest priority channel selection logic followed by the WiFi chip of terminal device B is the SCC channel selection logic, if the channel list Q' supported by terminal device B also includes the identifier 52 and the identifier of channel 149, terminal device B is in concurrent mode, and the working channel of terminal device B as STA is 52, then the WiFi chip of terminal device B will preferentially select channel 52 as the working channel of GO, and will not use the channel 149 selected by the screen projection application of terminal device B as the working channel of GO.

[0211] In addition, under normal circumstances, if the communication information of both terminal devices includes the identification of the STA channel, the WiFi chip of the terminal device as GO will give priority to its own STA channel. For example, in the communication information 1, the channel list supported by the terminal device A as GC includes the identification of channel 36, the identification of channel 52, and the identification of channel 149, and the STA channel of terminal device A is 36. In the communication information 2, the channel list Q supported by the terminal device B as GO includes the identification of channel 52 and the identification of channel 149, and the STA channel of terminal device B is 52. The WiFi chip of the terminal device of GO will give priority to establishing the working channel of GO on channel 52. If there is no identification of the STA channel in the communication information of the terminal device as GO, the WiFi chip of the terminal device of GO will consider the channel determined by the screen projection application of the terminal device. Of course, the WiFi chip will ultimately determine the working channel of GO based on the channel list Q'.

[0212] After step S701 and step S702 of the above embodiment, terminal device B can obtain communication information 1 of terminal device A and communication information 2 of terminal device B, where communication information 2 includes a channel list Q supported by terminal device B.

[0213] Based on the above embodiment, the communication information 1 of the terminal device A may include: a list of channels supported by the terminal device A. And in some examples, if the terminal device A is in concurrent mode, the communication information 1 may also include an identification of a working channel when the terminal device A is a STA. The communication information 2 of the terminal device B may include: a list of channels Q supported by the terminal device B. If the terminal device B is in concurrent mode, the communication information 2 may also include an identification of a working channel when the terminal device B is a STA.

[0214] In some embodiments, the screen projection application of terminal device B can determine the identifier of the working channel of the P2P connection based on communication information 1 and communication information 2, which is present in the channel list supported by terminal device A included in communication information 1 and the channel list Q supported by terminal device B included in communication information 2. Afterwards, the WiFi chip can determine whether the working channel of the P2P connection can be established on the channel determined by the screen projection application based on the channel list Q' supported by terminal device B.

[0215] For example, the channel list supported by terminal device A included in communication information 1 includes: the identifier of channel 36, the identifier of channel 40, the identifier of channel 44, the identifier of channel 48, the identifier of channel 149, the identifier of channel 153, the identifier of channel 157, the identifier of channel 161, and the identifier of channel 165. The channel list Q supported by terminal device B included in communication information 2 includes: the identifier of channel 52, the identifier of channel 56, the identifier of channel 60, the identifier of channel 64, the identifier of channel 36, the identifier of channel 40, the identifier of channel 44, the identifier of channel 48, the identifier of channel 149, the identifier of channel 153, the identifier of channel 157, the identifier of channel 161, and the identifier of channel 165. If the screen projection application of terminal device B determines to establish a P2P connection on channel 36, and the WiFi chip can determine that the channel list Q' supported by terminal device B includes the identifier of channel 36, then the WiFi chip of terminal device B can set the working channel of GO to channel 36. If the screen projection application of terminal device B determines to establish a P2P connection on channel 36, and the channel list Q' supported by terminal device B in the WiFi chip of terminal device B does not include the identifier of channel 36, then the WiFi chip of terminal device B cannot set the working channel of GO to channel 36.

[0216] Since the channel list Q' set in the WiFi chip of terminal device B is set based on the channel list supported by terminal device A included in communication information 1 and the channel list Q supported by terminal device B included in communication information 2, the decision logic of the screen projection application to determine the working channel of GO based on the channel list supported by terminal device A included in communication information 1 and the channel list supported by terminal device B included in communication information 2 is the same as the decision logic of the working channel of GO determined by the WiFi chip based on channel list Q'. Therefore, the WiFi chip can directly establish GO on the working channel determined by the screen projection application.

[0217] For another example, the channel list supported by terminal device A included in communication information 1 includes: the identifier of channel 36, the identifier of channel 40, the identifier of channel 44, the identifier of channel 48, the identifier of channel 149, the identifier of channel 153, the identifier of channel 157, the identifier of channel 161, and the identifier of channel 165. The channel list supported by terminal device B included in communication information 2 includes: the identifier of channel 52, the identifier of channel 56, the identifier of channel 60, the identifier of channel 64, the identifier of channel 36, the identifier of channel 40, the identifier of channel 44, the identifier of channel 48, the identifier of channel 149, the identifier of channel 153, the identifier of channel 157, the identifier of channel 161, and the identifier of channel 165. Communication information 2 also includes the identifier of the working channel of terminal device B when it is used as STA, which is 52. Since the identifier of channel 52 is not included in the channel list supported by terminal device A included in communication information 1, the screen projection application of terminal device B will not select channel 52 to establish a P2P connection. Instead, a P2P connection is established on one of channels 36, 40, 44, 48, 149, 153, 157, 161, and 165. If the screen projection application of terminal device B determines to establish a P2P connection on channel 36, but because the highest priority channel selection logic followed by the WiFi chip of terminal device B is the SCC channel selection logic, then in theory the WiFi chip will choose to establish a P2P connection on channel 52. However, since the channel list supported by terminal device B set in the WiFi chip has been changed based on communication information 1 and communication information 1, although terminal device B supports establishing a P2P connection on channel 52, at this time, the channel list supported by terminal device B set in the WiFi chip of terminal device B only includes the channel identifiers that coexist in the channel list supported by terminal device A included in communication information 1 and the channel list supported by terminal device B included in communication information 2. In this way, the screen projection application determines the channel identifier based on the channel list supported by terminal device A included in communication information 1 and the channel list supported by terminal device B included in communication information 2, and the channel identifier must be in the channel list set in the WiFi chip of terminal device B.

[0218] S708: Terminal device B sends the working channel M of GO and security configuration information to terminal device A.

[0219] S709: Terminal device A creates a GC and sets the working channel of the GC to channel M.

[0220] In some embodiments, terminal device B acts as a GO and sends the working channel and security configuration information of the GO to terminal device A. Terminal device A acts as a GC, i.e., a slave device, and its working channel is determined by the master device (terminal device B). Therefore, terminal device A can set the working channel of the GC to channel M, which is consistent with the working channel of the GO.

[0221] S710 . Terminal device A and terminal device B establish a P2P connection on channel M based on security configuration information.

[0222] Among them, the security configuration information may include a service set identifier (SSID) and a password. The SSID is used to indicate the P2P network where the terminal device B is located, and the password is used by the terminal device B as a GO to identify the identity of the terminal device A as a GC, so as to ensure that the terminal device A and the terminal device B can join the same P2P network. For example, the SSID sent by the terminal device B to the terminal device A is 2, and the password is 123. Then, the terminal device A can send an authentication request to the P2P network with SSID 2 through the working channel of the GO, and the authentication request includes the password 123. After the terminal device B receives the authentication request, the authentication request can be verified based on the SSID and the password, and the verification is passed. After that, the terminal device B can establish a P2P connection with the terminal device A. If the authentication request is received by another terminal device that is also a GO in another P2P network, since the P2P network where the terminal device is located is different from the P2P network where the terminal device is located, the SSID is also different, then the terminal device will not respond to the authentication request, or the terminal device will respond to the result of authentication failure to the terminal device A. In this way, it can be ensured that terminal device A accurately establishes a P2P connection with terminal device B.

[0223] In some embodiments, terminal device A may send an authentication request to terminal device B based on security configuration information. After receiving the authentication request, terminal device B feeds back the authentication result to terminal device A. Next, terminal device A sends an association request to terminal device B. Terminal device B feeds back the association result to terminal device A. Finally, terminal device A initiates a handshake process to terminal device B. In response to the end of the handshake process, terminal device A and terminal device B establish a P2P connection through channel M.

[0224] In some embodiments of the present application, during the process of establishing the P2P connection, terminal devices may exchange information indicating whether the terminal device supports the DFS feature.

[0225] In some examples, the association request sent by terminal device A may carry an extended channel switching (ECS) bit or a spectrum management (spectrum management) bit. If the ECS bit or the spectrum management bit is set to 1, it can be considered that terminal device A supports the DFS feature.

[0226] For example, the P2P connection between terminal device A and terminal device B is established on channel 149. If terminal device B detects that there is a problem with the communication of channel 149 of the P2P connection, such as high data transmission speed delay, high packet loss rate, etc., then terminal device B can switch the working channel of the P2P connection to channel 52. In this way, it can be ensured that the P2P connection can communicate normally.

[0227] For another example, if terminal device B is in concurrent mode, in order to ensure that the STA working channel of terminal device B is the same as the channel corresponding to the P2P connection, when the STA working channel of terminal device B is switched, the working channel of the P2P connection between terminal device A and terminal device B can be switched to the same channel as the STA working channel, thereby avoiding terminal device B being in the same frequency but different channel working mode, thereby improving the stability of data transmission.

[0228] In this way, when the STA working channel of the terminal device B is switched from a non-DFS channel to a DFS channel, the terminal device B can execute subsequent steps (S711-S714) to perform channel switching.

[0229] S711. Terminal device B detects whether the STA working channel is switched, and whether the channel list Q' includes the identifier of channel O after the STA working channel is switched.

[0230] S712: In response to the STA working channel of terminal device B being switched, and the channel list Q' including the identifier of channel O after the STA working channel is switched, terminal device B determines whether terminal device A supports channel switching based on the association request.

[0231] S713: In response to terminal device A supporting channel switching, terminal device B sends a channel switching instruction to terminal device A.

[0232] Since in the previous steps S705 and S706, the channel list Q' supported by the P2P connection corresponding to the terminal device B has been changed based on the communication information 1 of the terminal device A, it is ensured that the channel identifiers included in the channel list supported by the P2P connection corresponding to the terminal device B include the identifiers of the P2P connection channels supported by both the terminal device A and the terminal device B. In this way, the terminal device B can directly determine whether there is a channel in the channel list Q' that is the same as the current STA working channel O, which can ensure that both the terminal device A and the terminal device B can smoothly switch channels.

[0233] S714. Terminal device A switches the working channel of GC to channel O.

[0234] In some examples, terminal device B is connected to AP via channel 52 as STA, and terminal device B is also connected to terminal device A via channel 52 as GO. When terminal device B detects that the STA working channel is switched from channel 52 to channel 149, terminal device B can determine whether there is an identifier of channel 149 in the channel list supported by the P2P connection corresponding to terminal device B. If there is an identifier of channel 149 in the channel list supported by the P2P connection corresponding to terminal device B, terminal device B can switch the working channel of GO to channel 149. Because in step S705 and step S706, the channel list supported by the P2P connection corresponding to terminal device A is synchronized and changed. In this way, terminal device A can also switch the working channel of GC to channel 149. Terminal device B can control terminal device A to switch channels by sending a channel switching instruction to terminal device A. In this way, it can be ensured that terminal device B in the concurrent module is in the same frequency and same channel working mode, avoiding the problem of large transmission delay in the communication process and easy packet loss during transmission.

[0235] In the above embodiments, communication information needs to be exchanged between terminal device A and terminal device B, such as using the Bluetooth protocol to establish a Bluetooth connection for the exchange of communication information. Therefore, terminal device A and terminal device B need to support the same Bluetooth protocol, that is, the above solution can be used in the scenario where terminal device A and terminal device B support the same Bluetooth protocol. For example, if two terminal devices include the same operating system, or the same research and development platform, then the Bluetooth protocol used by the two terminal devices is the same, and the terminal devices can exchange communication information through the Bluetooth protocol. In the scenario where terminal device A and terminal device B do not support the same Bluetooth protocol, for example, if the two terminal devices include different operating systems, or different research and development platforms, then the embodiments of the present application also provide Figure 8 The solution shown is used to establish a P2P connection between terminal devices.

[0236] like Figure 8 As shown, Figure 8 A schematic flow chart of a method for establishing a P2P connection is shown, the method comprising the following steps:

[0237] S801. In response to the activation of function 1 in the screen projection application b, the screen projection application b of the terminal device B obtains the channel list Q supported by the terminal device B.

[0238] In some embodiments, terminal device B may be triggered by function 1 in screen projection application b to execute step S801. For example, when terminal device B is a smart TV, the operation interface corresponding to screen projection application b includes an operation button for starting or closing function 1. In some examples, function 1 may be in a closed state by default after screen projection application b is started.

[0239] S802: In response to the presence of a DFS channel identifier in the channel list Q supported by the terminal device B, the screen projection application b of the terminal device B deletes the DFS channel identifier from the channel list Q' supported by the terminal device B;

[0240] S803. The screen projection application b of the terminal device B creates a GO and sets the working channel of the GO to channel N based on the channel list Q'.

[0241] Generally, after the DFS channel identifier in the channel list Q' is deleted, only the identifier of the non-DFS channel is retained in the channel list Q'. Therefore, when step S803 sets the working channel of GO to channel N based on the channel list Q', channel N is a non-DFS channel.

[0242] In some examples, when function 1 is in the off state, if the user clicks the operation button corresponding to function 1, terminal device B starts function 1. After that, screen projection application b can default terminal device B to GO, and screen projection application b can inform the WiFi chip of terminal device B to set the working channel of GO based on channel list Q', so as to ensure that the working channel of GO is set to a channel in the non-DFS channel.

[0243] In some embodiments, after function 1 in the screen projection application b of terminal device B is started, the screen projection application b can set the channel list Q' supported by terminal device B to include only non-DFS channels. For example, the user clicks the operation button corresponding to function 1, and terminal device B starts function 1. The screen projection application b can first obtain the communication information 2 of terminal device B, and the communication information 2 includes the channel list supported by terminal device B. Subsequently, the screen projection application b determines whether the channel list supported by terminal device B includes the DFS channel. If so, the screen projection application b can send a channel deletion instruction to the WiFi chip of terminal device B, and the channel deletion instruction carries the identifier of the DFS channel. After receiving the channel deletion instruction, the WiFi chip deletes the identifier of the DFS channel from the P2P supported channel list set in the WiFi chip. In this way, regardless of whether the terminal device B is connected to the AP as a STA, and regardless of whether the STA working channel of the terminal device B is a DFS channel or a non-DFS channel, the WiFi chip can only set the working channel of GO to channel N in the non-DFS channel.

[0244] In some examples, the screen projection application b can store the acquired communication information 2.

[0245] S804. In response to detecting the operation of initiating screen projection, terminal device A sends a detection request frame on a non-DFS channel to discover terminal device B as a GO.

[0246] In some embodiments, terminal device A can detect the operation of initiating screen projection and determine whether terminal device A needs to execute step S804. For example, when terminal device A is a smart phone, screen projection application a is running in terminal device A, and the operation interface corresponding to screen projection application a includes an operation button for initiating screen projection. If it is detected that the user clicks the operation button for initiating screen projection, the screen projection application a of terminal device A can inform the WiFi chip of terminal device A to start sending detection request frames on the non-DFS channel, so that terminal device A can find terminal device B that is also listening on the non-DFS channel.

[0247] like Figure 8 As shown, after step S804, terminal device A needs to discover terminal device B as GO. The process of terminal device A discovering terminal device B is similar to the process of Figure 2The P2P connection establishment process shown is similar, and terminal device A needs to send a detection request frame on a non-DFS channel until terminal device A discovers terminal device B. Take the non-DFS channels supported by terminal device A and terminal device B as an example, including channel 36, channel 40, channel 44, channel 48, channel 149, channel 153, channel 157, channel 161, and channel 165. In response to detecting the operation of initiating screen projection, terminal device A sends detection request frames on channels 36, 40, 44, 48, channel 149, channel 153, channel 157, channel 161, and channel 165 in sequence until terminal device A discovers terminal device B. For example, when the working channel of terminal device B as GO is channel 40, terminal device A first sends a detection request frame on channel 36. At this time, terminal device B cannot monitor the detection request frame sent by terminal device A, and cannot send a detection feedback frame to terminal device A. Subsequently, since terminal device A cannot receive the detection feedback frame sent by terminal device B within the preset waiting time, terminal device A can send a detection request frame on channel 40 after the waiting time has expired. At this time, terminal device B can monitor the detection request frame sent by terminal device A and send a detection feedback frame to terminal device A. S805. In response to receiving the detection request frame sent by terminal device A, terminal device B sends the working channel N of GO and security configuration information to terminal device A.

[0248] After monitoring the detection request frame sent by the terminal device A, the terminal device B may send a detection feedback frame to the terminal device A. The detection feedback may carry the working channel and security configuration information of the GO.

[0249] S806. Terminal device A creates a GC and sets the working channel of the GC to channel N.

[0250] In some embodiments, after discovering terminal device B as GO, terminal device A can determine that terminal device A is a GC in the P2P network based on the detection feedback frame fed back by terminal device B. GC is a slave device in the P2P network, and its working channel is determined by the master device GO. Therefore, terminal device A sets the working channel of GC to channel N. At this time, the working channel of GC is the same as the working channel of GO, which can ensure that a P2P connection can be established between GC and GO through channel N.

[0251] S807 . Terminal device A and terminal device B establish a P2P connection on channel N based on the security configuration information.

[0252] The security configuration information is similar to the security configuration information in step S708, and step S807 is the same as step S710. For details, please refer to the above embodiment, which will not be repeated here.

[0253] In the above embodiment, terminal device B is directly determined to be GO, so when terminal device A scans terminal device B, terminal device A can directly serve as GC. And when terminal device B sets the working channel of GO, it is set based on the non-DFS channel to ensure that any type of terminal device A that only supports the P2P function can scan terminal device B. For example, if terminal device A does not support the DFS feature and supports the radar signal detection function, but supports the P2P function, it means that terminal device A can perform the standard P2P connection process. Then, terminal device A can discover the opposite device by scanning the non-DFS channel. In this way, the applicability of the embodiments of the present application is greatly improved.

[0254] Based on the above steps, the channel corresponding to the P2P connection established by terminal device B is directly established on a non-DFS channel. It is possible that the STA working channel of the terminal device is in a DFS channel. In order to avoid the situation where the working channel of the P2P connection of terminal device B is different from the STA working channel in concurrent mode, resulting in terminal device B being in the same frequency but different channel working mode, the following steps can be used to switch the P2P channel.

[0255] The following is an example of a case where terminal device B, as a STA, establishes a connection with AP on a DFS channel.

[0256] S808. Terminal device B determines whether terminal device A supports the DFS feature and whether it supports establishing a P2P connection in the DFS channel based on the association request frame in the P2P connection establishment process.

[0257] Terminal device A and terminal device B determine whether terminal device A supports the DFS feature and the DFS channel based on the association request frame in the P2P connection establishment process. For example, the association request frame may include the ECS bit or the spectrum management bit, and the channels supported by terminal device A. Specifically, terminal device B can determine whether terminal device A supports the DFS feature based on whether the value of the ECS bit or the spectrum management bit is 1. If the supported channels include the DFS channel, terminal device A supports the DFS channel.

[0258] If terminal device A does not support switching the GC working channel to the DFS channel, then terminal device A and terminal device B maintain P2P communication on the non-DFS channel to ensure that the P2P connection is not disconnected.

[0259] If the terminal device A supports switching the working channel of the GC to the DFS channel, then the following steps can be performed to implement the channel switching (step S809-step S813).

[0260] S809 . In response to the terminal device A supporting the establishment of a P2P connection on the DFS channel, the terminal device B adds the DFS channel to the channel list Q′ supported by the terminal device B.

[0261] In some examples, based on the above steps, after the screen projection application b obtains the communication information 2 of the terminal device B, the screen projection application b can send a channel deletion instruction to the WiFi chip of the terminal device B, and the channel deletion instruction carries the identifier of the DFS channel. After the WiFi chip receives the channel deletion instruction, it deletes the identifier of the DFS channel from the list of channels supported by P2P set in the WiFi chip. Then, in response to the terminal device A supporting the establishment of a P2P connection on the DFS channel, the screen projection application b of the terminal device B can add the identifier of the DFS channel back to the channel list Q' in the WiFi chip based on the stored communication information 2.

[0262] S810: In response to the current STA working channel P of the terminal device B being a DFS channel and the channel list Q' including the identifier of the STA working channel P, the terminal device B determines whether the terminal device A supports channel switching based on the association request.

[0263] After the DFS channel identifier is added back to the channel list Q' in the WiFi chip, if the current STA working channel P of the terminal device B is a DFS channel, and it can be determined that the channel list Q' includes the identifier of the STA working channel P, then the terminal device B can determine whether the terminal device A supports channel switching based on the association request, so as to prepare for switching in order to avoid the terminal device B being in the same frequency but different channel working mode.

[0264] S811. In response to terminal device A supporting channel switching, terminal device B sends a channel switching instruction to terminal device A.

[0265] In some embodiments, when terminal device A supports channel switching, the WiFi chip of terminal device B can switch the working channel of GO to channel P. At the same time, a channel switching instruction is sent to terminal device A, and the channel switching instruction is used to instruct terminal device A to switch the working channel of GC to channel P.

[0266] S812. Terminal device A switches the working channel of GC to channel P.

[0267] In one case, if the current STA working channel acquired by terminal device B is channel 52, which is a DFS channel, and terminal device B sets the working channel to a non-DFS channel when establishing the working channel of GO, the current STA working channel of terminal device B is different from the working channel of GO. Then, terminal device B can switch the working channel of GO to channel 52, and send a channel switching instruction to terminal device A, so that terminal device A also switches the working channel of GC to channel 52.

[0268] In another case, if the current STA working channel obtained by terminal device B is channel 36, which is a non-DFS channel. When terminal device B establishes the working channel of GO, it sets the working channel to channel 40 in the non-DFS channel, so the current STA working channel of terminal device B is also different from the working channel of GO. Then, terminal device B can switch the working channel of GO to channel 40, and send a channel switching instruction to terminal device A, so that terminal device A also switches the working channel of GC to channel 40.

[0269] In this way, it can be ensured that when it is unknown whether terminal device A supports the DFS feature and whether it supports the establishment of P2P on the DFS channel, terminal device B and terminal device A first establish a P2P connection on a non-DFS channel. After terminal device A and terminal device B establish a P2P connection, terminal device B determines whether the working channel of the P2P connection can be switched based on the association request frame of terminal device A obtained when the P2P connection is established. In this way, while ensuring that a P2P connection can be established between terminal device A and terminal device B, the STA channel of terminal device B is guaranteed to be the same as the working channel of the P2P connection.

[0270] In the following, taking the first terminal device as terminal device B as an example, the process of a point-to-point P2P communication method provided by the present application is described. Fig. 9 As shown, the method is applied to a first terminal device and includes the following steps:

[0271] Step S901: In response to a request for establishing a P2P communication connection, first communication information of a first terminal device and second communication information of a second terminal device are acquired.

[0272] The first communication information includes a first channel list supported by the first terminal device, and the second communication information includes a second channel list supported by the second terminal device. The first terminal device corresponds to the terminal device B in the above embodiment, and the first communication information corresponds to the communication information 2. The second terminal device corresponds to the terminal device A in the above embodiment, and the second communication information corresponds to the communication information 1. The first communication information includes a first channel list supported by the first terminal device, and the first channel list includes the identifiers of the channels supported by the P2P connection of the first terminal device. The second communication information includes a second channel list supported by the second terminal device, and the second channel list includes the identifiers of the channels supported by the P2P connection of the second terminal device.

[0273] In some examples, the request to establish a P2P communication connection may be initiated by the first terminal device. For example, the first terminal device may regard the detection by the first terminal device of a user initiating a screen projection operation as a request to establish a P2P communication connection. In other examples, the request to establish a P2P communication connection may be initiated by the second terminal device. For example, when the second terminal device detects that a user has initiated a screen projection operation, the second terminal device may send a request to establish a P2P communication connection to the first terminal device via a Bluetooth connection.

[0274] Step S902: When at least one channel list in the first channel list and the second channel list does not include the identifier of the dynamic frequency selection DFS channel, and the third channel list includes the identifier of the DFS channel, delete the identifier of the DFS channel in the third channel list, where the third channel list is a working list of the wireless communication chip of the first terminal device.

[0275] In some embodiments, if the first channel list includes the identifier of the dynamic frequency selection DFS channel, the second channel list does not include the identifier of the dynamic frequency selection DFS channel, and the third channel list includes the identifier of the DFS channel, the identifier of the DFS channel in the third channel list is deleted.

[0276] For example, when the first channel list includes the identifiers of channel 52 and channel 149, the second channel list includes the identifier of channel 149, and the third channel list includes the identifier of channel 52 and channel 149, the first terminal device can delete the identifier of DFS channel 52 in the third channel list to obtain a third channel list that only includes the identifier of channel 149.

[0277] At this time, if the STA working channel of the first terminal device is connected to channel 52, the screen projection application of the first terminal device can determine that the working channel of GO is 149 based on the STA working channel being channel 52, the first channel list and the second channel list, thereby ensuring that the P2P connection can be successfully established. Subsequently, the screen projection application of the first terminal device sends channel 149 to the WiFi chip. Although the STA working channel is channel 52, and the WiFi chip should select channel 52 as the working channel of GO based on the SCC channel selection logic with the highest priority, the WiFi chip also needs to set the working channel of GO according to the third channel list, and the current third channel list only includes the identifier of channel 149, so the WiFi chip can only select channel 149 as the working channel of the P2P connection.

[0278] In some examples, the third channel list may be the first channel list. In this case, after the first terminal device obtains the first channel list and the second channel list, it may modify the first channel list, that is, the third channel list.

[0279] Optionally, in the case where the third channel list may be the first channel list, in order to ensure that the third channel list can be accurately updated based on the first channel list and the second channel list, the first terminal device may initialize the first channel list each time before acquiring the first channel list, so that the first channel list includes channel identifiers preset by the chip manufacturer.

[0280] In some examples, the third channel list may also be a backup of the first channel list. For example, the third channel list may be backed up based on the first channel list, and the channel identifiers in the third channel list may be changed, and the third channel list is a working list of the wireless communication chip of the first terminal device.

[0281] In some embodiments, when the first channel list does not include the identifier of the dynamic frequency selection DFS channel, the second channel list includes the identifier of the dynamic frequency selection DFS channel, and the third channel list includes the identifier of the DFS channel, the identifier of the DFS channel in the third channel list should be deleted. In some examples, in actual applications, the first channel list includes the identifier of the channel supported by the P2P connection of the first terminal device. If the first channel list includes the identifier of the dynamic frequency selection DFS channel, it means that the first terminal device supports the establishment of a P2P connection on the DFS channel. Then, the third channel list, as the working list of the wireless communication chip of the first terminal device, will not include the identifier of the DFS channel. However, if in actual applications, there is a situation where the identifier of the dynamic frequency selection DFS channel is included in the first channel list, and the third channel list is inaccurate, resulting in the inclusion of the identifier of the DFS channel that should not be included in the third channel list, then based on the above step S902, the third channel list can also be corrected.

[0282] In some embodiments, when neither the first channel list nor the second channel list includes the identifier of the dynamic frequency selection DFS channel, and the third channel list includes the identifier of the DFS channel, the identifier of the DFS channel in the third channel list is deleted. Accordingly, similar to the above embodiment, in actual application, the first channel list includes the identifier of the DFS channel, and under normal circumstances, the third channel list does not include the third channel list. However, if there is an error in the third channel list, the third channel list can be corrected, and the details can be referred to the above embodiment.

[0283] Among them, the first channel list supported by the first terminal device can be called the P2P channel list supported by the first terminal device, the second channel list supported by the second terminal device can be called the P2P channel list supported by the second terminal device, and the third list can be called the working list supported by GO.

[0284] After the first terminal device deletes the identifier of the DFS channel in the third channel list through step S902, it can establish a P2P communication connection with the second terminal device through the following step S903.

[0285] Step S903: Based on the first communication information, the second communication information and the third channel list, a P2P communication connection is established between the first terminal device and the second terminal device on the first channel, where the first channel is a channel corresponding to an identifier included in the first communication information, the second communication information and the third channel list.

[0286] In some embodiments, when the first terminal device establishes a P2P communication connection between the first terminal device and the second terminal device on the first channel based on the first communication information, the second communication information and the third channel list, the application of the first terminal device can first determine the identifier of the first channel based on the first communication information and the second communication information; thereafter, the application of the first terminal device sends the identifier of the first channel to the wireless communication chip; the wireless communication chip establishes the P2P communication connection between the first terminal device and the second terminal device on the first channel based on the identifier of the first channel and the third channel list.

[0287] The wireless communication chip only uses the channel identifier determined by the application of the first terminal device as a reference. The wireless communication chip ultimately determines the P2P connection working channel based on the channel selection logic set internally thereof with reference to the channel identifier determined by the application of the first terminal device.

[0288] In some embodiments, the first communication information further includes: a STA channel of the first terminal device, and the second communication information further includes a STA channel of the second terminal device.

[0289] In some examples, when the first terminal device is in concurrent mode, that is, the first terminal device communicates with the AP as a STA and acts as a communication end in the P2P network, the first communication information includes the STA channel of the first terminal device. Correspondingly, when the second terminal device is in concurrent mode, the second communication information includes the STA channel of the second terminal device.

[0290] In some examples, the STA channel of the terminal device can be acquired by a WiFi chip.

[0291] In some embodiments, the first terminal device is connected to an access point AP, and the working channel of the first terminal device connected to the AP is switched from the second channel to the third channel, and if the second terminal device supports channel switching, the first terminal device switches the first channel to the third channel, and the identifier of the third channel is included in the third channel list. In this way, the first terminal device can avoid the situation of the same frequency and different channels.

[0292] In some examples, when the working channel of the first terminal device connected to the AP is switched from the second channel to the third channel, and the second terminal device does not support channel switching, the first terminal device and the second terminal device maintain a P2P connection through the first channel. In this way, it can be ensured that the P2P connection will not fail due to the switching of the STA channel and the second terminal device does not support channel switching, thereby improving the stability of the P2P connection.

[0293] In some examples, the first terminal device may also obtain second indication information for indicating whether the second terminal device supports channel switching, where the second indication information is included in the management request frame.

[0294] In some examples, the second terminal device sends a first indication message of radar signal detection.

[0295] In some embodiments, the first terminal device is the group manager GO of the P2P communication connection; wherein the first terminal device supports the radar signal detection function, and the second terminal device does not support the radar signal detection function; or, when both the first terminal device and the second terminal device support the radar signal detection function, the first terminal device is the display end in the P2P communication connection request.

[0296] The first terminal device as GO supports the radar signal detection function, which can avoid the P2P connection being established on the DFS channel when a radar signal is detected, so that the terminal device can establish the P2P connection in compliance with regulations.

[0297] In some examples, the first terminal device as a GO may also support the DFS feature, and the first terminal device supporting the DFS feature may implement the switching of the P2P channel. If the P2P connection of the first terminal device has been established on the DFS channel, then when the first terminal device as a GO detects a radar signal, in order to avoid the P2P connection from interfering with the radar signal, the first terminal device may switch the channel of the P2P connection from the DFS channel to the non-DFS channel, so that the terminal device can establish the P2P connection in compliance with the regulations.

[0298] In some embodiments, the second communication information further includes: first indication information for indicating whether the second terminal device supports the radar signal detection function. Then the first terminal device can determine the GO of the P2P communication connection based on the first indication information and whether the first terminal device supports the radar signal detection function.

[0299] For details, please refer to the embodiment corresponding to the above step S703. The terminal device can determine GO based on the information in the first communication information indicating whether the first terminal device supports the radar signal detection function and whether the second terminal device supports the radar signal detection function. In the case where the first terminal device supports the radar signal detection function and the second terminal device does not support the radar signal detection function, the first terminal device is GO. In the case where the first terminal device supports the radar signal detection function and the second terminal device both support the radar signal detection function, it can be determined that the first terminal device serving as the display end of the projection screen is GO.

[0300] In some embodiments, the first terminal device may add the identifier of the DFS channel to the third channel list when both the first channel list and the second channel list include the identifier of the DFS channel and the third channel list does not include the identifier of the DFS channel.

[0301] In some examples, after the first terminal device executes step S902, that is, after deleting the channel identifier in the third channel list, there may be some situations where the deleted channel identifier needs to be added back to the third channel list. For example, the first terminal device establishes a P2P connection on a DFS channel. Considering that the second terminal device does not support establishing a connection on the DFS channel, the first terminal device deletes the DFS channel identifier from the third channel list. Afterwards, after the first terminal device disconnects the P2P connection with the second terminal device, it establishes a P2P connection with a third terminal device that supports establishing a P2P connection on the DFS channel, and then the DFS channel identifier can be added to the third channel list.

[0302] In some embodiments, the application of the first terminal device determines whether both the first channel list and the second channel list include the identifier of the DFS channel. The application can be an application that triggers a P2P connection, or an application for establishing a P2P connection. For example, a multi-screen collaboration application installed in a computer, a screen projection application installed in a TV, and the like. Afterwards, when at least one channel list in the first channel list and the second channel list does not include the identifier of the dynamic frequency selection DFS channel, and the third channel list includes the identifier of the DFS channel, the first terminal device can delete the identifier of the DFS channel in the third channel list through the following process: First, when at least one channel list in the first channel list and the second channel list does not include the identifier of the DFS channel, the application of the first terminal device sends a deletion instruction to the wireless communication chip, and the deletion instruction includes the identifier of the DFS channel. When the wireless communication chip determines that the third channel list includes the identifier of the DFS channel, it deletes the identifier of the DFS channel in the third channel list.

[0303] In some embodiments, when the first channel list and the second channel list both include the identifier of the DFS channel, and the third channel list does not include the identifier of the DFS channel, the first terminal device may add the identifier of the DFS channel to the third channel list through the following process: first, when the first channel list and the second channel list both include the identifier of the DFS channel, the application of the first terminal device sends an add instruction to the wireless communication chip, and the add instruction includes the identifier of the DFS channel; when it is determined that the third channel list does not include the identifier of the DFS channel, the wireless communication chip adds the identifier of the DFS channel to the third channel list.

[0304] The process of the first terminal device deleting the DFS channel in the third channel list and the process of the first terminal device adding the identifier of the DFS channel in the third channel list can refer to the details of the above embodiment and will not be repeated here.

[0305] The present application also provides a point-to-point P2P communication discovery method, which is applied to a first terminal device, and the first terminal device is connected to an access point AP on a dynamic frequency selection DFS channel. The first terminal device responds to a request for establishing a P2P communication connection, and obtains the first communication information of the first terminal device; the first communication information includes a first channel list supported by the first terminal device, and the first channel list includes an identifier of a DFS channel; when a third channel list includes an identifier of a DFS channel, the identifier of the DFS channel in the third channel list is deleted, and the third channel list is a working list of a wireless communication chip of the first terminal device; and the working channel of the first terminal device is set to a non-DFS channel supported by the first terminal device, so that the second terminal device can discover the first terminal device on the non-DFS channel.

[0306] When it is unknown whether terminal device A supports the DFS feature and whether it supports establishing P2P on the DFS channel, terminal device B first establishes a P2P connection with terminal device A on a non-DFS channel. After terminal device A establishes a P2P connection with terminal device B, terminal device B determines whether the working channel of the P2P connection can be switched based on the association request frame of terminal device A obtained when establishing the P2P connection. In this way, while ensuring that a P2P connection can be established between terminal device A and terminal device B, the STA channel of terminal device B is guaranteed to be the same as the working channel of the P2P connection. For a specific implementation method, please refer to Figure 8 And related embodiments are not described in detail here.

[0307] In some embodiments, the first terminal device may receive a probe request frame from the second terminal device on a non-DFS channel, and send a probe response frame to the second terminal device on the non-DFS channel, and the first terminal device establishes a P2P communication connection between the first terminal device and the second terminal device on the non-DFS channel. Subsequently, if the first terminal device supports channel switching, the second communication information of the second terminal device is obtained; the second communication information includes a list of second channels supported by the second terminal device and indication information for indicating whether the second terminal device supports channel switching; if the second channel list includes an identifier of a DFS channel, the identifier of the DFS channel is added to the third channel list; if the indication information indicates that the second terminal device supports channel switching, the working channel of the P2P communication connection is switched from a non-DFS channel to a DFS channel.

[0308] Combination of the above Figure 7-Figure 9The P2P communication method and the P2P communication discovery method provided by the embodiments of the present application are described in detail. Fig.10 The terminal device provided in the embodiment of the present application is described in detail.

[0309] In one possible design, Fig.10 This is a schematic diagram of the structure of the terminal device provided in the embodiment of the present application. Fig.10 As shown, the terminal device 100 may include: a processing unit 1001 and a transceiver unit 1002. The terminal device 100 may be used to implement the functions of the terminal device involved in the above method embodiment.

[0310] Optionally, the processing unit 1001 is used to support the terminal device 100 to execute Figure 7 S701-S714 in; also used to support the terminal device 100 to execute Figure 8 S801-S812 in; also used to support the terminal device 100 to execute Fig. 9 S901-S903 in.

[0311] Optionally, the transceiver unit 1002 is used to support the terminal device 100 to execute Figure 7 S701-S714 in; also used to support the terminal device 100 to execute Figure 8 S801-S812 in; also used to support the terminal device 100 to execute Fig. 9 S901-S903 in.

[0312] Among them, the transceiver unit may include a receiving unit and a sending unit, and may be implemented by a transceiver or a transceiver-related circuit component, and may be a transceiver or a transceiver module. The operations and / or functions of each unit in the terminal device 1000 are respectively to implement the corresponding processes of the P2P communication method and the P2P communication discovery method described in the above method embodiment. All relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional unit, and for the sake of brevity, they will not be repeated here.

[0313] Optionally, Fig.10 The terminal device 100 shown may also include a storage unit ( Fig.10 (not shown), the storage unit stores a program or instruction. When the processing unit 1001 and the transceiver unit 1001 execute the program or instruction, Fig.10 The terminal device 100 shown can execute the P2P communication method and the P2P communication discovery method described in the above method embodiments.

[0314] Fig.10The technical effects of the terminal device 100 shown can refer to the technical effects of the P2P communication method and the P2P communication discovery method described in the above method embodiments, which will not be repeated here.

[0315] In addition to being in the form of the terminal device 100, the technical solution provided in the embodiment of the present application may also be a functional unit or chip in the terminal device, or a device used in conjunction with the terminal device.

[0316] An embodiment of the present application also provides a computer-readable storage medium, which includes computer instructions. When the computer instructions are executed on the above-mentioned terminal device, the terminal device executes each function or step in the above-mentioned method embodiment.

[0317] The embodiment of the present application also provides a computer program product, including a computer program. When the computer program is executed on a terminal device, the terminal device executes each function or step in the above method embodiment.

[0318] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned 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.

[0319] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0320] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0321] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0322] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.

[0323] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application shall be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims

1. A point-to-point (P2P) communication method, characterized in that: Applied to a first terminal device, the method includes: In response to a request for establishing a P2P communication connection, acquiring first communication information of the first terminal device and second communication information of the second terminal device; the first communication information includes a first channel list supported by the first terminal device, and the second communication information includes a second channel list supported by the second terminal device; In a case where at least one of the first channel list and the second channel list does not include an identifier of a dynamic frequency selection DFS channel, and the third channel list includes an identifier of a DFS channel, deleting the identifier of the DFS channel in the third channel list, where the third channel list is a working list of a wireless communication chip of the first terminal device; Based on the first communication information, the second communication information and the third channel list, a P2P communication connection is established between the first terminal device and the second terminal device on a first channel, wherein the first channel is a channel corresponding to an identifier included in the first communication information, the second communication information and the third channel list.

2. The method according to claim 1, characterized in that The first terminal device is a group manager GO of the P2P communication connection; Among them, the first terminal device supports the radar signal detection function, and the second terminal device does not support the radar signal detection function; or, when the first terminal device and the second terminal device both support the radar signal detection function, the first terminal device is the display end in the P2P communication connection network.

3. The method according to claim 2, characterized in that The second communication information further includes: first indication information for indicating whether the second terminal device supports the radar signal detection function; The method further comprises: A GO of the P2P communication connection is determined based on the first indication information and whether the first terminal device supports the radar signal detection function.

4. The method according to any one of claims 1 to 3, characterized in that The method further comprises: In a case where both the first channel list and the second channel list include the identifier of the DFS channel, and the third channel list does not include the identifier of the DFS channel, the identifier of the DFS channel is added to the third channel list.

5. The method according to any one of claims 1 to 4, characterized in that The method further comprises: The application of the first terminal device determines whether the first channel list and the second channel list both include the identifier of the DFS channel; The step of deleting the identifier of the DFS channel in the third channel list when at least one of the first channel list and the second channel list does not include the identifier of the dynamic frequency selection DFS channel, and the third channel list includes the identifier of the DFS channel, comprises: In a case where at least one of the first channel list and the second channel list does not include the identifier of the DFS channel, the application of the first terminal device sends a deletion instruction to the wireless communication chip, where the deletion instruction includes the identifier of the DFS channel; When determining that the third channel list includes the identifier of the DFS channel, the wireless communication chip deletes the identifier of the DFS channel in the third channel list.

6. The method according to claim 5, characterized in that When both the first channel list and the second channel list include the identifier of the DFS channel, and the third channel list does not include the identifier of the DFS channel, adding the identifier of the DFS channel to the third channel list includes: In a case where both the first channel list and the second channel list include the identifier of the DFS channel, the application of the first terminal device sends an add instruction to the wireless communication chip, where the add instruction includes the identifier of the DFS channel; When determining that the third channel list does not include the identifier of the DFS channel, the wireless communication chip adds the identifier of the DFS channel to the third channel list.

7. The method according to any one of claims 1 to 6, characterized in that The establishing a P2P communication connection between the first terminal device and the second terminal device on the first channel based on the first communication information, the second communication information and the third channel list includes: The application of the first terminal device determines an identifier of the first channel based on the first communication information and the second communication information; The application of the first terminal device sends an identifier of the first channel to the wireless communication chip; The wireless communication chip establishes a P2P communication connection between the first terminal device and the second terminal device on the first channel based on the identifier of the first channel and the third channel list.

8. The method according to any one of claims 1 to 7, characterized in that The first terminal device is connected to an access point AP, and the method further includes: When the working channel connecting the first terminal device and the AP is switched from the second channel to the third channel and the second terminal device supports channel switching, the first terminal device switches the first channel to the third channel, and the identifier of the third channel is included in the third channel list.

9. The method according to claim 7, characterized in that: The method further comprises: Obtain second indication information for indicating whether the second terminal device supports channel switching, where the second indication information is included in a management request frame.

10. A point-to-point P2P communication discovery method, characterized in that: Applied to a first terminal device, the first terminal device is connected to an access point AP on a dynamic frequency selection DFS channel, and the method includes: In response to a request for establishing a P2P communication connection, acquiring first communication information of the first terminal device; the first communication information includes a first channel list supported by the first terminal device, and the first channel list includes an identifier of the DFS channel; In a case where the third channel list includes an identifier of a DFS channel, deleting the identifier of the DFS channel in the third channel list, where the third channel list is a working list of the wireless communication chip of the first terminal device; The working channel of the first terminal device is set to a non-DFS channel supported by the first terminal device, so that the second terminal device can discover the first terminal device on the non-DFS channel.

11. The method according to claim 10, characterized in that The method further comprises: Receiving a probe request frame from the second terminal device on the non-DFS channel; Sending a probe response frame to the second terminal device on the non-DFS channel; Establishing a P2P communication connection between the first terminal device and the second terminal device on the non-DFS channel; In the case where the first terminal device supports channel switching, acquiring second communication information of the second terminal device; the second communication information includes a second channel list supported by the second terminal device and indication information for indicating whether the second terminal device supports channel switching; In a case where the second channel list includes the identifier of the DFS channel, adding the identifier of the DFS channel to the third channel list; In a case where the indication information indicates that the second terminal device supports channel switching, the working channel of the P2P communication connection is switched from the non-DFS channel to the DFS channel.

12. A terminal device, characterized in that: The terminal device includes a wireless communication chip, a memory and one or more processors; the wireless communication chip, the memory and the processor are coupled; the wireless communication chip is used to establish a point-to-point P2P communication connection, and the memory is used to store computer program code, and the computer program code includes computer instructions; when the processor executes the computer instructions, the terminal device executes the method described in any one of claims 1-9, or the method described in any one of claims 10-11.

13. A storage medium, characterized in that: The method comprises computer instructions, which, when executed on a terminal device, cause the terminal device to execute the method as claimed in any one of claims 1 to 9, or the method as claimed in any one of claims 10 to 11.