SIM card detection method, system and device
The SIM card level changes are detected through the GPIO interface of the controller, combined with serial communication, and the SIM card status detection problem in the existing technology is solved, real-time status monitoring and hot plugging of the SIM card are realized, and the hardware resource adjustment cost is reduced.
Patent Information
- Application Number
- CN202410931863.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-11
- Publication Date
- 2024-11-08
AI Technical Summary
The prior art is difficult to detect the unplugging and inserting status of SIM cards, especially when the terminal device does not support the hot-plugging function, and the lack of effective hardware interface connections, resulting in the inability to monitor the inserting status of SIM cards in real time.
The controller's general input and output GPIO interface is electrically connected to the test interface of the SIM card, detecting the level changes to determine the insertion or unplugging status of the SIM card, and interacting with the communication module through serial communication to realize the status initialization of the SIM card and Business execution.
Real-time detection of SIM card unplugging and inserting status is realized, the hot plugging function of SIM card is supported, and the cost of change of communication modules is saved when hardware resources are increased, and the flexibility and maintenance efficiency of terminal equipment are improved.
Smart Images

Figure CN118921693A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of electronic technology, and in particular to a SIM card detection method, system and device. Background Art
[0002] The hot-swap function of the subscriber identity module (SIM) card means that the terminal device can directly replace the SIM card when it is powered on, and can identify the state of the SIM card being pulled out and inserted. Among them, whether the terminal device supports the hot-swap function of the SIM card depends on whether the hardware interface of the terminal device and the hardware interface of the SIM card are connected. If the two interfaces are connected, the terminal device supports the hot-swap function of the SIM card.
[0003] However, if the terminal device does not have a hardware interface that is connected to the hardware interface of the SIM card, the terminal device does not support the hot-swap function. Therefore, how to detect the removal and insertion status of the SIM card remains to be studied. Summary of the invention
[0004] The embodiments of the present application provide a SIM card detection method, system and device, which can detect the removal and insertion status of a SIM card.
[0005] In the first aspect, an embodiment of the present application provides a SIM card detection system. The system includes a controller, a communication module, and a user identity module SIM card that are communicatively connected to each other. Among them, the general input and output GPIO interface of the controller is electrically connected to the test interface of the SIM card, and the controller is used to detect the level change of the test interface of the SIM card through the GPIO interface, and determine the first state of the SIM card according to the level change of the test interface, and the first state is the SIM card insertion state or the SIM card removal state.
[0006] It can be seen that in the embodiment of the present application, in the SIM card detection system, the controller can detect the level change of the test interface of the SIM card through the GPIO interface, and determine whether the first state of the SIM card is the SIM card insertion state or the SIM card removal state according to the level change of the test interface, thereby realizing the detection of the removal and insertion states of the SIM card.
[0007] In an optional implementation, the controller and the communication module communicate via a serial port, the transmitting interface of the controller is electrically connected to the receiving interface of the communication module, and the receiving interface of the controller is electrically connected to the transmitting interface of the communication module.
[0008] In an optional implementation, the data interface of the communication module is electrically connected to the data interface of the SIM card, the clock interface of the communication module is electrically connected to the clock interface of the SIM card, the reset interface of the communication module is electrically connected to the reset interface of the SIM card, and the voltage interface of the communication module is electrically connected to the voltage interface of the SIM card.
[0009] In a second aspect, an embodiment of the present application provides a SIM card detection method. The method includes: a controller detects a level change of a test interface of a user identity module SIM card through a general purpose input and output GPIO interface. The controller determines a first state of the SIM card according to the level change of the test interface, and the first state is a SIM card insertion state or a SIM card removal state.
[0010] It can be seen that in the embodiment of the present application, the controller can detect the level change of the test interface of the SIM card through the GPIO interface, and determine whether the first state of the SIM card is the SIM card insertion state or the SIM card removal state through the level change of the test interface, thereby realizing the detection of the removal and insertion state of the SIM card.
[0011] In an optional implementation, the controller further performs the following operations: sending a first state of the SIM card to the communication module; receiving a second state of the SIM card from the communication module, the second state being a SIM card preparation state or a SIM card not inserted state; and executing services according to the second state of the SIM card.
[0012] In an optional implementation, the controller determines the first state of the SIM card according to the level change of the test interface, including: when the level of the test interface changes from a low level to a high level, determining that the first state of the SIM card is a SIM card inserted state; when the level of the test interface changes from a high level to a low level, determining that the first state of the SIM card is a SIM card removed state.
[0013] In a third aspect, an embodiment of the present application provides a SIM card detection method. The method includes: a communication module receives a first state of a user identity module SIM card from a controller, the first state being a SIM card insertion state or a SIM card removal state. The communication module initializes the SIM card according to the first state of the SIM card to obtain a second state of the SIM card. The communication module sends the second state of the SIM card to the controller, the second state being a SIM card preparation completion state or a SIM card not inserted state.
[0014] It can be seen that in the embodiment of the present application, the communication module initializes the SIM card according to the first state of the received SIM card, obtains the second state of the SIM card as the SIM card preparation state or the SIM card not inserted state, and sends the second state of the SIM card to the controller, which is beneficial for the controller to execute the service according to the second state of the SIM card.
[0015] In an optional implementation, the communication module initializes the SIM card according to the first state of the SIM card to obtain the second state of the SIM card, including: when the first state of the SIM card is the SIM card inserted state, the SIM card is initialized to obtain the second state of the SIM card, and the second state is the SIM card preparation state; when the first state of the SIM card is the SIM card removed state, the SIM card is initialized to obtain the second state of the SIM card, and the second state is the SIM card not inserted state.
[0016] In a fourth aspect, an embodiment of the present application provides a SIM card detection device, the device comprising:
[0017] The detection module is used to detect the level change of the test interface of the user identity module SIM card through the general input and output GPIO interface;
[0018] The determination module is used to determine the first state of the SIM card according to the level change of the test interface, and the first state is the SIM card insertion state or the SIM card removal state.
[0019] In an optional implementation, the SIM card detection device further includes: a sending module, used to send the first state of the SIM card to the communication module; a receiving module, used to receive the second state of the SIM card from the communication module, the second state being a SIM card preparation state or a SIM card not inserted state; and an execution module, used to execute a service according to the second state of the SIM card.
[0020] In an optional implementation, the determination module determines the first state of the SIM card according to the level change of the test interface, and is specifically used to: when the level of the test interface changes from a low level to a high level, determine that the first state of the SIM card is the SIM card inserted state; when the level of the test interface changes from a high level to a low level, determine that the first state of the SIM card is the SIM card removed state.
[0021] In a fifth aspect, an embodiment of the present application provides a SIM card detection device, the device comprising:
[0022] A receiving module, used for receiving a first state of a user identity module SIM card from a controller, wherein the first state is a SIM card insertion state or a SIM card removal state;
[0023] an obtaining module, configured to initialize the SIM card according to the first state of the SIM card, and obtain a second state of the SIM card, where the second state is a SIM card preparation completion state or a SIM card not inserted state;
[0024] A sending module is used to send the second state of the SIM card to the controller.
[0025] In an optional implementation, the obtaining module initializes the SIM card according to the first state of the SIM card to obtain the second state of the SIM card, and is specifically used to: when the first state of the SIM card is the SIM card inserted state, initialize the SIM card to obtain the second state of the SIM card, and the second state is the SIM card preparation completion state; when the first state of the SIM card is the SIM card removed state, initialize the SIM card to obtain the second state of the SIM card, and the second state is the SIM card not inserted state.
[0026] In a sixth aspect, the present application further provides a computer device, comprising: a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the steps of the above method are implemented.
[0027] In a seventh aspect, the present application further provides a computer storage medium, wherein the computer storage medium stores a computer program, and the computer program implements the steps of the above method when executed by a processor. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] The drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present application, and are used together with the specification to explain the principles of the present application. In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments are briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative labor.
[0029] Figure 1 A schematic diagram of the architecture of a SIM card detection system provided in an embodiment of the present application;
[0030] Figure 2 A structural diagram of a SIM card hot-swap status detection;
[0031] Figure 3 A flow chart of a SIM card detection method provided in an embodiment of the present application;
[0032] Figure 4 A flow chart of a method for detecting the state of a SIM card plugging and unplugging provided in an embodiment of the present application;
[0033] Figure 5 A schematic diagram of the structure of a SIM card detection device provided in an embodiment of the present application;
[0034] Figure 6 A schematic diagram of the structure of another SIM card detection device provided in an embodiment of the present application;
[0035] Figure 7 A schematic diagram of the structure of a computer device provided in an embodiment of the present application.
[0036] The realization of the purpose, functional features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. The above-mentioned drawings have shown clear embodiments of this application, which will be described in more detail later. These drawings and textual descriptions are not intended to limit the scope of the concept of this application in any way, but to illustrate the concept of this application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0037] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0038] It should be understood that the terms "comprising" and "including" indicate the presence of the described features, steps, operations, elements, components, items, kinds, and / or groups, but do not exclude the presence, occurrence or addition of one or more other features, steps, operations, elements, components, items, kinds, and / or groups. The terms "or", "and / or", "including at least one of the following", etc. used in this application may be interpreted as inclusive, or mean any one or any combination. For example, "including at least one of the following: A, B, C" means "any one of the following: A; B; C; A and B; A and C; B and C; A and B and C", and for another example, "A, B or C" or "A, B and / or C" means "any one of the following: A; B; C; A and B; A and C; B and C; A and B and C". Exceptions to this definition will only occur when the combination of elements, functions, steps or operations is inherently mutually exclusive in some way.
[0039] It should be understood that, although the various steps in the flowchart in the embodiment of the present application are displayed in sequence according to the indication of the arrows, these steps are not necessarily performed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and it can be performed in other orders. Moreover, at least a portion of the steps in the figure may include a plurality of sub-steps or a plurality of stages, and these sub-steps or stages are not necessarily performed at the same time, but can be performed at different times, and their execution order is not necessarily performed in sequence, but can be performed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0040] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0041] In the subsequent description, the suffixes such as "module", "component" or "unit" used to represent elements are only used to facilitate the description of the present application, and have no specific meanings. Therefore, "module", "component" or "unit" can be used in a mixed manner.
[0042] See also Figure 1 , Figure 1 This is a schematic diagram of the architecture of a SIM card detection system provided in an embodiment of the present application. Figure 1 As shown, the detection system includes a communication module, a controller and a subscriber identity module (SIM) card. Among them, the communication module can be a fourth generation mobile communication (4G) module, a fifth generation mobile communication (5G) module, etc., and the embodiment of the present application is not limited to this. The communication module in the embodiment of the present application can be a communication module deployed in a terminal device, and the controller can be a microcontroller unit (MCU).
[0043] like Figure 1 As shown, the general-purpose input / output (GPIO) interface of the controller is electrically connected to the detection (DET) interface of the SIM card. The controller can detect the level change of the test interface of the SIM card through the GPIO interface, and determine the first state of the SIM card according to the level change of the test interface, and the first state is the SIM card insertion state or the SIM card removal state.
[0044] In one possible manner, the controller and the communication module communicate via a serial port, the transmitting interface of the controller is electrically connected to the receiving interface of the communication module, and the receiving interface of the controller is electrically connected to the transmitting interface of the communication module. Figure 1 As shown, the universal asynchronous receiver / transmitter_transmit interface (UART_TX) of the controller is electrically connected to the universal asynchronous receiver / transmitter_receive interface (UART_receive, UART_RX) of the communication module, and the UART_RX of the controller is electrically connected to the UART_TX of the communication module. The controller can send a signal to the communication module through UART_TX, and can receive a signal from the communication module through UART_RX. The communication module can send a signal to the controller through UART_TX, and can receive a signal from the controller through UART_RX.
[0045] In one possible manner, the data interface of the communication module is electrically connected to the data interface of the SIM card, the clock interface of the communication module is electrically connected to the clock interface of the SIM card, the reset interface of the communication module is electrically connected to the reset interface of the SIM card, and the voltage interface of the communication module is electrically connected to the voltage interface of the SIM card. Figure 1 As shown, the universal subscriber identity module data (universal subscriber identity module_data, USIM_data) interface of the communication module is electrically connected to the data (data) interface of the SIM card; the global subscriber identity module clock (USIM_clock, USIM_CLK) interface of the communication module is electrically connected to the clock (clock, CLK) interface of the SIM card; the global subscriber identity module reset (USIM_reset, USIM_RST) interface of the communication module is electrically connected to the reset (reset, RST) interface of the SIM card; the global subscriber identity module drain power voltage (USIM_voltage drain drain, USIM_VDD) interface of the communication module is electrically connected to the power supply voltage (volt current condenser, VCC) interface of the SIM card.
[0046] Among them, the USIM_DATA interface of the communication module is used to read and write data in the SIM card, and to send and receive instructions; the USIM_CLK interface of the communication module is used to provide a clock signal for the SIM card, and the USIM_CLK interface of the communication module is electrically connected to the CLK interface of the SIM card, which can synchronize and coordinate the communication between the communication module and the SIM card; the USIM_RST interface of the communication module is used to control the reset of the SIM card, and the USIM_RST interface of the communication module is electrically connected to the RST interface of the SIM card. Through the USIM_RST interface of the communication module, the SIM card can be reset to the initial state to facilitate the initialization of the SIM card; the USIM_VDD interface of the communication module is used to provide a power supply voltage for the SIM card, and the USIM_VDD interface of the communication module can support 1.8V / 3.0V SIM cards.
[0047] In addition, in the communication module, the application layer can handle application services, for example, the application layer can obtain the status of the SIM card, the application layer can obtain the network injection status, and the application layer can handle transmission control protocol (TCP) / internet protocol (IP) services, etc. In the communication module, the protocol layer can initialize the SIM card and handle the network injection process. In the controller, the application service layer can execute services, for example, start dialing, detect the SIM card status, and determine the network status.
[0048] See also Figure 2 , Figure 2 The figure is a schematic diagram of a structure for detecting the hot-swap status of a SIM card. Figure 2 As shown, the global user identity module detection (USIM_PRESENCE) interface of the communication module is connected to the DET interface of the SIM card, and the USIM_PRESENCE interface is used to detect the level signal of the DET interface of the SIM card. Whether the terminal device supports the hot-swap function of the SIM card depends on whether the hardware interface of the terminal device and the hardware interface of the SIM card are connected. In other words, whether the terminal device supports the hot-swap function of the SIM card depends on whether the USIM_PRESENCE interface of the communication module and the DET interface of the SIM card are connected. When the USIM_PRESENCE interface is connected to the DET interface, the USIM_PRESENCE interface can detect the level signal of the DET interface. When the level signal of the DET interface is a high-level signal, the SIM card is inserted; when the level signal of the DET interface is a low-level signal, the SIM card is pulled out. Therefore, the communication module of the terminal device can judge whether the SIM card is in an inserted state or a pulled out state according to the level signal of the DET interface.
[0049] However, when the USIM_PRESENCE interface and the DET interface are not connected, the terminal device does not support the hot-swap function of the SIM card. For example, when there are not enough hardware resources inside the communication module of the terminal device, or when the communication module of the terminal device is designed, it is not considered that the terminal device supports the hot-swap function of the SIM card, so that the interface connected to the DET interface of the SIM card on the communication module is not designed. If the hot-swap function requirement of the newly added SIM card is considered when the interface connected to the DET interface of the SIM card on the communication module is not designed, it is necessary to make major adjustments to the hardware resources of the communication module. In response to the above defects, an embodiment of the present application proposes to add an external controller to detect the level signal of the DET interface of the SIM card through the GPIO interface of the controller, so as to obtain whether the SIM card is in the inserted or unplugged state. In this way, the terminal device can support the hot-swap function of the SIM card, and when the hot-swap function requirement of the newly added SIM card is added, the cost of changing the hardware resources of the communication module can be saved.
[0050] Based on the above description, the embodiment of the present application proposes a SIM card detection method 100. Figure 3 A flow chart of a SIM card detection method provided in an embodiment of the present application, the method includes but is not limited to:
[0051] S301. The controller detects a level change of a test interface of a subscriber identity module SIM card through a general purpose input and output (GPIO) interface.
[0052] The GPIO interface is deployed on the controller, that is, the GPIO interface is an interface of the controller. In addition, the GPIO interface on the controller is used to detect the level change of the test interface of the SIM card, and the controller can detect the level change of the test interface of the SIM card through the GPIO interface.
[0053] In an optional implementation, the controller detects the level change of the test interface of the SIM card through the GPIO interface, including: detecting the level of the DET interface through an interrupt trigger of the GPIO interface.
[0054] Optionally, the interface in the embodiment of the present application can be replaced by a pin.
[0055] S302. The controller determines a first state of the SIM card according to a level change of the test interface, where the first state is a SIM card inserted state or a SIM card removed state.
[0056] The first state is a SIM card inserted state or a SIM card removed state, and therefore, the controller determines whether the SIM card is in an inserted state or removed state according to a level change of the test interface.
[0057] It is understandable that when the level of the SIM card test interface changes, it indicates that the SIM card may be inserted or removed, so that the controller can determine whether the SIM card is removed or inserted according to the level change of the SIM card test interface, that is, determine whether the SIM card is in an inserted state or a removed state.
[0058] In an optional implementation, the controller determines the first state of the SIM card according to the level change of the test interface, including: when the level of the test interface changes from a low level to a high level, determining that the first state of the SIM card is a SIM card inserted state; when the level of the test interface changes from a high level to a low level, determining that the first state of the SIM card is a SIM card removed state.
[0059] That is, the controller determines that the SIM card is in the inserted state when the level of the test interface changes from low level to high level; the controller determines that the SIM card is in the removed state when the level of the test interface changes from high level to low level.
[0060] In an optional implementation, the controller further sends the first state of the SIM card to the communication module. Correspondingly, the communication module receives the first state from the controller.
[0061] The controller may send the first state of the SIM card to the communication module via the UART interface. Figure 1 As shown, the controller can send the first state of the SIM card to the communication module via UART_TX. Correspondingly, the communication module can receive the first state of the SIM card from the controller via UART_RX.
[0062] In an optional implementation, after the communication module receives the first state of the SIM card from the controller, it may also perform the following operations: initialize the SIM card according to the first state of the SIM card to obtain the second state of the SIM card, where the second state is the SIM card preparation state or the SIM card not inserted state.
[0063] Among them, the communication module initializes the SIM card, including: the communication module identifies, configures and activates the SIM card and other operations. For example, after the communication module receives the first state of the SIM card from the controller through UART_RX, the serial port of the communication module parses the first state of the SIM card and sends the first state of the SIM card to the application layer of the communication module. The application layer of the communication module calls an instruction to notify the protocol layer to initialize the SIM card. For example, the application layer can call the ipc_notify_sim_detect instruction to notify the protocol layer to initialize the SIM card. The protocol layer of the communication module executes the initialization of the SIM card. After the protocol layer of the communication module completes the initialization of the SIM card, the communication module obtains the second state of the SIM card.
[0064] In an optional implementation, the communication module initializes the SIM card according to the first state of the SIM card to obtain the second state of the SIM card, including: when the first state of the SIM card is the SIM card inserted state, the communication module initializes the SIM card to obtain the second state of the SIM card, and the second state is the SIM card preparation state; when the first state of the SIM card is the SIM card removed state, the communication module initializes the SIM card to obtain the second state of the SIM card, and the second state is the SIM card not inserted state.
[0065] It can be understood that when the first state of the SIM card is the SIM card inserted state, after the communication module initializes the SIM card, the second state of the SIM card is the SIM card preparation state; when the first state of the SIM card is the SIM card removed state, after the communication module initializes the SIM card, the second state of the SIM card is the SIM card not inserted state.
[0066] Optionally, the communication module can also detect the connection status between the SIM card and the terminal device according to the first state of the SIM card. When the first state of the SIM card is the SIM card inserted state, the connection between the SIM card and the terminal device is normal; when the first state of the SIM card is the SIM card removed state, the connection between the SIM card and the terminal device is abnormal. In this way, the terminal device can detect whether the connection status between the SIM card and the terminal device is abnormal in time through the communication module, thereby improving the efficiency of repairing the terminal device when the SIM card falls.
[0067] In an optional implementation, after the communication module obtains the second state of the SIM card, it may also send the second state of the SIM card to the controller. For example, after the communication module obtains the second state of the SIM card, the protocol layer of the communication module sends the second state of the SIM card to the application layer, the application layer sends the second state of the SIM card to UART_TX, and the communication module sends the second state of the SIM card to the controller via UART_TX.
[0068] Correspondingly, the controller also receives the second state of the SIM card from the communication module, and executes the service according to the second state of the SIM card. For example, the controller receives the second state of the SIM card from the communication module via UART_RX.
[0069] In an optional implementation, the controller executes the service according to the second state of the SIM card, including: when the second state is the SIM card preparation completion state, the controller can initiate a built-in dial-up, obtain IP and TCP, and execute the message queuing telemetry transport (MQTT) service. When the second state is the SIM card not inserted state, the controller can exit the normal service of the SIM card, and when the second state of the SIM card received from the communication module is the SIM card preparation completion state, the controller can execute the normal service of the SIM card.
[0070] It can be seen that the controller can detect the level change of the test interface of the SIM card through the GPIO interface of the controller, and determine whether the first state of the SIM card is the SIM card insertion state or the SIM card removal state according to the level change of the test interface. This method allows the controller to detect the removal and insertion states of the SIM card.
[0071] See also Figure 4 , Figure 4 The following is a flow chart of a method for detecting the state of a SIM card plug-in or plug-out provided in an embodiment of the present application. Specifically, Figure 4 The SIM card insertion and removal status detection method shown in the figure takes the controller as MCU and the communication module as the communication module of the terminal device as an example. Figure 3 The detection method shown is used as an example embodiment, and the SIM card plug-in status detection method includes but is not limited to the following steps:
[0072] S401.MCU detects the level of the DET interface of the SIM card through the GPIO interface and determines the insertion and removal status of the SIM card.
[0073] The GPIO interface of the MCU is connected to the DET interface of the SIM card. The MCU can detect the level of the DET interface by interrupting the current service, and then execute the interrupted current service after the detection is completed.
[0074] When the MCU detects that the level of the DET interface of the SIM card has changed, the SIM card insertion status can be determined by the level change of the DET interface. The SIM card insertion status can also be called the above Figure 3 The first state of the detection method shown. For example, when the level of the DET interface changes from a low level to a high level, the SIM card insertion state is determined to be the SIM card insertion state; when the level of the DET interface changes from a high level to a low level, the SIM card insertion state is determined to be the SIM card removal state.
[0075] S402. MCU sends the SIM card insertion and removal status to the communication module through the serial port.
[0076] Among them, the serial port in the embodiment of the present application can also be replaced by an interface or a pin.
[0077] Specifically, the MCU sends the SIM card insertion and removal status to the communication module via UART_TX. Figure 1 As shown, the MCU sends the SIM card insertion and removal status to the communication module's UART_RX via UART_TX.
[0078] S403. The communication module receives the SIM card insertion and removal status from the MCU through the serial port.
[0079] Specifically, the communication module receives the plug-in and unplug-out status of the SIM card from the MCU via UART_RX.
[0080] Optionally, the communication module serial port also parses the insertion and removal status of the SIM card.
[0081] S404. The serial port sends the plug-in status of the SIM card to the application layer, and the application layer calls an instruction to notify the protocol layer to initialize the SIM card.
[0082] After the serial port parses the SIM card's plug-in status, it sends the SIM card's plug-in status to the application layer. After the application layer receives the SIM card's plug-in status from the serial port, it can call the ipc_notify_sim_detect instruction to notify the protocol layer to initialize the SIM card.
[0083] When the plug-in state of the SIM card is the SIM card inserted state, the application layer notifies the protocol layer to initialize the SIM card; when the plug-in state of the SIM card is the SIM card removed state, the application layer notifies the protocol layer to initialize the SIM card.
[0084] S405. The communication module protocol layer starts to execute SIM card initialization.
[0085] In the embodiment of the present application, S405 can refer to the above Figure 3 The initialization process described in the detection method shown will not be repeated here.
[0086] S406. The communication module protocol layer obtains the initialization status of the SIM card and sends the initialization status of the SIM card to the application layer.
[0087] After the protocol layer completes the initialization of the SIM card, it obtains the initialization status of the SIM card and sends the initialization status of the SIM card to the application layer. The SIM card initialization status includes the SIM card initialization completion status or the SIM card not inserted status. That is, the SIM card initialization status is Figure 3 The second state in the detection method shown.
[0088] It can be understood that when the insertion and unplugging state of the SIM card is the SIM card inserted state, the application layer notifies the protocol layer to initialize the SIM card. After the protocol layer completes the initialization of the SIM card, the initialization state of the SIM card is obtained as the SIM card initialization completion state; when the insertion and unplugging state of the SIM card is the SIM card pulled out state, the application layer notifies the protocol layer to initialize the SIM card. After the protocol layer completes the initialization of the SIM card, the initialization state of the SIM card is obtained as the SIM card not inserted state.
[0089] S407. The communication module application layer receives the initialization status of the SIM card and sends the initialization status of the SIM card to the MCU through the serial port.
[0090] like Figure 1 As shown, the communication module sends the SIM card initialization status to the UART_RX of the MCU via UART_TX.
[0091] S408. MCU receives the initialization status of the SIM card from the communication module through the serial port.
[0092] like Figure 1 As shown in the figure, the MCU receives the SIM card initialization status from the communication module through UART_RX. After the MCU receives the SIM card initialization status, it can execute the service. The implementation method of MCU executing the service can be found in Figure 3 The detection method is described in the figure and will not be repeated here.
[0093] See also Figure 5 , Figure 5 This is a schematic diagram of the structure of a SIM card detection device provided in an embodiment of the present application. The SIM card detection device includes at least a detection module 501 and a determination module 502, wherein:
[0094] The detection module 501 is used to detect the level change of the test interface of the user identity module SIM card through the general purpose input and output GPIO interface;
[0095] The determination module 502 is used to determine the first state of the SIM card according to the level change of the test interface, where the first state is the SIM card insertion state or the SIM card removal state.
[0096] In an optional implementation, the SIM card detection device further includes: a sending module, used to send the first state of the SIM card to the communication module; a receiving module, used to receive the second state of the SIM card from the communication module, the second state being a SIM card preparation state or a SIM card not inserted state; and an execution module, used to execute a service according to the second state of the SIM card.
[0097] In an optional implementation, the determination module 502 determines the first state of the SIM card according to the level change of the test interface, and is specifically used to: when the level of the test interface changes from a low level to a high level, determine that the first state of the SIM card is the SIM card inserted state; when the level of the test interface changes from a high level to a low level, determine that the first state of the SIM card is the SIM card removed state.
[0098] The embodiments of the present application and the method embodiments shown above are based on the same concept, and the technical effects they bring are also the same. For the specific principles, please refer to the description of the embodiments shown above, and no further details will be given.
[0099] See also Figure 6 , Figure 6 This is a schematic diagram of the structure of another SIM card detection device provided in an embodiment of the present application. The SIM card detection device at least includes a receiving module 601, an obtaining module 602 and a sending module 603, wherein:
[0100] A receiving module 601 is used to receive a first state of a subscriber identity module SIM card from a controller, wherein the first state is a SIM card insertion state or a SIM card removal state;
[0101] An obtaining module 602 is used to initialize the SIM card according to the first state of the SIM card to obtain a second state of the SIM card, where the second state is a SIM card preparation state or a SIM card not inserted state;
[0102] The sending module 603 is configured to send the second state of the SIM card to the controller.
[0103] In an optional implementation, the obtaining module 602 initializes the SIM card according to the first state of the SIM card to obtain the second state of the SIM card, and is specifically used to: when the first state of the SIM card is the SIM card inserted state, initialize the SIM card to obtain the second state of the SIM card, and the second state is the SIM card preparation completion state; when the first state of the SIM card is the SIM card removed state, initialize the SIM card to obtain the second state of the SIM card, and the second state is the SIM card not inserted state.
[0104] The embodiments of the present application and the method embodiments shown above are based on the same concept, and the technical effects they bring are also the same. For the specific principles, please refer to the description of the embodiments shown above, and no further details will be given.
[0105] See also Figure 7 , Figure 7A schematic diagram of the structure of a computer device provided in an embodiment of the present application. The computer device includes at least a processor 701, a memory 703, and a user interface 702, wherein the processor 701, the memory 703, and the user interface 702 are interconnected, wherein the memory 703 is used to store a computer program, the computer program includes program instructions, and the processor 701 is used to execute the program instructions.
[0106] The memory 703 may include a volatile memory (volatile memory), for example, a random-access memory (RAM); the memory 703 may also include a non-volatile memory (non-volatile memory), for example, a flash memory, a solid-state drive (SSD), etc.; the memory 703 may also include a combination of the above-mentioned types of memory.
[0107] The processor 701 may be a central processing unit (CPU). The processor 701 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), etc. The PLD may be a field-programmable gate array (FPGA), a generic array logic (GAL), etc.
[0108] In an optional implementation, the memory 703 is also used to store program instructions. The processor 701 can call the program instructions: the processor 701 is configured to call the program instructions and perform the following steps:
[0109] Detect the level change of the test interface of the user identity module SIM card through the general input and output GPIO interface;
[0110] According to the level change of the test interface, the first state of the SIM card is determined, and the first state is a SIM card insertion state or a SIM card removal state.
[0111] Optionally, the processor 701 further performs the following steps: sending the first state of the SIM card to the communication module; receiving the second state of the SIM card from the communication module, the second state being a SIM card preparation state or a SIM card not inserted state; and executing a service according to the second state of the SIM card.
[0112] Optionally, the processor 701 determines the first state of the SIM card according to the level change of the test interface, and is specifically used to: when the level of the test interface changes from a low level to a high level, determine that the first state of the SIM card is the SIM card inserted state; when the level of the test interface changes from a high level to a low level, determine that the first state of the SIM card is the SIM card removed state.
[0113] In an optional implementation, the memory 703 is also used to store program instructions. The processor 701 can call the program instructions: the processor 701 is configured to call the program instructions and perform the following steps:
[0114] Receiving a first state of a subscriber identity module SIM card from a controller, wherein the first state is a SIM card insertion state or a SIM card removal state;
[0115] Initializing the SIM card according to the first state of the SIM card to obtain a second state of the SIM card, where the second state is a SIM card preparation completion state or a SIM card not inserted state;
[0116] The second state of the SIM card is sent to the controller.
[0117] Optionally, the processor 701 initializes the SIM card according to the first state of the SIM card to obtain the second state of the SIM card, and is specifically used to: when the first state of the SIM card is the SIM card inserted state, initialize the SIM card to obtain the second state of the SIM card, and the second state is the SIM card preparation completion state; when the first state of the SIM card is the SIM card removed state, initialize the SIM card to obtain the second state of the SIM card, and the second state is the SIM card not inserted state.
[0118] The embodiments of the present application and the method embodiments shown above are based on the same concept, and the technical effects they bring are also the same. For the specific principles, please refer to the description of the embodiments shown above, and no further details will be given.
[0119] The present application also provides a computer-readable storage medium, on which a detection program is stored. When the detection program is executed by a processor, the steps of a detection method in any of the above embodiments are implemented.
[0120] In the embodiments of the mobile terminal and computer-readable storage medium provided in the present application, all technical features of the embodiments of the above-mentioned detection method are included, and the expansion and explanation content of the specification are basically the same as those of the embodiments of the above-mentioned method, and will not be repeated here.
[0121] The embodiment of the present application further provides a computer program product, which includes a computer program code. When the computer program code runs on a computer, the computer executes the methods in the above various possible implementation modes.
[0122] An embodiment of the present application also provides a chip, including a memory and a processor, the memory is used to store a computer program, and the processor is used to call and run the computer program from the memory, so that a device equipped with the chip executes the methods in various possible implementation modes as described above.
[0123] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0124] The steps in the method of the embodiment of the present application can be adjusted in order, combined and deleted according to actual needs.
[0125] The units in the device of the embodiment of the present application can be merged, divided and deleted according to actual needs.
[0126] In the present application, the same or similar terminology concepts, technical solutions and / or application scenario descriptions are generally described in detail only the first time they appear. When they appear again later, they are generally not repeated for the sake of brevity. When understanding the technical solutions and other contents of the present application, for the same or similar terminology concepts, technical solutions and / or application scenario descriptions that are not described in detail later, reference can be made to the previous related detailed descriptions.
[0127] In the present application, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0128] The various technical features of the technical solution of the present application can be arbitrarily combined. In order to make the description concise, not all possible combinations of the various technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of the present application.
[0129] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as above, and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, a controlled terminal, or a network device, etc.) to execute the method of each embodiment of the present application.
[0130] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loading and executing computer program instructions on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, a computer, a server or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, a data center, etc. that contains one or more available media integrated. The available medium can be a magnetic medium, (e.g., a floppy disk, a storage disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state storage disk Solid State Disk (SSD)), etc.
[0131] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A SIM card detection system, characterized in that: The system comprises a controller, a communication module and a user identity module SIM card which are communicatively connected to each other, and a general purpose input and output GPIO interface of the controller is electrically connected to a test interface of the SIM card; The controller is used to detect the level change of the test interface of the SIM card through the GPIO interface, and determine the first state of the SIM card according to the level change of the test interface, where the first state is the SIM card insertion state or the SIM card removal state.
2. The detection system according to claim 1, characterized in that: The controller communicates with the communication module via a serial port, the transmitting interface of the controller is electrically connected to the receiving interface of the communication module, and the receiving interface of the controller is electrically connected to the transmitting interface of the communication module.
3. The detection system according to claim 2, characterized in that: The data interface of the communication module is electrically connected to the data interface of the SIM card, the clock interface of the communication module is electrically connected to the clock interface of the SIM card, the reset interface of the communication module is electrically connected to the reset interface of the SIM card, and the voltage interface of the communication module is electrically connected to the voltage interface of the SIM card.
4. A SIM card detection method, characterized in that: The method comprises: Detect the level change of the test interface of the user identity module SIM card through the general input and output GPIO interface; According to the level change of the test interface, the first state of the SIM card is determined, and the first state is a SIM card insertion state or a SIM card removal state.
5. The method according to claim 4, characterized in that The method further comprises: Sending the first state of the SIM card to a communication module; receiving a second state of the SIM card from the communication module, where the second state is a SIM card preparation completion state or a SIM card not inserted state; A service is executed according to the second state of the SIM card.
6. The method according to claim 4 or 5, characterized in that: Determining the first state of the SIM card according to the level change of the test interface includes: When the level of the test interface changes from a low level to a high level, determining that the first state of the SIM card is the SIM card insertion state; When the level of the test interface changes from a high level to a low level, it is determined that the first state of the SIM card is the SIM card removed state.
7. A SIM card detection method, characterized in that: The method comprises: Receiving a first state of a subscriber identity module SIM card from a controller, wherein the first state is a SIM card insertion state or a SIM card removal state; Initializing the SIM card according to the first state of the SIM card to obtain a second state of the SIM card, where the second state is a SIM card preparation completion state or a SIM card not inserted state; The second state of the SIM card is sent to the controller.
8. The method according to claim 7, characterized in that Initializing the SIM card according to the first state of the SIM card to obtain the second state of the SIM card includes: When the first state of the SIM card is the SIM card inserted state, the SIM card is initialized to obtain the second state of the SIM card, where the second state is the SIM card preparation completion state; When the first state of the SIM card is a state in which the SIM card is pulled out, the SIM card is initialized to obtain the second state of the SIM card, where the second state is a state in which the SIM card is not inserted.
9. A computer device, characterized in that: The computer device comprises: a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the method according to any one of claims 4 to 6 is implemented, or the method according to claim 7 or 8 is executed.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 4 to 6 is implemented, or the method according to claim 7 or 8 is executed.
