Network switching method and electronic device

By analyzing the causes of network service anomalies and switching networks when necessary, the problem of electronic devices frequently switching networks when poor network service quality is detected has been solved, thus improving network service quality and transmission efficiency and reducing unnecessary network switching and data traffic waste.

CN120769316BActive Publication Date: 2026-06-09HONOR DEVICE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HONOR DEVICE CO LTD
Filing Date
2024-03-30
Publication Date
2026-06-09

Smart Images

  • Figure CN120769316B_ABST
    Figure CN120769316B_ABST
Patent Text Reader

Abstract

The application provides a network switching method and an electronic device, relates to the technical field of communication, and is used for avoiding the case that network is frequently switched but the freezing problem cannot be solved. The method is applied to the electronic device and comprises the following steps: in the process that the electronic device provides network service to a user based on a first network, the electronic device acquires data transmission parameters; in the case that the data transmission parameters represent that the network service is abnormally running, the electronic device acquires network parameters of the first network; and in the case that the network parameters of the first network represent that the first network is abnormal, the current access network of the electronic device is switched from the first network to a second network.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of communication technology, and in particular to a network switching method and electronic device. Background Technology

[0002] In related technologies, when electronic devices transmit data over a network, they typically monitor the quality of service (QoS) of the network to ensure a good user experience. If poor QoS is detected in the currently accessed network, the device can switch to another network to provide a higher-quality service to the user.

[0003] For example, when an electronic device is using Wi-Fi (wireless fidelity) to provide network service, if it detects a data transmission lag, it can switch the current network from Wi-Fi to cellular. However, many factors can cause data transmission lag, and the lag may persist even after switching networks. This can easily lead to a situation where frequent network switching fails to resolve the lag issue. Summary of the Invention

[0004] This application provides a network switching method and electronic device to avoid situations where frequent network switching fails to resolve lag issues.

[0005] To achieve the above objectives, the embodiments of this application adopt the following technical solutions:

[0006] Firstly, a network switching method is provided, which is applied to electronic devices and includes:

[0007] During the process of an electronic device providing network services to a user based on a first network, data transmission parameters are acquired. If the data transmission parameters indicate an abnormality in the network service operation, the electronic device can analyze the cause of the abnormality. Specifically, the electronic device acquires the network parameters of the first network and then analyzes whether the first network is abnormal, thereby determining whether the current network service abnormality is caused by network issues. If the network parameters of the first network indicate an abnormality, the electronic device switches its current access network from the first network to a second network. In other words, switching the current access network is only performed when a network service abnormality is detected and the currently accessed first network is also abnormal. This ensures that the quality of network service will be improved after switching networks, thus avoiding situations where multiple network switches fail to improve the network service abnormality.

[0008] In one possible implementation of the first aspect, the data transmission parameters include at least one of the following: uplink rate, downlink rate, TCP round-trip time, number of TCP retransmission packets, number of sync packet retransmission packets, frame length, frame rate, and frame per second (FPS).

[0009] In one possible implementation of the first aspect, the aforementioned data transmission parameters characterize network service malfunctions, including: when at least one data transmission parameter fails to meet the corresponding quality of service condition, the network service malfunctions.

[0010] In one possible implementation of the first aspect, the aforementioned data transmission parameters characterize network service malfunctions and may specifically include at least one of the following: uplink rate is less than the uplink rate threshold, downlink rate is less than the downlink rate threshold, TCP round-trip time is greater than or equal to the round-trip time threshold, TCP retransmission packet count is greater than or equal to the TCP retransmission packet count threshold, sync packet retransmission packet count is greater than or equal to the sync packet retransmission packet count, frame length is greater than or equal to the frame length threshold, frame rate is less than the frame rate threshold, and FPS is less than the FPS threshold.

[0011] In one possible implementation of the first aspect, the network parameters of the first network characterize the anomalies of the first network, including at least one of the following:

[0012] The first item is that the network parameters of the first network include the signal strength of the first network; the signal strength is less than the signal strength threshold.

[0013] The second item is that the first network is Wi-Fi, and the network parameters of the first network include: the number of uplink packets and the uplink negotiation rate of the first network; when the number of uplink packets is greater than or equal to the uplink packet number threshold, the uplink negotiation rate is less than the uplink negotiation rate threshold.

[0014] The third item is that the first network is Wi-Fi, and the network parameters of the first network include: the number of downlink packets and the downlink negotiation rate of the first network; when the number of downlink packets is greater than or equal to the downlink packet number threshold, the downlink negotiation rate is less than the downlink negotiation rate threshold.

[0015] The fourth item is that the first network is Wi-Fi, and the network parameters of the first network include: the status information of the router corresponding to the first network; the router status information indicates that the router is abnormal.

[0016] In one possible implementation of the first aspect, the method includes the status information of the router corresponding to the first network; the method may further include: an electronic device sending a status acquisition request to the router corresponding to the first network. Subsequently, the electronic device can receive the router's status information returned by the router based on the status acquisition request. This router status information can indicate whether the router is malfunctioning.

[0017] In one possible implementation of the first aspect, the network parameters of the first network include: uplink negotiation rate and uplink packet count; the method further includes: when the uplink packet count is less than an uplink packet count threshold, the electronic device transmits a preset data packet to the router corresponding to the first network until the uplink packet count is greater than or equal to the uplink packet count threshold; the preset data packet is used to increase the uplink packet count. When the uplink packet count is low, the accuracy of the uplink negotiation rate is low. Therefore, if the uplink negotiation packet count is low, the electronic device and the router work together to send a preset data packet to the router to increase the uplink packet count, thus increasing the accuracy of the uplink negotiation rate. When the uplink packet count is greater than or equal to the uplink packet count threshold, the accuracy of the first network's anomaly is determined based on the uplink negotiation rate, which improves the accuracy of the analysis results regarding whether the first network is abnormal.

[0018] In one possible implementation of the first aspect, the network parameters of the first network include: downlink negotiation rate and downlink packet count; the method further includes: when the downlink packet count is less than a downlink packet count threshold, the electronic device sends a notification message to the router corresponding to the first network until the downlink packet count is greater than or equal to the downlink packet count threshold; the notification message is used to instruct the router to transmit a preset data packet to the electronic device; the preset data packet is used to increase the downlink packet count. When the downlink packet count is low, the accuracy of the downlink negotiation rate is low. Therefore, if the downlink negotiation packet count is low, the electronic device and the router work together to send a preset data packet to the router to increase the downlink packet count, thus increasing the accuracy of the downlink negotiation rate. When the downlink packet count is greater than or equal to the downlink packet count threshold, the downlink negotiation rate is then used to determine whether the first network is abnormal, thus improving the accuracy of the analysis results regarding whether the first network is abnormal.

[0019] In one possible implementation of the first aspect, the network parameters of the first network include: uplink negotiation rate and uplink packet count, downlink negotiation rate and downlink packet count. The method further includes: when the uplink packet count is less than an uplink packet count threshold, the electronic device transmits a preset data packet to the router corresponding to the first network until the uplink packet count is greater than or equal to the uplink packet count threshold. When the downlink packet count is less than the downlink packet count threshold, the electronic device sends a notification message to the router corresponding to the first network until the downlink packet count is greater than or equal to the downlink packet count threshold. This can improve the accuracy of the analysis results regarding whether the first network is abnormal.

[0020] In one possible implementation of the first aspect, the content of the preset data packet is empty; or the preset data packet's IP header carries a preset identifier used to distinguish the preset data packet from regular data packets; or the receiving address corresponding to the preset data packet sent by the electronic device to the router is the router's address. In this way, the preset data packet will not affect the application's data transmission.

[0021] In one possible implementation of the first aspect, after the router receives a preset data packet sent by the electronic device, it parses the preset data packet at the data link layer and then discards it. In this way, the preset data packet is not transmitted to the transport layer and therefore does not affect application data transmission. Similarly, after the electronic device receives the preset data packet sent by the router, the phone's data link layer parses the preset data packet and can then discard it at the data link layer.

[0022] In one possible implementation of the first aspect, the network parameters of the first network include: a first network parameter and a second network parameter; the first network parameter has a higher priority than the second network parameter. In this scheme, the aforementioned network parameters of the first network characterize anomalies of the first network, including:

[0023] Following a priority order from highest to lowest, the first step is to check whether the first network parameter meets the corresponding first threshold requirement. If the first network parameter does not meet the first threshold requirement, the first network can be directly identified as abnormal, without needing to check other network parameters. This improves detection efficiency. If the first network parameter meets the first threshold requirement, then the second network parameter is checked to see if it meets the corresponding second threshold requirement. If the second network parameter does not meet the second threshold requirement, the first network can also be identified as abnormal. Generally, higher priority network parameters are easier to obtain; therefore, analyzing the first network for abnormality based on different network parameters in order of priority improves detection efficiency.

[0024] In one possible implementation of the first aspect, the first network parameter has a higher priority than the second network parameter; the first network parameter includes the signal strength of the first network; the second network parameter includes: negotiation rate and number of transmission packets, and / or, the status information of the router corresponding to the first network.

[0025] In one possible implementation of the first aspect, taking the signal strength of the first network as the first network parameter and the negotiation rate and packet count as the second network parameters, when analyzing whether the first network is abnormal based on the network parameters, the electronic device can first determine whether the signal strength is less than a signal strength threshold. If so, the first network can be directly determined to be abnormal without further checking the negotiation rate and packet count. If the signal strength is greater than or equal to the signal strength threshold, the electronic device then checks the negotiation rate and packet count. Specifically, if the packet count is greater than or equal to the packet count threshold and the negotiation rate is less than the negotiation rate threshold, it indicates that the network parameters of the first network indicate an abnormality. If the packet count is greater than or equal to the packet count threshold and the negotiation rate is greater than or equal to the negotiation rate threshold, it indicates that the network parameters of the first network indicate that the first network is normal.

[0026] In cases where the number of transmitted packets is less than the threshold, the number of transmitted packets can be increased through collaborative processing between the electronic device and the router corresponding to the first network. Then, the negotiated rate can be used to analyze whether the first network is abnormal. For specific implementation details, please refer to the description in the previous implementation section.

[0027] In one possible implementation of the first aspect, taking the signal strength of the first network as the first network parameter and the router's status information as the second network parameter, when analyzing whether the first network is abnormal based on the network parameters, the electronic device can first determine whether the signal strength is less than a signal strength threshold. If so, the first network can be directly determined to be abnormal without further checking the router's status information. If the signal strength is greater than or equal to the signal strength threshold, the electronic device then checks the router's status information. Specifically, if the router's status information indicates that the router is abnormal, it means that the network parameters of the first network indicate that the first network is abnormal. If the router's status information indicates that the router is normal, it means that the network parameters of the first network indicate that the first network is normal.

[0028] In one possible implementation of the first aspect, the method further includes: maintaining the currently accessed network as the first network when the network parameters of the first network indicate that the first network is functioning normally. This avoids situations where network services remain abnormal after a network switch, thereby reducing the number of network switches.

[0029] In one possible implementation of the first aspect, the method further includes: when the network parameters of the first network indicate that the first network is normal, calculating the duration of abnormal network service operation; and when the duration exceeds a preset time, switching the currently accessed network from the first network to the second network. This avoids situations where the network service remains abnormal after switching networks, thereby reducing the number of network switching operations.

[0030] In one possible implementation of the first aspect, before switching the current access network of the electronic device from the first network to the second network, the method may further include: detecting whether the electronic device has an alternative network that meets preset conditions. Specifically, if the existence of an alternative network that meets the preset conditions is detected, the electronic device may determine the second network from the alternative networks; if multiple alternative networks are included, the most suitable one may be selected as the second network. Then, the current access network is switched from the first network to the second network.

[0031] In one possible implementation of the first aspect, the preset condition can be specifically set to a network signal strength greater than a signal strength threshold. This ensures the signal strength of the second network, thereby guaranteeing the quality of network service provided by the electronic device after network switching. Alternatively, the preset condition can also be set to determine the cellular network to which the device is allowed to switch in the event of Wi-Fi anomalies based on user settings.

[0032] In one possible implementation of the first aspect, the first network may be Wi-Fi 1; the second network may be any other Wi-Fi network besides Wi-Fi 1, or it may be a cellular network.

[0033] Secondly, this application also provides a network interaction method applicable to a router connected to an electronic device, providing the device with a Wi-Fi network. The method includes: the router receiving a notification message from the electronic device, and in response to the notification message, sending a preset data packet to the electronic device. This preset data packet can be used to increase the downlink packet count of the electronic device. In this scheme, by sending a preset data packet to the electronic device through the router, the downlink packet count of the electronic device can be increased, thereby improving the accuracy of the downlink negotiation rate of the electronic device. This, in turn, can improve the accuracy of analyzing whether the network provided by the router to the electronic device is abnormal, based on the downlink negotiation rate used by the electronic device.

[0034] In one possible implementation of the second aspect, the method further includes: the router receiving a status acquisition request sent by an electronic device, and in response to the status acquisition request, returning router status information to the electronic device. This router status information can be used to characterize the router's status. This allows the electronic device to analyze whether the network provided by the router to it is abnormal based on the status information.

[0035] Thirdly, this application also provides an electronic device. The electronic device may include a processor and a memory. The memory stores computer-executed instructions, and when the electronic device is running, the processor executes the computer-executed instructions stored in the memory to cause the electronic device to perform the network switching method as described in any of the first aspects above.

[0036] Fourthly, this application provides a computer-readable storage medium storing instructions that, when executed on a computer, enable the computer to perform the network switching method described in any of the first aspects above.

[0037] Fifthly, a computer program product containing instructions is provided, which, when run on an electronic device, enables the electronic device to execute any of the network switching methods described in the first aspect above.

[0038] In a sixth aspect, an apparatus (e.g., a system-on-a-chip) is provided, comprising a processor for supporting an electronic device in performing the functions described in the first aspect above. In one possible design, the apparatus further comprises a memory for storing program instructions and data necessary for the electronic device. When the apparatus is a system-on-a-chip, it may be composed of chips or may include chips and other discrete devices.

[0039] The technical effects of any of the design methods in aspects two through six can be found in the technical effects of different design methods in aspect one, and will not be repeated here. Attached Figure Description

[0040] Figure 1 A schematic diagram of the architecture of a TCP / IP transport protocol reference model provided for embodiments of this application;

[0041] Figure 2 This is a flowchart illustrating a network handover method in a related technology.

[0042] Figure 3 An architecture diagram of a communication system provided in an embodiment of this application;

[0043] Figure 4 A flowchart illustrating a network switching method provided in an embodiment of this application;

[0044] Figure 5 A flowchart illustrating a network switching method provided in an embodiment of this application;

[0045] Figure 6 A schematic diagram of a data packet transmission process provided in an embodiment of this application;

[0046] Figure 7 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application;

[0047] Figure 8 A software framework diagram of an electronic device provided in an embodiment of this application;

[0048] Figure 9This is a schematic diagram of a chip system provided in an embodiment of this application. Detailed Implementation

[0049] The following provides a detailed description of the technical terms that may be involved in the embodiments of this application.

[0050] Uplink rate refers to the data transmission rate at which electronic devices send information to a base station, such as the rate at which mobile phones, laptops, and other electronic devices send data to a base station. Downlink rate refers to the data transmission rate at which a base station sends information to an electronic device, such as the rate at which mobile phones, laptops, and other electronic devices download data from a base station or network.

[0051] Transmission Control Protocol (TCP) is a connection-oriented transport layer communication protocol. Interconnected electronic devices rely on TCP to provide reliable communication services.

[0052] TCP round trip time (RTT) is the time elapsed from when the sender starts sending data to when the sender receives an acknowledgment message from the receiver. Generally, the shorter the RTT, the faster the network transmission speed, and vice versa.

[0053] TCP addresses packet loss using a retransmission mechanism. One key retransmission mechanism is timeout retransmission. When sending data, a timer is set; if an acknowledgment message is received after the specified duration of the timer, the data is retransmitted. During network transmission, the number of TCP retransmitted packets (TCP retransmission count) and / or the TCP retransmission rate can be tracked. Generally, a higher TCP retransmission count or rate indicates a lower quality of service.

[0054] Synchronization (sync) packets are a type of data packet in TCP connections. If no acknowledgment is received from the other party after a timeout period following the initial data transmission during connection establishment, a sync packet will be retransmitted. During network transmission, the number of retransmitted sync packets (referred to as the sync packet retransmission count) and / or the sync packet retransmission rate can be statistically analyzed. Generally, a higher number of sync packet retransmissions or a higher sync packet retransmission rate indicates a lower quality of network service.

[0055] Negotiation rate refers to the theoretically fastest sending and receiving rate supported by routers and electronic devices in the current network environment. Negotiation rate includes uplink negotiation rate and downlink negotiation rate. The uplink negotiation rate is the fastest sending rate; the downlink negotiation rate is the fastest receiving rate. Typically, Wi-Fi networks have lower uplink or downlink negotiation rates, resulting in slower data transmission speeds for electronic devices using Wi-Fi and poorer quality of service.

[0056] Signal strength is an important metric for measuring network performance. Signal strength is usually expressed as a negative number in dBm. A higher value indicates a stronger signal, while a lower value indicates a weaker signal.

[0057] Frame length refers to the length of a data frame. Generally, a frame length greater than or equal to a certain threshold indicates poor network service quality. Frame rate is the frequency (rate) at which bitmap images, measured in frames, appear continuously on a display. Generally, a frame rate less than a certain threshold indicates poor network service quality. Frames per second (FPS) refers to the number of frames in an animation or video. Generally, an FPS less than a certain threshold indicates poor network service quality.

