- changes to make driver running (no init pod yet), just fixed some running pains with driver
This commit is contained in:
parent
9b0a4b742d
commit
4351b65a92
|
@ -27,7 +27,7 @@ public abstract class PumpStatus {
|
|||
|
||||
// other pump settings
|
||||
public String activeProfileName = "0";
|
||||
public double reservoirRemainingUnits = 0d;
|
||||
public double reservoirRemainingUnits = 0.0d;
|
||||
public int reservoirFullUnits = 0;
|
||||
public int batteryRemaining = 0; // percent, so 0-100
|
||||
public Double batteryVoltage = null;
|
||||
|
|
|
@ -13,6 +13,7 @@ import java.util.Locale;
|
|||
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
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.hw.rileylink.RileyLinkUtil;
|
||||
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.medtronic.driver.MedtronicPumpStatus;
|
||||
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.
|
||||
|
@ -44,6 +47,7 @@ public class RileyLinkStatusGeneral extends Fragment implements RefreshableInter
|
|||
RileyLinkServiceData rileyLinkServiceData;
|
||||
|
||||
MedtronicPumpStatus medtronicPumpStatus;
|
||||
OmnipodPumpStatus omnipodPumpStatus;
|
||||
boolean first = false;
|
||||
|
||||
|
||||
|
@ -118,31 +122,59 @@ public class RileyLinkStatusGeneral extends Fragment implements RefreshableInter
|
|||
|
||||
}
|
||||
|
||||
// TODO add handling for Omnipod pump status
|
||||
this.medtronicPumpStatus = MedtronicUtil.getPumpStatus();
|
||||
if (MedtronicUtil.isMedtronicPump()) {
|
||||
|
||||
if (medtronicPumpStatus != null) {
|
||||
this.deviceType.setText(MainApp.gs(RileyLinkTargetDevice.MedtronicPump.getResourceId()));
|
||||
this.deviceModel.setText(medtronicPumpStatus.pumpType.getDescription());
|
||||
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.medtronicPumpStatus = MedtronicUtil.getPumpStatus();
|
||||
|
||||
// TODO extend when Omnipod used
|
||||
if (medtronicPumpStatus != null) {
|
||||
this.deviceType.setText(MainApp.gs(RileyLinkTargetDevice.MedtronicPump.getResourceId()));
|
||||
this.deviceModel.setText(medtronicPumpStatus.pumpType.getDescription());
|
||||
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));
|
||||
|
||||
if (MedtronicUtil.getMedtronicPumpModel() != null)
|
||||
this.connectedDevice.setText("Medtronic " + MedtronicUtil.getMedtronicPumpModel().getPumpModel());
|
||||
else
|
||||
this.connectedDevice.setText("???");
|
||||
if (MedtronicUtil.getMedtronicPumpModel() != null)
|
||||
this.connectedDevice.setText("Medtronic " + MedtronicUtil.getMedtronicPumpModel().getPumpModel());
|
||||
else
|
||||
this.connectedDevice.setText("???");
|
||||
|
||||
if (rileyLinkServiceData.lastGoodFrequency != null)
|
||||
this.lastUsedFrequency.setText(String.format(Locale.ENGLISH, "%.2f MHz",
|
||||
rileyLinkServiceData.lastGoodFrequency));
|
||||
if (rileyLinkServiceData.lastGoodFrequency != null)
|
||||
this.lastUsedFrequency.setText(String.format(Locale.ENGLISH, "%.2f MHz",
|
||||
rileyLinkServiceData.lastGoodFrequency));
|
||||
|
||||
if (medtronicPumpStatus.lastConnection != 0)
|
||||
this.lastDeviceContact.setText(StringUtil.toDateTimeString(new LocalDateTime(
|
||||
medtronicPumpStatus.lastDataTime)));
|
||||
else
|
||||
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));
|
||||
}
|
||||
|
||||
if (medtronicPumpStatus.lastConnection != 0)
|
||||
this.lastDeviceContact.setText(StringUtil.toDateTimeString(new LocalDateTime(
|
||||
medtronicPumpStatus.lastDataTime)));
|
||||
else
|
||||
this.lastDeviceContact.setText("Never");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,11 +8,13 @@ import org.slf4j.LoggerFactory;
|
|||
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.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.RileyLinkServiceState;
|
||||
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.medtronic.util.MedtronicConst;
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil;
|
||||
import info.nightscout.androidaps.utils.SP;
|
||||
|
||||
/**
|
||||
|
@ -42,7 +44,7 @@ public class InitializePumpManagerTask extends ServiceTask {
|
|||
|
||||
double lastGoodFrequency = 0.0d;
|
||||
|
||||
if (RileyLinkUtil.getRileyLinkServiceData().lastGoodFrequency==null) {
|
||||
if (RileyLinkUtil.getRileyLinkServiceData().lastGoodFrequency == null) {
|
||||
|
||||
lastGoodFrequency = SP.getDouble(RileyLinkConst.Prefs.LastGoodDeviceFrequency, 0.0d);
|
||||
lastGoodFrequency = Math.round(lastGoodFrequency * 1000d) / 1000d;
|
||||
|
@ -56,28 +58,55 @@ public class InitializePumpManagerTask extends ServiceTask {
|
|||
lastGoodFrequency = RileyLinkUtil.getRileyLinkServiceData().lastGoodFrequency;
|
||||
}
|
||||
|
||||
if ((lastGoodFrequency > 0.0d)
|
||||
&& RileyLinkUtil.getRileyLinkCommunicationManager().isValidFrequency(lastGoodFrequency)) {
|
||||
|
||||
if (MedtronicUtil.isMedtronicPump()) {
|
||||
|
||||
if ((lastGoodFrequency > 0.0d)
|
||||
&& RileyLinkUtil.getRileyLinkCommunicationManager().isValidFrequency(lastGoodFrequency)) {
|
||||
|
||||
RileyLinkUtil.setServiceState(RileyLinkServiceState.RileyLinkReady);
|
||||
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
LOG.info("Setting radio frequency to {} MHz", lastGoodFrequency);
|
||||
|
||||
RileyLinkUtil.getRileyLinkCommunicationManager().setRadioFrequencyForPump(lastGoodFrequency);
|
||||
|
||||
boolean foundThePump = RileyLinkUtil.getRileyLinkCommunicationManager().tryToConnectToDevice();
|
||||
|
||||
if (foundThePump) {
|
||||
RileyLinkUtil.setServiceState(RileyLinkServiceState.PumpConnectorReady);
|
||||
} else {
|
||||
RileyLinkUtil.setServiceState(RileyLinkServiceState.PumpConnectorError,
|
||||
RileyLinkError.NoContactWithDevice);
|
||||
RileyLinkUtil.sendBroadcastMessage(RileyLinkConst.IPC.MSG_PUMP_tunePump);
|
||||
}
|
||||
|
||||
} else {
|
||||
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);
|
||||
|
||||
boolean foundThePump = RileyLinkUtil.getRileyLinkCommunicationManager().tryToConnectToDevice();
|
||||
|
||||
if (foundThePump) {
|
||||
RileyLinkUtil.setServiceState(RileyLinkServiceState.PumpConnectorReady);
|
||||
} else {
|
||||
RileyLinkUtil.setServiceState(RileyLinkServiceState.PumpConnectorError,
|
||||
RileyLinkError.NoContactWithDevice);
|
||||
RileyLinkUtil.sendBroadcastMessage(RileyLinkConst.IPC.MSG_PUMP_tunePump);
|
||||
}
|
||||
LOG.error("TRYYYYYY TO CONNECT IF AVAILABLE");
|
||||
|
||||
RileyLinkUtil.setServiceState(RileyLinkServiceState.PumpConnectorReady);
|
||||
|
||||
} else {
|
||||
RileyLinkUtil.sendBroadcastMessage(RileyLinkConst.IPC.MSG_PUMP_tunePump);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ import org.slf4j.LoggerFactory
|
|||
class OmnipodFragment : Fragment() {
|
||||
private val log = LoggerFactory.getLogger(L.PUMP)
|
||||
private var disposable: CompositeDisposable = CompositeDisposable()
|
||||
private var podAvailable = false
|
||||
|
||||
operator fun CompositeDisposable.plusAssign(disposable: Disposable) {
|
||||
add(disposable)
|
||||
|
@ -68,7 +69,7 @@ class OmnipodFragment : Fragment() {
|
|||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
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))
|
||||
|
||||
|
@ -199,9 +200,11 @@ class OmnipodFragment : Fragment() {
|
|||
if (pumpStatus.podSessionState == null) {
|
||||
omnipod_pod_address.text = MainApp.gs(R.string.omnipod_pod_name_no_info)
|
||||
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 {
|
||||
|
||||
podAvailable = true
|
||||
pumpStatus.podAvailable = true
|
||||
omnipod_pod_address.text = pumpStatus.podSessionState.address.toString()
|
||||
omnipod_pod_expiry.text = pumpStatus.podSessionState.expiryDateAsString
|
||||
|
||||
|
@ -307,70 +310,86 @@ class OmnipodFragment : Fragment() {
|
|||
|
||||
setDeviceStatus()
|
||||
|
||||
if (podAvailable) {
|
||||
// last connection
|
||||
if (pumpStatus.lastConnection != 0L) {
|
||||
val minAgo = DateUtil.minAgo(pumpStatus.lastConnection)
|
||||
val min = (System.currentTimeMillis() - pumpStatus.lastConnection) / 1000 / 60
|
||||
if (pumpStatus.lastConnection + 60 * 1000 > System.currentTimeMillis()) {
|
||||
omnipod_lastconnection.setText(R.string.combo_pump_connected_now)
|
||||
omnipod_lastconnection.setTextColor(Color.WHITE)
|
||||
} else if (pumpStatus.lastConnection + 30 * 60 * 1000 < System.currentTimeMillis()) {
|
||||
if (pumpStatus.lastConnection != 0L) {
|
||||
val minAgo = DateUtil.minAgo(pumpStatus.lastConnection)
|
||||
val min = (System.currentTimeMillis() - pumpStatus.lastConnection) / 1000 / 60
|
||||
if (pumpStatus.lastConnection + 60 * 1000 > System.currentTimeMillis()) {
|
||||
omnipod_lastconnection.setText(R.string.combo_pump_connected_now)
|
||||
omnipod_lastconnection.setTextColor(Color.WHITE)
|
||||
} else if (pumpStatus.lastConnection + 30 * 60 * 1000 < System.currentTimeMillis()) {
|
||||
|
||||
if (min < 60) {
|
||||
omnipod_lastconnection.text = MainApp.gs(R.string.minago, min)
|
||||
} else if (min < 1440) {
|
||||
val h = (min / 60).toInt()
|
||||
omnipod_lastconnection.text = (MainApp.gq(R.plurals.objective_hours, h, h) + " "
|
||||
+ MainApp.gs(R.string.ago))
|
||||
if (min < 60) {
|
||||
omnipod_lastconnection.text = MainApp.gs(R.string.minago, min)
|
||||
} else if (min < 1440) {
|
||||
val h = (min / 60).toInt()
|
||||
omnipod_lastconnection.text = (MainApp.gq(R.plurals.objective_hours, h, h) + " "
|
||||
+ MainApp.gs(R.string.ago))
|
||||
} else {
|
||||
val h = (min / 60).toInt()
|
||||
val d = h / 24
|
||||
// h = h - (d * 24);
|
||||
omnipod_lastconnection.text = (MainApp.gq(R.plurals.objective_days, d, d) + " "
|
||||
+ MainApp.gs(R.string.ago))
|
||||
}
|
||||
omnipod_lastconnection.setTextColor(Color.RED)
|
||||
} else {
|
||||
val h = (min / 60).toInt()
|
||||
val d = h / 24
|
||||
// h = h - (d * 24);
|
||||
omnipod_lastconnection.text = (MainApp.gq(R.plurals.objective_days, d, d) + " "
|
||||
+ MainApp.gs(R.string.ago))
|
||||
omnipod_lastconnection.text = minAgo
|
||||
omnipod_lastconnection.setTextColor(Color.WHITE)
|
||||
}
|
||||
omnipod_lastconnection.setTextColor(Color.RED)
|
||||
} else {
|
||||
omnipod_lastconnection.text = minAgo
|
||||
omnipod_lastconnection.setTextColor(Color.WHITE)
|
||||
}
|
||||
}
|
||||
|
||||
// last bolus
|
||||
val bolus = pumpStatus.lastBolusAmount
|
||||
val bolusTime = pumpStatus.lastBolusTime
|
||||
if (bolus != null && bolusTime != null) {
|
||||
val agoMsc = System.currentTimeMillis() - pumpStatus.lastBolusTime.time
|
||||
val bolusMinAgo = agoMsc.toDouble() / 60.0 / 1000.0
|
||||
val unit = MainApp.gs(R.string.insulin_unit_shortname)
|
||||
val ago: String
|
||||
if (agoMsc < 60 * 1000) {
|
||||
ago = MainApp.gs(R.string.combo_pump_connected_now)
|
||||
} else if (bolusMinAgo < 60) {
|
||||
ago = DateUtil.minAgo(pumpStatus.lastBolusTime.time)
|
||||
// last bolus
|
||||
val bolus = pumpStatus.lastBolusAmount
|
||||
val bolusTime = pumpStatus.lastBolusTime
|
||||
if (bolus != null && bolusTime != null && podAvailable) {
|
||||
val agoMsc = System.currentTimeMillis() - pumpStatus.lastBolusTime.time
|
||||
val bolusMinAgo = agoMsc.toDouble() / 60.0 / 1000.0
|
||||
val unit = MainApp.gs(R.string.insulin_unit_shortname)
|
||||
val ago: String
|
||||
if (agoMsc < 60 * 1000) {
|
||||
ago = MainApp.gs(R.string.combo_pump_connected_now)
|
||||
} else if (bolusMinAgo < 60) {
|
||||
ago = DateUtil.minAgo(pumpStatus.lastBolusTime.time)
|
||||
} else {
|
||||
ago = DateUtil.hourAgo(pumpStatus.lastBolusTime.time)
|
||||
}
|
||||
omnipod_lastbolus.text = MainApp.gs(R.string.combo_last_bolus, bolus, unit, ago)
|
||||
} else {
|
||||
ago = DateUtil.hourAgo(pumpStatus.lastBolusTime.time)
|
||||
omnipod_lastbolus.text = ""
|
||||
}
|
||||
omnipod_lastbolus.text = MainApp.gs(R.string.combo_last_bolus, bolus, unit, ago)
|
||||
|
||||
// base basal rate
|
||||
|
||||
omnipod_basabasalrate.text = MainApp.gs(R.string.pump_basebasalrate, plugin.baseBasalRate)
|
||||
|
||||
omnipod_tempbasal.text = TreatmentsPlugin.getPlugin()
|
||||
.getTempBasalFromHistory(System.currentTimeMillis())?.toStringFull() ?: ""
|
||||
|
||||
// reservoir
|
||||
if (RileyLinkUtil.isSame(pumpStatus.reservoirRemainingUnits, 75.0)) {
|
||||
omnipod_reservoir.text = MainApp.gs(R.string.omnipod_reservoir_over50)
|
||||
} else {
|
||||
omnipod_reservoir.text = MainApp.gs(R.string.omnipod_reservoir_left, pumpStatus.reservoirRemainingUnits)
|
||||
}
|
||||
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)
|
||||
|
||||
}
|
||||
|
||||
// base basal rate
|
||||
omnipod_basabasalrate.text = ("(" + pumpStatus.activeProfileName + ") "
|
||||
+ MainApp.gs(R.string.pump_basebasalrate, plugin.baseBasalRate))
|
||||
|
||||
omnipod_tempbasal.text = TreatmentsPlugin.getPlugin()
|
||||
.getTempBasalFromHistory(System.currentTimeMillis())?.toStringFull() ?: ""
|
||||
|
||||
// reservoir
|
||||
if (RileyLinkUtil.isSame(pumpStatus.reservoirRemainingUnits, 0.0)) {
|
||||
omnipod_reservoir.text = MainApp.gs(R.string.omnipod_reservoir_over50)
|
||||
} else {
|
||||
omnipod_reservoir.text = MainApp.gs(R.string.omnipod_reservoir_left, pumpStatus.reservoirRemainingUnits)
|
||||
}
|
||||
SetWarnColor.setColorInverse(omnipod_reservoir, pumpStatus.reservoirRemainingUnits, 50.0, 20.0)
|
||||
|
||||
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.GetStatusAction;
|
||||
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.PrimeAction;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.SetBasalScheduleAction;
|
||||
|
@ -345,4 +346,9 @@ public class OmnipodManager {
|
|||
// TODO use string resource
|
||||
return new PumpEnactResult().success(false).enacted(false).comment("Pod should be initialized first");
|
||||
}
|
||||
|
||||
private void addToHistory(long requestTime, OmnipodAction omnipodAction, long responseTime) {
|
||||
// TODO andy
|
||||
}
|
||||
|
||||
}
|
|
@ -113,10 +113,10 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
OmnipodUtil.setOmnipodPodType(OmnipodPodType.Eros);
|
||||
|
||||
if (omnipodCommunicationManager == null) {
|
||||
omnipodCommunicationManager = AapsOmnipodManager.getInstance();
|
||||
//omnipodCommunicationManager = AapsOmnipodManager.getInstance();
|
||||
}
|
||||
|
||||
omnipodUIComm = new OmnipodUIComm(omnipodCommunicationManager);
|
||||
omnipodUIComm = new OmnipodUIComm(omnipodCommunicationManager, this, this.pumpStatusLocal);
|
||||
|
||||
OmnipodUtil.setPlugin(this);
|
||||
|
||||
|
@ -255,7 +255,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
|
||||
if (isServiceSet()) {
|
||||
|
||||
if (isBusy)
|
||||
if (isBusy || !pumpStatusLocal.podAvailable)
|
||||
return true;
|
||||
|
||||
if (busyTimestamps.size() > 0) {
|
||||
|
@ -313,6 +313,11 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isSuspended() {
|
||||
return (pumpStatusLocal!=null && !pumpStatusLocal.podAvailable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getPumpStatus() {
|
||||
|
||||
|
@ -487,6 +492,12 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isFakingTempsByExtendedBoluses() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
protected PumpEnactResult deliverBolus(final DetailedBolusInfo detailedBolusInfo) {
|
||||
|
|
|
@ -4,8 +4,10 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
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.OmnipodCommandType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.service.OmnipodPumpStatus;
|
||||
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);
|
||||
|
||||
OmnipodCommunicationManagerInterface ocmInstance = null;
|
||||
OmnipodUIPostprocessor uiPostprocessor = new OmnipodUIPostprocessor();
|
||||
OmnipodUIPostprocessor uiPostprocessor; // = new OmnipodUIPostprocessor();
|
||||
|
||||
|
||||
private OmnipodCommunicationManagerInterface getCommunicationManager() {
|
||||
return ocmInstance;
|
||||
}
|
||||
|
||||
public OmnipodUIComm(OmnipodCommunicationManagerInterface communicationManager) {
|
||||
public OmnipodUIComm(OmnipodCommunicationManagerInterface communicationManager, OmnipodPumpPlugin plugin, OmnipodPumpStatus status) {
|
||||
ocmInstance = communicationManager;
|
||||
uiPostprocessor = new OmnipodUIPostprocessor(plugin, status);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -21,9 +21,11 @@ public class OmnipodUIPostprocessor {
|
|||
OmnipodPumpPlugin omnipodPumpPlugin;
|
||||
|
||||
|
||||
public OmnipodUIPostprocessor() {
|
||||
pumpStatus = OmnipodUtil.getPumpStatus();
|
||||
omnipodPumpPlugin = OmnipodPumpPlugin.getPlugin();
|
||||
public OmnipodUIPostprocessor(OmnipodPumpPlugin plugin, OmnipodPumpStatus pumpStatus) {
|
||||
// pumpStatus = OmnipodUtil.getPumpStatus();
|
||||
// omnipodPumpPlugin = OmnipodPumpPlugin.getPlugin();
|
||||
this.pumpStatus = pumpStatus;
|
||||
this.omnipodPumpPlugin = plugin;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -48,6 +48,8 @@ public class OmnipodPumpStatus extends PumpStatus {
|
|||
|
||||
public String podNumber;
|
||||
public PodDeviceState podDeviceState = PodDeviceState.NeverContacted;
|
||||
public boolean podAvailable = false;
|
||||
public boolean ackAlertsAvailable = false;
|
||||
|
||||
|
||||
public OmnipodPumpStatus(PumpDescription pumpDescription) {
|
||||
|
@ -63,6 +65,7 @@ public class OmnipodPumpStatus extends PumpStatus {
|
|||
this.lastConnection = SP.getLong(OmnipodConst.Statistics.LastGoodPumpCommunicationTime, 0L);
|
||||
this.lastDataTime = new LocalDateTime(this.lastConnection);
|
||||
this.pumpType = PumpType.Insulet_Omnipod;
|
||||
this.podAvailable = false;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -61,7 +61,6 @@ public class OmnipodDashPumpPlugin extends OmnipodPumpPlugin implements OmnipodP
|
|||
|
||||
|
||||
private OmnipodDashPumpPlugin() {
|
||||
|
||||
super(new PluginDescription() //
|
||||
.mainType(PluginType.PUMP) //
|
||||
.fragmentClass(OmnipodFragment.class.getName()) //
|
||||
|
@ -80,7 +79,7 @@ public class OmnipodDashPumpPlugin extends OmnipodPumpPlugin implements OmnipodP
|
|||
omnipodCommunicationManager = OmnipodDashCommunicationManager.getInstance();
|
||||
}
|
||||
|
||||
omnipodUIComm = new OmnipodUIComm(omnipodCommunicationManager);
|
||||
omnipodUIComm = new OmnipodUIComm(omnipodCommunicationManager, this, this.pumpStatusLocal);
|
||||
|
||||
OmnipodUtil.setPlugin(this);
|
||||
|
||||
|
|
|
@ -206,8 +206,9 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="start"
|
||||
android:paddingLeft="5dp"
|
||||
android:text="{fa-bluetooth-b}"
|
||||
android:paddingStart="5dp"
|
||||
android:paddingEnd="5dp"
|
||||
android:text=""
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="14sp" />
|
||||
|
||||
|
|
|
@ -1470,6 +1470,7 @@
|
|||
<string name="rileylink_scanner_scanning">Scanning</string>
|
||||
<string name="rileylink_scanner_scanning_finished">Scanning finished</string>
|
||||
<string name="rileylink_scanner_scanning_error">Scanning error: %1$d</string>
|
||||
<string name="common_never">Never</string>
|
||||
|
||||
|
||||
<!-- RL Status Page -->
|
||||
|
@ -1631,9 +1632,13 @@
|
|||
<string name="omnipod_pod_address">Pod Address</string>
|
||||
<string name="omnipod_pod_expiry">Pod Expires</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_ack_short">Ack Alerts</string>
|
||||
|
||||
<!-- Omnipod - Dialogs -->
|
||||
<string name="omnipod_frequency">Omnipod (433.91 MHz)</string>
|
||||
|
||||
|
||||
<!-- 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>
|
||||
|
|
Loading…
Reference in a new issue