Skip to content
Snippets Groups Projects
Unverified Commit a76774c2 authored by Johannes Mockenhaupt's avatar Johannes Mockenhaupt
Browse files

Bugfix: fix more instances where sgvDate is desired.

parent c5528c8d
No related branches found
No related tags found
No related merge requests found
......@@ -112,6 +112,7 @@ public class MainActivity extends AppCompatActivity implements OnSharedPreferenc
* @param pumpStatusData
* @return timestamp
*/
// TODO remove code duplication; this method and MdtCnlIntentService.scheduleNextPoll
public static long getNextPoll(PumpStatusEvent pumpStatusData) {
long nextPoll = pumpStatusData.getSgvDate().getTime() + pumpStatusData.getPumpTimeOffset(),
now = System.currentTimeMillis(),
......
......@@ -229,7 +229,7 @@ public class MedtronicCnlIntentService extends IntentService {
if (pumpOffset > 0) {
offsetSign = "+";
}
sendStatus("SGV: " + MainActivity.strFormatSGV(pumpRecord.getSgv()) + " At: " + df.format(pumpRecord.getEventDate().getTime()) + " Pump: " + offsetSign + (pumpOffset / 1000L) + "sec"); //note: event time is currently stored with offset
sendStatus("SGV: " + MainActivity.strFormatSGV(pumpRecord.getSgv()) + " At: " + df.format(pumpRecord.getSgvDate().getTime()) + " Pump: " + offsetSign + (pumpOffset / 1000L) + "sec"); //note: event time is currently stored with offset
// Check if pump sent old event when new expected
if (pumpRecord != null &&
......
......@@ -71,6 +71,8 @@ public class EntriesSerializer implements JsonSerializer<PumpStatusEvent> {
}
}
// TODO currentnly unused, see info.nightscout.android.xdrip_plus.XDripPlusUploadIntentService.addSgvEntry()
// TODO also, proper method name
@Override
public JsonElement serialize(PumpStatusEvent src, Type typeOfSrc, JsonSerializationContext context) {
final JsonObject jsonObject = new JsonObject();
......@@ -78,7 +80,7 @@ public class EntriesSerializer implements JsonSerializer<PumpStatusEvent> {
jsonObject.addProperty("direction", getDirectionString(src.getCgmTrend()));
jsonObject.addProperty("device", src.getDeviceName());
jsonObject.addProperty("type", "sgv");
jsonObject.addProperty("date", src.getEventDate().getTime());
jsonObject.addProperty("date", src.getSgvDate().getTime());
jsonObject.addProperty("dateString", String.valueOf(src.getEventDate()));
return jsonObject;
......
......@@ -145,8 +145,8 @@ public class XDripPlusUploadIntentService extends IntentService {
json.put("direction", EntriesSerializer.getDirectionString(pumpRecord.getCgmTrend()));
json.put("device", pumpRecord.getDeviceName());
json.put("type", "sgv");
json.put("date", pumpRecord.getEventDate().getTime());
json.put("dateString", pumpRecord.getEventDate());
json.put("date", pumpRecord.getSgvDate().getTime());
json.put("dateString", pumpRecord.getSgvDate());
entriesArray.put(json);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment