CN116437410A - Frequency band switching method, device and computer readable storage medium - Google Patents

Frequency band switching method, device and computer readable storage medium Download PDF

Info

Publication number
CN116437410A
CN116437410A CN202310505264.1A CN202310505264A CN116437410A CN 116437410 A CN116437410 A CN 116437410A CN 202310505264 A CN202310505264 A CN 202310505264A CN 116437410 A CN116437410 A CN 116437410A
Authority
CN
China
Prior art keywords
frequency band
working frequency
signal intensity
wifi
signal strength
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310505264.1A
Other languages
Chinese (zh)
Inventor
滑国青
梁锐年
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Mailing Information Technology Co ltd
Original Assignee
Shenzhen Mailing Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Mailing Information Technology Co ltd filed Critical Shenzhen Mailing Information Technology Co ltd
Priority to CN202310505264.1A priority Critical patent/CN116437410A/en
Publication of CN116437410A publication Critical patent/CN116437410A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W36/00Hand-off or reselection arrangements
    • H04W36/24Reselection being triggered by specific parameters
    • H04W36/30Reselection being triggered by specific parameters by measured or perceived connection quality data
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W36/00Hand-off or reselection arrangements
    • H04W36/0005Control or signalling for completing the hand-off
    • H04W36/0083Determination of parameters used for hand-off, e.g. generation or modification of neighbour cell lists
    • H04W36/00837Determination of triggering parameters for hand-off
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

The application provides a frequency band switching method, a device and a computer readable storage medium, which belong to the field of wireless communication, and the method comprises the following steps: acquiring a current working frequency band corresponding to current connection between a terminal and a router; measuring a first signal strength and a second signal strength between the terminal and the router; comparing the first signal strength with a preset segmentation threshold according to the current working frequency band, and determining a threshold interval to which the first signal strength belongs; and monitoring whether the first signal intensity and the second signal intensity meet the frequency band switching condition according to the threshold interval to which the first signal intensity belongs. According to the method and the device, two groups of segment thresholds are preset for the current working frequency band, different threshold intervals are arranged for each group of segment thresholds, corresponding frequency band switching conditions are arranged for each threshold interval, and the problem that in the prior art, the terminal is repeatedly switched between two frequency bands due to single threshold setting is solved.

Description

