Skip to content

Configure MTU via peripheral builder#867

Open
twyatt wants to merge 7 commits into
mainfrom
twyatt/mtu
Open

Configure MTU via peripheral builder#867
twyatt wants to merge 7 commits into
mainfrom
twyatt/mtu

Conversation

@twyatt

@twyatt twyatt commented Feb 21, 2025

Copy link
Copy Markdown
Member

Closes #811


Note

Medium Risk
Breaking API removal and new default MTU on every connect change connection timing and permission requirements; write chunk sizing behavior changes on newer Android versions due to the attribute-length cap.

Overview
Android MTU is now configured on the peripheral builder instead of calling requestMtu during onServicesDiscovered or on AndroidPeripheral. New PeripheralBuilder.mtu defaults to 517 (null skips any MTU request); the library requests MTU after GATT connect and before service discovery.

Breaking: public AndroidPeripheral.requestMtu and ServicesDiscoveredPeripheral.requestMtu are removed. connect() docs note BLUETOOTH_CONNECT when MTU is non-null. maximumWriteValueLengthForType is capped by Android max attribute length (512 on API 33+, 600 on older APIs).

Reviewed by Cursor Bugbot for commit bce7bae. Configure here.

@twyatt twyatt added the major Changes that should bump the MAJOR version number label Feb 21, 2025
@twyatt twyatt added this to the 0.37.0 milestone Feb 21, 2025
@twyatt

This comment was marked as resolved.

@twyatt twyatt modified the milestones: 0.37.0, 0.38.0 Mar 19, 2025
@twyatt twyatt modified the milestones: 0.38.0, 0.39.0 Jun 25, 2025
@twyatt twyatt modified the milestones: 0.39.0, 0.40.0 Jul 21, 2025
@twyatt twyatt modified the milestones: 0.40.0, 0.41.0 Aug 28, 2025
@twyatt twyatt modified the milestones: 0.44.0, 0.45.0 Jul 8, 2026
Comment thread kable-core/src/androidMain/kotlin/Connection.kt Outdated
@twyatt

twyatt commented Jul 21, 2026

Copy link
Copy Markdown
Member Author

@cursor review

@twyatt
twyatt marked this pull request as ready for review July 21, 2026 19:43
@twyatt
twyatt requested a review from a team as a code owner July 21, 2026 19:43
@twyatt
twyatt requested review from Phoenix7351 and sdonn3 July 21, 2026 19:43

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit bce7bae. Configure here.

)

suspendUntil<State.Connecting.Services>()
if (desiredMtu != null) requestMtu(desiredMtu)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If requestMtu() fails at this point (throwing GattRequestRejectedException), is it cancelling the connection? Shouldn't it be able to continue the connection with the default MTU?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

major Changes that should bump the MAJOR version number

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Drop Android.requestMtu

2 participants