summaryrefslogtreecommitdiff
path: root/nxt-python-fantom/nxt/fantomglue.py
diff options
context:
space:
mode:
authorTat-Chee Wan (USM)2011-05-04 08:17:53 +0800
committerTat-Chee Wan (USM)2011-05-04 08:17:53 +0800
commit05b196d6bf26b0fe70a43607269f88187f595673 (patch)
tree512e8d09ed1229ec51e4a7ecf9b112e437103979 /nxt-python-fantom/nxt/fantomglue.py
parent5885fe8b81e99d6af1e51f7d7e3b20d0fee49676 (diff)
work in progress
Tracing Exception in NXTIterator.get_nxt() which is triggered when invoking fantomglue.find_devices()
Diffstat (limited to 'nxt-python-fantom/nxt/fantomglue.py')
-rw-r--r--nxt-python-fantom/nxt/fantomglue.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/nxt-python-fantom/nxt/fantomglue.py b/nxt-python-fantom/nxt/fantomglue.py
index ac125ed..96bcd3c 100644
--- a/nxt-python-fantom/nxt/fantomglue.py
+++ b/nxt-python-fantom/nxt/fantomglue.py
@@ -16,6 +16,8 @@
import pyfantom
+USB_BUFSIZE = 64
+
RFCOMM=11 # lightblue const
FANTOM_BT = RFCOMM # For compatibilty with lightblue
FANTOM_USB = 0
@@ -66,9 +68,12 @@ def _check_brick(arg, value):
def find_devices(lookup_names=False): # parameter is ignored
devicelist = []
for d in pyfantom.NXTIterator(False):
- #name = d.get_name()
- #print "NXT name: ", name
+ addr = d.get_resource_string()
+ print "NXT addr: ", addr
nxt = d.get_nxt()
+ # BUG?: If nxt.get_firware_version() is enabled, d.get_nxt() will throw an exception
+ # Related to Reference Counting for Obj-C Objects?
+ #print " firmware version:", nxt.get_firmware_version()
devicelist.append(nxt)
return devicelist
@@ -90,6 +95,7 @@ class USBSocket:
def __init__(self, device=None):
# We instantiate a NXT object only when we connect if none supplied
+ # FIXME: The addr is not passed in, so we can't actually create a NXT object later
#self.device = device
self._sock = device
self.debug = False
@@ -101,7 +107,7 @@ class USBSocket:
def connect(self):
if self._sock is None:
# Port is ignored
- self._sock = pyfantom.NXT(addr)
+ self._sock = pyfantom.NXT(addr) # FIXME: No address!
def send(self, data):
return self._sock.write( data )