- 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:
Andy Rozman 2019-11-10 17:23:40 +00:00
parent 5c8f0a2a39
commit c77cc018f0
19 changed files with 490 additions and 64 deletions

View file

@ -89,7 +89,7 @@ class OmnipodFragment : Fragment() {
OmnipodUtil.displayNotConfiguredDialog(context) OmnipodUtil.displayNotConfiguredDialog(context)
} else { } else {
omnipod_refresh.isEnabled = false omnipod_refresh.isEnabled = false
OmnipodUtil.getPlugin().addPodStatusRequest(OmnipodStatusRequest.ResetState); OmnipodUtil.getPlugin().addPodStatusRequest(OmnipodStatusRequest.GetPodState);
ConfigBuilderPlugin.getPlugin().commandQueue.readStatus("Clicked Refresh", object : Callback() { ConfigBuilderPlugin.getPlugin().commandQueue.readStatus("Clicked Refresh", object : Callback() {
override fun run() { override fun run() {
activity?.runOnUiThread { omnipod_refresh.isEnabled = true } activity?.runOnUiThread { omnipod_refresh.isEnabled = true }

View file

@ -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.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.medtronic.events.EventMedtronicPumpValuesChanged; import info.nightscout.androidaps.plugins.pump.omnipod.comm.AapsOmnipodManager;
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.comm.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;
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.OmnipodCustomActionType; 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; public static boolean isBusy = false;
protected List<Long> busyTimestamps = new ArrayList<>(); protected List<Long> busyTimestamps = new ArrayList<>();
protected boolean sentIdToFirebase = false; protected boolean sentIdToFirebase = false;
protected boolean hasTimeDateOrTimeZoneChanged = false;
private boolean hasTimeDateOrTimeZoneChanged = false;
private Profile currentProfile; private Profile currentProfile;
@ -111,13 +110,6 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
displayConnectionMessages = false; displayConnectionMessages = false;
OmnipodUtil.setOmnipodPodType(OmnipodPodType.Eros); OmnipodUtil.setOmnipodPodType(OmnipodPodType.Eros);
if (omnipodCommunicationManager == null) {
//omnipodCommunicationManager = AapsOmnipodManager.getInstance();
}
omnipodUIComm = new OmnipodUIComm(omnipodCommunicationManager, this, this.pumpStatusLocal);
OmnipodUtil.setPlugin(this); OmnipodUtil.setPlugin(this);
serviceConnection = new ServiceConnection() { serviceConnection = new ServiceConnection() {
@ -139,15 +131,22 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
new Thread(() -> { new Thread(() -> {
for (int i = 0; i < 20; i++) { for (int i = 0; i < 20; i++) {
SystemClock.sleep(5000);
if (OmnipodUtil.getPumpStatus() != null) { if (OmnipodUtil.getPumpStatus() != null) {
if (isLoggingEnabled()) if (isLoggingEnabled())
LOG.debug("Starting OmniPod-RileyLink service"); LOG.debug("Starting OmniPod-RileyLink service");
if (OmnipodUtil.getPumpStatus().setNotInPreInit()) { if (OmnipodUtil.getPumpStatus().setNotInPreInit()) {
if (omnipodCommunicationManager == null) {
omnipodCommunicationManager = AapsOmnipodManager.getInstance();
omnipodCommunicationManager.setPumpStatus(pumpStatusLocal);
}
omnipodUIComm = new OmnipodUIComm(omnipodCommunicationManager, plugin, pumpStatusLocal);
break; break;
} }
} }
SystemClock.sleep(5000);
} }
}).start(); }).start();
} }
@ -330,10 +329,11 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
for (OmnipodStatusRequest omnipodStatusRequest : omnipodStatusRequestList) { for (OmnipodStatusRequest omnipodStatusRequest : omnipodStatusRequestList) {
// TODO when we get more commands this needs to be extended // TODO when we get more commands this needs to be extended
omnipodUIComm.executeCommand(OmnipodCommandType.AcknowledgeAlerts); omnipodUIComm.executeCommand(omnipodStatusRequest.getCommandType());
removeList.add(omnipodStatusRequest); removeList.add(omnipodStatusRequest);
} }
omnipodStatusRequestList.removeAll(removeList);
//getPodPumpStatus(); //getPodPumpStatus();
} }
@ -341,8 +341,8 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
} }
public void setIsBusy(boolean isBusy) { public void setIsBusy(boolean isBusy_) {
this.isBusy = isBusy; isBusy = isBusy_;
} }
@ -798,14 +798,16 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
if (customActions == null) { if (customActions == null) {
this.customActions = Arrays.asList( this.customActions = Arrays.asList(
customActionResetRLConfig, // customActionResetRLConfig //,
customActionPairAndPrime, // //customActionPairAndPrime, //
customActionFillCanullaSetBasalProfile, // //customActionFillCanullaSetBasalProfile, //
customActionDeactivatePod, // //customActionDeactivatePod, //
customActionResetPod); //customActionResetPod
);
} }
return this.customActions; return this.customActions;
} }

View file

@ -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 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.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.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.service.OmnipodPumpStatus;
public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface { public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface {
private final OmnipodManager delegate; private final OmnipodManager delegate;
private static AapsOmnipodManager instance; private static AapsOmnipodManager instance;
private OmnipodPumpStatus pumpStatus;
// FIXME this is dirty // FIXME this is dirty
public static AapsOmnipodManager getInstance() { public static AapsOmnipodManager getInstance() {
@ -27,6 +28,7 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
instance = this; instance = this;
} }
@Override @Override
public PumpEnactResult initPod(PodInitActionType podInitActionType, PodInitReceiver podInitReceiver, Profile profile) { public PumpEnactResult initPod(PodInitActionType podInitActionType, PodInitReceiver podInitReceiver, Profile profile) {
if (PodInitActionType.PairAndPrimeWizardStep.equals(podInitActionType)) { if (PodInitActionType.PairAndPrimeWizardStep.equals(podInitActionType)) {
@ -59,6 +61,7 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
@Override @Override
public PumpEnactResult resetPodStatus() { public PumpEnactResult resetPodStatus() {
pumpStatus.podDeviceState = null;
return delegate.resetPodState(); return delegate.resetPodState();
} }
@ -87,6 +90,11 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
return delegate.acknowledgeAlerts(); return delegate.acknowledgeAlerts();
} }
@Override
public void setPumpStatus(OmnipodPumpStatus pumpStatus) {
this.pumpStatus = pumpStatus;
}
// TODO should we add this to the OmnipodCommunicationManager interface? // TODO should we add this to the OmnipodCommunicationManager interface?
public PumpEnactResult getPodInfo(PodInfoType podInfoType) { public PumpEnactResult getPodInfo(PodInfoType podInfoType) {
return delegate.getPodInfo(podInfoType); return delegate.getPodInfo(podInfoType);

View file

@ -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.DateTime;
import org.joda.time.DateTimeZone; import org.joda.time.DateTimeZone;

View file

@ -12,9 +12,11 @@ public enum OmnipodCommandType {
SetBasalProfile, // SetBasalProfile, //
SetBolus, // SetBolus, //
CancelBolus, // CancelBolus, //
SetTemporaryBasal, SetTemporaryBasal, //
CancelTemporaryBasal, CancelTemporaryBasal, //
ResetPodStatus, AcknowledgeAlerts; ResetPodStatus, //
GetPodStatus, //
AcknowledgeAlerts;
} }

View file

@ -3,6 +3,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.defs;
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.pump.common.data.TempBasalPair; import info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair;
import info.nightscout.androidaps.plugins.pump.omnipod.service.OmnipodPumpStatus;
public interface OmnipodCommunicationManagerInterface { public interface OmnipodCommunicationManagerInterface {
@ -64,4 +65,5 @@ public interface OmnipodCommunicationManagerInterface {
PumpEnactResult acknowledgeAlerts(); PumpEnactResult acknowledgeAlerts();
void setPumpStatus(OmnipodPumpStatus pumpStatusLocal);
} }

View file

@ -1,9 +1,19 @@
package info.nightscout.androidaps.plugins.pump.omnipod.defs; package info.nightscout.androidaps.plugins.pump.omnipod.defs;
public enum OmnipodStatusRequest { public enum OmnipodStatusRequest {
ResetState, // ResetState(OmnipodCommandType.ResetPodStatus), //
AcknowledgeAlerts, // AcknowledgeAlerts(OmnipodCommandType.AcknowledgeAlerts), //
GetPodState(OmnipodCommandType.GetPodStatus) //
; ;
private OmnipodCommandType commandType;
OmnipodStatusRequest(OmnipodCommandType commandType) {
this.commandType = commandType;
}
public OmnipodCommandType getCommandType() {
return commandType;
}
} }

View file

@ -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);
}
}
}
}

View file

@ -1,8 +1,10 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dialogs package info.nightscout.androidaps.plugins.pump.omnipod.dialogs
import android.os.Bundle import android.os.Bundle
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.utils.OKDialog
import kotlinx.android.synthetic.main.omnipod_pod_mgmt.* import kotlinx.android.synthetic.main.omnipod_pod_mgmt.*
class PodManagementActivity : NoSplashActivity() { class PodManagementActivity : NoSplashActivity() {
@ -23,19 +25,34 @@ class PodManagementActivity : NoSplashActivity() {
resetPodAction() resetPodAction()
} }
initpod_pod_history.setOnClickListener {
showPodHistory()
}
} }
fun initPodAction() { fun initPodAction() {
OKDialog.showConfirmation(this,
MainApp.gs(R.string.omnipod_cmd_init_pod_na), null)
} }
fun removePodAction() { fun removePodAction() {
OKDialog.showConfirmation(this,
MainApp.gs(R.string.omnipod_cmd_deactivate_pod_na), null)
} }
fun resetPodAction() { 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)
}
} }

