Merge branch 'omnipod_eros_bart' into omnipod_eros_andy

This commit is contained in:
Andy Rozman 2019-08-30 10:52:25 +01:00
commit 3438c3ed23
14 changed files with 481 additions and 499 deletions

View file

@ -46,6 +46,7 @@
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
@ -79,33 +80,33 @@
<!-- Receive new BG readings from other local apps -->
<receiver
android:name=".receivers.DataReceiver"
android:enabled="true"
android:exported="true">
android:name=".receivers.DataReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<!-- Receiver from xDrip -->
<action android:name="com.eveningoutpost.dexdrip.BgEstimate"/>
<action android:name="com.eveningoutpost.dexdrip.BgEstimate" />
<!-- Receiver from 640g uploader -->
<action android:name="com.eveningoutpost.dexdrip.NS_EMULATOR"/>
<action android:name="com.eveningoutpost.dexdrip.NS_EMULATOR" />
<!-- Receiver from glimp -->
<action android:name="it.ct.glicemia.ACTION_GLUCOSE_MEASURED"/>
<action android:name="it.ct.glicemia.ACTION_GLUCOSE_MEASURED" />
<!-- Receiver from Dexcom -->
<action android:name="com.dexcom.cgm.EXTERNAL_BROADCAST"/>
<action android:name="com.dexcom.cgm.EXTERNAL_BROADCAST" />
<!-- Receiver from Poctech -->
<action android:name="com.china.poctech.data"/>
<action android:name="com.china.poctech.data" />
<!-- Receiver from Tomato -->
<action android:name="com.fanqies.tomatofn.BgEstimate"/>
<action android:name="com.fanqies.tomatofn.BgEstimate" />
</intent-filter>
</receiver>
<!-- Receive new SMS messages -->
<receiver
android:name=".receivers.SmsReceiver"
android:enabled="true"
android:exported="true"
android:permission="android.permission.BROADCAST_SMS">
android:name=".receivers.SmsReceiver"
android:enabled="true"
android:exported="true"
android:permission="android.permission.BROADCAST_SMS">
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED"/>
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
@ -297,7 +298,6 @@
android:theme="@style/Theme.AppCompat.NoTitle" />
<activity android:name=".plugins.pump.medtronic.dialog.MedtronicHistoryActivity" />
<!-- Omnipod service and activities -->
<service
android:name=".plugins.pump.omnipod.service.RileyLinkOmnipodService"
@ -305,7 +305,9 @@
android:exported="true" />
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
<uses-library
android:name="org.apache.http.legacy"
android:required="false" />
</application>

View file

