Device Control Method, Device, Storage Medium and Electronic Device

By determining the initial working channel and the channel to be detected in the Wi-Fi device, and switching to the target channel with a larger bandwidth according to the environmental conditions, the problem of poor performance of existing Wi-Fi connections is solved, and the efficiency of data transmission is improved.

CN114788349BActive Publication Date: 2025-06-10GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN201980102260.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-12-24
Publication Date
2025-06-10
Estimated Expiration
2039-12-24

AI Technical Summary

Technical Problem

The data transmission performance of existing Wi-Fi connections is poor, especially when the environmental interference is strong, and the communication performance of fixed bandwidth is poor.

Method used

By determining the initial working channel and the channel to be detected, the number of devices in the environment and the channel idle parameters are obtained. If a specific condition is met, the target channel with a larger bandwidth is switched to Wi-Fi communication.

Benefits of technology

In environments with less interference, improve the bandwidth and performance of Wi-Fi communication and enhance the efficiency of data transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114788349B_ABST
    Figure CN114788349B_ABST
Patent Text Reader

Abstract

A device control method: determining an initial channel of a device with a second role; determining a channel to be detected; obtaining the sum of the numbers of devices with the second role operating on the initial channel and the channel to be detected in the environment; obtaining a channel idle parameter; obtaining the received signal strength of the device; if it is detected that the sum of the numbers is less than a preset first threshold, the channel idle parameter meets the first condition, and the received signal strength of the target device is greater than a preset second threshold, then determining the target channel.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the technical field of Wi-Fi, and particularly relates to a device control method, device, storage medium, and electronic device. Background Art

[0002] Wi-Fi is a wireless local area network technology created based on the IEEE 802.11 standard. Wi-Fi technology has become one of the most widely used wireless network transmission technologies. Using Wi-Fi technology, mobile terminals such as smart phones and laptops can connect to an access point (AP) and connect to the Internet through the access point to use network services. Summary of the Invention

[0003] Embodiments of this application provide a device control method, device, storage medium, and electronic device, which can improve the performance of data transmission using Wi-Fi connections.

[0004] In a first aspect, this application provides a device control method, which is applied to an electronic device. The electronic device is a device with a first role, and the first role is a workstation role or a group client role. The method includes:

[0005] Determine the initial working channel of a target device with a second role accessed by the electronic device. The second role is an access point role or a group owner role;

[0006] According to the initial working channel, determine a channel to be detected. The channel to be detected is within a preset bandwidth range corresponding to the initial working channel;

[0007] Obtain the sum of the numbers of devices with the second role working on the initial working channel and the channel to be detected in the environment;

[0008] Obtain the channel idle parameters of the initial working channel and the channel to be detected;

[0009] Obtain the received signal strength of the target device accessed by the electronic device;

[0010] If it is detected that the sum of the numbers is less than or equal to a preset first threshold, the channel idle parameters meet a first condition, and the received signal strength of the target device is greater than or equal to a preset second threshold, then determine a target channel and perform Wi-Fi communication between the electronic device and the target device through the target channel. The bandwidth of the target channel is greater than the bandwidth of the initial working channel.

[0011] Second aspect, the present application provides a device control method, which is applied to an electronic device. The electronic device is a device with a second role, and the second role is an access point role or a group owner role. The method includes:

[0012] Determine an initial working channel of the electronic device;

[0013] According to the initial working channel, determine a channel to be detected, and the channel to be detected is within a preset bandwidth range corresponding to the initial working channel;

[0014] Obtain the sum of the numbers of devices with the second role working on the initial working channel and the channel to be detected in the environment;

[0015] Obtain channel idle parameters of the initial working channel and the channel to be detected;

[0016] Obtain the sum of received signal strengths of other devices with the second role working on the initial working channel and the channel to be detected in the environment;

[0017] If it is detected that the sum of the numbers is less than or equal to a preset first threshold, the channel idle parameters meet a first condition, and the sum of the received signal strengths of other devices with the second role is less than or equal to a preset fifth threshold, then determine a target channel, and perform Wi-Fi communication between the electronic device and a device with a first role connected thereto through the target channel. The bandwidth of the target channel is greater than the bandwidth of the initial working channel, and the first role is a workstation role or a group client role.

[0018] Third aspect, the present application provides a device control device, which is applied to an electronic device. The electronic device is a device with a first role, and the first role is a workstation role or a group client role. The device includes:

[0019] A first determination module, configured to determine an initial working channel of a target device with a second role accessed by the electronic device, where the second role is an access point role or a group owner role;

[0020] A second determination module, configured to determine a channel to be detected according to the initial working channel, and the channel to be detected is within a preset bandwidth range corresponding to the initial working channel;

[0021] A first acquisition module, configured to obtain the sum of the numbers of devices with the second role working on the initial working channel and the channel to be detected in the environment;

[0022] A second acquisition module, configured to obtain channel idle parameters of the initial working channel and the channel to be detected;

[0023] A third acquisition module, configured to acquire the received signal strength of the target device accessed by the electronic device;

[0024] A first processing module, configured to determine a target channel if it is detected that the sum of the quantities is less than or equal to a preset first threshold, the channel idle parameter satisfies a first condition, and the received signal strength of the target device is greater than or equal to a preset second threshold, and perform Wi-Fi communication between the electronic device and the target device through the target channel, where the bandwidth of the target channel is greater than the bandwidth of the initial working channel.

[0025] In a fourth aspect, the present application provides a device control apparatus, which is applied to an electronic device. The electronic device is a device with a second role, and the second role is an access point role or a group owner role. The apparatus includes:

[0026] A third determination module, configured to determine the initial working channel of the electronic device;

[0027] A fourth determination module, configured to determine a channel to be detected according to the initial working channel, where the channel to be detected is within a preset bandwidth range corresponding to the initial working channel;

[0028] A fourth acquisition module, configured to acquire the sum of the quantities of devices with the second role working on the initial working channel and the channel to be detected in the environment;

[0029] A fifth acquisition module, configured to acquire the channel idle parameters of the initial working channel and the channel to be detected;

[0030] A sixth acquisition module, configured to acquire the sum of the received signal strengths of other devices with the second role working on the initial working channel and the channel to be detected in the environment;

[0031] A second processing module, configured to determine a target channel if it is detected that the sum of the quantities is less than or equal to a preset first threshold, the channel idle parameter satisfies a first condition, and the sum of the received signal strengths of the other devices with the second role is less than or equal to a preset fifth threshold, and perform Wi-Fi communication between the electronic device and the device with a first role connected thereto through the target channel, where the bandwidth of the target channel is greater than the bandwidth of the initial working channel, and the first role is a workstation role or a group client role.

[0032] In a fifth aspect, the present application provides a storage medium, on which a computer program is stored. When the computer program is executed on a computer, the computer is caused to execute the method provided in the first aspect or the method provided in the second aspect.

[0033] Sixth aspect, the present application provides an electronic device, including a memory and a processor. The electronic device is a device with a first role, and the first role is a workstation role or a group client role. The processor is configured to execute by calling a computer program stored in the memory:

[0034] Determine an initial working channel of a target device with a second role accessed by the electronic device, where the second role is an access point role or a group owner role;

[0035] Determine a channel to be detected according to the initial working channel, where the channel to be detected is within a preset bandwidth range corresponding to the initial working channel;

[0036] Obtain the sum of the numbers of devices with the second role working on the initial working channel and the channel to be detected in the environment;

[0037] Obtain channel idle parameters of the initial working channel and the channel to be detected;

[0038] Obtain the received signal strength of the target device accessed by the electronic device;

[0039] If it is detected that the sum of the numbers is less than or equal to a preset first threshold, the channel idle parameters meet a first condition, and the received signal strength of the target device is greater than or equal to a preset second threshold, then determine a target channel, and perform Wi-Fi communication between the electronic device and the target device through the target channel, where the bandwidth of the target channel is greater than the bandwidth of the initial working channel.

[0040] Seventh aspect, an embodiment of the present application provides an electronic device, including a memory and a processor. The electronic device is a device with a second role, and the second role is an access point role or a group owner role. The processor is configured to execute by calling a computer program stored in the memory:

[0041] Determine the initial working channel of the electronic device;

[0042] Determine a channel to be detected according to the initial working channel, where the channel to be detected is within a preset bandwidth range corresponding to the initial working channel;

[0043] Obtain the sum of the numbers of devices with the second role working on the initial working channel and the channel to be detected in the environment;

[0044] Obtain channel idle parameters of the initial working channel and the channel to be detected;

[0045] Obtain the sum of the received signal strengths of other devices with the second role operating on the initial working channel and the channel to be detected in the environment;

[0046] If it is detected that the sum of the quantities is less than or equal to a preset first threshold, the channel idle parameter meets the first condition, and the sum of the received signal strengths of other devices with the second role is less than or equal to a preset fifth threshold, then determine the target channel, and perform Wi-Fi communication between the electronic device and the device with the first role to which it is connected through the target channel, where the bandwidth of the target channel is greater than the bandwidth of the initial working channel, and the first role is the workstation role or the group client role. Description of the Drawings

[0047] The following, in conjunction with the drawings, through a detailed description of the specific embodiments of the present application, will make the technical solutions and their beneficial effects of the present application obvious.