View file

@ -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.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;

View file

@ -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.Logger;
import org.slf4j.LoggerFactory; 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.OmnipodPumpPlugin;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCustomActionType; 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.service.OmnipodPumpStatus;
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;
/** /**
* Created by andy on 4.8.2019 * Created by andy on 4.8.2019

View file

@ -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.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -63,7 +63,6 @@ public class OmnipodUITask {
case FillCanulaAndSetBasalProfile: case FillCanulaAndSetBasalProfile:
returnData = communicationManager.initPod((PodInitActionType) parameters[0], (PodInitReceiver) parameters[1], (Profile) parameters[2]); returnData = communicationManager.initPod((PodInitActionType) parameters[0], (PodInitReceiver) parameters[1], (Profile) parameters[2]);
// TODO returnData = communicationManager.pairAndPrime();
break; break;
case DeactivatePod: case DeactivatePod:
@ -88,6 +87,10 @@ public class OmnipodUITask {
} }
break; break;
case GetPodStatus:
returnData = communicationManager.getPodStatus();
break;
case CancelBolus: case CancelBolus:
returnData = communicationManager.cancelBolus(); returnData = communicationManager.cancelBolus();
break; break;

View file

@ -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.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.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;

View file

@ -5,7 +5,6 @@ import android.os.Bundle;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; 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.common.defs.PumpType;
import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodFragment; import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodFragment;
import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodPumpPlugin; 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.OmnipodPodType;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodPumpPluginInterface; 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.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.service.OmnipodPumpStatus;
import info.nightscout.androidaps.plugins.pump.omnipod.service.RileyLinkOmnipodService; 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.util.OmnipodUtil;
import info.nightscout.androidaps.plugins.pump.omnipod_dash.comm.OmnipodDashCommunicationManager; 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); private static final Logger LOG = LoggerFactory.getLogger(L.PUMP);
protected static OmnipodDashPumpPlugin plugin = null; protected static OmnipodDashPumpPlugin plugin = null;
private RileyLinkOmnipodService omnipodService; //private RileyLinkOmnipodService omnipodService;
private OmnipodPumpStatus pumpStatusLocal = null; //private OmnipodPumpStatus pumpStatusLocal = null;
// variables for handling statuses and history // variables for handling statuses and history
private boolean firstRun = true; private boolean firstRun = true;
@ -53,9 +51,9 @@ public class OmnipodDashPumpPlugin extends OmnipodPumpPlugin implements OmnipodP
private boolean isInitialized = false; private boolean isInitialized = false;
public static boolean isBusy = false; public static boolean isBusy = false;
private List<Long> busyTimestamps = new ArrayList<>(); //private List<Long> busyTimestamps = new ArrayList<>();
private boolean sentIdToFirebase = false; //private boolean sentIdToFirebase = false;
private boolean hasTimeDateOrTimeZoneChanged = false; //private boolean hasTimeDateOrTimeZoneChanged = false;
private Profile currentProfile; private Profile currentProfile;
@ -144,7 +142,11 @@ public class OmnipodDashPumpPlugin extends OmnipodPumpPlugin implements OmnipodP
// Pump Plugin // Pump Plugin
private boolean isServiceSet() { 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() { public boolean isConnected() {
if (isLoggingEnabled() && displayConnectionMessages) if (isLoggingEnabled() && displayConnectionMessages)
LOG.debug(getLogPrefix() + "isConnected"); 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() { public boolean isConnecting() {
if (isLoggingEnabled() && displayConnectionMessages) if (isLoggingEnabled() && displayConnectionMessages)
LOG.debug(getLogPrefix() + "isConnecting"); LOG.debug(getLogPrefix() + "isConnecting");
return !isServiceSet() || !omnipodService.isInitialized(); return !isServiceSet() || !isServiceInitialized();
} }

View file

@ -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.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.service.OmnipodPumpStatus;
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil; import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;
import info.nightscout.androidaps.utils.SP; 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 final Logger LOG = LoggerFactory.getLogger(L.PUMPCOMM);
private static OmnipodDashCommunicationManager omnipodCommunicationManager; private static OmnipodDashCommunicationManager omnipodCommunicationManager;
String errorMessage; private String errorMessage;
public OmnipodDashCommunicationManager(Context context, RFSpy rfspy) { public OmnipodDashCommunicationManager(Context context, RFSpy rfspy) {
@ -37,8 +38,6 @@ public class OmnipodDashCommunicationManager implements OmnipodCommunicationMana
private PodSessionState getPodSessionState() { private PodSessionState getPodSessionState() {
return null; return null;
} }
@ -107,4 +106,9 @@ public class OmnipodDashCommunicationManager implements OmnipodCommunicationMana
return null; return null;
} }
@Override
public void setPumpStatus(OmnipodPumpStatus pumpStatusLocal) {
}
} }

View 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>

View 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>

View file

@ -18,8 +18,16 @@
android:id="@+id/initpod_space0" android:id="@+id/initpod_space0"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="120dp" 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: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 <info.nightscout.androidaps.utils.SingleClickButton
android:id="@+id/initpod_init_pod" android:id="@+id/initpod_init_pod"
@ -27,17 +35,18 @@
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="3dp" android:layout_marginBottom="3dp"
android:layout_marginLeft="10dp" android:layout_marginLeft="40dp"
android:layout_marginRight="10dp" android:layout_marginRight="40dp"
android:layout_marginTop="3dp" android:layout_marginTop="3dp"
android:textAllCaps="false"
android:layout_weight="0.5" android:layout_weight="0.5"
android:drawableTop="@drawable/icon_cp_pump_canula" android:drawableTop="@drawable/icon_cp_pump_canula"
android:text="@string/careportal_profileswitch" /> android:text="@string/omnipod_cmd_init_pod" />
<TextView <TextView
android:id="@+id/initpod_space1" android:id="@+id/initpod_space1"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="60dp" android:layout_height="20dp"
android:layout_weight="0.5" android:layout_weight="0.5"
android:text="" /> android:text="" />
@ -47,17 +56,18 @@
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="3dp" android:layout_marginBottom="3dp"
android:layout_marginLeft="10dp" android:layout_marginLeft="40dp"
android:layout_marginRight="10dp" android:layout_marginRight="40dp"
android:layout_marginTop="3dp" android:layout_marginTop="3dp"
android:textAllCaps="false"
android:layout_weight="0.5" android:layout_weight="0.5"
android:drawableTop="@drawable/icon_actions_temptarget" android:drawableTop="@drawable/icon_actions_temptarget"
android:text="@string/careportal_temporarytarget" /> android:text="@string/omnipod_cmd_deactivate_pod" />
<TextView <TextView
android:id="@+id/initpod_space2" android:id="@+id/initpod_space2"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="60dp" android:layout_height="20dp"
android:layout_weight="0.5" android:layout_weight="0.5"
android:text="" /> android:text="" />
@ -66,21 +76,38 @@
style="?android:attr/buttonStyle" style="?android:attr/buttonStyle"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="10dp" android:layout_marginLeft="40dp"
android:layout_marginTop="3dp" android:layout_marginTop="3dp"
android:layout_marginRight="10dp" android:layout_marginRight="40dp"
android:layout_marginBottom="3dp" android:layout_marginBottom="3dp"
android:textAllCaps="false"
android:layout_weight="0.5" android:layout_weight="0.5"
android:drawableTop="@drawable/icon_cp_pump_canula" android:drawableTop="@drawable/icon_cp_pump_canula"
android:text="@string/primefill" /> android:text="@string/omnipod_cmd_reset_pod" />
<TextView <TextView
android:id="@+id/initpod_space3" android:id="@+id/initpod_space3"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="60dp" android:layout_height="20dp"
android:layout_weight="0.5" android:layout_weight="0.5"
android:text="" /> 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> </LinearLayout>
</ScrollView> </ScrollView>

View file

@ -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> <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 --> <!-- 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_init_pod">Init Pod</string>
<string name="omnipod_cmd_deactivate_pod">Deactivate Pod</string> <string name="omnipod_cmd_deactivate_pod">Deactivate Pod</string>
<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_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_namex" translatable="false">Omnipod</string>
<string name="omnipod_namex2" translatable="false">Omnipod</string> <string name="omnipod_namex2" translatable="false">Omnipod</string>