Processing method and device for erasing and writing operation of SIM card, electronic equipment and readable medium

By starting the protection mode in the preset scenario of the SIM card terminal detection and cacheing data locally, the number of times of rewritten by the SIM card is reduced, and the problems of shortening of life and increasing maintenance costs caused by frequent rewritten are solved, and the long life and stable operation of the SIM card are achieved.

CN120277010APending Publication Date: 2025-07-08FIBOCOM WIRELESS
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510287377.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-11
Publication Date
2025-07-08

AI Technical Summary

Technical Problem

Frequent and unnecessary SIM card rewritten operations will shorten the service life of the SIM card and increase the maintenance costs of the equipment and the potential risk of service interruptions.

Method used

By detecting whether the SIM card terminal is in a preset scenario, start the protection mode and turn on the timer. When the timer's timer is less than the preset time, the data to be erased is stored in the local cache. When the timer's timer is equal to the preset time, the target erasing operation is performed on the SIM card using the local cached data.

Benefits of technology

It reduces the number of times the SIM card is erased, extends the service life of the SIM card, and reduces the maintenance cost of the equipment and the risk of service interruption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120277010A_ABST
    Figure CN120277010A_ABST
Patent Text Reader

Abstract

The invention relates to an SIM card erasing operation processing method and device, electronic equipment and a readable medium, and the method comprises the steps: detecting whether an SIM card terminal is in a preset scene at present, and the preset scene is a scene in which an SIM card needs to be erased frequently; if it is determined that the SIM card terminal is currently in the preset scene, starting an SIM card protection mode and starting a timer; when the timing duration of the timer is less than a preset duration, storing the first to-be-erased data into a local cache; and when the timing duration of the timer is equal to the preset duration, executing the target erasing operation on the SIM card by using the locally cached first to-be-erased data. The problem that the service life of the SIM card is shortened due to frequent and unnecessary SIM card erasing and writing is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technologies, and in particular, to a method, apparatus, electronic device, and readable medium for processing SIM card writing and erasing operations. Background Art

[0002] A SIM (subscriber identification module) is an identification card used to uniquely identify a mobile user in a cellular mobile communication system. The SIM card stores user data, authentication methods, and keys, which can be used by the communication network to authenticate the user's identity.

[0003] When the SIM card terminal is in some specific scenarios, it is necessary to frequently perform SIM card file writing and erasing operations. For example, the terminal device is at the edge of two cells, traveling at high speed, in arrears, or frequently powered on and off. Even in these scenarios, some data does not need to be actually written to the SIM card immediately because it will soon be overwritten by new data. However, once the terminal device is in such a scenario, it will perform frequent and unnecessary writing and erasing operations on the SIM card. Frequent and unnecessary SIM card writing and erasing will shorten the service life of the SIM card, increase the maintenance cost of the device, and the risk of potential service interruption.

[0004] In response to the above problems, no effective solution has been proposed yet. Summary of the Invention

[0005] The present application provides a method, apparatus, electronic device, and readable medium for processing SIM card writing and erasing operations to solve the above technical problem of "frequent and unnecessary SIM card writing and erasing will shorten the service life of the SIM card".

[0006] According to one aspect of the embodiments of the present application, a method for processing SIM card writing and erasing operations is provided, including: detecting whether the SIM card terminal is currently in a preset scenario, where the preset scenario is a scenario that requires frequent writing and erasing of the SIM card; if it is determined that the SIM card terminal is currently in the preset scenario, starting the SIM card protection mode and turning on a timer; when the timing duration of the timer is less than a preset duration, storing first data to be written and erased in a local cache; when the timing duration of the timer is equal to the preset duration, performing a target writing and erasing operation on the SIM card using the first data to be written and erased in the local cache.

[0007] Optionally, detect whether the SIM card terminal is currently in a preset scenario, including: detecting whether the number of area switches of the SIM card terminal within the first time period is greater than the first number, and if the number of switches is greater than the first number, determining that the SIM card terminal is currently in the preset scenario; or detecting whether the number of consecutive switch-on and switch-off times of the SIM card terminal within the second time period is greater than the second number, and if the number of consecutive switch-on and switch-off times is greater than the second number, determining that the SIM card terminal is currently in the preset scenario.

