- changes for running, so that everything is correctly initalized, moved ui classes to .driver
- moved manager to .comm package - started adding dialog for Pod History
This commit is contained in:
parent
5c8f0a2a39
commit
c77cc018f0
|
@ -89,7 +89,7 @@ class OmnipodFragment : Fragment() {
|
|||
OmnipodUtil.displayNotConfiguredDialog(context)
|
||||
} else {
|
||||
omnipod_refresh.isEnabled = false
|
||||
OmnipodUtil.getPlugin().addPodStatusRequest(OmnipodStatusRequest.ResetState);
|
||||
OmnipodUtil.getPlugin().addPodStatusRequest(OmnipodStatusRequest.GetPodState);
|
||||
ConfigBuilderPlugin.getPlugin().commandQueue.readStatus("Clicked Refresh", object : Callback() {
|
||||
override fun run() {
|
||||
activity?.runOnUiThread { omnipod_refresh.isEnabled = true }
|
||||
|
|
|
@ -43,9 +43,9 @@ 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.medtronic.events.EventMedtronicPumpValuesChanged;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.ui.OmnipodUIComm;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.ui.OmnipodUITask;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.AapsOmnipodManager;
|
||||
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.defs.OmnipodCommandType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommunicationManagerInterface;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCustomActionType;
|
||||
|
@ -90,8 +90,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
public static boolean isBusy = false;
|
||||
protected List<Long> busyTimestamps = new ArrayList<>();
|
||||
protected boolean sentIdToFirebase = false;
|
||||
|
||||
private boolean hasTimeDateOrTimeZoneChanged = false;
|
||||
protected boolean hasTimeDateOrTimeZoneChanged = false;
|
||||
|
||||
private Profile currentProfile;
|
||||
|
||||
|
@ -111,13 +110,6 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
displayConnectionMessages = false;
|
||||
|
||||
OmnipodUtil.setOmnipodPodType(OmnipodPodType.Eros);
|
||||
|
||||
if (omnipodCommunicationManager == null) {
|
||||
//omnipodCommunicationManager = AapsOmnipodManager.getInstance();
|
||||
}
|
||||
|
||||
omnipodUIComm = new OmnipodUIComm(omnipodCommunicationManager, this, this.pumpStatusLocal);
|
||||
|
||||
OmnipodUtil.setPlugin(this);
|
||||
|
||||
serviceConnection = new ServiceConnection() {
|
||||
|
@ -139,15 +131,22 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
new Thread(() -> {
|
||||
|
||||
for (int i = 0; i < 20; i++) {
|
||||
SystemClock.sleep(5000);
|
||||
|
||||
if (OmnipodUtil.getPumpStatus() != null) {
|
||||
if (isLoggingEnabled())
|
||||
LOG.debug("Starting OmniPod-RileyLink service");
|
||||
if (OmnipodUtil.getPumpStatus().setNotInPreInit()) {
|
||||
if (omnipodCommunicationManager == null) {
|
||||
omnipodCommunicationManager = AapsOmnipodManager.getInstance();
|
||||
omnipodCommunicationManager.setPumpStatus(pumpStatusLocal);
|
||||
}
|
||||
|
||||
omnipodUIComm = new OmnipodUIComm(omnipodCommunicationManager, plugin, pumpStatusLocal);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SystemClock.sleep(5000);
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
@ -330,10 +329,11 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
|
||||
for (OmnipodStatusRequest omnipodStatusRequest : omnipodStatusRequestList) {
|
||||
// TODO when we get more commands this needs to be extended
|
||||
omnipodUIComm.executeCommand(OmnipodCommandType.AcknowledgeAlerts);
|
||||
omnipodUIComm.executeCommand(omnipodStatusRequest.getCommandType());
|
||||
removeList.add(omnipodStatusRequest);
|
||||
}
|
||||
|
||||
omnipodStatusRequestList.removeAll(removeList);
|
||||
|
||||
//getPodPumpStatus();
|
||||
}
|
||||
|
@ -341,8 +341,8 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
}
|
||||
|
||||
|
||||
public void setIsBusy(boolean isBusy) {
|
||||
this.isBusy = isBusy;
|
||||
public void setIsBusy(boolean isBusy_) {
|
||||
isBusy = isBusy_;
|
||||
}
|
||||
|
||||
|
||||
|
@ -798,14 +798,16 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
|
||||
if (customActions == null) {
|
||||
this.customActions = Arrays.asList(
|
||||
customActionResetRLConfig, //
|
||||
customActionPairAndPrime, //
|
||||
customActionFillCanullaSetBasalProfile, //
|
||||
customActionDeactivatePod, //
|
||||
customActionResetPod);
|
||||
customActionResetRLConfig //,
|
||||
//customActionPairAndPrime, //
|
||||
//customActionFillCanullaSetBasalProfile, //
|
||||
//customActionDeactivatePod, //
|
||||
//customActionResetPod
|
||||
);
|
||||
}
|
||||
|
||||
return this.customActions;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,21 +1,22 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.comm;
|
||||
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
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.OmnipodCommunicationService;
|
||||
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.PodInitActionType;
|
||||
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.service.OmnipodPumpStatus;
|
||||
|
||||
public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface {
|
||||
private final OmnipodManager delegate;
|
||||
|
||||
private static AapsOmnipodManager instance;
|
||||
private OmnipodPumpStatus pumpStatus;
|
||||
|
||||
// FIXME this is dirty
|
||||
public static AapsOmnipodManager getInstance() {
|
||||
|
@ -27,6 +28,7 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
|
|||
instance = this;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PumpEnactResult initPod(PodInitActionType podInitActionType, PodInitReceiver podInitReceiver, Profile profile) {
|
||||
if (PodInitActionType.PairAndPrimeWizardStep.equals(podInitActionType)) {
|
||||
|
@ -59,6 +61,7 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
|
|||
|
||||
@Override
|
||||
public PumpEnactResult resetPodStatus() {
|
||||
pumpStatus.podDeviceState = null;
|
||||
return delegate.resetPodState();
|
||||
}
|
||||
|
||||
|
@ -87,6 +90,11 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
|
|||
return delegate.acknowledgeAlerts();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPumpStatus(OmnipodPumpStatus pumpStatus) {
|
||||
this.pumpStatus = pumpStatus;
|
||||
}
|
||||
|
||||
// TODO should we add this to the OmnipodCommunicationManager interface?
|
||||
public PumpEnactResult getPodInfo(PodInfoType podInfoType) {
|
||||
return delegate.getPodInfo(podInfoType);
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.comm;
|
||||
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.DateTimeZone;
|
|
@ -12,9 +12,11 @@ public enum OmnipodCommandType {
|
|||
SetBasalProfile, //
|
||||
SetBolus, //
|
||||
CancelBolus, //
|
||||
SetTemporaryBasal,
|
||||
CancelTemporaryBasal,
|
||||
ResetPodStatus, AcknowledgeAlerts;
|
||||
SetTemporaryBasal, //
|
||||
CancelTemporaryBasal, //
|
||||
ResetPodStatus, //
|
||||
GetPodStatus, //
|
||||
AcknowledgeAlerts;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -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.service.OmnipodPumpStatus;
|
||||
|
||||
public interface OmnipodCommunicationManagerInterface {
|
||||
|
||||
|
@ -64,4 +65,5 @@ public interface OmnipodCommunicationManagerInterface {
|
|||
PumpEnactResult acknowledgeAlerts();
|
||||
|
||||
|
||||
void setPumpStatus(OmnipodPumpStatus pumpStatusLocal);
|
||||
}
|
||||
|
|
|
@ -1,9 +1,19 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.defs;
|
||||
|
||||
public enum OmnipodStatusRequest {
|
||||
ResetState, //
|
||||
AcknowledgeAlerts, //
|
||||
ResetState(OmnipodCommandType.ResetPodStatus), //
|
||||
AcknowledgeAlerts(OmnipodCommandType.AcknowledgeAlerts), //
|
||||
GetPodState(OmnipodCommandType.GetPodStatus) //
|
||||
;
|
||||
|
||||
private OmnipodCommandType commandType;
|
||||
|
||||
OmnipodStatusRequest(OmnipodCommandType commandType) {
|
||||
this.commandType = commandType;
|
||||
}
|
||||
|
||||
|
||||
public OmnipodCommandType getCommandType() {
|
||||
return commandType;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,253 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.dialogs;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.os.SystemClock;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.activities.NoSplashActivity;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
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.PumpHistoryEntryGroup;
|
||||
|
||||
public class PodHistoryActivity extends NoSplashActivity {
|
||||
|
||||
private static Logger LOG = LoggerFactory.getLogger(L.PUMP);
|
||||
|
||||
Spinner historyTypeSpinner;
|
||||
TextView statusView;
|
||||
RecyclerView recyclerView;
|
||||
LinearLayoutManager llm;
|
||||
|
||||
static TypeList showingType = null;
|
||||
static PumpHistoryEntryGroup selectedGroup = PumpHistoryEntryGroup.All;
|
||||
List<PumpHistoryEntry> filteredHistoryList = new ArrayList<>();
|
||||
|
||||
RecyclerViewAdapter recyclerViewAdapter;
|
||||
boolean manualChange = false;
|
||||
|
||||
List<TypeList> typeListFull;
|
||||
|
||||
|
||||
public PodHistoryActivity() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
private void filterHistory(PumpHistoryEntryGroup group) {
|
||||
|
||||
this.filteredHistoryList.clear();
|
||||
|
||||
List<PumpHistoryEntry> list = new ArrayList<>();
|
||||
list.addAll(MedtronicPumpPlugin.getPlugin().getMedtronicHistoryData().getAllHistory());
|
||||
|
||||
//LOG.debug("Items on full list: {}", list.size());
|
||||
|
||||
if (group == PumpHistoryEntryGroup.All) {
|
||||
this.filteredHistoryList.addAll(list);
|
||||
} else {
|
||||
for (PumpHistoryEntry pumpHistoryEntry : list) {
|
||||
if (pumpHistoryEntry.getEntryType().getGroup() == group) {
|
||||
this.filteredHistoryList.add(pumpHistoryEntry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.recyclerViewAdapter != null) {
|
||||
this.recyclerViewAdapter.setHistoryList(this.filteredHistoryList);
|
||||
this.recyclerViewAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
//LOG.debug("Items on filtered list: {}", filteredHistoryList.size());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
filterHistory(selectedGroup);
|
||||
setHistoryTypeSpinner();
|
||||
}
|
||||
|
||||
|
||||
private void setHistoryTypeSpinner() {
|
||||
this.manualChange = true;
|
||||
|
||||
for (int i = 0; i < typeListFull.size(); i++) {
|
||||
if (typeListFull.get(i).entryGroup == selectedGroup) {
|
||||
historyTypeSpinner.setSelection(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SystemClock.sleep(200);
|
||||
this.manualChange = false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.omnipod_pod_history_activity);
|
||||
|
||||
historyTypeSpinner = (Spinner) findViewById(R.id.omnipod_historytype);
|
||||
statusView = (TextView) findViewById(R.id.omnipod_historystatus);
|
||||
recyclerView = (RecyclerView) findViewById(R.id.omnipod_history_recyclerview);
|
||||
|
||||
recyclerView.setHasFixedSize(true);
|
||||
llm = new LinearLayoutManager(this);
|
||||
recyclerView.setLayoutManager(llm);
|
||||
|
||||
recyclerViewAdapter = new RecyclerViewAdapter(filteredHistoryList);
|
||||
recyclerView.setAdapter(recyclerViewAdapter);
|
||||
|
||||
statusView.setVisibility(View.GONE);
|
||||
|
||||
typeListFull = getTypeList(PumpHistoryEntryGroup.getList());
|
||||
|
||||
ArrayAdapter<TypeList> spinnerAdapter = new ArrayAdapter<>(this, R.layout.spinner_centered, typeListFull);
|
||||
historyTypeSpinner.setAdapter(spinnerAdapter);
|
||||
|
||||
historyTypeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
if (manualChange)
|
||||
return;
|
||||
TypeList selected = (TypeList) historyTypeSpinner.getSelectedItem();
|
||||
showingType = selected;
|
||||
selectedGroup = selected.entryGroup;
|
||||
filterHistory(selectedGroup);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
if (manualChange)
|
||||
return;
|
||||
filterHistory(PumpHistoryEntryGroup.All);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
private List<TypeList> getTypeList(List<PumpHistoryEntryGroup> list) {
|
||||
|
||||
ArrayList<TypeList> typeList = new ArrayList<>();
|
||||
|
||||
for (PumpHistoryEntryGroup pumpHistoryEntryGroup : list) {
|
||||
typeList.add(new TypeList(pumpHistoryEntryGroup));
|
||||
}
|
||||
|
||||
return typeList;
|
||||
}
|
||||
|
||||
public static class TypeList {
|
||||
|
||||
PumpHistoryEntryGroup entryGroup;
|
||||
String name;
|
||||
|
||||
|
||||
TypeList(PumpHistoryEntryGroup entryGroup) {
|
||||
this.entryGroup = entryGroup;
|
||||
this.name = entryGroup.getTranslated();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
public static class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.HistoryViewHolder> {
|
||||
|
||||
List<PumpHistoryEntry> historyList;
|
||||
|
||||
|
||||
RecyclerViewAdapter(List<PumpHistoryEntry> historyList) {
|
||||
this.historyList = historyList;
|
||||
}
|
||||
|
||||
|
||||
public void setHistoryList(List<PumpHistoryEntry> historyList) {
|
||||
// this.historyList.clear();
|
||||
// this.historyList.addAll(historyList);
|
||||
|
||||
this.historyList = historyList;
|
||||
|
||||
// this.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public HistoryViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
|
||||
View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.omnipod_pod_history_item, //
|
||||
viewGroup, false);
|
||||
return new HistoryViewHolder(v);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(HistoryViewHolder holder, int position) {
|
||||
PumpHistoryEntry record = historyList.get(position);
|
||||
|
||||
if (record != null) {
|
||||
holder.timeView.setText(record.getDateTimeString());
|
||||
holder.typeView.setText(record.getEntryType().getDescription());
|
||||
holder.valueView.setText(record.getDisplayableValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return historyList.size();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onAttachedToRecyclerView(RecyclerView recyclerView) {
|
||||
super.onAttachedToRecyclerView(recyclerView);
|
||||
}
|
||||
|
||||
static class HistoryViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
TextView timeView;
|
||||
TextView typeView;
|
||||
TextView valueView;
|
||||
|
||||
|
||||
HistoryViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
timeView = (TextView) itemView.findViewById(R.id.omnipod_history_time);
|
||||
typeView = (TextView) itemView.findViewById(R.id.omnipod_history_source);
|
||||
valueView = (TextView) itemView.findViewById(R.id.omnipod_history_description);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,8 +1,10 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.dialogs
|
||||
|
||||
import android.os.Bundle
|
||||
import info.nightscout.androidaps.MainApp
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.activities.NoSplashActivity
|
||||
import info.nightscout.androidaps.utils.OKDialog
|
||||
import kotlinx.android.synthetic.main.omnipod_pod_mgmt.*
|
||||
|
||||
class PodManagementActivity : NoSplashActivity() {
|
||||
|
@ -23,19 +25,34 @@ class PodManagementActivity : NoSplashActivity() {
|
|||
resetPodAction()
|
||||
}
|
||||
|
||||
|
||||
initpod_pod_history.setOnClickListener {
|
||||
showPodHistory()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
fun initPodAction() {
|
||||
|
||||
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() {
|
||||
OKDialog.showConfirmation(this,
|
||||
MainApp.gs(R.string.omnipod_cmd_reset_pod_na), null)
|
||||
|
||||
}
|
||||
|
||||
fun showPodHistory() {
|
||||
OKDialog.showConfirmation(this,
|
||||
MainApp.gs(R.string.omnipod_cmd_pod_history_na), null)
|
||||
}
|
||||
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.ui;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.ui;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.ui;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.ui;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -7,7 +7,6 @@ import info.nightscout.androidaps.logging.L;
|
|||
import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodPumpPlugin;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCustomActionType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.service.OmnipodPumpStatus;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;
|
||||
|
||||
/**
|
||||
* Created by andy on 4.8.2019
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.ui;
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.ui;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -63,7 +63,6 @@ public class OmnipodUITask {
|
|||
|
||||
case FillCanulaAndSetBasalProfile:
|
||||
returnData = communicationManager.initPod((PodInitActionType) parameters[0], (PodInitReceiver) parameters[1], (Profile) parameters[2]);
|
||||
// TODO returnData = communicationManager.pairAndPrime();
|
||||
break;
|
||||
|
||||
case DeactivatePod:
|
||||
|
@ -88,6 +87,10 @@ public class OmnipodUITask {
|
|||
}
|
||||
break;
|
||||
|
||||
case GetPodStatus:
|
||||
returnData = communicationManager.getPodStatus();
|
||||
break;
|
||||
|
||||
case CancelBolus:
|
||||
returnData = communicationManager.cancelBolus();
|
||||
break;
|
|
@ -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.service.RileyLinkService;
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkServiceData;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.AapsOmnipodManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.AapsOmnipodManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodPumpPlugin;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationService;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommunicationManagerInterface;
|
||||
|
|
|
@ -5,7 +5,6 @@ import android.os.Bundle;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -22,12 +21,11 @@ import info.nightscout.androidaps.plugins.pump.common.defs.PumpDriverState;
|
|||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodFragment;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodPumpPlugin;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.ui.OmnipodUIComm;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.ui.OmnipodUIComm;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodPodType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodPumpPluginInterface;
|
||||
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.service.OmnipodPumpStatus;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.service.RileyLinkOmnipodService;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod_dash.comm.OmnipodDashCommunicationManager;
|
||||
|
@ -42,8 +40,8 @@ public class OmnipodDashPumpPlugin extends OmnipodPumpPlugin implements OmnipodP
|
|||
private static final Logger LOG = LoggerFactory.getLogger(L.PUMP);
|
||||
|
||||
protected static OmnipodDashPumpPlugin plugin = null;
|
||||
private RileyLinkOmnipodService omnipodService;
|
||||
private OmnipodPumpStatus pumpStatusLocal = null;
|
||||
//private RileyLinkOmnipodService omnipodService;
|
||||
//private OmnipodPumpStatus pumpStatusLocal = null;
|
||||
|
||||
// variables for handling statuses and history
|
||||
private boolean firstRun = true;
|
||||
|
@ -53,9 +51,9 @@ public class OmnipodDashPumpPlugin extends OmnipodPumpPlugin implements OmnipodP
|
|||
private boolean isInitialized = false;
|
||||
|
||||
public static boolean isBusy = false;
|
||||
private List<Long> busyTimestamps = new ArrayList<>();
|
||||
private boolean sentIdToFirebase = false;
|
||||
private boolean hasTimeDateOrTimeZoneChanged = false;
|
||||
//private List<Long> busyTimestamps = new ArrayList<>();
|
||||
//private boolean sentIdToFirebase = false;
|
||||
//private boolean hasTimeDateOrTimeZoneChanged = false;
|
||||
|
||||
private Profile currentProfile;
|
||||
|
||||
|
@ -144,7 +142,11 @@ public class OmnipodDashPumpPlugin extends OmnipodPumpPlugin implements OmnipodP
|
|||
// Pump Plugin
|
||||
|
||||
private boolean isServiceSet() {
|
||||
return omnipodService != null;
|
||||
return true; //omnipodService != null;
|
||||
}
|
||||
|
||||
private boolean isServiceInitialized() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -160,7 +162,7 @@ public class OmnipodDashPumpPlugin extends OmnipodPumpPlugin implements OmnipodP
|
|||
public boolean isConnected() {
|
||||
if (isLoggingEnabled() && displayConnectionMessages)
|
||||
LOG.debug(getLogPrefix() + "isConnected");
|
||||
return isServiceSet() && omnipodService.isInitialized();
|
||||
return isServiceSet() && isServiceInitialized();
|
||||
}
|
||||
|
||||
|
||||
|
@ -168,7 +170,7 @@ public class OmnipodDashPumpPlugin extends OmnipodPumpPlugin implements OmnipodP
|
|||
public boolean isConnecting() {
|
||||
if (isLoggingEnabled() && displayConnectionMessages)
|
||||
LOG.debug(getLogPrefix() + "isConnecting");
|
||||
return !isServiceSet() || !omnipodService.isInitialized();
|
||||
return !isServiceSet() || !isServiceInitialized();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommunication
|
|||
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.state.PodSessionState;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.service.OmnipodPumpStatus;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;
|
||||
import info.nightscout.androidaps.utils.SP;
|
||||
|
||||
|
@ -26,7 +27,7 @@ public class OmnipodDashCommunicationManager implements OmnipodCommunicationMana
|
|||
private static final Logger LOG = LoggerFactory.getLogger(L.PUMPCOMM);
|
||||
|
||||
private static OmnipodDashCommunicationManager omnipodCommunicationManager;
|
||||
String errorMessage;
|
||||
private String errorMessage;
|
||||
|
||||
|
||||
public OmnipodDashCommunicationManager(Context context, RFSpy rfspy) {
|
||||
|
@ -37,8 +38,6 @@ public class OmnipodDashCommunicationManager implements OmnipodCommunicationMana
|
|||
|
||||
|
||||
private PodSessionState getPodSessionState() {
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -107,4 +106,9 @@ public class OmnipodDashCommunicationManager implements OmnipodCommunicationMana
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPumpStatus(OmnipodPumpStatus pumpStatusLocal) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
58
app/src/main/res/layout/omnipod_pod_history_activity.xml
Normal file
58
app/src/main/res/layout/omnipod_pod_history_activity.xml
Normal file
|
@ -0,0 +1,58 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context=".plugins.pump.omnipod.dialogs.PodHistoryActivity">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/omnipod_historytop"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:text="Type:"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/omnipod_historytype"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="20dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/pillborder"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/medtronic_pump_history" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/omnipod_historystatus"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/omnipod_historytop"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:gravity="center_horizontal" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/omnipod_history_recyclerview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_below="@+id/omnipod_historystatus" />
|
||||
|
||||
</RelativeLayout>
|
33
app/src/main/res/layout/omnipod_pod_history_item.xml
Normal file
33
app/src/main/res/layout/omnipod_pod_history_item.xml
Normal file
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:paddingLeft="20dp">
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/omnipod_history_time"
|
||||
android:layout_width="88dp"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical"
|
||||
android:text="Date"
|
||||
android:textSize="12dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/omnipod_history_source"
|
||||
android:layout_width="132dp"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical"
|
||||
android:text="Source"
|
||||
android:textSize="12dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/omnipod_history_description"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:text="Description"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="12dp" />
|
||||
|
||||
</LinearLayout>
|
|
@ -18,8 +18,16 @@
|
|||
android:id="@+id/initpod_space0"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="120dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginTop="3dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginBottom="3dp"
|
||||
android:layout_weight="0.5"
|
||||
android:text="Pod Management" />
|
||||
android:text="@string/omnipod_pod_mgmt_title"
|
||||
android:textAlignment="center"
|
||||
android:textSize="12pt"
|
||||
android:gravity="center"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
android:id="@+id/initpod_init_pod"
|
||||
|
@ -27,17 +35,18 @@
|
|||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="3dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginLeft="40dp"
|
||||
android:layout_marginRight="40dp"
|
||||
android:layout_marginTop="3dp"
|
||||
android:textAllCaps="false"
|
||||
android:layout_weight="0.5"
|
||||
android:drawableTop="@drawable/icon_cp_pump_canula"
|
||||
android:text="@string/careportal_profileswitch" />
|
||||
android:text="@string/omnipod_cmd_init_pod" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/initpod_space1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_weight="0.5"
|
||||
android:text="" />
|
||||
|
||||
|
@ -47,17 +56,18 @@
|
|||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="3dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginLeft="40dp"
|
||||
android:layout_marginRight="40dp"
|
||||
android:layout_marginTop="3dp"
|
||||
android:textAllCaps="false"
|
||||
android:layout_weight="0.5"
|
||||
android:drawableTop="@drawable/icon_actions_temptarget"
|
||||
android:text="@string/careportal_temporarytarget" />
|
||||
android:text="@string/omnipod_cmd_deactivate_pod" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/initpod_space2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_weight="0.5"
|
||||
android:text="" />
|
||||
|
||||
|
@ -66,21 +76,38 @@
|
|||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginLeft="40dp"
|
||||
android:layout_marginTop="3dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginRight="40dp"
|
||||
android:layout_marginBottom="3dp"
|
||||
android:textAllCaps="false"
|
||||
android:layout_weight="0.5"
|
||||
android:drawableTop="@drawable/icon_cp_pump_canula"
|
||||
android:text="@string/primefill" />
|
||||
android:text="@string/omnipod_cmd_reset_pod" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/initpod_space3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_weight="0.5"
|
||||
android:text="" />
|
||||
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
android:id="@+id/initpod_pod_history"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="40dp"
|
||||
android:layout_marginTop="3dp"
|
||||
android:layout_marginRight="40dp"
|
||||
android:layout_marginBottom="3dp"
|
||||
android:textAllCaps="false"
|
||||
android:layout_weight="0.5"
|
||||
android:drawableTop="@drawable/icon_cp_pump_canula"
|
||||
android:text="@string/omnipod_cmd_pod_history" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
|
|
@ -1645,10 +1645,16 @@
|
|||
<string name="omnipod_error_operation_not_possible_no_profile">Operation is not possible.\n\n You need to wait few minutes, until AAPS tries to set profile for first time.</string>
|
||||
|
||||
<!-- Omnipod - Pod Mgmt -->
|
||||
<string name="omnipod_pod_mgmt_title">Pod Management</string>
|
||||
<string name="omnipod_cmd_init_pod">Init Pod</string>
|
||||
<string name="omnipod_cmd_deactivate_pod">Deactivate Pod</string>
|
||||
<string name="omnipod_cmd_reset_pod">Reset Pod</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_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_pod_history_na">Pod History not available at the moment.</string>
|
||||
|
||||
<string name="omnipod_namex" translatable="false">Omnipod</string>
|
||||
<string name="omnipod_namex2" translatable="false">Omnipod</string>
|
||||
|
|
Loading…
Reference in a new issue