VHL.ExchangeLongAPDU
This command sends basic Inter-Industry commands to the currently selected card in accordance with the ISO/IEC 7816-4 standard. This command has the same functionality as VHL.ExchangeAPDU, but it allows the application to send commands and receive responses larger than the reader's internal protocol buffers by splitting the command. See the Sys.GetBufferSize command documentation for more details about the reader's internal buffers.
When splitting a command into multiple blocks, this command has to be repeated to transfer the APDU as Cmd parameter block by block. As long as the ContinueCmd parameter is set to true, the reader will wait for further output before transmitting the APDU. The last block of the APDU can be sent by setting ContinueCmd to false. The reader will only start transferring the response once the last block of the APDU command has been sent. If the response is bigger than one communication frame, it is split in the same manner as the command with the ContinueResp flag set to true as long as the response has not been completely received. The command is completely exchanged when the ContinueResp flag is set to false.
A command transfer can be broken if the reader returns an error status code or by starting a new VHL.ExchangeLongAPDU sequence. When starting a new APDU the Reset parameter of the first VHL.ExchangeLongAPDU call always has to be set to true (it does not matter if the command breaks a preceding VHL.ExchangeLongAPDU or not).
The splitting of a command into blocks is determined by the size of the reader's sending and receiving buffers. The size of these buffers can be obtained by the Sys.GetBufferSize command. A frame must not exceed MaxSendSize - 4 or TotalSize - 8.
The sum of the amount of data transmitted and received through Cmd and Resp has to be smaller than or equal to TotalSize.
The following example shows how a 1000 Byte APDU Command which returns a 500 Byte response is transferred to a reader having a buffer of 400 Bytes (i.e. for which Sys.GetBufferSize returns a 400 Byte MaxSendSize and a 400 Byte TotalSize ):
- ExchangeLongAPDU(Reset=True, ContinueCmd=True, Cmd=bytes 0..391) >= ContinueResp=True, Resp=empty
- ExchangeLongAPDU(Reset=False, ContinueCmd=True, Cmd=bytes 392..783) >= ContinueResp=True, Resp=empty
- ExchangeLongAPDU(Reset=False, ContinueCmd=False, Cmd=bytes 784..999) >= ContinueResp=True, Resp=0..175
- ExchangeLongAPDU(Reset=False, ContinueCmd=False, Cmd=empty) >= ContinueResp=False, Resp=176..499
Properties
- Command code: 0x010C
- Command timeout: 60000 ms
- Possible status codes: General status codes, VHL.ErrNoTag, VHL.ErrCardNotSelected, VHL.ErrHf, VHL.ErrHw, VHL.ErrApdu
Parameters (request frame)
Name | Type/Size | Description | |
---|---|---|---|
AssumedCardType | Enumeration (8 bits) |
Forces the reader to assume a specified card type.
By default (i.e. CardType = 0x00), the
reader uses the card type detected by the
VHL.Select command.
The type of the selected card. Since there are no reliable identification standards amongst card manufacturers, we use a heuristic that examines the UID, its length, and other information as documented here. Due to the lack of standards, we cannot guarantee the card type is always identified correctly. Values:
|
|
Reset | Boolean (8 bits) | If true, restart a new APDU. | |
ContinueCmd | Boolean (8 bits) | If true, the content of Cmd will be appended to the last command(s). | |
Length of Cmd | Integer (16 bits) |
Length of Cmd in bytes |
|
Cmd | Raw data | APDU Command data. |
Returned values (response frame)
Name | Type/Size | Description |
---|---|---|
ContinueResp | Boolean (8 bits) | If true, the content of Resp will be appended to the response of the last command(s) |
Length of Resp | Integer (16 bits) |
Length of Resp in bytes |
Resp | Raw data | APDU response data. |