[0048] Figure 1 It is the first flowchart of the device control method provided by the embodiment of the present application.

[0049] Figure 2 It is the second flowchart of the device control method provided by the embodiment of the present application.

[0050] Figure 3 It is a Wi-Fi channel scan diagram of the electronic device provided by the embodiment of the present application that additionally returns the channel number, channel idle time, and scan time during channel scanning.

[0051] Figure 4 It is the third flowchart of the device control method provided by the embodiment of the present application.

[0052] Figures 5 to 6 It is a scenario diagram of the device control method provided by the embodiment of the present application.

[0053] Figure 7 It is the first structural diagram of the device control device provided by the embodiment of the present application.

[0054] Figure 8 It is the first structural diagram of the device control device provided by the embodiment of the present application.

[0055] Figure 9 It is the first structural diagram of the electronic device provided by the embodiment of the present application.

[0056] Figure 10 It is the second structural diagram of the electronic device provided by the embodiment of the present application.

[0057] Figure 11 It is the third structural diagram of the electronic device provided by the embodiment of the present application. Detailed implementation manners

[0058] Please refer to the drawings, in which the same component symbols represent the same components. The principle of the present application is illustrated by being implemented in a suitable computing environment. The following description is based on the specific embodiments of the present application illustrated, and should not be regarded as limiting other specific embodiments of the present application not detailed herein.

[0059] Please refer to Figure 1 , Figure 1 which is the first flowchart of the device control method provided by the embodiment of the present application. The device control method can be applied to an electronic device, and the electronic device is a device with a first role, and the first role can be a workstation role or a group client role, that is, the electronic device can be a device with a workstation (STA) role or a group client (GC) role. The process of the device control method can include:

[0060] 101. Determine the initial working channel of the target device with a second role accessed by the electronic device, where the second role is an access point role or a group owner role.

[0061] Wi-Fi is a wireless local area network technology created based on the IEEE 802.11 standard. Wi-Fi technology has become the most widely used wireless network transmission technology at present. Using Wi-Fi technology, mobile terminals such as smart phones and laptops can be connected to an access point (AP), and through the access point, they can be connected to the Internet to use network services. However, in related technologies, the performance of data transmission using Wi-Fi connections is poor. For example, in related technologies, when a smart mobile terminal is connected to an access point, the working channel for their communication generally fixedly uses a bandwidth of 20 MHz or 40 MHz. Among them, if the working channel with a bandwidth of 20 MHz is fixedly used, then the performance of Wi-Fi communication always remains at a relatively low level. If the working channel with a bandwidth of 40 MHz is fixedly used, then when the interference in the environment is strong, the performance of Wi-Fi communication may be worse than that of using the working channel with a bandwidth of 20 MHz.

[0062] There are two roles in ordinary Wi-Fi connection communication: Access Point (hereinafter referred to as AP) and Station (hereinafter referred to as STA). Wi-Fi Display (WFD) is a specification developed by the Wi-Fi Alliance, which enables multimedia devices to establish and maintain a Wi-Fi-based connection and use this connection to promote the presentation and playback of video / audio on the target device. An important technology in Wi-Fi Display is Wi-Fi Direct, that is, Wi-Fi P2P. It supports direct connection and communication between two Wi-Fi devices without an Access Point AP. In the Wi-Fi Direct functional structure, two roles are defined: Group Owner (GO) and Group Client (GC). Among them, the role of the Group Owner GO is similar to that of the Access Point AP in Infrastructure BSS. And the role of the Group Client GC is similar to that of the Station STA in Infrastructure BSS. Before forming a P2P Group (i.e., P2P Network), each terminal is a P2P Device. When P2P negotiation is completed among these P2P Device devices, one and only one P2P Device will play the role of GO, and the other P2P Devices will play the role of GC.

[0063] In the embodiment of the present application, for example, when an electronic device in the STA role or GC role accesses an AP or GO device and needs to determine the bandwidth width of the working channel between them, the electronic device can first obtain the current working channel (i.e., the initial working channel) of the AP or GO device it accesses. For example, the AP or GO device accessed by the electronic device is currently working on Channel 7 in the 2.4 GHz band. Among them, the frequency range of the 2.4 GHz band is 2.400 - 2.4835 GHz. The center frequency of Channel 7 is 2442 MHz, the low-end frequency of the channel is 2431 MHz, and the high-end frequency of the channel is 2453 MHz.

[0064] It should be noted that an AP or GO device will determine a working channel as its initial working channel after startup, even if no STA or GC device has accessed the AP or GO device yet.

[0065] It should also be noted that when the electronic device is a device in the STA role, the role of the target device accessed by the electronic device is correspondingly the AP role. And when the electronic device is a device in the GC role, the role of the target device accessed by the electronic device is correspondingly the GO role.

[0066] 102. Determine a channel to be detected according to the initial working channel, where the channel to be detected is within the preset bandwidth range corresponding to the initial working channel.

[0067] For example, after determining the initial working channel of the target device accessed by the electronic device, the electronic device can determine the channel to be detected according to the initial working channel, where the channel to be detected is within the preset bandwidth range corresponding to the initial working channel.

[0068] Channels in the 2.4 GHz band can use a bandwidth of 20 MHz or 40 MHz. Among them, the 40 MHz bandwidth is formed by bundling two 20 MHz bandwidth channels together to form a 40 MHz bandwidth.

[0069] For example, the preset bandwidth is 40 MHz. Then, in process 102, the electronic device can determine the channel to be detected according to the initial working channel of the target device it accesses, and the channel to be detected is within the coverage range of the 40 MHz bandwidth corresponding to the initial working channel.

[0070] 103. Obtain the sum of the numbers of devices with a second role operating on the initial working channel and the channel to be detected in the environment.

[0071] For example, the electronic device can also obtain the sum of the numbers of devices with the AP and GO roles operating on the above initial working channel and the channel to be detected in the environment it is in.

[0072] For example, the current working channel is channel 7, and the channels to be detected include channels 2, 3, 4, 5, 6, 8, and 9. Then, in process 103, the electronic device can obtain the sum of the numbers of AP and GO devices operating on channels 2, 3, 4, 5, 6, 7, 8, and 9 in the environment.

[0073] 104. Obtain the channel idle parameters of the initial working channel and the channel to be detected.

[0074] For example, the electronic device can also obtain the channel idle parameters of each of the above initial working channel and the channel to be detected. Among them, the channel idle parameter can represent the idle degree of a channel.

[0075] 105. Obtain the received signal strength of the target device accessed by the electronic device.

[0076] For example, the electronic device can also obtain the received signal strength (Received Signal Strength Indication, RSSI) of the target device it accesses.

[0077] After obtaining the sum of the numbers of AP and GO devices operating on the above-mentioned initial working channel and the channel to be detected in the environment, the channel idle parameters of the above-mentioned initial working channel and the channel to be detected, and the received signal strength RSSI of the target device accessed by the electronic device, the electronic device can detect whether the sum of the numbers is less than or equal to a preset first threshold, whether the channel idle parameter meets the first condition, and whether the RSSI of the target device accessed by the electronic device is greater than or equal to a preset second threshold.

[0078] If it is detected that the sum of the numbers is less than or equal to a preset first threshold, the channel idle parameter meets the first condition, and the RSSI of the target device accessed by the electronic device is greater than or equal to a preset second threshold, then it can enter 106. Otherwise, the electronic device can perform other operations.

[0079] 106. If it is detected that the sum of the numbers is less than or equal to a preset first threshold, the channel idle parameter meets the first condition, and the received signal strength of the target device is greater than or equal to a preset second threshold, then determine the target channel, and perform Wi-Fi communication between the electronic device and the target device through the target channel, where the bandwidth of the target channel is greater than the bandwidth of the initial working channel.

[0080] For example, if the electronic device detects that the sum of the numbers is less than or equal to a preset first threshold, the channel idle parameter meets the first condition, and the RSSI of the target device accessed by the electronic device is greater than or equal to a preset second threshold, then it can be considered that the interference in the environment where the electronic device is currently located is small. In this case, the electronic device can determine the target channel and perform Wi-Fi communication between the electronic device and the target device through the target channel. Among them, the bandwidth of the target channel can be greater than the bandwidth of the initial working channel. For example, the bandwidth of the initial working channel is 20MHz, and the bandwidth of the target channel is 40MHz. Then, when it is detected that the sum of the numbers is less than or equal to a preset first threshold, the channel idle parameter meets the first condition, and the RSSI of the target device accessed by the electronic device is greater than or equal to a preset second threshold, the electronic device can use the target channel with a bandwidth of 40MHz to perform Wi-Fi communication between the electronic device and the target device it accesses. For example, the electronic device can use Channel 7 as the primary channel and Channel 6 or Channel 8 as the secondary channel to form a target channel with a bandwidth of 40MHz, and perform Wi-Fi communication with the target device it accesses based on the target channel with a bandwidth of 40MHz. Otherwise, the electronic device can use Channel 7 with a bandwidth of 20MHz to perform Wi-Fi communication between the electronic device and the target device it accesses.

[0081] It can be understood that in the embodiments of the present application, when the working environment of the electronic device meets certain conditions (that is, the sum of the above quantities is less than or equal to a preset first threshold, the channel idle parameter meets the first condition, and the RSSI of the target device accessed by the electronic device is greater than or equal to a preset second threshold), the electronic device can use a target channel with a larger bandwidth than the initial working channel for Wi-Fi communication between the electronic device and the target device it accesses. That is, in the embodiments of the present application, the electronic device can use a channel with a larger bandwidth for Wi-Fi communication in an environment with less interference, thereby improving the performance of data transmission using Wi-Fi connection.

[0082] Please refer to Figure 2 , Figure 2 which is the second flowchart of the device control method provided by the embodiments of the present application. The device control method can be applied to an electronic device, and the electronic device is a device with a first role, and the first role can be a workstation role or a group client role, that is, the electronic device can be a device with a workstation (STA) role or a group client (GC) role. The process of the device control method can include:

[0083] 201. The electronic device determines the initial working channel of the target device with a second role it accesses, and the second role is an access point role or a group owner role.

[0084] For example, when an electronic device with an STA role or a GC role accesses an AP or GO device and needs to determine what bandwidth width to use for the working channel between them, the electronic device can first obtain the current working channel (i.e., the initial working channel) of the target device it accesses. For example, the target device accessed by the electronic device is currently working on channel 7 in the 2.4 GHz band, that is, channel 7 is the initial working channel.

[0085] It should be noted that when the electronic device is a device with an STA role, the role of the target device accessed by the electronic device is correspondingly an AP role. And when the electronic device is a device with a GC role, the role of the target device accessed by the electronic device is correspondingly a GO role.

[0086] 202. According to the initial working channel, the electronic device determines the channel to be detected, and the channel to be detected is within the preset bandwidth range corresponding to the initial working channel.

[0087] For example, after determining the initial working channel of the target device accessed by the electronic device, the electronic device can determine the channel to be detected according to the initial working channel, where the channel to be detected is within the preset bandwidth range corresponding to the initial working channel. In one implementation, the preset bandwidth can be a bandwidth greater than 20 MHz.

[0088] The channels in the 2.4GHz band can use a bandwidth of 20MHz or 40MHz. Among them, the 40MHz bandwidth is formed by bundling two 20MHz bandwidth channels together to form a 40MHz bandwidth.

[0089] For example, the preset bandwidth is 40MHz. Then, in the 202 process, the electronic device can determine the channel to be detected according to the initial working channel of the target device it accesses - the 7th channel. The channel to be detected is within the coverage range of the 40MHz bandwidth corresponding to the 7th channel.

[0090] In one implementation, the electronic device can determine the channel to be detected according to the initial working channel in the following way:

[0091] The electronic device obtains the way in which the target device it accesses uses the preset bandwidth on the initial working channel, and this way is one of the plus channel superposition and minus channel superposition;

[0092] According to the way in which the target device uses the preset bandwidth on the initial working channel and the initial working channel, the electronic device determines the channel to be detected.

[0093] It should be noted that taking the preset bandwidth as 40MHz and the initial working channel of the target device accessed by the electronic device as the 7th channel in the 2.4GHz band as an example. The electronic device can first obtain the way in which the target device it accesses uses the 40MHz bandwidth on the 7th channel. Among them, this way includes plus channel superposition and minus channel superposition.

[0094] It should also be noted that the 40MHz bandwidth is formed by bundling two adjacent 20MHz bandwidth channels together to form a 40MHz channel, one is the main channel and the other is the auxiliary channel. The main channel sends beacon messages and some data messages, and the auxiliary channel sends other messages. If the center frequency of the auxiliary channel is higher than that of the main channel when bundling two adjacent 20MHz channels, it is plus. If the center frequency of the auxiliary channel is lower than that of the main channel when bundling two adjacent 20MHz channels, it is minus. Here, plus and minus are both relative to the main channel. For example, the current channel is 7. To configure a 40MHz bandwidth with plus, another channel needs to be superimposed, that is, the 40MHz bandwidth composed of the 7th channel and the 8th channel. Minus means that the channel superposition is downward when superimposing channels. For example, the 7th channel and the 6th channel form a new 40MHz bandwidth channel.

[0095] In this embodiment, the electronic device can obtain the beacon data packet of the target device it accesses, and obtain the way in which the accessed target device uses a 40 MHz bandwidth on the initial working channel from the beacon data packet.

[0096] After determining the way in which the target device accessed by the electronic device uses a 40 MHz bandwidth on the current working channel, the electronic device can determine the channel to be detected in the following way:

[0097] If the way in which the target device accessed by the electronic device uses a 40 MHz bandwidth on the initial working channel is the downlink channel aggregation, the electronic device determines 8 consecutive channels including the initial working channel as the first object channels; the electronic device determines the other channels in the first object channels except the initial working channel as the channels to be detected, where the number of channels in the channels to be detected that are lower than the initial working channel is greater than the number of channels that are higher than the initial working channel.

[0098] Alternatively, if the way in which the target device accessed by the electronic device uses a 40 MHz bandwidth on the initial working channel is the uplink channel aggregation, the electronic device determines 8 consecutive channels including the initial working channel as the second object channels; the electronic device determines the other channels in the second object channels except the initial working channel as the channels to be detected, where the number of channels in the channels to be detected that are lower than the initial working channel is less than the number of channels that are higher than the initial working channel.

[0099] For example, if the initial working channel is Channel 7 and the electronic device uses the method of stacking channels downward (minus) to construct a 40 MHz bandwidth channel, the electronic device can determine 8 consecutive channels including Channel 7 as the first object channels, and then determine the other channels except Channel 7 among these 8 channels as the channels to be detected, where the number of channels lower than Channel 7 among the channels to be detected is greater than the number of channels higher than Channel 7. For example, the 8 consecutive channels including Channel 7 are Channels 2, 3, 4, 5, 6, 7, 8, and 9. Then, the electronic device can determine Channels 2, 3, 4, 5, 6, 8, and 9 as the channels to be detected, where the number of channels lower than Channel 7 is 5 (Channels 2, 3, 4, 5, 6), and the number of channels higher than Channel 7 is 2 (Channels 8, 9). Another example, the 8 consecutive channels including Channel 7 are Channels 3, 4, 5, 6, 7, 8, 9, and 10. Then, the electronic device can determine Channels 3, 4, 5, 6, 8, 9, and 10 as the channels to be detected, where the number of channels lower than Channel 7 is 4 (Channels 3, 4, 5, 6), and the number of channels higher than Channel 7 is 3 (Channels 8, 9, 10).

[0100] For example, if the initial working channel is Channel 7 and the electronic device uses the method of stacking channels upward (plus) to construct a 40 MHz bandwidth channel, the electronic device can determine 8 consecutive channels including Channel 7 as the second object channels, and then determine the other channels except Channel 7 among these 8 channels as the channels to be detected, where the number of channels lower than Channel 7 among the channels to be detected is less than the number of channels higher than Channel 7. For example, the 8 consecutive channels including Channel 7 are Channels 4, 5, 6, 7, 8, 9, 10, and 11. Then, the electronic device can determine Channels 4, 5, 6, 8, 9, 10, and 11 as the channels to be detected, where the number of channels lower than Channel 7 is 3 (Channels 4, 5, 6), and the number of channels higher than Channel 7 is 4 (Channels 8, 9, 10, 11). Another example, the 8 consecutive channels including Channel 7 are Channels 5, 6, 7, 8, 9, 10, 11, and 12. Then, the electronic device can determine Channels 5, 6, 8, 9, 10, 11, and 12 as the channels to be detected, where the number of channels lower than Channel 7 is 2 (Channels 5, 6), and the number of channels higher than Channel 7 is 5 (Channels 8, 9, 10, 11, 12).

[0101] 203. The electronic device obtains the sum of the numbers of devices with a second role operating on the initial working channel and the to-be-detected channels in the environment.

[0102] For example, the electronic device can also obtain the sum of the numbers of devices with a second role operating on the above-mentioned initial working channel and the to-be-detected channels in the environment where it is located, that is, the electronic device can obtain the numbers of AP and GO devices operating on the above-mentioned initial working channel and the to-be-detected channels in the environment where it is located.

[0103] For example, the initial working channel is channel 7, and the to-be-detected channels include channels 2, 3, 4, 5, 6, 8, and 9. Then, in the 203 process, the electronic device can obtain the sum of the numbers of AP and GO devices operating on channels 2, 3, 4, 5, 6, 7, 8, and 9 in the environment.

[0104] 204. The electronic device scans the initial working channel and the to-be-detected channels, and obtains the channel idle time and the channel scan time of each channel during the scanning.

[0105] 205. According to the channel idle time and the channel scan time of each channel, the electronic device calculates the channel idle ratio of each channel, where the channel idle ratio is the ratio of the channel idle time to the channel scan time.

[0106] 206. The electronic device calculates the average channel idle ratio of the initial working channel and the to-be-detected channels, and uses the average channel idle ratio and the channel idle ratios of each channel as channel idle parameters.

[0107] For example, 204, 205, and 206 may include:

