aboutsummaryrefslogtreecommitdiff
path: root/AT91SAM7S256/armdebug/nxt-python-fantom/nxt/fantomglue.py
diff options
context:
space:
mode:
Diffstat (limited to 'AT91SAM7S256/armdebug/nxt-python-fantom/nxt/fantomglue.py')
-rw-r--r--AT91SAM7S256/armdebug/nxt-python-fantom/nxt/fantomglue.py26
1 files changed, 25 insertions, 1 deletions
diff --git a/AT91SAM7S256/armdebug/nxt-python-fantom/nxt/fantomglue.py b/AT91SAM7S256/armdebug/nxt-python-fantom/nxt/fantomglue.py
index 359427d..16d9608 100644
--- a/AT91SAM7S256/armdebug/nxt-python-fantom/nxt/fantomglue.py
+++ b/AT91SAM7S256/armdebug/nxt-python-fantom/nxt/fantomglue.py
@@ -64,7 +64,16 @@ 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
+ print "NXT object deleted"
+ else:
+ print "No NXT Object when calling __del__ for BluetoothSocket"
+
class BluetoothError(IOError):
pass
@@ -127,10 +136,25 @@ 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
+ print "NXT object deleted"
+ else:
+ print "No NXT Object when calling __del__ for USBSocket"
if __name__ == '__main__':
#get_info = False