Frequency band switching method and device, electronic equipment and computer program product

By determining that the frequency bands of the two working modes are consistent in the Wi-Fi module and switching the frequency bands of one of the working modes when the third working mode is enabled, the problem of communication restriction when the Wi-Fi module is running multiple working modes at the same time is solved, and stable and reliable communication is achieved.

CN119729819APending Publication Date: 2025-03-28GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411857901.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-16
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

When the Wi-Fi module runs multiple different working modes at the same time, the communication in some working modes is limited, which affects the communication stability.

Method used

By determining that both operating modes in which the Wi-Fi module operates simultaneously use the same frequency band communication, and when the third operating mode is enabled, the communication band of one of the operating modes is switched to different frequency bands to avoid communication limitations.

Benefits of technology

The stability and reliability of using multiple working modes for communication in the Wi-Fi module at the same time is realized, and communication restriction in some working modes is avoided.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119729819A_ABST
    Figure CN119729819A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a frequency band switching method and device, electronic equipment and a computer program product. The method is applied to the electronic equipment, the electronic equipment comprises a Wi-Fi module, and the method comprises the following steps: under the condition that the Wi-Fi module operates a first working mode and a second working mode at the same time, determining that the first working mode and the second working mode both use a first frequency band for communication; and in response to starting operation for a third working mode, switching a communication frequency band of the first working mode or the second working mode from the first frequency band to a second frequency band, and controlling the Wi-Fi module to simultaneously operate the first working mode, the second working mode and the third working mode. According to the frequency band switching method and device, the electronic equipment and the computer program product, the stability and reliability of the Wi-Fi module when the Wi-Fi module simultaneously uses multiple working modes for communication can be ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a frequency band switching method, device, electronic device and computer program product. Background Art

[0002] With the rapid development of wireless network technology, Wi-Fi wireless network covers almost every area of ​​people's daily life and is one of the most frequently used wireless communication technologies. At present, Wi-Fi technology can support a variety of different working modes, such as STA (Station) mode, AP (Access Point) mode and P2P (Peer to Peer) mode, etc. The working mode defines the role and action of Wi-Fi devices in the network.

[0003] In the related art, the Wi-Fi modules of some electronic devices support the coexistence of multiple different working modes, that is, the Wi-Fi modules of electronic devices can run multiple different working modes at the same time, so as to meet more usage scenarios. However, when the Wi-Fi module runs multiple different working modes at the same time, there are situations where the communication of some working modes is restricted, which affects the communication stability. Summary of the invention

[0004] The embodiments of the present application disclose a frequency band switching method, device, electronic device and computer program product, which can avoid the situation where the communication of some working modes is restricted when the Wi-Fi module runs multiple different working modes at the same time, and ensure the stability and reliability of the Wi-Fi module when using multiple working modes for communication at the same time.

[0005] The embodiment of the present application discloses a frequency band switching method, which is applied to an electronic device, wherein the electronic device includes a Wi-Fi module, and the method includes:

[0006] When the Wi-Fi module runs the first working mode and the second working mode at the same time, determining that both the first working mode and the second working mode use the first frequency band for communication;

[0007] In response to an enabling operation for the third working mode, the communication frequency band of the first working mode or the second working mode is switched from the first frequency band to the second frequency band, and the Wi-Fi module is controlled to simultaneously run the first working mode, the second working mode and the third working mode; the first working mode, the second working mode and the third working mode are different working modes supported by the Wi-Fi module.

[0008] The embodiment of the present application discloses a frequency band switching device, which is applied to an electronic device, wherein the electronic device includes a Wi-Fi module, and the device includes:

[0009] A frequency band determination module, configured to determine that both the first working mode and the second working mode use the first frequency band for communication when the Wi-Fi module operates in the first working mode and the second working mode at the same time;

[0010] A frequency band switching module is used to switch the communication frequency band of the first working mode or the second working mode from the first frequency band to the second frequency band in response to an enabling operation for the third working mode, and control the Wi-Fi module to simultaneously run the first working mode, the second working mode and the third working mode; the first working mode, the second working mode and the third working mode are different working modes supported by the Wi-Fi module.

[0011] An embodiment of the present application discloses an electronic device, including a memory, a processor, and a transceiver unit. The memory stores a computer program. When the computer program is executed by the processor, the electronic device implements the method described above.

[0012] An embodiment of the present application discloses a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor in an electronic device, the electronic device implements the method described above.

[0013] An embodiment of the present application discloses a computer program product, including a computer program. When the computer program is executed by a processor in an electronic device, the electronic device implements the method as described above.

[0014] The frequency band switching method, device, electronic device and computer program product disclosed in the embodiments of the present application, when the Wi-Fi module runs the first working mode and the second working mode at the same time, determine that the first working mode and the second working mode both use the first frequency band for communication, and in response to the enabling operation for the third working mode, switch the communication frequency band of the first working mode or the second working mode from the first frequency band to the second frequency band, and control the Wi-Fi module to run the first working mode, the second working mode and the third working mode at the same time, wherein the first working mode, the second working mode and the third working mode are different working modes supported by the Wi-Fi module. In an embodiment of the present application, when the Wi-Fi module simultaneously runs the first working mode and the second working mode, and the first working mode and the second working mode work in the same first frequency band, if the third working mode is enabled, the communication of the third working mode may be restricted. Therefore, by switching the communication frequency band of the first working mode or the second working mode from the first frequency band to the second frequency band, the communication of the enabled third working mode can be unrestricted, which can avoid the situation where the communication of some working modes is restricted when the Wi-Fi module runs multiple different working modes at the same time, thereby ensuring the stability and reliability of the Wi-Fi module when communicating in three different working modes at the same time. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0016] Figure 1 An application scenario of a frequency band switching method in an embodiment;

[0017] Figure 2 is a flow chart of a frequency band switching method in one embodiment;

[0018] Figure 3A is a schematic diagram of an interface of an electronic device in an embodiment;

[0019] Figure 3B is a schematic diagram of an interface of an electronic device in another embodiment;

[0020] Figure 3C is a schematic diagram of an interface of an electronic device in another embodiment;

[0021] Figure 4 A flowchart of enabling the P2P mode when the Wi-Fi module operates in the STA mode and the AP mode at the same time in one embodiment;

[0022] Figure 5 A flowchart of another embodiment of enabling the P2P mode when the Wi-Fi module operates in the STA mode and the AP mode at the same time;

[0023] Figure 6 A flowchart of enabling AP mode when the Wi-Fi module runs both STA mode and P2P mode in one embodiment;

[0024] Figure 7 A flowchart of enabling STA mode when the Wi-Fi module operates in AP mode and P2P mode at the same time in one embodiment;

[0025] Figure 8 A flowchart of selecting AP mode or P2P mode for frequency band switching in one embodiment;

[0026] Fig. 9 A flowchart of another embodiment of enabling the STA mode when the Wi-Fi module operates in both the AP mode and the P2P mode;

[0027] Fig.10 A flowchart of determining a target channel in one embodiment;

[0028] Fig.11 is a block diagram of a frequency band switching device in one embodiment;

[0029] Fig.12 FIG. 4 is a structural block diagram of an electronic device in an embodiment. DETAILED DESCRIPTION

[0030] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0031] It should be noted that the terms "including" and "having" and any variations thereof in the embodiments of the present application and the accompanying drawings are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device including a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products or devices.

[0032] It is understood that the terms "first", "second", etc. used in this application may be used herein to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish a first element from another element. For example, without departing from the scope of this application, the first operating mode may be referred to as the second operating mode, and similarly, the second operating mode may be referred to as the first operating mode. Both the first operating mode and the second operating mode are operating modes of the Wi-Fi module, but they are not the same operating mode. The term "multiple" used in this application refers to two or more. The term "and / or" used in this application refers to one of the schemes, or any combination of multiple schemes.

[0033] Currently, Wi-Fi technology can support a variety of different working modes, such as STA mode, AP mode and P2P mode.

[0034] STA mode means that the Wi-Fi device can be used as a client in a wireless network. In STA mode, the Wi-Fi device can connect to an existing wireless network (usually established by a Wi-Fi device in AP mode), so that it can communicate through the connected wireless network. For example, electronic devices such as mobile phones and tablets can realize network browsing, network communication, network downloading and other functions by connecting to the wireless network provided by the wireless router.

[0035] AP mode means that a Wi-Fi device can create its own wireless network for other devices to connect to for communication. For example, mobile phones, tablets and other electronic devices can use Soft-AP technology to open wireless hotspots, and other electronic devices can access the opened wireless hotspots to achieve network access.

[0036] Wi-Fi's P2P mode can also be called Wi-Fi Direct mode, which is a technology that allows different Wi-Fi devices to connect directly without going through an AP. In P2P mode, one Wi-Fi device can act as a Group Owner (GO) and other Wi-Fi devices can act as Group Clients (GC) to achieve fast and direct communication between devices. For example, in scenarios such as screen projection and multi-device collaboration, P2P connections can be established between multiple electronic devices to achieve direct data transmission.

[0037] In the related art, the Wi-Fi module of some electronic devices supports the coexistence of multiple different working modes. For example, the Wi-Fi module of the electronic device supports the coexistence of STA mode, AP mode and P2P mode. The Wi-Fi module can run in STA mode, AP mode and P2P mode at the same time. However, when the Wi-Fi module runs STA mode, AP mode and P2P mode at the same time, there are situations where the communication of some working modes is restricted. Furthermore, when the Wi-Fi module of the electronic device has enabled two of the working modes of STA mode, AP mode and P2P mode, if the third working mode is enabled, the communication of the third working mode may be restricted.

[0038] For example, it is found through actual testing that the communication restriction situation may be as shown in Table 1.

[0039] Table 1

[0040]

[0041]

[0042] At present, Wi-Fi technology generally supports two frequency bands, 2.4G (GHz, gigahertz) and 5G. Among them, when the Wi-Fi module of an electronic device has enabled AP mode and STA mode, if the Wi-Fi module enables P2P mode again, if the AP mode and STA mode work in the same frequency band, then the P2P mode can only use another frequency band, resulting in limited communication in P2P mode. When the Wi-Fi module of an electronic device has enabled AP mode and P2P mode, if the Wi-Fi module enables STA mode again, if the AP mode and P2P mode work in the same frequency band, the connection initiated by STA mode will most likely fail, resulting in the electronic device being unable to establish a connection with an external wireless network normally.

