SHOW Signed

net.rim.device.api.smartcard
Class SmartCard

java.lang.Object
  |
  +--net.rim.device.api.smartcard.SmartCard
All Implemented Interfaces:
Persistable, Persistable
Direct Known Subclasses:
CryptoSmartCard

public abstract class SmartCard
extends Object
implements Persistable

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 SmartCardID, SmartCardID) 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.

Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

Since:
JDE 4.1.0
See Also:
SmartCardFactory, SmartCardSession, SmartCardID, Persistable

Constructor Summary
 Category: Signed protected SmartCard()
          Constructs a new SmartCard.
 
Method Summary
 Category: Signed  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.
 Category: Signed 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.
 Category: Signed  void displaySettings(Object context)
          Allows the driver to display some settings or properties.
 Category: Signed protected  void displaySettingsImpl(Object context)
          Allows the driver to display some settings or properties.
 Category: Signed  boolean equals(Object obj)
          Indicates whether some other object is "equal to" this one.
 Category: Signed  SmartCardCapabilities getCapabilities()
          Returns the SmartCardCapabilities of the smart card.
 Category: Signed protected abstract  SmartCardCapabilities getCapabilitiesImpl()
          Returns the SmartCardCapabilities of the smart card.
 Category: Signed  String getLabel()
          Returns a label associated with the kind of smart card.
 Category: Signed protected abstract  String getLabelImpl()
          Returns a label associated with the kind of smart card.
 Category: Signed  int hashCode()
          Returns a hash code value for the object.
 Category: Signed  boolean isDisplaySettingsAvailable(Object context)
          Allows the driver to indicate if they support displaying settings.
 Category: Signed protected  boolean isDisplaySettingsAvailableImpl(Object context)
          Allows the driver to indicate if they support displaying settings.
 Category: Signed  SmartCardSession openSession(SmartCardReaderSession readerSession)
          Returns a session through which an application may communicate with a physical SmartCard.
 Category: Signed protected abstract  SmartCardSession openSessionImpl(SmartCardReaderSession readerSession)
          Returns the appropriate subclass of SmartCardSession.
 Category: Signed  String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SmartCard

protected SmartCard()
Constructs a new SmartCard.
Since:
JDE 4.1.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.
Method Detail

checkAnswerToReset

public final 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. 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.

Parameters:
atr - The AnswerToReset of the smart card. Must be non-null.
Returns:
A boolean that determines if the smart card implementation should be used to communicate with the physical smart card.
Since:
JDE 4.1.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

checkAnswerToResetImpl

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. 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.

Parameters:
atr - The AnswerToReset of the smart card. Will be non-null.
Returns:
A boolean that determines if the smart card implementation should be used to communicate with the physical smart card.
Since:
JDE 4.1.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

displaySettings

public final void displaySettings(Object context)
Allows the driver to display some settings or properties. This method will be invoked from the smart card options screen when the user selects the driver and chooses to view the settings of that driver. This method could be called from the event thread. The driver should not block the event thread for long periods of time.
Parameters:
context - Reserved for future use.
Since:
JDE 4.1.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

displaySettingsImpl

protected void displaySettingsImpl(Object context)
Allows the driver to display some settings or properties. This method will be invoked from the smart card options screen when the user selects the driver and chooses to view the settings of that driver. This method could be called from the event thread. The driver should not block the event thread for long periods of time.
Parameters:
context - Reserved for future use.
Since:
JDE 4.1.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

equals

public boolean equals(Object obj)
Description copied from class: Object
Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation:

  • It is reflexive: for any reference value x, x.equals(x) should return true.
  • It is symmetric: for any reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the object is modified.
  • For any non-null reference value x, x.equals(null) should return false.

The equals method for class Object implements the most discriminating possible equivalence relation on objects; that is, for any reference values x and y, this method returns true if and only if x and y refer to the same object (x==y has the value true).

Overrides:
equals in class Object
Since:
JDE 4.2.0

Following copied from class: Object
Parameters:
obj - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.
See Also:
Boolean.hashCode(), Hashtable
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

getCapabilities

public final SmartCardCapabilities getCapabilities()
Returns the SmartCardCapabilities of the smart card.

Returns:
The capabilities of the smart card.
Since:
JDE 4.1.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

getCapabilitiesImpl

protected abstract SmartCardCapabilities getCapabilitiesImpl()
Returns the SmartCardCapabilities of the smart card.

Returns:
The capabilities of the smart card.
Since:
JDE 4.1.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

getLabel

public final String getLabel()
Returns a label associated with the kind of smart card.

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() )

Returns:
A String representing the label of the smart card.
Since:
JDE 4.1.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

getLabelImpl

protected abstract String getLabelImpl()
Returns a label associated with the kind of smart card.

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() )

Returns:
A String representing the label of the smart card.
Since:
JDE 4.1.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

hashCode

public int hashCode()
Description copied from class: Object
Returns a hash code value for the object. This method is supported for the benefit of hashtables such as those provided by java.util.Hashtable.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals(Object) method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the 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.)

Overrides:
hashCode in class Object
Since:
JDE 4.2.0

Following copied from class: Object
Returns:
a hash code value for this object.
See Also:
Object.equals(java.lang.Object), Hashtable
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

isDisplaySettingsAvailable

public final boolean isDisplaySettingsAvailable(Object context)
Allows the driver to indicate if they support displaying settings. If this method returns true, then the method displaySettings maybe called to show settings to the user.
Parameters:
context - Reserved for future use.
Returns:
true if the driver supports displaying settings, false otherwise.
Since:
JDE 4.1.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

isDisplaySettingsAvailableImpl

protected boolean isDisplaySettingsAvailableImpl(Object context)
Allows the driver to indicate if they support displaying settings. If this method returns true, then the method displaySettings maybe called to show settings to the user.
Parameters:
context - Reserved for future use.
Returns:
true if the driver supports displaying settings, false otherwise.
Since:
JDE 4.1.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

openSession

public final SmartCardSession openSession(SmartCardReaderSession readerSession)
                                   throws SmartCardException
Returns a session through which an application may communicate with a physical SmartCard. A SmartCardReaderSession may only have one SmartCardSession associated with it.

Note: sessions should be closed promptly when no longer needed.

Parameters:
readerSession - An open communication session with a reader. Must be non null.
Returns:
The newly opened communications session with the SmartCard.
Throws:
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.
Since:
JDE 4.1.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

openSessionImpl

protected abstract SmartCardSession openSessionImpl(SmartCardReaderSession readerSession)
                                             throws SmartCardException
Returns the appropriate subclass of SmartCardSession.

Implementations of this method should not bring up UI.

Parameters:
readerSession - An open communication session with a reader. Will be non-null.
Returns:
The newly opened communications session with the SmartCard.
Throws:
SmartCardException - Thrown if an error occurs while reading the smart card.
Since:
JDE 4.1.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

toString

public String toString()
Description copied from class: Object
Returns a string representation of the object. In general, the 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())
 
Overrides:
toString in class Object
Since:
JDE 4.1.0

Following copied from class: Object
Returns:
a string representation of the object.
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.


Copyright 1999-2007 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.