SIM card switching method and terminal equipment

By obtaining and analyzing the network parameters of each SIM card in a multi-SIM card terminal device, determining its network quality, and dynamically switching the main SIM card, the problems of network availability and stability of the main SIM card are solved, achieving more stable communication and better user experience.

CN119789061APending Publication Date: 2025-04-08CHINA TOWER CO LTD
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202411756272.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-02
Publication Date
2025-04-08

AI Technical Summary

Technical Problem

In multi-SIM card terminal devices, ensuring network availability and stability of the primary SIM card is an important issue, especially during communication.

Method used

By obtaining the network parameters of each SIM card within a certain period of time, determining the network quality of each SIM card based on these parameters, and selecting a new main SIM card in the SIM card with a network quality higher than the current main SIM card, thereby realizing the determination and switching of the main SIM card.

Benefits of technology

This method can ensure the long-term stability of the network quality of the main SIM card, avoid frequent main SIM card switching, improve the communication stability and network availability of terminal devices, and improve the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119789061A_ABST
    Figure CN119789061A_ABST
Patent Text Reader

Abstract

The present application discloses a SIM card switching method and a terminal device, the method being applied to a terminal device equipped with multiple SIM cards, comprising: obtaining a network parameter of each SIM card in a first time period; determining, for each SIM card, a network quality of the SIM card based on the network parameter of the SIM card in the first time period; if the network quality of at least one SIM card is higher than the network quality of a first SIM card currently serving as a primary SIM card, selecting a second SIM card from the at least one SIM card to be set as the primary SIM card.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communications, and in particular to a SIM card switching method and terminal equipment. Background Art

[0002] With the development of technology, more and more users use multi-Subscriber Identity Module (SIM) card communication devices, such as smart phones that support dual SIM cards. One of the SIM cards is used as the primary SIM card to provide the main network connection.

[0003] During the communication process, it is particularly important to ensure the network availability and stability of the primary SIM card. Summary of the invention

[0004] The purpose of the embodiments of the present application is to provide a SIM card switching method and a terminal device, which are used to ensure the network availability and stability of the primary SIM card.

[0005] In order to achieve the above objectives, the present application embodiment adopts the following technical solutions: In a first aspect, an embodiment of the present application provides a SIM card switching method, which is applied to a terminal device equipped with multiple SIM cards, including: Obtaining network parameters of each SIM card in a first time period; For each SIM card, determining a network quality of the SIM card based on a network parameter of the SIM card in the first time period; If the network quality of at least one SIM card is higher than the network quality of the first SIM card currently serving as the primary SIM card, a second SIM card is selected from the at least one SIM card and set as the primary SIM card.

[0006] In a second aspect, an embodiment of the present application provides a SIM card switching device, which is applied to a terminal device equipped with multiple SIM cards, including: An acquisition unit, used to acquire network parameters of each SIM card in a first time period; a determining unit, configured to determine, for each SIM card, a network quality of the SIM card based on a network parameter of the SIM card in the first time period; The switching unit is used to select a second SIM card from the at least one SIM card to be set as the primary SIM card if the network quality of the at least one SIM card is higher than the network quality of the first SIM card currently serving as the primary SIM card.

[0007] In a third aspect, an embodiment of the present application provides a terminal device, wherein the terminal device has multiple SIM cards built in, including: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions, and when the instructions are executed, the processor executes the method as described in the first aspect.

[0008] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute the method described in the first aspect.

[0009] At least one of the above technical solutions adopted in the embodiments of the present application can achieve the following beneficial effects: by obtaining the network parameters of each SIM card within a certain period of time, based on the obtained network parameters, the network quality of each SIM card is determined, and by comparing the network quality of each SIM card, the second SIM card is selected as the main SIM card from at least one SIM card whose network quality is higher than the network quality of the first SIM card currently serving as the main SIM card, thereby achieving the determination and switching of the main SIM card. Determining the main SIM card based on long-term network parameters can ensure that the network quality of the main SIM card is in a stable state for a long time. Compared with the switching method based on the instantaneous network, the frequent switching of the main SIM card can be avoided, thereby maintaining the communication stability and network availability of the device, and effectively improving the user experience in the multi-SIM card terminal device. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings: Figure 1 One of the flowcharts of a SIM card switching method provided by an embodiment of the present application; Figure 2 A second flow chart of a SIM card switching method provided by an embodiment of the present application; Figure 3 A third flowchart of a SIM card switching method provided by an embodiment of the present application; Figure 4 A fourth flowchart of a SIM card switching method provided by an embodiment of the present application; Figure 5 A schematic structural diagram of a SIM card switching device provided in one embodiment of the present application; Figure 6 A schematic diagram of the structure of a terminal device provided for one embodiment of the present application. DETAILED DESCRIPTION

[0011] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.

[0012] The terms "first", "second", etc. in this specification and claims are used to distinguish similar objects, and are not used to describe a particular order or precedence. It should be understood that the terms used in this way can be interchanged where appropriate so that the embodiments of the present application are implemented in a sequence other than those illustrated or described herein. In addition, "and / or" in this specification and claims means at least one of the connected objects, and the character " / " generally means that the objects associated with each other are in an "or" relationship.

[0013] With the development of technology, more and more users use multi-Subscriber Identity Module (SIM) card communication devices, such as smart phones that support dual SIM cards. One of the SIM cards is used as the primary SIM card to provide the main network connection.

[0014] During the communication process, it is particularly important to ensure the network availability and stability of the primary SIM card.

[0015] In view of this, an embodiment of the present application provides a SIM card switching method, which obtains the network parameters of each SIM card within a certain period of time, determines the network quality of each SIM card based on the obtained network parameters, and compares the network quality of each SIM card. Among at least one SIM card whose network quality is higher than the network quality of the first SIM card currently serving as the primary SIM card, selects a second SIM card to be set as the primary SIM card, thereby achieving determination and switching of the primary SIM card. Determining the primary SIM card based on long-term network parameters can ensure that the network quality of the primary SIM card is in a stable state for a long time. Compared with the switching method based on the instantaneous network, it can avoid frequent switching of the primary SIM card, thereby maintaining the communication stability and network availability of the device, and effectively improving the user experience in multi-SIM card terminal devices.

[0016] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.

[0017] See also Figure 1 , is one of the flow charts of a SIM card switching method provided by an embodiment of the present application. Figure 1As shown, an embodiment of the present application provides a SIM card switching method, which is applied to a terminal device equipped with multiple SIM cards. The method may include the following steps: S102: Obtain network parameters of each SIM card in a first time period.

[0018] SIM (Subscriber Identity Module) card, also known as user identity module card, is a chip card used in terminal devices to store user-related data, such as user identity, authorization information, communication data and other data.

[0019] A terminal device is a device that can connect to a communication network and use network services, such as a mobile phone, a tablet computer, a smart watch, an IoT device, etc. The IoT device includes but is not limited to smart home devices, vehicle terminals, remote monitoring systems, etc. In the embodiment of the present application, the terminal device can carry multiple SIM cards.

