android - BLE onCharacteristicRead 接收状态 133
问题描述
我正在开发一个 BLE 中央应用程序(服务器)并在我的三星 Galaxy S8 上对其进行测试。在我的手机决定更新(从 7.1.0 到 8.0.0)之前,该应用程序正在运行。
我正在从已知特征/服务中进行标准读取。设备在功能中正确连接
public void onConnectionStateChange(final BluetoothGatt gatt, int status, int newState)
并且预期的服务出现在函数中
public void onServicesDiscovered(final BluetoothGatt gatt, int status)
. 在这两个回调中,status
等于 0。所以一切似乎都在工作,直到我打电话
gatt.readCharacteristic(characteristic);
来自onServicesDiscovered
回调,之后有很长的暂停,然后调用
public void onCharacteristicRead(final BluetoothGatt gatt, final BluetoothGattCharacteristic characteristic, int status)
当我用 . 检查特征值时,状态等于 133 和“null” Log.d("DEBUG", "" + characteristic.getStringValue(0));
。characteristic.getValue()
也返回null。
最奇怪的是,这段代码在更新之前都运行成功了。(我现在已经将 BLE 代码复制到一个新项目中以隔离它,并相信我已经从原始项目中复制了适当的权限。)
在此特定回调中会导致错误 133 的原因是什么?我似乎在文档( https://developer.android.com/reference/android/bluetooth/BluetoothGatt )中找不到 133 ,所以即使只是帮助解释错误也是一个很好的步骤。
解决方案
推荐阅读
- mysql - 带有 LIKE 和排序的 Mysql 索引
- powershell - Windows PowerShell 在 Windows 10 上安装 NativeScript
- android - 是否可以将现有的 Android APK 转换为捆绑包
- hazelcast - Hazelcast Jet 内部优化
- javascript - 具有单独输出 v2 到 v3 升级的 Youtube 自动搜索
- php - 函数忘记()返回调用Laravel中未定义的方法
- ios - 如何正确地在 Swift 中为以编程方式创建的 PDF 添加密码?
- python - ABC ----> ABC、CAB、BCA 仅顺序很重要,但不是真正的 itertools 排列
- listview - Flutter中stack和listview的区别
- reactjs - 他为什么先
列表中的元素没有显示其他使用 React Bootstrap 的机器人?