diff --git a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/PluginsModule.kt b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/PluginsModule.kt index ed14d108c9..1e02c6100d 100644 --- a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/PluginsModule.kt +++ b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/PluginsModule.kt @@ -4,6 +4,9 @@ import dagger.Binds import dagger.Module import dagger.multibindings.IntKey import dagger.multibindings.IntoMap +import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin +import info.nightscout.androidaps.danaRv2.DanaRv2Plugin +import info.nightscout.androidaps.danar.DanaRPlugin import info.nightscout.androidaps.danars.DanaRSPlugin import info.nightscout.androidaps.interfaces.PluginBase import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin @@ -106,19 +109,19 @@ abstract class PluginsModule { @PumpDriver @IntoMap @IntKey(90) - abstract fun bindDanaRPlugin(plugin: info.nightscout.androidaps.danar.DanaRPlugin): PluginBase + abstract fun bindDanaRPlugin(plugin: DanaRPlugin): PluginBase @Binds @PumpDriver @IntoMap @IntKey(100) - abstract fun bindDanaRKoreanPlugin(plugin: info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin): PluginBase + abstract fun bindDanaRKoreanPlugin(plugin: DanaRKoreanPlugin): PluginBase @Binds @PumpDriver @IntoMap @IntKey(110) - abstract fun bindDanaRv2Plugin(plugin: info.nightscout.androidaps.danaRv2.DanaRv2Plugin): PluginBase + abstract fun bindDanaRv2Plugin(plugin: DanaRv2Plugin): PluginBase @Binds @PumpDriver diff --git a/danar/src/main/java/info/nightscout/androidaps/danaRKorean/services/DanaRKoreanExecutionService.java b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/services/DanaRKoreanExecutionService.java index 11edecc293..2bacae53cb 100644 --- a/danar/src/main/java/info/nightscout/androidaps/danaRKorean/services/DanaRKoreanExecutionService.java +++ b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/services/DanaRKoreanExecutionService.java @@ -259,7 +259,8 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService { if (!isConnected()) return false; if (BolusProgressDialog.stopPressed) return false; - mBolusingTreatment = t; + danaPump.setBolusingTreatment(t); + danaPump.setBolusDone(false); MsgBolusStart start = new MsgBolusStart(aapsLogger, constraintChecker, danaPump, amount); danaPump.setBolusStopped(false); danaPump.setBolusStopForced(false); @@ -288,7 +289,7 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService { } SystemClock.sleep(300); - mBolusingTreatment = null; + danaPump.setBolusingTreatment(null); commandQueue.readStatus("bolusOK", null); } diff --git a/danar/src/main/java/info/nightscout/androidaps/danaRv2/services/DanaRv2ExecutionService.java b/danar/src/main/java/info/nightscout/androidaps/danaRv2/services/DanaRv2ExecutionService.java index e28e2804ee..87d689530f 100644 --- a/danar/src/main/java/info/nightscout/androidaps/danaRv2/services/DanaRv2ExecutionService.java +++ b/danar/src/main/java/info/nightscout/androidaps/danaRv2/services/DanaRv2ExecutionService.java @@ -349,7 +349,8 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService { if (BolusProgressDialog.stopPressed) return false; rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.startingbolus))); - mBolusingTreatment = t; + danaPump.setBolusingTreatment(t); + danaPump.setBolusDone(false); final int preferencesSpeed = sp.getInt(R.string.key_danars_bolusspeed, 0); MessageBase start; if (preferencesSpeed == 0) @@ -392,7 +393,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService { bolusingEvent.setT(t); bolusingEvent.setPercent(99); - mBolusingTreatment = null; + danaPump.setBolusingTreatment(null); int speed = 12; switch (preferencesSpeed) { case 0: diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/services/AbstractDanaRExecutionService.java b/danar/src/main/java/info/nightscout/androidaps/danar/services/AbstractDanaRExecutionService.java index 63174d70c4..44f2950eb6 100644 --- a/danar/src/main/java/info/nightscout/androidaps/danar/services/AbstractDanaRExecutionService.java +++ b/danar/src/main/java/info/nightscout/androidaps/danar/services/AbstractDanaRExecutionService.java @@ -74,8 +74,6 @@ public abstract class AbstractDanaRExecutionService extends DaggerService { protected BluetoothSocket mRfcommSocket; protected BluetoothDevice mBTDevice; - protected Treatment mBolusingTreatment = null; - protected boolean mConnectionInProgress = false; protected boolean mHandshakeInProgress = false; @@ -212,7 +210,7 @@ public abstract class AbstractDanaRExecutionService extends DaggerService { } public void bolusStop() { - aapsLogger.debug(LTag.PUMP, "bolusStop >>>>> @ " + (mBolusingTreatment == null ? "" : mBolusingTreatment.insulin)); + aapsLogger.debug(LTag.PUMP, "bolusStop >>>>> @ " + (danaPump.getBolusingTreatment() == null ? "" : danaPump.getBolusingTreatment().insulin)); MsgBolusStop stop = new MsgBolusStop(aapsLogger, rxBus, resourceHelper, danaPump); danaPump.setBolusStopForced(true); if (isConnected()) { diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/services/DanaRExecutionService.java b/danar/src/main/java/info/nightscout/androidaps/danar/services/DanaRExecutionService.java index e5a8dd7644..fa95da936c 100644 --- a/danar/src/main/java/info/nightscout/androidaps/danar/services/DanaRExecutionService.java +++ b/danar/src/main/java/info/nightscout/androidaps/danar/services/DanaRExecutionService.java @@ -270,7 +270,8 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService { if (!isConnected()) return false; if (BolusProgressDialog.stopPressed) return false; - mBolusingTreatment = t; + danaPump.setBolusingTreatment(t); + danaPump.setBolusDone(false); int preferencesSpeed = sp.getInt(R.string.key_danars_bolusspeed, 0); MessageBase start; if (preferencesSpeed == 0) @@ -309,7 +310,7 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService { bolusingEvent.setT(t); bolusingEvent.setPercent(99); - mBolusingTreatment = null; + danaPump.setBolusingTreatment(null); int speed = 12; switch (preferencesSpeed) { diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/services/DanaRSService.kt b/danars/src/main/java/info/nightscout/androidaps/danars/services/DanaRSService.kt index b062c0d21a..ad5023a849 100644 --- a/danars/src/main/java/info/nightscout/androidaps/danars/services/DanaRSService.kt +++ b/danars/src/main/java/info/nightscout/androidaps/danars/services/DanaRSService.kt @@ -10,7 +10,10 @@ import dagger.android.DaggerService import dagger.android.HasAndroidInjector import info.nightscout.androidaps.Constants import info.nightscout.androidaps.activities.ErrorHelperActivity +import info.nightscout.androidaps.dana.DanaPump +import info.nightscout.androidaps.danars.DanaRSPlugin import info.nightscout.androidaps.danars.R +import info.nightscout.androidaps.danars.comm.* import info.nightscout.androidaps.data.Profile import info.nightscout.androidaps.data.PumpEnactResult import info.nightscout.androidaps.db.Treatment @@ -31,9 +34,6 @@ import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotifi import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress import info.nightscout.androidaps.plugins.general.overview.notifications.Notification import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage -import info.nightscout.androidaps.dana.DanaPump -import info.nightscout.androidaps.danars.DanaRSPlugin -import info.nightscout.androidaps.danars.comm.* import info.nightscout.androidaps.queue.Callback import info.nightscout.androidaps.queue.commands.Command import info.nightscout.androidaps.utils.DateUtil @@ -69,7 +69,6 @@ class DanaRSService : DaggerService() { private val disposable = CompositeDisposable() private val mBinder: IBinder = LocalBinder() - private var bolusingTreatment: Treatment? = null private var lastHistoryFetched: Long = 0 private var lastApproachingDailyLimit: Long = 0 @@ -236,8 +235,8 @@ class DanaRSService : DaggerService() { if (!isConnected) return false if (BolusProgressDialog.stopPressed) return false rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.startingbolus))) - bolusingTreatment = t val preferencesSpeed = sp.getInt(R.string.key_danars_bolusspeed, 0) + danaPump.bolusDone = false danaPump.bolusingTreatment = t danaPump.bolusAmountToBeDelivered = insulin danaPump.bolusStopped = false @@ -247,7 +246,7 @@ class DanaRSService : DaggerService() { if (carbs > 0) { // MsgSetCarbsEntry msg = new MsgSetCarbsEntry(carbTime, carbs); #### // sendMessage(msg); - val msgSetHistoryEntryV2 = DanaRS_Packet_APS_Set_Event_History(injector, info.nightscout.androidaps.dana.DanaPump.CARBS, carbTime, carbs, 0) + val msgSetHistoryEntryV2 = DanaRS_Packet_APS_Set_Event_History(injector, DanaPump.CARBS, carbTime, carbs, 0) sendMessage(msgSetHistoryEntryV2) lastHistoryFetched = min(lastHistoryFetched, carbTime - T.mins(1).msecs()) } @@ -271,7 +270,7 @@ class DanaRSService : DaggerService() { val bolusingEvent = EventOverviewBolusProgress bolusingEvent.t = t bolusingEvent.percent = 99 - bolusingTreatment = null + danaPump.bolusingTreatment = null var speed = 12 when (preferencesSpeed) { 0 -> speed = 12 @@ -300,7 +299,7 @@ class DanaRSService : DaggerService() { } fun bolusStop() { - aapsLogger.debug(LTag.PUMPCOMM, "bolusStop >>>>> @ " + if (bolusingTreatment == null) "" else bolusingTreatment?.insulin) + aapsLogger.debug(LTag.PUMPCOMM, "bolusStop >>>>> @ " + if (danaPump.bolusingTreatment == null) "" else danaPump.bolusingTreatment?.insulin) val stop = DanaRS_Packet_Bolus_Set_Step_Bolus_Stop(injector) danaPump.bolusStopForced = true if (isConnected) { diff --git a/settings.gradle b/settings.gradle index 15de48ff31..661d9ef66a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,3 +1 @@ -include ':app', ':wear', ':core', ':danars' -include ':dana' -include ':danar' +include ':app', ':wear', ':core', ':dana', ':danar', ':danars'