[0043] The embodiments of the present application disclose a frequency band switching method, device, electronic device and computer program product, which can avoid the situation where the communication of some working modes is restricted when the Wi-Fi module runs multiple different working modes at the same time, and ensure the stability and reliability of the Wi-Fi module when using multiple working modes for communication at the same time.

[0044] Figure 1 FIG. 1 is an application scenario of a frequency band switching method in an embodiment. Figure 1 As shown, the frequency band switching method can be applied to electronic devices 110, which may include but are not limited to mobile phones, wearable devices (such as smart watches, smart glasses, etc.), vehicle terminals, tablet computers, laptops, PCs (Personal Computers), and other devices.

[0045] The electronic device 110 may include a Wi-Fi module, which can support Wi-Fi technology. The Wi-Fi module can establish a Wi-Fi communication connection with other external devices and realize wireless network communication. The Wi-Fi module can support a variety of different working modes and can support the coexistence of multiple working modes, that is, the Wi-Fi module can run multiple working modes at the same time. For example, the Wi-Fi module can support the coexistence of STA mode, AP mode and P2P mode.

[0046] In some embodiments, the Wi-Fi module of the electronic device 110 can support DBS (Dual-band simultaneous) communication, and the Wi-Fi module can use the 2.4G band and the 5G band for communication at the same time, that is, the 2.4G band and the 5G band of the Wi-Fi module can transmit data in parallel to achieve dual-band concurrency.

[0047] Optionally, the Wi-Fi module of the electronic device 110 may include two Wi-Fi radio frequency modules, wherein one Wi-Fi radio frequency module may be used to support communications in the 2.4G frequency band, and the other Wi-Fi radio frequency module may be used to support communications in the 5G frequency band, and DBS communication is achieved through the two Wi-Fi radio frequency modules. Optionally, the Wi-Fi module of the electronic device 110 may also include only one Wi-Fi radio frequency module, which may support communications in both the 2.4G frequency band and the 5G frequency band, and DBS communication is achieved through the Wi-Fi radio frequency module. The embodiments of the present application do not specifically limit the Wi-Fi radio frequency module included in the Wi-Fi module.

[0048] It should be noted that the term "simultaneously" involved in the embodiments of the present application does not necessarily mean the same moment, but may also refer to the same time period or the same period of time.

[0049] In some embodiments, the Wi-Fi module of the electronic device 110 can support the coexistence of STA mode, AP mode and P2P mode. When the Wi-Fi module runs in STA mode, the electronic device 110 can be connected to the wireless network provided by the network device 120 as a client, and the network device 120 can be used as an AP in the wireless network. The network device 120 can be a router, etc., or a terminal device that creates a wireless hotspot, such as a mobile phone, wearable device, tablet computer or laptop computer.

[0050] When the Wi-Fi module runs in AP mode, the electronic device 110 can serve as an AP in the wireless network, the Wi-Fi module of the electronic device 110 can create a wireless hotspot, and the terminal device 130 can serve as a client to connect to the wireless hotspot created by the Wi-Fi module of the electronic device 110, thereby accessing the wireless network. The terminal device 130 may include but is not limited to a mobile phone, a wearable device, a tablet computer, a laptop computer, or a PC.

[0051] When the Wi-Fi module operates in P2P mode, the electronic device 110 and the terminal device 140 can directly establish a Wi-Fi communication connection without the help of an AP, such as directly establishing a Wi-Fi communication connection without the help of the network device 120. The terminal device 140 may include but is not limited to a mobile phone, a wearable device, a tablet computer, a laptop computer, a projector or a TV.

[0052] In the embodiment of the present application, when the Wi-Fi module of the electronic device 110 runs the first working mode and the second working mode at the same time, it is determined that both the first working mode and the second working mode use the first frequency band for communication, and the electronic device 110 switches the communication frequency band of the first working mode or the second working mode from the first frequency band to the second frequency band in response to the activation operation for the third working mode, and controls the Wi-Fi module to run the first working mode, the second working mode and the third working mode at the same time. By switching the communication frequency band of the first working mode or the second working mode from the first frequency band to the second frequency band, the communication of the enabled third working mode can be unrestricted, and the situation where the communication of some working modes is restricted when the Wi-Fi module runs multiple different working modes at the same time can be avoided.

[0053] like Figure 2 As shown, in one embodiment, a frequency band switching method is provided, which can be applied to the above electronic device, and the method may include the following steps:

[0054] Step 210: When the Wi-Fi module runs the first working mode and the second working mode at the same time, determine that both the first working mode and the second working mode use the first frequency band for communication.

[0055] The Wi-Fi module of the electronic device can support multiple working modes and can support the coexistence of multiple working modes. Optionally, the roles and actions of the Wi-Fi modules defined in different working modes in the wireless network are different. Further, the Wi-Fi module of the electronic device supports the first working mode, the second working mode and the third working mode, and the first working mode, the second working mode and the third working mode are different working modes supported by the Wi-Fi module. The Wi-Fi module of the electronic device can support the coexistence of the first working mode, the second working mode and the third working mode, that is, the Wi-Fi module of the electronic device can run the first working mode, the second working mode and the third working mode at the same time.

[0056] In some embodiments, the situation where the Wi-Fi module runs the first working mode and the second working mode at the same time may refer to the situation where the Wi-Fi module runs the first working mode and the second working mode at the same time but does not run the third working mode. The Wi-Fi module runs the first working mode and the second working mode in parallel. For example, the Wi-Fi module can establish a Wi-Fi communication connection with an external device based on the first working mode, and can establish another Wi-Fi communication connection with another external device based on the second working mode.

[0057] Optionally, when the Wi-Fi module runs the first working mode and the second working mode at the same time, the first working mode and the second working mode can use the same communication frequency band for communication. For example, the first working mode and the second working mode both use the first frequency band for communication, and the first frequency band can be a 2.4G frequency band or a 5G frequency band. The Wi-Fi communication connection established by the Wi-Fi module running in the first working mode and the Wi-Fi communication connection established by running in the second working mode can both transmit data through the first frequency band. Furthermore, the communication frequency corresponding to the first working mode and the communication frequency corresponding to the second working mode can be the same or different, which is not limited here.

[0058] Optionally, when the Wi-Fi module runs the first working mode and the second working mode at the same time, the first working mode and the second working mode may also use different communication frequency bands for communication. The Wi-Fi module runs the Wi-Fi communication connection established in the first working mode, and the Wi-Fi communication connection established in the second working mode, respectively using different communication frequency bands for data transmission. For example, the first working mode uses the 2.4G frequency band for communication, and the second working mode uses the 5G frequency band for communication, or the first working mode uses the 5G frequency band for communication, and the second working mode uses the 2.4G frequency band for communication, etc.

[0059] Step 220, in response to the activation operation for the third working mode, the communication frequency band of the first working mode or the second working mode is switched from the first frequency band to the second frequency band, and the Wi-Fi module is controlled to run the first working mode, the second working mode and the third working mode simultaneously.

[0060] When the Wi-Fi module runs the first working mode and the second working mode at the same time, if the first working mode and the second working mode use the same communication frequency band for communication, if the Wi-Fi module of the electronic device enables the third working mode, the communication in the third working mode may be restricted, affecting the stability of the Wi-Fi communication.

[0061] In some embodiments, the first working mode and the second working mode may include any two working modes among STA mode, AP mode and P2P mode, and the third working mode may be a working mode among STA mode, AP mode and P2P mode except the first working mode and the second working mode. For example, the first working mode and the second working mode may be STA mode and AP mode, and the third working mode may be P2P mode; or, the first working mode and the second working mode may be P2P mode and AP mode, and the third working mode may be STA mode; or, the first working mode and the second working mode may be STA mode and P2P mode, and the third working mode may be AP mode.

[0062] When the first working mode and the second working mode are different, and the enabled third working modes are different, the communication restriction situations encountered may be different. For example, when the first working mode and the second working mode are STA mode and AP mode, and the third working mode is P2P mode, if the STA mode and the AP mode work in the same communication frequency band, the P2P mode can only use another communication frequency band, resulting in P2P communication restriction; or, when the first working mode and the second working mode are P2P mode and AP mode, and the third working mode is STA mode, if the P2P mode and the AP mode work in the same communication frequency band, the STA mode has a high probability of connection failure, resulting in STA mode communication restriction; or, when the first working mode and the second working mode are STA mode and P2P mode, and the third working mode is AP mode, if the STA mode and the P2P mode work in the same communication frequency band, the AP mode can only use another communication frequency band, resulting in AP mode communication restriction, etc.

[0063] Therefore, when the Wi-Fi module runs the first working mode and the second working mode at the same time, if the first working mode and the second working mode use the same communication frequency band for communication, if the electronic device detects an activation operation for the third working mode, the communication frequency band of the first working mode or the second working mode can be switched, so that the first working mode and the second working mode use different frequency bands for communication. In the embodiment of the present application, the coexistence of working modes of different Wi-Fi modules can be avoided to avoid the situation where the communication of some working modes is restricted when the Wi-Fi module runs multiple different working modes at the same time, thereby ensuring the stability of communication of the Wi-Fi module when the STA mode, AP mode and P2P mode coexist.

[0064] The enabling operation for the third working mode may refer to an operation for enabling the Wi-Fi module to enable the third working mode. In some embodiments, the enabling operation for the third working mode may be triggered by a user, for example, the user triggers (such as clicking, etc.) an icon or button, key, etc. displayed on the electronic device to trigger the enabling operation for the third working mode.

[0065] For example, Figure 3A FIG. 1 is a schematic diagram of an interface of an electronic device in an embodiment. Figure 3A As shown, the electronic device can display a Wi-Fi connection interface 310, which may include multiple connectable wireless hotspots 312. The user can click on any connectable wireless hotspot to trigger the Wi-Fi module of the electronic device to connect to the wireless hotspot in STA mode. The user's operation of clicking on the wireless hotspot can be considered as an operation to enable the STA mode.

