|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.rim.device.api.smartcard.SmartCardReaderSession
public abstract class SmartCardReaderSession
Represents a communications session with a physical smartcard reader. Over this session, APDUs may be exchanged with the reader and smartcard to provide the desired functionality.
Sessions should not be held open when not in use. As a security precaution, only one open session is allowed to exist per SmartCardReader
,
and subsequent openSession requests will block until the current session is closed.
Note to implementors: Most, if not all, UI functionality has been implemented in the base class. Typically, subclasses should not need to implement any UI.
SmartCardSession
Constructor Summary | ||
---|---|---|
|
protected |
SmartCardReaderSession(SmartCardReader reader)
Construct a new SmartCardReaderSession . |
Method Summary | ||
---|---|---|
|
void |
close()
Closes this session, and unblocks a pending session. |
|
protected abstract void |
closeImpl()
Closes this session. |
|
AnswerToReset |
getAnswerToReset()
Returns the AnswerToReset provided by the physical smartcard present in the reader. |
|
protected abstract AnswerToReset |
getAnswerToResetImpl()
Returns the AnswerToReset provided by the physical smartcard present in the reader. |
|
SmartCard |
getSmartCard()
Returns the SmartCard driver that is able to communicate with the
smart card present in the reader. |
|
SmartCardReader |
getSmartCardReader()
Returns the associated SmartCardReader . |
|
SmartCard[] |
getSmartCards()
Returns the SmartCard drivers that are able to communicate with the
smart card present in the reader. |
|
boolean |
isOpen()
Returns true if the session is open, otherwise false. |
|
protected abstract void |
negotiateProtocolImpl(SmartCardCapabilities cardCapabilities)
Attempts to negotate a new protocol with the smartcard if desired. |
|
void |
sendAPDU(CommandAPDU commandAPDU,
ResponseAPDU responseAPDU)
Transmits an APDU to the reader and blocks waiting for a response. |
|
protected abstract void |
sendAPDUImpl(CommandAPDU commandAPDU,
ResponseAPDU responseAPDU)
Transmits an APDU to the reader and blocks waiting for a response. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected SmartCardReaderSession(SmartCardReader reader)
SmartCardReaderSession
.
reader
- The associated SmartCardReader
.Method Detail |
---|
public final void close()
protected abstract void closeImpl()
public final boolean isOpen()
public final void sendAPDU(CommandAPDU commandAPDU, ResponseAPDU responseAPDU) throws SmartCardException
commandAPDU
- The CommandAPDU
to send.responseAPDU
- The ResponseAPDU
received back from the reader.
SmartCardException
- Thrown if an error occurs while reading the smart card.
SmartCardSessionClosedException
- Thrown if the reader session is already closed.protected abstract void sendAPDUImpl(CommandAPDU commandAPDU, ResponseAPDU responseAPDU) throws SmartCardException
commandAPDU
- The commandAPDU
to send.responseAPDU
- The responseAPDU
to send.
SmartCardException
- Thrown if an error occurs while reading the
smart card.protected abstract void negotiateProtocolImpl(SmartCardCapabilities cardCapabilities) throws SmartCardException
cardCapabilities
- The SmartCardCapabilities
the capabilities of the card.
SmartCardException
- Thrown if an error occurs with the smart card.public final SmartCard getSmartCard() throws SmartCardException
SmartCard
driver that is able to communicate with the
smart card present in the reader.
The driver returned is the first smart card driver which indicates that is capable of communicating with the card.
The user may be prompted to insert their smartcard.
SmartCard
that is currently present in the reader.
SmartCardException
- Thrown if an error occurs while reading the smart card.
SmartCardSessionClosedException
- Thrown if this reader session is closed.getSmartCards
public final SmartCard[] getSmartCards() throws SmartCardException
SmartCard
drivers that are able to communicate with the
smart card present in the reader.
The user may be prompted to insert their smartcard.
SmartCard
drivers that are able to communicate with the card
that is currently present in the reader.
SmartCardException
- Thrown if an error occurs while reading the smart card.
SmartCardSessionClosedException
- Thrown if this reader session is closed.getSmartCard
public final SmartCardReader getSmartCardReader()
SmartCardReader
.
SmartCardReader
.public final AnswerToReset getAnswerToReset() throws SmartCardException
AnswerToReset
provided by the physical smartcard present in the reader.
The user may be prompted to insert their smartcard.
AnswerToReset
provided by smart card in the reader.
SmartCardException
- Thrown if an error occurs while reading the smart card.
SmartCardSessionClosedException
- Thrown if this reader session is closed.
SmartCardNoCardPresentException
- Thrown if no card is currently present in the reader.protected abstract AnswerToReset getAnswerToResetImpl() throws SmartCardException
AnswerToReset
provided by the physical smartcard present in the reader.
Implementations should not bring up UI.
AnswerToReset
provided by the smart card in the reader.
SmartCardException
- Thrown if an error occurs while reading the smart card.
SmartCardNoCardPresentException
- Thrown if no card is currently present in the reader.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal