Page 1 of 1

Bluetooth Comm using Fantom driver unreliable?

Posted: 19 May 2011, 06:36
by tcwan
Hi,

The Python pyfantom wrapper for the Fantom Drivers is finally working.
It is available from:
http://git.ni.fr.eu.org/?p=pyfantom.git;a=summary

The USB connection seems to work reliably enough for raw write / read (not shown in log).
send_direct_command() seems to work ok though whether with or without replies for Bluetooth.

However, when attempting to connect via Bluetooth, I can't get the raw write / read sequence to work reliably.
In the log below, it does not return any data values at all.

Prior to this, I can sometimes get a response with incomplete / combined data (e.g., additional 2 bytes with BT length, but AFTER the message data bytes) but I can't reproduce it in the test script.
Adding a time delay between the raw write and raw read does not seem to help.
Does anyone have an experience with Bluetooth raw write / read using the Fantom Driver and can get it to work reliably?


--- snippet of output log for Bluetooth connection (only first iteration shown) ---
$ arch -i386 /usr/bin/python2.6 pyfantom.py
Retrieving list of NXT objects
nxtlist: <__main__.NXT instance at 0x3ecf2d8>
resource string: BTH::NXT::00:16:53:07:E5:1D::1
firmware version: (1, 124, 1, 29)
get device info: DeviceInfo(name='NXT', bluetooth_address='00:16:53:07:e5:1d', signal_strength=(0, 0, 0, 0), available_flash=87340L)
send direct command (tone)...
direct command returned 0 data bytes
send raw command (tone)...
send direct command (battery level)...
send_direct_command() response: (11, 0, 61, 30)
direct command returned 4 data bytes
Battery Level (11, 0, 61, 30)
send raw command (battery level)...
wrote 2
pyfantom: read() returned 0 of 64 bytes.
Battery Level ()
send raw command (version system command)...
wrote 2
pyfantom: read() returned 0 of 64 bytes.
read ()
pyfantom: close()
pyfantom: Destroying NXT.
pyfantom: NXT destroyed.