0
我正在尝试从蓝牙LE设备发送给我的数组中读取数据。从UUID读取蓝牙LE数组?
该数据流应为18个字节,并且,作为一个数组观察时,我需要字节5,图6和7
我对service
和characteristic
正确的UUID。但是,我不知道如何从characteristic
获得数组。
现在我只是试图获取我认识的数据。但是,下面的日志语句会生成我无法理解或与数据匹配的随机字符。
这个函数中唯一真正重要的行是与characteristic.getValue()
的日志,但我想我会包括整个事情的一些上下文。
@Override
public void onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) {
Log.d(TAG, "characteristic read: "+characteristic.getValue());
gatt.setCharacteristicNotification(characteristic, true);
gatt.readRemoteRssi();
runOnUiThread(update_UI);
try {
Thread.sleep(500);
} catch(InterruptedException ex) {
Thread.currentThread().interrupt();
}
gatt.discoverServices();
}