[0008] Optionally, storing the first data to be erased and written into the local cache includes: obtaining the first data to be erased and written; setting a temporary flag bit in the local cache and performing a storage operation on the first data to be erased and written; when it is determined that the first data to be erased and written has been stored in the local cache, updating the temporary flag bit to the target flag bit.

[0009] Optionally, performing a target erasing and writing operation on the SIM card using the first data to be erased and written in the local cache includes: checking whether a target flag bit exists in the local cache; if the target flag bit exists in the local cache, reading the first data to be erased and written in the local cache; determining whether there is data in the SIM card that duplicates the data to be written in the first data to be erased and written; if there is no data in the SIM card that duplicates the data to be written, writing the data to be written into the SIM card.

[0010] Optionally, after performing the target erasing and writing operation on the SIM card using the first data to be erased and written in the local cache, the method further includes: clearing the timer and controlling the timer to start timing again; when the new timing duration of the timer is less than the preset duration, storing the second data to be erased and written into the local cache; when the new timing duration of the timer is equal to the preset duration, performing a target erasing and writing operation on the SIM card using the second data to be erased and written in the local cache.

[0011] Optionally, after starting the SIM card protection mode and starting the timer, the method further includes: monitoring whether the SIM card terminal is in a preset scenario; if it is monitored that the SIM card terminal is not in the preset scenario, turning off the SIM card protection mode; obtaining the current timing duration of the timer and turning off the timer; obtaining the third data to be erased and written stored in the local cache during the current timing duration; performing a target erasing and writing operation on the SIM card using the third data to be erased and written.

[0012] Optionally, the method further includes: when receiving a data reading instruction, determining the target file to be read corresponding to the data reading instruction; if the SIM card terminal is not in the SIM card protection mode, reading the target file from the SIM card, and if the SIM card terminal is in the SIM card protection mode, determining whether the target file belongs to a file to be protected; if the target file belongs to a file to be protected, reading the target file from the local cache and the SIM card, and if the target file does not belong to a file to be protected, reading the target file from the SIM card.

[0013] According to another aspect of the embodiments of the present application, the present application provides a processing device for SIM card writing and erasing operations, including: a detection module, configured to detect whether the SIM card terminal is currently in a preset scenario, where the preset scenario is a scenario that requires frequent writing and erasing of the SIM card; a start module, configured to start the SIM card protection mode and start a timer if it is determined that the SIM card terminal is currently in the preset scenario; a storage module, configured to store first data to be written and erased in a local cache when the timing duration of the timer is less than a preset duration; and a writing and erasing module, configured to perform a target writing and erasing operation on the SIM card by using the first data to be written and erased in the local cache when the timing duration of the timer is equal to the preset duration.

[0014] According to another aspect of the embodiments of the present application, the present application provides an electronic device, including a memory, a processor, a communication interface, and a communication bus. A computer program that can run on the processor is stored in the memory. The memory and the processor communicate through the communication bus and the communication interface. When the processor executes the computer program, the steps of the above method are implemented.

[0015] According to another aspect of the embodiments of the present application, the present application further provides a computer-readable medium having non-volatile program code executable by a processor, and the program code causes the processor to execute the above method.

[0016] The above technical solutions provided by the embodiments of the present application have the following advantages compared with the related technologies:

[0017] The present application provides a method for processing SIM card writing and erasing operations, including: detecting whether the SIM card terminal is currently in a preset scenario, where the preset scenario is a scenario that requires frequent writing and erasing of the SIM card; if it is determined that the SIM card terminal is currently in the preset scenario, starting the SIM card protection mode and starting a timer; when the timing duration of the timer is less than a preset duration, storing first data to be written and erased in a local cache; and when the timing duration of the timer is equal to the preset duration, performing a target writing and erasing operation on the SIM card by using the first data to be written and erased in the local cache. By adding a judgment mechanism to the scenario where the SIM card terminal is located, if the SIM card terminal is in a frequent writing and erasing scenario, the protection mode is enabled. In the protection mode, the data to be written and erased is first stored in the local cache, and then the writing and erasing operations are uniformly performed every certain duration, which can effectively reduce the number of writing and erasing times and solve the problem that frequent and unnecessary SIM card writing and erasing will shorten the service life of the SIM card. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and are used together with the specification to explain the principles of the present application.