Frequency band switching method, device and computer readable storage medium
Technical Field
The present invention relates to the field of wireless communications technologies, and in particular, to a method and apparatus for switching frequency bands, and a computer readable storage medium.
Background
It is known that the bandwidth of a 5G channel is larger than that of a 2.4G channel under the condition of good signal quality, so that theoretically, it is a better strategy to connect the 5G channel; but the 2.4G signal has larger coverage than the 5G signal, and the 5G signal is fast in attenuation along with the distance and poor in wall penetrating capability, so that the 2.4G signal is more stable and is not easy to break when penetrating the wall or the longer distance.
Most of embedded devices in the market use wpa_suppicant open source software as a wifi connection control program, whether frequency band switching is performed is mainly determined by evaluating signal to noise ratio and predicting throughput of wifi, and the algorithm of finding wpa_suppicant through testing is biased to use 5G frequency band, namely, after the device is connected to the 5G frequency band, the device is difficult to automatically switch to 2.4G frequency band, which causes unstable communication and even frequent disconnection under the condition of relatively far away from a router or relatively poor 5G signal such as wall penetration; there are also algorithms for judging whether to use the 2.4G band or the 5G band by simply setting a signal strength threshold, but since wifi signals are fluctuating, the device can oscillate back and forth between the 2.4G band and the 5G band.
Disclosure of Invention
The present invention aims to provide a frequency band switching method, a device and a computer readable storage medium, which solve one or more of the above technical problems:
according to a first aspect of the present disclosure, there is provided a frequency band switching method, the method including the steps of:
periodically scanning wifi, and acquiring current wifi and candidate wifi, wherein the current wifi corresponds to a current working frequency band, the candidate wifi corresponds to a candidate working frequency band, and the current working frequency band and the candidate working frequency band are respectively one of a first frequency band and a second frequency band supported by a terminal and a router;
measuring a first signal strength of communication between the terminal and the router through the first frequency band and a second signal strength of communication through the second frequency band;
comparing the first signal strength with a preset segmentation threshold according to the current working frequency band, determining a threshold interval to which the first signal strength belongs, wherein the preset segmentation threshold comprises a first segmentation threshold and a second segmentation threshold, the first segmentation threshold comprises a first strong area, a first middle area and a first weak area, the second segmentation threshold comprises a second strong area, a second middle area and a second weak area, and if the current working frequency band is the first frequency band, comparing the first signal strength with the first segmentation threshold; if the current working frequency band is a second frequency band, comparing the first signal strength with the second segmentation threshold value;
monitoring whether the first signal intensity and the second signal intensity meet the frequency band switching condition of the threshold interval or not;
if yes, the current working frequency band is switched to a candidate working frequency band;
if not, maintaining the current working frequency band.
Optionally, if the current operating frequency band is a first frequency band, the step of comparing the first signal strength with the first segmentation threshold includes:
comparing the first signal strength with a first boundary value, wherein the first boundary value comprises a boundary value h and a boundary value l, the boundary value h is a boundary value of the first strong zone and the first middle zone, and the boundary value l is a boundary value of the first middle zone and the first weak zone;
if the first signal intensity is greater than the boundary value h, the first signal intensity belongs to the first strong zone;
if the first signal strength is smaller than the boundary value l, the first signal strength belongs to the first weak area;
and if the first signal strength is greater than or equal to the boundary value l and less than or equal to the boundary value h, the first signal strength belongs to the first middle zone.
Optionally, if the current operating frequency band is a second frequency band, the step of comparing the first signal strength with the second segmentation threshold includes:
comparing the first signal strength with a second boundary value, wherein the second boundary value comprises a boundary value H and a boundary value L, the boundary value H is the boundary value of the second strong zone and the second middle zone, and the boundary value L is the boundary value of the second middle zone and the second weak zone;
if the first signal intensity is greater than the boundary value H, the first signal intensity belongs to the second strong area;
if the first signal strength is smaller than a boundary value L, the first signal strength belongs to the second weak area;
and if the first signal strength is smaller than or equal to the boundary value H and larger than or equal to the boundary value L, the first signal strength belongs to the second middle zone.
Optionally, the frequency band switching condition of the threshold interval includes:
the first signal intensity belongs to the first middle area, and the difference value between the first signal intensity and the second signal intensity is smaller than the first preset value;
the first signal intensity belongs to the first weak area, and the difference value between the first signal intensity and the second signal intensity is smaller than zero;
the first signal strength belongs to a second strong area;
the first signal intensity belongs to a second middle area, and the difference value between the first signal intensity and the second signal intensity is larger than a second preset value;
the first signal intensity belongs to a second weak area, and the difference value between the first signal intensity and the second signal intensity is larger than a third preset value.
Optionally, the step of switching the current operating frequency band to the candidate operating frequency band includes:
acquiring a frequency band switching instruction;
disconnecting the current wifi and sending a disconnection event to a wifi network management module, wherein the disconnection event refers to the connection interruption of the current wifi;
judging whether the network management state of the current working frequency band interface is that: the network management state comprises a connection state value and an IP state value, wherein the connection state value represents connection or disconnection, and the IP state value represents IP or no IP;
if yes, a timer is started, the timer is provided with a timeout value, and the wifi network management module does not process the disconnection event in the timeout value, namely, the network management state of the current working frequency band interface is kept as follows: connected, IP;
switching wifi connection to the candidate wifi, sending a connected event to the wifi network management module and automatically acquiring an IP module, wherein the connected event means that the candidate wifi is successfully connected;
monitoring the network management state of the candidate working frequency band interface through the wifi network management module;
if the network management state of the candidate working frequency band interface is: if the IP is connected, judging whether the timer exists or not;
if so, canceling the timer;
sending an IP generation request to the automatic IP acquisition module, and renewing a new IP;
judging whether the new IP is consistent with the current IP;
if the IP is consistent, the IP does not need to be changed;
if not, resetting the IP and resetting the default route.
Optionally, the step of monitoring, by the wifi network management module, the network management state of the candidate operating frequency band interface further includes:
if the network management state of the candidate working frequency band interface is: if the connection is no IP, an IP generation request is sent to the automatic IP acquisition module to generate an IP;
if the IP is acquired, setting the IP and updating a default route, and changing the network management state of the candidate working frequency band interface into: connected, IP;
acquiring the network management state of the candidate working frequency band interface when the timer is overtime;
if the network management state of the candidate working frequency band interface is: if the IP is connected, the frequency band switching is successful;
if the network management state of the candidate working frequency band interface is: and if the connection is not provided with the IP, after a certain time delay, sending an IP generation request to the automatic acquisition IP module, and re-acquiring the IP.
Optionally, the step of monitoring, by the wifi network management module, the network management state of the candidate operating frequency band interface further includes:
if the network management state of the candidate working frequency band interface is: unconnected, IP-free, change the network management state to: unconnected, IP-free, and clear IP, reselect default route.
Optionally, when the timer expires, if the network management state of the candidate operating band interface is: and if the connection is not provided with the IP, after a certain time delay, sending an IP generation request to the automatic acquisition IP module, and after the step of re-acquiring the IP, further comprising:
setting IP and updating default route;
changing the network management state of the candidate working frequency band interface into: connected, there is IP.
According to a second aspect of the present disclosure, there is provided a frequency band switching apparatus, the apparatus comprising:
the scanning module is used for periodically scanning wifi to obtain current wifi and candidate wifi, the current wifi corresponds to a current working frequency band, the candidate wifi corresponds to a candidate working frequency band, and the current working frequency band and the candidate working frequency band are respectively one of a first frequency band and a second frequency band supported by a terminal and a router;
the measuring module is used for measuring the first signal intensity of the communication between the terminal and the router through the first frequency band and the second signal intensity of the communication through the second frequency band;
the comparison module is used for comparing the first signal intensity with a preset segmentation threshold according to the working frequency band, determining a threshold interval to which the first signal intensity belongs, wherein the preset segmentation threshold comprises a first segmentation threshold and a second segmentation threshold, the first segmentation threshold comprises a first strong area, a first middle area and a first weak area, the second segmentation threshold comprises a second strong area, a second middle area and a second weak area, and if the working frequency band is the first frequency band, the first signal intensity is compared with the first segmentation threshold, and determining the threshold interval to which the first signal intensity belongs in the first segmentation threshold; if the working frequency band is a second frequency band, comparing the first signal intensity with a second segmentation threshold value, and determining a threshold value interval of the first signal intensity in the second segmentation threshold value;
the judging module is used for judging whether the first signal intensity and the second signal intensity accord with the frequency band switching condition or not according to the threshold value interval to which the first signal intensity belongs;
and the switching module is used for switching the working frequency band to another frequency band different from the working frequency band.
According to a third aspect of the present disclosure, there is provided a computer readable storage medium comprising a computer program which, when run on an electronic device, causes the electronic device to perform the method of any one of claims 1-8.
The beneficial effects of the present disclosure are:
two groups of segment thresholds are respectively set according to the difference of the current working frequency bands, each group of segment thresholds is provided with a different threshold interval, and each threshold interval is provided with different frequency band switching conditions, on one hand, the signal intensity is compared with the corresponding segment threshold to determine the threshold interval to which the signal intensity belongs, and compared with the setting of a single threshold, the signal intensity is prevented from switching back and forth around the threshold, so that the switching of the frequency bands is more stable; on the other hand, different frequency band switching conditions are set for different threshold intervals, so that the switching of the frequency bands is more accurate, and the terminal is further prevented from switching back and forth between the two frequency bands.
Meanwhile, when the frequency band is switched, the communication is ensured to be continuous as far as possible through an IP anti-shake management strategy, the equipment is not offline, and the user experience of the equipment is enhanced.
Drawings
Fig. 1 is a diagram of an implementation environment involved in a frequency band switching method according to some exemplary embodiments of the present disclosure;
fig. 2, 3, 4 are flowcharts illustrating a method of band switching according to an exemplary embodiment;
fig. 5 is a block diagram illustrating a band switching apparatus according to an exemplary embodiment.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
In order to make the present application solution better understood by those skilled in the art, the following description will be made in detail and with reference to the accompanying drawings in the embodiments of the present application, it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without making any inventive effort, shall fall within the scope of the present application.
Fig. 1 is a schematic diagram of an implementation environment related to a frequency band switching method according to an exemplary embodiment of a portion of the disclosure, where the implementation environment includes: a terminal 100 and a router 200;
the terminal 100 may be an electronic device supporting dual-frequency wireless communication, such as a smart phone, a tablet computer, and a network camera, and has a frequency band switching capability, and can switch to another frequency band of the router 200 for communication when the signal quality of a certain frequency band of the access router 200 does not meet the communication requirement.
The router 200 is a dual-frequency wireless router, and can communicate with the terminal 100 through a first frequency band and a second frequency band, wherein the bandwidth of the first frequency band channel is larger than that of the second frequency band channel under the condition of good signal quality, so that the communication by connecting the first frequency band is a better strategy in theory; but the first frequency band signal decays faster along with the distance than the second frequency band signal, and the wall penetration ability is poor, and the second frequency band signal has bigger coverage than first frequency band signal, and when wearing the wall or long distance, the second frequency band signal is more stable than first frequency band signal, is difficult for breaking. The second frequency band of the present disclosure is illustrated by way of example with respect to the 2.4G frequency band, and the first frequency band is illustrated by way of example with respect to the 5G frequency band.
For the router 200 and the terminal 100 supporting the dual-band integration, the terminal 100 may be connected with a certain frequency band of the router 200 according to actual situations. However, since the threshold is set relatively singly in the conventional terminal 100, the terminal 100 switches back and forth between two frequency bands, which affects the user experience. According to the method, two groups of segment thresholds are preset in the terminal 100, different threshold intervals are arranged in each group of segment thresholds, and different frequency band switching conditions are arranged in each threshold interval, so that on one hand, the frequency band switching of the method is more stable, the 5G signal strength is compared with the corresponding segment threshold, the threshold interval to which the 5G signal strength belongs is determined firstly, whether the frequency band switching is carried out is judged, and compared with the single threshold setting, the terminal 100 is prevented from switching back and forth between two frequency bands when the signal strength is near the threshold; on the other hand, the frequency band switching is more accurate, different frequency band switching conditions are set according to different threshold intervals, and the terminal 100 is further prevented from switching back and forth between two frequency bands. Specifically, when the frequency band switching judgment is performed, firstly, the working frequency band corresponding to the current connection between the terminal 100 and the router 200, the 5G signal intensity of the communication between the terminal 100 and the router 200 through the 5G frequency band, and the 2.4G signal intensity of the communication between the terminal 100 and the router 200 through the 2.4G frequency band are obtained, the 5G signal intensity is compared with the corresponding segmentation threshold according to the working frequency band corresponding to the current connection, the threshold interval to which the 5G signal intensity belongs is determined, then, according to the frequency band switching condition of the corresponding threshold interval, whether the 5G signal intensity and the 2.4G signal intensity meet the frequency band switching condition is judged, if yes, the working frequency band is switched to another frequency band different from the working frequency band.
In addition, the frequency band switching method mainly relates to three functional modules: the system comprises a wifi network management module, a wifi connection management module and an automatic IP module.
wifi network management module: the management function of the wifi interface is responsible for, and the management function specifically comprises the functions of starting and stopping the wifi interface, configuring an ip address, setting a routing table, monitoring an interface state and the like.
wifi connection management module: the system is embedded equipment of a general linux platform, and is a commonly used open-source wifi connection management program which is responsible for completing wifi connection management work and sending connection state change events such as events of disconnect, connected and the like to a wifi network management module.
Automatically acquiring an IP module: and after the wifi connection is successful, automatically acquiring or renewing the IP address.
Fig. 2 and 3 are flowcharts illustrating a method for switching frequency bands according to an exemplary embodiment. The frequency band switching method is used in the terminal 100 in the implementation environment shown in fig. 1, wherein the first frequency band is a 5G frequency band, and the second frequency band is a 2.4G frequency band. The frequency band switching method as shown in fig. 2 may include the steps of:
s1, periodically scanning wifi to obtain current wifi and candidate wifi, wherein the current wifi corresponds to a current working frequency band, the candidate wifi corresponds to a candidate working frequency band, and the current working frequency band and the candidate working frequency band are respectively one of a first frequency band and a second frequency band supported by a terminal and a router;
s2, measuring first signal intensity of communication between the terminal and the router through the first frequency band and second signal intensity of communication between the terminal and the router through the second frequency band;
s3, comparing the first signal strength with a preset segmentation threshold according to the working frequency band, determining a threshold interval to which the first signal strength belongs, wherein the preset segmentation threshold comprises a first segmentation threshold and a second segmentation threshold, the first segmentation threshold comprises a first strong area, a first middle area and a first weak area, the second segmentation threshold comprises a second strong area, a second middle area and a second weak area, and if the working frequency band is the first frequency band, comparing the first signal strength with the first segmentation threshold; if the working frequency band is a second frequency band, comparing the first signal strength with a second segmentation threshold;
s4, monitoring whether the first signal intensity and the second signal intensity meet the judgment condition of frequency band switching or not according to the threshold value interval to which the first signal intensity belongs;
and if yes, S5, switching the current working frequency band into the candidate working frequency band.
In the step S1, the terminal 100 periodically scans wifi, filters out wifi networks of all the same SSID according to the assigned SSID, and takes 2.4 gwfi networks and 5 gwfi networks as an example in the disclosure, where a wifi network corresponding to a current connection between the terminal 100 and the router 200 is a current wifi, a corresponding frequency band is a current working frequency band, another is a candidate wifi, a corresponding frequency band is a candidate working frequency band, if a wifi network corresponding to a current connection between the terminal and the router is a 2.4 gwfi network, a current working frequency band of the terminal is a 2.4G frequency band, and the candidate working frequency band is a 5G frequency band; if the wifi network corresponding to the current connection between the terminal and the router is a 5Gwifi network, the current working frequency band of the terminal is a 5G frequency band, and the candidate working frequency band is a 2.4G frequency band.
In the step S2, the terminal 100 may monitor the signal intensities of the two frequency bands in real time to obtain the signal intensities of the two frequency bands, where the signal intensity of the 2.4G frequency band is 2.4G signal intensity and the signal intensity of the 5G frequency band is 5G signal intensity.
In the above steps S3-S4, the band switching involves two aspects, the switching strategy 1 is to switch from the 5G band to the 2.4G band, and the switching strategy 2 is to switch from the 2.4G band to the 5G band. The switching from the 2.4G frequency band to the 5G frequency band means that the current working frequency band corresponding to the current connection between the terminal 100 and the router 200 is the 2.4G frequency band, and the candidate working frequency band is the 5G frequency band; the switching from the 5G frequency band to the 2.4G frequency band means that the current operating frequency band corresponding to the current connection between the terminal 100 and the router 200 is the 5G frequency band, and the candidate operating frequency band is the 2.4G frequency band. For the switching policy 1, a first segmentation threshold is preset in the terminal 100, where the first segmentation threshold includes a first strong region [ 0, h ], a first middle region [ h, l ] and a first weak region [ 256, l ], where h is a boundary value between the first strong region and the first middle region, and l is a boundary value between the first middle region and the first weak region. When judging whether the 5G signal strength meets the frequency band switching condition, firstly, comparing the 5G signal strength with a boundary value l and a boundary value h respectively to determine a threshold interval to which the 5G signal strength belongs in a first segmentation threshold, and if the 5G signal strength is greater than the boundary value h, the 5G signal strength belongs to a first strong area; if the 5G signal strength is smaller than the boundary value l, the 5G signal strength belongs to a first weak area; if the 5G signal intensity is greater than or equal to the boundary value l and less than or equal to the boundary value h, the 5G signal intensity belongs to a first middle zone; then judging whether to switch the frequency band according to the frequency band switching condition of the corresponding threshold interval, wherein the 5G signal of the first strong area is better than the 2.4G signal and the bandwidth is larger, so that when the 5G signal strength belongs to the first strong area, the current working frequency band is kept not to switch the frequency band; the 5G signal strength in the first middle region is weaker and has little difference from the 2.4G signal strength, so the frequency band switching condition in the first middle region is: the difference between the 5G signal strength and the 2.4G signal strength is smaller than a first preset value, the first preset value is larger than 0, and is preferably half of the difference between the boundary value h and the boundary value l, namely, the first preset value= (h-l)/2; the 5G signal strength of the first weak area is weaker, the terminal 100 adopts the principle of stable networking priority, and uses the 2.4G network preferentially, which ensures that the equipment can be on line for a long time to the greatest extent for embedded equipment such as a network camera or an IOT, and the frequency band switching conditions are as follows: the difference value between the 5G signal intensity and the 2.4G signal intensity is smaller than zero, and the frequency band switching condition of the corresponding threshold interval is met, namely the current working frequency band is switched to the candidate working frequency band. For policy 2, a second segmentation threshold is preset in the terminal 100, where the second segmentation threshold includes a second strong region [ 0, H ], a second middle region [ H, L ] and a second weak region [ 256, L ], where H is a boundary value between the second strong region and the second middle region, L is a boundary value between the second middle region and the second weak region, and H > H, L > L. Firstly, comparing the 5G signal strength with a boundary value L and a boundary value H respectively to determine a threshold interval of the 5G signal strength in a second segmentation threshold, and if the 5G signal strength is greater than the boundary value H, the 5G signal strength belongs to a second strong area; if the 5G signal strength is smaller than the boundary value L, the 5G signal strength belongs to a second weak area; if the 5G signal intensity is greater than or equal to the boundary value L and less than or equal to the boundary value H, the 5G signal intensity belongs to a second middle area; then judging whether to switch the frequency band according to the frequency band switching condition of the corresponding threshold interval, wherein the 5G signal of the second strong area is better than the 2.4G signal and the bandwidth is larger, so that when the 5G signal strength belongs to the second strong area, the current working frequency band is switched to the candidate working frequency band; the 5G signal strength in the second middle region is weaker and has a small difference from the 2.4G signal strength, so the frequency band switching condition in the second middle region is: the difference between the 5G signal strength and the 2.4G signal strength is greater than a second preset value, the second preset value is greater than 0, and preferably the difference between the boundary value H and the boundary value L is the second preset value=h-L; the 5G signal strength of the second weak area is weaker, the terminal 100 adopts the principle of stable networking priority, and uses the 2.4G network preferentially, which ensures that the equipment can be on line for a long time to the greatest extent for embedded equipment such as a network camera or an IOT, and the frequency band switching conditions are as follows: the difference between the 5G signal strength and the 2.4G signal strength is greater than a third preset value, and the third preset value is preferably twice the second preset value, that is, the third preset value=2× (H-L), and the frequency band switching condition in the corresponding threshold interval is satisfied, that is, the current operating frequency band is switched to the candidate operating frequency band.
In summary, in the frequency band switching method shown in the embodiment of the present disclosure, by acquiring the current working frequency band corresponding to the current connection between the terminal 100 and the router 200, comparing the 5G signal strength with the corresponding segmentation threshold, if the current working frequency band is the 5G frequency band, comparing the 5G signal strength with the first segmentation threshold, if the current working frequency band is the 2.4G frequency band, comparing the 5G signal strength with the second segmentation threshold, acquiring the threshold interval to which the 5G signal strength belongs, wherein different segmentation thresholds are respectively provided with different frequency band switching conditions, and judging whether to perform frequency band switching according to the frequency band switching conditions of the threshold interval, so that the present disclosure can use the 2.4G network preferentially under the condition that the 5G signal strength is weak, which ensures that the equipment such as the network camera or the IOT can be online for a long time to the greatest extent; under the condition of strong 5G signal strength, a speed priority principle is adopted, a throughput priority principle is adopted, and a 5G network is preferentially selected by evaluating the router signal quality and predicting the throughput, so that the transmission throughput is ensured to be as large as possible when the network quality is good; under the condition that the 5G signal intensity is weaker and the difference from the 2.4G signal intensity is not great, the problem of repeated switching between the 5G network and the 2.4G network possibly caused by a single partition threshold strategy is solved by adopting different segmentation and switching threshold strategies when switching from the 2.4G frequency band to the 5G frequency band and from the 5G frequency band to the 2.4G frequency band.
In the step S5, as shown in fig. 3, the step of switching the current operating frequency band to the candidate operating frequency band includes:
s51, acquiring a frequency band switching instruction;
s52, disconnecting the current wifi and sending a disconnection event to a wifi network management module, wherein the disconnection event refers to the connection interruption of the current wifi;
s53, judging whether the wifi network management state of the current working frequency band interface is that through the wifi network management module: connected, IP;
and S54, if yes, starting a timer, wherein the timer is provided with a timeout value, and the wifi network management module does not process the disconnection event in the timeout value, namely, the wifi network management state of the current working frequency band interface is kept as follows: connected, IP;
s55, switching wifi connection to the candidate wifi, and sending a connected event to the wifi network management module and the automatic IP acquisition module, wherein the connected event means that the candidate wifi is successfully connected;
s56, monitoring a wifi network management state of the candidate working frequency band interface through the wifi network management module;
s57, acquiring a wifi network management state of the candidate working frequency band interface when the timer is overtime;
if the wifi network management state of the candidate working frequency band interface is: if the IP is connected, the frequency band switching is successful;
if the wifi network management state of the candidate working frequency band interface is: if the connection is not provided with the IP, after a certain time delay, sending an IP generation request to the automatic acquisition IP module, and re-acquiring the IP;
if the wifi network management state of the candidate working frequency band interface is: and if the wireless communication network is not connected and has no IP, the frequency band switching fails, and the wifi network management module changes the management state of the wifi network into: unconnected, no IP.
In the above steps S51-S57, when the judgment result of the terminal 100 is that the current working frequency band is switched to the candidate working frequency band, the wifi network management module will interrupt the current wifi connection first, and then switch to connect to the candidate wifi, during this period, the wifi will have communication interruption, in order to ensure that the upper layer service can operate as uninterruptedly as possible, this patent provides an IP anti-shake method with pertinence, that is, after the current wifi is disconnected, the wifi network management module sends a disconnection event to the wifi network management module, and the wifi network management module judges whether the wifi network management state of the current working frequency band interface is: if the IP is connected, starting a timer, and if the IP is connected, changing the management state of the wifi network into: unconnected and IP-free, wherein, the timer is provided with a timeout value, preferably for 2 seconds, and the wifi network management module is used for processing the disconnection event temporarily in the timeout value, and the wifi network management state of the current working frequency band interface is kept as follows: if the terminal completes the switching of the frequency band before the timeout of the timer, the disconnection event is ignored, thereby ensuring that the upper layer application does not have perceived network reconnection or switching, the TCP connection is kept continuous, and the function of IP anti-shake is realized; if the terminal does not complete the switching of the frequency band before the timer is overtime, the management state of the wifi network is changed into: and (3) connecting, removing the IP, and reselecting the default route.
Specifically, the frequency band switching performed by the terminal 100 after receiving the frequency band switching instruction may be divided into two phases, see fig. 4:
stage 1 is that wifi connection management module breaks current wifi to send disconnected event to wifi network management module:
step 1: the wifi network management module receives the disconnection event and judges whether the wifi network management state of the current working frequency band interface is: if the IP is connected, turning to the step 2, if not, turning to the step 3;
step 2: starting a timer, and temporarily processing a disconnection event, wherein the timer is provided with a timeout value, preferably 2 seconds, and the wifi network management state of the current working frequency band port within 2 seconds is kept as follows: connected, IP;
step 3: and changing the management state of the wifi network of the terminal into: if the connection is not made and the IP is not available, the IP is cleared, and the default route is reselected;
the stage 2 is that the wifi connection management module connects a wifi network to the candidate wifi and sends a connected event to the wifi network management module, and two conditions exist in the stage 2, wherein one condition is that the wifi is rapidly switched or disconnected in a short time and reconnected to be successful, and the timer is not overtime; another case is that wifi fails to reconnect successfully in a short time. Specific:
step 1: the wifi network management module monitors the wifi network management state of the candidate working frequency band interface;
if the wifi network management state of the candidate working frequency band interface is connected and IP exists, judging whether a timer exists or not; if so, canceling the timer; turning to step 3;
if the wifi network management state of the candidate working frequency band interface is: connected, IP-free, go to step 4;
if the wifi network management state of the candidate working frequency band interface is: if the terminal is not connected and has no IP, changing the management state of the wifi network of the terminal into: unconnected and IP-free, and clear IP, reselect default route;
step 2: acquiring a wifi network management state of a candidate working frequency band interface when a timer is overtime;
if the wifi network management state of the candidate working frequency band interface is: if the IP is connected, the frequency band switching is successful; turning to step 8;
if the wifi network management state of the candidate working frequency band interface is: if the connection is made and the IP is not available, the IP generation request is sent to the automatic acquisition IP module after a certain time delay, and the IP is acquired again; turning to step 7;
step 3: sending an IP generation request to an automatic IP acquisition module, renewing the IP, and if a new IP is acquired, turning to step 5;
step 4: sending an IP generation request to an automatic IP acquisition module, and re-acquiring the IP; if the IP is acquired, setting the IP and updating a default route, and changing the wifi network management state of the candidate working frequency band into: connected, IP; turning to step 2;
step 5: judging whether the new IP is the same as the IP which is currently set, if so, not updating the IP; if not, turning to the step 6;
step 6: resetting the IP and updating the default route;
step 7: setting IP and updating default route; turning to step 8;
step 8: updating the wifi network management state of the terminal as follows: connected, IP;
in summary, in the present disclosure, during the period of switching between the terminal 100 and the router 200 or reconnection after reconnection for short time, an IP anti-jitter management policy is added, sending the disconnection event is delayed, the IP is not cleared, the default route is not updated, if reconnection for short time is successful, the disconnection event is ignored, and immediately sending an IP renewal message to check whether the IP changes or not after reconnection; if the IP follow-up is unchanged after the switching, the IP is not required to be reset, so that the upper layer application is ensured to have no perceived network reconnection or switching, and the TCP connection is kept continuous; if the IP changes, the IP is updated immediately, so that the communication can be restored immediately.
Fig. 4 is a block diagram illustrating a band switching apparatus that may be used in the terminal 100 of the implementation environment shown in fig. 1 to perform the method shown in fig. 2 according to an exemplary embodiment. As shown in fig. 3, the frequency band switching device includes, but is not limited to: the device comprises a scanning module 601, a measuring module 602, a comparing module 603, a judging module 604 and a switching module 605.
The frequency band acquisition module is used for acquiring a working frequency band corresponding to the current connection between the terminal and the router, wherein the working frequency band is one of a first frequency band and a second frequency band supported by the terminal and the router;
the measuring module is used for measuring a first signal intensity of communication between the terminal and the router through the first frequency band and a second signal intensity of communication between the terminal and the router through the second frequency band;
the comparison module is configured to compare the first signal strength with a preset segmentation threshold according to the working frequency band, determine a threshold interval to which the first signal strength belongs, where the preset segmentation threshold includes a first segmentation threshold and a second segmentation threshold, the first segmentation threshold includes a first strong region, a first middle region and a first weak region, and the second segmentation threshold includes a second strong region, a second middle region and a second weak region, and if the working frequency band is the first frequency band, compare the first signal strength with the first segmentation threshold; if the working frequency band is a second frequency band, comparing the first signal strength with a second segmentation threshold;
the judging module is configured to judge whether the first signal strength and the second signal strength meet a frequency band switching condition according to a threshold interval to which the first signal strength belongs;
the switching module is arranged to switch the operating frequency band to another frequency band different from the operating frequency band.
To sum up, in the frequency band switching device according to the embodiment of the present disclosure, by acquiring the working frequency band corresponding to the current connection between the terminal and the router, measuring the 5G signal strength of the communication between the terminal and the router through the 5G frequency band and the 2.4G signal strength of the communication between the terminal and the router through the 2.4G frequency band, and then determining whether to perform frequency band switching according to the working frequency band corresponding to the current connection, the 5G signal strength and the 2.4G signal strength
Under the condition that the 5G router signal is weak, a principle of stable networking priority is adopted, and a 2.4G network is preferentially used, so that the equipment can be ensured to be online for a long time to the greatest extent for embedded equipment such as a network camera or an IOT.
Under the condition that the 5G router signal is strong, a speed priority principle is adopted, a throughput priority principle is adopted, and the 5G network is preferentially selected by evaluating the router signal quality and predicting the throughput. The transmission throughput is ensured to be as large as possible when the network quality is good.
Under the condition that the 5G router signal is weak and has little difference with the 2.4G signal, the problem of repeated switching between the 5G network and the 2.4G network possibly caused by a single partition threshold strategy is solved by adopting different segmentation and switching threshold strategies when switching the 5G network from the 2.4G network and the 2.4G network from the 5G network.
During switching between routers or reconnection after short-time reconnection, an IP anti-jitter management strategy is added, disconnection events are delayed to be sent, the IP is not cleared, a default route is not updated, if the short-time reconnection is successful, the disconnection events are ignored, and an IP renewal message is sent immediately after reconnection to check whether the IP changes; if the IP follow-up is unchanged after the switching, the IP is not required to be reset, so that the upper layer application is ensured to have no perceived network reconnection or switching, and the TCP connection is kept continuous; if the IP changes, the IP is updated immediately, so that the communication can be restored immediately.
It is to be understood that the invention is not limited to the precise arrangements and instrumentalities shown in the drawings, which have been described above, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the invention is limited only by the appended claims.

