Detailed onscreen history logging

This commit is contained in:
Milos Kozak 2017-10-21 18:05:19 +02:00
parent dbf5a5e577
commit a8751bf35a
2 changed files with 52 additions and 8 deletions

View file

@ -10,15 +10,14 @@ import java.util.Date;
import java.util.GregorianCalendar; import java.util.GregorianCalendar;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.DetailedBolusInfo; import info.nightscout.androidaps.data.DetailedBolusInfo;
import info.nightscout.androidaps.db.DanaRHistoryRecord;
import info.nightscout.androidaps.db.ExtendedBolus; import info.nightscout.androidaps.db.ExtendedBolus;
import info.nightscout.androidaps.db.Source; import info.nightscout.androidaps.db.Source;
import info.nightscout.androidaps.db.TemporaryBasal; import info.nightscout.androidaps.db.TemporaryBasal;
import info.nightscout.androidaps.events.EventPumpStatusChanged;
import info.nightscout.androidaps.plugins.ConfigBuilder.DetailedBolusInfoStorage; import info.nightscout.androidaps.plugins.ConfigBuilder.DetailedBolusInfoStorage;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump; import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
import info.nightscout.androidaps.plugins.PumpDanaR.comm.RecordTypes;
import info.nightscout.androidaps.plugins.PumpDanaR.events.EventDanaRSyncStatus;
import info.nightscout.utils.DateUtil; import info.nightscout.utils.DateUtil;
public class DanaRS_Packet_APS_History_Events extends DanaRS_Packet { public class DanaRS_Packet_APS_History_Events extends DanaRS_Packet {
@ -32,11 +31,11 @@ public class DanaRS_Packet_APS_History_Events extends DanaRS_Packet {
private int sec = 0; private int sec = 0;
public boolean done; public boolean done;
public int totalCount; private int totalCount;
public static long lastEventTimeLoaded = 0; public static long lastEventTimeLoaded = 0;
public DanaRS_Packet_APS_History_Events() { DanaRS_Packet_APS_History_Events() {
super(); super();
opCode = BleCommandUtil.DANAR_PACKET__OPCODE__APS_HISTORY_EVENTS; opCode = BleCommandUtil.DANAR_PACKET__OPCODE__APS_HISTORY_EVENTS;
done = false; done = false;
@ -97,70 +96,87 @@ public class DanaRS_Packet_APS_History_Events extends DanaRS_Packet {
DetailedBolusInfo detailedBolusInfo = DetailedBolusInfoStorage.findDetailedBolusInfo(datetime.getTime()); DetailedBolusInfo detailedBolusInfo = DetailedBolusInfoStorage.findDetailedBolusInfo(datetime.getTime());
if (detailedBolusInfo == null) { if (detailedBolusInfo == null) {
log.debug("DetailedBolusInfo not found for " + datetime.toLocaleString()); log.debug("Detailed bolus info not found for " + datetime.toLocaleString());
detailedBolusInfo = new DetailedBolusInfo(); detailedBolusInfo = new DetailedBolusInfo();
} else {
log.debug("Detailed bolus info found: " + detailedBolusInfo);
} }
detailedBolusInfo.date = datetime.getTime(); detailedBolusInfo.date = datetime.getTime();
detailedBolusInfo.source = Source.PUMP; detailedBolusInfo.source = Source.PUMP;
detailedBolusInfo.pumpId = datetime.getTime(); detailedBolusInfo.pumpId = datetime.getTime();
String status;
switch (recordCode) { switch (recordCode) {
case DanaRPump.TEMPSTART: case DanaRPump.TEMPSTART:
log.debug("EVENT TEMPSTART (" + recordCode + ") " + datetime.toLocaleString() + " Ratio: " + param1 + "% Duration: " + param2 + "min"); log.debug("EVENT TEMPSTART (" + recordCode + ") " + datetime.toLocaleString() + " Ratio: " + param1 + "% Duration: " + param2 + "min");
temporaryBasal.percentRate = param1; temporaryBasal.percentRate = param1;
temporaryBasal.durationInMinutes = param2; temporaryBasal.durationInMinutes = param2;
MainApp.getConfigBuilder().addToHistoryTempBasal(temporaryBasal); MainApp.getConfigBuilder().addToHistoryTempBasal(temporaryBasal);
status = "TEMPSTART " + DateUtil.timeString(datetime);
break; break;
case DanaRPump.TEMPSTOP: case DanaRPump.TEMPSTOP:
log.debug("EVENT TEMPSTOP (" + recordCode + ") " + datetime.toLocaleString()); log.debug("EVENT TEMPSTOP (" + recordCode + ") " + datetime.toLocaleString());
MainApp.getConfigBuilder().addToHistoryTempBasal(temporaryBasal); MainApp.getConfigBuilder().addToHistoryTempBasal(temporaryBasal);
status = "TEMPSTOP " + DateUtil.timeString(datetime);
break; break;
case DanaRPump.EXTENDEDSTART: case DanaRPump.EXTENDEDSTART:
log.debug("EVENT EXTENDEDSTART (" + recordCode + ") " + datetime.toLocaleString() + " Amount: " + (param1 / 100d) + "U Duration: " + param2 + "min"); log.debug("EVENT EXTENDEDSTART (" + recordCode + ") " + datetime.toLocaleString() + " Amount: " + (param1 / 100d) + "U Duration: " + param2 + "min");
extendedBolus.insulin = param1 / 100d; extendedBolus.insulin = param1 / 100d;
extendedBolus.durationInMinutes = param2; extendedBolus.durationInMinutes = param2;
MainApp.getConfigBuilder().addToHistoryExtendedBolus(extendedBolus); MainApp.getConfigBuilder().addToHistoryExtendedBolus(extendedBolus);
status = "EXTENDEDSTART " + DateUtil.timeString(datetime);
break; break;
case DanaRPump.EXTENDEDSTOP: case DanaRPump.EXTENDEDSTOP:
log.debug("EVENT EXTENDEDSTOP (" + recordCode + ") " + datetime.toLocaleString() + " Delivered: " + (param1 / 100d) + "U RealDuration: " + param2 + "min"); log.debug("EVENT EXTENDEDSTOP (" + recordCode + ") " + datetime.toLocaleString() + " Delivered: " + (param1 / 100d) + "U RealDuration: " + param2 + "min");
MainApp.getConfigBuilder().addToHistoryExtendedBolus(extendedBolus); MainApp.getConfigBuilder().addToHistoryExtendedBolus(extendedBolus);
status = "EXTENDEDSTOP " + DateUtil.timeString(datetime);
break; break;
case DanaRPump.BOLUS: case DanaRPump.BOLUS:
detailedBolusInfo.insulin = param1 / 100d; detailedBolusInfo.insulin = param1 / 100d;
boolean newRecord = MainApp.getConfigBuilder().addToHistoryTreatment(detailedBolusInfo); boolean newRecord = MainApp.getConfigBuilder().addToHistoryTreatment(detailedBolusInfo);
log.debug((newRecord ? "**NEW** " : "") + "EVENT BOLUS (" + recordCode + ") " + datetime.toLocaleString() + " Bolus: " + (param1 / 100d) + "U Duration: " + param2 + "min"); log.debug((newRecord ? "**NEW** " : "") + "EVENT BOLUS (" + recordCode + ") " + datetime.toLocaleString() + " Bolus: " + (param1 / 100d) + "U Duration: " + param2 + "min");
DetailedBolusInfoStorage.remove(detailedBolusInfo.date); DetailedBolusInfoStorage.remove(detailedBolusInfo.date);
status = "BOLUS " + DateUtil.timeString(datetime);
break; break;
case DanaRPump.DUALBOLUS: case DanaRPump.DUALBOLUS:
detailedBolusInfo.insulin = param1 / 100d; detailedBolusInfo.insulin = param1 / 100d;
newRecord = MainApp.getConfigBuilder().addToHistoryTreatment(detailedBolusInfo); newRecord = MainApp.getConfigBuilder().addToHistoryTreatment(detailedBolusInfo);
log.debug((newRecord ? "**NEW** " : "") + "EVENT DUALBOLUS (" + recordCode + ") " + datetime.toLocaleString() + " Bolus: " + (param1 / 100d) + "U Duration: " + param2 + "min"); log.debug((newRecord ? "**NEW** " : "") + "EVENT DUALBOLUS (" + recordCode + ") " + datetime.toLocaleString() + " Bolus: " + (param1 / 100d) + "U Duration: " + param2 + "min");
DetailedBolusInfoStorage.remove(detailedBolusInfo.date); DetailedBolusInfoStorage.remove(detailedBolusInfo.date);
status = "DUALBOLUS " + DateUtil.timeString(datetime);
break; break;
case DanaRPump.DUALEXTENDEDSTART: case DanaRPump.DUALEXTENDEDSTART:
log.debug("EVENT DUALEXTENDEDSTART (" + recordCode + ") " + datetime.toLocaleString() + " Amount: " + (param1 / 100d) + "U Duration: " + param2 + "min"); log.debug("EVENT DUALEXTENDEDSTART (" + recordCode + ") " + datetime.toLocaleString() + " Amount: " + (param1 / 100d) + "U Duration: " + param2 + "min");
extendedBolus.insulin = param1 / 100d; extendedBolus.insulin = param1 / 100d;
extendedBolus.durationInMinutes = param2; extendedBolus.durationInMinutes = param2;
MainApp.getConfigBuilder().addToHistoryExtendedBolus(extendedBolus); MainApp.getConfigBuilder().addToHistoryExtendedBolus(extendedBolus);
status = "DUALEXTENDEDSTART " + DateUtil.timeString(datetime);
break; break;
case DanaRPump.DUALEXTENDEDSTOP: case DanaRPump.DUALEXTENDEDSTOP:
log.debug("EVENT DUALEXTENDEDSTOP (" + recordCode + ") " + datetime.toLocaleString() + " Delivered: " + (param1 / 100d) + "U RealDuration: " + param2 + "min"); log.debug("EVENT DUALEXTENDEDSTOP (" + recordCode + ") " + datetime.toLocaleString() + " Delivered: " + (param1 / 100d) + "U RealDuration: " + param2 + "min");
MainApp.getConfigBuilder().addToHistoryExtendedBolus(extendedBolus); MainApp.getConfigBuilder().addToHistoryExtendedBolus(extendedBolus);
status = "DUALEXTENDEDSTOP " + DateUtil.timeString(datetime);
break; break;
case DanaRPump.SUSPENDON: case DanaRPump.SUSPENDON:
log.debug("EVENT SUSPENDON (" + recordCode + ") " + datetime.toLocaleString()); log.debug("EVENT SUSPENDON (" + recordCode + ") " + datetime.toLocaleString());
status = "SUSPENDON " + DateUtil.timeString(datetime);
break; break;
case DanaRPump.SUSPENDOFF: case DanaRPump.SUSPENDOFF:
log.debug("EVENT SUSPENDOFF (" + recordCode + ") " + datetime.toLocaleString()); log.debug("EVENT SUSPENDOFF (" + recordCode + ") " + datetime.toLocaleString());
status = "SUSPENDOFF " + DateUtil.timeString(datetime);
break; break;
case DanaRPump.REFILL: case DanaRPump.REFILL:
log.debug("EVENT REFILL (" + recordCode + ") " + datetime.toLocaleString() + " Amount: " + param1 / 100d + "U"); log.debug("EVENT REFILL (" + recordCode + ") " + datetime.toLocaleString() + " Amount: " + param1 / 100d + "U");
status = "REFILL " + DateUtil.timeString(datetime);
break; break;
case DanaRPump.PRIME: case DanaRPump.PRIME:
log.debug("EVENT PRIME (" + recordCode + ") " + datetime.toLocaleString() + " Amount: " + param1 / 100d + "U"); log.debug("EVENT PRIME (" + recordCode + ") " + datetime.toLocaleString() + " Amount: " + param1 / 100d + "U");
status = "PRIME " + DateUtil.timeString(datetime);
break; break;
case DanaRPump.PROFILECHANGE: case DanaRPump.PROFILECHANGE:
log.debug("EVENT PROFILECHANGE (" + recordCode + ") " + datetime.toLocaleString() + " No: " + param1 + " CurrentRate: " + (param2 / 100d) + "U/h"); log.debug("EVENT PROFILECHANGE (" + recordCode + ") " + datetime.toLocaleString() + " No: " + param1 + " CurrentRate: " + (param2 / 100d) + "U/h");
status = "PROFILECHANGE " + DateUtil.timeString(datetime);
break; break;
case DanaRPump.CARBS: case DanaRPump.CARBS:
DetailedBolusInfo emptyCarbsInfo = new DetailedBolusInfo(); DetailedBolusInfo emptyCarbsInfo = new DetailedBolusInfo();
@ -170,17 +186,22 @@ public class DanaRS_Packet_APS_History_Events extends DanaRS_Packet {
emptyCarbsInfo.pumpId = datetime.getTime(); emptyCarbsInfo.pumpId = datetime.getTime();
newRecord = MainApp.getConfigBuilder().addToHistoryTreatment(emptyCarbsInfo); newRecord = MainApp.getConfigBuilder().addToHistoryTreatment(emptyCarbsInfo);
log.debug((newRecord ? "**NEW** " : "") + "EVENT CARBS (" + recordCode + ") " + datetime.toLocaleString() + " Carbs: " + param1 + "g"); log.debug((newRecord ? "**NEW** " : "") + "EVENT CARBS (" + recordCode + ") " + datetime.toLocaleString() + " Carbs: " + param1 + "g");
status = "CARBS " + DateUtil.timeString(datetime);
break; break;
case DanaRPump.PRIMECANNULA: case DanaRPump.PRIMECANNULA:
log.debug("EVENT PRIMECANNULA(" + recordCode + ") " + datetime.toLocaleString() + " Amount: " + param1 / 100d + "U"); log.debug("EVENT PRIMECANNULA(" + recordCode + ") " + datetime.toLocaleString() + " Amount: " + param1 / 100d + "U");
status = "PRIMECANNULA " + DateUtil.timeString(datetime);
break; break;
default: default:
log.debug("Event: " + recordCode + " " + datetime.toLocaleString() + " Param1: " + param1 + " Param2: " + param2); log.debug("Event: " + recordCode + " " + datetime.toLocaleString() + " Param1: " + param1 + " Param2: " + param2);
status = "UNKNOWN " + DateUtil.timeString(datetime);
break; break;
} }
if (datetime.getTime() > lastEventTimeLoaded) if (datetime.getTime() > lastEventTimeLoaded)
lastEventTimeLoaded = datetime.getTime(); lastEventTimeLoaded = datetime.getTime();
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.processinghistory) + ": " + status));
} }
@Override @Override

View file

@ -7,13 +7,16 @@ import java.util.Date;
import java.util.GregorianCalendar; import java.util.GregorianCalendar;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.DetailedBolusInfo; import info.nightscout.androidaps.data.DetailedBolusInfo;
import info.nightscout.androidaps.db.ExtendedBolus; import info.nightscout.androidaps.db.ExtendedBolus;
import info.nightscout.androidaps.db.Source; import info.nightscout.androidaps.db.Source;
import info.nightscout.androidaps.db.TemporaryBasal; import info.nightscout.androidaps.db.TemporaryBasal;
import info.nightscout.androidaps.events.EventPumpStatusChanged;
import info.nightscout.androidaps.plugins.ConfigBuilder.DetailedBolusInfoStorage; import info.nightscout.androidaps.plugins.ConfigBuilder.DetailedBolusInfoStorage;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump; import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MessageBase; import info.nightscout.androidaps.plugins.PumpDanaR.comm.MessageBase;
import info.nightscout.utils.DateUtil;
public class MsgHistoryEvents_v2 extends MessageBase { public class MsgHistoryEvents_v2 extends MessageBase {
private static Logger log = LoggerFactory.getLogger(MsgHistoryEvents_v2.class); private static Logger log = LoggerFactory.getLogger(MsgHistoryEvents_v2.class);
@ -65,70 +68,87 @@ public class MsgHistoryEvents_v2 extends MessageBase {
DetailedBolusInfo detailedBolusInfo = DetailedBolusInfoStorage.findDetailedBolusInfo(datetime.getTime()); DetailedBolusInfo detailedBolusInfo = DetailedBolusInfoStorage.findDetailedBolusInfo(datetime.getTime());
if (detailedBolusInfo == null) { if (detailedBolusInfo == null) {
log.debug("DetailedBolusInfo not found for " + datetime.toLocaleString()); log.debug("Detailed bolus info not found for " + datetime.toLocaleString());
detailedBolusInfo = new DetailedBolusInfo(); detailedBolusInfo = new DetailedBolusInfo();
} else {
log.debug("Detailed bolus info found: " + detailedBolusInfo);
} }
detailedBolusInfo.date = datetime.getTime(); detailedBolusInfo.date = datetime.getTime();
detailedBolusInfo.source = Source.PUMP; detailedBolusInfo.source = Source.PUMP;
detailedBolusInfo.pumpId = datetime.getTime(); detailedBolusInfo.pumpId = datetime.getTime();
String status = "";
switch (recordCode) { switch (recordCode) {
case DanaRPump.TEMPSTART: case DanaRPump.TEMPSTART:
log.debug("EVENT TEMPSTART (" + recordCode + ") " + datetime.toLocaleString() + " Ratio: " + param1 + "% Duration: " + param2 + "min"); log.debug("EVENT TEMPSTART (" + recordCode + ") " + datetime.toLocaleString() + " Ratio: " + param1 + "% Duration: " + param2 + "min");
temporaryBasal.percentRate = param1; temporaryBasal.percentRate = param1;
temporaryBasal.durationInMinutes = param2; temporaryBasal.durationInMinutes = param2;
MainApp.getConfigBuilder().addToHistoryTempBasal(temporaryBasal); MainApp.getConfigBuilder().addToHistoryTempBasal(temporaryBasal);
status = "TEMPSTART " + DateUtil.timeString(datetime);
break; break;
case DanaRPump.TEMPSTOP: case DanaRPump.TEMPSTOP:
log.debug("EVENT TEMPSTOP (" + recordCode + ") " + datetime.toLocaleString()); log.debug("EVENT TEMPSTOP (" + recordCode + ") " + datetime.toLocaleString());
MainApp.getConfigBuilder().addToHistoryTempBasal(temporaryBasal); MainApp.getConfigBuilder().addToHistoryTempBasal(temporaryBasal);
status = "TEMPSTOP " + DateUtil.timeString(datetime);
break; break;
case DanaRPump.EXTENDEDSTART: case DanaRPump.EXTENDEDSTART:
log.debug("EVENT EXTENDEDSTART (" + recordCode + ") " + datetime.toLocaleString() + " Amount: " + (param1 / 100d) + "U Duration: " + param2 + "min"); log.debug("EVENT EXTENDEDSTART (" + recordCode + ") " + datetime.toLocaleString() + " Amount: " + (param1 / 100d) + "U Duration: " + param2 + "min");
extendedBolus.insulin = param1 / 100d; extendedBolus.insulin = param1 / 100d;
extendedBolus.durationInMinutes = param2; extendedBolus.durationInMinutes = param2;
MainApp.getConfigBuilder().addToHistoryExtendedBolus(extendedBolus); MainApp.getConfigBuilder().addToHistoryExtendedBolus(extendedBolus);
status = "EXTENDEDSTART " + DateUtil.timeString(datetime);
break; break;
case DanaRPump.EXTENDEDSTOP: case DanaRPump.EXTENDEDSTOP:
log.debug("EVENT EXTENDEDSTOP (" + recordCode + ") " + datetime.toLocaleString() + " Delivered: " + (param1 / 100d) + "U RealDuration: " + param2 + "min"); log.debug("EVENT EXTENDEDSTOP (" + recordCode + ") " + datetime.toLocaleString() + " Delivered: " + (param1 / 100d) + "U RealDuration: " + param2 + "min");
MainApp.getConfigBuilder().addToHistoryExtendedBolus(extendedBolus); MainApp.getConfigBuilder().addToHistoryExtendedBolus(extendedBolus);
status = "EXTENDEDSTOP " + DateUtil.timeString(datetime);
break; break;
case DanaRPump.BOLUS: case DanaRPump.BOLUS:
detailedBolusInfo.insulin = param1 / 100d; detailedBolusInfo.insulin = param1 / 100d;
boolean newRecord = MainApp.getConfigBuilder().addToHistoryTreatment(detailedBolusInfo); boolean newRecord = MainApp.getConfigBuilder().addToHistoryTreatment(detailedBolusInfo);
log.debug((newRecord ? "**NEW** " : "") + "EVENT BOLUS (" + recordCode + ") " + datetime.toLocaleString() + " Bolus: " + (param1 / 100d) + "U Duration: " + param2 + "min"); log.debug((newRecord ? "**NEW** " : "") + "EVENT BOLUS (" + recordCode + ") " + datetime.toLocaleString() + " Bolus: " + (param1 / 100d) + "U Duration: " + param2 + "min");
DetailedBolusInfoStorage.remove(detailedBolusInfo.date); DetailedBolusInfoStorage.remove(detailedBolusInfo.date);
status = "BOLUS " + DateUtil.timeString(datetime);
break; break;
case DanaRPump.DUALBOLUS: case DanaRPump.DUALBOLUS:
detailedBolusInfo.insulin = param1 / 100d; detailedBolusInfo.insulin = param1 / 100d;
newRecord = MainApp.getConfigBuilder().addToHistoryTreatment(detailedBolusInfo); newRecord = MainApp.getConfigBuilder().addToHistoryTreatment(detailedBolusInfo);
log.debug((newRecord ? "**NEW** " : "") + "EVENT DUALBOLUS (" + recordCode + ") " + datetime.toLocaleString() + " Bolus: " + (param1 / 100d) + "U Duration: " + param2 + "min"); log.debug((newRecord ? "**NEW** " : "") + "EVENT DUALBOLUS (" + recordCode + ") " + datetime.toLocaleString() + " Bolus: " + (param1 / 100d) + "U Duration: " + param2 + "min");
DetailedBolusInfoStorage.remove(detailedBolusInfo.date); DetailedBolusInfoStorage.remove(detailedBolusInfo.date);
status = "DUALBOLUS " + DateUtil.timeString(datetime);
break; break;
case DanaRPump.DUALEXTENDEDSTART: case DanaRPump.DUALEXTENDEDSTART:
log.debug("EVENT DUALEXTENDEDSTART (" + recordCode + ") " + datetime.toLocaleString() + " Amount: " + (param1 / 100d) + "U Duration: " + param2 + "min"); log.debug("EVENT DUALEXTENDEDSTART (" + recordCode + ") " + datetime.toLocaleString() + " Amount: " + (param1 / 100d) + "U Duration: " + param2 + "min");
extendedBolus.insulin = param1 / 100d; extendedBolus.insulin = param1 / 100d;
extendedBolus.durationInMinutes = param2; extendedBolus.durationInMinutes = param2;
MainApp.getConfigBuilder().addToHistoryExtendedBolus(extendedBolus); MainApp.getConfigBuilder().addToHistoryExtendedBolus(extendedBolus);
status = "DUALEXTENDEDSTART " + DateUtil.timeString(datetime);
break; break;
case DanaRPump.DUALEXTENDEDSTOP: case DanaRPump.DUALEXTENDEDSTOP:
log.debug("EVENT DUALEXTENDEDSTOP (" + recordCode + ") " + datetime.toLocaleString() + " Delivered: " + (param1 / 100d) + "U RealDuration: " + param2 + "min"); log.debug("EVENT DUALEXTENDEDSTOP (" + recordCode + ") " + datetime.toLocaleString() + " Delivered: " + (param1 / 100d) + "U RealDuration: " + param2 + "min");
MainApp.getConfigBuilder().addToHistoryExtendedBolus(extendedBolus); MainApp.getConfigBuilder().addToHistoryExtendedBolus(extendedBolus);
status = "DUALEXTENDEDSTOP " + DateUtil.timeString(datetime);
break; break;
case DanaRPump.SUSPENDON: case DanaRPump.SUSPENDON:
log.debug("EVENT SUSPENDON (" + recordCode + ") " + datetime.toLocaleString()); log.debug("EVENT SUSPENDON (" + recordCode + ") " + datetime.toLocaleString());
status = "SUSPENDON " + DateUtil.timeString(datetime);
break; break;
case DanaRPump.SUSPENDOFF: case DanaRPump.SUSPENDOFF:
log.debug("EVENT SUSPENDOFF (" + recordCode + ") " + datetime.toLocaleString()); log.debug("EVENT SUSPENDOFF (" + recordCode + ") " + datetime.toLocaleString());
status = "SUSPENDOFF " + DateUtil.timeString(datetime);
break; break;
case DanaRPump.REFILL: case DanaRPump.REFILL:
log.debug("EVENT REFILL (" + recordCode + ") " + datetime.toLocaleString() + " Amount: " + param1 / 100d + "U"); log.debug("EVENT REFILL (" + recordCode + ") " + datetime.toLocaleString() + " Amount: " + param1 / 100d + "U");
status = "REFILL " + DateUtil.timeString(datetime);
break; break;
case DanaRPump.PRIME: case DanaRPump.PRIME:
log.debug("EVENT PRIME (" + recordCode + ") " + datetime.toLocaleString() + " Amount: " + param1 / 100d + "U"); log.debug("EVENT PRIME (" + recordCode + ") " + datetime.toLocaleString() + " Amount: " + param1 / 100d + "U");
status = "PRIME " + DateUtil.timeString(datetime);
break; break;
case DanaRPump.PROFILECHANGE: case DanaRPump.PROFILECHANGE:
log.debug("EVENT PROFILECHANGE (" + recordCode + ") " + datetime.toLocaleString() + " No: " + param1 + " CurrentRate: " + (param2 / 100d) + "U/h"); log.debug("EVENT PROFILECHANGE (" + recordCode + ") " + datetime.toLocaleString() + " No: " + param1 + " CurrentRate: " + (param2 / 100d) + "U/h");
status = "PROFILECHANGE " + DateUtil.timeString(datetime);
break; break;
case DanaRPump.CARBS: case DanaRPump.CARBS:
DetailedBolusInfo emptyCarbsInfo = new DetailedBolusInfo(); DetailedBolusInfo emptyCarbsInfo = new DetailedBolusInfo();
@ -138,14 +158,17 @@ public class MsgHistoryEvents_v2 extends MessageBase {
emptyCarbsInfo.pumpId = datetime.getTime(); emptyCarbsInfo.pumpId = datetime.getTime();
newRecord = MainApp.getConfigBuilder().addToHistoryTreatment(emptyCarbsInfo); newRecord = MainApp.getConfigBuilder().addToHistoryTreatment(emptyCarbsInfo);
log.debug((newRecord ? "**NEW** " : "") + "EVENT CARBS (" + recordCode + ") " + datetime.toLocaleString() + " Carbs: " + param1 + "g"); log.debug((newRecord ? "**NEW** " : "") + "EVENT CARBS (" + recordCode + ") " + datetime.toLocaleString() + " Carbs: " + param1 + "g");
status = "CARBS " + DateUtil.timeString(datetime);
break; break;
default: default:
log.debug("Event: " + recordCode + " " + datetime.toLocaleString() + " Param1: " + param1 + " Param2: " + param2); log.debug("Event: " + recordCode + " " + datetime.toLocaleString() + " Param1: " + param1 + " Param2: " + param2);
status = "UNKNOWN " + DateUtil.timeString(datetime);
break; break;
} }
if (datetime.getTime() > lastEventTimeLoaded) if (datetime.getTime() > lastEventTimeLoaded)
lastEventTimeLoaded = datetime.getTime(); lastEventTimeLoaded = datetime.getTime();
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.processinghistory) + ": " + status));
} }
} }