From 0ed9e5b1a807505d0de057abca2d9e3bfe8e6be1 Mon Sep 17 00:00:00 2001 From: Damien 'Psolyca' Gaignon Date: Sun, 21 Jan 2024 21:37:44 +0100 Subject: [PATCH] Fix normal mode connection --- .../devices/huawei/HuaweiSupportProvider.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huawei/HuaweiSupportProvider.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huawei/HuaweiSupportProvider.java index 73b8c071b..8fa252ac6 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huawei/HuaweiSupportProvider.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huawei/HuaweiSupportProvider.java @@ -400,12 +400,16 @@ public class HuaweiSupportProvider { try { createSecretKey(); GetAuthRequest authReq = new GetAuthRequest(this, linkParamsReq); - GetBondParamsRequest bondParamsReq = new GetBondParamsRequest(this); - GetBondRequest bondReq = new GetBondRequest(this); - authReq.nextRequest(bondParamsReq); - bondParamsReq.nextRequest(bondReq); - bondParamsReq.setFinalizeReq(configureReq); - bondReq.setFinalizeReq(configureReq); + if (getHuaweiType() == HuaweiDeviceType.BLE) { + GetBondParamsRequest bondParamsReq = new GetBondParamsRequest(this); + GetBondRequest bondReq = new GetBondRequest(this); + authReq.nextRequest(bondParamsReq); + bondParamsReq.nextRequest(bondReq); + bondParamsReq.setFinalizeReq(configureReq); + bondReq.setFinalizeReq(configureReq); + } else { + authReq.setFinalizeReq(configureReq); + } authReq.doPerform(); } catch (IOException e) { GB.toast(context, "init Normal Mode of Huawei device failed", Toast.LENGTH_SHORT, GB.ERROR, e);