My data looks like this when it comes from the device (biofeedback device). 
There are 9 bytes in total, and I need to buffer so much, and then poll it for 
new/recent packets. The start packet unfortunately starts with 0x00

So far the only thing I've found that looks like what I want to do is this, but 
I don't know how to implement it. http://code.activestate.com/recipes/408859/


Data:  [0000002d0270025e00]
Data:  [0001004a0006026547]
Data:  [0002004b000a026343]
Data:  [00]
Data:  [03004f0006025b4a00]
Data:  [046698000802569d00]
Data:  [00003002830257f100]
Data:  [01004a000602585400]
Data:  [020048000a025b4e00]
Data:  [03004b0006025b4e00]
Data:  [046698000702579d00]
Data:  [00002f027602480e00]
Data:  [01004a0006024b61]
Data:  [0002004a000a025552]
Data:  [0003004b0006025752]
Data:  [00046698000702569e]
Data:  [0000002c025b025321]
Data:  [00010048000602505e]

My code so far looks like this...

import bluetooth, sys, time, os, binascii, struct;

# Create the client socket
client_socket=BluetoothSocket( RFCOMM )

client_socket.connect(("10:00:E8:AC:4D:D0", 1))

data = ""
try:
        while True:
                try:
                        data = client_socket.recv(9)
                except bluetooth.BluetoothError, b:
                        print "Bluetooth Error: ", b

                if len(data) > 0:
                        print "Data:  [%s]" % binascii.hexlify(data)

except KeyboardInterrupt:
        #print "Closing socket...",
        client_socket.close()
        #print "done."
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to