- fixed 16, 17, 18
- added some code for db
This commit is contained in:
parent
b4abf00d98
commit
24430a5c81
5 changed files with 77 additions and 27 deletions
|
@ -207,11 +207,13 @@ class OmnipodFragment : Fragment() {
|
|||
omnipod_pod_expiry.text = "-"
|
||||
omnipod_pod_status.text = MainApp.gs(R.string.omnipod_pod_no_pod_connected)
|
||||
pumpStatus.podAvailable = false
|
||||
pumpStatus.podNumber == null
|
||||
} else {
|
||||
podAvailable = true
|
||||
pumpStatus.podAvailable = true
|
||||
omnipod_pod_address.text = pumpStatus.podSessionState.address.toString()
|
||||
omnipod_pod_expiry.text = pumpStatus.podSessionState.expiryDateAsString
|
||||
pumpStatus.podNumber == pumpStatus.podSessionState.address.toString()
|
||||
|
||||
//pumpStatus.podSessionState = checkStatusSet(pumpStatus.podSessionState,
|
||||
// OmnipodUtil.getPodSessionState()) as PodSessionState?
|
||||
|
|
|
@ -576,9 +576,10 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
TreatmentsPlugin.getPlugin().addToHistoryTreatment(detailedBolusInfo, true);
|
||||
|
||||
// we subtract insulin, exact amount will be visible with next remainingInsulin update.
|
||||
// if (getPodPumpStatusObject().reservoirRemainingUnits != 0) {
|
||||
// getPodPumpStatusObject().reservoirRemainingUnits -= detailedBolusInfo.insulin;
|
||||
// }
|
||||
if (getPodPumpStatusObject().reservoirRemainingUnits != 0 &&
|
||||
getPodPumpStatusObject().reservoirRemainingUnits != 75 ) {
|
||||
getPodPumpStatusObject().reservoirRemainingUnits -= detailedBolusInfo.insulin;
|
||||
}
|
||||
|
||||
incrementStatistics(detailedBolusInfo.isSMB ? OmnipodConst.Statistics.SMBBoluses
|
||||
: OmnipodConst.Statistics.StandardBoluses);
|
||||
|
|
|
@ -11,6 +11,7 @@ import info.nightscout.androidaps.R
|
|||
import info.nightscout.androidaps.activities.NoSplashActivity
|
||||
import info.nightscout.androidaps.events.EventRefreshOverview
|
||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.SetupProgress
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.comm.AapsOmnipodManager
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.initpod.InitPodCancelAction
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.initpod.InitPodWizardModel
|
||||
|
@ -27,6 +28,7 @@ import kotlinx.android.synthetic.main.omnipod_pod_mgmt.*
|
|||
class PodManagementActivity : NoSplashActivity() {
|
||||
|
||||
private var initPodChanged = false
|
||||
private var podSessionFullyInitalized = false
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
@ -83,7 +85,7 @@ class PodManagementActivity : NoSplashActivity() {
|
|||
|
||||
wizardPagerContext.clearContext()
|
||||
wizardPagerContext.pagerSettings = pagerSettings
|
||||
wizardPagerContext.wizardModel = InitPodWizardModel(applicationContext)
|
||||
wizardPagerContext.wizardModel = InitPodWizardModel(applicationContext, !podSessionFullyInitalized)
|
||||
|
||||
val myIntent = Intent(this@PodManagementActivity, WizardPagerActivity::class.java)
|
||||
this@PodManagementActivity.startActivity(myIntent)
|
||||
|
@ -129,7 +131,14 @@ class PodManagementActivity : NoSplashActivity() {
|
|||
fun refreshButtons() {
|
||||
val isPodSessionActive = (OmnipodUtil.getPodSessionState()!=null)
|
||||
|
||||
initpod_init_pod.isEnabled = !isPodSessionActive
|
||||
if (isPodSessionActive) {
|
||||
podSessionFullyInitalized = !OmnipodUtil.getPodSessionState().getSetupProgress().isBefore(SetupProgress.COMPLETED)
|
||||
initpod_init_pod.isEnabled = !podSessionFullyInitalized
|
||||
} else {
|
||||
podSessionFullyInitalized = false
|
||||
initpod_init_pod.isEnabled = true
|
||||
}
|
||||
|
||||
initpod_remove_pod.isEnabled = isPodSessionActive
|
||||
initpod_reset_pod.isEnabled = isPodSessionActive
|
||||
}
|
||||
|
|
|
@ -33,34 +33,57 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.pages.PodI
|
|||
* Created by andy on 12/11/2019
|
||||
*/
|
||||
public class InitPodWizardModel extends AbstractWizardModel {
|
||||
public InitPodWizardModel(Context context) {
|
||||
|
||||
boolean isFullInit = true;
|
||||
|
||||
public InitPodWizardModel(Context context, boolean isFullInit) {
|
||||
super(context);
|
||||
this.isFullInit = isFullInit;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PageList onNewRootPageList() {
|
||||
return new PageList(
|
||||
|
||||
new DisplayTextPage(this,
|
||||
R.string.omnipod_init_pod_wizard_step1_title,
|
||||
R.string.omnipod_init_pod_wizard_step1_desc,
|
||||
R.style.WizardPagePodContent).setRequired(true).setCancelReason("None"),
|
||||
if (isFullInit) {
|
||||
|
||||
new InitActionPage(this,
|
||||
R.string.omnipod_init_pod_wizard_step2_title,
|
||||
PodInitActionType.PairAndPrimeWizardStep
|
||||
).setRequired(true).setCancelReason("Cancel"),
|
||||
return new PageList(
|
||||
|
||||
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 DisplayTextPage(this,
|
||||
R.string.omnipod_init_pod_wizard_step1_title,
|
||||
R.string.omnipod_init_pod_wizard_step1_desc,
|
||||
R.style.WizardPagePodContent).setRequired(true).setCancelReason("None"),
|
||||
|
||||
new InitActionPage(this,
|
||||
R.string.omnipod_init_pod_wizard_step4_title,
|
||||
PodInitActionType.FillCannulaSetBasalProfileWizardStep
|
||||
).setRequired(true).setCancelReason("Cancel")
|
||||
);
|
||||
new InitActionPage(this,
|
||||
R.string.omnipod_init_pod_wizard_step2_title,
|
||||
PodInitActionType.PairAndPrimeWizardStep
|
||||
).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")
|
||||
);
|
||||
} else {
|
||||
|
||||
return new PageList(
|
||||
|
||||
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")
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ import info.nightscout.androidaps.MainApp;
|
|||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
import info.nightscout.androidaps.data.PumpEnactResult;
|
||||
import info.nightscout.androidaps.db.DatabaseHelper;
|
||||
import info.nightscout.androidaps.db.Source;
|
||||
import info.nightscout.androidaps.db.TemporaryBasal;
|
||||
import info.nightscout.androidaps.events.Event;
|
||||
|
@ -43,6 +44,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule.BasalSchedu
|
|||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule.BasalScheduleEntry;
|
||||
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.db.PodHistory;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.db.PodHistoryEntryType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodAcknowledgeAlertsChanged;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodPumpValuesChanged;
|
||||
|
@ -419,10 +421,23 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
|
|||
}
|
||||
}
|
||||
|
||||
private void addToHistory(long requestTime, PodHistoryEntryType entryType, String data, boolean success) {
|
||||
// TODO andy needs to be refactored
|
||||
public void addToHistory(long requestTime, PodHistoryEntryType entryType, Object data, boolean success) {
|
||||
|
||||
PodHistory podHistory = new PodHistory(requestTime, entryType);
|
||||
|
||||
if (data!=null) {
|
||||
if (data instanceof String) {
|
||||
podHistory.setData((String)data);
|
||||
} else {
|
||||
podHistory.setData(OmnipodUtil.getGsonInstance().toJson(data));
|
||||
}
|
||||
}
|
||||
|
||||
podHistory.setSuccess(success);
|
||||
podHistory.setPodSerial(pumpStatus.podNumber);
|
||||
|
||||
MainApp.getDbHelper().createOrUpdate(podHistory);
|
||||
|
||||
//PodDbEntry entry = new PodDbEntry(requestTime, entryType);
|
||||
}
|
||||
|
||||
private void handleSetupActionResult(PodInitActionType podInitActionType, PodInitReceiver podInitReceiver, SetupActionResult res) {
|
||||
|
|
Loading…
Reference in a new issue