sendAPDU

abstract fun sendAPDU(baApduCommand: ByteArray): TypeOutputContactlessAPDU

Sends an Application Protocol Data Unit (APDU) command to the contactless card and retrieves the response.

This function facilitates communication with a contactless card by transmitting a specific APDU command and awaiting the card's reply. APDUs are the standard format for exchanging data with smart cards.

Return

A String containing the response APDU from the card. This response usually includes a status word (SW1, SW2) indicating the outcome of the command, and potentially data returned by the card.

Parameters

baApduCommand

A ByteArray representing the APDU command to be sent to the card. This typically includes a class byte (CLA), instruction byte (INS), parameter bytes (P1, P2), and optionally a data field length (Lc) and data field, and an expected response length (Le).

Throws

If an error occurs during the communication with the card, such as a communication failure, card removal, or an invalid APDU command. The specific error details can be found within the NexusException object.

Samples