Communication method, device, equipment, program product and storage medium
By adjusting the device's channel or sharing the peer WiFi network, the latency problem caused by channel switching in WiFi P2P connections is resolved, improving the user experience.
Patent Information
- Application Number
- CN202411186324.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-27
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2044-08-27
AI Technical Summary
In WiFi P2P connections, channel switching between devices causes significant latency in P2P services, impacting user experience.
By adjusting the device's STA channel and P2P channel to the same channel, or sharing the peer device's WiFi network through a P2P connection, channel switching can be avoided and co-frequency and co-channel operation can be achieved.
It effectively avoids the delay problem of P2P services and improves user experience.
Smart Images

Figure CN120751356A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a communication method, apparatus, device, program product, and storage medium. Background Art
[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 generally 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 a different channel, or using different frequencies but different channels. This requires the at least one device to time-share between the operating channel in WiFi STA mode (referred to as the STA channel) and the operating channel in WiFi P2P mode (referred to as the P2P channel). This affects P2P services on the P2P channel, resulting in significant latency and a poor user experience. Summary of the Invention
[0004] The present application provides a communication method, apparatus, device, program product, and storage medium, the purpose of which is to solve the problem of large delay in P2P services.
[0005] In order to achieve the above objectives, this application provides the following technical solutions:
[0006] A first aspect of the present application provides a communication method. Specifically, a first device receives second WiFi information of 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 own network access method based on its own WiFi connection status and the WiFi connection status of the opposite device, so that the first device can access the network with the same frequency and channel, or the first device can disconnect from the WiFi and directly share the WiFi network connected to the second device through the P2P connection. In this way, the first device can be prevented from continuously operating with the same frequency and different channel or with different frequencies and different channels, thereby avoiding the problem of large delay in P2P services caused by the need to switch different channels in time, thereby improving the user experience of P2P services.
[0008] In some possible implementations, the first WiFi information includes a first frequency, which is the frequency of the first WiFi to which the first device is connected, and the second WiFi information includes a second frequency, which is the frequency of the second WiFi to which the second device is connected. Accordingly, based on the first WiFi information and the second WiFi information of the first device, adjusting the STA channel corresponding to the first device and the P2P channel corresponding to the first device to be co-channel, or sharing the WiFi network to which the second device is connected through a P2P connection between the first and second devices, may include: adjusting the STA channel corresponding to the first device and the P2P channel corresponding to the first device to be co-channel, or sharing the WiFi network to which the second device is connected through the P2P connection between the first and second devices, based on the first frequency, the second frequency, and a third frequency, wherein the third frequency is the frequency corresponding to the first P2P connection. In this way, the first device can adaptively change its network access method based on the specific frequency of the WiFi to which it is connected, the specific frequency of the WiFi to which the peer device is connected, and the frequency corresponding to the P2P connection between the two devices, thereby avoiding the problem of large latency in P2P services.
[0009] In some possible implementations, based on the first frequency, the second frequency, and the third frequency, 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: based on the first frequency and the third frequency, determining that the first device accesses the network with the same frequency but different channel; based on the second frequency and the third frequency, determining that the second device accesses the network with the same frequency and same channel; if there is a third WiFi network with the second frequency in the connected WiFi list of the first device, switching the first device to the third WiFi network; if there is no third WiFi network with the second frequency in the connected WiFi list, sharing the second WiFi network through the first P2P connection.
[0010] In this method, for a situation where a first device accesses a network using the same frequency but different channels, and a second device accesses a network using the same frequency but same channel, the first device switches the first WiFi network to a 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, thereby aligning the frequency of the WiFi network connected to the first device with the frequency corresponding to the first P2P connection. This adjusts the STA channel corresponding to the first device and the P2P channel corresponding to the first device to be co-channel, enabling the first device to operate using the same frequency but same channel, thereby avoiding the problem of large latency in P2P services. Alternatively, the first device directly disconnects from the first WiFi network and shares 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 the first device to operate using the same frequency but different channels or using different frequencies but different channels, thereby 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, switching the first device to the third WiFi network includes: if the third WiFi network with the second frequency exists in the connected WiFi list and a WiFi quality score of the third WiFi network is greater than a first quality threshold, switching the first device to the third WiFi network. In this manner, the WiFi network switch is performed only when the WiFi quality score of the third WiFi network reaches a certain value, thereby ensuring that the P2P service can be normally carried out on the switched WiFi network and avoiding any impact on the P2P service.
[0012] In some possible implementations, the WiFi quality score of the third WiFi network is used to represent the signal strength and / or network speed of the third WiFi network. In this way, whether to switch WiFi networks can be determined based on the signal strength and / or network speed of the WiFi network.
[0013] In some possible implementations, if a third WiFi network with a second frequency exists in the connected WiFi list of the first device, switching the first device to the third WiFi network includes: if the third WiFi network with the second frequency exists in the connected WiFi list, and no second P2P service requiring high quality of service (QoS) based on the second P2P connection exists between the first device and the third device, switching the first device to the third WiFi network, where the second P2P connection is a P2P connection between the first device and the third device. This can avoid affecting P2P services requiring high QoS on other P2P connections, thereby ensuring that P2P services requiring high QoS can function normally.
[0014] In some possible implementations, the first device does not support dual-band dual concurrent (DBDC), and based on the first frequency, the second frequency, and the third frequency, 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 accesses the network with different frequencies and channels based on the first frequency and the third frequency; determining that the second device accesses the network with the same frequency and channel based on the second frequency and the third frequency; if a fourth WiFi network with the second frequency exists in the connected WiFi list of the first device, switching the first device to the fourth WiFi network; if the fourth WiFi network with the second frequency does not exist in the connected WiFi list, sharing the second WiFi network through the first P2P connection.
[0015] In this method, when a first device accesses a network using different frequencies and channels, and a second device accesses a network using the same frequency and channel, and the first device does not support DBDC, the first device switches the first WiFi network to a 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, 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 corresponding to the first device and the P2P channel corresponding to the first device to be the same channel, allowing the first device to operate on the same frequency and channel, thereby avoiding the problem of large latency in P2P services. Alternatively, the first device directly disconnects from the first WiFi network and shares 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 the first device to operate on the same frequency and channel or on different frequencies and channels, thereby avoiding the problem of large latency in P2P services.
[0016] In some possible implementations, based on the first frequency, the second frequency, and the third frequency, 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 and the third frequency, determining that the first device accesses the network with the same frequency but different channel; based on the third frequency and the second frequency, determining that the second device accesses the network with the same frequency but different channel; based on the first frequency, modifying the first P2P connection to a third P2P connection, the third P2P connection being a P2P connection between the first device and the second device.
[0017] In this method, for a situation where a first device and a second device access the network using the same frequency but different channels, if the first device can establish a P2P connection with the same frequency as the WiFi network to which the first device is connected, the frequency of the WiFi network to which the first device is connected can be made consistent with the frequency of the modified third P2P connection, thereby adjusting the STA channel corresponding to the first device and the P2P channel corresponding to the first device to be the same channel. This allows the first device to operate using the same frequency and channel, thereby avoiding the problem of large latency in P2P services.
[0018] In some possible implementations, based on the first frequency, the second frequency, and the third frequency, 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 and the third frequency, determining that the first device accesses the network with the same frequency and different channel; based on the second frequency and the third frequency, determining that the second device accesses the network with the same frequency and different channel; based on the non-dynamic frequency selection (DFS) channel in the connected WiFi list of the first device, modifying the first P2P connection to a fourth P2P connection, the fourth P2P connection being the P2P connection between the first device and the second device; based on the fourth frequency corresponding to the fourth P2P connection, switching the first device to a fifth WiFi network.
[0019] In this method, for a situation where a first device and a second device access a network using the same frequency but different channels and a P2P connection with the first frequency 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 DFS channel being used by radar and the P2P connection being unable to be established on the DFS channel. It also ensures that the first device can switch to a WiFi network with the same frequency as that corresponding to the modified P2P connection, thereby adjusting the STA channel corresponding to the first device and the P2P channel corresponding to the first device to the same channel, allowing the first device to operate with the same frequency and channel, thereby avoiding the problem of large latency in P2P services.
[0020] In some possible implementations, based on the first frequency, the second frequency, and the third frequency, 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 accesses the network with different frequencies and channels based on the first frequency and the third frequency; determining that the second device accesses the network with the same frequency and different channels based on the second frequency and the third frequency; modifying the first P2P connection to a fifth P2P connection based on the second frequency, 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 exists in the connected WiFi list of the first device, switching the first device to the sixth WiFi network; if the sixth WiFi network with the second frequency does not exist in the connected WiFi list, sharing the second WiFi network through the fifth P2P connection.
[0021] In this method, in the case where the first device accesses the network using different frequencies and channels, and the second device accesses the network using the same frequency and channel, the first device can disconnect the first P2P connection and establish a fifth P2P connection with the same frequency as the second frequency, so that the second device accesses 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, and adjust the STA channel corresponding to the first device and the P2P channel corresponding to the first device to the same channel, so that the first device can operate on the same frequency and channel, thereby avoiding the problem of large 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 it is impossible to operate on the same frequency and channel or on different frequencies and channels, thereby avoiding the problem of large latency in P2P services.
[0022] In some possible implementations, based on the first frequency, the second frequency, and the third frequency, 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 and the third frequency, determining that the first device accesses the network with different frequencies and channels; based on the second frequency and the third frequency, determining that the second device accesses the network with the same frequency and different channels; based on the non-DFS channel in the connected WiFi list of the first device, modifying the first P2P connection to the sixth P2P connection, the sixth P2P connection being the P2P connection between the first device and the second device; based on the fifth frequency corresponding to the sixth P2P connection, switching the first device to connect to the seventh WiFi network.
[0023] In this method, for the situation where a first device accesses the network with different frequencies and channels, and a second device accesses the network with the same frequency and channel, and a P2P connection with the same frequency as the second frequency 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 DFS channel being used by radar and the P2P connection being unable to be established on the DFS channel, and ensures that the first device can switch to the WiFi with the same frequency as the modified P2P connection. This adjusts the STA channel corresponding to the first device and the P2P channel corresponding to the first device to the same channel, allowing the first device to operate with the same frequency and channel, thereby avoiding the problem of large latency in P2P services.
[0024] In some possible implementations, the method further includes: receiving second DBDC information of the second device based on the first P2P connection, the second DBDC information being used to indicate 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 be the same channel based on the first frequency, the second frequency, and the 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 with different frequencies and channels based on the first frequency and the third frequency; determining that the second device accesses the network with different frequencies and channels based on the second frequency and the third frequency; determining that the first device accesses the network with different frequencies and channels based on the first DBDC information and the second DBDC information. The first device and the second device do not support DBDC, and the first DBDC information is used to indicate whether the first device supports DBDC; the first device is switched to be connected to the eighth WiFi network based on the third frequency point, and the third WiFi information of the first device is obtained; the fourth WiFi information of the second device is received based on the first P2P connection; the fifth WiFi information is the WiFi information corresponding to the second device after the second device is switched to be connected 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 corresponding to the first device and the 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 between the first device and the second device.
[0025] In this method, when a first device and a second device access the network at different frequencies and channels, and the first device and the second device do not support DBDC, the second device and the first device will attempt to switch and connect to WiFi with the same frequency band as the first P2P connection. This may result in the first device accessing the network at the same frequency and channel, and the second device accessing the network at the same frequency and channel. Alternatively, the first device and the second device access the network at the same frequency and channel. Based on this, the WiFi information of the first device and the second device has changed. The first device can re-acquire the WiFi information of the second device and, based on the changed WiFi information of the first device and the changed WiFi information of the second device, adaptively change its own network access method, so that the first device operates at the same frequency and channel, or shares the WiFi connected to the second device through the P2P connection between the first device and the second device. This can avoid the problem of large latency in P2P services.
[0026] In some possible implementations, the method further includes: receiving second DBDC information of the second device based on the first P2P connection, the second DBDC information being used to indicate whether the second device supports DBDC; sharing the WiFi network connected to the second device through the P2P connection between the first device and the second device based on the first frequency, the second frequency, and the third frequency, including: determining, based on the first frequency and the third frequency, that the first device accesses the network using different frequencies and channels; determining, based on the second frequency and the third frequency, that the second device accesses the network using different frequencies and channels; determining, based on the first DBDC information and the second DBDC information, that the first device does not support DBDC and that the second device supports DBDC, the first DBDC information being used to indicate whether the first device supports DBDC; and sharing the second WiFi network through the first P2P connection.
[0027] In this method, when the first device and the second device access the network at different frequencies and channels, and the second device supports DBDC, the second device can simultaneously utilize resources in two frequency bands without changing the working mode of the second device. 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 the first device to operate at the same frequency and different channels or at different frequencies and different channels, thereby avoiding the problem of large delay in P2P services.
[0028] In some possible implementations, before the first device receives the second WiFi information from the second device, the first device will establish a first P2P connection. If the service requirements corresponding to the first P2P service include WiFi switching, the first device will send the first WiFi information 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. In this way, the first device will only exchange WiFi information with the second device and perform operations such as WiFi switching when there is a need for WiFi switching in the first P2P service, thereby avoiding WiFi information exchange, WiFi switching and other operations for any P2P service, and saving computing resources to a certain extent. Moreover, sending the first WiFi information to the second device allows the second device to adaptively change its own network access method, so that the second device can also access the network with the same frequency and channel, further avoiding the problem of large latency in P2P services.
[0029] In some possible implementations, the first device may transmit fifth WiFi information of the first device to the second device based on the P2P connection between the first and second devices. The fifth WiFi information is WiFi information corresponding to the first device adjusting the STA channel and the P2P channel to the same channel or sharing the WiFi network connected to the second device. The first device then transmits the modified WiFi information to the peer device, allowing the second device to understand the latest WiFi connection status of the first device. This allows the second device to consider the WiFi connection status of the first device when making subsequent adjustments to existing P2P connections with other devices.
[0030] In some possible implementations, the first device is in a WiFi roaming state and detects a tenth WiFi network. The method may further include: if a 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 a sixth frequency 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 to another WiFi network. This ensures that the switched WiFi network is available and avoids any impact on P2P services. Furthermore, the P2P connection between the first and second devices is modified simultaneously, ensuring that the first device continues to operate on the same frequency and channel, avoiding significant latency issues for P2P services.
[0032] A second aspect of the present application provides a communication device, which is applied to a first device, and includes: a P2P connection module and a WiFi switching algorithm module, wherein the P2P connection module includes a WiFi information exchange module;
[0033] A WiFi information exchange module, configured to receive 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, where the first P2P connection is a P2P connection between the first device and the second device;
[0034] The WiFi switching algorithm module is configured to determine, based on the first WiFi information and the second WiFi information of the first device, whether to adjust the STA channel corresponding to the first device and the P2P channel corresponding to the first device to be 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 further include: a session management module;
[0036] A session management module, configured to determine a service requirement corresponding to the first P2P service;
[0037] A P2P connection module, configured to establish a first P2P connection;
[0038] The WiFi information exchange module is further used to send the first WiFi information to the second device based on the first P2P connection if the service demand 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 implementation of the first aspect. The 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 functions.
[0040] A third aspect of the present application provides a communication system, the system comprising a first device and a second device;
[0041] The second device is configured to send 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 configured to receive second WiFi information based on the first P2P connection;
[0043] The first device is configured to adjust, based on the first WiFi information and the second WiFi information of the first device, a STA channel corresponding to the first device and a P2P channel corresponding to the first device to be a same channel, or to share a WiFi network connected to the second device through a P2P connection between the first device and the second device.
[0044] The communication system has the function of implementing the communication method in the above-mentioned first aspect or any possible implementation manner of the first aspect.
[0045] A fourth aspect of the present application provides a communication device, comprising: a memory and at least one processor. The memory is configured to store a computer program or computer instructions, and the at least one processor is configured to execute the computer program or computer instructions stored in the memory, so that the communication device implements the communication method of the first aspect of the present application or any optional embodiment of the first aspect.
[0046] The fifth method of the present application provides a computer program product, including a computer program, which, when executed, is used to implement the communication method in the first aspect of the present application or any optional implementation of the first aspect.
[0047] The sixth aspect of the present application provides a computer storage medium for storing a computer program. When the computer program is executed, it is used to implement the communication method in the first aspect of the present application or any optional implementation method in the first aspect.
[0048] A seventh aspect of the present application provides a chip system, which includes a processor for supporting a device to implement the functions involved in the above aspects, for example, sending or processing the data and / or information involved in the above methods. In one possible design, the chip system also includes a memory for storing program instructions and data necessary for the device. The chip system can be composed of a chip or can include a chip and other discrete devices.
[0049] The eighth aspect of the present application provides a chip comprising one or more interface circuits and one or more processors; the interface circuit is used to receive signals from a memory of an electronic device and send signals to the processor, the signals comprising computer instructions stored in the memory; when the processor executes the computer instructions, the electronic device executes the communication method in the first aspect or any optional embodiment of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 A schematic diagram of a scenario in which a first device accesses a network using the same frequency but different channels, and a second device accesses a network using the same frequency and same channel, provided in an embodiment of the present application;
[0051] Figure 2 A flow chart of a communication method provided in an embodiment of the present application;
[0052] Figure 3 A flowchart of another communication method provided in an embodiment of the present application;
[0053] Figure 4 A schematic diagram of a scenario for changing a device's network access method provided in an embodiment of the present application;
[0054] Figure 5 Schematic diagram of a scenario for connecting devices within a trust ring provided in an embodiment of the present application
[0055] Figure 6 A schematic diagram of another scenario for changing a device's network access method provided in an embodiment of the present application;
[0056] Figure 7 A schematic diagram of another scenario for changing a device's network access method provided in an embodiment of the present application;
[0057] Figure 8 A schematic diagram of another scenario for changing a device's network access method provided in an embodiment of the present application;
[0058] Figure 9 A schematic diagram of another scenario for changing a device's network access method provided in an embodiment of the present application;
[0059] Figure 10 A schematic diagram of a scenario for changing device connection during channel roaming provided in an embodiment of the present application;
[0060] Figure 11a A flowchart of another communication method provided in an embodiment of the present application;
[0061] Figure 11b A flow chart of another communication method provided in an embodiment of the present application;
[0062] Figure 12 A schematic diagram of the structure of a communication device provided in an embodiment of the present application;
[0063] Figure 13 A schematic diagram of the structure of another communication device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0064] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. The terms used in the following embodiments are only for the purpose of describing specific embodiments and are not intended to be limiting of the present application. As used in the specification and appended claims of the present application, the singular expressions "one", "a kind of", "said", "above", "the" and "this" are intended to also include expressions such as "one or more", unless there is a clear contrary indication in the context. It should also be understood that in the embodiments of the present application, "one or more" refers to one, two or more; "and / or" describes the association relationship of associated objects, indicating that three relationships may exist; for example, A and / or B can represent: the existence of A alone, the existence of A and B at the same time, and the existence of B alone, where A and B can be singular or plural. The character " / " generally indicates that the related objects before and after are in an "or" relationship.
[0065] References to "one embodiment" or "some embodiments" in this specification mean that a particular feature, structure, or characteristic described in conjunction with that embodiment is included in one or more embodiments of the present application. Thus, phrases such as "in one embodiment," "in some embodiments," "in other embodiments," and "in yet other embodiments" appearing in various places in 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 "including," "comprising," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.
[0066] The "multiple" involved in the embodiments of the present application means greater than or equal to two. It should be noted that in the description of the embodiments of the present application, the words "first" and "second" are only used for the purpose of distinguishing the description and cannot be understood as indicating or implying relative importance or order.
[0067] In the embodiments provided herein, the first device and the second device may be terminals, which may be in various forms, such as mobile phones, tablet computers, computers with wireless transceiver functions, virtual reality (VR) terminal devices, augmented reality (AR) terminal devices, wireless terminals in industrial control, vehicle-mounted terminal devices, wireless terminals in self-driving, wireless terminals in remote medical, wireless terminals in smart grids, wireless terminals in transportation safety, wireless terminals in smart cities, wireless terminals in smart homes, wearable terminal devices, etc. The terminal may also be sometimes referred to as a terminal device, user equipment (UE), access terminal device, vehicle-mounted terminal, industrial control terminal, UE unit, UE station, mobile station, mobile station, remote station, remote terminal device, mobile device, UE terminal device, terminal device, wireless communication device, UE agent, or UE device, etc. The terminal may also be a fixed terminal or a mobile terminal.
[0068] In order to more clearly illustrate the technical solution of this application, the relevant concepts involved in this application are explained below.
[0069] Frequency band. In the field of communications, frequency band refers to the frequency range of electromagnetic waves. Currently, the commonly used frequency bands of WiFi networks include: 2.4G, 5G, 6G and other bands.
[0070] A channel is the path through which signals travel within a communication system. It consists of the transmission medium through which signals travel from the transmitter to the receiver. Each frequency band commonly used in WiFi networks is divided into multiple channels. For example, according to the IEEE 802.11 protocol, the 2.4 GHz Wi-Fi band is divided into 13 overlapping channels, each 22 MHz wide (each channel has a bandwidth of 20 MHz in the IEEE 802.11g and IEEE 802.11n standards, and 22 MHz in the IEEE 802.10B standard). The 5 GHz Wi-Fi band is divided into 201 channels.
[0071] DFS is one of the features of the 5G wireless frequency band. Originally, DFS channels were reserved only for specific radar signals, such as military radar, satellite communications, and weather radar. Now that relevant channels are open for use in accordance with relevant specifications, DFS channels can increase the number of wireless channels that can be used. When using DFS channels, a Channel Availability Check process (CAC) must be performed to avoid electromagnetic interference to radar when using DFS channels. Domestic DFS channels can include channels with frequencies of 5260MHz, 5280MHz, 5300MHz, 5320MHz, etc.
[0072] Frequency refers to the specific frequency assigned to a specific wireless channel in a wireless communication system.
[0073] WiFi P2P is a peer-to-peer (P2P) WiFi standard launched by the WiFi Alliance. A WiFi P2P connection (P2P connection for short) is typically established 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 the need for a local area network (LAN) or access point (AP). It should be noted that the P2P connection in the embodiments of this application refers to a WiFi P2P connection.
[0074] P2P sharing is a resource sharing method based on P2P connections, which allows two-end devices in a P2P connection to directly share resources and services, such as files, computing power, storage space, etc.
[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 direct connection channels through WiFi P2P connections.
[0077] Same frequency and same channel means that electronic devices operate in WiFi STA mode and WiFi P2P mode in the same frequency band and the same channel.
[0078] Same-frequency, different-channel mode means that electronic devices can operate in Wi-Fi STA mode and Wi-Fi P2P mode on different channels within the same frequency band. These devices must time-share between the Wi-Fi STA mode operating channel (referred to as the STA channel) and the Wi-Fi P2P mode operating channel (referred to as the P2P channel). For example, with a 100ms / 100ms timeshare and a 20ms switching time, the device will switch to the P2P channel after operating on the STA channel for 100ms. This switching process takes 20ms, and after switching to the P2P channel for 100ms, it will switch back to the STA channel.
[0079] Different frequency and different channels means that electronic devices operate in WiFi STA mode and WiFi P2P mode in different frequency bands and channels. If the electronic device does not support DBDC, the electronic device needs to switch between the STA channel and the P2P channel in a time-sharing manner.
[0080] DBDC: This allows an electronic device to operate simultaneously on two channels in different frequency bands. For example, a device can operate simultaneously on a 2.4 GHz STA channel and a 5 GHz P2P channel. Operating modes other than DBDC, such as dual-band single concurrent (DBSC), dual-band adaptive concurrent (DBAC), and same-frequency same-channel modes, do not support simultaneous operation of two channels; they only support time-division multiplexing of two channels.
[0081] See also Figure 1 , is a schematic diagram of a scenario disclosed in an embodiment of the present application in which a first device accesses the network using the same frequency but different channel, and a second device accesses the network using the same frequency and same channel. Figure 1 In the example, a mobile phone is connected to WiFi 1 at a frequency of 5200MHz, and a tablet is connected to WiFi 2 at a frequency of 5180MHz. After the mobile phone and tablet establish a P2P connection at a frequency of 5180MHz, the mobile phone accesses the network using the same frequency but different channels, and the tablet accesses the network using the same frequency and channel. The mobile phone then operates in WiFi STA mode on the 5200MHz channel and in WiFi P2P mode on the 5180MHz channel, splitting the time between the two. That is, the mobile phone operates in the same frequency but different channels. As a result, P2P services conducted through the P2P channel are interrupted at regular intervals, resulting in significant latency for P2P services and a poor user experience.
[0082] To this end, the embodiments of the present 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 operate on the same frequency and channel, or share the WiFi network connected to the peer device through a P2P connection, thereby avoiding the problem of large delays in P2P services.
[0083] See also Figure 2 , Figure 2 A flow chart of a communication method provided for the implementation of this application, which can be performed by a communication system, which can include a first device and a second device. The communication method provided in this embodiment of the application 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 the embodiment of the present application, after a first P2P connection is established between the first device and the second device, the first device will send the first WiFi information of the first device to the second device based on the first P2P connection, and the second device will send the second WiFi information of the second device 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. Signal strength may include a received signal strength indicator (RSSI). Accordingly, the first WiFi information may include a first frequency and a first WiFi quality score. The first WiFi quality score 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. The second WiFi quality score 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 the embodiment of the present application, after the first device sends the first WiFi information, the second device will receive the first WiFi information based on the first P2P connection. After the second device sends the second WiFi information, the first device will receive the second WiFi information based on the first P2P connection, thereby realizing the exchange of WiFi information on both ends.
[0090] S203: 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 based on the first WiFi information and the second WiFi information, or shares the WiFi network connected to the second device through the P2P connection between the first device and the second device.
[0091] In an embodiment of the present application, the first device can adjust the STA channel corresponding to the first device 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 the two ends; alternatively, the first device can also share the WiFi network connected to the second device through the first P2P connection or the modified P2P connection based on the WiFi information of the two ends.
[0092] It can be seen that in the embodiment of the present 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 own network access method based on its own WiFi network connection status and the WiFi network connection status of the opposite device, so that the first device operates with the same frequency and channel, or the first device disconnects from the WiFi network and directly shares the WiFi network connected to the second device through the P2P connection. This can avoid the first device from continuously operating with the same frequency and different channel or operating with different frequencies and different channels, thereby avoiding the problem of large delay in P2P services caused by the need to switch different channels in time, thereby improving the user experience of P2P services.
[0093] See also Figure 3 , Figure 3 A flow chart of another communication method provided for the implementation of this application, which can be performed by a communication system, which can include a first device and a second device. The communication method provided in this embodiment of the application may include:
[0094] S301: A first device determines a service demand corresponding to a first P2P service.
[0095] Among them, the first P2P service is a P2P service initiated between the first device and the second device. P2P services can be divided into two categories, generally referred to as: P2P services with high QoS requirements and P2P services with low QoS requirements. High QoS requirements refer to the demand for strict standards for service quality in network communications, including ensuring sufficient transmission bandwidth, low latency, low packet loss rate, etc., to ensure that critical applications are given priority in the network, thereby improving the overall network communication service quality. Low QoS requirements are relatively relaxed. In situations where network resources are limited or in specific application scenarios, the requirements for service quality are not high, and a certain degree of delay, packet loss, etc. are allowed to occur.
[0096] Service requirements can include WiFi switching, stopping scanning, and prioritizing transmission. Generally, P2P services with high QoS requirements also require WiFi switching. These services include screen mirroring and audio sharing, while P2P services with low QoS requirements include background messaging.
[0097] S302: The first device establishes a 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 first WiFi information to the second device based on the first P2P connection.
[0100] In the embodiment of the present application, the first device only exchanges WiFi information with the second device and performs operations such as WiFi switching when the first P2P service requires WiFi switching. This avoids performing WiFi information exchange and WiFi switching operations for any P2P service, saving computing resources to a certain extent. Furthermore, sending the first WiFi information to the second device allows the second device to adaptively change its network access method, allowing the second device to access the network using the same frequency and channel, further avoiding the problem of large latency in P2P services.
[0101] In a possible implementation, in an embodiment of the present application, the first device may send first WiFi information and first DBDC support information to the second device based on the first P2P connection, where the first DBDC information is used to indicate whether the first device supports DBDC.
[0102] S304: The second device receives 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 the embodiment of the present application, the second device sends the second WiFi information to the first device after receiving the first WiFi information. In the embodiment of the present application, if the service requirements corresponding to the first P2P service do not include WiFi switching, after the first device establishes the first P2P connection, it will directly perform the first P2P service based on the first P2P connection. That is, after the first P2P connection is established, the first device will not send the first WiFi information or receive the second WiFi information, and the second device will not send the second WiFi information or receive the first WiFi information.
[0105] The first WiFi information includes a first frequency, which is the frequency of the first WiFi to which the first device is connected. The second WiFi information includes a second frequency, which is the frequency of the second WiFi to which the second device is connected. It is understood that the first WiFi information and the second WiFi information are the same as those in the above embodiment, and the same parts are not repeated here.
[0106] In a possible implementation, in an embodiment of the present application, the second device may send second WiFi information and second DBDC support information to the first device based on the first P2P connection, where 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 corresponding to the first device and the P2P channel corresponding to the first device to be the same channel based on the first frequency, the second frequency, and the third frequency, 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 is the frequency corresponding to the first P2P connection.
[0110] In one possible implementation, the first device in an embodiment of the present application can 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 first frequency, the second frequency, the third frequency, 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 the embodiment of the present application, the first device can adjust the STA channel corresponding to the first device 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 of the WiFi network connected at the two ends; alternatively, the first device can also share the WiFi network connected to the second device through the first P2P connection or the modified P2P connection based on the specific frequency of the WiFi network connected at the two 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 be the same channel based on the first frequency, the second frequency, and the third frequency, or maintains the existing network access mode.
[0113] In the embodiment of the present application, the second device can adjust the STA channel corresponding to the second device and the 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 to which the two ends are connected; alternatively, the second device can determine, based on the specific frequency of the WiFi network to which the two ends are connected, whether the second device is accessing the network with the same frequency and channel or whether the second device is accessing the network with different frequencies and channels and supports DBDC, and the second device can maintain the existing network access method.
[0114] In one possible implementation, the second device in the embodiment of the present application can adjust 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, the second frequency, 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] Among them, the fifth WiFi information is the WiFi information corresponding to the first device adjusting the STA channel and the 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 changing the network access method. The third WiFi information may include a third frequency and a third network speed, etc.
[0117] In the embodiment of the present application, the first device will send the changed WiFi information of the first device to the peer device, so that the second device can understand the latest WiFi network connection status of the first device. This facilitates the subsequent adjustment of the WiFi network connection of the second device to other devices when the second device has a P2P connection. Correspondingly, if the WiFi information of the second device changes, the second device will also send the changed WiFi information of the second device to the first device.
[0118] It can be seen that in the embodiment of the present application, the first device and the second device can adaptively change their own network access methods based on the service requirements corresponding to the P2P service, the specific frequency of the WiFi network to which they are connected, and the specific frequency of the WiFi network to which the opposite device is connected, thereby avoiding the problem of large delay in P2P services with high QoS requirements.
[0119] See also Figure 4, is a schematic diagram of a scenario for changing the device network access method disclosed in an embodiment of the present application. The embodiment of the present application is described by taking the first device as a mobile phone and the second device as a tablet computer as an example. In the left half sub-figure, the mobile phone is connected to a WiFi network with a frequency of 5785MHz, and the tablet computer is connected to a WiFi network with a frequency of 5180MHz. The mobile phone and the tablet computer establish a P2P connection with a frequency of 5180MHz. Both 5785MHz and 5180MHz are frequencies in the 5G frequency band. In this way, the mobile phone accesses the network with the same frequency but different channels, and the tablet computer accesses the network with the same frequency and the same channel. In the right half sub-figure, 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 through a P2P connection with a frequency of 5180MHz; the tablet computer maintains the existing network access method. It can be understood that, Figure 4 This is merely an example and should not be construed as limiting the embodiments of the present application. Accordingly, in a scenario where a first device accesses the network using the same frequency but different channels, and a second device accesses the network using the same frequency and same channel, the communication method provided in the embodiments of the present application may include:
[0120] S401. The first device determines, based on the first frequency and the third frequency, that the first device accesses the network using the same frequency but different channel.
[0121] S402: The first device determines, based on the second frequency and the third frequency, that the second device accesses the network using the same frequency and channel.
[0122] Among them, the first frequency is the frequency of the first WiFi network connected to the first device, the second frequency is the frequency of the second WiFi network connected to the second device, and the third frequency is the frequency corresponding to the first P2P connection. The first P2P connection is the current P2P connection between the first device and the second device.
[0123] It can be understood that, in the embodiment of the present application, after the first device 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 switches the first device 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 may be a different WiFi network as the second WiFi network, but have the same frequency.
[0126] The connected WiFi list refers to a collection of WiFi networks that the device is currently connected to or has previously connected to. This list typically displays the name of each WiFi network and may also display other information such as signal strength or security type. In embodiments of the present application, the connected WiFi list of the first device may include the first WiFi information.
[0127] In one possible implementation, S403 in the embodiment of the present application may include: 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, switching the first device to the third WiFi network. The first quality threshold can be set based on actual circumstances and is not limited in the embodiment of the present application. However, the WiFi network must ensure that the WiFi quality score of the WiFi network is greater than the first quality threshold for the network to function properly. This ensures that the WiFi network is switched only when the WiFi quality score of the third WiFi network reaches a certain value, ensuring that the P2P service can function normally on the switched WiFi network and avoiding any impact on the P2P service.
[0128] See also Figure 5 , is a schematic diagram of a scenario of device connection in a trust ring disclosed in an embodiment of the present application. In this embodiment of the present application, the first device is Figure 5 The phone in the middle, the second device is Figure 5 The tablet on the left, the third device is Figure 5 Take the mobile phone on the right as an example for explanation. There are the first device, the second device and the third device in the trust ring. The first device and the third device are performing P2P services with high QoS requirements. At this time, if the WiFi network connected to the first device, the second device or the third device is switched, the P2P services with high QoS requirements may be affected. To this end, in a possible implementation method, S403 in the embodiment of the present application may include: if there is a third WiFi network with a 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 first device is switched to the third WiFi network. Among them, the second P2P connection is the P2P connection between the first device and the third device. In this way, it can avoid affecting the P2P services with high QoS requirements on other P2P connections and ensure that the P2P services with high QoS requirements are carried out normally.
[0129] S404: If the third WiFi network with the second frequency does not exist in the connected WiFi list, the first device shares the second WiFi network through the first P2P connection.
[0130] S405: The second device determines, based on the first frequency and the third frequency, that the first device accesses the network using the same frequency but different channel.
[0131] S406. The second device determines, based on the second frequency and the third frequency, that the second device accesses the network using the same frequency and channel.
[0132] It can be understood that, in the embodiment of the present application, after the second device 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 maintains the existing network access mode.
[0134] It should be noted that the second device determines that it accesses the network with the same frequency and channel, and the other device accesses the network with the same frequency but different channel. It can be determined that its existing network access method will not affect the P2P business, and there is no need to change its existing network access method. It will continue to maintain the existing network access method.
[0135] It can be seen that in the embodiment of the present application, for the situation where the first device accesses the network with the same frequency and different channel, and the second device accesses the network with 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, thereby making the frequency of the WiFi network connected to the first device consistent with the frequency corresponding to the first P2P connection, and adjusting the STA channel corresponding to the first device and the P2P channel corresponding to the first device to the same channel, so that the first device can operate with the same frequency and the same channel, thereby avoiding the problem of large delay 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 to operate with the same frequency and different channel or with different frequencies and different channels, thereby avoiding the problem of large delay in P2P services.
[0136] See also Figure 6, is a schematic diagram of another scenario of changing the device network access method disclosed in an embodiment of the present application. The embodiment of the present application is described by taking the first device as a mobile phone and the second device as a tablet computer as an example. In the left half of the sub-figure, the mobile phone is connected to a WiFi network with a frequency of 2417MHz, and the tablet computer is connected to a WiFi network with a frequency of 5180MHz. The mobile phone and the tablet computer establish a P2P connection with a frequency of 5180MHz. 5180MHz is a frequency in the 5G band, and 2417MHz is a frequency in the 2.4G band. In this way, the mobile phone accesses the network with different frequencies and channels, and the tablet computer accesses the network with the same frequency and channel. In the right half of the sub-figure, if the mobile phone does not support DBDC, the mobile phone switches to connect to the WiFi network with a frequency of 5180MHz, or shares the WiFi network connected to the tablet computer through a P2P connection with a frequency of 5180MHz; the tablet computer maintains the existing network access method. It can be understood that the above is only an exemplary description and should not be understood as a limitation to the embodiment of the present application. Accordingly, in the scenario where the first device accesses the network with different frequencies and channels, and the second device accesses the network with the same frequency and channel, the communication method provided in the embodiment of the present application may include:
[0137] S601. The first device determines, based on the first frequency and the third frequency, that the first device accesses the network using different frequencies and channels.
[0138] In the embodiment of the present application, it can also be determined based on the first DBDC information that the first device does not support DBDC. The first device then performs corresponding operations based on the dual-end network access method and its own DBDC support status.
[0139] S602: The first device determines, based on the second frequency and the third frequency, that the second device accesses the network using the same frequency and channel.
[0140] It can be understood that the first frequency point, the second frequency point and the third frequency point in the embodiment of the present application are the same as the first frequency point, the second frequency point and the third frequency point in the above embodiment, so they are not repeated here.
[0141] S603: If a fourth WiFi network with the second frequency exists in the connected WiFi list of the first device, the first device switches the first device to the fourth WiFi network.
[0142] It can be understood that S603 in the embodiment of the present application is similar to S403 in the above embodiment, so it will not be described in detail.
[0143] S604: If the fourth WiFi network with the second frequency does not exist in the connected WiFi list, the first device shares the second WiFi network through the first P2P connection.
[0144] It can be understood that S604 in the embodiment of the present application is similar to S404 in the above embodiment, so it will not be described in detail.
[0145] S605: The second device determines, based on the first frequency and the third frequency, that the first device accesses the network using the same frequency but different channel.
[0146] S606. The second device determines, based on the second frequency and the third frequency, that the second device accesses the network using the same frequency and channel.
[0147] S607: The second device determines that the second device maintains the existing network access mode.
[0148] It should be noted that in the scenario where the first device accesses the network with different frequencies and channels, and the second device accesses the network with the same frequency and channel, if the first device supports DBDC, the first device can simultaneously utilize the resources of the 5G frequency band and the 2.4G frequency band. In this way, the first device and the second device do not need to change the network access method and can continue to maintain the existing network access method.
[0149] It can be seen that in the embodiment of the present application, for the situation where the first device accesses the network with different frequencies and channels, and the second device accesses the network with 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, thereby making the frequency of the WiFi network connected to the first device consistent with the frequency corresponding to the first P2P connection, and adjusting the STA channel corresponding to the first device and the P2P channel corresponding to the first device to the same channel, so that the first device can operate with the same frequency and channel, thereby avoiding the problem of large delay in P2P services; alternatively, 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 to operate with the same frequency and different channel or with different frequencies and different channels, thereby avoiding the problem of large delay in P2P services.
[0150] See also Figure 7, which is another schematic diagram of a scenario for changing the working mode of a device disclosed in an embodiment of the present application. The embodiment of the present application is described by taking a mobile phone as the first device and a tablet computer as the second device. In the left half of the sub-figure, the mobile phone is connected to a WiFi network with a frequency of 5280MHz, and the tablet computer is connected to a WiFi network with a frequency of 5280MHz. The STA channels corresponding to the mobile phone and the tablet computer are DFS channels. The mobile phone and the tablet computer establish a P2P connection with a frequency of 5180MHz. 5180MHz and 5280MHz are frequencies in the 5G frequency band. In this way, the mobile phone and the tablet computer both access the network with the same frequency but different channels. The P2P connection between the mobile phone and the tablet will be modified in the right half of the sub-graph, that is, the original P2P connection with a frequency of 5180MHz will be disconnected, and the mobile phone and the tablet will establish a P2P connection on the DFS channel with a frequency of 5280MHz; if subject to other restrictions, such as a radar currently using the DFS channel, etc., a P2P connection with a frequency of 5280MHz cannot be established, and the mobile phone determines the non-DFS channel in the connected WiFi list based on the mobile phone's connected WiFi list, disconnects the original P2P connection with a frequency of 5180MHz, and establishes a P2P connection on a non-DFS channel with a frequency of 5785MHz. The mobile phone and the tablet will switch to connect to the WiFi network with a frequency of 5780MHz. It will be understood that the above is only an exemplary description and should not be understood as a limitation on the embodiments of the present application. Accordingly, in the scenario where the first device and the second device access the network with the same frequency but different channels, the embodiments of the present application provide two communication methods.
[0151] The first communication method may include:
[0152] S701a: The first device determines, based on the first frequency and the third frequency, that the first device accesses the network using the same frequency but different channel.
[0153] S702a: The first device determines, based on the second frequency and the third frequency, that the second device accesses the network using the same frequency but different channel.
[0154] It can be understood that the first frequency point, the second frequency point and the third frequency point in the embodiment of the present application are the same as the first frequency point, the second frequency point and the third frequency point in the above embodiment, so they are not repeated here.
[0155] S703a: The first device modifies the first P2P connection into a third P2P connection based on the first frequency.
[0156] The third P2P connection is a P2P connection between the first device and the second device, and the frequency corresponding to the third P2P connection is the same as the first frequency. Modifying 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, based on the first frequency and the third frequency, that the first device accesses the network using the same frequency but different channel.
[0158] S705a: The second device determines, based on the second frequency and the third frequency, that the second device accesses the network using the same frequency but different channel.
[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 mode.
[0160] S707a: If the first frequency and the second frequency are different, and there is an eleventh WiFi network with the first frequency in the connected WiFi list of the second device, the second device switches to connect to the eleventh WiFi network.
[0161] S708a: If the first frequency is different from the second frequency, and the connected WiFi list of the second device does not include an eleventh WiFi network with the first frequency, the second device shares the first WiFi network through a third P2P connection.
[0162] It can be seen that in the method in the embodiment of the present application, for the case where the first device and the second device access the network with the same frequency but different channels, if the first device can establish a P2P connection with the same frequency as the WiFi connected to the first device, the frequency of the WiFi network connected to the first device can be made consistent with the frequency of the modified third P2P connection, thereby adjusting the STA channel corresponding to the first device and the P2P channel corresponding to the first device to the same channel. In this way, the first device can operate with the same frequency and the same channel, and the second device can also adjust the STA channel corresponding to the second device and the P2P channel corresponding to the second device to the same channel based on the specific frequencies of both ends and the frequency corresponding to the P2P connection, or share the first WiFi network through P2P, thereby avoiding the problem of large delay in P2P services.
[0163] The second communication method may include:
[0164] S701b: The first device determines, based on the first frequency and the third frequency, that the first device accesses the network using a same-frequency but different-channel method.
[0165] S702b: The first device determines, based on the second frequency and the third frequency, that the second device accesses the network using the same frequency but different channel.
[0166] It can be understood that the first frequency point, the second frequency point and the third frequency point in the embodiment of the present application are the same as the first frequency point, the second frequency point and the third frequency point in the above embodiment, so they are not repeated here.
[0167] S703b: The first device modifies the first P2P connection into a fourth P2P connection based on a non-DFS channel in the connected WiFi list of the first device.
[0168] The fourth P2P connection is a P2P connection between the first device and the second device, and the frequency of the fourth P2P connection is the same as the frequency of the non-DFS channel. Modifying 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 a DFS channel and the current DFS channel is used by the radar, a P2P connection with the same frequency as the first frequency cannot be established, so a non-DFS channel will be selected to establish a P2P connection.
[0170] S704b: The first device switches the connection of the first device to the fifth WiFi network based on the fourth frequency corresponding to the fourth P2P connection.
[0171] Among them, the frequency of the fifth WiFi network is the same as the fourth frequency.
[0172] S705b: The first device sends the sixth WiFi information of the first device 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 the network access method is changed, that is, the WiFi information of the fifth WiFi network.
[0174] S706b: The second device determines, based on the first frequency and the third frequency, that the first device accesses the network using the same frequency but different channel.
[0175] S707b: The second device determines, based on the second frequency and the third frequency, that the second device accesses the network using the same frequency but different channel.
[0176] S708b: The second device switches the connection of the second device to the twelfth WiFi network based on the fourth frequency corresponding to the fourth P2P connection, or shares the fifth WiFi network through the fourth P2P connection.
[0177] It should be noted that if there is a WiFi network with the fourth frequency in the connected WiFi list of the second device, the second device will switch the second device to the WiFi network, that is, switch the second device to the twelfth WiFi network; if there is no WiFi network with the fourth frequency in the connected WiFi list, the second device will share the fifth WiFi network connected by the first device through the fourth P2P connection.
[0178] The twelfth WiFi network and the fifth WiFi network may be the same WiFi network, or may be different WiFi networks but have the same frequency.
[0179] It can be seen that in the implementation of this application, for the situation where the first device and the second device access the network with the same frequency but different channels, the first device modifies the P2P connection based on the non-DFS channel in the connected WiFi list of the first device. This avoids the DFS channel being 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, and adjusts the STA channel corresponding to the first device and the P2P channel corresponding to the first device to the same channel, so that the first device can operate with the same frequency and channel. The second device can also adjust the STA channel corresponding to the second device and the P2P channel corresponding to the second device to the same channel based on the specific frequencies of the two ends and the frequency corresponding to the P2P connection, or share the first WiFi network through P2P, thereby avoiding the problem of large latency in P2P services.
[0180] See also Figure 8 , is another schematic diagram of a scenario of changing the device network access method disclosed in an embodiment of the present application. The embodiment of the present application is described by taking the first device as a mobile phone and the second device as a tablet computer as an example. In the left half of the sub-graph, the mobile phone is connected to a WiFi network with a frequency of 2417MHz, and the tablet computer is connected to a WiFi network with a frequency of 5280MHz. The mobile phone and the tablet computer establish a P2P connection with a frequency of 5785MHz. 5280MHz and 5785MHz are frequencies in the 5G band, and 2417MHz is a frequency in the 2.4G band. In this way, the mobile phone accesses the network with different frequencies and channels, and the tablet computer accesses the network with the same frequency and channels. If a P2P connection with a frequency of 5280MHz can be established in the right half of the sub-graph, it degenerates into a scenario in which the mobile phone accesses the network with different frequencies and channels, and the tablet computer accesses the network with the same frequency and channel. The corresponding processing is then the same as Figure 6 Similar, no further details will be given here; if a P2P connection with a frequency of 5280MHz cannot be established, the mobile phone and tablet computer determine the non-DFS channel in the connected WiFi list based on the mobile phone's connected WiFi list, disconnect the original P2P connection with a frequency of 5785MHz, establish a P2P connection on a non-DFS channel with a frequency of 5180MHz, and the mobile phone and tablet computer switch to connect to the WiFi network with a frequency of 5180MHz. It will be understood that the above is only an exemplary description and should not be understood as a limitation on the embodiments of the present application. Accordingly, in the scenario where the first device accesses the network with different frequencies and channels, and the second device accesses the network with the same frequency and channels, the embodiments of the present application provide two communication methods.
[0181] The first communication method includes:
[0182] S801a: The first device determines, based on the first frequency and the third frequency, that the first device accesses the network using different frequencies and channels.
[0183] S802a: The first device determines, based on the second frequency and the third frequency, that the second device accesses the network using the same frequency but different channel.
[0184] It can be understood that the first frequency point, the second frequency point and the third frequency point in the embodiment of the present application are the same as the first frequency point, the second frequency point and the third frequency point in the above embodiment, so they are not repeated here.
[0185] S803a: The first device modifies the first P2P connection into a fifth P2P connection based on the second frequency.
[0186] The fifth P2P connection is a P2P connection between the first device and the second device, and the frequency of the fifth P2P connection is the same as the second frequency. Modifying 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 device and the second device is modified, the WiFi connected to the first device and the second device is not modified, so the first device and the second device will not exchange WiFi information again, but after the first device and the second device establish the fifth P2P connection, they can determine that the first device is accessing the network with different frequencies and channels, 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 switches the first device to the sixth WiFi network.
[0189] It can be understood that S804a in the embodiment of the present application is similar to S403 in the above embodiment, so it will not be described in detail.
[0190] S805a: If the sixth WiFi network with the second frequency does not exist in the connected WiFi list, the first device shares the second WiFi network through the fifth P2P connection.
[0191] It can be understood that S805a in the embodiment of the present application is similar to S404 in the above embodiment, so it will not be described in detail.
[0192] S806a: The second device determines, based on the first frequency and the third frequency, that the first device accesses the network using different frequencies and channels.
[0193] S807a: The second device determines, based on the second frequency and the third frequency, that the second device accesses the network using the same frequency but different channel.
[0194] S808a: The second device determines that the second device maintains the existing WiFi network connection mode based on the second frequency, the third frequency, and the frequency corresponding to the fifth P2P connection.
[0195] It can be seen that in the embodiment of the present application, for the situation where the first device accesses the network with different frequencies and channels, and the second device accesses the network with the same frequency and channel, the first device can disconnect the first P2P connection and establish a fifth P2P connection with the same frequency as the second frequency, so that the second device will access the network with 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, so that the first device can operate with the same frequency and channel, thereby avoiding the problem of large delay 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 it is impossible to operate with the same frequency and channel or with different frequencies and channels, thereby avoiding the problem of large delay in P2P services.
[0196] The second communication method includes:
[0197] S801b: The first device determines, based on the first frequency and the third frequency, that the first device accesses the network using different frequencies and channels.
[0198] S802b: The first device determines, based on the second frequency and the third frequency, that the second device accesses the network using the same frequency but different channel.
[0199] It can be understood that the first frequency point, the second frequency point and the third frequency point in the embodiment of the present application are the same as the first frequency point, the second frequency point and the third frequency point in the above embodiment, so they are not repeated here.
[0200] S803b: The first device modifies the first P2P connection into a sixth P2P connection based on a non-DFS channel in the connected WiFi list of the first device.
[0201] The sixth P2P connection is a P2P connection between the first device and the second device, and the frequency of the sixth P2P connection is the same as the frequency of the non-DFS channel. Modifying 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 the connection to the seventh WiFi network based on the fifth frequency corresponding to the sixth P2P connection.
[0203] Among them, the frequency of the seventh WiFi is the same as the fifth frequency.
[0204] S805b: The first device sends the seventh WiFi information of the first device 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 the network access method is changed, that is, the WiFi information of the seventh WiFi network.
[0206] S806b: The second device determines, based on the first frequency and the third frequency, that the first device accesses the network using different frequencies and channels.
[0207] S807b: The second device determines, based on the second frequency and the third frequency, that the second device accesses the network using the same frequency but different channel.
[0208] S808b. The second device switches the connection to the thirteenth WiFi network based on the fifth frequency corresponding to the sixth P2P connection, or shares the seventh WiFi network through the fifth P2P connection.
[0209] It should be noted that if there is a WiFi network with the fifth frequency in the connected WiFi list of the second device, the second device will switch the second device to the WiFi network, that is, switch the second device to the thirteenth WiFi network; if there is no WiFi network with the fifth frequency in the connected WiFi list, the second device will share the seventh WiFi network connected by the first device through the fifth P2P connection.
[0210] The thirteenth WiFi network and the seventh WiFi network may be the same WiFi network, or may be different WiFi networks but have the same frequency.
[0211] It can be seen that in the embodiment of the present application, for the situation where the first device accesses the network with different frequencies and channels, and the second device accesses the network with the same frequency and channel, and a P2P connection with the same frequency as the second frequency cannot be established, the first device modifies the P2P connection based on the non-DFS channel in the connected WiFi list of the first device. This avoids the DFS channel being used by the radar and the P2P connection may not be established on the DFS channel, and ensures that the first device can switch to the WiFi network with the same frequency corresponding to the modified P2P connection, and adjusts the STA channel corresponding to the first device and the P2P channel corresponding to the first device to the same channel, so that the first device can operate with the same frequency and channel. The second device can also adjust the STA channel corresponding to the second device and the P2P channel corresponding to the second device to the same channel based on the specific frequencies of the two ends and the frequency corresponding to the P2P connection, or share the first WiFi network through P2P, thereby avoiding the problem of large latency in P2P services.
[0212] See also Figure 9, which is another schematic diagram of a scenario of changing the device network access method disclosed in an embodiment of the present application. The embodiment of the present application is described by taking the first device as a mobile phone and the second device as a tablet computer as an example. In the left half of the sub-figure, the mobile phone is connected to a WiFi network with a frequency of 2417MHz, and the tablet is connected to a WiFi network with a frequency of 2417MHz. The mobile phone and the tablet establish a P2P connection with a frequency of 5180MHz. 5180MHz is the frequency of the 5G band, and 2417MHz is the frequency of the 2.4G band. In this way, the mobile phone and the tablet access the network with different frequencies and channels. In the right half of the sub-figure, if neither the first device nor the second device supports DBDC, the mobile phone and the tablet will try to switch to connect to the WiFi network corresponding to the 5G band, which will degenerate into a scenario where the mobile phone and the tablet access the network with the same frequency and channel; or degenerate into a scenario where the mobile phone accesses the network with the same frequency and different channels, and the tablet accesses the network with the same frequency and channel, and then the corresponding processing is the same as Figure 4 Similar, no further details will be given here; or it can be degraded to the scenario where the mobile phone and tablet computer access the network with the same frequency but different channels, and the corresponding processing is the same as Figure 7 Similarly, and will not be further elaborated here; if the mobile phone does not support DBDC, but the tablet does, the mobile phone is disconnected from the 2417MHz WiFi network, and the tablet's WiFi network is shared via a P2P connection at 5180MHz. It should be understood that the above is merely an example and should not be construed as limiting the embodiments of this application. Accordingly, in the scenario where the first device and the second device access the network using different frequencies and channels, the 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 the embodiment of the present application are the same as the second WiFi information and the second DBDC information in the above embodiment, so they will not be repeated.
[0216] S902a: The first device determines, based on the first frequency and the third frequency, that the first device accesses the network using different frequencies and channels.
[0217] S903a: The first device determines, based on the second frequency and the third frequency, that the second device accesses the network using different frequencies and channels.
[0218] It can be understood that the first frequency point, the second frequency point and the third frequency point in the embodiment of the present application are the same as the first frequency point, the second frequency point and the third frequency point in the above embodiment, so they are not repeated here.
[0219] S904a: The first device determines that the first device and the second device do not support DBDC based on the first DBDC information and the second DBDC information.
[0220] It can be understood that the first DBDC information in the embodiment of the present application is the same as the first DBDC information in the above embodiment, so it will not be repeated here.
[0221] S905a. The first device switches the connection to the eighth WiFi network based on the third frequency corresponding to the first P2P connection, obtains 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 the eighth WiFi network.
[0223] It should be noted that the first device will attempt to switch to a WiFi network corresponding to the 5G frequency band. Ultimately, the first device may switch the first device to an eighth WiFi network with the same frequency as the fifth frequency band, or may switch the first device to an eighth WiFi network with a different frequency than the third frequency band but within 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 the embodiment of the present application is the same as the first WiFi information in the above embodiment, so it will not be repeated here.
[0226] S907a: The second device determines, based on the first frequency and the second frequency, that the first device accesses the network using different frequencies and channels.
[0227] S908a: The second device determines, based on the second frequency and the third frequency, that the second device accesses the network using different frequencies and channels.
[0228] S909a: The second device determines that the first device and the second device do not support DBDC based on the first DBDC information and the second DBDC information.
[0229] S910a. The second device switches the connection to a ninth WiFi network based on the third frequency corresponding to the first P2P connection, obtains fourth WiFi information, and sends the fourth WiFi information to the first device.
[0230] Among them, 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 corresponding to the 5G frequency band. Ultimately, the second device may switch the second device to a ninth WiFi with the same frequency as the fifth frequency, or it may switch the second device to a ninth WiFi with a different frequency than the fifth but within the same frequency band. After the second device switches WiFi, the corresponding WiFi information changes, and the changed 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. 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 based on the third WiFi information and the fourth WiFi information, 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 corresponding network access method after the first device switches to connect to the eighth WiFi.
[0236] In the embodiment of the present application, if the first device determines that the first device and the second device access the network with the same frequency and channel based on the third WiFi information, the fourth WiFi information and the third frequency, the first device will maintain the existing network access method of the first device; if the first device determines that the first device accesses the network with the same frequency and different channels and the second device accesses the network with the same frequency and same channel based on the third WiFi information, the fourth WiFi information and the third frequency, the first device will adjust the STA channel corresponding to the first device and the P2P channel corresponding to the first device to the same channel, or share the ninth WiFi network through the P2P connection between the first device and the second device. The corresponding specific processing process is the same as Figure 4 Similar, no further details will be given here; if the first device determines that the first device and the second device access the network with the same frequency but different channels based on the third WiFi information, the fourth WiFi information and the third frequency point, the first device will adjust the STA channel corresponding to the first device and the P2P channel corresponding to the first device to the same channel, and the corresponding specific processing process is the same as Figure 7 Similar, no further description is given here.
[0237] S914a: 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 based on the third WiFi information and the fourth WiFi information, or maintains the existing network access mode of the second device.
[0238] It should be noted that the existing network access method of the second device here refers to the corresponding network access method after the second device switches to connect to the ninth WiFi.
[0239] In the embodiment of the present application, if the second device determines that the first device and the second device access the network with the same frequency and channel based on the third WiFi information, the fourth WiFi information and the third frequency, the second device will maintain the existing network access method of the first device; if the first device determines that the first device accesses the network with the same frequency and different channels and the second device accesses the network with the same frequency and channel based on the third WiFi information, the fourth WiFi information and the third frequency, the second device will maintain the existing network access method of the first device. The corresponding specific processing process is the same as Figure 4 Similar, no further details will be given here; if the first device determines that the first device and the second device access the network with the same frequency but 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 the same channel, or maintain the existing network access method of the second device. The corresponding specific processing process is the same as Figure 7 Similar, no further description is given here.
[0240] It can be seen that in the embodiment of the present application, for the situation where the first device and the second device access the network with different frequencies and channels, and the first device and the second device do not support DBDC, the second device and the first device will try to switch to connect to the WiFi network with the same frequency band corresponding to the first P2P connection. After that, the first device and the second device may access the network with the same frequency and channel, or the first device may access the network with the same frequency and different channels, and the second device may access the network with the same frequency and channel, or the first device and the second device may access the network with the same frequency and different channels. On this basis, 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 opposite device and adaptively change their own network access methods based on the changed WiFi information of both ends, so that the first device works with the same frequency and channel, or shares the WiFi connected to the second device through the P2P connection of the first device and the second device, and the second device works with the same frequency and channel. This can avoid the problem of large delay 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 the embodiment of the present application are the same as the second WiFi information and the second DBDC information in the above embodiment, so they will not be repeated.
[0244] S902b: The first device determines, based on the first frequency and the third frequency, that the first device accesses the network using different frequencies and channels.
[0245] S903b: The first device determines, based on the second frequency and the third frequency, that the second device accesses the network using different frequencies and channels.
[0246] It can be understood that the first frequency point, the second frequency point and the third frequency point in the embodiment of the present application are the same as the first frequency point, the second frequency point and the third frequency point in the above embodiment, so they are not repeated here.
[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 supports DBDC.
[0248] It can be understood that the first DBDC information in the embodiment of the present application is the same as the first DBDC information in the above embodiment, so it will not be repeated here.
[0249] S905b: The first device shares the second WiFi network through the 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 the embodiment of the present application is the same as the first WiFi information in the above embodiment, so it will not be repeated here.
[0252] S907a: The second device determines, based on the first frequency and the third frequency, that the first device accesses the network using different frequencies and channels.
[0253] S908a: The second device determines, based on the second frequency and the third frequency, that the second device accesses the network using different frequencies and channels.
[0254] S909a: The second device determines that the first device and the second device do not support DBDC based on the first DBDC information and the second DBDC information.
[0255] S910b: The second device determines that the second device maintains the existing network access mode.
[0256] In the embodiment of the present application, the second device supports DBDC and can utilize resources of the 5G frequency band and the 2.4G frequency band at the same time. In this way, the second device does not need to change the network access method and can continue to maintain the existing network access method.
[0257] It should be noted that in the scenario where the first device and the second device access the network with 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 resources of the 5G frequency band and the 2.4G frequency band. In this way, the first device and the second device do not need to change the network access method and can continue to maintain the existing network access method.
[0258] It can be seen that in the embodiment of the present application, for the case where the first device and the second device access the network with different frequencies and channels, and the second device supports DBDC, the second device can simultaneously utilize resources of two frequency bands without changing the network 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 the WiFi, and it is impossible to work with the same frequency and different channels or with different frequencies and different channels, thereby avoiding the problem of large delay in P2P services.
[0259] See also Figure 10 , is a schematic diagram of a scenario in which device connections are changed under channel roaming disclosed in an embodiment of the present application. This embodiment of the present application is described using the example of a mobile phone as the first device and a tablet as the second device. In the left sub-graph, the mobile phone and tablet are connected to WiFi 1 with a frequency of 5180MHz. The mobile phone and tablet establish a P2P connection with a frequency of 5180MHz. The mobile phone and tablet are in WiFi roaming state and detect WiFi with a frequency of 5200MHz. In the right sub-graph, if the WiFi quality score of the detected WiFi network is not greater than the second quality threshold, the mobile phone and tablet will maintain the 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 will switch to the WiFi network with a frequency of 5200MHz, disconnect the original P2P connection, and establish a P2P connection with a frequency of 5200MHz. It should be understood that the above is merely an exemplary description and should not be construed as limiting the embodiments of the present application. Accordingly, in the scenario in which the first device and the second device are in roaming state, the embodiments of the present application provide 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 switches the connection of the first device to the tenth WiFi network.
[0262] The first device is in WiFi roaming state and detects a tenth WiFi network.
[0263] It should be noted that before the first device is in a roaming state, the first device operates in 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 switches the second device connection to the fourteenth WiFi.
[0265] The second device is in WiFi roaming state and detects a fourteenth WiFi network.
[0266] It should be noted that before the second device is in a roaming state, the second device operates in the same frequency and channel.
[0267] In the embodiment of the present application, the frequency of the tenth WiFi network is the same as the frequency 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 with the same frequency.
[0268] It should be noted that the first device and the second device performing the P2P service are generally physically close to each other, and it is highly likely that the first device and the second device can detect the WiFi network with the same frequency.
[0269] S1003a: The first device and the second device modify the first P2P connection to a seventh P2P connection based on the sixth frequency of the tenth WiFi network.
[0270] It is understandable that, since the frequency of the tenth WiFi network is the same as the frequency of the fourteenth WiFi network, the first device and the second device may 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 a P2P connection between the first device and the second device. Modifying 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 the second quality threshold can be set according to actual conditions, and the present embodiment does not limit this. The second quality threshold can be the same as the first quality threshold in the above embodiment, or different from the first quality threshold in the above embodiment.
[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 mode.
[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 mode.
[0276] As can be seen, in the embodiment of the present application, for the WiFi roaming scenario, the WiFi quality score of the detected WiFi network will be determined first. 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 to WiFi. This ensures that the WiFi network after the switch is available, avoiding any impact on P2P services. In addition, the P2P connection between the first device and the second device will be modified at the same time, thus ensuring that the second device will continue to operate on the same frequency and channel, avoiding the problem of large latency in P2P services.
[0277] See also Figure 11a , which is a flow chart of another communication method provided in an embodiment of the present application. Figure 11a The first and second devices have the same structure, both including a service module, a MagicLink module, and a short-range module. The service module may include audio services, screen projection services, and control services; the MagicLink module may include a session management layer and a P2P connection module; the P2P connection module may include a WiFi information exchange module; and the short-range module may include a WiFi handover 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 mobile phones, PCs, tablets, and other devices. The physical channels used by Magiclink include Long Term Evolution (LTE) far field, Bluetooth, WiFi (such as P2P connection, local area network), etc., aiming to support stable and fast communication between devices.
[0279] The session management layer is designed to provide adaptive services to businesses by distinguishing and managing sessions with different attributes. Generally speaking, a single business corresponds to at least one session. If a business has multiple demands and needs (such as the need to send control signaling, transmission streams, and send files at the same time), then it should correspond to multiple different types of sessions (such as message sessions, stream sessions, and file sessions). The session management layer can access Magiclink's upper-layer services (such as screen projection, calls, keyboard and mouse, etc.) to determine the business demand capabilities of the P2P business. Among them, the business demand capabilities corresponding to different P2P services need to be written into the Magiclink configuration file in advance. Business demand capabilities may include WiFi switching, etc. When a P2P business uses Magiclink capabilities, Magiclink will first check the configuration items of the P2P business in the configuration file to determine which capabilities the P2P business can use.
[0280] The short-range module includes all modules below the Internet Protocol (IP) layer, including drivers, network cards, WiFi switching algorithm modules, and WiFi modules.
[0281] Registering a callback means that the lower-level module can notify the upper-level module.
[0282] The following combination Figure 11a The communication method provided in the embodiment of the present application is described.
[0283] The service module of the first device initiates a P2P service; the session management layer of the first device checks the configuration and determines that the service requirement capability corresponding to the initiated P2P service includes WiFi handover, 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 handover algorithm module of the first device; the WiFi handover algorithm module of the first device determines, based on the WiFi information of the first device, the WiFi information of the second device, and the frequency corresponding to the P2P connection, whether 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 operation of the second device through the P2P connection between the first and second devices, or to maintain the existing network access mode of the first device; the WiFi module of the first device switches the WiFi network to which the first device is connected based on the determination result of the WiFi handover algorithm module, and / or the P2P connection module changes the P2P connection between the first and second devices based on the determination result of the WiFi handover algorithm module. Among them, 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] It is understandable that Figure 11a The execution process of the second device is similar to that of the first device, so it will not be repeated here.
[0285] See also Figure 11b , which is a flow chart of another communication method provided in an embodiment of the present application. Figure 11b The composition and structure of the first device Figure 11a The composition structure of the first device is the same as that of the first device. Figure 11b The composition structure of the second device is relatively Figure 11a The second device's structure lacks the WiFi switching algorithm module. 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 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] Among them, the WiFi switching indication information is used to instruct the second device to adjust the WiFi network to which the second device is connected. The second device may switch the second device to another WiFi network according to the WiFi switching indication information, or may maintain the existing WiFi connection mode according to the WiFi switching indication information, or may disconnect the connected WiFi network according to the WiFi switching indication information and share the WiFi network of the first device through a P2P connection.
[0288] It should be noted that for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.
[0289] In order to better implement the above-mentioned solutions of the embodiments of the present application, relevant devices for implementing the above-mentioned solutions are also provided below.
[0290] See also Figure 12 , is a schematic structural diagram of a communication device provided in an embodiment of the present application, wherein the communication device 1200 is applied to a first device, and 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, wherein the P2P connection module 1202 includes a WiFi information exchange module 12021;
[0291] A WiFi information exchange module 12021 is configured to receive second WiFi information of a second device based on a first P2P connection, and send the second WiFi information to the WiFi switching algorithm module, where the first P2P connection is a P2P connection between the first device and the second device;
[0292] The WiFi switching algorithm module 1203 is configured to determine, based on the first WiFi information and the second WiFi information of the first device, whether to adjust the STA channel corresponding to the first device and the P2P channel corresponding to the first device to be 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] It is understandable that Figure 12 The illustrated communication apparatus 1200 may also be applied to a second device.
[0294] It can be seen that in the embodiment of the present 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 adaptively change its own network access method based on its own WiFi connection status and the WiFi connection status of the opposite device, so that the first device can access the network with the same frequency and channel, or the first device can disconnect from the WiFi and directly share the WiFi network connected to the second device through the P2P connection. In this way, the first device can be prevented from continuously working with the same frequency and different channel or working with different frequencies and different channels, thereby avoiding the problem of large delay in P2P services caused by the need to switch different channels in time, thereby improving the user experience of P2P services.
[0295] In some possible implementations, the first WiFi information includes a first frequency, which is a frequency of a first WiFi to which the first device is connected; the second WiFi information includes a second frequency, which is a frequency of a second WiFi to which the second device is connected;
[0296] The WiFi switching algorithm module 1203 is specifically used to determine, based on the first frequency, the second frequency, and the third frequency, whether to adjust the STA channel corresponding to the first device and the P2P channel corresponding to the first device to be 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, where the third frequency is the frequency corresponding to the first P2P connection.
[0297] In some possible implementations, the WiFi handover algorithm module 1203 is further configured to determine, based on the first frequency and the third frequency, that the first device accesses the network using the same frequency and different channel; and to determine, based on the second frequency and the third frequency, that the second device accesses the network using the same frequency and same channel.
[0298] The WiFi switching algorithm module 1203 is also used to switch the first device to the third WiFi network if there is a third WiFi network with the second frequency in the connected WiFi list of the first device.
[0299] The WiFi module 1204 is further configured to switch the first device to a third WiFi network;
[0300] The WiFi switching algorithm module 1203 is further configured to share the second WiFi network through the first P2P connection if the third WiFi network with the second frequency does not exist in the connected WiFi list;
[0301] The P2P connection module 1202 is further configured to share the second WiFi network through the first P2P connection.
[0302] In some possible implementations, the WiFi switching algorithm module 1203 is specifically configured to switch the first device to the third WiFi network 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 the first quality threshold.
[0303] In some possible implementations, the WiFi quality score of the third WiFi network is used to represent 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 configured to switch the first device to the third WiFi network if a third WiFi network with the second frequency is present in the connected WiFi list, and if a second P2P service with high QoS requirements based on the second P2P connection does not exist between the first device and the third device, and 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, and the WiFi switching algorithm module 1203 is further configured to determine, based on the first frequency and the third frequency, that the first device accesses the network at different frequencies and channels; and to determine, based on the second frequency and the third frequency, that the second device accesses the network at the same frequency and channel.
[0306] The WiFi switching algorithm module 1203 is further configured to switch the first device to the fourth WiFi network if a fourth WiFi network with the second frequency exists in the connected WiFi list of the first device;
[0307] The WiFi module 1204 is further configured to switch the first device to a fourth WiFi network;
[0308] The WiFi switching algorithm module 1203 is further configured to share the second WiFi network through the first P2P connection if the fourth WiFi network with the second frequency does not exist in the connected WiFi list;
[0309] The P2P connection module 1202 is further configured to share the second WiFi network through the first P2P connection.
[0310] In some possible implementations, the WiFi handover algorithm module 1203 is further configured to determine, based on the first frequency and the third frequency, that the first device accesses the network using a same-frequency but different-channel method; and based on the third frequency and the second frequency, determine that the second device accesses the network using a same-frequency but different-channel method.
[0311] The WiFi switching algorithm module 1203 is further configured to determine, based on the first frequency, to modify the first P2P connection to a third P2P connection, where the third P2P connection is a P2P connection between the first device and the second device;
[0312] The P2P connection module 1202 is further configured to modify the first P2P connection into a third P2P connection.
[0313] In some possible implementations, the WiFi handover algorithm module 1203 is further configured to determine, based on the first frequency and the third frequency, that the first device accesses the network using a same-frequency but different-channel approach; and based on the second frequency and the third frequency, determine that the second device accesses the network using a same-frequency but different-channel approach.
[0314] The WiFi switching algorithm module 1203 is further configured to determine, on a non-dynamic frequency selection (DFS) channel in a connected WiFi list of the first device, to modify the first P2P connection to a fourth P2P connection, where the fourth P2P connection is a P2P connection between the first device and the second device;
[0315] The P2P connection module 1202 is further configured to modify the first P2P connection into a fourth P2P connection;
[0316] The WiFi switching algorithm module 1203 is further configured to determine, based on a fourth frequency corresponding to the fourth P2P connection, to switch the first device to a fifth WiFi network;
[0317] The WiFi module 1204 is further configured to switch the first device to a fifth WiFi network.
[0318] In some possible implementations, the WiFi handover algorithm module 1203 is further configured to determine, based on the first frequency and the third frequency, that the first device accesses the network using different frequencies and channels; and to determine, based on the second frequency and the third frequency, that the second device accesses the network using the same frequency and channels.
[0319] The WiFi switching algorithm module 1203 is further configured to determine, based on the second frequency point, to modify the first P2P connection into a fifth P2P connection. The fifth P2P connection is a P2P connection between the first device and the second device.
[0320] The P2P connection module 1202 is further configured to modify the first P2P connection into a fifth P2P connection;
[0321] The WiFi switching algorithm module 1203 is further configured to determine to switch the first device to the sixth WiFi network if a sixth WiFi network with the second frequency exists in the connected WiFi list of the first device;
[0322] The WiFi module 1204 is further configured to switch the first device to a sixth WiFi network;
[0323] The WiFi switching algorithm module 1203 is further configured to determine to share the second WiFi network through a fifth P2P connection if the sixth WiFi network with the second frequency does not exist in the connected WiFi list;
[0324] The P2P connection module 1202 is further configured to share the second WiFi network through a fifth P2P connection.
[0325] In some possible implementations, the WiFi handover algorithm module 1203 is further configured to determine, based on the first frequency and the third frequency, that the first device accesses the network using different frequencies and channels; and to determine, based on the second frequency and the third frequency, that the second device accesses the network using the same frequency and channels.
[0326] The WiFi switching algorithm module 1203 is further configured to determine, on a non-DFS channel in the connected WiFi list of the first device, to modify the first P2P connection to a sixth P2P connection, where the sixth P2P connection is a P2P connection between the first device and the second device;
[0327] The P2P connection module 1202 is further configured to modify the first P2P connection into a sixth P2P connection;
[0328] The WiFi switching algorithm module 1203 is further configured to switch the connection of the first device to a seventh WiFi network based on the fifth frequency corresponding to the sixth P2P connection;
[0329] The WiFi switching algorithm module 1203 is further configured to switch the first device to a seventh WiFi network.
[0330] In some possible implementations, the WiFi information exchange module 12021 is further configured to receive second DBDC information of the second device based on the first P2P connection, where the second DBDC information is used to indicate whether the second device supports DBDC.
[0331] The WiFi handover algorithm module 1203 is further configured to determine, based on the first frequency and the third frequency, that the first device accesses the network using a different frequency and channel; determine, based on the second frequency and the third frequency, that the second device accesses the network using a different frequency and channel; and determine, based on the first DBDC information and the second DBDC information, that the first device and the second device do not support DBDC, where the first DBDC information indicates whether the first device supports DBDC.
[0332] The WiFi switching algorithm module 1203 is further configured to determine, based on the third frequency point, to switch the first device to an eighth WiFi network;
[0333] The WiFi module 1204 is further configured to switch the first device to an eighth WiFi network and obtain third WiFi information of the first device;
[0334] The WiFi information exchange module 12021 is further configured to receive fourth WiFi information of the second device based on the first P2P connection; the fourth WiFi information is WiFi information corresponding to the second device after the second device is switched to the ninth WiFi network based on the third frequency;
[0335] The WiFi switching algorithm module 1203 is further configured to 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 third WiFi information and the fourth WiFi information, or to share a 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 further configured to receive second DBDC information of the second device based on the first P2P connection, where the second DBDC information is used to indicate whether the second device supports DBDC.
[0337] The WiFi handover algorithm module 1203 is further configured to determine, based on the first frequency and the third frequency, that the first device accesses the network using a different frequency and channel; determine, based on the second frequency and the third frequency, that the second device accesses the network using a different frequency and channel; and determine, based on the first DBDC information and the second DBDC information, that the first device does not support DBDC and that the second device supports DBDC, where the first DBDC information indicates whether the first device supports DBDC.
[0338] The WiFi handover algorithm module 1203 is further configured to determine sharing of the second WiFi network through the first P2P connection;
[0339] The P2P connection module 1202 is further configured to share the second WiFi network through the first P2P connection.
[0340] In some possible implementations, the session management module 1201 is configured to determine a service demand corresponding to the first P2P service;
[0341] A P2P connection module 1202, configured to establish a first P2P connection;
[0342] The WiFi information exchange module 12021 is further used to send the first WiFi information to the second device based on the first P2P connection if the service requirements corresponding to the first P2P service include WiFi switching. The first P2P service is a P2P service initiated between the first device and the second device.
[0343] In some possible implementations, the WiFi module 1204 is configured to send fifth WiFi information to the WiFi information exchange module 12021, where the fifth WiFi information is WiFi information corresponding to the first device adjusting the STA channel and the P2P channel to be co-channel, or sharing the WiFi network connected to the second device;
[0344] The WiFi information exchange module 12021 is further configured to send the 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 a WiFi roaming state and detects a tenth WiFi network. The WiFi handover algorithm module 1203 is further configured to, if a WiFi quality score of the tenth WiFi network is greater than a second quality threshold, determine to handover the first device to the tenth WiFi network, and, based on a sixth frequency of the tenth WiFi network, determine to modify the first P2P connection to a seventh P2P connection, where the seventh P2P connection is a P2P connection between the first device and the second device.
[0346] The WiFi module 1204 is further configured to switch the first device to a tenth WiFi network;
[0347] The P2P connection module 1202 is further configured to modify the first P2P connection into a seventh P2P connection.
[0348] It should be noted that the information interaction, execution process, etc. between the modules / units of the above-mentioned device are based on the same concept as the method embodiment of the present application, and the technical effects they bring are the same as those of the method embodiment of the present application. For specific contents, please refer to the description in the method embodiment shown above in the present application, and no further details will be given here.
[0349] Figure 13 This is an example of the composition of another communication device provided in an embodiment of the present application. The communication device can be a first device or a second device, and the first device or the second device includes but is not limited to electronic devices such as mobile phones and smart wearable devices (such as smart watches). 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, an antenna 1, an antenna 2, a mobile communication module 350, and a wireless communication module 360.
[0350] It should be 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 shown, or may combine or separate certain components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0351] The processor 310 may include one or more processing units. For example, the processor 310 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). The different processing units may be independent devices or integrated into one or more processors.
[0352] It is understood that the interface connection relationship between the modules illustrated in this embodiment is only a schematic illustration and does not constitute a structural limitation of the electronic device. In other embodiments of the present application, the electronic device may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0353] External memory interface 320 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the communication device. The external memory card communicates with processor 310 via external memory interface 320 to implement data storage functions. For example, files such as music and videos can be stored on the external memory card.
[0354] The internal memory 321 can be used to store computer executable program code, and the executable program code includes instructions. The processor 310 executes various functional applications and data processing of the communication device by running the instructions stored in the internal memory 321, thereby realizing the communication method in the above embodiment. The internal memory 321 may include a program storage area and a data storage area. Among them, the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area can store data created during the use of the electronic device (such as audio data, a phone book, etc.), etc. In addition, the internal memory 321 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 310 executes various functional applications and data processing of the communication device by running the instructions stored in the internal memory 321, and / or the instructions stored in the memory provided in the processor.
[0355] The wireless communication function of the communication device can be implemented 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 a single or multiple 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 other embodiments, the antennas can be used in conjunction with a tuning switch.
[0357] The mobile communication module 350 can provide solutions for wireless communications including 2G / 3G / 4G / 5G applied to electronic devices. The mobile communication module 350 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 350 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 350 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 350 can be set in the processor 310. In some embodiments, at least some of the functional modules of the mobile communication module 350 can be set in the same device as at least some of the modules of the processor 310.
[0358] In some embodiments, the communication device initiates or receives a call request via the mobile communication module 350 and the antenna 1 .
[0359] Furthermore, an operating system runs on the aforementioned components, such as the iOS operating system, the Android operating system, and the Windows operating system. Application programs can be installed and run on the operating system. Those skilled in the art will clearly understand that, for ease of description and brevity, the explanation and beneficial effects of any of the aforementioned electronic devices can be referred to the corresponding method embodiments provided above, and will not be further elaborated 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 example, the division of the modules is merely a logical function division. In actual implementation, there may be other division methods, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interface, device or module, which can be electrical, mechanical or other forms.
[0361] The modules described as separate components may or may not be physically separate, and 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 may be selected to achieve the purpose of the present embodiment according to actual needs.
[0362] In addition, the functional modules in the various embodiments of the present application may be integrated into a processing module, or each module may exist physically separately, or two or more modules may be integrated into a single module. The above-mentioned integrated modules may be implemented in the form of hardware or software functional modules.
[0363] If the integrated module is implemented in the form of 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 part that essentially contributes to the technical solution of the present application or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the process of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory, a random access memory, a magnetic disk or an optical disk.
[0364] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the above embodiments, ordinary technicians in this field should understand that they can still modify the technical solutions recorded in the above embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A communication method, characterized in that: The method is applied to a first device, and includes: receiving second WiFi information of a second device based on a first peer-to-peer P2P connection, where the first P2P connection is a P2P connection between the first device and the second device; Based on the first WiFi information and the second WiFi information of the first device, 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.
2. The method according to claim 1, characterized in that The first WiFi information includes a first frequency, which is the frequency of a first WiFi network to which the first device is connected; the second WiFi information includes a second frequency, which is the frequency of a second WiFi network to which the second device is connected; The adjusting, based on the first WiFi information and the second WiFi information of the first device, the STA channel corresponding to the first device and the P2P channel corresponding to the first device to be the same channel, or sharing the WiFi network connected to the second device through the P2P connection between the first device and the second device, includes: Based on the first frequency, the second frequency, and the third frequency, 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, where the third frequency is the frequency corresponding to the first P2P connection.
3. The method according to claim 2, characterized in that The adjusting, based on the first frequency, the second frequency, and the third frequency, the STA channel corresponding to the first device and the P2P channel corresponding to the first device to be the same channel, or sharing the WiFi network connected to the second device through the P2P connection between the first device and the second device, includes: Determining, based on the first frequency and the third frequency, that the first device accesses the network using a same-frequency but different-channel method; Determining, based on the second frequency and the third frequency, that the second device accesses the network using the same frequency and channel; If a third WiFi network with the second frequency exists in the connected WiFi list of the first device, switching the first device to the third WiFi network; If the third WiFi network with the second frequency does not exist in the connected WiFi list, the second WiFi network is shared through the first P2P connection.
4. The method according to claim 3, characterized in that If a third WiFi network with the second frequency exists in the connected WiFi list of the first device, switching the first device to the third WiFi network includes: If a third WiFi network with the second frequency exists in the connected WiFi list, and a WiFi quality score of the third WiFi network is greater than a first quality threshold, the first device is switched to be connected to the third WiFi network.
5. The method according to claim 4, characterized in that The WiFi quality score of the third WiFi network is used to represent the signal strength and / or network speed of the third WiFi network.
6. The method according to any one of claims 3 to 5, characterized in that If a third WiFi network with the second frequency exists in the connected WiFi list of the first device, switching the first device to the third WiFi network includes: If a third WiFi network with the second frequency exists in the connected WiFi list, and no second P2P service requiring high quality of service (QoS) based on the second P2P connection exists between the first device and the third device, the first device is switched to the third WiFi network, and the second P2P connection is a P2P connection between the first device and the third device.
7. The method according to claim 2, characterized in that The first device does not support dual-band dual-concurrent DBDC, and the adjusting, based on the first frequency, the second frequency, and the third frequency, the STA channel corresponding to the first device and the P2P channel corresponding to the first device to be the same channel, or sharing the WiFi network connected to the second device through the P2P connection between the first device and the second device, includes: Determining, based on the first frequency and the third frequency, that the first device accesses the network using different frequencies and channels; Determining, based on the second frequency and the third frequency, that the second device accesses the network using the same frequency and channel; If a fourth WiFi network with the second frequency exists in the connected WiFi list of the first device, switching the first device to the fourth WiFi network; If the fourth WiFi network with the second frequency does not exist in the connected WiFi list, the second WiFi network is shared through the first P2P connection.
8. The method according to claim 2, characterized in that The adjusting, based on the first frequency, the second frequency, and the third frequency, the STA channel corresponding to the first device and the P2P channel corresponding to the first device to be co-channel includes: Determining, based on the first frequency and the third frequency, that the first device accesses the network using a same-frequency but different-channel method; Determining, based on the second frequency and the third frequency, that the second device accesses the network using a same-frequency but different-channel method; The first P2P connection is modified into a third P2P connection based on the first frequency, where the third P2P connection is a P2P connection between the first device and the second device.
9. The method according to claim 2, characterized in that The adjusting, based on the first frequency, the second frequency, and the third frequency, the STA channel corresponding to the first device and the P2P channel corresponding to the first device to be co-channel includes: Determining, based on the first frequency and the third frequency, that the first device accesses the network using a same-frequency but different-channel method; Determining, based on the second frequency and the third frequency, that the second device accesses the network using a same-frequency but different-channel method; Selecting a DFS channel based on a non-dynamic frequency in a connected WiFi list of the first device, and modifying the first P2P connection to a fourth P2P connection, where the fourth P2P connection is a P2P connection between the first device and the second device; Based on the fourth frequency corresponding to the fourth P2P connection, the first device is switched to connect to a fifth WiFi network.
10. The method according to claim 2, characterized in that The adjusting, based on the first frequency, the second frequency, and the third frequency, the STA channel corresponding to the first device and the P2P channel corresponding to the first device to be the same channel, or sharing the WiFi network connected to the second device through the P2P connection between the first device and the second device, includes: Determining, based on the first frequency and the third frequency, that the first device accesses the network using different frequencies and channels; Determining, based on the second frequency and the third frequency, that the second device accesses the network using a same-frequency but different-channel method; Modify the first P2P connection into a fifth P2P connection based on the second frequency, where 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, switching the first device to the sixth WiFi network; If the sixth WiFi network with the second frequency does not exist in the connected WiFi list, the second WiFi network is shared through the fifth P2P connection.
11. The method according to claim 2, characterized in that The adjusting, based on the first frequency, the second frequency, and the third frequency, the STA channel corresponding to the first device and the P2P channel corresponding to the first device to be co-channel includes: Determining, based on the first frequency and the third frequency, that the first device accesses the network using different frequencies and channels; Determining, based on the second frequency and the third frequency, that the second device accesses the network using a same-frequency but different-channel method; Modify the first P2P connection to a sixth P2P connection based on a non-DFS channel in the connected WiFi list of the first device, where the sixth P2P connection is a P2P connection between the first device and the second device; Based on the fifth frequency corresponding to the sixth P2P connection, the first device is switched to connect to a seventh WiFi network.
12. The method according to claim 2, characterized in that The method further comprises: receiving second DBDC information of the second device based on the first P2P connection, where the second DBDC information is used to indicate whether the second device supports DBDC; The adjusting, based on the first frequency, the second frequency, and the third frequency, the STA channel corresponding to the first device and the P2P channel corresponding to the first device to be the same channel, or sharing the WiFi network connected to the second device through the P2P connection between the first device and the second device, includes: Determining, based on the first frequency and the third frequency, that the first device accesses the network using different frequencies and channels; Determining, based on the second frequency and the third frequency, that the second device accesses the network using different frequencies and channels; determining, based on 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; Switching the first device to an eighth WiFi network based on the third frequency, and obtaining third WiFi information of the first device; receiving fourth WiFi information of the second device based on the first P2P connection; the fourth WiFi information being WiFi information corresponding to the second device after the second device is switched to a ninth WiFi network based on the third frequency; Based on the third WiFi information and the fourth WiFi information, 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 ninth WiFi network is shared through the P2P connection between the first device and the second device.
13. The method according to claim 2, characterized in that The method further comprises: receiving second DBDC information of the second device based on the first P2P connection, where the second DBDC information is used to indicate whether the second device supports DBDC; Sharing a WiFi network connected to the second device through a P2P connection between the first device and the second device based on the first frequency, the second frequency, and the third frequency includes: Determining, based on the first frequency and the third frequency, that the first device accesses the network using different frequencies and channels; Determining, based on the second frequency and the third frequency, that the second device accesses the network using different frequencies and channels; determining, based on first DBDC information and the second DBDC information, that the first device does not support DBDC and that the second device supports DBDC, wherein 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.
14. The method according to any one of claims 1 to 13, characterized in that Before receiving the second WiFi information of the second device based on the first peer-to-peer P2P connection, the method further includes: Establishing 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, and the first P2P service is a P2P service initiated between the first device and the second device.
15. The method according to any one of claims 1 to 14, characterized in that The method further comprises: Based on the P2P connection between the first device and the second device, fifth WiFi information of the first device is sent to the second device, where the fifth WiFi information is WiFi information corresponding to the first device adjusting the STA channel and the P2P channel to be the same channel, or sharing the WiFi network connected to the second device.
16. The method according to any one of claims 1 to 15, characterized in that The first device is in a WiFi roaming state and detects a tenth WiFi network, the method further comprising: If the WiFi quality score of the tenth WiFi network is greater than a second quality threshold, the first device is switched to the tenth WiFi network, and the first P2P connection is modified to a seventh P2P connection based on the sixth frequency of the tenth WiFi network. The seventh P2P connection is a P2P connection between the first device and the second device.
17. A communication device, characterized in that: The communication device is applied to a first device, and the device includes: an end-to-end P2P connection module and a WiFi switching algorithm module, and the P2P connection module includes a WiFi information exchange module; The WiFi information exchange module is configured to receive second WiFi information of the second device based on a first P2P connection, and send the second WiFi information to the WiFi switching algorithm module, where the first P2P connection is a P2P connection between the first device and the second device; The WiFi switching algorithm module is configured to determine, based on the first WiFi information and the second WiFi information of the first device, whether to adjust the STA channel corresponding to the first device and the P2P channel corresponding to the first device to be co-channel, or to share the WiFi network connected to the second device through the P2P connection between the first device and the second device.
18. The device according to claim 17, characterized in that The apparatus further comprises: a session management module; The session management module is configured to determine a service requirement corresponding to the first P2P service; The P2P connection module is configured 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, where the first P2P service is a P2P service initiated between the first device and the second device.
19. A communication device, characterized in that: The communication device comprises: Memory for storing computer programs or computer instructions; A processor, configured to execute a computer program or computer instruction stored in the memory, so that the communication device executes the communication method according to any one of claims 1 to 16.
20. A computer program product comprising a computer program, characterized in that When the computer program is executed, the communication method according to any one of claims 1 to 16 is implemented.
21. A computer storage medium for storing a computer program, wherein when the computer program is executed, it is used to implement the communication method according to any one of claims 1 to 16.
Citation Information
Patent Citations
Network transmission control method and device, terminal equipment and storage medium
CN111050368A
Channel adjustment method and electronic equipment
CN112929972A
System and method for providing wireless internet access and electronic device
CN113676902A
Communication method, electronic equipment and storage medium
CN114980235A
Communication method
CN116709577A