Re: [web-bluetooth] API which provides the negotiated MTU is required (#383)

> There are a bunch of applications where the specifications assume the MTU is known.
> For my case I'd like to implement Flic 2: https://github.com/50ButtonsEach/flic2-documentation/wiki/Flic-2-Protocol-Specification, where the fragmentation/segmentation can be much more efficient if the MTU is known (especially if LE Data Length extension is supported). Otherwise one have to be on the safe side and assume 23.
> 
> On Mac, Windows and BlueZ, the MTU is hardcoded and always negotiated by the system when a connection starts before GATT is activated for the user. On Android it's customizable but there's as far as I know no reason not to try setting it to 517 (maximum supported).
> 
> However, now when you mention it, the remote device may select a lower MTU than requested, and I'm not sure if that value can be retrieved from all platforms. :/
> Mac: https://developer.apple.com/documentation/corebluetooth/cbperipheral/1620312-maximumwritevaluelength
> Android: onMtuChanged
> BlueZ: ?
> Windows: Maybe https://docs.microsoft.com/en-us/uwp/api/windows.devices.bluetooth.genericattributeprofile.gattsession.maxpdusize#Windows_Devices_Bluetooth_GenericAttributeProfile_GattSession_MaxPduSize can be used?

@Emill You're right

We've implement `QuickBlue` plugin of Flutter on Android/iOS/macOS/Windows

API declaration:
https://github.com/woodemi/quick_blue/blob/f24cf23b5fe1ed12dabb41f947b948a08569e67d/quick_blue_platform_interface/lib/quick_blue_platform_interface.dart#L55

- Android: https://github.com/woodemi/quick_blue/blob/f24cf23b5fe1ed12dabb41f947b948a08569e67d/quick_blue/android/src/main/kotlin/com/example/quick_blue/QuickBluePlugin.kt#L107
- iOS: https://github.com/woodemi/quick_blue/blob/f24cf23b5fe1ed12dabb41f947b948a08569e67d/quick_blue/ios/Classes/SwiftQuickBluePlugin.swift#L114
- macOS: https://github.com/woodemi/quick_blue/blob/f24cf23b5fe1ed12dabb41f947b948a08569e67d/quick_blue_macos/macos/Classes/QuickBlueMacosPlugin.swift#L114
- Windows: https://github.com/woodemi/quick_blue/blob/f24cf23b5fe1ed12dabb41f947b948a08569e67d/quick_blue_windows/windows/quick_blue_windows_plugin.cpp#L249

-- 
GitHub Notification of comment by Sunbreak
Please view or discuss this issue at https://github.com/WebBluetoothCG/web-bluetooth/issues/383#issuecomment-731955963 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Monday, 23 November 2020 06:30:44 UTC