[0019] To more clearly illustrate the technical solutions in the embodiments of the present application or the related art, the following will briefly introduce the accompanying drawings required for the description of the embodiments or the related art. Obviously, for those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0020] Figure 1 It is a flowchart of an optional processing method for SIM card writing and erasing operations provided according to an embodiment of the present application;

[0021] Figure 2 It is a flowchart of an optional data file reading method provided according to an embodiment of the present application;

[0022] Figure 3 It is a block diagram of an optional processing device for SIM card writing and erasing operations provided according to an embodiment of the present application;

[0023] Figure 4 It is a schematic structural diagram of an optional electronic device provided by an embodiment of the present application. Detailed implementation manners

[0024] To make the objectives, technical solutions, and advantages of the embodiments of the present application clearer, the following will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are some, but not all, of the embodiments of the present application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts belong to the scope of protection of the present application.

[0025] In subsequent descriptions, suffixes such as "module", "component", or "unit" used to represent elements are only for the convenience of description of the present application, and they have no specific meaning in themselves. Therefore, "module" and "component" can be used interchangeably.

[0026] A SIM (subscriber identification module) is an identification card used to uniquely identify a mobile user in a cellular mobile communication system. The SIM card stores user data, authentication methods, and keys, which can be used by the communication network to authenticate the user's identity.

[0027] When the SIM card terminal is in some specific scenarios, it is necessary to frequently perform SIM card file erasing and writing operations. For example, the terminal device is at the edge of two cells, traveling at high speed, in arrears, or frequently powered on and off, etc. Even in these scenarios, some data does not need to be actually written to the SIM card immediately because it will soon be overwritten by new data. However, once the terminal device is in such a scenario, it will perform frequent and unnecessary erasing and writing operations on the SIM card. Frequent and unnecessary SIM card erasing and writing will shorten the service life of the SIM card, increase the maintenance cost of the device, and the risk of potential service interruption.

[0028] To solve the problems mentioned in the background art, according to one aspect of the embodiments of the present application, a method for processing SIM card erasing and writing operations is provided, as Figure 1 shown, including:

[0029] Step 101, detecting whether the SIM card terminal is currently in a preset scenario, where the preset scenario is a scenario that requires frequent erasing and writing of the SIM card;

[0030] Step 103, if it is determined that the SIM card terminal is currently in the preset scenario, start the SIM card protection mode and turn on the timer;

[0031] Step 105, when the timing duration of the timer is less than the preset duration, store the first data to be erased and written in the local cache;

[0032] Step 107, when the timing duration of the timer is equal to the preset duration, perform the target erasing and writing operation on the SIM card using the first data to be erased and written in the local cache.

[0033] The present application provides an embodiment for protecting the SIM card from being damaged by frequent erasing and writing in a preset scenario, while ensuring the timely update and accuracy of the data.

[0034] The preset scenario is a scenario that requires frequent erasing and writing of the SIM card. The preset scenario can have multiple scenarios (such as, the terminal device is at the edge of two cells, traveling at high speed, the SIM card is in arrears, or frequently powered on and off, etc.), including but not limited to the scenarios listed in the present application.

[0035] The preset duration can be set according to the actual situation, and the present application does not limit this.

[0036] The present application adds a judgment mechanism for the scenario where the SIM card terminal is located. If the SIM card terminal is in a frequent erasing and writing scenario, the protection mode is turned on. In the protection mode, the data to be erased and written is first stored in the local cache, and then the erasing and writing operations are uniformly performed every certain duration, which can effectively reduce the number of erasing and writing times.

[0037] As an alternative embodiment, detecting whether the SIM card terminal is currently in a preset scenario includes: detecting whether the number of handovers of the area where the SIM card terminal is located within a first duration is greater than a first number; if the number of handovers is greater than the first number, it is determined that the SIM card terminal is currently in the preset scenario; or detecting whether the number of consecutive power - on / off operations of the SIM card terminal within a second duration is greater than a second number; if the number of consecutive power - on / off operations is greater than the second number, it is determined that the SIM card terminal is currently in the preset scenario.

[0038] Specifically, the first duration, the second duration, the first number, and the second number can be set according to the actual situation, and the present application does not limit the specific values.

