|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.dalsemi.onewire.container.ResponseAPDU
A ResponseAPDU
represents an Application Protocol Data Unit (APDU)
received from the smart card in response to a previous CommandAPDU
.
A ResponseAPDU
consists of an optional body and a mandatory
Status Word (SW).
According to ISO 7816-4, a ResponseAPDU
has the following
format:
DATA | STATUS WORD [data] | SW1 SW2where
data
is an optional byte array of data received from the smart card.
SW1
is the status byte 1 containing command processing status.
SW2
is the status byte 2 containing command processing qualifier.
byte[] buffer = {(byte)0x01, (byte)0x02, (byte)0x90, (byte)0x00};
ResponseAPDU rapdu = new ResponseAPDU(buffer);
OneWireContainer16 owc16 = new OneWireContainer16(adapter, address);
byte[] buffer = {(byte)0x90, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x01, (byte)0x02, (byte)0x03};
CommandAPDU capdu = new CommandAPDU(buffer);
ResponseAPDU rapdu = owc16.sendAPDU(capdu, runTime);
CommandAPDU
,
OneWireContainer16
Constructor Summary | |
ResponseAPDU(byte[] buffer)
Constructs a new ResponseAPDU with the given buffer
byte array. |
Method Summary | |
byte |
getByte(int index)
Gets the byte value at the specified offset in apduBuffer . |
byte[] |
getBytes()
Gets a byte array holding this ResponseAPDU
apduBuffer . |
byte[] |
getData()
Gets the data field of this ResponseAPDU . |
int |
getLength()
Gets the length of apduBuffer . |
int |
getSW()
Gets the value of SW1 and SW2 as an integer. |
byte |
getSW1()
Gets the value of SW1. |
byte |
getSW2()
Gets the value of SW2. |
String |
toString()
Gets a string representation of this ResponseAPDU . |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public ResponseAPDU(byte[] buffer)
ResponseAPDU
with the given buffer
byte array. The internal apduLength
is set to the
length of the buffer passed.buffer
- the byte array with data for the internal
apduBuffer
RuntimeException
- thrown when buffer
length
< 2
.CommandAPDU
Method Detail |
public byte[] getData()
ResponseAPDU
.ResponseAPDU
data fieldpublic final int getSW()
(((SW1 << 8) & 0xFF00) | (SW2 & 0xFF))
(((SW1 << 8) & 0xFF00) | (SW2 & 0xFF))
as an integerpublic final byte getSW1()
public final byte getSW2()
public final byte getByte(int index)
apduBuffer
.index
- the offset in the apduBuffer
-1
if the offset is invalidgetBytes()
,
getLength()
public final byte[] getBytes()
ResponseAPDU
apduBuffer
.apduBuffer
copied into a new arraygetByte(int)
,
getLength()
public final int getLength()
apduBuffer
.apduLength
the length of the
apduBuffer
currently storedpublic String toString()
ResponseAPDU
.toString
in class Object
ResponseAPDU
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |