#!/usr/bin/python # Requirements: # sudo aptitude install python-bluetooth # Information Sources: # http://code.google.com/p/pybluez/source/browse/trunk/examples/simple/rfc... # http://people.csail.mit.edu/albert/bluez-intro/x290.html#py-rfcomm-clien... import bluetooth import sys import threading uuid = "fa87c0d0-afac-11de-8a39-0800200c9a66" addr = None if len(sys.argv) < 2: print "No device specified. Searching all nearby bluetooth devices for" print "the BluetoothChat service" else: addr = sys.argv[1] print "Searching for BluetoothChat on %s" % addr # search for the BluetoothChat service service_matches = bluetooth.find_service( uuid = uuid, address = addr ) if len(service_matches) == 0: print "couldn't find the BluetoothChat service =(" sys.exit(0) first_match = service_matches[0] port = first_match["port"] name = first_match["name"] host = first_match["host"] print "connecting to \"%s\" on %s" % (name, host) # Create the client socket sock=bluetooth.BluetoothSocket( bluetooth.RFCOMM ) sock.connect((host, port)) class receiverThread(threading.Thread): def __init__ (self,sock): threading.Thread.__init__(self) self.sock = sock def run(self): while True: data = self.sock.recv(1024) if len(data) == 0: break print "received [%s]" % data receiver = receiverThread(sock) receiver.setDaemon(True) receiver.start() print "connected - type stuff:" while True: data = raw_input() if len(data) == 0: break sock.send(data) print "sent [%s]" % data sock.close()
rd@radekdostal.com
+43 681 815 945 10
skype: radekdostal
www.mimo-domov.cz - Czech and Slovak people abroad
Hey! Quick question that's entirely off topic. Do
you kno how to make your site mobile friendly? My weblog looks weird whe browwing from my iphone4.
I'm trying to find a theme or plugin that might be able
tto correct this issue. If you have any suggestions, please share.
Thanks! https://Accountportal.org/
It's awesome for me to have a site, which is useful in support of my knowledge.
thanks admin https://podiivua.com/
I will right awaay take hold of your rss as I can't find your e-mail subscription link or newsletter service.
Do you've any? Please allow me know so that
I may subscribe. Thanks. https://podiivua.com/
Having read this I thought it wwas extremely informative.
I appreciate youu finding the time and effort
to put this informative article together. I onjce
again find myself spending a significant amount of time both
reading and leaving comments. But so what, it was still worthwhile! https://Accountportal.org/