我正在使用 Android SDKandroid.蓝牙 and android.蓝牙.le APIs.
我想实现一个应用程序(发挥核心作用,并连接到 BLE 外设以读取特征值和描述符)。
应用程序需要读取的特征值较大,因此需要分块连续读取。我对如何实现这一点的理解是,应用程序应该在读取请求中包含一个偏移量,该偏移量向外围设备指示要在响应中返回的总数据的子部分。
然而,该 API 只提供了一个BluetoothGatt.readCharacteristic(BluetoothGattCharacteristic) https://developer.android.com/reference/android/bluetooth/BluetoothGatt.html#readCharacteristic(android.bluetooth.BluetoothGattCharacteristic)方法。我找不到包含偏移参数的读取特征 API 调用,用于发出我在上一段中描述的部分读取特征请求的类型。
有谁知道我如何实现这些分块特征读取?
注意:我知道有一个类似的堆栈溢出问题here https://stackoverflow.com/questions/38241986/ble-read-long-characteristics-value-using-android-ios。它没有为我正在处理的 Android 方面提供答案。
只需调用 readCharacteristic,它就会在后台读取所有块。当所有块都被读取时,onCharacteristicRead 将被调用。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)