do not postpone status upload
This commit is contained in:
parent
2465ed2985
commit
a508b0bbc5
5 changed files with 5 additions and 29 deletions
|
@ -81,9 +81,6 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
|||
|
||||
static ArrayList<PluginBase> pluginList;
|
||||
|
||||
private static final ScheduledExecutorService worker = Executors.newSingleThreadScheduledExecutor();
|
||||
private static ScheduledFuture<?> scheduledPost = null;
|
||||
|
||||
PowerManager.WakeLock mWakeLock;
|
||||
|
||||
public ConfigBuilderPlugin() {
|
||||
|
@ -815,11 +812,6 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
|||
return maxIobAfterConstrain;
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventNewBG ev) {
|
||||
uploadDeviceStatus(120);
|
||||
}
|
||||
|
||||
public void uploadTempBasalStartAbsolute(Double absolute, double durationInMinutes) {
|
||||
try {
|
||||
Context context = MainApp.instance().getApplicationContext();
|
||||
|
@ -923,7 +915,7 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
|||
}
|
||||
}
|
||||
|
||||
public void doUploadDeviceStatus() {
|
||||
public void uploadDeviceStatus() {
|
||||
DeviceStatus deviceStatus = new DeviceStatus();
|
||||
try {
|
||||
LoopPlugin.LastRun lastRun = LoopPlugin.lastRun;
|
||||
|
@ -981,22 +973,6 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
|||
}
|
||||
}
|
||||
|
||||
static public void uploadDeviceStatus(int sec) {
|
||||
class PostRunnable implements Runnable {
|
||||
public void run() {
|
||||
MainApp.getConfigBuilder().doUploadDeviceStatus();
|
||||
scheduledPost = null;
|
||||
}
|
||||
}
|
||||
// prepare task for execution
|
||||
// cancel waiting task to prevent sending multiple posts
|
||||
if (scheduledPost != null)
|
||||
scheduledPost.cancel(false);
|
||||
Runnable task = new PostRunnable();
|
||||
scheduledPost = worker.schedule(task, sec, TimeUnit.SECONDS);
|
||||
log.debug("Scheduling devicestatus upload in " + sec + " sec");
|
||||
}
|
||||
|
||||
public void uploadBolusWizardRecord(Treatment t, double glucose, String glucoseType, int carbTime, JSONObject boluscalc) {
|
||||
JSONObject data = new JSONObject();
|
||||
try {
|
||||
|
|
|
@ -341,7 +341,7 @@ public class ExecutionService extends Service {
|
|||
danaRPump.lastConnection = now;
|
||||
MainApp.bus().post(new EventDanaRNewStatus());
|
||||
MainApp.bus().post(new EventInitializationChanged());
|
||||
MainApp.getConfigBuilder().uploadDeviceStatus(15);
|
||||
MainApp.getConfigBuilder().uploadDeviceStatus();
|
||||
if (danaRPump.dailyTotalUnits > danaRPump.maxDailyTotalUnits * Constants.dailyLimitWarning ) {
|
||||
log.debug("Approaching daily limit: " + danaRPump.dailyTotalUnits + "/" + danaRPump.maxDailyTotalUnits);
|
||||
Notification reportFail = new Notification(Notification.APPROACHING_DAILY_LIMIT, MainApp.sResources.getString(R.string.approachingdailylimit), Notification.URGENT);
|
||||
|
|
|
@ -332,7 +332,7 @@ public class ExecutionService extends Service {
|
|||
danaRKoreanPump.lastConnection = now;
|
||||
MainApp.bus().post(new EventDanaRNewStatus());
|
||||
MainApp.bus().post(new EventInitializationChanged());
|
||||
MainApp.getConfigBuilder().uploadDeviceStatus(15);
|
||||
MainApp.getConfigBuilder().uploadDeviceStatus();
|
||||
if (danaRKoreanPump.dailyTotalUnits > danaRKoreanPump.maxDailyTotalUnits * Constants.dailyLimitWarning ) {
|
||||
log.debug("Approaching daily limit: " + danaRKoreanPump.dailyTotalUnits + "/" + danaRKoreanPump.maxDailyTotalUnits);
|
||||
Notification reportFail = new Notification(Notification.APPROACHING_DAILY_LIMIT, MainApp.sResources.getString(R.string.approachingdailylimit), Notification.URGENT);
|
||||
|
|
|
@ -228,7 +228,7 @@ public class LoopPlugin implements PluginBase {
|
|||
}
|
||||
|
||||
MainApp.bus().post(new EventLoopUpdateGui());
|
||||
MainApp.getConfigBuilder().uploadDeviceStatus(60);
|
||||
MainApp.getConfigBuilder().uploadDeviceStatus();
|
||||
} finally {
|
||||
if (Config.logFunctionCalls)
|
||||
log.debug("invoke end");
|
||||
|
|
|
@ -272,7 +272,7 @@ public class OverviewFragment extends Fragment {
|
|||
finalLastRun.setByPump = applyResult;
|
||||
finalLastRun.lastEnact = new Date();
|
||||
finalLastRun.lastOpenModeAccept = new Date();
|
||||
MainApp.getConfigBuilder().uploadDeviceStatus(15);
|
||||
MainApp.getConfigBuilder().uploadDeviceStatus();
|
||||
ObjectivesPlugin objectivesPlugin = (ObjectivesPlugin) MainApp.getSpecificPlugin(ObjectivesPlugin.class);
|
||||
if (objectivesPlugin != null) {
|
||||
objectivesPlugin.manualEnacts++;
|
||||
|
|
Loading…
Reference in a new issue