SCardReaderListDelegate

public protocol SCardReaderListDelegate

All the protocols to implement in the client app

Version

Version 1.0

Author

SpringCard
  • When the SCardReaderListe.create() methods finished its job, this method is called

    Remark

    In the callback, the first thing to do is to validate that the error parameter is not nil

    Declaration

    Swift

    func onReaderListDidCreate(readers: SCardReaderList?, error: Error?)

    Parameters

    readers

    in case of success an instance of an object of type SCardReaderList

    error

    In case of problem this parameter is not nil and contains an error code and message

  • When a deconnection from the current connected device is asked or when the device itself disconnect

    Declaration

    Swift

    func onReaderListDidClose(readers: SCardReaderList?, error: Error?)

    Parameters

    readers

    Object of type SCardReaderList

    error

    In case of problem this parameter is not nil and contains an error code and message

  • When a response is received after a call to SCardReaderList.control()

    Declaration

    Swift

    func onControlDidResponse(readers: SCardReaderList?, response: [UInt8]?, error: Error?)

    Parameters

    readers

    Object of type SCardReaderList

    response

    a byte array if everything went well or nil in cas of problem.

    error

    In case of problem this parameter is not nil and contains an error code and message

  • When a card is inserted into, or removed from an active reader

    Declaration

    Swift

    func onReaderStatus(reader: SCardReader?, present: Bool?, powered: Bool?, error: Error?)

    Parameters

    reader

    Object of type SCardReader

    present

    Is the card present?

    powered

    Is the card powered?

    error

    In case of problem this parameter is not nil and contains an error code and message

  • Invoked when the device is going to sleep or waking up

    Declaration

    Swift

    func onReaderListState(readers: SCardReaderList, isInLowPowerMode: Bool)

    Parameters

    readers

    Object of type SCardReaderList

    isInLowPowerMode

    true if the product is going to low power mode, false if it is waking-up

  • When a R-APDU is received after a call to SCardChannel.transmit()

    Declaration

    Swift

    func onTransmitDidResponse(channel: SCardChannel?, response: [UInt8]?, error: Error?)

    Parameters

    channel

    The channel that sent the C-APUD (object of type SCardChannel), can be nil in case of error

    response

    a byte array if everything went well or nil in case of problem

    error

    In case of problem this parameter is not nil and contains an error code and message

  • Used to give the result of a SCardReader.cardConnect()

    Declaration

    Swift

    func onCardDidConnect(channel: SCardChannel?, error: Error?)

    Parameters

    channel

    Object of type SCardChannel or nil in case of problem

    error

    In case of problem this parameter is not nil and contains an error code and message

  • Callback used for giving the result of a channel.cardDisconnect()

    Declaration

    Swift

    func onCardDidDisconnect(channel: SCardChannel?, error: Error?)

    Parameters

    channel

    Object of type SCardChannel or nil in case of problem

    error

    In case of problem this parameter is not nil and contains an error code and message

  • Log data sent and received by the library

    Remark

    This callback is temporary

    Declaration

    Swift

    func onData(characteristicId: String, direction: String, data: [UInt8]?)

    Parameters

    characteristicId

    Bluetooth characteristic that sent or received data

    direction

    < means data sent by the library to the reader, > means data received by the library

    data

    byte array representing data sent or received

  • Read device’s power state & battery level

    Declaration

    Swift

    func onPowerInfo(powerState: Int?, batteryLevel: Int?, error: Error?)