Explicit unload() 'destructor'

This commit is contained in:
Ondrej Mikle 2014-07-19 20:09:05 +02:00
parent 3717cb2563
commit bbec77f248
3 changed files with 31 additions and 4 deletions

View file

@ -71,12 +71,18 @@ public:
/** Open device explicitly. May be useful after explicit close */
void open() throw(NFCError);
/** Returns true iff device was opened */
bool opened() const {return _opened;}
/** Returns true iff device was opened and not unloaded. */
bool opened() const {return _opened && !_unloaded;}
/** Close reader. You need to reopen before reading again */
void close();
/**
* Unload all structures, close device. It's kind of explicit destructor
* since we can't be sure the destructor will be called in Python.
*/
void unload();
/**
* Specifies the number of polling (0x01 0xFE: 1 up to 254 polling, 0xFF:
* Endless polling)
@ -106,6 +112,9 @@ protected:
/** Whether device has been successfully opened */
bool _opened;
/** Whether device and its internal libnfc structures have been unloaded */
bool _unloaded;
};