mirror of
https://github.com/brmlab/brmdoor_libnfc.git
synced 2025-06-08 16:36:25 +02:00
Fixed open/close order in case of initiator error
This commit is contained in:
parent
87f9486fcf
commit
a8149abeec
2 changed files with 5 additions and 2 deletions
|
@ -41,12 +41,12 @@ void NFCDevice::open()
|
|||
throw NFCError("Unable to open NFC device.");
|
||||
}
|
||||
|
||||
_opened = true;
|
||||
|
||||
if (nfc_initiator_init(_nfcDevice) < 0) {
|
||||
close();
|
||||
throw NFCError("NFC initiator error");
|
||||
}
|
||||
|
||||
_opened = true;
|
||||
}
|
||||
|
||||
void NFCDevice::close()
|
||||
|
|
3
runme.py
3
runme.py
|
@ -7,3 +7,6 @@ nfc.close()
|
|||
nfc.open()
|
||||
print hexlify(nfc.scanUID())
|
||||
print "Device is opened:", nfc.opened()
|
||||
print "Closing device"
|
||||
nfc.close()
|
||||
print "Device is opened:", nfc.opened()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue