NordicSemiconductor / Android-nRF-Toolbox

The nRF Toolbox is a container app that stores your Nordic Semiconductor apps for Bluetooth Low Energy in one location.
https://www.nordicsemi.com/Software-and-tools/Development-Tools/nRF-Toolbox
BSD 3-Clause "New" or "Revised" License
1.07k stars 461 forks source link

MTU change from peripheral question #92

Closed XabierGoros closed 4 years ago

XabierGoros commented 4 years ago

If a MTU negotiation is only performed by the peripheral, the onMtuChanged method is not invoked. According to your documentation, in that case, android.bluetooth.BluetoothGattServerCallback#onMtuChanged(BluetoothDevice, int) should be used instead. However, the following method in MainThreadBluetoothGattCallback which extends from BluetoothGattCallback is not invoked either:

@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@Override
public final void onMtuChanged(@NonNull final BluetoothGatt gatt,
                   @IntRange(from = 23, to = 517) final int mtu, final int status) {
    runOnUiThread(() -> onMtuChangedSafe(gatt, mtu, status));
}

Isn't it possible to get the negotiated MTU without requesting a change?

XabierGoros commented 4 years ago

Moved to https://github.com/NordicSemiconductor/Android-BLE-Library/issues/164, delete this issue please.