|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--net.rim.device.api.smartcard.SmartCardReader
Represents a physical smart card reader.
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.
To communicate with the reader, the developer must call openSession().
For information on implementing smart card readers, see Adding smart card reader drivers to the SmartCard API. This tutorial describes the process of adding support for new smart card reader and smart card reader drivers to the API. A smart card reader consists of the physical device and the software driver used to read the data from a smart card.
SmartCardReaderSession,
SmartCardReaderFactory| Constructor Summary | ||
|
protected |
SmartCardReader()
Constructs a SmartCardReader. |
| Method Summary | ||
|
boolean |
addListener(ReaderStatusListener listener)
Registers a ReaderStatusListener with this reader. |
|
void |
displaySettings(Object context)
Allows the driver to display some settings or properties. |
|
protected void |
displaySettingsImpl(Object context)
Allows the driver to display some settings or properties. |
|
String |
getLabel()
Returns a label associated with the kind of smart card reader. |
|
protected abstract String |
getLabelImpl()
Returns a label associated with the kind of smart card reader. |
|
int |
getReaderStatus()
Returns the current reader status. |
|
String |
getType()
Returns the type of the reader, eg "Serial Port" or "Bluetooth". |
|
protected abstract String |
getTypeImpl()
Returns the type of the reader, eg "Serial Port", "Bluetooth". |
|
boolean |
isDisplaySettingsAvailable(Object context)
Allows the driver to indicate if they support displaying settings. |
|
protected boolean |
isDisplaySettingsAvailableImpl(Object context)
Allows the driver to indicate if they support displaying settings. |
|
boolean |
isInsertionRemovalDetectable()
Returns true if the reader can detect when a card is inserted in or removed from the reader. |
|
protected abstract boolean |
isInsertionRemovalDetectableImpl()
Returns true if the reader can detect when a card is inserted in or removed from the reader. |
|
boolean |
isReaderPresent()
Returns true if the reader is attached, and false otherwise. |
|
protected abstract boolean |
isReaderPresentImpl()
Returns true if the reader is attached, and false otherwise. |
|
boolean |
isSmartCardPresent()
Returns true if a smart card is present in the reader, and false otherwise. |
|
protected abstract boolean |
isSmartCardPresentImpl()
Returns true if a smart card is present in the reader, and false otherwise. |
|
SmartCardReaderSession |
openSession()
Returns a communication session with the reader. |
|
protected abstract SmartCardReaderSession |
openSessionImpl()
Returns the appropriate subclass of SmartCardReaderSession. |
|
boolean |
removeListener(ReaderStatusListener listener)
Deregisters the given listener with this reader. |
|
protected void |
setReaderStatus(int readerStatus)
Called by the subclass implementation to notify all registered ReaderStatusListeners with the given status. |
|
String |
toString()
Returns a string representation of the object. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
protected SmartCardReader()
| Method Detail |
public final boolean addListener(ReaderStatusListener listener)
ReaderStatusListener with this reader.
Some readers may recognize when a card is inserted or removed. If this functionality is not supported by the reader, then this method returns false.
If smart card insertions and removals are recognized, then when addListener is called, listener.readerStatus() will be called directly with either ReaderStatus.CARD_PRESENT, ReaderStatus.CARD_ABDSENT, or ReaderStatus.CARD_UNKNOWN if there was an exception.
When there is a change in the reader status, for example if the card is inserted or removed listener.readerStatus() will be called with either ReaderStatus.CARD_INSERTED or ReaderStatus.CARD_REMOVED.
listener - The listener to add.public final void displaySettings(Object context)
context - Reserved for future use.protected void displaySettingsImpl(Object context)
context - Reserved for future use.public final String getLabel()
The String should not include the words "smart card reader", as this method will be used to generate strings such as ( "Please insert your %s smart card reader", getLabel() )
protected abstract String getLabelImpl()
The String should not include the words "smart card reader", as this method will be used to generate strings such as ( "Please insert your %s smart card reader", getLabel() )
public final int getReaderStatus()
The state diagram represents the different possible paths to a return value.

ReaderStatuspublic final String getType()
A session does not need to be open to get a valid response from this method.
protected abstract String getTypeImpl()
A session does not need to be open to get a valid response from this method.
public final boolean isDisplaySettingsAvailable(Object context)
context - Reserved for future use.protected boolean isDisplaySettingsAvailableImpl(Object context)
context - Reserved for future use.public final boolean isInsertionRemovalDetectable()
Some readers may recognize when a card is inserted or removed. If this functionality is not supported by the reader, then this method must returns false.
protected abstract boolean isInsertionRemovalDetectableImpl()
Some readers may recognize when a card is inserted or removed. If this functionality is not supported by the reader, then this method must returns false.
public final boolean isReaderPresent()
throws SmartCardException
The implementation of this function should not bring up UI.
The implementation of this function must not call
openSession().
SmartCardException - Thrown if an error occurs while reading the
smart card.
protected abstract boolean isReaderPresentImpl()
throws SmartCardException
The implementation of this function should not bring up UI.
The implementation of this function must not call
openSession().
SmartCardException - Thrown if an error occurs while reading the
smart card.
public final boolean isSmartCardPresent()
throws SmartCardException
Should return false when there is not reader present. The implementation of this function should not bring up UI. The implementation of this function must not call openSession().
SmartCardException - Thrown if an error occurs while reading the
smart card.
protected abstract boolean isSmartCardPresentImpl()
throws SmartCardException
Should return false when there is not reader present. The implementation of this function should not bring up UI. The implementation of this function must not call openSession().
SmartCardException - Thrown if an error occurs while reading the
smart card.public final SmartCardReaderSession openSession() throws SmartCardException
The user may be prompted to attach the reader, if the reader could not be found. For security reasons, only only one communcation session is allowed to be open with a reader at one time. Hence, this function will block until all other communication sessions using this reader have closed.
SmartCardException - Thrown if an error occurs while reading the smart card.SmartCardCancelException - Thrown if the user presses cancel when asked to install their reader.protected abstract SmartCardReaderSession openSessionImpl() throws SmartCardException
SmartCardReaderSession.
Implementations of the method should not bring up UI.
SmartCardReaderSession subclass.SmartCardException - Thrown if an error occurs while reading the smart card.SmartCardNoReaderPresentException - Thrown if the reader is not installed.public final boolean removeListener(ReaderStatusListener listener)
listener - The listener to be deregistered from the reader.protected final void setReaderStatus(int readerStatus)
ReaderStatusListeners with the given status.
Note: all Throwable exceptions thrown by the listeners are ignored.
readerStatus - An integer representing the status of the reader.ReaderStatuspublic String toString()
ObjecttoString method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2008 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.