[0058] TCP / IP (Internet Protocol) is a suite of protocols that enables information transmission between multiple different networks. The TCP / IP transport protocol defines the standards and methods for communication between different parts of the Internet. Figure 1 This illustrates the architecture of the TCP / IP transport protocol reference model. The TCP / IP transport protocol can include the application layer, transport layer, network layer, data link layer, and physical layer. Figure 1 The arrow indicates the process of electronic device 1 sending a data packet to electronic device 2.

[0059] Once smartphones and other electronic devices connect to the network, they can provide users with various network services, such as social chat, video calls, web browsing, and online video services. During this process, poor network service quality—such as slow message sending and receiving, choppy video calls or playback, or slow webpage loading—will negatively impact the user's online experience. To ensure network service quality, electronic devices monitor the quality of service (QoS) of the network they are connecting to. When abnormal QoS is detected, they can switch networks or reconnect to a new one to improve service quality.

[0060] It should be noted that the network services provided to users by the aforementioned electronic devices based on the network specifically refer to the business process that achieves a certain function based on the network and other related factors such as wireless access points (APs).

[0061] In general, abnormal network service quality can be caused by identifiable network link problems (weak signal, interference, low negotiation rate, router failure under Wi-Fi network), as well as the following: application server problems, other background applications on electronic devices competing for network speed, performance problems of electronic devices, and unknown network fluctuations (such as changes in the location of electronic devices, problems with the operator's network).

[0062] For example, such as Figure 2 As shown, when mobile devices such as smartphones are providing network services via Wi-Fi, if they detect abnormal network service quality issues such as slow message sending and receiving, stuttering video calls or playback, or slow webpage loading, they can switch from the Wi-Fi network to another Wi-Fi or cellular network. However, as explained earlier, many factors can affect network service quality. If the cause of the abnormal service quality is not a network link problem, simply switching networks when abnormal service quality occurs may not improve the situation. For example, after switching from Wi-Fi to cellular, the abnormal service quality may still be detected. In this case, the phone may switch networks again. This can lead to frequent network switching without resolving the abnormal service quality issue. Furthermore, switching from Wi-Fi to cellular when the network service quality is abnormal may also result in wasted data usage.

[0063] Based on this, this application proposes a network switching method applied to scenarios where an electronic device detects an abnormality in the quality of service (QoS) of a network service. Specifically, when the electronic device is connected to a first network, it can monitor the QoS of the network service provided by the first network. When an QoS abnormality is detected, it will determine whether the QoS abnormality is caused by an anomaly in the first network. If it is determined that the first network is anomaly, it indicates that the QoS abnormality of the network service may be caused by an anomaly in the first network, and at this time, the electronic device switches the currently accessed network from the first network to a second network.

[0064] In some embodiments, an abnormal quality of service of the network service provided by the electronic device can also be recorded as an abnormal operation of the network service provided by the electronic device.

[0065] For example, the electronic device can be a mobile phone (such as...) Figure 2The devices described herein include tablets, personal computers (PCs), smart screens, desktop computers, laptops, handheld computers, notebook computers, ultra-mobile personal computers (UMPCs), netbooks, smartwatches and other wearable devices, artificial intelligence (AI) speakers, and in-vehicle devices. They can also be various teaching aids (such as learning machines and early education machines), smart toys, portable robots, personal digital assistants (PDAs), augmented reality (AR) / virtual reality (VR) devices, media players, and other devices. Furthermore, they can be devices with mobile office capabilities, smart home capabilities, audio-visual entertainment capabilities, and devices supporting smart travel. This application does not impose any special limitations on the specific form of the device.

[0066] In embodiments of this application, the first network may be a Wi-Fi network. The second network may be a Wi-Fi network or a cellular network. The first network and the second network are two different networks that electronic devices can access.

[0067] Figure 3 An architecture diagram of a communication system is shown. In this example, a mobile phone provides network services to users via a Wi-Fi network. The mobile phone establishes a connection with the router corresponding to the Wi-Fi network and forwards data through the router. Specifically, the mobile phone sends data to other devices (uplink data) through the router, and receives data from other devices (downlink data) through the router.

[0068] The network switching method proposed in the embodiments of this application will be described in detail below with reference to the accompanying drawings.

[0069] Figure 4 Flowcharts of network switching methods in some embodiments are shown. In this embodiment, the method is applied to a mobile phone as an example. The mobile phone is connected to a first network, and can provide network services to the user based on the first network.

[0070] S301. Start Application 1.

[0071] Application 1 is an application that can provide network services. For example, Application 1 can be a browser, social chat application, online game, map, navigation, and video application.

[0072] The phone can respond to user actions and launch application 1.

[0073] S302. Obtain the data transmission parameters of application 1.

[0074] While application 1 is running in the foreground, it can use the network to transmit data. Data transmission parameters can be used to characterize the features of application 1 when using the network to transmit data. In some embodiments, data transmission parameters may include at least one of the following: uplink rate, downlink rate, TCP round-trip time, number of TCP retransmission packets, and number of sync packet retransmission packets. In other embodiments, where application 1 provides network services such as video calls, video playback, or games, data transmission parameters may also include any one of frame length, frame rate, or FPS.

[0075] In some embodiments, the mobile phone can obtain the aforementioned data transmission parameters from the kernel layer.

[0076] S303. Determine whether the quality of service of the network service is abnormal based on the data transmission parameters.

[0077] The Quality of Service (QoS) of a network service is used to evaluate the quality of the network service provided by a mobile phone. A higher QoS indicates a better network service. Generally, when the QoS is above a certain threshold, the QoS is considered normal (or the network service is operating normally); when the QoS is below a certain threshold, the QoS is considered abnormal (or the network service is operating abnormally).

[0078] For example, the quality of service (QoS) of a network service may include the download speed of videos, applications, or offline maps; the faster the download speed, the higher the QoS of the corresponding network service. Similarly, the QoS of a network service may include the smoothness of video playback or the smoothness of game graphics; the higher the smoothness of video playback or game graphics, the higher the QoS of the corresponding network service. Furthermore, the QoS of a network service may include webpage loading speed; the faster the webpage loads, the higher the QoS of the corresponding network service. It is understood that the specific manifestations of QoS of network services described above are merely examples; in other embodiments, the QoS of a network service may also include other parameters.

[0079] In some embodiments, S303 may specifically include: determining whether the data transmission parameters do not meet the quality of service (QoS) conditions. The QoS conditions can represent the minimum requirements for normal network service quality. Specifically, if the data transmission parameters do not meet the QoS conditions, it indicates that the network service quality is abnormal; conversely, if the data transmission parameters meet the QoS conditions, it indicates that the network service quality is normal.

[0080] In embodiments where data transmission parameters include multiple parameters, a failure of any one of the data transmission parameters to meet the corresponding quality of service (QoS) condition indicates an abnormal quality of service (QoS) for the network service. For example, the data transmission parameters include: uplink rate, downlink rate, TCP round-trip time (RTT), TCP retransmission count, and sync packet retransmission count. For each data transmission parameter, a corresponding QoS condition is set. A network service QoS is determined to be abnormal if any of the following conditions are met: uplink rate does not meet the corresponding QoS condition, downlink rate does not meet the corresponding QoS condition, TCP RTT does not meet the corresponding QoS condition, TCP retransmission count does not meet the corresponding QoS condition, and sync packet retransmission count does not meet the corresponding QoS condition.

[0081] As explained above, uplink and downlink rates represent the data transmission rates when a mobile phone sends information to a base station and when a base station sends data to a mobile phone, respectively. Lower uplink and downlink rates indicate poorer network service quality. Therefore, the service quality condition corresponding to the uplink rate can be set to an uplink rate greater than or equal to an uplink rate threshold; similarly, the service quality condition corresponding to the downlink rate can be set to an uplink rate greater than or equal to a downlink rate threshold. When an uplink rate is detected to be less than the uplink rate threshold, it indicates that the uplink rate does not meet the corresponding service quality condition, i.e., the network service quality is abnormal. Similarly, when a downlink rate is detected to be less than the downlink rate threshold, it indicates that the downlink rate does not meet the corresponding service quality condition, i.e., the network service quality is abnormal.

[0082] The shorter the TCP round-trip time (RTT), the faster the network transmission speed and the better the quality of service (QoS) of the network service. In some embodiments, the QoS condition corresponding to the TCP RTT can be set to TCP RTT being less than a TCP RTT threshold. When a TCP RTT is detected to be greater than or equal to the TCP RTT threshold, it indicates that the TCP RTT does not meet the corresponding QoS condition, i.e., the QoS of the network service is abnormal.

[0083] A higher number of TCP retransmissions indicates a lower quality of service (QoS) for the network. In some embodiments, the QoS condition corresponding to the number of TCP retransmissions can be set to the number of TCP retransmissions being less than a TCP retransmission threshold. Alternatively, a QoS condition corresponding to the TCP retransmission rate can be set, specifically, the TCP retransmission rate being less than a TCP retransmission rate threshold. When the number of TCP retransmissions is detected to be greater than or equal to the TCP retransmission threshold, it indicates that the number of TCP retransmissions does not meet the corresponding QoS condition, i.e., the network service QoS is abnormal. Similarly, when the TCP retransmission rate is detected to be greater than or equal to the TCP retransmission rate threshold, it indicates that the TCP retransmission rate does not meet the corresponding QoS condition, i.e., the network service QoS is abnormal.

[0084] A higher number of retransmitted sync packets indicates a lower quality of service (QoS) for the network service. In some embodiments, the QoS condition corresponding to the number of retransmitted sync packets can be set to the number of retransmitted sync packets being less than a threshold. Alternatively, the QoS condition corresponding to the retransmission rate of sync packets can be set, specifically, the retransmission rate of sync packets being less than a threshold. When the number of retransmitted sync packets is detected to be greater than or equal to the threshold, it indicates that the number of retransmitted sync packets does not meet the corresponding QoS condition, i.e., the network service QoS is abnormal. Similarly, when the retransmission rate of sync packets is detected to be greater than or equal to the threshold, it indicates that the retransmission rate does not meet the corresponding QoS condition, i.e., the network service QoS is abnormal.

[0085] Based on the above explanation, the service quality condition corresponding to frame length can be set to frame length less than a frame length threshold. When a frame length greater than or equal to the frame length threshold is detected, it indicates that the frame length does not meet the corresponding service quality condition, i.e., the network service quality is abnormal. The service quality condition corresponding to frame rate can be set to frame rate greater than or equal to a frame rate threshold. When a frame rate less than the frame rate threshold is detected, it indicates that the frame rate does not meet the corresponding service quality condition, thus confirming an abnormal network service quality. The service quality condition corresponding to FPS can be set to FPS greater than or equal to an FPS threshold. When an FPS less than the FPS threshold is detected, it indicates that the FPS does not meet the corresponding service quality condition, thus confirming an abnormal network service quality.

[0086] It should be noted that the various thresholds in the above embodiments (such as uplink rate threshold, downlink rate threshold, TCP round-trip time threshold, TCP retransmission packet count threshold, etc.) can be set according to the actual situation.

[0087] Understandably, if the data transmission parameters determine that the network service quality is not abnormal, it means that the phone's network service quality is normal; Application 1 can use the network to transmit data normally. In other words, if the result of S303 is negative, the phone can continue to acquire data transmission parameters and monitor the network service quality, i.e., return to continue executing S302 and S303.

[0088] Conversely, if the network service quality is determined to be abnormal based on network transmission parameters, it indicates that the current application 1 may be experiencing issues with data transmission over the network, such as slow message sending and receiving, stuttering video calls or playback, or slow webpage loading. As explained above, there are many factors that can cause abnormal network service quality. To avoid situations where switching networks fails to resolve the issue, it's advisable to first analyze whether the abnormality is caused by network issues. If it is determined that the abnormality is due to network problems, switching networks can be attempted to improve the service quality. In other words, if the judgment result of S303 is yes, further analysis can be conducted to determine if the network service quality is caused by an anomaly in the currently accessed network. As explained above, the phone is currently accessing the first network. Therefore, the network parameters of the first network can be obtained, and its network quality can be analyzed, i.e., whether the first network is abnormal.

[0089] S304. Obtain the network parameters of the first network.

[0090] Network parameters can be used to provide feedback on the network itself. The first network is a Wi-Fi network, and its network parameters may include: signal strength, uplink negotiation rate, downlink negotiation rate, uplink negotiation rate and number of uplink packets, downlink negotiation rate and number of downlink packets, and router status information. It is understood that this router is the router corresponding to the first network. In this embodiment, S304 may specifically include: the mobile phone obtaining the router's status information from the router. The network parameters of the first network may be data link layer parameters.

[0091] Router status information indicates whether the router is functioning correctly. In some embodiments, abnormal router operation may include any of the following: router domain name system (DNS) malfunction, router bandwidth limitation, or severe router overheating causing malfunction.

[0092] Furthermore, in some embodiments, the mobile phone obtains the router's status information from the router. Specifically, the mobile phone sends an information retrieval request to the router, and the router responds to the request by returning its current router status information to the mobile phone. In this way, the mobile phone can obtain the router's status information only when it detects abnormal network service quality.

[0093] In other embodiments, the router may also proactively send router status information to the mobile phone at regular intervals. Alternatively, the router may proactively send status information to the mobile phone when the status information is updated. For example, the router can monitor its status and send status information to the mobile phone when it detects an update. For instance, if the router detects a DNS anomaly or bandwidth limitation, it can proactively send status information to the mobile phone. Specifically, the router can proactively send status information to all electronic devices connected to it; alternatively, the router can broadcast its current status information. In this way, the mobile phone can obtain the router's status information in real time while using the Wi-Fi network through the router.

[0094] S305. Analyze whether the first network is abnormal based on the network parameters of the first network.

[0095] If the first network is not experiencing any anomalies, it indicates that the current network service quality anomaly is not caused by the network itself. In this case, even if the mobile phone switches its current access network from the first network to another network, the network service quality problem cannot be improved. Therefore, in this embodiment, if the judgment result of S305 is negative, the mobile phone does not perform the network switching action, but continues to use the first network and waits for the network service quality to recover. Afterwards, the mobile phone can continue to acquire data transmission parameters to analyze the network service quality. It should be noted that the situation where the judgment result of S305 is negative... Figure 4 Not shown in the image.

[0096] In other embodiments, when the determination result of S305 is negative, the service quality of the network service can be continuously monitored. If abnormal network service quality is detected and the duration exceeds a preset time, the currently accessed network is switched from the first network to another network. In some cases, the mobile phone may not be able to detect accurate network quality. If the network service quality is abnormal and persists for a period of time, but the quality detection result for the currently accessed network is that the first network is normal, it may be because the mobile phone has not detected accurate network quality, or the quality detection result of the first network is incorrect. Therefore, in this case, the problem of improving the network service quality can still be attempted by switching the currently accessed network. This avoids the problem of prolonged abnormal network service quality.

[0097] The following section explains the specific implementation method for analyzing the network quality of the first network based on network parameters.

[0098] When network parameters include signal strength, the aforementioned S305 may specifically include: detecting whether the signal strength is less than a signal strength threshold. Specifically, the higher the signal strength, the better the network quality. Therefore, if the signal strength is greater than or equal to the signal strength threshold, the first network can be determined to be normal. Conversely, if the signal strength is less than the signal strength threshold, the first network can be determined to be abnormal.

[0099] When network parameters include uplink packet count and uplink negotiation rate, the aforementioned S305 can specifically include: if the uplink packet count is greater than or equal to an uplink packet count threshold, the uplink negotiation rate is less than an uplink negotiation rate threshold. If the uplink packet count is greater than or equal to the uplink packet count threshold, then the uplink negotiation rate is used to determine whether the first network is abnormal. This improves the accuracy of the analysis results regarding whether the first network is abnormal. Specifically, if the uplink packet count is greater than or equal to the uplink packet count threshold, and the uplink negotiation rate is less than the uplink negotiation rate threshold, then the first network is abnormal. Conversely, if the uplink packet count is greater than or equal to the uplink packet count threshold, and the uplink negotiation rate is greater than or equal to the uplink negotiation rate threshold, then the first network is normal.

[0100] When network parameters include downlink packet count and downlink negotiation rate, the aforementioned S305 may specifically include: if the downlink packet count is greater than or equal to a downlink packet count threshold, the downlink negotiation rate is less than a downlink negotiation rate threshold. If the downlink packet count is greater than or equal to the downlink packet count threshold, then the downlink negotiation rate is used to determine whether the first network is abnormal. This improves the accuracy of the analysis results regarding whether the first network is abnormal. Specifically, if the downlink packet count is greater than or equal to the downlink packet count threshold, and the downlink negotiation rate is less than the downlink negotiation rate threshold, it indicates that the first network is abnormal. Conversely, if the downlink packet count is greater than or equal to the downlink packet count threshold, and the downlink negotiation rate is greater than or equal to the downlink negotiation rate threshold, it indicates that the first network is normal.

[0101] In other embodiments, network parameters may further include uplink packet count and uplink negotiation rate, as well as downlink packet count and downlink negotiation rate. In this embodiment, S305 may specifically include at least one of the following to indicate a first network anomaly: when the uplink packet count is greater than or equal to an uplink packet count threshold, the uplink negotiation rate is less than an uplink negotiation rate threshold; and when the downlink packet count is greater than or equal to a downlink packet count threshold, the downlink negotiation rate is less than a downlink negotiation rate threshold.

[0102] It should be noted that in embodiments where network parameters include the number of transmitted packets (including the number of uplink packets and / or the number of downlink packets) and the negotiation rate (including the uplink negotiation rate and / or the downlink negotiation rate), the specific implementation process of analyzing whether the first network is abnormal based on the number of transmitted packets and the negotiation rate can be referred to the description in the following embodiments.

[0103] When the first network is a Wi-Fi network and the network parameters include router status information, the aforementioned S305 can specifically include: determining whether the router is malfunctioning based on the router status information. Understandably, if the router is malfunctioning, then the first network can be identified as malfunctioning.

[0104] In other embodiments, network parameters may include two or more of the following: signal strength, negotiation rate (including uplink and downlink negotiation rates), and router status information. When determining whether a first network is abnormal based on network parameters, the first network is identified as abnormal if one of the network parameters does not meet the corresponding network quality conditions. For example, network parameters include signal strength and router status information. The first network is identified as abnormal if the signal strength is found to be below a signal strength threshold, and / or if the router is malfunctioning.

[0105] When there are two or more network parameters, the phone can simultaneously check all network parameters to determine if they meet the corresponding network quality conditions. If any one of the network parameters fails to meet the corresponding network quality conditions, it is identified as the first network anomaly; other network parameters do not need to be checked.

[0106] In other embodiments, the mobile phone can also set priorities for different network parameters. When determining whether the first network is abnormal based on the network parameters, each network parameter can be judged sequentially in descending order of priority to determine whether it does not meet the corresponding network quality conditions. For example, the network parameters include a first network parameter and a second network parameter, with the first network parameter having a higher priority than the second network parameter. Therefore, S305 can specifically include: based on the priority of each network parameter, first detecting whether the first network parameter meets the first threshold requirement corresponding to the first network parameter. If the first network parameter does not meet the first threshold requirement, the first network can be determined to be abnormal. At this time, other network parameters do not need to be detected. If the first network parameter meets the first threshold requirement, then the second network parameter is checked to see if it meets the second threshold requirement corresponding to the second network parameter. If the second network parameter does not meet the second threshold requirement, the first network can also be determined to be abnormal.

[0107] Generally, higher-priority network parameters are easier to obtain. Therefore, analyzing whether the first network is abnormal based on different network parameters in descending order of priority can improve detection efficiency. In some embodiments, the first network parameter may include signal strength; the second network parameter may be negotiation rate and number of packets transmitted, and / or router status information.

[0108] Taking the signal strength of the first network parameter as the first network parameter, and the negotiation rate and packet count as the second network parameters, when analyzing whether the first network is abnormal based on the network parameters, the mobile phone can first determine whether the signal strength is less than the signal strength threshold. If so, the first network can be directly determined to be abnormal without further checking the negotiation rate and packet count. If the signal strength is greater than or equal to the signal strength threshold, the mobile phone then checks the negotiation rate and packet count. Specifically, if the packet count is greater than or equal to the packet count threshold, and the negotiation rate is less than the negotiation rate threshold, it indicates that the network parameters of the first network indicate an abnormality. If the packet count is greater than or equal to the packet count threshold, and the negotiation rate is greater than or equal to the negotiation rate threshold, it indicates that the network parameters of the first network indicate that the first network is normal.

[0109] Taking the signal strength of the first network as the first network parameter and the router's status information, negotiation rate, and packet count as the second network parameters, when analyzing whether the first network is abnormal based on the network parameters, the mobile phone can first determine whether the signal strength is less than the signal strength threshold. If so, the first network can be directly determined to be abnormal without further checking the router's status information, negotiation rate, and packet count. If the signal strength is greater than or equal to the signal strength threshold, the mobile phone then checks the router's status information, or the negotiation rate and packet count. Specifically, the mobile phone can first check whether the negotiation rate and packet count meet the corresponding network quality conditions, and then check whether the router's status information meets the corresponding network quality conditions. Alternatively, the mobile phone can first check whether the router's status information meets the corresponding conditions, and then check whether the negotiation rate and packet count meet the corresponding network quality conditions. Alternatively, the mobile phone can simultaneously check whether the negotiation rate, packet count, and router's status information meet the corresponding network quality conditions. If the negotiation rate and packet count do not meet the corresponding network quality conditions, or if the router's status information indicates a router abnormality, the first network can be determined to be abnormal. Specific network quality conditions can be found in the description of the above embodiment.

[0110] Taking network parameters including signal strength, negotiation rate, and packet count, as well as router status information, as an example, in some embodiments, the priority is set from high to low, with signal strength having the highest priority, negotiation rate and packet count having middle priority, and router status information having the lowest priority. When determining whether the first network is abnormal based on network parameters, firstly, it is determined whether the corresponding network quality conditions are not met based on signal strength. If so, the first network is determined to be abnormal. The other two network parameters are not checked further. If the signal strength meets the corresponding network quality conditions, then it is determined whether the corresponding network quality conditions are not met based on negotiation rate and packet count. If both negotiation rate and packet count meet the corresponding network quality conditions, finally, the router status information is used to determine whether the first network is abnormal. By first using simpler network parameters to determine whether the first network is abnormal, and then using other network parameters if the determination is not possible, the time required to analyze whether the first network is abnormal can be reduced, thus improving efficiency.

[0111] If it is determined that the first network is malfunctioning, it indicates that the current network service quality anomaly is likely caused by network factors. In this case, the phone can switch to another network to improve the network service quality issue caused by the current network connection. That is, the judgment result of S305 is that S306 can be executed.

[0112] S306. Switch the current access network from the first network to the second network.

[0113] The second network can be any network other than the first network. Specifically, the second network can be any Wi-Fi network other than the first network, or it can be a cellular network, etc.

[0114] Understandably, executing S306 indicates that in the event of a first network failure, the phone must have a second network that meets preset conditions before S306 can be executed. Therefore, in some embodiments, after S305 and before S306, the phone can first check whether a network that meets the preset conditions exists. Only after confirming the existence of a network that meets the preset conditions will the phone execute S306. These preset conditions can be set according to actual conditions; for example, the preset conditions can specify a signal strength greater than a certain value to ensure network transmission speed after network switching.

[0115] Furthermore, when the phone detects other networks that meet preset conditions, and these other networks are cellular networks, it can also determine whether to switch networks based on the user's SIM card data plan usage. For example, when the user's data plan shows sufficient data usage, the phone can switch the current network from the first network to the cellular network. Conversely, if data is insufficient, the phone will not switch to the cellular network to avoid incurring higher data charges. Alternatively, when the phone detects insufficient data, it can send a notification to the user, allowing the user to choose whether to switch to the cellular network.

[0116] Alternatively, the phone can determine whether to switch the current access network from the primary network to the cellular network based on the user's network usage settings. In some embodiments, the user can set whether to use the cellular network when the Wi-Fi network is faulty. If the network usage settings specifically indicate that the cellular network should not be used when the Wi-Fi network is faulty, the phone will not execute S306. If the network usage settings specifically indicate that the cellular network should be used when the Wi-Fi network is faulty, the phone can execute S306. Alternatively, if the network usage settings specifically indicate that the user should be prompted to switch the network to the cellular network when the Wi-Fi network is faulty, the phone can send a prompt. Then, based on the user's selection, it will decide whether to switch the current access network to the cellular network. It is understood that all of the above steps can be executed after S305 and before S306.

[0117] In embodiments where the mobile phone includes multiple SIM cards, the user can set network usage settings separately for each SIM card. In this way, when selecting a target network to switch to, the mobile phone can determine whether to switch networks based on the network usage settings of each SIM card.

[0118] Furthermore, when the mobile phone detects an anomaly in the first network, there may be multiple alternative networks in the environment that meet preset conditions. In this embodiment, the mobile phone can first select a target network from the multiple alternative networks as the second network. Then, the current access network is switched from the first network to the target network.

[0119] In some embodiments, the mobile phone can select a target network as a second network from multiple candidate networks based on network priority. For example, the priority of a Wi-Fi network may be greater than that of a cellular network. When the candidate networks include both Wi-Fi and cellular networks, the mobile phone preferentially selects the Wi-Fi network as the target network.

[0120] In other embodiments, the mobile phone can also combine the signal strength of each network to select a target network as a second network from multiple candidate networks. For example, the mobile phone can select the candidate network with the highest signal strength as the target network.

[0121] In other embodiments, the mobile phone can also combine priority and signal strength to select a target network as the second network from multiple candidate networks. For example, the mobile phone can first filter for candidate networks with higher priority. If multiple candidate networks with the same high priority exist, the one with the highest signal strength can be selected as the target network. Alternatively, the mobile phone can first filter for candidate networks with signal strength greater than or equal to a signal strength threshold based on signal strength. If multiple networks have signal strength greater than or equal to the signal strength threshold and are of different types, the network with the higher priority is selected as the target network. This allows for the selection of a more suitable network as the target network, enabling better switching from the current access network to the target network.

[0122] In other embodiments, if the phone detects that there are no other networks that meet the preset conditions when the first network is determined to be abnormal, the phone may not execute S306. Alternatively, the phone may issue a prompt message to inform the user that the network service quality is abnormal. For example, the prompt message issued by the phone may be used to inform the user that the network service quality is abnormal, and ask the user to try restarting the application / restarting the phone / clearing background applications / exiting the application, etc. This allows the user to check the phone's network usage in a timely manner and take appropriate action.

[0123] In the network switching method proposed in this application embodiment, when an abnormality in the quality of service of the network service is detected, it is first determined whether the currently accessed network is abnormal. If the currently accessed network is determined to be abnormal, it will be switched to another available network. If the currently accessed network is normal, it will not be switched to another network. In this way, the problem of frequent network switching failing to improve the quality of service of the network service can be avoided, and the number of network switching times can be reduced.

[0124] Furthermore, the uplink negotiation rate and downlink negotiation rate are affected by the number of uplink packets and downlink packets, respectively. When the number of uplink packets is low, the accuracy of the uplink negotiation rate is low. Similarly, when the number of downlink packets is low, the accuracy of the downlink negotiation rate is low. Therefore, in the above-mentioned S305, when analyzing whether the first network is abnormal based on the uplink negotiation rate, it can specifically include: when the number of uplink packets is greater than or equal to an uplink packet count threshold, analyzing whether the first network is abnormal based on the uplink negotiation rate. Similarly, when analyzing whether the first network is abnormal based on the downlink negotiation rate, it can specifically include: when the number of downlink packets is greater than or equal to a downlink packet count threshold, analyzing whether the first network is abnormal based on the downlink negotiation rate.

[0125] Please refer to Figure 5 In some embodiments, S304 may specifically include S304a:

[0126] S304a. Obtain the number of transmission packets and negotiate the rate from the mobile phone.

[0127] The transmission includes the number of uplink packets and / or downlink packets; the negotiation rate includes the uplink negotiation rate and / or downlink negotiation rate.

[0128] Prior to S305, the above method may also include: detecting whether the number of transmitted packets is greater than or equal to a threshold number of transmitted packets.

[0129] When the number of transmitted packets includes the number of uplink packets, the number of transmitted packets threshold includes the uplink packet count threshold. Specifically, detecting whether the number of transmitted packets is greater than or equal to the number of transmitted packets threshold includes S401a:

[0130] S401a. Is the number of uplink packets greater than or equal to the uplink packet number threshold?

[0131] When the number of transmitted packets includes the number of downlink packets, the transmission packet count threshold includes the downlink packet count threshold. Detecting whether the number of transmitted packets is greater than or equal to the transmission packet count threshold specifically includes S401b:

[0132] S401b. Is the number of downlink packets greater than or equal to the downlink packet number threshold?

[0133] When the number of transmitted packets includes both uplink and downlink packets, the transmission packet count threshold includes both uplink and downlink packet count thresholds. Specifically, detecting whether the number of transmitted packets is greater than or equal to the transmission packet count threshold includes checking whether the number of uplink packets is greater than or equal to the uplink packet count threshold, and whether the number of downlink packets is greater than or equal to the downlink packet count threshold. It should be noted that the mobile phone can execute S401a first and then S401b; or it can execute S401b first and then S401a; or the mobile phone can execute S401a and S401 simultaneously.

[0134] If the result of the judgment in S401a is yes, then the mobile phone can execute S305a. If the result of the judgment in S401b is yes, then the mobile phone can execute S305b.

[0135] S305a. Is the uplink negotiation rate less than the uplink negotiation rate threshold?

[0136] S305b. Is the downlink negotiation rate less than the downlink negotiation rate threshold?

[0137] If the judgment result of S305a or S305b is negative, it indicates that the first network is normal. In this case, the phone will not switch to the currently accessed network. This situation occurs in... Figure 5 Not shown in the image.

[0138] When the negotiation rate includes both uplink and downlink negotiation rates, the negotiation rate threshold also includes both uplink and downlink negotiation rate thresholds. Specifically, S305a checks whether the uplink negotiation rate is less than the uplink negotiation rate threshold, or whether the downlink negotiation rate is less than the downlink negotiation rate threshold. If the result of S305a is negative, it means that both the uplink and downlink negotiation rates are greater than or equal to the uplink negotiation rate threshold. In this case, the first network is considered normal. Figure 5 It is also not shown in the middle.

[0139] In other embodiments, if the determination result of S401a or S401b is negative, it indicates that the accuracy of the uplink negotiation rate and / or downlink negotiation rate is not high. In this case, the number of uplink packets and / or downlink packets can be increased first, as in S402 and S403.

[0140] S402. If the number of uplink packets is less than the uplink packet threshold, the mobile phone sends a preset data packet to the router.

[0141] It should be noted that the above-mentioned preset data packets only have size and quantity, and their content is meaningless.

[0142] In some embodiments, a preset identifier can be added to the IP header of a preset data packet. This preset identifier is used by the receiver (router) to distinguish preset data packets from ordinary data packets. Because the preset identifier is added to the IP header of the preset data packet sent by the mobile phone to the router, the router can parse and obtain the preset identifier from the IP header after receiving the preset data packet. Subsequently, the router will not forward the preset data packet to other electronic devices, but can directly discard it. In this way, the preset data packet sent by the mobile phone to the router will only be transmitted to the Wi-Fi link layer and will not rise to the transport layer. Therefore, the preset data packet is only used to correct the uplink negotiation rate and will not affect the application's data transmission. Figure 6 As shown, in the process of a mobile phone sending a preset data packet to a router, after the router's physical layer receives the preset data packet from the mobile phone, it uploads the preset data packet to the data link layer. The data link layer parses the preset data packet, obtains the preset identifier carried in the IP header, determines that this preset data packet is used to increase the uplink packet count, and can then discard the preset data packet without transmitting it further.

[0143] In other embodiments, the destination address of the preset data packet sent by the mobile phone to the router can be set to empty or to the router's address. This way, after receiving the preset data packet, the router can determine, based on the destination address, that the data packet is used to increase the uplink packet count and does not need to be forwarded to other electronic devices.

[0144] In some embodiments, the mobile phone can send a preset number of preset data packets to the router. The preset number can be preset according to actual conditions.

[0145] In other embodiments, the number of preset data packets sent by the mobile phone to the router can also be determined by combining the difference between the uplink packet count and the uplink packet count threshold. For example, after determining the difference between the uplink packet count and the uplink packet count threshold, the mobile phone can then send a preset number of data packets corresponding to the difference to the router. Alternatively, the mobile phone can also send a preset number of data packets greater than the difference, such as difference + 1, difference + 5, etc. In this way, sending the preset data packets to the router once is sufficient for the mobile phone's uplink packet count to meet the uplink packet count threshold requirement.

[0146] In other embodiments, the number of preset data packets sent by the mobile phone to the router can also be set in conjunction with an uplink packet count threshold. For example, if it is determined that the uplink packet count is less than the uplink packet count threshold, the mobile phone can send a preset number of mouse cursors corresponding to the uplink packet count threshold to the router. In this way, sending the preset data packets once to the router is sufficient to ensure that the mobile phone's uplink packet count meets the uplink packet count threshold requirement.

[0147] After sending a preset data packet to the router, the mobile phone can re-acquire the uplink packet count and determine if it exceeds an uplink packet count threshold. If the uplink packet count is greater than or equal to the threshold, the mobile phone acquires the uplink negotiation rate and analyzes the network quality of the first network based on this rate. If the uplink packet count is still less than the threshold, the mobile phone can continue sending the preset data packet to the router, or it can send an even larger number of preset data packets than before. This further increases the mobile phone's uplink packet count, thereby improving the accuracy of the uplink negotiation rate.

[0148] S403. If the number of downlink packets is less than the downlink packet threshold, the mobile phone sends a notification message to the router.

[0149] S404. In response to receiving the notification message, the router sends a preset data packet to the mobile phone.

[0150] For details on determining the number of preset data packets that the router sends to the mobile phone, please refer to the detailed explanation of how the mobile phone sends preset data packets to the router.

[0151] If neither the uplink nor downlink packet count meets the corresponding threshold requirements, the phone can simultaneously execute steps S402, S403, and S404 to increase the uplink and downlink packet counts concurrently. This improves the accuracy of the uplink and downlink negotiation rates.

[0152] The uplink and downlink negotiation rates corrected using the above method have improved accuracy and reliability. Subsequently, analyzing whether the first network is abnormal based on the corrected uplink and downlink negotiation rates can improve the accuracy of the analysis. In some embodiments, after S402, S403, and S404, the mobile phone can return to S304a to reacquire the uplink packet count, downlink packet count, uplink negotiation rate, and downlink negotiation rate, and analyze whether the first network is abnormal based on the reacquired parameters.

[0153] In the technical solution proposed in this application, when analyzing whether the first network is abnormal using the uplink negotiation rate and downlink negotiation rate, the accuracy of the analysis is achieved by combining the number of uplink packets and the number of downlink packets. If the accuracy of determining the uplink and downlink negotiation rates based on the number of uplink and downlink packets is low, end-to-end coordination can be achieved by increasing the transmission of preset data packets between the mobile phone and the router. This increases the number of uplink and downlink packets, thereby improving the accuracy of the uplink and downlink negotiation rates. This improves the accuracy of analyzing whether the first network is abnormal using the uplink and downlink negotiation rates.

[0154] like Figure 7 The diagram shown is a structural schematic of an electronic device 700 provided in an embodiment of this application. The electronic device 700 may include a processor 710, an external memory interface 720, an internal memory 721, a universal serial bus (USB) interface 730, a charging management module 740, a power management module 741, a battery 742, antenna 1, antenna 2, a mobile communication module 750, a wireless communication module 760, an audio module 770, a sensor module 780, buttons 790, a motor 791, a camera 792, a display screen 793, and a subscriber identification module (SIM) card interface 794, etc. The sensor module 780 may include a pressure sensor 780A, a touch sensor 780B, etc.

[0155] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the electronic device 700. In other embodiments of this application, the electronic device 700 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0156] Processor 710 may include one or more processing units, such as an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processing unit (NPU). Different processing units may be independent devices or integrated into one or more processors. For example, processor 710 is used to execute the network switching method in the embodiments of this application.

[0157] The controller can serve as the nerve center and command center of the electronic device 700. The controller can generate operation control signals based on the instruction opcode and timing signals to control the fetching and execution of instructions.

[0158] The processor 710 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 710 is a cache memory. This memory can store instructions or data that the processor 710 has just used or that are used repeatedly. If the processor 710 needs to use the instruction or data again, it can retrieve it directly from the memory. This avoids repeated accesses, reduces the waiting time of the processor 710, and thus improves the efficiency of the system.

[0159] The USB interface 730 is a USB standard compliant interface, which can be a Mini USB interface, Micro USB interface, USB Type-C interface, etc. The USB interface 730 can be used to connect a charger to charge the electronic device 700, and can also be used for data transfer between the electronic device 700 and peripheral devices.

[0160] The external memory interface 720 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 700. The external memory card communicates with the processor 710 through the external memory interface 720 to perform data storage functions. For example, music, video, and other files can be saved on the external memory card.

[0161] Internal memory 721 can be used to store executable program code, which includes instructions. Processor 710 executes various functional applications and data processing of electronic device 700 by running the instructions stored in internal memory 721. Internal memory 721 may include a program storage area and a data storage area. The program storage area may store the operating system and at least one application program required for a given function (such as sound playback, image playback, etc.).

[0162] In addition, the internal memory 721 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc.

