Android : Connection to specific HID profile bluetooth device

on Monday, October 13, 2014


I connect bluetooth barcode scanner to my android tablet. barcode scanner is bonded with android device as a input device - HID profile. it shows as keyboard or mouse in system bluetooth manager. i discovered that bluetooth profile input device class exist but is hidden. class and btprofile constants have @hide annotaions in android docs.


hidden class:



grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.3.1_r1/android/bluetooth/BluetoothInputDevice.java



here they should be also 3 other constants



developer.android.com/reference/android/bluetooth/BluetoothProfile.html#HEADSET



just like



public static final int INPUT_DEVICE = 4;
public static final int PAN = 5;
public static final int PBAP = 6;


that constants are simple accessible by reflection. What i need to achieve, is list of devices by hid profile(INPUT_DEVICE). it should be simple with small changes using method:



developer.android.com/reference/android/bluetooth/BluetoothA2dp.html#getConnectedDevices()



not for A2dp profile, but for hid profile accessed also by reflection methods. sadly



Class c = Class.forName("android.bluetooth.BluetoothInputDevice")


won't work.. any ideas how i should approach to the problem ? i need only list of hid devices


0 comments:

Post a Comment