- added command for Pod Debugging as async (with pump queue)
This commit is contained in:
parent
64310f4e28
commit
72b32be6f6
|
@ -44,7 +44,7 @@ import org.slf4j.LoggerFactory
|
|||
class OmnipodFragment : Fragment() {
|
||||
private val LOG = LoggerFactory.getLogger(L.PUMP)
|
||||
private var disposable: CompositeDisposable = CompositeDisposable()
|
||||
private var podAvailable = false
|
||||
//private var podAvailable = false
|
||||
|
||||
operator fun CompositeDisposable.plusAssign(disposable: Disposable) {
|
||||
add(disposable)
|
||||
|
@ -116,10 +116,20 @@ class OmnipodFragment : Fragment() {
|
|||
if (!OmnipodUtil.getPumpStatus().verifyConfiguration()) {
|
||||
OmnipodUtil.displayNotConfiguredDialog(context)
|
||||
} else {
|
||||
val readPulseLog = AapsOmnipodManager.getInstance().readPulseLog()
|
||||
// val readPulseLog = AapsOmnipodManager.getInstance().readPulseLog()
|
||||
//
|
||||
// OKDialog.show(MainApp.instance().applicationContext, MainApp.gs(R.string.action),
|
||||
// "Pulse Log:\n" + readPulseLog.toString(), null)
|
||||
//
|
||||
|
||||
omnipod_pod_debug.isEnabled = false
|
||||
OmnipodUtil.getPlugin().addPodStatusRequest(OmnipodStatusRequest.GetPodPulseLog);
|
||||
ConfigBuilderPlugin.getPlugin().commandQueue.readStatus("Clicked Refresh", object : Callback() {
|
||||
override fun run() {
|
||||
activity?.runOnUiThread { omnipod_pod_debug.isEnabled = true }
|
||||
}
|
||||
})
|
||||
|
||||
OKDialog.show(MainApp.instance().applicationContext, MainApp.gs(R.string.action),
|
||||
"Pulse Log:\n" + readPulseLog.toString(), null)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -177,25 +187,6 @@ class OmnipodFragment : Fragment() {
|
|||
loopHandler.removeCallbacks(refreshLoop)
|
||||
}
|
||||
|
||||
// @Subscribe
|
||||
// fun onStatusEvent(c: EventPumpStatusChanged) {
|
||||
// activity?.runOnUiThread { updateGUI() }
|
||||
// }
|
||||
//
|
||||
// @Subscribe
|
||||
// fun onStatusEvent(s: EventTempBasalChange) {
|
||||
// activity?.runOnUiThread { updateGUI() }
|
||||
// }
|
||||
//
|
||||
// @Subscribe
|
||||
// fun onStatusEvent(s: EventExtendedBolusChange) {
|
||||
// activity?.runOnUiThread { updateGUI() }
|
||||
// }
|
||||
//
|
||||
// @Subscribe
|
||||
// fun onStatusEvent(s: EventQueueChanged) {
|
||||
// activity?.runOnUiThread { updateGUI() }
|
||||
// }
|
||||
|
||||
@Synchronized
|
||||
private fun setDeviceStatus() {
|
||||
|
@ -231,7 +222,7 @@ class OmnipodFragment : Fragment() {
|
|||
pumpStatus.podAvailable = false
|
||||
pumpStatus.podNumber == null
|
||||
} else {
|
||||
podAvailable = true
|
||||
//podAvailable = true
|
||||
pumpStatus.podAvailable = true
|
||||
omnipod_pod_address.text = pumpStatus.podSessionState.address.toString()
|
||||
omnipod_pod_expiry.text = pumpStatus.podSessionState.expiryDateAsString
|
||||
|
@ -339,7 +330,7 @@ class OmnipodFragment : Fragment() {
|
|||
|
||||
setDeviceStatus()
|
||||
|
||||
if (podAvailable) {
|
||||
if (pumpStatus.podAvailable) {
|
||||
// last connection
|
||||
if (pumpStatus.lastConnection != 0L) {
|
||||
val minAgo = DateUtil.minAgo(pumpStatus.lastConnection)
|
||||
|
@ -372,7 +363,7 @@ class OmnipodFragment : Fragment() {
|
|||
// last bolus
|
||||
val bolus = pumpStatus.lastBolusAmount
|
||||
val bolusTime = pumpStatus.lastBolusTime
|
||||
if (bolus != null && bolusTime != null && podAvailable) {
|
||||
if (bolus != null && bolusTime != null && pumpStatus.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)
|
||||
|
@ -411,7 +402,6 @@ class OmnipodFragment : Fragment() {
|
|||
omnipod_lastbolus.text = ""
|
||||
omnipod_lastconnection.text = ""
|
||||
omnipod_lastconnection.setTextColor(Color.WHITE)
|
||||
|
||||
}
|
||||
|
||||
omnipod_errors.text = pumpStatus.errorInfo
|
||||
|
|
|
@ -47,6 +47,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.service.tasks.ResetRileyLinkConfigurationTask;
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ServiceTaskExecutor;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoRecentHighFlashLogDump;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommandType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommunicationManagerInterface;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCustomActionType;
|
||||
|
@ -374,8 +375,23 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
List<OmnipodStatusRequest> removeList = new ArrayList<>();
|
||||
|
||||
for (OmnipodStatusRequest omnipodStatusRequest : omnipodStatusRequestList) {
|
||||
// TODO when we get more commands this needs to be extended
|
||||
if (omnipodStatusRequest==OmnipodStatusRequest.GetPodPulseLog) {
|
||||
OmnipodUITask omnipodUITask = omnipodUIComm.executeCommand(omnipodStatusRequest.getCommandType());
|
||||
|
||||
PodInfoRecentHighFlashLogDump result = (PodInfoRecentHighFlashLogDump)omnipodUITask.returnDataObject;
|
||||
|
||||
if (result==null) {
|
||||
LOG.warn("Result was null.");
|
||||
} else {
|
||||
LOG.warn("Result was NOT null.");
|
||||
|
||||
OKDialog.show(MainApp.instance().getApplicationContext(), MainApp.gs(R.string.action),
|
||||
"Pulse Log:\n" + result.toString(), null);
|
||||
}
|
||||
|
||||
} else {
|
||||
omnipodUIComm.executeCommand(omnipodStatusRequest.getCommandType());
|
||||
}
|
||||
removeList.add(omnipodStatusRequest);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,8 @@ public enum OmnipodCommandType {
|
|||
ResetPodStatus, //
|
||||
GetPodStatus, //
|
||||
SetTime, //
|
||||
AcknowledgeAlerts;
|
||||
AcknowledgeAlerts, //
|
||||
GetPodPulseLog;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.defs;
|
|||
import info.nightscout.androidaps.data.Profile;
|
||||
import info.nightscout.androidaps.data.PumpEnactResult;
|
||||
import info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoRecentHighFlashLogDump;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus;
|
||||
|
||||
public interface OmnipodCommunicationManagerInterface {
|
||||
|
@ -71,4 +72,7 @@ public interface OmnipodCommunicationManagerInterface {
|
|||
|
||||
|
||||
void setPumpStatus(OmnipodPumpStatus pumpStatusLocal);
|
||||
|
||||
|
||||
PodInfoRecentHighFlashLogDump readPulseLog();
|
||||
}
|
||||
|
|
|
@ -3,7 +3,8 @@ package info.nightscout.androidaps.plugins.pump.omnipod.defs;
|
|||
public enum OmnipodStatusRequest {
|
||||
ResetState(OmnipodCommandType.ResetPodStatus), //
|
||||
AcknowledgeAlerts(OmnipodCommandType.AcknowledgeAlerts), //
|
||||
GetPodState(OmnipodCommandType.GetPodStatus) //
|
||||
GetPodState(OmnipodCommandType.GetPodStatus), //
|
||||
GetPodPulseLog(OmnipodCommandType.GetPodPulseLog)
|
||||
;
|
||||
|
||||
private OmnipodCommandType commandType;
|
||||
|
|
|
@ -31,6 +31,7 @@ public class OmnipodUITask {
|
|||
private String errorDescription;
|
||||
private Object[] parameters;
|
||||
private PodResponseType responseType;
|
||||
public Object returnDataObject;
|
||||
|
||||
|
||||
public OmnipodUITask(OmnipodCommandType commandType) {
|
||||
|
@ -88,6 +89,10 @@ public class OmnipodUITask {
|
|||
}
|
||||
break;
|
||||
|
||||
case GetPodPulseLog:
|
||||
returnDataObject = communicationManager.readPulseLog();
|
||||
break;
|
||||
|
||||
case GetPodStatus:
|
||||
returnData = communicationManager.getPodStatus();
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue