restrict aproaching daily limit to once every 30 minutes R
This commit is contained in:
parent
70b2b1502f
commit
b43eff8e55
|
@ -64,8 +64,11 @@ public abstract class AbstractDanaRExecutionService extends Service {
|
|||
protected IBinder mBinder;
|
||||
|
||||
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);
|
||||
|
||||
|
|
|
@ -196,9 +196,11 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService{
|
|||
NSUpload.uploadDeviceStatus();
|
||||
if (mDanaRPump.dailyTotalUnits > mDanaRPump.maxDailyTotalUnits * Constants.dailyLimitWarning) {
|
||||
log.debug("Approaching daily limit: " + mDanaRPump.dailyTotalUnits + "/" + mDanaRPump.maxDailyTotalUnits);
|
||||
Notification reportFail = new Notification(Notification.APPROACHING_DAILY_LIMIT, MainApp.gs(R.string.approachingdailylimit), Notification.URGENT);
|
||||
MainApp.bus().post(new EventNewNotification(reportFail));
|
||||
NSUpload.uploadError(MainApp.gs(R.string.approachingdailylimit) + ": " + mDanaRPump.dailyTotalUnits + "/" + mDanaRPump.maxDailyTotalUnits + "U");
|
||||
if(System.currentTimeMillis() > lastApproachingDailyLimit + 30 * 60 * 1000) {
|
||||
Notification reportFail = new Notification(Notification.APPROACHING_DAILY_LIMIT, MainApp.gs(R.string.approachingdailylimit), Notification.URGENT);
|
||||
MainApp.bus().post(new EventNewNotification(reportFail));
|
||||
NSUpload.uploadError(MainApp.gs(R.string.approachingdailylimit) + ": " + mDanaRPump.dailyTotalUnits + "/" + mDanaRPump.maxDailyTotalUnits + "U");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("Unhandled exception", e);
|
||||
|
|
Loading…
Reference in a new issue