[0039] Exemplarily, if it is detected that the number of consecutive cell handovers of the SIM card terminal within a time interval T is greater than n, it is determined that the terminal enters the high - speed driving state. At this time, the SIM card protection mode is enabled, and the write - protection of the corresponding file is enabled, where T and n need to be determined according to the specific scenario of the terminal. For example, if it is an automobile or an electric vehicle, then T can be set to 2 minutes and n can be set to 3 times; if it is a bicycle, then T can be set to 3 minutes and n can be set to 2 times.

[0040] Exemplarily, if it is detected that the registration of the SIM of the terminal in the HPLMN, EHPLMN, and RPLMN is continuously rejected and the reason for rejection is "No suitable cells in tracking area", it is determined that the SIM card is in an overdue scenario. At this time, the SIM card protection mode is enabled, and the write - protection of the corresponding file is enabled. When the registration is successful, the SIM card protection mode is exited.

[0041] Exemplarily, if it is detected that the SIM card terminal has more than 3 cell handovers in two cells within 1 minute and the signal change is greater than 6 dBm, it is determined that the SIM card terminal is at the cell edge. At this time, the SIM card protection mode is enabled, and the write - protection of the corresponding file is enabled.

[0042] Exemplarily, if it is detected that the number of consecutive power - on / off operations of the SIM card terminal within a unit time T exceeds N times, it is determined that the SIM card terminal is in a scenario of repeated power - on / off operations. At this time, the SIM card protection mode is enabled, and the write - protection of the corresponding file is enabled.

[0043] It should be noted that since different files store different data, the files to be protected are different in different scenarios. For example, when the SIM card terminal is moving at high speed or at the edge of the cell, the file to be protected is the EFepsloci file; when the SIM card terminal is in arrears, the files to be protected are the EFFPLMN and EFepsloci files; when the SIM card terminal is in a frequent power-on and power-off state, the files to be protected are the EFepsloci and EFepsnsc files.

[0044] In the embodiments provided by the present application, in addition to scenario judgment, the SIM card terminal can also be forced to enter and exit a certain scenario by sending an instruction.

[0045] By adding a mechanism for judging the scenario in which the SIM card terminal is located, the present application can enable the protection mode in a scenario of frequent erasing and writing to avoid increasing unnecessary erasing and writing times.

[0046] As an optional embodiment, storing the first data to be erased and written in the local cache includes: obtaining the first data to be erased and written; setting a temporary flag bit in the local cache and performing a storage operation on the first data to be erased and written; when it is determined that the first data to be erased and written has been stored in the local cache, updating the temporary flag bit to the target flag bit.

[0047] When receiving an erasing and writing instruction, obtain the first data to be erased and written from the erasing and writing instruction. The first data to be erased and written depends on the application scenario and requirements of the SIM card, and the present application does not limit its specific content.

[0048] Before data storage, first set a temporary flag bit in the local cache to identify that there is currently data waiting to be stored but the storage process has not been completed.

[0049] Store the first data to be erased and written in the local cache. After the data storage is completed, perform necessary verification steps to confirm that the data has been correctly stored in the local cache, and then update the temporary flag bit to the target flag bit.

[0050] By first storing the first data to be erased and written in the local cache and then uniformly writing it into the SIM card, frequent erasing and writing of the SIM card can be avoided. Moreover, setting the flag bit can clearly identify the storage status of the data in the local cache, such as "being stored", "storage completed", etc., which helps the system or application program to track the storage progress of the data in real time and ensure the correctness and integrity of the data.

[0051] As an alternative embodiment, performing a target erasing operation on the SIM card by using the first data to be erased cached locally includes: checking whether a target flag bit exists in the local cache; if the target flag bit exists in the local cache, reading the first data to be erased in the local cache; determining whether there is data in the SIM card that duplicates the data to be written in the first data to be erased; if there is no data in the SIM card that duplicates the data to be written, writing the data to be written into the SIM card.

[0052] After the timing duration of the timer reaches the preset duration, performing the target erasing operation includes: comparing the new file in the local cache (i.e., the first data to be erased) with the file in the SIM card, that is, determining whether there is data in the SIM card that duplicates the data to be written in the first data to be erased); if they are different, writing the new data in the cache into the SIM card and updating the file on the SIM card.

[0053] During the target erasing operation, it is necessary to check whether a target flag bit exists in the local cache. If the target flag bit exists, it means there is new data in the local cache that can be written into the SIM card. If the target flag bit does not exist, it means there is no new data in the local cache that can be written into the SIM card.

