Reconnect of HID

25 views
Skip to first unread message

Jonas Jinbäck

unread,
Nov 11, 2015, 12:22:01 PM11/11/15
to bluecove-users
Hello.

I'm writing a program that should recieve inputs from a bluetooth keyboard.
The keyboard should not send it's keypresses to the OS, but instead they should be sent to the java program.

I'm able to connect to the device with the following code.

String hidURL = "btl2cap://8000000046C5:0011;authenticate=false;encrypt=false;master=false";
String hidInterupt = "btl2cap://8000000046C5:0013;authenticate=false;encrypt=false;master=false";
L2CAPConnection conn = (L2CAPConnection) Connector.open(hidURL);
L2CAPConnection connInterupt = (L2CAPConnection) Connector.open(hidInterupt);

And then I'm able to recieve keypresses on the connInterupt object.


When I disconnect the keyboard, by turning it off and on again I'm able to detect the reconnect from the HID device with the following code:

String hidListen = "btl2cap://localhost:0001";
L2CAPConnectionNotifier notifier
= (L2CAPConnectionNotifier) Connector.open(hidListen);
L2CAPConnection connection
= notifier.acceptAndOpen();

But I'm stuck here and dont know how to make the reconnect happen between the computer and the HID.

I'm using debian 8.0 with BlueZ 5.23.

Reply all
Reply to author
Forward
0 new messages