summaryrefslogtreecommitdiff
path: root/pybluez/simple/l2capclient.py
diff options
context:
space:
mode:
authorTim Redfern <tim@eclectronics.org>2011-12-19 18:20:33 +0000
committerTim Redfern <tim@eclectronics.org>2011-12-19 18:20:33 +0000
commite9a73bbb3c14af340999f70146747787785f4fee (patch)
treea125452f7d641673286542497da051b810427880 /pybluez/simple/l2capclient.py
initial commit
Diffstat (limited to 'pybluez/simple/l2capclient.py')
-rw-r--r--pybluez/simple/l2capclient.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/pybluez/simple/l2capclient.py b/pybluez/simple/l2capclient.py
new file mode 100644
index 0000000..930e431
--- /dev/null
+++ b/pybluez/simple/l2capclient.py
@@ -0,0 +1,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()
+