BluetoothTerminalManager
public class BluetoothTerminalManager : NSObject
extension BluetoothTerminalManager: CBCentralManagerDelegate
The BluetoothTerminalManager
class manages card terminals.
Version
1.0Date
17 Nov 2017-
The terminal type
See moreDeclaration
Swift
public enum TerminalType
-
This control code is to send escape command.
Declaration
Swift
public static let ioctlEscape: Int
-
Declaration
Swift
public enum BatteryStatus
-
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
the terminal type. It can be
TerminalType.acr3901us1
,TerminalType.acr1255uj1
orTerminalType.amr220c
. -
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.3Declaration
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.3Declaration
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.4Throws
CardError.operationFailed
if the card operation failedDeclaration
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.4Throws
CardError.operationFailed
if the card operation failedDeclaration
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.5Throws
CardError.operationFailed
if the card operation failedDeclaration
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
-
Undocumented
Declaration
Swift
public func centralManagerDidUpdateState(_ central: CBCentralManager)
-
Undocumented
Declaration
Swift
public func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI: NSNumber)
-
Undocumented
Declaration
Swift
public func centralManager(_ central: CBCentralManager, didConnect peripheral: CBPeripheral)
-
Undocumented
Declaration
Swift
public func centralManager(_ central: CBCentralManager, didFailToConnect peripheral: CBPeripheral, error: Error?)
-
Undocumented
Declaration
Swift
public func centralManager(_ central: CBCentralManager, didDisconnectPeripheral peripheral: CBPeripheral, error: Error?)