# Card

    @objcMembers
    public class Card : BaseClass

SmartCardIO - Card class

A Smart Card with which a connection has been established. Card objects are obtained by calling CardTerminal.connect().

- `ConnectionProtocol`

  Possible connection protocol used for Card connections

  See more

  #### Declaration

  Swift

      public enum ConnectionProtocol : String, Equatable, CaseNameable

- `beginExclusive()`

  Requests exclusive access to this card. Once a thread has invoked beginExclusive, only this thread is allowed to communicate with this card until it calls endExclusive. Other threads attempting communication will receive a CardException. Applications have to ensure that exclusive access is correctly released. This can be achieved by executing the beginExclusive() and endExclusive calls.

  Throws

  Status.StatusCode on failure (see enum Status.StatusCode for possible values)

  #### Declaration

  Swift

      public func beginExclusive() throws

- `endExclusive()`

  Releases the exclusive access previously established using beginExclusive.

  Throws

  Status.StatusCode on failure (see enum Status.StatusCode for possible values)

  #### Declaration

  Swift

      public func endExclusive() throws

- `getATR()`

  Returns the ATR of this card.

  #### Declaration

  Swift

      public func getATR() -> ATR

  #### Return Value

  ATR in the form of a ATR object

- `getBasicChannel()`

  Returns the CardChannel for the basic logical channel. The basic logical channel has a channel number of 0.

  Throws

  Status.StatusCode on failure (see enum Status.StatusCode for possible values)

  #### Declaration

  Swift

      public func getBasicChannel() throws -> CardChannel

  #### Return Value

  CardChannel in the form of a CardChannel object

- `getProtocol()`

  Returns the protocol in use for this card.

  #### Declaration

  Swift

      public func getProtocol() -> ConnectionProtocol

  #### Return Value

  Connection protocol (see enum ConnectionProtocol for possible values)

- `getProtocol()`

  Returns the protocol in use for this card in String form.

  #### Declaration

  Swift

      public func getProtocol() -> String

  #### Return Value

  Connection protocol as String

- `openLogicalChannel()`

  Opens a new logical channel to the card and returns it. The channel is opened by issuing a MANAGE CHANNEL command that should use the format [00 70 00 00 01].

  Throws

  Status.StatusCode on failure (see enum Status.StatusCode for possible values)

  #### Declaration

  Swift

      public func openLogicalChannel() throws -> CardChannel

  #### Return Value

  CardChannel in the form of a CardChannel object

- `transmitControlCommand(controlCode:command:)`

  Transmits a control command to the terminal device. This can be used to, for example, control terminal functions like a built-in PIN pad or biometrics.

  Throws

  Status.StatusCode on failure (see enum Status.StatusCode for possible values)

  #### Declaration

  Swift

      public func transmitControlCommand(controlCode: Int, command: Data) throws -> Data?

  #### Parameters

  `controlCode` | The control code of the command. Note: only code 3500 is supported as this time.
  `command` | The command Data

  #### Return Value

  Response data if any, else nil

- `disconnect(reset:)`

  Disconnects the connection with this card. After this method returns, calling methods on this object or in CardChannels associated with this object that require interaction with the card will raise an error.

  Throws

  Status.StatusCode on failure (see enum Status.StatusCode for possible values)

  #### Declaration

  Swift

      public func disconnect(reset: Bool) throws

  #### Parameters

  `reset` | whether to reset the card after disconnecting.

Copyright (c) 2018-2024, AB Circle Ltd. All rights reserved.

Generated by jazzy ♪♫ v0.14.3, a Realm project.