0
当我的代码不起作用时,我开始使用该项目,发现here,并将其与我的moto-x上的自定义蓝牙设备一起运行。针对与配置文件的一般属性,我找回数据从下面的代码:readCharacteristic没有返回自定义属性的数据
public void readCharacteristic(BluetoothGattCharacteristic characteristic) {
if (mBluetoothAdapter == null || mBluetoothGatt == null) {
Log.w(TAG, "BluetoothAdapter not initialized");
return;
}
mBluetoothGatt.readCharacteristic(characteristic);
}
这在异步返回数据:
public void onCharacteristicRead(BluetoothGatt gatt,
BluetoothGattCharacteristic characteristic,
int status) {
if (status == BluetoothGatt.GATT_SUCCESS) {
broadcastUpdate(ACTION_DATA_AVAILABLE, characteristic);
}
}
,如果我跑对心脏监测仪验证码这也适用。
如果我在没有默认配置文件的情况下对其中一个自定义属性运行它,数据永远不会回来。永远。
谷歌搜索包括:Cannot read characteristic. Android BLE但设置通知没有解决我的问题。
有什么建议吗?
感谢您的意见。我检查并设置了PROPERTY_READ位。 – Thom
你有解决它吗?我也想知道有什么问题 – user2450263
没有。开始认为这与设备有关。 – Thom