[0054] In addition, in addition to setting the flag bit as a temporary flag bit or a target flag bit to indicate whether the data is stored or not, the status of the flag bit can also be set to true to indicate that the data is successfully stored in the local cache, and the status of the flag bit can be set to false to indicate that the data has not been stored in the local cache temporarily.

[0055] After writing the data to be written into the SIM card, erase the target flag bit so that the flag bit can be reset when new data is stored in the local cache next time.

[0056] In the embodiment provided in the present application, the data writing operation in the cache can also be triggered by sending an instruction or calling an interface, and the data in the cache is directly written into the SIM card, which is mainly used when the customer needs to restart the machine or change the card, and the data can be written into the SIM card in time.

[0057] As an alternative embodiment, after performing the target erasing operation on the SIM card by using the first data to be erased cached locally, the method further includes: clearing the timer and controlling the timer to start timing again; when the new timing duration of the timer is less than the preset duration, storing the second data to be erased in the local cache; when the new timing duration of the timer is equal to the preset duration, performing the target erasing operation on the SIM card by using the second data to be erased cached locally.

[0058] In the embodiments provided in the present application, data in the local cache is written into the SIM card every preset time interval. After the data writing is completed, the timer needs to restart timing. In the case where the SIM card is in the protection mode, the following steps are cycled: when the new timing duration of the timer is less than the preset time interval, the second data to be erased is stored in the local cache; when the new timing duration of the timer is equal to the preset time interval, the target erasing operation is performed on the SIM card using the second data to be erased in the local cache.

[0059] Data in the local cache is written into the SIM card every preset time interval. In this process, it involves two parts: storing new data in the local cache and writing the new data in the local cache into the SIM card. The specific steps of these two parts have been described above and will not be elaborated here.

[0060] As an alternative embodiment, after starting the SIM card protection mode and turning on the timer, the method further includes: monitoring whether the SIM card terminal is in a preset scenario; if it is monitored that the SIM card terminal is not in the preset scenario, the SIM card protection mode is turned off; obtaining the current timing duration of the timer and turning off the timer; obtaining the third data to be erased stored in the local cache during the current timing duration; performing the target erasing operation on the SIM card using the third data to be erased.

[0061] The present application repeats the step of writing data in the local cache into the SIM card every preset time interval according to the timing duration of the timer until it is monitored that the SIM card terminal exits the preset scenario, and then the SIM card protection mode is turned off. At this time, the necessary erasing operation to be performed is executed immediately.

[0062] When the SIM card protection mode is turned off, the current timing duration of the timer is usually less than the preset time interval. However, during the current timing duration, there may also be a situation where new data is stored in the local cache. Therefore, it is still necessary to obtain the third data to be erased stored in the local cache during the current timing duration, and then synchronize the third data to be erased to the SIM card according to the steps of the target erasing operation.

[0063] Turning off the SIM card protection mode when the SIM card terminal is not in the preset scenario can ensure that the necessary erasing operation is executed in a timely manner.

[0064] Synchronizing the third data to be erased in the local cache to the SIM card can ensure that the data in the SIM card is the latest data.

[0065] As an alternative embodiment, the method further includes: when a data reading instruction is received, determining a target file to be read corresponding to the data reading instruction; if the SIM card terminal is not in the SIM card protection mode, reading the target file from the SIM card, and if the SIM card terminal is in the SIM card protection mode, determining whether the target file belongs to a file to be protected; if the target file belongs to a file to be protected, reading the target file from the local cache and the SIM card, and if the target file does not belong to a file to be protected, reading the target file from the SIM card.

[0066] If the SIM card terminal is in the SIM card protection mode, it means that some files in the SIM card are in the protection mode, and the latest data of these files may still be cached locally. Therefore, at this time, these files need to be read from both the local cache and the SIM card.

[0067] There are already relatively mature technologies for reading file data from the SIM card, and this application will not elaborate on them here.

[0068] When reading data from the local cache, it is necessary to first check whether the target flag bit exists in the local cache. If the target flag bit exists, it means that there is new data to be written to the target file, and at this time, the new data in the local cache can be read. If the target flag bit does not exist, it means that there is no new data to be written to the target file, so there is no need to read the new data in the local cache at this time.

