From b8c8045ffdff1e0d5337398563ed6b86d3661040 Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM) Date: Thu, 5 May 2011 14:19:14 +0800 Subject: modified recv() to accept a buffer length argument in usbsock.py --- nxt-python-fantom/nxt/brick.py | 1 + nxt-python-fantom/nxt/fantomglue.py | 6 ++++++ nxt-python-fantom/nxt/usbsock.py | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/nxt-python-fantom/nxt/brick.py b/nxt-python-fantom/nxt/brick.py index 740ccbd..240ba27 100644 --- a/nxt-python-fantom/nxt/brick.py +++ b/nxt-python-fantom/nxt/brick.py @@ -217,6 +217,7 @@ class Brick(object): #TODO: this begs to have explicit methods sleep(duration / 1000.0) def __del__(self): + print "Deleting Brick" self.sock.close() find_files = FileFinder diff --git a/nxt-python-fantom/nxt/fantomglue.py b/nxt-python-fantom/nxt/fantomglue.py index a977696..16d9608 100644 --- a/nxt-python-fantom/nxt/fantomglue.py +++ b/nxt-python-fantom/nxt/fantomglue.py @@ -70,6 +70,9 @@ class BluetoothSocket: """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 @@ -149,6 +152,9 @@ class USBSocket: """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 diff --git a/nxt-python-fantom/nxt/usbsock.py b/nxt-python-fantom/nxt/usbsock.py index f4dc3f1..5ff2b36 100644 --- a/nxt-python-fantom/nxt/usbsock.py +++ b/nxt-python-fantom/nxt/usbsock.py @@ -128,6 +128,6 @@ if __name__ == '__main__': #print "read", struct.unpack('%dB' % len(rep), rep) #s.close() #del s - brick.sock.close() + #brick.sock.close() del brick -- cgit v1.2.3