insight -> lib

This commit is contained in:
Milos Kozak 2021-02-21 18:03:26 +01:00
parent 32873e0730
commit 0322dd48ac
313 changed files with 345 additions and 188 deletions

View file

@ -182,6 +182,7 @@ dependencies {
implementation project(':dana') implementation project(':dana')
implementation project(':danars') implementation project(':danars')
implementation project(':danar') implementation project(':danar')
implementation project(':insight')
implementation project(':rileylink') implementation project(':rileylink')
implementation project(':medtronic') implementation project(':medtronic')
implementation project(':omnipod-eros') implementation project(':omnipod-eros')

View file

@ -219,8 +219,6 @@
android:exported="false" /> android:exported="false" />
<service android:name=".plugins.general.persistentNotification.DummyService" /> <service android:name=".plugins.general.persistentNotification.DummyService" />
<service android:name=".plugins.pump.insight.connection_service.InsightConnectionService" />
<service android:name=".plugins.pump.insight.InsightAlertService" />
<meta-data <meta-data
android:name="io.fabric.ApiKey" android:name="io.fabric.ApiKey"
@ -236,20 +234,6 @@
android:name=".activities.SingleFragmentActivity" android:name=".activities.SingleFragmentActivity"
android:theme="@style/AppTheme" /> android:theme="@style/AppTheme" />
<activity android:name=".plugins.general.maintenance.activities.LogSettingActivity" /> <activity android:name=".plugins.general.maintenance.activities.LogSettingActivity" />
<activity
android:name=".plugins.pump.insight.activities.InsightPairingActivity"
android:label="@string/insight_pairing"
android:theme="@style/AppTheme" />
<activity
android:name=".plugins.pump.insight.activities.InsightAlertActivity"
android:label="@string/pump_alert"
android:excludeFromRecents="true"
android:launchMode="singleInstance"
android:theme="@style/InsightAlertDialog" />
<activity
android:name=".plugins.pump.insight.activities.InsightPairingInformationActivity"
android:label="@string/pairing_information"
android:theme="@style/AppTheme" />
<activity android:name=".activities.RequestDexcomPermissionActivity" /> <activity android:name=".activities.RequestDexcomPermissionActivity" />
<activity android:name=".plugins.general.smsCommunicator.activities.SmsCommunicatorOtpActivity"> <activity android:name=".plugins.general.smsCommunicator.activities.SmsCommunicatorOtpActivity">
<intent-filter> <intent-filter>

View file

@ -46,6 +46,7 @@ import info.nightscout.androidaps.events.EventReloadTreatmentData;
import info.nightscout.androidaps.events.EventTempBasalChange; import info.nightscout.androidaps.events.EventTempBasalChange;
import info.nightscout.androidaps.events.EventTempTargetChange; import info.nightscout.androidaps.events.EventTempTargetChange;
import info.nightscout.androidaps.interfaces.ActivePluginProvider; import info.nightscout.androidaps.interfaces.ActivePluginProvider;
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface;
import info.nightscout.androidaps.interfaces.ProfileInterface; import info.nightscout.androidaps.interfaces.ProfileInterface;
import info.nightscout.androidaps.interfaces.ProfileStore; import info.nightscout.androidaps.interfaces.ProfileStore;
import info.nightscout.androidaps.logging.AAPSLogger; import info.nightscout.androidaps.logging.AAPSLogger;
@ -54,9 +55,6 @@ import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload; import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
import info.nightscout.androidaps.plugins.general.openhumans.OpenHumansUploader; import info.nightscout.androidaps.plugins.general.openhumans.OpenHumansUploader;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventNewHistoryData; import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventNewHistoryData;
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.virtual.VirtualPumpPlugin; import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin;
import info.nightscout.androidaps.utils.JsonHelper; import info.nightscout.androidaps.utils.JsonHelper;
import info.nightscout.androidaps.utils.PercentageSplitter; import info.nightscout.androidaps.utils.PercentageSplitter;
@ -83,9 +81,6 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
public static final String DATABASE_DBREQUESTS = "DBRequests"; public static final String DATABASE_DBREQUESTS = "DBRequests";
public static final String DATABASE_CAREPORTALEVENTS = "CareportalEvents"; public static final String DATABASE_CAREPORTALEVENTS = "CareportalEvents";
public static final String DATABASE_TDDS = "TDDs"; public static final String DATABASE_TDDS = "TDDs";
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_OPEN_HUMANS_QUEUE = "OpenHumansQueue"; public static final String DATABASE_OPEN_HUMANS_QUEUE = "OpenHumansQueue";
private static final int DATABASE_VERSION = 13; private static final int DATABASE_VERSION = 13;
@ -138,10 +133,10 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
TableUtils.createTableIfNotExists(connectionSource, InsightPumpID.class); TableUtils.createTableIfNotExists(connectionSource, InsightPumpID.class);
TableUtils.createTableIfNotExists(connectionSource, OmnipodHistoryRecord.class); TableUtils.createTableIfNotExists(connectionSource, OmnipodHistoryRecord.class);
TableUtils.createTableIfNotExists(connectionSource, OHQueueItem.class); TableUtils.createTableIfNotExists(connectionSource, OHQueueItem.class);
database.execSQL("INSERT INTO sqlite_sequence (name, seq) SELECT \"" + DATABASE_INSIGHT_BOLUS_IDS + "\", " + System.currentTimeMillis() + " " + database.execSQL("INSERT INTO sqlite_sequence (name, seq) SELECT \"" + DatabaseHelperInterface.Companion.DATABASE_INSIGHT_BOLUS_IDS + "\", " + System.currentTimeMillis() + " " +
"WHERE NOT EXISTS (SELECT 1 FROM sqlite_sequence WHERE name = \"" + DATABASE_INSIGHT_BOLUS_IDS + "\")"); "WHERE NOT EXISTS (SELECT 1 FROM sqlite_sequence WHERE name = \"" + DatabaseHelperInterface.Companion.DATABASE_INSIGHT_BOLUS_IDS + "\")");
database.execSQL("INSERT INTO sqlite_sequence (name, seq) SELECT \"" + DATABASE_INSIGHT_PUMP_IDS + "\", " + System.currentTimeMillis() + " " + database.execSQL("INSERT INTO sqlite_sequence (name, seq) SELECT \"" + DatabaseHelperInterface.Companion.DATABASE_INSIGHT_PUMP_IDS + "\", " + System.currentTimeMillis() + " " +
"WHERE NOT EXISTS (SELECT 1 FROM sqlite_sequence WHERE name = \"" + DATABASE_INSIGHT_PUMP_IDS + "\")"); "WHERE NOT EXISTS (SELECT 1 FROM sqlite_sequence WHERE name = \"" + DatabaseHelperInterface.Companion.DATABASE_INSIGHT_PUMP_IDS + "\")");
} catch (SQLException e) { } catch (SQLException e) {
aapsLogger.error("Can't create database", e); aapsLogger.error("Can't create database", e);
throw new RuntimeException(e); throw new RuntimeException(e);
@ -169,13 +164,13 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
TableUtils.createTableIfNotExists(connectionSource, InsightHistoryOffset.class); TableUtils.createTableIfNotExists(connectionSource, InsightHistoryOffset.class);
TableUtils.createTableIfNotExists(connectionSource, InsightBolusID.class); TableUtils.createTableIfNotExists(connectionSource, InsightBolusID.class);
TableUtils.createTableIfNotExists(connectionSource, InsightPumpID.class); TableUtils.createTableIfNotExists(connectionSource, InsightPumpID.class);
database.execSQL("INSERT INTO sqlite_sequence (name, seq) SELECT \"" + DATABASE_INSIGHT_BOLUS_IDS + "\", " + System.currentTimeMillis() + " " + database.execSQL("INSERT INTO sqlite_sequence (name, seq) SELECT \"" + DatabaseHelperInterface.Companion.DATABASE_INSIGHT_BOLUS_IDS + "\", " + System.currentTimeMillis() + " " +
"WHERE NOT EXISTS (SELECT 1 FROM sqlite_sequence WHERE name = \"" + DATABASE_INSIGHT_BOLUS_IDS + "\")"); "WHERE NOT EXISTS (SELECT 1 FROM sqlite_sequence WHERE name = \"" + DatabaseHelperInterface.Companion.DATABASE_INSIGHT_BOLUS_IDS + "\")");
database.execSQL("INSERT INTO sqlite_sequence (name, seq) SELECT \"" + DATABASE_INSIGHT_PUMP_IDS + "\", " + System.currentTimeMillis() + " " + database.execSQL("INSERT INTO sqlite_sequence (name, seq) SELECT \"" + DatabaseHelperInterface.Companion.DATABASE_INSIGHT_PUMP_IDS + "\", " + System.currentTimeMillis() + " " +
"WHERE NOT EXISTS (SELECT 1 FROM sqlite_sequence WHERE name = \"" + DATABASE_INSIGHT_PUMP_IDS + "\")"); "WHERE NOT EXISTS (SELECT 1 FROM sqlite_sequence WHERE name = \"" + DatabaseHelperInterface.Companion.DATABASE_INSIGHT_PUMP_IDS + "\")");
} else if (oldVersion < 11) { } else if (oldVersion < 11) {
database.execSQL("UPDATE sqlite_sequence SET seq = " + System.currentTimeMillis() + " WHERE name = \"" + DATABASE_INSIGHT_BOLUS_IDS + "\""); database.execSQL("UPDATE sqlite_sequence SET seq = " + System.currentTimeMillis() + " WHERE name = \"" + DatabaseHelperInterface.Companion.DATABASE_INSIGHT_BOLUS_IDS + "\"");
database.execSQL("UPDATE sqlite_sequence SET seq = " + System.currentTimeMillis() + " WHERE name = \"" + DATABASE_INSIGHT_PUMP_IDS + "\""); database.execSQL("UPDATE sqlite_sequence SET seq = " + System.currentTimeMillis() + " WHERE name = \"" + DatabaseHelperInterface.Companion.DATABASE_INSIGHT_PUMP_IDS + "\"");
} }
TableUtils.createTableIfNotExists(connectionSource, OHQueueItem.class); TableUtils.createTableIfNotExists(connectionSource, OHQueueItem.class);
} catch (SQLException e) { } catch (SQLException e) {

View file

@ -108,4 +108,35 @@ public class DatabaseHelperProvider implements DatabaseHelperInterface {
return MainApp.getDbHelper().getProfileSwitchData(from, ascending); return MainApp.getDbHelper().getProfileSwitchData(from, ascending);
} }
@Override public void createOrUpdate(@NotNull InsightBolusID record) {
MainApp.getDbHelper().createOrUpdate(record);
}
@Override public void createOrUpdate(@NotNull InsightPumpID record) {
MainApp.getDbHelper().createOrUpdate(record);
}
@Override public void createOrUpdate(@NotNull InsightHistoryOffset record) {
MainApp.getDbHelper().createOrUpdate(record);
}
@Override public void delete(@NotNull ExtendedBolus extendedBolus) {
MainApp.getDbHelper().delete(extendedBolus);
}
@Nullable @Override public ExtendedBolus getExtendedBolusByPumpId(long pumpId) {
return MainApp.getDbHelper().getExtendedBolusByPumpId(pumpId);
}
@Nullable @Override public InsightBolusID getInsightBolusID(@NotNull String pumpSerial, int bolusID, long timestamp) {
return MainApp.getDbHelper().getInsightBolusID(pumpSerial, bolusID, timestamp);
}
@Nullable @Override public InsightHistoryOffset getInsightHistoryOffset(@NotNull String pumpSerial) {
return MainApp.getDbHelper().getInsightHistoryOffset(pumpSerial);
}
@Nullable @Override public InsightPumpID getPumpStoppedEvent(@NotNull String pumpSerial, long before) {
return MainApp.getDbHelper().getPumpStoppedEvent(pumpSerial, before);
}
} }