[0108] After determining the to-be-detected channels, the electronic device can scan the initial working channel of the target device it accesses and the to-be-detected channels. When scanning the initial working channel and the to-be-detected channels, the electronic device can obtain the channel idle time (channel idle slot time) and the channel scan time (scan time) of each of these channels.

[0109] It should be noted that in the related art, the channel idle time (channel idle slot time) and the scan time are not returned during channel scanning. In the embodiments of the present application, the information of the channel idle time (channel idle slot time) and the scan time will be additionally returned in the scan result of the channel scanning.

[0110] For example, please refer to Figure 3 , Figure 3Schematic diagram of Wi-Fi channel scanning where the electronic device provided by the embodiment of this application additionally returns the channel number, channel idle slot time, and scan time during channel scanning. Among them, Wi-Fi Driver is the Wi-Fi driver module, Wi-Fi Firmware is the Wi-Fi firmware, Wi-Fi Hardware is the Wi-Fi hardware, Packet Tx represents sending data packets, and Packet Rx represents receiving data packets. That is, when scanning each channel, the electronic device can additionally obtain and return the channel idle slot time and scan time. In this way, the electronic device can obtain the channel idle time and scan time of each channel during channel scanning.

[0111] After obtaining the channel idle time and scan time of each channel, the electronic device can calculate the channel idle slot ratio corresponding to each channel, where the channel idle slot ratio is the ratio of the channel idle time to the scan time. For example, if the channel idle time of Channel 2 is 30 ms and the scan time is 50 ms, then the channel idle slot ratio of Channel 2 is 30 ms / 50 ms = 0.6.

[0112] Moreover, the electronic device can also calculate the average channel idle slot ratio of the above-mentioned initial working channel and the channels to be detected. That is, the average channel idle slot ratio is the average value of the sum of the channel idle slot ratios of the above-mentioned initial working channel and the channels to be detected.

[0113] In this embodiment, the electronic device can use the above-mentioned average channel idle slot ratio and the channel idle slot ratios of each channel in the above-mentioned initial working channel and the channels to be detected as channel idle parameters.

[0114] 207. The electronic device obtains the received signal strength of the target device it is connected to.

[0115] For example, the electronic device can also obtain the received signal strength RSSI of the target device it is connected to.

[0116] After obtaining the sum of the numbers of AP and GO devices operating on the above-mentioned initial working channel and the channel to be detected in the environment, the channel idle parameters of the above-mentioned initial working channel and the channel to be detected, and the received signal strength RSSI of the target device accessed by the electronic device, the electronic device can detect whether the sum of the numbers is less than or equal to a preset first threshold, whether the above-mentioned channel idle parameters meet a preset first condition, and whether the RSSI of the target device accessed by the electronic device is greater than or equal to a preset second threshold. Among them, the above-mentioned first condition is that the channel idle ratio of each channel in the above-mentioned initial working channel and the channel to be detected is greater than or equal to a preset third threshold, and the average channel idle ratio is greater than or equal to a preset fourth threshold.

[0117] If it is detected that the sum of the numbers is less than or equal to the first threshold, the above-mentioned channel idle parameters meet the preset first condition, and the RSSI of the target device accessed by the electronic device is greater than or equal to the preset second threshold, then it is possible to enter 208.

[0118] 208. If the sum of the numbers is less than or equal to the preset first threshold, the channel idle parameters meet the first condition, and the received signal strength of the target device is greater than or equal to the preset second threshold, the electronic device determines the target channel and performs Wi-Fi communication between the electronic device and the target device through the target channel. The bandwidth of the target channel is greater than the bandwidth of the initial working channel. Among them, when the channel idle ratio of each channel in the above-mentioned initial working channel and the channel to be detected is greater than or equal to the preset third threshold, and the average channel idle ratio is greater than or equal to the preset fourth threshold, it is determined that the channel idle parameters meet the first condition.

[0119] For example, if the sum of the numbers is less than or equal to the preset first threshold, the channel idle parameters meet the first condition, and the received signal strength of the target device accessed by the electronic device is greater than or equal to the preset second threshold, it can be considered that the interference in the environment where the electronic device is currently located is small. In this case, the electronic device can determine the target channel and perform Wi-Fi communication between the electronic device and the target device through the target channel. Among them, the bandwidth of the target channel can be greater than the bandwidth of the initial working channel. For example, the bandwidth of the target channel is 40MHz bandwidth. Among them, the channel idle parameters meeting the first condition can indicate that the relevant channels are relatively idle. For example, the electronic device can use Channel 7 as the main channel and Channel 6 as the secondary channel to construct a target channel with a 40MHz bandwidth for performing Wi-Fi communication between the electronic device and the target device it accesses.

[0120] Otherwise, the electronic device can continue to use the 20MHz bandwidth of Channel 7 to perform Wi-Fi communication between the electronic device and the AP or GO device it accesses.

[0121] It can be understood that in the embodiments of the present application, when the sum of the number of AP and GO devices operating on the above-mentioned initial working channel and the to-be-detected channel in the environment is less than a preset first threshold, and the channel idle ratio of each channel in the above-mentioned initial working channel and the to-be-detected channel is greater than or equal to a preset third threshold, and the average channel idle ratio is greater than or equal to a preset fourth threshold, and the RSSI of the target device accessed by the electronic device is greater than or equal to a preset second threshold, it can be considered that the interference in the environment where the electronic device is located is small. In the case of small interference in the environment, the electronic device can use a channel with a 40MHz bandwidth for Wi-Fi communication. In the case of large interference in the environment, the electronic device can use a channel with a 20MHz bandwidth for Wi-Fi communication. Since the Wi-Fi communication transceiver performance of the 40MHz bandwidth channel is better than that of the 20MHz bandwidth channel, in this embodiment, when the environmental interference is small, the electronic device using a channel with a 40MHz bandwidth for Wi-Fi communication can have better communication performance.

[0122] In another implementation, the medium ready count can also be used as the channel idle parameter. The value of the parameter medium ready count represents the number of Wi-Fi packets detected by the Wi-Fi physical layer. When the number is relatively small, for example, the value of medium ready count is less than 100 within 500ms, then it can be considered that the interference on the corresponding channel is small.

[0123] For example, when it is detected that the sum of the number of access points and group owner devices operating on the initial working channel and the to-be-detected channel in the environment is less than or equal to a preset first threshold, and the value of the above-mentioned medium ready count is less than a preset value, and the received signal strength of the target device accessed by the electronic device is greater than or equal to a preset second threshold, it can be considered that the current environmental interference is small. In this case, the electronic device can use a target channel with a preset bandwidth (such as 40MHz bandwidth) to perform Wi-Fi communication with the target device it accesses.

[0124] Please refer to Figure 4 , Figure 4 FIG. is the third flowchart of the device control method provided by the embodiments of the present application. The device control method can be applied to an electronic device, and the electronic device can be a device with a second role, and the second role is an access point (AP) role or a group owner (GO) role. The process of the device control method can include:

[0125] 301. Determine the initial working channel of the electronic device.

[0126] In the embodiments of the present application, for example, when a device in the STA role or GC role accesses an electronic device in the AP role or GO role and needs to determine what width of bandwidth to use for the working channel between them, the electronic device can first obtain its current working channel (i.e., the initial working channel). For example, the electronic device is currently working on Channel 7 in the 2.4 GHz band.

[0127] 302. Determine a channel to be detected according to the initial working channel, where the channel to be detected is within the preset bandwidth range corresponding to the initial working channel.

[0128] For example, after determining the initial working channel of the electronic device, the electronic device can determine the channel to be detected according to the initial working channel, where the channel to be detected is within the preset bandwidth range corresponding to the initial working channel.

[0129] For example, the preset bandwidth is 40 MHz. Then, in step 302, the electronic device can determine the channel to be detected according to its initial working channel, and the channel to be detected is within the coverage range of the 40 MHz bandwidth corresponding to the initial working channel. How to determine the channel to be detected according to the initial working channel has been described in detail above and will not be elaborated here.

[0130] 303. Obtain the sum of the numbers of devices with the second role working on the initial working channel and the channel to be detected in the environment.

[0131] For example, the electronic device can also obtain the numbers of AP and GO devices working on the above initial working channel and the channel to be detected in its environment.

[0132] For example, the initial working channel is Channel 7, and the channels to be detected include Channels 2, 3, 4, 5, 6, 8, and 9. Then, in step 303, the electronic device can obtain the sum of the numbers of AP and GO devices working on Channels 2, 3, 4, 5, 6, 7, 8, and 9 in the environment.

[0133] 304. Obtain the channel idle parameters of the initial working channel and the channel to be detected.

[0134] For example, the electronic device can also obtain the channel idle parameters of each of the above initial working channel and the channel to be detected. Among them, the channel idle parameter can represent the idle degree of a channel.

[0135] 305. Obtain the sum of the received signal strengths of other devices with the second role working on the initial working channel and the channel to be detected in the environment.

[0136] For example, the electronic device can also obtain the sum of the RSSIs of other AP and GO devices working on the initial working channel and the channel to be detected in the environment.

[0137] After that, the electronic device can detect whether the sum of the above - mentioned quantities is less than or equal to a preset first threshold, whether the channel idle parameter meets the first condition, and whether the sum of the received signal strengths of other devices with the second role is less than or equal to a preset fifth threshold. If so, it can enter the process of 306. Otherwise, the electronic device can perform other operations.

