fix dana bolusing dialog

This commit is contained in:
Milos Kozak 2020-05-11 20:05:12 +02:00
parent 5368b5c109
commit 9e8124bc29
7 changed files with 24 additions and 23 deletions

View file

@ -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

View file

@ -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);
}

View file

@ -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:

View file

@ -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()) {

View file

@ -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) {

View file

@ -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) {

View file

@ -1,3 +1 @@
include ':app', ':wear', ':core', ':danars'
include ':dana'
include ':danar'
include ':app', ':wear', ':core', ':dana', ':danar', ':danars'