WIP on moving Omnipod into a separate module

This commit is contained in:
Bart Sopers 2020-08-17 19:53:43 +02:00
parent 2a55c6413c
commit 5c4b9846e6
42 changed files with 172 additions and 409 deletions

View file

@ -57,7 +57,6 @@ import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventNewHi
import info.nightscout.androidaps.plugins.pump.insight.database.InsightBolusID;
import info.nightscout.androidaps.plugins.pump.insight.database.InsightHistoryOffset;
import info.nightscout.androidaps.plugins.pump.insight.database.InsightPumpID;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.db.PodHistory;
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin;
import info.nightscout.androidaps.utils.JsonHelper;
import info.nightscout.androidaps.utils.PercentageSplitter;
@ -88,7 +87,6 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
public static final String DATABASE_INSIGHT_HISTORY_OFFSETS = "InsightHistoryOffsets";
public static final String DATABASE_INSIGHT_BOLUS_IDS = "InsightBolusIDs";
public static final String DATABASE_INSIGHT_PUMP_IDS = "InsightPumpIDs";
public static final String DATABASE_POD_HISTORY = "PodHistory";
private static final int DATABASE_VERSION = 12;
@ -142,7 +140,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
TableUtils.createTableIfNotExists(connectionSource, InsightHistoryOffset.class);
TableUtils.createTableIfNotExists(connectionSource, InsightBolusID.class);
TableUtils.createTableIfNotExists(connectionSource, InsightPumpID.class);
TableUtils.createTableIfNotExists(connectionSource, PodHistory.class);
TableUtils.createTableIfNotExists(connectionSource, OmnipodHistoryRecord.class);
database.execSQL("INSERT INTO sqlite_sequence (name, seq) SELECT \"" + DATABASE_INSIGHT_BOLUS_IDS + "\", " + System.currentTimeMillis() + " " +
"WHERE NOT EXISTS (SELECT 1 FROM sqlite_sequence WHERE name = \"" + DATABASE_INSIGHT_BOLUS_IDS + "\")");
database.execSQL("INSERT INTO sqlite_sequence (name, seq) SELECT \"" + DATABASE_INSIGHT_PUMP_IDS + "\", " + System.currentTimeMillis() + " " +
@ -219,7 +217,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
TableUtils.dropTable(connectionSource, CareportalEvent.class, true);
TableUtils.dropTable(connectionSource, ProfileSwitch.class, true);
TableUtils.dropTable(connectionSource, TDD.class, true);
TableUtils.dropTable(connectionSource, PodHistory.class, true);
TableUtils.dropTable(connectionSource, OmnipodHistoryRecord.class, true);
TableUtils.createTableIfNotExists(connectionSource, TempTarget.class);
TableUtils.createTableIfNotExists(connectionSource, BgReading.class);
TableUtils.createTableIfNotExists(connectionSource, DanaRHistoryRecord.class);
@ -229,7 +227,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
TableUtils.createTableIfNotExists(connectionSource, CareportalEvent.class);
TableUtils.createTableIfNotExists(connectionSource, ProfileSwitch.class);
TableUtils.createTableIfNotExists(connectionSource, TDD.class);
TableUtils.createTableIfNotExists(connectionSource, PodHistory.class);
TableUtils.createTableIfNotExists(connectionSource, OmnipodHistoryRecord.class);
updateEarliestDataChange(0);
} catch (SQLException e) {
aapsLogger.error("Unhandled exception", e);
@ -364,8 +362,8 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
return getDao(InsightHistoryOffset.class);
}
private Dao<PodHistory, Long> getDaoPodHistory() throws SQLException {
return getDao(PodHistory.class);
private Dao<OmnipodHistoryRecord, Long> getDaoPodHistory() throws SQLException {
return getDao(OmnipodHistoryRecord.class);
}
public long roundDateToSec(long date) {
@ -1865,25 +1863,25 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
// ---------------- PodHistory handling ---------------
public void createOrUpdate(PodHistory podHistory) {
public void createOrUpdate(OmnipodHistoryRecord omnipodHistoryRecord) {
try {
getDaoPodHistory().createOrUpdate(podHistory);
getDaoPodHistory().createOrUpdate(omnipodHistoryRecord);
} catch (SQLException e) {
aapsLogger.error("Unhandled exception", e);
}
}
public List<PodHistory> getPodHistoryFromTime(long from, boolean ascending) {
public List<OmnipodHistoryRecord> getAllOmnipodHistoryRecordsFromTimeStamp(long from, boolean ascending) {
try {
Dao<PodHistory, Long> daoPodHistory = getDaoPodHistory();
List<PodHistory> podHistories;
QueryBuilder<PodHistory, Long> queryBuilder = daoPodHistory.queryBuilder();
Dao<OmnipodHistoryRecord, Long> daoPodHistory = getDaoPodHistory();
List<OmnipodHistoryRecord> podHistories;
QueryBuilder<OmnipodHistoryRecord, Long> queryBuilder = daoPodHistory.queryBuilder();
queryBuilder.orderBy("date", ascending);
//queryBuilder.limit(100L);
Where where = queryBuilder.where();
where.ge("date", from);
PreparedQuery<PodHistory> preparedQuery = queryBuilder.prepare();
PreparedQuery<OmnipodHistoryRecord> preparedQuery = queryBuilder.prepare();
podHistories = daoPodHistory.query(preparedQuery);
return podHistories;
} catch (SQLException e) {

View file

@ -16,7 +16,8 @@ import info.nightscout.androidaps.interfaces.DatabaseHelperInterface;
@Singleton
public class DatabaseHelperProvider implements DatabaseHelperInterface {
@Inject DatabaseHelperProvider() {}
@Inject DatabaseHelperProvider() {
}
@NotNull @Override public List<BgReading> getAllBgreadingsDataFromTime(long mills, boolean ascending) {
return MainApp.getDbHelper().getAllBgreadingsDataFromTime(mills, ascending);
@ -30,6 +31,10 @@ public class DatabaseHelperProvider implements DatabaseHelperInterface {
MainApp.getDbHelper().createOrUpdate(record);
}
@Override public void createOrUpdate(@NotNull OmnipodHistoryRecord record) {
MainApp.getDbHelper().createOrUpdate(record);
}
@NotNull @Override public List<DanaRHistoryRecord> getDanaRHistoryRecordsByType(byte type) {
return MainApp.getDbHelper().getDanaRHistoryRecordsByType(type);
}
@ -86,10 +91,14 @@ public class DatabaseHelperProvider implements DatabaseHelperInterface {
return MainApp.getDbHelper().getTemporaryBasalsDataFromTime(mills, ascending);
}
@NotNull @Override public CareportalEvent getCareportalEventFromTimestamp(long timestamp) {
@Override public CareportalEvent getCareportalEventFromTimestamp(long timestamp) {
return MainApp.getDbHelper().getCareportalEventFromTimestamp(timestamp);
}
@NotNull @Override public List<OmnipodHistoryRecord> getAllOmnipodHistoryRecordsFromTimestamp(long timestamp, boolean ascending) {
return MainApp.getDbHelper().getAllOmnipodHistoryRecordsFromTimeStamp(timestamp, ascending);
}
@NotNull @Override public List<TDD> getTDDsForLastXDays(int days) {
return MainApp.getDbHelper().getTDDsForLastXDays(days);
}

View file

@ -1,23 +1,19 @@
package info.nightscout.androidaps.plugins.pump.omnipod.driver.db;
package info.nightscout.androidaps.db;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;
import info.nightscout.androidaps.db.DatabaseHelper;
import info.nightscout.androidaps.db.DbObjectBase;
import info.nightscout.androidaps.plugins.pump.common.utils.DateTimeUtil;
/**
* Created by andy on 30.11.2019.
*/
@DatabaseTable(tableName = DatabaseHelper.DATABASE_POD_HISTORY)
public class PodHistory implements DbObjectBase, Comparable<PodHistory> {
@DatabaseTable(tableName = "PodHistory")
public class OmnipodHistoryRecord implements DbObjectBase, Comparable<OmnipodHistoryRecord> {
@DatabaseField(id = true)
public long date;
private PodHistoryEntryType podHistoryEntryType;
@DatabaseField
private long podEntryTypeCode;
@ -36,27 +32,16 @@ public class PodHistory implements DbObjectBase, Comparable<PodHistory> {
@DatabaseField
private Boolean successConfirmed;
public PodHistory() {
public OmnipodHistoryRecord() {
generatePumpId();
}
public PodHistory(PodHistoryEntryType podDbEntryType) {
this.date = System.currentTimeMillis();
this.podHistoryEntryType = podDbEntryType;
this.podEntryTypeCode = podDbEntryType.getCode();
generatePumpId();
}
public PodHistory(long dateTimeInMillis, PodHistoryEntryType podDbEntryType) {
public OmnipodHistoryRecord(long dateTimeInMillis, long podEntryTypeCode) {
this.date = dateTimeInMillis;
this.podHistoryEntryType = podDbEntryType;
this.podEntryTypeCode = podDbEntryType.getCode();
this.podEntryTypeCode = podEntryTypeCode;
generatePumpId();
}
@Override
public long getDate() {
return this.date;
@ -70,19 +55,14 @@ public class PodHistory implements DbObjectBase, Comparable<PodHistory> {
return DateTimeUtil.toStringFromTimeInMillis(this.date);
}
public PodHistoryEntryType getPodDbEntryType() {
return PodHistoryEntryType.getByCode((int) this.podEntryTypeCode);
}
public void setPodDbEntryType(PodHistoryEntryType podDbEntryType) {
//this.podHistoryEntryType = podDbEntryType;
this.podEntryTypeCode = podDbEntryType.getCode();
}
public long getPodEntryTypeCode() {
return podEntryTypeCode;
}
public void setPodEntryTypeCode(long podEntryTypeCode) {
this.podEntryTypeCode = podEntryTypeCode;
}
public String getData() {
return data;
}
@ -130,7 +110,7 @@ public class PodHistory implements DbObjectBase, Comparable<PodHistory> {
}
@Override
public int compareTo(PodHistory otherOne) {
public int compareTo(OmnipodHistoryRecord otherOne) {
return (int) (otherOne.date - this.date);
}
}

View file

@ -8,6 +8,7 @@ interface DatabaseHelperInterface {
fun getAllBgreadingsDataFromTime(mills: Long, ascending: Boolean): List<BgReading>
fun createOrUpdate(careportalEvent: CareportalEvent)
fun createOrUpdate(record: DanaRHistoryRecord)
fun createOrUpdate(record: OmnipodHistoryRecord)
fun create(record: DbRequest)
fun getDanaRHistoryRecordsByType(type: Byte): List<DanaRHistoryRecord>
fun getTDDs(): List<TDD>
@ -19,9 +20,10 @@ interface DatabaseHelperInterface {
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 findTempBasalByPumpId(id: Long): TemporaryBasal
fun getTemporaryBasalsDataFromTime(mills: Long, ascending: Boolean): List<TemporaryBasal>
fun getCareportalEventFromTimestamp(timestamp: Long): CareportalEvent?
fun getAllOmnipodHistoryRecordsFromTimestamp(timestamp: Long, ascending: Boolean): List<OmnipodHistoryRecord>
fun getTDDsForLastXDays(days: Int): List<TDD>
fun getProfileSwitchData(from: Long, ascending: Boolean): List<ProfileSwitch>
}

View file

@ -64,17 +64,9 @@ public abstract class PumpPluginAbstract extends PumpPluginBase implements PumpI
protected CommandQueueProvider commandQueue;
protected SP sp;
protected DateUtil dateUtil;
/*
protected static final PumpEnactResult OPERATION_NOT_SUPPORTED = new PumpEnactResult().success(false)
.enacted(false).comment(MainApp.gs(R.string.pump_operation_not_supported_by_pump_driver));
protected static final PumpEnactResult OPERATION_NOT_YET_SUPPORTED = new PumpEnactResult().success(false)
.enacted(false).comment(MainApp.gs(R.string.pump_operation_not_yet_supported_by_pump));
*/
protected PumpDescription pumpDescription = new PumpDescription();
protected ServiceConnection serviceConnection = null;
protected ServiceConnection serviceConnection;
protected boolean serviceRunning = false;
// protected boolean isInitialized = false;
protected PumpDriverState pumpState = PumpDriverState.NotInitialized;
protected boolean displayConnectionMessages = false;
protected PumpType pumpType;

View file

@ -9,8 +9,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.EventPreferenceChange
import info.nightscout.androidaps.interfaces.ActivePluginProvider
import info.nightscout.androidaps.interfaces.CommandQueueProvider
@ -34,7 +32,6 @@ import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil
import info.nightscout.androidaps.queue.Callback
import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.LocalAlertUtils
import info.nightscout.androidaps.utils.T
import info.nightscout.androidaps.utils.WarnColors
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
@ -55,7 +52,6 @@ import javax.inject.Inject
class OmnipodFragment : 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
@ -68,7 +64,9 @@ class OmnipodFragment : DaggerFragment() {
@Inject lateinit var sp: SP
@Inject lateinit var omnipodUtil: OmnipodUtil
@Inject lateinit var rileyLinkServiceData: RileyLinkServiceData
@Inject lateinit var localAlertUtils: LocalAlertUtils
// TODO somehow obtain the pumpUnreachableThreshold in order to display last connection time red or white
// @Inject lateinit var localAlertUtils: LocalAlertUtils
@Inject lateinit var protectionCheck: ProtectionCheck
private var disposable: CompositeDisposable = CompositeDisposable()
@ -98,8 +96,8 @@ class OmnipodFragment : DaggerFragment() {
if (omnipodPumpPlugin.rileyLinkService?.verifyConfiguration() == true) {
activity?.let { activity ->
protectionCheck.queryProtection(
activity,ProtectionCheck.Protection.PREFERENCES,
UIRunnable(Runnable{startActivity(Intent(context, PodManagementActivity::class.java))})
activity, ProtectionCheck.Protection.PREFERENCES,
UIRunnable(Runnable { startActivity(Intent(context, PodManagementActivity::class.java)) })
)
}
} else {
@ -330,11 +328,15 @@ class OmnipodFragment : DaggerFragment() {
private fun updateLastConnectionUiElements() {
if (podStateManager.isPodInitialized && podStateManager.lastSuccessfulCommunication != null) { // Null check for backwards compatibility
omnipod_lastconnection.text = readableDuration(podStateManager.lastSuccessfulCommunication)
omnipod_lastconnection.setTextColor(Color.WHITE)
/*
// TODO
if (omnipodPumpPlugin.isUnreachableAlertTimeoutExceeded(localAlertUtils.pumpUnreachableThreshold())) {
omnipod_lastconnection.setTextColor(Color.RED)
} else {
omnipod_lastconnection.setTextColor(Color.WHITE)
}
*/
} else {
omnipod_lastconnection.setTextColor(Color.WHITE)
if (podStateManager.hasPodState() && podStateManager.lastSuccessfulCommunication != null) {
@ -356,25 +358,19 @@ class OmnipodFragment : DaggerFragment() {
}
private fun readableDuration(dateTime: DateTime): String {
val min = Duration(dateTime, DateTime.now()).standardMinutes
val minutes = Duration(dateTime, DateTime.now()).standardMinutes
when {
min == 0L -> {
minutes == 0L -> {
return resourceHelper.gs(R.string.omnipod_connected_now)
}
min < 60 -> {
return resourceHelper.gs(R.string.minago, min)
minutes < 60 -> {
return resourceHelper.gs(R.string.minago, minutes)
}
min < 1440 -> {
val h = (min / 60).toInt()
return resourceHelper.gq(R.plurals.objective_hours, h, h) + " " + resourceHelper.gs(R.string.ago)
}
else -> {
val h = (min / 60).toInt()
val d = h / 24
return resourceHelper.gq(R.plurals.objective_days, d, d) + " " + resourceHelper.gs(R.string.ago)
else -> {
val hours = (minutes / 60).toInt()
return resourceHelper.gs(R.string.hoursago, hours)
}
}
}

View file

@ -4,7 +4,6 @@ import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.IBinder;
import android.os.SystemClock;
@ -24,8 +23,6 @@ import javax.inject.Inject;
import javax.inject.Singleton;
import dagger.android.HasAndroidInjector;
import info.nightscout.androidaps.BuildConfig;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.activities.ErrorHelperActivity;
import info.nightscout.androidaps.data.DetailedBolusInfo;
import info.nightscout.androidaps.data.Profile;
@ -49,7 +46,6 @@ import info.nightscout.androidaps.plugins.general.overview.notifications.Notific
import info.nightscout.androidaps.plugins.pump.common.PumpPluginAbstract;
import info.nightscout.androidaps.plugins.pump.common.data.PumpStatus;
import info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair;
import info.nightscout.androidaps.plugins.pump.common.defs.PumpDriverState;
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice;
@ -59,12 +55,10 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks
import info.nightscout.androidaps.plugins.pump.common.utils.DateTimeUtil;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoRecentPulseLog;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommandType;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.IOmnipodManager;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCustomActionType;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodPumpPluginInterface;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodStatusRequest;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodStateManager;
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.driver.ui.OmnipodUIComm;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.ui.OmnipodUITask;
@ -72,7 +66,6 @@ import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodPumpVa
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodRefreshButtonState;
import info.nightscout.androidaps.plugins.pump.omnipod.service.RileyLinkOmnipodService;
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;
import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.FabricPrivacy;
import info.nightscout.androidaps.utils.Round;
@ -89,41 +82,29 @@ import io.reactivex.schedulers.Schedulers;
*/
@Singleton
public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPumpPluginInterface, RileyLinkPumpDevice {
protected PodStateManager podStateManager;
private static OmnipodPumpPlugin plugin = null;
private RileyLinkServiceData rileyLinkServiceData;
private ServiceTaskExecutor serviceTaskExecutor;
private RileyLinkOmnipodService rileyLinkOmnipodService;
private OmnipodUtil omnipodUtil;
protected OmnipodPumpStatus omnipodPumpStatus = null;
//protected OmnipodUIComm omnipodUIComm;
private final PodStateManager podStateManager;
private final RileyLinkServiceData rileyLinkServiceData;
private final ServiceTaskExecutor serviceTaskExecutor;
private final OmnipodPumpStatus omnipodPumpStatus;
private CompositeDisposable disposable = new CompositeDisposable();
// variables for handling statuses and history
protected boolean firstRun = true;
protected boolean isRefresh = false;
private boolean isBasalProfileInvalid = false;
private boolean basalProfileChanged = false;
private boolean isInitialized = false;
protected IOmnipodManager omnipodCommunicationManager;
// TODO make non-static just inject the Singleton and use a getter)
public static boolean isBusy = false;
private RileyLinkOmnipodService rileyLinkOmnipodService;
private boolean isBusy = false;
// TODO it seems that we never add anything to this list?
// I Wouldn't know why we need it anyway
protected List<Long> busyTimestamps = new ArrayList<>();
protected boolean sentIdToFirebase = false;
protected boolean hasTimeDateOrTimeZoneChanged = false;
private int timeChangeRetries = 0;
private Profile currentProfile;
boolean omnipodServiceRunning = false;
private long nextPodCheck = 0L;
//OmnipodDriverState driverState = OmnipodDriverState.NotInitalized;
@Inject
public OmnipodPumpPlugin(
@ -134,7 +115,6 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
ResourceHelper resourceHelper,
ActivePluginProvider activePlugin,
SP sp,
OmnipodUtil omnipodUtil,
OmnipodPumpStatus omnipodPumpStatus,
PodStateManager podStateManager,
CommandQueueProvider commandQueue,
@ -157,23 +137,10 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
this.podStateManager = podStateManager;
this.rileyLinkServiceData = rileyLinkServiceData;
this.serviceTaskExecutor = serviceTaskExecutor;
displayConnectionMessages = false;
this.omnipodUtil = omnipodUtil;
this.omnipodPumpStatus = omnipodPumpStatus;
//OmnipodUtil.setDriverState();
// TODO loop
// if (OmnipodUtil.isOmnipodEros()) {
// OmnipodUtil.setPlugin(this);
// OmnipodUtil.setOmnipodPodType(OmnipodPodType.Eros);
// OmnipodUtil.setPumpType(PumpType.Insulet_Omnipod);
// }
// // TODO ccc
serviceConnection = new ServiceConnection() {
displayConnectionMessages = false;
this.serviceConnection = new ServiceConnection() {
@Override
public void onServiceDisconnected(ComponentName name) {
@ -230,28 +197,6 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
}
protected OmnipodPumpPlugin(PluginDescription pluginDescription, PumpType pumpType,
HasAndroidInjector injector,
AAPSLogger aapsLogger,
RxBusWrapper rxBus,
Context context,
ResourceHelper resourceHelper,
ActivePluginProvider activePlugin,
info.nightscout.androidaps.utils.sharedPreferences.SP sp,
CommandQueueProvider commandQueue,
FabricPrivacy fabricPrivacy,
DateUtil dateUtil) {
super(pluginDescription, pumpType, injector, resourceHelper, aapsLogger, commandQueue, rxBus, activePlugin, sp, context, fabricPrivacy, dateUtil);
// this.rileyLinkUtil = rileyLinkUtil;
// this.medtronicUtil = medtronicUtil;
// this.sp = sp;
// this.medtronicPumpStatus = medtronicPumpStatus;
// this.medtronicHistoryData = medtronicHistoryData;
// this.rileyLinkServiceData = rileyLinkServiceData;
// this.serviceTaskExecutor = serviceTaskExecutor;
}
public PodStateManager getPodStateManager() {
return podStateManager;
}
@ -566,26 +511,15 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
}
}
public void setIsBusy(boolean isBusy_) {
isBusy = isBusy_;
public void setIsBusy(boolean isBusy) {
this.isBusy = isBusy;
}
private void getPodPumpStatus() {
// TODO read pod status
aapsLogger.error(LTag.PUMP, "getPodPumpStatus() NOT IMPLEMENTED");
//addPodStatusRequest(OmnipodStatusRequest.GetPodState);
//getPodPumpStatusObject().driverState = OmnipodDriverState.Initalized_PodAvailable;
//driverState = OmnipodDriverState.Initalized_PodAvailable;
// FIXME this does not seem to make sense
omnipodUtil.setDriverState(OmnipodDriverState.Initalized_PodAttached);
// we would probably need to read Basal Profile here too
}
List<OmnipodStatusRequest> omnipodStatusRequestList = new ArrayList<>();
public void addPodStatusRequest(OmnipodStatusRequest pumpStatusRequest) {
@ -596,12 +530,6 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
}
}
@Override
public void setDriverState(OmnipodDriverState state) {
//this.driverState = state;
}
public void resetStatusState() {
firstRun = true;
isRefresh = true;
@ -625,29 +553,14 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
if (podStateManager.isPodInitialized()) {
aapsLogger.debug(LTag.PUMP, "PodStateManager (saved): " + podStateManager);
if (!isRefresh) {
pumpState = PumpDriverState.Initialized;
}
// TODO handle if session state too old
getPodPumpStatus();
} else {
aapsLogger.debug(LTag.PUMP, "No Pod running");
omnipodUtil.setDriverState(OmnipodDriverState.Initalized_NoPod);
}
finishAction("Omnipod Pump");
if (!sentIdToFirebase) {
Bundle params = new Bundle();
params.putString("version", BuildConfig.VERSION);
getFabricPrivacy().getFirebaseAnalytics().logEvent("OmnipodPumpInit", params);
sentIdToFirebase = true;
}
isInitialized = true;
this.firstRun = false;
@ -917,7 +830,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
return new PumpEnactResult(getInjector()) //
.success(true) //
.enacted(false) //
.comment(resourceHelper.gs(R.string.medtronic_cmd_basal_profile_not_set_is_same));
.comment(resourceHelper.gs(R.string.omnipod_cmd_basal_profile_not_set_is_same));
}
setRefreshButtonEnabled(false);
@ -952,7 +865,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
protected List<CustomAction> customActions = null;
private CustomAction customActionResetRLConfig = new CustomAction(
R.string.medtronic_custom_action_reset_rileylink, OmnipodCustomActionType.ResetRileyLinkConfiguration, true);
R.string.omnipod_custom_action_reset_rileylink, OmnipodCustomActionType.ResetRileyLinkConfiguration, true);
@Override
@ -988,11 +901,9 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
public void timezoneOrDSTChanged(TimeChangeType timeChangeType) {
aapsLogger.warn(LTag.PUMP, getLogPrefix() + "Time, Date and/or TimeZone changed. [changeType=" + timeChangeType.name() + ", eventHandlingEnabled=" + omnipodPumpStatus.timeChangeEventEnabled + "]");
if (omnipodUtil.getDriverState() == OmnipodDriverState.Initalized_PodAttached) {
if (omnipodPumpStatus.timeChangeEventEnabled) {
aapsLogger.info(LTag.PUMP, getLogPrefix() + "Time,and/or TimeZone changed event received and will be consumed by driver.");
this.hasTimeDateOrTimeZoneChanged = true;
}
if (omnipodPumpStatus.timeChangeEventEnabled && podStateManager.isPodRunning()) {
aapsLogger.info(LTag.PUMP, getLogPrefix() + "Time,and/or TimeZone changed event received and will be consumed by driver.");
this.hasTimeDateOrTimeZoneChanged = true;
}
}

View file

@ -1,10 +1,10 @@
package info.nightscout.androidaps.plugins.pump.omnipod.comm.action;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationManager;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.ActionInitializationException;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command.GetStatusCommand;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.StatusResponse;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInfoType;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.ActionInitializationException;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodStateManager;
public class GetStatusAction implements OmnipodAction<StatusResponse> {

View file

@ -11,7 +11,7 @@ public class CommunicationException extends OmnipodException {
}
public CommunicationException(Type type, Throwable cause) {
super(type.getDescription() + ": "+ cause, cause, false);
super(type.getDescription() + ": " + cause, cause, false);
this.type = type;
}

View file

@ -7,7 +7,7 @@ public class IllegalMessageAddressException extends OmnipodException {
private final int actual;
public IllegalMessageAddressException(int expected, int actual) {
super("Invalid message address. Expected="+ expected +", actual="+ actual, false);
super("Invalid message address. Expected=" + expected + ", actual=" + actual, false);
this.expected = expected;
this.actual = actual;
}

View file

@ -7,7 +7,7 @@ public class IllegalMessageSequenceNumberException extends OmnipodException {
private final int actual;
public IllegalMessageSequenceNumberException(int expected, int actual) {
super("Invalid message sequence number. Expected="+ expected +", actual="+ actual, false);
super("Invalid message sequence number. Expected=" + expected + ", actual=" + actual, false);
this.expected = expected;
this.actual = actual;
}

View file

@ -4,6 +4,6 @@ import info.nightscout.androidaps.plugins.pump.omnipod.exception.OmnipodExceptio
public class IllegalVersionResponseTypeException extends OmnipodException {
public IllegalVersionResponseTypeException(String expected, String actual) {
super("Invalid Version Response type. Expected="+ expected +", actual="+ actual, false);
super("Invalid Version Response type. Expected=" + expected + ", actual=" + actual, false);
}
}

View file

@ -4,12 +4,12 @@ import java.util.ArrayList;
import java.util.List;
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command.GetStatusCommand;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.MessageBlockType;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInfoType;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.CrcMismatchException;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.MessageDecodingException;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.NotEnoughDataException;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command.GetStatusCommand;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.MessageBlockType;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInfoType;
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmniCRC;
public class OmnipodMessage {

View file

@ -2,9 +2,9 @@ package info.nightscout.androidaps.plugins.pump.omnipod.comm.message;
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;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.CrcMismatchException;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalPacketTypeException;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PacketType;
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmniCRC;
/**

View file

@ -3,9 +3,9 @@ package info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command;
import org.joda.time.Duration;
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.CommandInitializationException;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.MessageBlock;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.MessageBlockType;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.CommandInitializationException;
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
public class BolusExtraCommand extends MessageBlock {

View file

@ -3,6 +3,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command;
import org.joda.time.Duration;
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.CommandInitializationException;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.NonceResyncableMessageBlock;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.MessageBlockType;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule.BasalDeliverySchedule;
@ -11,7 +12,6 @@ import info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule.BasalSchedu
import info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule.BolusDeliverySchedule;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule.DeliverySchedule;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule.TempBasalDeliverySchedule;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.CommandInitializationException;
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
public class SetInsulinScheduleCommand extends NonceResyncableMessageBlock {

View file

@ -6,10 +6,10 @@ import java.util.ArrayList;
import java.util.List;
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.CommandInitializationException;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.MessageBlock;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.MessageBlockType;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule.RateEntry;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.CommandInitializationException;
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
public class TempBasalExtraCommand extends MessageBlock {

View file

@ -4,7 +4,6 @@ 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;
@ -20,14 +19,14 @@ public class RLHistoryItemOmnipod extends RLHistoryItem {
public String getDescription(ResourceHelper resourceHelper) {
switch (this.source) {
case RLHistoryItemSource.RileyLink:
case RileyLink:
return "State: " + resourceHelper.gs(serviceState.getResourceId(targetDevice))
+ (this.errorCode == null ? "" : ", Error Code: " + errorCode);
case RLHistoryItemSource.MedtronicPump:
case MedtronicPump:
return resourceHelper.gs(pumpDeviceState.getResourceId());
case RLHistoryItemSource.OmnipodCommand:
case OmnipodCommand:
return omnipodCommandType.name();
default:
@ -35,6 +34,4 @@ public class RLHistoryItemOmnipod extends RLHistoryItem {
}
}
}

View file

@ -1,16 +1,9 @@
package info.nightscout.androidaps.plugins.pump.omnipod.defs;
import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodDriverState;
public interface OmnipodPumpPluginInterface extends PumpInterface {
void addPodStatusRequest(OmnipodStatusRequest pumpStatusRequest);
void setDriverState(OmnipodDriverState state);
@Deprecated
RxBusWrapper getRxBus();
}

View file

@ -4,8 +4,7 @@ public enum OmnipodStatusRequest {
ResetState(OmnipodCommandType.ResetPodStatus), //
AcknowledgeAlerts(OmnipodCommandType.AcknowledgeAlerts), //
GetPodState(OmnipodCommandType.GetPodStatus), //
GetPodPulseLog(OmnipodCommandType.GetPodPulseLog)
;
GetPodPulseLog(OmnipodCommandType.GetPodPulseLog);
private OmnipodCommandType commandType;

View file

@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.defs;
import java.util.ArrayList;
import java.util.List;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.pump.omnipod.R;
public enum PodInitActionType {

View file

@ -23,17 +23,18 @@ import java.util.List;
import javax.inject.Inject;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity;
import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.db.OmnipodHistoryRecord;
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface;
import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.logging.LTag;
import info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair;
import info.nightscout.androidaps.plugins.pump.common.defs.PumpHistoryEntryGroup;
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
import info.nightscout.androidaps.plugins.pump.common.utils.ProfileUtil;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.db.PodHistory;
import info.nightscout.androidaps.plugins.pump.omnipod.R;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.db.PodHistoryEntryType;
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;
import info.nightscout.androidaps.utils.resources.ResourceHelper;
@ -42,6 +43,7 @@ public class PodHistoryActivity extends NoSplashAppCompatActivity {
@Inject AAPSLogger aapsLogger;
@Inject OmnipodUtil omnipodUtil;
@Inject ResourceHelper resourceHelper;
@Inject DatabaseHelperInterface databaseHelper;
private Spinner historyTypeSpinner;
private TextView statusView;
@ -50,8 +52,8 @@ public class PodHistoryActivity extends NoSplashAppCompatActivity {
static TypeList showingType = null;
static PumpHistoryEntryGroup selectedGroup = PumpHistoryEntryGroup.All;
List<PodHistory> fullHistoryList = new ArrayList<>();
List<PodHistory> filteredHistoryList = new ArrayList<>();
List<OmnipodHistoryRecord> fullHistoryList = new ArrayList<>();
List<OmnipodHistoryRecord> filteredHistoryList = new ArrayList<>();
RecyclerViewAdapter recyclerViewAdapter;
boolean manualChange = false;
@ -68,9 +70,9 @@ public class PodHistoryActivity extends NoSplashAppCompatActivity {
GregorianCalendar gc = new GregorianCalendar();
gc.add(Calendar.HOUR_OF_DAY, -24);
MainApp.getDbHelper().getPodHistoryFromTime(gc.getTimeInMillis(), false);
databaseHelper.getAllOmnipodHistoryRecordsFromTimestamp(gc.getTimeInMillis(), false);
fullHistoryList.addAll(MainApp.getDbHelper().getPodHistoryFromTime(gc.getTimeInMillis(), true));
fullHistoryList.addAll(databaseHelper.getAllOmnipodHistoryRecordsFromTimestamp(gc.getTimeInMillis(), true));
}
@ -83,8 +85,8 @@ public class PodHistoryActivity extends NoSplashAppCompatActivity {
if (group == PumpHistoryEntryGroup.All) {
this.filteredHistoryList.addAll(fullHistoryList);
} else {
for (PodHistory pumpHistoryEntry : fullHistoryList) {
if (pumpHistoryEntry.getPodDbEntryType().getGroup() == group) {
for (OmnipodHistoryRecord pumpHistoryEntry : fullHistoryList) {
if (PodHistoryEntryType.getByCode(pumpHistoryEntry.getPodEntryTypeCode()).getGroup() == group) {
this.filteredHistoryList.add(pumpHistoryEntry);
}
}
@ -207,14 +209,14 @@ public class PodHistoryActivity extends NoSplashAppCompatActivity {
public class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.HistoryViewHolder> {
List<PodHistory> historyList;
List<OmnipodHistoryRecord> historyList;
RecyclerViewAdapter(List<PodHistory> historyList) {
RecyclerViewAdapter(List<OmnipodHistoryRecord> historyList) {
this.historyList = historyList;
}
public void setHistoryList(List<PodHistory> historyList) {
public void setHistoryList(List<OmnipodHistoryRecord> historyList) {
this.historyList = historyList;
Collections.sort(this.historyList);
}
@ -231,21 +233,22 @@ public class PodHistoryActivity extends NoSplashAppCompatActivity {
@Override
public void onBindViewHolder(@NotNull HistoryViewHolder holder, int position) {
PodHistory record = historyList.get(position);
OmnipodHistoryRecord record = historyList.get(position);
if (record != null) {
holder.timeView.setText(record.getDateTimeString());
holder.typeView.setText(record.getPodDbEntryType().getResourceId());
holder.typeView.setText(PodHistoryEntryType.getByCode(record.getPodEntryTypeCode()).getResourceId());
setValue(record, holder.valueView);
}
}
private void setValue(PodHistory historyEntry, TextView valueView) {
private void setValue(OmnipodHistoryRecord historyEntry, TextView valueView) {
//valueView.setText("");
if (historyEntry.isSuccess()) {
switch (historyEntry.getPodDbEntryType()) {
PodHistoryEntryType entryType = PodHistoryEntryType.getByCode(historyEntry.getPodEntryTypeCode());
switch (entryType) {
case SetTemporaryBasal: {
TempBasalPair tempBasalPair = omnipodUtil.getGsonInstance().fromJson(historyEntry.getData(), TempBasalPair.class);

View file

@ -8,7 +8,6 @@ import com.atech.android.library.wizardpager.WizardPagerContext
import com.atech.android.library.wizardpager.data.WizardPagerSettings
import com.atech.android.library.wizardpager.defs.WizardStepsWayType
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
import info.nightscout.androidaps.events.EventRefreshOverview
import info.nightscout.androidaps.interfaces.CommandQueueProvider
@ -16,6 +15,7 @@ import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkServiceData
import info.nightscout.androidaps.plugins.pump.omnipod.R
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodProgressStatus
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodStateManager
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.defs.PodActionType
@ -23,7 +23,6 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.model.Full
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.model.RemovePodWizardModel
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.model.ShortInitPodWizardModel
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.pages.InitPodRefreshAction
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodDriverState
import info.nightscout.androidaps.plugins.pump.omnipod.driver.comm.AapsOmnipodManager
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodPumpValuesChanged
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil
@ -143,7 +142,6 @@ class PodManagementActivity : NoSplashAppCompatActivity() {
OKDialog.showConfirmation(this,
resourceHelper.gs(R.string.omnipod_cmd_reset_pod_desc), Thread {
AapsOmnipodManager.getInstance().resetPodStatus()
omnipodUtil.setDriverState(OmnipodDriverState.Initalized_NoPod)
refreshButtons()
})
}

View file

@ -30,8 +30,8 @@ import javax.inject.Inject;
import dagger.android.HasAndroidInjector;
import dagger.android.support.DaggerFragment;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.PumpEnactResult;
import info.nightscout.androidaps.plugins.pump.omnipod.R;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitActionType;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitReceiver;

View file

@ -14,7 +14,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitActionType;
/**
* Created by andy on 12/11/2019
*
* <p>
* This page is for InitPod and RemovePod, but Fragments called for this 2 actions are different
*/
public class InitActionPage extends Page {

View file

@ -5,7 +5,7 @@ import android.content.Context;
import com.atech.android.library.wizardpager.model.DisplayTextPage;
import com.tech.freak.wizardpager.model.PageList;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.pump.omnipod.R;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitActionType;
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.initpod.InitActionPage;

View file

@ -24,7 +24,7 @@ import com.atech.android.library.wizardpager.model.DisplayTextPage;
import com.tech.freak.wizardpager.model.AbstractWizardModel;
import com.tech.freak.wizardpager.model.PageList;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.pump.omnipod.R;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitActionType;
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.pages.PodInfoFragment;
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.removepod.RemovePodActionPage;

View file

@ -5,7 +5,7 @@ import android.content.Context;
import com.atech.android.library.wizardpager.model.DisplayTextPage;
import com.tech.freak.wizardpager.model.PageList;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.pump.omnipod.R;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitActionType;
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.initpod.InitActionPage;

View file

@ -9,17 +9,15 @@ import org.json.JSONObject;
import javax.inject.Inject;
import dagger.android.HasAndroidInjector;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.db.CareportalEvent;
import info.nightscout.androidaps.db.Source;
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;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodStateManager;
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.PodManagementActivity;
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.defs.PodActionType;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodDriverState;
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;
import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.sharedPreferences.SP;
@ -32,11 +30,11 @@ public class InitPodRefreshAction extends AbstractCancelAction implements Finish
private PodManagementActivity podManagementActivity;
private PodActionType actionType;
@Inject OmnipodUtil omnipodUtil;
@Inject PodStateManager podStateManager;
@Inject AAPSLogger aapsLogger;
@Inject SP sp;
@Inject NSUpload nsUpload;
@Inject DatabaseHelperInterface databaseHelper;
public InitPodRefreshAction(HasAndroidInjector injector, PodManagementActivity podManagementActivity, PodActionType actionType) {
injector.androidInjector().inject(this);
@ -60,21 +58,17 @@ public class InitPodRefreshAction extends AbstractCancelAction implements Finish
@Override
public void execute() {
if (actionType == PodActionType.InitPod) {
if (!podStateManager.isPodRunning()) {
omnipodUtil.setDriverState(OmnipodDriverState.Initalized_PodInitializing);
} else {
omnipodUtil.setDriverState(OmnipodDriverState.Initalized_PodAttached);
if (podStateManager.isPodRunning()) {
uploadCareportalEvent(System.currentTimeMillis(), CareportalEvent.SITECHANGE);
}
} else {
omnipodUtil.setDriverState(OmnipodDriverState.Initalized_NoPod);
}
// TODO do this in PodManagerMentActivity itself by listening to OmnipodPumpValuesChanged events
podManagementActivity.refreshButtons();
}
private void uploadCareportalEvent(long date, String event) {
if (MainApp.getDbHelper().getCareportalEventFromTimestamp(date) != null)
if (databaseHelper.getCareportalEventFromTimestamp(date) != null)
return;
try {
JSONObject data = new JSONObject();
@ -87,7 +81,7 @@ public class InitPodRefreshAction extends AbstractCancelAction implements Finish
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(LTag.PUMPCOMM, "Unhandled exception when uploading SiteChange event.", e);

View file

@ -21,7 +21,7 @@ import java.util.ArrayList;
import javax.inject.Inject;
import dagger.android.support.DaggerFragment;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.pump.omnipod.R;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodStateManager;
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;

View file

@ -11,7 +11,6 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.initpod.In
/**
* Created by andy on 12/11/2019
*
*/
public class RemovePodActionPage extends InitActionPage {

View file

@ -1,11 +0,0 @@
package info.nightscout.androidaps.plugins.pump.omnipod.driver;
// TODO replace with method calls on PodStateManager
public enum OmnipodDriverState {
NotInitalized, // when we start
Initalized_NoPod, // driver is initalized, but there is no pod
Initalized_PodInitializing, // driver is initalized, pod is initalizing
Initalized_PodAttached, // driver is initalized, pod is there
}

View file

@ -15,7 +15,6 @@ 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.RileyLinkTargetDevice;
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
import info.nightscout.androidaps.utils.resources.ResourceHelper;
import info.nightscout.androidaps.utils.sharedPreferences.SP;
/**
@ -27,7 +26,6 @@ public class OmnipodPumpStatus extends PumpStatus {
// TODO remove all fields that can also be obtained via PodStateManager
// We can probably get rid of this class altogether
private final ResourceHelper resourceHelper;
private final SP sp;
private final RileyLinkUtil rileyLinkUtil;
private final RxBusWrapper rxBus;
@ -47,9 +45,6 @@ public class OmnipodPumpStatus extends PumpStatus {
public String regexMac = "([\\da-fA-F]{1,2}(?:\\:|$)){6}";
public boolean ackAlertsAvailable = false;
public String ackAlertsText = null;
public boolean beepBolusEnabled = true;
public boolean beepBasalEnabled = true;
public boolean beepSMBEnabled = true;
@ -57,16 +52,13 @@ public class OmnipodPumpStatus extends PumpStatus {
public boolean podDebuggingOptionsEnabled = false;
public boolean timeChangeEventEnabled = true;
public OmnipodDriverState driverState = OmnipodDriverState.NotInitalized;
private PumpDeviceState pumpDeviceState;
@Inject
public OmnipodPumpStatus(ResourceHelper resourceHelper,
info.nightscout.androidaps.utils.sharedPreferences.SP sp,
public OmnipodPumpStatus(SP sp,
RxBusWrapper rxBus,
RileyLinkUtil rileyLinkUtil) {
super(PumpType.Insulet_Omnipod);
this.resourceHelper = resourceHelper;
this.sp = sp;
this.rxBus = rxBus;
this.rileyLinkUtil = rileyLinkUtil;
@ -139,7 +131,6 @@ public class OmnipodPumpStatus extends PumpStatus {
"rileyLinkErrorDescription='" + rileyLinkErrorDescription + '\'' +
", rileyLinkAddress='" + rileyLinkAddress + '\'' +
", inPreInit=" + inPreInit +
", currentBasal=" + currentBasal +
", tempBasalStart=" + tempBasalStart +
", tempBasalEnd=" + tempBasalEnd +
", tempBasalAmount=" + tempBasalAmount +

View file

@ -11,16 +11,16 @@ import java.util.Date;
import java.util.List;
import dagger.android.HasAndroidInjector;
import info.nightscout.androidaps.MainApp;
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.OmnipodHistoryRecord;
import info.nightscout.androidaps.db.Source;
import info.nightscout.androidaps.db.TemporaryBasal;
import info.nightscout.androidaps.events.Event;
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface;
import info.nightscout.androidaps.interfaces.TreatmentsInterface;
import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.logging.LTag;
@ -33,6 +33,7 @@ import info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair;
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
import info.nightscout.androidaps.plugins.pump.common.utils.DateTimeUtil;
import info.nightscout.androidaps.plugins.pump.omnipod.R;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationManager;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodManager;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.SetupActionResult;
@ -65,7 +66,6 @@ import info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule.BasalSchedu
import info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule.BasalScheduleEntry;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodStateManager;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.db.PodHistory;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.db.PodHistoryEntryType;
import info.nightscout.androidaps.plugins.pump.omnipod.exception.OmnipodException;
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;
@ -90,6 +90,7 @@ public class AapsOmnipodManager implements IOmnipodManager {
//TODO: remove and use injection
private static AapsOmnipodManager instance;
private DatabaseHelperInterface databaseHelper;
public static AapsOmnipodManager getInstance() {
return instance;
@ -105,7 +106,8 @@ public class AapsOmnipodManager implements IOmnipodManager {
ResourceHelper resourceHelper,
HasAndroidInjector injector,
ActivePluginProvider activePlugin,
Context context) {
Context context,
DatabaseHelperInterface databaseHelper) {
if (podStateManager == null) {
throw new IllegalArgumentException("Pod state manager can not be null");
}
@ -118,6 +120,7 @@ public class AapsOmnipodManager implements IOmnipodManager {
this.activePlugin = activePlugin;
this.pumpStatus = pumpStatus;
this.context = context;
this.databaseHelper = databaseHelper;
delegate = new OmnipodManager(aapsLogger, sp, communicationService, podStateManager);
instance = this;
@ -287,7 +290,7 @@ public class AapsOmnipodManager implements IOmnipodManager {
activePlugin.getActiveTreatments().addToHistoryTreatment(detailedBolusInfo, false);
if (podStateManager.hasFaultEvent()) {
showPodFaultErrorDialog(podStateManager.getFaultEvent().getFaultEventCode(), R.raw.urgentalarm);
showPodFaultErrorDialog(podStateManager.getFaultEvent().getFaultEventCode());
}
return new PumpEnactResult(injector).success(true).enacted(true).bolusDelivered(unitsDelivered);
@ -493,22 +496,22 @@ public class AapsOmnipodManager implements IOmnipodManager {
}
private long addToHistory(long requestTime, PodHistoryEntryType entryType, Object data, boolean success) {
PodHistory podHistory = new PodHistory(requestTime, entryType);
OmnipodHistoryRecord omnipodHistoryRecord = new OmnipodHistoryRecord(requestTime, entryType.getCode());
if (data != null) {
if (data instanceof String) {
podHistory.setData((String) data);
omnipodHistoryRecord.setData((String) data);
} else {
podHistory.setData(omnipodUtil.getGsonInstance().toJson(data));
omnipodHistoryRecord.setData(omnipodUtil.getGsonInstance().toJson(data));
}
}
podHistory.setSuccess(success);
podHistory.setPodSerial(podStateManager.hasPodState() ? String.valueOf(podStateManager.getAddress()) : "None");
omnipodHistoryRecord.setSuccess(success);
omnipodHistoryRecord.setPodSerial(podStateManager.hasPodState() ? String.valueOf(podStateManager.getAddress()) : "None");
MainApp.getDbHelper().createOrUpdate(podHistory);
databaseHelper.createOrUpdate(omnipodHistoryRecord);
return podHistory.getPumpId();
return omnipodHistoryRecord.getPumpId();
}
private void handleSetupActionResult(PodInitActionType podInitActionType, PodInitReceiver podInitReceiver, SetupActionResult res, long time, Profile profile) {
@ -571,7 +574,7 @@ public class AapsOmnipodManager implements IOmnipodManager {
comment = getStringResource(R.string.omnipod_driver_error_not_enough_data);
} else if (ex instanceof PodFaultException) {
FaultEventCode faultEventCode = ((PodFaultException) ex).getFaultEvent().getFaultEventCode();
showPodFaultErrorDialog(faultEventCode, R.raw.urgentalarm);
showPodFaultErrorDialog(faultEventCode);
comment = createPodFaultErrorMessage(faultEventCode);
} else if (ex instanceof PodReturnedErrorResponseException) {
comment = getStringResource(R.string.omnipod_driver_error_pod_returned_error_response);
@ -599,13 +602,21 @@ public class AapsOmnipodManager implements IOmnipodManager {
rxBus.send(event);
}
private void showPodFaultErrorDialog(FaultEventCode faultEventCode) {
showErrorDialog(createPodFaultErrorMessage(faultEventCode), null);
}
private void showPodFaultErrorDialog(FaultEventCode faultEventCode, Integer sound) {
showErrorDialog(createPodFaultErrorMessage(faultEventCode), sound);
}
private void showErrorDialog(String message) {
showErrorDialog(message, null);
}
private void showErrorDialog(String message, Integer sound) {
Intent intent = new Intent(context, ErrorHelperActivity.class);
intent.putExtra("soundid", sound == null ? 0 : sound);
intent.putExtra("soundid", sound);
intent.putExtra("status", message);
intent.putExtra("title", resourceHelper.gs(R.string.treatmentdeliveryerror));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

View file

@ -5,8 +5,8 @@ import androidx.annotation.StringRes;
import java.util.HashMap;
import java.util.Map;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.pump.common.defs.PumpHistoryEntryGroup;
import info.nightscout.androidaps.plugins.pump.omnipod.R;
/**
* Created by andy on 24.11.2019
@ -37,8 +37,7 @@ public enum PodHistoryEntryType {
SuspendDelivery(60, R.string.omnipod_cmd_suspend_delivery, PumpHistoryEntryGroup.Basal),
ResumeDelivery(61, R.string.omnipod_cmd_resume_delivery, PumpHistoryEntryGroup.Basal),
UnknownEntryType(99, R.string.omnipod_cmd_unknown_entry)
;
UnknownEntryType(99, R.string.omnipod_cmd_unknown_entry);
private int code;
private static Map<Integer, PodHistoryEntryType> instanceMap;
@ -48,7 +47,6 @@ public enum PodHistoryEntryType {
private PumpHistoryEntryGroup group;
static {
instanceMap = new HashMap<>();
@ -57,7 +55,6 @@ public enum PodHistoryEntryType {
}
}
PodHistoryEntryType(int code, @StringRes int resourceId) {
this.code = code;
this.resourceId = resourceId;
@ -77,6 +74,9 @@ public enum PodHistoryEntryType {
return this.group;
}
public static PodHistoryEntryType getByCode(long code) {
return getByCode((int) code);
}
public static PodHistoryEntryType getByCode(int code) {
if (instanceMap.containsKey(code)) {

View file

@ -1,8 +1,5 @@
package info.nightscout.androidaps.plugins.pump.omnipod.driver.ui;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Date;
import javax.inject.Inject;
@ -10,10 +7,8 @@ import javax.inject.Singleton;
import info.nightscout.androidaps.data.DetailedBolusInfo;
import info.nightscout.androidaps.data.PumpEnactResult;
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.omnipod.OmnipodPumpPlugin;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodPumpPluginInterface;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus;
/**
@ -22,19 +17,13 @@ import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus;
// TODO remove once OmnipodPumpStatus has been removed
@Singleton
public class OmnipodUIPostprocessor {
private static final Logger LOG = LoggerFactory.getLogger(LTag.PUMP.name());
private OmnipodPumpStatus pumpStatus;
private OmnipodPumpPluginInterface omnipodPumpPlugin;
private RxBusWrapper rxBus;
private final AAPSLogger aapsLogger;
private final OmnipodPumpStatus pumpStatus;
@Inject
public OmnipodUIPostprocessor(OmnipodPumpPlugin plugin, OmnipodPumpStatus pumpStatus) {
public OmnipodUIPostprocessor(AAPSLogger aapsLogger, OmnipodPumpStatus pumpStatus) {
this.aapsLogger = aapsLogger;
this.pumpStatus = pumpStatus;
this.omnipodPumpPlugin = plugin;
this.rxBus = plugin.getRxBus();
}
// this is mostly intended for command that return certain statuses (Remaining Insulin, ...), and
@ -42,8 +31,7 @@ public class OmnipodUIPostprocessor {
public void postProcessData(OmnipodUITask uiTask) {
switch (uiTask.commandType) {
case SetBolus: {
case SetBolus:
if (uiTask.returnData != null) {
PumpEnactResult result = uiTask.returnData;
@ -59,57 +47,18 @@ public class OmnipodUIPostprocessor {
}
}
}
}
break;
break;
case CancelTemporaryBasal: {
case CancelTemporaryBasal:
pumpStatus.tempBasalStart = 0;
pumpStatus.tempBasalEnd = 0;
pumpStatus.tempBasalAmount = null;
pumpStatus.tempBasalLength = null;
}
break;
// case PairAndPrimePod: {
// if (uiTask.returnData.success) {
// omnipodPumpPlugin.setEnableCustomAction(OmnipodCustomActionType.PairAndPrime, false);
// omnipodPumpPlugin.setEnableCustomAction(OmnipodCustomActionType.FillCanulaSetBasalProfile, true);
// }
// omnipodPumpPlugin.setEnableCustomAction(OmnipodCustomActionType.DeactivatePod, true);
// }
// break;
//
// case FillCanulaAndSetBasalProfile: {
// if (uiTask.returnData.success) {
// omnipodPumpPlugin.setEnableCustomAction(OmnipodCustomActionType.FillCanulaSetBasalProfile, false);
// }
// omnipodPumpPlugin.setEnableCustomAction(OmnipodCustomActionType.DeactivatePod, true);
// }
// break;
//
// case DeactivatePod:
// case ResetPodStatus: {
// omnipodPumpPlugin.setEnableCustomAction(OmnipodCustomActionType.PairAndPrime, true);
// omnipodPumpPlugin.setEnableCustomAction(OmnipodCustomActionType.DeactivatePod, false);
// }
// break;
break;
default:
if (isLogEnabled())
LOG.trace("Post-processing not implemented for {}.", uiTask.commandType.name());
aapsLogger.debug(LTag.PUMP, "Post-processing not implemented for {}.", uiTask.commandType.name());
}
}
private boolean isLogEnabled() {
return true; //L.isEnabled(LTag.PUMP);
}
public RxBusWrapper getRxBus() {
return this.rxBus;
}
}

View file

@ -2,4 +2,4 @@ package info.nightscout.androidaps.plugins.pump.omnipod.events
import info.nightscout.androidaps.events.Event
class EventOmnipodRefreshButtonState (val newState : Boolean): Event()
class EventOmnipodRefreshButtonState(val newState: Boolean) : Event()

View file

@ -9,7 +9,6 @@ import org.apache.commons.lang3.StringUtils;
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;
@ -21,6 +20,7 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.Rile
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.omnipod.OmnipodPumpPlugin;
import info.nightscout.androidaps.plugins.pump.omnipod.R;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationManager;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodStateManager;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus;

View file

@ -1,7 +1,7 @@
package info.nightscout.androidaps.plugins.pump.omnipod.util;
public class OmniCRC {
public static final int[] crc16lookup = new int[] {
public static final int[] crc16lookup = new int[]{
0x0000, 0x8005, 0x800f, 0x000a, 0x801b, 0x001e, 0x0014, 0x8011,
0x8033, 0x0036, 0x003c, 0x8039, 0x0028, 0x802d, 0x8027, 0x0022,
0x8063, 0x0066, 0x006c, 0x8069, 0x0078, 0x807d, 0x8077, 0x0072,

View file

@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.util;
import org.joda.time.Duration;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.pump.omnipod.R;
/**
* Created by andy on 4.8.2019

View file

@ -16,16 +16,12 @@ import java.util.List;
import javax.inject.Inject;
import javax.inject.Singleton;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.plugins.pump.omnipod.R;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.AlertSet;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.AlertSlot;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.AlertType;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodStateManager;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodDriverState;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus;
import info.nightscout.androidaps.utils.resources.ResourceHelper;
import info.nightscout.androidaps.utils.sharedPreferences.SP;
/**
* Created by andy on 4/8/19.
@ -33,39 +29,15 @@ import info.nightscout.androidaps.utils.sharedPreferences.SP;
@Singleton
public class OmnipodUtil {
private final AAPSLogger aapsLogger;
private final OmnipodPumpStatus omnipodPumpStatus;
private final ResourceHelper resourceHelper;
private final SP sp;
private Gson gsonInstance = createGson();
private OmnipodDriverState driverState = OmnipodDriverState.NotInitalized;
@Inject
public OmnipodUtil(
AAPSLogger aapsLogger,
OmnipodPumpStatus omnipodPumpStatus,
SP sp,
ResourceHelper resourceHelper
) {
this.aapsLogger = aapsLogger;
this.omnipodPumpStatus = omnipodPumpStatus;
this.sp = sp;
public OmnipodUtil(ResourceHelper resourceHelper) {
this.resourceHelper = resourceHelper;
}
public OmnipodDriverState getDriverState() {
return driverState;
}
public void setDriverState(OmnipodDriverState state) {
if (driverState == state)
return;
driverState = state;
omnipodPumpStatus.driverState = state;
}
private Gson createGson() {
GsonBuilder gsonBuilder = new GsonBuilder()
.registerTypeAdapter(DateTime.class, (JsonSerializer<DateTime>) (dateTime, typeOfSrc, context) ->
@ -84,14 +56,6 @@ public class OmnipodUtil {
return this.gsonInstance;
}
public AAPSLogger getAapsLogger() {
return this.aapsLogger;
}
public SP getSp() {
return this.sp;
}
public List<String> getTranslatedActiveAlerts(PodStateManager podStateManager) {
List<String> translatedAlerts = new ArrayList<>();
AlertSet activeAlerts = podStateManager.getActiveAlerts();

View file

@ -55,7 +55,6 @@
<string name="omnipod_error_operation_not_possible_no_profile">Operation is not possible.\n\n You need to wait few minutes, until AAPS tries to set profile for first time.</string>
<string name="omnipod_error_illegal_init_action_type">Illegal PodInitActionType: %1$s</string>
<string name="omnipod_error_pod_not_attached">No active pod.</string>
<string name="omnipod_driver_error_setup_action_verification_failed">Command verification failed.</string>
<string name="omnipod_driver_error_unexpected_exception_type">An unexpected error occurred. Please report! (type: %1$s).</string>
<string name="omnipod_driver_error_invalid_parameters">Communication failed: received invalid input parameters.</string>
@ -80,7 +79,6 @@
<string name="omnipod_cmd_deactivate_pod">Deactivate Pod</string>
<string name="omnipod_cmd_reset_pod">Reset Pod</string>
<string name="omnipod_cmd_pod_history">Pod History</string>
<string name="omnipod_cmd_set_bolus">Set Bolus</string>
<string name="omnipod_cmd_cancel_bolus">Cancel Bolus</string>
<string name="omnipod_cmd_set_tbr">Set Temporary Basal</string>
@ -95,19 +93,11 @@
<string name="omnipod_cmd_suspend_delivery">Suspend Delivery</string>
<string name="omnipod_cmd_resume_delivery">Resume Delivery</string>
<string name="omnipod_cmd_unknown_entry">Unknown Entry</string>
<string name="omnipod_cmd_bolus_value">%1$.1f U</string>
<string name="omnipod_cmd_bolus_value_with_carbs">%1$.1f U, CH=%2$.1f g</string>
<string name="omnipod_cmd_tbr_value">Rate: %1$.1f U, Duration: %2$d min</string>
<string name="omnipod_cmd_reset_pod_desc">If you press <b>OK</b>, the Pod state will be forcibly reset and you will not be able to communicate with the Pod anymore. Do this only if you can not communicate with the Pod anymore. If you can still communicate with the Pod, please use the <b>Deactivate Pod</b> option.</string>
<string name="omnipod_cmd_pod_history_na">Pod History not available at the moment.</string>
<string name="omnipod_namex" translatable="false">Omnipod</string>
<string name="omnipod_namex2" translatable="false">Omnipod</string>
<string name="omnipod_namexxx" translatable="false">Omnipod</string>
<string name="omnipod_init_pod_wizard_step1_title">Fill the Pod</string>
<string name="omnipod_init_pod_wizard_step1_desc">\nFill the new Pod with enough insulin for 3 days.\n\nListen for two beeps from the Pod during the filling process. These indicate that the minimum amount of 85U has been inserted. Be sure to completely empty the fill syringe, even after hearing the two beeps.\n\nAfter filling the Pod, please press <b>Next</b>.\n\n<b>Note:</b> do not remove the Pod\'s needle cap at this time.</string>
<string name="omnipod_init_pod_wizard_step2_title">Priming</string>
@ -116,17 +106,13 @@
<string name="omnipod_init_pod_wizard_step3_desc">\nPrepare the infusion site. Remove the Pod\'s needle cap and adhesive backing and attach the Pod to the infusion site.\n\nIf the cannula sticks out, please press <b>Cancel</b> and discard your Pod.\n\nPress <b>Next</b> to insert the cannula and begin basal delivery.</string>
<string name="omnipod_init_pod_wizard_step4_title">Inserting cannula</string>
<string name="omnipod_init_pod_wizard_step4_action_header">Trying to set initial basal schedule and insert the cannula.\n\nWhen all items are checked, you can press <b>Next</b>.</string>
<string name="omnipod_init_pod_wizard_pod_info_title">Pod Info</string>
<string name="omnipod_init_pod_wizard_pod_info_init_pod_description">\nThe Pod is now active.\n\nYour basal schedule has been programmed and the cannula has been inserted.\n\nPlease verify that the cannula has been inserted correctly and replace your Pod if you feel hasn\'t.</string>
<string name="omnipod_remove_pod_wizard_step1_title">Deactivate Pod</string>
<string name="omnipod_remove_pod_wizard_step1_desc">\nPress <b>Next</b> to deactivate the Pod.\n\n<b>Note:</b> This will suspend all insulin delivery and deactivate the Pod.</string>
<string name="omnipod_remove_pod_wizard_step2_title">Deactivating the Pod</string>
<string name="omnipod_remove_pod_wizard_step2_action_header">Deactivating the Pod.\n\nWhen all items are checked, you can press <b>Next</b>.\n\n<b>Note:</b> If deactivating continuously fails, please press <b>Cancel</b> and use the <b>Reset Pod</b> option to forcibly reset the Pod state.</string>
<string name="omnipod_init_pod_wizard_pod_info_remove_pod_description">Pod deactivated.\n\nPlease remove the Pod from your body and discard it.</string>
<string name="omnipod_init_pod_pair_pod">Pair Pod</string>
<string name="omnipod_init_pod_prime_pod">Prime Pod</string>
<string name="omnipod_init_pod_fill_cannula">Fill Cannula</string>
@ -134,7 +120,6 @@
<string name="omnipod_deactivate_pod_cancel_delivery">Cancel Delivery</string>
<string name="omnipod_deactivate_pod_deactivate_pod">Deactivate Pod</string>
<!-- Omnipod - Base -->
<string name="omnipod_dash_name" translatable="false">Omnipod Dash</string>
<string name="omnipod_dash_name_short" translatable="false">DASH</string>
@ -156,4 +141,7 @@
<string name="omnipod_pod_tid">TID</string>
<string name="omnipod_pod_fw_version">PM / PI version</string>
<string name="omnipod_errors">Errors</string>
<string name="omnipod_cmd_basal_profile_not_set_is_same">Basal profile is the same, so it will not be set again.</string>
<string name="omnipod_custom_action_reset_rileylink">Reset RileyLink Config</string>
</resources>