diff --git a/app/libs/sightparser-release.aar b/app/libs/sightparser-release.aar index 20de889426..4e474e608e 100644 Binary files a/app/libs/sightparser-release.aar and b/app/libs/sightparser-release.aar differ diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/InsightPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/InsightPlugin.java index f94ff4d3ff..21a59c326f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/InsightPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/InsightPlugin.java @@ -193,8 +193,8 @@ public class InsightPlugin extends PluginBase implements PumpInterface, Constrai @Override public PumpEnactResult loadTDDs() { - //TODO: read TDDs and store to DB PumpEnactResult result = new PumpEnactResult(); + result.success = true; return result; } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/history/HistoryIntentAdapter.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/history/HistoryIntentAdapter.java index 4295fadccb..23f5e5ac3c 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/history/HistoryIntentAdapter.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/history/HistoryIntentAdapter.java @@ -4,6 +4,10 @@ import android.content.Intent; import java.util.Date; +import android.database.DatabaseUtils; +import info.nightscout.androidaps.MainApp; +import info.nightscout.androidaps.db.DatabaseHelper; +import info.nightscout.androidaps.db.TDD; import sugar.free.sightparser.handling.HistoryBroadcast; import static info.nightscout.androidaps.plugins.PumpInsight.history.PumpIdCache.updatePumpSerialNumber; @@ -109,4 +113,12 @@ class HistoryIntentAdapter { log("ERROR, UNKNWON BOLUS TYPE: " + bolus_type); } } + + void processDailyTotalIntent(Intent intent) { + Date date = getDateExtra(intent, HistoryBroadcast.EXTRA_TOTAL_DATE); + double basal = intent.getDoubleExtra(HistoryBroadcast.EXTRA_BASAL_TOTAL, 0D); + double bolus = intent.getDoubleExtra(HistoryBroadcast.EXTRA_BOLUS_TOTAL, 0D); + TDD tdd = new TDD(date.getTime(), bolus, basal, bolus + basal); + MainApp.getDbHelper().createOrUpdateTDD(tdd); + } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/history/HistoryReceiver.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/history/HistoryReceiver.java index cad58963b4..0523eddc6e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/history/HistoryReceiver.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/history/HistoryReceiver.java @@ -11,13 +11,7 @@ import info.nightscout.androidaps.R; import static info.nightscout.androidaps.plugins.PumpInsight.history.HistoryReceiver.Status.BUSY; import static info.nightscout.androidaps.plugins.PumpInsight.history.HistoryReceiver.Status.SYNCED; import static info.nightscout.androidaps.plugins.PumpInsight.history.HistoryReceiver.Status.SYNCING; -import static sugar.free.sightparser.handling.HistoryBroadcast.ACTION_BOLUS_DELIVERED; -import static sugar.free.sightparser.handling.HistoryBroadcast.ACTION_BOLUS_PROGRAMMED; -import static sugar.free.sightparser.handling.HistoryBroadcast.ACTION_END_OF_TBR; -import static sugar.free.sightparser.handling.HistoryBroadcast.ACTION_PUMP_STATUS_CHANGED; -import static sugar.free.sightparser.handling.HistoryBroadcast.ACTION_STILL_SYNCING; -import static sugar.free.sightparser.handling.HistoryBroadcast.ACTION_SYNC_FINISHED; -import static sugar.free.sightparser.handling.HistoryBroadcast.ACTION_SYNC_STARTED; +import static sugar.free.sightparser.handling.HistoryBroadcast.*; /** * Created by jamorham on 27/01/2018. @@ -45,6 +39,7 @@ public class HistoryReceiver { filter.addAction(ACTION_BOLUS_PROGRAMMED); filter.addAction(ACTION_BOLUS_DELIVERED); filter.addAction(ACTION_END_OF_TBR); + filter.addAction(ACTION_DAILY_TOTAL); filter.addAction(ACTION_SYNC_STARTED); filter.addAction(ACTION_STILL_SYNCING); filter.addAction(ACTION_SYNC_FINISHED); @@ -95,6 +90,9 @@ public class HistoryReceiver { case ACTION_END_OF_TBR: intentAdapter.processTBRIntent(intent); break; + case ACTION_DAILY_TOTAL: + intentAdapter.processDailyTotalIntent(intent); + break; } } };