[0138] 306. If it is detected that the sum of the above - mentioned quantities is less than or equal to a preset first threshold, the channel idle parameter meets the first condition, and the sum of the received signal strengths of other devices with the second role is less than or equal to a preset fifth threshold, then determine a target channel, and perform Wi - Fi communication between the electronic device and the device with the first role connected thereto through the target channel. The bandwidth of the target channel is greater than the bandwidth of the initial working channel, and the first role is a workstation role or a group client role.

[0139] For example, if the electronic device detects that the sum of the above - mentioned quantities is less than or equal to a preset first threshold, the channel idle parameter meets the first condition, and the sum of the RSSIs of other access points and group owner devices operating on the initial working channel and the channels to be detected is less than or equal to a preset fifth threshold, then it can be considered that the interference in the environment where the electronic device is currently located is small. In this case, the electronic device can determine a target channel and perform Wi - Fi communication between the electronic device and the device with the first role connected thereto through the target channel. The bandwidth of the target channel is greater than the bandwidth of the initial working channel, and the first role is a workstation role or a group client role. For example, the electronic device can use Channel 7 as the primary channel and Channel 6 or Channel 8 as the secondary channel to form a target channel with a 40MHz bandwidth, and perform Wi - Fi communication based on the 40MHz - bandwidth target channel and its corresponding STA or GC device. Otherwise, the electronic device can still use Channel 7 with a 20MHz bandwidth to perform Wi - Fi communication between the electronic device and its corresponding STA or GC device.

[0140] It can be understood that in the embodiments of the present application, the electronic device can use a channel with a larger bandwidth for Wi - Fi communication in an environment with less interference, thereby improving the performance of data transmission using Wi - Fi connections.

[0141] In one implementation, the channel idle parameter in 306 can be the channel idle ratio of each channel in the initial working channel and the channels to be detected of the electronic device. Then, the above - mentioned channel idle parameter meeting the preset first condition can be that the channel idle ratio of each channel in the initial working channel and the channels to be detected of the electronic device is greater than or equal to a preset third threshold.

[0142] Alternatively, the channel idle parameter in 306 may be the channel idle ratio of each channel in the initial working channel and the channels to be detected of the electronic device, as well as the average channel idle ratio of these channels. Then, the above channel idle parameter satisfying the preset first condition may be that the channel idle ratio of each channel in the initial working channel and the channels to be detected of the electronic device is greater than or equal to a preset third threshold, and the average channel idle ratio of these channels is greater than or equal to a preset fourth threshold.

[0143] Please refer to Figures 5 to 6 , Figures 5 to 6 which is a schematic diagram of the scenario of the device control method provided by the embodiments of the present application.

[0144] For example, there are electronic device D1 and electronic device D2, and the user wants to wirelessly screen mirror the audio and video files on electronic device D2 to electronic device D1 for playing. The user can turn on the Wi-Fi functions of electronic devices D1 and D2, thereby establishing a Wi-Fi P2P connection between electronic devices D1 and D2, as Figure 5 shown.

[0145] Through negotiation, electronic device D1 is determined to be the role of the group owner GO, and electronic device D2 is determined to be the role of the group client GC. Among them, the working channel of GO device D1 is, for example, channel 7 in the 2.4 GHz band. Before establishing a formal connection, GC device D2 can first obtain the current working channel of GO device D1, that is, channel 7. Among them, GO device D1 supports 20 MHz bandwidth and 40 MHz bandwidth.

[0146] After that, GC device D2 can determine the channels to be detected according to the current working channel 7 of GO device D1. For example, the way GO device D1 uses 40 MHz bandwidth on channel 7 is the downward stacked channel minus. Then, the channels to be detected may be, for example, channels 2, 3, 4, 5, 6, 8, and 9.

[0147] After that, GC device D2 can scan each channel from channel 2 to channel 9 to obtain the sum of the number of APs and GO devices working on channels 2 to 9 in the surrounding environment.

[0148] Moreover, when scanning each channel from channel 2 to channel 9, GC device D2 can additionally obtain the channel idle time (channel idle slot time) and the channel scan time (scan time) of each channel. According to the channel idle time and the channel scan time of each channel, GC device D2 can calculate the channel idle ratio of each channel, where the channel idle ratio is the ratio of the channel idle time to the channel scan time. And after calculating the channel idle ratio of each channel, GC device D2 can also calculate the average channel idle ratio.

[0149] After that, the GC device D2 can also obtain the received signal strength indication (RSSI) of the GO device D1 to which it is connected.

[0150] After obtaining the above information, the GC device D2 can detect whether the sum of the number of APs and GO devices operating on channels 2 to 9 in the surrounding environment is less than or equal to a preset first threshold (for example, the preset first threshold is 7 or 8, etc.), and detect whether the channel idle ratio of each channel in channels 2 to 9 is greater than or equal to a preset third threshold (for example, the preset third threshold is 10% or 20%, etc.) and whether the average channel idle ratio of each channel is greater than or equal to a preset fourth threshold (for example, the preset fourth threshold is 15% or 25%, etc.), and detect whether the received signal strength RSSI of the GO device D1 is greater than or equal to a preset second threshold (for example, the preset second threshold is -75 dBm or -60 dBm, etc.).

[0151] For example, in this embodiment, the detection results of the above four conditions are all yes. For example, the GC device D2 detects that the number of APs and GO devices operating on channels 2 to 9 in the surrounding environment is 5, which is less than the preset first threshold of 7, and detects that the channel idle ratio of each channel in channels 2 to 9 is greater than the preset third threshold of 10%, and the average channel idle ratio of each channel is 30%, which is greater than the preset fourth threshold of 15%, and detects that the received signal strength RSSI of the GO device D1 is -50 dBm, which is greater than the preset second threshold of -75 dBm. In this case, the GC device D2 can determine a channel that can use a 40 MHz bandwidth to perform Wi-Fi communication with the GO device D1. For example, devices D1 and D2 can use channel 7 as the primary channel and channel 6 as the secondary channel to form a 40 MHz bandwidth channel and use this 40 MHz bandwidth channel to perform Wi-Fi communication, as Figure 6 shown.

[0152] Please refer to Figure 7 , Figure 7 FIG. 1 is a schematic diagram of a first structure of a device control device provided by an embodiment of the present application. The device control device can be applied to an electronic device, and the electronic device is a device with a first role, and the first role is a workstation role or a group client role. The device control device 400 may include: a first determination module 401, a second determination module 402, a first acquisition module 403, a second acquisition module 404, a third acquisition module 405, and a first processing module 406.

[0153] The first determination module 401 is configured to determine an initial working channel of a target device with a second role to which the electronic device is connected, where the second role is an access point role or a group owner role.

[0154] A second determination module 402, configured to determine a channel to be detected according to the initial working channel, where the channel to be detected is within a preset bandwidth range corresponding to the initial working channel.

[0155] A first acquisition module 403, configured to acquire the sum of the numbers of devices with the second role operating on the initial working channel and the channel to be detected in the environment.

[0156] A second acquisition module 404, configured to acquire channel idle parameters of the initial working channel and the channel to be detected.

[0157] A third acquisition module 405, configured to acquire the received signal strength of the target device accessed by the electronic device.

[0158] A first processing module 406, configured to determine a target channel and perform Wi-Fi communication between the electronic device and the target device through the target channel if it is detected that the sum of the numbers is less than or equal to a preset first threshold, the channel idle parameters satisfy a first condition, and the received signal strength of the target device is greater than or equal to a preset second threshold, where the bandwidth of the target channel is greater than the bandwidth of the initial working channel.

[0159] In an implementation manner, the second acquisition module 404 may be configured to:

[0160] Scan the initial working channel and the channel to be detected, and acquire the channel idle time and channel scan time of each channel during the scan; calculate the channel idle ratio of each channel according to the channel idle time and channel scan time of each channel, where the channel idle ratio is the ratio of the channel idle time to the channel scan time; determine the channel idle ratio as the channel idle parameter of each channel in the initial working channel and the channel to be detected;

[0161] Then, the first processing module 406 may be configured to: when the channel idle ratios of all channels in the initial working channel and the channel to be detected are greater than or equal to a preset third threshold, determine that the channel idle parameters satisfy the first condition.

[0162] In an implementation manner, the second acquisition module 404 may further be configured to: calculate the average channel idle ratio of the initial working channel and the channel to be detected, where the average channel idle ratio is another parameter among the channel idle parameters;

[0163] Then, the first processing module 406 may be configured to: when the channel idle ratios of all channels in the initial working channel and the channel to be detected are greater than or equal to a preset third threshold, and the average channel idle ratio is greater than or equal to a preset fourth threshold, determine that the channel idle parameters satisfy the first condition.

[0164] In one embodiment, the second determination module 402 may be configured to:

[0165] Obtain the manner in which the target device accessed by the electronic device uses a preset bandwidth on the initial working channel, where the manner is one of an upward stacked channel and a downward stacked channel;

[0166] Determine a channel to be detected according to the manner in which the target device uses a preset bandwidth on the initial working channel and the initial working channel.