[0163] The charging management module 740 is used to receive charging input from a charger. The charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 740 can receive charging input from the wired charger via a USB interface 730.

[0164] The power management module 741 is used to connect the battery 742, the charging management module 740, and the processor 710. The power management module 741 receives input from the battery 742 and / or the charging management module 740 to power the processor 710, internal memory 721, external memory, display 793, camera 792, and wireless communication module 760, etc.

[0165] In some other embodiments, the power management module 741 may also be located within the processor 710. In still other embodiments, the power management module 741 and the charging management module 740 may also be located in the same device.

[0166] The wireless communication function of electronic device 700 can be implemented through antenna 1, antenna 2, mobile communication module 750, wireless communication module 760, modem processor and baseband processor, etc.

[0167] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 700 can be used to cover one or more communication frequency bands. Different antennas can also be multiplexed to improve antenna utilization. For example, antenna 1 can be multiplexed as a diversity antenna for a wireless local area network. In some other embodiments, the antennas can be used in conjunction with a tuning switch.

[0168] The mobile communication module 750 can provide solutions for wireless communication applications including 2G / 3G / 4G / 5G on the electronic device 700. The mobile communication module 750 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 750 can receive electromagnetic waves via antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic waves before transmitting them to a modem processor for demodulation. The mobile communication module 750 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via antenna 1.