[0066] For example, Figure 3B FIG. 1 is a schematic diagram of an interface of an electronic device in another embodiment. Figure 3B As shown, the electronic device can display a personal hotspot interface 320, which may include a button 322 that allows other devices to join the network. The user can click the button 322 to trigger the Wi-Fi module of the electronic device to turn on the wireless hotspot. Other devices can connect to the wireless hotspot to achieve network access. The user clicks the button 322 to turn on the wireless hotspot, which can be considered as an operation to enable the AP mode.

[0067] For example, Figure 3C FIG. 1 is a schematic diagram of an interface of an electronic device in another embodiment. Figure 3CAs shown, the electronic device can run an application that can realize screen projection, multi-device collaborative work, etc. The electronic device can display the application interface 330 of the application, and the application interface 330 may include a screen projection button 332, etc. The user can click the screen projection button 332 to trigger the Wi-Fi module of the electronic device to establish a Wi-Fi P2P connection with the target device that needs screen projection based on the P2P mode, and transmit data through the Wi-Fi P2P connection to realize the screen projection function. The operation of the user clicking the screen projection button 332 can be regarded as an operation to enable the P2P mode.

[0068] It should be noted that the user may trigger the activation operation for the third working mode in other ways, which are not limited to the ways described in the above embodiments, for example, by voice triggering.

[0069] In some embodiments, the enabling operation for the third working mode may also be automatically triggered by the electronic device. For example, when the electronic device enters the coverage of the wireless network provided by the network device, the enabling operation of the STA mode may be automatically triggered, and the Wi-Fi module of the electronic device automatically connects to the wireless hotspot in STA mode, etc., but is not limited thereto.

[0070] The electronic device switches the communication frequency band of the first working mode or the second working mode of the Wi-Fi module from the first frequency band to the second frequency band. The working mode for frequency band switching can be a fixed working mode, for example, the AP mode can be used as a fixed working mode for frequency band switching, and only the AP mode is switched; it can also be a working mode determined according to actual business conditions. For example, the communication frequency band of the working mode that has less impact on the business between the first working mode and the second working mode can be switched.

[0071] After the communication frequency band of the first working mode or the second working mode of the Wi-Fi module is switched from the first frequency band to the second frequency band, the first working mode and the second working mode respectively use different communication frequency bands to work, and the Wi-Fi module operates in the Wi-Fi communication connection established in the first working mode and the Wi-Fi communication connection established in the second working mode, and transmits data through different communication frequency bands.

[0072] The electronic device can control the Wi-Fi module to operate in the third operating mode in response to an enabling operation for the third operating mode. The Wi-Fi module simultaneously operates in the first operating mode, the second operating mode and the third operating mode, thereby achieving coexistence of the first operating mode, the second operating mode and the third operating mode. Furthermore, since the first operating mode and the second operating mode respectively operate in different communication frequency bands, communication in the third operating mode will not be restricted. The third operating mode can communicate in the first frequency band or in the second frequency band, thereby ensuring the stability of the Wi-Fi module when communicating in three different operating modes at the same time.

[0073] In some embodiments, when the electronic device detects an activation operation for the third working mode, if the first working mode and the second working mode of the Wi-Fi module use different communication frequency bands for communication, since the communication of the third working mode to be activated will not be restricted, the communication frequency bands of the first working mode and the second working mode may not be adjusted, which can reduce the impact of the Wi-Fi module on the ongoing services in the first working mode and the second working mode when the third working mode is activated.

[0074] In an embodiment of the present application, when the Wi-Fi module simultaneously runs the first working mode and the second working mode, and the first working mode and the second working mode work in the same first frequency band, if the third working mode is enabled, the communication of the third working mode may be restricted. Therefore, by switching the communication frequency band of the first working mode or the second working mode from the first frequency band to the second frequency band, the communication of the enabled third working mode can be unrestricted, which can avoid the situation where the communication of some working modes is restricted when the Wi-Fi module runs multiple different working modes at the same time, thereby ensuring the stability and reliability of the Wi-Fi module when communicating in three different working modes at the same time.

[0075] In some embodiments, the first working mode and the second working mode may include STA mode and AP mode, and the third working mode that needs to be enabled may be P2P mode. Figure 4 As shown, the above-mentioned frequency band switching method may include the following steps:

[0076] Step 402: When the Wi-Fi module runs in STA mode and AP mode at the same time, determine that both the STA mode and the AP mode use the first frequency band for communication.

[0077] Step 404, in response to the activation operation for the P2P mode, the communication frequency band of the AP mode is switched from the first frequency band to the second frequency band, and the Wi-Fi module is controlled to run the STA mode, the AP mode and the P2P mode simultaneously.

[0078] When the Wi-Fi module of an electronic device runs STA mode and AP mode at the same time, and both STA mode and AP mode use the same first frequency band for communication, if the Wi-Fi module then enables P2P mode, communication in P2P mode may be restricted, for example, P2P mode can only use the second frequency band for communication, but cannot use the first frequency band for communication.

[0079] Since the communication frequency band used by the Wi-Fi module in STA mode is usually determined by the network device (such as a router or other terminal device, etc.) to which the Wi-Fi module is connected, and the communication frequency band used by the Wi-Fi module in AP mode can be determined by the Wi-Fi module itself. Therefore, when the Wi-Fi module runs STA mode and AP mode at the same time, and both STA mode and AP mode use the same first frequency band for communication, if the electronic device detects an enabling operation for P2P mode, the communication frequency band of the AP mode can be switched from the first frequency band to the second frequency band, and the STA mode remains unchanged in the first frequency band. This can avoid the problem of limited communication in P2P mode and reduce the complexity of switching the communication frequency band. The Wi-Fi module does not need to interact with external network devices to change the communication frequency band of the network device, which improves the convenience of frequency band switching and reduces the impact of communication frequency band switching.

[0080] In some embodiments, when it is determined that the communication frequency band of the AP mode needs to be switched from a first frequency band to a second frequency band, the electronic device may send switching information to each opposite device corresponding to the AP mode through the Wi-Fi module, wherein each opposite device corresponding to the AP mode may refer to a terminal device connected to the wireless hotspot provided by the Wi-Fi module. Each opposite device connected to the wireless hotspot provided by the Wi-Fi module may serve as a site device, and by connecting to the wireless hotspot provided by the Wi-Fi module, access the wireless network provided by the Wi-Fi module to achieve network communication.

[0081] The switching information can carry the frequency band information of the second frequency band. After receiving the switching information sent by the electronic device, each counterpart device corresponding to the AP mode can switch the communication frequency band between the wireless hotspot provided by the Wi-Fi module to the second frequency band according to the switching information. The Wi-Fi communication connection between each counterpart device and the Wi-Fi module of the electronic device can use the second frequency band for data transmission.

[0082] Optionally, the switching information may be a notification information sent in advance by the electronic device before the Wi-Fi module switches the communication frequency band of the AP mode. The switching information may also include a target frame interval for waiting for the communication frequency band switching. The target frame interval may indicate how many management frames (such as Beacon frames) intervals are required before the frequency band switching is performed. For example, it may be agreed that the frequency band switching will be performed after waiting for 3 management frame intervals, or it may be agreed that the frequency band switching will be performed immediately (i.e., waiting for 0 management frame intervals), etc., which are not limited here. After receiving the switching information sent by the electronic device, each opposite-end device corresponding to the AP mode may switch the communication frequency band between the wireless hotspot provided by the Wi-Fi module to the second frequency band according to the frequency band information of the second frequency band carried in the switching information and the target frame interval, after waiting for the management frame interval corresponding to the target frame interval. By performing the frequency band switching after agreeing on the target frame interval to wait in the switching information, it is possible to ensure that the Wi-Fi module of the electronic device switches the communication frequency band of the AP mode, and keeps synchronization with the communication frequency band switching of each opposite-end device corresponding to the AP mode, thereby improving the communication stability of the Wi-Fi module in the AP mode.

[0083] Optionally, after receiving the switching information sent by the electronic device, each counterpart device corresponding to the AP mode can first stop sending data frames to the Wi-Fi module of the electronic device, and then continue to send data frames to the Wi-Fi module of the electronic device after completing the communication frequency band switching, which can further improve the communication stability of the Wi-Fi module in AP mode.

[0084] After switching the communication frequency band of the AP mode to the second frequency band, the electronic device can establish a Wi-Fi P2P connection with other terminal devices in the first frequency band or the second frequency band through the Wi-Fi module and perform data transmission. The communication of the Wi-Fi module in the P2P mode is not restricted.

[0085] In an embodiment of the present application, when the Wi-Fi module runs the STA mode and the AP mode at the same time, and both the STA mode and the AP mode use the same first frequency band for communication, if the electronic device detects an enabling operation for the P2P mode, the communication band of the AP mode can be switched from the first frequency band to the second frequency band, while keeping the STA mode operating in the first frequency band unchanged. This can avoid the problem of limited communication in the P2P mode, reduce the complexity of switching the communication frequency band, and improve the convenience of switching the frequency band.

[0086] like Figure 5 As shown, in one embodiment, the first working mode and the second working mode may include a STA mode and an AP mode, and the third working mode to be enabled may be a P2P mode. The above-mentioned frequency band switching method may include the following steps:

[0087] Step 502: When the Wi-Fi module runs in STA mode and AP mode at the same time, determine that both the STA mode and the AP mode use the first frequency band for communication.

[0088] Step 504: In response to the activation operation for the P2P mode, frequency band negotiation is performed with a peer device corresponding to the P2P mode to negotiate to establish a Wi-Fi P2P connection based on the second frequency band.

[0089] When the Wi-Fi module of the electronic device runs STA mode and AP mode at the same time, and both STA mode and AP mode use the same first frequency band for communication, if the electronic device detects an activation operation for the P2P mode, it can first perform frequency band negotiation with the opposite device corresponding to the P2P mode to negotiate to establish a Wi-Fi P2P connection based on the second frequency band, and determine whether it is necessary to switch the communication frequency band of the AP mode based on the negotiation result.

[0090] In some embodiments, the process of establishing a Wi-Fi P2P connection between the Wi-Fi module of the electronic device and the peer device may generally include device sending (Device Discovery), service discovery (Service Discovery), group formation (GroupFormation) and other processes.