[0069] Figure 2 The following is a flowchart for reading and writing data files provided by this application. As shown in the figure, when it is necessary to read a SIM card file, since it is not certain whether the file has been written to the SIM card at this time, it is necessary to first determine whether the SIM card terminal is in the SIM card protection mode. If the SIM card terminal is not in the SIM card protection mode, it means that the file data in the SIM card is the latest data, and the SIM card file can be directly read from the SIM card. If the SIM card terminal is in the SIM card protection mode, it is necessary to further determine whether the SIM card file is in the protection mode (it can be determined which file is currently protected according to the current scenario of the SIM card). If the SIM card file is in the protection mode, the SIM card file is directly read from the local cache and the SIM card. If the SIM card file is not in the protection mode, the SIM card file is directly read from the SIM card to ensure that the data read is the latest data.

[0070] By determining whether the file is in the protection mode before reading the file and then selecting the reading location, rather than directly reading data from the SIM card, it is possible to prevent data omission caused by data not being written to the SIM card and ensure that the data read is the latest data.

[0071] Scenes that may frequently write to the card are identified through scene judgment. Files that will be frequently erased and written in these scenes are protected. During the protection process, the SIM card information that needs to be updated is written into the local cache instead of the SIM card. After leaving these scenes, the data in the local cache will be written into the SIM card, so as to achieve the purpose of reducing the number of erase and write operations.

[0072] This application provides a method for processing SIM card erase and write operations, including: detecting whether the SIM card terminal is currently in a preset scene, where the preset scene is a scene that requires frequent erase and write operations on the SIM card; if it is determined that the SIM card terminal is currently in the preset scene, start the SIM card protection mode and start a timer; when the timing duration of the timer is less than the preset duration, store the first data to be erased and written in the local cache; when the timing duration of the timer is equal to the preset duration, perform a target erase and write operation on the SIM card using the first data to be erased and written in the local cache. By adding a judgment mechanism to the scene where the SIM card terminal is located, if the SIM card terminal is in a frequent erase and write scene, the protection mode is enabled. In the protection mode, the data to be erased and written is first stored in the local cache, and then the erase and write operation is performed uniformly at regular intervals, which can effectively reduce the number of erase and write operations and solve the problem that frequent and unnecessary SIM card erase and write operations will shorten the service life of the SIM card.

[0073] According to another aspect of the embodiments of the present application, the present application provides a device for processing SIM card erase and write operations, as Figure 3 shown, including:

[0074] A detection module 302, configured to detect whether the SIM card terminal is currently in a preset scene, where the preset scene is a scene that requires frequent erase and write operations on the SIM card;

[0075] A start module 304, configured to start the SIM card protection mode and start a timer if it is determined that the SIM card terminal is currently in the preset scene;

[0076] A storage module 306, configured to store the first data to be erased and written in the local cache when the timing duration of the timer is less than the preset duration;

[0077] An erase and write module 308, configured to perform a target erase and write operation on the SIM card using the first data to be erased and written in the local cache when the timing duration of the timer is equal to the preset duration.

[0078] It should be noted that the detection module 302 in this embodiment can be used to execute step 101 in the embodiments of the present application, the start module 304 in this embodiment can be used to execute step 103 in the embodiments of the present application, the storage module 306 in this embodiment can be used to execute step 105 in the embodiments of the present application, and the erase and write module 308 in this embodiment can be used to execute step 107 in the embodiments of the present application.

[0079] Optionally, the detection module 302 is specifically configured to detect whether the number of times the area where the SIM card terminal is located is switched within the first time period is greater than the first number. If the number of switches is greater than the first number, it is determined that the SIM card terminal is currently in a preset scenario; or to detect whether the number of consecutive on / off times of the SIM card terminal within the second time period is greater than the second number. If the number of consecutive on / off times is greater than the second number, it is determined that the SIM card terminal is currently in a preset scenario.

[0080] Optionally, the storage module 306 is specifically configured to obtain the first data to be erased and written; set a temporary flag bit in the local cache, and perform a storage operation on the first data to be erased and written; when it is determined that the first data to be erased and written has been stored in the local cache, update the temporary flag bit to the target flag bit.

