CcidDriver

class CcidDriver(usbManager: UsbManager, device: UsbDevice)

A driver for USB CCID (Chip Card Interface Device) smart card readers. This class handles the communication with a CCID-compliant smart card reader, allowing for sending APDUs (Application Protocol Data Units) to a smart card and receiving responses. It also provides notifications for card insertion and removal.

The driver communicates with the CCID reader over bulk and interrupt USB endpoints. It uses a listener interface to notify the application of card events.

Constructors

Link copied to clipboard
constructor(usbManager: UsbManager, device: UsbDevice)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun connect()

Connects to the CCID reader. This method must be called before any other operations can be performed. It requests permission to access the USB device, opens a connection, and starts listening for card events.

Link copied to clipboard

Disconnects from the CCID reader. This method should be called when the application is finished with the device. It releases all resources and closes the connection.

Link copied to clipboard

Gets the current status of the card in the reader.

Link copied to clipboard

Sets or removes the listener for card events.

Link copied to clipboard
fun transceive(commandApdu: ByteArray): ByteArray

Sends a command APDU to the smart card and returns the response APDU. This is a synchronous operation and will block until the response is received.