aboutsummaryrefslogtreecommitdiff
path: root/AT91SAM7S256/armdebug/nxt-python-fantom/nxt/fantomglue.py
diff options
context:
space:
mode:
authorTat-Chee Wan (USM)2011-05-05 14:19:57 +0800
committerTat-Chee Wan (USM)2011-05-05 14:19:57 +0800
commit95844a4c56675f5130893ef0c52caa58567cb352 (patch)
treee7d34ce728be74b678b3f28870cbb4d1f465240e /AT91SAM7S256/armdebug/nxt-python-fantom/nxt/fantomglue.py
parenta37cdc84494a314a1f67701c0c1beafc6c98c034 (diff)
parentb8c8045ffdff1e0d5337398563ed6b86d3661040 (diff)
Merge branch 'master' of ssh://svc.cs.usm.my/~/gitrepo-bare/armdebug
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