1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2025-01-14 19:57:32 +01:00

rename BatteryDual_2 to BatteryDual_NoCase and DUAL_2 to DUAL_NO_CASE

This commit is contained in:
Zahnstocher 2024-09-17 22:35:47 +02:00
parent 503cd31d91
commit fd06519cd1
7 changed files with 11 additions and 11 deletions

View File

@ -19,7 +19,7 @@ package nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones;
public enum SonyHeadphonesCapabilities { public enum SonyHeadphonesCapabilities {
BatterySingle, BatterySingle,
BatteryDual, BatteryDual,
BatteryDual_2, BatteryDual_NoCase,
BatteryCase, BatteryCase,
PowerOffFromPhone, PowerOffFromPhone,
AmbientSoundControl, AmbientSoundControl,

View File

@ -70,7 +70,7 @@ public abstract class SonyHeadphonesCoordinator extends AbstractBLClassicDeviceC
@Override @Override
public int getBatteryCount() { public int getBatteryCount() {
if (supports(SonyHeadphonesCapabilities.BatterySingle)) { 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"); throw new IllegalStateException("A device can't have both single and dual battery");
} else if (supports(SonyHeadphonesCapabilities.BatteryCase)) { } else if (supports(SonyHeadphonesCapabilities.BatteryCase)) {
throw new IllegalStateException("Devices with single battery + case are not supported by the protocol"); 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; batteryCount += 1;
} }
if (supports(SonyHeadphonesCapabilities.BatteryDual) || supports(SonyHeadphonesCapabilities.BatteryDual_2)) { if (supports(SonyHeadphonesCapabilities.BatteryDual) || supports(SonyHeadphonesCapabilities.BatteryDual_NoCase)) {
batteryCount += 2; 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)); 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_l, R.string.left_earbud));
batteries.add(new BatteryConfig(batteries.size(), R.drawable.ic_galaxy_buds_r, R.string.right_earbud)); batteries.add(new BatteryConfig(batteries.size(), R.drawable.ic_galaxy_buds_r, R.string.right_earbud));
} }

View File

@ -43,7 +43,7 @@ public class SonyWFC500Coordinator extends SonyHeadphonesCoordinator {
@Override @Override
public List<SonyHeadphonesCapabilities> getCapabilities() { public List<SonyHeadphonesCapabilities> getCapabilities() {
return Arrays.asList( return Arrays.asList(
SonyHeadphonesCapabilities.BatteryDual_2, SonyHeadphonesCapabilities.BatteryDual_NoCase,
SonyHeadphonesCapabilities.EqualizerSimple, SonyHeadphonesCapabilities.EqualizerSimple,
SonyHeadphonesCapabilities.EqualizerWithCustomBands, SonyHeadphonesCapabilities.EqualizerWithCustomBands,
SonyHeadphonesCapabilities.AudioUpsampling, SonyHeadphonesCapabilities.AudioUpsampling,

View File

@ -638,7 +638,7 @@ public class SonyProtocolImplV1 extends AbstractSonyProtocolImpl {
final Map<SonyHeadphonesCapabilities, Request> capabilityRequestMap = new LinkedHashMap<SonyHeadphonesCapabilities, Request>() {{ final Map<SonyHeadphonesCapabilities, Request> capabilityRequestMap = new LinkedHashMap<SonyHeadphonesCapabilities, Request>() {{
put(SonyHeadphonesCapabilities.BatterySingle, getBattery(BatteryType.SINGLE)); put(SonyHeadphonesCapabilities.BatterySingle, getBattery(BatteryType.SINGLE));
put(SonyHeadphonesCapabilities.BatteryDual, getBattery(BatteryType.DUAL)); 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.BatteryCase, getBattery(BatteryType.CASE));
put(SonyHeadphonesCapabilities.AmbientSoundControl, getAmbientSoundControl()); put(SonyHeadphonesCapabilities.AmbientSoundControl, getAmbientSoundControl());
put(SonyHeadphonesCapabilities.AncOptimizer, getNoiseCancellingOptimizerState()); put(SonyHeadphonesCapabilities.AncOptimizer, getNoiseCancellingOptimizerState());
@ -963,7 +963,7 @@ public class SonyProtocolImplV1 extends AbstractSonyProtocolImpl {
batteryEvents.add(gbDeviceEventBatteryInfoRight); batteryEvents.add(gbDeviceEventBatteryInfoRight);
} }
} else if (BatteryType.DUAL_2.equals(batteryType)) { } else if (BatteryType.DUAL_NO_CASE.equals(batteryType)) {
// Dual Battery (L / R) // Dual Battery (L / R)
LOG.debug("Battery Level: L: {}, R: {}", payload[2], payload[4]); LOG.debug("Battery Level: L: {}, R: {}", payload[2], payload[4]);

View File

@ -19,6 +19,6 @@ package nodomain.freeyourgadget.gadgetbridge.service.devices.sony.headphones.pro
public enum BatteryType { public enum BatteryType {
SINGLE, SINGLE,
DUAL, DUAL,
DUAL_2, DUAL_NO_CASE,
CASE, CASE,
} }

View File

@ -1028,7 +1028,7 @@ public class SonyProtocolImplV2 extends SonyProtocolImplV1 {
case 0x00: case 0x00:
return BatteryType.SINGLE; return BatteryType.SINGLE;
case 0x01: case 0x01:
return BatteryType.DUAL_2; return BatteryType.DUAL_NO_CASE;
case 0x09: case 0x09:
return BatteryType.DUAL; return BatteryType.DUAL;
case 0x0a: case 0x0a:
@ -1043,7 +1043,7 @@ public class SonyProtocolImplV2 extends SonyProtocolImplV1 {
switch (batteryType) { switch (batteryType) {
case SINGLE: case SINGLE:
return 0x00; return 0x00;
case DUAL_2: case DUAL_NO_CASE:
return 0x01; return 0x01;
case DUAL: case DUAL:
return 0x09; return 0x09;

View File

@ -104,7 +104,7 @@ public class SonyProtocolImplV2Test {
final Map<BatteryType, String> commands = new LinkedHashMap<BatteryType, String>() {{ final Map<BatteryType, String> commands = new LinkedHashMap<BatteryType, String>() {{
put(BatteryType.SINGLE, "22:00"); put(BatteryType.SINGLE, "22:00");
put(BatteryType.DUAL, "22:09"); put(BatteryType.DUAL, "22:09");
put(BatteryType.DUAL_2, "22:01"); put(BatteryType.DUAL_NO_CASE, "22:01");
put(BatteryType.CASE, "22:0a"); put(BatteryType.CASE, "22:0a");
}}; }};