Merge pull request #153 from AAPS-Omnipod/omnipod_eros_dev_rl_cleanup
Some RileyLink cleanup
This commit is contained in:
commit
155460c8c0
|
@ -19,8 +19,6 @@ public abstract class PumpStatus {
|
||||||
public long previousConnection = 0L; // here should be stored last connection of previous session (so needs to be
|
public long previousConnection = 0L; // here should be stored last connection of previous session (so needs to be
|
||||||
// read before lastConnection is modified for first time).
|
// read before lastConnection is modified for first time).
|
||||||
|
|
||||||
public long lastErrorConnection = 0L;
|
|
||||||
|
|
||||||
// last bolus
|
// last bolus
|
||||||
public Date lastBolusTime;
|
public Date lastBolusTime;
|
||||||
public Double lastBolusAmount;
|
public Double lastBolusAmount;
|
||||||
|
@ -63,26 +61,11 @@ public abstract class PumpStatus {
|
||||||
|
|
||||||
public abstract void initSettings();
|
public abstract void initSettings();
|
||||||
|
|
||||||
|
|
||||||
public void setLastCommunicationToNow() {
|
public void setLastCommunicationToNow() {
|
||||||
this.lastDataTime = DateUtil.now();
|
this.lastDataTime = DateUtil.now();
|
||||||
this.lastConnection = System.currentTimeMillis();
|
this.lastConnection = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setLastFailedCommunicationToNow() {
|
|
||||||
this.lastErrorConnection = System.currentTimeMillis();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public abstract String getErrorInfo();
|
public abstract String getErrorInfo();
|
||||||
|
|
||||||
|
|
||||||
public abstract <E> E getCustomData(String key, Class<E> clazz);
|
|
||||||
|
|
||||||
public String getCustomDataAsString(String key) {
|
|
||||||
return getCustomData(key, String.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,6 @@ import info.nightscout.androidaps.data.Profile;
|
||||||
import info.nightscout.androidaps.data.PumpEnactResult;
|
import info.nightscout.androidaps.data.PumpEnactResult;
|
||||||
import info.nightscout.androidaps.db.Source;
|
import info.nightscout.androidaps.db.Source;
|
||||||
import info.nightscout.androidaps.db.TemporaryBasal;
|
import info.nightscout.androidaps.db.TemporaryBasal;
|
||||||
|
|
||||||
import info.nightscout.androidaps.events.EventRefreshOverview;
|
import info.nightscout.androidaps.events.EventRefreshOverview;
|
||||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
|
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
|
||||||
import info.nightscout.androidaps.interfaces.CommandQueueProvider;
|
import info.nightscout.androidaps.interfaces.CommandQueueProvider;
|
||||||
|
@ -55,9 +54,11 @@ import info.nightscout.androidaps.plugins.pump.common.PumpPluginAbstract;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.data.PumpStatus;
|
import info.nightscout.androidaps.plugins.pump.common.data.PumpStatus;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpDriverState;
|
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.common.events.EventRefreshButtonState;
|
||||||
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.RileyLinkUtil;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpInfo;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState;
|
||||||
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.common.hw.rileylink.service.tasks.ResetRileyLinkConfigurationTask;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ResetRileyLinkConfigurationTask;
|
||||||
|
@ -81,7 +82,6 @@ import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicUIRespons
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus;
|
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus;
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicPumpConfigurationChanged;
|
import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicPumpConfigurationChanged;
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicPumpValuesChanged;
|
import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicPumpValuesChanged;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.events.EventRefreshButtonState;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.service.RileyLinkMedtronicService;
|
import info.nightscout.androidaps.plugins.pump.medtronic.service.RileyLinkMedtronicService;
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicConst;
|
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicConst;
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil;
|
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil;
|
||||||
|
@ -236,21 +236,6 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void resetRileyLinkConfiguration() {
|
|
||||||
rileyLinkMedtronicService.resetRileyLinkConfiguration();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasTuneUp() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void doTuneUpDevice() {
|
|
||||||
rileyLinkMedtronicService.doTuneUpDevice();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void triggerPumpConfigurationChangedEvent() {
|
public void triggerPumpConfigurationChangedEvent() {
|
||||||
rxBus.send(new EventMedtronicPumpConfigurationChanged());
|
rxBus.send(new EventMedtronicPumpConfigurationChanged());
|
||||||
|
@ -339,6 +324,22 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
|
||||||
return rileyLinkMedtronicService;
|
return rileyLinkMedtronicService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override public RileyLinkPumpInfo getPumpInfo() {
|
||||||
|
String pumpDescription = pumpType.getDescription();
|
||||||
|
String frequency = resourceHelper.gs(medtronicPumpStatus.pumpFrequency.equals("medtronic_pump_frequency_us_ca") ? R.string.medtronic_pump_frequency_us_ca : R.string.medtronic_pump_frequency_worldwide);
|
||||||
|
String model = medtronicPumpStatus.medtronicDeviceType == null ? "???" : "Medtronic " + medtronicPumpStatus.medtronicDeviceType.getPumpModel();
|
||||||
|
String serialNumber = medtronicPumpStatus.serialNumber;
|
||||||
|
return new RileyLinkPumpInfo(pumpDescription, frequency, model, serialNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public long getLastConnectionTimeMillis() {
|
||||||
|
return medtronicPumpStatus.lastConnection;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public void setLastCommunicationToNow() {
|
||||||
|
medtronicPumpStatus.setLastCommunicationToNow();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isInitialized() {
|
public boolean isInitialized() {
|
||||||
if (displayConnectionMessages)
|
if (displayConnectionMessages)
|
||||||
|
@ -348,8 +349,8 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsBusy(boolean isBusy_) {
|
public void setBusy(boolean busy) {
|
||||||
isBusy = isBusy_;
|
isBusy = busy;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -774,7 +775,7 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
|
||||||
|
|
||||||
if ((clock.localDeviceTime.getYear() <= 2015) || (timeDiff <= 24 * 60 * 60)) {
|
if ((clock.localDeviceTime.getYear() <= 2015) || (timeDiff <= 24 * 60 * 60)) {
|
||||||
|
|
||||||
aapsLogger.info(LTag.PUMP, "MedtronicPumpPlugin::checkTimeAndOptionallySetTime - Time difference is {} s. Set time on pump." , timeDiff);
|
aapsLogger.info(LTag.PUMP, "MedtronicPumpPlugin::checkTimeAndOptionallySetTime - Time difference is {} s. Set time on pump.", timeDiff);
|
||||||
|
|
||||||
rileyLinkMedtronicService.getMedtronicUIComm().executeCommand(MedtronicCommandType.SetRealTimeClock);
|
rileyLinkMedtronicService.getMedtronicUIComm().executeCommand(MedtronicCommandType.SetRealTimeClock);
|
||||||
|
|
||||||
|
|
|
@ -916,8 +916,4 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public PumpStatus getPumpStatus() {
|
|
||||||
return medtronicPumpStatus;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,27 +165,6 @@ public class MedtronicPumpStatus extends info.nightscout.androidaps.plugins.pump
|
||||||
return (errorDescription == null) ? "-" : errorDescription;
|
return (errorDescription == null) ? "-" : errorDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public <E> E getCustomData(String key, Class<E> clazz) {
|
|
||||||
switch(key) {
|
|
||||||
case "SERIAL_NUMBER":
|
|
||||||
return (E)serialNumber;
|
|
||||||
|
|
||||||
case "PUMP_FREQUENCY":
|
|
||||||
return (E)pumpFrequency;
|
|
||||||
|
|
||||||
case "PUMP_MODEL": {
|
|
||||||
if (medtronicDeviceType==null)
|
|
||||||
return null;
|
|
||||||
else
|
|
||||||
return (E)medtronicDeviceType.getPumpModel();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
default:
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public PumpDeviceState getPumpDeviceState() {
|
public PumpDeviceState getPumpDeviceState() {
|
||||||
return pumpDeviceState;
|
return pumpDeviceState;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.medtronic.service;
|
package info.nightscout.androidaps.plugins.pump.medtronic.service;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.os.Binder;
|
import android.os.Binder;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
|
@ -14,10 +13,8 @@ import info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
|
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.ble.RFSpy;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RFSpy;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RileyLinkBLE;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkEncodingType;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkEncodingType;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkTargetFrequency;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkTargetFrequency;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState;
|
|
||||||
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.utils.ByteUtil;
|
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
|
||||||
|
@ -26,7 +23,6 @@ import info.nightscout.androidaps.plugins.pump.medtronic.R;
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.comm.MedtronicCommunicationManager;
|
import info.nightscout.androidaps.plugins.pump.medtronic.comm.MedtronicCommunicationManager;
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.comm.ui.MedtronicUIComm;
|
import info.nightscout.androidaps.plugins.pump.medtronic.comm.ui.MedtronicUIComm;
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.comm.ui.MedtronicUIPostprocessor;
|
import info.nightscout.androidaps.plugins.pump.medtronic.comm.ui.MedtronicUIPostprocessor;
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.data.MedtronicHistoryData;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.defs.BatteryType;
|
import info.nightscout.androidaps.plugins.pump.medtronic.defs.BatteryType;
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus;
|
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus;
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicConst;
|
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicConst;
|
||||||
|
@ -110,12 +106,6 @@ public class RileyLinkMedtronicService extends RileyLinkService {
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "RileyLinkMedtronicService newly constructed");
|
aapsLogger.debug(LTag.PUMPCOMM, "RileyLinkMedtronicService newly constructed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void resetRileyLinkConfiguration() {
|
|
||||||
rfspy.resetRileyLinkConfiguration();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public MedtronicCommunicationManager getDeviceCommunicationManager() {
|
public MedtronicCommunicationManager getDeviceCommunicationManager() {
|
||||||
return this.medtronicCommunicationManager;
|
return this.medtronicCommunicationManager;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,8 +49,10 @@ import info.nightscout.androidaps.plugins.pump.common.PumpPluginAbstract;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.data.PumpStatus;
|
import info.nightscout.androidaps.plugins.pump.common.data.PumpStatus;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair;
|
import info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
|
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange;
|
||||||
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.defs.RileyLinkPumpDevice;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpInfo;
|
||||||
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.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;
|
||||||
|
@ -339,24 +341,10 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void resetRileyLinkConfiguration() {
|
|
||||||
rileyLinkOmnipodService.resetRileyLinkConfiguration();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasTuneUp() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void doTuneUpDevice() {
|
|
||||||
//rileyLinkOmnipodService.doTuneUpDevice();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void triggerPumpConfigurationChangedEvent() {
|
public void triggerPumpConfigurationChangedEvent() {
|
||||||
rxBus.send(new EventOmnipodPumpValuesChanged());
|
rxBus.send(new EventOmnipodPumpValuesChanged());
|
||||||
|
rxBus.send(new EventRileyLinkDeviceStatusChange());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -364,6 +352,22 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
||||||
return rileyLinkOmnipodService;
|
return rileyLinkOmnipodService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override public RileyLinkPumpInfo getPumpInfo() {
|
||||||
|
String pumpDescription = "Eros";
|
||||||
|
String frequency = resourceHelper.gs(R.string.omnipod_frequency);
|
||||||
|
String connectedModel = podStateManager.isPodInitialized() ? "Eros Pod" : "-";
|
||||||
|
String serialNumber = podStateManager.isPodInitialized() ? String.valueOf(podStateManager.getAddress()) : "-";
|
||||||
|
return new RileyLinkPumpInfo(pumpDescription, frequency, connectedModel, serialNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public long getLastConnectionTimeMillis() {
|
||||||
|
return omnipodPumpStatus.lastConnection;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public void setLastCommunicationToNow() {
|
||||||
|
omnipodPumpStatus.setLastCommunicationToNow();
|
||||||
|
}
|
||||||
|
|
||||||
public OmnipodUIComm getDeviceCommandExecutor() {
|
public OmnipodUIComm getDeviceCommandExecutor() {
|
||||||
return rileyLinkOmnipodService.getDeviceCommandExecutor();
|
return rileyLinkOmnipodService.getDeviceCommandExecutor();
|
||||||
}
|
}
|
||||||
|
@ -478,8 +482,8 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIsBusy(boolean isBusy) {
|
public void setBusy(boolean busy) {
|
||||||
this.isBusy = isBusy;
|
this.isBusy = busy;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getPodPumpStatus() {
|
private void getPodPumpStatus() {
|
||||||
|
|
|
@ -81,19 +81,10 @@ public class OmnipodCommunicationManager extends RileyLinkCommunicationManager {
|
||||||
return new byte[0];
|
return new byte[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public PumpStatus getPumpStatus() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public boolean isDeviceReachable() {
|
@Override public boolean isDeviceReachable() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasTunning() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RLMessage createResponseMessage(byte[] payload) {
|
public RLMessage createResponseMessage(byte[] payload) {
|
||||||
return new OmnipodPacket(payload);
|
return new OmnipodPacket(payload);
|
||||||
|
|
|
@ -5,5 +5,9 @@ public enum PodResponseType {
|
||||||
Acknowledgment, // set commands would just acknowledge if data was sent
|
Acknowledgment, // set commands would just acknowledge if data was sent
|
||||||
Data, // query commands would return data
|
Data, // query commands would return data
|
||||||
Error, // communication/response produced an error
|
Error, // communication/response produced an error
|
||||||
Invalid // invalid response (not supported, should never be returned)
|
Invalid; // invalid response (not supported, should never be returned)
|
||||||
|
|
||||||
|
public boolean isError() {
|
||||||
|
return this == Error || this == Invalid;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,25 +80,6 @@ public class OmnipodPumpStatus extends PumpStatus {
|
||||||
return this.rileyLinkErrorDescription;
|
return this.rileyLinkErrorDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public <E> E getCustomData(String key, Class<E> clazz) {
|
|
||||||
switch (key) {
|
|
||||||
// TODO
|
|
||||||
/*
|
|
||||||
case "POD_LOT_NUMBER":
|
|
||||||
return (E) podLotNumber;
|
|
||||||
|
|
||||||
case "POD_AVAILABLE":
|
|
||||||
return (E) podAvailable;
|
|
||||||
*/
|
|
||||||
|
|
||||||
default:
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// public boolean setNotInPreInit() {
|
// public boolean setNotInPreInit() {
|
||||||
// this.inPreInit = false;
|
// this.inPreInit = false;
|
||||||
//
|
//
|
||||||
|
|
|
@ -200,11 +200,7 @@ public class OmnipodUITask {
|
||||||
|
|
||||||
aapsLogger.debug(LTag.PUMP, "OmnipodUITask: @@@ postProcess. responseType={}", responseType);
|
aapsLogger.debug(LTag.PUMP, "OmnipodUITask: @@@ postProcess. responseType={}", responseType);
|
||||||
|
|
||||||
if (responseType == PodResponseType.Invalid) {
|
if (!responseType.isError()) {
|
||||||
omnipodPumpStatus.setLastFailedCommunicationToNow();
|
|
||||||
} else if (responseType == PodResponseType.Error) {
|
|
||||||
omnipodPumpStatus.setLastFailedCommunicationToNow();
|
|
||||||
} else {
|
|
||||||
omnipodPumpStatus.setLastCommunicationToNow();
|
omnipodPumpStatus.setLastCommunicationToNow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,10 +103,6 @@ public class RileyLinkOmnipodService extends RileyLinkService {
|
||||||
return this.omnipodUIComm;
|
return this.omnipodUIComm;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resetRileyLinkConfiguration() {
|
|
||||||
rfspy.resetRileyLinkConfiguration();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RileyLinkCommunicationManager getDeviceCommunicationManager() {
|
public RileyLinkCommunicationManager getDeviceCommunicationManager() {
|
||||||
return omnipodCommunicationManager;
|
return omnipodCommunicationManager;
|
||||||
|
|
|
@ -24,7 +24,6 @@ import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -35,16 +34,12 @@ import java.util.Map;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
|
||||||
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity;
|
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity;
|
||||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
|
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
|
||||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
|
||||||
import info.nightscout.androidaps.logging.AAPSLogger;
|
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
|
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
|
||||||
import info.nightscout.androidaps.plugins.common.ManufacturerType;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.R;
|
import info.nightscout.androidaps.plugins.pump.common.R;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.ble.BlePreCheck;
|
import info.nightscout.androidaps.plugins.pump.common.ble.BlePreCheck;
|
||||||
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.RileyLinkUtil;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.GattAttributes;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.GattAttributes;
|
||||||
|
@ -110,20 +105,9 @@ public class RileyLinkBLEScanActivity extends NoSplashAppCompatActivity {
|
||||||
|
|
||||||
sp.putString(RileyLinkConst.Prefs.RileyLinkAddress, bleAddress);
|
sp.putString(RileyLinkConst.Prefs.RileyLinkAddress, bleAddress);
|
||||||
|
|
||||||
PumpInterface activePump = activePlugin.getActivePump();
|
RileyLinkPumpDevice rileyLinkPump = (RileyLinkPumpDevice) activePlugin.getActivePump();
|
||||||
|
rileyLinkPump.getRileyLinkService().verifyConfiguration(); // force reloading of address
|
||||||
if (activePump.manufacturer() == ManufacturerType.Medtronic) {
|
rileyLinkPump.triggerPumpConfigurationChangedEvent();
|
||||||
RileyLinkPumpDevice rileyLinkPump = (RileyLinkPumpDevice) activePump;
|
|
||||||
rileyLinkPump.getRileyLinkService().verifyConfiguration(); // force reloading of address
|
|
||||||
|
|
||||||
rileyLinkPump.triggerPumpConfigurationChangedEvent();
|
|
||||||
|
|
||||||
} else if (activePlugin.getActivePump().manufacturer() == ManufacturerType.Insulet) {
|
|
||||||
RileyLinkPumpDevice rileyLinkPump = (RileyLinkPumpDevice) activePump;
|
|
||||||
rileyLinkPump.getRileyLinkService().verifyConfiguration(); // force reloading of address
|
|
||||||
|
|
||||||
rileyLinkPump.triggerPumpConfigurationChangedEvent();
|
|
||||||
}
|
|
||||||
|
|
||||||
finish();
|
finish();
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,9 +3,9 @@ package info.nightscout.androidaps.plugins.pump.common.hw.rileylink;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import dagger.android.HasAndroidInjector;
|
import dagger.android.HasAndroidInjector;
|
||||||
|
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
|
||||||
import info.nightscout.androidaps.logging.AAPSLogger;
|
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||||
import info.nightscout.androidaps.logging.LTag;
|
import info.nightscout.androidaps.logging.LTag;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.data.PumpStatus;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState;
|
import info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RFSpy;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RFSpy;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RileyLinkCommunicationException;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RileyLinkCommunicationException;
|
||||||
|
@ -17,6 +17,7 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.Radi
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.RadioResponse;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.RadioResponse;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RLMessageType;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RLMessageType;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkBLEError;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkBLEError;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice;
|
||||||
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.common.hw.rileylink.service.tasks.ServiceTaskExecutor;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ServiceTaskExecutor;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.WakeAndTuneTask;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.WakeAndTuneTask;
|
||||||
|
@ -37,6 +38,7 @@ public abstract class RileyLinkCommunicationManager {
|
||||||
@Inject protected ServiceTaskExecutor serviceTaskExecutor;
|
@Inject protected ServiceTaskExecutor serviceTaskExecutor;
|
||||||
@Inject protected RFSpy rfspy;
|
@Inject protected RFSpy rfspy;
|
||||||
@Inject protected HasAndroidInjector injector;
|
@Inject protected HasAndroidInjector injector;
|
||||||
|
@Inject protected ActivePluginProvider activePluginProvider;
|
||||||
|
|
||||||
private final int SCAN_TIMEOUT = 1500;
|
private final int SCAN_TIMEOUT = 1500;
|
||||||
private final int ALLOWED_PUMP_UNREACHABLE = 10 * 60 * 1000; // 10 minutes
|
private final int ALLOWED_PUMP_UNREACHABLE = 10 * 60 * 1000; // 10 minutes
|
||||||
|
@ -44,7 +46,6 @@ public abstract class RileyLinkCommunicationManager {
|
||||||
protected int receiverDeviceAwakeForMinutes = 1; // override this in constructor of specific implementation
|
protected int receiverDeviceAwakeForMinutes = 1; // override this in constructor of specific implementation
|
||||||
protected String receiverDeviceID; // String representation of receiver device (ex. Pump (xxxxxx) or Pod (yyyyyy))
|
protected String receiverDeviceID; // String representation of receiver device (ex. Pump (xxxxxx) or Pod (yyyyyy))
|
||||||
protected long lastGoodReceiverCommunicationTime = 0;
|
protected long lastGoodReceiverCommunicationTime = 0;
|
||||||
// protected PumpStatus pumpStatus;
|
|
||||||
private long nextWakeUpRequired = 0L;
|
private long nextWakeUpRequired = 0L;
|
||||||
private int timeoutCount = 0;
|
private int timeoutCount = 0;
|
||||||
|
|
||||||
|
@ -89,10 +90,10 @@ public abstract class RileyLinkCommunicationManager {
|
||||||
rfSpyResponse.wasTimeout(), rfSpyResponse.isUnknownCommand(), rfSpyResponse.isInvalidParam());
|
rfSpyResponse.wasTimeout(), rfSpyResponse.isUnknownCommand(), rfSpyResponse.isInvalidParam());
|
||||||
|
|
||||||
if (rfSpyResponse.wasTimeout()) {
|
if (rfSpyResponse.wasTimeout()) {
|
||||||
if (hasTunning()) {
|
if (rileyLinkServiceData.targetDevice.isTuneUpEnabled()) {
|
||||||
timeoutCount++;
|
timeoutCount++;
|
||||||
|
|
||||||
long diff = System.currentTimeMillis() - getPumpStatus().lastConnection;
|
long diff = System.currentTimeMillis() - getPumpDevice().getLastConnectionTimeMillis();
|
||||||
|
|
||||||
if (diff > ALLOWED_PUMP_UNREACHABLE) {
|
if (diff > ALLOWED_PUMP_UNREACHABLE) {
|
||||||
aapsLogger.warn(LTag.PUMPCOMM, "We reached max time that Pump can be unreachable. Starting Tuning.");
|
aapsLogger.warn(LTag.PUMPCOMM, "We reached max time that Pump can be unreachable. Starting Tuning.");
|
||||||
|
@ -130,10 +131,6 @@ public abstract class RileyLinkCommunicationManager {
|
||||||
return rfspy != null ? rfspy.notConnectedCount : 0;
|
return rfspy != null ? rfspy.notConnectedCount : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasTunning() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// FIXME change wakeup
|
// FIXME change wakeup
|
||||||
// TODO we might need to fix this. Maybe make pump awake for shorter time (battery factor for pump) - Andy
|
// TODO we might need to fix this. Maybe make pump awake for shorter time (battery factor for pump) - Andy
|
||||||
|
@ -404,11 +401,8 @@ public abstract class RileyLinkCommunicationManager {
|
||||||
lastGoodReceiverCommunicationTime = System.currentTimeMillis();
|
lastGoodReceiverCommunicationTime = System.currentTimeMillis();
|
||||||
|
|
||||||
sp.putLong(RileyLinkConst.Prefs.LastGoodDeviceCommunicationTime, lastGoodReceiverCommunicationTime);
|
sp.putLong(RileyLinkConst.Prefs.LastGoodDeviceCommunicationTime, lastGoodReceiverCommunicationTime);
|
||||||
PumpStatus pumpStatus = getPumpStatus();
|
|
||||||
|
|
||||||
if(pumpStatus != null) {
|
getPumpDevice().setLastCommunicationToNow();
|
||||||
pumpStatus.setLastCommunicationToNow();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -429,7 +423,9 @@ public abstract class RileyLinkCommunicationManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract PumpStatus getPumpStatus();
|
private RileyLinkPumpDevice getPumpDevice() {
|
||||||
|
return (RileyLinkPumpDevice) activePluginProvider.getActivePump();
|
||||||
|
}
|
||||||
|
|
||||||
public abstract boolean isDeviceReachable();
|
public abstract boolean isDeviceReachable();
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,18 +4,15 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.Riley
|
||||||
|
|
||||||
public interface RileyLinkPumpDevice {
|
public interface RileyLinkPumpDevice {
|
||||||
|
|
||||||
void setIsBusy(boolean isBusy_);
|
void setBusy(boolean busy);
|
||||||
|
|
||||||
boolean isBusy();
|
|
||||||
|
|
||||||
void resetRileyLinkConfiguration();
|
|
||||||
|
|
||||||
boolean hasTuneUp();
|
|
||||||
|
|
||||||
void doTuneUpDevice();
|
|
||||||
|
|
||||||
void triggerPumpConfigurationChangedEvent();
|
void triggerPumpConfigurationChangedEvent();
|
||||||
|
|
||||||
RileyLinkService getRileyLinkService();
|
RileyLinkService getRileyLinkService();
|
||||||
|
|
||||||
|
RileyLinkPumpInfo getPumpInfo();
|
||||||
|
|
||||||
|
long getLastConnectionTimeMillis();
|
||||||
|
|
||||||
|
void setLastCommunicationToNow();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs;
|
||||||
|
|
||||||
|
public class RileyLinkPumpInfo {
|
||||||
|
private final String connectedDeviceModel;
|
||||||
|
private final String pumpDescription;
|
||||||
|
private final String connectedDeviceSerialNumber;
|
||||||
|
private final String pumpFrequency;
|
||||||
|
|
||||||
|
public RileyLinkPumpInfo(String pumpDescription, String pumpFrequency, String connectedDeviceModel, String connectedDeviceSerialNumber) {
|
||||||
|
this.pumpDescription = pumpDescription;
|
||||||
|
this.pumpFrequency = pumpFrequency;
|
||||||
|
this.connectedDeviceModel = connectedDeviceModel;
|
||||||
|
this.connectedDeviceSerialNumber = connectedDeviceSerialNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getConnectedDeviceModel() {
|
||||||
|
return connectedDeviceModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPumpDescription() {
|
||||||
|
return pumpDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getConnectedDeviceSerialNumber() {
|
||||||
|
return connectedDeviceSerialNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPumpFrequency() {
|
||||||
|
return pumpFrequency;
|
||||||
|
}
|
||||||
|
}
|
|
@ -15,18 +15,15 @@ public enum RileyLinkTargetDevice {
|
||||||
private int resourceId;
|
private int resourceId;
|
||||||
private boolean tuneUpEnabled;
|
private boolean tuneUpEnabled;
|
||||||
|
|
||||||
|
|
||||||
RileyLinkTargetDevice(int resourceId, boolean tuneUpEnabled) {
|
RileyLinkTargetDevice(int resourceId, boolean tuneUpEnabled) {
|
||||||
this.resourceId = resourceId;
|
this.resourceId = resourceId;
|
||||||
this.tuneUpEnabled = tuneUpEnabled;
|
this.tuneUpEnabled = tuneUpEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean isTuneUpEnabled() {
|
public boolean isTuneUpEnabled() {
|
||||||
return tuneUpEnabled;
|
return tuneUpEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public int getResourceId() {
|
public int getResourceId() {
|
||||||
return resourceId;
|
return resourceId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,13 +15,11 @@ import javax.inject.Inject;
|
||||||
import dagger.android.support.DaggerFragment;
|
import dagger.android.support.DaggerFragment;
|
||||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
|
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
|
||||||
import info.nightscout.androidaps.logging.AAPSLogger;
|
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||||
import info.nightscout.androidaps.plugins.common.ManufacturerType;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.PumpPluginAbstract;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.R;
|
import info.nightscout.androidaps.plugins.pump.common.R;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.data.PumpStatus;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.dialog.RefreshableInterface;
|
import info.nightscout.androidaps.plugins.pump.common.dialog.RefreshableInterface;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkFirmwareVersion;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkFirmwareVersion;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpInfo;
|
||||||
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.RileyLinkServiceData;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkServiceData;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.utils.StringUtil;
|
import info.nightscout.androidaps.plugins.pump.common.utils.StringUtil;
|
||||||
|
@ -121,65 +119,24 @@ public class RileyLinkStatusGeneralFragment extends DaggerFragment implements Re
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PumpPluginAbstract pumpPlugin = (PumpPluginAbstract) activePlugin.getActivePump();
|
RileyLinkPumpDevice pumpPlugin = (RileyLinkPumpDevice) activePlugin.getActivePump();
|
||||||
|
RileyLinkPumpInfo pumpInfo = pumpPlugin.getPumpInfo();
|
||||||
|
this.deviceType.setText(rileyLinkServiceData.targetDevice.getResourceId());
|
||||||
|
this.deviceModel.setText(pumpInfo.getPumpDescription());
|
||||||
|
this.serialNumber.setText(pumpInfo.getConnectedDeviceSerialNumber());
|
||||||
|
this.pumpFrequency.setText(pumpInfo.getPumpFrequency());
|
||||||
|
this.connectedDevice.setText(pumpInfo.getConnectedDeviceModel());
|
||||||
|
|
||||||
if (pumpPlugin.manufacturer() == ManufacturerType.Medtronic) {
|
if (rileyLinkServiceData.lastGoodFrequency != null) {
|
||||||
//MedtronicPumpStatus medtronicPumpStatus = (MedtronicPumpStatus)pumpPlugin.getPumpStatusData();
|
this.lastUsedFrequency.setText(String.format(Locale.ENGLISH, "%.2f MHz",
|
||||||
|
rileyLinkServiceData.lastGoodFrequency));
|
||||||
|
}
|
||||||
|
|
||||||
PumpStatus pumpStatusData = pumpPlugin.getPumpStatusData();
|
long lastConnectionTimeMillis = pumpPlugin.getLastConnectionTimeMillis();
|
||||||
|
if (lastConnectionTimeMillis == 0) {
|
||||||
this.deviceType.setText(resourceHelper.gs(RileyLinkTargetDevice.MedtronicPump.getResourceId()));
|
this.lastDeviceContact.setText(resourceHelper.gs(R.string.common_never));
|
||||||
this.deviceModel.setText(pumpPlugin.getPumpType().getDescription());
|
|
||||||
this.serialNumber.setText(pumpStatusData.getCustomDataAsString("SERIAL_NUMBER")); // medtronicPumpStatus.serialNumber);
|
|
||||||
this.pumpFrequency.setText(resourceHelper.gs(pumpStatusData.getCustomDataAsString("PUMP_FREQUENCY").equals("medtronic_pump_frequency_us_ca") ? R.string.medtronic_pump_frequency_us_ca : R.string.medtronic_pump_frequency_worldwide));
|
|
||||||
|
|
||||||
if (pumpStatusData.getCustomDataAsString("PUMP_MODEL") != null)
|
|
||||||
this.connectedDevice.setText("Medtronic " + pumpStatusData.getCustomDataAsString("PUMP_MODEL"));
|
|
||||||
else
|
|
||||||
this.connectedDevice.setText("???");
|
|
||||||
|
|
||||||
if (rileyLinkServiceData.lastGoodFrequency != null)
|
|
||||||
this.lastUsedFrequency.setText(String.format(Locale.ENGLISH, "%.2f MHz",
|
|
||||||
rileyLinkServiceData.lastGoodFrequency));
|
|
||||||
|
|
||||||
if (pumpStatusData.lastConnection != 0)
|
|
||||||
this.lastDeviceContact.setText(StringUtil.toDateTimeString(dateUtil, new LocalDateTime(
|
|
||||||
pumpStatusData.lastDataTime)));
|
|
||||||
else
|
|
||||||
this.lastDeviceContact.setText(resourceHelper.gs(R.string.common_never));
|
|
||||||
} else {
|
} else {
|
||||||
|
this.lastDeviceContact.setText(StringUtil.toDateTimeString(dateUtil, new LocalDateTime(lastConnectionTimeMillis)));
|
||||||
//OmnipodPumpStatus omnipodPumpStatus = (OmnipodPumpStatus)pumpPlugin.getPumpStatusData();
|
|
||||||
PumpStatus pumpStatusData = pumpPlugin.getPumpStatusData();
|
|
||||||
|
|
||||||
this.deviceType.setText(resourceHelper.gs(RileyLinkTargetDevice.Omnipod.getResourceId()));
|
|
||||||
this.deviceModel.setText("Eros");
|
|
||||||
|
|
||||||
this.pumpFrequency.setText(resourceHelper.gs(R.string.omnipod_frequency));
|
|
||||||
|
|
||||||
if (pumpStatusData != null) {
|
|
||||||
|
|
||||||
// TODO show info about active Pod
|
|
||||||
/*
|
|
||||||
if (pumpStatusData.getCustomData("POD_AVAILABLE", Boolean.class)) {
|
|
||||||
this.serialNumber.setText(pumpStatusData.getCustomDataAsString("POD_LOT_NUMBER"));
|
|
||||||
this.connectedDevice.setText(pumpStatusData.pumpType == PumpType.Insulet_Omnipod ? "Eros Pod" : "Dash Pod");
|
|
||||||
} else {
|
|
||||||
this.serialNumber.setText("??");
|
|
||||||
this.connectedDevice.setText("-");
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (rileyLinkServiceData.lastGoodFrequency != null)
|
|
||||||
this.lastUsedFrequency.setText(String.format(Locale.ENGLISH, "%.2f MHz",
|
|
||||||
rileyLinkServiceData.lastGoodFrequency));
|
|
||||||
|
|
||||||
if (pumpStatusData.lastConnection != 0)
|
|
||||||
this.lastDeviceContact.setText(StringUtil.toDateTimeString(dateUtil, new LocalDateTime(
|
|
||||||
pumpStatusData.lastDataTime)));
|
|
||||||
else
|
|
||||||
this.lastDeviceContact.setText(resourceHelper.gs(R.string.common_never));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service;
|
||||||
import android.bluetooth.BluetoothAdapter;
|
import android.bluetooth.BluetoothAdapter;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
@ -185,13 +184,6 @@ public abstract class RileyLinkService extends DaggerService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void sendServiceTransportResponse(ServiceTransport transport, ServiceResult serviceResult) {
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// FIXME: This needs to be run in a session so that is interruptable, has a separate thread, etc.
|
// FIXME: This needs to be run in a session so that is interruptable, has a separate thread, etc.
|
||||||
public void doTuneUpDevice() {
|
public void doTuneUpDevice() {
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,6 @@ import javax.inject.Inject;
|
||||||
import dagger.android.HasAndroidInjector;
|
import dagger.android.HasAndroidInjector;
|
||||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
|
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
|
||||||
import info.nightscout.androidaps.logging.AAPSLogger;
|
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||||
import info.nightscout.androidaps.logging.LTag;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -9,7 +9,6 @@ import info.nightscout.androidaps.interfaces.ActivePluginProvider;
|
||||||
import info.nightscout.androidaps.logging.AAPSLogger;
|
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||||
import info.nightscout.androidaps.logging.LTag;
|
import info.nightscout.androidaps.logging.LTag;
|
||||||
import info.nightscout.androidaps.plugins.common.ManufacturerType;
|
import info.nightscout.androidaps.plugins.common.ManufacturerType;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.PumpPluginAbstract;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkCommunicationManager;
|
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.RileyLinkConst;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil;
|
||||||
|
|
|
@ -6,8 +6,8 @@ import dagger.android.HasAndroidInjector;
|
||||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
|
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
|
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.events.EventRefreshButtonState;
|
import info.nightscout.androidaps.plugins.pump.common.events.EventRefreshButtonState;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RFSpy;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.data.ServiceTransport;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by andy on 9/16/18.
|
* Created by andy on 9/16/18.
|
||||||
|
@ -16,29 +16,23 @@ public class ResetRileyLinkConfigurationTask extends PumpTask {
|
||||||
|
|
||||||
@Inject ActivePluginProvider activePlugin;
|
@Inject ActivePluginProvider activePlugin;
|
||||||
@Inject RxBusWrapper rxBus;
|
@Inject RxBusWrapper rxBus;
|
||||||
|
@Inject RFSpy rfSpy;
|
||||||
|
|
||||||
public ResetRileyLinkConfigurationTask(HasAndroidInjector injector) {
|
public ResetRileyLinkConfigurationTask(HasAndroidInjector injector) {
|
||||||
super(injector);
|
super(injector);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public ResetRileyLinkConfigurationTask(HasAndroidInjector injector, ServiceTransport transport) {
|
|
||||||
super(injector, transport);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
RileyLinkPumpDevice pumpAbstract = (RileyLinkPumpDevice) activePlugin.getActivePump();
|
RileyLinkPumpDevice rileyLinkPumpDevice = (RileyLinkPumpDevice) activePlugin.getActivePump();
|
||||||
|
|
||||||
rxBus.send(new EventRefreshButtonState(false));
|
rxBus.send(new EventRefreshButtonState(false));
|
||||||
|
|
||||||
pumpAbstract.setIsBusy(true);
|
rileyLinkPumpDevice.setBusy(true);
|
||||||
pumpAbstract.resetRileyLinkConfiguration();
|
rfSpy.resetRileyLinkConfiguration();
|
||||||
pumpAbstract.setIsBusy(false);
|
rileyLinkPumpDevice.setBusy(false);
|
||||||
|
|
||||||
rxBus.send(new EventRefreshButtonState(true));
|
rxBus.send(new EventRefreshButtonState(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ import info.nightscout.androidaps.interfaces.ActivePluginProvider;
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
|
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.events.EventRefreshButtonState;
|
import info.nightscout.androidaps.plugins.pump.common.events.EventRefreshButtonState;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.data.ServiceTransport;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by geoff on 7/16/16.
|
* Created by geoff on 7/16/16.
|
||||||
|
@ -19,24 +18,17 @@ public class WakeAndTuneTask extends PumpTask {
|
||||||
|
|
||||||
private static final String TAG = "WakeAndTuneTask";
|
private static final String TAG = "WakeAndTuneTask";
|
||||||
|
|
||||||
|
|
||||||
public WakeAndTuneTask(HasAndroidInjector injector) {
|
public WakeAndTuneTask(HasAndroidInjector injector) {
|
||||||
super(injector);
|
super(injector);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public WakeAndTuneTask(HasAndroidInjector injector, ServiceTransport transport) {
|
|
||||||
super(injector, transport);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
RileyLinkPumpDevice pumpDevice = (RileyLinkPumpDevice)activePlugin.getActivePump();
|
RileyLinkPumpDevice pumpDevice = (RileyLinkPumpDevice) activePlugin.getActivePump();
|
||||||
rxBus.send(new EventRefreshButtonState(false));
|
rxBus.send(new EventRefreshButtonState(false));
|
||||||
pumpDevice.setIsBusy(true);
|
pumpDevice.setBusy(true);
|
||||||
pumpDevice.doTuneUpDevice();
|
pumpDevice.getRileyLinkService().doTuneUpDevice();
|
||||||
pumpDevice.setIsBusy(false);
|
pumpDevice.setBusy(false);
|
||||||
rxBus.send(new EventRefreshButtonState(true));
|
rxBus.send(new EventRefreshButtonState(true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,11 +57,6 @@
|
||||||
<string name="rileylink_target_device_medtronic">Medtronic Pump</string>
|
<string name="rileylink_target_device_medtronic">Medtronic Pump</string>
|
||||||
<string name="rileylink_target_device_omnipod">Omnipod</string>
|
<string name="rileylink_target_device_omnipod">Omnipod</string>
|
||||||
|
|
||||||
|
|
||||||
<string name="omnipod_frequency">Omnipod (433.91 MHz)</string>
|
|
||||||
<string name="medtronic_pump_frequency_us_ca">US & Canada (916 MHz)</string>
|
|
||||||
<string name="medtronic_pump_frequency_worldwide">Worldwide (868 Mhz)</string>
|
|
||||||
|
|
||||||
<string name="key_medtronic_pump_encoding_4b6b_local" translatable="false">medtronic_pump_encoding_4b6b_local</string>
|
<string name="key_medtronic_pump_encoding_4b6b_local" translatable="false">medtronic_pump_encoding_4b6b_local</string>
|
||||||
<string name="key_medtronic_pump_encoding_4b6b_rileylink" translatable="false">medtronic_pump_encoding_4b6b_rileylink</string>
|
<string name="key_medtronic_pump_encoding_4b6b_rileylink" translatable="false">medtronic_pump_encoding_4b6b_rileylink</string>
|
||||||
|
|
||||||
|
@ -70,9 +65,6 @@
|
||||||
|
|
||||||
<string name="mdt_last_bolus" translatable="false">%1$.1f %2$s (%3$s)</string>
|
<string name="mdt_last_bolus" translatable="false">%1$.1f %2$s (%3$s)</string>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<plurals name="duration_days">
|
<plurals name="duration_days">
|
||||||
<item quantity="one">%1$d day</item>
|
<item quantity="one">%1$d day</item>
|
||||||
<item quantity="other">%1$d days</item>
|
<item quantity="other">%1$d days</item>
|
||||||
|
@ -81,10 +73,6 @@
|
||||||
<item quantity="one">%1$d hour</item>
|
<item quantity="one">%1$d hour</item>
|
||||||
<item quantity="other">%1$d hours</item>
|
<item quantity="other">%1$d hours</item>
|
||||||
</plurals>
|
</plurals>
|
||||||
<!-- <plurals name="objective_minutes">-->
|
|
||||||
<!-- <item quantity="one">%1$d minute</item>-->
|
|
||||||
<!-- <item quantity="other">%1$d minutes</item>-->
|
|
||||||
<!-- </plurals>-->
|
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in a new issue