是否有可能获得Android中的蓝牙打印机列表?

Vol*_*lyy 5 android bluetooth

如何获取Android中的蓝牙打印机列表?
以下代码返回所有蓝牙设备:

BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
java.util.Set<BluetoothDevice> pairedDevices = mBluetoothAdapter.getBondedDevices();
Run Code Online (Sandbox Code Playgroud)

是否可以从这些设备中仅选择打印机?

更新:
我的打印机蓝牙类的设备类是1664.
但我在Android SDK中找不到这样的常量.
所有蓝牙打印机都有设备类1664吗?

Ali*_*eza 10

这个问题现在已经很老了,但我想为需要这些信息的人分享我自己的经验.

您可以获取次要设备class(getDeviceClass())和major(getMajorDeviceClass())getBluetoothClass()并根据可用的类号进行检查.1536是表示成像设备的主要类,而打印机由1664次要设备类指定.

您也可以使用此在线设备类计算器来生成类:

http://bluetooth-pentest.narod.ru/software/bluetooth_class_of_device-service_generator.html