java - 无代码 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
解决方案
我已经解决了这个问题。问题要简单得多。是我没有在每个“AT”命令之后发送空格。所以命令需要特别采用这种格式:“AT”,每个命令后面都有空格。
推荐阅读
- php - 为什么 PHP include 语句将 '?/../' 后面的内容视为当前目录的路径?
- javascript - 如何使用 jquery 在某些内联 CSS 上做某事?
- django - Django使用来自A->C的related_name进行注释,其中A->B和B->C,其中'->'是反向关系
- android - React Native Axios上传图片在Android上返回网络错误
- javascript - NodeJS 和增加堆大小
- c# - 使用 Xamarin.Forms 的 MenuBar (UWP) 或 Menu (WPF) 的本机视图?
- javascript - 无论浏览器缓存如何,如何在不更改 URL 的情况下强制交付更新的 JS/CSS 文件
- sql - 如何在 SQL Server 查询中将相似 id 的不同行结果转换为具有唯一 id 的不同列
- xaml - Xamarin.Forms:xaml。为按钮添加“点击”动画
- python - 在 keras 中可视化训练好的神经网络的权重