View file

@ -11,9 +11,6 @@ import info.nightscout.androidaps.plugins.general.overview.activities.QuickWizar
import info.nightscout.androidaps.plugins.general.smsCommunicator.activities.SmsCommunicatorOtpActivity import info.nightscout.androidaps.plugins.general.smsCommunicator.activities.SmsCommunicatorOtpActivity
import info.nightscout.androidaps.plugins.pump.common.dialog.RileyLinkBLEConfigActivity import info.nightscout.androidaps.plugins.pump.common.dialog.RileyLinkBLEConfigActivity
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusActivity import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusActivity
import info.nightscout.androidaps.plugins.pump.insight.activities.InsightAlertActivity
import info.nightscout.androidaps.plugins.pump.insight.activities.InsightPairingActivity
import info.nightscout.androidaps.plugins.pump.insight.activities.InsightPairingInformationActivity
import info.nightscout.androidaps.plugins.pump.medtronic.dialog.MedtronicHistoryActivity import info.nightscout.androidaps.plugins.pump.medtronic.dialog.MedtronicHistoryActivity
import info.nightscout.androidaps.setupwizard.SetupWizardActivity import info.nightscout.androidaps.setupwizard.SetupWizardActivity
@ -22,9 +19,6 @@ import info.nightscout.androidaps.setupwizard.SetupWizardActivity
abstract class ActivitiesModule { abstract class ActivitiesModule {
@ContributesAndroidInjector abstract fun contributesHistoryBrowseActivity(): HistoryBrowseActivity @ContributesAndroidInjector abstract fun contributesHistoryBrowseActivity(): HistoryBrowseActivity
@ContributesAndroidInjector abstract fun contributesInsightAlertActivity(): InsightAlertActivity
@ContributesAndroidInjector abstract fun contributesInsightPairingActivity(): InsightPairingActivity
@ContributesAndroidInjector abstract fun contributesInsightPairingInformationActivity(): InsightPairingInformationActivity
@ContributesAndroidInjector abstract fun contributesLogSettingActivity(): LogSettingActivity @ContributesAndroidInjector abstract fun contributesLogSettingActivity(): LogSettingActivity
@ContributesAndroidInjector abstract fun contributeMainActivity(): MainActivity @ContributesAndroidInjector abstract fun contributeMainActivity(): MainActivity
@ContributesAndroidInjector abstract fun contributesMedtronicHistoryActivity(): MedtronicHistoryActivity @ContributesAndroidInjector abstract fun contributesMedtronicHistoryActivity(): MedtronicHistoryActivity

View file

@ -5,10 +5,12 @@ import dagger.Component
import dagger.android.AndroidInjectionModule import dagger.android.AndroidInjectionModule
import dagger.android.AndroidInjector import dagger.android.AndroidInjector
import info.nightscout.androidaps.MainApp import info.nightscout.androidaps.MainApp
import info.nightscout.androidaps.combo.di.ComboModule
import info.nightscout.androidaps.core.di.CoreModule import info.nightscout.androidaps.core.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.danars.di.InsightModule
import info.nightscout.androidaps.database.DatabaseModule import info.nightscout.androidaps.database.DatabaseModule
import info.nightscout.androidaps.plugins.pump.common.dagger.RileyLinkModule import info.nightscout.androidaps.plugins.pump.common.dagger.RileyLinkModule
import info.nightscout.androidaps.plugins.pump.omnipod.eros.dagger.OmnipodErosModule import info.nightscout.androidaps.plugins.pump.omnipod.eros.dagger.OmnipodErosModule
@ -43,6 +45,8 @@ import javax.inject.Singleton
DanaModule::class, DanaModule::class,
DanaRModule::class, DanaRModule::class,
DanaRSModule::class, DanaRSModule::class,
ComboModule::class,
InsightModule::class,
WorkersModule::class, WorkersModule::class,
OHUploaderModule::class OHUploaderModule::class
] ]

View file

