【发布时间】:2012-09-18 20:15:50
【问题描述】:
我正在尝试使用我的摩托罗拉 RAZR 连接到基于 TI 的 CC2540 的 BLE 设备(我有 TI 的密钥卡,以及 connectblue OLP425 的另一个设备),到目前为止我唯一的成功是一个名为 Propagation on我无法获得资源的市场。
我尝试使用此代码连接到设备,但我最不明白的是 UUID,
我在 iPad 3 上下载了一个应用程序,发现设备具有以下 UUID 00000000-0000-0000-ff31-1a064f8c5966
private static final UUID SPP_UUID = UUID.fromString("00000000-0000-0000-ff31-1a064f8c5966");
BluetoothDevice bd =BluetoothAdapter.getDefaultAdapter().getBondedDevices().iterator().next();
//I only have I device paired that is the Bluetooth Low Energy Device so using the first Device returned by the iterator is fine.
try {
BluetoothSocket bs = bd.createRfcommSocketToServiceRecord(UUID);
bs.connect();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
我得到的只是 logcat 中的服务发现失败
在几乎所有每个人都在使用的示例中
00000000-0000-1000-8000-00805f9b34fb
如果我在应用程序中走得更远,它会提示电池服务是 UUID 0x180f
我只想创建一个应用程序来读取此服务的值,这是一个简单的十进制值
过去有人成功配对过 BLE 设备吗?
谢谢
乔纳森
【问题讨论】:
-
您显示的代码用于连接传统蓝牙设备。这对 LE 不起作用。
-
谢谢,我找到了摩托罗拉api的connectLe和connectGatt函数,我还没有成功,但我会继续努力。
标签: android bluetooth core-bluetooth bluetooth-lowenergy