[英]Bluecove : check if device is paired?
I am new to using Bluecove API
and it seems that after a lot of research, I still cannot find a way to check if a RemoteDevice
is already paired to the running machine or not. 我是使用
Bluecove API
,似乎经过大量研究,我仍然找不到一种方法来检查RemoteDevice
是否已与运行中的机器配对。
First of all, I successfully manage to start a scan however, I find it strange that Bluecove
does not offer a way to only look for devices that are in discoverable mode hence the need to check if paired or not ... 首先,我成功地开始进行扫描,但是,我感到奇怪的是,
Bluecove
没有提供仅查找处于可发现模式的设备的方法,因此需要检查是否已配对...
To be more precisded I am "translating" a project that I developped in C# using InTheHand.dll
for Bluetooth management. 更确切地说,我正在“翻译”一个使用
InTheHand.dll
在C#中开发的项目进行蓝牙管理。 This assembly is great and helped me achieved what I wanted to do : scan for devices in discoverable mode and in range, initiate pairing process, handle data via Bluetooth streams
. 这个程序集很棒,并帮助我实现了我想做的事情:以可发现的模式和范围扫描设备,启动配对过程,通过
Bluetooth streams
处理数据。 I need to do the same thing with Bluecove . 我需要对Bluecove做同样的事情 。
Why is it so hard to find answers ? 为什么很难找到答案? The documentation says almost nothing about pairing although I managed to pair a device I knew was not paired via
RemoteDevice.authenticate()
. 尽管我设法配对了一个我知道不是通过
RemoteDevice.authenticate()
配对过的设备,但文档几乎没有说明配对。
Anyway to summup : 无论如何总结:
Note : using both RemoteDevice.isAuthenticated()
and RemoteDeviceHelper.implIsAuthenticated(remoteDevice)
always return false
regardless of the paired status. 注意:无论配对状态如何,同时使用
RemoteDevice.isAuthenticated()
和RemoteDeviceHelper.implIsAuthenticated(remoteDevice)
始终返回false
。
Note 2 : Furthermore, having a lookg at RemoteDeviceHelper.java
from http://bluecove.googlecode.com/svn/trunk/bluecove/src/main/java/com/intel/bluetooth/RemoteDeviceHelper.java , there is a private property for boolean paired
. 注意2:此外,从http://bluecove.googlecode.com/svn/trunk/bluecove/src/main/java/com/intel/bluetooth/RemoteDeviceHelper.java看一下
RemoteDeviceHelper.java
,有一个私有属性对于boolean paired
。
It seems no public method will use it ... 似乎没有公共方法会使用它 ...
Even weirder and desperatly frustating, in the debugger mode, looking at a specific RemoteDevice
, I can see the value of this property. 甚至在调试器模式下,通过查看特定的
RemoteDevice
,也很奇怪和令人沮丧,我可以看到此属性的值。 It is indeed false when device is not paired, and true if device is paired ! 设备未配对时确实为false,而设备未配对则为true! So why can't the API tell me so ?
那么,为什么API不能告诉我呢?
What should I do ? 我该怎么办 ? Thanks for the help !
谢谢您的帮助 !
List of paired devices: 配对设备列表:
import javax.bluetooth.*
...
RemoteDevice[] rdList = LocalDevice.getLocalDevice().getDiscoveryAgent().retrieveDevices(DiscoveryAgent.PREKNOWN);
Get name & address of paired device: 获取已配对设备的名称和地址:
rdList[0].getBlueToothAddress();
rdList[0].getFriendlyName(true);
Some comments: 一些评论:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.