获取有关黑莓蓝牙的远程设备的信息

时间:2012-04-16 10:36:46

标签: java blackberry bluetooth

我正在开发一个黑莓移动应用程序,我正在使用javax.bluetooth api在我的应用程序中使用蓝牙。我想知道是否有可能获得有关远程设备的信息。我能够获取远程蓝牙设备的名称和地址,但我也想知道设备的类型。我想知道远程设备是手机还是PC。是否可以在Blackberry OS 5中确定这一点? 我使用以下代码来获取远程设备的名称和地址。

System.out.println((i + 1) + ". "
                                + remoteDevice.getBluetoothAddress() + " ("
                                + remoteDevice.getFriendlyName(true) + ")");

提前致谢

2 个答案:

答案 0 :(得分:1)

我想出了如何获得设备的类型。可以使用Device Class找到设备类型。在deviceDiscovered()的{​​{1}}方法中,我们得到Discovery Agent以及Remote Device。我们可以使用Device Class的Device class方法来获取Device的类型 主要设备类的类型在此link中给出。

答案 1 :(得分:0)

您似乎应该使用DiscoveryAgent.searchServices()方法来检索此信息:

public int searchServices(int [] attrSet,                           UUID [] uuidSet,                           RemoteDevice btDev,                           DiscoveryListener监听器)                    抛出BluetoothStateException

查看javadoc以获取更多信息:http://www.blackberry.com/developers/docs/5.0.0api/javax/bluetooth/DiscoveryAgent.html

相关问题