mtu

val mtu: StateFlow<Int?>

The ATT MTU (Attribute Protocol Maximum Transfer Unit) negotiated for the connection.

The value of this state is null if the peripheral is not connected. When the state changes to ConnectionState.Connected the flow emits 23 (default MTU) or the value of the negotiated MTU. ATT MTU can be negotiated once per connection.

More information about MTU can be found here.

Use maximumWriteValueLength to calculate the maximum size of a single write. This method takes into account bytes used for the ATT header for given write type.

MTU on iOS

Due to API limitations, on iOS this may emit 515 even if the negotiated ATT MTU was larger.

See also