|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.dalsemi.onewire.container.CommandAPDU
A CommandAPDU represents an ISO 7816-4 specified
Application Protocol Data Unit (APDU) sent to a
smart card. A response from the smart card is in turn represented
by a ResponseAPDU.
According to ISO 7816-4, a CommandAPDU has the following
format:
HEADER | BODY
CLA INS P1 P2 | [LC] [DATA] [LE]
where
| Field Summary | |
static int |
CLA
Constant for addressing CLA in the CommandAPDU buffer. |
static int |
INS
Constant for addressing INS in the CommandAPDU buffer. |
static int |
LC
Constant for addressing LC in the CommandAPDU buffer. |
static int |
P1
Constant for addressing P1 in the CommandAPDU buffer. |
static int |
P2
Constant for addressing P2 in the CommandAPDU buffer. |
| Constructor Summary | |
CommandAPDU(byte[] buffer)
Constructs a new ISO 7816-4 CommandAPDU. |
|
CommandAPDU(byte cla,
byte ins,
byte p1,
byte p2)
Constructs a new ISO 7816-4 CASE 1 CommandAPDU. |
|
CommandAPDU(byte cla,
byte ins,
byte p1,
byte p2,
byte[] data)
Constructs a new ISO 7816-4 CASE 3 CommandAPDU. |
|
CommandAPDU(byte cla,
byte ins,
byte p1,
byte p2,
byte[] data,
int le)
Constructs a new ISO 7816-4 CASE 4 CommandAPDU. |
|
CommandAPDU(byte cla,
byte ins,
byte p1,
byte p2,
int le)
Constructs a new ISO 7816-4 CASE 2 CommandAPDU. |
|
| Method Summary | |
byte[] |
getBuffer()
Gets the internal CommandAPDU buffer. |
byte |
getByte(int index)
Gets the byte at the specified position in the buffer. |
byte[] |
getBytes()
Gets a byte array of the buffered CommandAPDU. |
byte |
getCLA()
Gets the CLA byte value. |
byte |
getINS()
Gets the INS byte value. |
int |
getLC()
Gets the length of data field (LC). |
int |
getLE()
Gets the expected length of ResponseAPDU (LE). |
int |
getLength()
Gets the length of the buffered CommandAPDU. |
byte |
getP1()
Gets the first parameter (P1) byte value. |
byte |
getP2()
Gets the second parameter (P2) byte value. |
void |
setByte(int index,
byte value)
Sets the byte value at the specified position in the buffer. |
java.lang.String |
toString()
Gets a string representation of this CommandAPDU. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int CLA
public static final int INS
public static final int P1
public static final int P2
public static final int LC
| Constructor Detail |
public CommandAPDU(byte[] buffer)
buffer - the entire CommandAPDU as a byte array .
public CommandAPDU(byte cla,
byte ins,
byte p1,
byte p2)
cla - CLA byte.ins - INS byte.p1 - Parameter byte P1.p2 - Parameter byte P2.
public CommandAPDU(byte cla,
byte ins,
byte p1,
byte p2,
int le)
cla - CLA byte.ins - INS byte.p1 - Parameter byte P1.p2 - Parameter byte P2.le - Length of expected ResponseAPDU.
This value can be in the range of -1 to 255,
where -1 means no length is expected and 0
means the maximum length supported is expected.
public CommandAPDU(byte cla,
byte ins,
byte p1,
byte p2,
byte[] data)
cla - CLA byte.ins - INS byte.p1 - Parameter byte P1.p2 - Parameter byte P2.data - The CommandAPDU data as a byte array.
The length LC is derived from the array length.
public CommandAPDU(byte cla,
byte ins,
byte p1,
byte p2,
byte[] data,
int le)
cla - CLA byte.ins - INS byte.p1 - Parameter byte P1.p2 - Parameter byte P2.data - The CommandAPDU data as a byte array.
The length LC is derived from the array length.le - Length of expected ResponseAPDU.
This value can be in the range of -1 to 255,
where -1 means no length is expected and 0
means the maximum length supported is expected.| Method Detail |
public byte getCLA()
public byte getINS()
public byte getP1()
public byte getP2()
public int getLC()
public int getLE()
public final byte[] getBuffer()
getBytes()public final byte getByte(int index)
index - the position in the buffersetByte(int, byte),
getLength()public final byte[] getBytes()
getBuffer()public final int getLength()
public final void setByte(int index,
byte value)
index - the position in the buffervalue - the new byte value to storegetByte(int),
getLength()public java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||