mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-09 03:37:03 +01:00
rename BatteryDual_2 to BatteryDual_NoCase and DUAL_2 to DUAL_NO_CASE
This commit is contained in:
parent
503cd31d91
commit
fd06519cd1
@ -19,7 +19,7 @@ package nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones;
|
||||
public enum SonyHeadphonesCapabilities {
|
||||
BatterySingle,
|
||||
BatteryDual,
|
||||
BatteryDual_2,
|
||||
BatteryDual_NoCase,
|
||||
BatteryCase,
|
||||
PowerOffFromPhone,
|
||||
AmbientSoundControl,
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ public class SonyWFC500Coordinator extends SonyHeadphonesCoordinator {
|
||||
@Override
|
||||
public List<SonyHeadphonesCapabilities> getCapabilities() {
|
||||
return Arrays.asList(
|
||||
SonyHeadphonesCapabilities.BatteryDual_2,
|
||||
SonyHeadphonesCapabilities.BatteryDual_NoCase,
|
||||
SonyHeadphonesCapabilities.EqualizerSimple,
|
||||
SonyHeadphonesCapabilities.EqualizerWithCustomBands,
|
||||
SonyHeadphonesCapabilities.AudioUpsampling,
|
||||
|
@ -638,7 +638,7 @@ public class SonyProtocolImplV1 extends AbstractSonyProtocolImpl {
|
||||
final Map<SonyHeadphonesCapabilities, Request> capabilityRequestMap = new LinkedHashMap<SonyHeadphonesCapabilities, Request>() {{
|
||||
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]);
|
||||
|
||||
|
@ -19,6 +19,6 @@ package nodomain.freeyourgadget.gadgetbridge.service.devices.sony.headphones.pro
|
||||
public enum BatteryType {
|
||||
SINGLE,
|
||||
DUAL,
|
||||
DUAL_2,
|
||||
DUAL_NO_CASE,
|
||||
CASE,
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -104,7 +104,7 @@ public class SonyProtocolImplV2Test {
|
||||
final Map<BatteryType, String> commands = new LinkedHashMap<BatteryType, String>() {{
|
||||
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");
|
||||
}};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user