public abstract class AbstractIso7816CommandBuilder extends AbstractApduCommandBuilder
It has to be extended by all PO and SAM command builder classes.
It provides, through the AbstractApduCommandBuilder superclass, the generic getters to retrieve:
commandRef, request
Modifier | Constructor and Description |
---|---|
protected |
AbstractIso7816CommandBuilder(CardCommand commandReference,
ApduRequest request)
(protected)
Abstract constructor to build a command with a command reference and an ApduRequest . |
Modifier and Type | Method and Description |
---|---|
protected ApduRequest |
setApduRequest(byte cla,
CardCommand command,
byte p1,
byte p2,
byte[] dataIn,
java.lang.Byte le)
Helper method to create an ApduRequest from separated elements.
|
addSubName, getApduRequest, getCommandRef, getName
protected AbstractIso7816CommandBuilder(CardCommand commandReference, ApduRequest request)
ApduRequest
.commandReference
- The CardCommand
used as Command reference (should be not null)request
- The ApduRequest
used for the requestprotected ApduRequest setApduRequest(byte cla, CardCommand command, byte p1, byte p2, byte[] dataIn, java.lang.Byte le)
The ISO7816-4 case for data in a command-response pair is determined from the provided arguments:
dataIn = null, le = null
→ case 1: no
command data, no response data expected.
dataIn = null, le != null
→ case 2: no
command data, expected response data.
dataIn != null, le = null
→ case 3: command
data, no response data expected.
dataIn != null, le = 0
→ case 4: command data, expected response data.
If dataIn is not null and Le > 0 an IllegalArgumentException is thrown
cla
- class of instruction (should not be null)command
- CardCommand
used for Instruction (INS) (should not be null)p1
- instruction parameter 1 (should not be null)p2
- instruction parameter 2 (should not be null)dataIn
- bytes sent in the data field of the command. dataIn.limit will be Lc (Number of
bytes present in the data field of the command).le
- maximum number of bytes expected in the data field of the response to the command
(set to 0 is the case where ingoing and outgoing are present. Let the lower layer to handle
the actual length [case4]).