BluetoothTerminalManager

public class BluetoothTerminalManager : NSObject
extension BluetoothTerminalManager: CBCentralManagerDelegate

The BluetoothTerminalManager class manages card terminals.

Author

Godfrey Chung

Version

1.0

Date

17 Nov 2017
  • The terminal type

    See more

    Declaration

    Swift

    public enum TerminalType
  • This control code is to send escape command.

    Declaration

    Swift

    public static let ioctlEscape: Int
  • Battery status

    Since

    0.4
    See more

    Declaration

    Swift

    public enum BatteryStatus
  • The device information type

    Since

    0.5
    See more

    Declaration

    Swift

    public enum DeviceInfoType : Int
  • The delegate object you want to receive Bluetooth terminal manager events.

    Declaration

    Swift

    public var delegate: BluetoothTerminalManagerDelegate?
  • The central manager

    Declaration

    Swift

    public private(set) var centralManager: CBCentralManager! { get }
  • Starts the scanning for available card terminals.

    Declaration

    Swift

    public func startScan(terminalType: TerminalType)

    Parameters

    terminalType
  • Stops the scanning for available card terminals.

    Declaration

    Swift

    public func stopScan()
  • Gets the timeouts from the card terminal.

    Declaration

    Swift

    public func timeouts(terminal: CardTerminal) throws -> TerminalTimeouts

    Parameters

    terminal

    the card terminal

    Return Value

    the timeouts

  • Sets the master key from the card terminal.

    Since

    0.3

    Declaration

    Swift

    public func setMasterKey(terminal: CardTerminal,
                             masterKey: [UInt8]?) throws

    Parameters

    terminal

    the card terminal

    masterKey

    the master key

  • Gets the terminal type from the card terminal.

    Since

    0.3

    Declaration

    Swift

    public func terminalType(terminal: CardTerminal) throws -> TerminalType

    Parameters

    terminal

    the card terminal

    Return Value

    the terminal type

  • Gets the battery status from the card terminal.

    Since

    0.4

    Throws

    CardError.operationFailed if the card operation failed

    Declaration

    Swift

    public func batteryStatus(terminal: CardTerminal,
                              timeout: Int) throws -> BatteryStatus

    Parameters

    terminal

    the card terminal

    timeout

    the maximum time to wait in milliseconds

    Return Value

    the battery status

  • Gets the battery level from the card terminal.

    Since

    0.4

    Throws

    CardError.operationFailed if the card operation failed

    Declaration

    Swift

    public func batteryLevel(terminal: CardTerminal,
                             timeout: Int) throws -> Int

    Parameters

    terminal

    the card terminal

    timeout

    the maximum time to wait in milliseconds

    Return Value

    the battery level. -1 if the card terminal does not support it.

  • Gets the device information.

    Since

    0.5

    Throws

    CardError.operationFailed if the card operation failed

    Declaration

    Swift

    public func deviceInfo(terminal: CardTerminal,
                           type: BluetoothTerminalManager.DeviceInfoType,
                           timeout: Int) throws -> String?

    Parameters

    terminal

    the card terminal

    type

    the device information type

    timeout

    the maximum time to wait in milliseconds

    Return Value

    the device information. nil if the card terminal does not support it.

  • Disconnects the card terminal.

    Declaration

    Swift

    public func disconnect(terminal: CardTerminal) throws

    Parameters

    terminal

    the card terminal

CBCentralManagerDelegate