【发布时间】:2018-07-15 18:11:34
【问题描述】:
我正在开发 BLE 设备。 - 我可以使用BluetoothGATT 将此设备与应用程序连接起来 - 一旦连接到BluetoothGatt,我就能够第一时间读取所有服务、特征和广告商数据。 - 我们有两个特征,一个是我们需要读,另一个是写,我可以写特征。
但问题是我在写入后无法读取特征。 据我了解
@Override
public void onCharacteristicChanged(BluetoothGatt gatt,
BluetoothGattCharacteristic characteristic)
或
@Override
public void onCharacteristicRead(BluetoothGatt gatt,
BluetoothGattCharacteristic characteristic,
int status)
应该自动调用,这些都是回调方法
我的特色写代码是
boolean status = mBluetoothGatt.setCharacteristicNotification(characteristic, state);
我也通过下面的代码启用通知
mBluetoothGatt.setCharacteristicNotification(characteristic, enabled);
我写完后卡在阅读特性部分
任何帮助,谢谢亲爱的,我在这一点上被困了 3 天。
【问题讨论】:
标签: android bluetooth bluetooth-lowenergy bluetooth-gatt