1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-29 13:26:50 +01:00

Galaxy Buds: add multiple batteries support

This commit is contained in:
vanous 2021-10-31 07:41:22 +01:00
parent 788f4d8ae0
commit 80207b34bc
2 changed files with 9 additions and 9 deletions

View File

@ -40,10 +40,10 @@ public class GalaxyBudsDeviceCoordinator extends AbstractDeviceCoordinator {
return DeviceType.GALAXY_BUDS;
}
//@Override
//public int getBatteryCount() {
// return 2;
//}
@Override
public int getBatteryCount() {
return 2;
}
@Nullable
@Override

View File

@ -225,18 +225,18 @@ public class GalaxyBudsProtocol extends GBDeviceProtocol {
int batteryLevel2 = payload[1];
GBDeviceEventBatteryInfo evBattery1 = new GBDeviceEventBatteryInfo();
//evBattery1.batteryIndex = 0;
evBattery1.batteryIndex = 0;
evBattery1.level = GBDevice.BATTERY_UNKNOWN;
evBattery1.level = (batteryLevel1 > 0) ? (short) batteryLevel1 : GBDevice.BATTERY_UNKNOWN;
evBattery1.level = (batteryLevel1 > 0) ? batteryLevel1 : GBDevice.BATTERY_UNKNOWN;
evBattery1.state = (batteryLevel1 > 0) ? BatteryState.BATTERY_NORMAL : BatteryState.UNKNOWN;
deviceEvents.add(evBattery1);
GBDeviceEventBatteryInfo evBattery2 = new GBDeviceEventBatteryInfo();
//evBattery2.batteryIndex = 1;
evBattery2.batteryIndex = 1;
evBattery2.level = GBDevice.BATTERY_UNKNOWN;
evBattery2.level = (batteryLevel2 > 0) ? (short) batteryLevel2 : GBDevice.BATTERY_UNKNOWN;
evBattery2.level = (batteryLevel2 > 0) ? batteryLevel2 : GBDevice.BATTERY_UNKNOWN;
evBattery2.state = (batteryLevel2 > 0) ? BatteryState.BATTERY_NORMAL : BatteryState.UNKNOWN;
//deviceEvents.add(evBattery2);
deviceEvents.add(evBattery2);
return deviceEvents;
}