
self.lib.setConnectionType(UInt(BLE_EMV))
self.lib.setDeviceType(UInt32(MAGTEKEDYNAMO))func bleReaderStateUpdated(_ state: MTSCRABLEState) {
print("readerStateUpdated - ", state)
if (state == 0) {
// dispatch in main queue is very important
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1,
execute: {
self.lib.startScanningForPeripherals()
})
}
}
func onDeviceList(_ instance: Any!, connectionType: UInt, deviceList:
[Any]!) {
let devices = deviceList as! [MTDeviceInfo]
devList.removeAll()
let peripherals = self.lib.getDiscoveredPeripherals()
print(peripherals as Any)
...
}
lib.stopScanningForPeripherals()
lib.setAddress(devList[selected].address)
lib.openDevice()