insight -> lib
This commit is contained in:
parent
32873e0730
commit
0322dd48ac
313 changed files with 345 additions and 188 deletions
|
@ -182,6 +182,7 @@ dependencies {
|
|||
implementation project(':dana')
|
||||
implementation project(':danars')
|
||||
implementation project(':danar')
|
||||
implementation project(':insight')
|
||||
implementation project(':rileylink')
|
||||
implementation project(':medtronic')
|
||||
implementation project(':omnipod-eros')
|
||||
|
|
|
@ -219,8 +219,6 @@
|
|||
android:exported="false" />
|
||||
|
||||
<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
|
||||
android:name="io.fabric.ApiKey"
|
||||
|
@ -236,20 +234,6 @@
|
|||
android:name=".activities.SingleFragmentActivity"
|
||||
android:theme="@style/AppTheme" />
|
||||
<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=".plugins.general.smsCommunicator.activities.SmsCommunicatorOtpActivity">
|
||||
<intent-filter>
|
||||
|
|
|
@ -46,6 +46,7 @@ import info.nightscout.androidaps.events.EventReloadTreatmentData;
|
|||
import info.nightscout.androidaps.events.EventTempBasalChange;
|
||||
import info.nightscout.androidaps.events.EventTempTargetChange;
|
||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
|
||||
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface;
|
||||
import info.nightscout.androidaps.interfaces.ProfileInterface;
|
||||
import info.nightscout.androidaps.interfaces.ProfileStore;
|
||||
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.openhumans.OpenHumansUploader;
|
||||
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.utils.JsonHelper;
|
||||
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_CAREPORTALEVENTS = "CareportalEvents";
|
||||
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";
|
||||
|
||||
private static final int DATABASE_VERSION = 13;
|
||||
|
@ -138,10 +133,10 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
TableUtils.createTableIfNotExists(connectionSource, InsightPumpID.class);
|
||||
TableUtils.createTableIfNotExists(connectionSource, OmnipodHistoryRecord.class);
|
||||
TableUtils.createTableIfNotExists(connectionSource, OHQueueItem.class);
|
||||
database.execSQL("INSERT INTO sqlite_sequence (name, seq) SELECT \"" + DATABASE_INSIGHT_BOLUS_IDS + "\", " + System.currentTimeMillis() + " " +
|
||||
"WHERE NOT EXISTS (SELECT 1 FROM sqlite_sequence WHERE name = \"" + DATABASE_INSIGHT_BOLUS_IDS + "\")");
|
||||
database.execSQL("INSERT INTO sqlite_sequence (name, seq) SELECT \"" + DATABASE_INSIGHT_PUMP_IDS + "\", " + System.currentTimeMillis() + " " +
|
||||
"WHERE NOT EXISTS (SELECT 1 FROM sqlite_sequence WHERE name = \"" + DATABASE_INSIGHT_PUMP_IDS + "\")");
|
||||
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 = \"" + DatabaseHelperInterface.Companion.DATABASE_INSIGHT_BOLUS_IDS + "\")");
|
||||
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 = \"" + DatabaseHelperInterface.Companion.DATABASE_INSIGHT_PUMP_IDS + "\")");
|
||||
} catch (SQLException e) {
|
||||
aapsLogger.error("Can't create database", e);
|
||||
throw new RuntimeException(e);
|
||||
|
@ -169,13 +164,13 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
TableUtils.createTableIfNotExists(connectionSource, InsightHistoryOffset.class);
|
||||
TableUtils.createTableIfNotExists(connectionSource, InsightBolusID.class);
|
||||
TableUtils.createTableIfNotExists(connectionSource, InsightPumpID.class);
|
||||
database.execSQL("INSERT INTO sqlite_sequence (name, seq) SELECT \"" + DATABASE_INSIGHT_BOLUS_IDS + "\", " + System.currentTimeMillis() + " " +
|
||||
"WHERE NOT EXISTS (SELECT 1 FROM sqlite_sequence WHERE name = \"" + DATABASE_INSIGHT_BOLUS_IDS + "\")");
|
||||
database.execSQL("INSERT INTO sqlite_sequence (name, seq) SELECT \"" + DATABASE_INSIGHT_PUMP_IDS + "\", " + System.currentTimeMillis() + " " +
|
||||
"WHERE NOT EXISTS (SELECT 1 FROM sqlite_sequence WHERE name = \"" + DATABASE_INSIGHT_PUMP_IDS + "\")");
|
||||
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 = \"" + DatabaseHelperInterface.Companion.DATABASE_INSIGHT_BOLUS_IDS + "\")");
|
||||
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 = \"" + DatabaseHelperInterface.Companion.DATABASE_INSIGHT_PUMP_IDS + "\")");
|
||||
} 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 = \"" + DATABASE_INSIGHT_PUMP_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 = \"" + DatabaseHelperInterface.Companion.DATABASE_INSIGHT_PUMP_IDS + "\"");
|
||||
}
|
||||
TableUtils.createTableIfNotExists(connectionSource, OHQueueItem.class);
|
||||
} catch (SQLException e) {
|
||||
|
|
|
@ -108,4 +108,35 @@ public class DatabaseHelperProvider implements DatabaseHelperInterface {
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.pump.common.dialog.RileyLinkBLEConfigActivity
|
||||
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.setupwizard.SetupWizardActivity
|
||||
|
||||
|
@ -22,9 +19,6 @@ import info.nightscout.androidaps.setupwizard.SetupWizardActivity
|
|||
abstract class ActivitiesModule {
|
||||
|
||||
@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 contributeMainActivity(): MainActivity
|
||||
@ContributesAndroidInjector abstract fun contributesMedtronicHistoryActivity(): MedtronicHistoryActivity
|
||||
|
|
|
@ -5,10 +5,12 @@ import dagger.Component
|
|||
import dagger.android.AndroidInjectionModule
|
||||
import dagger.android.AndroidInjector
|
||||
import info.nightscout.androidaps.MainApp
|
||||
import info.nightscout.androidaps.combo.di.ComboModule
|
||||
import info.nightscout.androidaps.core.di.CoreModule
|
||||
import info.nightscout.androidaps.dana.di.DanaModule
|
||||
import info.nightscout.androidaps.danar.di.DanaRModule
|
||||
import info.nightscout.androidaps.danars.di.DanaRSModule
|
||||
import info.nightscout.androidaps.danars.di.InsightModule
|
||||
import info.nightscout.androidaps.database.DatabaseModule
|
||||
import info.nightscout.androidaps.plugins.pump.common.dagger.RileyLinkModule
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.dagger.OmnipodErosModule
|
||||
|
@ -43,6 +45,8 @@ import javax.inject.Singleton
|
|||
DanaModule::class,
|
||||
DanaRModule::class,
|
||||
DanaRSModule::class,
|
||||
ComboModule::class,
|
||||
InsightModule::class,
|
||||
WorkersModule::class,
|
||||
OHUploaderModule::class
|
||||
]
|
||||
|
|
|
@ -30,10 +30,8 @@ import info.nightscout.androidaps.plugins.general.wear.WearFragment
|
|||
import info.nightscout.androidaps.plugins.insulin.InsulinFragment
|
||||
import info.nightscout.androidaps.plugins.profile.local.LocalProfileFragment
|
||||
import info.nightscout.androidaps.plugins.profile.ns.NSProfileFragment
|
||||
import info.nightscout.androidaps.plugins.pump.combo.ComboFragment
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusGeneralFragment
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusHistoryFragment
|
||||
import info.nightscout.androidaps.plugins.pump.insight.LocalInsightFragment
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicFragment
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.dialog.RileyLinkStatusDeviceMedtronic
|
||||
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 contributesAutomationFragment(): AutomationFragment
|
||||
@ContributesAndroidInjector abstract fun contributesBGSourceFragment(): BGSourceFragment
|
||||
@ContributesAndroidInjector abstract fun contributesComboFragment(): ComboFragment
|
||||
|
||||
@ContributesAndroidInjector
|
||||
abstract fun contributesConfigBuilderFragment(): ConfigBuilderFragment
|
||||
|
@ -64,7 +61,6 @@ abstract class FragmentsModule {
|
|||
@ContributesAndroidInjector abstract fun contributesOpenAPSAMAFragment(): OpenAPSAMAFragment
|
||||
@ContributesAndroidInjector abstract fun contributesOpenAPSSMBFragment(): OpenAPSSMBFragment
|
||||
@ContributesAndroidInjector abstract fun contributesOverviewFragment(): OverviewFragment
|
||||
@ContributesAndroidInjector abstract fun contributesLocalInsightFragment(): LocalInsightFragment
|
||||
@ContributesAndroidInjector abstract fun contributesLoopFragment(): LoopFragment
|
||||
@ContributesAndroidInjector abstract fun contributesMaintenanceFragment(): MaintenanceFragment
|
||||
@ContributesAndroidInjector abstract fun contributesMedtronicFragment(): MedtronicFragment
|
||||
|
|
|
@ -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.wear.wearintegration.WatchUpdaterService
|
||||
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.omnipod.eros.rileylink.service.RileyLinkOmnipodService
|
||||
import info.nightscout.androidaps.services.AlarmSoundService
|
||||
|
@ -24,8 +22,6 @@ abstract class ServicesModule {
|
|||
@ContributesAndroidInjector abstract fun contributesLocationService(): LocationService
|
||||
@ContributesAndroidInjector abstract fun contributesNSClientService(): NSClientService
|
||||
@ContributesAndroidInjector abstract fun contributesWatchUpdaterService(): WatchUpdaterService
|
||||
@ContributesAndroidInjector abstract fun contributesInsightAlertService(): InsightAlertService
|
||||
@ContributesAndroidInjector abstract fun contributesInsightConnectionService(): InsightConnectionService
|
||||
@ContributesAndroidInjector abstract fun contributesRileyLinkService(): RileyLinkService
|
||||
@ContributesAndroidInjector abstract fun contributesRileyLinkMedtronicService(): RileyLinkMedtronicService
|
||||
@ContributesAndroidInjector abstract fun contributesRileyLinkOmnipodService(): RileyLinkOmnipodService
|
||||
|
|
|
@ -382,7 +382,6 @@
|
|||
<string name="show_queue">Show queue</string>
|
||||
<string name="queue">Queue:</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_api_secret" translatable="false">nsclientinternal_api_secret</string>
|
||||
<string name="clearlog">Clear log</string>
|
||||
|
@ -640,7 +639,6 @@
|
|||
<string name="maxiobset">Maximal IOB set properly</string>
|
||||
<string name="hasbgdata">BG available from selected source</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_with_COB" translatable="false">enableSMB_with_COB</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="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="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_summary">Time at which any meal is considered absorbed. Remaining carbs will be cut off.</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="needstoragepermission">Application needs storage permission to be able store log files and export settings</string>
|
||||
<string name="request">Request</string>
|
||||
<string name="exit">Exit</string>
|
||||
<string name="open_navigation">Open navigation</string>
|
||||
<string name="close_navigation">Close navigation</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_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="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_saturday_short">Sat</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_tbrrequest_time_label">Temp basal request 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 -->
|
||||
|
||||
|
|
|
@ -16,12 +16,6 @@
|
|||
<item name="dialogTitleIconTint">@color/dialog_title_icon_tint</item>
|
||||
</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">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
|
|
|
@ -127,7 +127,7 @@ class ConstraintsCheckerTest : TestBaseWithProfile() {
|
|||
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)
|
||||
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)
|
||||
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())
|
||||
|
|
|
@ -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
|
||||
}
|
|
@ -1,7 +1,9 @@
|
|||
package info.nightscout.androidaps.combo.di
|
||||
|
||||
import dagger.Module
|
||||
import info.nightscout.androidaps.danars.di.ComboActivitiesModule
|
||||
|
||||
@Module(includes = [
|
||||
ComboActivitiesModule::class
|
||||
])
|
||||
open class ComboModule
|
|
@ -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.table.DatabaseTable;
|
||||
|
||||
import info.nightscout.androidaps.db.DatabaseHelper;
|
||||
|
||||
@DatabaseTable(tableName = DatabaseHelper.DATABASE_INSIGHT_BOLUS_IDS)
|
||||
@DatabaseTable(tableName = "InsightBolusIDs")
|
||||
public class InsightBolusID {
|
||||
|
||||
@DatabaseField(generatedId = true)
|
|
@ -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.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 {
|
||||
|
||||
@DatabaseField(id = true, canBeNull = false)
|
|
@ -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.table.DatabaseTable;
|
||||
|
||||
import info.nightscout.androidaps.db.DatabaseHelper;
|
||||
|
||||
@DatabaseTable(tableName = DatabaseHelper.DATABASE_INSIGHT_PUMP_IDS)
|
||||
@DatabaseTable(tableName = "InsightPumpIDs")
|
||||
public class InsightPumpID {
|
||||
|
||||
@DatabaseField(generatedId = true)
|
|
@ -8,12 +8,16 @@ interface DatabaseHelperInterface {
|
|||
fun createOrUpdate(careportalEvent: CareportalEvent)
|
||||
fun createOrUpdate(record: DanaRHistoryRecord)
|
||||
fun createOrUpdate(record: OmnipodHistoryRecord)
|
||||
fun createOrUpdate(record: InsightBolusID)
|
||||
fun createOrUpdate(record: InsightPumpID)
|
||||
fun createOrUpdate(record: InsightHistoryOffset)
|
||||
fun create(record: DbRequest)
|
||||
fun getDanaRHistoryRecordsByType(type: Byte): List<DanaRHistoryRecord>
|
||||
fun getTDDs(): List<TDD>
|
||||
fun size(table: String): Long
|
||||
fun deleteAllDbRequests()
|
||||
fun deleteDbRequest(id: String): Int
|
||||
fun delete(extendedBolus: ExtendedBolus)
|
||||
fun deleteDbRequestbyMongoId(action: String, _id: String)
|
||||
fun getDbRequestInterator(): CloseableIterator<DbRequest>
|
||||
fun roundDateToSec(date: Long): Long
|
||||
|
@ -26,4 +30,16 @@ interface DatabaseHelperInterface {
|
|||
fun findOmnipodHistoryRecordByPumpId(pumpId: Long): OmnipodHistoryRecord?
|
||||
fun getTDDsForLastXDays(days: Int): List<TDD>
|
||||
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"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,4 +5,5 @@ import info.nightscout.androidaps.db.DbRequest;
|
|||
public interface UploadQueueInterface {
|
||||
|
||||
void add(DbRequest dbRequest);
|
||||
void removeID(final String action, final String _id);
|
||||
}
|
||||
|
|
|
@ -106,6 +106,10 @@
|
|||
<string name="limitingmaxiob">Limiting max IOB to %1$.1f U because of %2$s</string>
|
||||
<string name="unsafeusage">unsafe usage</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-->
|
||||
<string name="limitingbasalratio">Limiting max basal rate to %1$.2f U/h because of %2$s</string>
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
files:
|
||||
- source: /app/src/main/res/values/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
|
||||
translation: /app/src/main/res/values-%android_code%/%original_file_name%
|
||||
- source: /app/src/main/res/values/objectives.xml
|
||||
|
@ -27,3 +25,7 @@ files:
|
|||
translation: /omnipod-eros/src/main/res/values-%android_code%/strings.xml
|
||||
- source: /rileylink/src/main/res/values/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
1
insight/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/build
|
20
insight/build.gradle
Normal file
20
insight/build.gradle
Normal 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')
|
||||
}
|
0
insight/consumer-rules.pro
Normal file
0
insight/consumer-rules.pro
Normal file
21
insight/proguard-rules.pro
vendored
Normal file
21
insight/proguard-rules.pro
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
25
insight/src/main/AndroidManifest.xml
Normal file
25
insight/src/main/AndroidManifest.xml
Normal 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>
|
|
@ -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
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package info.nightscout.androidaps.danars.di
|
||||
|
||||
import dagger.Module
|
||||
|
||||
@Module
|
||||
@Suppress("unused")
|
||||
abstract class InsightCommModule {
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package info.nightscout.androidaps.danars.di
|
||||
|
||||
import dagger.Module
|
||||
|
||||
@Module(includes = [
|
||||
InsightCommModule::class,
|
||||
InsightActivitiesModule::class,
|
||||
InsightServicesModule::class
|
||||
])
|
||||
open class InsightModule
|
|
@ -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
|
||||
}
|
|
@ -17,7 +17,7 @@ import androidx.lifecycle.MutableLiveData;
|
|||
import javax.inject.Inject;
|
||||
|
||||
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.LTag;
|
||||
import info.nightscout.androidaps.plugins.pump.insight.activities.InsightAlertActivity;
|
|
@ -1,5 +1,6 @@
|
|||
package info.nightscout.androidaps.plugins.pump.insight;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
|
@ -19,7 +20,8 @@ import java.util.List;
|
|||
import javax.inject.Inject;
|
||||
|
||||
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.pump.insight.app_layer.parameter_blocks.TBROverNotificationBlock;
|
||||
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.events.EventLocalInsightUpdateGUI;
|
||||
import info.nightscout.androidaps.queue.Callback;
|
||||
import info.nightscout.androidaps.queue.CommandQueue;
|
||||
import info.nightscout.androidaps.utils.DateUtil;
|
||||
import info.nightscout.androidaps.utils.DecimalFormatter;
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy;
|
||||
|
@ -40,7 +41,7 @@ import io.reactivex.disposables.CompositeDisposable;
|
|||
|
||||
public class LocalInsightFragment extends DaggerFragment implements View.OnClickListener {
|
||||
@Inject LocalInsightPlugin localInsightPlugin;
|
||||
@Inject CommandQueue commandQueue;
|
||||
@Inject CommandQueueProvider commandQueue;
|
||||
@Inject RxBusWrapper rxBus;
|
||||
@Inject ResourceHelper resourceHelper;
|
||||
@Inject FabricPrivacy fabricPrivacy;
|
||||
|
@ -186,7 +187,7 @@ public class LocalInsightFragment extends DaggerFragment implements View.OnClick
|
|||
}
|
||||
|
||||
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.value)).setText(value);
|
||||
return statusItem;
|
||||
|
@ -238,7 +239,6 @@ public class LocalInsightFragment extends DaggerFragment implements View.OnClick
|
|||
default:
|
||||
long lastConnection = localInsightPlugin.getConnectionService().getLastConnected();
|
||||
if (lastConnection == 0) return;
|
||||
int min = (int) ((System.currentTimeMillis() - lastConnection) / 60000);
|
||||
statusItems.add(getStatusItem(resourceHelper.gs(R.string.last_connected), dateUtil.timeString(lastConnection)));
|
||||
}
|
||||
}
|
|
@ -26,9 +26,6 @@ import javax.inject.Inject;
|
|||
import javax.inject.Singleton;
|
||||
|
||||
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.Profile;
|
||||
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.events.EventInitializationChanged;
|
||||
import info.nightscout.androidaps.events.EventRefreshOverview;
|
||||
import info.nightscout.androidaps.insight.R;
|
||||
import info.nightscout.androidaps.interfaces.CommandQueueProvider;
|
||||
import info.nightscout.androidaps.interfaces.ConfigInterface;
|
||||
import info.nightscout.androidaps.interfaces.Constraint;
|
||||
import info.nightscout.androidaps.interfaces.ConstraintsInterface;
|
||||
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface;
|
||||
import info.nightscout.androidaps.interfaces.PluginDescription;
|
||||
import info.nightscout.androidaps.interfaces.PluginType;
|
||||
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.PumpPluginBase;
|
||||
import info.nightscout.androidaps.interfaces.TreatmentsInterface;
|
||||
import info.nightscout.androidaps.interfaces.UploadQueueInterface;
|
||||
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||
import info.nightscout.androidaps.logging.LTag;
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
|
||||
import info.nightscout.androidaps.plugins.common.ManufacturerType;
|
||||
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.EventNewNotification;
|
||||
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.ResetPumpStatusRegisterMessage;
|
||||
import info.nightscout.androidaps.plugins.pump.insight.connection_service.InsightConnectionService;
|
||||
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.db.InsightBolusID;
|
||||
import info.nightscout.androidaps.db.InsightHistoryOffset;
|
||||
import info.nightscout.androidaps.db.InsightPumpID;
|
||||
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.ActiveTBR;
|
||||
|
@ -147,8 +147,9 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
|
|||
private final ProfileFunction profileFunction;
|
||||
private final NSUpload nsUpload;
|
||||
private final Context context;
|
||||
private final UploadQueue uploadQueue;
|
||||
private final UploadQueueInterface uploadQueue;
|
||||
private final DateUtil dateUtil;
|
||||
private final DatabaseHelperInterface databaseHelper;
|
||||
|
||||
public static final String ALERT_CHANNEL_ID = "AndroidAPS-InsightAlert";
|
||||
|
||||
|
@ -209,9 +210,10 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
|
|||
ProfileFunction profileFunction,
|
||||
NSUpload nsUpload,
|
||||
Context context,
|
||||
UploadQueue uploadQueue,
|
||||
Config config,
|
||||
DateUtil dateUtil
|
||||
UploadQueueInterface uploadQueue,
|
||||
ConfigInterface config,
|
||||
DateUtil dateUtil,
|
||||
DatabaseHelperInterface databaseHelper
|
||||
) {
|
||||
super(new PluginDescription()
|
||||
.pluginIcon(R.drawable.ic_insight_128)
|
||||
|
@ -235,6 +237,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
|
|||
this.context = context;
|
||||
this.uploadQueue = uploadQueue;
|
||||
this.dateUtil = dateUtil;
|
||||
this.databaseHelper = databaseHelper;
|
||||
|
||||
pumpDescription = new PumpDescription();
|
||||
pumpDescription.setPumpDescription(PumpType.AccuChekInsightBluetooth);
|
||||
|
@ -606,7 +609,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
|
|||
insightBolusID.bolusID = bolusID;
|
||||
insightBolusID.timestamp = System.currentTimeMillis();
|
||||
insightBolusID.pumpSerial = connectionService.getPumpSystemIdentification().getSerialNumber();
|
||||
MainApp.getDbHelper().createOrUpdate(insightBolusID);
|
||||
databaseHelper.createOrUpdate(insightBolusID);
|
||||
detailedBolusInfo.date = insightBolusID.timestamp;
|
||||
detailedBolusInfo.source = Source.PUMP;
|
||||
detailedBolusInfo.pumpId = insightBolusID.id;
|
||||
|
@ -820,7 +823,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
|
|||
insightBolusID.bolusID = bolusID;
|
||||
insightBolusID.timestamp = System.currentTimeMillis();
|
||||
insightBolusID.pumpSerial = connectionService.getPumpSystemIdentification().getSerialNumber();
|
||||
MainApp.getDbHelper().createOrUpdate(insightBolusID);
|
||||
databaseHelper.createOrUpdate(insightBolusID);
|
||||
ExtendedBolus extendedBolus = new ExtendedBolus(getInjector());
|
||||
extendedBolus.date = insightBolusID.timestamp;
|
||||
extendedBolus.source = Source.PUMP;
|
||||
|
@ -920,10 +923,10 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
|
|||
connectionService.requestMessage(cancelBolusMessage).await();
|
||||
confirmAlert(AlertType.WARNING_38);
|
||||
alertService.ignore(null);
|
||||
InsightBolusID insightBolusID = MainApp.getDbHelper().getInsightBolusID(connectionService.getPumpSystemIdentification().getSerialNumber(),
|
||||
InsightBolusID insightBolusID = databaseHelper.getInsightBolusID(connectionService.getPumpSystemIdentification().getSerialNumber(),
|
||||
activeBolus.getBolusID(), System.currentTimeMillis());
|
||||
if (insightBolusID != null) {
|
||||
ExtendedBolus extendedBolus = MainApp.getDbHelper().getExtendedBolusByPumpId(insightBolusID.id);
|
||||
ExtendedBolus extendedBolus = databaseHelper.getExtendedBolusByPumpId(insightBolusID.id);
|
||||
if (extendedBolus != null) {
|
||||
extendedBolus.durationInMinutes = (int) ((System.currentTimeMillis() - extendedBolus.date) / 60000);
|
||||
if (extendedBolus.durationInMinutes <= 0) {
|
||||
|
@ -931,7 +934,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
|
|||
if (NSUpload.isIdValid(_id))
|
||||
nsUpload.removeCareportalEntryFromNS(_id);
|
||||
else uploadQueue.removeID("dbAdd", _id);
|
||||
MainApp.getDbHelper().delete(extendedBolus);
|
||||
databaseHelper.delete(extendedBolus);
|
||||
} else
|
||||
treatmentsPlugin.addToHistoryExtendedBolus(extendedBolus);
|
||||
}
|
||||
|
@ -1162,7 +1165,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
|
|||
String pumpSerial = connectionService.getPumpSystemIdentification().getSerialNumber();
|
||||
timeOffset = Calendar.getInstance(TimeZone.getTimeZone("UTC")).getTimeInMillis() - parseDate(pumpTime.getYear(),
|
||||
pumpTime.getMonth(), pumpTime.getDay(), pumpTime.getHour(), pumpTime.getMinute(), pumpTime.getSecond());
|
||||
InsightHistoryOffset historyOffset = MainApp.getDbHelper().getInsightHistoryOffset(pumpSerial);
|
||||
InsightHistoryOffset historyOffset = databaseHelper.getInsightHistoryOffset(pumpSerial);
|
||||
try {
|
||||
List<HistoryEvent> historyEvents = new ArrayList<>();
|
||||
if (historyOffset == null) {
|
||||
|
@ -1189,7 +1192,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
|
|||
historyOffset = new InsightHistoryOffset();
|
||||
historyOffset.pumpSerial = pumpSerial;
|
||||
historyOffset.offset = historyEvents.get(0).getEventPosition();
|
||||
MainApp.getDbHelper().createOrUpdate(historyOffset);
|
||||
databaseHelper.createOrUpdate(historyOffset);
|
||||
}
|
||||
} catch (AppLayerErrorException e) {
|
||||
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;
|
||||
Collections.reverse(temporaryBasals);
|
||||
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;
|
||||
long tbrStart = stoppedEvent.timestamp + 10000;
|
||||
TemporaryBasal temporaryBasal = new TemporaryBasal(getInjector());
|
||||
|
@ -1289,7 +1292,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
|
|||
tdd.bolus = event.getBolusTotal();
|
||||
tdd.total = tdd.basal + tdd.bolus;
|
||||
tdd.date = calendar.getTimeInMillis();
|
||||
MainApp.getDbHelper().createOrUpdateTDD(tdd);
|
||||
databaseHelper.createOrUpdateTDD(tdd);
|
||||
}
|
||||
|
||||
private void processTubeFilledEvent(TubeFilledEvent event) {
|
||||
|
@ -1338,7 +1341,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
|
|||
logNote(timestamp, resourceHelper.gs(R.string.pump_paused));
|
||||
break;
|
||||
}
|
||||
MainApp.getDbHelper().createOrUpdate(pumpID);
|
||||
databaseHelper.createOrUpdate(pumpID);
|
||||
}
|
||||
|
||||
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.timestamp = timestamp;
|
||||
pumpID.eventType = "StartOfTBR";
|
||||
MainApp.getDbHelper().createOrUpdate(pumpID);
|
||||
databaseHelper.createOrUpdate(pumpID);
|
||||
TemporaryBasal temporaryBasal = new TemporaryBasal(getInjector());
|
||||
temporaryBasal.durationInMinutes = event.getDuration();
|
||||
temporaryBasal.source = Source.PUMP;
|
||||
|
@ -1368,7 +1371,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
|
|||
pumpID.pumpSerial = serial;
|
||||
pumpID.eventType = "EndOfTBR";
|
||||
pumpID.timestamp = timestamp;
|
||||
MainApp.getDbHelper().createOrUpdate(pumpID);
|
||||
databaseHelper.createOrUpdate(pumpID);
|
||||
TemporaryBasal temporaryBasal = new TemporaryBasal(getInjector());
|
||||
temporaryBasal.durationInMinutes = 0;
|
||||
temporaryBasal.source = Source.PUMP;
|
||||
|
@ -1380,10 +1383,10 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
|
|||
private void processBolusProgrammedEvent(String serial, BolusProgrammedEvent event) {
|
||||
long timestamp = parseDate(event.getEventYear(), event.getEventMonth(), event.getEventDay(),
|
||||
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) {
|
||||
bolusID.startID = event.getEventPosition();
|
||||
MainApp.getDbHelper().createOrUpdate(bolusID);
|
||||
databaseHelper.createOrUpdate(bolusID);
|
||||
return;
|
||||
}
|
||||
if (bolusID == null || bolusID.startID != null) {
|
||||
|
@ -1393,7 +1396,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
|
|||
bolusID.pumpSerial = serial;
|
||||
}
|
||||
bolusID.startID = event.getEventPosition();
|
||||
MainApp.getDbHelper().createOrUpdate(bolusID);
|
||||
databaseHelper.createOrUpdate(bolusID);
|
||||
if (event.getBolusType() == BolusType.STANDARD || event.getBolusType() == BolusType.MULTIWAVE) {
|
||||
DetailedBolusInfo detailedBolusInfo = new DetailedBolusInfo();
|
||||
detailedBolusInfo.date = bolusID.timestamp;
|
||||
|
@ -1419,7 +1422,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
|
|||
event.getEventHour(), event.getEventMinute(), event.getEventSecond()) + timeOffset;
|
||||
long startTimestamp = parseRelativeDate(event.getEventYear(), event.getEventMonth(), event.getEventDay(), event.getEventHour(),
|
||||
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) {
|
||||
bolusID = new InsightBolusID();
|
||||
bolusID.timestamp = startTimestamp;
|
||||
|
@ -1427,7 +1430,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
|
|||
bolusID.pumpSerial = serial;
|
||||
}
|
||||
bolusID.endID = event.getEventPosition();
|
||||
MainApp.getDbHelper().createOrUpdate(bolusID);
|
||||
databaseHelper.createOrUpdate(bolusID);
|
||||
if (event.getBolusType() == BolusType.STANDARD || event.getBolusType() == BolusType.MULTIWAVE) {
|
||||
DetailedBolusInfo detailedBolusInfo = new DetailedBolusInfo();
|
||||
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.getDuration() == 0) {
|
||||
ExtendedBolus extendedBolus = MainApp.getDbHelper().getExtendedBolusByPumpId(bolusID.id);
|
||||
ExtendedBolus extendedBolus = databaseHelper.getExtendedBolusByPumpId(bolusID.id);
|
||||
if (extendedBolus != null) {
|
||||
final String _id = extendedBolus._id;
|
||||
if (NSUpload.isIdValid(_id)) nsUpload.removeCareportalEntryFromNS(_id);
|
||||
else uploadQueue.removeID("dbAdd", _id);
|
||||
MainApp.getDbHelper().delete(extendedBolus);
|
||||
databaseHelper.delete(extendedBolus);
|
||||
}
|
||||
} else {
|
||||
ExtendedBolus extendedBolus = new ExtendedBolus(getInjector());
|
||||
|
@ -1559,7 +1562,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
|
|||
|
||||
private void logNote(long date, String note) {
|
||||
try {
|
||||
if (MainApp.getDbHelper().getCareportalEventFromTimestamp(date) != null)
|
||||
if (databaseHelper.getCareportalEventFromTimestamp(date) != null)
|
||||
return;
|
||||
JSONObject data = new JSONObject();
|
||||
String enteredBy = sp.getString("careportal_enteredby", "");
|
||||
|
@ -1572,7 +1575,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
|
|||
careportalEvent.source = Source.USER;
|
||||
careportalEvent.eventType = CareportalEvent.NOTE;
|
||||
careportalEvent.json = data.toString();
|
||||
MainApp.getDbHelper().createOrUpdate(careportalEvent);
|
||||
databaseHelper.createOrUpdate(careportalEvent);
|
||||
nsUpload.uploadCareportalEntryToNS(data);
|
||||
} catch (JSONException e) {
|
||||
aapsLogger.error("Unhandled exception", e);
|
||||
|
@ -1593,7 +1596,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
|
|||
}
|
||||
|
||||
private void uploadCareportalEvent(long date, String event) {
|
||||
if (MainApp.getDbHelper().getCareportalEventFromTimestamp(date) != null)
|
||||
if (databaseHelper.getCareportalEventFromTimestamp(date) != null)
|
||||
return;
|
||||
try {
|
||||
JSONObject data = new JSONObject();
|
||||
|
@ -1606,7 +1609,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
|
|||
careportalEvent.source = Source.USER;
|
||||
careportalEvent.eventType = event;
|
||||
careportalEvent.json = data.toString();
|
||||
MainApp.getDbHelper().createOrUpdate(careportalEvent);
|
||||
databaseHelper.createOrUpdate(careportalEvent);
|
||||
nsUpload.uploadCareportalEntryToNS(data);
|
||||
} catch (JSONException e) {
|
||||
aapsLogger.error("Unhandled exception", e);
|
|
@ -17,7 +17,7 @@ import androidx.core.content.ContextCompat;
|
|||
import javax.inject.Inject;
|
||||
|
||||
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.descriptors.Alert;
|
||||
import info.nightscout.androidaps.plugins.pump.insight.descriptors.AlertStatus;
|
|
@ -25,8 +25,8 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import info.nightscout.androidaps.R;
|
||||
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.descriptors.InsightState;
|
||||
import info.nightscout.androidaps.plugins.pump.insight.utils.ExceptionTranslator;
|
|
@ -10,8 +10,8 @@ import android.widget.TextView;
|
|||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity;
|
||||
import info.nightscout.androidaps.insight.R;
|
||||
import info.nightscout.androidaps.plugins.pump.insight.connection_service.InsightConnectionService;
|
||||
|
||||
public class InsightPairingInformationActivity extends NoSplashAppCompatActivity {
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue