Android BLE - 如何分块读取大特征值(使用偏移量)?
Android BLE - How is large characteristic value read in chunks (using an offset)?
我正在使用 Android SDK 的 android.bluetooth 和 android.bluetooth.le APIs.
我想实现一个应用程序(扮演核心角色,并连接到 BLE 外设以读取特征值和描述符)。
应用需要读取的特征值较大,需要分块读取。我对这是如何实现的理解是应用程序应该在读取请求中包含一个偏移量,它向外设指示响应中总数据的子部分 return。
但是,API只提供了一个BluetoothGatt.readCharacteristic(BluetoothGattCharacteristic)方法。我找不到包含偏移量参数的读取特征 API 调用,用于发出我在上一段中描述的部分读取特征请求的类型。
有谁知道我是如何实现这些分块特征读取的?
注意:我知道有一个类似的堆栈溢出问题 here。它没有为我正在处理的 Android 方面提供答案。
只需调用 readCharacteristic,它将在后台读取所有块。当读取完所有块时,将调用 onCharacteristicRead。
我正在使用 Android SDK 的 android.bluetooth 和 android.bluetooth.le APIs.
我想实现一个应用程序(扮演核心角色,并连接到 BLE 外设以读取特征值和描述符)。
应用需要读取的特征值较大,需要分块读取。我对这是如何实现的理解是应用程序应该在读取请求中包含一个偏移量,它向外设指示响应中总数据的子部分 return。
但是,API只提供了一个BluetoothGatt.readCharacteristic(BluetoothGattCharacteristic)方法。我找不到包含偏移量参数的读取特征 API 调用,用于发出我在上一段中描述的部分读取特征请求的类型。
有谁知道我是如何实现这些分块特征读取的?
注意:我知道有一个类似的堆栈溢出问题 here。它没有为我正在处理的 Android 方面提供答案。
只需调用 readCharacteristic,它将在后台读取所有块。当读取完所有块时,将调用 onCharacteristicRead。