From e5be6b35b9418899ff8d22455bf67c9918c4e130 Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Thu, 1 Apr 2021 12:43:56 +0200 Subject: [PATCH 1/2] Iterate on PumpInterface/PumpSync documentation. --- .../androidaps/interfaces/PumpInterface.kt | 3 +++ .../nightscout/androidaps/interfaces/PumpSync.kt | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/PumpInterface.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/PumpInterface.kt index 602acf6bba..43802833c5 100644 --- a/core/src/main/java/info/nightscout/androidaps/interfaces/PumpInterface.kt +++ b/core/src/main/java/info/nightscout/androidaps/interfaces/PumpInterface.kt @@ -12,6 +12,9 @@ import info.nightscout.androidaps.utils.TimeChangeType import org.json.JSONObject /** + * This interface defines the communication from AAPS-core to pump drivers. + * Pump drivers communicate data changes back to AAPS-core using {@link info.nightscout.androidaps.interfaces.PumpSync}. + * * Created by mike on 04.06.2016. */ interface PumpInterface { diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/PumpSync.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/PumpSync.kt index a94d82ac28..c9f984a820 100644 --- a/core/src/main/java/info/nightscout/androidaps/interfaces/PumpSync.kt +++ b/core/src/main/java/info/nightscout/androidaps/interfaces/PumpSync.kt @@ -3,6 +3,20 @@ package info.nightscout.androidaps.interfaces import info.nightscout.androidaps.data.DetailedBolusInfo import info.nightscout.androidaps.plugins.pump.common.defs.PumpType +/** + * This interface allows pump drivers to push data changes (creation and update of treatments) back to AAPS-core. + * + * Intended use cases for handling bolus treatments: + * + * - for pumps that have a reliable history that can be read and which therefore issue a bolus on the pump, + * read the history back and add new bolus entries on the pump, the method [syncBolusWithPumpId] + * are used to inform AAPS-core of a new bolus. + * - for pumps that don't support history or take rather long to complete a bolus, the methods + * [addBolusWithTempId] and [syncBolusWithTempId] provide a mechanism to notify AAPS-core of a started + * bolus, so AAPS-core can operate under the assumption the bolus will be delivered and effect IOB until delivery + * completed. Upon completion, the pump driver will call the second method to turn a temporary bolus into a finished + * bolus. + */ interface PumpSync { /** * Create bolus with temporary id From 808d3a5a5dca14da8c873ce679c6468cdf484041 Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Thu, 1 Apr 2021 12:51:07 +0200 Subject: [PATCH 2/2] Mention VirtualPumpPlugin as an example how to push data to AAPS-core. --- .../main/java/info/nightscout/androidaps/interfaces/PumpSync.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/PumpSync.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/PumpSync.kt index c9f984a820..c76312df87 100644 --- a/core/src/main/java/info/nightscout/androidaps/interfaces/PumpSync.kt +++ b/core/src/main/java/info/nightscout/androidaps/interfaces/PumpSync.kt @@ -11,6 +11,8 @@ import info.nightscout.androidaps.plugins.pump.common.defs.PumpType * - for pumps that have a reliable history that can be read and which therefore issue a bolus on the pump, * read the history back and add new bolus entries on the pump, the method [syncBolusWithPumpId] * are used to inform AAPS-core of a new bolus. + * [VirtualPumpPlugin](info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin) is a pump driver that + * takes this approach. * - for pumps that don't support history or take rather long to complete a bolus, the methods * [addBolusWithTempId] and [syncBolusWithTempId] provide a mechanism to notify AAPS-core of a started * bolus, so AAPS-core can operate under the assumption the bolus will be delivered and effect IOB until delivery