在这里,我要实现的是具有加密委托的Linea-Pro磁卡读卡器。 SDK本身已经提供了委托方法,我正在类中确认该方法,但未得到调用。而委托人func magneticCardData(_ track1: String!, track2: String!, track3: String!)
可以被呼叫。有人可以告诉我我想念的东西吗?
class ViewController: UIViewController {
private let cardReader = DTDevices.sharedDevice() as! DTDevices
var params : [AnyHashable: Any] = [:]
//var keyID: Int32 = -1
override func viewDidLoad() {
super.viewDidLoad()
cardReader.addDelegate(self)
cardReader.connect()
}
}
extension ViewController:DTDeviceDelegate {
func connectionState(_ state: Int32) {
if state == CONN_STATES.CONNECTED.rawValue {
DispatchQueue.main.async {
do {
try self.cardReader.emsrSetEncryption(ALG_EH_ECC,params: self.params)
}catch let error {
print(error.localizedDescription)
}
}
}
}
func magneticCardEncryptedData(_ encryption: Int32, tracks: Int32, data: Data!) {
print(data)
}
func magneticCardEncryptedData(_ encryption: Int32, tracks: Int32, data: Data!, track1masked: String!, track2masked: String!, track3: String!) {
print(data)
}
}