CardTerminal

public protocol CardTerminal : AnyObject

A Smart Card terminal, sometimes referred to as a Smart Card Reader. A CardTerminal object can be obtained by calling CardTerminals.list() or CardTerminals.terminal(name:).

Note that physical card readers with slots for multiple cards are represented by one CardTerminal object per such slot.

See also

CardTerminals

See also

TerminalFactory

Author

Andreas Sterbenz

Author

JSR 268 Expert Group

Author

Godfrey Chung

Version

1.0

Date

6 Nov 2017

  • Returns the unique name of this terminal.

    Declaration

    Swift

    var name: String { get }
  • Establishes a connection to the card. If a connection has previously established using the specified protocol, this method returns the same Card object as the previous call.

    Throws

    CardError.illegalArgument if protocol is an invalid protocol specification; CardError.cardNotPresent if no card is present in this terminal; CardError.operationFailed if a connection could not be established using the specified protocol or if a connection has previously been established using a different protocol

    Declaration

    Swift

    func connect(protocolString: String) throws -> Card

    Parameters

    protocolString

    the protocol to use (“T=0”, “T=1”, or “T=CL”), or “*” to connect using any available protocol.

    Return Value

    the Card object

  • Returns whether a card is present in this terminal.

    Throws

    CardError.operationFailed if the status could not be determined

    Declaration

    Swift

    func isCardPresent() throws -> Bool

    Return Value

    whether a card is present in this terminal

  • 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 returns true.

    If a card is present in this terminal when this method is called, it returns immediately.

    Throws

    CardError.illegalArgument if timeout is negative; CardError.operationFailed if the operation failed

    Declaration

    Swift

    func waitForCardPresent(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 absent in this terminal or the timeout expires. If the method returns due to an expired timeout, it returns false. Otherwise it returns true.

    If no card is present in this terminal when this method is called, it returns immediately.

    Throws

    CardError.illegalArgument if timeout is negative; CardError.operationFailed if the operation failed

    Declaration

    Swift

    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