Merge branch 'omnipod_eros_bart' of https://github.com/bartsopers/AndroidAPS into omnipod_eros_bart
This commit is contained in:
commit
6387799ba4
20 changed files with 336 additions and 150 deletions
|
@ -27,7 +27,7 @@ public abstract class PumpStatus {
|
||||||
|
|
||||||
// other pump settings
|
// other pump settings
|
||||||
public String activeProfileName = "0";
|
public String activeProfileName = "0";
|
||||||
public double reservoirRemainingUnits = 0d;
|
public double reservoirRemainingUnits = 0.0d;
|
||||||
public int reservoirFullUnits = 0;
|
public int reservoirFullUnits = 0;
|
||||||
public int batteryRemaining = 0; // percent, so 0-100
|
public int batteryRemaining = 0; // percent, so 0-100
|
||||||
public Double batteryVoltage = null;
|
public Double batteryVoltage = null;
|
||||||
|
|
|
@ -13,6 +13,7 @@ import java.util.Locale;
|
||||||
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.dialog.RefreshableInterface;
|
import info.nightscout.androidaps.plugins.pump.common.dialog.RefreshableInterface;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkFirmwareVersion;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkFirmwareVersion;
|
||||||
|
@ -22,6 +23,8 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.Riley
|
||||||
import info.nightscout.androidaps.plugins.pump.common.utils.StringUtil;
|
import info.nightscout.androidaps.plugins.pump.common.utils.StringUtil;
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus;
|
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus;
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil;
|
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.service.OmnipodPumpStatus;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by andy on 5/19/18.
|
* Created by andy on 5/19/18.
|
||||||
|
@ -44,6 +47,7 @@ public class RileyLinkStatusGeneral extends Fragment implements RefreshableInter
|
||||||
RileyLinkServiceData rileyLinkServiceData;
|
RileyLinkServiceData rileyLinkServiceData;
|
||||||
|
|
||||||
MedtronicPumpStatus medtronicPumpStatus;
|
MedtronicPumpStatus medtronicPumpStatus;
|
||||||
|
OmnipodPumpStatus omnipodPumpStatus;
|
||||||
boolean first = false;
|
boolean first = false;
|
||||||
|
|
||||||
|
|
||||||
|
@ -118,7 +122,8 @@ public class RileyLinkStatusGeneral extends Fragment implements RefreshableInter
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO add handling for Omnipod pump status
|
if (MedtronicUtil.isMedtronicPump()) {
|
||||||
|
|
||||||
this.medtronicPumpStatus = MedtronicUtil.getPumpStatus();
|
this.medtronicPumpStatus = MedtronicUtil.getPumpStatus();
|
||||||
|
|
||||||
if (medtronicPumpStatus != null) {
|
if (medtronicPumpStatus != null) {
|
||||||
|
@ -127,8 +132,6 @@ public class RileyLinkStatusGeneral extends Fragment implements RefreshableInter
|
||||||
this.serialNumber.setText(medtronicPumpStatus.serialNumber);
|
this.serialNumber.setText(medtronicPumpStatus.serialNumber);
|
||||||
this.pumpFrequency.setText(MainApp.gs(medtronicPumpStatus.pumpFrequency.equals("medtronic_pump_frequency_us_ca") ? R.string.medtronic_pump_frequency_us_ca : R.string.medtronic_pump_frequency_worldwide));
|
this.pumpFrequency.setText(MainApp.gs(medtronicPumpStatus.pumpFrequency.equals("medtronic_pump_frequency_us_ca") ? R.string.medtronic_pump_frequency_us_ca : R.string.medtronic_pump_frequency_worldwide));
|
||||||
|
|
||||||
// TODO extend when Omnipod used
|
|
||||||
|
|
||||||
if (MedtronicUtil.getMedtronicPumpModel() != null)
|
if (MedtronicUtil.getMedtronicPumpModel() != null)
|
||||||
this.connectedDevice.setText("Medtronic " + MedtronicUtil.getMedtronicPumpModel().getPumpModel());
|
this.connectedDevice.setText("Medtronic " + MedtronicUtil.getMedtronicPumpModel().getPumpModel());
|
||||||
else
|
else
|
||||||
|
@ -142,7 +145,36 @@ public class RileyLinkStatusGeneral extends Fragment implements RefreshableInter
|
||||||
this.lastDeviceContact.setText(StringUtil.toDateTimeString(new LocalDateTime(
|
this.lastDeviceContact.setText(StringUtil.toDateTimeString(new LocalDateTime(
|
||||||
medtronicPumpStatus.lastDataTime)));
|
medtronicPumpStatus.lastDataTime)));
|
||||||
else
|
else
|
||||||
this.lastDeviceContact.setText("Never");
|
this.lastDeviceContact.setText(MainApp.gs(R.string.common_never));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// TODO add handling for Omnipod Dash pump status
|
||||||
|
this.omnipodPumpStatus = OmnipodUtil.getPumpStatus();
|
||||||
|
|
||||||
|
if (omnipodPumpStatus != null) {
|
||||||
|
this.deviceType.setText(MainApp.gs(RileyLinkTargetDevice.Omnipod.getResourceId()));
|
||||||
|
this.deviceModel.setText(omnipodPumpStatus.pumpType== PumpType.Insulet_Omnipod ? "Eros" : "Dash");
|
||||||
|
this.pumpFrequency.setText(MainApp.gs(R.string.omnipod_frequency));
|
||||||
|
|
||||||
|
if (omnipodPumpStatus.podAvailable) {
|
||||||
|
this.serialNumber.setText(omnipodPumpStatus.podNumber);
|
||||||
|
this.connectedDevice.setText(omnipodPumpStatus.pumpType== PumpType.Insulet_Omnipod ? "Eros Pod" : "Dash Pod");
|
||||||
|
} else {
|
||||||
|
this.connectedDevice.setText("-");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rileyLinkServiceData.lastGoodFrequency != null)
|
||||||
|
this.lastUsedFrequency.setText(String.format(Locale.ENGLISH, "%.2f MHz",
|
||||||
|
rileyLinkServiceData.lastGoodFrequency));
|
||||||
|
|
||||||
|
if (omnipodPumpStatus.lastConnection != 0)
|
||||||
|
this.lastDeviceContact.setText(StringUtil.toDateTimeString(new LocalDateTime(
|
||||||
|
omnipodPumpStatus.lastDataTime)));
|
||||||
|
else
|
||||||
|
this.lastDeviceContact.setText(MainApp.gs(R.string.common_never));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,11 +8,13 @@ import org.slf4j.LoggerFactory;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkTargetFrequency;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkError;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkError;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.data.ServiceTransport;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.data.ServiceTransport;
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicConst;
|
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicConst;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil;
|
||||||
import info.nightscout.androidaps.utils.SP;
|
import info.nightscout.androidaps.utils.SP;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -56,6 +58,9 @@ public class InitializePumpManagerTask extends ServiceTask {
|
||||||
lastGoodFrequency = RileyLinkUtil.getRileyLinkServiceData().lastGoodFrequency;
|
lastGoodFrequency = RileyLinkUtil.getRileyLinkServiceData().lastGoodFrequency;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (MedtronicUtil.isMedtronicPump()) {
|
||||||
|
|
||||||
if ((lastGoodFrequency > 0.0d)
|
if ((lastGoodFrequency > 0.0d)
|
||||||
&& RileyLinkUtil.getRileyLinkCommunicationManager().isValidFrequency(lastGoodFrequency)) {
|
&& RileyLinkUtil.getRileyLinkCommunicationManager().isValidFrequency(lastGoodFrequency)) {
|
||||||
|
|
||||||
|
@ -79,5 +84,29 @@ public class InitializePumpManagerTask extends ServiceTask {
|
||||||
} else {
|
} else {
|
||||||
RileyLinkUtil.sendBroadcastMessage(RileyLinkConst.IPC.MSG_PUMP_tunePump);
|
RileyLinkUtil.sendBroadcastMessage(RileyLinkConst.IPC.MSG_PUMP_tunePump);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (!RileyLinkUtil.isSame(lastGoodFrequency, RileyLinkTargetFrequency.Omnipod.getScanFrequencies()[0])) {
|
||||||
|
lastGoodFrequency = RileyLinkTargetFrequency.Omnipod.getScanFrequencies()[0];
|
||||||
|
lastGoodFrequency = Math.round(lastGoodFrequency * 1000d) / 1000d;
|
||||||
|
|
||||||
|
RileyLinkUtil.getRileyLinkServiceData().lastGoodFrequency = lastGoodFrequency;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
RileyLinkUtil.setServiceState(RileyLinkServiceState.RileyLinkReady);
|
||||||
|
RileyLinkUtil.setRileyLinkTargetFrequency(RileyLinkTargetFrequency.Omnipod);
|
||||||
|
|
||||||
|
if (L.isEnabled(L.PUMPCOMM))
|
||||||
|
LOG.info("Setting radio frequency to {} MHz", lastGoodFrequency);
|
||||||
|
|
||||||
|
RileyLinkUtil.getRileyLinkCommunicationManager().setRadioFrequencyForPump(lastGoodFrequency);
|
||||||
|
|
||||||
|
|
||||||
|
LOG.error("TRYYYYYY TO CONNECT IF AVAILABLE");
|
||||||
|
|
||||||
|
RileyLinkUtil.setServiceState(RileyLinkServiceState.PumpConnectorReady);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,14 +28,14 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PumpEnactResult initPod(PodInitActionType podInitActionType, PodInitReceiver podInitReceiver) {
|
public PumpEnactResult initPod(PodInitActionType podInitActionType, PodInitReceiver podInitReceiver, Profile profile) {
|
||||||
if (PodInitActionType.PairAndPrimeWizardStep.equals(podInitActionType)) {
|
if (PodInitActionType.PairAndPrimeWizardStep.equals(podInitActionType)) {
|
||||||
PumpEnactResult result = delegate.pairAndPrime();
|
PumpEnactResult result = delegate.pairAndPrime();
|
||||||
podInitReceiver.returnInitTaskStatus(podInitActionType, result.success, (result.success ? null : result.comment));
|
podInitReceiver.returnInitTaskStatus(podInitActionType, result.success, (result.success ? null : result.comment));
|
||||||
return result;
|
return result;
|
||||||
} else if(PodInitActionType.FillCannulaWizardStep.equals(podInitActionType)) {
|
} else if (PodInitActionType.FillCannulaSetBasalProfileWizardStep.equals(podInitActionType)) {
|
||||||
// FIXME we need a basal profile here
|
// FIXME we need a basal profile here
|
||||||
PumpEnactResult result = delegate.insertCannula(null);
|
PumpEnactResult result = delegate.insertCannula(profile);
|
||||||
podInitReceiver.returnInitTaskStatus(podInitActionType, result.success, (result.success ? null : result.comment));
|
podInitReceiver.returnInitTaskStatus(podInitActionType, result.success, (result.success ? null : result.comment));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import com.squareup.otto.Subscribe
|
|
||||||
import info.nightscout.androidaps.MainApp
|
import info.nightscout.androidaps.MainApp
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
import info.nightscout.androidaps.events.EventExtendedBolusChange
|
import info.nightscout.androidaps.events.EventExtendedBolusChange
|
||||||
|
@ -47,6 +46,7 @@ import org.slf4j.LoggerFactory
|
||||||
class OmnipodFragment : Fragment() {
|
class OmnipodFragment : Fragment() {
|
||||||
private val log = LoggerFactory.getLogger(L.PUMP)
|
private val log = LoggerFactory.getLogger(L.PUMP)
|
||||||
private var disposable: CompositeDisposable = CompositeDisposable()
|
private var disposable: CompositeDisposable = CompositeDisposable()
|
||||||
|
private var podAvailable = false
|
||||||
|
|
||||||
operator fun CompositeDisposable.plusAssign(disposable: Disposable) {
|
operator fun CompositeDisposable.plusAssign(disposable: Disposable) {
|
||||||
add(disposable)
|
add(disposable)
|
||||||
|
@ -69,7 +69,7 @@ class OmnipodFragment : Fragment() {
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
|
||||||
omnipod_pod_status.setBackgroundColor(MainApp.gc(R.color.colorInitializingBorder))
|
//omnipod_pod_status.setBackgroundColor(MainApp.gc(R.color.colorInitializingBorder))
|
||||||
|
|
||||||
omnipod_rl_status.text = MainApp.gs(RileyLinkServiceState.NotStarted.getResourceId(RileyLinkTargetDevice.Omnipod))
|
omnipod_rl_status.text = MainApp.gs(RileyLinkServiceState.NotStarted.getResourceId(RileyLinkTargetDevice.Omnipod))
|
||||||
|
|
||||||
|
@ -121,7 +121,6 @@ class OmnipodFragment : Fragment() {
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
MainApp.bus().register(this)
|
|
||||||
loopHandler.postDelayed(refreshLoop, T.mins(1).msecs())
|
loopHandler.postDelayed(refreshLoop, T.mins(1).msecs())
|
||||||
disposable += RxBus
|
disposable += RxBus
|
||||||
.toObservable(EventOmnipodRefreshButtonState::class.java)
|
.toObservable(EventOmnipodRefreshButtonState::class.java)
|
||||||
|
@ -145,29 +144,28 @@ class OmnipodFragment : Fragment() {
|
||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
super.onPause()
|
super.onPause()
|
||||||
disposable.clear()
|
disposable.clear()
|
||||||
MainApp.bus().unregister(this)
|
|
||||||
loopHandler.removeCallbacks(refreshLoop)
|
loopHandler.removeCallbacks(refreshLoop)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
// @Subscribe
|
||||||
fun onStatusEvent(c: EventPumpStatusChanged) {
|
// fun onStatusEvent(c: EventPumpStatusChanged) {
|
||||||
activity?.runOnUiThread { updateGUI() }
|
// activity?.runOnUiThread { updateGUI() }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Subscribe
|
// @Subscribe
|
||||||
fun onStatusEvent(s: EventTempBasalChange) {
|
// fun onStatusEvent(s: EventTempBasalChange) {
|
||||||
activity?.runOnUiThread { updateGUI() }
|
// activity?.runOnUiThread { updateGUI() }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Subscribe
|
// @Subscribe
|
||||||
fun onStatusEvent(s: EventExtendedBolusChange) {
|
// fun onStatusEvent(s: EventExtendedBolusChange) {
|
||||||
activity?.runOnUiThread { updateGUI() }
|
// activity?.runOnUiThread { updateGUI() }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Subscribe
|
// @Subscribe
|
||||||
fun onStatusEvent(s: EventQueueChanged) {
|
// fun onStatusEvent(s: EventQueueChanged) {
|
||||||
activity?.runOnUiThread { updateGUI() }
|
// activity?.runOnUiThread { updateGUI() }
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Synchronized
|
@Synchronized
|
||||||
private fun setDeviceStatus() {
|
private fun setDeviceStatus() {
|
||||||
|
@ -202,9 +200,11 @@ class OmnipodFragment : Fragment() {
|
||||||
if (pumpStatus.podSessionState == null) {
|
if (pumpStatus.podSessionState == null) {
|
||||||
omnipod_pod_address.text = MainApp.gs(R.string.omnipod_pod_name_no_info)
|
omnipod_pod_address.text = MainApp.gs(R.string.omnipod_pod_name_no_info)
|
||||||
omnipod_pod_expiry.text = "-"
|
omnipod_pod_expiry.text = "-"
|
||||||
omnipod_pod_status.text = "{fa-bed} "
|
omnipod_pod_status.text = MainApp.gs(R.string.omnipod_pod_no_pod_connected)
|
||||||
|
pumpStatus.podAvailable = false
|
||||||
} else {
|
} else {
|
||||||
|
podAvailable = true
|
||||||
|
pumpStatus.podAvailable = true
|
||||||
omnipod_pod_address.text = pumpStatus.podSessionState.address.toString()
|
omnipod_pod_address.text = pumpStatus.podSessionState.address.toString()
|
||||||
omnipod_pod_expiry.text = pumpStatus.podSessionState.expiryDateAsString
|
omnipod_pod_expiry.text = pumpStatus.podSessionState.expiryDateAsString
|
||||||
|
|
||||||
|
@ -310,6 +310,7 @@ class OmnipodFragment : Fragment() {
|
||||||
|
|
||||||
setDeviceStatus()
|
setDeviceStatus()
|
||||||
|
|
||||||
|
if (podAvailable) {
|
||||||
// last connection
|
// last connection
|
||||||
if (pumpStatus.lastConnection != 0L) {
|
if (pumpStatus.lastConnection != 0L) {
|
||||||
val minAgo = DateUtil.minAgo(pumpStatus.lastConnection)
|
val minAgo = DateUtil.minAgo(pumpStatus.lastConnection)
|
||||||
|
@ -342,7 +343,7 @@ class OmnipodFragment : Fragment() {
|
||||||
// last bolus
|
// last bolus
|
||||||
val bolus = pumpStatus.lastBolusAmount
|
val bolus = pumpStatus.lastBolusAmount
|
||||||
val bolusTime = pumpStatus.lastBolusTime
|
val bolusTime = pumpStatus.lastBolusTime
|
||||||
if (bolus != null && bolusTime != null) {
|
if (bolus != null && bolusTime != null && podAvailable) {
|
||||||
val agoMsc = System.currentTimeMillis() - pumpStatus.lastBolusTime.time
|
val agoMsc = System.currentTimeMillis() - pumpStatus.lastBolusTime.time
|
||||||
val bolusMinAgo = agoMsc.toDouble() / 60.0 / 1000.0
|
val bolusMinAgo = agoMsc.toDouble() / 60.0 / 1000.0
|
||||||
val unit = MainApp.gs(R.string.insulin_unit_shortname)
|
val unit = MainApp.gs(R.string.insulin_unit_shortname)
|
||||||
|
@ -360,20 +361,35 @@ class OmnipodFragment : Fragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// base basal rate
|
// base basal rate
|
||||||
omnipod_basabasalrate.text = ("(" + pumpStatus.activeProfileName + ") "
|
|
||||||
+ MainApp.gs(R.string.pump_basebasalrate, plugin.baseBasalRate))
|
omnipod_basabasalrate.text = MainApp.gs(R.string.pump_basebasalrate, plugin.baseBasalRate)
|
||||||
|
|
||||||
omnipod_tempbasal.text = TreatmentsPlugin.getPlugin()
|
omnipod_tempbasal.text = TreatmentsPlugin.getPlugin()
|
||||||
.getTempBasalFromHistory(System.currentTimeMillis())?.toStringFull() ?: ""
|
.getTempBasalFromHistory(System.currentTimeMillis())?.toStringFull() ?: ""
|
||||||
|
|
||||||
// reservoir
|
// reservoir
|
||||||
if (RileyLinkUtil.isSame(pumpStatus.reservoirRemainingUnits, 0.0)) {
|
if (RileyLinkUtil.isSame(pumpStatus.reservoirRemainingUnits, 75.0)) {
|
||||||
omnipod_reservoir.text = MainApp.gs(R.string.omnipod_reservoir_over50)
|
omnipod_reservoir.text = MainApp.gs(R.string.omnipod_reservoir_over50)
|
||||||
} else {
|
} else {
|
||||||
omnipod_reservoir.text = MainApp.gs(R.string.omnipod_reservoir_left, pumpStatus.reservoirRemainingUnits)
|
omnipod_reservoir.text = MainApp.gs(R.string.omnipod_reservoir_left, pumpStatus.reservoirRemainingUnits)
|
||||||
}
|
}
|
||||||
SetWarnColor.setColorInverse(omnipod_reservoir, pumpStatus.reservoirRemainingUnits, 50.0, 20.0)
|
SetWarnColor.setColorInverse(omnipod_reservoir, pumpStatus.reservoirRemainingUnits, 50.0, 20.0)
|
||||||
|
|
||||||
|
} else {
|
||||||
|
omnipod_basabasalrate.text = ""
|
||||||
|
omnipod_reservoir.text = ""
|
||||||
|
omnipod_tempbasal.text = ""
|
||||||
|
omnipod_lastbolus.text = ""
|
||||||
|
omnipod_lastconnection.text = ""
|
||||||
|
omnipod_lastconnection.setTextColor(Color.WHITE)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
omnipod_errors.text = pumpStatus.errorInfo
|
omnipod_errors.text = pumpStatus.errorInfo
|
||||||
|
|
||||||
|
omnipod_pod_active_alerts_ack.isEnabled = pumpStatus.ackAlertsAvailable
|
||||||
|
|
||||||
|
omnipod_refresh.isEnabled = pumpStatus.podAvailable
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.DeactivatePod
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.GetPodInfoAction;
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.GetPodInfoAction;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.GetStatusAction;
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.GetStatusAction;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.InsertCannulaAction;
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.InsertCannulaAction;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.OmnipodAction;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.PairAction;
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.PairAction;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.PrimeAction;
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.PrimeAction;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.SetBasalScheduleAction;
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.SetBasalScheduleAction;
|
||||||
|
@ -345,4 +346,9 @@ public class OmnipodManager {
|
||||||
// TODO use string resource
|
// TODO use string resource
|
||||||
return new PumpEnactResult().success(false).enacted(false).comment("Pod should be initialized first");
|
return new PumpEnactResult().success(false).enacted(false).comment("Pod should be initialized first");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addToHistory(long requestTime, OmnipodAction omnipodAction, long responseTime) {
|
||||||
|
// TODO andy
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -43,6 +43,7 @@ import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ResetRileyLinkConfigurationTask;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ResetRileyLinkConfigurationTask;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ServiceTaskExecutor;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ServiceTaskExecutor;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicPumpValuesChanged;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.ui.OmnipodUIComm;
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.ui.OmnipodUIComm;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.ui.OmnipodUITask;
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.ui.OmnipodUITask;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommandType;
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommandType;
|
||||||
|
@ -51,14 +52,17 @@ import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCustomActionT
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodPodType;
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodPodType;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodPumpPluginInterface;
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodPumpPluginInterface;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodStatusRequest;
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodStatusRequest;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitActionType;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodSessionState;
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodSessionState;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodPumpValuesChanged;
|
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodPumpValuesChanged;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodRefreshButtonState;
|
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodRefreshButtonState;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.service.OmnipodPumpStatus;
|
import info.nightscout.androidaps.plugins.pump.omnipod.service.OmnipodPumpStatus;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.service.RileyLinkOmnipodService;
|
import info.nightscout.androidaps.plugins.pump.omnipod.service.RileyLinkOmnipodService;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.util.LogReceiver;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
|
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;
|
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;
|
||||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
|
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
|
||||||
|
import info.nightscout.androidaps.utils.OKDialog;
|
||||||
import info.nightscout.androidaps.utils.SP;
|
import info.nightscout.androidaps.utils.SP;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -109,10 +113,10 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
||||||
OmnipodUtil.setOmnipodPodType(OmnipodPodType.Eros);
|
OmnipodUtil.setOmnipodPodType(OmnipodPodType.Eros);
|
||||||
|
|
||||||
if (omnipodCommunicationManager == null) {
|
if (omnipodCommunicationManager == null) {
|
||||||
omnipodCommunicationManager = AapsOmnipodManager.getInstance();
|
//omnipodCommunicationManager = AapsOmnipodManager.getInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
omnipodUIComm = new OmnipodUIComm(omnipodCommunicationManager);
|
omnipodUIComm = new OmnipodUIComm(omnipodCommunicationManager, this, this.pumpStatusLocal);
|
||||||
|
|
||||||
OmnipodUtil.setPlugin(this);
|
OmnipodUtil.setPlugin(this);
|
||||||
|
|
||||||
|
@ -251,7 +255,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
||||||
|
|
||||||
if (isServiceSet()) {
|
if (isServiceSet()) {
|
||||||
|
|
||||||
if (isBusy)
|
if (isBusy || !pumpStatusLocal.podAvailable)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (busyTimestamps.size() > 0) {
|
if (busyTimestamps.size() > 0) {
|
||||||
|
@ -309,6 +313,11 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSuspended() {
|
||||||
|
return (pumpStatusLocal!=null && !pumpStatusLocal.podAvailable);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getPumpStatus() {
|
public void getPumpStatus() {
|
||||||
|
|
||||||
|
@ -419,7 +428,9 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
||||||
public boolean isThisProfileSet(Profile profile) {
|
public boolean isThisProfileSet(Profile profile) {
|
||||||
|
|
||||||
// TODO status was not yet read from pod
|
// TODO status was not yet read from pod
|
||||||
|
// TODO maybe not possible, need to see how we will handle that
|
||||||
if (currentProfile == null) {
|
if (currentProfile == null) {
|
||||||
|
this.currentProfile = profile;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -481,6 +492,12 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isFakingTempsByExtendedBoluses() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NonNull
|
@NonNull
|
||||||
protected PumpEnactResult deliverBolus(final DetailedBolusInfo detailedBolusInfo) {
|
protected PumpEnactResult deliverBolus(final DetailedBolusInfo detailedBolusInfo) {
|
||||||
|
@ -655,7 +672,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
||||||
|
|
||||||
protected void finishAction(String overviewKey) {
|
protected void finishAction(String overviewKey) {
|
||||||
if (overviewKey != null)
|
if (overviewKey != null)
|
||||||
MainApp.bus().post(new EventRefreshOverview(overviewKey));
|
RxBus.INSTANCE.send(new EventRefreshOverview(overviewKey));
|
||||||
|
|
||||||
triggerUIChange();
|
triggerUIChange();
|
||||||
|
|
||||||
|
@ -763,8 +780,11 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
||||||
private CustomAction customActionResetRLConfig = new CustomAction(
|
private CustomAction customActionResetRLConfig = new CustomAction(
|
||||||
R.string.medtronic_custom_action_reset_rileylink, OmnipodCustomActionType.ResetRileyLinkConfiguration, true);
|
R.string.medtronic_custom_action_reset_rileylink, OmnipodCustomActionType.ResetRileyLinkConfiguration, true);
|
||||||
|
|
||||||
protected CustomAction customActionInitPod = new CustomAction(
|
protected CustomAction customActionPairAndPrime = new CustomAction(
|
||||||
R.string.omnipod_cmd_init_pod, OmnipodCustomActionType.InitPod, true);
|
R.string.omnipod_cmd_init_pod, OmnipodCustomActionType.PairAndPrime, true);
|
||||||
|
|
||||||
|
protected CustomAction customActionFillCanullaSetBasalProfile = new CustomAction(
|
||||||
|
R.string.omnipod_cmd_init_pod, OmnipodCustomActionType.FillCanulaSetBasalProfile, false);
|
||||||
|
|
||||||
protected CustomAction customActionDeactivatePod = new CustomAction(
|
protected CustomAction customActionDeactivatePod = new CustomAction(
|
||||||
R.string.omnipod_cmd_deactivate_pod, OmnipodCustomActionType.DeactivatePod, false);
|
R.string.omnipod_cmd_deactivate_pod, OmnipodCustomActionType.DeactivatePod, false);
|
||||||
|
@ -779,7 +799,8 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
||||||
if (customActions == null) {
|
if (customActions == null) {
|
||||||
this.customActions = Arrays.asList(
|
this.customActions = Arrays.asList(
|
||||||
customActionResetRLConfig, //
|
customActionResetRLConfig, //
|
||||||
customActionInitPod, //
|
customActionPairAndPrime, //
|
||||||
|
customActionFillCanullaSetBasalProfile, //
|
||||||
customActionDeactivatePod, //
|
customActionDeactivatePod, //
|
||||||
customActionResetPod);
|
customActionResetPod);
|
||||||
}
|
}
|
||||||
|
@ -787,6 +808,9 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
||||||
return this.customActions;
|
return this.customActions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LogReceiver logReceiver = new LogReceiver();
|
||||||
|
|
||||||
// TODO we need to brainstorm how we want to do this -- Andy
|
// TODO we need to brainstorm how we want to do this -- Andy
|
||||||
@Override
|
@Override
|
||||||
public void executeCustomAction(CustomActionType customActionType) {
|
public void executeCustomAction(CustomActionType customActionType) {
|
||||||
|
@ -800,8 +824,18 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case InitPod: {
|
case PairAndPrime: {
|
||||||
omnipodUIComm.executeCommand(OmnipodCommandType.InitPod);
|
omnipodUIComm.executeCommand(OmnipodCommandType.PairAndPrimePod, PodInitActionType.PairAndPrimeWizardStep, logReceiver);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FillCanulaSetBasalProfile: {
|
||||||
|
if (this.currentProfile != null) {
|
||||||
|
omnipodUIComm.executeCommand(OmnipodCommandType.FillCanulaAndSetBasalProfile, PodInitActionType.FillCannulaSetBasalProfileWizardStep, logReceiver, this.currentProfile);
|
||||||
|
} else {
|
||||||
|
OKDialog.show(MainApp.instance().getApplicationContext(), MainApp.gs(R.string.combo_warning),
|
||||||
|
MainApp.gs(R.string.omnipod_error_operation_not_possible_no_profile), null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -835,11 +869,17 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
||||||
|
|
||||||
switch (customAction) {
|
switch (customAction) {
|
||||||
|
|
||||||
case InitPod: {
|
case PairAndPrime: {
|
||||||
this.customActionInitPod.setEnabled(isEnabled);
|
this.customActionPairAndPrime.setEnabled(isEnabled);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case FillCanulaSetBasalProfile: {
|
||||||
|
this.customActionFillCanullaSetBasalProfile.setEnabled(isEnabled);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
case DeactivatePod: {
|
case DeactivatePod: {
|
||||||
this.customActionDeactivatePod.setEnabled(isEnabled);
|
this.customActionDeactivatePod.setEnabled(isEnabled);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,10 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodPumpPlugin;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommunicationManagerInterface;
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommunicationManagerInterface;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommandType;
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommandType;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.service.OmnipodPumpStatus;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;
|
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,15 +18,16 @@ public class OmnipodUIComm {
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(L.PUMP);
|
private static final Logger LOG = LoggerFactory.getLogger(L.PUMP);
|
||||||
|
|
||||||
OmnipodCommunicationManagerInterface ocmInstance = null;
|
OmnipodCommunicationManagerInterface ocmInstance = null;
|
||||||
OmnipodUIPostprocessor uiPostprocessor = new OmnipodUIPostprocessor();
|
OmnipodUIPostprocessor uiPostprocessor; // = new OmnipodUIPostprocessor();
|
||||||
|
|
||||||
|
|
||||||
private OmnipodCommunicationManagerInterface getCommunicationManager() {
|
private OmnipodCommunicationManagerInterface getCommunicationManager() {
|
||||||
return ocmInstance;
|
return ocmInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OmnipodUIComm(OmnipodCommunicationManagerInterface communicationManager) {
|
public OmnipodUIComm(OmnipodCommunicationManagerInterface communicationManager, OmnipodPumpPlugin plugin, OmnipodPumpStatus status) {
|
||||||
ocmInstance = communicationManager;
|
ocmInstance = communicationManager;
|
||||||
|
uiPostprocessor = new OmnipodUIPostprocessor(plugin, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -21,9 +21,11 @@ public class OmnipodUIPostprocessor {
|
||||||
OmnipodPumpPlugin omnipodPumpPlugin;
|
OmnipodPumpPlugin omnipodPumpPlugin;
|
||||||
|
|
||||||
|
|
||||||
public OmnipodUIPostprocessor() {
|
public OmnipodUIPostprocessor(OmnipodPumpPlugin plugin, OmnipodPumpStatus pumpStatus) {
|
||||||
pumpStatus = OmnipodUtil.getPumpStatus();
|
// pumpStatus = OmnipodUtil.getPumpStatus();
|
||||||
omnipodPumpPlugin = OmnipodPumpPlugin.getPlugin();
|
// omnipodPumpPlugin = OmnipodPumpPlugin.getPlugin();
|
||||||
|
this.pumpStatus = pumpStatus;
|
||||||
|
this.omnipodPumpPlugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,15 +35,26 @@ public class OmnipodUIPostprocessor {
|
||||||
|
|
||||||
switch (uiTask.commandType) {
|
switch (uiTask.commandType) {
|
||||||
|
|
||||||
case InitPod: {
|
case PairAndPrimePod: {
|
||||||
omnipodPumpPlugin.setEnableCustomAction(OmnipodCustomActionType.InitPod, false);
|
if (uiTask.returnData.success) {
|
||||||
|
omnipodPumpPlugin.setEnableCustomAction(OmnipodCustomActionType.PairAndPrime, false);
|
||||||
|
omnipodPumpPlugin.setEnableCustomAction(OmnipodCustomActionType.FillCanulaSetBasalProfile, true);
|
||||||
|
}
|
||||||
|
omnipodPumpPlugin.setEnableCustomAction(OmnipodCustomActionType.DeactivatePod, true);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FillCanulaAndSetBasalProfile: {
|
||||||
|
if (uiTask.returnData.success) {
|
||||||
|
omnipodPumpPlugin.setEnableCustomAction(OmnipodCustomActionType.FillCanulaSetBasalProfile, false);
|
||||||
|
}
|
||||||
omnipodPumpPlugin.setEnableCustomAction(OmnipodCustomActionType.DeactivatePod, true);
|
omnipodPumpPlugin.setEnableCustomAction(OmnipodCustomActionType.DeactivatePod, true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DeactivatePod:
|
case DeactivatePod:
|
||||||
case ResetPodStatus: {
|
case ResetPodStatus: {
|
||||||
omnipodPumpPlugin.setEnableCustomAction(OmnipodCustomActionType.InitPod, true);
|
omnipodPumpPlugin.setEnableCustomAction(OmnipodCustomActionType.PairAndPrime, true);
|
||||||
omnipodPumpPlugin.setEnableCustomAction(OmnipodCustomActionType.DeactivatePod, false);
|
omnipodPumpPlugin.setEnableCustomAction(OmnipodCustomActionType.DeactivatePod, false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -56,8 +56,13 @@ public class OmnipodUITask {
|
||||||
// }
|
// }
|
||||||
// break;
|
// break;
|
||||||
|
|
||||||
case InitPod:
|
case PairAndPrimePod:
|
||||||
returnData = communicationManager.initPod((PodInitActionType) parameters[0], (PodInitReceiver) parameters[1]);
|
returnData = communicationManager.initPod((PodInitActionType) parameters[0], (PodInitReceiver) parameters[1], null);
|
||||||
|
// TODO returnData = communicationManager.pairAndPrime();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FillCanulaAndSetBasalProfile:
|
||||||
|
returnData = communicationManager.initPod((PodInitActionType) parameters[0], (PodInitReceiver) parameters[1], (Profile) parameters[2]);
|
||||||
// TODO returnData = communicationManager.pairAndPrime();
|
// TODO returnData = communicationManager.pairAndPrime();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,9 @@ package info.nightscout.androidaps.plugins.pump.omnipod.defs;
|
||||||
*/
|
*/
|
||||||
public enum OmnipodCommandType {
|
public enum OmnipodCommandType {
|
||||||
|
|
||||||
InitPod, //
|
PairAndPrimePod, //
|
||||||
|
FillCanulaAndSetBasalProfile, //
|
||||||
|
//InitPod, //
|
||||||
DeactivatePod, //
|
DeactivatePod, //
|
||||||
SetBasalProfile, //
|
SetBasalProfile, //
|
||||||
SetBolus, //
|
SetBolus, //
|
||||||
|
|
|
@ -11,7 +11,7 @@ public interface OmnipodCommunicationManagerInterface {
|
||||||
/**
|
/**
|
||||||
* Initialize Pod
|
* Initialize Pod
|
||||||
*/
|
*/
|
||||||
PumpEnactResult initPod(PodInitActionType podInitActionType, PodInitReceiver podInitReceiver);
|
PumpEnactResult initPod(PodInitActionType podInitActionType, PodInitReceiver podInitReceiver, Profile profile);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Pod Status (is pod running, battery left ?, reservoir, etc)
|
* Get Pod Status (is pod running, battery left ?, reservoir, etc)
|
||||||
|
|
|
@ -9,7 +9,9 @@ import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType;
|
||||||
public enum OmnipodCustomActionType implements CustomActionType {
|
public enum OmnipodCustomActionType implements CustomActionType {
|
||||||
|
|
||||||
ResetRileyLinkConfiguration(), //
|
ResetRileyLinkConfiguration(), //
|
||||||
InitPod(), //
|
PairAndPrime(), //
|
||||||
|
FillCanulaSetBasalProfile(), //
|
||||||
|
//InitPod(), //
|
||||||
DeactivatePod(), //
|
DeactivatePod(), //
|
||||||
ResetPodStatus(), //
|
ResetPodStatus(), //
|
||||||
;
|
;
|
||||||
|
|
|
@ -10,9 +10,9 @@ public enum PodInitActionType {
|
||||||
PairPod(PairAndPrimeWizardStep), //
|
PairPod(PairAndPrimeWizardStep), //
|
||||||
PrimePod(PairAndPrimeWizardStep), //
|
PrimePod(PairAndPrimeWizardStep), //
|
||||||
|
|
||||||
FillCannulaWizardStep,
|
FillCannulaSetBasalProfileWizardStep,
|
||||||
FillCannula(FillCannulaWizardStep),
|
FillCannula(FillCannulaSetBasalProfileWizardStep),
|
||||||
SetBasalProfile(FillCannulaWizardStep);
|
SetBasalProfile(FillCannulaSetBasalProfileWizardStep);
|
||||||
|
|
||||||
|
|
||||||
private PodInitActionType[] parent;
|
private PodInitActionType[] parent;
|
||||||
|
@ -41,7 +41,7 @@ public enum PodInitActionType {
|
||||||
|
|
||||||
if (podType == OmnipodPodType.Eros) {
|
if (podType == OmnipodPodType.Eros) {
|
||||||
outList.add(PodInitActionType.PairAndPrimeWizardStep);
|
outList.add(PodInitActionType.PairAndPrimeWizardStep);
|
||||||
outList.add(PodInitActionType.FillCannulaWizardStep);
|
outList.add(PodInitActionType.FillCannulaSetBasalProfileWizardStep);
|
||||||
} else {
|
} else {
|
||||||
// TODO we might have different wizard steps, with different handling for Dash
|
// TODO we might have different wizard steps, with different handling for Dash
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,8 @@ public class OmnipodPumpStatus extends PumpStatus {
|
||||||
|
|
||||||
public String podNumber;
|
public String podNumber;
|
||||||
public PodDeviceState podDeviceState = PodDeviceState.NeverContacted;
|
public PodDeviceState podDeviceState = PodDeviceState.NeverContacted;
|
||||||
|
public boolean podAvailable = false;
|
||||||
|
public boolean ackAlertsAvailable = false;
|
||||||
|
|
||||||
|
|
||||||
public OmnipodPumpStatus(PumpDescription pumpDescription) {
|
public OmnipodPumpStatus(PumpDescription pumpDescription) {
|
||||||
|
@ -63,6 +65,7 @@ public class OmnipodPumpStatus extends PumpStatus {
|
||||||
this.lastConnection = SP.getLong(OmnipodConst.Statistics.LastGoodPumpCommunicationTime, 0L);
|
this.lastConnection = SP.getLong(OmnipodConst.Statistics.LastGoodPumpCommunicationTime, 0L);
|
||||||
this.lastDataTime = new LocalDateTime(this.lastConnection);
|
this.lastDataTime = new LocalDateTime(this.lastConnection);
|
||||||
this.pumpType = PumpType.Insulet_Omnipod;
|
this.pumpType = PumpType.Insulet_Omnipod;
|
||||||
|
this.podAvailable = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
package info.nightscout.androidaps.plugins.pump.omnipod.util;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitActionType;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitReceiver;
|
||||||
|
|
||||||
|
public class LogReceiver implements PodInitReceiver {
|
||||||
|
|
||||||
|
private static final Logger LOG = LoggerFactory.getLogger(LogReceiver.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void returnInitTaskStatus(PodInitActionType podInitActionType, boolean isSuccess, String errorMessage) {
|
||||||
|
|
||||||
|
if (errorMessage != null) {
|
||||||
|
LOG.error(podInitActionType.name() + " - Success: " + isSuccess + ", Error Message: " + errorMessage);
|
||||||
|
} else {
|
||||||
|
if (isSuccess) {
|
||||||
|
LOG.info(podInitActionType.name() + " - Success: " + isSuccess);
|
||||||
|
} else {
|
||||||
|
LOG.error(podInitActionType.name() + " - NOT Succesful");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -61,7 +61,6 @@ public class OmnipodDashPumpPlugin extends OmnipodPumpPlugin implements OmnipodP
|
||||||
|
|
||||||
|
|
||||||
private OmnipodDashPumpPlugin() {
|
private OmnipodDashPumpPlugin() {
|
||||||
|
|
||||||
super(new PluginDescription() //
|
super(new PluginDescription() //
|
||||||
.mainType(PluginType.PUMP) //
|
.mainType(PluginType.PUMP) //
|
||||||
.fragmentClass(OmnipodFragment.class.getName()) //
|
.fragmentClass(OmnipodFragment.class.getName()) //
|
||||||
|
@ -80,7 +79,7 @@ public class OmnipodDashPumpPlugin extends OmnipodPumpPlugin implements OmnipodP
|
||||||
omnipodCommunicationManager = OmnipodDashCommunicationManager.getInstance();
|
omnipodCommunicationManager = OmnipodDashCommunicationManager.getInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
omnipodUIComm = new OmnipodUIComm(omnipodCommunicationManager);
|
omnipodUIComm = new OmnipodUIComm(omnipodCommunicationManager, this, this.pumpStatusLocal);
|
||||||
|
|
||||||
OmnipodUtil.setPlugin(this);
|
OmnipodUtil.setPlugin(this);
|
||||||
|
|
||||||
|
@ -257,7 +256,7 @@ public class OmnipodDashPumpPlugin extends OmnipodPumpPlugin implements OmnipodP
|
||||||
|
|
||||||
|
|
||||||
protected void triggerUIChange() {
|
protected void triggerUIChange() {
|
||||||
MainApp.bus().post(new EventOmnipodPumpValuesChanged());
|
RxBus.INSTANCE.send(new EventOmnipodPumpValuesChanged());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -271,7 +270,8 @@ public class OmnipodDashPumpPlugin extends OmnipodPumpPlugin implements OmnipodP
|
||||||
|
|
||||||
if (customActions == null) {
|
if (customActions == null) {
|
||||||
this.customActions = Arrays.asList(
|
this.customActions = Arrays.asList(
|
||||||
customActionInitPod, //
|
customActionPairAndPrime, //
|
||||||
|
customActionFillCanullaSetBasalProfile, //
|
||||||
customActionDeactivatePod, //
|
customActionDeactivatePod, //
|
||||||
customActionResetPod);
|
customActionResetPod);
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class OmnipodDashCommunicationManager implements OmnipodCommunicationMana
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PumpEnactResult initPod(PodInitActionType podInitActionType, PodInitReceiver podInitReceiver) {
|
public PumpEnactResult initPod(PodInitActionType podInitActionType, PodInitReceiver podInitReceiver, Profile profile) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -206,8 +206,9 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:gravity="start"
|
android:gravity="start"
|
||||||
android:paddingLeft="5dp"
|
android:paddingStart="5dp"
|
||||||
android:text="{fa-bluetooth-b}"
|
android:paddingEnd="5dp"
|
||||||
|
android:text=""
|
||||||
android:textColor="@android:color/white"
|
android:textColor="@android:color/white"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
|
|
@ -1470,6 +1470,7 @@
|
||||||
<string name="rileylink_scanner_scanning">Scanning</string>
|
<string name="rileylink_scanner_scanning">Scanning</string>
|
||||||
<string name="rileylink_scanner_scanning_finished">Scanning finished</string>
|
<string name="rileylink_scanner_scanning_finished">Scanning finished</string>
|
||||||
<string name="rileylink_scanner_scanning_error">Scanning error: %1$d</string>
|
<string name="rileylink_scanner_scanning_error">Scanning error: %1$d</string>
|
||||||
|
<string name="common_never">Never</string>
|
||||||
|
|
||||||
|
|
||||||
<!-- RL Status Page -->
|
<!-- RL Status Page -->
|
||||||
|
@ -1615,6 +1616,7 @@
|
||||||
<string name="common_on">On</string>
|
<string name="common_on">On</string>
|
||||||
<string name="common_off">Off</string>
|
<string name="common_off">Off</string>
|
||||||
|
|
||||||
|
|
||||||
<!-- Omnipod -->
|
<!-- Omnipod -->
|
||||||
|
|
||||||
<!-- Omnipod - Base -->
|
<!-- Omnipod - Base -->
|
||||||
|
@ -1630,12 +1632,17 @@
|
||||||
<string name="omnipod_pod_address">Pod Address</string>
|
<string name="omnipod_pod_address">Pod Address</string>
|
||||||
<string name="omnipod_pod_expiry">Pod Expires</string>
|
<string name="omnipod_pod_expiry">Pod Expires</string>
|
||||||
<string name="omnipod_pod_name_no_info">No info</string>
|
<string name="omnipod_pod_name_no_info">No info</string>
|
||||||
|
<string name="omnipod_pod_no_pod_connected">No Pod connected</string>
|
||||||
<string name="omnipod_pod_active_alerts">Active Pod Alerts</string>
|
<string name="omnipod_pod_active_alerts">Active Pod Alerts</string>
|
||||||
<string name="omnipod_ack_short">Ack Alerts</string>
|
<string name="omnipod_ack_short">Ack Alerts</string>
|
||||||
|
|
||||||
|
<!-- Omnipod - Dialogs -->
|
||||||
|
<string name="omnipod_frequency">Omnipod (433.91 MHz)</string>
|
||||||
|
|
||||||
|
|
||||||
<!-- Omnipod - Error -->
|
<!-- Omnipod - Error -->
|
||||||
<string name="omnipod_error_operation_not_possible_no_configuration">Operation is not possible.\n\n You need to configure Omnipod first, before you can use this operation.</string>
|
<string name="omnipod_error_operation_not_possible_no_configuration">Operation is not possible.\n\n You need to configure Omnipod first, before you can use this operation.</string>
|
||||||
|
<string name="omnipod_error_operation_not_possible_no_profile">Operation is not possible.\n\n You need to wait few minutes, until AAPS tries to set profile for first time.</string>
|
||||||
|
|
||||||
<!-- Omnipod - Pod Mgmt -->
|
<!-- Omnipod - Pod Mgmt -->
|
||||||
<string name="omnipod_cmd_init_pod">Init Pod</string>
|
<string name="omnipod_cmd_init_pod">Init Pod</string>
|
||||||
|
@ -1669,4 +1676,5 @@
|
||||||
<item quantity="one">%1$d minute</item>
|
<item quantity="one">%1$d minute</item>
|
||||||
<item quantity="other">%1$d minutes</item>
|
<item quantity="other">%1$d minutes</item>
|
||||||
</plurals>
|
</plurals>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in a new issue