diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/XiaomiCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/XiaomiCoordinator.java
index 5fde67d31..ccb5b1aa9 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/XiaomiCoordinator.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/XiaomiCoordinator.java
@@ -55,13 +55,6 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.HuamiLanguageT
import nodomain.freeyourgadget.gadgetbridge.util.FileUtils;
public abstract class XiaomiCoordinator extends AbstractBLEDeviceCoordinator {
- @NonNull
- @Override
- public Collection extends ScanFilter> createBLEScanFilters() {
- // TODO
- return super.createBLEScanFilters();
- }
-
@Override
protected void deleteDevice(@NonNull final GBDevice gbDevice,
@NonNull final Device device,
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/XiaomiEncryptedCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/XiaomiEncryptedCoordinator.java
new file mode 100644
index 000000000..f8a705c88
--- /dev/null
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/XiaomiEncryptedCoordinator.java
@@ -0,0 +1,44 @@
+/* Copyright (C) 2023 José Rebelo
+
+ This file is part of Gadgetbridge.
+
+ Gadgetbridge is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Gadgetbridge is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see . */
+package nodomain.freeyourgadget.gadgetbridge.devices.xiaomi;
+
+import android.bluetooth.le.ScanFilter;
+import android.os.ParcelUuid;
+
+import androidx.annotation.NonNull;
+
+import java.util.Collection;
+import java.util.Collections;
+
+import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
+import nodomain.freeyourgadget.gadgetbridge.service.devices.xiaomi.XiaomiEncryptedSupport;
+
+public abstract class XiaomiEncryptedCoordinator extends XiaomiCoordinator {
+ @NonNull
+ @Override
+ public Collection extends ScanFilter> createBLEScanFilters() {
+ final ParcelUuid service = new ParcelUuid(XiaomiEncryptedSupport.UUID_SERVICE_XIAOMI_FE95);
+ final ScanFilter filter = new ScanFilter.Builder().setServiceUuid(service).build();
+ return Collections.singletonList(filter);
+ }
+
+ @NonNull
+ @Override
+ public Class extends DeviceSupport> getDeviceSupportClass() {
+ return XiaomiEncryptedSupport.class;
+ }
+}
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/XiaomiPlaintextCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/XiaomiPlaintextCoordinator.java
new file mode 100644
index 000000000..3a249da92
--- /dev/null
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/XiaomiPlaintextCoordinator.java
@@ -0,0 +1,44 @@
+/* Copyright (C) 2023 José Rebelo
+
+ This file is part of Gadgetbridge.
+
+ Gadgetbridge is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Gadgetbridge is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see . */
+package nodomain.freeyourgadget.gadgetbridge.devices.xiaomi;
+
+import android.bluetooth.le.ScanFilter;
+import android.os.ParcelUuid;
+
+import androidx.annotation.NonNull;
+
+import java.util.Collection;
+import java.util.Collections;
+
+import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
+import nodomain.freeyourgadget.gadgetbridge.service.devices.xiaomi.XiaomiPlaintextSupport;
+
+public abstract class XiaomiPlaintextCoordinator extends XiaomiCoordinator {
+ @NonNull
+ @Override
+ public Collection extends ScanFilter> createBLEScanFilters() {
+ final ParcelUuid service = new ParcelUuid(XiaomiPlaintextSupport.UUID_SERVICE);
+ final ScanFilter filter = new ScanFilter.Builder().setServiceUuid(service).build();
+ return Collections.singletonList(filter);
+ }
+
+ @NonNull
+ @Override
+ public Class extends DeviceSupport> getDeviceSupportClass() {
+ return XiaomiPlaintextSupport.class;
+ }
+}
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/miband8/MiBand8Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/miband8/MiBand8Coordinator.java
index 7f0f0d9ce..21aa3d650 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/miband8/MiBand8Coordinator.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/miband8/MiBand8Coordinator.java
@@ -19,19 +19,16 @@ package nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.miband8;
import android.content.Context;
import android.net.Uri;
-import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
-import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.XiaomiCoordinator;
+import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.XiaomiEncryptedCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.XiaomiInstallHandler;
-import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
-import nodomain.freeyourgadget.gadgetbridge.service.devices.xiaomi.XiaomiEncryptedSupport;
-public class MiBand8Coordinator extends XiaomiCoordinator {
+public class MiBand8Coordinator extends XiaomiEncryptedCoordinator {
@Override
protected Pattern getSupportedDeviceName() {
return Pattern.compile("^Xiaomi Smart Band 8 [A-Z0-9]{4}$");
@@ -58,10 +55,4 @@ public class MiBand8Coordinator extends XiaomiCoordinator {
public int getDisabledIconResource() {
return R.drawable.ic_device_miband6_disabled;
}
-
- @NonNull
- @Override
- public Class extends DeviceSupport> getDeviceSupportClass() {
- return XiaomiEncryptedSupport.class;
- }
}
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/miwatch/MiWatchLiteCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/miwatch/MiWatchLiteCoordinator.java
index 1ab94f303..e10eb0fbc 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/miwatch/MiWatchLiteCoordinator.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/miwatch/MiWatchLiteCoordinator.java
@@ -19,19 +19,16 @@ package nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.miwatch;
import android.content.Context;
import android.net.Uri;
-import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
-import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.XiaomiCoordinator;
+import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.XiaomiPlaintextCoordinator;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
-import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
-import nodomain.freeyourgadget.gadgetbridge.service.devices.xiaomi.XiaomiPlaintextSupport;
-public class MiWatchLiteCoordinator extends XiaomiCoordinator {
+public class MiWatchLiteCoordinator extends XiaomiPlaintextCoordinator {
@Override
protected Pattern getSupportedDeviceName() {
return Pattern.compile("^Mi Watch Lite_[A-Z0-9]{4}$");
@@ -87,10 +84,4 @@ public class MiWatchLiteCoordinator extends XiaomiCoordinator {
public int getReminderSlotCount(final GBDevice device) {
return 0;
}
-
- @NonNull
- @Override
- public Class extends DeviceSupport> getDeviceSupportClass() {
- return XiaomiPlaintextSupport.class;
- }
}
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/xiaomi/XiaomiEncryptedSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/xiaomi/XiaomiEncryptedSupport.java
index 600bef3b4..aa38cea1e 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/xiaomi/XiaomiEncryptedSupport.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/xiaomi/XiaomiEncryptedSupport.java
@@ -16,17 +16,13 @@
along with this program. If not, see . */
package nodomain.freeyourgadget.gadgetbridge.service.devices.xiaomi;
-import android.bluetooth.BluetoothGattCharacteristic;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.UUID;
-import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.service.btle.GattService;
import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder;
-import nodomain.freeyourgadget.gadgetbridge.service.btle.actions.SetDeviceStateAction;
public class XiaomiEncryptedSupport extends XiaomiSupport {
private static final Logger LOG = LoggerFactory.getLogger(XiaomiEncryptedSupport.class);
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/xiaomi/XiaomiPlaintextSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/xiaomi/XiaomiPlaintextSupport.java
index 8a2ea5e53..a975d1f60 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/xiaomi/XiaomiPlaintextSupport.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/xiaomi/XiaomiPlaintextSupport.java
@@ -29,9 +29,9 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder;
public class XiaomiPlaintextSupport extends XiaomiSupport {
-
private static final Logger LOG = LoggerFactory.getLogger(XiaomiPlaintextSupport.class);
+ public static final UUID UUID_SERVICE = UUID.fromString("16186f00-0000-1000-8000-00807f9b34fb");
private static final UUID UUID_CHARACTERISTIC_MAIN_READ = UUID.fromString("16186f01-0000-1000-8000-00807f9b34fb");
private static final UUID UUID_CHARACTERISTIC_MAIN_WRITE = UUID.fromString("16186f02-0000-1000-8000-00807f9b34fb");
private static final UUID UUID_CHARACTERISTIC_ACTIVITY_DATA = UUID.fromString("16186f03-0000-1000-8000-00807f9b34fb");
@@ -40,7 +40,7 @@ public class XiaomiPlaintextSupport extends XiaomiSupport {
public XiaomiPlaintextSupport() {
super();
- addSupportedService(UUID.fromString("16186f00-0000-1000-8000-00807f9b34fb"));
+ addSupportedService(UUID_SERVICE);
}
@Override