Merge pull request #2817 from andyrozman/medtronic_modules
Medtronic modules
This commit is contained in:
commit
9f7a5c0003
223 changed files with 1126 additions and 586 deletions
|
@ -242,6 +242,8 @@ dependencies {
|
|||
implementation project(':dana')
|
||||
implementation project(':danars')
|
||||
implementation project(':danar')
|
||||
implementation project(':rileylink')
|
||||
implementation project(':medtronic')
|
||||
|
||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||
implementation 'com.google.android.gms:play-services-wearable:17.0.0'
|
||||
|
|
|
@ -258,16 +258,7 @@
|
|||
android:name=".plugins.pump.medtronic.service.RileyLinkMedtronicService"
|
||||
android:enabled="true"
|
||||
android:exported="true" />
|
||||
<activity android:name=".plugins.pump.common.dialog.RileyLinkBLEScanActivity">
|
||||
<intent-filter>
|
||||
<action android:name="info.nightscout.androidaps.plugins.PumpCommon.dialog.RileyLinkBLEScanActivity" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusActivity"
|
||||
android:label="@string/title_activity_rileylink_settings"
|
||||
android:theme="@style/Theme.AppCompat.NoTitle" />
|
||||
|
||||
<activity android:name=".plugins.pump.medtronic.dialog.MedtronicHistoryActivity" />
|
||||
|
||||
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
|
||||
|
|
|
@ -70,7 +70,32 @@ public class DatabaseHelperProvider implements DatabaseHelperInterface {
|
|||
return MainApp.getDbHelper().roundDateToSec(date);
|
||||
}
|
||||
|
||||
@Override public void createOrUpdateTDD(@NotNull TDD record) {
|
||||
MainApp.getDbHelper().createOrUpdateTDD(record);
|
||||
}
|
||||
|
||||
@Override public void createOrUpdate(@NotNull TemporaryBasal tempBasal) {
|
||||
MainApp.getDbHelper().createOrUpdate(tempBasal);
|
||||
}
|
||||
|
||||
@NotNull @Override public TemporaryBasal findTempBasalByPumpId(long id) {
|
||||
return MainApp.getDbHelper().findTempBasalByPumpId(id);
|
||||
}
|
||||
|
||||
@NotNull @Override public List<TemporaryBasal> getTemporaryBasalsDataFromTime(long mills, boolean ascending) {
|
||||
return MainApp.getDbHelper().getTemporaryBasalsDataFromTime(mills, ascending);
|
||||
}
|
||||
|
||||
@NotNull @Override public CareportalEvent getCareportalEventFromTimestamp(long timestamp) {
|
||||
return MainApp.getDbHelper().getCareportalEventFromTimestamp(timestamp);
|
||||
}
|
||||
|
||||
@NotNull @Override public List<TDD> getTDDsForLastXDays(int days) {
|
||||
return MainApp.getDbHelper().getTDDsForLastXDays(days);
|
||||
}
|
||||
|
||||
@NotNull @Override public List<ProfileSwitch> getProfileSwitchData(long from, boolean ascending) {
|
||||
return MainApp.getDbHelper().getProfileSwitchData(from, ascending);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ import info.nightscout.androidaps.plugins.aps.openAPSSMB.OpenAPSSMBFragment
|
|||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderFragment
|
||||
import info.nightscout.androidaps.plugins.constraints.objectives.ObjectivesFragment
|
||||
import info.nightscout.androidaps.plugins.constraints.objectives.activities.ObjectivesExamDialog
|
||||
import info.nightscout.androidaps.dialogs.NtpProgressDialog
|
||||
import info.nightscout.androidaps.plugins.general.actions.ActionsFragment
|
||||
import info.nightscout.androidaps.plugins.general.automation.AutomationFragment
|
||||
import info.nightscout.androidaps.plugins.general.automation.dialogs.ChooseActionDialog
|
||||
|
@ -32,7 +31,6 @@ import info.nightscout.androidaps.plugins.profile.ns.NSProfileFragment
|
|||
import info.nightscout.androidaps.plugins.pump.combo.ComboFragment
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusGeneralFragment
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusHistoryFragment
|
||||
import info.nightscout.androidaps.danars.dialogs.PairingProgressDialog
|
||||
import info.nightscout.androidaps.plugins.pump.insight.LocalInsightFragment
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicFragment
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.dialog.RileyLinkStatusDeviceMedtronic
|
||||
|
|
|
@ -2,10 +2,6 @@ package info.nightscout.androidaps.dependencyInjection
|
|||
|
||||
import dagger.Module
|
||||
import dagger.android.ContributesAndroidInjector
|
||||
import info.nightscout.androidaps.plugins.general.automation.AutomationEvent
|
||||
import info.nightscout.androidaps.plugins.general.automation.actions.*
|
||||
import info.nightscout.androidaps.plugins.general.automation.elements.*
|
||||
import info.nightscout.androidaps.plugins.general.automation.triggers.*
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkCommunicationManager
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RFSpy
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RileyLinkBLE
|
||||
|
@ -16,8 +12,6 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.Radi
|
|||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.*
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.comm.MedtronicCommunicationManager
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.comm.ui.MedtronicUITask
|
||||
import info.nightscout.androidaps.queue.CommandQueue
|
||||
import info.nightscout.androidaps.queue.commands.*
|
||||
|
||||
@Module
|
||||
@Suppress("unused")
|
||||
|
|
|
@ -8,7 +8,6 @@ import info.nightscout.androidaps.events.EventRefreshOverview
|
|||
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
||||
import info.nightscout.androidaps.queue.Callback
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import javax.inject.Inject
|
||||
|
|
|
@ -20,7 +20,6 @@ import javax.inject.Inject;
|
|||
import javax.inject.Singleton;
|
||||
|
||||
import dagger.android.HasAndroidInjector;
|
||||
import info.nightscout.androidaps.BuildConfig;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.DetailedBolusInfo;
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
package info.nightscout.androidaps.plugins.pump.medtronic.defs;
|
||||
|
||||
import info.nightscout.androidaps.R;
|
||||
|
||||
/**
|
||||
* Created by andy on 6/11/18.
|
||||
*/
|
||||
|
||||
public enum PumpDeviceState {
|
||||
|
||||
NeverContacted(R.string.medtronic_pump_status_never_contacted), //
|
||||
Sleeping(R.string.medtronic_pump_status_sleeping), //
|
||||
WakingUp(R.string.medtronic_pump_status_waking_up), //
|
||||
Active(R.string.medtronic_pump_status_active), //
|
||||
ErrorWhenCommunicating(R.string.medtronic_pump_status_error_comm), //
|
||||
TimeoutWhenCommunicating(R.string.medtronic_pump_status_timeout_comm), //
|
||||
// ProblemContacting(R.string.medtronic_pump_status_problem_contacting), //
|
||||
PumpUnreachable(R.string.medtronic_pump_status_pump_unreachable), //
|
||||
InvalidConfiguration(R.string.medtronic_pump_status_invalid_config);
|
||||
|
||||
Integer resourceId;
|
||||
|
||||
PumpDeviceState(int resourceId) {
|
||||
this.resourceId = resourceId;
|
||||
}
|
||||
|
||||
public Integer getResourceId() {
|
||||
return resourceId;
|
||||
}
|
||||
}
|
|
@ -217,10 +217,10 @@ class OmnipodFragment : DaggerFragment() {
|
|||
omnipod_rl_status.text =
|
||||
when {
|
||||
omnipodPumpStatus.rileyLinkServiceState == RileyLinkServiceState.NotStarted -> resourceHelper.gs(resourceId)
|
||||
omnipodPumpStatus.rileyLinkServiceState.isConnecting -> "{fa-bluetooth-b spin} " + resourceHelper.gs(resourceId)
|
||||
omnipodPumpStatus.rileyLinkServiceState.isError && rileyLinkError == null -> "{fa-bluetooth-b} " + resourceHelper.gs(resourceId)
|
||||
omnipodPumpStatus.rileyLinkServiceState.isError && rileyLinkError != null -> "{fa-bluetooth-b} " + resourceHelper.gs(rileyLinkError.getResourceId(RileyLinkTargetDevice.MedtronicPump))
|
||||
else -> "{fa-bluetooth-b} " + resourceHelper.gs(resourceId)
|
||||
omnipodPumpStatus.rileyLinkServiceState.isConnecting -> "{fa-bluetooth-b spin} " + resourceHelper.gs(resourceId)
|
||||
omnipodPumpStatus.rileyLinkServiceState.isError && rileyLinkError == null -> "{fa-bluetooth-b} " + resourceHelper.gs(resourceId)
|
||||
omnipodPumpStatus.rileyLinkServiceState.isError && rileyLinkError != null -> "{fa-bluetooth-b} " + resourceHelper.gs(rileyLinkError.getResourceId(RileyLinkTargetDevice.MedtronicPump))
|
||||
else -> "{fa-bluetooth-b} " + resourceHelper.gs(resourceId)
|
||||
}
|
||||
omnipod_rl_status.setTextColor(if (rileyLinkError != null) Color.RED else Color.WHITE)
|
||||
|
||||
|
|
|
@ -418,6 +418,11 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
rileyLinkOmnipodService.doTuneUpDevice();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void triggerPumpConfigurationChangedEvent() {
|
||||
rxBus.send(new EventOmnipodPumpValuesChanged());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public RileyLinkOmnipodService getRileyLinkService() {
|
||||
|
|
|
@ -9,6 +9,7 @@ import dagger.android.HasAndroidInjector;
|
|||
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||
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.hw.rileylink.RileyLinkCommunicationManager;
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst;
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RFSpy;
|
||||
|
@ -17,7 +18,6 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.RLMe
|
|||
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.utils.ByteUtil;
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.defs.PumpDeviceState;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.OmnipodAction;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.CommunicationException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalMessageAddressException;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.message;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.RLMessage;
|
||||
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PacketType;
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.data;
|
||||
|
||||
import org.joda.time.LocalDateTime;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.data.RLHistoryItem;
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice;
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicCommandType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommandType;
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
||||
|
||||
public class RLHistoryItemOmnipod extends RLHistoryItem {
|
||||
|
||||
private OmnipodCommandType omnipodCommandType;
|
||||
|
||||
public RLHistoryItemOmnipod(OmnipodCommandType omnipodCommandType) {
|
||||
super(new LocalDateTime(), RLHistoryItemSource.OmnipodCommand, RileyLinkTargetDevice.Omnipod);
|
||||
this.omnipodCommandType = omnipodCommandType;
|
||||
}
|
||||
|
||||
public String getDescription(ResourceHelper resourceHelper) {
|
||||
|
||||
switch (this.source) {
|
||||
case RileyLink:
|
||||
return "State: " + resourceHelper.gs(serviceState.getResourceId(targetDevice))
|
||||
+ (this.errorCode == null ? "" : ", Error Code: " + errorCode);
|
||||
|
||||
case MedtronicPump:
|
||||
return resourceHelper.gs(pumpDeviceState.getResourceId());
|
||||
|
||||
case OmnipodCommand:
|
||||
return omnipodCommandType.name();
|
||||
|
||||
default:
|
||||
return "Unknown Description";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -5,7 +5,6 @@ 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.message.response.podinfo.PodInfoRecentPulseLog;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus;
|
||||
|
||||
public interface OmnipodCommunicationManagerInterface {
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import info.nightscout.androidaps.R;
|
|||
/**
|
||||
* Created by andy on 4.8.2019
|
||||
*/
|
||||
|
||||
// TODO remove this class and use PumpDeviceState instead
|
||||
public enum PodDeviceState {
|
||||
|
||||
// FIXME
|
||||
|
|
|
@ -8,14 +8,14 @@ import javax.inject.Singleton;
|
|||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
|
||||
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.defs.PumpDeviceState;
|
||||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
|
||||
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.common.hw.rileylink.defs.RileyLinkError;
|
||||
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.medtronic.defs.PumpDeviceState;
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicDeviceStatusChange;
|
||||
import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange;
|
||||
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.util.OmnipodConst;
|
||||
|
@ -53,7 +53,7 @@ public class OmnipodPumpStatus extends PumpStatus {
|
|||
|
||||
public String podNumber;
|
||||
public PodDeviceState podDeviceState = PodDeviceState.NeverContacted;
|
||||
public boolean podAvailable = false;
|
||||
public Boolean podAvailable = false;
|
||||
public boolean podAvailibityChecked = false;
|
||||
public boolean ackAlertsAvailable = false;
|
||||
public String ackAlertsText = null;
|
||||
|
@ -101,6 +101,21 @@ public class OmnipodPumpStatus extends PumpStatus {
|
|||
return (this.errorDescription == null) ? "-" : this.errorDescription;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <E> E getCustomData(String key, Class<E> clazz) {
|
||||
switch(key) {
|
||||
case "POD_LOT_NUMBER":
|
||||
return (E)podLotNumber;
|
||||
|
||||
case "POD_AVAILABLE":
|
||||
return (E)podAvailable;
|
||||
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// public boolean setNotInPreInit() {
|
||||
// this.inPreInit = false;
|
||||
|
@ -187,7 +202,7 @@ public class OmnipodPumpStatus extends PumpStatus {
|
|||
|
||||
rileyLinkUtil.getRileyLinkHistory().add(new RLHistoryItem(pumpDeviceState, RileyLinkTargetDevice.Omnipod));
|
||||
|
||||
rxBus.send(new EventMedtronicDeviceStatusChange(pumpDeviceState));
|
||||
rxBus.send(new EventRileyLinkDeviceStatusChange(pumpDeviceState));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.db;
|
||||
|
||||
import androidx.annotation.IdRes;
|
||||
import androidx.annotation.StringRes;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.events
|
||||
|
||||
import info.nightscout.androidaps.events.Event
|
||||
import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkError
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodDeviceState
|
||||
|
@ -9,18 +10,13 @@ import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodSessionStat
|
|||
/**
|
||||
* Created by andy on 4.8.2019
|
||||
*/
|
||||
class EventOmnipodDeviceStatusChange : Event {
|
||||
class EventOmnipodDeviceStatusChange : EventRileyLinkDeviceStatusChange {
|
||||
|
||||
var rileyLinkServiceState: RileyLinkServiceState? = null
|
||||
var rileyLinkError: RileyLinkError? = null
|
||||
var podSessionState: PodSessionState? = null
|
||||
var errorDescription: String? = null
|
||||
var podDeviceState: PodDeviceState? = null
|
||||
|
||||
@JvmOverloads
|
||||
constructor(rileyLinkServiceState: RileyLinkServiceState?, rileyLinkError: RileyLinkError? = null) {
|
||||
this.rileyLinkServiceState = rileyLinkServiceState
|
||||
this.rileyLinkError = rileyLinkError
|
||||
constructor(rileyLinkServiceState: RileyLinkServiceState?, rileyLinkError: RileyLinkError? = null) : super(rileyLinkServiceState, rileyLinkError) {
|
||||
}
|
||||
|
||||
constructor(podSessionState: PodSessionState?) {
|
||||
|
|
|
@ -14,6 +14,7 @@ import javax.inject.Inject;
|
|||
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.logging.LTag;
|
||||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState;
|
||||
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;
|
||||
|
@ -23,7 +24,6 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.Rile
|
|||
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.service.RileyLinkService;
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.defs.PumpDeviceState;
|
||||
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.state.PodSessionState;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.util;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonDeserializer;
|
||||
|
@ -17,8 +15,6 @@ import javax.inject.Inject;
|
|||
import javax.inject.Singleton;
|
||||
|
||||
import dagger.android.HasAndroidInjector;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
|
||||
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||
import info.nightscout.androidaps.logging.LTag;
|
||||
|
@ -27,14 +23,15 @@ import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
|
|||
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.comm.OmnipodManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.data.RLHistoryItemOmnipod;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommandType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodPodType;
|
||||
|
||||
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.driver.OmnipodDriverState;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodDeviceStatusChange;
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog;
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP;
|
||||
|
||||
|
@ -103,7 +100,7 @@ public class OmnipodUtil {
|
|||
this.currentCommand = currentCommand;
|
||||
|
||||
if (currentCommand != null)
|
||||
rileyLinkUtil.getRileyLinkHistory().add(new RLHistoryItem(currentCommand));
|
||||
rileyLinkUtil.getRileyLinkHistory().add(new RLHistoryItemOmnipod(currentCommand));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommunication
|
|||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitActionType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitReceiver;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodSessionState;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus;
|
||||
|
||||
/**
|
||||
* Created by andy on 4.8.2019
|
||||
|
|
|
@ -64,4 +64,4 @@ abstract class AbstractSensitivityPlugin(
|
|||
output.sensResult = sensResult
|
||||
return output
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ import androidx.annotation.NonNull;
|
|||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||
import com.google.gson.GsonBuilder;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
|
@ -605,6 +604,12 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
|
|||
return newRecordCreated;
|
||||
}
|
||||
|
||||
public TreatmentUpdateReturn createOrUpdateMedtronic(Treatment treatment, boolean fromNightScout) {
|
||||
TreatmentService.UpdateReturn resultRecord = getService().createOrUpdateMedtronic(treatment, fromNightScout);
|
||||
|
||||
return new TreatmentUpdateReturn(resultRecord.success, resultRecord.newRecord);
|
||||
}
|
||||
|
||||
// return true if new record is created
|
||||
@Override
|
||||
public boolean addToHistoryTreatment(DetailedBolusInfo detailedBolusInfo, boolean allowUpdate) {
|
||||
|
|
0
app/src/main/jniLibs/README.md
Normal file
0
app/src/main/jniLibs/README.md
Normal file
BIN
app/src/main/jniLibs/arm64-v8a/libBleCommandUtil.so
Normal file
BIN
app/src/main/jniLibs/arm64-v8a/libBleCommandUtil.so
Normal file
Binary file not shown.
BIN
app/src/main/jniLibs/armeabi-v7a/libBleCommandUtil.so
Normal file
BIN
app/src/main/jniLibs/armeabi-v7a/libBleCommandUtil.so
Normal file
Binary file not shown.
BIN
app/src/main/jniLibs/armeabi/libBleCommandUtil.so
Normal file
BIN
app/src/main/jniLibs/armeabi/libBleCommandUtil.so
Normal file
Binary file not shown.
BIN
app/src/main/jniLibs/mips/libBleCommandUtil.so
Normal file
BIN
app/src/main/jniLibs/mips/libBleCommandUtil.so
Normal file
Binary file not shown.
BIN
app/src/main/jniLibs/mips64/libBleCommandUtil.so
Normal file
BIN
app/src/main/jniLibs/mips64/libBleCommandUtil.so
Normal file
Binary file not shown.
BIN
app/src/main/jniLibs/x86/libBleCommandUtil.so
Normal file
BIN
app/src/main/jniLibs/x86/libBleCommandUtil.so
Normal file
Binary file not shown.
BIN
app/src/main/jniLibs/x86_64/libBleCommandUtil.so
Normal file
BIN
app/src/main/jniLibs/x86_64/libBleCommandUtil.so
Normal file
Binary file not shown.
|
@ -1244,175 +1244,8 @@
|
|||
<string name="preconditions">Preconditions:</string>
|
||||
|
||||
|
||||
<!-- Pump Abstract -->
|
||||
<string name="pump_operation_not_supported_by_pump_driver">Operation not supported by pump and/or driver.</string>
|
||||
<string name="pump_operation_not_yet_supported_by_pump">Operation not YET supported by pump.</string>
|
||||
|
||||
<!-- Medtronic (MDT) - Base -->
|
||||
<string name="medtronic_name" translatable="false">Medtronic</string>
|
||||
<string name="medtronic_name_short" translatable="false">MDT</string>
|
||||
<string name="description_pump_medtronic">Pump integration for Medtronic, requires RileyLink device and specific Pump Model</string>
|
||||
|
||||
<!-- MDT Configuration -->
|
||||
<string name="key_medtronic_serial" translatable="false">pref_medtronic_serial</string>
|
||||
<string name="key_medtronic_pump_type" translatable="false">pref_medtronic_pump_type</string>
|
||||
<string name="key_medtronic_frequency" translatable="false">pref_medtronic_frequency</string>
|
||||
<string name="key_medtronic_max_bolus" translatable="false">pref_medtronic_max_bolus</string>
|
||||
<string name="key_medtronic_max_basal" translatable="false">pref_medtronic_max_basal</string>
|
||||
<string name="key_medtronic_bolus_delay" translatable="false">pref_medtronic_bolus_delay</string>
|
||||
<string name="key_medtronic_encoding" translatable="false">pref_medtronic_encoding</string>
|
||||
<string name="key_medtronic_battery_type" translatable="false">pref_medtronic_battery_type</string>
|
||||
<string name="key_medtronic_bolus_debug" translatable="false">pref_medtronic_bolus_debug</string>
|
||||
<string name="key_rileylink_mac_address" translatable="false">pref_rileylink_mac_address</string>
|
||||
<string name="key_medtronic_pump_frequency_us_ca" translatable="false">medtronic_pump_frequency_us_ca</string>
|
||||
<string name="key_medtronic_pump_frequency_worldwide" translatable="false">medtronic_pump_frequency_worldwide</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_battery_no" translatable="false">medtronic_pump_battery_no</string>
|
||||
<string name="key_medtronic_pump_battery_alkaline" translatable="false">medtronic_pump_battery_alkaline</string>
|
||||
<string name="key_medtronic_pump_battery_lithium" translatable="false">medtronic_pump_battery_lithium</string>
|
||||
<string name="key_medtronic_pump_battery_nizn" translatable="false">medtronic_pump_battery_nizn</string>
|
||||
<string name="key_medtronic_pump_battery_nimh" translatable="false">medtronic_pump_battery_nimh</string>
|
||||
|
||||
<string name="medtronic_serial_number">Pump Serial Number</string>
|
||||
<string name="medtronic_pump_type">Pump Type</string>
|
||||
<string name="medtronic_pump_frequency">Pump Frequency</string>
|
||||
<string name="medtronic_pump_bolus_delay">Delay before Bolus is started (s)</string>
|
||||
<string name="medtronic_pump_max_bolus">Max Bolus on Pump (U)</string>
|
||||
<string name="medtronic_pump_max_basal">Max Basal on Pump (U/h)</string>
|
||||
<string name="medtronic_pump_encoding">Medtronic Encoding</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="medtronic_pump_encoding_4b6b_local">Software 4b6b Encoding</string>
|
||||
<string name="medtronic_pump_encoding_4b6b_rileylink">Hardware 4b6b Encoding</string>
|
||||
<string name="medtronic_custom_action_wake_and_tune">Wake and Tune Up</string>
|
||||
<string name="medtronic_custom_action_clear_bolus_block">Clear Bolus Block</string>
|
||||
<string name="medtronic_custom_action_reset_rileylink">Reset RileyLink Config</string>
|
||||
<string name="medtronic_pump_battery_select">Battery Type (Power View)</string>
|
||||
<string name="medtronic_pump_battery_no">Not selected (Simple view)</string>
|
||||
<string name="medtronic_pump_battery_alkaline">Alkaline (Extended view)</string>
|
||||
<string name="medtronic_pump_battery_lithium">Lithium (Extended view)</string>
|
||||
<string name="medtronic_pump_battery_nizn">NiZn (Extended view)</string>
|
||||
<string name="medtronic_pump_battery_nimh">NiMH (Extended view)</string>
|
||||
<string name="medtronic_bolus_debugging">Bolus/Treatments Debugging</string>
|
||||
|
||||
<!-- RL BLE Scanning -->
|
||||
<string name="rileylink_scanner_scan_scan">SCAN</string>
|
||||
<string name="rileylink_scanner_scan_stop">STOP</string>
|
||||
<string name="rileylink_scanner_selected_device">Selected</string>
|
||||
<string name="rileylink_scanner_title">RileyLink Scan</string>
|
||||
<string name="location_yes">Enable</string>
|
||||
<string name="location_no">No</string>
|
||||
<string name="rileylink_scanner_scanning">Scanning</string>
|
||||
<string name="rileylink_scanner_scanning_finished">Scanning finished</string>
|
||||
<string name="rileylink_scanner_scanning_error">Scanning error: %1$d</string>
|
||||
<string name="common_never">Never</string>
|
||||
|
||||
<!-- RL Status Page -->
|
||||
<string name="rileylink_settings_tab1">Settings</string>
|
||||
<string name="rileylink_settings_tab2">History</string>
|
||||
<string name="rileylink_status">RileyLink Status</string>
|
||||
<string name="medtronic_pump_status">Pump Status</string>
|
||||
<string name="title_activity_rileylink_settings">RileyLink Settings</string>
|
||||
<string name="rileylink_title">RileyLink</string>
|
||||
<string name="rileylink_configured_address">Configured Address</string>
|
||||
<string name="rileylink_connected_device">Connected Device</string>
|
||||
<string name="rileylink_connection_status">Connection Status</string>
|
||||
<string name="rileylink_connection_error">Connection Error</string>
|
||||
<string name="rileylink_device">Device</string>
|
||||
<string name="rileylink_device_type">Device Type</string>
|
||||
<string name="rileylink_device_model">Device Model</string>
|
||||
<string name="rileylink_last_used_frequency">Last used frequency</string>
|
||||
<string name="rileylink_last_device_contact">Last device contact</string>
|
||||
<string name="rileylink_firmware_version">RL Firmware</string>
|
||||
|
||||
|
||||
<!-- RL State -->
|
||||
<string name="rileylink_state_bt_init">Bluetooth Initializing…</string>
|
||||
<string name="rileylink_state_bt_error">Bluetooth Error</string>
|
||||
<string name="rileylink_state_bt_ready">Bluetooth Ready</string>
|
||||
<string name="rileylink_state_not_started">Not Started</string>
|
||||
<string name="rileylink_state_rl_init">RileyLink Initialization…</string>
|
||||
<string name="rileylink_state_rl_error">RileyLink Error</string>
|
||||
<string name="rileylink_state_pc_tune_up">Tuning up RileyLink and Pump</string>
|
||||
<string name="rileylink_state_pc_error">Problem connecting to Pump</string>
|
||||
<string name="rileylink_state_connected">Connected</string>
|
||||
|
||||
<!-- RL Errors -->
|
||||
<string name="rileylink_error_not_rl">Device is not RileyLink</string>
|
||||
<string name="rileylink_error_unreachable">RileyLink unreachable</string>
|
||||
<string name="rileylink_error_bt_disabled">Bluetooth disabled</string>
|
||||
<string name="rileylink_error_no_bt_adapter">No Bluetooth Adapter</string>
|
||||
<string name="rileylink_error_tuneup_failed">TuneUp Failed</string>
|
||||
<string name="rileylink_error_pump_unreachable">Pump unreachable</string>
|
||||
<string name="rileylink_error_pod_unreachable">Pod unreachable</string>
|
||||
|
||||
<!-- RL Target Device -->
|
||||
<string name="rileylink_target_device_medtronic">Medtronic Pump</string>
|
||||
<string name="rileylink_target_device_omnipod">Omnipod</string>
|
||||
|
||||
|
||||
<!-- MDT Errors -->
|
||||
<string name="medtronic_errors">Errors</string>
|
||||
<string name="medtronic_error_serial_not_set">Serial # not set.</string>
|
||||
<string name="medtronic_error_serial_invalid">Serial # invalid.</string>
|
||||
<string name="medtronic_error_pump_type_not_set">Pump Type not set.</string>
|
||||
<string name="medtronic_error_pump_type_invalid">Pump Type unsupported.</string>
|
||||
<string name="medtronic_error_pump_frequency_not_set">Pump Frequency not set.</string>
|
||||
<string name="medtronic_error_pump_frequency_invalid">Pump Frequency unsupported.</string>
|
||||
<string name="medtronic_error_rileylink_address_invalid">RileyLink Address invalid.</string>
|
||||
<string name="medtronic_error_pump_type_set_differs_from_detected">Pump type detected is not the same as configured type.</string>
|
||||
|
||||
<string name="medtronic_error_pump_basal_profiles_not_enabled">Basal profiles/patterns setting is not enabled on pump. Enable it on the pump.</string>
|
||||
<string name="medtronic_error_pump_incorrect_basal_profile_selected">Basal profile set on pump is incorrect (must be STD).</string>
|
||||
<string name="medtronic_error_pump_wrong_tbr_type_set">Wrong TBR type set on pump (must be Absolute).</string>
|
||||
<string name="medtronic_error_pump_wrong_max_bolus_set">Wrong Max Bolus set on Pump (must be %1$.2f).</string>
|
||||
<string name="medtronic_error_pump_wrong_max_basal_set">Wrong Max Basal set on Pump (must be %1$.2f).</string>
|
||||
<string name="medtronic_error_operation_not_possible_no_configuration">Operation is not possible.\n\n You need to configure Medtronic Pump first, before you can use this operation.</string>
|
||||
<string name="medtronic_error_pump_24h_time_change_requested">Over 24h Time change was requested.</string>
|
||||
|
||||
<!-- MDT History -->
|
||||
<string name="medtronic_history_group_basal">Basals</string>
|
||||
<string name="medtronic_history_group_configuration">Configurations</string>
|
||||
<string name="medtronic_history_group_notification">Notifications</string>
|
||||
<string name="medtronic_history_group_statistic">Statistics</string>
|
||||
<string name="medtronic_history_group_unknown">Unknowns</string>
|
||||
<string name="medtronic_history_group_all">All</string>
|
||||
<string name="medtronic_pump_history">Medtronic Pump History</string>
|
||||
|
||||
|
||||
<!-- MDT Pump Status -->
|
||||
<string name="medtronic_pump_status_never_contacted">Never contacted</string>
|
||||
<string name="medtronic_pump_status_waking_up">Waking up</string>
|
||||
<string name="medtronic_pump_status_error_comm">Error with communication</string>
|
||||
<string name="medtronic_pump_status_timeout_comm">Timeout on communication</string>
|
||||
<string name="medtronic_pump_status_pump_unreachable">Pump unreachable</string>
|
||||
<string name="medtronic_pump_status_invalid_config">Invalid configuration</string>
|
||||
<string name="medtronic_pump_status_active">Active</string>
|
||||
<string name="medtronic_pump_status_sleeping">Sleeping</string>
|
||||
|
||||
<!-- <string name="medtronic_cmd_profile_not_set">Remote Basal profile setting is not supported. Please modify Basal profile on your pump manually.</string> -->
|
||||
<string name="medtronic_cmd_cancel_bolus_not_supported">You cancelled Bolus, after it was already set on Pump. Since Medtronic Pump doesn\'t support cancel, you will need to manually cancel it. Put the Pump into Suspend mode and then do Resume (if you still want to cancel). Application will pick up changes, on next update (in less than 5 minutes).</string>
|
||||
<string name="medtronic_cmd_cant_read_tbr">Could not read current TBR.</string>
|
||||
<string name="medtronic_cmd_cant_cancel_tbr_stop_op">Could not cancel current TBR. Stopping operation.</string>
|
||||
<string name="medtronic_cmd_set_profile_pattern_overflow">Profile set failed, because following patterns, have too big basal rate: %1$s</string>
|
||||
<string name="medtronic_cmd_bolus_could_not_be_delivered">Bolus could not be delivered.</string>
|
||||
<string name="medtronic_cmd_bolus_could_not_be_delivered_no_insulin">Bolus could not be delivered, because available insulin amount (%1$.2f) is less than bolus required (%2$.2f).</string>
|
||||
<string name="medtronic_cmd_tbr_could_not_be_delivered">TBR could not be set.</string>
|
||||
<string name="medtronic_cmd_cant_cancel_tbr">Could not cancel current TBR.</string>
|
||||
<string name="medtronic_cmd_basal_profile_could_not_be_set">Basal profile could not be set.</string>
|
||||
<string name="medtronic_cmd_basal_profile_not_set_is_same">Basal profile is the same, so it will not be set again.</string>
|
||||
|
||||
<string name="medtronic_cmd_desc_get_history">Get History - Page %1$d (%2$d/16)</string>
|
||||
<string name="medtronic_cmd_desc_get_history_request">Get History - Page %1$d</string>
|
||||
<string name="medtronic_cmd_desc_get_time">Get Pump Time</string>
|
||||
<string name="medtronic_cmd_desc_get_settings">Get Settings</string>
|
||||
<string name="medtronic_cmd_desc_get_model">Get Pump Model</string>
|
||||
<string name="medtronic_cmd_desc_get_basal_profile">Get Basal Profile</string>
|
||||
<string name="medtronic_cmd_desc_set_basal_profile">Set Basal Profile</string>
|
||||
<string name="medtronic_cmd_desc_get_tbr">Get Temporary Basal</string>
|
||||
<string name="medtronic_cmd_desc_set_tbr">Set Temporary Basal</string>
|
||||
<string name="medtronic_cmd_desc_set_bolus">Set Bolus</string>
|
||||
<string name="profilename">Change profile to</string>
|
||||
<string name="changengetoprofilename">Change profile to %1$s</string>
|
||||
<string name="automation_trigger_pump_last_connection_label">Last connection to pump</string>
|
||||
|
@ -1568,6 +1401,17 @@
|
|||
<string name="skin">Skin</string>
|
||||
|
||||
|
||||
<!-- MDT Pump Status - removed when PodDeviceState is removed -->
|
||||
<string name="medtronic_pump_status_never_contacted">Never contacted</string>
|
||||
<string name="medtronic_pump_status_waking_up">Waking up</string>
|
||||
<string name="medtronic_pump_status_error_comm">Error with communication</string>
|
||||
<string name="medtronic_pump_status_timeout_comm">Timeout on communication</string>
|
||||
<string name="medtronic_pump_status_pump_unreachable">Pump unreachable</string>
|
||||
<string name="medtronic_pump_status_invalid_config">Invalid configuration</string>
|
||||
<string name="medtronic_pump_status_active">Active</string>
|
||||
<string name="medtronic_pump_status_sleeping">Sleeping</string>
|
||||
|
||||
|
||||
<!-- Omnipod -->
|
||||
|
||||
<!-- Omnipod - Base -->
|
||||
|
|
|
@ -6,8 +6,6 @@ import junit.framework.Assert;
|
|||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class DateTimeUtilUTest {
|
||||
|
||||
@Test
|
||||
|
|
|
@ -75,6 +75,9 @@ dependencies {
|
|||
implementation "com.j256.ormlite:ormlite-core:${ormLiteVersion}"
|
||||
implementation "com.j256.ormlite:ormlite-android:${ormLiteVersion}"
|
||||
|
||||
// pumpCommon
|
||||
implementation "com.google.code.gson:gson:2.8.6"
|
||||
|
||||
testImplementation 'junit:junit:4.13'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||
|
|
|
@ -17,5 +17,11 @@ interface DatabaseHelperInterface {
|
|||
fun deleteDbRequestbyMongoId(action: String, _id: String)
|
||||
fun getDbRequestInterator(): CloseableIterator<DbRequest>
|
||||
fun roundDateToSec(date: Long): Long
|
||||
fun createOrUpdateTDD(record: TDD)
|
||||
fun createOrUpdate(tempBasal: TemporaryBasal)
|
||||
fun findTempBasalByPumpId(id: Long) : TemporaryBasal
|
||||
fun getTemporaryBasalsDataFromTime(mills: Long, ascending: Boolean) : List<TemporaryBasal>
|
||||
fun getCareportalEventFromTimestamp(timestamp: Long): CareportalEvent
|
||||
fun getTDDsForLastXDays(days: Int): List<TDD>
|
||||
fun getProfileSwitchData(from: Long, ascending: Boolean): List<ProfileSwitch>
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ import info.nightscout.androidaps.db.ProfileSwitch;
|
|||
import info.nightscout.androidaps.db.TempTarget;
|
||||
import info.nightscout.androidaps.db.TemporaryBasal;
|
||||
import info.nightscout.androidaps.db.Treatment;
|
||||
import info.nightscout.androidaps.plugins.treatments.TreatmentUpdateReturn;
|
||||
|
||||
/**
|
||||
* Created by mike on 14.06.2016.
|
||||
|
@ -84,4 +85,6 @@ public interface TreatmentsInterface {
|
|||
|
||||
long oldestDataAvailable();
|
||||
|
||||
TreatmentUpdateReturn createOrUpdateMedtronic(Treatment treatment, boolean fromNightScout);
|
||||
|
||||
}
|
|
@ -13,8 +13,7 @@ import org.json.JSONObject;
|
|||
import java.util.Date;
|
||||
|
||||
import dagger.android.HasAndroidInjector;
|
||||
import info.nightscout.androidaps.BuildConfig;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.core.R;
|
||||
import info.nightscout.androidaps.data.DetailedBolusInfo;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
import info.nightscout.androidaps.data.PumpEnactResult;
|
||||
|
@ -37,7 +36,6 @@ import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewB
|
|||
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.PumpType;
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.data.MedtronicHistoryData;
|
||||
import info.nightscout.androidaps.db.Treatment;
|
||||
import info.nightscout.androidaps.utils.DateUtil;
|
||||
import info.nightscout.androidaps.utils.DecimalFormatter;
|
||||
|
@ -118,7 +116,7 @@ public abstract class PumpPluginAbstract extends PumpPluginBase implements PumpI
|
|||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
// TODO: moved from constructor .... test if it works
|
||||
|
||||
initPumpStatusData();
|
||||
|
||||
Intent intent = new Intent(context, getServiceClass());
|
||||
|
@ -418,8 +416,8 @@ public abstract class PumpPluginAbstract extends PumpPluginBase implements PumpI
|
|||
// bolus needed, ask pump to deliver it
|
||||
return deliverBolus(detailedBolusInfo);
|
||||
} else {
|
||||
if (MedtronicHistoryData.doubleBolusDebug)
|
||||
aapsLogger.debug("DoubleBolusDebug: deliverTreatment::(carb only entry)");
|
||||
//if (MedtronicHistoryData.doubleBolusDebug)
|
||||
// aapsLogger.debug("DoubleBolusDebug: deliverTreatment::(carb only entry)");
|
||||
|
||||
// no bolus required, carb only treatment
|
||||
activePlugin.getActiveTreatments().addToHistoryTreatment(detailedBolusInfo, true);
|
||||
|
@ -433,7 +431,7 @@ public abstract class PumpPluginAbstract extends PumpPluginBase implements PumpI
|
|||
aapsLogger.debug(LTag.PUMP, "deliverTreatment: Carb only treatment.");
|
||||
|
||||
return new PumpEnactResult(getInjector()).success(true).enacted(true).bolusDelivered(0d)
|
||||
.carbsDelivered(detailedBolusInfo.carbs).comment(getResourceHelper().gs(R.string.virtualpump_resultok));
|
||||
.carbsDelivered(detailedBolusInfo.carbs).comment(getResourceHelper().gs(R.string.common_resultok));
|
||||
}
|
||||
} finally {
|
||||
triggerUIChange();
|
|
@ -49,7 +49,7 @@ public abstract class PumpStatus {
|
|||
public int tempBasalRatio = 0;
|
||||
public int tempBasalRemainMin = 0;
|
||||
public Date tempBasalStart;
|
||||
private PumpType pumpType;
|
||||
public PumpType pumpType;
|
||||
//protected PumpDescription pumpDescription;
|
||||
|
||||
|
||||
|
@ -69,9 +69,20 @@ public abstract class PumpStatus {
|
|||
this.lastConnection = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
|
||||
public void setLastFailedCommunicationToNow() {
|
||||
this.lastErrorConnection = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
|
||||
public abstract String getErrorInfo();
|
||||
|
||||
|
||||
public abstract <E> E getCustomData(String key, Class<E> clazz);
|
||||
|
||||
public String getCustomDataAsString(String key) {
|
||||
return getCustomData(key, String.class);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -2,11 +2,6 @@ package info.nightscout.androidaps.plugins.pump.common.data;
|
|||
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
|
||||
public class TempBasalPair {
|
||||
|
||||
@Expose
|
|
@ -0,0 +1,29 @@
|
|||
package info.nightscout.androidaps.plugins.pump.common.defs;
|
||||
|
||||
import info.nightscout.androidaps.core.R;
|
||||
|
||||
/**
|
||||
* Created by andy on 6/11/18.
|
||||
*/
|
||||
public enum PumpDeviceState {
|
||||
|
||||
NeverContacted(R.string.pump_status_never_contacted), //
|
||||
Sleeping(R.string.pump_status_sleeping), //
|
||||
WakingUp(R.string.pump_status_waking_up), //
|
||||
Active(R.string.pump_status_active), //
|
||||
ErrorWhenCommunicating(R.string.pump_status_error_comm), //
|
||||
TimeoutWhenCommunicating(R.string.pump_status_timeout_comm), //
|
||||
// ProblemContacting(R.string.medtronic_pump_status_problem_contacting), //
|
||||
PumpUnreachable(R.string.pump_status_pump_unreachable), //
|
||||
InvalidConfiguration(R.string.pump_status_invalid_config);
|
||||
|
||||
Integer resourceId;
|
||||
|
||||
PumpDeviceState(int resourceId) {
|
||||
this.resourceId = resourceId;
|
||||
}
|
||||
|
||||
public Integer getResourceId() {
|
||||
return resourceId;
|
||||
}
|
||||
}
|
|
@ -3,7 +3,8 @@ package info.nightscout.androidaps.plugins.pump.common.defs;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import info.nightscout.androidaps.R;
|
||||
|
||||
import info.nightscout.androidaps.core.R;
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
||||
|
||||
|
||||
|
@ -16,16 +17,16 @@ import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
|||
|
||||
public enum PumpHistoryEntryGroup {
|
||||
|
||||
All(R.string.medtronic_history_group_all),
|
||||
Bolus(R.string.danar_history_bolus),
|
||||
Basal(R.string.medtronic_history_group_basal),
|
||||
Prime(R.string.danar_history_prime),
|
||||
Configuration(R.string.medtronic_history_group_configuration),
|
||||
Alarm(R.string.danar_history_alarm),
|
||||
Glucose(R.string.danar_history_glucose),
|
||||
Notification(R.string.medtronic_history_group_notification),
|
||||
Statistic(R.string.medtronic_history_group_statistic),
|
||||
Unknown(R.string.medtronic_history_group_unknown),
|
||||
All(R.string.history_group_all),
|
||||
Bolus(R.string.history_group_bolus),
|
||||
Basal(R.string.history_group_basal),
|
||||
Prime(R.string.history_group_prime),
|
||||
Configuration(R.string.history_group_configuration),
|
||||
Alarm(R.string.history_group_alarm),
|
||||
Glucose(R.string.history_group_glucose),
|
||||
Notification(R.string.history_group_notification),
|
||||
Statistic(R.string.history_group_statistic),
|
||||
Unknown(R.string.history_group_unknown),
|
||||
;
|
||||
|
||||
private int resourceId;
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.pump.medtronic.events
|
||||
package info.nightscout.androidaps.plugins.pump.common.events
|
||||
|
||||
import info.nightscout.androidaps.events.Event
|
||||
|
|
@ -6,15 +6,10 @@ package info.nightscout.androidaps.plugins.pump.common.utils;
|
|||
|
||||
import org.joda.time.LocalDateTime;
|
||||
import org.joda.time.Minutes;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.GregorianCalendar;
|
||||
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.logging.StacktraceLoggerWrapper;
|
||||
|
||||
/**
|
||||
* This is simple version of ATechDate, limited only to one format (yyyymmddHHMIss)
|
||||
*/
|
||||
|
@ -26,7 +21,6 @@ public class DateTimeUtil {
|
|||
* @param atechDateTime
|
||||
* @return
|
||||
*/
|
||||
@Deprecated // use joda instead
|
||||
public static LocalDateTime toLocalDateTime(long atechDateTime) {
|
||||
int year = (int) (atechDateTime / 10000000000L);
|
||||
atechDateTime -= year * 10000000000L;
|
||||
|
@ -61,7 +55,6 @@ public class DateTimeUtil {
|
|||
* @param atechDateTime
|
||||
* @return
|
||||
*/
|
||||
@Deprecated // use joda instead
|
||||
public static GregorianCalendar toGregorianCalendar(long atechDateTime) {
|
||||
int year = (int) (atechDateTime / 10000000000L);
|
||||
atechDateTime -= year * 10000000000L;
|
|
@ -0,0 +1,27 @@
|
|||
package info.nightscout.androidaps.plugins.treatments;
|
||||
|
||||
import info.nightscout.androidaps.db.Treatment;
|
||||
|
||||
public class TreatmentUpdateReturn {
|
||||
|
||||
public TreatmentUpdateReturn(boolean success, boolean newRecord) {
|
||||
this.success = success;
|
||||
this.newRecord = newRecord;
|
||||
}
|
||||
|
||||
boolean newRecord;
|
||||
boolean success;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UpdateReturn [" +
|
||||
"newRecord=" + newRecord +
|
||||
", success=" + success +
|
||||
']';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -222,4 +222,57 @@
|
|||
<string name="timedetection">Time detection</string>
|
||||
<string name="format_hour_minute">%1$dh %2$dm</string>
|
||||
|
||||
<!-- PumoCommon - Pump Abstract -->
|
||||
<string name="pump_operation_not_supported_by_pump_driver">Operation not supported by pump and/or driver.</string>
|
||||
<string name="pump_operation_not_yet_supported_by_pump">Operation not YET supported by pump.</string>
|
||||
<string name="common_resultok">OK</string>
|
||||
|
||||
<!-- PumoCommon - Pump Status -->
|
||||
<string name="pump_status_never_contacted">Never contacted</string>
|
||||
<string name="pump_status_waking_up">Waking up</string>
|
||||
<string name="pump_status_error_comm">Error with communication</string>
|
||||
<string name="pump_status_timeout_comm">Timeout on communication</string>
|
||||
<string name="pump_status_pump_unreachable">Pump unreachable</string>
|
||||
<string name="pump_status_invalid_config">Invalid configuration</string>
|
||||
<string name="pump_status_active">Active</string>
|
||||
<string name="pump_status_sleeping">Sleeping</string>
|
||||
|
||||
<!-- PumpCommon - History Group -->
|
||||
<string name="history_group_basal">Basals</string>
|
||||
<string name="history_group_configuration">Configurations</string>
|
||||
<string name="history_group_notification">Notifications</string>
|
||||
<string name="history_group_statistic">Statistics</string>
|
||||
<string name="history_group_unknown">Unknowns</string>
|
||||
<string name="history_group_all">All</string>
|
||||
<string name="history_group_bolus">Boluses</string>
|
||||
<string name="history_group_prime">Prime</string>
|
||||
<string name="history_group_alarm">Alarms</string>
|
||||
<string name="history_group_glucose">Glucose</string>
|
||||
|
||||
<!-- <string name="medtronic_pump_status_never_contacted">Never contacted</string>-->
|
||||
<!-- <string name="medtronic_pump_status_waking_up">Waking up</string>-->
|
||||
<!-- <string name="medtronic_pump_status_error_comm">Error with communication</string>-->
|
||||
<!-- <string name="medtronic_pump_status_timeout_comm">Timeout on communication</string>-->
|
||||
<!-- <string name="medtronic_pump_status_pump_unreachable">Pump unreachable</string>-->
|
||||
<!-- <string name="medtronic_pump_status_invalid_config">Invalid configuration</string>-->
|
||||
<!-- <string name="medtronic_pump_status_active">Active</string>-->
|
||||
<!-- <string name="medtronic_pump_status_sleeping">Sleeping</string>-->
|
||||
|
||||
<!-- <string name="danar_history_alarm">Alarms</string>-->
|
||||
<!-- <string name="danar_history_glucose">Glucose</string>-->
|
||||
|
||||
|
||||
<!-- All(R.string.medtronic_history_group_all), //-->
|
||||
<!-- Bolus(R.string.danar_history_bolus), //-->
|
||||
<!-- Basal(R.string.medtronic_history_group_basal), //-->
|
||||
<!-- Prime(R.string.danar_history_prime), //-->
|
||||
<!-- Configuration(R.string.medtronic_history_group_configuration), //-->
|
||||
<!-- Alarm(R.string.danar_history_alarm), //-->
|
||||
<!-- Glucose(R.string.danar_history_glucose), //-->
|
||||
<!-- Notification(R.string.medtronic_history_group_notification), //-->
|
||||
<!-- Statistic(R.string.medtronic_history_group_statistic),-->
|
||||
<!-- Unknown(R.string.medtronic_history_group_unknown), //-->
|
||||
|
||||
|
||||
|
||||
</resources>
|
1
medtronic/.gitignore
vendored
Normal file
1
medtronic/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/build
|
83
medtronic/build.gradle
Normal file
83
medtronic/build.gradle
Normal file
|
@ -0,0 +1,83 @@
|
|||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
apply plugin: 'kotlin-kapt'
|
||||
|
||||
android {
|
||||
compileSdkVersion 28
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 24
|
||||
targetSdkVersion 28
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles 'consumer-rules.pro'
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = '1.8'
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
debug {
|
||||
testCoverageEnabled(project.hasProperty('coverage'))
|
||||
}
|
||||
firebaseDisable {
|
||||
System.setProperty("disableFirebase", "true")
|
||||
ext.enableCrashlytics = false
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(':core')
|
||||
implementation project(':rileylink')
|
||||
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
||||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion"
|
||||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion"
|
||||
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
|
||||
implementation 'androidx.core:core-ktx:1.2.0'
|
||||
implementation "androidx.preference:preference-ktx:1.1.1"
|
||||
implementation "androidx.activity:activity-ktx:${activityVersion}"
|
||||
implementation 'com.google.android.material:material:1.1.0'
|
||||
|
||||
implementation "io.reactivex.rxjava2:rxandroid:${rxandroid_version}"
|
||||
|
||||
// Graphview cannot be upgraded
|
||||
implementation "com.jjoe64:graphview:4.0.1"
|
||||
|
||||
implementation "com.joanzapata.iconify:android-iconify-fontawesome:2.2.2"
|
||||
|
||||
// medtronic - start
|
||||
implementation 'org.apache.commons:commons-lang3:3.10'
|
||||
implementation 'net.danlew:android.joda:2.10.6'
|
||||
implementation 'org.slf4j:slf4j-api:1.7.30'
|
||||
implementation "com.google.code.gson:gson:2.8.6"
|
||||
// medtronic - end
|
||||
|
||||
implementation "com.google.dagger:dagger-android:$dagger_version"
|
||||
implementation "com.google.dagger:dagger-android-support:$dagger_version"
|
||||
annotationProcessor "com.google.dagger:dagger-compiler:$dagger_version"
|
||||
annotationProcessor "com.google.dagger:dagger-android-processor:$dagger_version"
|
||||
kapt "com.google.dagger:dagger-android-processor:$dagger_version"
|
||||
kapt "com.google.dagger:dagger-compiler:$dagger_version"
|
||||
|
||||
testImplementation 'junit:junit:4.13'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||
}
|
0
medtronic/consumer-rules.pro
Normal file
0
medtronic/consumer-rules.pro
Normal file
21
medtronic/proguard-rules.pro
vendored
Normal file
21
medtronic/proguard-rules.pro
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
|
@ -0,0 +1,27 @@
|
|||
package info.nightscout.androidaps.plugins.pump.medtronic;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
|
||||
assertEquals("info.nightscout.androidaps.plugins.pump.medtronic.test", appContext.getPackageName());
|
||||
}
|
||||
}
|
15
medtronic/src/main/AndroidManifest.xml
Normal file
15
medtronic/src/main/AndroidManifest.xml
Normal file
|
@ -0,0 +1,15 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="info.nightscout.androidaps.plugins.pump.medtronic">
|
||||
|
||||
<application>
|
||||
<service
|
||||
android:name=".service.RileyLinkMedtronicService"
|
||||
android:enabled="true"
|
||||
android:exported="true" />
|
||||
|
||||
<activity android:name=".dialog.MedtronicHistoryActivity" />
|
||||
|
||||
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
|
||||
</application>
|
||||
|
||||
</manifest>
|
|
@ -8,8 +8,6 @@ import android.view.LayoutInflater
|
|||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import dagger.android.support.DaggerFragment
|
||||
import info.nightscout.androidaps.MainApp
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.events.EventExtendedBolusChange
|
||||
import info.nightscout.androidaps.events.EventPumpStatusChanged
|
||||
import info.nightscout.androidaps.events.EventTempBasalChange
|
||||
|
@ -18,20 +16,20 @@ import info.nightscout.androidaps.interfaces.CommandQueueProvider
|
|||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.defs.BatteryType
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicCommandType
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.dialog.MedtronicHistoryActivity
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus
|
||||
import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicPumpConfigurationChanged
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicPumpValuesChanged
|
||||
import info.nightscout.androidaps.plugins.pump.common.events.EventRefreshButtonState
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil
|
||||
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.dialog.RileyLinkStatusActivity
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkServiceData
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.defs.BatteryType
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicCommandType
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.defs.PumpDeviceState
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.dialog.MedtronicHistoryActivity
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicDeviceStatusChange
|
||||
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.EventRefreshButtonState
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil
|
||||
import info.nightscout.androidaps.queue.Callback
|
||||
import info.nightscout.androidaps.queue.events.EventQueueChanged
|
||||
|
@ -49,7 +47,6 @@ import javax.inject.Inject
|
|||
|
||||
class MedtronicFragment : DaggerFragment() {
|
||||
@Inject lateinit var aapsLogger: AAPSLogger
|
||||
@Inject lateinit var mainApp: MainApp
|
||||
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
||||
@Inject lateinit var resourceHelper: ResourceHelper
|
||||
@Inject lateinit var rxBus: RxBusWrapper
|
||||
|
@ -128,10 +125,10 @@ class MedtronicFragment : DaggerFragment() {
|
|||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe({ medtronic_refresh.isEnabled = it.newState }, { fabricPrivacy.logException(it) })
|
||||
disposable += rxBus
|
||||
.toObservable(EventMedtronicDeviceStatusChange::class.java)
|
||||
.toObservable(EventRileyLinkDeviceStatusChange::class.java)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe({
|
||||
aapsLogger.debug(LTag.PUMP, "onStatusEvent(EventMedtronicDeviceStatusChange): $it")
|
||||
aapsLogger.debug(LTag.PUMP, "onStatusEvent(EventRileyLinkDeviceStatusChange): $it")
|
||||
setDeviceStatus()
|
||||
}, { fabricPrivacy.logException(it) })
|
||||
disposable += rxBus
|
||||
|
@ -179,11 +176,11 @@ class MedtronicFragment : DaggerFragment() {
|
|||
val rileyLinkError = medtronicPumpPlugin.rileyLinkService?.error
|
||||
medtronic_rl_status.text =
|
||||
when {
|
||||
rileyLinkServiceData.rileyLinkServiceState == RileyLinkServiceState.NotStarted -> resourceHelper.gs(resourceId)
|
||||
rileyLinkServiceData.rileyLinkServiceState.isConnecting -> "{fa-bluetooth-b spin} " + resourceHelper.gs(resourceId)
|
||||
rileyLinkServiceData.rileyLinkServiceState.isError && rileyLinkError == null -> "{fa-bluetooth-b} " + resourceHelper.gs(resourceId)
|
||||
rileyLinkServiceData.rileyLinkServiceState.isError && rileyLinkError != null -> "{fa-bluetooth-b} " + resourceHelper.gs(rileyLinkError.getResourceId(RileyLinkTargetDevice.MedtronicPump))
|
||||
else -> "{fa-bluetooth-b} " + resourceHelper.gs(resourceId)
|
||||
rileyLinkServiceData.rileyLinkServiceState == RileyLinkServiceState.NotStarted -> resourceHelper.gs(resourceId)
|
||||
rileyLinkServiceData.rileyLinkServiceState.isConnecting -> "{fa-bluetooth-b spin} " + resourceHelper.gs(resourceId)
|
||||
rileyLinkServiceData.rileyLinkServiceState.isError && rileyLinkError == null -> "{fa-bluetooth-b} " + resourceHelper.gs(resourceId)
|
||||
rileyLinkServiceData.rileyLinkServiceState.isError && rileyLinkError != null -> "{fa-bluetooth-b} " + resourceHelper.gs(rileyLinkError.getResourceId(RileyLinkTargetDevice.MedtronicPump))
|
||||
else -> "{fa-bluetooth-b} " + resourceHelper.gs(resourceId)
|
||||
}
|
||||
medtronic_rl_status.setTextColor(if (rileyLinkError != null) Color.RED else Color.WHITE)
|
||||
|
||||
|
@ -221,7 +218,7 @@ class MedtronicFragment : DaggerFragment() {
|
|||
}
|
||||
}
|
||||
|
||||
else -> aapsLogger.warn(LTag.PUMP, "Unknown pump state: " + medtronicPumpStatus.pumpDeviceState)
|
||||
else -> aapsLogger.warn(LTag.PUMP, "Unknown pump state: " + medtronicPumpStatus.pumpDeviceState)
|
||||
}
|
||||
|
||||
val status = commandQueue.spannedStatus()
|
||||
|
@ -235,7 +232,7 @@ class MedtronicFragment : DaggerFragment() {
|
|||
|
||||
private fun displayNotConfiguredDialog() {
|
||||
context?.let {
|
||||
OKDialog.show(it, resourceHelper.gs(R.string.combo_warning),
|
||||
OKDialog.show(it, resourceHelper.gs(R.string.medtronic_warning),
|
||||
resourceHelper.gs(R.string.medtronic_error_operation_not_possible_no_configuration), null)
|
||||
}
|
||||
}
|
||||
|
@ -252,7 +249,7 @@ class MedtronicFragment : DaggerFragment() {
|
|||
val minAgo = DateUtil.minAgo(resourceHelper, medtronicPumpStatus.lastConnection)
|
||||
val min = (System.currentTimeMillis() - medtronicPumpStatus.lastConnection) / 1000 / 60
|
||||
if (medtronicPumpStatus.lastConnection + 60 * 1000 > System.currentTimeMillis()) {
|
||||
medtronic_lastconnection.setText(R.string.combo_pump_connected_now)
|
||||
medtronic_lastconnection.setText(R.string.medtronic_pump_connected_now)
|
||||
medtronic_lastconnection.setTextColor(Color.WHITE)
|
||||
} else if (medtronicPumpStatus.lastConnection + 30 * 60 * 1000 < System.currentTimeMillis()) {
|
||||
|
||||
|
@ -260,13 +257,13 @@ class MedtronicFragment : DaggerFragment() {
|
|||
medtronic_lastconnection.text = resourceHelper.gs(R.string.minago, min)
|
||||
} else if (min < 1440) {
|
||||
val h = (min / 60).toInt()
|
||||
medtronic_lastconnection.text = (resourceHelper.gq(R.plurals.objective_hours, h, h) + " "
|
||||
medtronic_lastconnection.text = (resourceHelper.gq(R.plurals.duration_hours, h, h) + " "
|
||||
+ resourceHelper.gs(R.string.ago))
|
||||
} else {
|
||||
val h = (min / 60).toInt()
|
||||
val d = h / 24
|
||||
// h = h - (d * 24);
|
||||
medtronic_lastconnection.text = (resourceHelper.gq(R.plurals.objective_days, d, d) + " "
|
||||
medtronic_lastconnection.text = (resourceHelper.gq(R.plurals.duration_days, d, d) + " "
|
||||
+ resourceHelper.gs(R.string.ago))
|
||||
}
|
||||
medtronic_lastconnection.setTextColor(Color.RED)
|
||||
|
@ -285,13 +282,13 @@ class MedtronicFragment : DaggerFragment() {
|
|||
val unit = resourceHelper.gs(R.string.insulin_unit_shortname)
|
||||
val ago: String
|
||||
if (agoMsc < 60 * 1000) {
|
||||
ago = resourceHelper.gs(R.string.combo_pump_connected_now)
|
||||
ago = resourceHelper.gs(R.string.medtronic_pump_connected_now)
|
||||
} else if (bolusMinAgo < 60) {
|
||||
ago = DateUtil.minAgo(resourceHelper, medtronicPumpStatus.lastBolusTime.time)
|
||||
} else {
|
||||
ago = DateUtil.hourAgo(medtronicPumpStatus.lastBolusTime.time, resourceHelper)
|
||||
}
|
||||
medtronic_lastbolus.text = resourceHelper.gs(R.string.combo_last_bolus, bolus, unit, ago)
|
||||
medtronic_lastbolus.text = resourceHelper.gs(R.string.mdt_last_bolus, bolus, unit, ago)
|
||||
} else {
|
||||
medtronic_lastbolus.text = ""
|
||||
}
|
|
@ -30,13 +30,13 @@ import javax.inject.Inject;
|
|||
import javax.inject.Singleton;
|
||||
|
||||
import dagger.android.HasAndroidInjector;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.activities.ErrorHelperActivity;
|
||||
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.ActivePluginProvider;
|
||||
import info.nightscout.androidaps.interfaces.CommandQueueProvider;
|
||||
|
@ -79,8 +79,9 @@ import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicNotificat
|
|||
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicStatusRefreshType;
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicUIResponseType;
|
||||
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.EventMedtronicPumpValuesChanged;
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.events.EventRefreshButtonState;
|
||||
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.util.MedtronicConst;
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil;
|
||||
|
@ -173,6 +174,7 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
|
|||
aapsLogger.debug(LTag.PUMP, "RileyLinkMedtronicService is connected");
|
||||
RileyLinkMedtronicService.LocalBinder mLocalBinder = (RileyLinkMedtronicService.LocalBinder) service;
|
||||
rileyLinkMedtronicService = mLocalBinder.getServiceInstance();
|
||||
rileyLinkMedtronicService.verifyConfiguration();
|
||||
|
||||
new Thread(() -> {
|
||||
|
||||
|
@ -216,7 +218,7 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
|
|||
medtronicPumpStatus.lastDataTime = medtronicPumpStatus.lastConnection;
|
||||
medtronicPumpStatus.previousConnection = medtronicPumpStatus.lastConnection;
|
||||
|
||||
if (rileyLinkMedtronicService != null) rileyLinkMedtronicService.verifyConfiguration();
|
||||
//if (rileyLinkMedtronicService != null) rileyLinkMedtronicService.verifyConfiguration();
|
||||
|
||||
aapsLogger.debug(LTag.PUMP, "initPumpStatusData: " + this.medtronicPumpStatus);
|
||||
|
||||
|
@ -242,10 +244,16 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override public void doTuneUpDevice() {
|
||||
@Override
|
||||
public void doTuneUpDevice() {
|
||||
rileyLinkMedtronicService.doTuneUpDevice();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void triggerPumpConfigurationChangedEvent() {
|
||||
rxBus.send(new EventMedtronicPumpConfigurationChanged());
|
||||
}
|
||||
|
||||
private void migrateSettings() {
|
||||
|
||||
if ("US (916 MHz)".equals(sp.getString(MedtronicConst.Prefs.PumpFrequency, "US (916 MHz)"))) {
|
||||
|
@ -764,7 +772,7 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
|
|||
|
||||
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);
|
||||
|
||||
|
@ -774,13 +782,13 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
|
|||
}
|
||||
} else {
|
||||
if ((clock.localDeviceTime.getYear() > 2015)) {
|
||||
aapsLogger.error("MedtronicPumpPlugin::checkTimeAndOptionallySetTime - Time difference over 24h requested [diff={}]. Doing nothing." + timeDiff);
|
||||
aapsLogger.error("MedtronicPumpPlugin::checkTimeAndOptionallySetTime - Time difference over 24h requested [diff={} s]. Doing nothing.", timeDiff);
|
||||
medtronicUtil.sendNotification(MedtronicNotificationType.TimeChangeOver24h, getResourceHelper(), rxBus);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
aapsLogger.info(LTag.PUMP, "MedtronicPumpPlugin::checkTimeAndOptionallySetTime - Time difference is {} s. Do nothing." + timeDiff);
|
||||
aapsLogger.info(LTag.PUMP, "MedtronicPumpPlugin::checkTimeAndOptionallySetTime - Time difference is {} s. Do nothing.", timeDiff);
|
||||
}
|
||||
|
||||
scheduleNextRefresh(MedtronicStatusRefreshType.PumpTime, 0);
|
||||
|
@ -860,7 +868,7 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
|
|||
Intent i = new Intent(context, ErrorHelperActivity.class);
|
||||
i.putExtra("soundid", R.raw.boluserror);
|
||||
i.putExtra("status", getResourceHelper().gs(R.string.medtronic_cmd_cancel_bolus_not_supported));
|
||||
i.putExtra("title", getResourceHelper().gs(R.string.combo_warning));
|
||||
i.putExtra("title", getResourceHelper().gs(R.string.medtronic_warning));
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(i);
|
||||
|
||||
|
@ -1126,11 +1134,14 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
|
|||
|
||||
private void readPumpHistoryLogic() {
|
||||
|
||||
boolean debugHistory = false;
|
||||
|
||||
LocalDateTime targetDate = null;
|
||||
|
||||
if (lastPumpHistoryEntry == null) {
|
||||
|
||||
aapsLogger.debug(LTag.PUMP, getLogPrefix() + "readPumpHistoryLogic(): lastPumpHistoryEntry: null");
|
||||
if (debugHistory)
|
||||
aapsLogger.debug(LTag.PUMP, getLogPrefix() + "readPumpHistoryLogic(): lastPumpHistoryEntry: null");
|
||||
|
||||
Long lastPumpHistoryEntryTime = getLastPumpEntryTime();
|
||||
|
||||
|
@ -1139,13 +1150,15 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
|
|||
medtronicHistoryData.setIsInInit(true);
|
||||
|
||||
if (lastPumpHistoryEntryTime == 0L) {
|
||||
aapsLogger.debug(LTag.PUMP, getLogPrefix() + "readPumpHistoryLogic(): lastPumpHistoryEntryTime: 0L - targetDate: "
|
||||
+ targetDate);
|
||||
if (debugHistory)
|
||||
aapsLogger.debug(LTag.PUMP, getLogPrefix() + "readPumpHistoryLogic(): lastPumpHistoryEntryTime: 0L - targetDate: "
|
||||
+ targetDate);
|
||||
targetDate = timeMinus36h;
|
||||
} else {
|
||||
// LocalDateTime lastHistoryRecordTime = DateTimeUtil.toLocalDateTime(lastPumpHistoryEntryTime);
|
||||
|
||||
aapsLogger.debug(LTag.PUMP, getLogPrefix() + "readPumpHistoryLogic(): lastPumpHistoryEntryTime: " + lastPumpHistoryEntryTime + " - targetDate: " + targetDate);
|
||||
if (debugHistory)
|
||||
aapsLogger.debug(LTag.PUMP, getLogPrefix() + "readPumpHistoryLogic(): lastPumpHistoryEntryTime: " + lastPumpHistoryEntryTime + " - targetDate: " + targetDate);
|
||||
|
||||
medtronicHistoryData.setLastHistoryRecordTime(lastPumpHistoryEntryTime);
|
||||
|
||||
|
@ -1161,30 +1174,35 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
|
|||
|
||||
targetDate = (timeMinus36h.isAfter(lastHistoryRecordTime) ? timeMinus36h : lastHistoryRecordTime);
|
||||
|
||||
aapsLogger.debug(LTag.PUMP, getLogPrefix() + "readPumpHistoryLogic(): targetDate: " + targetDate);
|
||||
if (debugHistory)
|
||||
aapsLogger.debug(LTag.PUMP, getLogPrefix() + "readPumpHistoryLogic(): targetDate: " + targetDate);
|
||||
}
|
||||
} else {
|
||||
aapsLogger.debug(LTag.PUMP, getLogPrefix() + "readPumpHistoryLogic(): lastPumpHistoryEntry: not null - " + medtronicUtil.gsonInstance.toJson(lastPumpHistoryEntry));
|
||||
if (debugHistory)
|
||||
aapsLogger.debug(LTag.PUMP, getLogPrefix() + "readPumpHistoryLogic(): lastPumpHistoryEntry: not null - " + medtronicUtil.gsonInstance.toJson(lastPumpHistoryEntry));
|
||||
medtronicHistoryData.setIsInInit(false);
|
||||
// medtronicHistoryData.setLastHistoryRecordTime(lastPumpHistoryEntry.atechDateTime);
|
||||
|
||||
// targetDate = lastPumpHistoryEntry.atechDateTime;
|
||||
}
|
||||
|
||||
aapsLogger.debug(LTag.PUMP, "HST: Target Date: " + targetDate);
|
||||
//aapsLogger.debug(LTag.PUMP, "HST: Target Date: " + targetDate);
|
||||
|
||||
MedtronicUITask responseTask2 = rileyLinkMedtronicService.getMedtronicUIComm().executeCommand(MedtronicCommandType.GetHistoryData,
|
||||
lastPumpHistoryEntry, targetDate);
|
||||
|
||||
aapsLogger.debug(LTag.PUMP, "HST: After task");
|
||||
if (debugHistory)
|
||||
aapsLogger.debug(LTag.PUMP, "HST: After task");
|
||||
|
||||
PumpHistoryResult historyResult = (PumpHistoryResult) responseTask2.returnData;
|
||||
|
||||
aapsLogger.debug(LTag.PUMP, "HST: History Result: " + historyResult.toString());
|
||||
if (debugHistory)
|
||||
aapsLogger.debug(LTag.PUMP, "HST: History Result: " + historyResult.toString());
|
||||
|
||||
PumpHistoryEntry latestEntry = historyResult.getLatestEntry();
|
||||
|
||||
aapsLogger.debug(LTag.PUMP, getLogPrefix() + "Last entry: " + latestEntry);
|
||||
if (debugHistory)
|
||||
aapsLogger.debug(LTag.PUMP, getLogPrefix() + "Last entry: " + latestEntry);
|
||||
|
||||
if (latestEntry == null) // no new history to read
|
||||
return;
|
||||
|
@ -1192,7 +1210,8 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
|
|||
this.lastPumpHistoryEntry = latestEntry;
|
||||
sp.putLong(MedtronicConst.Statistics.LastPumpHistoryEntry, latestEntry.atechDateTime);
|
||||
|
||||
aapsLogger.debug(LTag.PUMP, "HST: History: valid=" + historyResult.validEntries.size() + ", unprocessed=" + historyResult.unprocessedEntries.size());
|
||||
if (debugHistory)
|
||||
aapsLogger.debug(LTag.PUMP, "HST: History: valid=" + historyResult.validEntries.size() + ", unprocessed=" + historyResult.unprocessedEntries.size());
|
||||
|
||||
this.medtronicHistoryData.addNewHistory(historyResult);
|
||||
this.medtronicHistoryData.filterNewEntries();
|
||||
|
@ -1214,11 +1233,9 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
|
|||
// update to last entry
|
||||
// - save
|
||||
// - determine pump status
|
||||
|
||||
//
|
||||
|
||||
}
|
||||
|
||||
|
||||
private Long getLastPumpEntryTime() {
|
||||
Long lastPumpEntryTime = sp.getLong(MedtronicConst.Statistics.LastPumpHistoryEntry, 0L);
|
||||
|
||||
|
@ -1538,7 +1555,7 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
|
|||
Intent i = new Intent(context, ErrorHelperActivity.class);
|
||||
i.putExtra("soundid", R.raw.boluserror);
|
||||
i.putExtra("status", getResourceHelper().gs(R.string.medtronic_error_operation_not_possible_no_configuration));
|
||||
i.putExtra("title", getResourceHelper().gs(R.string.combo_warning));
|
||||
i.putExtra("title", getResourceHelper().gs(R.string.medtronic_warning));
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(i);
|
||||
}
|
||||
|
@ -1571,7 +1588,8 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
|
|||
this.hasTimeDateOrTimeZoneChanged = true;
|
||||
}
|
||||
|
||||
@Override public boolean setNeutralTempAtFullHour() {
|
||||
@Override
|
||||
public boolean setNeutralTempAtFullHour() {
|
||||
return sp.getBoolean(R.string.key_set_neutral_temps, true);
|
||||
}
|
||||
|
|
@ -12,9 +12,9 @@ import java.util.Map;
|
|||
import javax.inject.Inject;
|
||||
|
||||
import dagger.android.HasAndroidInjector;
|
||||
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||
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.hw.rileylink.RileyLinkCommunicationManager;
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst;
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RFSpy;
|
||||
|
@ -24,8 +24,6 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.RLMe
|
|||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.RadioPacket;
|
||||
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.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.WakeAndTuneTask;
|
||||
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
|
||||
import info.nightscout.androidaps.plugins.pump.common.utils.DateTimeUtil;
|
||||
|
@ -48,7 +46,6 @@ import info.nightscout.androidaps.plugins.pump.medtronic.data.dto.PumpSettingDTO
|
|||
import info.nightscout.androidaps.plugins.pump.medtronic.data.dto.TempBasalPair;
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicCommandType;
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicDeviceType;
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.defs.PumpDeviceState;
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus;
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil;
|
||||
|
||||
|
@ -151,6 +148,8 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
|
|||
|
||||
PumpDeviceState state = medtronicPumpStatus.getPumpDeviceState();
|
||||
|
||||
// check connection
|
||||
|
||||
byte[] pumpMsgContent = createPumpMessageContent(RLMessageType.ReadSimpleData); // simple
|
||||
RFSpyResponse rfSpyResponse = rfspy.transmitThenReceive(new RadioPacket(injector, pumpMsgContent), (byte) 0, (byte) 200,
|
||||
(byte) 0, (byte) 0, 25000, (byte) 0);
|
|
@ -118,7 +118,7 @@ public abstract class MedtronicHistoryDecoder<T extends MedtronicHistoryEntry> i
|
|||
StringUtil.appendToStringBuilder(sb, "" + unknownEntry.getKey(), ", ");
|
||||
}
|
||||
|
||||
aapsLogger.error(LTag.PUMPCOMM, "STATISTICS OF PUMP DECODE");
|
||||
aapsLogger.info(LTag.PUMPCOMM, "STATISTICS OF PUMP DECODE");
|
||||
|
||||
if (unknownOpCodes.size() > 0) {
|
||||
aapsLogger.warn(LTag.PUMPCOMM, "Unknown Op Codes: {}", sb.toString());
|
||||
|
@ -137,9 +137,9 @@ public abstract class MedtronicHistoryDecoder<T extends MedtronicHistoryEntry> i
|
|||
|
||||
String spaces = StringUtils.repeat(" ", 14 - entry.getKey().name().length());
|
||||
|
||||
aapsLogger.error(LTag.PUMPCOMM, " {}{} - {}. Elements: {}", entry.getKey().name(), spaces, entry.getValue().size(), sb.toString());
|
||||
aapsLogger.info(LTag.PUMPCOMM, " {}{} - {}. Elements: {}", entry.getKey().name(), spaces, entry.getValue().size(), sb.toString());
|
||||
} else {
|
||||
aapsLogger.error(LTag.PUMPCOMM, " {} - {}", entry.getKey().name(), entry.getValue().size());
|
||||
aapsLogger.info(LTag.PUMPCOMM, " {} - {}", entry.getKey().name(), entry.getValue().size());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -3,7 +3,6 @@ package info.nightscout.androidaps.plugins.pump.medtronic.comm.history;
|
|||
import com.google.gson.annotations.Expose;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
|
@ -34,7 +34,7 @@ public class MedtronicUIComm {
|
|||
|
||||
public synchronized MedtronicUITask executeCommand(MedtronicCommandType commandType, Object... parameters) {
|
||||
|
||||
aapsLogger.warn(LTag.PUMP, "Execute Command: " + commandType.name());
|
||||
aapsLogger.info(LTag.PUMP, "Execute Command: " + commandType.name());
|
||||
|
||||
MedtronicUITask task = new MedtronicUITask(injector, commandType, parameters);
|
||||
|
|
@ -161,7 +161,8 @@ public class MedtronicUIPostprocessor {
|
|||
// no postprocessing
|
||||
|
||||
default:
|
||||
aapsLogger.error(LTag.PUMP, "Post-processing not implemented for {}.", uiTask.commandType.name());
|
||||
break;
|
||||
//aapsLogger.error(LTag.PUMP, "Post-processing not implemented for {}.", uiTask.commandType.name());
|
||||
|
||||
}
|
||||
|
|
@ -8,15 +8,15 @@ import dagger.android.HasAndroidInjector;
|
|||
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||
import info.nightscout.androidaps.logging.LTag;
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
|
||||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState;
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.comm.MedtronicCommunicationManager;
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpHistoryEntry;
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.data.dto.BasalProfile;
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.data.dto.TempBasalPair;
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicCommandType;
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicUIResponseType;
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.defs.PumpDeviceState;
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus;
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicDeviceStatusChange;
|
||||
import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange;
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicPumpValuesChanged;
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil;
|
||||
|
||||
|
@ -201,10 +201,10 @@ public class MedtronicUITask {
|
|||
}
|
||||
|
||||
if (responseType == MedtronicUIResponseType.Invalid) {
|
||||
rxBus.send(new EventMedtronicDeviceStatusChange(PumpDeviceState.ErrorWhenCommunicating,
|
||||
rxBus.send(new EventRileyLinkDeviceStatusChange(PumpDeviceState.ErrorWhenCommunicating,
|
||||
"Unsupported command in MedtronicUITask"));
|
||||
} else if (responseType == MedtronicUIResponseType.Error) {
|
||||
rxBus.send(new EventMedtronicDeviceStatusChange(PumpDeviceState.ErrorWhenCommunicating,
|
||||
rxBus.send(new EventRileyLinkDeviceStatusChange(PumpDeviceState.ErrorWhenCommunicating,
|
||||
errorDescription));
|
||||
} else {
|
||||
rxBus.send(new EventMedtronicPumpValuesChanged());
|
|
@ -22,7 +22,6 @@ import javax.inject.Inject;
|
|||
import javax.inject.Singleton;
|
||||
|
||||
import dagger.android.HasAndroidInjector;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.data.DetailedBolusInfo;
|
||||
import info.nightscout.androidaps.db.CareportalEvent;
|
||||
import info.nightscout.androidaps.db.DbObjectBase;
|
||||
|
@ -31,6 +30,7 @@ import info.nightscout.androidaps.db.Source;
|
|||
import info.nightscout.androidaps.db.TDD;
|
||||
import info.nightscout.androidaps.db.TemporaryBasal;
|
||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
|
||||
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface;
|
||||
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||
import info.nightscout.androidaps.logging.LTag;
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
|
||||
|
@ -52,8 +52,7 @@ import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpSta
|
|||
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicConst;
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil;
|
||||
import info.nightscout.androidaps.db.Treatment;
|
||||
import info.nightscout.androidaps.plugins.treatments.TreatmentService;
|
||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
|
||||
import info.nightscout.androidaps.plugins.treatments.TreatmentUpdateReturn;
|
||||
import info.nightscout.androidaps.utils.DateUtil;
|
||||
import info.nightscout.androidaps.utils.Round;
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP;
|
||||
|
@ -81,6 +80,7 @@ public class MedtronicHistoryData {
|
|||
private final NSUpload nsUpload;
|
||||
private final MedtronicUtil medtronicUtil;
|
||||
private final MedtronicPumpHistoryDecoder medtronicPumpHistoryDecoder;
|
||||
private final DatabaseHelperInterface databaseHelper;
|
||||
|
||||
private List<PumpHistoryEntry> allHistory;
|
||||
private List<PumpHistoryEntry> newHistory = null;
|
||||
|
@ -98,8 +98,10 @@ public class MedtronicHistoryData {
|
|||
* Double bolus debug. We seem to have small problem with double Boluses (or sometimes also missing boluses
|
||||
* from history. This flag turns on debugging for that (default is off=false)... Debuging is pretty detailed,
|
||||
* so log files will get bigger.
|
||||
* Note: June 2020. Since this seems to be fixed, I am disabling this per default. I will leave code inside
|
||||
* in case we need it again. Code that turns this on is commented out RileyLinkMedtronicService#verifyConfiguration()
|
||||
*/
|
||||
public static boolean doubleBolusDebug = false;
|
||||
public static final boolean doubleBolusDebug = false;
|
||||
|
||||
@Inject
|
||||
public MedtronicHistoryData(
|
||||
|
@ -109,7 +111,8 @@ public class MedtronicHistoryData {
|
|||
ActivePluginProvider activePlugin,
|
||||
NSUpload nsUpload,
|
||||
MedtronicUtil medtronicUtil,
|
||||
MedtronicPumpHistoryDecoder medtronicPumpHistoryDecoder
|
||||
MedtronicPumpHistoryDecoder medtronicPumpHistoryDecoder,
|
||||
DatabaseHelperInterface databaseHelperInterface
|
||||
) {
|
||||
this.allHistory = new ArrayList<>();
|
||||
|
||||
|
@ -120,6 +123,7 @@ public class MedtronicHistoryData {
|
|||
this.nsUpload = nsUpload;
|
||||
this.medtronicUtil = medtronicUtil;
|
||||
this.medtronicPumpHistoryDecoder = medtronicPumpHistoryDecoder;
|
||||
this.databaseHelper = databaseHelperInterface;
|
||||
}
|
||||
|
||||
private Gson gson() {
|
||||
|
@ -532,7 +536,7 @@ public class MedtronicHistoryData {
|
|||
|
||||
|
||||
private void uploadCareportalEvent(long date, String event) {
|
||||
if (MainApp.getDbHelper().getCareportalEventFromTimestamp(date) != null)
|
||||
if (databaseHelper.getCareportalEventFromTimestamp(date) != null)
|
||||
return;
|
||||
try {
|
||||
JSONObject data = new JSONObject();
|
||||
|
@ -545,7 +549,7 @@ public class MedtronicHistoryData {
|
|||
careportalEvent.source = Source.USER;
|
||||
careportalEvent.eventType = event;
|
||||
careportalEvent.json = data.toString();
|
||||
MainApp.getDbHelper().createOrUpdate(careportalEvent);
|
||||
databaseHelper.createOrUpdate(careportalEvent);
|
||||
nsUpload.uploadCareportalEntryToNS(data);
|
||||
} catch (JSONException e) {
|
||||
aapsLogger.error("Unhandled exception", e);
|
||||
|
@ -559,7 +563,7 @@ public class MedtronicHistoryData {
|
|||
|
||||
aapsLogger.debug(LTag.PUMP, getLogPrefix() + "TDDs found: {}.\n{}", tdds.size(), gson().toJson(tdds));
|
||||
|
||||
List<TDD> tddsDb = MainApp.getDbHelper().getTDDsForLastXDays(3);
|
||||
List<TDD> tddsDb = databaseHelper.getTDDsForLastXDays(3);
|
||||
|
||||
for (PumpHistoryEntry tdd : tdds) {
|
||||
|
||||
|
@ -575,7 +579,7 @@ public class MedtronicHistoryData {
|
|||
|
||||
aapsLogger.debug(LTag.PUMP, "TDD Add: {}", tddNew);
|
||||
|
||||
MainApp.getDbHelper().createOrUpdateTDD(tddNew);
|
||||
databaseHelper.createOrUpdateTDD(tddNew);
|
||||
|
||||
} else {
|
||||
|
||||
|
@ -584,7 +588,7 @@ public class MedtronicHistoryData {
|
|||
|
||||
aapsLogger.debug(LTag.PUMP, "TDD Edit: {}", tddDbEntry);
|
||||
|
||||
MainApp.getDbHelper().createOrUpdateTDD(tddDbEntry);
|
||||
databaseHelper.createOrUpdateTDD(tddDbEntry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -745,7 +749,7 @@ public class MedtronicHistoryData {
|
|||
|
||||
tempBasal.durationInMinutes = tempBasalProcessDTO.getDuration();
|
||||
|
||||
MainApp.getDbHelper().createOrUpdate(tempBasal);
|
||||
databaseHelper.createOrUpdate(tempBasal);
|
||||
|
||||
aapsLogger.debug(LTag.PUMP, "Edit " + ProcessHistoryRecord.TBR.getDescription() + " - (entryFromDb={}) ", tempBasal);
|
||||
} else {
|
||||
|
@ -793,7 +797,7 @@ public class MedtronicHistoryData {
|
|||
}
|
||||
}
|
||||
|
||||
TemporaryBasal tempBasal = MainApp.getDbHelper().findTempBasalByPumpId(pumpId);
|
||||
TemporaryBasal tempBasal = databaseHelper.findTempBasalByPumpId(pumpId);
|
||||
return tempBasal;
|
||||
}
|
||||
|
||||
|
@ -884,7 +888,7 @@ public class MedtronicHistoryData {
|
|||
if (processHistoryRecord == ProcessHistoryRecord.Bolus) {
|
||||
return activePlugin.getActiveTreatments().getTreatmentsFromHistoryAfterTimestamp(startTimestamp);
|
||||
} else {
|
||||
return MainApp.getDbHelper().getTemporaryBasalsDataFromTime(startTimestamp, true);
|
||||
return databaseHelper.getTemporaryBasalsDataFromTime(startTimestamp, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -992,7 +996,7 @@ public class MedtronicHistoryData {
|
|||
treatment.pumpId = bolus.getPumpId();
|
||||
treatment.insulin = bolusDTO.getDeliveredAmount();
|
||||
|
||||
TreatmentService.UpdateReturn updateReturn = ((TreatmentsPlugin) activePlugin.getActiveTreatments()).getService().createOrUpdateMedtronic(treatment, false);
|
||||
TreatmentUpdateReturn updateReturn = activePlugin.getActiveTreatments().createOrUpdateMedtronic(treatment, false);
|
||||
|
||||
if (doubleBolusDebug)
|
||||
aapsLogger.debug(LTag.PUMP, "DoubleBolusDebug: addBolus(tretament!=null): NewTreatment={}, UpdateReturn={}", treatment, updateReturn);
|
||||
|
@ -1042,7 +1046,7 @@ public class MedtronicHistoryData {
|
|||
|
||||
treatment.setLinkedObject(temporaryBasalDb);
|
||||
|
||||
MainApp.getDbHelper().createOrUpdate(temporaryBasalDb);
|
||||
databaseHelper.createOrUpdate(temporaryBasalDb);
|
||||
|
||||
aapsLogger.debug(LTag.PUMP, operation + " - [date={},pumpId={}, rate={} {}, duration={}]", //
|
||||
temporaryBasalDb.date, //
|
||||
|
@ -1058,7 +1062,7 @@ public class MedtronicHistoryData {
|
|||
|
||||
for (TempBasalProcessDTO tempBasalProcess : tempBasalProcessList) {
|
||||
|
||||
TemporaryBasal tempBasal = MainApp.getDbHelper().findTempBasalByPumpId(tempBasalProcess.itemOne.getPumpId());
|
||||
TemporaryBasal tempBasal = databaseHelper.findTempBasalByPumpId(tempBasalProcess.itemOne.getPumpId());
|
||||
|
||||
if (tempBasal == null) {
|
||||
// add
|
||||
|
@ -1074,7 +1078,7 @@ public class MedtronicHistoryData {
|
|||
tempBasalProcess.itemOne.setLinkedObject(tempBasal);
|
||||
tempBasalProcess.itemTwo.setLinkedObject(tempBasal);
|
||||
|
||||
MainApp.getDbHelper().createOrUpdate(tempBasal);
|
||||
databaseHelper.createOrUpdate(tempBasal);
|
||||
|
||||
}
|
||||
}
|
|
@ -8,7 +8,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.logging.LTag;
|
||||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
|
||||
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
|
|
@ -1,14 +1,10 @@
|
|||
package info.nightscout.androidaps.plugins.pump.medtronic.data.dto;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
|
||||
import info.nightscout.androidaps.db.TDD;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.logging.StacktraceLoggerWrapper;
|
||||
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
|
||||
import info.nightscout.androidaps.plugins.pump.common.utils.DateTimeUtil;
|
||||
import info.nightscout.androidaps.plugins.pump.common.utils.StringUtil;
|
||||
|
@ -209,38 +205,37 @@ public class DailyTotalsDTO {
|
|||
//LOG.debug("523: {}", toString());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return MoreObjects.toStringHelper(this) //
|
||||
.add("bgAvg", bgAvg) //
|
||||
.add("bgLow", bgLow) //
|
||||
.add("bgHigh", bgHigh) //
|
||||
.add("bgCount", bgCount) //
|
||||
.add("sensorAvg", sensorAvg) //
|
||||
.add("sensorMin", sensorMin) //
|
||||
.add("sensorMax", sensorMax) //
|
||||
.add("sensorCalcCount", sensorCalcCount) //
|
||||
.add("sensorDataCount", sensorDataCount) //
|
||||
.add("insulinTotal", insulinTotal) //
|
||||
.add("insulinBasal", insulinBasal) //
|
||||
.add("insulinBolus", insulinBolus) //
|
||||
.add("insulinCarbs", insulinCarbs) //
|
||||
.add("bolusTotal", bolusTotal) //
|
||||
.add("bolusFood", bolusFood) //
|
||||
.add("bolusCorrection", bolusCorrection) //
|
||||
.add("bolusManual", bolusManual) //
|
||||
.add("bolusCount", bolusCount) //
|
||||
.add("bolusCountFoodOrCorr", bolusCountFoodOrCorr) //
|
||||
.add("bolusCountFoodAndCorr", bolusCountFoodAndCorr) //
|
||||
.add("bolusCountFood", bolusCountFood) //
|
||||
.add("bolusCountCorr", bolusCountCorr) //
|
||||
.add("bolusCountManual", bolusCountManual) //
|
||||
.omitNullValues() //
|
||||
return new ToStringBuilder(this)
|
||||
.append("bgAvg", bgAvg)
|
||||
.append("bgLow", bgLow)
|
||||
.append("bgHigh", bgHigh)
|
||||
.append("bgCount", bgCount)
|
||||
.append("sensorAvg", sensorAvg)
|
||||
.append("sensorMin", sensorMin)
|
||||
.append("sensorMax", sensorMax)
|
||||
.append("sensorCalcCount", sensorCalcCount)
|
||||
.append("sensorDataCount", sensorDataCount)
|
||||
.append("insulinTotal", insulinTotal)
|
||||
.append("insulinBasal", insulinBasal)
|
||||
.append("insulinBolus", insulinBolus)
|
||||
.append("insulinCarbs", insulinCarbs)
|
||||
.append("bolusTotal", bolusTotal)
|
||||
.append("bolusFood", bolusFood)
|
||||
.append("bolusFoodAndCorr", bolusFoodAndCorr)
|
||||
.append("bolusCorrection", bolusCorrection)
|
||||
.append("bolusManual", bolusManual)
|
||||
.append("bolusCount", bolusCount)
|
||||
.append("bolusCountFoodOrCorr", bolusCountFoodOrCorr)
|
||||
.append("bolusCountFoodAndCorr", bolusCountFoodAndCorr)
|
||||
.append("bolusCountManual", bolusCountManual)
|
||||
.append("bolusCountFood", bolusCountFood)
|
||||
.append("bolusCountCorr", bolusCountCorr)
|
||||
.append("entry", entry)
|
||||
.toString();
|
||||
}
|
||||
|
||||
|
||||
public void setTDD(TDD tdd) {
|
||||
tdd.date = DateTimeUtil.toMillisFromATD(this.entry.atechDateTime);
|
||||
tdd.basal = insulinBasal;
|
|
@ -0,0 +1,41 @@
|
|||
package info.nightscout.androidaps.plugins.pump.medtronic.data.dto;
|
||||
|
||||
import org.joda.time.LocalDateTime;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.data.RLHistoryItem;
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkError;
|
||||
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.medtronic.defs.MedtronicCommandType;
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
||||
|
||||
public class RLHistoryItemMedtronic extends RLHistoryItem {
|
||||
|
||||
private MedtronicCommandType medtronicCommandType;
|
||||
|
||||
public RLHistoryItemMedtronic(MedtronicCommandType medtronicCommandType) {
|
||||
super(new LocalDateTime(), RLHistoryItemSource.MedtronicCommand, RileyLinkTargetDevice.MedtronicPump);
|
||||
this.medtronicCommandType = medtronicCommandType;
|
||||
}
|
||||
|
||||
public String getDescription(ResourceHelper resourceHelper) {
|
||||
|
||||
switch (this.source) {
|
||||
case RileyLink:
|
||||
return "State: " + resourceHelper.gs(serviceState.getResourceId(targetDevice))
|
||||
+ (this.errorCode == null ? "" : ", Error Code: " + errorCode);
|
||||
|
||||
case MedtronicPump:
|
||||
return resourceHelper.gs(pumpDeviceState.getResourceId());
|
||||
|
||||
case MedtronicCommand:
|
||||
return medtronicCommandType.name();
|
||||
|
||||
default:
|
||||
return "Unknown Description";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -7,7 +7,6 @@ import java.util.List;
|
|||
import java.util.Locale;
|
||||
|
||||
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.logging.LTag;
|
||||
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil;
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue