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

> > Yes, but I don't think there is a D-Bus API to read this number.
> 
> BlueZ issue requesting the feature: [bluez/bluez#199](https://github.com/bluez/bluez/issues/199)


An update on this... a D-Bus API for this was added recently. 

https://github.com/bluez/bluez/blob/6ea642f6ef2e2d5486aec092a2596f24e60bca3e/doc/gatt-api.txt#L297-L301

Unlike other platforms where the API provides a per-device value, BlueZ provides this on a per-characteristic basis. The rational being that Bluetooth 5.2 Enhanced Attribute Protocol (EATT) could result in characteristics having different individual MTU values.

So I propose that the Web Bluetooth API should also be a property/method on the characteristic object. The implementation on Linux/ChromOS can use the new BlueZ API while the Windows and Mac implementations can just return the device-level value for now and could be modified in the future if Microsoft or Apple adds new APIs for EATT.

Also, I think it makes sense to perhaps have an API like Apple's `maximumWriteValueLength()` rather than returning the MTU. If the problem we are solving with this is "what is the maximum number bytes can I pass to `writeWithoutResponse()` without getting an error", then it makes sense to return that number directly rather than expecting consumers of the API to know that you have to subtract 3 from the MTU to arrive at the correct answer.

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


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

Received on Saturday, 20 November 2021 16:14:54 UTC