[0167] In one embodiment, the preset bandwidth is a bandwidth of 40 MHz, and the manner in which the target device uses the preset bandwidth on the initial working channel is a downward stacked channel;

[0168] The second determination module 402 may be configured to:

[0169] Determine eight consecutive channels including the initial working channel as the first object channels;

[0170] Determine the channels other than the initial working channel in the first object channels as the channels to be detected, where the number of channels in the channels to be detected that are lower than the initial working channel is greater than the number of channels that are higher than the initial working channel.

[0171] In one embodiment, the preset bandwidth is a bandwidth of 40 MHz, and the manner in which the target device uses the preset bandwidth on the initial working channel is an upward stacked channel;

[0172] The second determination module 402 may also be configured to:

[0173] Determine eight consecutive channels including the initial working channel as the second object channels;

[0174] Determine the channels other than the initial working channel in the second object channels as the channels to be detected, where the number of channels in the channels to be detected that are lower than the initial working channel is less than the number of channels that are higher than the initial working channel.

[0175] In one embodiment, the second determination module 402 may be configured to:

[0176] Obtain the beacon data packet of the target device accessed by the electronic device;

[0177] Obtain the manner in which the target device uses a preset bandwidth on the initial working channel from the beacon data packet.

[0178] Please refer to Figure 8 ,Figure 8 This is the second structural schematic diagram of the device control apparatus provided by the embodiments of the present application. The device control apparatus can be applied to an electronic device, which is a device with a second role, and the second role is an access point role or a group owner role. The device control apparatus 500 may include: a third determination module 501, a fourth determination module 502, a fourth acquisition module 503, a fifth acquisition module 504, a sixth acquisition module 505, and a second processing module 506.

[0179] The third determination module 501 is configured to determine an initial working channel of the electronic device;

[0180] The fourth determination module 502 is configured to determine a channel to be detected according to the initial working channel, and the channel to be detected is within a preset bandwidth range corresponding to the initial working channel;

[0181] The fourth acquisition module 503 is configured to acquire the sum of the numbers of devices with the second role that are operating on the initial working channel and the channel to be detected in the environment;

[0182] The fifth acquisition module 504 is configured to acquire channel idle parameters of the initial working channel and the channel to be detected;

[0183] The sixth acquisition module 505 is configured to acquire the sum of the received signal strengths of other devices with the second role that are operating on the initial working channel and the channel to be detected in the environment;

[0184] The second processing module 506 is configured to, if it is detected that the sum of the numbers is less than or equal to a preset first threshold, the channel idle parameters satisfy a first condition, and the sum of the received signal strengths of the other devices with the second role is less than or equal to a preset fifth threshold, determine a target channel, and perform Wi-Fi communication between the electronic device and a device with a first role connected thereto through the target channel, where the bandwidth of the target channel is greater than the bandwidth of the initial working channel, and the first role is a workstation role or a group client role.

[0185] The embodiments of the present application provide a computer-readable storage medium, on which a computer program is stored. When the computer program is executed on a computer, the computer is caused to execute the processes in the device control method provided in this embodiment.

[0186] The embodiments of the present application further provide an electronic device, including a memory and a processor. The processor is configured to execute the processes in the device control method provided in this embodiment by calling the computer program stored in the memory.

[0187] For example, the above-mentioned electronic device may be a mobile terminal such as a tablet computer or a smart phone. Please refer toFigure 9 , Figure 9 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.

[0188] The electronic device 600 may include components such as a Wi-Fi module 601, a memory 602, and a processor 603. Those skilled in the art can understand that Figure 9 the structure of the electronic device shown in does not constitute a limitation on the electronic device, and may include more or fewer components than shown, or combine certain components, or have different component arrangements. The electronic device 600 may be a device with a first role, and the first role is a workstation role or a group client role.

[0189] The Wi-Fi module 601 may be used to implement Wi-Fi functions.

[0190] The memory 602 may be used to store application programs and data. The application programs stored in the memory 602 contain executable code. The application programs may form various functional modules. The processor 603 executes various functional applications and data processing by running the application programs stored in the memory 602.

[0191] The processor 603 is the control center of the electronic device, connects various parts of the entire electronic device using various interfaces and lines, executes various functions of the electronic device and processes data by running or executing the application programs stored in the memory 602, and by calling the data stored in the memory 602, thereby monitoring the electronic device as a whole.

[0192] In this embodiment, the processor 603 in the electronic device will, according to the following instructions, load the executable code corresponding to the processes of one or more application programs into the memory 602, and the processor 603 will run the application programs stored in the memory 602 to execute:

[0193] Determine the initial working channel of a target device with a second role accessed by the electronic device, where the second role is an access point role or a group owner role;

[0194] According to the initial working channel, determine the channel to be detected, where the channel to be detected is within the preset bandwidth range corresponding to the initial working channel;

[0195] Obtain the sum of the numbers of devices with the second role working on the initial working channel and the channel to be detected in the environment;

[0196] Obtain the channel idle parameters of the initial working channel and the channel to be detected;

[0197] Obtain the received signal strength of the target device accessed by the electronic device;

[0198] If it is detected that the sum of the quantities is less than or equal to a preset first threshold, the channel idle parameter satisfies a first condition, and the received signal strength of the target device is greater than or equal to a preset second threshold, then a target channel is determined, and Wi-Fi communication between the electronic device and the target device is performed through the target channel, and the bandwidth of the target channel is greater than the bandwidth of the initial working channel.

[0199] Please refer to Figure 10 , the electronic device 600 may include components such as a Wi-Fi module 601, a memory 602, a processor 603, a speaker 604, a microphone 605, and a display screen 606.

[0200] The Wi-Fi module 401 may be used to implement Wi-Fi functions.

[0201] The memory 602 may be used to store application programs and data. The application programs stored in the memory 602 contain executable codes. The application programs may form various functional modules. The processor 603 executes various functional applications and data processing by running the application programs stored in the memory 602.

[0202] The processor 603 is the control center of the electronic device, connects various parts of the entire electronic device using various interfaces and lines, executes various functions of the electronic device and processes data by running or executing the application programs stored in the memory 602, and by calling the data stored in the memory 602, thereby performing overall monitoring of the electronic device.

[0203] In this embodiment, the processor 603 in the electronic device will load the executable codes corresponding to the processes of one or more application programs into the memory 602 according to the following instructions, and the processor 603 will run the application programs stored in the memory 602, thereby performing:

[0204] Determine the initial working channel of the target device with a second role accessed by the electronic device, where the second role is an access point role or a group owner role;

[0205] Determine a channel to be detected according to the initial working channel, where the channel to be detected is within a preset bandwidth range corresponding to the initial working channel;

[0206] Obtain the sum of the quantities of devices with the second role working on the initial working channel and the channel to be detected in the environment;

[0207] Obtain the channel idle parameters of the initial working channel and the channel to be detected;

[0208] Obtain the received signal strength of the target device accessed by the electronic device;

[0209] If it is detected that the sum of the quantities is less than or equal to a preset first threshold, the channel idle parameter satisfies a first condition, and the received signal strength of the target device is greater than or equal to a preset second threshold, determine a target channel, and perform Wi-Fi communication between the electronic device and the target device through the target channel, where the bandwidth of the target channel is greater than the bandwidth of the initial working channel.

[0210] In one implementation, when the processor 603 executes to obtain the channel idle parameters of the initial working channel and the channels to be detected, it may execute: scan the initial working channel and the channels to be detected, and obtain the channel idle time and channel scan time of each channel during the scan; calculate the channel idle ratio of each channel according to the channel idle time and channel scan time of each channel, where the channel idle ratio is the ratio of the channel idle time to the channel scan time; determine the channel idle ratio as the channel idle parameter of each channel in the initial working channel and the channels to be detected;

[0211] Then, when the processor 603 executes that the channel idle parameter satisfies the first condition, it may execute: when the channel idle ratio of each channel in the initial working channel and the channels to be detected is greater than or equal to a preset third threshold, determine that the channel idle parameter satisfies the first condition.

[0212] In one implementation, the processor 603 may also execute: calculate the average channel idle ratio of the initial working channel and the channels to be detected, where the average channel idle ratio is another parameter in the channel idle parameter;

[0213] Then, when the processor 603 executes that when the channel idle ratio of each channel in the initial working channel and the channels to be detected is greater than or equal to a preset third threshold, determine that the channel idle parameter satisfies the first condition, it may execute: when the channel idle ratio of each channel in the initial working channel and the channels to be detected is greater than or equal to a preset third threshold, and the average channel idle ratio is greater than or equal to a preset fourth threshold, determine that the channel idle parameter satisfies the first condition.

[0214] In one implementation, when the processor 603 executes to determine the channels to be detected according to the initial working channel, it may execute: obtain the way of using a preset bandwidth on the initial working channel by the target device accessed by the electronic device, where the way is one of an upward stacked channel and a downward stacked channel; determine the channels to be detected according to the way of using the preset bandwidth on the initial working channel by the target device and the initial working channel.