[0020] Network parameters are various technical indicators and performance data related to network connections. As an example, network parameters include: signal strength, network delay, packet loss rate, data transmission rate and network jitter. As another example, network data also includes: bandwidth, Ping value. Among them, signal strength indicates the strength of the network signal, usually in dBm (decibel milliwatt). The higher the signal strength, the better the network connection. Network delay is the time from sending a request to receiving a response, usually in milliseconds (ms). Bandwidth indicates the rate of data transmission, usually in kbps or Mbps. Packet loss rate is the proportion of data packets lost during data transmission. A higher packet loss rate usually means poor network quality. Data transmission rate refers to the amount of data transmitted through the network per unit time, usually expressed in bits per second (bps) or its multiples, such as Kbps, Mbps, Gbps. Network jitter refers to the degree of network delay fluctuation during data packet transmission, that is, the change in the time interval for data packets in the same data stream to reach the target. The delay fluctuation of data packet transmission is usually expressed in milliseconds (ms). Bandwidth refers to the maximum capacity or width of data that can be transmitted in a network connection, usually expressed in bits per second (bps) or its multiples such as Kbps, Mbps, Gbps. Ping values ​​are often used to evaluate network latency and reflect the stability and real-time performance of network connections. The above are just some examples of network parameters. Of course, they can also be set according to actual needs, and the embodiments of the present application do not specifically limit this.

[0021] The first time period is a period before the current time point. The duration of the first time period can be set according to actual application needs, which may be a few seconds, a few minutes, or a longer time, and the embodiments of the present application do not specifically limit this. As a preferred implementation, the first time period is selected as a period of time closest to the current time point, and the main SIM card of the terminal device is determined based on the latest historical network parameters, so that a smooth transition can be made in different usage scenarios, and the switching of the main SIM card can be completed to ensure the stability and availability of the terminal device network. For example: assuming that the current time point is 14:00, and the duration of the first time period is 1 hour, then the first time period is from 13:00 to 14:00.

[0022] As an example, the above S102 can obtain the network parameters of each SIM card by real-time monitoring of multiple SIM cards. For example, after the terminal device is started, the current network parameters of each SIM card can be recorded and saved periodically, such as recording once every 1 minute. When it is necessary to determine the network quality of each SIM card, the network parameters recorded in the past period of time, such as the network parameters in the past hour, are pulled, and the network quality of each SIM card is determined based on the pulled network parameters.

[0023] As an example, a corresponding API interface, network debugging tool or communication module may be set to realize the pulling of network parameters. The above S102 may obtain the corresponding network data by calling the communication module, network debugging tool or API interface provided by the operating system of the terminal device.

[0024] The embodiment of the present application shows some implementation methods of the above S102. Of course, it should be understood that the above S102 can also be implemented in other ways, and the embodiment of the present application does not limit this.

[0025] S104: For each SIM card, determine the network quality of the SIM card based on the network parameters of the SIM card in the first time period.

[0026] Network quality refers to the quality of network connection. The network quality of each SIM card can be judged by network parameters. For example, the higher the signal strength, the better the network quality, the lower the signal strength, the worse the network quality; or if the signal strength exceeds a certain threshold, the network quality is considered good.

[0027] As an example, when determining the network quality of the SIM card based on the network parameters of the SIM card in the first time period in the above S104, the network quality of the SIM card can be determined based on the average of the network parameters in the first time period. For example: assuming that the network parameters of the SIM card are recorded every hour, the network parameters of the past day are obtained, such as the signal strength is s1, s2, ... si ... s24, where si represents the signal strength of the SIM card recorded in the i-th hour of the past day, then the average of the network parameters in the past day is (s1 + s2 + ... + si + ... + s24) / 24, and the network quality of the SIM card is determined based on the obtained average.

[0028] As an example, the first time period can be divided to obtain multiple second time periods. For each second time period, the mean value of the network parameters in the second time period is calculated, and the weight corresponding to each second time period is determined according to the time sequence of the multiple second time periods. The weight corresponding to the second time period closer to the current time point is greater. The weight is adjusted according to the latest network performance to ensure that the nearest network parameters have a greater impact and the farther network parameters have a smaller impact. When the network quality of the SIM card is determined based on the network parameters of the SIM card in the first time period in the above S104, the network quality of the SIM card can be determined based on the mean value of the network parameters in multiple second time periods and the weight corresponding to each second time period. Among them, when the first time period is divided to obtain multiple second time periods, the logarithmic growth method can be used to divide the first time period. Starting from the second time period closest to the current time point, the length of the second time period gradually increases, thereby obtaining multiple second time periods. For example: starting from the second time period closest to the current time point, the duration (unit: hours) of each second time period is 1, 2, 4, 8, 16 respectively, the current time point is recorded as 0, and starting from the second time period closest to the current time point, the ranges of each second time period are [0,1), [1,3), [3,7), [7,15), [15,31).

[0029] As an example, the network parameters include multiple parameter types. As an example, the parameter types include signal strength, network delay, packet loss rate, data transmission rate and network jitter. As another example, the parameter types also include: bandwidth, Ping value. Of course, other parameter types may also be included, which is not limited in the embodiments of the present application.

[0030] Because the terminal devices are used in different scenarios, there are different network requirements for SIM cards. For example, in scenarios that require a large amount of data transmission, such as video and audio downloads, higher bandwidth is required; in some instant messaging scenarios, lower network latency is required to achieve real-time communication, etc. As an example, corresponding weights can be set for different parameter types. According to different network requirements, the weights of important parameter types can be set higher, and the weights of unimportant parameter types can be set lower. When determining the network quality of the SIM card based on the network parameters of the SIM card in the first time period in the above S104, the network quality of the SIM card can be determined according to the weights of different parameter types and network parameters.

[0031] As an optional implementation manner, when the first time period includes multiple second time periods, the network parameter of the SIM card in the first time period includes an average value of the network parameter in different second time periods, and the network parameter of the SIM card in the first time period includes multiple parameter types, when determining the network quality of the SIM card based on the network parameter of the SIM card in the first time period in the above S104, the following steps may be included: S140: For each parameter type, determine the network quality corresponding to the parameter type based on the average of the network parameters of the parameter type in multiple second time periods and the weights corresponding to each of the multiple second time periods.

[0032] S142: Determine the network quality of the SIM card based on the network qualities corresponding to different network parameter types.

[0033] The embodiment of the present application is based on the average of the network parameters in multiple second time periods and the weights corresponding to different second time periods and the parameter types of the network parameters, which can more accurately and comprehensively determine the network quality of each SIM card, thereby ensuring the stability of the main SIM card. Compared with the switching method of a single network parameter and an instantaneous network parameter, it can avoid frequent switching of the main SIM card, making the network quality determination of the terminal setting more robust and accurate. By adopting a multi-dimensional and multi-time period network parameter evaluation method, it is possible to eliminate misjudgments caused by short-term network fluctuations, improve the accuracy of judgments on the SIM card network quality, and ensure that the device can select a truly stable and high-quality network connection when switching the main SIM card, thereby improving the communication stability and experience quality of users when using multi-SIM card devices.

[0034] As an optional implementation, in the above S140, the average value of the network parameter in different second time periods may be determined in the following manner: for each second time period, based on a preset sampling period, sampling the network parameter in the second time period to obtain multiple sampling values; For each sampling point, determine a weight corresponding to a sampling value collected at the sampling point based on the distance of the sampling point from the central sampling point, where the central sampling point is a sampling point located at the center of the second time period; Based on the multiple sampling values ​​and the weights corresponding to the multiple sampling values, an average value of the network parameter in the second time period is determined.

[0035] Sampling refers to measuring network parameters within a predetermined time period. The sampling period is the time interval or frequency for measuring network parameters. The sampling point is the moment or location of the measurement operation. The sampling value is the measured data. For example: if a time period is 5 seconds and the sampling period is 1 second, then within the time period, sampling will be performed every 1 second, and the sampling points are the 1st second, 2nd second, 3rd second, 4th second, and 5th second. If the signal strength is sampled, then the signal strength at the 1st second, 2nd second, 3rd second, 4th second, and 5th second is the sampling value. As an example, if the distance between the sampling point and the central sampling point is greater, the weight corresponding to the sampling value collected by the sampling point is greater; if the distance between the sampling point and the central sampling point is smaller, the weight corresponding to the sampling value collected by the sampling point is smaller.

[0036] As an example, when determining the mean value of the network parameter in the second time period based on multiple sampling values ​​and the weights corresponding to the multiple sampling values, the product of the sampling value and the weight corresponding to the sampling value can be determined for each sampling value to obtain a first product, and the ratio of the sum of the multiple first products to the sum of the weights of the multiple sampling values ​​is used as the mean value of the network parameter in the second time period.

[0037] As an example, the mean value of the network parameter in the second time period can be calculated by formula (1), where: represents the mean value of the network parameters in the nth second time period, represents the sample value collected at the i-th sampling point, represents the weight corresponding to the sample value collected at the i-th sampling point, Represents the weights and values ​​of multiple sample values, represents the product of the i-th sampling value and the weight corresponding to the i-th sampling value, that is, the first product, represents the sum of multiple first products, and m represents the number of sampling points or sampling values.

[0038] (1) The embodiment of the present application adopts a weighted sampling strategy based on the central sampling point for each second time period, assigns different weights to different sampling values, and obtains the mean value of the network parameters in each second time period based on the sampling values ​​and their corresponding weights, thereby avoiding excessive reliance on network status fluctuations at a certain moment, reducing the interference of instantaneous fluctuations on network quality, and effectively improving the accuracy and stability of network quality determination, better reflecting the overall quality of the network, making network quality determination more accurate and objective, thereby avoiding incorrect judgment of the network quality of the SIM card due to a single instantaneous network parameter, resulting in improper selection of the primary SIM card or communication interruption.

[0039] As an optional implementation, in the above S140, the weights corresponding to different second time periods may be determined in the following manner: according to the temporal sequence of the multiple second time periods, the multiple second time periods are numbered, the second time period closest to the current moment is recorded as the first second time period, and the nth second time period is numbered as n; For each second time period, based on the number and the decay coefficient of the second time period, determine the exponential decay weight of the second time period, where the decay coefficient is determined according to the usage scenario of the terminal device; The weight corresponding to the second time period is determined based on the ratio between the exponential decay weight of the second time period and the sum of the exponential decay weights of multiple second time periods.

[0040] As an example, the second time period that is closer to the current time point is arranged in front, and the second time period that is farther from the current time point is arranged in the back. When numbering multiple second time periods, they usually start from 1. The second time period closest to the current time point is the first second time period, numbered 1, and the other second time periods are numbered in chronological order. For example: Assume that the current time is T0, and there are three second time periods, namely: T1, T2, and T3, among which T1 is closest to T0 in time, and T3 is farthest from T0 in time, then, according to the chronological order, T1 is numbered 1, T2 is numbered 2, and T3 is numbered 3.

[0041] As an example, when determining the exponential decay weight of the second time period based on the number and decay coefficient of the second time period, the number and decay coefficient of the second time period can be used as exponents to obtain the exponential decay weight of the second time period through exponential calculation.

[0042] As an example, the exponential decay weight of the second time period can be calculated by formula (2), where: represents the exponential decay weight of the nth second time period, e (approximately equal to 2.71828) is the base of the natural logarithm, a represents the attenuation coefficient, and n represents the number of the nth second time period.

[0043] (2) As an example, when determining the weight corresponding to the second time period based on the ratio between the exponential decay weight of the second time period and the sum of the exponential decay weights of multiple second time periods, the exponential decay weights of each second time period can be first determined, and summed up to obtain the sum, and then for each second time period, the ratio between the exponential decay weight of the second time period and the sum is used as the weight corresponding to the second time period.

[0044] As an example, the weight corresponding to the second time period can be calculated by formula (3), where: represents the weight corresponding to the nth second time period, represents the exponential decay weight of the nth second time period, represents the sum of the exponential decay weights of multiple second time periods, and N represents the number of second time periods.

[0045] (3) The attenuation coefficient is usually in the range of 0.3 to 0.5. For real-time scenarios, such as video conferencing, it is necessary to increase the weight of the second time period that is closer to the current time point, and the attenuation coefficient is usually 0.5. For long-term stability scenarios, such as monitoring systems, it is necessary to balance the weight of the second time period, and the attenuation coefficient is usually 0.3. For example: Assuming there are 5 second time periods, numbered 1 to 5, if the attenuation coefficient is 0.5, the weight corresponding to each second time period is calculated according to the above formulas (2) and (3): =[0.50, 0.30, 0.15, 0.05, 0.00], if the attenuation coefficient is 0.3, the weight corresponding to each second time period is calculated according to the above formulas (2) and (3): =[0.35, 0.30, 0.20, 0.10, 0.05].

[0046] The embodiment of the present application calculates the weight corresponding to each second time period according to the time span and attenuation coefficient between the second time period and the current time point, so as to effectively process and optimize the resource allocation and decision-making process of the terminal device in different time periods. By sorting multiple time periods and calculating the weight of each time period according to time decay, the terminal device can more accurately determine and give priority to the weight of the time period closer to the current moment, gradually reduce the dependence on the distant time period, and avoid the unreasonable influence of the data of the distant time period on the decision. Through the weight allocation mechanism based on time decay, the resource scheduling and response efficiency of the terminal device can be improved, especially in a dynamic environment, it can better adapt to the actual use scenarios of the terminal device, optimize the use of resources, and improve the performance and response speed of the overall system.

[0047] As an example, in the above S140, for each parameter type, based on the average value of the network parameters of the parameter type in multiple second time periods and the weights corresponding to the multiple second time periods, when determining the network quality corresponding to the parameter type, for each second time period, the product of the average value of the network parameters of the parameter type in the second time period and the weight corresponding to the second time period can be determined to obtain the second product, and the second products corresponding to each second time period are added to obtain the network quality corresponding to the parameter type.

[0048] As an example, the network quality corresponding to the above parameter types can be calculated by formula (4), where: Indicates the network quality corresponding to the parameter type. represents the mean value of the network parameters in the nth second time period, represents the weight corresponding to the nth second time period, represents the second product obtained based on the mean of the nth second time period and its corresponding weight, and N represents the number of second time periods.

[0049] (4) Here, a complete example is used to illustrate the process of determining the network quality corresponding to each parameter type in the above S140, which should not be understood as limiting the method of the embodiment of the present application. For example: for the signal strength of one of the SIM cards, as shown in Table 1, the duration (hours), number (n), signal strength average, weight ( ) is shown in Table 1, where the weight ( ) is calculated based on the number n according to formula (2) and formula (3), and the attenuation coefficient a=0.3. The signal strength mean is calculated according to formula (1), and the second time period is divided by the logarithmic growth method. For details, please refer to the content of the previous embodiment example, which will not be repeated here. According to formula (4), the network quality corresponding to the signal strength is calculated as: =(80×0.35)+(75×0.30)+(70×0.20)+(65×0.10)+(60×0.05)=28+22.5+14+6.5+3=74.0. Similarly, the network quality corresponding to other parameter types can be obtained, such as the network quality corresponding to network delay and the network quality corresponding to packet loss rate.

[0050] Table 1

[0051] As an optional implementation, when determining the network quality of the SIM card based on the network quality corresponding to different network parameter types in S142, the following steps may be included: determining weights corresponding to different parameter types according to a usage scenario of the terminal device; The network quality of the SIMS card is determined based on the network qualities corresponding to the various parameter types and the weights corresponding to the various parameter types.

[0052] As an example, the usage scenarios of terminal devices include general scenarios, scenarios with high real-time requirements, scenarios with high bandwidth requirements, and stability priority. Among them, general scenarios are applicable to most scenarios, and the target requirement is to comprehensively evaluate network quality. Scenarios with high real-time requirements, such as video conferencing and voice calls, target requirements are to ensure low latency and network stability. Scenarios with high bandwidth requirements, such as file transfer and cloud storage, target requirements are to improve data throughput and transmission reliability. Scenarios with stability priority, such as remote monitoring and the Internet of Things, target requirements are to ensure the stability of long-term network connections.

[0053] As an example, when the parameter types include signal strength, network delay, packet loss rate, data transmission rate and network jitter, if the usage scenario of the terminal device is a general scenario, then the weight distribution is: signal strength 30%, network delay 25%, packet loss rate 20%, data transmission rate 15%, network jitter 10%; if the usage scenario of the terminal device is a scenario with high real-time requirements, then the weight distribution is: signal strength 20%, network delay 40%, packet loss rate 15%, data transmission rate 10%, network jitter 15%; if the usage scenario of the terminal device is a scenario with high bandwidth requirements, then the weight distribution is: signal strength 25%, network delay 15%, packet loss rate 20%, data transmission rate 30%, network jitter 10%; if the usage scenario of the terminal device is a scenario with stability priority, then the weight distribution is: signal strength 35%, network delay 20%, packet loss rate 25%, data transmission rate 10%, network jitter 10%.

[0054] Here, an example is used to illustrate the process of determining the network quality of the SIMS card based on the network quality corresponding to the multiple parameter types and the weights corresponding to the multiple parameter types, which should not be understood as a limitation on the method of the embodiment of the present application. For example: Assuming that the signal strength of the SIM card is A, the network delay is B, the packet loss rate is C, the data transmission rate is D, and the network jitter is E based on the parameter data of the SIM card in the past period of time, if the weight distribution of each parameter type in the general scenario is 30% signal strength, 25% network delay, 20% packet loss rate, 15% data transmission rate, and network jitter, then the final network quality of the SIM card is 30%A+25%B+20%C+15%D+15%E.

[0055] The embodiment of the present application determines the network quality of the SIM card based on the network quality corresponding to different parameter types, determines the weights corresponding to different parameter types in combination with the usage scenarios of the terminal device, and then determines the network quality of the SIM card. In combination with the usage scenario characteristics of the parameters, a more accurate network quality determination method is provided for the terminal device, which fully considers the influence of different network parameters on the network quality in the actual usage scenarios of the user. By introducing the weights of different network parameter types, the influence of each network parameter on the network quality of the SIM card can be refined according to the specific usage scenarios of the terminal device, which can avoid the judgment of the entire network quality dominated by a single instantaneous network parameter. At the same time, the adaptive adjustment of weight distribution is realized, making the method more flexible and in line with actual needs, and can more accurately reflect the user's real experience of network quality in different application scenarios, thereby improving the rationality of SIM card selection and the network optimization capability of the terminal device, thereby providing a more accurate decision-making basis for SIM card selection, effectively solving the problem that the traditional method ignores multi-dimensional network quality factors, making the network quality evaluation more scientific and reasonable, and helping the terminal device to select the optimal SIM card according to actual needs, improving communication efficiency and user experience.

[0056] S106: If the network quality of the at least one SIM card is higher than the network quality of the first SIM card currently serving as the primary SIM card, select a second SIM card from the at least one SIM card and set it as the primary SIM card.

[0057] The primary SIM card refers to the SIM card used to provide the main network connection in the terminal device, and is used for most communication operations, such as making calls, sending text messages, surfing the Internet, etc. In the embodiment of the present application, the terminal device can be equipped with multiple SIM cards, one of which is used as the primary SIM card.

[0058] As an example, if there are multiple SIM cards with higher network quality than the first SIM card currently serving as the primary SIM card, the SIM card with the highest network quality may be selected as the second SIM card, and the second SIM card may be set as the primary card.

[0059] As another example, after the above S104, if the network quality of the first SIM card currently serving as the primary SIM card is the highest, the current primary SIM card continues to be used without switching the SIM card.

[0060] As an example, after the above S104, a second SIM card may be selected from at least one SIM card whose network quality is higher than a preset quality threshold and set as the primary SIM card.

[0061] The embodiment of the present application obtains the network parameters of each SIM card within a certain period of time, determines the network quality of each SIM card based on the obtained network parameters, and compares the network quality of each SIM card. Among at least one SIM card whose network quality is higher than the network quality of the first SIM card currently serving as the primary SIM card, the second SIM card is selected to be set as the primary SIM card, thereby achieving the determination and switching of the primary SIM card. Determining the primary SIM card based on long-term network parameters can ensure that the network quality of the primary SIM card is in a stable state for a long time. Compared with the switching method based on the instantaneous network, it can avoid frequent switching of the primary SIM card, thereby maintaining the communication stability and network availability of the device, and effectively improving the user experience in multi-SIM card terminal devices.

[0062] As an example, when switching the main SIM card according to the long-term network parameters, the frequency can be preset to switch once every period of time. For example, once a day, a week or a month. The adjustment of the long-term network parameter switching frequency can flexibly control the sensitivity of the terminal device to switch the main SIM card and adapt to changes in network conditions in different environments.

[0063] As another optional implementation, after the above S106, the method may further include the following steps: selecting a SIM card from a plurality of SIM cards as a secondary SIM card; In response to monitoring that the network parameter of the second SIM card does not meet the preset communication condition, the secondary SIM card is set as the primary SIM card.

[0064] The secondary SIM card serves as a backup SIM card for the primary SIM card and is used to provide network support when the network quality of the primary SIM card does not meet the communication conditions.

[0065] As an example, in the above-mentioned selecting one SIM card from the multiple SIM cards as the secondary SIM card, a third SIM card whose network quality is second only to that of the second SIM card may be determined as the secondary SIM card.

[0066] In the embodiment of the present application, each time after a new primary SIM card is set according to the network parameters within the first time period, the primary SIM card will be monitored in real time. When it is detected that the network parameters of the primary SIM card do not meet the preset parameter threshold, the secondary SIM card will be temporarily set as the primary SIM card to provide the main network connection. After the network parameters of the original primary SIM card return to normal, it will be switched back. At the same time, each time after a new primary SIM card is set, the embodiment of the present application will also perform heartbeat detection between the terminal device and the server through the network connection of the primary SIM card. The terminal device continuously and periodically sends a signal to the server. After receiving the signal, the server will feed back a corresponding signal to the terminal device. If the terminal device does not receive feedback within the preset time, it is confirmed that the primary SIM card is offline. At this time, the secondary SIM card can be temporarily set as the primary SIM card to provide the main network connection. After the network parameters of the original primary SIM card return to normal, it will be switched back. The embodiment of the present application ensures that the device always maintains the best communication performance in different network environments by intelligently monitoring and dynamically switching the primary and secondary SIM cards. When the network quality of at least one SIM card is higher than that of the first SIM card currently used as the primary SIM card, the second SIM card with better network quality will be automatically selected as the new primary SIM card, and one of the multiple SIM cards will be selected as the secondary SIM card, and when the network parameters of the second SIM card are detected to not meet the communication conditions, the secondary SIM card will be switched to the primary SIM card. By selecting the primary SIM card according to the real-time network quality, the terminal device is always in the best network environment, reducing the problem of communication interruption or poor quality. By dynamically monitoring the network parameters and automatically switching the primary SIM card according to the conditions, human intervention is reduced, the automation and real-time response capabilities of network switching are improved, and the flexibility and reliability of network switching can be enhanced. Considering that different SIM cards may be provided by different network operators, through the dynamic adjustment of the primary and secondary SIM cards, the device can intelligently select and switch the network that best suits the current usage scenario, further improving the adaptability of the terminal device in a complex network environment, ensuring that the terminal device can always maintain the best network connection state under different network conditions, and improving the communication stability of the terminal device and the user experience.

[0067] As an optional implementation manner, when the network parameters of the second SIM card include network parameters of multiple parameter types, the above communication conditions include: the network parameter of any parameter type of the second SIM card is lower than a preset parameter threshold, and the duration of being lower than the preset parameter threshold exceeds a preset window size; or, When a heartbeat detection is performed between the terminal device and the server through the network of the second SIM card, the server does not return a response signal within a preset time range.

[0068] As an example, a certain number of heartbeats can be preset. If the terminal device sends multiple signals continuously and does not receive a response signal returned by the server, the secondary SIM card is set as the primary SIM card.

[0069] Here is an example to illustrate the situation where the network parameter of any parameter type of the above-mentioned second SIM card is lower than the preset parameter threshold, and the duration of being lower than the preset parameter threshold exceeds the preset window size. For example: Assume that in a dual-SIM dual-standby mobile phone, the second SIM card is the current main SIM card and is using a 4G network connection. The network parameters include signal strength, delay, bandwidth, etc. If the signal strength of the second SIM card is lower than the preset signal strength threshold, and the signal strength remains at this level below the threshold for 10 consecutive minutes, it means that the network quality of the current main SIM card does not meet the requirements, and a switching operation will be triggered to set the alternative SIM card as the main SIM card. When the network parameters of the original main SIM card return to above the preset parameter threshold, it will be set back to the main SIM card.

[0070] By setting parameter thresholds and duration windows, the embodiment of the present application can quickly determine whether the second SIM card can continue to provide services as the main SIM card when the network quality of the second SIM card decreases. When the network parameters of any parameter type are continuously lower than the preset parameter threshold for a certain period of time, the system will automatically identify and take switching measures to avoid affecting the user's communication quality due to network instability, thereby realizing dynamic switching of the main SIM card. The health status of the network is further evaluated by heartbeat detection. If the heartbeat detection between the terminal device and the server fails to respond within the preset time, the switching operation will be triggered, and the network connection interruption or instability can be captured in time, and the switching process will be automatically started to ensure that the communication is not interrupted, and the network failure can be detected in advance. By combining a variety of communication conditions to judge the network quality of the main SIM card, the SIM card switching is more intelligent and reliable, and multiple factors can be comprehensively considered to improve the accuracy of the switching, thereby improving the stability, reliability and user experience of the communication, thereby effectively improving the self-adaptation ability of the SIM card in a multi-network environment, and avoiding communication interruption or poor quality problems caused by the decline in network quality.

[0071] As another optional implementation, before the secondary SIM card is set as the primary SIM card, the method may further include the following steps: determining whether the cooling time exceeds a preset time, where the cooling time is the time between the current time point and the time point when the secondary SIM card was last set as the primary SIM card; The step of setting the secondary SIM card as the primary SIM card comprises: If the cooling time exceeds the preset time, the secondary SIM card is set as the primary SIM card.

[0072] After determining the main SIM card, in order to avoid frequent use of the secondary SIM card, the embodiment of the present application sets a cooling mechanism to avoid frequent switching of the secondary main SIM card. For example: Assuming the preset time is 30 minutes, if the secondary SIM card is set as the main SIM card at 10:00 AM, and at 10:25 AM, the network quality of the original main SIM card has been restored and it is switched back to the main SIM card, at this time, the cooling time is 25 minutes. If at 11:15 AM, if the system detects a network quality problem, the secondary SIM card may be considered as the main SIM card again. At this time, the cooling time is from the time point 10:00 AM when the secondary SIM card was last switched to the main SIM card to the current time point 11:15 AM, a total of 50 minutes, which exceeds the preset time of 30 minutes. Therefore, the secondary SIM card can be allowed to be reset to the main SIM card.

[0073] The embodiment of the present application introduces a cooling mechanism, requiring that a certain time interval must be met before the secondary SIM card is set as the primary SIM card, effectively avoiding network instability and reduced user experience caused by frequent switching, so that the system can adaptively adjust the switching frequency of the SIM card according to the network quality and device status, thereby optimizing the network quality while ensuring the rationality of the switching. Only after the cooling time exceeds the preset time, the secondary SIM card is allowed to become the primary SIM card again, which can avoid the negative impact of frequent network switching on the device and improve the adaptability of the terminal device to complex network environments. By reasonably setting the cooling time, users will not encounter interference caused by frequent switching of primary and secondary SIM cards when using multi-SIM card devices, and the terminal equipment can operate more smoothly in multiple network environments, ensuring stable communication quality, reducing unnecessary switching, ensuring the continuity of communication quality, and ultimately improving the user's communication experience.

[0074] As an optional implementation, after the above S104, the method may further include the following steps: if the network quality of multiple SIM cards is lower than a preset quality threshold, the current status information of the terminal device is reported to the server for alarm through the Beidou short message mode.

[0075] The preset quality threshold is a standard value set to measure the network quality of the SIM card. The preset quality threshold defines a benchmark. Only when the network quality is lower than the threshold will the subsequent alarm and other operations be triggered, and then the Beidou short message mode will be used to ensure the effective use of satellite resources. If the network quality of multiple SIM cards is lower than the threshold, it means that there is a serious problem with the network connection of the terminal device, and the terminal device needs to take corresponding emergency measures, such as reporting the current status information of the terminal device to the server through the Beidou short message mode.

[0076] Beidou short message mode refers to a mode of information transmission through satellite communication using the Beidou satellite navigation system. Beidou short message mode allows terminal devices to send messages to servers or other devices through Beidou satellites without a SIM card to provide network connection. As an example, the information to be transmitted can be compressed and optimized to ensure that as much key information as possible is transmitted within the minimum amount of data, reducing the time and cost of Beidou communication.

[0077] Status data refers to the current working status information of the terminal device. As an example, the status information may include the basic operating status of the device, such as battery power, whether the device is operating normally, and other information, as well as status related to network connection, such as network signal strength, network connection quality, location data, etc. As an example, the status data may include information such as the fault type, network environment, and SIM card status of the terminal device. As an example, the status information can be obtained in real time based on the sensors of the terminal device, the network parameters of the SIM card, and other detection means. In an embodiment of the present application, timely reporting of status data for alarm enables relevant personnel or systems to troubleshoot, process, or take emergency measures. Alarm refers to an alarm or notification mechanism triggered when a system or device detects a certain abnormal situation.

[0078] The embodiment of the present application can effectively improve the emergency response capability of the terminal device in an environment where the network connection is unstable or the cellular network cannot be used by triggering a mechanism to report the device status information and issue an alarm through the Beidou short message mode when the network quality of multiple SIM cards is lower than the preset quality threshold. When the network quality of multiple SIM cards is lower than the preset quality threshold, the alarm mechanism based on the cellular network cannot work normally. By introducing the Beidou short message mode, the terminal device can still rely on the Beidou satellite to report status information and issue an alarm even in the absence of a cellular network. It can not only ensure that the terminal device can report its status information in time when the network quality deteriorates, but also help the system to detect problems in time and take emergency measures, avoiding operation interruptions or accidents caused by network quality problems, thereby improving the reliability and security of the system.

[0079] As an example, after the above S104, the level of each SIM card can also be determined according to the network quality of each SIM card. When the terminal device is restarted and powered on again, the primary SIM card to be used can be determined according to the level of each SIM card, so as to avoid the situation where the previously recorded network parameters are lost and the primary SIM card cannot be reset according to the long-term network parameters.

[0080] As an example, in the initial stage of the terminal device, if the terminal device does not save historical network parameters, the user can manually select the primary SIM card. Specifically, the terminal device accepts the user's setting command and sets the corresponding SIM card as the primary SIM card.

[0081] As an example, the preset duration, preset threshold, etc. in the above embodiments can be dynamically adjusted and set according to needs to meet the communication needs in special scenarios.

[0082] The following is a complete example to illustrate the SIM card switching method provided in the embodiment of the present application, which should not be understood as limiting the method of the embodiment of the present application. Figure 2 , is a second flow chart of a SIM card switching method provided by an embodiment of the present application. Figure 2 As shown, first, multiple SIM cards are loaded onto a terminal device and the terminal device is started. At the beginning, a SIM card is randomly selected by default and set as the main SIM card. Then, the network status of each SIM card is monitored, and the network parameters of each SIM card, such as signal strength, delay, packet loss rate, data rate and other parameters, are periodically recorded and saved. After monitoring for a period of time, the network parameters in the past period of time are pulled, and the network quality of each SIM card is determined according to the network parameters of each SIM card. According to the needs, such as whether the accumulated time of the network parameters meets the preset time, it is determined whether to update the latest network quality of each SIM card. If not updated, the current main SIM card is kept. , no switching is performed; if it is determined to be updated, the network quality of each SIM card is compared, such as sorting the SIM cards according to the network quality, etc., and according to the comparison result, it is determined whether to switch the main SIM card. If there is at least one SIM card with a network quality higher than the network quality of the first SIM card currently serving as the main SIM card, a switching operation is performed, and a target SIM card is set as the main SIM card. The target SIM card can be any SIM card selected from the at least one SIM card, or can be a SIM card with the highest network quality; if the comparison result indicates that the network quality of the first SIM card currently serving as the main SIM card is the highest, the current main SIM card is kept without switching.

[0083] After determining the network quality of each SIM card based on the network parameters in the past period of time and determining the SIM card, you also need to select a SIM card as a secondary SIM card to serve as a backup for the primary SIM card. During the communication process, if the network quality of the primary SIM card is poor, you can use the secondary SIM card for communication. After the network quality of the primary SIM card returns to normal, you can continue to use the primary SIM card for communication. Figure 3 , is a flow chart of a SIM card switching method provided in an embodiment of the present application. Figure 3As shown, first, the main SIM card is used for communication, and the network parameters of the main SIM card are monitored in real time. Whether the communication of the main SIM card is stable is determined according to the real-time measured network parameters. If the real-time network parameters of the main SIM card are all higher than the preset parameter threshold, and the heartbeat detection between the terminal device and the server is also in normal state through the network connection of the main SIM card, it means that the communication of the main SIM card is stable, and the terminal device can continue to use the main SIM card for communication; if any real-time network parameter of the main SIM card is lower than the preset parameter threshold and the time period below the preset parameter threshold exceeds the preset time period, or the heartbeat detection between the terminal device and the server is interrupted through the network of the main SIM card, and the terminal device does not receive a response signal from the server within the specified time, it means that the communication of the main SIM card is unstable, and the secondary SIM card can be used for communication. When using the secondary SIM card for communication, it is also necessary to determine whether the secondary SIM card is available, such as whether the signal strength is appropriate, whether the cooling time exceeds the preset time, etc. If it is not available, continue to use the primary SIM card for communication; if it is available, use the secondary SIM card for communication, and then periodically detect the network status of the primary SIM card to determine whether the network of the primary SIM card is restored. If restored, use the primary SIM card for communication; if not restored, continue to use the secondary SIM card for communication.

