I have a Bluetooth client on Android that must connect to my computer by RFCOMM and using the UUID 00001101-0000-1000-8000-00805F9B34FB
The PyBluez library is used, as well as Python 2.6. I used the following code from the PyBluez Documentation
from bluetooth import *
server_sock=BluetoothSocket( RFCOMM )
server_sock.bind(("",PORT_ANY))
server_sock.listen(1)
port = server_sock.getsockname()[1]
uuid = "00001101-0000-1000-8000-00805F9B34FB"
advertise_service( server_sock, "SampleServer",
service_id = uuid,
service_classes = [ uuid, SERIAL_PORT_CLASS ],
profiles = [ SERIAL_PORT_PROFILE ],
)
print "Waiting for connection on RFCOMM channel %d" % port
client_sock, client_info = server_sock.accept()
print "Accepted connection from ", client_info
try:
while True:
data = client_sock.recv(1024)
if len(data) == 0: break
print "received [%s]" % data
except IOError:
pass
print "disconnected"
client_sock.close()
server_sock.close()
print "all done"
It works perfectly fine under Windows 7.
But I have no reaction with another computer on Windows XP, i.e. my code stays at the line "Waiting for connection on RFCOMM channel". My Bluetooth client warns me it is connected, though.
This Windows XP computer Bluetooth configuration allows me to set-up a COM port for serial communications with Bluetooth. If I listen on this configured COM port, I can see my data from the Bluetooth client.
I prefer to have a code working on any Windows computer, and I do not want to configure virtual COM port on these computers. So I would like the above program also working with the Windows XP computer.
What do I miss? It is as if the Windows XP computer do not forward Bluetooth data to my program, even if I disable its capability of reproducing data on a virtual serial port. It seems the UUID I use is a well known one, but I must use this one to have my program compatible with another specific platform.
The Bluetooth stack on the Windows 7 computer is from Atheros Communications, the one on the Windows XP computer is from Widcomm.