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 ):

  1. ExchangeLongAPDU(Reset=True, ContinueCmd=True, Cmd=bytes 0..391) >= ContinueResp=True, Resp=empty
  2. ExchangeLongAPDU(Reset=False, ContinueCmd=True, Cmd=bytes 392..783) >= ContinueResp=True, Resp=empty
  3. ExchangeLongAPDU(Reset=False, ContinueCmd=False, Cmd=bytes 784..999) >= ContinueResp=True, Resp=0..175
  4. ExchangeLongAPDU(Reset=False, ContinueCmd=False, Cmd=empty) >= ContinueResp=False, Resp=176..499

Properties

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.

Values:
  • Default (0x00)
    See description above
  • MifareClassic (0x10)
    MIFARE Classic (1k and 4k variants)
  • Iso14443aGeneric (0x11)
    Generic ISO 14443-4 Type A without ISO 7816-4 support
  • Iso14443aInterIndustry (0x12)
    ISO 14443-4 Type A compliant with ISO7816-4 and MIFARE L3
  • MifareUltraLight (0x13)
    MIFARE Ultralight
  • MifareDesfire (0x14)
    MIFARE DESFire (2k, 4k, and 8k variants)
  • InfineonSle55 (0x15)
    Infineon my-d proximity (SLE55)
  • Iso14443aIntIndustryMif (0x16)
    ISO 14443 Type A (NXP SmartMX/inter-industry)
  • MifarePlusL2 (0x17)
    MIFARE Plus L2 (2k and 4k variants)
  • LEGICAdvantIso14443a (0x18)
    LEGIC advant ISO 14443 Type A
  • MifarePlusL3 (0x19)
    MIFARE Plus L3
  • LEGICPrimeLegacy (0x20)
    LEGIC prime; this is a legacy value - it has been replaced by LEGICPrime .
  • LEGICAdvantLegacy (0x21)
    LEGIC advant (ISO 14443 Type A/ISO 15693); this is a legacy value - it has been replaced by LEGICAdvantIso14443a and LEGICAdvantIso15693.
  • Iso15693 (0x30)
    ISO-15693-compliant label
  • LEGICAdvantIso15693 (0x32)
    LEGIC advant ISO 15693
  • Iso14443bUnknown (0x40)
    ISO 14443-4 Type B without ISO 7816-4 support
  • Iso14443bIntIndustry (0x41)
    ISO 14443-4 Type B with ISO 7816-4 support
  • IClassIso14B (0x42)
    iCLASS via standard-compliant ISO 14443 Type B protocol (Level 3 compatible)
  • IClassIso14B2 (0x50)
    iCLASS via proprietary ISO 14443 Type B protocol derivate (Level 2 compatible)
  • IClass (0x60)
    iCLASS via ISO 15693
  • Felica (0x70)
    FeliCa
  • EM4205 (0x80)
    EM 4205/EM 4305
  • EM4100 (0x81)
    EM 4100/EM 4102
  • EM4450 (0x83)
    EM 4450
  • Pyramid (0x84)
    HID Pyramid
  • HidProx32 (0x85)
    HID Prox32
  • Keri (0x86)
    Keri
  • Quadrakey (0x87)
    QuadraKey
  • HidIndala (0x88)
    HID Indala ASP
  • HidAwid (0x89)
    AWID
  • HidProx (0x8A)
    HID Proximity
  • HidIoprox (0x8B)
    ioProx
  • Hitag1S (0x8C)
    HITAG 1 or S
  • Hitag2M (0x8D)
    HITAG 2 Manchester
  • Hitag2B (0x8E)
    HITAG 2 Biphase
  • TTF (0x8F)
    Low-level card type/programmable decoder
  • STSRIX (0x90)
    ST SRIX
  • SecuraKey (0xA0)
    SecuraKey
  • GProx (0xA1)
    G-Prox
  • HidIndalaSecure (0xA2)
    HID Indala ASP+
  • Cotag (0xA3)
    Cotag
  • Idteck (0xA4)
    IDTECK
  • BluetoothMce (0xB0)
    Bluetooth MCE; Mobile Card Emulation over Bluetooth
  • LEGICPrime (0xC0)
    LEGIC prime
  • HidSio (0xE0)
    Abstract card type for reading SIO Elements
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 byte
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 byte
Resp Raw data APDU response data.