[0084] If the network quality of each SIM card is lower than the preset threshold, this situation needs to be reported and an alarm is issued. For details, please refer to Figure 4 , is a fourth flow chart of a SIM card switching method provided in an embodiment of the present application. Figure 4 As shown, first, each SIM card is monitored in real time to determine whether the network quality of each SIM card is lower than the preset quality threshold. If not, the main SIM card is determined and communication is performed; if so, the Beidou short message mode is started, and the status information of the terminal device is sent to the server for alarm, and then periodic detection is performed to determine whether the network quality of each SIM card is restored. If not, the Beidou short message is continued to be sent; if they are all restored, the Beidou short message mode is turned off, and the main SIM card is continued to be determined for communication.

[0085] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0086] With the above Figure 5Corresponding to the SIM card switching method shown, the present application embodiment also provides a SIM card switching device. Figure 5 , is a structural schematic diagram of a SIM card switching device 500 provided in an embodiment of the present application. The device 500 is applied to a terminal device equipped with multiple SIM cards, including: an acquisition unit 510, a determination unit 520, and a switching unit 530.

[0087] The acquisition unit 510 is configured to acquire network parameters of each SIM card in a first time period.

[0088] The determining unit 520 is configured to determine, for each SIM card, the network quality of the SIM card based on the network parameters of the SIM card in the first time period.

[0089] The switching unit 530 is configured to select a second SIM card from the at least one SIM card and set it as the primary SIM card if the network quality of the at least one SIM card is higher than the network quality of the first SIM card currently serving as the primary SIM card.

[0090] Optionally, when the first time period includes multiple second time periods, the network parameter of the SIM card in the first time period includes an average of the network parameter in different second time periods, and the network parameter of the SIM card in the first time period includes multiple parameter types, the determining unit 520 may perform the following steps when determining the network quality of the SIM card based on the network parameter of the SIM card in the first time period: for each parameter type, based on the average of the network parameter of the parameter type in the multiple second time periods and the weights corresponding to each of the multiple second time periods, determine the network quality corresponding to the parameter type; The network quality of the SIM card is determined based on the network qualities corresponding to the different network parameter types.

[0091] Optionally, the apparatus 500 further includes: a first calculation unit; The first calculation unit is used to perform the following steps to determine the average value of the network parameter in different second time periods: for each second time period, based on a preset sampling period, sampling the network parameter in the second time period to obtain multiple sampling values; For each sampling point, determine a weight corresponding to a sampling value collected at the sampling point based on a distance of the sampling point from a central sampling point, where the central sampling point is a sampling point located at the center of the second time period; Based on the multiple sampling values ​​and the weights corresponding to the multiple sampling values, an average value of the network parameter in the second time period is determined.

[0092] Optionally, the apparatus 500 further includes: a second computing unit; The second calculation unit is used to perform the following steps, with weights corresponding to different second time periods: numbering the multiple second time periods according to the temporal sequence of the multiple second time periods, recording the second time period closest to the current moment as the first second time period, and the nth second time period as n; For each second time period, determining an exponential decay weight of the second time period based on the number and the decay coefficient of the second time period, where the decay coefficient is determined according to a usage scenario of the terminal device; The weight corresponding to the second time period is determined based on the ratio of the exponential decay weight of the second time period to the sum of the exponential decay weights of the plurality of second time periods.

[0093] Optionally, when determining the network quality of the SIM card based on the network quality corresponding to different network parameter types, the determining unit 520 may perform the following steps: determining weights corresponding to different parameter types according to a usage scenario of the terminal device; The network quality of the SIMS card is determined based on the network qualities corresponding to the multiple parameter types and the weights corresponding to the multiple parameter types.

[0094] Optionally, the apparatus 500 further includes: a response unit; The responding unit is configured to, after the switching unit 530 selects a second SIM card from the at least one SIM card to set as the primary SIM card if the network quality of the at least one SIM card is higher than the network quality of the first SIM card currently serving as the primary SIM card, perform the following steps: select a SIM card from the multiple SIM cards as the secondary SIM card; In response to monitoring that the network parameter of the second SIM card does not meet a preset communication condition, the secondary SIM card is set as a primary SIM card.

[0095] Optionally, in the case where the network parameters of the second SIM card include network parameters of multiple parameter types, the communication condition includes: a network parameter of any parameter type of the second SIM card is lower than a preset parameter threshold, and the duration of being lower than the preset parameter threshold continuously exceeds a preset window size; or, When heartbeat detection is performed between the terminal device and the server through the network of the second SIM card, the server does not return a response signal within a preset time range.

[0096] Optionally, before setting the secondary SIM card as the primary SIM card, the response unit may further perform the following steps: determining whether a cooling time exceeds a preset time, where the cooling time is the time between the current time point and the time point when the secondary SIM card was last set as the primary SIM card; When setting the secondary SIM card as the primary SIM card, the response unit may perform the following steps: if the cooling time exceeds the preset time, setting the secondary SIM card as the primary SIM card.

[0097] Optionally, the apparatus 500 further includes: a reporting unit; The reporting unit is used to perform the following steps after the determination unit 520 determines the network quality of the SIM card for each SIM card based on the network parameters of the SIM card in the first time period: if the network qualities of the multiple SIM cards are all lower than a preset quality threshold, report the current status information of the terminal device to the server for an alarm through the Beidou short message mode.

[0098] Obviously, the SIM card switching device provided in the embodiment of the present application can be used as Figure 1 The execution body of the SIM card switching method shown is, for example Figure 1 In the SIM card switching method shown in FIG. 1 , step S102 may be performed by Figure 5 The acquisition unit 510 in the SIM card switching device shown in FIG. 1 is executed, and step S104 can be performed by Figure 5 The determining unit 520 in the SIM card switching device shown in FIG. 1 is executed, and step S106 can be performed by Figure 5 The switching unit 530 in the SIM card switching device shown is executed.

[0099] According to another embodiment of the present application, Figure 5 The various units in the SIM card switching device shown can be separately or completely combined into one or several other units to form, or one (some) of the units can be further divided into multiple functionally smaller units to form, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. The above-mentioned units are divided based on logical functions. In practical applications, the functions of one unit can also be implemented by multiple units, or the functions of multiple units can be implemented by one unit. In other embodiments of the present application, the SIM card switching device may also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented by the collaboration of multiple units.

[0100] According to another embodiment of the present application, the program can be executed on a general computing device such as a computer including a central processing unit (CPU), a random access memory (RAM), a read-only memory (ROM), and other processing elements and storage elements. Figure 1 A computer program (including program code) for each step involved in the corresponding method shown in FIG. Figure 5 The SIM card switching device shown in the embodiment of the present application is used to implement the SIM card switching method of the embodiment of the present application. The computer program can be recorded on a computer-readable storage medium, for example, and transferred to an electronic device through the computer-readable storage medium and run therein.