[0091] Among them, in the Device Discovery stage, the Wi-Fi module of the electronic device can search for P2P devices in the surrounding by sending a Probe Request frame and / or a Probe Response frame. Further, the Probe Request frame and the Probe Response frame can carry P2P protocol information for distinguishing from other communication protocols. Exemplarily, when the electronic device detects an enabling operation for the P2P mode, it can control the Wi-Fi module to enable the P2P mode. The Wi-Fi module can enter the P2P scanning phase (Scan Phase), send Probe Request frames on each frequency band it supports, and then the Wi-Fi module can enter the P2P search phase (Scan Phase). In the search phase, the Wi-Fi module can switch between the listening state and the search state. In the listening state, the Wi-Fi module can receive the Probe Request frames sent by other P2P devices and reply to the Probe Response frames. In the search state, the Wi-Fi module can send ProbeRequest frames.

[0092] After the Wi-Fi module of the electronic device sends other P2P devices (i.e., the peer devices corresponding to the P2P mode), the Service Discovery phase can be entered. For example, the Wi-Fi module of the electronic device can discover the services supported by other P2P devices through Generic Advertisement Service (GAS) frames, etc. It should be noted that the Service Discovery phase is not necessary for the process of establishing a Wi-Fi P2P connection.

[0093] After the Wi-Fi module of the electronic device sends other P2P devices, it can enter the Group Formation stage. The electronic device can negotiate their respective roles with other P2P devices, such as which device acts as a GO and which device acts as a GC. The GroupFormation stage may include a handshake process to negotiate their respective roles through three frame exchanges.

[0094] Exemplarily, after the Wi-Fi module of the electronic device and the peer device corresponding to the P2P mode complete the GroupFormation stage, or during the GroupFormation stage between the Wi-Fi module of the electronic device and the peer device corresponding to the P2P mode, a frequency band negotiation may be further performed with the peer device. The frequency band negotiation may refer to negotiating on which frequency band the P2P Group formed by the electronic device and the peer device corresponding to the P2P mode will operate, that is, negotiating the communication frequency band used for data transmission for P2P connection between the electronic device and the peer device corresponding to the P2P mode.

[0095] The Wi-Fi module of the electronic device and the peer device corresponding to the P2P mode can first negotiate to establish a Wi-Fi P2P connection based on the second frequency band. If the peer device supports Wi-Fi P2P connection in the second frequency band, the negotiation is successful, and the Wi-Fi module of the electronic device and the peer device corresponding to the P2P mode can establish a Wi-Fi P2P connection with the peer device based on the first frequency band.

[0096] For example, the electronic device may carry the frequency band information of the second frequency band (such as the frequency band number, channel number or frequency, etc.) in the GON Request (GO Negotiation Request) frame sent in the Group Formation stage. If the counterpart device corresponding to the P2P mode supports the second frequency band, the frequency band information of the second frequency band may be carried in the replied GON Response frame, so that the negotiation between the two is successful.

[0097] Optionally, the electronic device and the peer device corresponding to the P2P mode can also negotiate the frequency band in the Device Discovery stage. For example, the electronic device can carry the frequency band information of the second frequency band in the sent Probe Request frame to indicate the communication frequency band corresponding to the P2P Group formed assuming that the electronic device plays the role of GO. If other P2P devices that receive the ProbeRequest frame support the second frequency band, the frequency band information of the second frequency band can also be carried in the replied Probe Response frame, so that the negotiation between the two is successful.

[0098] It should be noted that the embodiment of the present application does not limit the specific time of frequency band negotiation in establishing a Wi-Fi P2P connection, and can be flexibly adjusted according to actual needs, or can be performed according to the provisions of the P2P-related communication protocol.

[0099] Step 506: If the negotiation with the peer device fails, the communication frequency band of the AP mode is switched from the first frequency band to the second frequency band, and a Wi-Fi P2P connection is established with the peer device based on the first frequency band.

[0100] Step 508: If the negotiation with the peer device is successful, a Wi-Fi P2P connection is established with the peer device based on the second frequency band.

[0101] If the negotiation between the electronic device and the peer device corresponding to the P2P mode fails, for example, the peer device does not support P2P communication connection in the second frequency band, since the communication frequency band used by the Wi-Fi module in both STA mode and AP mode is the first frequency band, the P2P mode can no longer use the first frequency band for communication, which will cause the Wi-Fi P2P connection between the electronic device and the peer device to be unable to perform data transmission in both the first frequency band and the second frequency band, and the P2P mode communication of the Wi-Fi module is limited.

[0102] Therefore, the electronic device can switch the communication frequency band of the AP mode in which the Wi-Fi module operates from the first frequency band to the second frequency band, and after successfully switching the communication frequency band of the AP mode from the first frequency band to the second frequency band, the Wi-Fi module can be controlled to establish a Wi-Fi P2P connection with the peer device based on the first frequency band. The Wi-Fi P2P connection established between the electronic device and the peer device can use the first frequency band for data transmission, thereby ensuring that the electronic device and the peer device corresponding to the P2P mode can successfully establish a Wi-Fi P2P connection and perform data transmission, solving the problem of communication restrictions on the P2P mode of the Wi-Fi module when the STA mode, AP mode and P2P mode coexist.

[0103] If the electronic device successfully negotiates with the peer device corresponding to the P2P mode, indicating that the peer device supports P2P communication connection in the second frequency band, the electronic device can control the Wi-Fi module to establish a Wi-Fi P2P connection with the peer device based on the second frequency band. The Wi-Fi P2P connection established between the electronic device and the peer device can use the second frequency band for data transmission. In the case where the electronic device successfully negotiates with the peer device corresponding to the P2P mode, since a Wi-Fi P2P connection can be established and data can be transmitted, the Wi-Fi module can continue to maintain the first frequency band in the communication frequency band used in the STA mode and the AP mode, and there is no need to switch the communication frequency band used in the STA mode and the AP mode. This can avoid the situation where the frequency band switching causes the interruption of data transmission in the STA mode or the AP mode, thereby ensuring the stability of data transmission of the Wi-Fi module in the STA mode and the AP mode.

[0104] In an embodiment of the present application, when the Wi-Fi module of the electronic device runs STA mode and AP mode at the same time, and both STA mode and AP mode use the same first frequency band for communication, if the electronic device detects an activation operation for P2P mode, it can first perform frequency band negotiation with the opposite device corresponding to the P2P mode to negotiate to establish a Wi-Fi P2P connection based on the second frequency band, and determine whether it is necessary to switch the communication frequency band of the AP mode based on the negotiation result. This can avoid the P2P mode communication of the Wi-Fi module being limited when the STA mode, AP mode and P2P mode coexist, and can avoid unnecessary frequency band switching that causes data transmission interruption in STA mode or AP mode, thereby improving the communication stability of the Wi-Fi module when the STA mode, AP mode and P2P mode coexist.

[0105] In some embodiments, the first working mode and the second working mode may include STA mode and P2P mode, and the third working mode that needs to be enabled may be AP mode. Figure 6 As shown, the above-mentioned frequency band switching method may include the following steps:

[0106] Step 602: When the Wi-Fi module runs the STA mode and the P2P mode at the same time, determine that both the STA mode and the P2P mode use the first frequency band for communication.

[0107] Step 604, in response to the activation operation for the AP mode, the communication frequency band of the P2P mode is switched from the first frequency band to the second frequency band, and the Wi-Fi module is controlled to run the STA mode, the P2P mode and the AP mode simultaneously.

[0108] When the Wi-Fi module of an electronic device runs STA mode and P2P mode at the same time, and both STA mode and P2P mode use the same first frequency band for communication, if the Wi-Fi module then enables AP mode, communication in AP mode may be restricted, for example, AP mode can only use the second frequency band for communication and cannot use the first frequency band for communication.

[0109] Since the communication frequency band used by the Wi-Fi module in STA mode is usually determined by the network device (such as a router or other terminal device, etc.) to which the Wi-Fi module is connected, and if the Wi-Fi module plays the role of GO in P2P mode, the communication frequency band used in the P2P mode can be determined by the Wi-Fi module. Therefore, when the Wi-Fi module of the electronic device runs STA mode and P2P mode at the same time, and both STA mode and P2P mode use the same first frequency band for communication, if the electronic device detects an enabling operation for AP mode, the communication frequency band of the P2P mode can be switched from the first frequency band to the second frequency band, and the STA mode remains unchanged in the first frequency band, which can avoid the problem of communication restriction on AP mode and reduce the complexity of communication frequency band switching. The Wi-Fi module does not need to interact with external network devices to change the communication frequency band of the network device, which improves the convenience of frequency band switching and reduces the impact of communication frequency band switching.

[0110] In some embodiments, when it is determined that the communication frequency band of the P2P mode needs to be switched from the first frequency band to the second frequency band, the electronic device can send switching information to each peer device corresponding to the P2P mode through the Wi-Fi module, wherein each peer device corresponding to the P2P mode refers to a terminal device that establishes a Wi-Fi P2P connection with the Wi-Fi module. Further, the role of the electronic device in the Wi-Fi P2P connection can be a GO, and the role of each peer device corresponding to the P2P mode can be a GC.

[0111] After each peer device corresponding to the P2P mode receives the switching information sent by the electronic device, it can switch the communication frequency band used for the Wi-Fi P2P connection with the electronic device to the second frequency band according to the switching information, and the Wi-Fi P2P connection between each peer device and the electronic device can use the second frequency band for data transmission.

[0112] It should be noted that the manner in which the electronic device sends switching information to each peer device corresponding to the P2P mode so that each peer device corresponding to the P2P mode switches the communication frequency band of the Wi-Fi P2P connection may be similar to the manner described in the above embodiment in which the electronic device sends switching information to each peer device corresponding to the AP mode so that each peer device corresponding to the AP mode switches the communication frequency band of the Wi-Fi communication connection with the Wi-Fi module of the electronic device. Therefore, the description of the electronic device sending switching information to each peer device corresponding to the P2P mode so that each peer device corresponding to the P2P mode switches the communication frequency band of the Wi-Fi P2P connection may refer to the relevant description in the above embodiment and will not be repeated here.

