adjust devicestatus upload

This commit is contained in:
Milos Kozak 2017-02-19 20:41:20 +01:00
parent 5f4eb1e4c4
commit d030427b0f

View file

@ -482,7 +482,7 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
carbs = applyCarbsConstraints(carbs); carbs = applyCarbsConstraints(carbs);
BolusProgressDialog bolusProgressDialog = null; BolusProgressDialog bolusProgressDialog = null;
if (context != null ) { if (context != null) {
bolusProgressDialog = new BolusProgressDialog(); bolusProgressDialog = new BolusProgressDialog();
bolusProgressDialog.setInsulin(insulin); bolusProgressDialog.setInsulin(insulin);
bolusProgressDialog.show(((AppCompatActivity) context).getSupportFragmentManager(), "BolusProgress"); bolusProgressDialog.show(((AppCompatActivity) context).getSupportFragmentManager(), "BolusProgress");
@ -966,6 +966,8 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
requested.put("temp", "absolute"); requested.put("temp", "absolute");
deviceStatus.enacted.put("requested", requested); deviceStatus.enacted.put("requested", requested);
} }
} else {
log.debug("OpenAPS data too old to upload");
} }
if (activePump != null) { if (activePump != null) {
deviceStatus.device = "openaps://" + deviceID(); deviceStatus.device = "openaps://" + deviceID();
@ -973,11 +975,9 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
if (pumpstatus != null) { if (pumpstatus != null) {
deviceStatus.pump = getJSONStatus(); deviceStatus.pump = getJSONStatus();
} }
deviceStatus.created_at = DateUtil.toISOString(new Date());
deviceStatus.sendToNSClient();
} }
deviceStatus.created_at = DateUtil.toISOString(new Date());
deviceStatus.sendToNSClient();
} catch (JSONException e) { } catch (JSONException e) {
e.printStackTrace(); e.printStackTrace();
} }