Skip to content

Tell Windows to actively maintain the BLE connection.#82

Open
ranbochen wants to merge 1 commit into
stoprocent:mainfrom
ranbochen:main
Open

Tell Windows to actively maintain the BLE connection.#82
ranbochen wants to merge 1 commit into
stoprocent:mainfrom
ranbochen:main

Conversation

@ranbochen
Copy link
Copy Markdown

set GattSession.MaintainConnection to true for reliable MTU negotiation

On Windows, BluetoothLEDevice::FromBluetoothAddressAsync returns before the physical BLE connection is established.
Without MaintainConnection,the first GATT operation (GetGattServicesAsync) triggers the connection,
but by then the MTU is still at the default 23.
If the peripheral negotiates a larger MTU during service discovery,
the race condition can exhaust the peripheral's ATT buffer pool.

Setting MaintainConnection(true) ensures Windows proactively maintains the GATT session,
allowing the peripheral's MTU exchange request to be processed before service discovery begins.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant