How can one connect to an RFCOMM device other than another phone in Android?
Posted
by Charles Duffy
on Stack Overflow
See other posts from Stack Overflow
or by Charles Duffy
Published on 2010-03-14T20:09:06Z
Indexed on
2010/03/14
20:15 UTC
Read the original article
Hit count: 375
The Android API provides examples of using listenUsingRfcommWithServiceRecord() to set up a socket and createRfcommSocketToServiceRecord() to connect to that socket.
I'm trying to connect to an embedded device with a BlueSMiRF Gold chip. My working Python code (using the PyBluez library), which I'd like to port to Android, is as follows:
sock = bluetooth.BluetoothSocket(proto=bluetooth.RFCOMM)
sock.connect((device_addr, 1))
return sock.makefile()
...so the service to connect to is simply defined as channel 1, without any SDP lookup.
As the only documented mechanism I see in the Android API does SDP lookup of a UUID, I'm slightly at a loss.
© Stack Overflow or respective owner