[0081] Optionally, the erasing and writing module 308 is specifically configured to check whether a target flag bit exists in the local cache; if the target flag bit exists in the local cache, read the first data to be erased and written in the local cache; determine whether there is data in the SIM card that duplicates the data to be written in the first data to be erased and written; if there is no data in the SIM card that duplicates the data to be written, write the data to be written into the SIM card.

[0082] Optionally, the device further includes a first processing module, configured to clear the timer and control the timer to start timing again after performing a target erasing and writing operation on the SIM card using the first data to be erased and written in the local cache; when the new timing duration of the timer is less than the preset duration, store the second data to be erased and written in the local cache; when the new timing duration of the timer is equal to the preset duration, perform a target erasing and writing operation on the SIM card using the second data to be erased and written in the local cache.

[0083] Optionally, the device further includes a second processing module, configured to monitor whether the SIM card terminal is in a preset scenario after starting the SIM card protection mode and turning on the timer; if it is monitored that the SIM card terminal is not in the preset scenario, turn off the SIM card protection mode; obtain the current timing duration of the timer, and turn off the timer; obtain the third data to be erased and written stored in the local cache during the current timing duration; perform a target erasing and writing operation on the SIM card using the third data to be erased and written.

[0084] Optionally, the device further includes a third processing module, configured to determine a target file to be read corresponding to a data reading instruction when receiving the data reading instruction; if the SIM card terminal is not in the SIM card protection mode, read the target file from the SIM card, and if the SIM card terminal is in the SIM card protection mode, determine whether the target file belongs to a file to be protected; if the target file belongs to the file to be protected, read the target file from the local cache and the SIM card, and if the target file does not belong to the file to be protected, read the target file from the SIM card.

[0085] It should be noted here that the examples and application scenarios implemented by the above modules and the corresponding steps are the same, but are not limited to the content disclosed in the above embodiments.

[0086] According to another aspect of the embodiments of the present application, the present application provides an electronic device, as Figure 4 shown, including a memory 401, a processor 403, a communication interface 405, and a communication bus 407. A computer program that can run on the processor 403 is stored in the memory 401. The memory 401 and the processor 403 communicate through the communication interface 405 and the communication bus 407. When the processor 403 executes the computer program, the steps of the above method are implemented.

[0087] The memory and the processor in the above electronic device communicate through the communication bus and the communication interface. The communication bus may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc.

[0088] The memory may include a Random Access Memory (RAM), and may also include a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located far from the aforementioned processor.

[0089] The above-mentioned processor can be a general-purpose processor, including a Central Processing Unit (CPU for short), a Network Processor (NP for short), etc.; it can also be a Digital Signal Processor (DSP for short), an Application Specific Integrated Circuit (ASIC for short), a Field-Programmable Gate Array (FPGA for short), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0090] According to another aspect of the embodiments of the present application, there is also provided a computer-readable medium having non-volatile program code executable by a processor.

[0091] Optionally, specific examples in this embodiment can refer to the examples described in the above embodiments, and will not be elaborated herein.

[0092] When the embodiments of the present application are specifically implemented, reference can be made to the above various embodiments, and corresponding technical effects can be achieved.

[0093] It can be understood that these embodiments described herein can be implemented using hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field-Programmable Gate Arrays (FPGAs), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described in the present application, or a combination thereof.

[0094] For software implementation, the techniques described herein can be implemented by units that execute the functions described herein. The software code can be stored in a memory and executed by a processor. The memory can be implemented inside or outside the processor.

[0095] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, or by a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. A professional technician can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.

[0096] Those skilled in the art can clearly understand that for the convenience and conciseness of description, the specific working processes of the systems, devices, and units described above can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated herein.

[0097] In the embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation. For example, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces, and the indirect couplings or communication connections of the devices or units can be in electrical, mechanical, or other forms.

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

[0099] In addition, the functional units in each embodiment of this application can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit.

[0100] When the above-mentioned functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on such an understanding, the technical solutions of the embodiments of the present application, in essence, or the parts that contribute to the prior art, or parts of the technical solutions, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the embodiments of the present application. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, ROM, RAM, magnetic disks, or optical discs that can store program codes. It should be noted that in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements not only includes those elements, but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the existence of additional identical elements in the process, method, article or device comprising the element.

