This repository was archived by the owner on Aug 1, 2023. It is now read-only.
Fix long GATT read operations#87
Open
beaufortfrancois wants to merge 1 commit intoWebBluetoothCG:masterfrom
Open
Fix long GATT read operations#87beaufortfrancois wants to merge 1 commit intoWebBluetoothCG:masterfrom
beaufortfrancois wants to merge 1 commit intoWebBluetoothCG:masterfrom
Conversation
g-ortuno
reviewed
Apr 26, 2017
| if (offset != 0) { | ||
| mGattServer.sendResponse(device, requestId, BluetoothGatt.GATT_INVALID_OFFSET, offset, | ||
| /* value (optional) */ null); | ||
| mGattServer.sendResponse(device, requestId, BluetoothGatt.GATT_SUCCESS, offset, |
Contributor
There was a problem hiding this comment.
A couple of questions:
- Since we are using value.length chances are we are sending more bytes than necessary, could we fix that? If not then please comment why we use the length.
- I'm somewhat surprised of how we are using the API. I would have guessed that
offsetwould indicate the Android API to only send the data starting fromoffset. The fact that we 1. send offset back and 2. only send part of the value is making me really suspicious. Could you confirm that simply removing this if statement isn't enough to fix the issue? If it's not enough then I think we can just make that the default behavior:
Log.d(TAG, "Value: " + Arrays.toString(value));
mGattServer.sendResponse(device, requestId, BluetoothGatt.GATT_SUCCESS, offset,
// TODO: Comment why we use value.length
Arrays.copyOfRange(value, offset, value.length));
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We should not return an invalid offset when performing read GATT operations if it needs multiple reading due to a small MTU size (Mac)
Background: https://bugs.chromium.org/p/chromium/issues/detail?id=711286
R: @g-ortuno