uploader battery fix

This commit is contained in:
Milos Kozak 2017-02-21 14:12:28 +01:00
parent 4b6276c0b1
commit efc1988374
2 changed files with 3 additions and 5 deletions

View file

@ -960,9 +960,7 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
}
int batteryLevel = BatteryLevel.getBatteryLevel();
JSONObject uploaderBattery = new JSONObject();
uploaderBattery.put("uploaderBattery", batteryLevel);
deviceStatus.uploaderBattery = uploaderBattery;
deviceStatus.uploaderBattery = batteryLevel;
deviceStatus.created_at = DateUtil.toISOString(new Date());
deviceStatus.sendToNSClient();

View file

@ -378,7 +378,7 @@ public class DeviceStatus {
public JSONObject enacted = null;
public JSONObject suggested = null;
public JSONObject iob = null;
public JSONObject uploaderBattery = null;
public int uploaderBattery = 0;
public String created_at = null;
public JSONObject mongoRecord () {
@ -392,9 +392,9 @@ public class DeviceStatus {
if (enacted != null) openaps.put("enacted", enacted);
if (suggested != null) openaps.put("suggested", suggested);
if (iob != null) openaps.put("iob", iob);
if (uploaderBattery != null) openaps.put("uploaderBattery", uploaderBattery);
record.put("openaps", openaps);
}
if (uploaderBattery != 0) record.put("uploaderBattery", uploaderBattery);
if (created_at != null) record.put("created_at" , created_at);
} catch (JSONException e) {
e.printStackTrace();