首页 > 解决方案 > 无代码 Android BLE 特性始终返回相同的值

问题描述

我执行一个简单的写命令

    atWriteCharacteristic.setWriteType(BluetoothGattCharacteristic.WRITE_TYPE_DEFAULT);
    atWriteCharacteristic.setValue("ATI"); // no matter what value I put here always same response
    boolean didWrite = bluetoothGatt.writeCharacteristic(atWriteCharacteristic);

但是当我尝试通过以下方式阅读时:

    bluetoothGatt.readCharacteristic(atReadCharacteristic);

我总是得到相同的“OK”响应,这是不正确的,应该给我一个应用程序版本。我在 onCharacteristicRead 回调函数中得到响应。
这是无代码应用程序的链接:http: //lpccs-docs.dialog-semiconductor.com/UM-140-DA145x-CodeLess/howToUse.html#software-setup

标签: javaandroidbluetoothbluetooth-lowenergy

解决方案


我已经解决了这个问题。问题要简单得多。是我没有在每个“AT”命令之后发送空格。所以命令需要特别采用这种格式:“AT”,每个命令后面都有空格。


推荐阅读