[0215] In one embodiment, the preset bandwidth is 40 MHz, and the way the target device uses the preset bandwidth on the initial working channel is to stack channels downward; when the processor 603 determines the channels to be detected according to the way the target device uses the preset bandwidth on the initial working channel and the initial working channel, it may perform: determining 8 consecutive channels including the initial working channel as the first object channels; determining the channels other than the initial working channel in the first object channels as the channels to be detected, where the number of channels lower than the initial working channel in the channels to be detected is greater than the number of channels higher than the initial working channel.

[0216] In one embodiment, the preset bandwidth is 40 MHz, and the way the target device uses the preset bandwidth on the initial working channel is to stack channels upward; when the processor 603 determines the channels to be detected according to the way and the initial working channel, it may perform: determining 8 consecutive channels including the initial working channel as the second object channels; determining the channels other than the initial working channel in the second object channels as the channels to be detected, where the number of channels lower than the initial working channel in the channels to be detected is less than the number of channels higher than the initial working channel.

[0217] In one embodiment, when the processor 603 obtains the way the target device accessed by the electronic device uses the preset bandwidth on the initial working channel, it may perform: obtaining the beacon data packet of the target device accessed by the electronic device; obtaining the way the target device uses the preset bandwidth on the initial working channel from the beacon data packet.

[0218] Please refer to Figure 11 , Figure 11 which is the third structural schematic diagram of the electronic device provided by the embodiment of the present application.

[0219] The electronic device 700 may include components such as a Wi-Fi module 701, a memory 702, and a processor 703. Those skilled in the art can understand that Figure 11 the structure of the electronic device shown in

[0220] does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements. The electronic device 700 may be a device with a second role, and the second role is an access point role or a group owner role.

[0221] The memory 702 can be used to store application programs and data. The application programs stored in the memory 702 contain executable code. The application programs can form various functional modules. The processor 703 executes various functional applications and data processing by running the application programs stored in the memory 702.

[0222] The processor 703 is the control center of the electronic device. It uses various interfaces and circuits to connect all parts of the entire electronic device. By running or executing the application programs stored in the memory 702 and calling the data stored in the memory 702, it executes various functions of the electronic device and processes data, thereby monitoring the entire electronic device.

[0223] In this embodiment, the processor 703 in the electronic device will load the executable code corresponding to the processes of one or more application programs into the memory 702 according to the following instructions, and the processor 703 will run the application programs stored in the memory 702 to execute:

[0224] Determine the initial working channel of the electronic device;

[0225] According to the initial working channel, determine the channels to be detected, and the channels to be detected are within the preset bandwidth range corresponding to the initial working channel;

[0226] Obtain the sum of the numbers of devices with the second role working on the initial working channel and the channels to be detected in the environment;

[0227] Obtain the channel idle parameters of the initial working channel and the channels to be detected;

[0228] Obtain the sum of the received signal strengths of other devices with the second role working on the initial working channel and the channels to be detected in the environment;

[0229] If it is detected that the sum of the numbers is less than or equal to a preset first threshold, the channel idle parameters meet the first condition, and the sum of the received signal strengths of other devices with the second role is less than or equal to a preset fifth threshold, then determine the target channel, and perform Wi-Fi communication between the electronic device and the device with the first role connected thereto through the target channel. The bandwidth of the target channel is greater than the bandwidth of the initial working channel, and the first role is a workstation role or a group client role.

[0230] In the above embodiments, the descriptions of the respective embodiments have their own focuses. For the parts not detailed in a certain embodiment, reference can be made to the detailed description of the device control method above, and details will not be repeated here.

[0231] The device control device provided by the embodiments of the present application belongs to the same concept as the device control method in the above embodiments. Any method provided in the embodiments of the device control method can be run on the device control device. For the specific implementation process, please refer to the embodiments of the device control method, which will not be elaborated here.

[0232] It should be noted that for the device control method described in the embodiments of the present application, those of ordinary skill in the art can understand that all or part of the process of implementing the device control method described in the embodiments of the present application can be completed by controlling relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, such as stored in a memory and executed by at least one processor. During the execution process, it can include the process of the embodiments of the device control method. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM, Read Only Memory), a random access memory (RAM, Random Access Memory), etc.

[0233] For the device control device described in the embodiments of the present application, its various functional modules can be integrated in a processing chip, or each module can exist physically alone, or two or more modules can be integrated in one module. The above integrated modules can be implemented in the form of hardware or in the form of software functional modules. When the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium, such as a read-only memory, a magnetic disk or an optical disk, etc.

[0234] The above has introduced in detail a device control method, device, storage medium and electronic device provided by the embodiments of the present application. Specific examples are used in this article to elaborate on the principle and implementation manner of the present application. The description of the above embodiments is only used to help understand the method and its core idea of the present application; at the same time, for those skilled in the art, according to the idea of the present application, there will be changes in the specific implementation manner and application scope. In summary, the content of this specification should not be construed as a limitation to the present application.

Claims

1. A device control method, applied to an electronic device, wherein, the electronic device is a device with a first role, and the first role is a workstation role or a group client role. The method includes: determining an initial working channel of a target device with a second role accessed by the electronic device, where the second role is an access point role or a group owner role; determining a channel to be detected according to the initial working channel, and the channel to be detected is within a preset bandwidth range corresponding to the initial working channel; obtaining the sum of the numbers of devices with the second role working on the initial working channel and the channel to be detected in the environment; obtaining channel idle parameters of the initial working channel and the channel to be detected; obtaining the received signal strength of the target device accessed by the electronic device; if it is detected that the sum of the numbers is less than or equal to a preset first threshold, the channel idle parameters meet a first condition, and the received signal strength of the target device is greater than or equal to a preset second threshold, then determining a target channel, and performing Wi-Fi communication between the electronic device and the target device through the target channel, where the bandwidth of the target channel is greater than the bandwidth of the initial working channel. Herein, the channel idle parameters meeting the first condition include: when the channel idle ratios of each channel in the initial working channel and the channel to be detected are both greater than or equal to a preset third threshold, it is determined that the channel idle parameters meet the first condition.

2. The device control method according to claim 1, wherein, obtaining channel idle parameters of the initial working channel and the channel to be detected includes: scanning the initial working channel and the channel to be detected, and obtaining the channel idle time and channel scanning time of each channel during the scanning; calculating the channel idle ratio of each channel according to the channel idle time and channel scanning time of each channel, where the channel idle ratio is the ratio of the channel idle time to the channel scanning time; determining the channel idle ratio as the channel idle parameter of each channel in the initial working channel and the channel to be detected.

3. The device control method according to claim 2, wherein, the method further includes: calculating the average channel idle ratio of the initial working channel and the channel to be detected, where the average channel idle ratio is another parameter among the channel idle parameters; when the channel idle ratios of each channel in the initial working channel and the channel to be detected are both greater than or equal to a preset third threshold, determining that the channel idle parameters meet the first condition includes: when the channel idle ratios of each channel in the initial working channel and the channel to be detected are both greater than or equal to a preset third threshold, and the average channel idle ratio is greater than or equal to a preset fourth threshold, it is determined that the channel idle parameters meet the first condition.

4. The device control method according to claim 1, wherein, determining a channel to be detected according to the initial working channel includes: obtaining the way of using a preset bandwidth by the target device accessed by the electronic device on the initial working channel, and the way is one of an upward stacked channel and a downward stacked channel. Determine the channel to be detected according to the way the target device uses the preset bandwidth on the initial working channel and the initial working channel.

5. The device control method according to claim 4, wherein, The preset bandwidth is a bandwidth of 40 MHz, and the way the target device uses the preset bandwidth on the initial working channel is to stack channels downward; Determining the channel to be detected according to the way the target device uses the preset bandwidth on the initial working channel and the initial working channel includes: Determine 8 consecutive channels including the initial working channel as the first object channels; Determine the channels other than the initial working channel in the first object channels as the channels to be detected, wherein the number of channels in the channels to be detected that are lower than the initial working channel is greater than the number of channels that are higher than the initial working channel.

6. The device control method according to claim 4, wherein, The preset bandwidth is a bandwidth of 40 MHz, and the way the target device uses the preset bandwidth on the initial working channel is to stack channels upward; Determining the channel to be detected according to the way and the initial working channel includes: Determine 8 consecutive channels including the initial working channel as the second object channels; Determine the channels other than the initial working channel in the second object channels as the channels to be detected, wherein the number of channels in the channels to be detected that are lower than the initial working channel is less than the number of channels that are higher than the initial working channel.

7. The device control method according to claim 4, wherein, Obtaining the way the target device accessed by the electronic device uses the preset bandwidth on the initial working channel includes: Obtain the beacon data packet of the target device accessed by the electronic device; Obtain the way the target device uses the preset bandwidth on the initial working channel from the beacon data packet.