[0113] After switching the communication frequency band of the P2P mode to the second frequency band, the electronic device can control the Wi-Fi module to enable the AP mode, provide a wireless hotspot to other terminal devices, and the wireless hotspot can work in the first frequency band or the second frequency band. Other terminal devices can connect to the wireless hotspot to access the wireless network and access the Internet. The communication of the Wi-Fi module in the AP mode is not restricted.

[0114] Exemplarily, when controlling the Wi-Fi module to create a wireless hotspot, the hotspot information corresponding to the wireless hotspot can be configured, such as the hotspot name of the wireless hotspot, the connection password, etc. The electronic device can broadcast a Beacon management frame through the Wi-Fi module. The Beacon management frame can carry the hotspot name of the wireless hotspot, the MAC address (Media Access Control Address), etc. The other terminal devices around the electronic device can scan the Beacon management frame and display the wireless hotspot in the connection list according to the hotspot name, MAC address, and other information of the wireless hotspot carried in the Beacon management frame. Users of other terminal devices can select the wireless hotspot in the connection list for connection. After the electronic device and the other terminal device perform identity authentication, the other terminal devices can connect to the wireless hotspot provided by the Wi-Fi module and access the wireless network provided by the wireless hotspot.

[0115] In some embodiments, when the user selects to enable the AP mode of the Wi-Fi module of the electronic device, the communication frequency band of the AP mode can be selected. The electronic device can determine the target frequency band used by the AP mode selected by the user in response to the enabling operation for the AP mode, and the target frequency band is the communication frequency band of the AP mode selected by the user. For example, the user can select the 2.4G frequency band as the target frequency band used by the AP mode, or the 5G frequency band as the target frequency band used by the AP mode, etc., but is not limited thereto.

[0116] It can be determined whether the target frequency band used by the AP mode selected by the user is the first frequency band. If the target frequency band is the first frequency band, it means that the target frequency band used by the AP mode selected by the user is the same as the communication frequency band currently used by the STA mode and P2P mode of the Wi-Fi module. The AP mode cannot use the first frequency band for communication. Therefore, the communication frequency band of the P2P mode can be switched from the first frequency band to the second frequency band. After the communication frequency band of the P2P mode is switched from the first frequency band to the second frequency band, the Wi-Fi module can be controlled to enable the AP mode and turn on the wireless hotspot. The wireless hotspot can work in the first frequency band (i.e., the target frequency band selected by the user), thereby solving the problem of communication restrictions on the AP mode when the Wi-Fi module coexists in the STA mode, the P2P mode, and the AP mode, and can meet the needs of users to independently select the communication frequency band of the AP mode, thereby improving the user experience.

[0117] In some embodiments, if the target frequency band used by the AP mode selected by the user is not the first frequency band, it means that the target frequency band used by the AP mode selected by the user is different from the communication frequency band currently used by the STA mode and P2P mode of the Wi-Fi module. For example, if the target frequency band selected by the user is the second frequency band, the AP mode can use the second frequency band for communication. Therefore, the Wi-Fi module can continue to maintain the first frequency band in the communication frequency band used by the STA mode and the P2P mode, and can control the Wi-Fi module to enable the AP mode and turn on the wireless hotspot. The wireless hotspot can work in the second frequency band without switching the communication frequency bands used by the STA mode and the AP mode. This can avoid the situation where the data transmission in the STA mode or the P2P mode is interrupted due to the frequency band switching, and ensure the data transmission stability of the Wi-Fi module in the STA mode and the P2P mode.

[0118] In some embodiments, when the electronic device detects an enabling operation for the AP mode, if the electronic device plays the role of GC instead of GO in the Wi-Fi P2P connection, since the electronic device cannot actively switch the communication frequency band of the STA mode or the P2P mode, it can automatically select the communication frequency band of the AP mode as the second frequency band, directly control the Wi-Fi module to enable the AP mode, turn on the wireless hotspot, and let the wireless hotspot operate in the second frequency band. The user does not select the communication frequency band used for the AP mode, which can avoid conflicts between the communication frequency band selected by the user and the communication frequency band used by the Wi-Fi module in the STA mode and the P2P mode, causing inconvenience to the user.

[0119] As another implementation, when the Wi-Fi module of the electronic device runs the STA mode and the P2P mode at the same time, and both the STA mode and the P2P mode use the same first frequency band for communication, if an enabling operation for the AP mode is detected, the AP mode of the Wi-Fi module can be defaulted to operate in the second frequency band, and the Wi-Fi module can be directly controlled to enable the AP mode, turn on the wireless hotspot, and make the wireless hotspot operate in the second frequency band, thereby avoiding the situation where the Wi-Fi module is already running the STA mode and the P2P mode, and then enabling the AP mode to affect the data transmission in the STA mode and the P2P mode.

[0120] In an embodiment of the present application, when the Wi-Fi module runs the STA mode and the P2P mode at the same time, and both the STA mode and the P2P mode use the same first frequency band for communication, if the electronic device detects an enabling operation for the AP mode, the communication frequency band of the P2P mode can be switched from the first frequency band to the second frequency band, and the STA mode can be kept working in the first frequency band unchanged, which can avoid the problem of limited communication in the AP mode, reduce the complexity of switching the communication frequency band, and improve the convenience of switching the frequency band.

[0121] In some embodiments, the first working mode and the second working mode may include a P2P mode and an AP mode, and the third working mode that needs to be enabled may be a STA mode. Figure 7 As shown, the above-mentioned frequency band switching method may include the following steps:

[0122] Step 702: When the Wi-Fi module operates in AP mode and P2P mode at the same time, determine that both the AP mode and the P2P mode use the first frequency band for communication.

[0123] Step 704, in response to the enabling operation for the STA mode, the communication frequency band of the AP mode or the P2P mode is switched from the first frequency band to the second frequency band, and the Wi-Fi module is controlled to run the AP mode, the P2P mode and the STA mode simultaneously.

[0124] When the Wi-Fi module of an electronic device runs AP mode and P2P mode at the same time, and both AP mode and P2P mode use the same first frequency band for communication, if the Wi-Fi module enables STA mode again, communication in STA mode may be restricted. For example, when the STA mode of the Wi-Fi module is enabled, connection with external network devices will most likely fail.

[0125] As an implementation method, since the P2P mode does not support switching of communication frequency bands in some scenarios, or the current P2P mode is performing front-end business transmission (such as using Wi-Fi P2P connection for screen projection, etc.), the AP mode can be directly used as the working mode for switching the communication frequency band. When the Wi-Fi module of the electronic device runs AP mode and P2P mode at the same time, and both the AP mode and the P2P mode use the same first frequency band for communication, if the electronic device detects an enabling operation for the STA mode, the communication frequency band of the AP mode can be directly switched from the first frequency band to the second frequency band, and the P2P mode can be kept working in the first frequency band unchanged, which can improve the success rate of the frequency band switching and reduce the impact on user use.

[0126] As another implementation, when the Wi-Fi module of the electronic device runs AP mode and P2P mode at the same time, and both AP mode and P2P mode use the same first frequency band for communication, if the electronic device detects an enabling operation for STA mode, it can also select one of the working modes from AP mode and P2P mode to switch the frequency band according to the service conditions corresponding to the AP mode and P2P mode respectively.

[0127] Alternatively, if Figure 8 As shown, the step of switching the communication frequency band of the AP mode or the P2P mode from the first frequency band to the second frequency band may include steps 802 to 804.

[0128] Step 802: Acquire first service information corresponding to the AP mode and second service information corresponding to the P2P mode.

[0129] The first service information may refer to information used to describe the current service situation of the AP mode. For example, the first service information may include one or more of the number of first connected devices corresponding to the AP mode, the first service type corresponding to the AP mode, and the first data transmission volume. Among them, the number of first connected devices may refer to the number of other terminal devices currently connected to the wireless hotspot provided by the Wi-Fi module. The first service type may refer to the service type corresponding to the data transmitted by other terminal devices through the Wi-Fi communication connection between the wireless hotspot provided by the Wi-Fi module, such as real-time transmission service, non-real-time transmission service, etc. The real-time transmission service may refer to data with high real-time requirements, such as video service data, game service data, audio service data, etc. Non-real-time transmission service may refer to data with low real-time requirements, such as background download service data, but is not limited thereto. The first data transmission volume may refer to the amount of data transmitted by other terminal devices through the Wi-Fi communication connection between the wireless hotspot provided by the Wi-Fi module. Exemplarily, the first data transmission volume can be represented by occupied bandwidth, etc.

[0130] The second service information may refer to information used to describe the current service situation of the P2P mode. For example, the second service information may include one or more of the number of second connected devices corresponding to the P2P mode, the second service type corresponding to the P2P mode, and the second data transmission volume. Among them, the number of second connected devices may refer to the number of other terminal devices that currently establish a Wi-Fi P2P connection with the electronic device. The second service type may refer to the service type corresponding to the data transmitted by other terminal devices through the Wi-Fi P2P connection between the electronic device, such as real-time transmission services (such as screen projection data, etc.), non-real-time transmission services (such as file transfer data), etc. The second data transmission volume may refer to the amount of data transmitted by other terminal devices through the Wi-Fi P2P connection between the electronic device and the electronic device. Exemplarily, the second data transmission volume can be represented by occupied bandwidth, etc.

[0131] Step 804: Determine a target working mode from the AP mode and the P2P mode according to the first service information and the second service information, and switch the communication frequency band of the target working mode from the first frequency band to the second frequency band.

[0132] Based on the first business information and the second business information, the business conditions corresponding to the AP mode and the P2P mode of the Wi-Fi module can be evaluated respectively, and the working mode in which the communication frequency band switching has less impact on the business can be selected as the target working mode. Alternatively, the working mode in which the communication frequency band switching has less impact on the user can be selected as the target working mode.

[0133] In some embodiments, one or more of the following methods may be used to select a target operating mode from the AP mode and the P2P mode.

[0134] Method 1: Select a working mode with a smaller number of connected devices as the target working mode.

[0135] The number of first connected devices can be compared with the number of second connected devices. If the number of first connected devices is less than or equal to the number of second connected devices, the AP mode can be determined as the target working mode; if the number of first connected devices is greater than the number of second connected devices, the P2P mode is determined as the target working mode.

