Huami: Fix MTU update on device connection

This commit is contained in:
José Rebelo
2022-07-19 14:26:25 +01:00
committed by Gitea
parent 5871a70d1f
commit 2a0b7b64fb

View File

@@ -2026,6 +2026,21 @@ public abstract class HuamiSupport extends AbstractBTLEDeviceSupport {
mMTU = mtu; mMTU = mtu;
} }
@Override
public void onMtuChanged(BluetoothGatt gatt, int mtu, int status) {
super.onMtuChanged(gatt, mtu, status);
final Prefs prefs = new Prefs(GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()));
if (!prefs.getBoolean(PREF_ALLOW_HIGH_MTU, false)) {
LOG.warn("Ignoring MTU change to {}", mtu);
return;
}
LOG.info("MTU changed to {}", mtu);
this.mMTU = mtu;
}
private void acknowledgeFindPhone() { private void acknowledgeFindPhone() {
try { try {
TransactionBuilder builder = performInitialized("acknowledge find phone"); TransactionBuilder builder = performInitialized("acknowledge find phone");