8. A device control method applied to an electronic device, wherein, The electronic device is a device with a second role, and the second role is an access point role or a group owner role. The method includes: Determine the initial working channel of the electronic device; Determine the channel to be detected according to the initial working channel, and the channel to be detected is within the preset bandwidth range corresponding to the initial working channel; Obtain the sum of the number of devices with the second role working on the initial working channel and the channel to be detected in the environment; Obtain the channel idle parameters of the initial working channel and the channel to be detected; Obtain the sum of the received signal strengths of other devices with the second role working on the initial working channel and the channel to be detected in the environment. If it is detected that the sum of the quantities is less than or equal to a preset first threshold, the channel idle parameter satisfies a first condition, and the sum of the received signal strengths of other devices with a second role is less than or equal to a preset fifth threshold, then a target channel is determined, and Wi-Fi communication is performed between the electronic device and the device with a first role connected thereto through the target channel, where the bandwidth of the target channel is greater than the bandwidth of the initial working channel, and the first role is a workstation role or a group client role. Among them, the channel idle parameter satisfying the first condition includes: when the channel idle ratios of the channels in the initial working channel and the channels to be detected are both greater than or equal to a preset third threshold, it is determined that the channel idle parameter satisfies the first condition.

9. A device control device, applied to an electronic device, wherein, the electronic device is a device with a first role, and the first role is a workstation role or a group client role. The device includes: a first determination module, configured to determine an initial working channel of a target device with a second role accessed by the electronic device, where the second role is an access point role or a group owner role; a second determination module, configured to determine channels to be detected according to the initial working channel, where the channels to be detected are within a preset bandwidth range corresponding to the initial working channel; a first acquisition module, configured to acquire the sum of the numbers of devices with the second role working on the initial working channel and the channels to be detected in the environment; a second acquisition module, configured to acquire channel idle parameters of the initial working channel and the channels to be detected; a third acquisition module, configured to acquire the received signal strength of the target device accessed by the electronic device; a first processing module, configured to, if it is detected that the sum of the quantities is less than or equal to a preset first threshold, the channel idle parameter satisfies the first condition, and the received signal strength of the target device is greater than or equal to a preset second threshold, then determine a target channel, and perform Wi-Fi communication between the electronic device and the target device through the target channel, where the bandwidth of the target channel is greater than the bandwidth of the initial working channel. Among them, the first processing module is further configured to, when the channel idle ratios of the channels in the initial working channel and the channels to be detected are both greater than or equal to a preset third threshold, determine that the channel idle parameter satisfies the first condition.

10. The device control device according to claim 9, wherein, the second acquisition module is configured to: scan the initial working channel and the channels to be detected, and acquire the channel idle time and the channel scan time of each channel during the scan; calculate the channel idle ratio of each channel according to the channel idle time and the channel scan time of each channel, where the channel idle ratio is the ratio of the channel idle time to the channel scan time; and determine the channel idle ratio as the channel idle parameter of each channel in the initial working channel and the channels to be detected.

11. A device control device, applied to an electronic device, wherein, the electronic device is a device with a second role, and the second role is an access point role or a group owner role. The device includes: A third determination module, configured to determine an initial working channel of the electronic device; A fourth determination module, configured to determine a channel to be detected according to the initial working channel, where the channel to be detected is within a preset bandwidth range corresponding to the initial working channel; A fourth acquisition module, configured to acquire the sum of the numbers of devices with the second role that are working on the initial working channel and the channel to be detected in the environment; A fifth acquisition module, configured to acquire channel idle parameters of the initial working channel and the channel to be detected; A sixth acquisition module, configured to acquire the sum of the received signal strengths of other devices with the second role that are working on the initial working channel and the channel to be detected in the environment; A second processing module, configured to determine a target channel if it is detected that the sum of the numbers is less than or equal to a preset first threshold, the channel idle parameters satisfy a first condition, and the sum of the received signal strengths of the other devices with the second role is less than or equal to a preset fifth threshold, and perform Wi-Fi communication between the electronic device and the device with the first role connected thereto through the target channel, where the bandwidth of the target channel is greater than the bandwidth of the initial working channel, and the first role is a workstation role or a group client role. Wherein, the second processing module is further configured to determine that the channel idle parameters satisfy the first condition when the channel idle ratio of each channel in the initial working channel and the channel to be detected is greater than or equal to a preset third threshold.

12. A storage medium, on which a computer program is stored, wherein, when the computer program is executed on a computer, the computer is caused to execute the method according to any one of claims 1 to 7, or execute the method according to claim 8.

13. An electronic device, including a memory and a processor, wherein, the electronic device is a device with a first role, and the first role is a workstation role or a group client role. The processor is configured to execute by calling the computer program stored in the memory: determine an initial working channel of a target device with a second role accessed by the electronic device, where the second role is an access point role or a group owner role; determine a channel to be detected according to the initial working channel, where the channel to be detected is within a preset bandwidth range corresponding to the initial working channel; acquire the sum of the numbers of devices with the second role that are working on the initial working channel and the channel to be detected in the environment; acquire channel idle parameters of the initial working channel and the channel to be detected; acquire the received signal strength of the target device accessed by the electronic device; If it is detected that the sum of the quantities is less than or equal to a preset first threshold, the channel idle parameter satisfies a first condition, and the received signal strength of the target device is greater than or equal to a preset second threshold, then a target channel is determined, and Wi-Fi communication between the electronic device and the target device is performed through the target channel, where the bandwidth of the target channel is greater than the bandwidth of the initial working channel. Herein, the channel idle parameter satisfying the first condition includes: when the channel idle ratios of the channels in both the initial working channel and the channels to be detected are greater than or equal to a preset third threshold, it is determined that the channel idle parameter satisfies the first condition.

14. The electronic device according to claim 13, wherein, the processor is configured to execute: scan the initial working channel and the channels to be detected, and obtain the channel idle time and the channel scan time of each channel during the scan; calculate the channel idle ratio of each channel according to the channel idle time and the channel scan time of each channel, where the channel idle ratio is the ratio of the channel idle time to the channel scan time; determine the channel idle ratio as the channel idle parameter of each channel in the initial working channel and the channels to be detected.

15. The electronic device according to claim 14, wherein, the processor is configured to execute: calculate the average channel idle ratio of the initial working channel and the channels to be detected, where the average channel idle ratio is another parameter among the channel idle parameters; when the channel idle ratios of the channels in both the initial working channel and the channels to be detected are greater than or equal to a preset third threshold, and the average channel idle ratio is greater than or equal to a preset fourth threshold, it is determined that the channel idle parameter satisfies the first condition.

16. The electronic device according to claim 13, wherein, the processor is configured to execute: obtain the manner in which the target device accessed by the electronic device uses a preset bandwidth on the initial working channel, where the manner is one of an upward stacked channel and a downward stacked channel; determine the channels to be detected according to the manner in which the target device uses the preset bandwidth on the initial working channel and the initial working channel.

17. The electronic device according to claim 16, wherein, the preset bandwidth is a bandwidth of 40 MHz, and the manner in which the target device uses the preset bandwidth on the initial working channel is a downward stacked channel; the processor is configured to execute: determine 8 consecutive channels including the initial working channel as the first object channels; determine the channels other than the initial working channel in the first object channels as the channels to be detected, where the number of channels in the channels to be detected that are lower than the initial working channel is greater than the number of channels that are higher than the initial working channel.

18. The electronic device according to claim 16, wherein, the preset bandwidth is a bandwidth of 40 MHz, and the manner in which the target device uses the preset bandwidth on the initial working channel is an upward stacked channel; the processor is configured to execute: determine 8 consecutive channels including the initial working channel as the second object channels; Determine other channels in the second object channel except the initial working channel as channels to be detected, where the number of channels with a channel lower than the initial working channel in the channels to be detected is less than the number of channels with a channel higher than the initial working channel.

19. The electronic device according to claim 16, wherein, the processor is configured to execute: Obtain the beacon data packet of the target device accessed by the electronic device; Obtain the manner in which the target device uses a preset bandwidth on the initial working channel from the beacon data packet.

20. An electronic device, including a memory and a processor, wherein, the electronic device is a device with a second role, and the second role is an access point role or a group owner role. The processor is configured to execute by calling a computer program stored in the memory: Determine the initial working channel of the electronic device; Determine channels to be detected according to the initial working channel, and the channels to be detected are within a preset bandwidth range corresponding to the initial working channel; Obtain the sum of the numbers of devices with the second role working on the initial working channel and the channels to be detected in the environment; Obtain the channel idle parameters of the initial working channel and the channels to be detected; Obtain the sum of the received signal strengths of other devices with the second role working on the initial working channel and the channels to be detected in the environment; If it is detected that the sum of the numbers is less than or equal to a preset first threshold, the channel idle parameters meet the first condition, and the sum of the received signal strengths of other devices with the second role is less than or equal to a preset fifth threshold, then determine a target channel, and perform Wi-Fi communication between the electronic device and the device with the first role connected thereto through the target channel. The bandwidth of the target channel is greater than the bandwidth of the initial working channel, and the first role is a workstation role or a group client role. Wherein, the channel idle parameters meeting the first condition include: when the channel idle ratios of each channel in the initial working channel and the channels to be detected are both greater than or equal to a preset third threshold, it is determined that the channel idle parameters meet the first condition.

Citation Information

Patent Citations

  • Wireless bandwidth selecting method and system based on WLAN wireless bandwidth assessment

    CN103889011A

  • Method and system for optimizing WiFi connection

    CN106231676A

  • Network optimization method based on WIFI communication, intelligent terminal and storage medium

    CN109951858A

  • Adjusting method, terminal and computer storage medium

    CN110337135A