opencard.core.terminal
Class CardID
java.lang.Object
|
+--opencard.core.terminal.CardID
- public class CardID
- extends java.lang.Object
Represents a smartcard's ATR (Answer To Reset). In addition to the ATR
itself, the Slot where the card is inserted can be stored.
The ATR is used for identifying cards. It usually contains some so-called
historical characters which can be used to determine the type of
card. Since the historical characters can be defined by the card issuer,
they may also give a hint on the applications supported by the smartcard.
- Version:
- $Id: CardID.java,v 1.3 1999/10/22 16:07:34 damke Exp $
|
Field Summary |
protected byte[] |
atr
The represented ATR. |
protected java.lang.String |
cachedResult
The cached result of toString. |
protected byte[] |
historicals
The historical characters of the ATR.
|
protected int |
slotNr
The slot which holds the card with this ATR. |
protected CardTerminal |
terminal
|
|
Constructor Summary |
CardID(byte[] answerToResetResponse)
Instantiates a new card ID representing the given ATR. |
CardID(CardTerminal terminal,
int slotID,
byte[] answerToResetResponse)
Instantiates a new card ID representing the given ATR from the given slot. |
CardID(Slot slot,
byte[] answerToResetResponse)
Deprecated. use CardID(CardTerminal, int, byte[]) |
|
Method Summary |
boolean |
equals(java.lang.Object obj)
Compares this with another CardID object.
|
byte[] |
getATR()
Gets the represented ATR.
|
CardTerminal |
getCardTerminal()
Deprecated. use getSlotID() instead |
byte[] |
getHistoricals()
Gets the historical characters.
|
Slot |
getSlot()
Deprecated. use getSlotID(), getCardTerminal() instead |
int |
getSlotID()
Deprecated. use getSlotID() instead |
java.lang.String |
toString()
Returns a String representation of this CardID object. |
| Methods inherited from class java.lang.Object |
clone,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
atr
protected byte[] atr
- The represented ATR.
historicals
protected byte[] historicals
- The historical characters of the ATR.
There can be at most 15 historical characters.
If there are no historical characters, this attribute
holds null, not an empty array.
slotNr
protected int slotNr
- The slot which holds the card with this ATR.
terminal
protected CardTerminal terminal
cachedResult
protected java.lang.String cachedResult
- The cached result of toString.
- See Also:
toString()
CardID
public CardID(byte[] answerToResetResponse)
throws CardTerminalException
- Instantiates a new card ID representing the given ATR.
- Parameters:
answerToResetResponse - a byte array holding the ATR to represent- Throws:
- CardTerminalException - if the ATR is invalid
CardID
public CardID(Slot slot,
byte[] answerToResetResponse)
throws CardTerminalException
- Deprecated. use CardID(CardTerminal, int, byte[])
CardID
public CardID(CardTerminal terminal,
int slotID,
byte[] answerToResetResponse)
throws CardTerminalException
- Instantiates a new card ID representing the given ATR from the given slot.
- Parameters:
CardTerminal - the terminal where the card with this ATR is insertedslotID - the slot where the card with this ATR is inserted.answerToResetResponse - a byte array holding the ATR- Throws:
- CardTerminalException - if the ATR is invalid
getATR
public byte[] getATR()
- Gets the represented ATR.
The returned byte array holds a copy of the ATR.
It can safely be modified.
- Returns:
- a byte array holding the ATR
getHistoricals
public byte[] getHistoricals()
- Gets the historical characters.
Despite their name, the historical characters are byte values.
They do not have to be printable characters. Therefore, they
are returned as a byte array, not as a string. The byte array
is newly allocated and can safely be modified.
- Returns:
- a byte array containing the historical characters,
or null if the ATR does not include any
getSlot
public Slot getSlot()
- Deprecated. use getSlotID(), getCardTerminal() instead
- Gets the instantiating Slot.
- Returns:
- the Slot where the card with this ATR is inserted,
or null if unknown
getSlotID
public int getSlotID()
- Deprecated. use getSlotID() instead
- Gets the instantiating slot id.
- Returns:
- the SlotID or 0 if unknown
getCardTerminal
public CardTerminal getCardTerminal()
- Deprecated. use getSlotID() instead
- Gets the instantiating terminal.
- Returns:
- the terminal or null if unknown
equals
public boolean equals(java.lang.Object obj)
- Compares this with another CardID object.
They are equal if the represented ATRs are equal.
- Parameters:
obj - the CardID to compare with- Returns:
- true if the object represents the same ATR,
false if it represents a different ATR or
no ATR at all
- Overrides:
- equals in class java.lang.Object
toString
public java.lang.String toString()
- Returns a String representation of this CardID object.
- Returns:
- A String representation of this CardID
object.
- Overrides:
- toString in class java.lang.Object
|