aboutsummaryrefslogtreecommitdiff
path: root/AT91SAM7S256
diff options
context:
space:
mode:
Diffstat (limited to 'AT91SAM7S256')
-rw-r--r--AT91SAM7S256/armdebug/nxt-python-fantom/nxt/fantomglue.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/AT91SAM7S256/armdebug/nxt-python-fantom/nxt/fantomglue.py b/AT91SAM7S256/armdebug/nxt-python-fantom/nxt/fantomglue.py
index 4ba57a7..697655f 100644
--- a/AT91SAM7S256/armdebug/nxt-python-fantom/nxt/fantomglue.py
+++ b/AT91SAM7S256/armdebug/nxt-python-fantom/nxt/fantomglue.py
@@ -54,7 +54,10 @@ class BluetoothSocket:
addr, port = addrport
if self._sock is None:
# Port is ignored
- self._sock = pyfantom.NXT(addr)
+ paired_addr = pair_bluetooth(addr)
+ if self.debug:
+ print "BT Paired Addr: ", paired_addr
+ self._sock = pyfantom.NXT(paired_addr)
def send(self, data):
return self._sock.write( data )
@@ -194,9 +197,9 @@ if __name__ == '__main__':
#rep = nxt.recv(7) # Works, since reply is 7 bytes
rep = nxt.recv(5) # Works, read length < remaining buffer content length
print "read", struct.unpack('%dB' % len(rep), rep)
- rep = nxt.recv(2) # Works, read length <= remaining buffer content length
+ rep = nxt.recv(5) # Works, remaining buffer content length is non-zero
print "read", struct.unpack('%dB' % len(rep), rep)
- #rep = nxt.recv(1) # Doesn't work if it exceeds buffer content length (exception)
+ rep = nxt.recv(1) # Doesn't work if no bytes are in read buffer
# Same thing, without response.
#cmd = struct.pack('2B', 0x81, 0x88)
#r = nxt.send(cmd)