[0101] The above are only specific embodiments of the present application, enabling those skilled in the art to understand or implement the present application. Various modifications to these embodiments will be obvious to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to these embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A processing method for SIM card writing and erasing operations, characterized in that, Including: Detect whether the SIM card terminal is currently in a preset scenario, where the preset scenario is a scenario that requires frequent erasing and writing of the SIM card; If it is determined that the SIM card terminal is currently in the preset scenario, start the SIM card protection mode and activate a timer; When the elapsed time of the timer is less than a preset time, store the first data to be erased and written in the local cache; When the elapsed time of the timer is equal to the preset time, perform a target erasing and writing operation on the SIM card using the first data to be erased and written in the local cache.

2. The method according to claim 1, wherein The step of detecting whether the SIM card terminal is currently in a preset scenario includes: Detect whether the number of area switches of the SIM card terminal within a first period is greater than a first number. If the number of switches is greater than the first number, it is determined that the SIM card terminal is currently in the preset scenario; or Detect whether the number of consecutive on / off operations of the SIM card terminal within a second period is greater than a second number. If the number of consecutive on / off operations is greater than the second number, it is determined that the SIM card terminal is currently in the preset scenario.

3. The method according to claim 1, characterized in that, The step of storing the first data to be erased and written in the local cache includes: Obtain the first data to be erased and written; Set a temporary flag bit in the local cache and perform a storage operation on the first data to be erased and written; When it is determined that the first data to be erased and written has been stored in the local cache, update the temporary flag bit to a target flag bit.

4. The method according to claim 3, characterized in that, The step of performing a target erasing and writing operation on the SIM card using the first data to be erased and written in the local cache includes: Check whether the target flag bit exists in the local cache; If the target flag bit exists in the local cache, read the first data to be erased and written in the local cache; Determine whether there is data in the SIM card that duplicates the data to be written in the first data to be erased and written; If there is no data in the SIM card that duplicates the data to be written, write the data to be written into the SIM card.

5. The method according to claim 1, wherein After performing a target erasing and writing operation on the SIM card using the first data to be erased and written in the local cache, the method further includes: Reset the timer to zero and control the timer to start timing again; When the new elapsed time of the timer is less than the preset time, store the second data to be erased and written in the local cache; When the new elapsed time of the timer is equal to the preset time, perform the target erasing and writing operation on the SIM card using the second data to be erased and written in the local cache.

6. The method according to claim 1, characterized in that, After starting the SIM card protection mode and activating a timer, the method further includes: Monitor whether the SIM card terminal is in the preset scenario; If it is monitored that the SIM card terminal is not in the preset scenario, turn off the SIM card protection mode; Obtain the current elapsed time of the timer and turn off the timer; Obtain the third data to be erased and written that has been stored in the local cache during the current elapsed time; Perform the target erasing and writing operation on the SIM card using the third data to be erased and written.

7. The method according to claim 1, characterized in that The method further includes: Upon receiving a data reading instruction, determine a target file to be read corresponding to the data reading instruction; If the SIM card terminal is not in the SIM card protection mode, read the target file from the SIM card. If the SIM card terminal is in the SIM card protection mode, determine whether the target file belongs to a file to be protected; If the target file belongs to the file to be protected, read the target file from the local cache and the SIM card. If the target file does not belong to the file to be protected, read the target file from the SIM card.

8. A processing device for SIM card erasing and writing operations, characterized in that, Comprising: A detection module, configured to detect whether the SIM card terminal is currently in a preset scenario, where the preset scenario is a scenario that requires frequent erasing and writing of the SIM card; A start module, configured to start the SIM card protection mode and start a timer if it is determined that the SIM card terminal is currently in the preset scenario; A storage module, configured to store first data to be erased and written into the local cache when the timing duration of the timer is less than a preset duration; An erasing and writing module, configured to perform a target erasing and writing operation on the SIM card by using the first data to be erased and written in the local cache when the timing duration of the timer is equal to the preset duration.

9. An electronic device, comprising a memory, a processor, a communication interface and a communication bus, wherein a computer program that can run on the processor is stored in the memory, and the memory and the processor communicate through the communication bus and the communication interface, characterized in that, When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 above are implemented.

10. A computer-readable medium having non-volatile program code executable by a processor, characterized in that, The program code causes the processor to execute the method according to any one of claims 1 to 7.