summaryrefslogtreecommitdiff
path: root/nxt-python-fantom/nxt/fantomglue.py
diff options
context:
space:
mode:
Diffstat (limited to 'nxt-python-fantom/nxt/fantomglue.py')
-rw-r--r--nxt-python-fantom/nxt/fantomglue.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/nxt-python-fantom/nxt/fantomglue.py b/nxt-python-fantom/nxt/fantomglue.py
index 359427d..a977696 100644
--- a/nxt-python-fantom/nxt/fantomglue.py
+++ b/nxt-python-fantom/nxt/fantomglue.py
@@ -64,7 +64,13 @@ class BluetoothSocket:
def close(self):
if self._sock is not None:
del self._sock
-
+ self._sock = None
+
+ def __del__(self):
+ """Destroy interface."""
+ if self._sock is not None:
+ del self._sock
+
class BluetoothError(IOError):
pass
@@ -127,10 +133,22 @@ class USBSocket:
def recv(self, numbytes):
return self._sock.read( numbytes )
+
+ #def poll_command(self, numbytes):
+ # I'm not sure if this is specific to Direct Command Processing
+ # Or if it refers to any data transmission
+ #print "Bytes Available:", self._sock.bytes_available()
+ #return self._sock.read_buffer( numbytes, 0 )
def close(self):
if self._sock is not None:
del self._sock
+ self._sock = None
+
+ def __del__(self):
+ """Destroy interface."""
+ if self._sock is not None:
+ del self._sock
if __name__ == '__main__':
#get_info = False