SCardReaderListDelegate
public protocol SCardReaderListDelegate
All the protocols to implement in the client app
Version
Version 1.0Copyright
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 nilDeclaration
Swift
func onReaderListDidCreate(readers: SCardReaderList?, error: Error?)Parameters
readersin case of success an instance of an object of type
SCardReaderListerrorIn 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
readersObject of type
SCardReaderListerrorIn 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
readersObject of type
SCardReaderListresponsea byte array if everything went well or nil in cas of problem.
errorIn 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
readerObject of type
SCardReaderpresentIs the card present?
poweredIs the card powered?
errorIn 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
readersObject of type
SCardReaderListisInLowPowerModetrue 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
channelThe channel that sent the C-APUD (object of type
SCardChannel), can be nil in case of errorresponsea byte array if everything went well or nil in case of problem
errorIn 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
channelObject of type
SCardChannelor nil in case of problemerrorIn 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
channelObject of type
SCardChannelor nil in case of problemerrorIn 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 temporaryDeclaration
Swift
func onData(characteristicId: String, direction: String, data: [UInt8]?)Parameters
characteristicIdBluetooth characteristic that sent or received data
direction<means data sent by the library to the reader,>means data received by the librarydatabyte array representing data sent or received
-
Read device’s power state & battery level
Declaration
Swift
func onPowerInfo(powerState: Int?, batteryLevel: Int?, error: Error?)Parameters
powerStatebatteryLevel0-100%
SCardReaderListDelegate Protocol Reference