- Fixed wizardpager library, so that there is no longer NPE when cancel is used
- added Deactivate Pod Wizard - changed some strings
This commit is contained in:
parent
32097ee8ad
commit
5b3ca232e9
11 changed files with 111 additions and 109 deletions
Binary file not shown.
|
@ -43,7 +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.omnipod.comm.AapsOmnipodManager;
|
import info.nightscout.androidaps.plugins.pump.omnipod.driver.comm.AapsOmnipodManager;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.ui.OmnipodUIComm;
|
import info.nightscout.androidaps.plugins.pump.omnipod.driver.ui.OmnipodUIComm;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.ui.OmnipodUITask;
|
import info.nightscout.androidaps.plugins.pump.omnipod.driver.ui.OmnipodUITask;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommandType;
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommandType;
|
||||||
|
|
|
@ -39,10 +39,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInfoType;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.SetupProgress;
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.SetupProgress;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule.BasalScheduleMapper;
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule.BasalScheduleMapper;
|
||||||
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.driver.db.PodDbEntry;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.db.PodDbEntryType;
|
|
||||||
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.utils.SP;
|
import info.nightscout.androidaps.utils.SP;
|
||||||
|
|
||||||
public class OmnipodManager {
|
public class OmnipodManager {
|
||||||
|
@ -186,10 +183,6 @@ public class OmnipodManager {
|
||||||
podState = null;
|
podState = null;
|
||||||
SP.remove(OmnipodConst.Prefs.PodState);
|
SP.remove(OmnipodConst.Prefs.PodState);
|
||||||
|
|
||||||
addToHistory(System.currentTimeMillis(), PodDbEntryType.ResetPodState, null, null, null, null);
|
|
||||||
|
|
||||||
OmnipodUtil.setPodSessionState(null);
|
|
||||||
|
|
||||||
return new PumpEnactResult().success(true).enacted(true);
|
return new PumpEnactResult().success(true).enacted(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -361,27 +354,7 @@ public class OmnipodManager {
|
||||||
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, PodDbEntryType entryType, String shortDescription, OmnipodAction omnipodAction, Long responseTime, Object response) {
|
public PodSessionState getPodState() {
|
||||||
// TODO andy
|
return this.podState;
|
||||||
|
|
||||||
PodDbEntry entry = new PodDbEntry(requestTime, entryType);
|
|
||||||
|
|
||||||
if (shortDescription!=null) {
|
|
||||||
entry.setShortDescription(shortDescription);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (omnipodAction!=null) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (responseTime!=null) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (response!=null) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -2,7 +2,6 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dialogs
|
||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.SystemClock
|
|
||||||
import com.atech.android.library.wizardpager.WizardPagerActivity
|
import com.atech.android.library.wizardpager.WizardPagerActivity
|
||||||
import com.atech.android.library.wizardpager.WizardPagerContext
|
import com.atech.android.library.wizardpager.WizardPagerContext
|
||||||
import com.atech.android.library.wizardpager.data.WizardPagerSettings
|
import com.atech.android.library.wizardpager.data.WizardPagerSettings
|
||||||
|
@ -10,14 +9,10 @@ import com.atech.android.library.wizardpager.defs.WizardStepsWayType
|
||||||
import info.nightscout.androidaps.MainApp
|
import info.nightscout.androidaps.MainApp
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
import info.nightscout.androidaps.activities.NoSplashActivity
|
import info.nightscout.androidaps.activities.NoSplashActivity
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
import info.nightscout.androidaps.plugins.pump.omnipod.driver.comm.AapsOmnipodManager
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.AapsOmnipodManager
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.initpod.InitPodCancelAction
|
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.initpod.InitPodCancelAction
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.initpod.InitPodWizardModel
|
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.initpod.InitPodWizardModel
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.comm.OmnipodManagerAAPS
|
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.removepod.RemovePodWizardModel
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodPumpValuesChanged
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodRefreshButtonState
|
|
||||||
import info.nightscout.androidaps.utils.OKDialog
|
import info.nightscout.androidaps.utils.OKDialog
|
||||||
import kotlinx.android.synthetic.main.omnipod_pod_mgmt.*
|
import kotlinx.android.synthetic.main.omnipod_pod_mgmt.*
|
||||||
|
|
||||||
|
@ -49,7 +44,7 @@ class PodManagementActivity : NoSplashActivity() {
|
||||||
|
|
||||||
fun initPodAction() {
|
fun initPodAction() {
|
||||||
|
|
||||||
// TODO check if RL is running
|
// TODO check if RL is running and that pod is not active
|
||||||
|
|
||||||
val pagerSettings = WizardPagerSettings()
|
val pagerSettings = WizardPagerSettings()
|
||||||
|
|
||||||
|
@ -59,30 +54,43 @@ class PodManagementActivity : NoSplashActivity() {
|
||||||
pagerSettings.setNextButtonBackground(R.drawable.selectable_item_background)
|
pagerSettings.setNextButtonBackground(R.drawable.selectable_item_background)
|
||||||
pagerSettings.setBackStringResourceId(R.string.cancel)
|
pagerSettings.setBackStringResourceId(R.string.cancel)
|
||||||
pagerSettings.setCancelAction(InitPodCancelAction())
|
pagerSettings.setCancelAction(InitPodCancelAction())
|
||||||
pagerSettings.setTheme(R.style.AppTheme_NoActionBar)
|
|
||||||
|
|
||||||
|
val wizardPagerContext = WizardPagerContext.getInstance();
|
||||||
|
|
||||||
WizardPagerContext.getInstance().pagerSettings = pagerSettings
|
wizardPagerContext.clearContext()
|
||||||
WizardPagerContext.getInstance().wizardModel = InitPodWizardModel(applicationContext)
|
wizardPagerContext.pagerSettings = pagerSettings
|
||||||
|
wizardPagerContext.wizardModel = InitPodWizardModel(applicationContext)
|
||||||
|
|
||||||
|
val myIntent = Intent(this@PodManagementActivity, WizardPagerActivity::class.java)
|
||||||
|
this@PodManagementActivity.startActivity(myIntent)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun removePodAction() {
|
||||||
|
// TODO check that pod is active
|
||||||
|
|
||||||
|
val pagerSettings = WizardPagerSettings()
|
||||||
|
|
||||||
|
pagerSettings.setWizardStepsWayType(WizardStepsWayType.CancelNext)
|
||||||
|
pagerSettings.setFinishStringResourceId(R.string.close)
|
||||||
|
pagerSettings.setFinishButtonBackground(R.drawable.finish_background)
|
||||||
|
pagerSettings.setNextButtonBackground(R.drawable.selectable_item_background)
|
||||||
|
pagerSettings.setBackStringResourceId(R.string.cancel)
|
||||||
|
pagerSettings.setCancelAction(InitPodCancelAction())
|
||||||
|
|
||||||
|
val wizardPagerContext = WizardPagerContext.getInstance();
|
||||||
|
|
||||||
|
wizardPagerContext.clearContext()
|
||||||
|
wizardPagerContext.pagerSettings = pagerSettings
|
||||||
|
wizardPagerContext.wizardModel = RemovePodWizardModel(applicationContext)
|
||||||
|
|
||||||
val myIntent = Intent(this@PodManagementActivity, WizardPagerActivity::class.java)
|
val myIntent = Intent(this@PodManagementActivity, WizardPagerActivity::class.java)
|
||||||
this@PodManagementActivity.startActivity(myIntent)
|
this@PodManagementActivity.startActivity(myIntent)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//OKDialog.showConfirmation(this,
|
|
||||||
// MainApp.gs(R.string.omnipod_cmd_init_pod_na), null)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun removePodAction() {
|
|
||||||
OKDialog.showConfirmation(this,
|
|
||||||
MainApp.gs(R.string.omnipod_cmd_deactivate_pod_na), null)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun resetPodAction() {
|
fun resetPodAction() {
|
||||||
|
// TODO check that pod is active
|
||||||
|
|
||||||
OKDialog.showConfirmation(this,
|
OKDialog.showConfirmation(this,
|
||||||
MainApp.gs(R.string.omnipod_cmd_reset_pod_desc), Thread {
|
MainApp.gs(R.string.omnipod_cmd_reset_pod_desc), Thread {
|
||||||
AapsOmnipodManager.getInstance().resetPodStatus()
|
AapsOmnipodManager.getInstance().resetPodStatus()
|
||||||
|
|
|
@ -2,6 +2,8 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.initpod;
|
||||||
|
|
||||||
import com.atech.android.library.wizardpager.defs.action.AbstractCancelAction;
|
import com.atech.android.library.wizardpager.defs.action.AbstractCancelAction;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.driver.comm.AapsOmnipodManager;
|
||||||
|
|
||||||
public class InitPodCancelAction extends AbstractCancelAction {
|
public class InitPodCancelAction extends AbstractCancelAction {
|
||||||
@Override
|
@Override
|
||||||
public void execute(String cancelReason) {
|
public void execute(String cancelReason) {
|
||||||
|
@ -10,12 +12,8 @@ public class InitPodCancelAction extends AbstractCancelAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.cancelActionText.equals("Cancel")) {
|
if (this.cancelActionText.equals("Cancel")) {
|
||||||
// TODO
|
AapsOmnipodManager.getInstance().resetPodStatus();
|
||||||
// remove pod from SP
|
|
||||||
|
|
||||||
// do refresh of tab
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ import android.app.Activity;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.SystemClock;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
@ -27,7 +26,7 @@ import java.util.Map;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.data.PumpEnactResult;
|
import info.nightscout.androidaps.data.PumpEnactResult;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.AapsOmnipodManager;
|
import info.nightscout.androidaps.plugins.pump.omnipod.driver.comm.AapsOmnipodManager;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitActionType;
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitActionType;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitReceiver;
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitReceiver;
|
||||||
|
|
||||||
|
@ -103,6 +102,10 @@ public class InitActionFragment extends Fragment implements PodInitReceiver {
|
||||||
mapCheckBoxes.put(child, checkBox1);
|
mapCheckBoxes.put(child, checkBox1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (podInitActionType==PodInitActionType.DeactivatePodWizardStep) {
|
||||||
|
headerView.setText(R.string.omnipod_remove_pod_wizard_step2_action_header);
|
||||||
|
}
|
||||||
|
|
||||||
return rootView;
|
return rootView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,43 +32,33 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.pages.Init
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.pages.PodInfoFragment;
|
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.pages.PodInfoFragment;
|
||||||
|
|
||||||
public class RemovePodWizardModel extends AbstractWizardModel {
|
public class RemovePodWizardModel extends AbstractWizardModel {
|
||||||
|
|
||||||
public RemovePodWizardModel(Context context) {
|
public RemovePodWizardModel(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected PageList onNewRootPageList() {
|
protected PageList onNewRootPageList() {
|
||||||
// TODO
|
|
||||||
return new PageList(
|
return new PageList(
|
||||||
|
|
||||||
new DisplayTextPage(this,
|
new DisplayTextPage(this,
|
||||||
R.string.omnipod_init_pod_wizard_step1_title,
|
R.string.omnipod_remove_pod_wizard_step1_title,
|
||||||
R.string.omnipod_init_pod_wizard_step1_desc,
|
R.string.omnipod_remove_pod_wizard_step1_desc,
|
||||||
R.style.WizardPagePodContent).setRequired(true).setCancelReason("None"),
|
R.style.WizardPagePodContent).setRequired(true).setCancelReason("None"),
|
||||||
|
|
||||||
new InitActionPage(this,
|
new InitActionPage(this,
|
||||||
R.string.omnipod_init_pod_wizard_step2_title,
|
R.string.omnipod_remove_pod_wizard_step2_title,
|
||||||
PodInitActionType.PairAndPrimeWizardStep
|
PodInitActionType.DeactivatePodWizardStep
|
||||||
).setRequired(true).setCancelReason("Cancel"),
|
).setRequired(true).setCancelReason("Cancel")
|
||||||
|
|
||||||
new DisplayTextPage(this,
|
|
||||||
R.string.omnipod_init_pod_wizard_step3_title,
|
|
||||||
R.string.omnipod_init_pod_wizard_step3_desc,
|
|
||||||
R.style.WizardPagePodContent).setRequired(true).setCancelReason("Cancel"),
|
|
||||||
|
|
||||||
new InitActionPage(this,
|
|
||||||
R.string.omnipod_init_pod_wizard_step4_title,
|
|
||||||
PodInitActionType.FillCannulaSetBasalProfileWizardStep).setRequired(true).setCancelReason("Cancel")
|
|
||||||
|
|
||||||
//new PodInfoPage(this, "Pod Info").setRequired(true)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Fragment getReviewFragment() {
|
public Fragment getReviewFragment() {
|
||||||
// TODO
|
|
||||||
PodInfoFragment.isInitPod = false;
|
PodInfoFragment.isInitPod = false;
|
||||||
return DisplayTextFragment.create(null, 0, 0);
|
return new PodInfoFragment();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,21 +1,27 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.comm;
|
package info.nightscout.androidaps.plugins.pump.omnipod.driver.comm;
|
||||||
|
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
|
|
||||||
import info.nightscout.androidaps.data.Profile;
|
import info.nightscout.androidaps.data.Profile;
|
||||||
import info.nightscout.androidaps.data.PumpEnactResult;
|
import info.nightscout.androidaps.data.PumpEnactResult;
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair;
|
import info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationService;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodManager;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.OmnipodAction;
|
||||||
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.PodInfoType;
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInfoType;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitActionType;
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitActionType;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitReceiver;
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitReceiver;
|
||||||
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.driver.OmnipodPumpStatus;
|
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.comm.OmnipodManagerAAPS;
|
import info.nightscout.androidaps.plugins.pump.omnipod.driver.db.PodDbEntry;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.driver.db.PodDbEntryType;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodPumpValuesChanged;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;
|
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;
|
||||||
|
|
||||||
public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface {
|
public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface {
|
||||||
private final OmnipodManagerAAPS delegate;
|
private final OmnipodManager delegate;
|
||||||
|
|
||||||
private static AapsOmnipodManager instance;
|
private static AapsOmnipodManager instance;
|
||||||
private OmnipodPumpStatus pumpStatus;
|
private OmnipodPumpStatus pumpStatus;
|
||||||
|
@ -41,7 +47,10 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
|
||||||
// FIXME we need a basal profile here
|
// FIXME we need a basal profile here
|
||||||
PumpEnactResult result = delegate.insertCannula(profile);
|
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));
|
||||||
OmnipodUtil.setPodSessionState(delegate.podState);
|
if (result.success) {
|
||||||
|
OmnipodUtil.setPodSessionState(delegate.getPodState());
|
||||||
|
RxBus.INSTANCE.send(new EventOmnipodPumpValuesChanged());
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return new PumpEnactResult().success(false).enacted(false).comment("Illegal PodInitActionType: " + podInitActionType.name());
|
return new PumpEnactResult().success(false).enacted(false).comment("Illegal PodInitActionType: " + podInitActionType.name());
|
||||||
|
@ -54,9 +63,20 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PumpEnactResult deactivatePod(PodInitReceiver podInitReceiver) {
|
public PumpEnactResult deactivatePod(PodInitReceiver podInitReceiver) {
|
||||||
return delegate.deactivatePod(podInitReceiver);
|
|
||||||
|
PumpEnactResult result = delegate.deactivatePod();
|
||||||
|
podInitReceiver.returnInitTaskStatus(PodInitActionType.DeactivatePodWizardStep, result.success, (result.success ? null : result.comment));
|
||||||
|
|
||||||
|
if (result.success) {
|
||||||
|
OmnipodUtil.setPodSessionState(null);
|
||||||
|
RxBus.INSTANCE.send(new EventOmnipodPumpValuesChanged());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PumpEnactResult setBasalProfile(Profile basalProfile) {
|
public PumpEnactResult setBasalProfile(Profile basalProfile) {
|
||||||
return delegate.setBasalProfile(basalProfile);
|
return delegate.setBasalProfile(basalProfile);
|
||||||
|
@ -64,7 +84,16 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PumpEnactResult resetPodStatus() {
|
public PumpEnactResult resetPodStatus() {
|
||||||
return delegate.resetPodState();
|
|
||||||
|
PumpEnactResult result = delegate.resetPodState();
|
||||||
|
|
||||||
|
//addToHistory(System.currentTimeMillis(), PodDbEntryType.ResetPodState, null, null, null, null);
|
||||||
|
|
||||||
|
OmnipodUtil.setPodSessionState(null);
|
||||||
|
|
||||||
|
RxBus.INSTANCE.send(new EventOmnipodPumpValuesChanged());
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -95,6 +124,7 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
|
||||||
@Override
|
@Override
|
||||||
public void setPumpStatus(OmnipodPumpStatus pumpStatus) {
|
public void setPumpStatus(OmnipodPumpStatus pumpStatus) {
|
||||||
this.pumpStatus = pumpStatus;
|
this.pumpStatus = pumpStatus;
|
||||||
|
this.getCommunicationService().setPumpStatus(pumpStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO should we add this to the OmnipodCommunicationManager interface?
|
// TODO should we add this to the OmnipodCommunicationManager interface?
|
||||||
|
@ -130,4 +160,14 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
|
||||||
public String getPodStateAsString() {
|
public String getPodStateAsString() {
|
||||||
return delegate.getPodStateAsString();
|
return delegate.getPodStateAsString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void addToHistory(long requestTime, PodDbEntryType entryType, String data, boolean success) {
|
||||||
|
// TODO andy needs to be refactored
|
||||||
|
|
||||||
|
//PodDbEntry entry = new PodDbEntry(requestTime, entryType);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -62,7 +62,7 @@ public class OmnipodManagerAAPS extends OmnipodManager //implements OmnipodCommu
|
||||||
public PumpEnactResult resetPodState() {
|
public PumpEnactResult resetPodState() {
|
||||||
resetPodStateInternal();
|
resetPodStateInternal();
|
||||||
|
|
||||||
addToHistory(System.currentTimeMillis(), PodDbEntryType.ResetPodState, null, null, null, true);
|
//addToHistory(System.currentTimeMillis(), PodDbEntryType.ResetPodState, null, null, null, true);
|
||||||
|
|
||||||
return new PumpEnactResult().success(true).enacted(true);
|
return new PumpEnactResult().success(true).enacted(true);
|
||||||
}
|
}
|
||||||
|
@ -76,22 +76,5 @@ public class OmnipodManagerAAPS extends OmnipodManager //implements OmnipodCommu
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void addToHistory(long requestTime, PodDbEntryType entryType, OmnipodAction omnipodAction, Long responseTime, Object response, boolean success) {
|
|
||||||
// TODO andy
|
|
||||||
|
|
||||||
PodDbEntry entry = new PodDbEntry(requestTime, entryType);
|
|
||||||
|
|
||||||
if (omnipodAction!=null) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (responseTime!=null) {
|
|
||||||
entry.setDateTimeResponse(responseTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (response!=null) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLin
|
||||||
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.RileyLinkService;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkService;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkServiceData;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkServiceData;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.AapsOmnipodManager;
|
import info.nightscout.androidaps.plugins.pump.omnipod.driver.comm.AapsOmnipodManager;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodPumpPlugin;
|
import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodPumpPlugin;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationService;
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationService;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommunicationManagerInterface;
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommunicationManagerInterface;
|
||||||
|
@ -121,11 +121,15 @@ public class RileyLinkOmnipodService extends RileyLinkService {
|
||||||
Gson gson = OmnipodUtil.getGsonInstance();
|
Gson gson = OmnipodUtil.getGsonInstance();
|
||||||
String storedPodState = SP.getString(OmnipodConst.Prefs.PodState, null);
|
String storedPodState = SP.getString(OmnipodConst.Prefs.PodState, null);
|
||||||
podState = gson.fromJson(storedPodState, PodSessionState.class);
|
podState = gson.fromJson(storedPodState, PodSessionState.class);
|
||||||
|
OmnipodUtil.setPodSessionState(podState);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
LOG.error("Could not deserialize Pod state: " + ex.getClass().getSimpleName() + ": " + ex.getMessage());
|
LOG.error("Could not deserialize Pod state: " + ex.getClass().getSimpleName() + ": " + ex.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
omnipodCommunicationManager = new AapsOmnipodManager(new OmnipodCommunicationService(rfspy), podState, pumpStatus);
|
OmnipodCommunicationService omnipodCommunicationService = new OmnipodCommunicationService(rfspy);
|
||||||
|
omnipodCommunicationService.setPumpStatus(pumpStatus);
|
||||||
|
|
||||||
|
omnipodCommunicationManager = new AapsOmnipodManager(omnipodCommunicationService, podState, pumpStatus);
|
||||||
} else {
|
} else {
|
||||||
omnipodCommunicationManager = AapsOmnipodManager.getInstance();
|
omnipodCommunicationManager = AapsOmnipodManager.getInstance();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1651,10 +1651,7 @@
|
||||||
<string name="omnipod_cmd_reset_pod">Reset Pod</string>
|
<string name="omnipod_cmd_reset_pod">Reset Pod</string>
|
||||||
<string name="omnipod_cmd_pod_history">Pod History</string>
|
<string name="omnipod_cmd_pod_history">Pod History</string>
|
||||||
|
|
||||||
<string name="omnipod_cmd_init_pod_na">Init Pod not available at the moment.</string>
|
<string name="omnipod_cmd_reset_pod_desc">If you press "OK" Pod will be forcefully removed. Do this only if you can not communicate with Pod anymore.</string>
|
||||||
<string name="omnipod_cmd_deactivate_pod_na">Deactivate Pod not available at the moment.</string>
|
|
||||||
<string name="omnipod_cmd_reset_pod_na">Reset Pod not available at the moment.</string>
|
|
||||||
<string name="omnipod_cmd_reset_pod_desc">If you press "OK" Pod will be forcefully removed. Do this only if Deactivate Pod fails.</string>
|
|
||||||
<string name="omnipod_cmd_pod_history_na">Pod History not available at the moment.</string>
|
<string name="omnipod_cmd_pod_history_na">Pod History not available at the moment.</string>
|
||||||
|
|
||||||
<string name="omnipod_namex" translatable="false">Omnipod</string>
|
<string name="omnipod_namex" translatable="false">Omnipod</string>
|
||||||
|
@ -1671,7 +1668,13 @@
|
||||||
<string name="omnipod_init_pod_wizard_step4_title">Fill Cannula and Start Basal delivery</string>
|
<string name="omnipod_init_pod_wizard_step4_title">Fill Cannula and Start Basal delivery</string>
|
||||||
<string name="omnipod_init_pod_wizard_pod_info_title">Pod Info</string>
|
<string name="omnipod_init_pod_wizard_pod_info_title">Pod Info</string>
|
||||||
<string name="omnipod_init_pod_wizard_pod_info_init_pod_description">Pod is now active.\n\nBasal has been programmed.\n\nCheck infusion site and cannula. If cannula seems incorrectly inserted, please replace the Pod.</string>
|
<string name="omnipod_init_pod_wizard_pod_info_init_pod_description">Pod is now active.\n\nBasal has been programmed.\n\nCheck infusion site and cannula. If cannula seems incorrectly inserted, please replace the Pod.</string>
|
||||||
<string name="omnipod_init_pod_wizard_pod_info_remove_pod_description">Pod Info</string>
|
|
||||||
|
<string name="omnipod_remove_pod_wizard_step1_title">Prepare for Pod Removal</string>
|
||||||
|
<string name="omnipod_remove_pod_wizard_step1_desc">\nPress <b>Next</b> to begin Pod removal process.\n\n\nThis will stop delivery of insulin and deactivate Pod.</string>
|
||||||
|
<string name="omnipod_remove_pod_wizard_step2_title">Remove the Pod</string>
|
||||||
|
<string name="omnipod_remove_pod_wizard_step2_action_header">We are trying to communicate with Pod.\n\nWhen all items are checked, you can press Next. If Pod removal fails and you click on Cancel, Pod will be forcefully removed from AAPS.</string>
|
||||||
|
|
||||||
|
<string name="omnipod_init_pod_wizard_pod_info_remove_pod_description">Pod deactivated.\n\nRemove and discard the Pod.\n\nWhen you are ready, prepare the next Pod and start <b>Init Pod</b> action.</string>
|
||||||
|
|
||||||
<string name="omnipod_init_pod_pair_pod">Pair Pod</string>
|
<string name="omnipod_init_pod_pair_pod">Pair Pod</string>
|
||||||
<string name="omnipod_init_pod_prime_pod">Prime Pod</string>
|
<string name="omnipod_init_pod_prime_pod">Prime Pod</string>
|
||||||
|
|
Loading…
Reference in a new issue