小编Nih*_*s13的帖子

连接到特定的HID配置文件蓝牙设备

我将蓝牙条码扫描器连接到我的Android平板电脑.条码扫描器与Android设备绑定作为输入设备 - HID配置文件.它在系统蓝牙管理器中显示为键盘或鼠标.我发现蓝牙配置文件输入设备类存在但是隐藏了.class和btprofile常量在android文档中有@hide annotaions.

隐藏类:

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

这里它们也应该是其他3个常数

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

就像

public static final int INPUT_DEVICE = 4;
public static final int PAN = 5;
public static final int PBAP = 6;
Run Code Online (Sandbox Code Playgroud)

通过反射可以很容易地访问这些常量.我需要实现的是隐藏配置文件(INPUT_DEVICE)的设备列表.使用方法进行小改动应该很简单:

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

不适用于A2dp配置文件,但也适用于通过反射方法访问的hid配置文件.可悲的是

Class c = Class.forName("android.bluetooth.BluetoothInputDevice")
Run Code Online (Sandbox Code Playgroud)

将无法工作..任何想法我应该如何处理问题?我只需要隐藏设备列表

profile android input-devices bluetooth hid

3
推荐指数
1
解决办法
6100
查看次数

标签 统计

android ×1

bluetooth ×1

hid ×1

input-devices ×1

profile ×1