A kind ofly detect the method and system that SIM card falls card
Technical field
The present invention relates to SIM card technical field, particularly a kind ofly detect the method and system that SIM card falls card.
Background technology
The SIM(SubscriberIdentityModule that operator provides must be put in the terminal during the network that mobile terminal needs use operator to provide, client identification module) card, because SIM card is all by certain mechanical structure card in the terminal, and the contact corresponding to mobile terminal is connected, its electrical connection stability is relatively low, particularly mobile terminal has portability, often be in the middle of motion, even occur falling, the situation such as collision, be easy to the disconnecting making SIM card and mobile terminal, occur falling the phenomenon of card.
When the detection falling card for SIM card often needs to capture card by oscilloscope, the waveform of each pin of SIM card, judges that specifically which pin connects disconnection and causes SIM card and mobile terminal disconnecting.And fall card and often occur in very short time, and not easily reappear, and mobile terminal can not be connected oscilloscope all day by user to be used, therefore, in prior art, the instantaneous waveform captured when SIM card falls card is judged that the pin that actual physics connects disconnection does not still have effective method, mobile terminal can only be connected oscilloscope by tester constantly to use and reappear to fall card and capture waveform, take time and effort very much.
Thus prior art need to improve.
Summary of the invention
In view of above-mentioned the deficiencies in the prior art part, the object of the present invention is to provide and a kind ofly detect the method and system that SIM card falls card, instantaneous waveform when recovering card can be changed according to the level of each pin of SIM card of historical record when SIM card falls card, judge that actual physics connects the pin disconnected, effectively improve the pin detection efficiency that SIM card falls card.
In order to achieve the above object, this invention takes following technical scheme:
Detect the method that SIM card falls card, it comprises the steps:
A, be edge triggered interruption pattern by each pin configuration of SIM card;
B, detect the level state of each pin of described SIM card;
C, when detecting that described level state changes, obtaining and recording the level state information of current pin;
D, when SIM card Communications failure, stop detecting the level state of each pin, judge the pin disconnection information of SIM card according to the level state information of historical record.
Described detection SIM card is fallen in the method for card, and described step C specifically comprises:
C1, when detecting that described level state changes, obtaining and recording the title of current pin, the level of pin and current time.
Described detection SIM card is fallen in the method for card, and described step C1 specifically comprises:
When the level state of reset pin SIM card being detected changes, the title of reset pin is recorded as " RST ", obtains and records level and the current time of current reset pin;
When the level state of power pins SIM card being detected changes, the title of power pins is recorded as " VCC ", obtains and records level and the current time of current power pin;
When the level state of data pin SIM card being detected changes, the title of data pin is recorded as " DATA ", obtains and records level and the current time of current data pin;
When the level state of clock pins SIM card being detected changes, the title of clock pins is recorded as " CLK ", obtains and records level and the current time of present clock pin.
Described detection SIM card is fallen in the method for card, and described step D specifically comprises:
D1, when SIM card Communications failure, stop detecting the level state of each pin;
D2, in the level state information of historical record, judge according to time-sequencing to meet the pin connecting disconnection condition at first.
Described detection SIM card is fallen in the method for card, and described connection disconnection condition specifically comprises:
Judge that when the name of pin in described level state information is called " RST " and the level of pin is low level the reset pin of SIM card meets and connect disconnection condition;
Judge that when the name of pin in described level state information is called " VCC " and the level of pin is low level the power pins of SIM card meets and connect disconnection condition;
When the name of pin in described level state information be called " DATA " and a level N continuous clock cycle of pin is level or a N continuous clock cycle be high level time judge that the data pin of SIM card meets and connect disconnection condition, described N is 10;
When the name of pin in described level state information be called " CLK " and the level of pin continuous 2 clock cycle are level or continuous 2 clock cycle be high level time judge that the clock pins of SIM card meets and connect disconnection condition.
Detect the system that SIM card falls card, it comprises:
Configuration module, for being edge triggered interruption pattern by each pin configuration of SIM card;
Detection module, for detecting the level state of the pin of described SIM card;
Obtain logging modle, for when detecting that described level state changes, obtaining and recording the level state information of current pin;
Judging treatmenting module, for when SIM card Communications failure being detected, stops the level state detecting described pin, judges that the pin of SIM card disconnects information according to the level state information of historical record.
Described detection SIM card is fallen in the system of card, and described acquisition logging modle, specifically for when detecting that described level state changes, obtaining and recording the title of current pin, the level of pin and current time.
Described detection SIM card is fallen in the system of card, and described acquisition logging modle comprises:
First obtains record sub module, for when the level state of reset pin SIM card being detected changes, the title of reset pin is recorded as " RST ", obtains and records level and the current time of current reset pin;
Second obtains record sub module, for when the level state of power pins SIM card being detected changes, the title of power pins is recorded as " VCC ", obtains and records level and the current time of current power pin;
3rd obtains record sub module, for when the level state of data pin SIM card being detected changes, the title of data pin is recorded as " DATA ", obtains and records level and the current time of current data pin;
4th obtains record sub module, for when the level state of clock pins SIM card being detected changes, the title of clock pins is recorded as " CLK ", obtains and records level and the current time of present clock pin.
Described detection SIM card is fallen in the system of card, and described judging treatmenting module comprises:
Process submodule, for when SIM card Communications failure, stops the level state of the described pin of detection;
Judge submodule, in the level state information of historical record, judge according to time-sequencing to meet the pin connecting disconnection condition at first.
Described detection SIM card is fallen in the system of card, and described judgement submodule comprises:
First judging unit, connects disconnection condition for judging that when the name of pin in described level state information is called " RST " and the level of pin is low level the reset pin of SIM card meets;
Second judging unit, connects disconnection condition for judging that when the name of pin in described level state information is called " VCC " and the level of pin is low level the power pins of SIM card meets;
3rd judging unit, for be called " DATA " when the name of pin in described level state information and a level N continuous clock cycle of pin is level or a N continuous clock cycle be high level time judge that the data pin of SIM card meets and connect disconnection condition, described N is 10;
4th judging unit, for be called " CLK " when the name of pin in described level state information and the level of pin continuous 2 clock cycle are level or continuous 2 clock cycle be high level time judge that the clock pins of SIM card meets and connect disconnection condition.
Compared to prior art, described in the method and system that detection SIM card provided by the invention falls card, system is by arranging configuration module, detection module, acquisition logging modle and judging treatmenting module, is edge triggered interruption pattern by each pin configuration of SIM card; Detect the level state of each pin of described SIM card afterwards; When detecting that described level state changes, obtaining and recording the level state information of current pin; When SIM card Communications failure, stop the level state detecting each pin, judge that the pin of SIM card disconnects information according to the level state information of historical record, thus instantaneous waveform when can recover card according to the change of the level of each pin of SIM card of historical record when SIM card falls card, judge that actual physics connects the pin disconnected, effectively improve pin detection efficiency and accuracy that SIM card falls card.
Accompanying drawing explanation
Fig. 1 is the flow chart that detection SIM card provided by the invention falls the method for card.
Fig. 2 is the structured flowchart that detection SIM card provided by the invention falls the system of card.
Fig. 3 is that detection SIM card provided by the invention falls the structured flowchart obtaining logging modle and each pin of SIM card in the system of card.
Embodiment
In view of in prior art for the instantaneous waveform that cannot effectively capture when SIM card falls card, judge that actual physics connects the inefficient shortcoming of pin disconnected, the object of the present invention is to provide and a kind ofly detect the method and system that SIM card falls card, instantaneous waveform when recovering card can be changed according to the level of each pin of SIM card of historical record when SIM card falls card, judge that actual physics connects the pin disconnected, effectively improve the pin detection efficiency that SIM card falls card.
For making object of the present invention, technical scheme and effect clearly, clearly, developing simultaneously referring to accompanying drawing, the present invention is described in more detail for embodiment.Should be appreciated that specific embodiment described herein only in order to explain the present invention, be not intended to limit the present invention.
Refer to Fig. 1, the method that detection SIM card provided by the invention falls card comprises the steps:
S100, be edge triggered interruption pattern by each pin configuration of SIM card;
S200, detect the level state of each pin of described SIM card;
S300, when detecting that described level state changes, obtaining and recording the level state information of current pin;
S400, when SIM card Communications failure, stop detecting the level state of described pin, judge the pin disconnection information of SIM card according to the level state information of historical record.
At present, conventional SIM card at least includes reset pin RST, power pins VCC, data pin DATA, and clock pins CLK, the present invention is by being connected each pin of SIM card with system in advance, and be edge triggered interruption pattern by each pin configuration of SIM card, detect the level state of each pin of described SIM card simultaneously, when detecting that described level state changes, obtain and record the level state information that current level state there occurs the pin of change, the level state detecting each pin is stopped when SIM card Communications failure, instantaneous waveform when falling card according to the level state Information recovering of historical record, thus judge that the actual physics of SIM card connects the pinout information disconnected, achieve Waveshape reproduction when SIM card falls card, contribute to the pinout information judging that actual connection disconnects, substantially increase the efficiency that SIM card falls card detection.
Wherein, described step S300 specifically comprises: when detecting that described level state changes, and obtains and records the title of current pin, the level of pin and current time.
Namely when detecting that the level state of any one pin in reset pin RST, the power pins VCC of SIM card, data pin DATA and clock pins CLK changes, obtain and record current level state and there occurs the title of the pin of change, the level of pin and current time, for the Waveshape reproduction falling card moment provides reliable information.
Particularly, when the level state of reset pin SIM card being detected changes, the title of reset pin is recorded as " RST ", obtains and records level and the current time of current reset pin; When the level state of power pins SIM card being detected changes, the title of power pins is recorded as " VCC ", obtains and records level and the current time of current power pin; When the level state of data pin SIM card being detected changes, the title of data pin is recorded as " DATA ", obtains and records level and the current time of current data pin; When the level state of clock pins SIM card being detected changes, the title of clock pins is recorded as " CLK ", obtains and records level and the current time of present clock pin.
Such as, the level of power pins is high level, when the level of power pins becomes low level, then will produce edge (trailing edge) to interrupt, now the title of power pins is recorded as " VCC " by system, and obtains level (current is low level) and the current time (be such as 1876.455186909 seconds, this time is the time after distance start) of power pins, preserve, as follows:
Pin name " VCC ", low level, 1876.455186909;
Equally, when the level state of other pin of SIM card changes, system also will record its level state information according to above-mentioned record rule.
Further, described step S400 specifically comprises:
When SIM card Communications failure, stop the level state detecting described pin;
In the level state information of historical record, judge according to time-sequencing to meet the pin connecting disconnection condition at first.
During concrete enforcement, described connection disconnects condition and specifically comprises:
Judge that when the name of pin in described level state information is called " RST " and the level of pin is low level the reset pin of SIM card meets and connect disconnection condition;
Judge that when the name of pin in described level state information is called " VCC " and the level of pin is low level the power pins of SIM card meets and connect disconnection condition;
When the name of pin in described level state information be called " DATA " and a level N continuous clock cycle of pin is level or a N continuous clock cycle be high level time judge that the data pin of SIM card meets and connect disconnection condition, described N is 10, and the described clock cycle is cycle of clock pins output clock;
When the name of pin in described level state information be called " CLK " and the level of pin continuous 2 clock cycle are level or continuous 2 clock cycle be high level time judge that the clock pins of SIM card meets and connect disconnection condition, the described clock cycle is cycle of clock pins output clock.
Due to when reality uses, when the pin physical connection of a SIM card disconnects, other pin communicating interrupt can be caused, the final pin that other physical connections also can be made not disconnect meets connection disconnection condition, therefore, when SIM card Communications failure, namely SIM card is connected when disconnecting with system, stop the level state detecting each pin, in the level state information of historical record, time is sorted according to sequencing, judge which pin meets at first according to time-sequencing and connect disconnection condition, be judged as that actual physics connects the pin disconnected by it, thus achieve the pin being judged actual connection disconnection by historical record level information, improve the accuracy that SIM card falls card detection.
Such as, when SIM card Communications failure, the level state information of historical record is as follows:
Suppose that some records all do not meet above and connect disconnection condition;
Pin name " RST ", low level, 1876.455186909;
Pin name " VCC ", low level, 1876.455196156;
Pin name " DATA ", low level, 1876.455212170;
From the level state information of above-mentioned historical record, pin, power pins, data pin all meet connection disconnection condition, but reset pin meets connection disconnection condition at first, therefore by above-mentioned in the level state information of historical record, the method meeting the pin connecting disconnection condition is at first judged according to time-sequencing, judging that actual physics connects the pin disconnected is reset pin, instantaneous waveform when SIM card being fallen card recovers, the accurate pin judging actual connection disconnection, effectively improves the pin detection efficiency that SIM card falls card.
Refer to Fig. 2, the present invention is also corresponding to be provided a kind of and detects the system that SIM card falls card, and it comprises: configuration module 10, detection module 20, obtain logging modle 30 and judging treatmenting module 40.Wherein, described configuration module 10 is for being edge triggered interruption pattern by each pin configuration of SIM card; Described detection module 20 is for detecting the level state of each pin of described SIM card; Described acquisition logging modle 30, for when detecting that described level state changes, obtaining and recording the level state information of current pin; Described judging treatmenting module 40, for when SIM card Communications failure being detected, stops the level state detecting described pin, judges that the pin of SIM card disconnects information according to the level state information of historical record.
Each pin configuration of SIM card is edge triggered interruption pattern by configuration module 10 by the system that detection SIM card provided by the invention falls card; The level state of each pin of described SIM card is detected by detection module 20; When detection module 20 detects that described level state changes, obtain by obtaining logging modle 30 and record the level state information that current level state there occurs the pin of change; When SIM card Communications failure, the level state detecting each pin is stopped by judging treatmenting module 40, and instantaneous waveform when falling card according to the level state Information recovering of historical record, thus judge that the actual physics of SIM card connects the pinout information disconnected, achieve Waveshape reproduction when SIM card falls card, contribute to the pinout information judging that actual connection disconnects, substantially increase the efficiency that SIM card falls card detection.
Wherein, described acquisition logging modle 30, specifically for when detecting that described level state changes, obtaining and recording the title of current pin, the level of pin and current time.When detection module 20 detects that the level state of any one pin in reset pin RST, the power pins VCC of SIM card, data pin DATA and clock pins CLK changes, acquisition logging modle 30 obtains and records current level state and there occurs the title of the pin of change, the level of pin and current time, and the Waveshape reproduction falling card moment for SIM provides reliable information.
Particularly, see also Fig. 3, described acquisition logging modle 30 comprises: first obtains record sub module 401, second obtains record sub module 402, the 3rd acquisition record sub module 403 and the 4th acquisition record sub module 404, and described first obtains record sub module 401 is connected with the reset pin RST of SIM card; Described second obtains record sub module 402 is connected with the power pins VCC of SIM card; Described 3rd obtains record sub module 403 is connected with the data pin DATA of SIM card; Described 4th obtains record sub module 404 is connected with the clock pins CLK of SIM card.
Described first obtain record sub module 401 for when the level state of reset pin SIM card being detected changes, and the title of reset pin is recorded as " RST ", obtains and records level and the current time of current reset pin; Described second obtain record sub module 402 for when the level state of power pins SIM card being detected changes, and the title of power pins is recorded as " VCC ", obtains and records level and the current time of current power pin; Described 3rd obtain record sub module 403 for when the level state of data pin SIM card being detected changes, and the title of data pin is recorded as " DATA ", obtains and records level and the current time of current data pin; Described 4th obtain record sub module 404 for when the level state of clock pins SIM card being detected changes, and the title of clock pins is recorded as " CLK ", obtains and records level and the current time of present clock pin.
Such as, the level of power pins is high level, when the level of power pins becomes low level, then will produce edge (trailing edge) to interrupt, now the title of power pins is recorded as " VCC " by described second acquisition record sub module 402, and obtains level (current is low level) and the current time (be such as 1876.455186909 seconds, this time is the time after distance start) of power pins, preserve, as follows:
Pin name " VCC ", low level, 1876.455186909;
Equally, when the level state of other pin of SIM card changes, first obtains record sub module 401, the 3rd acquisition record sub module 403 and the 4th acquisition record sub module 404 also will record its level state information according to above-mentioned record rule.
Further, described judging treatmenting module 40 comprises process submodule (not shown) and judges submodule (not shown), and described process submodule is used for when SIM card Communications failure, stops the level state detecting described pin; Described judgement submodule is used in the level state information of historical record, judges to meet the pin connecting disconnection condition at first according to time-sequencing.
Due to reality use time, when the pin physical connection of a SIM card disconnects, other pin communicating interrupt can be caused, the final pin that other physical connections also can be made not disconnect meets connection disconnection condition, therefore, when SIM card Communications failure, described judgement submodule controls the level state stopping detecting each pin, and in the level state information of historical record, time is sorted according to sequencing, judge which pin meets at first according to time-sequencing and connect disconnection condition, be judged as that actual physics connects the pin disconnected by it, thus instantaneous waveform reproduction when SIM card being fallen card by historical record level information, and judge the actual pin connecting disconnection by this waveform, improve the accuracy that SIM card falls card detection.Specific embodiment falls in the embodiment of the method for card to be described in detail in above-mentioned detection SIM card, repeats no more herein.
Further, described judgement submodule comprises the first judging unit (not shown), the second judging unit (not shown), the 3rd judging unit (not shown) and the 4th judging unit (not shown), and described first judging unit is used for judging when the name of pin in described level state information is called " RST " and the level of pin is low level that the reset pin of SIM card meets and connects disconnection condition; Described second judging unit is used for judging when the name of pin in described level state information is called " VCC " and the level of pin is low level that the power pins of SIM card meets and connects disconnection condition; Described 3rd judging unit be used for when the name of pin in described level state information be called " DATA " and a level N continuous clock cycle of pin is level or a N continuous clock cycle be high level time judge the data pin of SIM card satisfied connection disconnection condition, described N is 10, and the described clock cycle is cycle of clock pins output clock; Described 4th judging unit be used for when the name of pin in described level state information be called " CLK " and the level of pin continuous 2 clock cycle are level or continuous 2 clock cycle be high level time judge the clock pins of SIM card satisfied connection disconnection condition, the described clock cycle is cycle of clock pins output clock.Thus when the level state of each pin of SIM card changes, accurately can judge whether each pin meets and connect disconnection condition, the Waveshape reproduction falling card moment for SIM card provides level state information accurately.
In sum, described in the method and system that detection SIM card provided by the invention falls card, system is by arranging configuration module, detection module, acquisition logging modle and judging treatmenting module, is edge triggered interruption pattern by each pin configuration of SIM card; Detect the level state of each pin of described SIM card afterwards; When detecting that described level state changes, obtaining and recording the level state information of current pin; When SIM card Communications failure, stop the level state detecting each pin, judge that the pin of SIM card disconnects information according to the level state information of historical record, thus instantaneous waveform when can recover card according to the change of the level of each pin of SIM card of historical record when SIM card falls card, judge that actual physics connects the pin disconnected, effectively improve pin detection efficiency and accuracy that SIM card falls card.
Be understandable that, for those of ordinary skills, can be equal to according to technical scheme of the present invention and inventive concept thereof and replace or change, and all these change or replace the protection range that all should belong to the claim appended by the present invention.