Java (J2SE) 低功耗蓝牙 (BLE)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28855288/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Java (J2SE) Bluetooth Low Energy (BLE)
提问by sgiessmann
I'm trying to connect to a Bluetooth Low-Energy (BLE) Sensor using Java. So far I searched for a library that interfaces with the BlueZ stack on my Linux.
我正在尝试使用 Java 连接到蓝牙低功耗 (BLE) 传感器。到目前为止,我在我的 Linux 上搜索了一个与 BlueZ 堆栈接口的库。
The only free library I found for Java was Bluecove but it seems, that they don't implement BLE. I checked if my BT dongle was working and recognizing the sensor using Linux command line tools
我为 Java 找到的唯一免费库是 Bluecove,但似乎它们没有实现 BLE。我使用 Linux 命令行工具检查了我的 BT 加密狗是否正常工作并识别传感器
sudo hcitool lescan
gatttool -i hci0 -b XX:XX:XX:XX:XX:XX -I
and it worked without problems.
它没有问题。
After that I tried the Bluecove example for DeviceDiscovery but my sensor didn't show up instead it scanned for normal BT devices. I couldn't find a way to scan for BLE devices.
之后,我尝试了 DeviceDiscovery 的 Bluecove 示例,但我的传感器没有出现,而是扫描了普通的 BT 设备。我找不到扫描 BLE 设备的方法。
Doing further research I came to the conclusion that Bluecove just implements JSR-82. If I'm not mistaken this standard is older than BLE and therefore doesn't implement it.
经过进一步的研究,我得出的结论是 Bluecove 只是实现了 JSR-82。如果我没记错的话,这个标准早于 BLE,因此没有实现它。
Are there any alternatives to Bluecove that support BLE in Java? I mean there should be because Android has no problems (in newer versions) to communicate with BLE devices.
在 Java 中是否有支持 BLE 的 Bluecove 替代品?我的意思是应该有,因为 Android 与 BLE 设备通信没有问题(在较新版本中)。
Thanks in advance!
提前致谢!
采纳答案by sgiessmann
After looking into this a while later I found an answer named TinyB.
在研究了一段时间后,我找到了一个名为 TinyB 的答案。
https://software.intel.com/en-us/java-for-bluetooth-le-apps
https://software.intel.com/en-us/java-for-bluetooth-le-apps
TinyB is a BluetoothLE implementation by Intel and it features a Java SDK. So far I've been able to achieve everything I tried.
TinyB 是 Intel 的 BluetoothLE 实现,它具有 Java SDK。到目前为止,我已经能够实现我尝试过的一切。
Hope this helps others stumbling across this topic.
希望这可以帮助其他人在这个话题上绊倒。
回答by Diego
An interesting option is using Kura Bluetooth LE APIs, which are built on top of the TinyB library.
一个有趣的选择是使用Kura 蓝牙 LE API,它构建在 TinyB 库之上。