[0169] The wireless communication module 760 can provide solutions for wireless communication applications on the electronic device 700, including wireless local area networks (WLAN) (such as Wi-Fi), Bluetooth, Global Navigation Satellite System (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR). The wireless communication module 760 can be one or more devices integrating at least one communication processing module. The wireless communication module 760 receives electromagnetic waves via antenna 2, performs frequency modulation and filtering of the electromagnetic wave signal, and sends the processed signal to processor 710. The wireless communication module 760 can also receive signals to be transmitted from processor 710, perform frequency modulation and amplification, and convert them into electromagnetic waves for radiation via antenna 2.

[0170] In some embodiments, antenna 1 of electronic device 700 is coupled to mobile communication module 750, and antenna 2 is coupled to wireless communication module 760, enabling electronic device 700 to communicate with networks and other devices via wireless communication technology.

[0171] Electronic device 700 can implement audio functions through audio module 770 and application processor, such as music playback and recording.

[0172] The audio module 770 is used to convert digital audio signals into analog audio signals for output, and also to convert analog audio inputs into digital audio signals. The audio module 770 can also be used for encoding and decoding audio signals. In some embodiments, the audio module 770 may be located in the processor 710, or some functional modules of the audio module 770 may be located in the processor 710.

[0173] Pressure sensor 780A is used to sense pressure signals and convert them into electrical signals. In some embodiments, pressure sensor 780A may be disposed on display screen 793. There are many types of pressure sensors 780A, such as resistive pressure sensors, inductive pressure sensors, and capacitive pressure sensors. A capacitive pressure sensor may include at least two parallel plates with conductive material. When a force is applied to pressure sensor 780A, the capacitance between the electrodes changes. Electronic device 700 determines the pressure intensity based on the change in capacitance. When a touch operation is applied to display screen 793, electronic device 700 detects the touch operation intensity based on pressure sensor 780A. Electronic device 700 can also calculate the touch position based on the detection signal from pressure sensor 780A.

[0174] Touch sensor 780B, also known as a "touch panel," can be located on display screen 793. The touch sensor 780B and display screen 793 together form a touchscreen, also known as a "touch screen." Touch sensor 780B is used to detect touch operations applied to or near it. The touch sensor can transmit the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through display screen 793. In other embodiments, touch sensor 780B may also be located on the surface of electronic device 700, in a different position than display screen 793.

[0175] Buttons 790 include a power button, volume buttons, etc. Buttons 790 can be mechanical buttons or touch-sensitive buttons. Electronic device 700 can receive button input and generate key signal inputs related to user settings and function control of electronic device 700.

[0176] Motor 791 can generate vibration alerts. Motor 791 can be used for incoming call vibration alerts or for touch vibration feedback.

[0177] The camera 792 is used to capture still images or videos. In some embodiments, the electronic device 700 may include one or N cameras 792, where N is a positive integer greater than 1.

[0178] Electronic device 700 implements display functions through a GPU, a display screen 793, and an application processor. The GPU is a microprocessor for image processing, connected to the display screen 793 and the application processor. The GPU performs mathematical and geometric calculations and is used for graphics rendering. Processor 710 may include one or more GPUs, which execute program instructions to generate or modify display information.

[0179] The display screen 793 is used to display images, videos, etc. In some embodiments, the electronic device 700 may include one or N display screens 793, where N is a positive integer greater than 1.

[0180] The SIM card interface 794 is used to connect a SIM card. The SIM card can be inserted into or removed from the SIM card interface 794 to make contact with or separate from the electronic device 700. The electronic device 700 can support one or N SIM card interfaces, where N is a positive integer greater than 1.

[0181] The network switching methods described in the following embodiments can all be implemented in the electronic device 700 with the above-described hardware structure.

[0182] The software system of the electronic device 700 can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This application embodiment uses the layered architecture Android™ system as an example to illustrate the software structure of the electronic device 700.

[0183] Figure 8 This is a software structure block diagram of an electronic device 700 according to an embodiment of this application.

[0184] A layered architecture divides software into several layers, each with a clear role and function. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into five layers, from top to bottom: the application layer, the application framework layer, the Android runtime (ART) and native C / C++ libraries, the hardware abstraction layer (HAL), and the kernel layer.

[0185] The application layer can include a series of application packages. Examples include applications such as gallery, calendar, maps, WLAN, music, SMS, calling, navigation, Bluetooth, and video.

[0186] The application framework layer provides application programming interfaces (APIs) and a programming framework for applications in the application layer. The application framework layer includes some predefined functions.

[0187] like Figure 8 As shown, the application framework layer may include a window manager, content provider, view system, resource manager, notification manager, activity manager, input manager, etc.

[0188] The window manager provides a window management service (WMS), which can be used for window management, window animation management, surface management, and as a relay station for the input system.

[0189] Content providers store and retrieve data, making that data accessible to applications. This data can include videos, images, audio, phone calls made and received, browsing history and bookmarks, phone books, etc.

[0190] A view system includes visual controls, such as controls for displaying text and controls for displaying images. View systems can be used to build applications. A display interface can consist of one or more views. For example, a display interface including a text notification icon could include views for displaying text and views for displaying images.

[0191] The file explorer provides applications with various resources, such as localized strings, icons, images, layout files, video files, and more.

[0192] The notification manager allows applications to display notifications in the status bar. These notifications can be used to deliver informational messages and can disappear automatically after a short pause, requiring no user interaction. For example, the notification manager can be used to notify users of completed downloads or message alerts. The notification manager can also display notifications as icons or scrolling text in the top status bar, such as notifications from background applications, or as dialog boxes on the screen. Examples include displaying text messages in the status bar, emitting sounds, vibrating electronic devices, and flashing indicator lights.

[0193] The Activity Manager Service (AMS) can be used to start, switch, and schedule system components (such as activities, services, content providers, and broadcast receivers), as well as manage and schedule application processes.

