Skip to content

Commit 90d729e

Browse files
authored
Fix maximal supported MTU on Android 13 (dariuszseweryn#808)
Maximal supported MTU set to 515 since it's the maximal supported MTU since Android 13
1 parent 468946f commit 90d729e

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

rxandroidble/src/main/java/com/polidea/rxandroidble2/RxBleConnection.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,17 @@ public interface RxBleConnection {
5656
int GATT_MTU_MINIMUM = 23;
5757

5858
/**
59-
* The maximum supported value for MTU (Maximum Transfer Unit) used by a bluetooth connection on Android OS.
60-
* https://android.googlesource.com/platform/external/bluetooth/bluedroid/+/android-5.1.0_r1/stack/include/gatt_api.h#119
59+
* The maximum properly supported value for MTU (Maximum Transfer Unit) used by a bluetooth connection on Android OS.
60+
* <p>The theoretical maximum value for MTU Negotiation on Android OS is 517
61+
* (https://cs.android.com/android/platform/superproject/+/master:packages/modules/Bluetooth/system/stack/include/gatt_api.h;l=244;drc=1918034a0730839c7a07b1260b1ab74b80d6b4e6)
62+
* the real maximal supported MTU is 515 since the buffer size is capped on 512 bytes = 515 - GATT_READ_MTU_OVERHEAD
63+
* (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)
64+
* <p>
65+
* <p>NOTE: before Android 13 (API 33) the maximal properly supported MTU was 517
66+
* see https://android.googlesource.com/platform/external/bluetooth/bluedroid/+/android-5.1.0_r1/stack/include/gatt_api.h#119
6167
*/
62-
int GATT_MTU_MAXIMUM = 517;
68+
int GATT_MTU_MAXIMUM = 515;
69+
6370

6471
/**
6572
* Description of correct values of connection priority

0 commit comments

Comments
 (0)