CN101572963A - Baseband communication functional device and communication method thereof - Google Patents

Baseband communication functional device and communication method thereof Download PDF

Info

Publication number
CN101572963A
CN101572963A CNA2008101056348A CN200810105634A CN101572963A CN 101572963 A CN101572963 A CN 101572963A CN A2008101056348 A CNA2008101056348 A CN A2008101056348A CN 200810105634 A CN200810105634 A CN 200810105634A CN 101572963 A CN101572963 A CN 101572963A
Authority
CN
China
Prior art keywords
instruction
sim card
apdu
command sequence
control module
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CNA2008101056348A
Other languages
Chinese (zh)
Other versions
CN101572963B (en
Inventor
侯清富
王小旭
赵旭
常嘉岳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Mobile Communications Group Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Mobile Communications Group Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN2008101056348A priority Critical patent/CN101572963B/en
Publication of CN101572963A publication Critical patent/CN101572963A/en
Application granted granted Critical
Publication of CN101572963B publication Critical patent/CN101572963B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention relates to the field of communication, in particular to communication technology between a mobile terminal and an SIM card. The communication method between the mobile terminal and the SIM card comprises the following steps: stopping the processing of subsequent AT instructions after processing the current AT instruction or determining that no AT instruction is required to be processed currently when receiving a first instruction of an APDU instruction sequence; and sequentially processing various received instructions in the APDU instruction sequence, and continuing to process the subsequent AT instructions after processing a final instruction in the APDU instruction sequence. The invention also provides a communication device between the mobile terminal and the SIM card. Because the APDU instruction sequence is executed and processed after waiting for the completion of the processing of the current AT instruction and the processing of the AT instructions is stopped in the process of processing the APDU instruction sequence, the completeness of the process of processing the AT instructions or the APDU instruction sequence is guaranteed and the communication function between the mobile terminal and the SIM card is enhanced.

Description

A kind of baseband communication functional device and communication means
Technical field
The present invention relates to the communications field, relate in particular to the communication technology between portable terminal and the SIM card.
Background technology
SIM (Subscriber Identity Module, Subscriber Identity Module) card is a kind of smart card that is used for mobile communications device (as modal hand-hold type portable terminal).Comprising user totem information, user's MSISDN (Mobile Station ISDN, travelling carriage ISDN) number for example.The user can be by SIM card is moved to another portable terminal from a portable terminal and is changed portable terminal simply.
Information in the SIM card is recorded in the file usually and preserves, portable terminal by by the APDU (ApplicationProtocol Data Unit, Application Protocol Data Unit) of International Organization for Standardization/International Electrotechnical Commission (IEC) 7816 standard definitions order to SIM card read, operation such as preservation information.For example, the information of preserving in certain file in the portable terminal reading SIM card, usually need to use two APDU order: article one APDU to order to selecting the select command of corresponding document and data record, SIM card receives this order back and carries out the data record of choosing correspondence in corresponding document and the file; Second APDU order is the reading of data order, because SIM card has been chosen respective file and data record after executing article one APDU order, then carry out second APDU when order and just return this respective file that reads out and the numerical value of data record to portable terminal, thus the information of preserving in certain specific file in the realization portable terminal reading SIM card.
As shown in Figure 1, various application programs in the portable terminal are not directly used the APDU instruction to communicate by letter with SIM card usually or are controlled SIM card, but could realize communicating by letter, control the function that SIM card 103 is operated after by baseband communication functional device 102 AT of the application program in the application function device 101 (Attention notes) instruction transformation being become the APDU instruction with SIM card 103.
Wherein, application function device 101 is positioned at portable terminal, the application program that realizes multiple business or function is arranged, it links to each other with the input/output interface module 104 of baseband communication functional device 102 by lead (as serial, parallel bus or usb communication bus) or Radio Link (as infrared, bluetooth), and realization is communicated by letter with baseband communication functional device 102.
Baseband communication functional device 102 receives the AT instruction of application program for being positioned at the circuit arrangement of portable terminal by input/output interface module 104.In SIM card control module 105, has instruction converting unit, its major function is that the corresponding relation according to AT instruction and APDU instruction is corresponding APDU command sequence with the AT instruction transformation, SIM card control module 105 is instructed to the APDU that SIM card 103 sends in the APDU command sequence successively by SIM card interface module 106, SIM card 103 is returned the execution result of APDU instruction by SIM card interface module 106, and SIM card control module 105 returns to application program by input/output interface module 104 with the result.
Wireless communication module 107 in the baseband communication functional device 102 is to be used for carrying out two-way communication with base station (Base Station) equipment of mobile communications network.Receive the information that network side sends by air interface, export to input/output interface module 104 after information translation become AT instruction, be converted to APDU instruction back by SIM card interface module 106 visit SIM card 103 by SIM card control module 105 then, SIM card returns to SIM card control module 105 with result by SIM card interface module 106; And SIM card control module 105 sends to network side by the result that wireless communication module 107 will return.
It is the instruction that approaches bottom hardware that APDU instructs, and the AT instruction is the more instruction on upper strata with respect to the APDU instruction, is easier to programming personnel's understanding, memory than the APDU instruction, and the programming personnel uses the AT instruction to write application program usually.In general, corresponding many APDU instruction of AT instruction, i.e. an APDU command sequence.The baseband communication functional device becomes the APDU command sequence to realize communicating by letter of application program and SIM card the AT instruction transformation of application program.
Which AT instruction transformation the baseband communication functional device can become the APDU command sequence then is that production firm by the baseband communication functional device is determined.In other words, if the baseband communication functional device of manufacturers produce is not realized the corresponding relation of certain AT instruction and APDU command sequence, application program just can't use this AT instruction to communicate by baseband communication functional device and SIM card so.
Along with development of technology, more and more based on the new business of SIM card.For example, mobile TV service is exactly a kind of new business based on SIM card, and finish this new business needs to be used to protect the business cipher key of business tine to store SIM card into.The technical staff need adopt new next the communication with SIM card of AT instruction to realize this function, and the AT instruction before just all is not enough to finish the function of communicating by letter with SIM card of this business.So, because the baseband communication functional device is not also supported the corresponding APDU command sequence of new AT instruction, so the application program of mobile TV service just can't communicate by baseband communication functional device and SIM card.
Except that mobile TV service, adopt new AT to instruct for many other new business or application need and finish under the situation of corresponding function, also need the production firm of baseband communication functional device to increase the corresponding relation of new AT instruction and APDU command sequence.This need hold consultation with these manufacturers, and then after it agree to be revised design and produces the baseband communication functional device that makes new advances, the application program of new business could realize and the communicating by letter of SIM card that this process often needs some months even, two years.Obviously, the speed that the baseband communication functional device upgrades has hindered portable terminal new business, function development and application well below to the new business of portable terminal, the speed that function is innovated.
In order to realize communicating by letter of new application program and SIM card as early as possible, consider a kind of method as shown in Figure 2, application program in the application function device 201 use the APDU instruction by input/output interface module 202, SIM card interface module 203 directly and SIM card 204 communicate; Because SIM card interface module 203 can directly be carried out the APDU instruction, therefore no longer needs the baseband communication functional device to carry out instruction transformation.But many existing application programs all are based on the AT instruction, if remove the instruction transformation function of baseband communication functional device, then must transform these existing application programs, transform it as instruct based on APDU application program, this will be time-consuming, as a to require great effort job.Therefore consider that from the angle of cost this method is infeasible substantially.
Fig. 3 a shows the another kind of schematic diagram of realizing that new application program is communicated by letter with SIM card.The input/output interface module 304 of baseband communication functional device 302 had both received the AT instruction that application program sends in the application function device 301, also received the APDU instruction that application program sends.
When input/output interface module 304 receives the AT instruction of application program, SIM card control module 305 becomes the APDU command sequence with the AT instruction transformation that receives, and use the APDU command sequence, and the result that SIM card 303 is returned is returned to application program by input/output interface module 304 by SIM card interface module 306 visit SIM card 303.
For application program newly developed, owing to there is not the corresponding APDU command sequence of new AT instruction in SIM card control module 305, application program newly developed adopts APDU to instruct directly and SIM card communicates.The APDU that receives application program when input/output interface module 304 instructs, and then directly the APDU instruction that receives is sent to SIM card 303 by SIM card interface module 306, and the result that SIM card 303 is returned sends to application program.
By said method, appear to the problem of baseband communication functional device that solved to portable terminal and SIM card communication restriction.But APDU instructs, the situation of AT instruction if two application programs send respectively simultaneously, will occur the operation or the response of mistake so.
Flow chart when Fig. 3 b shows the AT instruction of APDU instruction that SIM card control module 305 handles application program 1 simultaneously and application program 2.Suppose that the function of application program 1 is the data record of GBA (Generic Bootstrapping Architecture, universal guiding structure) file in the change SIM card, and application program 1 is to communicate with SIM card by the APDU instruction; The function of application program 2 is IMSI (International Mobile Subscriber Identity, the international mobile subscriber identification number) sign indicating numbers in the reading SIM card, and application program 2 communicates with SIM card by the AT instruction.Application program 1, application program 2 and SIM card communication process are as follows:
S311: application program 1 directly sends the APDU instruction of selecting the GBA file to SIM card by input/output interface module, SIM card interface module: Select File GBA.
The S312:SIM card returns the affirmation information of choosing the GBA file to application program 1 after choosing corresponding GBA file according to the APDU instruction of the selection GBA file that receives.
S313: just this moment, application program 2 needed IMSI sign indicating number in the reading SIM card owing to receive user's associative operation, had therefore sent the AT instruction of reading the IMSI sign indicating number to the SIM card control module by the input/output interface module: AT+Get IMSI.
S314:SIM card control module is decomposed into the APDU command sequence with the AT instruction after receiving the AT instruction of reading the IMSI sign indicating number:
APDU instruction 1: select IMSI file (Select File IMSI);
APDU instruction 2: read IMSI (Read Binary IMSI).
S315:SIM card control module sends APDU instruction 1---Select File IMSI by the SIM card interface module to SIM card.
The S316:SIM card instructs according to Select File IMSI and carries out the operation of choosing the IMSI file, and to SIM card control module return successful information.
Originally according to normal flow process, SIM card should be carried out the APDU that revises or read GBA file data record and instruct and finish operation to the GBA file after the APDU instruction that executes the selection GBA file that application program 1 sends; Yet because application program 2 has sent the AT instruction, the APDU instruction that causes the SIM card control module to insert other between former and later two APDU instructions of application program 1 between the selection GBA of application program 1 file APDU instruction and modification GBA file data record APDU instruction.Obviously this will upset the instruction execution in step of application program 1.
S317:SIM card control module sends APDU instruction 2---Read Binary IMSI by the SIM card interface module to SIM card.
The S318:SIM card returns the IMSI sign indicating number to the SIM card control module after reading IMSI sign indicating number in the IMSI file of choosing; The SIM card control module returns to application program 2 with the IMSI sign indicating number.
S319: application program 1 directly sends the APDU instruction of revising GBA file data record to SIM card by input/output interface module, SIM card interface module: Update Record GBA.
S320: because SIM card had before been carried out the APDU instruction of choosing the IMSI file, what this moment, SIM card was chosen is the IMSI file, so when SIM card receives and carries out Update Record GBA instruction, can cause instructing execution error because file type is different, return error notification Update Record GBAFLASE.
Therefore the method for handling AT instruction or APDU instruction in the time of above-mentioned can not guarantee the complete implementation of AT instruction or APDU instruction, if apply in the portable terminal, the processing of the application program of parallel running in the portable terminal is tanglewracked.
Summary of the invention
The embodiment of the invention provides a kind of portable terminal and SIM card method for communicating and baseband communication functional device, guarantees the integrality of AT instruction or APDU command sequence implementation.
A kind of baseband communication functional device comprises the SIM card interface module, also comprises:
The input/output interface module is used to receive AT instruction and APDU instruction and the output that application program sends;
The first SIM card control module is used for receiving the AT instruction from described input/output interface module, and the AT that receives by described SIM card interface module and SIM card interaction process instructs; According to the time-out notice of receiving, confirming to return the time-out confirmation after current no AT instruction needs processing or handles current AT instruction, and suspending the processing of follow-up AT instruction; And handle notice according to the continuation of receiving and continue the processing that follow-up AT instructs;
The second SIM card control module, be used for receiving the APDU instruction from described input/output interface module, send described time-out notice in the APDU instruction that confirm to receive during for article one instruction of APDU command sequence, after receiving the time-out confirmation of returning by described SIM card interface module and the described APDU command sequence of SIM card interaction process; And when the last item instruction of the described APDU command sequence that disposes, send described continuation and handle notice.
The described second SIM card control module comprises:
The second Instructions Cache unit is used for the APDU instruction that buffer memory receives from described input/output interface module;
Command sequence integrality judging unit is used for sending described time-out notice when the APDU instruction of confirming the reception of the described second Instructions Cache unit is instructed for article one of APDU command sequence; After receiving the time-out confirmation of returning, send APDU instruction exercise notice; When the last item instruction of the described APDU command sequence of confirming to dispose, send described continuation and handle notice;
Second instruction execution unit is used for according to described APDU instruction exercise notice, the described APDU command sequence of sequential processes.
The described first SIM card control module comprises:
The first Instructions Cache unit is used for the AT instruction that buffer memory receives from described input/output interface module;
First instruction execution unit is used for order and carries out the AT instruction of handling the described first Instructions Cache unit caches;
The instruction process control unit is used for according to the time-out notice of receiving, is confirming to return the time-out confirmation after current AT instruction need be handled or handle to current no AT instruction, and is suspending the processing of follow-up AT instruction; And, notify described first instruction execution unit to continue the processing of follow-up AT instruction according to the continuation processing notice of receiving.
A kind of baseband communication functional device comprises the SIM card interface module, also comprises:
The input/output interface module is used to receive AT instruction and APDU instruction and the output that application program sends;
The first SIM card control module is used for receiving AT when instruction from described input/output interface module, sends and suspends notice; And after receiving the time-out confirmation, handle described AT instruction; After the described AT instruction that disposes, send and continue to handle notice;
The second SIM card control module is used for receiving the APDU instruction from described input/output interface module, and the APDU that receives by described SIM card interface module and SIM card interaction process instructs; According to the described time-out notice that receives, after confirming to handle the last item instruction of the current APDU command sequence of handling, suspend processing, and return the time-out confirmation follow-up APDU command sequence; After receiving described continuation processing notice, continue the processing of follow-up APDU command sequence.
A kind of baseband communication functional device comprises: the first SIM card control module, SIM card interface module also comprise:
Input/output interface module, the instruction that is used to distinguish reception are AT instruction or APDU instruction, and the AT instruction is sent to the described first SIM card control module; The APDU instruction is sent to the described second SIM card control module;
The second SIM card control module is used for sending the first switching notice information when confirming to receive article one instruction of APDU command sequence; When receiving the confirmation information, carry out processing APDU instruction by described SIM card interface module and SIM card interaction sequences; When the last item instruction of the described APDU command sequence of determining to dispose, send the second switching notice information;
The interface monitoring module, be used for according to the described first switching notice information, monitoring described SIM card interface module bus during the free time, communicating to connect from the first SIM card control module of described SIM card interface module switched to the second SIM card control module, and return confirmation; According to the described second switching notice information, communicating to connect from the described second SIM card control module of described SIM card interface module switched to the first SIM card control module.
A kind of baseband communication functional device comprises: the SIM card interface module also comprises:
Input/output interface module, the instruction that is used to distinguish reception are AT instruction or APDU instruction, and the AT instruction is sent to the described first SIM card control module; The APDU instruction is sent to the described second SIM card control module;
The first SIM card control module is used for sending the first switching notice information when receiving the AT instruction; When receiving the confirmation information, carry out processing AT instruction alternately by described SIM card interface module and SIM card; After handling described AT instruction, send the second switching notice information;
The second SIM card control module, be used for by with the communicating to connect of described SIM card interface module, handle the APDU command sequence that receives;
The interface monitoring module, be used for according to the described first switching notice information, monitoring described SIM card interface module bus during the free time, communicating to connect from the second SIM card control module of described SIM card interface module switched to the first SIM card control module, and return confirmation; According to the described second switching notice information, communicating to connect from the described first SIM card control module of described SIM card interface module switched to the second SIM card control module.
A kind of portable terminal and SIM card method for communicating comprise:
In article one when instruction that receives the APDU command sequence, after current AT instruction process finished or confirming that current no AT instruction needs to handle, suspend and handle follow-up AT and instruct;
From described article one instruction, sequential processes receives each the bar instruction in the described APDU command sequence, and after the instruction of the last item in the described APDU command sequence that disposes, continues to handle described follow-up AT instruction.
Preferable, definite method of article one instruction of described APDU command sequence specifically comprises:
When APDU instruction that the instruction that receives begins for indication APDU command sequence, then confirm the next APDU instruction that receives article one instruction for described APDU command sequence.
And the definite method of the instruction of the last item in the described APDU command sequence, specifically comprise:
When confirming to indicate the APDU instruction of APDU command sequence end, the last item instruction that the previous APDU instruction of determining the APDU instruction that this indication APDU command sequence finishes is described APDU command sequence.
Preferable, method is determined in article one instruction of described APDU command sequence, specifically comprises:
Instruct on the APDU that receives instruction and the top of instruction tree of APDU instruction execution sequence in having write down each APDU command sequence when identical, determine that this APDU instruction instructs for article one of APDU command sequence.
And the definite method of the instruction of the last item in the described APDU command sequence, specifically comprise:
Instruct when identical at APDU instruction and the end of APDU instruction execution sequence instruction tree in having write down each APDU command sequence, determine that this APDU instruction instructs for the last item of APDU command sequence.
A kind of portable terminal and SIM card method for communicating comprise:
Receiving AT when instruction, after current APDU command sequence is disposed or confirming that current no APDU command sequence need be handled, suspending the follow-up APDU command sequence of processing;
The AT instruction that processing receives after the described AT instruction that disposes, continues to handle described follow-up APDU command sequence.
The embodiment of the invention is carried out processing APDU command sequence again because the second SIM card control module is waited for after the first SIM card control module is handled current AT instruction, and in processing APDU command sequence process, notify or control the processing that first SIM card control module time-out instructs to AT, thereby the processing procedure that has guaranteed AT instruction and APDU command sequence is not upset, guaranteed the integrality of the execution processing procedure of AT instruction or APDU sequence of instructions, strengthened portable terminal by the communication function between AT instruction or APDU command sequence and the SIM card.
Description of drawings
The schematic diagram that Fig. 1 communicates by letter with SIM card for the application program in the portable terminal of prior art one;
The schematic diagram that Fig. 2 communicates by letter with SIM card for the application program in the portable terminal of prior art two;
Fig. 3 a is the schematic diagram that the application program in the portable terminal of prior art three is communicated by letter with SIM card;
Fig. 3 b is the flow chart that the application program in the portable terminal of prior art three is communicated by letter with SIM card;
The system schematic that Fig. 4 communicates by letter with SIM card for the application program in the portable terminal of the embodiment of the invention one;
Fig. 5 is the second SIM card control module internal structure schematic diagram of the embodiment of the invention one;
Fig. 6 is application program and the SIM card method for communicating flow chart in the portable terminal of the embodiment of the invention one;
The system schematic that Fig. 7 communicates by letter with SIM card for the application program in the portable terminal of the embodiment of the invention two;
Fig. 8 is the first SIM card control module and the second SIM card control module internal structure schematic diagram of the embodiment of the invention two;
Fig. 9 is application program and the SIM card method for communicating flow chart in the portable terminal of the embodiment of the invention two.
Embodiment
The present invention expands another SIM card control module on the basis of existing baseband communication functional device.Be convenient and describe that the former SIM card control module that will have now in the baseband communication functional device is called the first SIM card control module herein, the AT instruction that be used to receive, the handle mobile terminal application program sends.Another SIM card control module of expansion is called the second SIM card control module, is used to receive the APDU command sequence that sends with the handle mobile terminal application program.In order to have guaranteed the integrality of the first SIM card control module to AT instruction process process, and the complete execution that guarantees the APDU command sequence of the second SIM card control module, when the second SIM card control module receives the APDU instruction of application program, need to determine whether the first SIM card control module is handling the AT instruction.If wait for that then the first SIM card control module disposes after the current AT instruction, stops the processing of follow-up AT instruction.After the first SIM card control module disposed current AT instruction, the second SIM card control module began the APDU command sequence that sequential processes receives.After the second SIM card control module disposed this APDU command sequence, the first SIM card control module can continue to handle follow-up AT instruction.
Like this, interrupt of the processing of the first SIM card control module after the first SIM card control module finishes to the AT instruction process again, guaranteed the integrality of the first SIM card control module AT instruction process process to follow-up AT instruction because the second SIM card control module is waited for; And the second SIM card control module is by SIM card interface module sequential processes APDU command sequence, and after the last item instruction of handling the APDU command sequence, control recovers the first SIM card control module by SIM card interface module continuation processing AT instruction again, has therefore guaranteed the complete execution of the APDU command sequence of the second SIM card control module again.Application program based on such method portable terminal just both can also can communicate with SIM card by the APDU instruction by the AT instruction, make portable terminal and communicating by letter of SIM card no longer be subjected to the restriction of existing baseband communication functional device, strengthened the communication function between portable terminal and the SIM card.
Be elaborated below in conjunction with accompanying drawing.The invention provides two specific embodiments, wherein embodiment one increases some peripheral modules on the basis of former SIM card control module, realizes that the second SIM card control module is to control of communication between the first SIM card control module and the SIM card interface module; The technical scheme of embodiment two then is after the first SIM card control module has been increased corresponding function, the second SIM card control module is directly notified the first SIM card control module, thereby reaches the purpose of communicating by letter between the control first SIM card control module and the SIM card interface module.Those skilled in the art can coordinate according to other the second SIM card control module of the easy to do realization of technology contents disclosed by the invention, the method for control APDU instruction and AT instruction process process.
Embodiment one
A kind of portable terminal that the embodiment of the invention provides and the structured flowchart of SIM card communication control system as shown in Figure 4, comprising: application function device 401, baseband communication functional device 402, SIM card 403.
Baseband communication functional device 402 is used for receiving, handle AT instruction or the APDU instruction that the application program of application function device 401 sends, and carry out alternately with SIM card 403, the application program in application function device 401 is returned the data of SIM card to commanded response.The baseband communication functional device 402 specifically processing procedure to AT instruction or APDU instruction is as follows:
Wherein, baseband communication functional device 402 comprises: input/output interface module 411, the first SIM card control module 412, the second SIM card control module 413, SIM card interface module 414, interface monitoring module 415.
Input/output interface module 411 receives the instruction (comprising AT instruction or APDU instruction) that the application program in the application function device 401 sends.Because the command format of AT instruction and APDU instruction is different, for example have " AT " sign in the AT instruction, have " APDU " sign in the APDU instruction, it is AT instruction or APDU instruction that input/output interface module 411 can be distinguished instruction according to the form of instruction; And the AT that distinguishes instruction sent to the first SIM card control module 412, the APDU instruction is sent to the second SIM card control module 413.
The handling process of the first SIM card control module 412 after the AT instruction that receives 411 transmissions of input/output interface module is identical with SIM card control module of the prior art, repeats no more herein.
The second SIM card control module 413 is sent the first switching notice information to interface monitoring module 415 when article one APDU instruction that receives the APDU command sequence.
Interface monitoring module 415 links to each other with the second SIM card control module 413 and the first SIM card control module 412, also links to each other with SIM card interface module 414.Can select SIM card interface module 414 by interface monitoring module 415 is to communicate by letter with the first SIM card control module 412, still communicates by letter with the second SIM card control module 413.
Interface monitoring module 415 is after receiving the first switching notice information of the second SIM card control module 413, and whether the bus that monitoring links to each other with SIM card interface module 414 is idle; If monitor the bus free time, show that this moment, SIM card interface module 414 buses did not both receive any instruction, there is not return data yet; That is the current AT instruction that does not have processing, then interface monitoring module 415 is interrupted communicating to connect between the first SIM card control module 412 and the SIM card interface module 414, and communicating to connect from the first SIM card control module 412 of SIM card interface module 414 switched to the second SIM card control module 413; Such second SIM card control module 413 can use SIM card interface module 414 and SIM card to communicate.
Interface monitoring module 415 finish communicating to connect of SIM card interface module 414 switched to the second SIM card control module 413 after, return confirmation.
After the second SIM card control module 413 receives the confirmation information, carry out processing APDU command sequence by SIM card interface module 414 orders.Concrete, the second SIM card control module 413 sends the APDU instruction by SIM card interface module 414 to SIM card 403 orders, receive SIM card 403 commanded response data, and by the application program return instruction response data of input/output interface module 411 in application function device 401.
The second SIM card control module 413 is after the last item APDU instruction of handling the APDU command sequence, when promptly whole APDU command sequence all being disposed, send the second switching notice information to interface monitoring module 415, interface monitoring module 415 is according to the second switching notice information, interrupt communicating to connect between the second SIM card control module 413 and the SIM card interface module 414, recover communicating to connect between the first SIM card control module 412 and the SIM card interface module 414, be about to communicating to connect of SIM card interface module 414 and switch to the first SIM card control module 412 from the second SIM card control module 413.
After recovering communicating to connect between the first SIM card control module 412 and the SIM card interface module 414, the AT that the first SIM card control module 412 can continue to handle reception instructs.
Because the second SIM card control module 413 is just interrupted communicating to connect between the first SIM card control module 412 and the SIM card interface module 414 monitoring bus by interface monitoring module 415 after the free time, and handle the APDU command sequence, guaranteed AT instruction process process complete of the first SIM card control module 412;
Because the second SIM card control module 413 is after the last item APDU instruction of handling the APDU command sequence, control recovers communicating to connect between the first SIM card control module 412 and the SIM card interface module 414, make the SIM card control module 412 of winning to continue to handle the AT instruction of reception, guaranteed the complete of APDU command sequence processing procedure.
Certainly, under some unexpected situation, the second SIM card control module 413 is before the last item APDU instruction that receives the APDU command sequence, application program is because certain reason interrupts continuing to send the APDU instruction, and the last item APDU that so might the second SIM card control module 413 receive the APDU command sequence all the time instructs.In order to guarantee accident to occur, can also continue the follow-up AT instruction or the processing of APDU instruction, the second SIM card control module 413 is being handled a current APDU instruction, and during the last item instruction that this APDU instruction is not the APDU command sequence, wait for one section setting-up time (such as 2 seconds), if in setting-up time, do not receive next bar APDU instruction, in order to guarantee that the first SIM card control module 412 can continue to handle the AT instruction, the second SIM card control module 413 sends the second switching notice information to interface monitoring module 415, and notification interface monitoring module 415 switches to the first SIM card control module 412 with communicating to connect of SIM card interface module 414.After the switching, the second SIM card control module 413 can think that current APDU command sequence carries out failure, the processing of preparing next APDU command sequence again.
In addition, baseband communication functional device 402 also comprises wireless communication module 416 usually; In order to guarantee that further the second SIM card control module 413 can intactly execute whole APDU command sequence, the second SIM card control module 413 is when interrupting communicating to connect between the first SIM card control module 412 and the SIM card interface module 414, also interrupt communicating by letter of wireless communication module 416 and SIM card, to prevent in carrying out the APDU command sequence, wireless communication module 416 receives information from network side SIM card is operated, thereby upsets the execution flow process of APDU command sequence.The concrete practice can be, application program sends the control command of locking wireless communication module 416 earlier, as AT+CFUN before sending the APDU command sequence, after wireless communication module 416 receives this control command by input/output interface module 411, enter locking (Disable) state.Application program sends release (Enable) control command to wireless communication module 416 again after sending the APDU command sequence; So just can prevent that the second SIM card control module 413 from having the signal of network side to interrupt implementation in carrying out APDU command sequence process.
A kind of concrete internal structure block diagram of the above-mentioned second SIM card control module 413 comprises as shown in Figure 5: Instructions Cache unit 501, instruction execution unit 502, command sequence integrality judging unit 503.
Instructions Cache unit 501 is in order to the APDU instruction that receives and buffer memory input/output interface module 411 sends, and its buffer memory is first-in first-out (FIFO) in proper order.
Article one APDU instruction and the last item APDU instruction of APDU command sequence determined in the APDU instruction that command sequence integrality judging unit 503 receives according to Instructions Cache unit 501.
Command sequence integrality judging unit 503 sends the second switching notice information if judging the APDU of Instructions Cache unit 501 receptions instructs when being article one APDU instruction of APDU command sequence to interface monitoring module 415.After interface monitoring module 415 is received the second switching notice information, the bus of monitoring SIM card interface module 414, monitoring SIM card interface module 414 buses when being in idle condition, interrupt communicating to connect between the first SIM card control module 412 and the SIM card interface module 414, will switch to the second SIM card control module 413 with communicating to connect of SIM card interface module 414; Return confirmation after finishing switching;
After the command sequence integrality judging unit 503 confirmation of receipt information, send the instruction exercise notice to instruction execution unit 502.
Instruction execution unit 502 begins the execute instruction APDU instruction of buffer memory in the buffer unit 501 of order according to this instruction exercise notice.In carrying out, handle APDU command sequence process, instruction execution unit 502 sends the APDU instruction to interface monitoring module 415, interface monitoring module 415 sends to SIM card by the SIM card interface module with the APDU instruction, and receive the commanded response data that SIM card is returned, the commanded response data are returned to instruction execution unit 502, and instruction execution unit 502 returns to application program with the commanded response data by input/output interface module 411.
When command sequence integrality judging unit 503 determines that instruction execution unit 502 is handled APDU command sequence (promptly handling the last item APDU instruction of APDU command sequence), send the second switching notice information to interface monitoring module 415.
After interface monitoring module 415 is received the second switching notice information, to switch to the first SIM card control module 412 with communicating to connect of SIM card interface module 414, thereby interrupted communicating to connect of the second SIM card control module 413 and SIM card interface module 414, recovered communicating to connect of the first SIM card control module 412 and SIM card interface module 414.The first SIM card control module 412 can continue to handle the AT instruction of reception subsequently.
Article one APDU instruction of the above-mentioned command sequence integrality judging unit 503 concrete APDU of judgement command sequences and the method that the last item APDU instructs can have multiple:
Such as, defined an APDU sign on, in order to the beginning of indication APDU command sequence, instruction thereafter is article one APDU instruction of APDU command sequence.For example, definition APDU+BEGIN is the APDU sign on, then receiving APDU+BEGIN when instruction when Instructions Cache unit 501, command sequence integrality judging unit 503 can confirm that article one APDU that article one APDU instruction that receives in this instruction back is the APDU command sequence instructs.Similarly, also can define an APDU instruction that finishes in order to indication APDU command sequence, as APDU+END, when instruction execution unit 502 obtained the APDU+END instruction from Instructions Cache unit 501, it was the last item APDU instruction of APDU command sequence that command sequence integrality judging unit 503 is promptly confirmed to instruct at last APDU of this command reception.
Perhaps, command sequence integrality judging unit 503 instructs interval time greater than set point (such as 3 seconds) at two APDU in front and back that detect 501 receptions of Instructions Cache unit, think that then it is article one APDU instruction of a back APDU command sequence that the last item APDU instruction that last APDU instruction is previous APDU command sequence, a back APDU are instructed.Concrete, can adopt a counter, the counter initial value is 0, Instructions Cache unit 501 whenever receives an APDU instruction, command sequence integrality judging unit 503 adds 1 with counter, if the APDU instruction that Instructions Cache unit 501 is received during at interval greater than set point, is confirmed last APDU instruction last APDU instruction for command sequence with last one APDU instruction time of receiving, and after the count value of recording counter with counter O reset.Counter is 0 o'clock so, and the APDU instruction that Instructions Cache unit 501 is received is first APDU instruction of command sequence, and the count value of the counter of record is then represented the sequence number of the last item APDU instruction of this command sequence.Like this, command sequence integrality judging unit 503 just can be determined article one APDU instruction or the last item APDU instruction of command sequence.
Again or, in command sequence integrality judging unit 503, preserve APDU instruction tree, this APDU instruction tree has been write down APDU command sequence structure, i.e. the order that instruction is carried out in the APDU command sequence.Though the APDU instruction has many, as then several instructions of article one APDU instruction of command sequence for fixing; The last item APDU instruction as command sequence also is fixing several instructions equally.APDU instruction that so Instructions Cache unit 501 is received and APDU instruct first APDU instruction of setting to compare, and be identical as if having, and thinks that then article one APDU that this APDU instruction is a command sequence instructs; If identical, then think the last item APDU instruction of command sequence with the APDU instruction of the end of APDU instruction tree.
In addition, when judging the last item instruction of APDU command sequence, can determine that next the bar APDU instruction that receives is article one instruction of next APDU command sequence with above-mentioned any method.
Further, above-mentioned command sequence integrality judging unit 503 can also be handled the last item APDU instruction in the Instructions Cache unit 501 monitoring instruction execution unit 502, and during the last item instruction that this APDU instruction is not the APDU command sequence, in setting-up time, Instructions Cache unit 501 does not receive next APDU instruction, then sends the second switching notice information to interface monitoring module 415.
Above-mentioned interface monitoring module 415 is behind the monitoring announcement information that receives the second SIM card control module 413, whether idle specific implementation method is well known to those skilled in the art the bus that monitoring links to each other with SIM card interface module 414, whether change in setting-up time (such as 500ms) such as the data on the monitoring bus, if not do not change then think the bus free time.
The concrete grammar that above-mentioned interface monitoring module 415 communicates switching is well known to those skilled in the art, interface monitoring module 415 to (from) the first SIM card control module 412 or the second SIM card control module 413 method that sends (reception) data respectively can have multiple: such as the bus (second bus) that is connected the bus (first bus) between the first SIM card control module 412 and the interface monitoring module 415 and be connected between the second SIM card control module 413 and the interface monitoring module 415 is physical separation.So, interface monitoring module 415 is when receiving the data that SIM card interface module 414 returns, data are transmitted to first bus, perhaps interface monitoring module 415 sending to SIM card interface module 414 when first bus interface is received data, then realized communicating to connect of the first SIM card control module 412 and SIM card interface module 414.
In addition, first bus and second bus can not be physical separation also.Interface monitoring module 415 carries different signs in the packet of issuing the first SIM card control module 412 or the second SIM card control module 413 respectively, the first SIM card control module 412 or the second SIM card control module 413 are told this packet according to the tag slot in the packet and whether issued oneself.
The second above-mentioned SIM card control module 413 and the function of interface monitoring module 415 can be by single-chip microcomputer, FPGA (Field Programmable Gate Array, field programmable gate array) or CPLD (Complicated Programmable Logical Device, CPLD) or the circuit formed of ASIC (Application Specific Integrated Circuit, application-specific integrated circuit (ASIC)) realize.
Be to serve as the main processing procedure of coordinating AT instruction and APDU instruction with the second SIM card control module 413 in the above-mentioned baseband communication functional device, this method relatively is suitable for handling the AT instruction than the many scenes of APDU instruction.
Can serve as the main processing procedure of coordinating AT instruction and APDU instruction with the first SIM card control module also in addition, this method then be suitable for handling the APDU instruction than the many scenes of AT instruction.For example concrete scheme can be:
The second SIM card control module is confirming to receive the APDU instruction by described input/output interface module, and the APDU that receives by described SIM card interface module and SIM card interaction process instructs.
When the first SIM card control module receives the AT instruction by the input/output interface module, send the time-out notice to the second SIM card control module;
The second SIM card control module, is suspended and is handled follow-up APDU instruction, and return the time-out confirmation when confirming to handle the last item instruction of current APDU command sequence according to suspending notice;
The first SIM card control module begins to handle the AT instruction of reception according to the time-out confirmation of returning, and continues to handle notice to the transmission of the second SIM card control module after handling this AT instruction; Notify the second SIM card control module can continue to handle follow-up APDU instruction.
The second above-mentioned SIM card control module both can be arranged at respectively in two physical entities with the first SIM card control module, also can be arranged in the same physical entity.
The flow process of the above-mentioned baseband communication functional device 402 concrete AT of processing instructions and APDU instruction is described with an object lesson (application program is handled between the AT order period at baseband communication functional device 402 and sent the APDU instruction again) below, as shown in Figure 6, comprise the steps:
S601: after the input/output interface module receives instruction, be defined as the AT instruction, then this instruction sent to the first SIM card control module.
S602: the first SIM card control module is converted into the APDU command sequence after receiving this AT instruction, and the APDU that carries out in the APDU command sequence by SIM card interface module and SIM card interaction sequences instructs.
S603: carry out in the APDU command sequence process of AT instruction transformation in the first SIM card control module, the input/output interface module confirms to receive the APDU instruction, and this APDU instruction is sent to the second SIM card control module.
S604: after article one APDU instruction of APDU instruction that the second SIM card control module is determined to receive, send the first switching notice information to the interface monitoring module for the APDU command sequence.
Determine the method for article one APDU instruction of APDU command sequence, the front is described in detail, such as the APDU instruction that the indication APDU command sequence that can adopt definition begins, perhaps adopts the method for instruction tree, does not repeat them here.
S605: the interface monitoring module is after receiving the first switching notice information, and whether monitoring SIM card interface module bus is idle.
S606: when the interface monitoring module monitors is idle to SIM card interface module bus, will switch to the second SIM card control module with communicating to connect of SIM card interface module after, send confirmation to the second SIM card control module.
Concrete changing method, the front is described in detail, does not repeat them here.
S607: the second SIM card control module is handled the APDU command sequence.
S608: the second SIM card control module confirms that the last item instruction process of APDU command sequence finishes, and then sends the second switching notice information to the interface monitoring module.
The method that the last item instruction process of second SIM card control module affirmation APDU command sequence finishes is identical with the method that the last item instruction process of the command sequence integrality judging unit realization affirmation APDU command sequence of the aforementioned second SIM card control module finishes, the APDU that finishes such as the indication APDU command sequence that can adopt definition instructs, perhaps adopt the method for instruction tree, repeat no more herein.
S609: after the interface monitoring module is received the second switching notice information, will switch to the first SIM card control module with communicating to connect of SIM card interface module.
During the second SIM card control module is handled the APDU command sequence, if the first SIM card control module receives the AT instruction, because the communication disruption of the first SIM card control module and SIM card interface module, then the AT instruction of first SIM card control module reception is waited in line to handle in the first SIM card control module.
The embodiment of the invention is because the second SIM card control module is just being interrupted communicating to connect between the first SIM card control module and the SIM card interface module by the interface monitoring module monitors to bus after the free time, and handle the APDU command sequence, guaranteed AT instruction process process complete of the first SIM card control module;
And since the second SIM card control module after the last item APDU instruction of handling the APDU command sequence, control recovers communicating to connect between the first SIM card control module and the SIM card interface module, make the SIM card control module of winning to continue to handle the AT instruction of reception, guaranteed the complete of APDU command sequence processing procedure.
So just guaranteed that the baseband communication functional device can intactly handle AT instruction or APDU command sequence, thereby having solved the application program in the portable terminal communicates by letter with SIM card and to be subjected to the problem of existing baseband communication functional device restriction, realized that application program both can also can strengthen the communication function between portable terminal and the SIM card by the communicating by letter of APDU instruction and SIM card by the AT instruction.
Embodiment two
As shown in Figure 7, a kind of portable terminal that the embodiment of the invention provides and the structured flowchart of SIM card communication control system comprise: application function device 701, baseband communication functional device 702, SIM card 703.
Baseband communication functional device 702 is used for receiving, handle AT instruction or the APDU instruction that the application program of application function device 701 sends, and carry out alternately with SIM card 703, the application program in application function device 701 is returned the data of SIM card to commanded response.The baseband communication functional device 702 specifically processing procedure to AT instruction or APDU instruction is as follows:
Wherein, baseband communication functional device 702 comprises: input/output interface module 711, the first SIM card control module 712, the second SIM card control module 713, SIM card interface module 714.
Baseband communication functional device 702 is except having increased by the second SIM card control module 713, some new functions also on the basis of the first SIM card control module, 712 original functions, have been increased, thereby can cooperate with the second SIM card control module 713, coordinate the execution of AT instruction or APDU command sequence.
The first SIM card control module 712 receives and handles the AT instruction by input/output interface module 711.After the first SIM card control module 712 receives the instruction that application program sends by input/output interface module 711, be defined as the AT instruction according to command format after, then receive and handle this AT instruction; Otherwise abandon.
The second SIM card control module 713 receives and handles the APDU instruction by input/output interface module 711.After the second SIM card control module 713 receives the instruction that application program sends by input/output interface module 711, be defined as the APDU instruction according to command format after, then receive and handle this APDU instruction; Otherwise abandon.
713 pairs of concrete processing methods of APDU instruction of the second SIM card control module are:
The second SIM card control module 713 sends the time-out notice to the first SIM card control module 712 when receiving article one APDU instruction that definite this APDU instruction in APDU instruction back is the APDU command sequence.
After the first SIM card control module 712 receives and suspends notice, if the current APDU command sequence of handling certain AT instruction transformation, then after handling this APDU command sequence, after promptly handling current AT instruction, suspend the AT instruction that continues to handle the back, and suspend confirmation to 713 transmissions of the second SIM card control module; If the current AT that do not handle instructs, suspend the processing of the AT instruction of follow-up reception, return the time-out confirmation.Certainly, those skilled in the art also can set the first SIM card control module 712 after finishing the AT instruction of setting number or finishing all AT instructions of current reception according to actual conditions, stop the processing of follow-up AT instruction again.
The second SIM card control module 713 begins to handle the APDU command sequence after receiving and suspending confirmation, when the last item APDU instruction of the APDU command sequence of confirming to dispose, sends to the first SIM card control module 712 and to continue to handle (Continue) notice.
The first SIM card control module 712 enables follow-up AT instruction process after receiving and continuing the processing notice, and promptly the first SIM card control module 712 can continue to carry out these AT instructions of processing if receive the AT instruction.
By the mutual and coordination between the first above-mentioned SIM card control module 712 and the second SIM card control module 713, guaranteed the complete of AT instruction and APDU command sequence processing procedure.
Similar with among the embodiment one, the second SIM card control module 713 is in carrying out the process of handling the APDU command sequence, if handle last APDU instruction of reception, and this APDU instruction is not when instructing the last item of sequence instruction, in setting-up time, do not receive next APDU instruction, think that then current APDU command sequence carries out failure, and continue processing to 713 transmissions of the second SIM card control module and notify, thereby guarantee that the first SIM card control module 712 can continue to handle follow-up AT instruction.
As shown in Figure 8, a kind of internal structure of the first SIM card control module 712 comprises: the first confirmation command unit 814, the first Instructions Cache unit 811, first instruction execution unit 812, instruction process control unit 813.
A kind of internal structure of the second SIM card control module 713 comprises: the second confirmation command unit 804, the second Instructions Cache unit 801, second instruction execution unit 802, command sequence integrality judging unit 803.
The first confirmation command unit 814 is used for after confirming that the instruction that receives by input/output interface module 711 is the AT instruction this AT instruction being deposited in the first Instructions Cache unit 811.The buffer memory of the first Instructions Cache unit 811 is first-in first-out (FIFO) in proper order.
The second confirmation command unit 804 is used for after confirming that the instruction that receives by input/output interface module 711 is the APDU instruction this APDU instruction being deposited in the second Instructions Cache unit 801.The buffer memory of the second Instructions Cache unit 801 is first-in first-out (FIFO) in proper order.
The command sequence integrality judging unit 803 of the second SIM card control module 713 is determined article one APDU instruction and the last item APDU instruction of APDU command sequence according to the APDU instruction of the second Instructions Cache unit, 801 storages.
When command sequence integrality judging unit 803 is article one APDU instruction of APDU command sequence as if the APDU instruction of judging 801 receptions of the second Instructions Cache unit, notify to the instruction process control unit 813 transmission time-outs of the first SIM card control module 712.
The instruction process control unit 813 of the first SIM card control module 712 receives and suspends notice, after handling current AT instruction, control first instruction execution unit 812 and handle the processing of the current follow-up AT instruction of AT instruction back time-out, and return to suspend and confirm notice in execution.
After command sequence integrality judging unit 803 receives and suspends the affirmation notice, send the instruction exercise notices to second instruction execution unit 802.
Second instruction execution unit 802 begins the APDU instruction that order is carried out buffer memory in the second Instructions Cache unit 801 according to this instruction exercise notice.
When command sequence integrality judging unit 803 monitors second instruction execution unit 802 when handling the last item APDU instruction of the APDU command sequence that command sequence integrality judging unit 803 determines, send to the first SIM card control module 712 and continue to handle notice.
After the instruction process control unit 813 of the first SIM card control module 712 receives and continue to handle notice, enable first instruction execution unit and can continue to handle AT instruction in the first Instructions Cache unit 811.
Further, command sequence integrality judging unit 803 monitorings second instruction execution unit 802 is carried out last APDU instruction of handling buffer memory in the second Instructions Cache unit 801, and this APDU instructs when not being the last item instruction of APDU command sequence, if the second Instructions Cache unit 801 is in setting-up time, also do not receive next APDU instruction, think that then current APDU command sequence carries out failure, command sequence integrality judging unit 803 sends and continues to handle notice, notifies the first SIM card control module 712 can continue to handle follow-up AT instruction.
In addition, baseband communication functional device 702 comprises wireless communication module 716 toward contact; In order further to guarantee that the second SIM card control module 713 can intactly carry out the APDU command sequence, wireless communication module 716 is locked identical with the foregoing description one with the method for release, repeat no more herein.
Certainly, the second confirmation command unit and the first confirmation command unit in the first SIM card control module 712 in the above-mentioned second SIM card control module 713 also can be put in the input/output interface module 711, by sending to the second SIM card control module and the first SIM card control module respectively after 711 differentiation AT instructions of input/output interface module or the APDU instruction.
The first above-mentioned SIM card control module 712 and the function of the second SIM card control module 713 can be realized by the circuit that single-chip microcomputer, FPGA or CPLD or ASIC form.
The second SIM card control module of the embodiment of the invention both can be arranged at respectively in two physical entities with the first SIM card control module, also can be arranged in the same physical entity.
The embodiment of the invention can serve as the main processing procedure of coordinating AT instruction and APDU instruction with the first SIM card control module also in addition, and this method then is suitable for handling the APDU instruction than the many scenes of AT instruction.For example concrete scheme can be:
Input/output interface module, the instruction that is used to distinguish reception are AT instruction or APDU instruction, and the AT instruction is sent to the described first SIM card control module; The APDU instruction is sent to the described second SIM card control module;
The second SIM card control module, be used for by with the communicating to connect of described SIM card interface module, handle the APDU command sequence that receives;
The first SIM card control module is used for sending the first switching notice information when receiving the AT instruction;
The interface monitoring module, be used for according to the described first switching notice information, monitoring described SIM card interface module bus during the free time, communicating to connect from the second SIM card control module of described SIM card interface module switched to the first SIM card control module, and return confirmation;
The first SIM card control module is carried out processing AT instruction alternately by described SIM card interface module and SIM card when receiving the confirmation information; After handling described AT instruction, send the second switching notice information;
The interface monitoring module switches to the second SIM card control module according to the described second switching notice information with communicating to connect from the described first SIM card control module of described SIM card interface module.
Like this, the second SIM card control module can by with the communicating to connect of described SIM card interface module, continue to handle connecing the follow-up APDU command sequence of receiving.
The embodiment of the invention has still sent the APDU instruction with application program again between baseband communication functional device 702 processing AT order periods be example, the flow process that the above-mentioned baseband communication functional device 702 concrete AT of processing instructions and APDU instruct is described, as shown in Figure 9, comprise the steps:
S901: the first SIM card control module receives the AT instruction by the input/output interface module.
The first SIM card control module is received the instruction that application program sends by the input/output interface module, confirm as the AT instruction by command format after, receive this AT instruction.
S902: the first SIM card control module is the APDU command sequence with the AT instruction transformation, and order is carried out the APDU command sequence.
S903: the second SIM card control module receives the APDU instruction by the input/output interface module.
The second SIM card control module is received the instruction that application program sends by the input/output interface module, confirm as the APDU instruction by command format after, receive this APDU instruction.
S904: the second SIM card control module sends the time-out notice to the first SIM card control module after confirming article one instruction of APDU instruction for the APDU command sequence of reception.
S905: the first SIM card control module receives suspends notice, after handling current AT instruction, returns the time-out confirmation to the second SIM card control module.
S906: the second SIM card control module begins to carry out the APDU command sequence after receiving and suspending confirmation.
S907: the last item APDU instruction process of confirming the APDU command sequence when the second SIM card control module finishes, and sends to the first SIM card control module and continues to handle notice.
After the first SIM card control module receives and continues to handle notice, can continue to handle follow-up AT instruction.
The embodiment of the invention since the second SIM card control module by with the first SIM card control module interactive information, control communicating to connect of the first SIM card control module and SIM card interface, thereby coordinated the processing procedure of AT instruction or APDU instruction, guaranteed the complete of AT instruction, APDU command sequence processing procedure, realized that application program both can also can strengthen the communication function between portable terminal and the SIM card by the communicating by letter of APDU instruction and SIM card by the AT instruction.
One of ordinary skill in the art will appreciate that all or part of step that realizes in the foregoing description method is to instruct relevant hardware to finish by program, this program can be stored in the computer read/write memory medium, as: ROM/RAM, magnetic disc, CD etc.
The above only is a preferred implementation of the present invention; should be pointed out that for those skilled in the art, under the prerequisite that does not break away from the principle of the invention; can also make some improvements and modifications, these improvements and modifications also should be considered as protection scope of the present invention.

Claims (16)

1, a kind of baseband communication functional device comprises the SIM card interface module, it is characterized in that, also comprises:
The input/output interface module is used to receive AT instruction and APDU instruction and the output that application program sends;
The first SIM card control module is used for receiving the AT instruction from described input/output interface module, and the AT that receives by described SIM card interface module and SIM card interaction process instructs; According to the time-out notice of receiving, after confirming that current no AT instruction needs processing or handles current AT instruction, return the time-out confirmation, and suspend the processing of follow-up AT instruction; And handle notice according to the continuation of receiving and continue the processing that follow-up AT instructs;
The second SIM card control module, be used for receiving the APDU instruction from described input/output interface module, send described time-out notice in the APDU instruction that confirm to receive during for article one instruction of APDU command sequence, after receiving the described time-out confirmation of returning by described SIM card interface module and the described APDU command sequence of SIM card interaction process; And when the last item instruction of the described APDU command sequence that disposes, send described continuation and handle notice.
2, device as claimed in claim 1 is characterized in that, the described second SIM card control module comprises:
The second Instructions Cache unit is used for the APDU instruction that buffer memory receives from described input/output interface module;
Command sequence integrality judging unit is used for sending described time-out notice when the APDU instruction of confirming the reception of the described second Instructions Cache unit is instructed for article one of APDU command sequence; After receiving the time-out confirmation of returning, send APDU instruction exercise notice; When the last item instruction of the described APDU command sequence of confirming to dispose, send described continuation and handle notice;
Second instruction execution unit is according to described APDU instruction exercise notice, the described APDU command sequence of sequential processes.
3, device as claimed in claim 2 is characterized in that, the described second SIM card control module also comprises:
The second confirmation command unit is used for receiving instruction from described input/output interface module, and confirm to receive instruct for APDU the time, the described APDU of affirmation instructed stores the described second Instructions Cache unit into.
4, device as claimed in claim 1 is characterized in that, the described first SIM card control module comprises:
The first Instructions Cache unit is used for the AT instruction that buffer memory receives from described input/output interface module;
First instruction execution unit is used for order and carries out the AT instruction of handling the described first Instructions Cache unit caches;
The instruction process control unit is used for according to the time-out notice of receiving, is confirming to return the time-out confirmation after current AT instruction need be handled or handle to current no AT instruction, and is suspending the processing of follow-up AT instruction; And, notify described first instruction execution unit to continue the processing of follow-up AT instruction according to the continuation processing notice of receiving.
5, device as claimed in claim 4 is characterized in that, the described first SIM card control module also comprises:
The first confirmation command unit is used for when confirming to be the AT instruction by the instruction that described input/output interface module receives, with described AT Instructions Cache in the described first Instructions Cache unit.
6, as claim 1,2 or 4 described devices, it is characterized in that,
The instruction area that described input/output interface module also is used for receiving is divided into AT instruction or APDU instruction, and the AT instruction of telling to the described first SIM card control module sending area, the APDU instruction of telling to the described second SIM card control module sending area.
7, a kind of baseband communication functional device comprises the SIM card interface module, it is characterized in that, also comprises:
The input/output interface module is used to receive AT instruction and APDU instruction and the output that application program sends;
The first SIM card control module is used for receiving AT when instruction from described input/output interface module, sends and suspends notice; And after receiving the time-out confirmation, handle described AT instruction; After the described AT instruction that disposes, send and continue to handle notice;
The second SIM card control module is used for receiving the APDU instruction from described input/output interface module, and the APDU that receives by described SIM card interface module and SIM card interaction process instructs; According to the described time-out notice that receives, after confirming to handle the last item instruction of the current APDU command sequence of handling, suspend processing, and return the time-out confirmation follow-up APDU command sequence; After receiving described continuation processing notice, continue the processing of follow-up APDU command sequence.
8, a kind of baseband communication functional device comprises: the first SIM card control module, SIM card interface module, it is characterized in that, and also comprise:
Input/output interface module, the instruction that is used to distinguish reception are AT instruction or APDU instruction, and the AT instruction is sent to the described first SIM card control module; The APDU instruction is sent to the described second SIM card control module;
The second SIM card control module is used for sending the first switching notice information when confirming to receive article one instruction of APDU command sequence; When receiving the confirmation information, carry out processing APDU instruction by described SIM card interface module and SIM card interaction sequences; When the last item instruction of the described APDU command sequence of determining to dispose, send the second switching notice information;
The interface monitoring module, be used for according to the described first switching notice information, monitoring described SIM card interface module bus during the free time, communicating to connect from the first SIM card control module of described SIM card interface module switched to the second SIM card control module, and return confirmation; According to the described second switching notice information, communicating to connect from the described second SIM card control module of described SIM card interface module switched to the first SIM card control module.
9, device as claimed in claim 8 is characterized in that, the described second SIM card control module comprises:
Instructions Cache unit, command sequence integrality judging unit, instruction execution unit;
The Instructions Cache unit is used for the APDU instruction that buffer memory receives by described input/output interface module;
Command sequence integrality judging unit is used for sending the described first switching notice information when the APDU instruction of confirming described Instructions Cache unit caches is instructed for article one of APDU command sequence; And after receiving the described confirmation of returning, send exercise notice; When the last item instruction of the described APDU command sequence of determining to dispose, send the described second switching notice information;
Described instruction execution unit is according to described exercise notice, and order is carried out the APDU command sequence of buffer memory in the described Instructions Cache unit.
10, a kind of baseband communication functional device comprises: the SIM card interface module, it is characterized in that, and also comprise:
Input/output interface module, the instruction that is used to distinguish reception are AT instruction or APDU instruction, and the AT instruction is sent to the described first SIM card control module; The APDU instruction is sent to the described second SIM card control module;
The first SIM card control module is used for sending the first switching notice information when receiving the AT instruction; When receiving the confirmation information, carry out processing AT instruction alternately by described SIM card interface module and SIM card; After handling described AT instruction, send the second switching notice information;
The second SIM card control module, be used for by with the communicating to connect of described SIM card interface module, handle the APDU command sequence that receives;
The interface monitoring module, be used for according to the described first switching notice information, monitoring described SIM card interface module bus during the free time, communicating to connect from the second SIM card control module of described SIM card interface module switched to the first SIM card control module, and return confirmation; According to the described second switching notice information, communicating to connect from the described first SIM card control module of described SIM card interface module switched to the second SIM card control module.
11, a kind of portable terminal and SIM card method for communicating is characterized in that, comprising:
In article one when instruction that receives the APDU command sequence, after current AT instruction process finished or confirming that current no AT instruction needs to handle, suspend and handle follow-up AT and instruct;
From described article one instruction, sequential processes receives each the bar instruction in the described APDU command sequence, and after the instruction of the last item in the described APDU command sequence that disposes, continues to handle described follow-up AT instruction.
12, method as claimed in claim 11 is characterized in that, definite method of article one instruction of described APDU command sequence specifically comprises:
When APDU instruction that the instruction that receives begins for indication APDU command sequence, then confirm the next APDU instruction that receives article one instruction for described APDU command sequence.
13, method as claimed in claim 11 is characterized in that, method is determined in the last item instruction in the described APDU command sequence, specifically comprises:
When confirming to indicate the APDU instruction of APDU command sequence end, the last item instruction that the previous APDU instruction of determining the APDU instruction that this indication APDU command sequence finishes is described APDU command sequence.
14, method as claimed in claim 11 is characterized in that, method is determined in article one instruction of described APDU command sequence, specifically comprises:
Instruct on the APDU that receives instruction and the top of instruction tree of APDU instruction execution sequence in having write down each APDU command sequence when identical, determine that this APDU instruction instructs for article one of APDU command sequence.
15, method as claimed in claim 11 is characterized in that, method is determined in the last item instruction in the described APDU command sequence, specifically comprises:
Instruct when identical at the APDU instruction and the end of instruction tree of APDU instruction execution sequence in having write down each APDU command sequence, determine that this APDU instruction instructs for the last item of APDU command sequence.
16, a kind of portable terminal and SIM card method for communicating is characterized in that, comprising:
Receiving AT when instruction, after current APDU command sequence is disposed or confirming that current no APDU command sequence need be handled, suspending the follow-up APDU command sequence of processing;
The AT instruction that processing receives after the described AT instruction that disposes, continues to handle described follow-up APDU command sequence.
CN2008101056348A 2008-04-30 2008-04-30 Baseband communication functional device and communication method thereof Expired - Fee Related CN101572963B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2008101056348A CN101572963B (en) 2008-04-30 2008-04-30 Baseband communication functional device and communication method thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2008101056348A CN101572963B (en) 2008-04-30 2008-04-30 Baseband communication functional device and communication method thereof

Publications (2)

Publication Number Publication Date
CN101572963A true CN101572963A (en) 2009-11-04
CN101572963B CN101572963B (en) 2011-04-20

Family

ID=41232161

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2008101056348A Expired - Fee Related CN101572963B (en) 2008-04-30 2008-04-30 Baseband communication functional device and communication method thereof

Country Status (1)

Country Link
CN (1) CN101572963B (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101969508A (en) * 2010-10-21 2011-02-09 北京大友迅捷科技有限公司 Method and device for implementing connection of wireless terminal and three SIM cards
CN102056108A (en) * 2010-12-09 2011-05-11 北京握奇数据系统有限公司 Short message cache method and device and telecommunication smart card
CN102202306A (en) * 2011-06-13 2011-09-28 中国电信股份有限公司 Mobile security authentication terminal and method
CN103345610A (en) * 2013-06-20 2013-10-09 武汉天喻信息产业股份有限公司 Device and method for quickly verifying data integrity of intelligent card
WO2013152501A1 (en) * 2012-04-13 2013-10-17 钒创科技股份有限公司 Mobile communication device, signal processing unit and information processing method
CN103778058A (en) * 2013-12-11 2014-05-07 国家无线电监测中心检测中心 TETRA digital trunked air interface test method and system based on TTCN-3
CN108628781A (en) * 2018-05-14 2018-10-09 星汉智能科技股份有限公司 Smart card proactive command sending method, device, smart card and terminal device

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102541639B (en) * 2011-12-26 2014-07-02 北京握奇数据系统有限公司 CPU (Central Processing Unit) card data processing method, CPU card data processing system and CPU card

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1523205B1 (en) * 2003-10-10 2014-04-16 Option Method and system for accessing a smart card stored in a telecommunications card from a host device to which said telecommunications card is connected
CN1320842C (en) * 2004-12-31 2007-06-06 大唐微电子技术有限公司 Real-time simulation developing method and system for SIM toolkit

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101969508A (en) * 2010-10-21 2011-02-09 北京大友迅捷科技有限公司 Method and device for implementing connection of wireless terminal and three SIM cards
CN102056108A (en) * 2010-12-09 2011-05-11 北京握奇数据系统有限公司 Short message cache method and device and telecommunication smart card
CN102056108B (en) * 2010-12-09 2013-06-05 北京握奇数据系统有限公司 Short message cache method and device and telecommunication smart card
CN102202306A (en) * 2011-06-13 2011-09-28 中国电信股份有限公司 Mobile security authentication terminal and method
WO2013152501A1 (en) * 2012-04-13 2013-10-17 钒创科技股份有限公司 Mobile communication device, signal processing unit and information processing method
CN103345610A (en) * 2013-06-20 2013-10-09 武汉天喻信息产业股份有限公司 Device and method for quickly verifying data integrity of intelligent card
CN103345610B (en) * 2013-06-20 2015-09-23 武汉天喻信息产业股份有限公司 The Apparatus and method for of fast verification intelligent card data integrality
CN103778058A (en) * 2013-12-11 2014-05-07 国家无线电监测中心检测中心 TETRA digital trunked air interface test method and system based on TTCN-3
CN108628781A (en) * 2018-05-14 2018-10-09 星汉智能科技股份有限公司 Smart card proactive command sending method, device, smart card and terminal device
CN108628781B (en) * 2018-05-14 2019-03-26 星汉智能科技股份有限公司 Smart card proactive command sending method, device, smart card and terminal device

Also Published As

Publication number Publication date
CN101572963B (en) 2011-04-20

Similar Documents

Publication Publication Date Title
CN101572963B (en) Baseband communication functional device and communication method thereof
CN102985889B (en) Method, system, and apparatus for communicating using multiple controllers
US4954950A (en) Terminal communications circuit
CN100549937C (en) Signal conditioning package and information processing method
CN101699416B (en) Communication method and system between host computer and card reader with multiple card holders
US5742502A (en) Method and apparatus for generating synchronous data transmissions in a device having a universal asynchronous receiver/transmitter
CN107229591A (en) Multi-serial communication method and device
US6512449B1 (en) Screen display method for portable information terminal
CN102301605A (en) System and method for virtualizing the peripherals in a terminal device to enable remote management via removable portable media with processing capability
CN102760238A (en) Controlled device and control system
CN209118324U (en) Card incudes instruction system
CN1661999B (en) System and method for supporting operation of multifunctional remote controller through network
CN102542171A (en) Automatic identification device and method for RFID port of electronic health station
CN202422132U (en) Automatic identification device for radio frequency identification (RFID) port of electronic health station
CA2289950A1 (en) Point-of-sale system and distributed computer network for same
CN112114568B (en) Design method of multi-station personalized product processing program taking data as center
CN212647579U (en) Automatic vending machine replenishment ware
JPH10208005A (en) Data access device
JPS624740B2 (en)
KR20040019393A (en) Elevator control transmission system
JPH05334272A (en) Monitoring and operating method for plural electronic computers
JPS61150546A (en) Data transmission controlling system
JPH0814809B2 (en) Intelligent I / O device
JP2604907B2 (en) Input / output method of local file data
CN101604150A (en) A kind of multifunctional mechanical parking system manipulator and control method thereof

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20110420

Termination date: 20210430

CF01 Termination of patent right due to non-payment of annual fee