restrict aproaching daily limit to once every 30 minutes R
This commit is contained in:
parent
70b2b1502f
commit
b43eff8e55
2 changed files with 10 additions and 5 deletions
|
@ -65,7 +65,10 @@ public abstract class AbstractDanaRExecutionService extends Service {
|
||||||
|
|
||||||
protected final UUID SPP_UUID = UUID.fromString("00001101-0000-1000-8000-00805f9b34fb");
|
protected final UUID SPP_UUID = UUID.fromString("00001101-0000-1000-8000-00805f9b34fb");
|
||||||
|
|
||||||
protected long lastWrongPumpPassword;
|
protected long lastWrongPumpPassword = 0;
|
||||||
|
|
||||||
|
protected long lastApproachingDailyLimit = 0;
|
||||||
|
|
||||||
|
|
||||||
public abstract boolean updateBasalsInPump(final Profile profile);
|
public abstract boolean updateBasalsInPump(final Profile profile);
|
||||||
|
|
||||||
|
|
|
@ -196,9 +196,11 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService{
|
||||||
NSUpload.uploadDeviceStatus();
|
NSUpload.uploadDeviceStatus();
|
||||||
if (mDanaRPump.dailyTotalUnits > mDanaRPump.maxDailyTotalUnits * Constants.dailyLimitWarning) {
|
if (mDanaRPump.dailyTotalUnits > mDanaRPump.maxDailyTotalUnits * Constants.dailyLimitWarning) {
|
||||||
log.debug("Approaching daily limit: " + mDanaRPump.dailyTotalUnits + "/" + mDanaRPump.maxDailyTotalUnits);
|
log.debug("Approaching daily limit: " + mDanaRPump.dailyTotalUnits + "/" + mDanaRPump.maxDailyTotalUnits);
|
||||||
Notification reportFail = new Notification(Notification.APPROACHING_DAILY_LIMIT, MainApp.gs(R.string.approachingdailylimit), Notification.URGENT);
|
if(System.currentTimeMillis() > lastApproachingDailyLimit + 30 * 60 * 1000) {
|
||||||
MainApp.bus().post(new EventNewNotification(reportFail));
|
Notification reportFail = new Notification(Notification.APPROACHING_DAILY_LIMIT, MainApp.gs(R.string.approachingdailylimit), Notification.URGENT);
|
||||||
NSUpload.uploadError(MainApp.gs(R.string.approachingdailylimit) + ": " + mDanaRPump.dailyTotalUnits + "/" + mDanaRPump.maxDailyTotalUnits + "U");
|
MainApp.bus().post(new EventNewNotification(reportFail));
|
||||||
|
NSUpload.uploadError(MainApp.gs(R.string.approachingdailylimit) + ": " + mDanaRPump.dailyTotalUnits + "/" + mDanaRPump.maxDailyTotalUnits + "U");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Unhandled exception", e);
|
log.error("Unhandled exception", e);
|
||||||
|
|
Loading…
Reference in a new issue