[0136] The number of first connected devices is less than or equal to the number of second connected devices, indicating that the number of opposite-end devices connected to the Wi-Fi module in AP mode is less than or equal to the number of opposite-end devices connected to the Wi-Fi module in P2P mode. Therefore, the AP mode can be determined as the target working mode, and the communication frequency band of the AP mode can be switched from the first frequency band to the second frequency band, and the communication frequency band used in the P2P mode can remain the first frequency band.

[0137] The number of the first connected devices is greater than the number of the second connected devices, indicating that the number of peer devices connected to the Wi-Fi module in AP mode is greater than the number of peer devices connected to the Wi-Fi module in P2P mode. Therefore, the P2P mode can be determined as the target working mode, and the communication frequency band of the P2P mode can be switched from the first frequency band to the second frequency band, and the communication frequency band used in the AP mode can remain the first frequency band.

[0138] By adopting the above-mentioned method, the number of opposite-end devices that need to perform frequency band switching can be reduced, thereby reducing the impact of frequency band switching on transmission services.

[0139] Method 2: Select the working mode of data transmission related to the current non-real-time transmission service as the target working mode.

[0140] If the first service type is a real-time transmission service, the P2P mode may be determined as the target working mode; if the second service type is a real-time transmission service, the AP mode may be determined as the target working mode. Further, if the first service type is a real-time transmission service and the second service type is a non-real-time transmission service, the P2P mode may be determined as the target working mode; if the second service type is a real-time transmission service and the first service type is a non-real-time transmission service, the AP mode may be determined as the target working mode.

[0141] If the first service type is a real-time transmission service, it means that the data transmitted by the Wi-Fi module in the AP mode has a high real-time requirement, then the P2P mode can be determined as the target working mode, and the communication frequency band of the P2P mode is switched from the first frequency band to the second frequency band, and the communication frequency band used in the AP mode can remain the first frequency band. If the second service type is a real-time transmission service, it means that the data transmitted by the Wi-Fi module in the P2P mode has a high real-time requirement, then the AP mode can be determined as the target working mode, and the communication frequency band of the AP mode is switched from the first frequency band to the second frequency band, and the communication frequency band used in the P2P mode can remain the first frequency band.

[0142] Exemplarily, if the first service type is the same as the second service type, for example, both are real-time transmission services or both are non-real-time transmission services, other methods can be used to select the target operating mode, such as selecting an operating mode with a smaller number of connected devices as the target operating mode, etc., which is not limited here.

[0143] By adopting the above method, the Wi-Fi module can try not to switch the communication frequency band when performing real-time transmission business, which can reduce the impact on real-time transmission business, avoid the frequency band switching causing obvious lag or no network experience to users, reduce the adverse effects caused by frequency band switching, and improve the user experience.

[0144] Method three: select a working mode with a smaller data transmission volume as the target working mode.

[0145] The first data transmission amount can be compared with the second data transmission amount. If the first data transmission amount is less than the second data transmission amount, the AP mode can be determined as the target working mode; if the first data transmission amount is greater than the second data transmission amount, the P2P mode can be determined as the target working mode.

[0146] The first data transmission volume is smaller than the second data transmission volume, and the data volume transmitted by the Wi-Fi module in AP mode is smaller than the data volume transmitted in P2P mode. Therefore, the AP mode can be determined as the target working mode, and the communication frequency band of the AP mode can be switched from the first frequency band to the second frequency band, and the communication frequency band used in the P2P mode can remain the first frequency band.

[0147] The first data transmission volume is greater than the second data transmission volume, and the data volume transmitted by the Wi-Fi module in AP mode is greater than the data volume transmitted in P2P mode. Therefore, the P2P mode can be determined as the target working mode, and the communication frequency band of the P2P mode can be switched from the first frequency band to the second frequency band, and the communication frequency band used in the AP mode can remain the first frequency band.

[0148] By adopting the above-mentioned method, a working mode with a smaller data transmission volume is selected to perform frequency band switching, so as to reduce the impact of frequency band switching on transmission services.

[0149] It should be noted that the above-mentioned methods can also be judged comprehensively. For example, the impact of frequency band switching on AP mode and P2P mode can be evaluated from multiple dimensions such as the number of connected devices, service type and data transmission volume, and the working mode with less impact can be selected as the target working mode.

[0150] In an embodiment of the present application, when the Wi-Fi module runs AP mode and P2P mode at the same time, and both AP mode and P2P mode use the same first frequency band for communication, if the electronic device detects an activation operation for AP mode, it can select the target working mode for frequency band switching based on the respective business conditions of P2P mode and AP mode, which can avoid the problem of limited communication in STA mode, reduce the impact of frequency band switching on the transmission service of the Wi-Fi module, and improve user experience.

[0151] After switching the communication frequency band of AP mode or P2P mode to the second frequency band, the electronic device can control the Wi-Fi module to connect to the external network device, and the Wi-Fi module can connect to the wireless hotspot provided by the external network device to access the wireless network, thereby ensuring that the electronic device successfully establishes a Wi-Fi communication connection with the external network device.

[0152] In an embodiment of the present application, when the Wi-Fi module runs AP mode and P2P mode at the same time, and both AP mode and P2P mode use the same first frequency band for communication, if the electronic device detects an activation operation for AP mode, the communication frequency band of AP mode or P2P mode can be switched from the first frequency band to the second frequency band, thereby improving the success rate of the Wi-Fi module in establishing a Wi-Fi communication connection with an external network device when AP mode, P2P mode and STA mode coexist, and improving the stability of communication.

[0153] like Fig. 9 As shown, in one embodiment, the first working mode and the second working mode may include a P2P mode and an AP mode, and the third working mode to be enabled may be a STA mode. The above-mentioned frequency band switching method may include the following steps:

[0154] Step 902: When the Wi-Fi module runs both the AP mode and the P2P mode, determine that both the AP mode and the P2P mode use the first frequency band for communication.

[0155] Step 904: In response to the enabling operation for the STA mode, intercepting a connection instruction generated by the enabling operation for the STA mode.

[0156] When the Wi-Fi module runs AP mode and P2P mode at the same time, and both AP mode and P2P mode use the first frequency band for communication, the Wi-Fi module enables STA mode, and the Wi-Fi module of the electronic device can connect to the wireless hotspot provided by the external network device.

[0157] For example, the electronic device can search for wireless hotspots in the surrounding area and obtain hotspot information of each wireless hotspot found, such as the hotspot name, MAC address, and other information of the wireless hotspot. The electronic device can display a connection list, which can include information such as the hotspot name of each wireless hotspot found, and the user can select any wireless hotspot to connect. Alternatively, the electronic device can search for wireless hotspots in the surrounding area, and if a wireless hotspot that has been connected before is found, a connection can be established directly with the wireless hotspot.

[0158] When the Wi-Fi module enables STA mode, the Wi-Fi module can send a connection instruction to an external network device, and the connection instruction can be used to establish a Wi-Fi communication connection with the network device. When the Wi-Fi module runs AP mode and P2P mode at the same time, and both AP mode and P2P mode use the first frequency band for communication, the electronic device can first intercept the generated connection instruction, not send the connection instruction to the network device, wait for the communication frequency band of AP mode or P2P mode to complete the switch, and then send the connection instruction to the network device.

[0159] Step 906: Switch the communication frequency band of the AP mode or the P2P mode from the first frequency band to the second frequency band.

[0160] The description of step 906 may refer to the related description of step 604 in the above embodiment, which will not be repeated here.

[0161] Step 908: Send a connection instruction to the network device, where the connection instruction is used to establish a Wi-Fi communication connection with the network device.

[0162] After switching the communication frequency band of the AP mode or P2P mode from the first frequency band to the second frequency band, the electronic device can send a connection instruction to the network device through the Wi-Fi module. After receiving the connection instruction, the network device can perform identity authentication on the electronic device. After the identity authentication is successful, the electronic device can connect to the wireless hotspot provided by the network device and access the wireless network corresponding to the wireless hotspot.

[0163] Exemplarily, after switching the communication frequency band of AP mode or P2P mode from the first frequency band to the second frequency band, the electronic device can send a verification request (such as an Authentication frame, etc.) to the network device through the Wi-Fi module for identity authentication. During the identity authentication process, the network device can verify the password and other information sent by the electronic device. If the identity authentication is successful, the network device can add a successful authentication message. After the electronic device receives the successful authentication message, it can send a connection request (such as an Association Request frame, etc.) to the network device. After receiving the connection request, the network device determines that the capabilities of both parties match, and then it can reply to the electronic device with a connection response (such as an Association Response frame). The electronic device successfully connects to the wireless hotspot provided by the network device.

[0164] In an embodiment of the present application, when the Wi-Fi module runs AP mode and P2P mode at the same time, and both AP mode and P2P mode use the first frequency band for communication, if an enabling operation for switching the communication frequency band of STAAP mode or P2P mode from the first frequency band to the second frequency band mode is detected, the connection instruction generated by the enabling operation of the STA mode can be intercepted first, and after the communication frequency band of the AP mode or P2P mode is switched from the first frequency band to the second frequency band, the connection instruction can be sent to the network device, thereby improving the success rate of establishing a Wi-Fi communication connection with the network device and improving the stability of communication of the Wi-Fi module in STA mode.

[0165] In some embodiments, before switching the communication frequency band of the first working mode or the second working mode from the first frequency band to the second frequency band, the target channel to be switched in the second frequency band may be determined first, and then the first working mode or the second working mode may be switched to the target channel for communication. Fig.10 As shown, the step of switching the communication frequency band of the first working mode or the second working mode from the first frequency band to the second frequency band may include the following steps:

[0166] Step 1002: Scan multiple channels included in the second frequency band respectively to obtain channel interference information of each channel.

[0167] The first frequency band and the second frequency band may include a plurality of different channels respectively. When it is determined that the communication frequency band of the first working mode or the second working mode needs to be switched from the first frequency band to the second frequency band, the plurality of channels included in the second frequency band may be obtained, and the plurality of channels included in the second frequency band may be scanned respectively to obtain channel interference information of each channel, and the channel interference information may refer to information that can describe the communication interference situation of the channel, for example, the channel interference information may include but is not limited to one or more of the number of devices on the channel, signal strength, signal-to-noise ratio, signal quality, etc.