Claims (10)

1. A frequency band switching method comprises the following steps:
periodically scanning wifi, and acquiring current wifi and candidate wifi, wherein the current wifi corresponds to a current working frequency band, the candidate wifi corresponds to a candidate working frequency band, and the current working frequency band and the candidate working frequency band are respectively one of a first frequency band and a second frequency band supported by a terminal and a router;
measuring a first signal strength of communication between the terminal and the router through the first frequency band and a second signal strength of communication through the second frequency band;
comparing the first signal strength with a preset segmentation threshold according to the current working frequency band, determining a threshold interval to which the first signal strength belongs, wherein the preset segmentation threshold comprises a first segmentation threshold and a second segmentation threshold, the first segmentation threshold comprises a first strong area, a first middle area and a first weak area, the second segmentation threshold comprises a second strong area, a second middle area and a second weak area, and if the current working frequency band is the first frequency band, comparing the first signal strength with the first segmentation threshold; if the current working frequency band is a second frequency band, comparing the first signal strength with the second segmentation threshold value;
monitoring whether the first signal intensity and the second signal intensity meet the frequency band switching condition of the threshold interval or not;
if yes, the current working frequency band is switched to a candidate working frequency band;
if not, maintaining the current working frequency band.
2. The method of band switching according to claim 1, wherein if the current operating band is a first band, the step of comparing the first signal strength with the first segmentation threshold comprises:
comparing the first signal strength with a first boundary value, wherein the first boundary value comprises a boundary value h and a boundary value l, the boundary value h is a boundary value of the first strong zone and the first middle zone, and the boundary value l is a boundary value of the first middle zone and the first weak zone;
if the first signal intensity is greater than the boundary value h, the first signal intensity belongs to the first strong zone;
if the first signal strength is smaller than the boundary value l, the first signal strength belongs to the first weak area;
and if the first signal strength is greater than or equal to the boundary value l and less than or equal to the boundary value h, the first signal strength belongs to the first middle zone.
3. The method of band switching according to claim 1, wherein if the current operating band is a second band, the step of comparing the first signal strength with the second segment threshold comprises:
comparing the first signal strength with a second boundary value, wherein the second boundary value comprises a boundary value H and a boundary value L, the boundary value H is the boundary value of the second strong zone and the second middle zone, and the boundary value L is the boundary value of the second middle zone and the second weak zone;
if the first signal intensity is greater than the boundary value H, the first signal intensity belongs to the second strong area;
if the first signal strength is smaller than a boundary value L, the first signal strength belongs to the second weak area;
and if the first signal strength is smaller than or equal to the boundary value H and larger than or equal to the boundary value L, the first signal strength belongs to the second middle zone.
4. The band switching method according to claim 1, wherein the band switching condition of the threshold interval includes:
the first signal intensity belongs to the first middle area, and the difference value between the first signal intensity and the second signal intensity is smaller than the first preset value;
the first signal intensity belongs to the first weak area, and the difference value between the first signal intensity and the second signal intensity is smaller than zero;
the first signal strength belongs to a second strong area;
the first signal intensity belongs to a second middle area, and the difference value between the first signal intensity and the second signal intensity is larger than a second preset value;
the first signal intensity belongs to a second weak area, and the difference value between the first signal intensity and the second signal intensity is larger than a third preset value.
5. The band switching method according to claim 1, wherein the step of switching the current operating band to the candidate operating band comprises:
acquiring a frequency band switching instruction;
disconnecting the current wifi and sending a disconnection event to a wifi network management module, wherein the disconnection event refers to the connection interruption of the current wifi;
judging whether the network management state of the current working frequency band interface is as follows by the wifi network management module: connected, IP;
if yes, a timer is started, the timer is provided with a timeout value, and the wifi network management module does not process the disconnection event in the timeout value, namely, the network management state of the current working frequency band interface is kept as follows: connected, IP;
switching wifi connection to the candidate wifi, sending a connected event to the wifi network management module and automatically acquiring an IP module, wherein the connected event means that the candidate wifi is successfully connected;
monitoring the network management state of the candidate working frequency band interface through the wifi network management module;
if the network management state of the candidate working frequency band interface is: if the IP is connected, judging whether the timer exists or not;
if so, canceling the timer;
sending an IP generation request to the automatic IP acquisition module, and renewing a new IP;
judging whether the new IP is consistent with the current IP;
if the IP is consistent, the IP does not need to be changed;
if not, resetting the IP and resetting the default route.
6. The method for switching frequency bands according to claim 5, wherein the step of detecting the network management state of the candidate operating frequency band interface by the wifi network management module further comprises:
if the network management state of the candidate working frequency band interface is: if the connection is no IP, an IP generation request is sent to the automatic IP acquisition module;
if the IP is acquired, setting the IP and updating a default route, and changing the network management state of the candidate working frequency band interface into: connected, IP;
acquiring the network management state of the candidate working frequency band interface when the timer is overtime;
if the network management state of the candidate working frequency band interface is: if the IP is connected, the frequency band switching is successful;
if the network management state of the candidate working frequency band interface is: and if the connection is not provided with the IP, after a certain time delay, sending an IP generation request to the automatic acquisition IP module, and re-acquiring the IP.
7. The method for switching frequency bands according to claim 5, wherein the step of monitoring the network management state of the candidate operating frequency band interface by the wifi network management module further comprises:
if the network management state of the candidate working frequency band interface is: and if no connection exists and no IP exists, changing the network management state of the terminal into: connectionless, IP-free, and clear IP, reselect default routes.
8. The method for switching frequency bands according to claim 6, wherein when a timer expires, if the network management state of the candidate operating frequency band interface is: after the step of re-acquiring the IP, the step of delaying for a certain time and then sending an IP generation request to the automatic IP acquisition module comprises the following steps:
if the IP is acquired, setting the IP and setting a default route;
and changing the network management state of the terminal into: connected, IP.
9. A frequency band switching apparatus, comprising:
the scanning module is used for periodically scanning wifi to obtain current wifi and candidate wifi, the current wifi corresponds to a current working frequency band, the candidate wifi corresponds to a candidate working frequency band, and the current working frequency band and the candidate working frequency band are respectively one of a first frequency band and a second frequency band supported by a terminal and a router;
the measuring module is used for measuring the first signal intensity of the communication between the terminal and the router through the first frequency band and the second signal intensity of the communication through the second frequency band;
the comparison module is used for comparing the first signal intensity with a preset segmentation threshold according to the working frequency band, determining a threshold interval to which the first signal intensity belongs, wherein the preset segmentation threshold comprises a first segmentation threshold and a second segmentation threshold, the first segmentation threshold comprises a first strong area, a first middle area and a first weak area, the second segmentation threshold comprises a second strong area, a second middle area and a second weak area, and if the working frequency band is the first frequency band, the first signal intensity is compared with the first segmentation threshold; if the working frequency band is a second frequency band, comparing the first signal strength with a second segmentation threshold;
the judging module is used for judging whether the first signal intensity and the second signal intensity accord with the frequency band switching condition or not according to the threshold value interval to which the first signal intensity belongs;
and the switching module is used for switching the working frequency band to another frequency band different from the working frequency band.
10. A computer readable storage medium, characterized in that the computer readable storage medium comprises a computer program which, when run on an electronic device, causes the electronic device to perform the method according to any of claims 1-8.
CN202310505264.1A 2023-05-06 2023-05-06 Frequency band switching method, device and computer readable storage medium Pending CN116437410A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310505264.1A CN116437410A (en) 2023-05-06 2023-05-06 Frequency band switching method, device and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310505264.1A CN116437410A (en) 2023-05-06 2023-05-06 Frequency band switching method, device and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN116437410A true CN116437410A (en) 2023-07-14

Family

ID=87094486

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310505264.1A Pending CN116437410A (en) 2023-05-06 2023-05-06 Frequency band switching method, device and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN116437410A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117580114A (en) * 2024-01-12 2024-02-20 北京小米移动软件有限公司 Connection control method, device, equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117580114A (en) * 2024-01-12 2024-02-20 北京小米移动软件有限公司 Connection control method, device, equipment and storage medium
CN117580114B (en) * 2024-01-12 2024-04-16 北京小米移动软件有限公司 Connection control method, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
RU2366107C2 (en) Communication controller and method to hold on line in re-selecting cellular cell
EP0325713B1 (en) Cellular radiotelephone system with dropped call protection
CN107046693B (en) Wireless router and method for switching frequency bands for access terminal
CN107071840B (en) Netsurfing switching method and device
CN100553213C (en) A kind of method and apparatus of WLAN abnormal quick restoring
US8041345B2 (en) Method and apparatus for determining reconnection time point for packet service
EP1744580A1 (en) Dual-mode mobile terminal and method for handover of packet service call between different communication networks
EP2187698A1 (en) Mobile communication system, general base station device, base station device, and base station status control method
EP1465451A2 (en) communication terminal, base station, server, network system, and handover method
JP4929192B2 (en) Wireless communication system and soft handoff control method in wireless communication system
EP1977623A1 (en) Methods, devices and systems relating to reselecting cells in a cellular wireless communications system
CN116437410A (en) Frequency band switching method, device and computer readable storage medium
CN110602704A (en) Non-sensing roaming system and method
KR20070078330A (en) Handover method for minimizing delay time according to reconnecting of packet call between two mobile communication modes and the multi-mode terminal therefor
CN109379766A (en) A kind of method and device switching WiFi network
WO2011032469A1 (en) Method for transitioning of state machines after radio access network is reselected and terminal
KR100580078B1 (en) Soft Handoff System and Mobile Phone installed it and Soft Handoff Method
CN112839310A (en) Wireless communication method and Mesh device
JP2004193852A (en) Wireless communication terminal and hand-off discrimination method
CN113055963B (en) Information processing method and service equipment of communication network
CN114339789A (en) AP distribution network processing method and device
CN112235780A (en) Data service switching method, equipment, device and storage medium
JP3405928B2 (en) Handover method
WO2006107884A2 (en) Method and apparatus for determining a level of involvement of mesh points in a wireless communication system
US11363661B2 (en) Methods and arrangements for assisting recovery of call setup failure in a wireless communication system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination