Reputation: 23
I cant connect to my bluetooth server, set up on rpi. I would need a connectionUrl, presumably fetched from a ServiceRecord. But I cant seem to get it to work.
Ive set it up using bluecove, and have a server running, discoverable. However, I cant find any services on the device. The server:
UUID uuid = new UUID("446118f08b1e11e29e960800200c9a66", false);
String connectionString = "btspp://localhost:" + uuid + ";name=Mine";
StreamConnectionNotifier streamConnNotifier = (StreamConnectionNotifier) Connector.open(connectionString);
The client:
UUID[] uuidSet = new UUID[1];
uuidSet[0] = new UUID("446118f08b1e11e29e960800200c9a66", false);
agent.searchServices(null, uuidSet, remoteDevice, client);
public void servicesDiscovered(int transID, ServiceRecord[] servRecord) {
System.out.println("service discovered");
But no service discovered. If I, in the server, do the following:
ServiceRecord sr = local.getRecord(streamConnNotifier);
System.out.println(sr);
..among other things, I see:
0x1:
DATSEQ {
UUID 446118f08b1e11e29e960800200c9a66
UUID 0000110100001000800000805f9b34fb
}
I would guess that I could connect to the service via url
btspp://b827ebe97e0e:446118f08b1e11e29e960800200c9a66, but I cant, I get IllegalArgumentException: channel 446118f08b1e11e29e960800200c9a66
Upvotes: 2
Views: 236
Reputation: 23
Anyone? Im using java, and the server is set up on Raspberry pi, and the client is my macbook laptop.
Am I correct to use the UUID as "port" (if we were talking http)?
Upvotes: 0