[0168] As an implementation, after determining the second frequency band, a channel list corresponding to the second frequency band may be obtained, and the channel list may include each channel included in the second frequency band and available for communication. Furthermore, since the channels included in the Wi-Fi 2.4G frequency band and the Wi-Fi 5G frequency band may be different in different countries, the channel list corresponding to the second frequency band may be obtained according to the country code corresponding to the electronic device, thereby improving the accuracy of scanning and channel switching.

[0169] After acquiring the channel list corresponding to the second frequency band, the electronic device may send a detection signal on each channel of the second frequency band, and determine channel interference information of each channel according to the detection result.

[0170] Step 1004: determine a target channel from multiple channels according to the channel interference information of each channel.

[0171] According to the channel interference information of each channel included in the second frequency band, a channel with less interference (ie, better communication quality) can be selected as the target channel.

[0172] Exemplarily, the channel interference information may include the number of devices on the channel, and the target channel may be the channel with the least number of devices among the multiple channels included in the second frequency band; and / or, the channel interference information may include signal strength, and the target channel may be the channel with the highest signal strength among the multiple channels included in the second frequency band; and / or, the channel interference information may include signal-to-noise ratio, and the target channel may be the channel with the highest signal-to-noise ratio among the multiple channels included in the second frequency band.

[0173] As an implementation method, corresponding weights may be assigned to different channel interference information, and the interference information of each channel may be integrated by weighted fusion to evaluate the interference degree of each channel. For example, the number of devices, signal strength, and signal-to-noise ratio on each channel may be weighted (such as weighted average calculation or weighted sum calculation, etc.) to obtain the interference value corresponding to each channel, and the channel with the smallest interference value may be selected as the target channel.

[0174] In this implementation, a variety of different approaches may be used to select a channel with less interference (ie, better communication quality) as the target channel, thereby improving the accuracy of selecting the target channel.

[0175] Step 1006: Switch the channel used by the first working mode or the second working mode to a target channel of the second frequency band.

[0176] After determining the target frequency band from the multiple frequency bands included in the second frequency band, the channel used in the first working mode or the second working mode may be switched to the target channel of the second frequency band.

[0177] In some embodiments, after determining the target frequency band from multiple frequency bands included in the second frequency band, the electronic device may send channel switching information to each opposite device corresponding to the target working mode, and the channel switching information is used to instruct the opposite device to switch to the target channel of the second frequency band for communication; the target working mode may be a working mode for switching the communication frequency band between the first working mode and the second working mode.

[0178] The electronic device may send channel switching information to each peer device corresponding to the target working mode, and the channel switching information may carry the channel identifier of the target channel, such as the channel number, or the frequency band corresponding to the channel, etc. After receiving the channel switching information, each peer device may switch the Wi-Fi communication connection with the electronic device to the target channel for communication according to the channel switching information.

[0179] For example, if the target working mode is AP mode, the electronic device can send channel switching information to each opposite device corresponding to the AP mode, that is, it can send channel switching information to each other terminal device connected to the wireless hotspot provided by the Wi-Fi module. After receiving the channel switching information, each opposite device corresponding to the AP mode can migrate the Wi-Fi communication connection between the wireless hotspot provided by the Wi-Fi module of the electronic device to the target channel for communication, thereby realizing the communication frequency band switching of the AP mode.

[0180] For example, if the target working mode is P2P mode, the electronic device can send channel switching information to each opposite device corresponding to the P2P mode, that is, it can send channel switching information to each other terminal device that establishes a Wi-Fi P2P connection with the electronic device. After receiving the channel switching information, each opposite device corresponding to the P2P mode can migrate the Wi-Fi P2P connection between the electronic device and the target channel for communication, thereby realizing the communication frequency band switching of the P2P mode.

[0181] As an implementation method, channel switching of the target working mode can be implemented based on CSA (Channel Switch Announcement) technology. Channel switching information may include an action frame in the CSA technology, and the action frame may include information such as the channel number of the target channel and the channel switching timing, wherein the channel switching timing is used to agree on how many Beacon frame intervals to wait before performing channel switching. After each peer device receives the action frame sent by the electronic device, it can complete the channel switching synchronously with the electronic device according to the channel number of the target channel carried in the action frame and the channel switching timing information. Implementing channel switching of the target working mode based on CSA technology can ensure that during the channel switching process, the Wi-Fi communication connection between the electronic device and each peer device is not disconnected, and the peer device can adjust to the new channel for communication in time, without affecting the connectivity of the transmission service, thereby improving the communication fluency and stability.

[0182] In the above-mentioned embodiment, after determining the target frequency band from the multiple frequency bands included in the second frequency band, the electronic device can send channel switching information to each opposite device corresponding to the target working mode, so that each opposite device corresponding to the target working mode can synchronously perform channel switching, thereby ensuring the communication accuracy and stability between the electronic device and each opposite device corresponding to the target working mode.

[0183] In an embodiment of the present application, based on the channel interference information of each channel included in the second frequency band, a channel with less interference (i.e., better communication quality) can be selected as the target channel, and then the channel used in the first working mode or the second working mode can be switched to the target channel, thereby reducing network congestion and improving the network stability and data transmission efficiency of the first working mode or the second working mode after the frequency band switching.

[0184] like Fig.11 As shown, in one embodiment, a frequency band switching device 1100 is provided, which can be applied to the above-mentioned electronic device. The frequency band switching device 1100 may include a frequency band determining module 1110 and a frequency band switching module 1120 .

[0185] The frequency band determination module 1110 is used to determine that both the first working mode and the second working mode use the first frequency band for communication when the Wi-Fi module runs the first working mode and the second working mode at the same time.

[0186] The frequency band switching module 1120 is used to switch the communication frequency band of the first working mode or the second working mode from the first frequency band to the second frequency band in response to the enabling operation for the third working mode, and control the Wi-Fi module to simultaneously operate the first working mode, the second working mode and the third working mode; the first working mode, the second working mode and the third working mode are different working modes supported by the Wi-Fi module.

[0187] In one embodiment, the first working mode and the second working mode include any two working modes among STA mode, AP mode and P2P mode; the third working mode includes working modes among STA mode, AP mode and P2P mode except the first working mode and the second working mode.

[0188] In one embodiment, the first working mode and the second working mode include a STA mode and an AP mode; the frequency band switching module 1120 is further configured to switch the communication frequency band of the AP mode from the first frequency band to the second frequency band; or,

[0189] The first working mode and the second working mode include STA mode and P2P mode; the frequency band switching module 1120 is further used to switch the communication frequency band of the P2P mode from the first frequency band to the second frequency band; or,

[0190] The first working mode and the second working mode include an AP mode and a P2P mode. The frequency band switching module 1120 is further used to switch the communication frequency band of the AP mode or the P2P mode from the first frequency band to the second frequency band.

[0191] In one embodiment, the frequency band switching module 1120 is also used to obtain first business information corresponding to the AP mode and second business information corresponding to the P2P mode; based on the first business information and the second business information, determine the target working mode from the AP mode and the P2P mode, and switch the communication frequency band of the target working mode from the first frequency band to the second frequency band.

[0192] In one embodiment, the first service information includes the number of first connected devices corresponding to the AP mode, and the second service information includes the number of second connected devices corresponding to the P2P mode.

[0193] The frequency band switching module 1120 is also used to compare the number of first connected devices with the number of second connected devices; if the number of first connected devices is less than or equal to the number of second connected devices, the AP mode is determined as the target working mode; if the number of first connected devices is greater than the number of second connected devices, the P2P mode is determined as the target working mode.

[0194] In one embodiment, the first service information includes a first service type corresponding to the AP mode, and the second service information includes a second service type corresponding to the P2P mode.

[0195] The frequency band switching module 1120 is further configured to determine the P2P mode as the target working mode if the first service type is a real-time transmission service; and to determine the AP mode as the target working mode if the second service type is a real-time transmission service.

[0196] In one embodiment, the frequency band switching module 1120 includes a channel scanning unit, a channel determining unit and a switching unit.

[0197] The channel scanning unit is used to scan the multiple channels included in the second frequency band respectively to obtain channel interference information of each channel.

[0198] The channel determination unit is used to determine a target channel from a plurality of channels according to channel interference information of each channel.

[0199] A switching unit is used to switch a channel used in the first working mode or the second working mode to a target channel in the second frequency band.

[0200] In one embodiment, the frequency band switching device 1100 further includes a first sending module.

[0201] The first sending module is used to send channel switching information to each opposite device corresponding to the target working mode, and the channel switching information is used to instruct the opposite device to switch to the target channel of the second frequency band for communication; the target working mode is the working mode of switching the communication frequency band between the first working mode and the second working mode.

[0202] In one embodiment, the channel interference information includes the number of devices on the channel, and the target channel is a channel with the least number of devices among the multiple channels; and / or,

[0203] The channel interference information includes signal strength, and the target channel is a channel with the largest signal strength among multiple channels; and / or,

[0204] The channel interference information includes a signal-to-noise ratio, and the target channel is a channel with the largest signal-to-noise ratio among multiple channels.

[0205] In one embodiment, the first working mode and the second working mode include STA mode and AP mode, and the third working mode includes P2P mode; the frequency band switching module 1120 is also used to respond to the enabling operation for the P2P mode, and perform frequency band negotiation with the peer device corresponding to the P2P mode to negotiate to establish a Wi-Fi P2P connection based on the second frequency band; if the negotiation with the peer device fails, the communication frequency band of the AP mode is switched from the first frequency band to the second frequency band.

[0206] In one embodiment, the third working mode includes a STA mode; the frequency band switching device 1100 further includes an intercepting module and a second sending module.

[0207] The interception module is used for intercepting the connection instruction generated by the enabling operation of the STA mode in response to the enabling operation of the STA mode.

[0208] The second sending module is also used to send a connection instruction to the network device after the communication frequency band of the first working mode or the second working mode is switched from the first frequency band to the second frequency band through the frequency band switching module 1120, and the connection instruction is used to establish a Wi-Fi communication connection with the network device.

[0209] In one embodiment, the first working mode and the second working mode include STA mode and P2P mode, and the third working mode includes AP mode; the frequency band switching module 1120 is also used to determine the target frequency band used by the AP mode selected by the user in response to the enabling operation for the AP mode; if the target frequency band is the first frequency band, the communication frequency band of the P2P mode is switched from the first frequency band to the second frequency band.

