|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.rim.device.api.smartcard.SmartCard
public abstract class SmartCard
Represents a kind (or model or family) of a physical smart card, as opposed to one unique smart card.
As such, the SmartCard
and SmartCardSession
objects embody only the mechanisms or protocols
to communicate with one kind of smart card. Therefore, there is only one SmartCard
object instantiated on
the device per kind of smart card.
To communicate with the smart card, the developer must call openSession()
.
Once a session has been opened, it is assumed that some card unique data (perhaps a serial number,
see ) may be extracted
to identify a particular smart card.
Note to implementators: Most, if not all, UI functionality has been implemented in the base class. Typically, subclasses should not need to implement any UI. Subclasses should implement Persistable, and must not contain any state information ( member variables ).
For information on implementing smart cards, see Adding smart card drivers to the SmartCard API. This tutorial describes the process of adding support for new smart cards and smart card drivers to the API.
Sub-classes must explicitly implement the Persistable interface if they are going to be registered as a smart card driver with the SmartCardFactory.
SmartCardFactory
,
SmartCardSession
,
SmartCardID
,
Persistable
Constructor Summary | ||
---|---|---|
|
protected |
SmartCard()
Constructs a new SmartCard . |
Method Summary | ||
---|---|---|
|
boolean |
checkAnswerToReset(AnswerToReset atr)
Returns true if this SmartCard implementation should be used
to communicate with a physical smart card that has the given AnswerToReset . |
|
protected abstract boolean |
checkAnswerToResetImpl(AnswerToReset atr)
Returns true if this SmartCard implementation should be used
to communicate with a physical smart card that has the given AnswerToReset . |
|
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. |
|
boolean |
equals(Object obj)
This method returns true if this smart card object is equal to the obj parameter. |
|
SmartCardCapabilities |
getCapabilities()
Returns the SmartCardCapabilities of the smart card. |
|
protected abstract SmartCardCapabilities |
getCapabilitiesImpl()
Returns the SmartCardCapabilities of the smart card. |
|
String |
getLabel()
Returns a label associated with the kind of smart card. |
|
protected abstract String |
getLabelImpl()
Returns a label associated with the kind of smart card. |
|
int |
hashCode()
Returns a hash code value for the object. |
|
boolean |
isBuiltInReaderSupported()
Returns whether or not this Smart Card expects to use any built-in Smart Card Readers. |
|
protected boolean |
isBuiltInReaderSupportedImpl()
Returns whether or not this Smart Card expects to use any built-in Smart Card Readers. |
|
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 |
isFingerprintSupportAvailable()
Determine if this smart card driver can extract fingerprints from the smart card. |
|
protected boolean |
isFingerprintSupportAvailableImpl()
Determine if this smart card driver can extract fingerprints from the smart card. |
|
SmartCardSession |
openSession(SmartCardReaderSession readerSession)
Returns a session through which an application may communicate with a physical SmartCard. |
|
protected abstract SmartCardSession |
openSessionImpl(SmartCardReaderSession readerSession)
Returns the appropriate subclass of SmartCardSession . |
|
String |
toString()
Returns a string representation of the object. |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected SmartCard()
SmartCard
.
Method Detail |
---|
public final SmartCardSession openSession(SmartCardReaderSession readerSession) throws SmartCardException
SmartCardReaderSession
may only have one SmartCardSession
associated with it.
Note: sessions should be closed promptly when no longer needed.
readerSession
- An open communication session with a reader. Must be non null.
SmartCardException
- Thrown if an error occurs while reading the smart card.
SmartCardSessionAlreadyOpenException
- Thrown if the reader session already has an open smart card session associated with it.
SmartCardSessionClosedException
- Thrown if the reader session is closed.protected abstract SmartCardSession openSessionImpl(SmartCardReaderSession readerSession) throws SmartCardException
SmartCardSession
.
Implementations of this method should not bring up UI.
readerSession
- An open communication session with a reader. Will be non-null.
SmartCard
.
SmartCardException
- Thrown if an error occurs while reading the
smart card.public final SmartCardCapabilities getCapabilities()
SmartCardCapabilities
of the smart card.
protected abstract SmartCardCapabilities getCapabilitiesImpl()
SmartCardCapabilities
of the smart card.
public final boolean checkAnswerToReset(AnswerToReset atr)
SmartCard
implementation should be used
to communicate with a physical smart card that has the given AnswerToReset
.
This function is called when the system is trying to ascertain which SmartCard implementation should be used to
communicate with a physical SmartCard found in a reader.
For Advanced Security SD (ASSD) cards (smart cards embedded in media cards like microSD), the AnswerToReset
cannot be retrieved. As such, the AnswerToReset
passed into this method is created using information in the
Card IDentification (CID) register of the smart card, as follows:
AnswerToReset
is null.
atr
- The AnswerToReset
of the smart card. Must be non-null.
protected abstract boolean checkAnswerToResetImpl(AnswerToReset atr)
SmartCard
implementation should be used
to communicate with a physical smart card that has the given AnswerToReset
.
This function is called when the system is trying to ascertain which SmartCard implementation should be used to
communicate with a physical SmartCard found in a reader.
atr
- The AnswerToReset
of the smart card. Will be non-null.
public final String getLabel()
The String should not include the words "smart card", as this method will be used to generate strings such as ( "Please insert your %s smart card", getLabel() )
protected abstract String getLabelImpl()
The String should not include the words "smart card", as this method will be used to generate strings such as ( "Please insert your %s smart card", getLabel() )
public final void displaySettings(Object context)
context
- Reserved for future use.protected void displaySettingsImpl(Object context)
context
- Reserved for future use.public final boolean isDisplaySettingsAvailable(Object context)
context
- Reserved for future use.
protected boolean isDisplaySettingsAvailableImpl(Object context)
context
- Reserved for future use.
public final boolean isFingerprintSupportAvailable()
If this driver can extract fingerprints from the card, it can be used in the smart card fingerprint authenticator.
protected boolean isFingerprintSupportAvailableImpl()
If your driver supports retrieval of fingerprints from the smart
card, you should implement this method to return true. If you do so you
should also implement the corresponding
SmartCardSession#getFingerprintsImp
.
public final boolean isBuiltInReaderSupported()
protected boolean isBuiltInReaderSupportedImpl()
public String toString()
Object
toString
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())
toString
in class Object
public boolean equals(Object obj)
equals
in class Object
obj
- the reference object with which to compare.
NullPointerException
- if obj
is null.Boolean.hashCode()
,
Hashtable
public int hashCode()
Object
java.util.Hashtable
.
The general contract of hashCode
is:
hashCode
method on each of
the two objects must produce the same integer result.
Object.equals(java.lang.Object)
method, then calling the hashCode method on each of the
two objects must produce distinct integer results. However, the
programmer should be aware that producing distinct integer results
for unequal objects may improve the performance of hashtables.
As much as is reasonably practical, the hashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the JavaTM programming language.)
hashCode
in class Object
Object.equals(java.lang.Object)
,
Hashtable
|
|||||||||
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