A communication method, apparatus, device, program product, and storage medium
By adjusting the device's channel or sharing the peer device's WiFi network, the latency issue caused by channel switching in WiFi P2P connections was resolved, improving the user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HONOR DEVICE CO LTD
- Filing Date
- 2024-08-27
- Publication Date
- 2026-07-03
AI Technical Summary
In WiFi P2P connections, the switching between devices on the same frequency but different channels or between different frequencies and different channels results in significant latency for P2P services, affecting user experience.
By adjusting the device's STA channel and P2P channel to the same channel, or by sharing the WiFi network of the peer device through a P2P connection, the device avoids switching between the same frequency and different channels or different frequencies and different channels, and adopts an adaptive network access method to improve the user experience.
It effectively reduced the latency of P2P services and improved the user experience.
Smart Images

Figure CN120751356B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, and in particular to a communication method, apparatus, device, program product, and storage medium. Background Technology
[0002] WiFi peer-to-peer (WiFi P2P), also known as WiFi Direct, is a WiFi peer-to-peer standard launched by the WiFi Alliance. It typically establishes a WiFi P2P connection on demand when a user initiates a P2P service.
[0003] Currently, after establishing a WiFi P2P connection between two devices, at least one of the devices may access the network using the same frequency but different channels or different frequencies and channels. As a result, the at least one device needs to switch between the WiFi STA mode working channel (STA channel) and the WiFi P2P mode working channel (P2P channel) in a time-division manner. This will affect the P2P services running on the P2P channel, resulting in a large delay and a poor user experience. Summary of the Invention
[0004] This application provides a communication method, apparatus, device, program product, and storage medium, with the aim of solving the problem of large latency in P2P services.
[0005] To achieve the above objectives, this application provides the following technical solution:
[0006] The first aspect of this application provides a communication method. Specifically, a first device receives second WiFi information from a second device based on a first peer-to-peer (P2P) connection; wherein the first P2P connection is a P2P connection between the first device and the second device; then, based on the first WiFi information of the first device and the second WiFi information of the second device, the first device adjusts the STA channel corresponding to the first device and the P2P channel corresponding to the first device to be the same channel, or shares the WiFi network connected to the second device through the P2P connection between the first device and the second device.
[0007] In this method, the first device can obtain the WiFi connection status of the second device based on the P2P connection between the first device and the second device. In this way, the first device can adaptively change its network access method by combining its own WiFi connection status and the WiFi connection status of the other device. This allows the first device to access the network with the same frequency and channel, or to disconnect from the WiFi connection and directly share the WiFi network connected to the second device through the P2P connection. This avoids the first device continuously operating with different channels on the same frequency or different channels, thereby avoiding the problem of large latency in P2P services caused by the need to switch different channels at different times, and thus improving the user experience of P2P services.
[0008] In some possible implementations, the first WiFi information includes a first frequency point, which is the frequency point of the first WiFi network connected to the first device; the second WiFi information includes a second frequency point, which is the frequency point of the second WiFi network connected to the second device. Correspondingly, based on the first and second WiFi information of the first device, adjusting the STA channel and P2P channel corresponding to the first device to be the same channel, or sharing the WiFi network connected to the second device through a P2P connection between the first and second devices, can include: adjusting the STA channel and P2P channel corresponding to the first device to be the same channel based on the first, second, and third frequency points, or sharing the WiFi network connected to the second device through a P2P connection between the first and second devices, where the third frequency point is the frequency point corresponding to the first P2P connection. In this way, the first device can adaptively change its network access method by combining the specific frequency point of its connected WiFi, the specific frequency point of the WiFi network connected to the peer device, and the frequency point corresponding to the P2P connection between the two devices, avoiding the problem of large latency in P2P services.
[0009] In some possible implementations, based on the first frequency point, the second frequency point, and the third frequency point, the STA channel corresponding to the first device and the P2P channel corresponding to the first device are adjusted to be the same channel, or the WiFi network connected to the second device is shared through the P2P connection between the first device and the second device, including: determining that the first device enters the network with the same frequency but different channel based on the first frequency point and the third frequency point; determining that the second device enters the network with the same frequency and the same channel based on the second frequency point and the third frequency point; if there is a third WiFi network with the second frequency point in the connected WiFi list of the first device, the first device is switched to connect to the third WiFi network; if there is no third WiFi network with the second frequency point in the connected WiFi list, the second WiFi network is shared through the first P2P connection.
[0010] In this method, for cases where the first device accesses the network using the same frequency but a different channel, and the second device accesses the network using the same frequency and the same channel, the first device switches from the first WiFi network to the third WiFi network, making the frequency of the WiFi network connected to the first device consistent with the frequency of the WiFi network connected to the second device. This makes the frequency of the WiFi network connected to the first device consistent with the frequency corresponding to the first P2P connection, thereby adjusting the STA channel and P2P channel corresponding to the first device to be the same channel, allowing the first device to work on the same frequency and the same channel, thus avoiding the problem of large latency in P2P services. Alternatively, the first device may directly disconnect from the first WiFi network and share the second WiFi network connected to the second device through the first P2P connection. In this way, the first device is not directly connected to the WiFi network, and it is impossible for it to work on the same frequency but a different channel or different frequency but a different channel, thus avoiding the problem of large latency in P2P services.
[0011] In some possible implementations, if a third WiFi network with the second frequency exists in the connected WiFi list of the first device, the first device is switched to connect to the third WiFi network. This includes: if a third WiFi network with the second frequency exists in the connected WiFi list, and the WiFi quality score of the third WiFi network is greater than a first quality threshold, the first device is switched to connect to the third WiFi network. In this way, WiFi network switching only occurs when the WiFi quality score of the third WiFi network reaches a certain value, ensuring that the switched WiFi network can normally perform P2P services and avoiding any impact on P2P services.
[0012] In some possible implementations, the WiFi quality score of the third WiFi network is used to characterize the signal strength and / or network speed of the third WiFi network. This allows for determining whether to switch WiFi networks based on the signal strength and / or network speed.
[0013] In some possible implementations, if a third WiFi network with the second frequency exists in the connected WiFi list of the first device, the first device is switched to connect to the third WiFi network. This includes: if a third WiFi network with the second frequency exists in the connected WiFi list, and there is no second P2P service with high Quality of Service (QoS) requirements based on the second P2P connection between the first device and the third device, the first device is switched to connect to the third WiFi network, and the second P2P connection becomes a P2P connection between the first device and the third device. This avoids affecting high QoS P2P services running on other P2P connections, ensuring the normal operation of high QoS P2P services.
[0014] In some possible implementations, the first device does not support dual-band dual-concurrent (DBDC). Based on the first, second, and third frequency points, the STA channel and P2P channel corresponding to the first device are adjusted to be the same channel, or the second device shares the WiFi network connected to the second device through a P2P connection. This includes: determining that the first device enters the network with a different frequency and channel based on the first and third frequency points; determining that the second device enters the network with the same frequency and channel based on the second and third frequency points; if a fourth WiFi network with the second frequency point exists in the first device's connected WiFi list, the first device is switched to connect to the fourth WiFi network; if a fourth WiFi network with the second frequency point does not exist in the connected WiFi list, the second WiFi network is shared through a first P2P connection.
[0015] In this method, for situations where the first device accesses the network via a different frequency and channel, and the second device accesses the network via the same frequency and channel, and the first device does not support DBDC, the first device will switch from the first WiFi network to the fourth WiFi network. This ensures that the frequency of the WiFi network connected to the first device is consistent with the frequency of the WiFi network connected to the second device, thereby making the frequency of the WiFi network connected to the first device consistent with the frequency corresponding to the first P2P connection. This adjusts the STA channel and P2P channel corresponding to the first device to be the same channel, allowing the first device to operate on the same frequency and channel, thus avoiding the problem of large latency in P2P services. Alternatively, the first device may directly disconnect from the first WiFi network and share the second WiFi network connected to the second device through the first P2P connection. In this case, the first device is not directly connected to the WiFi network, and it is impossible for it to operate on the same frequency and channel or in a different frequency and channel, thus avoiding the problem of large latency in P2P services.
[0016] In some possible implementations, based on the first frequency point, the second frequency point, and the third frequency point, the STA channel corresponding to the first device and the P2P channel corresponding to the first device are adjusted to be the same channel, including: based on the first frequency point and the third frequency point, determining that the first device enters the network with the same frequency but different channels; based on the third frequency point and the second frequency point, determining that the second device enters the network with the same frequency but different channels; and based on the first frequency point, modifying the first P2P connection to the third P2P connection, the third P2P connection being the P2P connection between the first device and the second device.
[0017] In this method, for the case where the first device and the second device access the network on the same frequency but different channels, if the first device can establish a P2P connection with the WiFi network connected to the first device on the same frequency, the frequency of the WiFi network connected to the first device will be consistent with the frequency of the modified third P2P connection. This will adjust the STA channel and the P2P channel corresponding to the first device to be the same channel, so that the first device can work on the same frequency and the same channel, thereby avoiding the problem of large latency in P2P services.
[0018] In some possible implementations, based on the first frequency point, the second frequency point, and the third frequency point, the STA channel corresponding to the first device and the P2P channel corresponding to the first device are adjusted to be the same channel, including: determining that the first device enters the network with the same frequency but different channels based on the first frequency point and the third frequency point; determining that the second device enters the network with the same frequency but different channels based on the second frequency point and the third frequency point; modifying the first P2P connection to the fourth P2P connection based on the non-dynamic frequency selection (DFS) channel in the connected WiFi list of the first device, and the fourth P2P connection is the P2P connection between the first device and the second device; and switching the first device to connect to the fifth WiFi network based on the fourth frequency point corresponding to the fourth P2P connection.
[0019] In this method, for situations where the first device and the second device access the network on the same frequency but different channels and cannot establish a P2P connection with the first frequency, the first device modifies the P2P connection based on a non-DFS channel in its connected WiFi list. This avoids the situation where the DFS channel is used by radar, preventing the P2P connection from being established on the DFS channel. It also ensures that the first device can switch to a WiFi network with the same frequency as the modified P2P connection, thereby adjusting the STA channel and P2P channel of the first device to be the same channel. This allows the first device to work on the same frequency and channel, thus avoiding the problem of large latency in P2P services.
[0020] In some possible implementations, based on the first frequency point, the second frequency point, and the third frequency point, the STA channel corresponding to the first device and the P2P channel corresponding to the first device are adjusted to be the same channel, or the second device shares the WiFi network connected to the second device through the P2P connection of the first device and the second device, including: determining that the first device enters the network with a different frequency and channel based on the first frequency point and the third frequency point; determining that the second device enters the network with a same frequency and a different channel based on the second frequency point and the third frequency point; modifying the first P2P connection to the fifth P2P connection based on the second frequency point, the fifth P2P connection being the P2P connection between the first device and the second device; if a sixth WiFi network with the second frequency point exists in the connected WiFi list of the first device, switching the first device to connect to the sixth WiFi network; if a sixth WiFi network with the second frequency point does not exist in the connected WiFi list, sharing the second WiFi network through the fifth P2P connection.
[0021] In this method, for situations where the first device connects to the network using a different frequency and channel, and the second device connects to the network using the same frequency but a different channel, the first device can disconnect the first P2P connection and establish a fifth P2P connection with the same frequency as the second P2P connection. In this way, the second device will connect to the network using the same frequency and channel. Based on this, the first device can switch the first WiFi network to a sixth WiFi network with the second frequency, making the frequency of the WiFi network connected to the first device consistent with the frequency corresponding to the fifth P2P connection. This adjusts the STA channel and P2P channel corresponding to the first device to be the same channel, allowing the first device to operate on the same frequency and channel, thus avoiding the problem of significant latency in P2P services. Alternatively, the first device can directly disconnect from the first WiFi network and share the second WiFi network through the fifth P2P connection. In this case, the first device is not directly connected to the WiFi network, and there is no possibility of operating on the same frequency but a different channel or different frequency but a different channel, thus avoiding the problem of significant latency in P2P services.
[0022] In some possible implementations, based on the first frequency point, the second frequency point, and the third frequency point, the STA channel corresponding to the first device and the P2P channel corresponding to the first device are adjusted to be the same channel, including: determining that the first device enters the network with different frequency and different channel based on the first frequency point and the third frequency point; determining that the second device enters the network with the same frequency and different channel based on the second frequency point and the third frequency point; modifying the first P2P connection to the sixth P2P connection based on the non-DFS channel in the connected WiFi list of the first device, and the sixth P2P connection is the P2P connection between the first device and the second device; and switching the first device to connect to the seventh WiFi network based on the fifth frequency point corresponding to the sixth P2P connection.
[0023] In this method, for situations where the first device enters the network using a different frequency and channel, and the second device enters the network using the same frequency but a different channel, and a P2P connection cannot be established with the same frequency as the second device, the first device modifies the P2P connection based on a non-DFS channel in its connected WiFi list. This avoids the situation where the DFS channel is used by radar, preventing the P2P connection from being established on the DFS channel. It also ensures that the first device can switch to WiFi with the same frequency as the modified P2P connection, thereby adjusting the STA channel and P2P channel of the first device to be the same channel, enabling the first device to work with the same frequency and channel, and thus avoiding the problem of large latency in P2P services.
[0024] In some possible implementations, the method further includes: receiving second DBDC information from a second device based on a first P2P connection, the second DBDC information indicating whether the second device supports DBDC; adjusting the STA channel corresponding to the first device and the P2P channel corresponding to the first device to the same channel based on a first frequency, a second frequency, and a third frequency, or sharing the WiFi network connected to the second device through the P2P connection between the first device and the second device, including: determining that the first device accesses the network using an inter-frequency and inter-channel configuration based on the first frequency and the third frequency; determining that the second device accesses the network using an inter-frequency and inter-channel configuration based on the second frequency and the third frequency; and determining that the first device accesses the network using an inter-frequency and inter-channel configuration based on the first DBDC information and the second DBDC information. The backup and second devices do not support DBDC. The first DBDC information is used to indicate whether the first device supports DBDC. The first device is switched to connect to the eighth WiFi network based on the third frequency point to obtain the third WiFi information of the first device. The fourth WiFi information of the second device is received based on the first P2P connection. The fifth WiFi information is the WiFi information of the second device after it is switched to connect to the ninth WiFi network based on the third frequency point. Based on the third WiFi information and the fourth WiFi information, the STA channel and P2P channel corresponding to the first device are adjusted to be the same channel, or the ninth WiFi network is shared through the P2P connection of the first device and the second device.
[0025] In this method, when the first and second devices access the network via different frequencies and channels, and neither device supports DBDC, the first and second devices will attempt to switch to the same WiFi band as the first P2P connection. This may result in the first device accessing the network via the same frequency but different channels, or the second device accessing the network via the same frequency and same channels, or vice versa. Based on this, the WiFi information of both the first and second devices changes. The first device can reacquire the WiFi information of the second device and adaptively change its network access method based on the changed WiFi information of both devices. This allows the first device to work via the same frequency and same channel, or to share the WiFi connection of the second device through the P2P connection between the first and second devices. This avoids the problem of large latency in P2P services.
[0026] In some possible implementations, the method further includes: receiving second DBDC information from a second device based on a first P2P connection, the second DBDC information indicating whether the second device supports DBDC; sharing the WiFi network connected to the second device via a P2P connection based on a first frequency, a second frequency, and a third frequency, including: determining that the first device accesses the network via an inter-frequency and inter-channel based on the first and third frequency; determining that the second device accesses the network via an inter-frequency and inter-channel based on the second and third frequency; determining that the first device does not support DBDC and the second device supports DBDC based on the first and second DBDC information, the first DBDC information indicating whether the first device supports DBDC; and sharing the second WiFi network via the first P2P connection.
[0027] In this method, for the case where the first device and the second device access the network via different frequencies and channels, and the second device supports DBDC, the second device can utilize the resources of two frequency bands simultaneously without changing its operating mode. Therefore, the first device can directly disconnect from the first WiFi network and share the second WiFi network connected to the second device through the first P2P connection. In this way, the first device is not directly connected to the WiFi network, and it is impossible for it to operate at the same frequency but different channels or at different frequencies and channels, thereby avoiding the problem of large latency in P2P services.
[0028] In some possible implementations, before receiving the second WiFi information from the second device, the first device establishes a first P2P connection. If the service requirement corresponding to the first P2P service includes WiFi switching, the first device sends the first WiFi information to the second device based on the first P2P connection. Here, the first P2P service is a P2P service initiated between the first and second devices. In this way, the first device only exchanges WiFi information with the second device and performs WiFi switching operations when there is a WiFi switching requirement for the first P2P service, avoiding WiFi information exchange and WiFi switching operations for every P2P service, thus saving computing resources to some extent. Furthermore, sending the first WiFi information to the second device allows the second device to adaptively change its network access method, enabling it to access the network using the same frequency and channel, further avoiding the problem of significant latency in P2P services.
[0029] In some possible implementations, the first device can send its fifth WiFi information to the second device based on the P2P connection between the first and second devices. This fifth WiFi information represents the WiFi information after the first device adjusts its STA and P2P channels to be the same, or shares the WiFi network the second device is connected to. In this way, the first device sends the changed WiFi information to the peer device, allowing the second device to understand the latest WiFi connection status of the first device. This facilitates adjustments made by the second device in the future, taking into account the WiFi connection status of the first device, should it have P2P connections with other devices.
[0030] In some possible implementations, the first device is in WiFi roaming mode and detects the tenth WiFi network. The method may further include: if the WiFi quality score of the tenth WiFi network is greater than a second quality threshold, switching the first device to connect to the tenth WiFi network, and modifying the first P2P connection to a seventh P2P connection based on the sixth frequency point of the tenth WiFi network; wherein the seventh P2P connection is a P2P connection between the first device and the second device.
[0031] In this method, for WiFi roaming scenarios, the WiFi quality score of the detected WiFi network is first determined. Only when the WiFi quality score of the detected WiFi network is greater than a certain value will the first device switch WiFi networks. This ensures that the switched WiFi network is usable and avoids impacting P2P services. Furthermore, the P2P connection between the first and second devices is modified accordingly, ensuring that the first device still operates on the same frequency and channel, thus avoiding significant latency issues in P2P services.
[0032] A second aspect of this application provides a communication device applied to a first device. The device includes a P2P connection module and a WiFi switching algorithm module. The P2P connection module includes a WiFi information exchange module.
[0033] The WiFi information exchange module is used to receive the second WiFi information of the second device based on the first P2P connection, and send the second WiFi information to the WiFi switching algorithm module. The first P2P connection is the P2P connection between the first device and the second device.
[0034] The WiFi switching algorithm module is used to determine, based on the first WiFi information and the second WiFi information of the first device, to adjust the STA channel and the P2P channel corresponding to the first device to the same channel, or to share the WiFi network connected to the second device through the P2P connection between the first device and the second device.
[0035] In some possible implementations, the communication device may also include: a session management module;
[0036] The session management module is used to determine the business requirements corresponding to the first P2P service.
[0037] The P2P connection module is used to establish the first P2P connection.
[0038] The WiFi information exchange module is also used to send first WiFi information to the second device based on the first P2P connection if the service requirement includes WiFi switching. The first P2P service is a P2P service initiated between the first device and the second device.
[0039] The communication device has the function of implementing the communication method in the first aspect or any possible embodiment of the first aspect. This function can be implemented by hardware or by hardware executing corresponding software, and the hardware or software includes one or more modules corresponding to the above function.
[0040] A third aspect of this application provides a communication system, which includes a first device and a second device;
[0041] The second device is used to send the second WiFi information of the second device to the first device based on the first P2P connection between the first device and the second device.
[0042] The first device is used to receive second WiFi information based on the first P2P connection;
[0043] The first device is configured to adjust the STA channel and the P2P channel corresponding to the first device to the same channel based on the first WiFi information and the second WiFi information of the first device, or to share the WiFi network connected to the second device through the P2P connection of the first device and the second device.
[0044] The communication system has the function of implementing the communication method in the first aspect or any possible implementation of the first aspect.
[0045] A fourth aspect of this application provides a communication device, comprising: a memory and at least one processor. The memory is used to store computer programs or computer instructions, and the at least one processor is used to execute the computer programs or computer instructions stored in the memory, so that the communication device implements the communication method of the first aspect of this application or any optional embodiment of the first aspect.
[0046] The fifth method of this application provides a computer program product, including a computer program, which, when executed, implements the communication method in the first aspect or any optional embodiment of the first aspect of this application.
[0047] The sixth aspect of this application provides a computer storage medium for storing a computer program, which, when executed, implements the communication method of the first aspect or any optional embodiment of the first aspect.
[0048] A seventh aspect of this application provides a chip system including a processor for supporting a device in implementing the functions involved in the foregoing aspects, such as transmitting or processing data and / or information involved in the methods described above. In one possible design, the chip system further includes a memory for storing program instructions and data necessary for the device. The chip system may be composed of chips or may include chips and other discrete devices.
[0049] The eighth aspect of this application provides a chip including one or more interface circuits and one or more processors; the interface circuits are configured to receive signals from the memory of an electronic device and send signals to the processors, the signals including computer instructions stored in the memory; when the processor executes the computer instructions, it causes the electronic device to perform the communication method of the first aspect or any optional embodiment of the first aspect. Attached Figure Description
[0050] Figure 1 This is a schematic diagram illustrating a scenario where a first device accesses the network via a different channel at the same frequency, and a second device accesses the network via the same channel at the same frequency, as provided in an embodiment of this application.
[0051] Figure 2 A flowchart illustrating a communication method provided in an embodiment of this application;
[0052] Figure 3 A flowchart illustrating another communication method provided in an embodiment of this application;
[0053] Figure 4 A schematic diagram illustrating a scenario for changing the network access method of a device, provided as an embodiment of this application;
[0054] Figure 5 This application provides a schematic diagram of a scenario for device connectivity within a trust ring.
[0055] Figure 6 A schematic diagram illustrating another scenario for changing the device's network access method, provided in an embodiment of this application;
[0056] Figure 7 A schematic diagram illustrating yet another scenario for changing the network access method of a device, provided in an embodiment of this application;
[0057] Figure 8 A schematic diagram illustrating yet another scenario for changing the network access method of a device, provided in an embodiment of this application;
[0058] Figure 9 A schematic diagram illustrating yet another scenario for changing the network access method of a device, provided in an embodiment of this application;
[0059] Figure 10 This application provides a schematic diagram illustrating a scenario of changing device connections under channel roaming.
[0060] Figure 11a A flowchart illustrating another communication method provided in an embodiment of this application;
[0061] Figure 11b A flowchart illustrating yet another communication method provided in an embodiment of this application;
[0062] Figure 12 This is a schematic diagram of the structure of a communication device provided in an embodiment of this application;
[0063] Figure 13 This is a schematic diagram of another communication device provided in an embodiment of this application. Detailed Implementation
[0064] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. The terminology used in the following embodiments is for the purpose of describing specific embodiments only and is not intended to be a limitation of this application. As used in the specification and appended claims of this application, the singular expressions "a," "an," "the," "the," "the," and "this" are intended to also include expressions such as "one or more," unless the context clearly indicates otherwise. It should also be understood that in the embodiments of this application, "one or more" refers to one, two, or more; "and / or" describes the relationship between related objects, indicating that three relationships may exist; for example, A and / or B can represent: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship.
[0065] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.
[0066] The "multiple" mentioned in the embodiments of this application refers to two or more. It should be noted that in the description of the embodiments of this application, terms such as "first" and "second" are used only for the purpose of distinguishing descriptions and should not be construed as indicating or implying relative importance, nor should they be construed as indicating or implying order.
[0067] In the embodiments provided in this application, the first device and the second device can be terminals. Terminals can take various forms, such as mobile phones, tablets, computers with wireless transceiver capabilities, virtual reality (VR) terminal devices, augmented reality (AR) terminal devices, wireless terminals in industrial control, vehicle-mounted terminal devices, wireless terminals in self-driving vehicles, wireless terminals in remote medical care, wireless terminals in smart grids, wireless terminals in transportation safety, wireless terminals in smart cities, wireless terminals in smart homes, wearable terminal devices, etc. Terminals may also be referred to as terminal equipment, user equipment (UE), access terminal equipment, vehicle-mounted terminals, industrial control terminals, UE units, UE stations, mobile stations, mobile stations, remote stations, remote terminal equipment, mobile devices, UE terminal equipment, terminal equipment, wireless communication equipment, UE agents, or UE devices, etc. Terminals can also be fixed terminals or mobile terminals.
[0068] To more clearly illustrate the technical solution of this application, the relevant concepts involved in this application are explained below.
[0069] In the field of communications, frequency band refers to the frequency range of electromagnetic waves. Currently, commonly used frequency bands for WiFi networks include 2.4G, 5G, and 6G.
[0070] A channel refers to the path through which signals are transmitted in a communication system, consisting of the transmission medium through which signals travel from the transmitting end to the receiving end. Each frequency band commonly used in WiFi networks is divided into multiple channels. For example, according to the IEEE 802.11 protocol, the 2.4GHz Wi-Fi band is divided into 13 overlapping channels, each with a bandwidth of 22MHz (the bandwidth of each channel in the IEEE 802.11g and IEEE 802.11n standards is 20MHz, and the bandwidth of each channel in the IEEE 802.10B standard is 22MHz); the 5GHz Wi-Fi band is divided into 201 channels.
[0071] DFS (Distributed Frequency Slots) is one of the functions of 5G wireless frequency bands. Originally, DFS channels were reserved for specific radar signals, such as military radar, satellite communication, and weather radar. Currently, in accordance with relevant specifications, these channels are open for use, thus increasing the number of usable wireless channels. When using DFS channels, a Channel Availability Check (CAC) process is required to avoid electromagnetic interference to radar. Domestically, DFS channels may include those with frequencies of 5260MHz, 5280MHz, 5300MHz, and 5320MHz.
[0072] A frequency point refers to a specific frequency assigned to a particular wireless channel in a wireless communication system.
[0073] WiFi P2P is a peer-to-peer (P2P) standard for WiFi introduced by the WiFi Alliance. WiFi P2P connections (or simply P2P connections) are generally created on demand when a user initiates a P2P service. WiFi P2P connections enable high-speed communication in one-to-one or one-to-many scenarios without a local area network (LAN) or access point (AP). It should be noted that the P2P connection in this application embodiment refers specifically to a WiFi P2P connection.
[0074] P2P sharing is a resource sharing method based on P2P connections, which allows two-end devices connected by P2P to directly share resources and services, such as files, computing power, and storage space.
[0075] WiFi STA mode refers to the mode in which electronic devices connect to a wireless access point (AP) to access the Internet.
[0076] WiFi P2P mode refers to a mode in which electronic devices establish a direct connection channel through WiFi P2P connection.
[0077] Same frequency and same channel refers to electronic devices operating in WiFi STA mode and WiFi P2P mode on the same frequency band and the same channel.
[0078] Same frequency, different channels: This refers to electronic devices operating in WiFi STA mode and WiFi P2P mode on the same frequency band but on different channels. The electronic device needs to switch between the working channel of WiFi STA mode (STA channel) and the working channel of WiFi P2P mode (P2P channel) in a time-division multiplexing manner. For example, if the time division is 100ms / 100ms and the switching time is 20ms, it means that after the electronic device operates on the STA channel for 100ms, it will switch to the P2P channel, and the switching process will take 20ms. After operating on the P2P channel for 100ms, it will switch back to the STA channel.
[0079] Inter-frequency and inter-channel refers to electronic devices operating in WiFi STA mode and WiFi P2P mode on different frequency bands and channels. If the electronic device does not support DBDC, it needs to switch between STA channel and P2P channel in a time-division manner.
[0080] DBDC: This refers to the ability of an electronic device to operate on two channels in different frequency bands simultaneously. For example, a device can operate simultaneously on a 2.4GHz STA channel and a 5GHz P2P channel. Operating modes other than DBDC do not support simultaneous operation of two channels. For example, dual-band single concurrent (DBSC), dual-band adaptive concurrent (DBAC), and same-frequency, same-channel operating modes all only support time-division multiplexing of the two channels.
[0081] Please see Figure 1 This is a schematic diagram illustrating a scenario where a first device accesses the network via a different channel at the same frequency, and a second device accesses the network via the same channel at the same frequency, as disclosed in an embodiment of this application. Figure 1 A mobile phone connects to WiFi 1 on a frequency of 5200MHz, and a tablet connects to WiFi 2 on a frequency of 5180MHz. After establishing a P2P connection on the 5180MHz frequency, the mobile phone accesses the network using the same frequency but a different channel, while the tablet accesses the network using the same frequency and channel. Subsequently, the mobile phone will operate in WiFi STA mode on the 5200MHz channel and WiFi P2P mode on the 5180MHz channel at different times. In other words, the mobile phone will work on the same frequency but different channels. As a result, the P2P service conducted through the P2P channel will be interrupted at regular intervals, resulting in a large latency in the P2P service and a poor user experience.
[0082] To this end, embodiments of this application provide a communication method, apparatus, device, program product, and storage medium. The device can adaptively change its network access method based on its own WiFi network connection status and the WiFi network connection status of the peer device, so that the device can work on the same frequency and channel, or share the WiFi network connected to the peer device through P2P connection, thus avoiding the problem of large latency in P2P services.
[0083] Please see Figure 2 , Figure 2 This is a flowchart illustrating a communication method provided for implementation of this application. The method can be executed by a communication system, which may include a first device and a second device. The communication method provided in this application embodiment may include:
[0084] S201, The second device sends second WiFi information to the first device based on the first P2P connection.
[0085] The first P2P connection is a P2P connection between the first device and the second device.
[0086] In this embodiment of the application, after establishing a first P2P connection between the first device and the second device, the first device will send its first WiFi information to the second device based on the first P2P connection, and the second device will send its second WiFi information to the first device based on the first P2P connection.
[0087] The WiFi information may include: the frequency and WiFi quality score of the WiFi network to which the device is connected. The WiFi quality score may include signal strength and network speed, and the signal strength may include a Received Signal Strength Indicator (RSSI). Correspondingly, the first WiFi information may include: a first frequency and a first WiFi quality score, which may include a first signal strength and a first network speed; the second WiFi information may include: a second frequency and a second WiFi quality score, which may include a second signal strength and a second network speed.
[0088] S202, The first device receives second WiFi information based on the first P2P connection.
[0089] In this embodiment of the application, after the first device sends the first WiFi information, the second device receives the first WiFi information based on the first P2P connection. After the second device sends the second WiFi information, the first device receives the second WiFi information based on the first P2P connection, thus realizing the exchange of WiFi information between the two ends.
[0090] S203. Based on the first WiFi information and the second WiFi information, the first device adjusts the STA channel corresponding to the first device and the P2P channel corresponding to the first device to be the same channel, or shares the WiFi network connected to the second device through the P2P connection between the first device and the second device.
[0091] In this embodiment, the first device can adjust the STA channel and the P2P channel corresponding to the first device to be the same channel by switching the WiFi network connected to the first device or modifying the P2P connection between the first device and the second device based on the WiFi information of both ends; or, the first device can also share the WiFi network connected to the second device by the first P2P connection or the modified P2P connection based on the WiFi information of both ends.
[0092] As can be seen, in this embodiment of the application, the first device can obtain the WiFi network connection status of the second device based on the P2P connection between the first device and the second device. In this way, the first device can adaptively change its network access method by combining its own WiFi network connection status and the WiFi network connection status of the other device, so that the first device can work on the same frequency and channel, or disconnect the first device from the WiFi network and directly share the WiFi network connected to the second device through the P2P connection. This can avoid the first device continuously working on the same frequency and different channels or different frequencies and different channels, thereby avoiding the problem of large latency in P2P services caused by the need to switch different channels in a time-sharing manner, and thus improving the user experience of P2P services.
[0093] Please see Figure 3 , Figure 3 This is a flowchart illustrating another communication method provided for implementation of this application. This method can be executed by a communication system, which may include a first device and a second device. The communication method provided in this application embodiment may include:
[0094] S301, The first device determines the business requirements corresponding to the first P2P service.
[0095] The first P2P service refers to the P2P service initiated between the first and second devices. P2P services can be divided into two categories, commonly referred to as: high QoS requirement P2P services and low QoS requirement P2P services. High QoS requirements refer to strict standards for service quality in network communication, including ensuring sufficient transmission bandwidth, low latency, and low packet loss rate, to ensure that critical applications receive priority service in the network, thereby improving the overall service quality of network communication. Low QoS requirements are relatively relaxed; under conditions of limited network resources or specific application scenarios, the service quality requirements are not high, allowing for a certain degree of latency and packet loss.
[0096] Service requirements can include WiFi switching, stopping scanning, and prioritizing transmission, etc. Generally, P2P services with high QoS requirements will include WiFi switching. P2P services with high QoS requirements include screen mirroring, audio sharing, etc., while P2P services with low QoS requirements include background messaging, etc.
[0097] S302, The first device establishes the first P2P connection.
[0098] The first P2P connection is a P2P connection between the first device and the second device.
[0099] S303. If the service requirement includes WiFi switching, the first device sends the first WiFi information to the second device based on the first P2P connection.
[0100] In this embodiment, the first device only exchanges WiFi information with the second device and performs WiFi switching operations when the first P2P service requires WiFi switching. This avoids performing WiFi information exchange and WiFi switching operations for every P2P service, thus saving computing resources to some extent. Moreover, sending the first WiFi information to the second device allows the second device to adaptively change its network access method, enabling it to access the network using the same frequency and channel, further avoiding the problem of large latency in P2P services.
[0101] In one possible implementation, in this embodiment of the application, the first device can send first WiFi information and first DBDC support information to the second device based on the first P2P connection. The first DBDC information is used to indicate whether the first device supports DBDC.
[0102] S304. The second device receives the first WiFi information based on the first P2P connection.
[0103] S305, The second device sends second WiFi information to the first device based on the first P2P connection.
[0104] It should be noted that in this embodiment, the second device sends the second WiFi information to the first device after receiving the first WiFi information. In this embodiment, if the service requirement corresponding to the first P2P service does not include WiFi switching, after establishing the first P2P connection, the first device will directly perform the first P2P service based on the first P2P connection. That is, after establishing the first P2P connection, the first device will not send the first WiFi information nor receive the second WiFi information, and the second device will not send the second WiFi information nor receive the first WiFi information.
[0105] The first WiFi information includes a first frequency point, which is the frequency point of the first WiFi network connected to the first device. The second WiFi information includes a second frequency point, which is the frequency point of the second WiFi network connected to the second device. It is understood that the first WiFi information and the second WiFi information are the same as those in the above embodiments; the identical parts will not be repeated here.
[0106] In one possible implementation, in this embodiment of the application, the second device can send second WiFi information and second DBDC support information to the first device based on the first P2P connection. The second DBDC information is used to indicate whether the second device supports DBDC.
[0107] S306. The first device receives second WiFi information based on the first P2P connection.
[0108] S307. The first device adjusts the STA channel and P2P channel corresponding to the first device to the same channel based on the first frequency point, the second frequency point and the third frequency point, or shares the WiFi network connected to the second device through the P2P connection between the first device and the second device.
[0109] The third frequency point is the frequency point corresponding to the first P2P connection.
[0110] In one possible implementation, the first device in this application embodiment may adjust the STA channel corresponding to the first device and the P2P channel corresponding to the first device to be the same channel based on the first frequency point, the second frequency point, the third frequency point, the first DBDC support information and the second DBDC information, or share the WiFi network connected to the second device through the P2P connection between the first device and the second device.
[0111] In this embodiment, the first device can adjust the STA channel and the P2P channel corresponding to the first device to be the same channel by switching the WiFi network connected to the first device or modifying the P2P connection between the first device and the second device, based on the specific frequency point of the WiFi network connected to both ends; or, the first device can also share the WiFi network connected to the second device by the first P2P connection or the modified P2P connection, based on the specific frequency point of the WiFi network connected to both ends.
[0112] S308. The second device adjusts the STA channel corresponding to the second device and the P2P channel corresponding to the second device to the same channel based on the first frequency point, the second frequency point and the third frequency point, or maintains the existing network access method.
[0113] In this embodiment, the second device can adjust the STA channel and P2P channel corresponding to the second device to be the same channel by switching the WiFi network to which the second device is connected, based on the specific frequency of the WiFi network connected to both ends; or, the second device can determine whether it is accessing the network with the same frequency and channel or with different frequency and channel and supports DBDC based on the specific frequency of the WiFi network connected to both ends, and the second device can maintain the existing access method.
[0114] In one possible implementation, the second device in this application embodiment may adjust the STA channel corresponding to the second device and the P2P channel corresponding to the second device to be the same channel based on the first frequency point, the second frequency point, the first DBDC support information and the second DBDC information, or maintain the existing network access method.
[0115] S309. The first device sends the fifth WiFi information of the first device to the second device based on the P2P connection between the first device and the second device.
[0116] The fifth WiFi information is the WiFi information corresponding to the first device after adjusting the STA channel and P2P channel to the same channel, or sharing the WiFi network connected to the second device, that is, the WiFi information corresponding to the first device after changing the network access method. The third WiFi information may include the third frequency point and the third network speed, etc.
[0117] In this embodiment, the first device sends its updated WiFi information to the peer device, allowing the second device to understand the latest WiFi network connection status of the first device. This facilitates adjustments made by the second device in conjunction with the WiFi network connection status of the first device should a P2P connection exist with other devices in the future. Similarly, if the WiFi information of the second device changes, the second device will also send the updated WiFi information to the first device.
[0118] As can be seen, in the embodiments of this application, the first device and the second device can adaptively change their network access methods by combining the service requirements corresponding to the P2P service, the specific frequency of the WiFi network they are connected to, and the specific frequency of the WiFi network connected to the peer device, so as to avoid the problem of large latency in P2P services with high QoS requirements.
[0119] Please see Figure 4This is a schematic diagram illustrating a scenario of changing the network access method of a device, as disclosed in an embodiment of this application. This embodiment uses a mobile phone as the first device and a tablet computer as the second device for illustration. In the left half of the diagram, the mobile phone connects to a 5785MHz WiFi network, and the tablet computer connects to a 5180MHz WiFi network. The mobile phone and tablet computer establish a P2P connection at 5180MHz. Both 5785MHz and 5180MHz are frequencies within the 5G band. Thus, the mobile phone accesses the network using the same frequency but a different channel, while the tablet computer accesses the network using the same frequency and channel. In the right half of the diagram, the mobile phone switches its connection to the 5180MHz WiFi network, or shares the WiFi network connected to the tablet computer via a 5180MHz P2P connection; the tablet computer maintains its existing network access method. It is understood that... Figure 4 This is merely an illustrative example and should not be construed as limiting the embodiments of this application. Accordingly, in scenarios where the first device accesses the network via the same frequency but different channels, and the second device accesses the network via the same frequency and same channel, the communication method provided in the embodiments of this application may include:
[0120] S401. Based on the first frequency point and the third frequency point, the first device determines that the first device will enter the network via the same frequency but different channels.
[0121] S402. The first device determines that the second device will enter the network on the same frequency and channel based on the second and third frequency points.
[0122] Wherein, the first frequency point is the frequency point of the first WiFi network connected to the first device, the second frequency point is the frequency point of the second WiFi network connected to the second device, the third frequency point is the frequency point corresponding to the first P2P connection, and the first P2P connection is the P2P connection between the current first device and the second device.
[0123] It is understood that after the first device in this application embodiment determines the network access method of the dual-end device, it can perform corresponding operations according to different network access methods.
[0124] S403. If a third WiFi network with the second frequency exists in the connected WiFi list of the first device, the first device will switch to connect to the third WiFi network.
[0125] It should be noted that the third WiFi network may be the same WiFi network as the second WiFi network, or it may not be the same WiFi network as the second WiFi network, but they may share the same frequency.
[0126] The connected WiFi list refers to the collection of WiFi networks that the device has currently connected to or has previously connected to. This list typically displays the name of each WiFi network, and may sometimes display other information, such as signal strength or security type. In this embodiment, the connected WiFi list of the first device may include first WiFi information.
[0127] In one possible implementation, step S403 in this embodiment may include: if a third WiFi network with a second frequency exists in the connected WiFi list, and the WiFi quality score of the third WiFi network is greater than a first quality threshold, then the first device is switched to connect to the third WiFi network. The first quality threshold can be set according to actual conditions, and this embodiment does not impose any restrictions on it, but it must be ensured that the WiFi network can function normally when its WiFi quality score is greater than the first quality threshold. This ensures that the WiFi network is switched only when the WiFi quality score of the third WiFi network reaches a certain value, guaranteeing that the switched WiFi network can normally perform P2P services and avoiding any impact on P2P services.
[0128] Please see Figure 5 This is a schematic diagram illustrating a scenario of device connection within a trust ring as disclosed in an embodiment of this application. This embodiment uses a first device as an example. Figure 5 The middle phone, the second device is Figure 5 The tablet on the left, the third device is Figure 5 Taking the mobile phone on the right as an example, the trust ring contains a first device, a second device, and a third device. The first and third devices are currently performing a high-QoS P2P service. Switching the WiFi network connected to the first, second, or third device could potentially affect this high-QoS P2P service. Therefore, in one possible implementation, step S403 in this embodiment may include: if a third WiFi network with a second frequency exists in the connected WiFi list, and there is no high-QoS second P2P service between the first and third devices based on a second P2P connection, then the first device is switched to connect to the third WiFi network. Here, the second P2P connection is the P2P connection between the first and third devices. This avoids affecting high-QoS P2P services running on other P2P connections, ensuring the normal operation of high-QoS P2P services.
[0129] S404. If there is no third WiFi network with the second frequency point in the connected WiFi list, the first device shares the second WiFi network through the first P2P connection.
[0130] S405. The second device determines that the first device enters the network via the same frequency but different channels based on the first frequency and the third frequency.
[0131] S406. Based on the second frequency point and the third frequency point, the second device determines that the second device will enter the network with the same frequency and the same channel.
[0132] It is understood that after the second device in this application embodiment determines the network access method of the dual-end device, it can perform corresponding operations according to different network access methods.
[0133] S407, The second device determines that the second device will maintain its existing network access method.
[0134] It should be noted that if the second device determines that it is accessing the network using the same frequency and channel, while the peer device is accessing the network using the same frequency but different channels, it can determine that its existing access method will not affect the P2P service, and it does not need to change its existing access method and will continue to maintain its existing access method.
[0135] As can be seen, in the embodiments of this application, for the cases where the first device accesses the network using the same frequency but different channels, and the second device accesses the network using the same frequency and same channel, the first device will switch the first WiFi network to the third WiFi network, so that the frequency of the WiFi network connected to the first device is consistent with the frequency of the WiFi network connected to the second device. This makes the frequency of the WiFi network connected to the first device consistent with the frequency corresponding to the first P2P connection, thereby adjusting the STA channel and P2P channel corresponding to the first device to be the same channel, so that the first device can work with the same frequency and same channel, thus avoiding the problem of large latency in P2P services. Alternatively, the first device will directly disconnect from the first WiFi network and share the second WiFi network connected to the second device through the first P2P connection. In this way, the first device is not directly connected to the WiFi network, and it is impossible for it to work with the same frequency but different channels or different frequencies and different channels, thus avoiding the problem of large latency in P2P services.
[0136] Please see Figure 6This is a schematic diagram illustrating another scenario of changing the device's network access method disclosed in this application embodiment. This application embodiment uses a mobile phone as the first device and a tablet computer as the second device for illustration. In the left half of the diagram, the mobile phone connects to a WiFi network with a frequency of 2417MHz, and the tablet computer connects to a WiFi network with a frequency of 5180MHz. The mobile phone and tablet computer establish a P2P connection with a frequency of 5180MHz. 5180MHz is a 5G frequency band, and 2417MHz is a 2.4G frequency band. Thus, the mobile phone accesses the network using a different frequency and channel, while the tablet computer accesses the network using the same frequency and channel. In the right half of the diagram, if the mobile phone does not support DBDC, the mobile phone switches to connect to a WiFi network with a frequency of 5180MHz, or shares the WiFi network connected to the tablet computer via a P2P connection with a frequency of 5180MHz; the tablet computer maintains its existing network access method. It is understood that the above is merely an illustrative description and should not be construed as a limitation on the embodiments of this application. Accordingly, in scenarios where the first device accesses the network using a different frequency and channel, and the second device accesses the network using the same frequency and channel, the communication method provided in this application embodiment may include:
[0137] S601. The first device determines that it will access the network via a different frequency and a different channel based on the first frequency and the third frequency.
[0138] In this embodiment, it can also be determined that the first device does not support DBDC based on the first DBDC information. Then, the first device, considering both the network access methods at both ends and its own DBDC support, performs the corresponding operation.
[0139] S602. The first device determines that the second device will enter the network on the same frequency and channel based on the second and third frequency points.
[0140] It is understood that the first frequency point, the second frequency point, and the third frequency point in the embodiments of this application are the same as the first frequency point, the second frequency point, and the third frequency point in the above embodiments, so they will not be described again.
[0141] S603. If a fourth WiFi network with the second frequency exists in the connected WiFi list of the first device, the first device will switch to connect to the fourth WiFi network.
[0142] It is understood that S603 in this embodiment is similar to S403 in the above embodiment, so it will not be described again.
[0143] S604. If there is no fourth WiFi network with the second frequency point in the connected WiFi list, the first device shares the second WiFi network through the first P2P connection.
[0144] It is understood that S604 in this embodiment is similar to S404 in the above embodiment, so it will not be described again.
[0145] S605. The second device determines that the first device enters the network via the same frequency but different channels based on the first frequency and the third frequency.
[0146] S606. Based on the second frequency point and the third frequency point, the second device determines that the second device will enter the network with the same frequency and the same channel.
[0147] S607, The second device determines that the second device will maintain its existing network access method.
[0148] It should be noted that in scenarios where the first device accesses the network using a different frequency and channel, and the second device accesses the network using the same frequency and channel, if the first device supports DBDC, the first device can utilize the resources of both the 5G and 2.4G frequency bands simultaneously. In this way, neither the first nor the second device needs to change its network access method and can continue to maintain its existing network access method.
[0149] As can be seen, in the embodiments of this application, for the case where the first device accesses the network using a different frequency and channel, and the second device accesses the network using the same frequency and channel, and the first device does not support DBDC, the first device will switch the first WiFi network to the fourth WiFi network, so that the frequency of the WiFi network connected to the first device is consistent with the frequency of the WiFi network connected to the second device. This makes the frequency of the WiFi network connected to the first device consistent with the frequency corresponding to the first P2P connection, thereby adjusting the STA channel and P2P channel corresponding to the first device to be the same channel, so that the first device can work in the same frequency and channel, thus avoiding the problem of large latency in P2P services; or, the first device will directly disconnect from the first WiFi and share the second WiFi network connected to the second device through the first P2P connection. In this way, the first device is not directly connected to the WiFi network, and it is impossible for it to work in the same frequency and channel or in a different frequency and channel, thus avoiding the problem of large latency in P2P services.
[0150] Please see Figure 7This is a schematic diagram illustrating another scenario of changing the operating mode of a device disclosed in this application. This application uses a mobile phone as the first device and a tablet computer as the second device for illustration. In the left half of the diagram, the mobile phone connects to a 5280MHz WiFi network, and the tablet computer connects to a 5280MHz WiFi network. The STA channel corresponding to the mobile phone and tablet computer is the DFS channel. The mobile phone and tablet computer establish a P2P connection at a frequency of 5180MHz. 5180MHz and 5280MHz are frequencies in the 5G band. Thus, both the mobile phone and tablet computer access the network using the same frequency but different channels. The right half of the diagram modifies the P2P connection between the mobile phone and tablet. Specifically, it disconnects the original 5180MHz P2P connection and establishes a P2P connection on the 5280MHz DFS channel. If other limitations prevent the establishment of a 5280MHz P2P connection, such as a radar using the DFS channel, the mobile phone, based on its connected WiFi list, determines a non-DFS channel in the list, disconnects the original 5180MHz P2P connection, and establishes a P2P connection on a non-DFS channel at 5785MHz. The mobile phone and tablet then switch to the 5780MHz WiFi network. It is understood that the above is merely illustrative and should not be construed as a limitation of the embodiments of this application. Accordingly, in scenarios where the first and second devices access the network using the same frequency but different channels, the embodiments of this application provide two communication methods.
[0151] The first communication method may include:
[0152] S701a. The first device determines that it will enter the network via the same frequency but different channels based on the first frequency point and the third frequency point.
[0153] S702a: The first device determines that the second device will enter the network via the same frequency but different channels based on the second and third frequency points.
[0154] It is understood that the first frequency point, the second frequency point, and the third frequency point in the embodiments of this application are the same as the first frequency point, the second frequency point, and the third frequency point in the above embodiments, so they will not be described again.
[0155] S703a, The first device modifies the first P2P connection to the third P2P connection based on the first frequency point.
[0156] The third P2P connection is a P2P connection between the first and second devices, and the frequency point corresponding to the third P2P connection is the same as that of the first P2P connection. Changing the first P2P connection to the third P2P connection can be understood as disconnecting the first P2P connection and establishing the third P2P connection.
[0157] S704a, the second device determines that the first device enters the network via a different channel at the same frequency based on the first frequency and the third frequency.
[0158] S705a: The second device determines that it will access the network via the same frequency but different channels based on the second and third frequency points.
[0159] S706a. If the first frequency point and the second frequency point are the same, the second device determines to maintain the existing WiFi network connection method.
[0160] S707a. If the first frequency point and the second frequency point are different, and the second device has an eleventh WiFi network with the first frequency point in its connected WiFi list, the second device switches to connect to the eleventh WiFi network.
[0161] S708a. If the first frequency point and the second frequency point are not the same, and the second device does not have an eleventh WiFi network with the first frequency point in its connected WiFi list, the second device shares the first WiFi network through a third P2P connection.
[0162] As can be seen, in the method of this application embodiment, for the case where the first device and the second device access the network on the same frequency but different channels, if the first device can establish a P2P connection with the WiFi network connected to the first device on the same frequency, the frequency of the WiFi network connected to the first device can be made consistent with the frequency of the modified third P2P connection. This achieves the adjustment of the STA channel corresponding to the first device and the P2P channel corresponding to the first device to be the same channel. In this way, the first device can work on the same frequency and the same channel. The second device can also combine the specific frequency points of both ends and the frequency points corresponding to the P2P connection to adjust the STA channel corresponding to the second device and the P2P channel corresponding to the second device to be the same channel, or share the first WiFi network through P2P, thereby avoiding the problem of large latency in P2P services.
[0163] The second communication method may include:
[0164] S701b: The first device determines that it will enter the network via the same frequency but different channels based on the first frequency and the third frequency.
[0165] S702b: The first device determines that the second device will enter the network via the same frequency but different channels based on the second and third frequency points.
[0166] It is understood that the first frequency point, the second frequency point, and the third frequency point in the embodiments of this application are the same as the first frequency point, the second frequency point, and the third frequency point in the above embodiments, so they will not be described again.
[0167] S703b: The first device modifies the first P2P connection to the fourth P2P connection based on the non-DFS channel in the first device's connected WiFi list.
[0168] The fourth P2P connection is a P2P connection between the first and second devices, and its frequency is the same as that of the non-DFS channel. Changing the first P2P connection to the fourth P2P connection can be understood as disconnecting the first P2P connection and establishing the fourth P2P connection.
[0169] It should be noted that if the STA channel of the first device is the DFS channel, and the current DFS channel is being used by the radar, a P2P connection with the same frequency as the first frequency point cannot be established. Therefore, a non-DFS channel will be selected to establish a P2P connection.
[0170] S704b: The first device switches to connect to the fifth WiFi network based on the fourth frequency point corresponding to the fourth P2P connection.
[0171] The fifth WiFi network uses the same frequency as the fourth WiFi network.
[0172] S705b: The first device sends its sixth WiFi information to the second device based on the fourth P2P connection.
[0173] Among them, the sixth WiFi information is the WiFi information corresponding to the first device after it changes its network access method, that is, the WiFi information of the fifth WiFi network.
[0174] S706b: The second device determines that the first device enters the network via the same frequency but different channels based on the first frequency and the third frequency.
[0175] S707b: The second device determines that it will access the network via the same frequency but different channels based on the second and third frequency points.
[0176] S708b: The second device switches to connect to the twelfth WiFi network based on the fourth frequency point corresponding to the fourth P2P connection, or shares the fifth WiFi network through the fourth P2P connection.
[0177] It should be noted that if the second device has a WiFi network with the fourth frequency in its connected WiFi list, the second device will switch to connect to that WiFi network, that is, switch to connect to the twelfth WiFi network; if the second device does not have a WiFi network with the fourth frequency in its connected WiFi list, the second device will share the fifth WiFi network connected to the first device through the fourth P2P connection.
[0178] The twelfth WiFi network and the fifth WiFi network can be the same WiFi network or different WiFi networks, but they share the same frequency.
[0179] As can be seen, in this application, when the first device and the second device access the network using the same frequency but different channels, the first device modifies the P2P connection based on the non-DFS channel in the first device's connected WiFi list. This avoids the situation where the DFS channel is used by radar, and the P2P connection may not be established on the DFS channel. It also ensures that the first device can switch to connect to the WiFi network with the same frequency as the modified P2P connection, thereby adjusting the STA channel and P2P channel of the first device to be the same channel, so that the first device can work with the same frequency and channel. The second device can also adjust the STA channel and P2P channel of the second device to be the same channel by combining the specific frequency points of both ends and the frequency point corresponding to the P2P connection, or share the first WiFi network through P2P, thereby avoiding the problem of large latency in P2P services.
[0180] Please see Figure 8 This is a schematic diagram illustrating another scenario of changing the device's network access method disclosed in this application. This application uses a mobile phone as the first device and a tablet computer as the second device for illustration. In the left half of the diagram, the mobile phone connects to a 2417MHz WiFi network, and the tablet computer connects to a 5280MHz WiFi network. The mobile phone and tablet computer establish a P2P connection at a frequency of 5785MHz. 5280MHz and 5785MHz are frequencies in the 5G band, and 2417MHz is a frequency in the 2.4G band. Thus, the mobile phone accesses the network using a different frequency and channel, while the tablet computer accesses the network using the same frequency but a different channel. In the right half of the diagram, if a P2P connection at a frequency of 5280MHz can be established, the scenario degenerates into the mobile phone accessing the network using a different frequency and channel, and the tablet computer accessing the network using the same frequency and channel. The subsequent processing is the same as... Figure 6 Similarly, this will not be repeated here; if a P2P connection at 5280MHz cannot be established, the mobile phone and tablet, based on the phone's connected WiFi list, determine the non-DFS channel in the connected WiFi list, disconnect the original P2P connection at 5785MHz, and establish a P2P connection on the non-DFS channel at 5180MHz. The mobile phone and tablet then switch to connect to the WiFi network at 5180MHz. It should be understood that the above is merely an illustrative description and should not be construed as a limitation on the embodiments of this application. Accordingly, in scenarios where the first device accesses the network using a different frequency and channel, and the second device accesses the network using the same frequency but a different channel, the embodiments of this application provide two communication methods.
[0181] The first communication method includes:
[0182] S801a. The first device determines that it will access the network via a different frequency and a different channel based on the first frequency and the third frequency.
[0183] S802a: The first device determines that the second device will enter the network via the same frequency but different channels based on the second and third frequency points.
[0184] It is understood that the first frequency point, the second frequency point, and the third frequency point in the embodiments of this application are the same as the first frequency point, the second frequency point, and the third frequency point in the above embodiments, so they will not be described again.
[0185] S803a: The first device modifies the first P2P connection to the fifth P2P connection based on the second frequency point.
[0186] The fifth P2P connection is a P2P connection between the first and second devices, and its frequency is the same as the second frequency. Changing the first P2P connection to the fifth P2P connection can be understood as disconnecting the first P2P connection and establishing the fifth P2P connection.
[0187] It should be noted that since the P2P connection between the first and second devices is modified, the WiFi connection between the first and second devices is not modified. Therefore, the first and second devices will not exchange WiFi information again. However, after the first and second devices establish the fifth P2P connection, it can be determined that the first device is accessing the network with a different frequency and channel, and the second device is accessing the network with the same frequency and channel.
[0188] S804a. If a sixth WiFi network with the second frequency exists in the connected WiFi list of the first device, the first device will switch to connect to the sixth WiFi network.
[0189] It is understood that S804a in this embodiment is similar to S403 in the above embodiment, so it will not be described again.
[0190] S805a: If the sixth WiFi network with the second frequency point does not exist in the connected WiFi list, the first device shares the second WiFi network through the fifth P2P connection.
[0191] It is understood that S805a in this embodiment is similar to S404 in the above embodiment, so it will not be described again.
[0192] S806a, the second device determines that the first device enters the network via a different frequency and channel based on the first frequency and the third frequency.
[0193] S807a: The second device determines that it will access the network via the same frequency but different channels based on the second and third frequency points.
[0194] S808a, the second device determines to maintain the existing WiFi network connection method based on the second frequency point, the third frequency point and the frequency point corresponding to the fifth P2P connection.
[0195] As can be seen, in this embodiment of the application, when the first device accesses the network using a different frequency and channel, and the second device accesses the network using the same frequency but a different channel, the first device can disconnect the first P2P connection and establish a fifth P2P connection with the same frequency as the second frequency. In this way, the second device will access the network using the same frequency and channel. Based on this, the first device can switch the first WiFi network to a sixth WiFi network with the second frequency, so that the frequency of the WiFi network connected to the first device is consistent with the frequency corresponding to the fifth P2P connection. This allows the first device to operate using the same frequency and channel, thereby avoiding the problem of significant latency in P2P services. Alternatively, the first device can directly disconnect from the first WiFi network and share the second WiFi network through the fifth P2P connection. In this way, the first device is not directly connected to the WiFi network, and there is no possibility of operating with the same frequency but a different channel or with different frequencies and channels, thus avoiding the problem of significant latency in P2P services.
[0196] The second communication method includes:
[0197] S801b: The first device determines that it will access the network via a different frequency and channel based on the first frequency and the third frequency.
[0198] S802b: The first device determines that the second device will enter the network via the same frequency but different channels based on the second and third frequency points.
[0199] It is understood that the first frequency point, the second frequency point, and the third frequency point in the embodiments of this application are the same as the first frequency point, the second frequency point, and the third frequency point in the above embodiments, so they will not be described again.
[0200] S803b: The first device modifies the first P2P connection to the sixth P2P connection based on the non-DFS channel in the first device's connected WiFi list.
[0201] The sixth P2P connection is a P2P connection between the first and second devices, and its frequency is the same as that of the non-DFS channel. Changing the first P2P connection to the sixth P2P connection can be understood as disconnecting the first P2P connection and establishing the sixth P2P connection.
[0202] S804b: The first device switches to connect to the seventh WiFi network based on the fifth frequency point corresponding to the sixth P2P connection.
[0203] The seventh WiFi uses the same frequency as the fifth WiFi.
[0204] S805b: The first device sends its seventh WiFi information to the second device based on the sixth P2P connection.
[0205] Among them, the seventh WiFi information is the WiFi information corresponding to the first device after it changes its network access method, that is, the WiFi information of the seventh WiFi network.
[0206] S806b: The second device determines that the first device will access the network via a different frequency and channel based on the first frequency and the third frequency.
[0207] S807b: The second device determines that it will access the network via the same frequency but different channels based on the second and third frequency points.
[0208] S808b: The second device switches to connect to the thirteenth WiFi network based on the fifth frequency point corresponding to the sixth P2P connection, or shares the seventh WiFi network through the fifth P2P connection.
[0209] It should be noted that if the second device has a WiFi network with the fifth frequency in its connected WiFi list, the second device will switch to connect to that WiFi network, i.e., switch to connect to the thirteenth WiFi network; if the WiFi network with the fifth frequency does not exist in the connected WiFi list, the second device will share the seventh WiFi network connected to the first device through the fifth P2P connection.
[0210] The thirteenth WiFi network and the seventh WiFi network can be the same WiFi network or different WiFi networks, but they share the same frequency.
[0211] As can be seen, in this embodiment of the application, for the cases where the first device enters the network using a different frequency and channel, and the second device enters the network using a different channel at the same frequency, and a P2P connection with the same frequency as the second device cannot be established, the first device modifies the P2P connection based on a non-DFS channel in the first device's connected WiFi list. This avoids the situation where the DFS channel is used by radar, and the P2P connection may not be established on the DFS channel. It also ensures that the first device can switch to connect to a WiFi network with the same frequency as the modified P2P connection, thereby adjusting the STA channel and P2P channel of the first device to be the same channel, so that the first device can work with the same frequency and channel. The second device can also adjust the STA channel and P2P channel of the second device to be the same channel by combining the specific frequency of both ends and the frequency of the P2P connection, or share the first WiFi network through P2P, thereby avoiding the problem of large latency in P2P services.
[0212] Please see Figure 9This is a schematic diagram illustrating another scenario of changing the device's network access method disclosed in this application. This application uses a mobile phone as the first device and a tablet computer as the second device for illustration. In the left half of the diagram, the mobile phone connects to a 2417MHz WiFi network, and the tablet computer connects to a 2417MHz WiFi network. The mobile phone and tablet computer establish a P2P connection at a frequency of 5180MHz. 5180MHz is the frequency of the 5G band, and 2417MHz is the frequency of the 2.4G band. Thus, the mobile phone and tablet computer access the network using different frequencies and channels. In the right half of the diagram, if neither the first nor the second device supports DBDC, the mobile phone and tablet computer will attempt to switch to the WiFi network corresponding to the 5G band, which will degenerate into a scenario where the mobile phone and tablet computer access the network using the same frequency and channel; or degenerate into a scenario where the mobile phone accesses the network using the same frequency but different channels, and the tablet computer accesses the network using the same frequency and channel. The subsequent processing is the same as described above. Figure 4 Similar to the above, I won't elaborate further; or it could degenerate into a scenario where mobile phones and tablets access the network via different channels on the same frequency, and the corresponding processing would be the same as... Figure 7 Similarly, this will not be repeated here; if the mobile phone does not support DBDC, but the tablet supports DBDC, disconnect the mobile phone from the 2417MHz WiFi network, and share the WiFi network connected to the tablet via a 5180MHz P2P connection. It should be understood that the above is merely an illustrative description and should not be construed as a limitation on the embodiments of this application. Accordingly, in scenarios where the first device and the second device access the network via different frequencies and channels, embodiments of this application provide two communication methods.
[0213] The first communication method includes:
[0214] S901a, the first device receives second WiFi information and second DBDC information based on the first P2P connection.
[0215] It is understood that the second WiFi information and the second DBDC information in this embodiment are the same as those in the above embodiments, and therefore will not be described again.
[0216] S902a: The first device determines that it will access the network via a different frequency and channel based on the first frequency and the third frequency.
[0217] S903a: The first device determines that the second device will access the network via a different frequency and channel based on the second and third frequency points.
[0218] It is understood that the first frequency point, the second frequency point, and the third frequency point in the embodiments of this application are the same as the first frequency point, the second frequency point, and the third frequency point in the above embodiments, so they will not be described again.
[0219] S904a, the first device determines, based on the first DBDC information and the second DBDC information, that the first device and the second device do not support DBDC.
[0220] It is understood that the first DBDC information in this embodiment is the same as the first DBDC information in the above embodiments, so it will not be described again.
[0221] S905a: Based on the third frequency point corresponding to the first P2P connection, the first device switches to connect to the eighth WiFi network, obtains the third WiFi information, and sends the third WiFi information to the second device.
[0222] The third WiFi information is the WiFi information corresponding to the first device after the first device is switched to connect to the eighth WiFi network.
[0223] It should be noted that the first device will attempt to switch to the WiFi network corresponding to the 5G frequency band. Ultimately, the first device may switch to the eighth WiFi network with the same frequency as the fifth frequency band, or it may switch to the eighth WiFi network with a different frequency than the third frequency band but belonging to the same frequency band. After the first device switches WiFi networks, the corresponding WiFi information changes, and the changed fourth WiFi information needs to be sent to the second device.
[0224] S906a, the second device receives first WiFi information and first DBDC information based on the first P2P connection.
[0225] It is understood that the first WiFi information in this embodiment is the same as the first WiFi information in the above embodiments, and therefore will not be described again.
[0226] S907a, the second device determines that the first device enters the network via a different frequency and channel based on the first frequency and the second frequency.
[0227] S908a: The second device determines that it will access the network via a different frequency and channel based on the second and third frequency points.
[0228] S909a, the second device determines, based on the first DBDC information and the second DBDC information, that the first device and the second device do not support DBDC.
[0229] S910a, the second device switches to connect to the ninth WiFi network based on the third frequency point corresponding to the first P2P connection, obtains the fourth WiFi information, and sends the fourth WiFi information to the first device.
[0230] The fourth WiFi information is the WiFi information corresponding to the second device after the second device is switched to connect to the ninth WiFi.
[0231] It should be noted that the second device will attempt to switch to the WiFi network corresponding to the 5G frequency band. Ultimately, the second device may switch to the ninth WiFi network, which shares the same frequency as the fifth network, or it may switch to the ninth WiFi network, which shares a different frequency than the fifth network but belongs to the same frequency band. After the second device switches WiFi networks, the corresponding WiFi information changes, and the updated fourth WiFi information needs to be sent to the first device.
[0232] S911a, the second device receives third WiFi information based on the first P2P connection.
[0233] S912a, The first device receives fourth WiFi information based on the first P2P connection.
[0234] S913a: Based on the third WiFi information and the fourth WiFi information, the first device adjusts the STA channel and the P2P channel corresponding to the first device to be the same channel, or shares the ninth WiFi network through the P2P connection between the first device and the second device, or maintains the existing network access method of the first device.
[0235] It should be noted that the existing network access method of the first device here refers to the network access method corresponding to the first device after switching to the eighth WiFi.
[0236] In this embodiment, if the first device determines that the first device and the second device will access the network on the same frequency and channel based on the third WiFi information, the fourth WiFi information, and the third frequency point, the first device will maintain its existing network access method. If the first device determines that the first device will access the network on the same frequency but on a different channel, and the second device will access the network on the same frequency and on the same channel, based on the third WiFi information, the fourth WiFi information, and the third frequency point, the first device will adjust the STA channel and the P2P channel corresponding to the first device to be on the same channel, or share the ninth WiFi network through the P2P connection between the first device and the second device. The specific processing procedure is the same as described above. Figure 4 Similar to the above, and will not be elaborated further; if the first device determines that the first device and the second device are accessing the network on the same frequency but through different channels based on the third WiFi information, the fourth WiFi information, and the third frequency point, the first device will adjust its corresponding STA channel and P2P channel to be the same channel. The specific processing procedure is the same as described above. Figure 7 The similarities are not elaborated upon here.
[0237] S914a: Based on the third WiFi information and the fourth WiFi information, the second device adjusts the STA channel corresponding to the second device and the P2P channel corresponding to the second device to be the same channel, or maintains the existing network access method of the second device.
[0238] It should be noted that the existing network access method of the second device here refers to the network access method corresponding to the second device after switching to the ninth WiFi.
[0239] In this embodiment, if the second device determines that the first device and the second device will access the network using the same frequency and channel based on the third WiFi information, the fourth WiFi information, and the third frequency point, the second device will maintain the existing network access method of the first device. If the first device determines that the first device will access the network using the same frequency but different channels based on the third WiFi information, the fourth WiFi information, and the third frequency point, and the second device will access the network using the same frequency and channel, the second device will maintain the existing network access method of the first device. The specific processing procedure is the same as that of the first device. Figure 4 Similar to the above, and will not be elaborated further; if the first device determines that the first device and the second device are accessing the network on the same frequency but with different channels based on the third WiFi information, the fourth WiFi information, and the third frequency point, the second device will adjust the STA channel corresponding to the second device and the P2P channel corresponding to the second device to be on the same channel, or maintain the existing network access method of the second device. The specific processing procedures are the same as those described above. Figure 7 The similarities are not elaborated upon here.
[0240] As can be seen, in this embodiment of the application, when the first device and the second device access the network using different frequencies and channels, and the first and second devices do not support DBDC, the second device and the first device will attempt to switch to connect to the WiFi network with the same frequency band as the first P2P connection. After this, the first device and the second device may access the network using the same frequency and channel, or the first device may access the network using the same frequency but different channels, and the second device may access the network using the same frequency and channel, or the first device and the second device may access the network using the same frequency but different channels. Based on this, the WiFi information of the first device and the second device has changed. The first device and the second device can re-acquire the WiFi information of the other device and adaptively change their own access methods based on the changed WiFi information of both ends, so that the first device works using the same frequency and channel, or shares the WiFi connection of the second device through the P2P connection of the first device and the second device, and the second device works using the same frequency and channel. This can avoid the problem of large latency in P2P services.
[0241] The second communication method includes:
[0242] S901b: The first device receives second WiFi information and second DBDC information based on the first P2P connection.
[0243] It is understood that the second WiFi information and the second DBDC information in this embodiment are the same as those in the above embodiments, and therefore will not be described again.
[0244] S902b: The first device determines that it will access the network via a different frequency and channel based on the first frequency and the third frequency.
[0245] S903b: The first device determines that the second device will access the network via a different frequency and channel based on the second and third frequency points.
[0246] It is understood that the first frequency point, the second frequency point, and the third frequency point in the embodiments of this application are the same as the first frequency point, the second frequency point, and the third frequency point in the above embodiments, so they will not be described again.
[0247] S904a, the first device determines, based on the first DBDC information and the second DBDC information, that the first device does not support DBDC and the second device does support DBDC.
[0248] It is understood that the first DBDC information in this embodiment is the same as the first DBDC information in the above embodiments, so it will not be described again.
[0249] S905b: The first device shares the second WiFi network through a first P2P connection.
[0250] S906a, the second device receives first WiFi information and first DBDC information based on the first P2P connection.
[0251] It is understood that the first WiFi information in this embodiment is the same as the first WiFi information in the above embodiments, and therefore will not be described again.
[0252] S907a, the second device determines the first device's inter-frequency and inter-channel network access based on the first frequency point and the third frequency point.
[0253] S908a: The second device determines that it will access the network via a different frequency and channel based on the second and third frequency points.
[0254] S909a, the second device determines, based on the first DBDC information and the second DBDC information, that the first device and the second device do not support DBDC.
[0255] S910b, The second device determines that the second device will maintain its existing network access method.
[0256] In this embodiment, the second device supports DBDC and can utilize the resources of both the 5G and 2.4G frequency bands simultaneously. Thus, the second device does not need to change its network access method and can continue to maintain its existing network access method.
[0257] It should be noted that in scenarios where the first device and the second device access the network via different frequencies and channels, if both the first device and the second device support DBDC, the first device and the second device can simultaneously utilize the resources of the 5G frequency band and the 2.4G frequency band. In this way, neither the first device nor the second device needs to change its network access method and can continue to maintain its existing network access method.
[0258] As can be seen, in this embodiment of the application, when the first device and the second device access the network using different frequencies and channels, and the second device supports DBDC, the second device can utilize the resources of two frequency bands simultaneously without changing the access method of the second device. Therefore, the first device can directly disconnect from the first WiFi and share the second WiFi network connected to the second device through the first P2P connection. In this way, the first device is not directly connected to WiFi, and it is impossible for it to work with the same frequency but different channels or with different frequencies and different channels, thereby avoiding the problem of large latency in P2P services.
[0259] Please see Figure 10 This is a schematic diagram illustrating a scenario of changing device connections under channel roaming, as disclosed in an embodiment of this application. This embodiment uses a mobile phone as the first device and a tablet computer as the second device for illustration. In the left half of the diagram, the mobile phone and tablet computer connect to WiFi 1 at a frequency of 5180MHz, establishing a P2P connection at 5180MHz. The mobile phone and tablet computer are in WiFi roaming mode and detect WiFi at a frequency of 5200MHz. In the right half of the diagram, if the WiFi quality score of the detected WiFi network is not greater than a second quality threshold, the mobile phone and tablet computer will maintain their existing network access method; if the WiFi quality score of the detected WiFi network is greater than the second quality threshold, the mobile phone and tablet computer will switch to connect to the WiFi network at a frequency of 5200MHz, disconnecting the original P2P connection and establishing a new P2P connection at a frequency of 5200MHz. It should be understood that the above is merely an illustrative description and should not be construed as a limitation on the embodiments of this application. Accordingly, in the scenario where the first device and the second device are in roaming mode, this embodiment of the application provides two communication methods.
[0260] The first communication method includes:
[0261] S1001a. If the WiFi quality score of the tenth WiFi network is greater than the second quality threshold, the first device will switch to connect to the tenth WiFi network.
[0262] The first device was in WiFi roaming mode and detected the tenth WiFi network.
[0263] It should be noted that before the first device is in roaming mode, the first device operates on the same frequency and channel.
[0264] S1002a. If the WiFi quality score of the fourteenth WiFi is greater than the second quality threshold, the second device will switch to connect to the fourteenth WiFi.
[0265] The second device was in WiFi roaming mode and detected the fourteenth WiFi network.
[0266] It should be noted that before the second device is in roaming mode, the second device operates on the same frequency and channel.
[0267] In this embodiment, the frequency of the tenth WiFi network is the same as that of the fourteenth WiFi network. The tenth WiFi network and the fourteenth WiFi network can be the same WiFi network or different WiFi networks, but they share the same frequency.
[0268] It should be noted that the first and second devices conducting P2P services are generally physically close, and there is a high probability that the first and second devices can detect WiFi networks on the same frequency.
[0269] S1003a, the first device and the second device modify the first P2P connection to the seventh P2P connection based on the sixth frequency point of the tenth WiFi network.
[0270] It is understandable that, since the frequency of the tenth WiFi network is the same as that of the fourteenth WiFi network, the first device and the second device can also modify the first P2P connection to the seventh P2P connection based on the seventh frequency of the fourteenth WiFi network.
[0271] The seventh P2P connection is the P2P connection between the first device and the second device. Changing the first P2P connection to the seventh P2P connection can be understood as disconnecting the first P2P connection and establishing the seventh P2P connection.
[0272] It should be noted that a second quality threshold can be set according to actual conditions, and this application embodiment does not impose any restrictions on this. The second quality threshold can be the same as or different from the first quality threshold in the above embodiments.
[0273] The second communication method includes:
[0274] S1001b If the WiFi quality score of the tenth WiFi network is less than or equal to the second quality threshold, the first device determines to maintain the existing WiFi connection method.
[0275] S1002b: If the WiFi quality score of the fourteenth WiFi network is less than or equal to the second quality threshold, the second device determines to maintain the existing WiFi connection method.
[0276] As can be seen, in this embodiment of the application, for WiFi roaming scenarios, the WiFi quality score of the detected WiFi network is first determined. Only when the WiFi quality score of the detected WiFi network is greater than a certain value will the first device and the second device switch WiFi. This ensures that the WiFi network after the switch is usable and avoids affecting P2P services. Moreover, the P2P connection between the first device and the second device is also modified, thus ensuring that the second device still operates on the same frequency and channel, avoiding the problem of large latency in P2P services.
[0277] Please see Figure 11a This is a flowchart illustrating another communication method provided in an embodiment of this application. Figure 11a The first and second devices have the same structural composition, both including a service module, a Magiclink module, and a short-range module. The service module can include audio services, screen mirroring services, and control services; the Magiclink module can include a session management layer and a P2P connection module, and the P2P connection module can include a WiFi information exchange module; the short-range module can include a WiFi switching algorithm module and a WiFi module.
[0278] It should be noted that Magiclink is a technology that supports self-discovery, self-organizing networking, and interconnection (such as file, message, and streaming media transmission) between devices such as mobile phones, PCs, and tablets. The physical channels used by Magiclink include Long Term Evolution (LTE) far-field communication, Bluetooth, and WiFi (such as P2P connections and local area networks), aiming to support stable and fast communication between devices.
[0279] The session management layer aims to provide adapted services to businesses by differentiating and managing sessions with different attributes. Generally, a single business corresponds to at least one session. If a business has multiple demands and needs (such as simultaneously sending control signaling, transporting streams, and sending files), then it should correspond to multiple different types of sessions (such as message sessions, stream sessions, and file sessions). The session management layer can connect to Magiclink's upper-layer businesses (such as screen mirroring, voice calls, keyboard and mouse, etc.) to determine the business requirements and capabilities of P2P services. Specifically, the business requirements and capabilities corresponding to different P2P services need to be written into Magiclink's configuration file in advance. These requirements and capabilities can include things like WiFi switching. When a P2P service uses Magiclink capabilities, Magiclink will first check the configuration items for that P2P service in the configuration file to determine which capabilities the P2P service can use.
[0280] Short-range modules include all modules below the Internet Protocol (IP) layer, including drivers, network cards, WiFi switching algorithm modules, and WiFi modules, etc.
[0281] Registering a callback means that a lower-level module can notify a higher-level module.
[0282] The following combination Figure 11a The communication method provided in the embodiments of this application will be described.
[0283] The service module of the first device initiates a P2P service; the session management layer of the first device checks the configuration, determines the service requirements corresponding to the initiated P2P service, including WiFi switching, and sends the check result to the WiFi information exchange module of the first device; the P2P module of the first device establishes a P2P connection with the P2P connection module of the second device; the WiFi information exchange module of the first device sends the WiFi information of the first device to the second device and receives the WiFi information of the second device sent by the WiFi information exchange module of the second device; the WiFi information exchange module of the first device sends the WiFi information of the second device to the WiFi switching algorithm module of the first device; the WiFi switching algorithm module of the first device, based on the WiFi information of the first device, the WiFi information of the second device, and the frequency point corresponding to the P2P connection, determines whether to adjust the STA channel and the P2P channel corresponding to the first device to the same channel, or to share the WiFi connection of the second device through the P2P connection of the first device and the second device, or to maintain the existing network access method of the first device; the WiFi module of the first device switches the WiFi network connected to the first device according to the determination result of the WiFi switching algorithm module, and / or, the P2P connection module changes the P2P connection of the first device and the second device according to the determination result of the WiFi switching algorithm module. If the WiFi network connected to the first device is switched, the WiFi module of the first device will send the changed WiFi information of the first device to the WiFi information exchange module of the first device, and the WiFi information exchange module of the first device will send the changed WiFi information of the first device to the WiFi information exchange module of the second device.
[0284] Understandable, Figure 11a The execution process of the second device is similar to that of the first device, so it will not be described in detail here.
[0285] Please see Figure 11b This is a flowchart illustrating another communication method provided in an embodiment of this application. Figure 11b The composition and structure of the first equipment in China Figure 11a The first device in the series has the same composition and structure. Figure 11b The composition and structure of the second equipment are relatively Figure 11a The second device lacks a WiFi switching algorithm module in its structure, which is related to... Figure 11a The same parts will not be repeated here.
[0286] Figure 11bThe WiFi switching algorithm module of the first device will also determine how to adjust the WiFi network connection mode of the second device based on the WiFi information of the first device, the WiFi information of the second device, and the frequency point corresponding to the P2P connection, obtain WiFi switching indication information, and send the WiFi switching indication information to the WiFi information exchange module of the first device; the WiFi information exchange module of the first device will send the WiFi switching indication information to the WiFi information exchange module of the second device; the WiFi information exchange module of the second device will send the WiFi information exchange module to the WiFi module of the second device; the WiFi module of the second device will adjust the WiFi network connected to the second device according to the WiFi switching indication information.
[0287] The WiFi switching instruction information is used to instruct the second device to adjust the WiFi network it is connected to. The second device may switch to another WiFi network according to the WiFi switching instruction information, or it may maintain the existing WiFi connection method according to the WiFi switching instruction information, or it may disconnect from the WiFi network according to the WiFi switching instruction information and share the first device's WiFi network through a P2P connection.
[0288] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.
[0289] To facilitate better implementation of the above-described solutions in the embodiments of this application, related apparatus for implementing the above-described solutions is also provided below.
[0290] Please see Figure 12 This is a schematic diagram of the structure of a communication device provided in an embodiment of this application. The communication device 1200 is applied to a first device. The device 1200 includes: a session management module 1201, a P2P connection module 1202, a WiFi switching algorithm module 1203, and a WiFi module 1204. The P2P connection module 1202 includes a WiFi information exchange module 12021.
[0291] WiFi information exchange module 12021 is used to receive second WiFi information from the second device based on the first P2P connection, and send the second WiFi information to the WiFi switching algorithm module. The first P2P connection is a P2P connection between the first device and the second device.
[0292] WiFi switching algorithm module 1203 is used to determine, based on the first WiFi information and the second WiFi information of the first device, to adjust the STA channel and the P2P channel corresponding to the first device to the same channel, or to share the WiFi network connected to the second device through the P2P connection between the first device and the second device.
[0293] Understandable, Figure 12 The illustrated communication device 1200 can also be applied to a second device.
[0294] As can be seen, in this embodiment of the application, the first device can obtain the WiFi connection status of the second device based on the P2P connection between the first device and the second device. In this way, the first device can combine its own WiFi connection status and the WiFi connection status of the other device to adaptively change its network access method, so that the first device can access the network with the same frequency and the same channel, or the first device can disconnect from the WiFi connection and directly share the WiFi network connected to the second device through the P2P connection. This can avoid the first device continuously working with the same frequency and different channels or with different frequencies and different channels, thereby avoiding the problem of large latency in P2P services caused by the need to switch different channels in a time-sharing manner, and thus improving the user experience of P2P services.
[0295] In some possible implementations, the first WiFi information includes a first frequency point, which is the frequency point of the first WiFi to which the first device is connected; the second WiFi information includes a second frequency point, which is the frequency point of the second WiFi to which the second device is connected.
[0296] WiFi switching algorithm module 1203 is specifically used to determine, based on a first frequency point, a second frequency point, and a third frequency point, to adjust the STA channel corresponding to the first device and the P2P channel corresponding to the first device to the same channel, or to share the WiFi network connected to the second device through the P2P connection between the first device and the second device, wherein the third frequency point is the frequency point corresponding to the first P2P connection.
[0297] In some possible implementations, the WiFi switching algorithm module 1203 is also used to determine, based on the first frequency point and the third frequency point, that the first device enters the network using the same frequency but different channels; and to determine, based on the second frequency point and the third frequency point, that the second device enters the network using the same frequency and the same channel.
[0298] The WiFi switching algorithm module 1203 is further configured to, if the first device's connected WiFi list contains a third WiFi network with a second frequency, switch the first device to connect to the third WiFi network.
[0299] WiFi module 1204 is also used to switch the first device to connect to a third WiFi network;
[0300] The WiFi switching algorithm module 1203 is also used to share the second WiFi network through the first P2P connection if there is no third WiFi network with the second frequency point in the connected WiFi list.
[0301] The P2P connection module 1202 is also used to share a second WiFi network via the first P2P connection.
[0302] In some possible implementations, the WiFi switching algorithm module 1203 is specifically used to switch the first device to connect to the third WiFi network if there is a third WiFi network with the second frequency in the connected WiFi list and the WiFi quality score of the third WiFi network is greater than the first quality threshold.
[0303] In some possible implementations, the WiFi quality score of the third WiFi network is used to characterize the signal strength and / or network speed of the third WiFi network.
[0304] In some possible implementations, the WiFi switching algorithm module 1203 is specifically used to switch the first device to connect to the third WiFi network if there is a third WiFi network with the second frequency in the connected WiFi list, and there is no second P2P service with high QoS requirements based on the second P2P connection between the first device and the third device. The second P2P connection is a P2P connection between the first device and the third device.
[0305] In some possible implementations, the first device does not support dual-band dual-concurrency DBDC. The WiFi switching algorithm module 1203 is also used to determine, based on the first frequency and the third frequency, that the first device enters the network with different frequencies and channels; and based on the second frequency and the third frequency, to determine that the second device enters the network with the same frequency and channel.
[0306] The WiFi switching algorithm module 1203 is also used to switch the first device to connect to the fourth WiFi network if there is a fourth WiFi network with the second frequency in the connected WiFi list of the first device.
[0307] WiFi module 1204 is also used to switch the first device to connect to the fourth WiFi network;
[0308] The WiFi switching algorithm module 1203 is also used to share the second WiFi network through the first P2P connection if there is no fourth WiFi network with the second frequency point in the connected WiFi list.
[0309] The P2P connection module 1202 is also used to share a second WiFi network via the first P2P connection.
[0310] In some possible implementations, the WiFi switching algorithm module 1203 is also used to determine, based on the first frequency point and the third frequency point, that the first device enters the network using the same frequency but different channels; and to determine, based on the third frequency point and the second frequency point, that the second device enters the network using the same frequency but different channels.
[0311] The WiFi switching algorithm module 1203 is also used to determine, based on the first frequency point, to change the first P2P connection to the third P2P connection, wherein the third P2P connection is the P2P connection between the first device and the second device.
[0312] The P2P connection module 1202 is also used to modify the first P2P connection into a third P2P connection.
[0313] In some possible implementations, the WiFi switching algorithm module 1203 is also used to determine, based on the first frequency point and the third frequency point, that the first device enters the network using the same frequency but different channels; and to determine, based on the second frequency point and the third frequency point, that the second device enters the network using the same frequency but different channels.
[0314] The WiFi switching algorithm module 1203 is also used to select the DFS channel from the connected WiFi list of the first device, and determine to modify the first P2P connection to the fourth P2P connection. The fourth P2P connection is the P2P connection between the first device and the second device.
[0315] The P2P connection module 1202 is also used to modify the first P2P connection into a fourth P2P connection;
[0316] The WiFi switching algorithm module 1203 is also used to determine, based on the fourth frequency point corresponding to the fourth P2P connection, to switch the first device to connect to the fifth WiFi network.
[0317] WiFi module 1204 is also used to switch the first device to connect to the fifth WiFi network.
[0318] In some possible implementations, the WiFi switching algorithm module 1203 is also used to determine, based on the first frequency and the third frequency, that the first device enters the network using a different frequency and a different channel; and to determine, based on the second frequency and the third frequency, that the second device enters the network using the same frequency but a different channel.
[0319] The WiFi switching algorithm module 1203 is also used to determine, based on the second frequency point, to modify the first P2P connection to the fifth P2P connection, and the fifth P2P connection to be a P2P connection between the first device and the second device.
[0320] The P2P connection module 1202 is also used to modify the first P2P connection into the fifth P2P connection;
[0321] The WiFi switching algorithm module 1203 is further configured to determine to switch the first device to connect to the sixth WiFi network if there is a sixth WiFi network with the second frequency in the connected WiFi list of the first device.
[0322] WiFi module 1204 is also used to switch the first device to connect to the sixth WiFi network;
[0323] The WiFi switching algorithm module 1203 is also used to determine to share the second WiFi network through the fifth P2P connection if there is no sixth WiFi network with the second frequency point in the connected WiFi list.
[0324] The P2P connection module 1202 is also used to share the second WiFi network via a fifth P2P connection.
[0325] In some possible implementations, the WiFi switching algorithm module 1203 is also used to determine, based on the first frequency and the third frequency, that the first device enters the network using a different frequency and a different channel; and to determine, based on the second frequency and the third frequency, that the second device enters the network using the same frequency but a different channel.
[0326] The WiFi switching algorithm module 1203 is also used to determine, through non-DFS channels in the connected WiFi list of the first device, to change the first P2P connection to the sixth P2P connection, and the sixth P2P connection is a P2P connection between the first device and the second device.
[0327] The P2P connection module 1202 is also used to modify the first P2P connection into the sixth P2P connection;
[0328] The WiFi switching algorithm module 1203 is also used to switch the first device to connect to the seventh WiFi network based on the fifth frequency point corresponding to the sixth P2P connection.
[0329] The WiFi switching algorithm module 1203 is also used to switch the first device to connect to the seventh WiFi network.
[0330] In some possible implementations, the WiFi information exchange module 12021 is also used to receive second DBDC information from the second device based on the first P2P connection, the second DBDC information being used to indicate whether the second device supports DBDC;
[0331] The WiFi switching algorithm module 1203 is also used to determine, based on the first frequency and the third frequency, that the first device enters the network using an inter-frequency and inter-channel configuration; based on the second frequency and the third frequency, that the second device enters the network using an inter-frequency and inter-channel configuration; and based on the first DBDC information and the second DBDC information, that the first device and the second device do not support DBDC, wherein the first DBDC information is used to indicate whether the first device supports DBDC.
[0332] The WiFi switching algorithm module 1203 is also used to determine, based on the third frequency point, to switch the first device to connect to the eighth WiFi network;
[0333] WiFi module 1204 is also used to switch the first device to connect to the eighth WiFi network and obtain the third WiFi information of the first device;
[0334] The WiFi information exchange module 12021 is also used to receive the fourth WiFi information of the second device based on the first P2P connection; the fourth WiFi information is the WiFi information of the second device after the second device is switched to connect to the ninth WiFi network based on the third frequency point.
[0335] The WiFi switching algorithm module 1203 is also used to adjust the STA channel corresponding to the first device and the P2P channel corresponding to the first device to the same channel based on the third WiFi information and the fourth WiFi information, or to share the ninth WiFi network through the P2P connection between the first device and the second device.
[0336] In some possible implementations, the WiFi information exchange module 12021 is also used to receive second DBDC information from the second device based on the first P2P connection, the second DBDC information being used to indicate whether the second device supports DBDC;
[0337] The WiFi switching algorithm module 1203 is also used to determine, based on the first frequency point and the third frequency point, that the first device enters the network with a different frequency and a different channel; based on the second frequency point and the third frequency point, that the second device enters the network with a different frequency and a different channel; and based on the first DBDC information and the second DBDC information, to determine that the first device does not support DBDC and the second device supports DBDC, wherein the first DBDC information is used to indicate whether the first device supports DBDC.
[0338] The WiFi switching algorithm module 1203 is also used to determine whether the second WiFi network is shared through the first P2P connection;
[0339] The P2P connection module 1202 is also used to share a second WiFi network via the first P2P connection.
[0340] In some possible implementations, the session management module 1201 is used to determine the business requirements corresponding to the first P2P service;
[0341] P2P connection module 1202 is used to establish the first P2P connection;
[0342] The WiFi information exchange module 12021 is also used to send first WiFi information to the second device based on the first P2P connection if the service requirement corresponding to the first P2P service includes WiFi switching. The first P2P service is a P2P service initiated between the first device and the second device.
[0343] In some possible implementations, WiFi module 1204 is used to send the fifth WiFi information to WiFi information exchange module 12021. The fifth WiFi information is the WiFi information corresponding to the first device after adjusting the STA channel and P2P channel to the same channel, or sharing the WiFi network connected to the second device.
[0344] The WiFi information exchange module 12021 is also used to send fifth WiFi information to the second device based on the P2P connection between the first device and the second device.
[0345] In some possible implementations, the first device is in WiFi roaming state and detects the tenth WiFi network. The WiFi switching algorithm module 1203 is further configured to determine to switch the first device to connect to the tenth WiFi network if the WiFi quality score of the tenth WiFi network is greater than the second quality threshold, and to determine to modify the first P2P connection to the seventh P2P connection based on the sixth frequency point of the tenth WiFi network. The seventh P2P connection is the P2P connection between the first device and the second device.
[0346] WiFi module 1204 is also used to switch the first device to connect to the tenth WiFi network;
[0347] The P2P connection module 1202 is also used to modify the first P2P connection into the seventh P2P connection.
[0348] It should be noted that the information interaction and execution process between the modules / units of the above-mentioned device are based on the same concept as the method embodiments of this application, and the resulting technical effects are the same as those of the method embodiments of this application. For details, please refer to the description in the method embodiments shown above in this application, and will not be repeated here.
[0349] Figure 13 This application provides another example of the composition of a communication device. The communication device can be a first device or a second device, including but not limited to mobile phones, smart wearable devices (such as smartwatches), and other electronic devices. Taking a mobile phone as an example, the communication device may include a processor 310, an external memory interface 320, an internal memory 321, a display screen 330, a camera 340, antenna 1, antenna 2, a mobile communication module 350, and a wireless communication module 360, etc.
[0350] It is understood that the structure illustrated in this embodiment does not constitute a specific limitation on the communication device. In other embodiments, the communication device may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0351] Processor 310 may include one or more processing units, such as application processor (AP), modem processor, graphics processing unit (GPU), image signal processor (ISP), controller, video codec, digital signal processor (DSP), baseband processor, and / or neural network processing unit (NPU). These different processing units may be independent devices or integrated into one or more processors.
[0352] It is understood that the interface connection relationships between the modules illustrated in this embodiment are merely illustrative and do not constitute a limitation on the structure of the electronic device. In other embodiments of this application, the electronic device may also employ different interface connection methods or combinations of multiple interface connection methods as described in the above embodiments.
[0353] The external storage interface 320 can be used to connect an external storage card, such as a Micro SD card, to expand the storage capacity of the communication device. The external storage card communicates with the processor 310 through the external storage interface 320 to perform data storage functions. For example, music, video, and other files can be saved on the external storage card.
[0354] Internal memory 321 can be used to store computer executable program code, which includes instructions. Processor 310 executes various functional applications and data processing of the communication device by running the instructions stored in internal memory 321, thereby implementing the communication method described in the above embodiments. Internal memory 321 may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback, image playback, etc.), etc. The data storage area may store data created during the use of the electronic device (such as audio data, phonebook, etc.). Furthermore, internal memory 321 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc. Processor 310 executes various functional applications and data processing of the communication device by running instructions stored in internal memory 321 and / or instructions stored in memory located within the processor.
[0355] The wireless communication function of the communication device can be realized through antenna 1, antenna 2, mobile communication module 350, wireless communication module 360, modem processor, and baseband processor.
[0356] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the communication device can be used to cover one or more communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antennas can be used in conjunction with a tuning switch.
[0357] The mobile communication module 350 can provide solutions for wireless communication applications including 2G / 3G / 4G / 5G in electronic devices. The mobile communication module 350 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 350 can receive electromagnetic waves via antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic waves before transmitting them to a modem processor for demodulation. The mobile communication module 350 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via antenna 1. In some embodiments, at least some functional modules of the mobile communication module 350 may be housed in the processor 310. In some embodiments, at least some functional modules of the mobile communication module 350 and at least some modules of the processor 310 may be housed in the same device.
[0358] In some embodiments, the communication device initiates or receives call requests via the mobile communication module 350 and the antenna 1.
[0359] Furthermore, an operating system runs on top of the aforementioned components. Examples include iOS, Android, and Windows operating systems. Applications can be installed and run on this operating system. Those skilled in the art will understand that, for the sake of convenience and brevity, explanations and beneficial effects of the relevant content in any of the above-described electronic devices can be found in the corresponding method embodiments provided above, and will not be repeated here.
[0360] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, or indirect coupling or communication connection between devices or modules, and may be electrical, mechanical, or other forms.
[0361] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules; that is, they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0362] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated modules described above can be implemented in hardware or as software functional modules.
[0363] If the integrated module is implemented as a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the essential contribution of the technical solution of this application, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the processes of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory, random access memory, magnetic disks, or optical disks.
[0364] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit it. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
Claims
1. A communication method characterized by comprising: The method is applied to a first device, and the method includes: The second WiFi information of the second device is received based on the first end-to-end P2P connection. The first P2P connection is a P2P connection between the first device and the second device. The second WiFi information includes a second frequency point, which is the frequency point of the second WiFi network to which the second device is connected. Based on the first WiFi information and the second WiFi information of the first device, adjust the STA channel and the P2P channel corresponding to the first device to be the same channel, or share the WiFi network connected to the second device through the P2P connection of the first device and the second device. The first WiFi information includes a first frequency point, which is the frequency point of the first WiFi network connected to the first device. The step of adjusting the STA channel and P2P channel corresponding to the first device to the same channel based on the first WiFi information and the second WiFi information of the first device, or sharing the WiFi network connected to the second device through the P2P connection of the first device and the second device, includes: Based on the first frequency point and the third frequency point, the network access method of the first device is determined. The third frequency point is the frequency point corresponding to the first P2P connection. The network access method of the first device is any one of the following: network access via the same frequency but different channel, or network access via different frequency and different channel. Based on the second frequency point and the third frequency point, the network access method of the second device is determined. The network access method of the second device is any one of the following: network access with the same frequency and the same channel, network access with the same frequency but different channels, or network access with different frequencies and different channels. Based on the network access methods of the first device and the second device, adjust the STA channel and P2P channel corresponding to the first device to be the same channel, or share the WiFi network connected to the second device through the P2P connection between the first device and the second device.
2. The method according to claim 1, characterized in that, The step of adjusting the STA channel and P2P channel corresponding to the first device to the same channel based on the network access method of the first device and the network access method of the second device, or sharing the WiFi network connected to the second device through the P2P connection of the first device and the second device, includes: If the first device enters the network via the same frequency but different channels, the second device enters the network via the same frequency and same channels, and there is a third WiFi network with the second frequency in the first device's connected WiFi list, then the first device will be switched to connect to the third WiFi network. If the first device joins the network via the same frequency but different channel, the second device joins the network via the same frequency and same channel, and there is no third WiFi network with the second frequency in the connected WiFi list, the second WiFi network is shared through the first P2P connection.
3. The method according to claim 2, characterized in that, The step of switching the first device to connect to the third WiFi network when the first device's network access method is same-frequency, different-channel, the second device's network access method is same-frequency, same-channel, and the first device's connected WiFi list contains a third WiFi network with the second frequency point, includes: If the first device joins the network via the same frequency but different channels, the second device joins the network via the same frequency and same channels, and there is a third WiFi network in the connected WiFi list with the second frequency, and the WiFi quality score of the third WiFi network is greater than the first quality threshold, then the first device will be switched to connect to the third WiFi network.
4. The method according to claim 3, characterized in that, The WiFi quality score of the third WiFi network is used to characterize the signal strength and / or network speed of the third WiFi network.
5. The method according to any one of claims 2 to 4, characterized in that, The step of switching the first device to connect to the third WiFi network when the first device's network access method is same-frequency, different-channel, the second device's network access method is same-frequency, same-channel, and the first device's connected WiFi list contains a third WiFi network with the second frequency point, includes: If the first device joins the network via a different channel at the same frequency, the second device joins the network via a same channel at the same frequency, and there is a third WiFi network with the second frequency in the connected WiFi list, and there is no second P2P service with QoS requirements based on the second P2P connection between the first device and the third device, then the first device will be switched to the third WiFi network, and the second P2P connection will be a P2P connection between the first device and the third device.
6. The method according to claim 1, characterized in that, The first device does not support dual-band dual-concurrency DBDC. The step of adjusting the STA channel and P2P channel corresponding to the first device to the same channel based on the network access methods of the first device and the second device, or sharing the WiFi network connected to the second device through the P2P connection of the first device and the second device, includes: If the first device enters the network via a different frequency and channel, the second device enters the network via the same frequency and channel, and there is a fourth WiFi network with the second frequency in the first device's connected WiFi list, then the first device will be switched to connect to the fourth WiFi network. If the first device joins the network via a different frequency and channel, the second device joins the network via the same frequency and channel, and there is no fourth WiFi network with the second frequency in the connected WiFi list, the second WiFi network is shared through the first P2P connection.
7. The method according to claim 1, characterized in that, The step of adjusting the STA channel and P2P channel corresponding to the first device to the same channel based on the network access method of the first device and the network access method of the second device, or sharing the WiFi network connected to the second device through the P2P connection of the first device and the second device, includes: When the first device enters the network via the same frequency but different channels, and the second device enters the network via the same frequency but different channels, the first P2P connection is modified into a third P2P connection based on the first frequency point. The third P2P connection is a P2P connection between the first device and the second device.
8. The method according to claim 1, characterized in that, The step of adjusting the STA channel and P2P channel corresponding to the first device to the same channel based on the network access method of the first device and the network access method of the second device, or sharing the WiFi network connected to the second device through the P2P connection of the first device and the second device, includes: When the first device enters the network via the same frequency but different channels and the second device enters the network via the same frequency but different channels, the first P2P connection is modified into a fourth P2P connection based on the non-dynamic frequency selection DFS channel in the connected WiFi list of the first device. The fourth P2P connection is a P2P connection between the first device and the second device. Based on the fourth frequency point corresponding to the fourth P2P connection, the first device is switched to connect to the fifth WiFi network.
9. The method according to claim 1, characterized in that, The step of adjusting the STA channel and P2P channel corresponding to the first device to the same channel based on the network access method of the first device and the network access method of the second device, or sharing the WiFi network connected to the second device through the P2P connection of the first device and the second device, includes: When the first device enters the network via a different frequency and channel, and the second device enters the network via a different frequency and channel, the first P2P connection is modified into a fifth P2P connection based on the second frequency point. The fifth P2P connection is a P2P connection between the first device and the second device. If a sixth WiFi network with the second frequency exists in the connected WiFi list of the first device, the first device will switch to connect to the sixth WiFi network. If the sixth WiFi network with the second frequency point is not found in the list of connected WiFi networks, the second WiFi network is shared through the fifth P2P connection.
10. The method according to claim 1, characterized in that, The step of adjusting the STA channel and P2P channel corresponding to the first device to the same channel based on the network access method of the first device and the network access method of the second device, or sharing the WiFi network connected to the second device through the P2P connection of the first device and the second device, includes: When the first device enters the network via a different frequency and channel, and the second device enters the network via a different frequency and channel, the first P2P connection is modified to the sixth P2P connection based on the non-DFS channel in the connected WiFi list of the first device. The sixth P2P connection is the P2P connection between the first device and the second device. Based on the fifth frequency point corresponding to the sixth P2P connection, the first device is switched to connect to the seventh WiFi network.
11. The method according to claim 1, characterized in that, The method further includes: Based on the first P2P connection, the second DBDC information of the second device is received, and the second DBDC information is used to indicate whether the second device supports DBDC. The step of adjusting the STA channel and P2P channel corresponding to the first device to the same channel based on the network access method of the first device and the network access method of the second device, or sharing the WiFi network connected to the second device through the P2P connection of the first device and the second device, includes: When the network access method of the first device is to access the network via different frequency and different channel, and the network access method of the second device is to access the network via different frequency and different channel, based on the first DBDC information and the second DBDC information, it is determined that the first device and the second device do not support DBDC. The first DBDC information is used to indicate whether the first device supports DBDC. Based on the third frequency point, the first device is switched to connect to the eighth WiFi network to obtain the third WiFi information of the first device; The fourth WiFi information of the second device is received based on the first P2P connection; the fourth WiFi information is the WiFi information of the second device after the second device is switched to the ninth WiFi network based on the third frequency point. Based on the third WiFi information and the fourth WiFi information, adjust the STA channel corresponding to the first device and the P2P channel corresponding to the first device to be the same channel, or share the ninth WiFi network through the P2P connection between the first device and the second device.
12. The method according to claim 1, characterized in that, The method further includes: Based on the first P2P connection, the second DBDC information of the second device is received, and the second DBDC information is used to indicate whether the second device supports DBDC. The step of adjusting the STA channel and P2P channel corresponding to the first device to the same channel based on the network access method of the first device and the network access method of the second device, or sharing the WiFi network connected to the second device through the P2P connection of the first device and the second device, includes: When the network access method of the first device is to access the network via different frequency and different channel, and the network access method of the second device is to access the network via different frequency and different channel, based on the first DBDC information and the second DBDC information, it is determined that the first device does not support DBDC and the second device supports DBDC. The first DBDC information is used to indicate whether the first device supports DBDC. The second WiFi network is shared through the first P2P connection.
13. The method according to any one of claims 1 to 4, characterized in that, Before receiving the second WiFi information from the second device based on the first end-to-end P2P connection, the method further includes: Establish the first P2P connection; If the service requirement corresponding to the first P2P service includes WiFi switching, the first WiFi information is sent to the second device based on the first P2P connection. The first P2P service is a P2P service initiated between the first device and the second device.
14. The method according to any one of claims 1 to 4, characterized in that, The method further includes: Based on the P2P connection between the first device and the second device, the fifth WiFi information of the first device is sent to the second device. The fifth WiFi information is the WiFi information corresponding to the first device after adjusting the STA channel and the P2P channel to the same channel, or sharing the WiFi network connected to the second device.
15. The method according to any one of claims 1 to 4, characterized in that, The first device is in WiFi roaming mode and has detected the tenth WiFi network. The method further includes: If the WiFi quality score of the tenth WiFi network is greater than the second quality threshold, the first device is switched to connect to the tenth WiFi network, and based on the sixth frequency point of the tenth WiFi network, the first P2P connection is modified to a seventh P2P connection, which is a P2P connection between the first device and the second device.
16. A communication device, characterized in that, The communication device is applied to the first device, and the device includes: an end-to-end P2P connection module and a WiFi switching algorithm module, wherein the P2P connection module includes a WiFi information exchange module; The WiFi information exchange module is used to receive second WiFi information from the second device based on the first P2P connection, and send the second WiFi information to the WiFi switching algorithm module. The first P2P connection is a P2P connection between the first device and the second device. The second WiFi information includes a second frequency point, which is the frequency point of the second WiFi network connected to the second device. The WiFi switching algorithm module is used to determine, based on the first WiFi information and the second WiFi information of the first device, to adjust the STA channel and the P2P channel corresponding to the first device to the same channel, or to share the WiFi network connected to the second device through the P2P connection of the first device and the second device. The first WiFi information includes a first frequency point, which is the frequency point of the first WiFi network connected to the first device. The WiFi switching algorithm module is specifically used to determine the network access method of the first device based on the first frequency point and the third frequency point, wherein the third frequency point is the frequency point corresponding to the first P2P connection, and the network access method of the first device is any one of the following: network access via the same frequency but different channel, or network access via different frequency and different channel; based on the second frequency point and the third frequency point, determine the network access method of the second device, wherein the network access method of the second device is any one of the following: network access via the same frequency and same channel, network access via the same frequency but different channel, or network access via different frequency and different channel; based on the network access methods of the first device and the second device, adjust the STA channel corresponding to the first device and the P2P channel corresponding to the first device to be the same channel, or share the WiFi network connected to the second device through the P2P connection of the first device and the second device.
17. The apparatus according to claim 16, characterized in that, The device further includes: a session management module; The session management module is used to determine the business requirements corresponding to the first P2P service; The P2P connection module is used to establish the first P2P connection; The WiFi information exchange module is further configured to send the first WiFi information to the second device based on the first P2P connection if the service requirement includes WiFi switching, wherein the first P2P service is a P2P service initiated between the first device and the second device.
18. A communication device, characterized in that, The communication device includes: Memory is used to store computer programs or computer instructions; A processor for executing a computer program or computer instructions stored in the memory, causing the communication device to perform the communication method as described in any one of claims 1 to 15.
19. A computer program product, comprising a computer program, characterized in that, When the computer program is executed, it implements the communication method according to any one of claims 1 to 15.
20. A computer storage medium for storing a computer program, which, when executed, implements the communication method according to any one of claims 1 to 15.