onMtuChanged

open override fun onMtuChanged(gatt: BluetoothGatt, mtu: Int, status: Int)

Called when the MTU (Maximum Transmission Unit) for a connection has changed.

This callback is invoked after BluetoothGatt.requestMtu completes. A larger MTU allows for more data to be sent in a single BLE packet, improving throughput for large data transfers.

Parameters

gatt

The BluetoothGatt instance for the connection.

mtu

The new MTU size in bytes. The effective payload size is MTU - 3 bytes due to ATT protocol overhead.

status

BluetoothGatt.GATT_SUCCESS if the MTU was changed successfully, or an error code if the request failed.

See also

ConnectionStateMachine.handleMtuChanged