[0194] The input manager can provide an input management service (IMS), which can be used to manage system inputs, such as touchscreen input, keypad input, and sensor input. IMS retrieves events from input device nodes and, through interaction with the WMS, distributes these events to the appropriate windows.

[0195] The Android runtime consists of the core libraries and the Android runtime itself. The Android runtime is responsible for converting source code into machine code. The Android runtime primarily employs ahead-of-time (AOT) compilation and just-in-time (JIT) compilation techniques.

[0196] The core library primarily provides basic Java class library functionalities, such as libraries for fundamental data structures, mathematics, I / O, tools, databases, and networking. It also provides APIs for users to develop Android applications.

[0197] Native C / C++ libraries can include multiple functional modules. Examples include: surface manager, media framework, 3D graphics library (OpenGL ES), relational database engine (SQLite), and browser engine (WebKit).

[0198] The interface manager manages the display subsystem and provides fusion of 2D and 3D layers for multiple applications. The media framework supports playback and recording of various common audio and video formats, as well as still image files. The media library supports multiple audio and video encoding formats, such as MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG. OpenGL ES provides drawing and manipulation of 2D and 3D graphics in applications. SQLite provides a lightweight relational database for applications on electronic devices.

[0199] The Hardware Abstraction Layer (HAL) runs in user space, encapsulates kernel-level drivers, and provides calling interfaces to higher layers. The HAL includes modules such as display, audio, camera, and Bluetooth.

[0200] The kernel layer is the layer between hardware and software. The kernel layer includes at least the display driver, audio driver, camera driver, and Bluetooth driver.

[0201] Other embodiments of this application provide an electronic device (such as a mobile phone). The electronic device may include a memory and one or more processors. The memory is coupled to the processors. The memory is also used to store computer program code, which includes computer instructions. When the processor executes the computer instructions, the electronic device can perform various functions or steps performed by the mobile phone in the above method embodiments. The structure of the electronic device can be referred to... Figure 7 The structure of the electronic device 700 shown is illustrated.

[0202] This application also provides a chip system, such as... Figure 9 As shown, the chip system 800 includes at least one processor 801 and at least one interface circuit 802. The processor 801 and the interface circuit 802 are interconnected via lines. For example, the interface circuit 802 can be used to receive signals from other devices (e.g., a computer's memory). As another example, the interface circuit 802 can be used to send signals to other devices (e.g., the processor 801). Exemplarily, the interface circuit 802 can read instructions stored in memory and send those instructions to the processor 801. When the instructions are executed by the processor 801, the computer can perform the steps in the above embodiments. Of course, the chip system may also include other discrete devices, which are not specifically limited in this application embodiment.

[0203] This application also provides a computer-readable storage medium including computer instructions that, when executed on the aforementioned electronic device (such as a mobile phone), cause the electronic device to perform various functions or steps performed by the mobile phone in the above method embodiments.

[0204] This application also provides a computer program product that, when run on a computer, causes the computer to perform the various functions or steps performed by the mobile phone in the above method embodiments. The computer can be an electronic device, such as a mobile phone.

[0205] Through the above description of the embodiments, those skilled in the art can clearly understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0206] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

[0207] The units described as separate components may or may not be physically separate. A component shown as a unit can be one or more physical units; that is, it can be located in one place or distributed in multiple different locations. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0208] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0209] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, in essence, or the parts that contribute to the prior art, or all or part of the technical solutions, can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0210] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A network handover method, characterized in that, The method is applied to an electronic device, and the method includes: During the process of the electronic device providing network services to the user based on the first network, the electronic device acquires data transmission parameters; When the data transmission parameters indicate an abnormal operation of the network service, the electronic device acquires the network parameters of the first network; the network parameters include the number of transmission packets and the negotiation rate of the first network. If the number of uplink transmission packets in the total number of transmission packets is less than an uplink packet number threshold, a preset data packet is transmitted between the electronic device and the router corresponding to the first network; the preset data packet is used to increase the number of uplink transmission packets to calibrate the uplink negotiation rate in the negotiation rate; and / or, if the number of downlink transmission packets in the total number of transmission packets is less than a downlink packet number threshold, a preset data packet is transmitted between the electronic device and the router corresponding to the first network; the preset data packet is used to increase the number of downlink transmission packets to calibrate the downlink negotiation rate in the negotiation rate. If the network parameters of the calibrated first network indicate an anomaly in the first network, the current access network of the electronic device is switched from the first network to the second network.

2. The method according to claim 1, characterized in that, The data transmission parameters include at least one of the following: uplink rate, downlink rate, TCP round-trip time, number of TCP retransmission packets, number of sync packet retransmission packets, frame length, frame rate, and frame per second (FPS). The data transmission parameters characterize network service malfunctions, including: When the data transmission parameters include two or more items, if at least one data transmission parameter does not meet the corresponding quality of service conditions, it indicates that the network service is malfunctioning.

3. The method according to claim 1 or 2, characterized in that, The network parameters of the first network characterize the anomalies of the first network, including at least one of the following: Firstly, the network parameters of the first network include the signal strength of the first network; the signal strength is less than a signal strength threshold. Second, the network parameters of the first network include: the number of uplink packets and the uplink negotiation rate of the first network; if the number of uplink packets is greater than or equal to an uplink packet count threshold, the uplink negotiation rate is less than an uplink negotiation rate threshold. Thirdly, the network parameters of the first network include: the number of downlink packets and the downlink negotiation rate of the first network; if the number of downlink packets is greater than or equal to the downlink packet number threshold, the downlink negotiation rate is less than the downlink negotiation rate threshold. Fourthly, the network parameters of the first network include: the status information of the router corresponding to the first network; the status information of the router indicates that the router is abnormal.

4. The method according to claim 3, characterized in that: The number of transmitted packets includes the number of uplink packets, and the threshold number of transmitted packets includes an uplink packet threshold; the step of transmitting a preset data packet between the electronic device and the router corresponding to the first network when the number of transmitted packets is less than the threshold number of transmitted packets includes: If the number of uplink packets is less than the uplink packet count threshold, the electronic device transmits a preset data packet to the router corresponding to the first network until the number of uplink packets is greater than or equal to the uplink packet count threshold; the preset data packet is used to increase the number of uplink packets. And / or, The number of transmitted packets includes the number of downlink packets, and the threshold number of transmitted packets includes a threshold number of downlink packets; the step of transmitting a preset data packet between the electronic device and the router corresponding to the first network when the number of transmitted packets is less than the threshold number of transmitted packets includes: If the number of downlink packets is less than the downlink packet count threshold, the electronic device sends a notification message to the router corresponding to the first network until the number of downlink packets is greater than or equal to the downlink packet count threshold; the notification message is used to instruct the router to transmit a preset data packet to the electronic device; the preset data packet is used to increase the number of downlink packets.

5. The method according to claim 1, characterized in that, The network parameters of the first network include: a first network parameter and a second network parameter; the first network parameter has a higher priority than the second network parameter; the first network parameter includes the signal strength of the first network; the second network parameter includes: negotiation rate and number of transmission packets, and / or, the status information of the router corresponding to the first network; the negotiation rate includes uplink negotiation rate and / or downlink negotiation rate, and the number of transmission packets includes uplink packet count and / or downlink packet count; The network parameters of the first network characterize the anomalies of the first network, including: Based on the priority of each network parameter, first check whether the first network parameter meets the first threshold requirement corresponding to the first network parameter; If the first network parameters do not meet the first threshold requirement, then the first network is considered abnormal. If the first network parameter meets the first threshold requirement, then it is checked whether the second network parameter meets the second threshold requirement corresponding to the second network parameter. If the second network parameters do not meet the second threshold requirement, it indicates that the first network is abnormal.

6. The method according to claim 1, characterized in that, The method further includes: If the network parameters of the first network indicate that the first network is functioning normally, then the currently accessed network remains the first network; or... If the network parameters of the first network indicate that the first network is normal, the duration of the abnormal operation of the network service is counted; if the duration exceeds a preset time, the current access network is switched from the first network to the second network.

7. The method according to claim 1, characterized in that, Before switching the current access network of the electronic device from the first network to the second network, the method further includes: Detect whether the electronic device has an alternative network that meets preset conditions; Switching the current access network of the electronic device from the first network to the second network includes: If the electronic device detects that there are alternative networks that meet preset conditions, the second network is determined from the alternative networks; Switch the current access network from the first network to the second network.

8. An electronic device, characterized in that, include: A processor, a memory, and a computer program stored in the memory; the memory is coupled to the processor; When the electronic device is running, the processor executes the computer program to implement the method as described in any one of claims 1-7.

9. A computer-readable storage medium, characterized in that, The device contains a computer program that, when executed by a processor of an electronic device, implements the method as described in any one of claims 1-7.

10. A computer program product, characterized in that, It includes a computer program, which, when executed by a processor of an electronic device, implements the method as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Network detection method and electronic equipment

    CN116390142A

  • Virtual system performance test method, device and system

    CN117061389A