CardTerminal
public class CardTerminal : BaseClass
SmartCardIO - CardTerminal class
A Smart Card terminal, sometimes refered to as a Smart Card Reader. A CardTerminal object can be obtained by calling CardTerminals.list() or CardTerminals.getTerminal(). Note that physical card readers with slots for multiple cards are represented by one CardTerminal object per such slot.
-
Establishes a connection to the card using the entered protocol. If a connection has previously established using the specified protocol, this method returns the same Card object as the previous call.
Throws
Status.StatusCode on failure (see enum Status.StatusCode for possible values)
Declaration
Swift
public func connect(protocolString: String) throws -> Card
Parameters
protocolString
the protocol to use (“T=0”, “T=1”), or “*” to connect using any available protocol.
Return Value
Card instance
-
Returns the unique name of this terminal.
Declaration
Swift
public func getName() -> String
Return Value
String holding the name
-
Returns whether a card is present in this terminal.
Declaration
Swift
public func isCardPresent() -> Bool
Return Value
True if a card is present, else false
-
Waits until a card is absent in this terminal or the timeout expires. If the method returns due to an expired timeout, it returns false. Otherwise it return true. If no card is present in this terminal when this method is called, it returns immediately.
Throws
Status.StatusCode on failure (see enum Status.StatusCode for possible values)
Declaration
Swift
public func waitForCardAbsent(timeout: Int) throws -> Bool
Parameters
timeout
if positive, block for up to timeout milliseconds; if zero, block indefinitely; must not be negative
Return Value
False if the method returns due to an expired timeout, true otherwise
-
Waits until a card is present in this terminal or the timeout expires. If the method returns due to an expired timeout, it returns false. Otherwise it return true. If a card is present in this terminal when this method is called, it returns immediately.
Throws
Status.StatusCode on failure (see enum Status.StatusCode for possible values)
Declaration
Swift
public func waitForCardPresent(timeout: Int) -> Bool
Parameters
timeout
if positive, block for up to timeout milliseconds; if zero, block indefinitely; must not be negative
Return Value
False if the method returns due to an expired timeout, true otherwise.
-
Returns the current battery level of the terminal in hexadecimal format. Note: returns 0xFF when charging.
Throws
Status.StatusCode on failure (see enum Status.StatusCode for possible values)Declaration
Swift
public func getBatteryLevel() throws -> UInt8
Return Value
Current battery level in hexadecimal format (0x00 till 0x64) or 0xFF when charging
-
Returns the firmware version of the terminal as ascii string
Throws
Status.StatusCode on failure (see enum Status.StatusCode for possible values)Declaration
Swift
public func getFirmwareVersion() throws -> String
Return Value
firmware version of the terminal as ascii string