@@ -0,0 +1,2029 @@
+package info.nightscout.androidaps.plugins.PumpInsight.history;%0A%0Aimport java.util.Date;%0A%0Aimport info.nightscout.androidaps.MainApp;%0Aimport info.nightscout.androidaps.data.DetailedBolusInfo;%0Aimport info.nightscout.androidaps.db.ExtendedBolus;%0Aimport info.nightscout.androidaps.db.Source;%0Aimport info.nightscout.androidaps.db.TemporaryBasal;%0A%0A/**%0A * Created by jamorham on 27/01/2018.%0A *%0A * Write to the History Log%0A *%0A */%0A%0Aclass HistoryLogAdapter %7B%0A%0A    void createTBRrecord(Date eventDate, int percent, int duration, long record_id) %7B%0A%0A        final TemporaryBasal temporaryBasal = new TemporaryBasal();%0A        temporaryBasal.date = eventDate.getTime();%0A        temporaryBasal.source = Source.PUMP;%0A        temporaryBasal.pumpId = record_id;%0A        temporaryBasal.percentRate = percent;%0A        temporaryBasal.durationInMinutes = duration;%0A%0A        MainApp.getConfigBuilder().addToHistoryTempBasal(temporaryBasal);%0A    %7D%0A%0A    void createExtendedBolusRecord(Date eventDate, double insulin, int durationInMinutes, long record_id) %7B%0A%0A        // TODO trap items below minimum period%0A%0A        final ExtendedBolus extendedBolus = new ExtendedBolus();%0A        extendedBolus.date = eventDate.getTime();%0A        extendedBolus.insulin = insulin;%0A        extendedBolus.durationInMinutes = durationInMinutes;%0A        extendedBolus.source = Source.PUMP;%0A        extendedBolus.pumpId = record_id;%0A%0A        MainApp.getConfigBuilder().addToHistoryExtendedBolus(extendedBolus);%0A    %7D%0A%0A    void createStandardBolusRecord(Date eventDate, double insulin, long record_id) %7B%0A%0A        //DetailedBolusInfo detailedBolusInfo = DetailedBolusInfoStorage.findDetailedBolusInfo(eventDate.getTime());%0A%0A        final DetailedBolusInfo detailedBolusInfo = new DetailedBolusInfo();%0A        detailedBolusInfo.date = eventDate.getTime();%0A        detailedBolusInfo.source = Source.PUMP;%0A        detailedBolusInfo.pumpId = record_id;%0A        detailedBolusInfo.insulin = insulin;%0A        MainApp.getConfigBuilder().addToHistoryTreatment(detailedBolusInfo);%0A    %7D%0A%7D%0A

Add Insight HistoryLogAdapter