@ -30,10 +30,8 @@ import info.nightscout.androidaps.plugins.general.wear.WearFragment
import info.nightscout.androidaps.plugins.insulin.InsulinFragment import info.nightscout.androidaps.plugins.insulin.InsulinFragment
import info.nightscout.androidaps.plugins.profile.local.LocalProfileFragment import info.nightscout.androidaps.plugins.profile.local.LocalProfileFragment
import info.nightscout.androidaps.plugins.profile.ns.NSProfileFragment import info.nightscout.androidaps.plugins.profile.ns.NSProfileFragment
import info.nightscout.androidaps.plugins.pump.combo.ComboFragment
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusGeneralFragment import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusGeneralFragment
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusHistoryFragment import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusHistoryFragment
import info.nightscout.androidaps.plugins.pump.insight.LocalInsightFragment
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicFragment import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicFragment
import info.nightscout.androidaps.plugins.pump.medtronic.dialog.RileyLinkStatusDeviceMedtronic import info.nightscout.androidaps.plugins.pump.medtronic.dialog.RileyLinkStatusDeviceMedtronic
import info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.OmnipodOverviewFragment import info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.OmnipodOverviewFragment
@ -52,7 +50,6 @@ abstract class FragmentsModule {
@ContributesAndroidInjector abstract fun contributesActionsFragment(): ActionsFragment @ContributesAndroidInjector abstract fun contributesActionsFragment(): ActionsFragment
@ContributesAndroidInjector abstract fun contributesAutomationFragment(): AutomationFragment @ContributesAndroidInjector abstract fun contributesAutomationFragment(): AutomationFragment
@ContributesAndroidInjector abstract fun contributesBGSourceFragment(): BGSourceFragment @ContributesAndroidInjector abstract fun contributesBGSourceFragment(): BGSourceFragment
@ContributesAndroidInjector abstract fun contributesComboFragment(): ComboFragment
@ContributesAndroidInjector @ContributesAndroidInjector
abstract fun contributesConfigBuilderFragment(): ConfigBuilderFragment abstract fun contributesConfigBuilderFragment(): ConfigBuilderFragment
@ -64,7 +61,6 @@ abstract class FragmentsModule {
@ContributesAndroidInjector abstract fun contributesOpenAPSAMAFragment(): OpenAPSAMAFragment @ContributesAndroidInjector abstract fun contributesOpenAPSAMAFragment(): OpenAPSAMAFragment
@ContributesAndroidInjector abstract fun contributesOpenAPSSMBFragment(): OpenAPSSMBFragment @ContributesAndroidInjector abstract fun contributesOpenAPSSMBFragment(): OpenAPSSMBFragment
@ContributesAndroidInjector abstract fun contributesOverviewFragment(): OverviewFragment @ContributesAndroidInjector abstract fun contributesOverviewFragment(): OverviewFragment
@ContributesAndroidInjector abstract fun contributesLocalInsightFragment(): LocalInsightFragment
@ContributesAndroidInjector abstract fun contributesLoopFragment(): LoopFragment @ContributesAndroidInjector abstract fun contributesLoopFragment(): LoopFragment
@ContributesAndroidInjector abstract fun contributesMaintenanceFragment(): MaintenanceFragment @ContributesAndroidInjector abstract fun contributesMaintenanceFragment(): MaintenanceFragment
@ContributesAndroidInjector abstract fun contributesMedtronicFragment(): MedtronicFragment @ContributesAndroidInjector abstract fun contributesMedtronicFragment(): MedtronicFragment

View file

@ -7,8 +7,6 @@ import info.nightscout.androidaps.plugins.general.overview.notifications.Dismiss
import info.nightscout.androidaps.plugins.general.persistentNotification.DummyService import info.nightscout.androidaps.plugins.general.persistentNotification.DummyService
import info.nightscout.androidaps.plugins.general.wear.wearintegration.WatchUpdaterService import info.nightscout.androidaps.plugins.general.wear.wearintegration.WatchUpdaterService
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkService import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkService
import info.nightscout.androidaps.plugins.pump.insight.InsightAlertService
import info.nightscout.androidaps.plugins.pump.insight.connection_service.InsightConnectionService
import info.nightscout.androidaps.plugins.pump.medtronic.service.RileyLinkMedtronicService import info.nightscout.androidaps.plugins.pump.medtronic.service.RileyLinkMedtronicService
import info.nightscout.androidaps.plugins.pump.omnipod.eros.rileylink.service.RileyLinkOmnipodService import info.nightscout.androidaps.plugins.pump.omnipod.eros.rileylink.service.RileyLinkOmnipodService
import info.nightscout.androidaps.services.AlarmSoundService import info.nightscout.androidaps.services.AlarmSoundService
@ -24,8 +22,6 @@ abstract class ServicesModule {
@ContributesAndroidInjector abstract fun contributesLocationService(): LocationService @ContributesAndroidInjector abstract fun contributesLocationService(): LocationService
@ContributesAndroidInjector abstract fun contributesNSClientService(): NSClientService @ContributesAndroidInjector abstract fun contributesNSClientService(): NSClientService
@ContributesAndroidInjector abstract fun contributesWatchUpdaterService(): WatchUpdaterService @ContributesAndroidInjector abstract fun contributesWatchUpdaterService(): WatchUpdaterService
@ContributesAndroidInjector abstract fun contributesInsightAlertService(): InsightAlertService
@ContributesAndroidInjector abstract fun contributesInsightConnectionService(): InsightConnectionService
@ContributesAndroidInjector abstract fun contributesRileyLinkService(): RileyLinkService @ContributesAndroidInjector abstract fun contributesRileyLinkService(): RileyLinkService
@ContributesAndroidInjector abstract fun contributesRileyLinkMedtronicService(): RileyLinkMedtronicService @ContributesAndroidInjector abstract fun contributesRileyLinkMedtronicService(): RileyLinkMedtronicService
@ContributesAndroidInjector abstract fun contributesRileyLinkOmnipodService(): RileyLinkOmnipodService @ContributesAndroidInjector abstract fun contributesRileyLinkOmnipodService(): RileyLinkOmnipodService

View file

@ -382,7 +382,6 @@
<string name="show_queue">Show queue</string> <string name="show_queue">Show queue</string>
<string name="queue">Queue:</string> <string name="queue">Queue:</string>
<string name="status">Status:</string> <string name="status">Status:</string>
<string name="paused">Paused</string>
<string name="key_nsclientinternal_url" translatable="false">nsclientinternal_url</string> <string name="key_nsclientinternal_url" translatable="false">nsclientinternal_url</string>
<string name="key_nsclientinternal_api_secret" translatable="false">nsclientinternal_api_secret</string> <string name="key_nsclientinternal_api_secret" translatable="false">nsclientinternal_api_secret</string>
<string name="clearlog">Clear log</string> <string name="clearlog">Clear log</string>
@ -640,7 +639,6 @@
<string name="maxiobset">Maximal IOB set properly</string> <string name="maxiobset">Maximal IOB set properly</string>
<string name="hasbgdata">BG available from selected source</string> <string name="hasbgdata">BG available from selected source</string>
<string name="extendedbolusdeliveryerror">Extended bolus delivery error</string> <string name="extendedbolusdeliveryerror">Extended bolus delivery error</string>
<string name="insightpump_shortname">Sight</string>
<string name="key_enableSMB_always" translatable="false">enableSMB_always</string> <string name="key_enableSMB_always" translatable="false">enableSMB_always</string>
<string name="key_enableSMB_with_COB" translatable="false">enableSMB_with_COB</string> <string name="key_enableSMB_with_COB" translatable="false">enableSMB_with_COB</string>
<string name="key_enableSMB_with_temptarget" translatable="false">enableSMB_with_temptarget</string> <string name="key_enableSMB_with_temptarget" translatable="false">enableSMB_with_temptarget</string>
@ -752,9 +750,6 @@
<string name="key_openapssmb_max_iob" translatable="false">openapsmb_max_iob</string> <string name="key_openapssmb_max_iob" translatable="false">openapsmb_max_iob</string>
<string name="openapssmb_maxiob_title">Maximum total IOB OpenAPS can\'t go over [U]</string> <string name="openapssmb_maxiob_title">Maximum total IOB OpenAPS can\'t go over [U]</string>
<string name="openapssmb_maxiob_summary">This value is called Max IOB in OpenAPS context\nOpenAPS will not add more insulin if current IOB is greater than this value</string> <string name="openapssmb_maxiob_summary">This value is called Max IOB in OpenAPS context\nOpenAPS will not add more insulin if current IOB is greater than this value</string>
<string name="pump_stopped">Pump stopped</string>
<string name="pump_started">Pump started</string>
<string name="pump_paused">Pump paused</string>
<string name="absorption_cutoff_title">Meal max absorption time [h]</string> <string name="absorption_cutoff_title">Meal max absorption time [h]</string>
<string name="absorption_cutoff_summary">Time at which any meal is considered absorbed. Remaining carbs will be cut off.</string> <string name="absorption_cutoff_summary">Time at which any meal is considered absorbed. Remaining carbs will be cut off.</string>
<string name="time">Time</string> <string name="time">Time</string>
@ -826,7 +821,6 @@
<string name="needlocationpermission">Application needs location permission for BT scan and WiFi identification</string> <string name="needlocationpermission">Application needs location permission for BT scan and WiFi identification</string>
<string name="needstoragepermission">Application needs storage permission to be able store log files and export settings</string> <string name="needstoragepermission">Application needs storage permission to be able store log files and export settings</string>
<string name="request">Request</string> <string name="request">Request</string>
<string name="exit">Exit</string>
<string name="open_navigation">Open navigation</string> <string name="open_navigation">Open navigation</string>
<string name="close_navigation">Close navigation</string> <string name="close_navigation">Close navigation</string>
<string name="nav_plugin_preferences">Plugin preferences</string> <string name="nav_plugin_preferences">Plugin preferences</string>
@ -882,76 +876,6 @@
<string name="loop_openmode_min_change">Minimal request change [%]</string> <string name="loop_openmode_min_change">Minimal request change [%]</string>
<string name="loop_openmode_min_change_summary" formatted="false">Open Loop will popup new change request only if change is bigger than this value in %. Default value is 20%</string> <string name="loop_openmode_min_change_summary" formatted="false">Open Loop will popup new change request only if change is bigger than this value in %. Default value is 20%</string>
<string name="key_short_tabtitles" translatable="false">short_tabtitles</string> <string name="key_short_tabtitles" translatable="false">short_tabtitles</string>
<string name="searching_for_devices">Searching for devices…</string>
<string name="pairing_completed">Pairing completed</string>
<string name="code_compare">Do the codes displayed on this device and on your pump match?</string>
<string name="insight_pairing">Insight pairing</string>
<string name="insight_local">Accu-Chek Insight</string>
<string name="insight_delivered">%1$.2f U / %2$.2f U delivered</string>
<string name="insight_alert_formatter">%1$s: %2$s</string>
<string name="tube_changed">Tube changed</string>
<string name="pump_time_updated">Pump time updated</string>
<string name="confirm">Confirm</string>
<string name="mute_alert">Mute</string>
<string name="pump_alert">Pump alert</string>
<string name="log_site_changes">Log site changes</string>
<string name="log_reservoir_changes">Log reservoir changes</string>
<string name="log_tube_changes">Log tube changes</string>
<string name="log_battery_changes">Log battery changes</string>
<string name="log_operating_mode_changes">Log operating mode changes</string>
<string name="log_alerts">Log alerts</string>
<string name="enable_tbr_emulation">Enable TBR emulation</string>
<string name="enable_tbr_emulation_summary">Use extended boluses instead of TBRs to bypass the 250%% limit</string>
<string name="key_disable_vibration" translatable="false">insight_disable_vibration</string>
<string name="disable_vibration">Disable vibrations on manual bolus delivery</string>
<string name="disable_vibration_summary">For bolus and extended bolus (only available with Insight firmware 3.x)</string>
<string name="key_disable_vibration_auto" translatable="false">insight_disable_vibration_auto</string>
<string name="disable_vibration_auto">Disable vibrations on automated bolus delivery</string>
<string name="disable_vibration_auto_summary">For SMB and Temp Basal with TBR emulation (only available with Insight firmware 3.x)</string>
<string name="disconnect_delay">Disconnect delay [s]</string>
<string name="serial_number">Serial number</string>
<string name="release_software_version">Release software version</string>
<string name="ui_processor_software_version">UI processor software version</string>
<string name="pc_processor_software_version">PC processor software version</string>
<string name="md_tel_processor_software_version">MD tel processor software version</string>
<string name="safety_processor_software_version">Safety processor software version</string>
<string name="bt_info_page_version">BT info page version</string>
<string name="bluetooth_address">Bluetooth address</string>
<string name="system_id_appendix">System ID appendix</string>
<string name="manufacturing_date">Manufacturing date</string>
<string name="delete_pairing">Delete pairing</string>
<string name="pairing_information">Pairing information</string>
<string name="start_pump">Start pump</string>
<string name="stop_pump">Stop pump</string>
<string name="operating_mode">Operating mode</string>
<string name="insight_status">Status</string>
<string name="tdd_bolus">TDD Bolus</string>
<string name="tdd_basal">TDD Basal</string>
<string name="tdd_total">TDD Total</string>
<string name="recovering">Recovering</string>
<string name="not_paired">Not paired</string>
<string name="last_connected">Last connected</string>
<string name="started">Started</string>
<string name="stopped">Stopped</string>
<string name="tbr_formatter">%1$d%% for %2$d / %3$d min</string>
<string name="extended_bolus">Extended bolus</string>
<string name="multiwave_bolus">Multiwave bolus</string>
<string name="eb_formatter">%1$.2f / %2$.2f U for %3$d min</string>
<string name="enable_tbr_over_notification">Enable notification of TBR end\n(pump setting)</string>
<string name="disable_tbr_over_notification">Disable notification of TBR end\n(pump setting)</string>
<string name="description_pump_insight_local">Pump integration for Accu-Chek Insight pumps</string>
<string name="not_inserted">Not inserted</string>
<string name="short_status_last_connected">Last conn: %1$d min ago</string>
<string name="short_status_tbr">TBR: %1$d%% for %2$d / %3$d min</string>
<string name="short_status_extended">Extended: %1$.2f / %2$.2f U for %3$d min</string>
<string name="short_status_multiwave">Multiwave: %1$.2f / %2$.2f U for %3$d min</string>
<string name="short_status_tdd">TDD: %1$.2f</string>
<string name="short_status_reservoir">Reser.: %1$.2f U</string>
<string name="short_status_battery">Batt.: %1$d%%</string>
<string name="max_recovery_duration">Max. recovery duration [s]</string>
<string name="min_recovery_duration">Min. recovery duration [s]</string>
<string name="recovery_duration">Recovery duration</string>
<string name="timeout_during_handshake">Timeout during handshake - reset bluetooth</string>
<string name="weekday_sunday_short">Sun</string> <string name="weekday_sunday_short">Sun</string>
<string name="weekday_saturday_short">Sat</string> <string name="weekday_saturday_short">Sat</string>
<string name="weekday_friday_short">Fri</string> <string name="weekday_friday_short">Fri</string>
@ -1199,7 +1123,6 @@
<string name="loop_smbexecution_time_label">SMB execution time</string> <string name="loop_smbexecution_time_label">SMB execution time</string>
<string name="loop_tbrrequest_time_label">Temp basal request time</string> <string name="loop_tbrrequest_time_label">Temp basal request time</string>
<string name="loop_tbrexecution_time_label">Temp basal execution time</string> <string name="loop_tbrexecution_time_label">Temp basal execution time</string>
<string name="insight_alert_notification_channel">Insight Pump Alerts</string>
<!-- SMS Communicator & OTP Authenticator --> <!-- SMS Communicator & OTP Authenticator -->

View file

@ -16,12 +16,6 @@
<item name="dialogTitleIconTint">@color/dialog_title_icon_tint</item> <item name="dialogTitleIconTint">@color/dialog_title_icon_tint</item>
</style> </style>
<style name="InsightAlertDialog" parent="Theme.AppCompat.Dialog.MinWidth">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="section_header_label"> <style name="section_header_label">
<item name="android:layout_width">match_parent</item> <item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item> <item name="android:layout_height">wrap_content</item>

View file

@ -127,7 +127,7 @@ class ConstraintsCheckerTest : TestBaseWithProfile() {
comboPlugin = ComboPlugin(injector, aapsLogger, rxBus, resourceHelper, profileFunction, treatmentsInterface, sp, commandQueue, context, databaseHelper) comboPlugin = ComboPlugin(injector, aapsLogger, rxBus, resourceHelper, profileFunction, treatmentsInterface, sp, commandQueue, context, databaseHelper)
danaRPlugin = DanaRPlugin(injector, aapsLogger, aapsSchedulers, rxBus, context, resourceHelper, constraintChecker, activePlugin, sp, commandQueue, danaPump, dateUtil, fabricPrivacy) danaRPlugin = DanaRPlugin(injector, aapsLogger, aapsSchedulers, rxBus, context, resourceHelper, constraintChecker, activePlugin, sp, commandQueue, danaPump, dateUtil, fabricPrivacy)
danaRSPlugin = DanaRSPlugin(injector, aapsLogger, aapsSchedulers, rxBus, context, resourceHelper, constraintChecker, profileFunction, activePluginProvider, sp, commandQueue, danaPump, detailedBolusInfoStorage, fabricPrivacy, dateUtil) danaRSPlugin = DanaRSPlugin(injector, aapsLogger, aapsSchedulers, rxBus, context, resourceHelper, constraintChecker, profileFunction, activePluginProvider, sp, commandQueue, danaPump, detailedBolusInfoStorage, fabricPrivacy, dateUtil)
insightPlugin = LocalInsightPlugin(injector, aapsLogger, rxBus, resourceHelper, treatmentsInterface, sp, commandQueue, profileFunction, nsUpload, context, uploadQueue, Config(), dateUtil) insightPlugin = LocalInsightPlugin(injector, aapsLogger, rxBus, resourceHelper, treatmentsInterface, sp, commandQueue, profileFunction, nsUpload, context, uploadQueue, Config(), dateUtil, databaseHelper)
openAPSSMBPlugin = OpenAPSSMBPlugin(injector, aapsLogger, rxBus, constraintChecker, resourceHelper, profileFunction, context, activePlugin, treatmentsInterface, iobCobCalculatorPlugin, hardLimits, profiler, sp) openAPSSMBPlugin = OpenAPSSMBPlugin(injector, aapsLogger, rxBus, constraintChecker, resourceHelper, profileFunction, context, activePlugin, treatmentsInterface, iobCobCalculatorPlugin, hardLimits, profiler, sp)
openAPSAMAPlugin = OpenAPSAMAPlugin(injector, aapsLogger, rxBus, constraintChecker, resourceHelper, profileFunction, context, activePlugin, treatmentsInterface, iobCobCalculatorPlugin, hardLimits, profiler, fabricPrivacy) openAPSAMAPlugin = OpenAPSAMAPlugin(injector, aapsLogger, rxBus, constraintChecker, resourceHelper, profileFunction, context, activePlugin, treatmentsInterface, iobCobCalculatorPlugin, hardLimits, profiler, fabricPrivacy)
safetyPlugin = SafetyPlugin(injector, aapsLogger, resourceHelper, sp, rxBus, constraintChecker, openAPSAMAPlugin, openAPSSMBPlugin, sensitivityOref1Plugin, activePlugin, hardLimits, BuildHelper(Config(), loggerUtils), treatmentsInterface, Config()) safetyPlugin = SafetyPlugin(injector, aapsLogger, resourceHelper, sp, rxBus, constraintChecker, openAPSAMAPlugin, openAPSSMBPlugin, sensitivityOref1Plugin, activePlugin, hardLimits, BuildHelper(Config(), loggerUtils), treatmentsInterface, Config())

View file

@ -0,0 +1,11 @@
package info.nightscout.androidaps.danars.di
import dagger.Module
import dagger.android.ContributesAndroidInjector
import info.nightscout.androidaps.plugins.pump.combo.ComboFragment
@Module
@Suppress("unused")
abstract class ComboActivitiesModule {
@ContributesAndroidInjector abstract fun contributesComboFragment(): ComboFragment
}

View file

@ -1,7 +1,9 @@
package info.nightscout.androidaps.combo.di package info.nightscout.androidaps.combo.di
import dagger.Module import dagger.Module
import info.nightscout.androidaps.danars.di.ComboActivitiesModule
@Module(includes = [ @Module(includes = [
ComboActivitiesModule::class
]) ])
open class ComboModule open class ComboModule

View file

@ -1,11 +1,9 @@
package info.nightscout.androidaps.plugins.pump.insight.database; package info.nightscout.androidaps.db;
import com.j256.ormlite.field.DatabaseField; import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable; import com.j256.ormlite.table.DatabaseTable;
import info.nightscout.androidaps.db.DatabaseHelper; @DatabaseTable(tableName = "InsightBolusIDs")
@DatabaseTable(tableName = DatabaseHelper.DATABASE_INSIGHT_BOLUS_IDS)
public class InsightBolusID { public class InsightBolusID {
@DatabaseField(generatedId = true) @DatabaseField(generatedId = true)

View file

@ -1,11 +1,11 @@
package info.nightscout.androidaps.plugins.pump.insight.database; package info.nightscout.androidaps.db;
import com.j256.ormlite.field.DatabaseField; import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable; import com.j256.ormlite.table.DatabaseTable;
import info.nightscout.androidaps.db.DatabaseHelper; import info.nightscout.androidaps.interfaces.DatabaseHelperInterface;
@DatabaseTable(tableName = DatabaseHelper.DATABASE_INSIGHT_HISTORY_OFFSETS) @DatabaseTable(tableName = "InsightHistoryOffsets")
public class InsightHistoryOffset { public class InsightHistoryOffset {
@DatabaseField(id = true, canBeNull = false) @DatabaseField(id = true, canBeNull = false)

View file

@ -1,11 +1,9 @@
package info.nightscout.androidaps.plugins.pump.insight.database; package info.nightscout.androidaps.db;
import com.j256.ormlite.field.DatabaseField; import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable; import com.j256.ormlite.table.DatabaseTable;
import info.nightscout.androidaps.db.DatabaseHelper; @DatabaseTable(tableName = "InsightPumpIDs")
@DatabaseTable(tableName = DatabaseHelper.DATABASE_INSIGHT_PUMP_IDS)
public class InsightPumpID { public class InsightPumpID {
@DatabaseField(generatedId = true) @DatabaseField(generatedId = true)

View file

@ -8,12 +8,16 @@ interface DatabaseHelperInterface {
fun createOrUpdate(careportalEvent: CareportalEvent) fun createOrUpdate(careportalEvent: CareportalEvent)
fun createOrUpdate(record: DanaRHistoryRecord) fun createOrUpdate(record: DanaRHistoryRecord)
fun createOrUpdate(record: OmnipodHistoryRecord) fun createOrUpdate(record: OmnipodHistoryRecord)
fun createOrUpdate(record: InsightBolusID)
fun createOrUpdate(record: InsightPumpID)
fun createOrUpdate(record: InsightHistoryOffset)
fun create(record: DbRequest) fun create(record: DbRequest)
fun getDanaRHistoryRecordsByType(type: Byte): List<DanaRHistoryRecord> fun getDanaRHistoryRecordsByType(type: Byte): List<DanaRHistoryRecord>
fun getTDDs(): List<TDD> fun getTDDs(): List<TDD>
fun size(table: String): Long fun size(table: String): Long
fun deleteAllDbRequests() fun deleteAllDbRequests()
fun deleteDbRequest(id: String): Int fun deleteDbRequest(id: String): Int
fun delete(extendedBolus: ExtendedBolus)
fun deleteDbRequestbyMongoId(action: String, _id: String) fun deleteDbRequestbyMongoId(action: String, _id: String)
fun getDbRequestInterator(): CloseableIterator<DbRequest> fun getDbRequestInterator(): CloseableIterator<DbRequest>
fun roundDateToSec(date: Long): Long fun roundDateToSec(date: Long): Long
@ -26,4 +30,16 @@ interface DatabaseHelperInterface {
fun findOmnipodHistoryRecordByPumpId(pumpId: Long): OmnipodHistoryRecord? fun findOmnipodHistoryRecordByPumpId(pumpId: Long): OmnipodHistoryRecord?
fun getTDDsForLastXDays(days: Int): List<TDD> fun getTDDsForLastXDays(days: Int): List<TDD>
fun getProfileSwitchData(from: Long, ascending: Boolean): List<ProfileSwitch> fun getProfileSwitchData(from: Long, ascending: Boolean): List<ProfileSwitch>
fun getExtendedBolusByPumpId(pumpId: Long): ExtendedBolus?
fun getInsightBolusID(pumpSerial: String, bolusID: Int, timestamp: Long): InsightBolusID?
fun getInsightHistoryOffset(pumpSerial: String): InsightHistoryOffset?
fun getPumpStoppedEvent(pumpSerial: String, before: Long): InsightPumpID?
companion object {
const val DATABASE_INSIGHT_HISTORY_OFFSETS = "InsightHistoryOffsets"
const val DATABASE_INSIGHT_BOLUS_IDS = "InsightBolusIDs"
const val DATABASE_INSIGHT_PUMP_IDS = "InsightPumpIDs"
}
} }

View file

@ -5,4 +5,5 @@ import info.nightscout.androidaps.db.DbRequest;
public interface UploadQueueInterface { public interface UploadQueueInterface {
void add(DbRequest dbRequest); void add(DbRequest dbRequest);
void removeID(final String action, final String _id);
} }

View file

@ -106,6 +106,10 @@
<string name="limitingmaxiob">Limiting max IOB to %1$.1f U because of %2$s</string> <string name="limitingmaxiob">Limiting max IOB to %1$.1f U because of %2$s</string>
<string name="unsafeusage">unsafe usage</string> <string name="unsafeusage">unsafe usage</string>
<string name="pump_unreachable">Pump unreachable</string> <string name="pump_unreachable">Pump unreachable</string>
<string name="extended_bolus">Extended bolus</string>
<string name="pump_time_updated">Pump time updated</string>
<string name="exit">Exit</string>
<string name="serial_number">Serial number</string>
<!-- Constraints--> <!-- Constraints-->
<string name="limitingbasalratio">Limiting max basal rate to %1$.2f U/h because of %2$s</string> <string name="limitingbasalratio">Limiting max basal rate to %1$.2f U/h because of %2$s</string>

View file

@ -1,8 +1,6 @@
files: files:
- source: /app/src/main/res/values/strings.xml - source: /app/src/main/res/values/strings.xml
translation: /app/src/main/res/values-%android_code%/strings.xml translation: /app/src/main/res/values-%android_code%/strings.xml
- source: /app/src/main/res/values/insight_*.xml
translation: /app/src/main/res/values-%android_code%/%original_file_name%
- source: /app/src/main/res/values/exam.xml - source: /app/src/main/res/values/exam.xml
translation: /app/src/main/res/values-%android_code%/%original_file_name% translation: /app/src/main/res/values-%android_code%/%original_file_name%
- source: /app/src/main/res/values/objectives.xml - source: /app/src/main/res/values/objectives.xml
@ -27,3 +25,7 @@ files:
translation: /omnipod-eros/src/main/res/values-%android_code%/strings.xml translation: /omnipod-eros/src/main/res/values-%android_code%/strings.xml
- source: /rileylink/src/main/res/values/strings.xml - source: /rileylink/src/main/res/values/strings.xml
translation: /rileylink/src/main/res/values-%android_code%/strings.xml translation: /rileylink/src/main/res/values-%android_code%/strings.xml
- source: /insight/src/main/res/values/strings.xml
translation: /insight/src/main/res/values-%android_code%/strings.xml
- source: /insigt/src/main/res/values/insight_*.xml
translation: /insigt/src/main/res/values-%android_code%/%original_file_name%

1
insight/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/build

20
insight/build.gradle Normal file
View file

@ -0,0 +1,20 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.hiya.jacoco-android'
apply from: "${project.rootDir}/gradle/android_dependencies.gradle"
apply from: "${project.rootDir}/gradle/android_module_dependencies.gradle"
apply from: "${project.rootDir}/gradle/test_dependencies.gradle"
android {
defaultConfig {
versionCode 1
versionName "1.0"
}
}
dependencies {
implementation project(':core')
}

View file

21
insight/proguard-rules.pro vendored Normal file
View file

@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View file

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="info.nightscout.androidaps.insight">
<application>
<activity
android:name="info.nightscout.androidaps.plugins.pump.insight.activities.InsightPairingActivity"
android:label="@string/insight_pairing"
android:theme="@style/AppTheme" />
<activity
android:name="info.nightscout.androidaps.plugins.pump.insight.activities.InsightAlertActivity"
android:label="@string/pump_alert"
android:excludeFromRecents="true"
android:launchMode="singleInstance"
android:theme="@style/InsightAlertDialog" />
<activity
android:name="info.nightscout.androidaps.plugins.pump.insight.activities.InsightPairingInformationActivity"
android:label="@string/pairing_information"
android:theme="@style/AppTheme" />
<service android:name="info.nightscout.androidaps.plugins.pump.insight.connection_service.InsightConnectionService" />
<service android:name="info.nightscout.androidaps.plugins.pump.insight.InsightAlertService" />
</application>
</manifest>

View file

@ -0,0 +1,18 @@
package info.nightscout.androidaps.danars.di
import dagger.Module
import dagger.android.ContributesAndroidInjector
import info.nightscout.androidaps.plugins.pump.insight.LocalInsightFragment
import info.nightscout.androidaps.plugins.pump.insight.activities.InsightAlertActivity
import info.nightscout.androidaps.plugins.pump.insight.activities.InsightPairingActivity
import info.nightscout.androidaps.plugins.pump.insight.activities.InsightPairingInformationActivity
@Module
@Suppress("unused")
abstract class InsightActivitiesModule {
@ContributesAndroidInjector abstract fun contributesInsightAlertActivity(): InsightAlertActivity
@ContributesAndroidInjector abstract fun contributesInsightPairingActivity(): InsightPairingActivity
@ContributesAndroidInjector abstract fun contributesInsightPairingInformationActivity(): InsightPairingInformationActivity
@ContributesAndroidInjector abstract fun contributesLocalInsightFragment(): LocalInsightFragment
}

View file

@ -0,0 +1,8 @@
package info.nightscout.androidaps.danars.di
import dagger.Module
@Module
@Suppress("unused")
abstract class InsightCommModule {
}

View file

@ -0,0 +1,10 @@
package info.nightscout.androidaps.danars.di
import dagger.Module
@Module(includes = [
InsightCommModule::class,
InsightActivitiesModule::class,
InsightServicesModule::class
])
open class InsightModule

View file

@ -0,0 +1,14 @@
package info.nightscout.androidaps.danars.di
import dagger.Module
import dagger.android.ContributesAndroidInjector
import info.nightscout.androidaps.plugins.pump.insight.InsightAlertService
import info.nightscout.androidaps.plugins.pump.insight.connection_service.InsightConnectionService
@Module
@Suppress("unused")
abstract class InsightServicesModule {
@ContributesAndroidInjector abstract fun contributesInsightAlertService(): InsightAlertService
@ContributesAndroidInjector abstract fun contributesInsightConnectionService(): InsightConnectionService
}

View file

@ -17,7 +17,7 @@ import androidx.lifecycle.MutableLiveData;
import javax.inject.Inject; import javax.inject.Inject;
import dagger.android.DaggerService; import dagger.android.DaggerService;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.insight.R;
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.insight.activities.InsightAlertActivity; import info.nightscout.androidaps.plugins.pump.insight.activities.InsightAlertActivity;

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.pump.insight; package info.nightscout.androidaps.plugins.pump.insight;
import android.annotation.SuppressLint;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
@ -19,7 +20,8 @@ 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.R; import info.nightscout.androidaps.insight.R;
import info.nightscout.androidaps.interfaces.CommandQueueProvider;
import info.nightscout.androidaps.plugins.bus.RxBusWrapper; import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
import info.nightscout.androidaps.plugins.pump.insight.app_layer.parameter_blocks.TBROverNotificationBlock; import info.nightscout.androidaps.plugins.pump.insight.app_layer.parameter_blocks.TBROverNotificationBlock;
import info.nightscout.androidaps.plugins.pump.insight.descriptors.ActiveBasalRate; import info.nightscout.androidaps.plugins.pump.insight.descriptors.ActiveBasalRate;
@ -30,7 +32,6 @@ import info.nightscout.androidaps.plugins.pump.insight.descriptors.InsightState;
import info.nightscout.androidaps.plugins.pump.insight.descriptors.TotalDailyDose; import info.nightscout.androidaps.plugins.pump.insight.descriptors.TotalDailyDose;
import info.nightscout.androidaps.plugins.pump.insight.events.EventLocalInsightUpdateGUI; import info.nightscout.androidaps.plugins.pump.insight.events.EventLocalInsightUpdateGUI;
import info.nightscout.androidaps.queue.Callback; import info.nightscout.androidaps.queue.Callback;
import info.nightscout.androidaps.queue.CommandQueue;
import info.nightscout.androidaps.utils.DateUtil; import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.DecimalFormatter; import info.nightscout.androidaps.utils.DecimalFormatter;
import info.nightscout.androidaps.utils.FabricPrivacy; import info.nightscout.androidaps.utils.FabricPrivacy;
@ -40,7 +41,7 @@ import io.reactivex.disposables.CompositeDisposable;
public class LocalInsightFragment extends DaggerFragment implements View.OnClickListener { public class LocalInsightFragment extends DaggerFragment implements View.OnClickListener {
@Inject LocalInsightPlugin localInsightPlugin; @Inject LocalInsightPlugin localInsightPlugin;
@Inject CommandQueue commandQueue; @Inject CommandQueueProvider commandQueue;
@Inject RxBusWrapper rxBus; @Inject RxBusWrapper rxBus;
@Inject ResourceHelper resourceHelper; @Inject ResourceHelper resourceHelper;
@Inject FabricPrivacy fabricPrivacy; @Inject FabricPrivacy fabricPrivacy;
@ -186,7 +187,7 @@ public class LocalInsightFragment extends DaggerFragment implements View.OnClick
} }
private View getStatusItem(String label, String value) { private View getStatusItem(String label, String value) {
View statusItem = getLayoutInflater().inflate(R.layout.local_insight_status_item, null); @SuppressLint("InflateParams") View statusItem = getLayoutInflater().inflate(R.layout.local_insight_status_item, null);
((TextView) statusItem.findViewById(R.id.label)).setText(label); ((TextView) statusItem.findViewById(R.id.label)).setText(label);
((TextView) statusItem.findViewById(R.id.value)).setText(value); ((TextView) statusItem.findViewById(R.id.value)).setText(value);
return statusItem; return statusItem;
@ -238,7 +239,6 @@ public class LocalInsightFragment extends DaggerFragment implements View.OnClick
default: default:
long lastConnection = localInsightPlugin.getConnectionService().getLastConnected(); long lastConnection = localInsightPlugin.getConnectionService().getLastConnected();
if (lastConnection == 0) return; if (lastConnection == 0) return;
int min = (int) ((System.currentTimeMillis() - lastConnection) / 60000);
statusItems.add(getStatusItem(resourceHelper.gs(R.string.last_connected), dateUtil.timeString(lastConnection))); statusItems.add(getStatusItem(resourceHelper.gs(R.string.last_connected), dateUtil.timeString(lastConnection)));
} }
} }

View file

@ -26,9 +26,6 @@ import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
import dagger.android.HasAndroidInjector; import dagger.android.HasAndroidInjector;
import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.DetailedBolusInfo; import info.nightscout.androidaps.data.DetailedBolusInfo;
import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.data.PumpEnactResult;
@ -40,9 +37,12 @@ import info.nightscout.androidaps.db.TemporaryBasal;
import info.nightscout.androidaps.db.Treatment; import info.nightscout.androidaps.db.Treatment;
import info.nightscout.androidaps.events.EventInitializationChanged; import info.nightscout.androidaps.events.EventInitializationChanged;
import info.nightscout.androidaps.events.EventRefreshOverview; import info.nightscout.androidaps.events.EventRefreshOverview;
import info.nightscout.androidaps.insight.R;
import info.nightscout.androidaps.interfaces.CommandQueueProvider; import info.nightscout.androidaps.interfaces.CommandQueueProvider;
import info.nightscout.androidaps.interfaces.ConfigInterface;
import info.nightscout.androidaps.interfaces.Constraint; import info.nightscout.androidaps.interfaces.Constraint;
import info.nightscout.androidaps.interfaces.ConstraintsInterface; import info.nightscout.androidaps.interfaces.ConstraintsInterface;
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface;
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.ProfileFunction; import info.nightscout.androidaps.interfaces.ProfileFunction;
@ -50,12 +50,12 @@ import info.nightscout.androidaps.interfaces.PumpDescription;
import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.interfaces.PumpPluginBase; import info.nightscout.androidaps.interfaces.PumpPluginBase;
import info.nightscout.androidaps.interfaces.TreatmentsInterface; import info.nightscout.androidaps.interfaces.TreatmentsInterface;
import info.nightscout.androidaps.interfaces.UploadQueueInterface;
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.common.ManufacturerType; import info.nightscout.androidaps.plugins.common.ManufacturerType;
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload; import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
import info.nightscout.androidaps.plugins.general.nsclient.UploadQueue;
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification; import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
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.events.EventOverviewBolusProgress; import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress;
@ -108,9 +108,9 @@ import info.nightscout.androidaps.plugins.pump.insight.app_layer.status.GetPumpS
import info.nightscout.androidaps.plugins.pump.insight.app_layer.status.GetTotalDailyDoseMessage; import info.nightscout.androidaps.plugins.pump.insight.app_layer.status.GetTotalDailyDoseMessage;
import info.nightscout.androidaps.plugins.pump.insight.app_layer.status.ResetPumpStatusRegisterMessage; import info.nightscout.androidaps.plugins.pump.insight.app_layer.status.ResetPumpStatusRegisterMessage;
import info.nightscout.androidaps.plugins.pump.insight.connection_service.InsightConnectionService; import info.nightscout.androidaps.plugins.pump.insight.connection_service.InsightConnectionService;
import info.nightscout.androidaps.plugins.pump.insight.database.InsightBolusID; import info.nightscout.androidaps.db.InsightBolusID;
import info.nightscout.androidaps.plugins.pump.insight.database.InsightHistoryOffset; import info.nightscout.androidaps.db.InsightHistoryOffset;
import info.nightscout.androidaps.plugins.pump.insight.database.InsightPumpID; import info.nightscout.androidaps.db.InsightPumpID;
import info.nightscout.androidaps.plugins.pump.insight.descriptors.ActiveBasalRate; import info.nightscout.androidaps.plugins.pump.insight.descriptors.ActiveBasalRate;
import info.nightscout.androidaps.plugins.pump.insight.descriptors.ActiveBolus; import info.nightscout.androidaps.plugins.pump.insight.descriptors.ActiveBolus;
import info.nightscout.androidaps.plugins.pump.insight.descriptors.ActiveTBR; import info.nightscout.androidaps.plugins.pump.insight.descriptors.ActiveTBR;
@ -147,8 +147,9 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
private final ProfileFunction profileFunction; private final ProfileFunction profileFunction;
private final NSUpload nsUpload; private final NSUpload nsUpload;
private final Context context; private final Context context;
private final UploadQueue uploadQueue; private final UploadQueueInterface uploadQueue;
private final DateUtil dateUtil; private final DateUtil dateUtil;
private final DatabaseHelperInterface databaseHelper;
public static final String ALERT_CHANNEL_ID = "AndroidAPS-InsightAlert"; public static final String ALERT_CHANNEL_ID = "AndroidAPS-InsightAlert";
@ -209,9 +210,10 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
ProfileFunction profileFunction, ProfileFunction profileFunction,
NSUpload nsUpload, NSUpload nsUpload,
Context context, Context context,
UploadQueue uploadQueue, UploadQueueInterface uploadQueue,
Config config, ConfigInterface config,
DateUtil dateUtil DateUtil dateUtil,
DatabaseHelperInterface databaseHelper
) { ) {
super(new PluginDescription() super(new PluginDescription()
.pluginIcon(R.drawable.ic_insight_128) .pluginIcon(R.drawable.ic_insight_128)
@ -235,6 +237,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
this.context = context; this.context = context;
this.uploadQueue = uploadQueue; this.uploadQueue = uploadQueue;
this.dateUtil = dateUtil; this.dateUtil = dateUtil;
this.databaseHelper = databaseHelper;
pumpDescription = new PumpDescription(); pumpDescription = new PumpDescription();
pumpDescription.setPumpDescription(PumpType.AccuChekInsightBluetooth); pumpDescription.setPumpDescription(PumpType.AccuChekInsightBluetooth);
@ -606,7 +609,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
insightBolusID.bolusID = bolusID; insightBolusID.bolusID = bolusID;
insightBolusID.timestamp = System.currentTimeMillis(); insightBolusID.timestamp = System.currentTimeMillis();
insightBolusID.pumpSerial = connectionService.getPumpSystemIdentification().getSerialNumber(); insightBolusID.pumpSerial = connectionService.getPumpSystemIdentification().getSerialNumber();
MainApp.getDbHelper().createOrUpdate(insightBolusID); databaseHelper.createOrUpdate(insightBolusID);
detailedBolusInfo.date = insightBolusID.timestamp; detailedBolusInfo.date = insightBolusID.timestamp;
detailedBolusInfo.source = Source.PUMP; detailedBolusInfo.source = Source.PUMP;
detailedBolusInfo.pumpId = insightBolusID.id; detailedBolusInfo.pumpId = insightBolusID.id;
@ -820,7 +823,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
insightBolusID.bolusID = bolusID; insightBolusID.bolusID = bolusID;
insightBolusID.timestamp = System.currentTimeMillis(); insightBolusID.timestamp = System.currentTimeMillis();
insightBolusID.pumpSerial = connectionService.getPumpSystemIdentification().getSerialNumber(); insightBolusID.pumpSerial = connectionService.getPumpSystemIdentification().getSerialNumber();
MainApp.getDbHelper().createOrUpdate(insightBolusID); databaseHelper.createOrUpdate(insightBolusID);
ExtendedBolus extendedBolus = new ExtendedBolus(getInjector()); ExtendedBolus extendedBolus = new ExtendedBolus(getInjector());
extendedBolus.date = insightBolusID.timestamp; extendedBolus.date = insightBolusID.timestamp;
extendedBolus.source = Source.PUMP; extendedBolus.source = Source.PUMP;
@ -920,10 +923,10 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
connectionService.requestMessage(cancelBolusMessage).await(); connectionService.requestMessage(cancelBolusMessage).await();
confirmAlert(AlertType.WARNING_38); confirmAlert(AlertType.WARNING_38);
alertService.ignore(null); alertService.ignore(null);
InsightBolusID insightBolusID = MainApp.getDbHelper().getInsightBolusID(connectionService.getPumpSystemIdentification().getSerialNumber(), InsightBolusID insightBolusID = databaseHelper.getInsightBolusID(connectionService.getPumpSystemIdentification().getSerialNumber(),
activeBolus.getBolusID(), System.currentTimeMillis()); activeBolus.getBolusID(), System.currentTimeMillis());
if (insightBolusID != null) { if (insightBolusID != null) {
ExtendedBolus extendedBolus = MainApp.getDbHelper().getExtendedBolusByPumpId(insightBolusID.id); ExtendedBolus extendedBolus = databaseHelper.getExtendedBolusByPumpId(insightBolusID.id);
if (extendedBolus != null) { if (extendedBolus != null) {
extendedBolus.durationInMinutes = (int) ((System.currentTimeMillis() - extendedBolus.date) / 60000); extendedBolus.durationInMinutes = (int) ((System.currentTimeMillis() - extendedBolus.date) / 60000);
if (extendedBolus.durationInMinutes <= 0) { if (extendedBolus.durationInMinutes <= 0) {
@ -931,7 +934,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
if (NSUpload.isIdValid(_id)) if (NSUpload.isIdValid(_id))
nsUpload.removeCareportalEntryFromNS(_id); nsUpload.removeCareportalEntryFromNS(_id);
else uploadQueue.removeID("dbAdd", _id); else uploadQueue.removeID("dbAdd", _id);
MainApp.getDbHelper().delete(extendedBolus); databaseHelper.delete(extendedBolus);
} else } else
treatmentsPlugin.addToHistoryExtendedBolus(extendedBolus); treatmentsPlugin.addToHistoryExtendedBolus(extendedBolus);
} }
@ -1162,7 +1165,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
String pumpSerial = connectionService.getPumpSystemIdentification().getSerialNumber(); String pumpSerial = connectionService.getPumpSystemIdentification().getSerialNumber();
timeOffset = Calendar.getInstance(TimeZone.getTimeZone("UTC")).getTimeInMillis() - parseDate(pumpTime.getYear(), timeOffset = Calendar.getInstance(TimeZone.getTimeZone("UTC")).getTimeInMillis() - parseDate(pumpTime.getYear(),
pumpTime.getMonth(), pumpTime.getDay(), pumpTime.getHour(), pumpTime.getMinute(), pumpTime.getSecond()); pumpTime.getMonth(), pumpTime.getDay(), pumpTime.getHour(), pumpTime.getMinute(), pumpTime.getSecond());
InsightHistoryOffset historyOffset = MainApp.getDbHelper().getInsightHistoryOffset(pumpSerial); InsightHistoryOffset historyOffset = databaseHelper.getInsightHistoryOffset(pumpSerial);
try { try {
List<HistoryEvent> historyEvents = new ArrayList<>(); List<HistoryEvent> historyEvents = new ArrayList<>();
if (historyOffset == null) { if (historyOffset == null) {
@ -1189,7 +1192,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
historyOffset = new InsightHistoryOffset(); historyOffset = new InsightHistoryOffset();
historyOffset.pumpSerial = pumpSerial; historyOffset.pumpSerial = pumpSerial;
historyOffset.offset = historyEvents.get(0).getEventPosition(); historyOffset.offset = historyEvents.get(0).getEventPosition();
MainApp.getDbHelper().createOrUpdate(historyOffset); databaseHelper.createOrUpdate(historyOffset);
} }
} catch (AppLayerErrorException e) { } catch (AppLayerErrorException e) {
aapsLogger.info(LTag.PUMP, "Exception while reading history: " + e.getClass().getCanonicalName() + " (" + e.getErrorCode() + ")"); aapsLogger.info(LTag.PUMP, "Exception while reading history: " + e.getClass().getCanonicalName() + " (" + e.getErrorCode() + ")");
@ -1221,7 +1224,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
break; break;
Collections.reverse(temporaryBasals); Collections.reverse(temporaryBasals);
for (InsightPumpID pumpID : pumpStartedEvents) { for (InsightPumpID pumpID : pumpStartedEvents) {
InsightPumpID stoppedEvent = MainApp.getDbHelper().getPumpStoppedEvent(pumpID.pumpSerial, pumpID.timestamp); InsightPumpID stoppedEvent = databaseHelper.getPumpStoppedEvent(pumpID.pumpSerial, pumpID.timestamp);
if (stoppedEvent == null || stoppedEvent.eventType.equals("PumpPaused")) continue; if (stoppedEvent == null || stoppedEvent.eventType.equals("PumpPaused")) continue;
long tbrStart = stoppedEvent.timestamp + 10000; long tbrStart = stoppedEvent.timestamp + 10000;
TemporaryBasal temporaryBasal = new TemporaryBasal(getInjector()); TemporaryBasal temporaryBasal = new TemporaryBasal(getInjector());
@ -1289,7 +1292,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
tdd.bolus = event.getBolusTotal(); tdd.bolus = event.getBolusTotal();
tdd.total = tdd.basal + tdd.bolus; tdd.total = tdd.basal + tdd.bolus;
tdd.date = calendar.getTimeInMillis(); tdd.date = calendar.getTimeInMillis();
MainApp.getDbHelper().createOrUpdateTDD(tdd); databaseHelper.createOrUpdateTDD(tdd);
} }
private void processTubeFilledEvent(TubeFilledEvent event) { private void processTubeFilledEvent(TubeFilledEvent event) {
@ -1338,7 +1341,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
logNote(timestamp, resourceHelper.gs(R.string.pump_paused)); logNote(timestamp, resourceHelper.gs(R.string.pump_paused));
break; break;
} }
MainApp.getDbHelper().createOrUpdate(pumpID); databaseHelper.createOrUpdate(pumpID);
} }
private void processStartOfTBREvent(String serial, List<TemporaryBasal> temporaryBasals, StartOfTBREvent event) { private void processStartOfTBREvent(String serial, List<TemporaryBasal> temporaryBasals, StartOfTBREvent event) {
@ -1349,7 +1352,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
pumpID.pumpSerial = serial; pumpID.pumpSerial = serial;
pumpID.timestamp = timestamp; pumpID.timestamp = timestamp;
pumpID.eventType = "StartOfTBR"; pumpID.eventType = "StartOfTBR";
MainApp.getDbHelper().createOrUpdate(pumpID); databaseHelper.createOrUpdate(pumpID);
TemporaryBasal temporaryBasal = new TemporaryBasal(getInjector()); TemporaryBasal temporaryBasal = new TemporaryBasal(getInjector());
temporaryBasal.durationInMinutes = event.getDuration(); temporaryBasal.durationInMinutes = event.getDuration();
temporaryBasal.source = Source.PUMP; temporaryBasal.source = Source.PUMP;
@ -1368,7 +1371,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
pumpID.pumpSerial = serial; pumpID.pumpSerial = serial;
pumpID.eventType = "EndOfTBR"; pumpID.eventType = "EndOfTBR";
pumpID.timestamp = timestamp; pumpID.timestamp = timestamp;
MainApp.getDbHelper().createOrUpdate(pumpID); databaseHelper.createOrUpdate(pumpID);
TemporaryBasal temporaryBasal = new TemporaryBasal(getInjector()); TemporaryBasal temporaryBasal = new TemporaryBasal(getInjector());
temporaryBasal.durationInMinutes = 0; temporaryBasal.durationInMinutes = 0;
temporaryBasal.source = Source.PUMP; temporaryBasal.source = Source.PUMP;
@ -1380,10 +1383,10 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
private void processBolusProgrammedEvent(String serial, BolusProgrammedEvent event) { private void processBolusProgrammedEvent(String serial, BolusProgrammedEvent event) {
long timestamp = parseDate(event.getEventYear(), event.getEventMonth(), event.getEventDay(), long timestamp = parseDate(event.getEventYear(), event.getEventMonth(), event.getEventDay(),
event.getEventHour(), event.getEventMinute(), event.getEventSecond()) + timeOffset; event.getEventHour(), event.getEventMinute(), event.getEventSecond()) + timeOffset;
InsightBolusID bolusID = MainApp.getDbHelper().getInsightBolusID(serial, event.getBolusID(), timestamp); InsightBolusID bolusID = databaseHelper.getInsightBolusID(serial, event.getBolusID(), timestamp);
if (bolusID != null && bolusID.endID != null) { if (bolusID != null && bolusID.endID != null) {
bolusID.startID = event.getEventPosition(); bolusID.startID = event.getEventPosition();
MainApp.getDbHelper().createOrUpdate(bolusID); databaseHelper.createOrUpdate(bolusID);
return; return;
} }
if (bolusID == null || bolusID.startID != null) { if (bolusID == null || bolusID.startID != null) {
@ -1393,7 +1396,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
bolusID.pumpSerial = serial; bolusID.pumpSerial = serial;
} }
bolusID.startID = event.getEventPosition(); bolusID.startID = event.getEventPosition();
MainApp.getDbHelper().createOrUpdate(bolusID); databaseHelper.createOrUpdate(bolusID);
if (event.getBolusType() == BolusType.STANDARD || event.getBolusType() == BolusType.MULTIWAVE) { if (event.getBolusType() == BolusType.STANDARD || event.getBolusType() == BolusType.MULTIWAVE) {
DetailedBolusInfo detailedBolusInfo = new DetailedBolusInfo(); DetailedBolusInfo detailedBolusInfo = new DetailedBolusInfo();
detailedBolusInfo.date = bolusID.timestamp; detailedBolusInfo.date = bolusID.timestamp;
@ -1419,7 +1422,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
event.getEventHour(), event.getEventMinute(), event.getEventSecond()) + timeOffset; event.getEventHour(), event.getEventMinute(), event.getEventSecond()) + timeOffset;
long startTimestamp = parseRelativeDate(event.getEventYear(), event.getEventMonth(), event.getEventDay(), event.getEventHour(), long startTimestamp = parseRelativeDate(event.getEventYear(), event.getEventMonth(), event.getEventDay(), event.getEventHour(),
event.getEventMinute(), event.getEventSecond(), event.getStartHour(), event.getStartMinute(), event.getStartSecond()) + timeOffset; event.getEventMinute(), event.getEventSecond(), event.getStartHour(), event.getStartMinute(), event.getStartSecond()) + timeOffset;
InsightBolusID bolusID = MainApp.getDbHelper().getInsightBolusID(serial, event.getBolusID(), timestamp); InsightBolusID bolusID = databaseHelper.getInsightBolusID(serial, event.getBolusID(), timestamp);
if (bolusID == null || bolusID.endID != null) { if (bolusID == null || bolusID.endID != null) {
bolusID = new InsightBolusID(); bolusID = new InsightBolusID();
bolusID.timestamp = startTimestamp; bolusID.timestamp = startTimestamp;
@ -1427,7 +1430,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
bolusID.pumpSerial = serial; bolusID.pumpSerial = serial;
} }
bolusID.endID = event.getEventPosition(); bolusID.endID = event.getEventPosition();
MainApp.getDbHelper().createOrUpdate(bolusID); databaseHelper.createOrUpdate(bolusID);
if (event.getBolusType() == BolusType.STANDARD || event.getBolusType() == BolusType.MULTIWAVE) { if (event.getBolusType() == BolusType.STANDARD || event.getBolusType() == BolusType.MULTIWAVE) {
DetailedBolusInfo detailedBolusInfo = new DetailedBolusInfo(); DetailedBolusInfo detailedBolusInfo = new DetailedBolusInfo();
detailedBolusInfo.date = bolusID.timestamp; detailedBolusInfo.date = bolusID.timestamp;
@ -1438,12 +1441,12 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
} }
if (event.getBolusType() == BolusType.EXTENDED || event.getBolusType() == BolusType.MULTIWAVE) { if (event.getBolusType() == BolusType.EXTENDED || event.getBolusType() == BolusType.MULTIWAVE) {
if (event.getDuration() == 0) { if (event.getDuration() == 0) {
ExtendedBolus extendedBolus = MainApp.getDbHelper().getExtendedBolusByPumpId(bolusID.id); ExtendedBolus extendedBolus = databaseHelper.getExtendedBolusByPumpId(bolusID.id);
if (extendedBolus != null) { if (extendedBolus != null) {
final String _id = extendedBolus._id; final String _id = extendedBolus._id;
if (NSUpload.isIdValid(_id)) nsUpload.removeCareportalEntryFromNS(_id); if (NSUpload.isIdValid(_id)) nsUpload.removeCareportalEntryFromNS(_id);
else uploadQueue.removeID("dbAdd", _id); else uploadQueue.removeID("dbAdd", _id);
MainApp.getDbHelper().delete(extendedBolus); databaseHelper.delete(extendedBolus);
} }
} else { } else {
ExtendedBolus extendedBolus = new ExtendedBolus(getInjector()); ExtendedBolus extendedBolus = new ExtendedBolus(getInjector());
@ -1559,7 +1562,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
private void logNote(long date, String note) { private void logNote(long date, String note) {
try { try {
if (MainApp.getDbHelper().getCareportalEventFromTimestamp(date) != null) if (databaseHelper.getCareportalEventFromTimestamp(date) != null)
return; return;
JSONObject data = new JSONObject(); JSONObject data = new JSONObject();
String enteredBy = sp.getString("careportal_enteredby", ""); String enteredBy = sp.getString("careportal_enteredby", "");
@ -1572,7 +1575,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
careportalEvent.source = Source.USER; careportalEvent.source = Source.USER;
careportalEvent.eventType = CareportalEvent.NOTE; careportalEvent.eventType = CareportalEvent.NOTE;
careportalEvent.json = data.toString(); careportalEvent.json = data.toString();
MainApp.getDbHelper().createOrUpdate(careportalEvent); databaseHelper.createOrUpdate(careportalEvent);
nsUpload.uploadCareportalEntryToNS(data); nsUpload.uploadCareportalEntryToNS(data);
} catch (JSONException e) { } catch (JSONException e) {
aapsLogger.error("Unhandled exception", e); aapsLogger.error("Unhandled exception", e);
@ -1593,7 +1596,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
} }
private void uploadCareportalEvent(long date, String event) { private void uploadCareportalEvent(long date, String event) {
if (MainApp.getDbHelper().getCareportalEventFromTimestamp(date) != null) if (databaseHelper.getCareportalEventFromTimestamp(date) != null)
return; return;
try { try {
JSONObject data = new JSONObject(); JSONObject data = new JSONObject();
@ -1606,7 +1609,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
careportalEvent.source = Source.USER; careportalEvent.source = Source.USER;
careportalEvent.eventType = event; careportalEvent.eventType = event;
careportalEvent.json = data.toString(); careportalEvent.json = data.toString();
MainApp.getDbHelper().createOrUpdate(careportalEvent); databaseHelper.createOrUpdate(careportalEvent);
nsUpload.uploadCareportalEntryToNS(data); nsUpload.uploadCareportalEntryToNS(data);
} catch (JSONException e) { } catch (JSONException e) {
aapsLogger.error("Unhandled exception", e); aapsLogger.error("Unhandled exception", e);

View file

@ -17,7 +17,7 @@ import androidx.core.content.ContextCompat;
import javax.inject.Inject; import javax.inject.Inject;
import dagger.android.support.DaggerAppCompatActivity; import dagger.android.support.DaggerAppCompatActivity;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.insight.R;
import info.nightscout.androidaps.plugins.pump.insight.InsightAlertService; import info.nightscout.androidaps.plugins.pump.insight.InsightAlertService;
import info.nightscout.androidaps.plugins.pump.insight.descriptors.Alert; import info.nightscout.androidaps.plugins.pump.insight.descriptors.Alert;
import info.nightscout.androidaps.plugins.pump.insight.descriptors.AlertStatus; import info.nightscout.androidaps.plugins.pump.insight.descriptors.AlertStatus;

View file

@ -25,8 +25,8 @@ import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity; import info.nightscout.androidaps.activities.NoSplashAppCompatActivity;
import info.nightscout.androidaps.insight.R;
import info.nightscout.androidaps.plugins.pump.insight.connection_service.InsightConnectionService; import info.nightscout.androidaps.plugins.pump.insight.connection_service.InsightConnectionService;
import info.nightscout.androidaps.plugins.pump.insight.descriptors.InsightState; import info.nightscout.androidaps.plugins.pump.insight.descriptors.InsightState;
import info.nightscout.androidaps.plugins.pump.insight.utils.ExceptionTranslator; import info.nightscout.androidaps.plugins.pump.insight.utils.ExceptionTranslator;

View file

@ -10,8 +10,8 @@ import android.widget.TextView;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity; import info.nightscout.androidaps.activities.NoSplashAppCompatActivity;
import info.nightscout.androidaps.insight.R;
import info.nightscout.androidaps.plugins.pump.insight.connection_service.InsightConnectionService; import info.nightscout.androidaps.plugins.pump.insight.connection_service.InsightConnectionService;
public class InsightPairingInformationActivity extends NoSplashAppCompatActivity { public class InsightPairingInformationActivity extends NoSplashAppCompatActivity {

Some files were not shown because too many files have changed in this diff Show more