From efd1e3d597e1031945a4e5debee668419c585fb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Rebelo?= Date: Thu, 2 Jan 2025 17:19:48 +0000 Subject: [PATCH] Redmi Buds: Make packages and support classes generic --- .../AbstractRedmiBudsCoordinator.java | 6 ++--- .../RedmiBuds4ActiveCoordinator.java | 5 +--- .../RedmiBuds5ProCoordinator.java | 4 ++-- .../RedmiBuds6ActiveCoordinator.java | 2 +- .../RedmiBudsSettingsCustomizer.java} | 18 +++++++------- .../prefs/Configuration.java | 2 +- .../prefs/Gestures.java | 2 +- .../gadgetbridge/model/DeviceType.java | 6 ++--- .../RedmiBudsDeviceSupport.java} | 12 +++++----- .../RedmiBudsIOThread.java} | 10 ++++---- .../RedmiBudsProtocol.java} | 24 +++++++++---------- .../protocol/AuthData.java | 2 +- .../protocol/Authentication.java | 2 +- .../protocol/Message.java | 2 +- .../protocol/MessageType.java | 2 +- .../protocol/Opcode.java | 2 +- 16 files changed, 49 insertions(+), 52 deletions(-) rename app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/{redmibuds5pro => redmibuds}/AbstractRedmiBudsCoordinator.java (96%) rename app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/{redmibuds5pro => redmibuds}/RedmiBuds4ActiveCoordinator.java (82%) rename app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/{redmibuds5pro => redmibuds}/RedmiBuds5ProCoordinator.java (96%) rename app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/{redmibuds5pro => redmibuds}/RedmiBuds6ActiveCoordinator.java (97%) rename app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/{redmibuds5pro/RedmiBuds5ProSettingsCustomizer.java => redmibuds/RedmiBudsSettingsCustomizer.java} (91%) rename app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/{redmibuds5pro => redmibuds}/prefs/Configuration.java (98%) rename app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/{redmibuds5pro => redmibuds}/prefs/Gestures.java (96%) rename app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/{redmibuds5pro/RedmiBuds5ProDeviceSupport.java => redmibuds/RedmiBudsDeviceSupport.java} (80%) rename app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/{redmibuds5pro/RedmiBuds5ProIOThread.java => redmibuds/RedmiBudsIOThread.java} (86%) rename app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/{redmibuds5pro/RedmiBuds5ProProtocol.java => redmibuds/RedmiBudsProtocol.java} (98%) rename app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/{redmibuds5pro => redmibuds}/protocol/AuthData.java (97%) rename app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/{redmibuds5pro => redmibuds}/protocol/Authentication.java (99%) rename app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/{redmibuds5pro => redmibuds}/protocol/Message.java (99%) rename app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/{redmibuds5pro => redmibuds}/protocol/MessageType.java (97%) rename app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/{redmibuds5pro => redmibuds}/protocol/Opcode.java (97%) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmibuds5pro/AbstractRedmiBudsCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmibuds/AbstractRedmiBudsCoordinator.java similarity index 96% rename from app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmibuds5pro/AbstractRedmiBudsCoordinator.java rename to app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmibuds/AbstractRedmiBudsCoordinator.java index 389cbe747..ea61f2a73 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmibuds5pro/AbstractRedmiBudsCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmibuds/AbstractRedmiBudsCoordinator.java @@ -14,7 +14,7 @@ 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.redmibuds5pro; +package nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmibuds; import androidx.annotation.NonNull; @@ -26,7 +26,7 @@ import nodomain.freeyourgadget.gadgetbridge.entities.Device; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.model.BatteryConfig; import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport; -import nodomain.freeyourgadget.gadgetbridge.service.devices.redmibuds5pro.RedmiBuds5ProDeviceSupport; +import nodomain.freeyourgadget.gadgetbridge.service.devices.redmibuds.RedmiBudsDeviceSupport; public abstract class AbstractRedmiBudsCoordinator extends AbstractDeviceCoordinator { @Override @@ -42,7 +42,7 @@ public abstract class AbstractRedmiBudsCoordinator extends AbstractDeviceCoordin @NonNull @Override public Class getDeviceSupportClass() { - return RedmiBuds5ProDeviceSupport.class; + return RedmiBudsDeviceSupport.class; } @Override diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmibuds5pro/RedmiBuds4ActiveCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmibuds/RedmiBuds4ActiveCoordinator.java similarity index 82% rename from app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmibuds5pro/RedmiBuds4ActiveCoordinator.java rename to app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmibuds/RedmiBuds4ActiveCoordinator.java index d83b305b3..3bb8de405 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmibuds5pro/RedmiBuds4ActiveCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmibuds/RedmiBuds4ActiveCoordinator.java @@ -14,14 +14,11 @@ 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.redmibuds5pro; +package nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmibuds; import java.util.regex.Pattern; import nodomain.freeyourgadget.gadgetbridge.R; -import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettings; -import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsCustomizer; -import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; public class RedmiBuds4ActiveCoordinator extends AbstractRedmiBudsCoordinator { @Override diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmibuds5pro/RedmiBuds5ProCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmibuds/RedmiBuds5ProCoordinator.java similarity index 96% rename from app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmibuds5pro/RedmiBuds5ProCoordinator.java rename to app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmibuds/RedmiBuds5ProCoordinator.java index 339b140bf..97b6f8126 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmibuds5pro/RedmiBuds5ProCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmibuds/RedmiBuds5ProCoordinator.java @@ -14,7 +14,7 @@ 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.redmibuds5pro; +package nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmibuds; import java.util.regex.Pattern; @@ -45,6 +45,6 @@ public class RedmiBuds5ProCoordinator extends AbstractRedmiBudsCoordinator { @Override public DeviceSpecificSettingsCustomizer getDeviceSpecificSettingsCustomizer(final GBDevice device) { - return new RedmiBuds5ProSettingsCustomizer(device); + return new RedmiBudsSettingsCustomizer(device); } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmibuds5pro/RedmiBuds6ActiveCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmibuds/RedmiBuds6ActiveCoordinator.java similarity index 97% rename from app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmibuds5pro/RedmiBuds6ActiveCoordinator.java rename to app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmibuds/RedmiBuds6ActiveCoordinator.java index 21c27d61b..f6106dcda 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmibuds5pro/RedmiBuds6ActiveCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmibuds/RedmiBuds6ActiveCoordinator.java @@ -1,4 +1,4 @@ -package nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmibuds5pro; +package nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmibuds; import java.util.regex.Pattern; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmibuds5pro/RedmiBuds5ProSettingsCustomizer.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmibuds/RedmiBudsSettingsCustomizer.java similarity index 91% rename from app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmibuds5pro/RedmiBuds5ProSettingsCustomizer.java rename to app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmibuds/RedmiBudsSettingsCustomizer.java index 9d0e5c972..13b85320e 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmibuds5pro/RedmiBuds5ProSettingsCustomizer.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmibuds/RedmiBudsSettingsCustomizer.java @@ -14,7 +14,7 @@ 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.redmibuds5pro; +package nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmibuds; import android.os.Parcel; @@ -33,11 +33,11 @@ import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpec import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.util.Prefs; -public class RedmiBuds5ProSettingsCustomizer implements DeviceSpecificSettingsCustomizer { +public class RedmiBudsSettingsCustomizer implements DeviceSpecificSettingsCustomizer { final GBDevice device; - public RedmiBuds5ProSettingsCustomizer(final GBDevice device) { + public RedmiBudsSettingsCustomizer(final GBDevice device) { this.device = device; } @@ -146,16 +146,16 @@ public class RedmiBuds5ProSettingsCustomizer implements DeviceSpecificSettingsCu parcel.writeParcelable(device, 0); } - public static final Creator CREATOR = new Creator() { + public static final Creator CREATOR = new Creator() { @Override - public RedmiBuds5ProSettingsCustomizer createFromParcel(final Parcel in) { - final GBDevice device = in.readParcelable(RedmiBuds5ProSettingsCustomizer.class.getClassLoader()); - return new RedmiBuds5ProSettingsCustomizer(device); + public RedmiBudsSettingsCustomizer createFromParcel(final Parcel in) { + final GBDevice device = in.readParcelable(RedmiBudsSettingsCustomizer.class.getClassLoader()); + return new RedmiBudsSettingsCustomizer(device); } @Override - public RedmiBuds5ProSettingsCustomizer[] newArray(final int size) { - return new RedmiBuds5ProSettingsCustomizer[size]; + public RedmiBudsSettingsCustomizer[] newArray(final int size) { + return new RedmiBudsSettingsCustomizer[size]; } }; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmibuds5pro/prefs/Configuration.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmibuds/prefs/Configuration.java similarity index 98% rename from app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmibuds5pro/prefs/Configuration.java rename to app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmibuds/prefs/Configuration.java index e42ada1ad..2f654e909 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmibuds5pro/prefs/Configuration.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmibuds/prefs/Configuration.java @@ -1,4 +1,4 @@ -package nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmibuds5pro.prefs; +package nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmibuds.prefs; public class Configuration { diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmibuds5pro/prefs/Gestures.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmibuds/prefs/Gestures.java similarity index 96% rename from app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmibuds5pro/prefs/Gestures.java rename to app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmibuds/prefs/Gestures.java index e7b89711f..9a3109bc5 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmibuds5pro/prefs/Gestures.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmibuds/prefs/Gestures.java @@ -1,4 +1,4 @@ -package nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmibuds5pro.prefs; +package nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmibuds.prefs; public class Gestures { diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java index 2132170bd..d8870239e 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java @@ -283,9 +283,9 @@ import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.miband9.MiBand9Coordi import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.miband9pro.MiBand9ProCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.miwatch.MiWatchLiteCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.miwatchcolorsport.MiWatchColorSportCoordinator; -import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmibuds5pro.RedmiBuds4ActiveCoordinator; -import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmibuds5pro.RedmiBuds5ProCoordinator; -import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmibuds5pro.RedmiBuds6ActiveCoordinator; +import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmibuds.RedmiBuds4ActiveCoordinator; +import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmibuds.RedmiBuds5ProCoordinator; +import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmibuds.RedmiBuds6ActiveCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmismartband2.RedmiSmartBand2Coordinator; import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmismartbandpro.RedmiSmartBandProCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmiwatch2.RedmiWatch2Coordinator; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds5pro/RedmiBuds5ProDeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds/RedmiBudsDeviceSupport.java similarity index 80% rename from app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds5pro/RedmiBuds5ProDeviceSupport.java rename to app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds/RedmiBudsDeviceSupport.java index af69f495e..2cc1c6b79 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds5pro/RedmiBuds5ProDeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds/RedmiBudsDeviceSupport.java @@ -14,23 +14,23 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ -package nodomain.freeyourgadget.gadgetbridge.service.devices.redmibuds5pro; +package nodomain.freeyourgadget.gadgetbridge.service.devices.redmibuds; import nodomain.freeyourgadget.gadgetbridge.service.serial.AbstractSerialDeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.serial.GBDeviceIoThread; import nodomain.freeyourgadget.gadgetbridge.service.serial.GBDeviceProtocol; -public class RedmiBuds5ProDeviceSupport extends AbstractSerialDeviceSupport { +public class RedmiBudsDeviceSupport extends AbstractSerialDeviceSupport { @Override protected GBDeviceProtocol createDeviceProtocol() { - return new RedmiBuds5ProProtocol(getDevice()); + return new RedmiBudsProtocol(getDevice()); } @Override protected GBDeviceIoThread createDeviceIOThread() { - return new RedmiBuds5ProIOThread(getDevice(), getContext(), - (RedmiBuds5ProProtocol) getDeviceProtocol(), - RedmiBuds5ProDeviceSupport.this, getBluetoothAdapter()); + return new RedmiBudsIOThread(getDevice(), getContext(), + (RedmiBudsProtocol) getDeviceProtocol(), + RedmiBudsDeviceSupport.this, getBluetoothAdapter()); } @Override diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds5pro/RedmiBuds5ProIOThread.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds/RedmiBudsIOThread.java similarity index 86% rename from app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds5pro/RedmiBuds5ProIOThread.java rename to app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds/RedmiBudsIOThread.java index e42bcc832..41c13a04f 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds5pro/RedmiBuds5ProIOThread.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds/RedmiBudsIOThread.java @@ -14,7 +14,7 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ -package nodomain.freeyourgadget.gadgetbridge.service.devices.redmibuds5pro; +package nodomain.freeyourgadget.gadgetbridge.service.devices.redmibuds; import static nodomain.freeyourgadget.gadgetbridge.util.GB.hexdump; @@ -35,11 +35,11 @@ import java.util.UUID; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.service.btclassic.BtClassicIoThread; -public class RedmiBuds5ProIOThread extends BtClassicIoThread { - private static final Logger LOG = LoggerFactory.getLogger(RedmiBuds5ProIOThread.class); - private final RedmiBuds5ProProtocol redmiProtocol; +public class RedmiBudsIOThread extends BtClassicIoThread { + private static final Logger LOG = LoggerFactory.getLogger(RedmiBudsIOThread.class); + private final RedmiBudsProtocol redmiProtocol; - public RedmiBuds5ProIOThread(GBDevice gbDevice, Context context, RedmiBuds5ProProtocol redmiProtocol, RedmiBuds5ProDeviceSupport deviceSupport, BluetoothAdapter btAdapter) { + public RedmiBudsIOThread(GBDevice gbDevice, Context context, RedmiBudsProtocol redmiProtocol, RedmiBudsDeviceSupport deviceSupport, BluetoothAdapter btAdapter) { super(gbDevice, context, redmiProtocol, deviceSupport, btAdapter); this.redmiProtocol = redmiProtocol; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds5pro/RedmiBuds5ProProtocol.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds/RedmiBudsProtocol.java similarity index 98% rename from app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds5pro/RedmiBuds5ProProtocol.java rename to app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds/RedmiBudsProtocol.java index c79c3d12c..aa69598db 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds5pro/RedmiBuds5ProProtocol.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds/RedmiBudsProtocol.java @@ -14,7 +14,7 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ -package nodomain.freeyourgadget.gadgetbridge.service.devices.redmibuds5pro; +package nodomain.freeyourgadget.gadgetbridge.service.devices.redmibuds; import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.*; import static nodomain.freeyourgadget.gadgetbridge.util.GB.hexdump; @@ -37,28 +37,28 @@ import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventBatteryInf import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventSendBytes; import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventUpdateDeviceState; import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventVersionInfo; -import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmibuds5pro.prefs.Configuration.Config; -import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmibuds5pro.prefs.Configuration.StrengthTarget; -import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmibuds5pro.prefs.Gestures.InteractionType; -import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmibuds5pro.prefs.Gestures.Position; +import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmibuds.prefs.Configuration.Config; +import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmibuds.prefs.Configuration.StrengthTarget; +import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmibuds.prefs.Gestures.InteractionType; +import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmibuds.prefs.Gestures.Position; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice.State; import nodomain.freeyourgadget.gadgetbridge.model.BatteryState; -import nodomain.freeyourgadget.gadgetbridge.service.devices.redmibuds5pro.protocol.Authentication; -import nodomain.freeyourgadget.gadgetbridge.service.devices.redmibuds5pro.protocol.Message; -import nodomain.freeyourgadget.gadgetbridge.service.devices.redmibuds5pro.protocol.MessageType; -import nodomain.freeyourgadget.gadgetbridge.service.devices.redmibuds5pro.protocol.Opcode; +import nodomain.freeyourgadget.gadgetbridge.service.devices.redmibuds.protocol.Authentication; +import nodomain.freeyourgadget.gadgetbridge.service.devices.redmibuds.protocol.Message; +import nodomain.freeyourgadget.gadgetbridge.service.devices.redmibuds.protocol.MessageType; +import nodomain.freeyourgadget.gadgetbridge.service.devices.redmibuds.protocol.Opcode; import nodomain.freeyourgadget.gadgetbridge.service.serial.GBDeviceProtocol; import nodomain.freeyourgadget.gadgetbridge.util.Prefs; -public class RedmiBuds5ProProtocol extends GBDeviceProtocol { +public class RedmiBudsProtocol extends GBDeviceProtocol { - private static final Logger LOG = LoggerFactory.getLogger(RedmiBuds5ProProtocol.class); + private static final Logger LOG = LoggerFactory.getLogger(RedmiBudsProtocol.class); final UUID UUID_DEVICE_CTRL = UUID.fromString("0000fd2d-0000-1000-8000-00805f9b34fb"); private byte sequenceNumber = 0; - protected RedmiBuds5ProProtocol(GBDevice device) { + protected RedmiBudsProtocol(GBDevice device) { super(device); } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds5pro/protocol/AuthData.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds/protocol/AuthData.java similarity index 97% rename from app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds5pro/protocol/AuthData.java rename to app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds/protocol/AuthData.java index 7925698d5..4e0069dab 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds5pro/protocol/AuthData.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds/protocol/AuthData.java @@ -1,4 +1,4 @@ -package nodomain.freeyourgadget.gadgetbridge.service.devices.redmibuds5pro.protocol; +package nodomain.freeyourgadget.gadgetbridge.service.devices.redmibuds.protocol; class AuthData { diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds5pro/protocol/Authentication.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds/protocol/Authentication.java similarity index 99% rename from app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds5pro/protocol/Authentication.java rename to app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds/protocol/Authentication.java index 867d897e4..db91280f9 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds5pro/protocol/Authentication.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds/protocol/Authentication.java @@ -14,7 +14,7 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ -package nodomain.freeyourgadget.gadgetbridge.service.devices.redmibuds5pro.protocol; +package nodomain.freeyourgadget.gadgetbridge.service.devices.redmibuds.protocol; import java.math.BigInteger; import java.security.SecureRandom; import java.util.ArrayList; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds5pro/protocol/Message.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds/protocol/Message.java similarity index 99% rename from app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds5pro/protocol/Message.java rename to app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds/protocol/Message.java index be88ea90a..ba84b9680 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds5pro/protocol/Message.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds/protocol/Message.java @@ -14,7 +14,7 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ -package nodomain.freeyourgadget.gadgetbridge.service.devices.redmibuds5pro.protocol; +package nodomain.freeyourgadget.gadgetbridge.service.devices.redmibuds.protocol; import static nodomain.freeyourgadget.gadgetbridge.util.GB.hexdump; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds5pro/protocol/MessageType.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds/protocol/MessageType.java similarity index 97% rename from app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds5pro/protocol/MessageType.java rename to app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds/protocol/MessageType.java index 112eb9885..f499337d3 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds5pro/protocol/MessageType.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds/protocol/MessageType.java @@ -1,4 +1,4 @@ -package nodomain.freeyourgadget.gadgetbridge.service.devices.redmibuds5pro.protocol; +package nodomain.freeyourgadget.gadgetbridge.service.devices.redmibuds.protocol; public enum MessageType { PHONE_REQUEST(0xC4), diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds5pro/protocol/Opcode.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds/protocol/Opcode.java similarity index 97% rename from app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds5pro/protocol/Opcode.java rename to app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds/protocol/Opcode.java index f6b3ed157..0c9f94c44 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds5pro/protocol/Opcode.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/redmibuds/protocol/Opcode.java @@ -1,4 +1,4 @@ -package nodomain.freeyourgadget.gadgetbridge.service.devices.redmibuds5pro.protocol; +package nodomain.freeyourgadget.gadgetbridge.service.devices.redmibuds.protocol; public enum Opcode { GET_DEVICE_INFO(0x02),