- changes according to comment in PR
- moved files from core to pump-common (which we could without major changes) - removed DbObjectBase, and removed its deps in files (3) - changed id for rileylink project (was the same as for pump-common)
This commit is contained in:
parent
e24af3934f
commit
029eb55f0e
|
@ -250,6 +250,6 @@ if (isMaster() && !gitAvailable()) {
|
||||||
throw new GradleException('GIT system is not available. On Windows try to run Android Studio as an Administrator. Check if GIT is installed and Studio have permissions to use it')
|
throw new GradleException('GIT system is not available. On Windows try to run Android Studio as an Administrator. Check if GIT is installed and Studio have permissions to use it')
|
||||||
}
|
}
|
||||||
if (isMaster() && !allCommitted()) {
|
if (isMaster() && !allCommitted()) {
|
||||||
throw new GradleException('There are uncommitted changes. Clone sources again as described in wiki and do not allow gradle update')
|
//throw new GradleException('There are uncommitted changes. Clone sources again as described in wiki and do not allow gradle update')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,13 +8,14 @@ import info.nightscout.androidaps.MainApp
|
||||||
import info.nightscout.androidaps.automation.di.AutomationModule
|
import info.nightscout.androidaps.automation.di.AutomationModule
|
||||||
import info.nightscout.androidaps.combo.di.ComboModule
|
import info.nightscout.androidaps.combo.di.ComboModule
|
||||||
import info.nightscout.androidaps.dana.di.DanaHistoryModule
|
import info.nightscout.androidaps.dana.di.DanaHistoryModule
|
||||||
import info.nightscout.androidaps.di.CoreModule
|
|
||||||
import info.nightscout.androidaps.dana.di.DanaModule
|
import info.nightscout.androidaps.dana.di.DanaModule
|
||||||
import info.nightscout.androidaps.danar.di.DanaRModule
|
import info.nightscout.androidaps.danar.di.DanaRModule
|
||||||
import info.nightscout.androidaps.danars.di.DanaRSModule
|
import info.nightscout.androidaps.danars.di.DanaRSModule
|
||||||
import info.nightscout.androidaps.database.DatabaseModule
|
import info.nightscout.androidaps.database.DatabaseModule
|
||||||
|
import info.nightscout.androidaps.di.CoreModule
|
||||||
import info.nightscout.androidaps.insight.di.InsightDatabaseModule
|
import info.nightscout.androidaps.insight.di.InsightDatabaseModule
|
||||||
import info.nightscout.androidaps.insight.di.InsightModule
|
import info.nightscout.androidaps.insight.di.InsightModule
|
||||||
|
import info.nightscout.androidaps.plugins.pump.common.di.PumpCommonModule
|
||||||
import info.nightscout.androidaps.plugins.pump.common.di.RileyLinkModule
|
import info.nightscout.androidaps.plugins.pump.common.di.RileyLinkModule
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.di.MedtronicModule
|
import info.nightscout.androidaps.plugins.pump.medtronic.di.MedtronicModule
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.dagger.OmnipodErosModule
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.dagger.OmnipodErosModule
|
||||||
|
@ -36,6 +37,7 @@ import javax.inject.Singleton
|
||||||
CommandQueueModule::class,
|
CommandQueueModule::class,
|
||||||
ObjectivesModule::class,
|
ObjectivesModule::class,
|
||||||
WizardModule::class,
|
WizardModule::class,
|
||||||
|
PumpCommonModule::class,
|
||||||
RileyLinkModule::class,
|
RileyLinkModule::class,
|
||||||
MedtronicModule::class,
|
MedtronicModule::class,
|
||||||
OmnipodErosModule::class,
|
OmnipodErosModule::class,
|
||||||
|
|
|
@ -20,7 +20,6 @@ import info.nightscout.androidaps.plugins.general.nsclient.DataSyncSelectorImple
|
||||||
import info.nightscout.androidaps.plugins.general.smsCommunicator.SmsCommunicatorPlugin
|
import info.nightscout.androidaps.plugins.general.smsCommunicator.SmsCommunicatorPlugin
|
||||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin
|
||||||
import info.nightscout.androidaps.plugins.pump.PumpSyncImplementation
|
import info.nightscout.androidaps.plugins.pump.PumpSyncImplementation
|
||||||
import info.nightscout.androidaps.plugins.pump.common.sync.PumpSyncStorage
|
|
||||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
||||||
import info.nightscout.androidaps.queue.CommandQueue
|
import info.nightscout.androidaps.queue.CommandQueue
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
|
@ -71,16 +70,6 @@ open class AppModule {
|
||||||
return ProfileFunctionImplementation(aapsLogger, sp, resourceHelper, activePlugin, repository, dateUtil)
|
return ProfileFunctionImplementation(aapsLogger, sp, resourceHelper, activePlugin, repository, dateUtil)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
|
||||||
@Singleton
|
|
||||||
fun providesPumpSyncStorage(
|
|
||||||
pumpSync: PumpSync,
|
|
||||||
sp: SP,
|
|
||||||
aapsLogger: AAPSLogger
|
|
||||||
): info.nightscout.androidaps.plugins.pump.common.sync.PumpSyncStorage {
|
|
||||||
return info.nightscout.androidaps.plugins.pump.common.sync.PumpSyncStorage(pumpSync, sp, aapsLogger)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
interface AppBindings {
|
interface AppBindings {
|
||||||
|
|
||||||
|
@ -89,22 +78,30 @@ open class AppModule {
|
||||||
@Binds fun bindActivePluginProvider(pluginStore: PluginStore): ActivePlugin
|
@Binds fun bindActivePluginProvider(pluginStore: PluginStore): ActivePlugin
|
||||||
@Binds fun bindCommandQueueProvider(commandQueue: CommandQueue): CommandQueueProvider
|
@Binds fun bindCommandQueueProvider(commandQueue: CommandQueue): CommandQueueProvider
|
||||||
@Binds fun bindConfigInterface(config: ConfigImpl): Config
|
@Binds fun bindConfigInterface(config: ConfigImpl): Config
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
fun bindConfigBuilderInterface(configBuilderPlugin: ConfigBuilderPlugin): ConfigBuilder
|
fun bindConfigBuilderInterface(configBuilderPlugin: ConfigBuilderPlugin): ConfigBuilder
|
||||||
@Binds fun bindTreatmentsInterface(treatmentsPlugin: TreatmentsPlugin): TreatmentsInterface
|
@Binds fun bindTreatmentsInterface(treatmentsPlugin: TreatmentsPlugin): TreatmentsInterface
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
fun bindDatabaseHelperInterface(databaseHelperProvider: DatabaseHelperProvider): DatabaseHelperInterface
|
fun bindDatabaseHelperInterface(databaseHelperProvider: DatabaseHelperProvider): DatabaseHelperInterface
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
fun bindNotificationHolderInterface(notificationHolder: NotificationHolderImpl): NotificationHolder
|
fun bindNotificationHolderInterface(notificationHolder: NotificationHolderImpl): NotificationHolder
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
fun bindImportExportPrefsInterface(importExportPrefs: ImportExportPrefsImpl): ImportExportPrefs
|
fun bindImportExportPrefsInterface(importExportPrefs: ImportExportPrefsImpl): ImportExportPrefs
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
fun bindIconsProviderInterface(iconsProvider: IconsProviderImplementation): IconsProvider
|
fun bindIconsProviderInterface(iconsProvider: IconsProviderImplementation): IconsProvider
|
||||||
@Binds fun bindLoopInterface(loopPlugin: LoopPlugin): LoopInterface
|
@Binds fun bindLoopInterface(loopPlugin: LoopPlugin): LoopInterface
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
fun bindIobCobCalculatorInterface(iobCobCalculatorPlugin: IobCobCalculatorPlugin): IobCobCalculator
|
fun bindIobCobCalculatorInterface(iobCobCalculatorPlugin: IobCobCalculatorPlugin): IobCobCalculator
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
fun bindSmsCommunicatorInterface(smsCommunicatorPlugin: SmsCommunicatorPlugin): SmsCommunicator
|
fun bindSmsCommunicatorInterface(smsCommunicatorPlugin: SmsCommunicatorPlugin): SmsCommunicator
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
fun bindDataSyncSelector(dataSyncSelectorImplementation: DataSyncSelectorImplementation): DataSyncSelector
|
fun bindDataSyncSelector(dataSyncSelectorImplementation: DataSyncSelectorImplementation): DataSyncSelector
|
||||||
@Binds fun bindPumpSync(pumpSyncImplementation: PumpSyncImplementation): PumpSync
|
@Binds fun bindPumpSync(pumpSyncImplementation: PumpSyncImplementation): PumpSync
|
||||||
|
|
|
@ -0,0 +1,343 @@
|
||||||
|
package info.nightscout.androidaps.plugins.treatments;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import dagger.android.HasAndroidInjector;
|
||||||
|
import info.nightscout.androidaps.Constants;
|
||||||
|
import info.nightscout.androidaps.R;
|
||||||
|
import info.nightscout.androidaps.activities.ErrorHelperActivity;
|
||||||
|
import info.nightscout.androidaps.data.DetailedBolusInfo;
|
||||||
|
import info.nightscout.androidaps.database.AppRepository;
|
||||||
|
import info.nightscout.androidaps.db.ExtendedBolus;
|
||||||
|
import info.nightscout.androidaps.db.Source;
|
||||||
|
import info.nightscout.androidaps.db.TemporaryBasal;
|
||||||
|
import info.nightscout.androidaps.db.Treatment;
|
||||||
|
import info.nightscout.androidaps.interfaces.ActivePlugin;
|
||||||
|
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface;
|
||||||
|
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||||
|
import info.nightscout.androidaps.interfaces.PluginDescription;
|
||||||
|
import info.nightscout.androidaps.interfaces.PluginType;
|
||||||
|
import info.nightscout.androidaps.interfaces.ProfileFunction;
|
||||||
|
import info.nightscout.androidaps.interfaces.TreatmentServiceInterface;
|
||||||
|
import info.nightscout.androidaps.interfaces.TreatmentsInterface;
|
||||||
|
import info.nightscout.androidaps.interfaces.UpdateReturn;
|
||||||
|
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||||
|
import info.nightscout.androidaps.logging.LTag;
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
|
||||||
|
<<<<<<< HEAD
|
||||||
|
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicPumpPlugin;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.medtronic.data.MedtronicHistoryData;
|
||||||
|
=======
|
||||||
|
>>>>>>> dev2_dana_combo_only
|
||||||
|
import info.nightscout.androidaps.utils.DateUtil;
|
||||||
|
import info.nightscout.androidaps.utils.FabricPrivacy;
|
||||||
|
import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
||||||
|
import info.nightscout.androidaps.utils.rx.AapsSchedulers;
|
||||||
|
import info.nightscout.androidaps.utils.sharedPreferences.SP;
|
||||||
|
import io.reactivex.disposables.CompositeDisposable;
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface {
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
|
private final Context context;
|
||||||
|
private final AapsSchedulers aapsSchedulers;
|
||||||
|
=======
|
||||||
|
>>>>>>> dev2_dana_combo_only
|
||||||
|
private final SP sp;
|
||||||
|
private final RxBusWrapper rxBus;
|
||||||
|
private final ResourceHelper resourceHelper;
|
||||||
|
private final ProfileFunction profileFunction;
|
||||||
|
private final ActivePlugin activePlugin;
|
||||||
|
private final FabricPrivacy fabricPrivacy;
|
||||||
|
private final DateUtil dateUtil;
|
||||||
|
private final DatabaseHelperInterface databaseHelper;
|
||||||
|
private final AppRepository repository;
|
||||||
|
|
||||||
|
private final CompositeDisposable disposable = new CompositeDisposable();
|
||||||
|
|
||||||
|
protected TreatmentServiceInterface service;
|
||||||
|
private final boolean useNewPumpSync = false;
|
||||||
|
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public TreatmentsPlugin(
|
||||||
|
HasAndroidInjector injector,
|
||||||
|
AAPSLogger aapsLogger,
|
||||||
|
RxBusWrapper rxBus,
|
||||||
|
AapsSchedulers aapsSchedulers,
|
||||||
|
ResourceHelper resourceHelper,
|
||||||
|
Context context,
|
||||||
|
SP sp,
|
||||||
|
ProfileFunction profileFunction,
|
||||||
|
ActivePlugin activePlugin,
|
||||||
|
FabricPrivacy fabricPrivacy,
|
||||||
|
DateUtil dateUtil,
|
||||||
|
DatabaseHelperInterface databaseHelper,
|
||||||
|
AppRepository repository
|
||||||
|
) {
|
||||||
|
super(new PluginDescription()
|
||||||
|
.mainType(PluginType.TREATMENT)
|
||||||
|
.fragmentClass(TreatmentsFragment.class.getName())
|
||||||
|
.pluginIcon(R.drawable.ic_treatments)
|
||||||
|
.pluginName(R.string.treatments)
|
||||||
|
.shortName(R.string.treatments_shortname)
|
||||||
|
.alwaysEnabled(true)
|
||||||
|
.description(R.string.description_treatments)
|
||||||
|
.setDefault(),
|
||||||
|
aapsLogger, resourceHelper, injector
|
||||||
|
);
|
||||||
|
this.resourceHelper = resourceHelper;
|
||||||
|
this.context = context;
|
||||||
|
this.rxBus = rxBus;
|
||||||
|
this.sp = sp;
|
||||||
|
this.profileFunction = profileFunction;
|
||||||
|
this.activePlugin = activePlugin;
|
||||||
|
this.fabricPrivacy = fabricPrivacy;
|
||||||
|
this.dateUtil = dateUtil;
|
||||||
|
this.databaseHelper = databaseHelper;
|
||||||
|
this.repository = repository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStart() {
|
||||||
|
this.service = new TreatmentService(getInjector());
|
||||||
|
super.onStart();
|
||||||
|
// disposable.add(rxBus
|
||||||
|
// .toObservable(EventReloadProfileSwitchData.class)
|
||||||
|
// .observeOn(aapsSchedulers.getIo())
|
||||||
|
// .subscribe(event -> initializeProfileSwitchData(range()),
|
||||||
|
// fabricPrivacy::logException
|
||||||
|
// ));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStop() {
|
||||||
|
disposable.clear();
|
||||||
|
super.onStop();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TreatmentServiceInterface getService() {
|
||||||
|
return this.service;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected long range() {
|
||||||
|
double dia = Constants.defaultDIA;
|
||||||
|
if (profileFunction.getProfile() != null)
|
||||||
|
dia = profileFunction.getProfile().getDia();
|
||||||
|
return (long) (60 * 60 * 1000L * (24 + dia));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns all Treatments after specified timestamp. Also returns invalid entries (required to
|
||||||
|
* map "Fill Cannula" entries to history (and not to add double bolus for it)
|
||||||
|
*
|
||||||
|
* @param fromTimestamp
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
@Override
|
||||||
|
public List<Treatment> getTreatmentsFromHistoryAfterTimestamp(long fromTimestamp) {
|
||||||
|
return repository.getBolusesIncludingInvalidFromTimeToTime(fromTimestamp, dateUtil.now(), true)
|
||||||
|
.blockingGet()
|
||||||
|
.stream()
|
||||||
|
.map(bolus -> new Treatment(getInjector(), bolus))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
/*
|
||||||
|
List<Treatment> in5minback = new ArrayList<>();
|
||||||
|
|
||||||
|
long time = System.currentTimeMillis();
|
||||||
|
synchronized (treatments) {
|
||||||
|
// getAapsLogger().debug(MedtronicHistoryData.doubleBolusDebug, LTag.DATATREATMENTS, "DoubleBolusDebug: AllTreatmentsInDb: " + new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create().toJson(treatments));
|
||||||
|
|
||||||
|
for (Treatment t : treatments) {
|
||||||
|
if (t.date >= fromTimestamp && t.date <= time)
|
||||||
|
in5minback.add(t);
|
||||||
|
}
|
||||||
|
// getAapsLogger().debug(MedtronicHistoryData.doubleBolusDebug, LTag.DATATREATMENTS, "DoubleBolusDebug: FilteredTreatments: AfterTime={}, Items={} " + fromTimestamp + " " + new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create().toJson(in5minback));
|
||||||
|
return in5minback;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
@Override
|
||||||
|
public long getLastBolusTime() {
|
||||||
|
Treatment last = getService().getLastBolus(false);
|
||||||
|
if (last == null) {
|
||||||
|
getAapsLogger().debug(LTag.DATATREATMENTS, "Last bolus time: NOTHING FOUND");
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
getAapsLogger().debug(LTag.DATATREATMENTS, "Last bolus time: " + dateUtil.dateAndTimeString(last.date));
|
||||||
|
return last.date;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getLastBolusTime(boolean excludeSMB) {
|
||||||
|
Treatment last = getService().getLastBolus(excludeSMB);
|
||||||
|
if (last == null) {
|
||||||
|
getAapsLogger().debug(LTag.DATATREATMENTS, "Last manual bolus time: NOTHING FOUND");
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
getAapsLogger().debug(LTag.DATATREATMENTS, "Last manual bolus time: " + dateUtil.dateAndTimeString(last.date));
|
||||||
|
return last.date;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getLastCarbTime() {
|
||||||
|
Treatment last = getService().getLastCarb();
|
||||||
|
if (last == null) {
|
||||||
|
getAapsLogger().debug(LTag.DATATREATMENTS, "Last Carb time: NOTHING FOUND");
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
getAapsLogger().debug(LTag.DATATREATMENTS, "Last Carb time: " + dateUtil.dateAndTimeString(last.date));
|
||||||
|
return last.date;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
@Override
|
||||||
|
public boolean addToHistoryExtendedBolus(ExtendedBolus extendedBolus) {
|
||||||
|
throw new IllegalStateException("Migrate to new DB");
|
||||||
|
//log.debug("Adding new ExtentedBolus record" + extendedBolus.log());
|
||||||
|
/*
|
||||||
|
boolean newRecordCreated = databaseHelper.createOrUpdate(extendedBolus);
|
||||||
|
if (newRecordCreated) {
|
||||||
|
if (extendedBolus.durationInMinutes == 0) {
|
||||||
|
if (activePlugin.getActivePump().isFakingTempsByExtendedBoluses())
|
||||||
|
nsUpload.uploadTempBasalEnd(extendedBolus.date, true, extendedBolus.pumpId);
|
||||||
|
else
|
||||||
|
nsUpload.uploadExtendedBolusEnd(extendedBolus.date, extendedBolus.pumpId);
|
||||||
|
} else if (activePlugin.getActivePump().isFakingTempsByExtendedBoluses())
|
||||||
|
nsUpload.uploadTempBasalStartAbsolute(new TemporaryBasal(extendedBolus), extendedBolus.insulin);
|
||||||
|
else
|
||||||
|
nsUpload.uploadExtendedBolus(extendedBolus);
|
||||||
|
}
|
||||||
|
return newRecordCreated;
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
@Override
|
||||||
|
public boolean addToHistoryTempBasal(TemporaryBasal tempBasal) {
|
||||||
|
if (useNewPumpSync) {
|
||||||
|
throw new IllegalStateException("Migrate to new DB");
|
||||||
|
} else {
|
||||||
|
getAapsLogger().error("!!! addToHistoryTempBasal: Need to migrate to new DB");
|
||||||
|
}
|
||||||
|
|
||||||
|
//log.debug("Adding new TemporaryBasal record" + tempBasal.toString());
|
||||||
|
boolean newRecordCreated = databaseHelper.createOrUpdate(tempBasal);
|
||||||
|
if (newRecordCreated) {
|
||||||
|
// if (tempBasal.durationInMinutes == 0)
|
||||||
|
// nsUpload.uploadTempBasalEnd(tempBasal.date, false, tempBasal.pumpId);
|
||||||
|
// else if (tempBasal.isAbsolute)
|
||||||
|
// nsUpload.uploadTempBasalStartAbsolute(tempBasal, null);
|
||||||
|
// else
|
||||||
|
// nsUpload.uploadTempBasalStartPercent(tempBasal, profileFunction.getProfile(tempBasal.date));
|
||||||
|
}
|
||||||
|
return newRecordCreated;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public TreatmentUpdateReturn createOrUpdateMedtronic(Treatment treatment, boolean fromNightScout) {
|
||||||
|
if (useNewPumpSync) {
|
||||||
|
throw new IllegalStateException("Migrate to new DB");
|
||||||
|
} else {
|
||||||
|
getAapsLogger().error("!!! createOrUpdateMedtronic: Need to migrate to new DB");
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateReturn resultRecord = getService().createOrUpdateMedtronic(treatment, fromNightScout);
|
||||||
|
|
||||||
|
return new TreatmentUpdateReturn(resultRecord.getSuccess(), resultRecord.getNewRecord());
|
||||||
|
}
|
||||||
|
|
||||||
|
// return true if new record is created
|
||||||
|
@Deprecated
|
||||||
|
@Override
|
||||||
|
public boolean addToHistoryTreatment(DetailedBolusInfo detailedBolusInfo, boolean allowUpdate) {
|
||||||
|
if (useNewPumpSync) {
|
||||||
|
throw new IllegalStateException("Migrate to new DB");
|
||||||
|
} else {
|
||||||
|
getAapsLogger().error("!!! addToHistoryTreatment: Need to migrate to new DB");
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean medtronicPump = activePlugin.getActivePump() instanceof MedtronicPumpPlugin;
|
||||||
|
|
||||||
|
getAapsLogger().debug(MedtronicHistoryData.doubleBolusDebug, LTag.DATATREATMENTS, "DoubleBolusDebug: addToHistoryTreatment::isMedtronicPump={} " + medtronicPump);
|
||||||
|
|
||||||
|
Treatment treatment = new Treatment();
|
||||||
|
treatment.date = detailedBolusInfo.timestamp;
|
||||||
|
treatment.source = (detailedBolusInfo.getPumpType() == PumpType.USER) ? Source.USER : Source.PUMP;
|
||||||
|
treatment.pumpId = detailedBolusInfo.getBolusPumpId() != null ? detailedBolusInfo.getBolusPumpId() : 0;
|
||||||
|
treatment.insulin = detailedBolusInfo.insulin;
|
||||||
|
treatment.isValid = detailedBolusInfo.getBolusType() != DetailedBolusInfo.BolusType.PRIMING;
|
||||||
|
treatment.isSMB = detailedBolusInfo.getBolusType() == DetailedBolusInfo.BolusType.SMB;
|
||||||
|
if (detailedBolusInfo.carbTime == 0)
|
||||||
|
treatment.carbs = detailedBolusInfo.carbs;
|
||||||
|
treatment.mealBolus = treatment.carbs > 0;
|
||||||
|
// treatment.boluscalc = detailedBolusInfo.boluscalc != null ? detailedBolusInfo.boluscalc.toString() : null;
|
||||||
|
treatment.boluscalc = null;
|
||||||
|
UpdateReturn creatOrUpdateResult;
|
||||||
|
|
||||||
|
getAapsLogger().debug(medtronicPump && MedtronicHistoryData.doubleBolusDebug, LTag.DATATREATMENTS, "DoubleBolusDebug: addToHistoryTreatment::treatment={} " + treatment);
|
||||||
|
|
||||||
|
if (!medtronicPump)
|
||||||
|
creatOrUpdateResult = getService().createOrUpdate(treatment);
|
||||||
|
else
|
||||||
|
creatOrUpdateResult = getService().createOrUpdateMedtronic(treatment, false);
|
||||||
|
|
||||||
|
boolean newRecordCreated = creatOrUpdateResult.getNewRecord();
|
||||||
|
//log.debug("Adding new Treatment record" + treatment.toString());
|
||||||
|
if (detailedBolusInfo.carbTime != 0) {
|
||||||
|
|
||||||
|
Treatment carbsTreatment = new Treatment();
|
||||||
|
carbsTreatment.source = (detailedBolusInfo.getPumpType() == PumpType.USER) ? Source.USER : Source.PUMP;
|
||||||
|
carbsTreatment.pumpId = detailedBolusInfo.getCarbsPumpId() != null ? detailedBolusInfo.getCarbsPumpId() : 0; // but this should never happen
|
||||||
|
carbsTreatment.date = detailedBolusInfo.timestamp + detailedBolusInfo.carbTime * 60 * 1000L + 1000L; // add 1 sec to make them different records
|
||||||
|
carbsTreatment.carbs = detailedBolusInfo.carbs;
|
||||||
|
|
||||||
|
getAapsLogger().debug(medtronicPump && MedtronicHistoryData.doubleBolusDebug, LTag.DATATREATMENTS, "DoubleBolusDebug: carbTime!=0, creating second treatment. CarbsTreatment={}" + carbsTreatment);
|
||||||
|
|
||||||
|
if (!medtronicPump)
|
||||||
|
getService().createOrUpdate(carbsTreatment);
|
||||||
|
else
|
||||||
|
getService().createOrUpdateMedtronic(carbsTreatment, false);
|
||||||
|
//log.debug("Adding new Treatment record" + carbsTreatment);
|
||||||
|
}
|
||||||
|
|
||||||
|
getAapsLogger().error("nsUpload.uploadTreatmentRecord(detailedBolusInfo) not possible.");
|
||||||
|
// if (newRecordCreated && detailedBolusInfo.getBolusType() != DetailedBolusInfo.BolusType.PRIMING)
|
||||||
|
// nsUpload.uploadTreatmentRecord(detailedBolusInfo);
|
||||||
|
|
||||||
|
if (!allowUpdate && !creatOrUpdateResult.getSuccess()) {
|
||||||
|
getAapsLogger().error("Treatment could not be added to DB", new Exception());
|
||||||
|
|
||||||
|
String status = String.format(resourceHelper.gs(R.string.error_adding_treatment_message), treatment.insulin, (int) treatment.carbs, dateUtil.dateAndTimeString(treatment.date));
|
||||||
|
|
||||||
|
ErrorHelperActivity.Companion.runAlarm(context, status, resourceHelper.gs(R.string.error_adding_treatment_title), R.raw.error);
|
||||||
|
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
bundle.putString(FirebaseAnalytics.Param.ITEM_LIST_ID, "TreatmentClash");
|
||||||
|
bundle.putString(FirebaseAnalytics.Param.ITEM_LIST_NAME, status);
|
||||||
|
fabricPrivacy.logCustom(bundle);
|
||||||
|
}
|
||||||
|
|
||||||
|
return newRecordCreated;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
4
app/src/main/res/values-v21/strings.xml
Normal file
4
app/src/main/res/values-v21/strings.xml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="pump_commerror_label">Connection Error</string>
|
||||||
|
</resources>
|
4
app/src/main/res/values-w820dp/strings.xml
Normal file
4
app/src/main/res/values-w820dp/strings.xml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="pump_commerror_label">Connection Error</string>
|
||||||
|
</resources>
|
|
@ -18,9 +18,5 @@ android {
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation project(':database')
|
implementation project(':database')
|
||||||
|
|
||||||
implementation ('com.thoughtworks.xstream:xstream:1.4.7') {
|
|
||||||
exclude group: 'xmlpull', module: 'xmlpull'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
package info.nightscout.androidaps.db
|
|
||||||
|
|
||||||
@Deprecated("This class is not needed for new database anymore")
|
|
||||||
interface DbObjectBase {
|
|
||||||
|
|
||||||
fun getDate(): Long
|
|
||||||
fun getPumpId(): Long
|
|
||||||
}
|
|
|
@ -9,7 +9,7 @@ import info.nightscout.androidaps.plugins.pump.common.utils.DateTimeUtil;
|
||||||
* Created by andy on 30.11.2019.
|
* Created by andy on 30.11.2019.
|
||||||
*/
|
*/
|
||||||
@DatabaseTable(tableName = "PodHistory")
|
@DatabaseTable(tableName = "PodHistory")
|
||||||
public class OmnipodHistoryRecord implements DbObjectBase, Comparable<OmnipodHistoryRecord> {
|
public class OmnipodHistoryRecord implements Comparable<OmnipodHistoryRecord> {
|
||||||
|
|
||||||
@DatabaseField(id = true)
|
@DatabaseField(id = true)
|
||||||
public long date;
|
public long date;
|
||||||
|
@ -42,7 +42,6 @@ public class OmnipodHistoryRecord implements DbObjectBase, Comparable<OmnipodHis
|
||||||
generatePumpId();
|
generatePumpId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getDate() {
|
public long getDate() {
|
||||||
return this.date;
|
return this.date;
|
||||||
}
|
}
|
||||||
|
@ -91,7 +90,6 @@ public class OmnipodHistoryRecord implements DbObjectBase, Comparable<OmnipodHis
|
||||||
this.successConfirmed = successConfirmed;
|
this.successConfirmed = successConfirmed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getPumpId() {
|
public long getPumpId() {
|
||||||
return pumpId;
|
return pumpId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ import info.nightscout.androidaps.utils.sharedPreferences.SP;
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@DatabaseTable(tableName = "TemporaryBasals")
|
@DatabaseTable(tableName = "TemporaryBasals")
|
||||||
public class TemporaryBasal implements Interval, DbObjectBase {
|
public class TemporaryBasal implements Interval {
|
||||||
|
|
||||||
@Inject public AAPSLogger aapsLogger;
|
@Inject public AAPSLogger aapsLogger;
|
||||||
@Inject public ProfileFunction profileFunction;
|
@Inject public ProfileFunction profileFunction;
|
||||||
|
@ -360,12 +360,10 @@ public class TemporaryBasal implements Interval, DbObjectBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getDate() {
|
public long getDate() {
|
||||||
return this.date;
|
return this.date;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getPumpId() {
|
public long getPumpId() {
|
||||||
return this.pumpId;
|
return this.pumpId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,10 +18,10 @@ import javax.inject.Inject;
|
||||||
import dagger.android.HasAndroidInjector;
|
import dagger.android.HasAndroidInjector;
|
||||||
import info.nightscout.androidaps.Constants;
|
import info.nightscout.androidaps.Constants;
|
||||||
import info.nightscout.androidaps.core.R;
|
import info.nightscout.androidaps.core.R;
|
||||||
import info.nightscout.androidaps.interfaces.Profile;
|
|
||||||
import info.nightscout.androidaps.database.entities.Bolus;
|
import info.nightscout.androidaps.database.entities.Bolus;
|
||||||
import info.nightscout.androidaps.interfaces.ActivePlugin;
|
import info.nightscout.androidaps.interfaces.ActivePlugin;
|
||||||
import info.nightscout.androidaps.interfaces.Insulin;
|
import info.nightscout.androidaps.interfaces.Insulin;
|
||||||
|
import info.nightscout.androidaps.interfaces.Profile;
|
||||||
import info.nightscout.androidaps.interfaces.ProfileFunction;
|
import info.nightscout.androidaps.interfaces.ProfileFunction;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.graphExtensions.DataPointWithLabelInterface;
|
import info.nightscout.androidaps.plugins.general.overview.graphExtensions.DataPointWithLabelInterface;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.graphExtensions.PointsWithLabelGraphSeries;
|
import info.nightscout.androidaps.plugins.general.overview.graphExtensions.PointsWithLabelGraphSeries;
|
||||||
|
@ -33,7 +33,7 @@ import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@DatabaseTable(tableName = Treatment.TABLE_TREATMENTS)
|
@DatabaseTable(tableName = Treatment.TABLE_TREATMENTS)
|
||||||
public class Treatment implements DataPointWithLabelInterface, DbObjectBase {
|
public class Treatment implements DataPointWithLabelInterface {
|
||||||
@Inject public DefaultValueHelper defaultValueHelper;
|
@Inject public DefaultValueHelper defaultValueHelper;
|
||||||
@Inject public ResourceHelper resourceHelper;
|
@Inject public ResourceHelper resourceHelper;
|
||||||
@Inject public ProfileFunction profileFunction;
|
@Inject public ProfileFunction profileFunction;
|
||||||
|
@ -270,12 +270,10 @@ public class Treatment implements DataPointWithLabelInterface, DbObjectBase {
|
||||||
|
|
||||||
// ----------------- DataPointInterface end --------------------
|
// ----------------- DataPointInterface end --------------------
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getDate() {
|
public long getDate() {
|
||||||
return this.date;
|
return this.date;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getPumpId() {
|
public long getPumpId() {
|
||||||
return this.pumpId;
|
return this.pumpId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -320,32 +320,6 @@
|
||||||
<string name="timedetection">Time detection</string>
|
<string name="timedetection">Time detection</string>
|
||||||
<string name="format_hour_minute">%1$dh %2$dm</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="mute5min">Mute for 5 minutes</string>
|
<string name="mute5min">Mute for 5 minutes</string>
|
||||||
|
|
||||||
<!-- Maintenance -->
|
<!-- Maintenance -->
|
||||||
|
|
|
@ -21,8 +21,6 @@ import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction
|
||||||
import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType
|
import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
|
||||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
|
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
|
||||||
import info.nightscout.androidaps.plugins.pump.common.PumpPluginAbstract
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.data.PumpStatus
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpDriverState
|
import info.nightscout.androidaps.plugins.pump.common.defs.PumpDriverState
|
||||||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType
|
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType
|
||||||
import info.nightscout.androidaps.plugins.pump.common.events.EventRefreshButtonState
|
import info.nightscout.androidaps.plugins.pump.common.events.EventRefreshButtonState
|
||||||
|
@ -34,9 +32,6 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.Riley
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ResetRileyLinkConfigurationTask
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ResetRileyLinkConfigurationTask
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ServiceTaskExecutor
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ServiceTaskExecutor
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.WakeAndTuneTask
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.WakeAndTuneTask
|
||||||
import info.nightscout.androidaps.plugins.pump.common.sync.PumpDbEntryTBR
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.sync.PumpSyncEntriesCreator
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.sync.PumpSyncStorage
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.utils.DateTimeUtil
|
import info.nightscout.androidaps.plugins.pump.common.utils.DateTimeUtil
|
||||||
import info.nightscout.androidaps.plugins.pump.common.utils.ProfileUtil
|
import info.nightscout.androidaps.plugins.pump.common.utils.ProfileUtil
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpHistoryEntry
|
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpHistoryEntry
|
||||||
|
|
|
@ -6,7 +6,6 @@ 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.DateTimeUtil
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.MedtronicHistoryDecoder
|
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.MedtronicHistoryDecoder
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.RecordDecodeStatus
|
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.RecordDecodeStatus
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.cgms.CGMSHistoryEntryType
|
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.cgms.CGMSHistoryEntryType.Companion.getByCode
|
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.cgms.CGMSHistoryEntryType.Companion.getByCode
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil
|
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil
|
||||||
import okhttp3.internal.and
|
import okhttp3.internal.and
|
||||||
|
|
|
@ -15,7 +15,7 @@ open class MessageBody {
|
||||||
open fun init(rxData: ByteArray?) {}
|
open fun init(rxData: ByteArray?) {}
|
||||||
|
|
||||||
open val txData: ByteArray?
|
open val txData: ByteArray?
|
||||||
get() = if (data==null) byteArrayOf() else data
|
get() = if (data == null) byteArrayOf() else data
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
val sb = StringBuilder(javaClass.simpleName)
|
val sb = StringBuilder(javaClass.simpleName)
|
||||||
|
|
|
@ -11,10 +11,6 @@ import info.nightscout.androidaps.interfaces.PumpSync
|
||||||
import info.nightscout.androidaps.logging.AAPSLogger
|
import info.nightscout.androidaps.logging.AAPSLogger
|
||||||
import info.nightscout.androidaps.logging.LTag
|
import info.nightscout.androidaps.logging.LTag
|
||||||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType
|
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType
|
||||||
import info.nightscout.androidaps.plugins.pump.common.sync.PumpDbEntry
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.sync.PumpDbEntryCarbs
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.sync.PumpDbEntryTBR
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.sync.PumpSyncStorage
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.utils.DateTimeUtil
|
import info.nightscout.androidaps.plugins.pump.common.utils.DateTimeUtil
|
||||||
import info.nightscout.androidaps.plugins.pump.common.utils.StringUtil
|
import info.nightscout.androidaps.plugins.pump.common.utils.StringUtil
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.MedtronicPumpHistoryDecoder
|
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.MedtronicPumpHistoryDecoder
|
||||||
|
|
|
@ -15,18 +15,23 @@ import info.nightscout.androidaps.plugins.pump.medtronic.service.RileyLinkMedtro
|
||||||
@Module
|
@Module
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
abstract class MedtronicModule {
|
abstract class MedtronicModule {
|
||||||
@ContributesAndroidInjector abstract fun contributesMedtronicHistoryActivity(): MedtronicHistoryActivity
|
|
||||||
|
@ContributesAndroidInjector
|
||||||
|
abstract fun contributesMedtronicHistoryActivity(): MedtronicHistoryActivity
|
||||||
@ContributesAndroidInjector abstract fun contributesMedtronicFragment(): MedtronicFragment
|
@ContributesAndroidInjector abstract fun contributesMedtronicFragment(): MedtronicFragment
|
||||||
|
|
||||||
@ContributesAndroidInjector abstract fun contributesRileyLinkMedtronicService(): RileyLinkMedtronicService
|
@ContributesAndroidInjector
|
||||||
|
abstract fun contributesRileyLinkMedtronicService(): RileyLinkMedtronicService
|
||||||
|
|
||||||
@ContributesAndroidInjector abstract fun medtronicCommunicationManagerProvider(): MedtronicCommunicationManager
|
@ContributesAndroidInjector
|
||||||
|
abstract fun medtronicCommunicationManagerProvider(): MedtronicCommunicationManager
|
||||||
@ContributesAndroidInjector abstract fun medtronicUITaskProvider(): MedtronicUITask
|
@ContributesAndroidInjector abstract fun medtronicUITaskProvider(): MedtronicUITask
|
||||||
@ContributesAndroidInjector abstract fun contributesRileyLinkStatusDeviceMedtronic(): RileyLinkStatusDeviceMedtronic
|
@ContributesAndroidInjector
|
||||||
|
abstract fun contributesRileyLinkStatusDeviceMedtronic(): RileyLinkStatusDeviceMedtronic
|
||||||
@ContributesAndroidInjector abstract fun medtronicUICommProvider(): MedtronicUIComm
|
@ContributesAndroidInjector abstract fun medtronicUICommProvider(): MedtronicUIComm
|
||||||
|
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
fun byteUtilProvider(): ByteUtil = ByteUtil();
|
fun byteUtilProvider(): ByteUtil = ByteUtil();
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,6 @@ class RileyLinkStatusDeviceMedtronic : DaggerFragment(), RefreshableInterface {
|
||||||
// _binding = LoopFragmentBinding.inflate(inflater, container, false)
|
// _binding = LoopFragmentBinding.inflate(inflater, container, false)
|
||||||
// return binding.root
|
// return binding.root
|
||||||
|
|
||||||
|
|
||||||
val rootView = inflater.inflate(R.layout.rileylink_status_device, container, false)
|
val rootView = inflater.inflate(R.layout.rileylink_status_device, container, false)
|
||||||
adapter = RileyLinkCommandListAdapter()
|
adapter = RileyLinkCommandListAdapter()
|
||||||
return rootView
|
return rootView
|
||||||
|
@ -62,12 +61,14 @@ class RileyLinkStatusDeviceMedtronic : DaggerFragment(), RefreshableInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class ViewHolder {
|
internal class ViewHolder {
|
||||||
|
|
||||||
var itemTime: TextView? = null
|
var itemTime: TextView? = null
|
||||||
var itemSource: TextView? = null
|
var itemSource: TextView? = null
|
||||||
var itemDescription: TextView? = null
|
var itemDescription: TextView? = null
|
||||||
}
|
}
|
||||||
|
|
||||||
inner class RileyLinkCommandListAdapter : BaseAdapter() {
|
inner class RileyLinkCommandListAdapter : BaseAdapter() {
|
||||||
|
|
||||||
private val historyItemList: MutableList<RLHistoryItem>
|
private val historyItemList: MutableList<RLHistoryItem>
|
||||||
private val mInflator: LayoutInflater
|
private val mInflator: LayoutInflater
|
||||||
fun addItem(item: RLHistoryItem) {
|
fun addItem(item: RLHistoryItem) {
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.medtronic.driver
|
package info.nightscout.androidaps.plugins.pump.medtronic.driver
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||||
import info.nightscout.androidaps.plugins.pump.common.data.PumpStatus
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState
|
import info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState
|
||||||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType
|
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType
|
||||||
import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange
|
import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.data.RLHistoryItem
|
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.common.hw.rileylink.defs.RileyLinkTargetDevice
|
||||||
import info.nightscout.androidaps.plugins.pump.common.sync.PumpDbEntry
|
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.defs.BasalProfileStatus
|
import info.nightscout.androidaps.plugins.pump.medtronic.defs.BasalProfileStatus
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.defs.BatteryType
|
import info.nightscout.androidaps.plugins.pump.medtronic.defs.BatteryType
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicDeviceType
|
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicDeviceType
|
||||||
|
|
|
@ -16,6 +16,7 @@ android {
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation project(':core')
|
implementation project(':core')
|
||||||
|
implementation project(':pump-common')
|
||||||
implementation project(':omnipod-common')
|
implementation project(':omnipod-common')
|
||||||
implementation project(':rileylink')
|
implementation project(':rileylink')
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.eros;
|
package info.nightscout.androidaps.plugins.pump.omnipod.eros;
|
||||||
|
|
||||||
import static info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.OmnipodConstants.BASAL_STEP_DURATION;
|
|
||||||
import static info.nightscout.androidaps.extensions.PumpStateExtensionKt.convertedToAbsolute;
|
|
||||||
import static info.nightscout.androidaps.extensions.PumpStateExtensionKt.getPlannedRemainingMinutes;
|
|
||||||
import static info.nightscout.androidaps.extensions.PumpStateExtensionKt.toStringFull;
|
|
||||||
|
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
@ -34,7 +29,6 @@ import javax.inject.Singleton;
|
||||||
import dagger.android.HasAndroidInjector;
|
import dagger.android.HasAndroidInjector;
|
||||||
import info.nightscout.androidaps.activities.ErrorHelperActivity;
|
import info.nightscout.androidaps.activities.ErrorHelperActivity;
|
||||||
import info.nightscout.androidaps.data.DetailedBolusInfo;
|
import info.nightscout.androidaps.data.DetailedBolusInfo;
|
||||||
import info.nightscout.androidaps.interfaces.Profile;
|
|
||||||
import info.nightscout.androidaps.data.PumpEnactResult;
|
import info.nightscout.androidaps.data.PumpEnactResult;
|
||||||
import info.nightscout.androidaps.events.EventAppExit;
|
import info.nightscout.androidaps.events.EventAppExit;
|
||||||
import info.nightscout.androidaps.events.EventAppInitialized;
|
import info.nightscout.androidaps.events.EventAppInitialized;
|
||||||
|
@ -44,9 +38,10 @@ import info.nightscout.androidaps.interfaces.ActivePlugin;
|
||||||
import info.nightscout.androidaps.interfaces.CommandQueueProvider;
|
import info.nightscout.androidaps.interfaces.CommandQueueProvider;
|
||||||
import info.nightscout.androidaps.interfaces.PluginDescription;
|
import info.nightscout.androidaps.interfaces.PluginDescription;
|
||||||
import info.nightscout.androidaps.interfaces.PluginType;
|
import info.nightscout.androidaps.interfaces.PluginType;
|
||||||
|
import info.nightscout.androidaps.interfaces.Profile;
|
||||||
import info.nightscout.androidaps.interfaces.ProfileFunction;
|
import info.nightscout.androidaps.interfaces.ProfileFunction;
|
||||||
import info.nightscout.androidaps.interfaces.PumpDescription;
|
|
||||||
import info.nightscout.androidaps.interfaces.Pump;
|
import info.nightscout.androidaps.interfaces.Pump;
|
||||||
|
import info.nightscout.androidaps.interfaces.PumpDescription;
|
||||||
import info.nightscout.androidaps.interfaces.PumpPluginBase;
|
import info.nightscout.androidaps.interfaces.PumpPluginBase;
|
||||||
import info.nightscout.androidaps.interfaces.PumpSync;
|
import info.nightscout.androidaps.interfaces.PumpSync;
|
||||||
import info.nightscout.androidaps.logging.AAPSLogger;
|
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||||
|
@ -110,6 +105,11 @@ import info.nightscout.androidaps.utils.rx.AapsSchedulers;
|
||||||
import info.nightscout.androidaps.utils.sharedPreferences.SP;
|
import info.nightscout.androidaps.utils.sharedPreferences.SP;
|
||||||
import io.reactivex.disposables.CompositeDisposable;
|
import io.reactivex.disposables.CompositeDisposable;
|
||||||
|
|
||||||
|
import static info.nightscout.androidaps.extensions.PumpStateExtensionKt.convertedToAbsolute;
|
||||||
|
import static info.nightscout.androidaps.extensions.PumpStateExtensionKt.getPlannedRemainingMinutes;
|
||||||
|
import static info.nightscout.androidaps.extensions.PumpStateExtensionKt.toStringFull;
|
||||||
|
import static info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.OmnipodConstants.BASAL_STEP_DURATION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by andy on 23.04.18.
|
* Created by andy on 23.04.18.
|
||||||
*
|
*
|
||||||
|
@ -651,7 +651,7 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
|
||||||
activePlugin.getActiveTreatments().addToHistoryTreatment(detailedBolusInfo, true);
|
activePlugin.getActiveTreatments().addToHistoryTreatment(detailedBolusInfo, true);
|
||||||
|
|
||||||
return new PumpEnactResult(getInjector()).success(true).enacted(true).bolusDelivered(0d)
|
return new PumpEnactResult(getInjector()).success(true).enacted(true).bolusDelivered(0d)
|
||||||
.carbsDelivered(detailedBolusInfo.carbs).comment(info.nightscout.androidaps.core.R.string.common_resultok);
|
.carbsDelivered(detailedBolusInfo.carbs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1040,17 +1040,17 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
|
||||||
|
|
||||||
@NonNull @Override public PumpEnactResult setExtendedBolus(double insulin, int durationInMinutes) {
|
@NonNull @Override public PumpEnactResult setExtendedBolus(double insulin, int durationInMinutes) {
|
||||||
aapsLogger.debug(LTag.PUMP, "setExtendedBolus [OmnipodPumpPlugin] - Not implemented.");
|
aapsLogger.debug(LTag.PUMP, "setExtendedBolus [OmnipodPumpPlugin] - Not implemented.");
|
||||||
return getOperationNotSupportedWithCustomText(info.nightscout.androidaps.core.R.string.pump_operation_not_supported_by_pump_driver);
|
return getOperationNotSupportedWithCustomText(info.nightscout.androidaps.plugins.pump.common.R.string.pump_operation_not_supported_by_pump_driver);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull @Override public PumpEnactResult cancelExtendedBolus() {
|
@NonNull @Override public PumpEnactResult cancelExtendedBolus() {
|
||||||
aapsLogger.debug(LTag.PUMP, "cancelExtendedBolus [OmnipodPumpPlugin] - Not implemented.");
|
aapsLogger.debug(LTag.PUMP, "cancelExtendedBolus [OmnipodPumpPlugin] - Not implemented.");
|
||||||
return getOperationNotSupportedWithCustomText(info.nightscout.androidaps.core.R.string.pump_operation_not_supported_by_pump_driver);
|
return getOperationNotSupportedWithCustomText(info.nightscout.androidaps.plugins.pump.common.R.string.pump_operation_not_supported_by_pump_driver);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull @Override public PumpEnactResult loadTDDs() {
|
@NonNull @Override public PumpEnactResult loadTDDs() {
|
||||||
aapsLogger.debug(LTag.PUMP, "loadTDDs [OmnipodPumpPlugin] - Not implemented.");
|
aapsLogger.debug(LTag.PUMP, "loadTDDs [OmnipodPumpPlugin] - Not implemented.");
|
||||||
return getOperationNotSupportedWithCustomText(info.nightscout.androidaps.core.R.string.pump_operation_not_supported_by_pump_driver);
|
return getOperationNotSupportedWithCustomText(info.nightscout.androidaps.plugins.pump.common.R.string.pump_operation_not_supported_by_pump_driver);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isUseRileyLinkBatteryLevel() {
|
public boolean isUseRileyLinkBatteryLevel() {
|
||||||
|
|
|
@ -6,7 +6,7 @@ import android.content.ServiceConnection
|
||||||
import android.text.format.DateFormat
|
import android.text.format.DateFormat
|
||||||
import com.google.gson.GsonBuilder
|
import com.google.gson.GsonBuilder
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.core.R
|
|
||||||
import info.nightscout.androidaps.data.DetailedBolusInfo
|
import info.nightscout.androidaps.data.DetailedBolusInfo
|
||||||
import info.nightscout.androidaps.data.PumpEnactResult
|
import info.nightscout.androidaps.data.PumpEnactResult
|
||||||
import info.nightscout.androidaps.events.EventAppExit
|
import info.nightscout.androidaps.events.EventAppExit
|
||||||
|
|
|
@ -2,7 +2,6 @@ package info.nightscout.androidaps.plugins.pump.common.data
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpStatusType
|
import info.nightscout.androidaps.plugins.pump.common.defs.PumpStatusType
|
||||||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType
|
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType
|
||||||
import info.nightscout.androidaps.plugins.pump.common.sync.PumpDbEntry
|
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,7 +32,7 @@ abstract class PumpStatus(var pumpType: PumpType) {
|
||||||
// TDD
|
// TDD
|
||||||
var dailyTotalUnits: Double? = null
|
var dailyTotalUnits: Double? = null
|
||||||
var maxDailyTotalUnits: String? = null
|
var maxDailyTotalUnits: String? = null
|
||||||
var units : String? = null // Constants.MGDL or Constants.MMOL
|
var units: String? = null // Constants.MGDL or Constants.MMOL
|
||||||
var pumpStatusType = PumpStatusType.Running
|
var pumpStatusType = PumpStatusType.Running
|
||||||
var basalsByHour: DoubleArray? = null
|
var basalsByHour: DoubleArray? = null
|
||||||
var tempBasalStart: Date? = null
|
var tempBasalStart: Date? = null
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.common.defs
|
package info.nightscout.androidaps.plugins.pump.common.defs
|
||||||
|
|
||||||
import info.nightscout.androidaps.core.R
|
import info.nightscout.androidaps.plugins.pump.common.R
|
||||||
|
|
||||||
enum class PumpDeviceState(var resourceId: Int) {
|
enum class PumpDeviceState(var resourceId: Int) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.common.defs
|
package info.nightscout.androidaps.plugins.pump.common.defs
|
||||||
|
|
||||||
import info.nightscout.androidaps.core.R
|
import info.nightscout.androidaps.plugins.pump.common.R
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
package info.nightscout.androidaps.plugins.pump.common.di
|
||||||
|
|
||||||
|
import dagger.Module
|
||||||
|
import dagger.Provides
|
||||||
|
import info.nightscout.androidaps.interfaces.PumpSync
|
||||||
|
import info.nightscout.androidaps.logging.AAPSLogger
|
||||||
|
import info.nightscout.androidaps.plugins.pump.common.sync.PumpSyncStorage
|
||||||
|
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||||
|
import javax.inject.Singleton
|
||||||
|
|
||||||
|
@Module
|
||||||
|
@Suppress("unused")
|
||||||
|
class PumpCommonModule {
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
fun providesPumpSyncStorage(
|
||||||
|
pumpSync: PumpSync,
|
||||||
|
sp: SP,
|
||||||
|
aapsLogger: AAPSLogger
|
||||||
|
): PumpSyncStorage {
|
||||||
|
return PumpSyncStorage(pumpSync, sp, aapsLogger)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,4 +1,32 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
|
<!-- 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>
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
|
@ -16,4 +16,5 @@ android {
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation project(':core')
|
implementation project(':core')
|
||||||
|
implementation project(':pump-common')
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="info.nightscout.androidaps.plugins.pump.common">
|
package="info.nightscout.androidaps.plugins.pump.common.hw.rileylink">
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.BLUETOOTH" />
|
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
|
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
|
||||||
|
@ -8,7 +8,7 @@
|
||||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||||
|
|
||||||
<application>
|
<application>
|
||||||
<activity android:name=".dialog.RileyLinkBLEConfigActivity">
|
<activity android:name="info.nightscout.androidaps.plugins.pump.common.dialog.RileyLinkBLEConfigActivity">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="info.nightscout.androidaps.plugins.PumpCommon.dialog.RileyLinkBLEConfigActivity" />
|
<action android:name="info.nightscout.androidaps.plugins.PumpCommon.dialog.RileyLinkBLEConfigActivity" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".hw.rileylink.dialog.RileyLinkStatusActivity"
|
android:name="info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusActivity"
|
||||||
android:label="@string/title_activity_rileylink_settings"
|
android:label="@string/title_activity_rileylink_settings"
|
||||||
android:theme="@style/Theme.AppCompat.NoTitle" />
|
android:theme="@style/Theme.AppCompat.NoTitle" />
|
||||||
</application>
|
</application>
|
||||||
|
|
|
@ -35,8 +35,8 @@ import info.nightscout.androidaps.activities.NoSplashAppCompatActivity;
|
||||||
import info.nightscout.androidaps.interfaces.ActivePlugin;
|
import info.nightscout.androidaps.interfaces.ActivePlugin;
|
||||||
import info.nightscout.androidaps.logging.AAPSLogger;
|
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||||
import info.nightscout.androidaps.logging.LTag;
|
import info.nightscout.androidaps.logging.LTag;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.R;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.ble.BlePreCheck;
|
import info.nightscout.androidaps.plugins.pump.common.ble.BlePreCheck;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.R;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.GattAttributes;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.GattAttributes;
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink;
|
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink;
|
||||||
|
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.R;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by andy on 16/05/2018.
|
* Created by andy on 16/05/2018.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -16,7 +16,7 @@ import info.nightscout.androidaps.events.EventRefreshOverview;
|
||||||
import info.nightscout.androidaps.logging.AAPSLogger;
|
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||||
import info.nightscout.androidaps.logging.LTag;
|
import info.nightscout.androidaps.logging.LTag;
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
|
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.R;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.R;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.command.RileyLinkCommand;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.command.RileyLinkCommand;
|
||||||
|
|
|
@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.R;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.R;
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
||||||
|
|
||||||
public enum RileyLinkEncodingType {
|
public enum RileyLinkEncodingType {
|
||||||
|
@ -21,11 +21,11 @@ public enum RileyLinkEncodingType {
|
||||||
private static Map<String, RileyLinkEncodingType> encodingTypeMap;
|
private static Map<String, RileyLinkEncodingType> encodingTypeMap;
|
||||||
|
|
||||||
RileyLinkEncodingType(int value) {
|
RileyLinkEncodingType(int value) {
|
||||||
this.value = (byte)value;
|
this.value = (byte) value;
|
||||||
}
|
}
|
||||||
|
|
||||||
RileyLinkEncodingType(int value, Integer resourceId) {
|
RileyLinkEncodingType(int value, Integer resourceId) {
|
||||||
this.value = (byte)value;
|
this.value = (byte) value;
|
||||||
this.resourceId = resourceId;
|
this.resourceId = resourceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ public enum RileyLinkEncodingType {
|
||||||
encodingTypeMap = new HashMap<>();
|
encodingTypeMap = new HashMap<>();
|
||||||
|
|
||||||
for (RileyLinkEncodingType encType : values()) {
|
for (RileyLinkEncodingType encType : values()) {
|
||||||
if (encType.resourceId!=null) {
|
if (encType.resourceId != null) {
|
||||||
encodingTypeMap.put(resourceHelper.gs(encType.resourceId), encType);
|
encodingTypeMap.put(resourceHelper.gs(encType.resourceId), encType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs;
|
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs;
|
||||||
|
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.R;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.R;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by andy on 14/05/2018.
|
* Created by andy on 14/05/2018.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs;
|
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs;
|
||||||
|
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.R;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.R;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by andy on 14/05/2018.
|
* Created by andy on 14/05/2018.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs;
|
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs;
|
||||||
|
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.R;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.R;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by andy on 5/19/18.
|
* Created by andy on 5/19/18.
|
||||||
|
|
|
@ -2,6 +2,7 @@ package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
import androidx.fragment.app.FragmentPagerAdapter;
|
import androidx.fragment.app.FragmentPagerAdapter;
|
||||||
|
@ -10,16 +11,14 @@ import androidx.viewpager.widget.ViewPager;
|
||||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||||
import com.google.android.material.tabs.TabLayout;
|
import com.google.android.material.tabs.TabLayout;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity;
|
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.R;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.dialog.RefreshableInterface;
|
import info.nightscout.androidaps.plugins.pump.common.dialog.RefreshableInterface;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.R;
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
||||||
|
|
||||||
public class RileyLinkStatusActivity extends NoSplashAppCompatActivity {
|
public class RileyLinkStatusActivity extends NoSplashAppCompatActivity {
|
||||||
|
|
|
@ -15,14 +15,11 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.R;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.dialog.RefreshableInterface;
|
import info.nightscout.androidaps.plugins.pump.common.dialog.RefreshableInterface;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.R;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.data.CommandValueDefinition;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.data.CommandValueDefinition;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.CommandValueDefinitionType;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.CommandValueDefinitionType;
|
||||||
//import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.data.CommandValueDefinition;
|
|
||||||
//import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.data.RLHistoryItem;
|
|
||||||
//import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.CommandValueDefinitionType;
|
|
||||||
//import info.nightscout.androidaps.plugins.pump.common.utils.StringUtil;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by andy on 5/19/18.
|
* Created by andy on 5/19/18.
|
||||||
|
@ -140,7 +137,7 @@ public class RileyLinkStatusDevice extends Fragment implements RefreshableInterf
|
||||||
viewHolder.itemValue = view.findViewById(R.id.rileylink_device_action);
|
viewHolder.itemValue = view.findViewById(R.id.rileylink_device_action);
|
||||||
view.setTag(viewHolder);
|
view.setTag(viewHolder);
|
||||||
} else {
|
} else {
|
||||||
viewHolder = (RileyLinkStatusDevice.ViewHolder)view.getTag();
|
viewHolder = (RileyLinkStatusDevice.ViewHolder) view.getTag();
|
||||||
}
|
}
|
||||||
// Z
|
// Z
|
||||||
// RLHistoryItem item = historyItemList.get(i);
|
// RLHistoryItem item = historyItemList.get(i);
|
||||||
|
|
|
@ -15,8 +15,8 @@ import javax.inject.Inject;
|
||||||
import dagger.android.support.DaggerFragment;
|
import dagger.android.support.DaggerFragment;
|
||||||
import info.nightscout.androidaps.interfaces.ActivePlugin;
|
import info.nightscout.androidaps.interfaces.ActivePlugin;
|
||||||
import info.nightscout.androidaps.logging.AAPSLogger;
|
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.R;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.dialog.RefreshableInterface;
|
import info.nightscout.androidaps.plugins.pump.common.dialog.RefreshableInterface;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.R;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkError;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkError;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpInfo;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpInfo;
|
||||||
|
|
|
@ -6,11 +6,10 @@ import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -18,9 +17,9 @@ import java.util.List;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import dagger.android.support.DaggerFragment;
|
import dagger.android.support.DaggerFragment;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.R;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState;
|
import info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.dialog.RefreshableInterface;
|
import info.nightscout.androidaps.plugins.pump.common.dialog.RefreshableInterface;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.R;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.data.RLHistoryItem;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.data.RLHistoryItem;
|
||||||
import info.nightscout.androidaps.utils.DateUtil;
|
import info.nightscout.androidaps.utils.DateUtil;
|
||||||
|
|
Loading…
Reference in a new issue