[0210] In an embodiment of the present application, when the Wi-Fi module simultaneously runs the first working mode and the second working mode, and the first working mode and the second working mode work in the same first frequency band, if the third working mode is enabled, the communication of the third working mode may be restricted. Therefore, by switching the communication frequency band of the first working mode or the second working mode from the first frequency band to the second frequency band, the communication of the enabled third working mode can be unrestricted, which can avoid the situation where the communication of some working modes is restricted when the Wi-Fi module runs multiple different working modes at the same time, thereby ensuring the stability and reliability of the Wi-Fi module when communicating in three different working modes at the same time.

[0211] Fig.12 FIG. 1 is a structural block diagram of an electronic device in an embodiment. Fig.12As shown, the electronic device 1200 may include one or more of the following components: a processor 1210, a memory 1220 coupled to the processor 1210, and a Wi-Fi module 1230, wherein the memory 1220 may store one or more computer programs, and the one or more computer programs may be configured to be executed by one or more processors 1210, so that the electronic device 1200 implements the methods described in the above embodiments.

[0212] The processor 1210 may include one or more processing cores. The processor 1210 uses various interfaces and lines to connect various parts of the entire electronic device 1200, and executes various functions and processes data of the electronic device 1200 by running or executing instructions, programs, code sets or instruction sets stored in the memory 1220, and calling data stored in the memory 1220. Optionally, the processor 1210 can be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), and programmable logic array (PLA). The processor 1210 can integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. Among them, the CPU mainly processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing display content; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 1210, but may be implemented separately through a communication chip.

[0213] The memory 1220 may include a random access memory (RAM) or a read-only memory (ROM). The memory 1220 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 1220 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc. The data storage area may also store data created by the electronic device 1200 during use, etc.

[0214] The electronic device 1200 can help the user to send and receive emails, browse web pages and access streaming media through the Wi-Fi module 1230, which provides the user with wireless broadband Internet access. The Wi-Fi module 1230 can support a variety of different working modes, and can support the coexistence of multiple different working modes.

[0215] It should be noted that the electronic device 1200 may also include other components, such as a display screen, a Bluetooth module, a power module, etc., which are not specifically limited here.

[0216] An embodiment of the present application discloses a computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor in an electronic device, the electronic device implements the methods described in the above embodiments.

[0217] An embodiment of the present application discloses a computer program product, which includes a computer program. When the computer program can be executed by a processor in an electronic device, the electronic device implements the methods described in the above embodiments.

[0218] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing related hardware through a computer program, and the program can be stored in a non-volatile computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a ROM, etc.

[0219] As used herein, any reference to memory, storage, database, or other medium may include nonvolatile and / or volatile memory. Suitable nonvolatile memory may include ROM, programmable ROM (Programmable ROM, PROM), erasable PROM (Erasable PROM, EPROM), electrically erasable PROM (Electrically Erasable PROM, EEPROM), or flash memory. Volatile memory may include random access memory (RAM), which is used as an external cache memory. By way of illustration and not limitation, RAM may be in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), memory bus direct RAM (RDRAM) and direct memory bus dynamic RAM (DRDRAM).

[0220] It should be understood that "one embodiment" or "an embodiment" mentioned throughout the specification means that specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. Those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present application. It should be noted that "multiple" in the present application includes "two or more".

[0221] In the various embodiments of the present application, it should be understood that the size of the serial numbers of the above-mentioned processes does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0222] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

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

[0224] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0225] The above is a detailed introduction to a frequency band switching method, device, electronic device and computer program product disclosed in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of ​​the present application. At the same time, for those of ordinary skill in the art, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A frequency band switching method, characterized in that: Applied to an electronic device, the electronic device includes a Wi-Fi module, and the method includes: When the Wi-Fi module runs the first working mode and the second working mode at the same time, determining that both the first working mode and the second working mode use the first frequency band for communication; In response to an enabling operation for the third working mode, the communication frequency band of the first working mode or the second working mode is switched from the first frequency band to the second frequency band, and the Wi-Fi module is controlled to simultaneously run the first working mode, the second working mode and the third working mode; the first working mode, the second working mode and the third working mode are different working modes supported by the Wi-Fi module.

2. The method according to claim 1, characterized in that: The first working mode and the second working mode include any two working modes of a station STA mode, an access point AP mode, and a point-to-point P2P mode; The third working mode includes working modes among the STA mode, AP mode and P2P mode except the first working mode and the second working mode.

3. The method according to claim 2, characterized in that The first working mode and the second working mode include the STA mode and the AP mode, and the switching of the communication frequency band of the first working mode or the second working mode from the first frequency band to the second frequency band includes: switching the communication frequency band of the AP mode from the first frequency band to the second frequency band; or The first working mode and the second working mode include the STA mode and the P2P mode, and the switching of the communication frequency band of the first working mode or the second working mode from the first frequency band to the second frequency band includes: switching the communication frequency band of the P2P mode from the first frequency band to the second frequency band; or The first working mode and the second working mode include the AP mode and the P2P mode, and switching the communication frequency band of the first working mode or the second working mode from the first frequency band to the second frequency band includes: switching the communication frequency band of the AP mode or the P2P mode from the first frequency band to the second frequency band.

4. The method according to claim 3, characterized in that: The switching of the communication frequency band of the AP mode or the P2P mode from the first frequency band to the second frequency band includes: Acquire first service information corresponding to the AP mode and second service information corresponding to the P2P mode; According to the first service information and the second service information, a target working mode is determined from the AP mode and the P2P mode, and a communication frequency band of the target working mode is switched from the first frequency band to a second frequency band.

5. The method according to claim 4, characterized in that The first service information includes the number of first connected devices corresponding to the AP mode, and the second service information includes the number of second connected devices corresponding to the P2P mode; The determining a target working mode from the AP mode and the P2P mode according to the first service information and the second service information includes: comparing the first number of connected devices with the second number of connected devices; If the number of the first connected devices is less than or equal to the number of the second connected devices, determining the AP mode as the target working mode; If the number of the first connected devices is greater than the number of the second connected devices, the P2P mode is determined as the target working mode.

6. The method according to claim 4, characterized in that The first service information includes a first service type corresponding to the AP mode, and the second service information includes a second service type corresponding to the P2P mode; The determining a target working mode from the AP mode and the P2P mode according to the first service information and the second service information includes: If the first service type is a real-time transmission service, determining the P2P mode as a target working mode; If the second service type is a real-time transmission service, the AP mode is determined as the target working mode.

7. The method according to any one of claims 1 to 6, characterized in that: The switching of the communication frequency band of the first working mode or the second working mode from the first frequency band to the second frequency band includes: Scanning the multiple channels included in the second frequency band respectively to obtain channel interference information of each of the channels; Determining a target channel from the multiple channels according to channel interference information of each of the channels; Switch a channel used by the first working mode or the second working mode to the target channel of the second frequency band.

8. The method according to claim 7, characterized in that After determining the target channel from the multiple channels according to the channel interference information of each of the channels, the method further includes: Channel switching information is sent to each opposite-end device corresponding to the target working mode, wherein the channel switching information is used to instruct the opposite-end device to switch to the target channel of the second frequency band for communication; the target working mode is a working mode for switching the communication frequency band between the first working mode and the second working mode.

9. The method according to claim 7, characterized in that: The channel interference information includes the number of devices on the channel, and the target channel is a channel with the least number of devices among the multiple channels; and / or, The channel interference information includes signal strength, and the target channel is a channel with the largest signal strength among the multiple channels; and / or, The channel interference information includes a signal-to-noise ratio, and the target channel is a channel with the largest signal-to-noise ratio among the multiple channels.

10. The method according to claim 1, characterized in that The first working mode and the second working mode include a STA mode and an AP mode, and the third working mode includes a P2P mode; and in response to the enabling operation for the third working mode, switching the communication frequency band of the first working mode or the second working mode from the first frequency band to the second frequency band comprises: In response to the enabling operation for the P2P mode, performing frequency band negotiation with a peer device corresponding to the P2P mode to negotiate to establish a Wi-Fi P2P connection based on a second frequency band; If the negotiation with the opposite device fails, the communication frequency band of the AP mode is switched from the first frequency band to the second frequency band.

11. The method according to claim 1, characterized in that: The third working mode includes a STA mode; before switching the communication frequency band of the first working mode or the second working mode from the first frequency band to the second frequency band, the method further includes: In response to an enabling operation for the STA mode, intercepting a connection instruction generated by the enabling operation for the STA mode; After switching the communication frequency band of the first working mode or the second working mode from the first frequency band to the second frequency band, the method further includes: The connection instruction is sent to the network device, where the connection instruction is used to establish a Wi-Fi communication connection with the network device.

12. The method according to claim 1, characterized in that The first working mode and the second working mode include a STA mode and a P2P mode, and the third working mode includes an AP mode; and in response to the enabling operation for the third working mode, switching the communication frequency band of the first working mode or the second working mode from the first frequency band to the second frequency band comprises: In response to an activation operation for the AP mode, determining a target frequency band used by the AP mode selected by a user; If the target frequency band is the first frequency band, the communication frequency band of the P2P mode is switched from the first frequency band to the second frequency band.

13. A frequency band switching device, characterized in that: Applied to an electronic device, the electronic device includes a Wi-Fi module, and the device includes: A frequency band determination module, configured to determine that both the first working mode and the second working mode use the first frequency band for communication when the Wi-Fi module operates in the first working mode and the second working mode at the same time; A frequency band switching module is used to switch the communication frequency band of the first working mode or the second working mode from the first frequency band to the second frequency band in response to an enabling operation for the third working mode, and control the Wi-Fi module to simultaneously run the first working mode, the second working mode and the third working mode; the first working mode, the second working mode and the third working mode are different working modes supported by the Wi-Fi module.

14. An electronic device, characterized in that: The electronic device comprises a memory, a processor and a transceiver unit. The memory stores a computer program. When the computer program is executed by the processor, the electronic device implements the method according to any one of claims 1 to 12.

15. A computer program product, characterized in that The method comprises a computer program, and when the computer program is executed by a processor in an electronic device, the electronic device implements the method according to any one of claims 1 to 12.