diff options
| author | Tim Redfern <tim@eclectronics.org> | 2011-12-19 18:20:33 +0000 |
|---|---|---|
| committer | Tim Redfern <tim@eclectronics.org> | 2011-12-19 18:20:33 +0000 |
| commit | e9a73bbb3c14af340999f70146747787785f4fee (patch) | |
| tree | a125452f7d641673286542497da051b810427880 /pyDMM/pyRFCLIENT.py | |
initial commit
Diffstat (limited to 'pyDMM/pyRFCLIENT.py')
| -rwxr-xr-x | pyDMM/pyRFCLIENT.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/pyDMM/pyRFCLIENT.py b/pyDMM/pyRFCLIENT.py new file mode 100755 index 0000000..33656c9 --- /dev/null +++ b/pyDMM/pyRFCLIENT.py @@ -0,0 +1,25 @@ +#!/usr/bin/python +import signal,sys +from bluetooth import * + +# Create the client socket +client_socket=BluetoothSocket( RFCOMM ) +bt_addr = "00:18:E4:0C:68:08" #electic +#bt_addr = "00:18:E4:0B:F5:06" #herge-1 +bt_port = 1 +client_socket.connect((bt_addr,bt_port)) + +def signal_handler(signal, frame): + print "closing bluetooth" + client_socket.close() + sys.exit(0) + +signal.signal(signal.SIGINT, signal_handler) +S=struct.Struct('<HIH') +while(1): + data=bytearray() + while len(data) < 9: + data.extend(client_socket.recv(8)) + print S.unpack_from(buffer(data)) + #while 1: + # print client_socket.recv() |
