- added Pod debug button (its 5th button and needs to be enabled in configuration)
- changed PodHistoryActivity to use PodHistory entries, removed filter for now, and values are not yet supported - added configuration for debug button - extended DatabaseHelper t retrive PodHistory for last day...
This commit is contained in:
parent
aea725e9ad
commit
c589993985
|
@ -307,7 +307,7 @@
|
||||||
android:exported="true" />
|
android:exported="true" />
|
||||||
|
|
||||||
<activity android:name=".plugins.pump.omnipod.dialogs.PodManagementActivity" />
|
<activity android:name=".plugins.pump.omnipod.dialogs.PodManagementActivity" />
|
||||||
<activity android:name=".plugins.pump.omnipod.dialogs.InitPodWizard" />
|
<activity android:name=".plugins.pump.omnipod.dialogs.PodHistoryActivity" />
|
||||||
<activity android:name="com.atech.android.library.wizardpager.WizardPagerActivity"
|
<activity android:name="com.atech.android.library.wizardpager.WizardPagerActivity"
|
||||||
android:theme="@style/AppTheme.NoActionBar"/>
|
android:theme="@style/AppTheme.NoActionBar"/>
|
||||||
|
|
||||||
|
|
|
@ -369,7 +369,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
return getDao(InsightHistoryOffset.class);
|
return getDao(InsightHistoryOffset.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Dao<PodHistory, String> getDaoPodHistory() throws SQLException {
|
private Dao<PodHistory, Long> getDaoPodHistory() throws SQLException {
|
||||||
return getDao(PodHistory.class);
|
return getDao(PodHistory.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1913,4 +1913,22 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<PodHistory> getPodHistoryFromTime(long from, boolean ascending) {
|
||||||
|
try {
|
||||||
|
Dao<PodHistory, Long> daoPodHistory = getDaoPodHistory();
|
||||||
|
List<PodHistory> podHistories;
|
||||||
|
QueryBuilder<PodHistory, Long> queryBuilder = daoPodHistory.queryBuilder();
|
||||||
|
queryBuilder.orderBy("date", ascending);
|
||||||
|
//queryBuilder.limit(100L);
|
||||||
|
Where where = queryBuilder.where();
|
||||||
|
where.ge("date", from);
|
||||||
|
PreparedQuery<PodHistory> preparedQuery = queryBuilder.prepare();
|
||||||
|
podHistories = daoPodHistory.query(preparedQuery);
|
||||||
|
return podHistories;
|
||||||
|
} catch (SQLException e) {
|
||||||
|
log.error("Unhandled exception", e);
|
||||||
|
}
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import android.view.ViewGroup
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
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.EventPreferenceChange
|
||||||
import info.nightscout.androidaps.logging.L
|
import info.nightscout.androidaps.logging.L
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
||||||
|
@ -25,17 +26,17 @@ import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodDevice
|
||||||
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.driver.OmnipodPumpStatus
|
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.driver.comm.AapsOmnipodManager
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodAcknowledgeAlertsChanged
|
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodAcknowledgeAlertsChanged
|
||||||
|
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.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
import info.nightscout.androidaps.utils.*
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
|
||||||
import info.nightscout.androidaps.utils.SetWarnColor
|
|
||||||
import info.nightscout.androidaps.utils.T
|
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||||
import io.reactivex.disposables.CompositeDisposable
|
import io.reactivex.disposables.CompositeDisposable
|
||||||
import io.reactivex.disposables.Disposable
|
import io.reactivex.disposables.Disposable
|
||||||
|
import io.reactivex.schedulers.Schedulers
|
||||||
import kotlinx.android.synthetic.main.omnipod_fragment.*
|
import kotlinx.android.synthetic.main.omnipod_fragment.*
|
||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
|
|
||||||
|
@ -66,8 +67,6 @@ 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_rl_status.text = MainApp.gs(RileyLinkServiceState.NotStarted.getResourceId(RileyLinkTargetDevice.Omnipod))
|
omnipod_rl_status.text = MainApp.gs(RileyLinkServiceState.NotStarted.getResourceId(RileyLinkTargetDevice.Omnipod))
|
||||||
|
|
||||||
omnipod_pod_status.setTextColor(Color.WHITE)
|
omnipod_pod_status.setTextColor(Color.WHITE)
|
||||||
|
@ -113,6 +112,19 @@ class OmnipodFragment : Fragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
omnipod_pod_debug.setOnClickListener {
|
||||||
|
if (!OmnipodUtil.getPumpStatus().verifyConfiguration()) {
|
||||||
|
OmnipodUtil.displayNotConfiguredDialog(context)
|
||||||
|
} else {
|
||||||
|
val readPulseLog = AapsOmnipodManager.getInstance().readPulseLog()
|
||||||
|
|
||||||
|
OKDialog.showConfirmation(null,
|
||||||
|
"Pulse Log:\n" + readPulseLog.toString(), null)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setVisibilityOfPodDebugButton()
|
||||||
|
|
||||||
updateGUI()
|
updateGUI()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,9 +151,24 @@ class OmnipodFragment : Fragment() {
|
||||||
.toObservable(EventOmnipodAcknowledgeAlertsChanged::class.java)
|
.toObservable(EventOmnipodAcknowledgeAlertsChanged::class.java)
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe({ updateAcknowledgeAlerts(OmnipodUtil.getPumpStatus()) }, { FabricPrivacy.logException(it) })
|
.subscribe({ updateAcknowledgeAlerts(OmnipodUtil.getPumpStatus()) }, { FabricPrivacy.logException(it) })
|
||||||
|
disposable.add(RxBus
|
||||||
|
.toObservable(EventPreferenceChange::class.java)
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe({ event ->
|
||||||
|
setVisibilityOfPodDebugButton()
|
||||||
|
}, { FabricPrivacy.logException(it) })
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun setVisibilityOfPodDebugButton() {
|
||||||
|
val isEnabled = SP.getBoolean(OmnipodConst.Prefs.PodExpertDebugModeEnabled, false)
|
||||||
|
|
||||||
|
if (isEnabled)
|
||||||
|
omnipod_pod_debug.visibility = View.VISIBLE
|
||||||
|
else
|
||||||
|
omnipod_pod_debug.visibility = View.GONE
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
|
@ -197,11 +224,6 @@ class OmnipodFragment : Fragment() {
|
||||||
MainApp.gs(it.getResourceId(RileyLinkTargetDevice.Omnipod))
|
MainApp.gs(it.getResourceId(RileyLinkTargetDevice.Omnipod))
|
||||||
} ?: "-"
|
} ?: "-"
|
||||||
|
|
||||||
if (pumpStatus.podNumber == null) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
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 = "-"
|
||||||
|
|
|
@ -185,6 +185,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
||||||
if ((event.isChanged(R.string.key_omnipod_beep_basal_enabled)) ||
|
if ((event.isChanged(R.string.key_omnipod_beep_basal_enabled)) ||
|
||||||
(event.isChanged(R.string.key_omnipod_beep_bolus_enabled)) ||
|
(event.isChanged(R.string.key_omnipod_beep_bolus_enabled)) ||
|
||||||
(event.isChanged(R.string.key_omnipod_beep_tbr_enabled)) ||
|
(event.isChanged(R.string.key_omnipod_beep_tbr_enabled)) ||
|
||||||
|
(event.isChanged(R.string.key_omnipod_pod_expert_debug_enabled)) ||
|
||||||
(event.isChanged(R.string.key_omnipod_beep_smb_enabled)))
|
(event.isChanged(R.string.key_omnipod_beep_smb_enabled)))
|
||||||
refreshConfiguration();
|
refreshConfiguration();
|
||||||
}, FabricPrivacy::logException)
|
}, FabricPrivacy::logException)
|
||||||
|
@ -380,7 +381,6 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
||||||
|
|
||||||
omnipodStatusRequestList.removeAll(removeList);
|
omnipodStatusRequestList.removeAll(removeList);
|
||||||
|
|
||||||
//getPodPumpStatus();
|
|
||||||
} else if (this.hasTimeDateOrTimeZoneChanged) {
|
} else if (this.hasTimeDateOrTimeZoneChanged) {
|
||||||
OmnipodUITask omnipodUITask = omnipodUIComm.executeCommand(OmnipodCommandType.SetTime);
|
OmnipodUITask omnipodUITask = omnipodUIComm.executeCommand(OmnipodCommandType.SetTime);
|
||||||
|
|
||||||
|
@ -396,7 +396,6 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -17,14 +17,19 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.GregorianCalendar;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
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.db.DatabaseHelper;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicPumpPlugin;
|
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicPumpPlugin;
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpHistoryEntry;
|
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpHistoryEntry;
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpHistoryEntryGroup;
|
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpHistoryEntryGroup;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.driver.db.PodHistory;
|
||||||
|
|
||||||
public class PodHistoryActivity extends NoSplashActivity {
|
public class PodHistoryActivity extends NoSplashActivity {
|
||||||
|
|
||||||
|
@ -37,7 +42,8 @@ public class PodHistoryActivity extends NoSplashActivity {
|
||||||
|
|
||||||
static TypeList showingType = null;
|
static TypeList showingType = null;
|
||||||
static PumpHistoryEntryGroup selectedGroup = PumpHistoryEntryGroup.All;
|
static PumpHistoryEntryGroup selectedGroup = PumpHistoryEntryGroup.All;
|
||||||
List<PumpHistoryEntry> filteredHistoryList = new ArrayList<>();
|
List<PodHistory> fullHistoryList = new ArrayList<>();
|
||||||
|
List<PodHistory> filteredHistoryList = new ArrayList<>();
|
||||||
|
|
||||||
RecyclerViewAdapter recyclerViewAdapter;
|
RecyclerViewAdapter recyclerViewAdapter;
|
||||||
boolean manualChange = false;
|
boolean manualChange = false;
|
||||||
|
@ -50,24 +56,37 @@ public class PodHistoryActivity extends NoSplashActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void prepareData() {
|
||||||
|
GregorianCalendar gc = new GregorianCalendar();
|
||||||
|
gc.add(Calendar.HOUR_OF_DAY, -24);
|
||||||
|
|
||||||
|
MainApp.getDbHelper().getPodHistoryFromTime(gc.getTimeInMillis(), false);
|
||||||
|
|
||||||
|
fullHistoryList.addAll(MainApp.getDbHelper().getPodHistoryFromTime(gc.getTimeInMillis(), true));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void filterHistory(PumpHistoryEntryGroup group) {
|
private void filterHistory(PumpHistoryEntryGroup group) {
|
||||||
|
|
||||||
this.filteredHistoryList.clear();
|
this.filteredHistoryList.clear();
|
||||||
|
|
||||||
List<PumpHistoryEntry> list = new ArrayList<>();
|
|
||||||
list.addAll(MedtronicPumpPlugin.getPlugin().getMedtronicHistoryData().getAllHistory());
|
|
||||||
|
|
||||||
//LOG.debug("Items on full list: {}", list.size());
|
//LOG.debug("Items on full list: {}", list.size());
|
||||||
|
|
||||||
if (group == PumpHistoryEntryGroup.All) {
|
this.filteredHistoryList.addAll(fullHistoryList);
|
||||||
this.filteredHistoryList.addAll(list);
|
|
||||||
} else {
|
// TODO
|
||||||
for (PumpHistoryEntry pumpHistoryEntry : list) {
|
|
||||||
if (pumpHistoryEntry.getEntryType().getGroup() == group) {
|
// if (group == PumpHistoryEntryGroup.All) {
|
||||||
this.filteredHistoryList.add(pumpHistoryEntry);
|
// this.filteredHistoryList.addAll(list);
|
||||||
}
|
// } else {
|
||||||
}
|
// for (PumpHistoryEntry pumpHistoryEntry : list) {
|
||||||
}
|
// if (pumpHistoryEntry.getEntryType().getGroup() == group) {
|
||||||
|
// this.filteredHistoryList.add(pumpHistoryEntry);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
if (this.recyclerViewAdapter != null) {
|
if (this.recyclerViewAdapter != null) {
|
||||||
this.recyclerViewAdapter.setHistoryList(this.filteredHistoryList);
|
this.recyclerViewAdapter.setHistoryList(this.filteredHistoryList);
|
||||||
|
@ -120,6 +139,8 @@ public class PodHistoryActivity extends NoSplashActivity {
|
||||||
llm = new LinearLayoutManager(this);
|
llm = new LinearLayoutManager(this);
|
||||||
recyclerView.setLayoutManager(llm);
|
recyclerView.setLayoutManager(llm);
|
||||||
|
|
||||||
|
prepareData();
|
||||||
|
|
||||||
recyclerViewAdapter = new RecyclerViewAdapter(filteredHistoryList);
|
recyclerViewAdapter = new RecyclerViewAdapter(filteredHistoryList);
|
||||||
recyclerView.setAdapter(recyclerViewAdapter);
|
recyclerView.setAdapter(recyclerViewAdapter);
|
||||||
|
|
||||||
|
@ -185,15 +206,15 @@ public class PodHistoryActivity extends NoSplashActivity {
|
||||||
|
|
||||||
public static class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.HistoryViewHolder> {
|
public static class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.HistoryViewHolder> {
|
||||||
|
|
||||||
List<PumpHistoryEntry> historyList;
|
List<PodHistory> historyList;
|
||||||
|
|
||||||
|
|
||||||
RecyclerViewAdapter(List<PumpHistoryEntry> historyList) {
|
RecyclerViewAdapter(List<PodHistory> historyList) {
|
||||||
this.historyList = historyList;
|
this.historyList = historyList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setHistoryList(List<PumpHistoryEntry> historyList) {
|
public void setHistoryList(List<PodHistory> historyList) {
|
||||||
// this.historyList.clear();
|
// this.historyList.clear();
|
||||||
// this.historyList.addAll(historyList);
|
// this.historyList.addAll(historyList);
|
||||||
|
|
||||||
|
@ -213,12 +234,12 @@ public class PodHistoryActivity extends NoSplashActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(HistoryViewHolder holder, int position) {
|
public void onBindViewHolder(HistoryViewHolder holder, int position) {
|
||||||
PumpHistoryEntry record = historyList.get(position);
|
PodHistory record = historyList.get(position);
|
||||||
|
|
||||||
if (record != null) {
|
if (record != null) {
|
||||||
holder.timeView.setText(record.getDateTimeString());
|
holder.timeView.setText(record.getDateTimeString());
|
||||||
holder.typeView.setText(record.getEntryType().getDescription());
|
holder.typeView.setText(record.getPodDbEntryType().getResourceId());
|
||||||
holder.valueView.setText(record.getDisplayableValue());
|
holder.valueView.setText(""); // TODO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,18 +255,18 @@ public class PodHistoryActivity extends NoSplashActivity {
|
||||||
super.onAttachedToRecyclerView(recyclerView);
|
super.onAttachedToRecyclerView(recyclerView);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static class HistoryViewHolder extends RecyclerView.ViewHolder {
|
static class HistoryViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
|
||||||
TextView timeView;
|
TextView timeView;
|
||||||
TextView typeView;
|
TextView typeView;
|
||||||
TextView valueView;
|
TextView valueView;
|
||||||
|
|
||||||
|
|
||||||
HistoryViewHolder(View itemView) {
|
HistoryViewHolder(View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
timeView = (TextView) itemView.findViewById(R.id.omnipod_history_time);
|
timeView = itemView.findViewById(R.id.omnipod_history_time);
|
||||||
typeView = (TextView) itemView.findViewById(R.id.omnipod_history_source);
|
typeView = itemView.findViewById(R.id.omnipod_history_source);
|
||||||
valueView = (TextView) itemView.findViewById(R.id.omnipod_history_description);
|
valueView = itemView.findViewById(R.id.omnipod_history_description);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,8 @@ import info.nightscout.androidaps.R
|
||||||
import info.nightscout.androidaps.activities.NoSplashActivity
|
import info.nightscout.androidaps.activities.NoSplashActivity
|
||||||
import info.nightscout.androidaps.events.EventRefreshOverview
|
import info.nightscout.androidaps.events.EventRefreshOverview
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
|
import info.nightscout.androidaps.plugins.pump.medtronic.dialog.MedtronicHistoryActivity
|
||||||
|
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil
|
||||||
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.dialogs.wizard.initpod.FullInitPodWizardModel
|
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.initpod.FullInitPodWizardModel
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.initpod.ShortInitPodWizardModel
|
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.initpod.ShortInitPodWizardModel
|
||||||
|
@ -129,8 +131,10 @@ class PodManagementActivity : NoSplashActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun showPodHistory() {
|
fun showPodHistory() {
|
||||||
OKDialog.showConfirmation(this,
|
// OKDialog.showConfirmation(this,
|
||||||
MainApp.gs(R.string.omnipod_cmd_pod_history_na), null)
|
// MainApp.gs(R.string.omnipod_cmd_pod_history_na), null)
|
||||||
|
|
||||||
|
startActivity(Intent(applicationContext, PodHistoryActivity::class.java))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,7 @@ public class OmnipodPumpStatus extends PumpStatus {
|
||||||
public boolean beepBasalEnabled = true;
|
public boolean beepBasalEnabled = true;
|
||||||
public boolean beepSMBEnabled = true;
|
public boolean beepSMBEnabled = true;
|
||||||
public boolean beepTBREnabled = true;
|
public boolean beepTBREnabled = true;
|
||||||
|
public boolean podExpertDebugModeEnabled = false;
|
||||||
|
|
||||||
public OmnipodPumpStatus(PumpDescription pumpDescription) {
|
public OmnipodPumpStatus(PumpDescription pumpDescription) {
|
||||||
super(pumpDescription);
|
super(pumpDescription);
|
||||||
|
@ -105,6 +106,7 @@ public class OmnipodPumpStatus extends PumpStatus {
|
||||||
this.beepBolusEnabled = SP.getBoolean(OmnipodConst.Prefs.BeepBolusEnabled, true);
|
this.beepBolusEnabled = SP.getBoolean(OmnipodConst.Prefs.BeepBolusEnabled, true);
|
||||||
this.beepSMBEnabled = SP.getBoolean(OmnipodConst.Prefs.BeepSMBEnabled, true);
|
this.beepSMBEnabled = SP.getBoolean(OmnipodConst.Prefs.BeepSMBEnabled, true);
|
||||||
this.beepTBREnabled = SP.getBoolean(OmnipodConst.Prefs.BeepTBREnabled, true);
|
this.beepTBREnabled = SP.getBoolean(OmnipodConst.Prefs.BeepTBREnabled, true);
|
||||||
|
this.podExpertDebugModeEnabled = SP.getBoolean(OmnipodConst.Prefs.PodExpertDebugModeEnabled, false);
|
||||||
|
|
||||||
LOG.debug("Beeps [basal={}, bolus={}, SMB={}, TBR={}]", this.beepBasalEnabled, this.beepBolusEnabled, this.beepSMBEnabled, this.beepTBREnabled);
|
LOG.debug("Beeps [basal={}, bolus={}, SMB={}, TBR={}]", this.beepBasalEnabled, this.beepBolusEnabled, this.beepSMBEnabled, this.beepTBREnabled);
|
||||||
|
|
||||||
|
|
|
@ -72,12 +72,16 @@ public class PodHistory implements DbObjectBase {
|
||||||
this.date = date;
|
this.date = date;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDateTimeString() {
|
||||||
|
return DateTimeUtil.toStringFromTimeInMillis(this.date);
|
||||||
|
}
|
||||||
|
|
||||||
public PodHistoryEntryType getPodDbEntryType() {
|
public PodHistoryEntryType getPodDbEntryType() {
|
||||||
return podHistoryEntryType;
|
return PodHistoryEntryType.getByCode((int)this.podEntryTypeCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPodDbEntryType(PodHistoryEntryType podDbEntryType) {
|
public void setPodDbEntryType(PodHistoryEntryType podDbEntryType) {
|
||||||
this.podHistoryEntryType = podDbEntryType;
|
//this.podHistoryEntryType = podDbEntryType;
|
||||||
this.podEntryTypeCode = podDbEntryType.getCode();
|
this.podEntryTypeCode = podDbEntryType.getCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,40 +1,50 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.db;
|
package info.nightscout.androidaps.plugins.pump.omnipod.driver.db;
|
||||||
|
|
||||||
|
import androidx.annotation.IdRes;
|
||||||
|
import androidx.annotation.StringRes;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.R;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by andy on 24.11.2019
|
* Created by andy on 24.11.2019
|
||||||
*/
|
*/
|
||||||
public enum PodHistoryEntryType {
|
public enum PodHistoryEntryType {
|
||||||
|
|
||||||
PairAndPrime(1),
|
PairAndPrime(1, R.string.omnipod_init_pod_wizard_step2_title),
|
||||||
FillCannulaSetBasalProfile(2),
|
FillCannulaSetBasalProfile(2, R.string.omnipod_init_pod_wizard_step4_title),
|
||||||
DeactivatePod(3),
|
DeactivatePod(3, R.string.omnipod_cmd_deactivate_pod),
|
||||||
ResetPodState(4),
|
ResetPodState(4, R.string.omnipod_cmd_reset_pod),
|
||||||
|
|
||||||
SetTemporaryBasal(10),
|
SetTemporaryBasal(10, R.string.omnipod_cmd_set_tbr),
|
||||||
CancelTemporaryBasal(11),
|
CancelTemporaryBasal(11, R.string.omnipod_cmd_cancel_tbr),
|
||||||
|
|
||||||
SetBasalSchedule(20),
|
SetBasalSchedule(20, R.string.omnipod_cmd_set_basal_schedule),
|
||||||
|
|
||||||
GetPodStatus(30),
|
GetPodStatus(30, R.string.omnipod_cmd_get_pod_status),
|
||||||
GetPodInfo(31),
|
GetPodInfo(31, R.string.omnipod_cmd_get_pod_info),
|
||||||
SetTime(32),
|
SetTime(32, R.string.omnipod_cmd_set_time),
|
||||||
|
|
||||||
SetBolus(40),
|
SetBolus(40, R.string.omnipod_cmd_set_bolus),
|
||||||
CancelBolus(41),
|
CancelBolus(41, R.string.omnipod_cmd_cancel_bolus),
|
||||||
|
|
||||||
ConfigureAlerts(50),
|
ConfigureAlerts(50, R.string.omnipod_cmd_configure_alerts),
|
||||||
AcknowledgeAlerts(51),
|
AcknowledgeAlerts(51, R.string.omnipod_cmd_acknowledge_alerts),
|
||||||
|
|
||||||
SuspendDelivery(60),
|
SuspendDelivery(60, R.string.omnipod_cmd_suspend_delivery),
|
||||||
ResumeDelivery(61)
|
ResumeDelivery(61, R.string.omnipod_cmd_resume_delivery),
|
||||||
|
|
||||||
|
UnknownEntryType(99, R.string.omnipod_cmd_umknown_entry)
|
||||||
;
|
;
|
||||||
|
|
||||||
private int code;
|
private int code;
|
||||||
private static Map<Integer, PodHistoryEntryType> instanceMap;
|
private static Map<Integer, PodHistoryEntryType> instanceMap;
|
||||||
|
|
||||||
|
@StringRes
|
||||||
|
private int resourceId;
|
||||||
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
instanceMap = new HashMap<>();
|
instanceMap = new HashMap<>();
|
||||||
|
@ -45,11 +55,25 @@ public enum PodHistoryEntryType {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PodHistoryEntryType(int code) {
|
PodHistoryEntryType(int code, @StringRes int resourceId) {
|
||||||
this.code = code;
|
this.code = code;
|
||||||
|
this.resourceId = resourceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCode() {
|
public int getCode() {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static PodHistoryEntryType getByCode(int code) {
|
||||||
|
if (instanceMap.containsKey(code)) {
|
||||||
|
return instanceMap.get(code);
|
||||||
|
} else {
|
||||||
|
return UnknownEntryType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getResourceId() {
|
||||||
|
return resourceId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ public class OmnipodConst {
|
||||||
public static final int BeepBolusEnabled = R.string.key_omnipod_beep_bolus_enabled;
|
public static final int BeepBolusEnabled = R.string.key_omnipod_beep_bolus_enabled;
|
||||||
public static final int BeepSMBEnabled = R.string.key_omnipod_beep_smb_enabled;
|
public static final int BeepSMBEnabled = R.string.key_omnipod_beep_smb_enabled;
|
||||||
public static final int BeepTBREnabled = R.string.key_omnipod_beep_tbr_enabled;
|
public static final int BeepTBREnabled = R.string.key_omnipod_beep_tbr_enabled;
|
||||||
|
public static final int PodExpertDebugModeEnabled = R.string.key_omnipod_pod_expert_debug_enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Statistics {
|
public class Statistics {
|
||||||
|
|
|
@ -612,6 +612,18 @@
|
||||||
android:paddingRight="0dp"
|
android:paddingRight="0dp"
|
||||||
android:text="RL Stats" />
|
android:text="RL Stats" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/omnipod_pod_debug"
|
||||||
|
style="@style/ButtonSmallFontStyle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:drawableTop="@drawable/icon_cp_bolus_correction"
|
||||||
|
android:paddingLeft="0dp"
|
||||||
|
android:paddingRight="0dp"
|
||||||
|
android:text="Pod Debug"
|
||||||
|
/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="@drawable/pillborder"
|
android:background="@drawable/pillborder"
|
||||||
android:gravity="center_horizontal"
|
android:gravity="center_horizontal"
|
||||||
android:text="@string/medtronic_pump_history" />
|
android:text="@string/omnipod_cmd_pod_history" />
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -1650,10 +1650,12 @@
|
||||||
<string name="key_omnipod_beep_basal_enabled" translatable="false">pref_omnipod_beep_basal_enabled</string>
|
<string name="key_omnipod_beep_basal_enabled" translatable="false">pref_omnipod_beep_basal_enabled</string>
|
||||||
<string name="key_omnipod_beep_smb_enabled" translatable="false">pref_omnipod_beep_smb_enabled</string>
|
<string name="key_omnipod_beep_smb_enabled" translatable="false">pref_omnipod_beep_smb_enabled</string>
|
||||||
<string name="key_omnipod_beep_tbr_enabled" translatable="false">pref_omnipod_beep_tbr_enabled</string>
|
<string name="key_omnipod_beep_tbr_enabled" translatable="false">pref_omnipod_beep_tbr_enabled</string>
|
||||||
|
<string name="key_omnipod_pod_expert_debug_enabled" translatable="false">key_omnipod_pod_expert_debug_enabled</string>
|
||||||
<string name="omnipod_config_beep_bolus_enabled">Bolus Beep Enabled</string>
|
<string name="omnipod_config_beep_bolus_enabled">Bolus Beep Enabled</string>
|
||||||
<string name="omnipod_config_beep_basal_enabled">Basal Beep Enabled</string>
|
<string name="omnipod_config_beep_basal_enabled">Basal Beep Enabled</string>
|
||||||
<string name="omnipod_config_beep_smb_enabled">SMB Beep Enabled</string>
|
<string name="omnipod_config_beep_smb_enabled">SMB Beep Enabled</string>
|
||||||
<string name="omnipod_config_beep_tbr_enabled">TBR Beep Enabled</string>
|
<string name="omnipod_config_beep_tbr_enabled">TBR Beep Enabled</string>
|
||||||
|
<string name="omnipod_config_pod_expert_debug_enabled">Pod Debug Expert Mode</string>
|
||||||
|
|
||||||
<!-- Omnipod - Fragment -->
|
<!-- Omnipod - Fragment -->
|
||||||
<string name="omnipod_pod_mgmt">Pod Mgmt</string>
|
<string name="omnipod_pod_mgmt">Pod Mgmt</string>
|
||||||
|
@ -1698,6 +1700,20 @@
|
||||||
<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_set_bolus">Set Bolus</string>
|
||||||
|
<string name="omnipod_cmd_cancel_bolus">Cancel Bolus</string>
|
||||||
|
<string name="omnipod_cmd_set_tbr">Set Temporary Basal</string>
|
||||||
|
<string name="omnipod_cmd_cancel_tbr">Cancel Temporary Basal</string>
|
||||||
|
<string name="omnipod_cmd_set_basal_schedule">Set Basal Schedule</string>
|
||||||
|
<string name="omnipod_cmd_get_pod_status">Get Pod Status</string>
|
||||||
|
<string name="omnipod_cmd_get_pod_info">Get Pod Info</string>
|
||||||
|
<string name="omnipod_cmd_set_time">Set Time</string>
|
||||||
|
<string name="omnipod_cmd_configure_alerts">Configure Alerts</string>
|
||||||
|
<string name="omnipod_cmd_acknowledge_alerts">Acknowledge Alerts</string>
|
||||||
|
<string name="omnipod_cmd_suspend_delivery">Suspend Delivery</string>
|
||||||
|
<string name="omnipod_cmd_resume_delivery">Resume Delivery</string>
|
||||||
|
<string name="omnipod_cmd_umknown_entry">Unknown Entry</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_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_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>
|
||||||
|
|
||||||
|
|
|
@ -31,5 +31,10 @@
|
||||||
android:key="@string/key_omnipod_beep_tbr_enabled"
|
android:key="@string/key_omnipod_beep_tbr_enabled"
|
||||||
android:title="@string/omnipod_config_beep_tbr_enabled" />
|
android:title="@string/omnipod_config_beep_tbr_enabled" />
|
||||||
|
|
||||||
|
<SwitchPreference
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:key="@string/key_omnipod_pod_expert_debug_enabled"
|
||||||
|
android:title="@string/omnipod_config_pod_expert_debug_enabled" />
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
Loading…
Reference in a new issue