[0101] Figure 6 This is a schematic diagram of the structure of a terminal device according to an embodiment of the present application. Figure 6 At the hardware level, the terminal device has multiple SIM cards built in, including a processor, and optionally an internal bus, a network interface, and a memory. The memory may include a memory, such as a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage. Of course, the terminal device may also include hardware required for other services.

[0102] The processor, network interface and memory can be interconnected through an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0103] The memory is used to store the program. Specifically, the program may include a program code, and the program code includes a computer operation instruction. The memory may include a memory and a non-volatile memory, and provides instructions and data to the processor.

[0104] The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it, forming a data processing device at the logical level. The processor executes the program stored in the memory and is specifically used to perform the following operations: Obtaining network parameters of each SIM card in a first time period; For each SIM card, determining a network quality of the SIM card based on a network parameter of the SIM card in the first time period; If the network quality of at least one SIM card is higher than the network quality of the first SIM card currently serving as the primary SIM card, a second SIM card is selected from the at least one SIM card and set as the primary SIM card.

[0105] The above application Figure 5 The method performed by the SIM card switching device disclosed in the illustrated embodiment can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor or an instruction in the form of software. The above processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module can be located in a storage medium mature in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.

[0106] The terminal device can also perform Figure 1 The method and the device are implemented in Figure 1 , Figure 5 The functions of the illustrated embodiment will not be described in detail in the embodiments of the present application.

[0107] Of course, in addition to software implementation methods, the terminal device of the present application does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc. That is to say, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0108] The embodiment of the present application also provides a computer-readable storage medium, which stores one or more programs, wherein the one or more programs include instructions, which, when executed by a portable electronic device including a plurality of application programs, enable the portable electronic device to execute Figure 1 The method of the embodiment shown is specifically used to perform the following operations: Obtaining network parameters of each SIM card in a first time period; For each SIM card, determining a network quality of the SIM card based on a network parameter of the SIM card in the first time period; If the network quality of at least one SIM card is higher than the network quality of the first SIM card currently serving as the primary SIM card, a second SIM card is selected from the at least one SIM card and set as the primary SIM card.

[0109] In short, the above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

[0110] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0111] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0112] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0113] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

Claims

1. A SIM card switching method, characterized in that: Applicable to terminal devices equipped with multiple SIM cards, including: Obtaining network parameters of each SIM card in a first time period; For each SIM card, determining a network quality of the SIM card based on a network parameter of the SIM card in the first time period; If the network quality of at least one SIM card is higher than the network quality of the first SIM card currently serving as the primary SIM card, a second SIM card is selected from the at least one SIM card and set as the primary SIM card.

2. The method according to claim 1, characterized in that The first time period includes multiple second time periods, the network parameters of the SIM card in the first time period include average values ​​of the network parameters in different second time periods, and the network parameters of the SIM card in the first time period include multiple parameter types; The determining the network quality of the SIM card based on the network parameters of the SIM card in the first time period includes: For each parameter type, determining a network quality corresponding to the parameter type based on an average of the network parameter of the parameter type in the multiple second time periods and weights corresponding to each of the multiple second time periods; The network quality of the SIM card is determined based on the network qualities corresponding to the different network parameter types.

3. The method according to claim 2, characterized in that The average value of the network parameter in different second time periods is determined by: For each second time period, based on a preset sampling period, sampling the network parameters in the second time period to obtain multiple sampling values; For each sampling point, determine a weight corresponding to a sampling value collected at the sampling point based on a distance of the sampling point from a central sampling point, where the central sampling point is a sampling point located at the center of the second time period; Based on the multiple sampling values ​​and the weights corresponding to the multiple sampling values, an average value of the network parameter in the second time period is determined.

4. The method according to claim 2, characterized in that: The weights corresponding to different second time periods are determined in the following way: According to the temporal sequence of the multiple second time periods, the multiple second time periods are numbered, the second time period closest to the current moment is recorded as the first second time period, and the nth second time period is numbered as n; For each second time period, determining an exponential decay weight of the second time period based on the number and the decay coefficient of the second time period, where the decay coefficient is determined according to a usage scenario of the terminal device; The weight corresponding to the second time period is determined based on the ratio of the exponential decay weight of the second time period to the sum of the exponential decay weights of the plurality of second time periods.

5. The method according to claim 2, characterized in that: The determining the network quality of the SIM card based on the network quality corresponding to different network parameter types includes: Determining weights corresponding to different parameter types according to the usage scenario of the terminal device; The network quality of the SIMS card is determined based on the network qualities corresponding to the multiple parameter types and the weights corresponding to the multiple parameter types.

6. The method according to claim 1, characterized in that After selecting a second SIM card from the at least one SIM card to be set as the primary SIM card if the network quality of the at least one SIM card is higher than the network quality of the first SIM card currently serving as the primary SIM card, the method further includes: Selecting a SIM card from the multiple SIM cards as a secondary SIM card; In response to monitoring that the network parameter of the second SIM card does not meet a preset communication condition, the secondary SIM card is set as a primary SIM card.

7. The method according to claim 6, characterized in that The network parameters of the second SIM card include network parameters of multiple parameter types; The communication conditions include: A network parameter of any parameter type of the second SIM card is lower than a preset parameter threshold, and the duration of being lower than the preset parameter threshold exceeds a preset window size; or, When heartbeat detection is performed between the terminal device and the server through the network of the second SIM card, the server does not return a response signal within a preset time range.

8. The method according to claim 6, characterized in that Before setting the secondary SIM card as the primary SIM card, the method further includes: Determine whether the cooling time exceeds a preset time, where the cooling time is the time between the current time point and the time point when the secondary SIM card was last set as the primary SIM card; The step of setting the secondary SIM card as the primary SIM card comprises: If the cooling time exceeds the preset time, the secondary SIM card is set as the primary SIM card.

9. The method according to claim 1, characterized in that: After determining, for each SIM card, the network quality of the SIM card based on the network parameters of the SIM card in the first time period, the method further includes: If the network quality of the multiple SIM cards is lower than the preset quality threshold, the current status information of the terminal device is reported to the server for alarm through the Beidou short message mode.

10. A terminal device, characterized in that: The terminal device has multiple SIM cards built in, including: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions, and when the instructions are executed, the processor performs the following operations: Obtaining network parameters of each SIM card in a first time period; For each SIM card, determining a network quality of the SIM card based on a network parameter of the SIM card in the first time period; If the network quality of at least one SIM card is higher than the network quality of the first SIM card currently serving as the primary SIM card, a second SIM card is selected from the at least one SIM card and set as the primary SIM card.

Citation Information

Cited By

  • Multi-4G card automatic identification switching method

    CN121692131A

  • Dual-card single-pass communication control method and system

    CN121968228A

  • Dual card single access communication control method and system

    CN121968228B