diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/SonyHeadphonesCapabilities.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/SonyHeadphonesCapabilities.java index 6735be53d..3907083d8 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/SonyHeadphonesCapabilities.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/SonyHeadphonesCapabilities.java @@ -19,7 +19,7 @@ package nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones; public enum SonyHeadphonesCapabilities { BatterySingle, BatteryDual, - BatteryDual_2, + BatteryDual_NoCase, BatteryCase, PowerOffFromPhone, AmbientSoundControl, diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/SonyHeadphonesCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/SonyHeadphonesCoordinator.java index b4a6dec31..0427e0b5e 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/SonyHeadphonesCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/SonyHeadphonesCoordinator.java @@ -70,7 +70,7 @@ public abstract class SonyHeadphonesCoordinator extends AbstractBLClassicDeviceC @Override public int getBatteryCount() { if (supports(SonyHeadphonesCapabilities.BatterySingle)) { - if (supports(SonyHeadphonesCapabilities.BatteryDual) || supports(SonyHeadphonesCapabilities.BatteryDual_2)) { + if (supports(SonyHeadphonesCapabilities.BatteryDual) || supports(SonyHeadphonesCapabilities.BatteryDual_NoCase)) { throw new IllegalStateException("A device can't have both single and dual battery"); } else if (supports(SonyHeadphonesCapabilities.BatteryCase)) { throw new IllegalStateException("Devices with single battery + case are not supported by the protocol"); @@ -87,7 +87,7 @@ public abstract class SonyHeadphonesCoordinator extends AbstractBLClassicDeviceC batteryCount += 1; } - if (supports(SonyHeadphonesCapabilities.BatteryDual) || supports(SonyHeadphonesCapabilities.BatteryDual_2)) { + if (supports(SonyHeadphonesCapabilities.BatteryDual) || supports(SonyHeadphonesCapabilities.BatteryDual_NoCase)) { batteryCount += 2; } @@ -106,7 +106,7 @@ public abstract class SonyHeadphonesCoordinator extends AbstractBLClassicDeviceC batteries.add(new BatteryConfig(batteries.size(), R.drawable.ic_tws_case, R.string.battery_case)); } - if (supports(SonyHeadphonesCapabilities.BatteryDual) || supports(SonyHeadphonesCapabilities.BatteryDual_2)) { + if (supports(SonyHeadphonesCapabilities.BatteryDual) || supports(SonyHeadphonesCapabilities.BatteryDual_NoCase)) { batteries.add(new BatteryConfig(batteries.size(), R.drawable.ic_galaxy_buds_l, R.string.left_earbud)); batteries.add(new BatteryConfig(batteries.size(), R.drawable.ic_galaxy_buds_r, R.string.right_earbud)); } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/coordinators/SonyWFC500Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/coordinators/SonyWFC500Coordinator.java index 6467b1f04..84c1c44a9 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/coordinators/SonyWFC500Coordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/coordinators/SonyWFC500Coordinator.java @@ -43,7 +43,7 @@ public class SonyWFC500Coordinator extends SonyHeadphonesCoordinator { @Override public List getCapabilities() { return Arrays.asList( - SonyHeadphonesCapabilities.BatteryDual_2, + SonyHeadphonesCapabilities.BatteryDual_NoCase, SonyHeadphonesCapabilities.EqualizerSimple, SonyHeadphonesCapabilities.EqualizerWithCustomBands, SonyHeadphonesCapabilities.AudioUpsampling, diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/headphones/protocol/impl/v1/SonyProtocolImplV1.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/headphones/protocol/impl/v1/SonyProtocolImplV1.java index 9c7f5f061..9dbf13ab0 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/headphones/protocol/impl/v1/SonyProtocolImplV1.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/headphones/protocol/impl/v1/SonyProtocolImplV1.java @@ -638,7 +638,7 @@ public class SonyProtocolImplV1 extends AbstractSonyProtocolImpl { final Map capabilityRequestMap = new LinkedHashMap() {{ put(SonyHeadphonesCapabilities.BatterySingle, getBattery(BatteryType.SINGLE)); put(SonyHeadphonesCapabilities.BatteryDual, getBattery(BatteryType.DUAL)); - put(SonyHeadphonesCapabilities.BatteryDual_2, getBattery(BatteryType.DUAL_2)); + put(SonyHeadphonesCapabilities.BatteryDual_NoCase, getBattery(BatteryType.DUAL_NO_CASE)); put(SonyHeadphonesCapabilities.BatteryCase, getBattery(BatteryType.CASE)); put(SonyHeadphonesCapabilities.AmbientSoundControl, getAmbientSoundControl()); put(SonyHeadphonesCapabilities.AncOptimizer, getNoiseCancellingOptimizerState()); @@ -963,7 +963,7 @@ public class SonyProtocolImplV1 extends AbstractSonyProtocolImpl { batteryEvents.add(gbDeviceEventBatteryInfoRight); } - } else if (BatteryType.DUAL_2.equals(batteryType)) { + } else if (BatteryType.DUAL_NO_CASE.equals(batteryType)) { // Dual Battery (L / R) LOG.debug("Battery Level: L: {}, R: {}", payload[2], payload[4]); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/headphones/protocol/impl/v1/params/BatteryType.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/headphones/protocol/impl/v1/params/BatteryType.java index 73737f793..213206b24 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/headphones/protocol/impl/v1/params/BatteryType.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/headphones/protocol/impl/v1/params/BatteryType.java @@ -19,6 +19,6 @@ package nodomain.freeyourgadget.gadgetbridge.service.devices.sony.headphones.pro public enum BatteryType { SINGLE, DUAL, - DUAL_2, + DUAL_NO_CASE, CASE, } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/headphones/protocol/impl/v2/SonyProtocolImplV2.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/headphones/protocol/impl/v2/SonyProtocolImplV2.java index dd5107268..94e6e4ae2 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/headphones/protocol/impl/v2/SonyProtocolImplV2.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/headphones/protocol/impl/v2/SonyProtocolImplV2.java @@ -1028,7 +1028,7 @@ public class SonyProtocolImplV2 extends SonyProtocolImplV1 { case 0x00: return BatteryType.SINGLE; case 0x01: - return BatteryType.DUAL_2; + return BatteryType.DUAL_NO_CASE; case 0x09: return BatteryType.DUAL; case 0x0a: @@ -1043,7 +1043,7 @@ public class SonyProtocolImplV2 extends SonyProtocolImplV1 { switch (batteryType) { case SINGLE: return 0x00; - case DUAL_2: + case DUAL_NO_CASE: return 0x01; case DUAL: return 0x09; diff --git a/app/src/test/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/headphones/protocol/impl/v2/SonyProtocolImplV2Test.java b/app/src/test/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/headphones/protocol/impl/v2/SonyProtocolImplV2Test.java index 59f52be27..9e6189378 100644 --- a/app/src/test/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/headphones/protocol/impl/v2/SonyProtocolImplV2Test.java +++ b/app/src/test/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/headphones/protocol/impl/v2/SonyProtocolImplV2Test.java @@ -104,7 +104,7 @@ public class SonyProtocolImplV2Test { final Map commands = new LinkedHashMap() {{ put(BatteryType.SINGLE, "22:00"); put(BatteryType.DUAL, "22:09"); - put(BatteryType.DUAL_2, "22:01"); + put(BatteryType.DUAL_NO_CASE, "22:01"); put(BatteryType.CASE, "22:0a"); }};