1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-29 05:16:51 +01:00

added battery level warning

This commit is contained in:
Daniel Dakhno 2019-12-31 15:51:52 +01:00
parent 19d68c62c6
commit 20cf15d91f
2 changed files with 13 additions and 21 deletions

View File

@ -88,11 +88,11 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
e.printStackTrace();
} // icons
// queueWrite(new NotificationFilterPutHRRequest(new NotificationHRConfiguration[]{
// new NotificationHRConfiguration("com.whatsapp", -1),
// new NotificationHRConfiguration("asdasdasdasdasd", -1),
// // new NotificationHRConfiguration("twitter", -1),
// }, this));
queueWrite(new NotificationFilterPutHRRequest(new NotificationHRConfiguration[]{
// new NotificationHRConfiguration("com.whatsapp", -1),
new NotificationHRConfiguration("generic", -1),
// new NotificationHRConfiguration("twitter", -1),
}, this));
// queueWrite(new PlayNotificationRequest("com.whatsapp", "WhatsAp", "wHATSaPP", this));
// queueWrite(new PlayNotificationRequest("twitterrrr", "Twitterr", "tWITTER", this));
@ -101,22 +101,7 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
setTime();
// overwriteButtons(null);
// negotiateSymmetricKey();
// queueWrite(
// new ConfigurationPutRequest(
// new nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil.configuration.ConfigurationPutRequest.CurrentStepCountConfigItem(99999),
// this
// )
// );
queueWrite(new MusicInfoSetRequest(
"This is an artist",
"Some stupid album",
"What the Track!",
this
));
overwriteButtons(null);
queueWrite(new SetDeviceStateRequest(GBDevice.State.INITIALIZED));
}

View File

@ -1,6 +1,8 @@
package nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil_hr.configuration;
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventBatteryInfo;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.BatteryState;
import nodomain.freeyourgadget.gadgetbridge.model.GenericItem;
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.QHybridSupport;
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.adapter.fossil_hr.FossilHRWatchAdapter;
@ -37,6 +39,11 @@ public class ConfigurationGetRequest extends FileEncryptedLookupAndGetRequest {
device.setBatteryLevel((short) ((ConfigurationPutRequest.BatteryConfigItem) item).getBatteryPercentage());
device.setBatteryVoltage(((ConfigurationPutRequest.BatteryConfigItem) item).getBatteryVoltage() / 1000f);
device.setBatteryThresholdPercent((short) 15);
GBDeviceEventBatteryInfo batteryInfo = new GBDeviceEventBatteryInfo();
batteryInfo.level = (short) ((ConfigurationPutRequest.BatteryConfigItem) item).getBatteryPercentage();
batteryInfo.state = BatteryState.BATTERY_NORMAL;
getAdapter().getDeviceSupport().handleGBDeviceEvent(batteryInfo);
}
}