@ -11,6 +11,8 @@ import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
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.comm.action.AcknowledgeAlertsAction;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.BolusAction;
@ -28,20 +30,25 @@ import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.service.PairS
import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.service.PrimeService;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.service.SetTempBasalService;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.StatusResponse;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfo;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoResponse;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.DeliveryType;
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.SetupProgress;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule.BasalSchedule;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule.BasalScheduleMapper;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodSessionState;
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
import info.nightscout.androidaps.utils.SP;
public class OmnipodManager {
public class OmnipodManager implements OmnipodCommunicationManagerInterface {
private final OmnipodCommunicationService communicationService;
private PodSessionState podState;
private static OmnipodManager instance;
// FIXME this is dirty
public static OmnipodManager getInstance() {
return instance;
}
public OmnipodManager(OmnipodCommunicationService communicationService, PodSessionState podState) {
if (communicationService == null) {
@ -49,150 +56,300 @@ public class OmnipodManager {
}
this.communicationService = communicationService;
this.podState = podState;
instance = this;
}
public OmnipodManager(OmnipodCommunicationService communicationService) {
this(communicationService, null);
@Override
public PumpEnactResult insertCannula(Profile profile) {
if (podState == null || podState.getSetupProgress().isBefore(SetupProgress.PRIMING_FINISHED)) {
// TODO use string resource
return new PumpEnactResult().success(false).enacted(false).comment("Pod should be paired and primed first");
} else if (podState.getSetupProgress().isAfter(SetupProgress.CANNULA_INSERTING)) {
// TODO use string resource
return new PumpEnactResult().success(false).enacted(false).comment("Illegal setup state: " + podState.getSetupProgress().name());
}
try {
communicationService.executeAction(new InsertCannulaAction(new InsertCannulaService(), podState,
BasalScheduleMapper.mapProfileToBasalSchedule(profile)));
executeDelayed(() -> {
StatusResponse delayedStatusResponse = communicationService.executeAction(new GetStatusAction(podState));
InsertCannulaAction.updateCannulaInsertionStatus(podState, delayedStatusResponse);
}, OmnipodConst.POD_CANNULA_INSERTION_DURATION);
} catch (Exception ex) {
// TODO distinguish between certain and uncertain failures
// TODO user friendly error messages (string resources)
return new PumpEnactResult().success(false).enacted(false).comment(ex.getMessage());
}
return new PumpEnactResult().success(true).enacted(true);
}
@Override
public PumpEnactResult pairAndPrime() {
try {
if (podState == null) {
podState = communicationService.executeAction(new PairAction(new PairService()));
}
if (podState.getSetupProgress().isBefore(SetupProgress.PRIMING_FINISHED)) {
communicationService.executeAction(new PrimeAction(new PrimeService(), podState));
executeDelayed(() -> {
StatusResponse delayedStatusResponse = communicationService.executeAction(new GetStatusAction(podState));
PrimeAction.updatePrimingStatus(podState, delayedStatusResponse);
}, OmnipodConst.POD_PRIME_DURATION);
} else {
// TODO use string resource
return new PumpEnactResult().success(false).enacted(false).comment("Illegal setup state: " + podState.getSetupProgress().name());
}
} catch (Exception ex) {
// TODO distinguish between certain and uncertain failures
// TODO user friendly error messages (string resources)
return new PumpEnactResult().success(false).enacted(false).comment(ex.getMessage());
}
return new PumpEnactResult().success(true).enacted(true);
}
@Override
public PumpEnactResult cancelBolus() {
if (!isInitialized()) {
return createNotInitializedResult();
}
try {
communicationService.executeAction(new CancelDeliveryAction(podState, DeliveryType.BOLUS, true));
} catch (Exception ex) {
// TODO distinguish between certain and uncertain failures
// TODO user friendly error messages (string resources)
return new PumpEnactResult().success(false).enacted(false).comment(ex.getMessage());
}
return new PumpEnactResult().success(true).enacted(true);
}
@Override
public PumpEnactResult getPodStatus() {
if (podState == null) {
// TODO use string resource
return new PumpEnactResult().success(false).enacted(false).comment("Pod should be paired and primed first");
}
try {
// TODO how can we return the status response? Also refer to TODO in interface
StatusResponse statusResponse = communicationService.executeAction(new GetStatusAction(podState));
} catch (Exception ex) {
// TODO distinguish between certain and uncertain failures
// TODO user friendly error messages (string resources)
return new PumpEnactResult().success(false).enacted(false).comment(ex.getMessage());
}
return new PumpEnactResult().success(true).enacted(true);
}
@Override
public PumpEnactResult deactivatePod() {
if (podState == null) {
// TODO use string resource
return new PumpEnactResult().success(false).enacted(false).comment("Pod should be paired and primed first");
}
try {
communicationService.executeAction(new DeactivatePodAction(podState, true));
resetPodState();
} catch (Exception ex) {
// TODO distinguish between certain and uncertain failures
// TODO user friendly error messages (string resources)
return new PumpEnactResult().success(false).enacted(false).comment(ex.getMessage());
}
return new PumpEnactResult().success(true).enacted(true);
}
@Override
public PumpEnactResult setBasalProfile(Profile basalProfile) {
if (!isInitialized()) {
return createNotInitializedResult();
}
try {
communicationService.executeAction(new SetBasalScheduleAction(podState,
BasalScheduleMapper.mapProfileToBasalSchedule(basalProfile),
false, podState.getScheduleOffset(), true));
} catch (Exception ex) {
// TODO distinguish between certain and uncertain failures
// TODO user friendly error messages (string resources)
return new PumpEnactResult().success(false).enacted(false).comment(ex.getMessage());
}
return new PumpEnactResult().success(true).enacted(true);
}
@Override
public PumpEnactResult resetPodState() {
podState = null;
SP.remove(OmnipodConst.Prefs.PodState);
return new PumpEnactResult().success(true).enacted(true);
}
@Override
public PumpEnactResult bolus(Double units) {
if (!isInitialized()) {
return createNotInitializedResult();
}
try {
communicationService.executeAction(new BolusAction(podState, units, true, true));
} catch (Exception ex) {
// TODO distinguish between certain and uncertain failures
// TODO user friendly error messages (string resources)
return new PumpEnactResult().success(false).enacted(false).comment(ex.getMessage());
}
return new PumpEnactResult().success(true).enacted(true);
}
@Override
public PumpEnactResult setTemporaryBasal(TempBasalPair tempBasalPair) {
if (!isInitialized()) {
return createNotInitializedResult();
}
try {
communicationService.executeAction(new SetTempBasalAction(new SetTempBasalService(),
podState, tempBasalPair.getInsulinRate(), Duration.standardMinutes(tempBasalPair.getDurationMinutes()),
true, true));
} catch (Exception ex) {
// TODO distinguish between certain and uncertain failures
// TODO user friendly error messages (string resources)
return new PumpEnactResult().success(false).enacted(false).comment(ex.getMessage());
}
return new PumpEnactResult().success(true).enacted(true);
}
@Override
public PumpEnactResult cancelTemporaryBasal() {
if (!isInitialized()) {
return createNotInitializedResult();
}
try {
communicationService.executeAction(new CancelDeliveryAction(podState, DeliveryType.TEMP_BASAL, true));
} catch (Exception ex) {
// TODO distinguish between certain and uncertain failures
// TODO user friendly error messages (string resources)
return new PumpEnactResult().success(false).enacted(false).comment(ex.getMessage());
}
return new PumpEnactResult().success(true).enacted(true);
}
@Override
public PumpEnactResult acknowledgeAlerts() {
if (!isInitialized()) {
return createNotInitializedResult();
}
try {
communicationService.executeAction(new AcknowledgeAlertsAction(podState, podState.getActiveAlerts()));
} catch (Exception ex) {
// TODO distinguish between certain and uncertain failures
// TODO user friendly error messages (string resources)
return new PumpEnactResult().success(false).enacted(false).comment(ex.getMessage());
}
return new PumpEnactResult().success(true).enacted(true);
}
// TODO should we add this to the OmnipodCommunicationManager interface?
public PumpEnactResult getPodInfo(PodInfoType podInfoType) {
if (!isInitialized()) {
return createNotInitializedResult();
}
try {
// TODO how can we return the PodInfo response?
PodInfoResponse podInfoResponse = communicationService.executeAction(new GetPodInfoAction(podState, podInfoType));
} catch (Exception ex) {
// TODO distinguish between certain and uncertain failures
// TODO user friendly error messages (string resources)
return new PumpEnactResult().success(false).enacted(false).comment(ex.getMessage());
}
return new PumpEnactResult().success(true).enacted(true);
}
// TODO should we add this to the OmnipodCommunicationManager interface?
public PumpEnactResult suspendDelivery() {
if (!isInitialized()) {
return createNotInitializedResult();
}
try {
communicationService.executeAction(new CancelDeliveryAction(podState, EnumSet.allOf(DeliveryType.class), true));
} catch (Exception ex) {
// TODO distinguish between certain and uncertain failures
// TODO user friendly error messages (string resources)
return new PumpEnactResult().success(false).enacted(false).comment(ex.getMessage());
}
return new PumpEnactResult().success(true).enacted(true);
}
// TODO should we add this to the OmnipodCommunicationManager interface?
public PumpEnactResult resumeDelivery() {
if (!isInitialized()) {
return createNotInitializedResult();
}
try {
communicationService.executeAction(new SetBasalScheduleAction(podState, podState.getBasalSchedule(),
true, podState.getScheduleOffset(), true));
} catch (Exception ex) {
// TODO distinguish between certain and uncertain failures
// TODO user friendly error messages (string resources)
return new PumpEnactResult().success(false).enacted(false).comment(ex.getMessage());
}
return new PumpEnactResult().success(true).enacted(true);
}
// TODO should we add this to the OmnipodCommunicationManager interface?
public PumpEnactResult setTime() {
if (!isInitialized()) {
return createNotInitializedResult();
}
try {
// Suspend delivery
communicationService.executeAction(new CancelDeliveryAction(podState, EnumSet.allOf(DeliveryType.class), false));
// Joda seems to cache the default time zone, so we use the JVM's
DateTimeZone.setDefault(DateTimeZone.forTimeZone(TimeZone.getDefault()));
podState.setTimeZone(DateTimeZone.getDefault());
// Resume delivery
communicationService.executeAction(new SetBasalScheduleAction(podState, podState.getBasalSchedule(),
true, podState.getScheduleOffset(), true));
} catch (Exception ex) {
// TODO distinguish between certain and uncertain failures
// TODO user friendly error messages (string resources)
return new PumpEnactResult().success(false).enacted(false).comment(ex.getMessage());
}
return new PumpEnactResult().success(true).enacted(true);
}
public OmnipodCommunicationService getCommunicationService() {
return communicationService;
}
public <T extends PodInfo> T getPodInfo(PodInfoType podInfoType) {
if (!isInitialized()) {
throw new IllegalStateException("Pod should be initialized first");
}
PodInfoResponse podInfoResponse = communicationService.executeAction(new GetPodInfoAction(podState, podInfoType));
return podInfoResponse.getPodInfo();
}
public StatusResponse getStatus() {
if (podState == null) {
throw new IllegalStateException("Pod should be paired first");
}
return communicationService.executeAction(new GetStatusAction(podState));
}
public void acknowledgeAlerts() {
if (!isInitialized()) {
throw new IllegalStateException("Pod should be initialized first");
}
communicationService.executeAction(new AcknowledgeAlertsAction(podState, podState.getActiveAlerts()));
}
public void pairAndPrime() {
if (podState == null) {
podState = communicationService.executeAction(new PairAction(new PairService()));
}
if (podState.getSetupProgress().isBefore(SetupProgress.PRIMING_FINISHED)) {
communicationService.executeAction(new PrimeAction(new PrimeService(), podState));
executeDelayed(() -> {
StatusResponse delayedStatusResponse = communicationService.executeAction(new GetStatusAction(podState));
PrimeAction.updatePrimingStatus(podState, delayedStatusResponse);
}, OmnipodConst.POD_PRIME_DURATION);
} else {
throw new IllegalStateException("Illegal setup state: " + podState.getSetupProgress().name());
}
}
public void insertCannula(Profile profile) {
if (podState == null || podState.getSetupProgress().isBefore(SetupProgress.PRIMING_FINISHED)) {
throw new IllegalArgumentException("Pod should be paired and primed first");
} else if (podState.getSetupProgress().isAfter(SetupProgress.CANNULA_INSERTING)) {
throw new IllegalStateException("Illegal setup state: " + podState.getSetupProgress().name());
}
communicationService.executeAction(new InsertCannulaAction(new InsertCannulaService(), podState,
BasalScheduleMapper.mapProfileToBasalSchedule(profile)));
executeDelayed(() -> {
StatusResponse delayedStatusResponse = communicationService.executeAction(new GetStatusAction(podState));
InsertCannulaAction.updateCannulaInsertionStatus(podState, delayedStatusResponse);
}, OmnipodConst.POD_CANNULA_INSERTION_DURATION);
}
public void setBasalSchedule(BasalSchedule basalSchedule, boolean confidenceReminder) {
if (!isInitialized()) {
throw new IllegalStateException("Pod should be initialized first");
}
communicationService.executeAction(new SetBasalScheduleAction(podState, basalSchedule,
confidenceReminder, podState.getScheduleOffset(), true));
}
public void setTempBasal(double rate, Duration duration) {
if (!isInitialized()) {
throw new IllegalStateException("Pod should be initialized first");
}
communicationService.executeAction(new SetTempBasalAction(new SetTempBasalService(),
podState, rate, duration, true, true));
}
public void cancelTempBasal() {
if (!isInitialized()) {
throw new IllegalStateException("Pod should be initialized first");
}
communicationService.executeAction(new CancelDeliveryAction(podState, DeliveryType.TEMP_BASAL, true));
}
public void bolus(double units) {
if (!isInitialized()) {
throw new IllegalStateException("Pod should be initialized first");
}
communicationService.executeAction(new BolusAction(podState, units, true, true));
}
public void cancelBolus() {
if (!isInitialized()) {
throw new IllegalStateException("Pod should be initialized first");
}
communicationService.executeAction(new CancelDeliveryAction(podState, DeliveryType.BOLUS, true));
}
public void suspendDelivery() {
if (!isInitialized()) {
throw new IllegalStateException("Pod should be initialized first");
}
communicationService.executeAction(new CancelDeliveryAction(podState, EnumSet.allOf(DeliveryType.class), true));
}
public void resumeDelivery() {
if (!isInitialized()) {
throw new IllegalStateException("Pod should be initialized first");
}
communicationService.executeAction(new SetBasalScheduleAction(podState, podState.getBasalSchedule(),
true, podState.getScheduleOffset(), true));
}
public void setTime() {
if (!isInitialized()) {
throw new IllegalStateException("Pod should be initialized first");
}
// Suspend delivery
communicationService.executeAction(new CancelDeliveryAction(podState, EnumSet.allOf(DeliveryType.class), false));
// Joda seems to cache the default time zone, so we use the JVM's
DateTimeZone.setDefault(DateTimeZone.forTimeZone(TimeZone.getDefault()));
podState.setTimeZone(DateTimeZone.getDefault());
// Resume delivery
communicationService.executeAction(new SetBasalScheduleAction(podState, podState.getBasalSchedule(),
true, podState.getScheduleOffset(), true));
}
public DateTime getTime() {
return podState.getTime();
}
public void deactivatePod() {
if (podState == null) {
throw new IllegalStateException("Pod should be paired first");
}
communicationService.executeAction(new DeactivatePodAction(podState, true));
resetPodState();
}
public boolean isInitialized() {
return podState != null && podState.getSetupProgress() == SetupProgress.COMPLETED;
}
@ -201,13 +358,13 @@ public class OmnipodManager {
return podState == null ? "null" : podState.toString();
}
public void resetPodState() {
podState = null;
SP.remove(OmnipodConst.Prefs.PodState);
}
private void executeDelayed(Runnable r, Duration timeout) {
ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(1);
scheduledExecutorService.schedule(r, timeout.getMillis(), TimeUnit.MILLISECONDS);
}
private PumpEnactResult createNotInitializedResult() {
// TODO use string resource
return new PumpEnactResult().success(false).enacted(false).comment("Pod should be initialized first");
}
}

View file

@ -43,7 +43,6 @@ 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.omnipod.comm.OmnipodCommunicationManager;
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.defs.OmnipodCommandType;
@ -105,7 +104,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements PumpInterfa
displayConnectionMessages = false;
if (omnipodCommunicationManager == null) {
omnipodCommunicationManager = OmnipodCommunicationManager.getInstance();
omnipodCommunicationManager = OmnipodManager.getInstance();
}
omnipodUIComm = new OmnipodUIComm(omnipodCommunicationManager);
@ -114,12 +113,14 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements PumpInterfa
serviceConnection = new ServiceConnection() {
@Override
public void onServiceDisconnected(ComponentName name) {
if (isLoggingEnabled())
LOG.debug("RileyLinkOmnipodService is disconnected");
omnipodService = null;
}
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
if (isLoggingEnabled())
LOG.debug("RileyLinkOmnipodService is connected");
@ -144,12 +145,10 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements PumpInterfa
};
}
protected OmnipodPumpPlugin(PluginDescription pluginDescription, PumpType pumpType) {
super(pluginDescription, pumpType);
}
public static OmnipodPumpPlugin getPlugin() {
if (plugin == null)
plugin = new OmnipodPumpPlugin();
@ -187,6 +186,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements PumpInterfa
}
@Override
public void onStartCustomActions() {
// check status every minute (if any status needs refresh we send readStatus command)
@ -205,6 +205,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements PumpInterfa
}
@Override
public Class getServiceClass() {
return RileyLinkOmnipodService.class;
}
@ -436,11 +437,13 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements PumpInterfa
}
@Override
protected void triggerUIChange() {
RxBus.INSTANCE.send(new EventOmnipodPumpValuesChanged());
}
@Override
@NonNull
protected PumpEnactResult deliverBolus(final DetailedBolusInfo detailedBolusInfo) {
@ -453,11 +456,11 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements PumpInterfa
OmnipodUITask responseTask = omnipodUIComm.executeCommand(OmnipodCommandType.SetBolus,
detailedBolusInfo.insulin);
Boolean response = responseTask.wasCommandSuccessful();
PumpEnactResult result = responseTask.getResult();
setRefreshButtonEnabled(true);
if (response) {
if (result.success) {
TreatmentsPlugin.getPlugin().addToHistoryTreatment(detailedBolusInfo, true);
@ -475,50 +478,36 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements PumpInterfa
long time = System.currentTimeMillis() + (bolusTime * 1000);
this.busyTimestamps.add(time);
return new PumpEnactResult().success(true) //
.enacted(true) //
.bolusDelivered(detailedBolusInfo.insulin) //
.carbsDelivered(detailedBolusInfo.carbs);
} else {
return new PumpEnactResult() //
.success(false) //
.enacted(false) //
.comment(MainApp.gs(R.string.medtronic_cmd_bolus_could_not_be_delivered));
result.bolusDelivered(detailedBolusInfo.insulin).carbsDelivered(detailedBolusInfo.carbs);
}
return result;
} finally {
finishAction("Bolus");
}
}
@Override
public void stopBolusDelivering() {
LOG.info(getLogPrefix() + "stopBolusDelivering");
setRefreshButtonEnabled(false);
try {
OmnipodUITask responseTask = omnipodUIComm.executeCommand(OmnipodCommandType.CancelBolus);
OmnipodUITask responseTask = omnipodUIComm.executeCommand(OmnipodCommandType.CancelBolus);
PumpEnactResult result = responseTask.getResult();
Boolean response = responseTask.wasCommandSuccessful();
setRefreshButtonEnabled(true);
setRefreshButtonEnabled(true);
LOG.info(getLogPrefix() + "stopBolusDelivering - wasSuccess={}", result.success);
LOG.info(getLogPrefix() + "stopBolusDelivering - wasSuccess={}", response);
if (result.success) {
// TODO fix bolus record with cancel
if (response) {
// TODO fix bolus record with cancel
//TreatmentsPlugin.getPlugin().addToHistoryTreatment(detailedBolusInfo, true);
}
} finally {
finishAction("Bolus");
//TreatmentsPlugin.getPlugin().addToHistoryTreatment(detailedBolusInfo, true);
}
finishAction("Bolus");
}
@ -552,7 +541,6 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements PumpInterfa
}
if (tbrCurrent != null && !enforceNew) {
if (OmnipodUtil.isSame(tbrCurrent.getInsulinRate(), absoluteRate)) {
if (isLoggingEnabled())
LOG.info(getLogPrefix() + "setTempBasalAbsolute - No enforceNew and same rate. Exiting.");
@ -569,10 +557,9 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements PumpInterfa
// CANCEL
OmnipodUITask responseTask2 = omnipodUIComm.executeCommand(OmnipodCommandType.CancelTemporaryBasal);
Boolean response = responseTask2.wasCommandSuccessful();
;
PumpEnactResult result = responseTask2.getResult();
if (response) {
if (result.success) {
if (isLoggingEnabled())
LOG.info(getLogPrefix() + "setTempBasalAbsolute - Current TBR cancelled.");
} else {
@ -581,8 +568,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements PumpInterfa
finishAction("TBR");
return new PumpEnactResult().success(false).enacted(false)
.comment(MainApp.gs(R.string.medtronic_cmd_cant_cancel_tbr_stop_op));
return result;
}
}
@ -590,12 +576,12 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements PumpInterfa
OmnipodUITask responseTask = omnipodUIComm.executeCommand(OmnipodCommandType.SetTemporaryBasal,
absoluteRate, durationInMinutes);
Boolean response = responseTask.wasCommandSuccessful();
PumpEnactResult result = responseTask.getResult();
if (isLoggingEnabled())
LOG.info(getLogPrefix() + "setTempBasalAbsolute - setTBR. Response: " + response);
LOG.info(getLogPrefix() + "setTempBasalAbsolute - setTBR. Response: " + result.success);
if (response) {
if (result.success) {
pumpStatusLocal.tempBasalStart = System.currentTimeMillis();
pumpStatusLocal.tempBasalAmount = absoluteRate;
pumpStatusLocal.tempBasalLength = durationInMinutes;
@ -610,19 +596,10 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements PumpInterfa
TreatmentsPlugin.getPlugin().addToHistoryTempBasal(tempStart);
incrementStatistics(OmnipodConst.Statistics.TBRsSet);
finishAction("TBR");
return new PumpEnactResult().success(true).enacted(true) //
.absolute(absoluteRate).duration(durationInMinutes);
} else {
finishAction("TBR");
return new PumpEnactResult().success(false).enacted(false) //
.comment(MainApp.gs(R.string.medtronic_cmd_tbr_could_not_be_delivered));
}
finishAction("TBR");
return result;
}
protected TempBasalPair readTBR() {
@ -683,11 +660,11 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements PumpInterfa
OmnipodUITask responseTask2 = omnipodUIComm.executeCommand(OmnipodCommandType.CancelTemporaryBasal);
Boolean response = responseTask2.wasCommandSuccessful();
PumpEnactResult result = responseTask2.getResult();
finishAction("TBR");
if (response) {
if (result.success) {
if (isLoggingEnabled())
LOG.info(getLogPrefix() + "cancelTempBasal - Cancel TBR successful.");
@ -697,17 +674,12 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements PumpInterfa
.source(Source.USER);
TreatmentsPlugin.getPlugin().addToHistoryTempBasal(tempBasal);
return new PumpEnactResult().success(true).enacted(true) //
.isTempCancel(true);
} else {
if (isLoggingEnabled())
LOG.info(getLogPrefix() + "cancelTempBasal - Cancel TBR failed.");
return new PumpEnactResult().success(response).enacted(response) //
.comment(MainApp.gs(R.string.medtronic_cmd_cant_cancel_tbr));
}
return result;
}
@Override
@ -733,19 +705,16 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements PumpInterfa
OmnipodUITask responseTask = omnipodUIComm.executeCommand(OmnipodCommandType.SetBasalProfile,
profile);
Boolean response = responseTask.wasCommandSuccessful();
PumpEnactResult result = responseTask.getResult();
if (isLoggingEnabled())
LOG.info(getLogPrefix() + "Basal Profile was set: " + response);
LOG.info(getLogPrefix() + "Basal Profile was set: " + result.success);
if (response) {
if (result.success) {
this.currentProfile = profile;
return new PumpEnactResult().success(true).enacted(true);
} else {
return new PumpEnactResult().success(response).enacted(response) //
.comment(MainApp.gs(R.string.medtronic_cmd_basal_profile_could_not_be_set));
}
return result;
}

View file

@ -1,144 +0,0 @@
package info.nightscout.androidaps.plugins.pump.omnipod.comm;
import android.content.Context;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkCommunicationManager;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RFSpy;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.RLMessage;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RLMessageType;
import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodManager;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.data.PodCommResponse;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommunicationManagerInterface;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodSessionState;
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;
import info.nightscout.androidaps.utils.SP;
/**
* Created by andy on 4.8.2019
*/
public class OmnipodCommunicationManager extends RileyLinkCommunicationManager implements OmnipodCommunicationManagerInterface {
private static final Logger LOG = LoggerFactory.getLogger(L.PUMPCOMM);
private static OmnipodCommunicationManager omnipodCommunicationManager;
String errorMessage;
OmnipodCommunicationService communicationService;
OmnipodManager omnipodManager;
public OmnipodCommunicationManager(Context context, RFSpy rfspy) {
super(rfspy);
omnipodCommunicationManager = this;
OmnipodUtil.getPumpStatus().previousConnection = SP.getLong(
RileyLinkConst.Prefs.LastGoodDeviceCommunicationTime, 0L);
communicationService = new OmnipodCommunicationService(this);
omnipodManager = new OmnipodManager(communicationService, getPodSessionState());
}
private PodSessionState getPodSessionState() {
return null;
}
public static OmnipodCommunicationManager getInstance() {
return omnipodCommunicationManager;
}
@Override
protected void configurePumpSpecificSettings() {
pumpStatus = OmnipodUtil.getPumpStatus();
}
@Override
public <E extends RLMessage> E createResponseMessage(byte[] payload, Class<E> clazz) {
// TODO
//PumpMessage pumpMessage = new PumpMessage(payload);
//eturn (E) pumpMessage;
return null;
}
@Override
public boolean tryToConnectToDevice() {
return false; //isDeviceReachable(true);
}
public String getErrorResponse() {
return this.errorMessage;
}
@Override
public byte[] createPumpMessageContent(RLMessageType type) {
return new byte[0];
}
private boolean isLogEnabled() {
return L.isEnabled(L.PUMPCOMM);
}
// This are just skeleton methods, we need to see what we can get returned and act accordingly
public PodCommResponse initPod() {
omnipodManager.pairAndPrime();
return null;
}
public PodCommResponse getPodStatus() {
return null;
}
public PodCommResponse deactivatePod() {
return null;
}
public PodCommResponse setBasalProfile(Profile profile) {
return null;
}
public PodCommResponse resetPodStatus() {
return null;
}
public PodCommResponse setBolus(Double parameter) {
return null;
}
public PodCommResponse cancelBolus() {
return null;
}
public PodCommResponse setTemporaryBasal(TempBasalPair tbr) {
return null;
}
public PodCommResponse cancelTemporaryBasal() {
return null;
}
@Override
public PodCommResponse acknowledgeAlerts() {
return null;
}
}

View file

@ -35,33 +35,30 @@ import info.nightscout.androidaps.plugins.pump.omnipod.exception.PodReturnedErro
* Created by andy on 6/29/18.
*/
public class OmnipodCommunicationService /*extends RileyLinkCommunicationManager*/ {
public class OmnipodCommunicationService extends RileyLinkCommunicationManager {
private static final Logger LOG = LoggerFactory.getLogger(OmnipodCommunicationService.class);
//RFSpy rfspy = null;
OmnipodCommunicationManager communicationManager;
public OmnipodCommunicationService(OmnipodCommunicationManager communicationManager) {
//this.rfspy = rfspy;
this.communicationManager = communicationManager;
public OmnipodCommunicationService(RFSpy rfspy) {
super(rfspy);
}
// @Override
// protected void configurePumpSpecificSettings() {
// }
//
// @Override
// public boolean tryToConnectToDevice() {
// // TODO
// return false;
// }
//
// @Override
// public byte[] createPumpMessageContent(RLMessageType type) {
// return new byte[0];
// }
@Override
protected void configurePumpSpecificSettings() {
}
//@Override
@Override
public boolean tryToConnectToDevice() {
// TODO
return false;
}
@Override
public byte[] createPumpMessageContent(RLMessageType type) {
return new byte[0];
}
@Override
public <E extends RLMessage> E createResponseMessage(byte[] payload, Class<E> clazz) {
return (E) new OmnipodPacket(payload);
}
@ -199,7 +196,7 @@ public class OmnipodCommunicationService /*extends RileyLinkCommunicationManager
OmnipodPacket ack = createAckPacket(podState, packetAddress, messageAddress);
boolean quiet = false;
while (!quiet) try {
this.communicationManager.sendAndListen(ack, 300, 1, 0, 40, OmnipodPacket.class);
sendAndListen(ack, 300, 1, 0, 40, OmnipodPacket.class);
} catch (RileyLinkCommunicationException ex) {
if (RileyLinkBLEError.Timeout.equals(ex.getErrorCode())) {
quiet = true;
@ -227,7 +224,7 @@ public class OmnipodCommunicationService /*extends RileyLinkCommunicationManager
while (System.currentTimeMillis() < timeoutTime) {
OmnipodPacket response = null;
try {
response = this.communicationManager.sendAndListen(packet, responseTimeoutMilliseconds, repeatCount, 9, preambleExtensionMilliseconds, OmnipodPacket.class);
response = sendAndListen(packet, responseTimeoutMilliseconds, repeatCount, 9, preambleExtensionMilliseconds, OmnipodPacket.class);
} catch (Exception ex) {
LOG.debug("Ignoring exception in exchangePackets: " + ex.getClass().getSimpleName() + ": " + ex.getMessage());
}

View file

@ -4,7 +4,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationManager;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommunicationManagerInterface;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommandType;
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;

View file

@ -4,10 +4,10 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.data.PumpEnactResult;
import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.bus.RxBus;
import info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.data.PodCommResponse;
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.PodDeviceState;
@ -25,7 +25,7 @@ public class OmnipodUITask {
private static final Logger LOG = LoggerFactory.getLogger(L.PUMP);
public OmnipodCommandType commandType;
public PodCommResponse returnData;
public PumpEnactResult returnData;
private String errorDescription;
private Object[] parameters;
private PodResponseType responseType;
@ -55,7 +55,7 @@ public class OmnipodUITask {
// break;
case InitPod:
returnData = communicationManager.initPod();
returnData = communicationManager.pairAndPrime();
break;
case DeactivatePod:
@ -63,7 +63,7 @@ public class OmnipodUITask {
break;
case ResetPodStatus:
returnData = communicationManager.resetPodStatus();
returnData = communicationManager.resetPodState();
break;
case SetBasalProfile:
@ -74,7 +74,7 @@ public class OmnipodUITask {
Double amount = getDoubleFromParameters(0);
if (amount != null)
returnData = communicationManager.setBolus(amount);
returnData = communicationManager.bolus(amount);
}
break;
@ -128,11 +128,10 @@ public class OmnipodUITask {
}
public Object getResult() {
return returnData;
public <T> T getResult() {
return (T)returnData;
}
public boolean isReceived() {
return (returnData != null || errorDescription != null);
}
@ -184,12 +183,5 @@ public class OmnipodUITask {
return this.responseType;
}
public boolean wasCommandSuccessful() {
if (returnData == null) {
return false;
}
return returnData.isAcknowledged();
}
}

View file

@ -1,66 +1,70 @@
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.comm.data.PodCommResponse;
public interface OmnipodCommunicationManagerInterface {
// TODO add methods that can be used by OmniPod Eros and Omnipod Dash
/**
* Pair and prime
*/
PumpEnactResult pairAndPrime();
/**
* Initialize Pod
* Insert cannula
*/
PodCommResponse initPod();
PumpEnactResult insertCannula(Profile basalProfile);
/**
* Get Pod Status (is pod running, battery left ?, reservoir, etc)
*/
PodCommResponse getPodStatus();
// TODO we should probably return a (wrapped) StatusResponse instead of a PumpEnactResult
PumpEnactResult getPodStatus();
/**
* Deactivate Pod
*/
PodCommResponse deactivatePod();
PumpEnactResult deactivatePod();
/**
* Set Basal Profile
*/
PodCommResponse setBasalProfile(Profile profile);
PumpEnactResult setBasalProfile(Profile basalProfile);
/**
* Reset Pod status (if we forget to disconnect Pod and want to init new pod, and want to forget current pod)
* Reset Pod state (if we forget to disconnect Pod and want to init new pod, and want to forget current pod)
*/
PodCommResponse resetPodStatus();
PumpEnactResult resetPodState();
/**
* Set Bolus
*
* @param amount amount of bolus in U
*/
PodCommResponse setBolus(Double amount);
PumpEnactResult bolus(Double amount);
/**
* Cancel Bolus (if bolus is already stopped, return acknowledgment)
*/
PodCommResponse cancelBolus();
PumpEnactResult cancelBolus();
/**
* Set Temporary Basal
*
* @param tbr TempBasalPair object containg amount and duration in minutes
* @param tempBasalPair TempBasalPair object containg amount and duration in minutes
*/
PodCommResponse setTemporaryBasal(TempBasalPair tbr);
PumpEnactResult setTemporaryBasal(TempBasalPair tempBasalPair);
/**
* Cancel Temporary Basal (if TB is already stopped, return acknowledgment)
*/
PodCommResponse cancelTemporaryBasal();
PumpEnactResult cancelTemporaryBasal();
/**
* Acknowledge alerts
*/
PodCommResponse acknowledgeAlerts();
PumpEnactResult acknowledgeAlerts();
}

View file

@ -8,6 +8,7 @@ import java.util.List;
import info.nightscout.androidaps.data.Profile;
public class BasalScheduleMapper {
// TODO add tests
public static BasalSchedule mapProfileToBasalSchedule(Profile profile) {
Profile.ProfileValue[] basalValues = profile.getBasalValues();
List<BasalScheduleEntry> entries = new ArrayList<>();

View file

@ -6,6 +6,8 @@ import android.content.res.Configuration;
import android.os.Binder;
import android.os.IBinder;
import com.google.gson.Gson;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -21,8 +23,12 @@ 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.OmnipodManager;
import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodPumpPlugin;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationManager;
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.state.PodSessionState;
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;
import info.nightscout.androidaps.utils.SP;
@ -36,7 +42,7 @@ public class RileyLinkOmnipodService extends RileyLinkService {
private static RileyLinkOmnipodService instance;
OmnipodCommunicationManager omnipodCommunicationManager;
OmnipodCommunicationManagerInterface omnipodCommunicationManager;
OmnipodPumpStatus pumpStatus = null;
private IBinder mBinder = new LocalBinder();
@ -101,7 +107,26 @@ public class RileyLinkOmnipodService extends RileyLinkService {
RileyLinkUtil.setRileyLinkBLE(rileyLinkBLE);
// init rileyLinkCommunicationManager
omnipodCommunicationManager = new OmnipodCommunicationManager(context, rfspy);
initializeErosOmnipodManager();
// TODO Dash
}
private void initializeErosOmnipodManager() {
if(OmnipodManager.getInstance() == null) {
PodSessionState podState = null;
if (SP.contains(OmnipodConst.Prefs.PodState)) {
try {
Gson gson = OmnipodUtil.getGsonInstance();
String storedPodState = SP.getString(OmnipodConst.Prefs.PodState, null);
podState = gson.fromJson(storedPodState, PodSessionState.class);
} catch (Exception ex) {
LOG.error("Could not deserialize Pod state: " + ex.getClass().getSimpleName() + ": " + ex.getMessage());
}
}
omnipodCommunicationManager = new OmnipodManager(new OmnipodCommunicationService(rfspy), podState);
} else {
omnipodCommunicationManager = OmnipodManager.getInstance();
}
}
@ -112,7 +137,11 @@ public class RileyLinkOmnipodService extends RileyLinkService {
@Override
public RileyLinkCommunicationManager getDeviceCommunicationManager() {
return this.omnipodCommunicationManager;
if(omnipodCommunicationManager instanceof OmnipodManager) { // Eros
return ((OmnipodManager) omnipodCommunicationManager).getCommunicationService();
}
// FIXME is this correct for Dash?
return (RileyLinkCommunicationManager)omnipodCommunicationManager;
}

View file

@ -25,8 +25,8 @@ import info.nightscout.androidaps.plugins.bus.RxBus;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.data.RLHistoryItem;
import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodPumpPlugin;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationManager;
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.PodDeviceState;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodSessionState;
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodDeviceStatusChange;
@ -46,7 +46,7 @@ public class OmnipodUtil extends RileyLinkUtil {
private static RileyLinkOmnipodService omnipodService;
private static OmnipodPumpStatus omnipodPumpStatus;
private static OmnipodCommandType currentCommand;
private static Gson gsonInstance = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
private static Gson gsonInstance = createGson();
private static PodSessionState podSessionState;
private static PodDeviceState podDeviceState;
private static OmnipodPumpPlugin omnipodPumpPlugin;
@ -99,12 +99,10 @@ public class OmnipodUtil extends RileyLinkUtil {
OmnipodUtil.lowLevelDebug = lowLevelDebug;
}
public static OmnipodCommunicationManager getOmnipodCommunicationManager() {
return (OmnipodCommunicationManager) RileyLinkUtil.rileyLinkCommunicationManager;
public static OmnipodCommunicationManagerInterface getOmnipodCommunicationManager() {
return (OmnipodCommunicationManagerInterface) RileyLinkUtil.rileyLinkCommunicationManager;
}
public static RileyLinkOmnipodService getOmnipodService() {
return OmnipodUtil.omnipodService;
}

View file

@ -1,65 +1,35 @@
package info.nightscout.androidaps.plugins.pump.omnipod_dash;
import android.content.ComponentName;
import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.IBinder;
import android.os.SystemClock;
import androidx.annotation.NonNull;
import org.joda.time.LocalDateTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import info.nightscout.androidaps.BuildConfig;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.DetailedBolusInfo;
import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.data.PumpEnactResult;
import info.nightscout.androidaps.db.Source;
import info.nightscout.androidaps.db.TemporaryBasal;
import info.nightscout.androidaps.events.EventRefreshOverview;
import info.nightscout.androidaps.interfaces.PluginDescription;
import info.nightscout.androidaps.interfaces.PluginType;
import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.bus.RxBus;
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction;
import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType;
import info.nightscout.androidaps.plugins.pump.common.PumpPluginAbstract;
import info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair;
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.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.omnipod.OmnipodFragment;
import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodPumpPlugin;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationManager;
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.defs.OmnipodCommandType;
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.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.OmnipodConst;
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;
import info.nightscout.androidaps.plugins.pump.omnipod_dash.comm.OmnipodDashCommunicationManager;
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
import info.nightscout.androidaps.utils.SP;
/**
* Created by andy on 23.04.18.

View file

@ -6,11 +6,11 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.data.PumpEnactResult;
import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RFSpy;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.data.PodCommResponse;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommunicationManagerInterface;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodSessionState;
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;
@ -35,8 +35,6 @@ public class OmnipodDashCommunicationManager implements OmnipodCommunicationMana
private PodSessionState getPodSessionState() {
return null;
}
@ -63,51 +61,61 @@ public class OmnipodDashCommunicationManager implements OmnipodCommunicationMana
// This are just skeleton methods, we need to see what we can get returned and act accordingly
public PodCommResponse initPod() {
@Override
public PumpEnactResult pairAndPrime() {
//omnipodManager.pairAndPrime();
return null;
}
public PodCommResponse getPodStatus() {
return null;
}
public PodCommResponse deactivatePod() {
return null;
}
public PodCommResponse setBasalProfile(Profile profile) {
return null;
}
public PodCommResponse resetPodStatus() {
return null;
}
public PodCommResponse setBolus(Double parameter) {
return null;
}
public PodCommResponse cancelBolus() {
return null;
}
public PodCommResponse setTemporaryBasal(TempBasalPair tbr) {
return null;
}
public PodCommResponse cancelTemporaryBasal() {
@Override
public PumpEnactResult insertCannula(Profile basalProfile) {
return null;
}
@Override
public PodCommResponse acknowledgeAlerts() {
public PumpEnactResult getPodStatus() {
return null;
}
@Override
public PumpEnactResult deactivatePod() {
return null;
}
@Override
public PumpEnactResult setBasalProfile(Profile basalProfile) {
return null;
}
@Override
public PumpEnactResult resetPodState() {
return null;
}
@Override
public PumpEnactResult bolus(Double parameter) {
return null;
}
@Override
public PumpEnactResult cancelBolus() {
return null;
}
@Override
public PumpEnactResult setTemporaryBasal(TempBasalPair tempBasalPair) {
return null;
}
@Override
public PumpEnactResult cancelTemporaryBasal() {
return null;
}
@Override
public PumpEnactResult acknowledgeAlerts() {
return null;
}
}

View file

@ -7,7 +7,7 @@
android:enabled="true"
android:summary=""
android:title="RileyLink Configuration"
android:key="@string/pref_key_rileylink_mac_address">
android:key="@string/key_rileylink_mac_address">
<intent android:action="info.nightscout.androidaps.plugins.PumpCommon.dialog.RileyLinkBLEScanActivity" />
</info.nightscout.androidaps.plugins.pump.common.ui.RileyLinkSelectPreference>