do not postpone status upload
This commit is contained in:
parent
2465ed2985
commit
a508b0bbc5
|
@ -81,9 +81,6 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
||||||
|
|
||||||
static ArrayList<PluginBase> pluginList;
|
static ArrayList<PluginBase> pluginList;
|
||||||
|
|
||||||
private static final ScheduledExecutorService worker = Executors.newSingleThreadScheduledExecutor();
|
|
||||||
private static ScheduledFuture<?> scheduledPost = null;
|
|
||||||
|
|
||||||
PowerManager.WakeLock mWakeLock;
|
PowerManager.WakeLock mWakeLock;
|
||||||
|
|
||||||
public ConfigBuilderPlugin() {
|
public ConfigBuilderPlugin() {
|
||||||
|
@ -815,11 +812,6 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
||||||
return maxIobAfterConstrain;
|
return maxIobAfterConstrain;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
|
||||||
public void onStatusEvent(final EventNewBG ev) {
|
|
||||||
uploadDeviceStatus(120);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void uploadTempBasalStartAbsolute(Double absolute, double durationInMinutes) {
|
public void uploadTempBasalStartAbsolute(Double absolute, double durationInMinutes) {
|
||||||
try {
|
try {
|
||||||
Context context = MainApp.instance().getApplicationContext();
|
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();
|
DeviceStatus deviceStatus = new DeviceStatus();
|
||||||
try {
|
try {
|
||||||
LoopPlugin.LastRun lastRun = LoopPlugin.lastRun;
|
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) {
|
public void uploadBolusWizardRecord(Treatment t, double glucose, String glucoseType, int carbTime, JSONObject boluscalc) {
|
||||||
JSONObject data = new JSONObject();
|
JSONObject data = new JSONObject();
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -341,7 +341,7 @@ public class ExecutionService extends Service {
|
||||||
danaRPump.lastConnection = now;
|
danaRPump.lastConnection = now;
|
||||||
MainApp.bus().post(new EventDanaRNewStatus());
|
MainApp.bus().post(new EventDanaRNewStatus());
|
||||||
MainApp.bus().post(new EventInitializationChanged());
|
MainApp.bus().post(new EventInitializationChanged());
|
||||||
MainApp.getConfigBuilder().uploadDeviceStatus(15);
|
MainApp.getConfigBuilder().uploadDeviceStatus();
|
||||||
if (danaRPump.dailyTotalUnits > danaRPump.maxDailyTotalUnits * Constants.dailyLimitWarning ) {
|
if (danaRPump.dailyTotalUnits > danaRPump.maxDailyTotalUnits * Constants.dailyLimitWarning ) {
|
||||||
log.debug("Approaching daily limit: " + danaRPump.dailyTotalUnits + "/" + danaRPump.maxDailyTotalUnits);
|
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);
|
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;
|
danaRKoreanPump.lastConnection = now;
|
||||||
MainApp.bus().post(new EventDanaRNewStatus());
|
MainApp.bus().post(new EventDanaRNewStatus());
|
||||||
MainApp.bus().post(new EventInitializationChanged());
|
MainApp.bus().post(new EventInitializationChanged());
|
||||||
MainApp.getConfigBuilder().uploadDeviceStatus(15);
|
MainApp.getConfigBuilder().uploadDeviceStatus();
|
||||||
if (danaRKoreanPump.dailyTotalUnits > danaRKoreanPump.maxDailyTotalUnits * Constants.dailyLimitWarning ) {
|
if (danaRKoreanPump.dailyTotalUnits > danaRKoreanPump.maxDailyTotalUnits * Constants.dailyLimitWarning ) {
|
||||||
log.debug("Approaching daily limit: " + danaRKoreanPump.dailyTotalUnits + "/" + danaRKoreanPump.maxDailyTotalUnits);
|
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);
|
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.bus().post(new EventLoopUpdateGui());
|
||||||
MainApp.getConfigBuilder().uploadDeviceStatus(60);
|
MainApp.getConfigBuilder().uploadDeviceStatus();
|
||||||
} finally {
|
} finally {
|
||||||
if (Config.logFunctionCalls)
|
if (Config.logFunctionCalls)
|
||||||
log.debug("invoke end");
|
log.debug("invoke end");
|
||||||
|
|
|
@ -272,7 +272,7 @@ public class OverviewFragment extends Fragment {
|
||||||
finalLastRun.setByPump = applyResult;
|
finalLastRun.setByPump = applyResult;
|
||||||
finalLastRun.lastEnact = new Date();
|
finalLastRun.lastEnact = new Date();
|
||||||
finalLastRun.lastOpenModeAccept = new Date();
|
finalLastRun.lastOpenModeAccept = new Date();
|
||||||
MainApp.getConfigBuilder().uploadDeviceStatus(15);
|
MainApp.getConfigBuilder().uploadDeviceStatus();
|
||||||
ObjectivesPlugin objectivesPlugin = (ObjectivesPlugin) MainApp.getSpecificPlugin(ObjectivesPlugin.class);
|
ObjectivesPlugin objectivesPlugin = (ObjectivesPlugin) MainApp.getSpecificPlugin(ObjectivesPlugin.class);
|
||||||
if (objectivesPlugin != null) {
|
if (objectivesPlugin != null) {
|
||||||
objectivesPlugin.manualEnacts++;
|
objectivesPlugin.manualEnacts++;
|
||||||
|
|
Loading…
Reference in a new issue