mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-25 19:36:50 +01:00
Galaxy Buds: add multiple batteries support
This commit is contained in:
parent
788f4d8ae0
commit
80207b34bc
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user