Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix maximal supported MTU on Android 13 #808

Merged
merged 2 commits into from
Oct 3, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,17 @@ public interface RxBleConnection {
int GATT_MTU_MINIMUM = 23;

/**
* The maximum supported value for MTU (Maximum Transfer Unit) used by a bluetooth connection on Android OS.
* https://android.googlesource.com/platform/external/bluetooth/bluedroid/+/android-5.1.0_r1/stack/include/gatt_api.h#119
* The maximum properly supported value for MTU (Maximum Transfer Unit) used by a bluetooth connection on Android OS.
* <p>The theoretical maximum value for MTU Negotiation on Android OS is 517
* (https://cs.android.com/android/platform/superproject/+/master:packages/modules/Bluetooth/system/stack/include/gatt_api.h;l=244;drc=1918034a0730839c7a07b1260b1ab74b80d6b4e6)
* the real maximal supported MTU is 515 since the buffer size is capped on 512 bytes = 515 - GATT_READ_MTU_OVERHEAD
* (https://cs.android.com/android/platform/superproject/+/master:packages/modules/Bluetooth/system/stack/include/gatt_api.h;l=250;drc=1918034a0730839c7a07b1260b1ab74b80d6b4e6;bpv=1;bpt=1)
* <p>
* <p>NOTE: before Android 13 (API 33) the maximal properly supported MTU was 517
* see https://android.googlesource.com/platform/external/bluetooth/bluedroid/+/android-5.1.0_r1/stack/include/gatt_api.h#119
*/
int GATT_MTU_MAXIMUM = 517;
int GATT_MTU_MAXIMUM = 515;


/**
* Description of correct values of connection priority
Expand Down