blob: 930e431a8a6a78c64f76fac0484a287a4c51fad9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# file: l2capclient.py
# desc: Demo L2CAP client for bluetooth module.
# $Id: l2capclient.py 524 2007-08-15 04:04:52Z albert $
import sys
import bluetooth
sock=bluetooth.BluetoothSocket(bluetooth.L2CAP)
if len(sys.argv) < 2:
print "usage: l2capclient.py <addr>"
sys.exit(2)
bt_addr=sys.argv[1]
port = 0x1001
print "trying to connect to %s on PSM 0x%X" % (bt_addr, port)
sock.connect((bt_addr, port))
print "connected. type stuff"
while True:
data = raw_input()
if(len(data) == 0): break
sock.send(data)
sock.close()
|