Command smartcard.transmitAPDU

The command smartcard.transmitAPDU is used to send an APDU command to the smart card.

The parameters should receive only hexadecimal strings.

Parameters

  1. datafield [string]
    Hexadecimal datafield of an APDU command containing additional information. Optional field: if not used will default to 00
  2. header [string]
    APDU hexadecimal header, composed by CLA + INS + P1 + P2. Required field.
  3. LC [string]
    Datafield parameter size in hexadecimal. Optional field: if not used will default to 00.
  4. LE [string]
    Expected size of the response in hexadecimal. Optional field: if not used will default to 00. If the response size is greater than the two obligatory bytes SW1 and SW2, it is necessary to specify the size of the response in this field.
  5. slot [string]
    slot that was opened with smartcard.startreader
  6. variabledatafieldresponse [string]
    Variable that will store the hexadecimal return value of the APDU command.
  7. variableSW [string]
    Variable that will store the obligatory two hexadecimal bytes from the APDU command.
  8. variablereturn [integer]
    Return of the command, which:
    • -2: Error while sending the command to the card
    • -1: Invalid slot
    • 1: Command successfully sent

Example


In the example above, a while loop waits for the command smartcard.insertedcard to identify a card insertion.

Once the card is inserted, the command smartcard.startreader initializes the reader and the card by sending an ATR command; then the command smartcard.transmitAPDU is executed. In the end the result is displayed using the command display.