|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.ibm.jc.JCard
This class represents a JavaCard connected to a terminal communicating via a certain logical channel.
| Field Summary | |
static int |
CHANNEL_CLOSE
Logical channel management mode. |
static int |
CHANNEL_OPEN
Logical channel management mode. |
| Constructor Summary | |
JCard(JCTerminal terminal,
ATR atr,
int timeout)
Create a card representative. |
|
| Method Summary | |
ATR |
getATR()
|
int |
getChannel()
Returns the logical channel number currently used. |
JCTerminal |
getTerminal()
|
java.lang.String |
identifyCard(java.io.PrintWriter out)
Returns the class name of the Card Manager implementation which fits to this JavaCard. |
int |
manageChannel(int mode)
Used to open and close Supplementary Logical Channels. |
void |
reset()
Reset card and get a new ATR. |
byte[] |
send(int nad,
byte[] toSend,
int offset,
int len)
Send data to the card via the current logical channel. |
byte[] |
send(int nad,
int cla,
int ins,
int p1,
int p2,
int p3,
byte[] toSend,
int offset,
int le)
Send data to the card via the current logical channel. |
void |
setChannel(int ch)
Sets the logical channel number used in any subsequent APDU communication. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int CHANNEL_OPEN
manageChannel(int),
Constant Field Valuespublic static final int CHANNEL_CLOSE
manageChannel(int),
getChannel(),
setChannel(int),
Constant Field Values| Constructor Detail |
public JCard(JCTerminal terminal,
ATR atr,
int timeout)
terminal - the terminal the card is plugged is or will be plugged in.
The terminal must be initialized and open.atr - the ATR as returned from the card or null. If null then
this object will request an ATR from the terminal object.timeout - timeout in ms to wait for card insertion.JCTerminal| Method Detail |
public void reset()
public JCTerminal getTerminal()
public ATR getATR()
public java.lang.String identifyCard(java.io.PrintWriter out)
out - if not null manufacturer info is printed.
public byte[] send(int nad,
byte[] toSend,
int offset,
int len)
nad - node address to which data is being sent (high nibble = destination
address, low = source address). Address values: 2=host, 1=terminal, 0=card.
A value of 0 means from host to card.toSend - byte array containing APDU to be sent (logical channel
(two least significant bits) should be zero).offset - offset into toSend.len - number of bytes to be transmitted
JCException - if communication failed or if some parameters are wrongsetChannel(int),
getChannel(),
manageChannel(int)
public byte[] send(int nad,
int cla,
int ins,
int p1,
int p2,
int p3,
byte[] toSend,
int offset,
int le)
nad - node address to which data is being sent. A value of 0 means from host to card.cla - CLA byte of APDU (byte #0) (logical channel (two least significant bits) should be zero)ins - INS byte of APDU (byte #1)p1 - P1 byte of APDU (byte #2)p2 - P2 byte of APDU (byte #3)p3 - P3 or LC byte of APDU (byte #4). This byte is omitted if parameter has value -1.toSend - byte array containing command data of APDU. Command data starts at byte #5.offset - offset starting at which data sending is to beginle - LE byte of APDU (appended to APDU). This byte is omitted if parameter has value -1.
JCException - if communication failed or if some parameters are wrongsetChannel(int),
getChannel(),
manageChannel(int)public int manageChannel(int mode)
mode - indicates if the next available supplementary logical
channel is to be opened (CHANNEL_OPEN) or
the current logical channel is to be closed (CHANNEL_CLOSE).
Upon opening a channel the newly opened channel becomes the current channel.
Upon closing a supplementary channel the default channel (zero) becomes
the current channel.
mode).
JCException - if the command failed or if parameters are wrongsetChannel(int),
getChannel(),
CHANNEL_OPEN,
CHANNEL_CLOSEpublic void setChannel(int ch)
ch - the desired logical channel (in the range 0-3).
JCException - if the channel number is invalid.getChannel(),
manageChannel(int),
send(int, byte[], int, int)public int getChannel()
setChannel(int),
manageChannel(int),
send(int, byte[], int, int)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||