Merge remote-tracking branch 'upstream/dev' into avereha/conn
This commit is contained in:
commit
1018a41346
503 changed files with 19046 additions and 6014 deletions
|
@ -24,6 +24,7 @@
|
|||
<option name="NAME_COUNT_TO_USE_STAR_IMPORT_FOR_MEMBERS" value="6" />
|
||||
<option name="BLANK_LINES_AROUND_BLOCK_WHEN_BRANCHES" value="1" />
|
||||
<option name="WRAP_EXPRESSION_BODY_FUNCTIONS" value="1" />
|
||||
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||
</JetCodeStyleSettings>
|
||||
<codeStyleSettings language="JAVA">
|
||||
<option name="METHOD_ANNOTATION_WRAP" value="0" />
|
||||
|
@ -142,7 +143,11 @@
|
|||
</arrangement>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="kotlin">
|
||||
<<<<<<< HEAD
|
||||
<option name="RIGHT_MARGIN" value="120" />
|
||||
=======
|
||||
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||
>>>>>>> upstream/dev
|
||||
<option name="LINE_COMMENT_AT_FIRST_COLUMN" value="false" />
|
||||
<option name="LINE_COMMENT_ADD_SPACE" value="true" />
|
||||
<option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1" />
|
||||
|
|
|
@ -111,7 +111,7 @@ android {
|
|||
defaultConfig {
|
||||
multiDexEnabled true
|
||||
versionCode 1500
|
||||
version "2.8.2.1-dev-e5"
|
||||
version "2.8.2.2-dev"
|
||||
buildConfigField "String", "VERSION", '"' + version + '"'
|
||||
buildConfigField "String", "BUILDVERSION", '"' + generateGitBuild() + '-' + generateDate() + '"'
|
||||
buildConfigField "String", "REMOTE", '"' + generateGitRemote() + '"'
|
||||
|
@ -192,6 +192,7 @@ dependencies {
|
|||
implementation project(':omnipod-common')
|
||||
implementation project(':omnipod-eros')
|
||||
implementation project(':omnipod-dash')
|
||||
implementation project(':diaconn')
|
||||
|
||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||
|
||||
|
|
|
@ -52,7 +52,8 @@
|
|||
android:name="com.google.android.gms.car.application"
|
||||
android:resource="@xml/automotive_app_desc" />
|
||||
|
||||
<activity android:name=".MainActivity">
|
||||
<activity android:name=".MainActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
@ -60,7 +61,8 @@
|
|||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name=".activities.PreferencesActivity" />
|
||||
<activity android:name=".plugins.general.overview.activities.QuickWizardListActivity">
|
||||
<activity android:name=".plugins.general.overview.activities.QuickWizardListActivity"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="info.nightscout.androidaps.plugins.general.overview.activities.QuickWizardListActivity" />
|
||||
|
||||
|
@ -119,7 +121,7 @@
|
|||
<receiver android:name=".receivers.KeepAliveReceiver" />
|
||||
|
||||
<!-- Receive ignore 5m, 15m, 30m requests for carb notifications -->
|
||||
<receiver android:name=".plugins.aps.loop.CarbSuggestionReceiver"></receiver>
|
||||
<receiver android:name=".plugins.aps.loop.CarbSuggestionReceiver" />
|
||||
|
||||
<!-- Auto start -->
|
||||
<receiver
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<configuration>
|
||||
<!-- Create a file appender for a log in the application's data directory -->
|
||||
<property name="EXT_FILES_DIR" scope="context"
|
||||
value="${EXT_DIR:-/sdcard}/Android/data/${PACKAGE_NAME}/files" />
|
||||
value="${EXT_DIR:-/sdcard}/AAPS/logs/${PACKAGE_NAME}" />
|
||||
<appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${EXT_FILES_DIR}/AndroidAPS.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
|
|
|
@ -6,7 +6,6 @@ import android.content.IntentFilter
|
|||
import android.net.ConnectivityManager
|
||||
import android.net.wifi.WifiManager
|
||||
import android.os.Build
|
||||
import com.j256.ormlite.android.apptools.OpenHelperManager
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.DaggerApplication
|
||||
import info.nightscout.androidaps.database.AppRepository
|
||||
|
@ -15,11 +14,10 @@ import info.nightscout.androidaps.database.entities.UserEntry
|
|||
import info.nightscout.androidaps.database.transactions.InsertIfNewByTimestampTherapyEventTransaction
|
||||
import info.nightscout.androidaps.database.transactions.VersionChangeTransaction
|
||||
import info.nightscout.androidaps.db.CompatDBHelper
|
||||
import info.nightscout.androidaps.db.DatabaseHelper
|
||||
import info.nightscout.androidaps.db.StaticInjector
|
||||
import info.nightscout.androidaps.di.StaticInjector
|
||||
import info.nightscout.androidaps.dependencyInjection.DaggerAppComponent
|
||||
import info.nightscout.androidaps.interfaces.ConfigBuilder
|
||||
import info.nightscout.androidaps.interfaces.Config
|
||||
import info.nightscout.androidaps.interfaces.ConfigBuilder
|
||||
import info.nightscout.androidaps.interfaces.PluginBase
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
|
@ -63,7 +61,6 @@ class MainApp : DaggerApplication() {
|
|||
super.onCreate()
|
||||
aapsLogger.debug("onCreate")
|
||||
update(this)
|
||||
dbHelper = OpenHelperManager.getHelper(this, DatabaseHelper::class.java)
|
||||
|
||||
var gitRemote: String? = BuildConfig.REMOTE
|
||||
var commitHash: String? = BuildConfig.HEAD
|
||||
|
@ -134,9 +131,4 @@ class MainApp : DaggerApplication() {
|
|||
keepAliveManager.cancelAlarm(this)
|
||||
super.onTerminate()
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
lateinit var dbHelper: DatabaseHelper
|
||||
}
|
||||
}
|
|
@ -14,6 +14,7 @@ import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin
|
|||
import info.nightscout.androidaps.danaRv2.DanaRv2Plugin
|
||||
import info.nightscout.androidaps.danar.DanaRPlugin
|
||||
import info.nightscout.androidaps.danars.DanaRSPlugin
|
||||
import info.nightscout.androidaps.diaconn.DiaconnG8Plugin
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.events.EventPreferenceChange
|
||||
import info.nightscout.androidaps.events.EventRebuildTabs
|
||||
|
@ -99,6 +100,7 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang
|
|||
@Inject lateinit var passwordCheck: PasswordCheck
|
||||
@Inject lateinit var nsSettingStatus: NSSettingsStatus
|
||||
@Inject lateinit var openHumansUploader: OpenHumansUploader
|
||||
@Inject lateinit var diaconnG8Plugin: DiaconnG8Plugin
|
||||
|
||||
override fun onAttach(context: Context) {
|
||||
AndroidSupportInjection.inject(this)
|
||||
|
@ -173,6 +175,7 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang
|
|||
addPreferencesFromResourceIfEnabled(localInsightPlugin, rootKey, config.PUMPDRIVERS)
|
||||
addPreferencesFromResourceIfEnabled(comboPlugin, rootKey, config.PUMPDRIVERS)
|
||||
addPreferencesFromResourceIfEnabled(medtronicPumpPlugin, rootKey, config.PUMPDRIVERS)
|
||||
addPreferencesFromResourceIfEnabled(diaconnG8Plugin, rootKey, config.PUMPDRIVERS)
|
||||
addPreferencesFromResource(R.xml.pref_pump, rootKey, config.PUMPDRIVERS)
|
||||
addPreferencesFromResourceIfEnabled(virtualPumpPlugin, rootKey)
|
||||
addPreferencesFromResourceIfEnabled(insulinOrefFreePeakPlugin, rootKey)
|
||||
|
@ -182,7 +185,7 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang
|
|||
addPreferencesFromResourceIfEnabled(automationPlugin, rootKey)
|
||||
addPreferencesFromResourceIfEnabled(wearPlugin, rootKey)
|
||||
addPreferencesFromResourceIfEnabled(statusLinePlugin, rootKey)
|
||||
addPreferencesFromResource(R.xml.pref_alerts, rootKey) // TODO not organized well
|
||||
addPreferencesFromResource(R.xml.pref_alerts, rootKey)
|
||||
addPreferencesFromResource(R.xml.pref_datachoices, rootKey)
|
||||
addPreferencesFromResourceIfEnabled(maintenancePlugin, rootKey)
|
||||
addPreferencesFromResourceIfEnabled(openHumansUploader, rootKey)
|
||||
|
|
|
@ -31,7 +31,7 @@ import info.nightscout.androidaps.logging.LTag
|
|||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientRestart
|
||||
import info.nightscout.androidaps.plugins.treatments.events.EventTreatmentUpdateGui
|
||||
import info.nightscout.androidaps.events.EventTreatmentUpdateGui
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.T
|
||||
|
|
|
@ -24,7 +24,7 @@ import info.nightscout.androidaps.logging.LTag
|
|||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientRestart
|
||||
import info.nightscout.androidaps.plugins.treatments.events.EventTreatmentUpdateGui
|
||||
import info.nightscout.androidaps.events.EventTreatmentUpdateGui
|
||||
import info.nightscout.androidaps.activities.fragments.TreatmentsCareportalFragment.RecyclerViewAdapter.TherapyEventsViewHolder
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
|
|
|
@ -29,7 +29,7 @@ import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientR
|
|||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventNewHistoryData
|
||||
import info.nightscout.androidaps.plugins.profile.local.LocalProfilePlugin
|
||||
import info.nightscout.androidaps.plugins.profile.local.events.EventLocalProfileChanged
|
||||
import info.nightscout.androidaps.plugins.treatments.events.EventTreatmentUpdateGui
|
||||
import info.nightscout.androidaps.events.EventTreatmentUpdateGui
|
||||
import info.nightscout.androidaps.activities.fragments.TreatmentsProfileSwitchFragment.RecyclerProfileViewAdapter.ProfileSwitchViewHolder
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
|
|
|
@ -28,7 +28,7 @@ import info.nightscout.androidaps.logging.LTag
|
|||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientRestart
|
||||
import info.nightscout.androidaps.plugins.treatments.events.EventTreatmentUpdateGui
|
||||
import info.nightscout.androidaps.events.EventTreatmentUpdateGui
|
||||
import info.nightscout.androidaps.activities.fragments.TreatmentsTempTargetFragment.RecyclerViewAdapter.TempTargetsViewHolder
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
|
|
|
@ -19,7 +19,7 @@ import info.nightscout.androidaps.interfaces.ImportExportPrefs
|
|||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.treatments.events.EventTreatmentUpdateGui
|
||||
import info.nightscout.androidaps.events.EventTreatmentUpdateGui
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.T
|
||||
|
|
|
@ -1,296 +0,0 @@
|
|||
package info.nightscout.androidaps.db;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.DatabaseUtils;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
|
||||
import com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper;
|
||||
import com.j256.ormlite.dao.CloseableIterator;
|
||||
import com.j256.ormlite.dao.Dao;
|
||||
import com.j256.ormlite.stmt.DeleteBuilder;
|
||||
import com.j256.ormlite.stmt.PreparedQuery;
|
||||
import com.j256.ormlite.stmt.QueryBuilder;
|
||||
import com.j256.ormlite.stmt.Where;
|
||||
import com.j256.ormlite.support.ConnectionSource;
|
||||
import com.j256.ormlite.table.TableUtils;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import info.nightscout.androidaps.events.EventRefreshOverview;
|
||||
import info.nightscout.androidaps.interfaces.ActivePlugin;
|
||||
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||
import info.nightscout.androidaps.logging.LTag;
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
|
||||
import info.nightscout.androidaps.plugins.general.openhumans.OpenHumansUploader;
|
||||
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin;
|
||||
import info.nightscout.androidaps.utils.DateUtil;
|
||||
|
||||
/**
|
||||
* This Helper contains all resource to provide a central DB management functionality. Only methods handling
|
||||
* data-structure (and not the DB content) should be contained in here (meaning DDL and not SQL).
|
||||
* <p>
|
||||
* This class can safely be called from Services, but should not call Services to avoid circular dependencies.
|
||||
* One major issue with this (right now) are the scheduled events, which are put into the service. Therefor all
|
||||
* direct calls to the corresponding methods (eg. resetDatabases) should be done by a central service.
|
||||
*/
|
||||
public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||
@Inject AAPSLogger aapsLogger;
|
||||
@Inject RxBusWrapper rxBus;
|
||||
@Inject VirtualPumpPlugin virtualPumpPlugin;
|
||||
@Inject OpenHumansUploader openHumansUploader;
|
||||
@Inject ActivePlugin activePlugin;
|
||||
@Inject DateUtil dateUtil;
|
||||
|
||||
public static final String DATABASE_NAME = "AndroidAPSDb";
|
||||
|
||||
private static final int DATABASE_VERSION = 13;
|
||||
|
||||
public static Long earliestDataChange = null;
|
||||
|
||||
private int oldVersion = 0;
|
||||
private int newVersion = 0;
|
||||
|
||||
public DatabaseHelper(Context context) {
|
||||
super(context, DATABASE_NAME, null, DATABASE_VERSION);
|
||||
StaticInjector.Companion.getInstance().androidInjector().inject(this);
|
||||
onCreate(getWritableDatabase(), getConnectionSource());
|
||||
//onUpgrade(getWritableDatabase(), getConnectionSource(), 1,1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(SQLiteDatabase database, ConnectionSource connectionSource) {
|
||||
try {
|
||||
aapsLogger.info(LTag.DATABASE, "onCreate");
|
||||
TableUtils.createTableIfNotExists(connectionSource, OmnipodHistoryRecord.class);
|
||||
TableUtils.createTableIfNotExists(connectionSource, OHQueueItem.class);
|
||||
} catch (SQLException e) {
|
||||
aapsLogger.error("Can't create database", e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpgrade(SQLiteDatabase database, ConnectionSource connectionSource, int oldVersion, int newVersion) {
|
||||
try {
|
||||
this.oldVersion = oldVersion;
|
||||
this.newVersion = newVersion;
|
||||
|
||||
if (oldVersion < 7) {
|
||||
aapsLogger.info(LTag.DATABASE, "onUpgrade");
|
||||
onCreate(database, connectionSource);
|
||||
}
|
||||
TableUtils.createTableIfNotExists(connectionSource, OHQueueItem.class);
|
||||
} catch (SQLException e) {
|
||||
aapsLogger.error("Can't drop databases", e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
||||
aapsLogger.info(LTag.DATABASE, "Do nothing for downgrading...");
|
||||
aapsLogger.info(LTag.DATABASE, "oldVersion: {}, newVersion: {}", oldVersion, newVersion);
|
||||
}
|
||||
|
||||
public int getOldVersion() {
|
||||
return oldVersion;
|
||||
}
|
||||
|
||||
public int getNewVersion() {
|
||||
return newVersion;
|
||||
}
|
||||
|
||||
public long size(String database) {
|
||||
return DatabaseUtils.queryNumEntries(getReadableDatabase(), database);
|
||||
}
|
||||
|
||||
// --------------------- DB resets ---------------------
|
||||
|
||||
public void resetDatabases() {
|
||||
try {
|
||||
TableUtils.dropTable(connectionSource, OmnipodHistoryRecord.class, true);
|
||||
TableUtils.createTableIfNotExists(connectionSource, OmnipodHistoryRecord.class);
|
||||
updateEarliestDataChange(0);
|
||||
} catch (SQLException e) {
|
||||
aapsLogger.error("Unhandled exception", e);
|
||||
}
|
||||
virtualPumpPlugin.setFakingStatus(true);
|
||||
new java.util.Timer().schedule(
|
||||
new java.util.TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
rxBus.send(new EventRefreshOverview("resetDatabases", false));
|
||||
}
|
||||
},
|
||||
3000
|
||||
);
|
||||
}
|
||||
|
||||
// ------------------ getDao -------------------------------------------
|
||||
|
||||
private Dao<OmnipodHistoryRecord, Long> getDaoPodHistory() throws SQLException {
|
||||
return getDao(OmnipodHistoryRecord.class);
|
||||
}
|
||||
|
||||
private Dao<OHQueueItem, Long> getDaoOpenHumansQueue() throws SQLException {
|
||||
return getDao(OHQueueItem.class);
|
||||
}
|
||||
|
||||
public static void updateEarliestDataChange(long newDate) {
|
||||
if (earliestDataChange == null) {
|
||||
earliestDataChange = newDate;
|
||||
return;
|
||||
}
|
||||
if (newDate < earliestDataChange) {
|
||||
earliestDataChange = newDate;
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------- Food handling ---------------
|
||||
|
||||
// ---------------- PodHistory handling ---------------
|
||||
|
||||
public void createOrUpdate(OmnipodHistoryRecord omnipodHistoryRecord) {
|
||||
try {
|
||||
getDaoPodHistory().createOrUpdate(omnipodHistoryRecord);
|
||||
} catch (SQLException e) {
|
||||
aapsLogger.error("Unhandled exception", e);
|
||||
}
|
||||
}
|
||||
|
||||
public List<OmnipodHistoryRecord> getAllOmnipodHistoryRecordsFromTimeStamp(long from, boolean ascending) {
|
||||
try {
|
||||
Dao<OmnipodHistoryRecord, Long> daoPodHistory = getDaoPodHistory();
|
||||
List<OmnipodHistoryRecord> podHistories;
|
||||
QueryBuilder<OmnipodHistoryRecord, Long> queryBuilder = daoPodHistory.queryBuilder();
|
||||
queryBuilder.orderBy("date", ascending);
|
||||
//queryBuilder.limit(100L);
|
||||
Where where = queryBuilder.where();
|
||||
where.ge("date", from);
|
||||
PreparedQuery<OmnipodHistoryRecord> preparedQuery = queryBuilder.prepare();
|
||||
podHistories = daoPodHistory.query(preparedQuery);
|
||||
return podHistories;
|
||||
} catch (SQLException e) {
|
||||
aapsLogger.error("Unhandled exception", e);
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
public OmnipodHistoryRecord findOmnipodHistoryRecordByPumpId(long pumpId) {
|
||||
try {
|
||||
Dao<OmnipodHistoryRecord, Long> daoPodHistory = getDaoPodHistory();
|
||||
QueryBuilder<OmnipodHistoryRecord, Long> queryBuilder = daoPodHistory.queryBuilder();
|
||||
queryBuilder.orderBy("date", false);
|
||||
Where<OmnipodHistoryRecord, Long> where = queryBuilder.where();
|
||||
where.eq("pumpId", pumpId);
|
||||
PreparedQuery<OmnipodHistoryRecord> preparedQuery = queryBuilder.prepare();
|
||||
return daoPodHistory.queryForFirst(preparedQuery);
|
||||
} catch (SQLException e) {
|
||||
aapsLogger.error("Unhandled exception", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
TODO implement again for database branch // Copied from xDrip+
|
||||
String calculateDirection(BgReading bgReading) {
|
||||
// Rework to get bgreaings from internal DB and calculate on that base
|
||||
|
||||
List<BgReading> bgReadingsList = MainApp.getDbHelper().getAllBgreadingsDataFromTime(bgReading.date - T.mins(10).msecs(), false);
|
||||
if (bgReadingsList == null || bgReadingsList.size() < 2)
|
||||
return "NONE";
|
||||
BgReading current = bgReadingsList.get(1);
|
||||
BgReading previous = bgReadingsList.get(0);
|
||||
|
||||
if (bgReadingsList.get(1).date < bgReadingsList.get(0).date) {
|
||||
current = bgReadingsList.get(0);
|
||||
previous = bgReadingsList.get(1);
|
||||
}
|
||||
|
||||
double slope;
|
||||
|
||||
// Avoid division by 0
|
||||
if (current.date == previous.date)
|
||||
slope = 0;
|
||||
else
|
||||
slope = (previous.value - current.value) / (previous.date - current.date);
|
||||
|
||||
// aapsLogger.error(LTag.GLUCOSE, "Slope is :" + slope + " delta " + (previous.value - current.value) + " date difference " + (current.date - previous.date));
|
||||
|
||||
double slope_by_minute = slope * 60000;
|
||||
String arrow = "NONE";
|
||||
|
||||
if (slope_by_minute <= (-3.5)) {
|
||||
arrow = "DoubleDown";
|
||||
} else if (slope_by_minute <= (-2)) {
|
||||
arrow = "SingleDown";
|
||||
} else if (slope_by_minute <= (-1)) {
|
||||
arrow = "FortyFiveDown";
|
||||
} else if (slope_by_minute <= (1)) {
|
||||
arrow = "Flat";
|
||||
} else if (slope_by_minute <= (2)) {
|
||||
arrow = "FortyFiveUp";
|
||||
} else if (slope_by_minute <= (3.5)) {
|
||||
arrow = "SingleUp";
|
||||
} else if (slope_by_minute <= (40)) {
|
||||
arrow = "DoubleUp";
|
||||
}
|
||||
// aapsLogger.error(LTag.GLUCOSE, "Direction set to: " + arrow);
|
||||
return arrow;
|
||||
}
|
||||
*/
|
||||
// ---------------- Open Humans Queue handling ---------------
|
||||
|
||||
public void clearOpenHumansQueue() {
|
||||
try {
|
||||
TableUtils.clearTable(connectionSource, OHQueueItem.class);
|
||||
} catch (SQLException e) {
|
||||
aapsLogger.error("Unhandled exception", e);
|
||||
}
|
||||
}
|
||||
|
||||
public void createOrUpdate(OHQueueItem item) {
|
||||
try {
|
||||
getDaoOpenHumansQueue().createOrUpdate(item);
|
||||
} catch (SQLException e) {
|
||||
aapsLogger.error("Unhandled exception", e);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeAllOHQueueItemsWithIdSmallerThan(long id) {
|
||||
try {
|
||||
DeleteBuilder<OHQueueItem, Long> deleteBuilder = getDaoOpenHumansQueue().deleteBuilder();
|
||||
deleteBuilder.where().le("id", id);
|
||||
deleteBuilder.delete();
|
||||
} catch (SQLException e) {
|
||||
aapsLogger.error("Unhandled exception", e);
|
||||
}
|
||||
}
|
||||
|
||||
public List<OHQueueItem> getAllOHQueueItems(Long maxEntries) {
|
||||
try {
|
||||
return getDaoOpenHumansQueue()
|
||||
.queryBuilder()
|
||||
.orderBy("id", true)
|
||||
.limit(maxEntries)
|
||||
.query();
|
||||
} catch (SQLException e) {
|
||||
aapsLogger.error("Unhandled exception", e);
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public long getOHQueueSize() {
|
||||
try {
|
||||
return getDaoOpenHumansQueue().countOf();
|
||||
} catch (SQLException e) {
|
||||
aapsLogger.error("Unhandled exception", e);
|
||||
}
|
||||
return 0L;
|
||||
}
|
||||
}
|
|
@ -1,84 +0,0 @@
|
|||
package info.nightscout.androidaps.db;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.j256.ormlite.dao.CloseableIterator;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface;
|
||||
|
||||
@Deprecated
|
||||
@Singleton
|
||||
public class DatabaseHelperProvider implements DatabaseHelperInterface {
|
||||
|
||||
@Inject DatabaseHelperProvider() {
|
||||
}
|
||||
|
||||
@Override public void createOrUpdate(@NonNull OmnipodHistoryRecord record) {
|
||||
MainApp.Companion.getDbHelper().createOrUpdate(record);
|
||||
}
|
||||
|
||||
@Override public boolean createOrUpdate(@NonNull TemporaryBasal tempBasal) {
|
||||
// return MainApp.Companion.getDbHelper().createOrUpdate(tempBasal);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nullable @Override public TemporaryBasal findTempBasalByPumpId(long id) {
|
||||
// return MainApp.Companion.getDbHelper().findTempBasalByPumpId(id);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@NonNull @Override public List<TemporaryBasal> getTemporaryBasalsDataFromTime(long mills, boolean ascending) {
|
||||
// return MainApp.Companion.getDbHelper().getTemporaryBasalsDataFromTime(mills, ascending);
|
||||
return null;
|
||||
}
|
||||
|
||||
@NonNull @Override public List<OmnipodHistoryRecord> getAllOmnipodHistoryRecordsFromTimestamp(long timestamp, boolean ascending) {
|
||||
return MainApp.Companion.getDbHelper().getAllOmnipodHistoryRecordsFromTimeStamp(timestamp, ascending);
|
||||
}
|
||||
|
||||
@Nullable @Override public OmnipodHistoryRecord findOmnipodHistoryRecordByPumpId(long pumpId) {
|
||||
return MainApp.Companion.getDbHelper().findOmnipodHistoryRecordByPumpId(pumpId);
|
||||
}
|
||||
|
||||
@Override public void delete(@NonNull ExtendedBolus extendedBolus) {
|
||||
// MainApp.Companion.getDbHelper().delete(extendedBolus);
|
||||
}
|
||||
|
||||
@Nullable @Override public ExtendedBolus getExtendedBolusByPumpId(long pumpId) {
|
||||
// return MainApp.Companion.getDbHelper().getExtendedBolusByPumpId(pumpId);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override public void resetDatabases() {
|
||||
MainApp.Companion.getDbHelper().resetDatabases();
|
||||
}
|
||||
|
||||
@Override public void createOrUpdate(@NonNull OHQueueItem record) {
|
||||
MainApp.Companion.getDbHelper().createOrUpdate(record);
|
||||
}
|
||||
|
||||
@NonNull @Override public List<OHQueueItem> getAllOHQueueItems(long maxEntries) {
|
||||
return MainApp.Companion.getDbHelper().getAllOHQueueItems(maxEntries);
|
||||
}
|
||||
|
||||
@Override public long getOHQueueSize() {
|
||||
return MainApp.Companion.getDbHelper().getOHQueueSize();
|
||||
}
|
||||
|
||||
@Override public void clearOpenHumansQueue() {
|
||||
MainApp.Companion.getDbHelper().clearOpenHumansQueue();
|
||||
}
|
||||
|
||||
@Override public void removeAllOHQueueItemsWithIdSmallerThan(long id) {
|
||||
MainApp.Companion.getDbHelper().removeAllOHQueueItemsWithIdSmallerThan(id);
|
||||
}
|
||||
}
|
|
@ -1,2 +0,0 @@
|
|||
package info.nightscout.androidaps.db
|
||||
|
|
@ -13,6 +13,7 @@ import info.nightscout.androidaps.danar.di.DanaRModule
|
|||
import info.nightscout.androidaps.danars.di.DanaRSModule
|
||||
import info.nightscout.androidaps.database.DatabaseModule
|
||||
import info.nightscout.androidaps.di.CoreModule
|
||||
import info.nightscout.androidaps.diaconn.di.DiaconnG8Module
|
||||
import info.nightscout.androidaps.insight.di.InsightDatabaseModule
|
||||
import info.nightscout.androidaps.insight.di.InsightModule
|
||||
import info.nightscout.androidaps.plugins.pump.common.di.PumpCommonModule
|
||||
|
@ -58,7 +59,8 @@ import javax.inject.Singleton
|
|||
InsightModule::class,
|
||||
InsightDatabaseModule::class,
|
||||
WorkersModule::class,
|
||||
OHUploaderModule::class
|
||||
OHUploaderModule::class,
|
||||
DiaconnG8Module::class
|
||||
]
|
||||
)
|
||||
interface AppComponent : AndroidInjector<MainApp> {
|
||||
|
|
|
@ -8,7 +8,6 @@ import dagger.Provides
|
|||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.MainApp
|
||||
import info.nightscout.androidaps.database.AppRepository
|
||||
import info.nightscout.androidaps.db.DatabaseHelperProvider
|
||||
import info.nightscout.androidaps.interfaces.*
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
|
||||
|
@ -20,7 +19,6 @@ import info.nightscout.androidaps.plugins.general.nsclient.DataSyncSelectorImple
|
|||
import info.nightscout.androidaps.plugins.general.smsCommunicator.SmsCommunicatorPlugin
|
||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin
|
||||
import info.nightscout.androidaps.plugins.pump.PumpSyncImplementation
|
||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
||||
import info.nightscout.androidaps.queue.CommandQueue
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.androidNotification.NotificationHolderImpl
|
||||
|
@ -56,9 +54,7 @@ open class AppModule {
|
|||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideStorage(): Storage {
|
||||
return FileStorage()
|
||||
}
|
||||
fun provideStorage(): Storage = FileStorage()
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
|
@ -66,9 +62,8 @@ open class AppModule {
|
|||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideProfileFunction(aapsLogger: AAPSLogger, sp: SP, resourceHelper: ResourceHelper, activePlugin: ActivePlugin, repository: AppRepository, dateUtil: DateUtil): ProfileFunction {
|
||||
return ProfileFunctionImplementation(aapsLogger, sp, resourceHelper, activePlugin, repository, dateUtil)
|
||||
}
|
||||
fun provideProfileFunction(aapsLogger: AAPSLogger, sp: SP, resourceHelper: ResourceHelper, activePlugin: ActivePlugin, repository: AppRepository, dateUtil: DateUtil): ProfileFunction =
|
||||
ProfileFunctionImplementation(aapsLogger, sp, resourceHelper, activePlugin, repository, dateUtil)
|
||||
|
||||
@Module
|
||||
interface AppBindings {
|
||||
|
@ -79,11 +74,7 @@ open class AppModule {
|
|||
@Binds fun bindCommandQueueProvider(commandQueue: CommandQueue): CommandQueueProvider
|
||||
@Binds fun bindConfigInterface(config: ConfigImpl): Config
|
||||
|
||||
@Binds
|
||||
fun bindConfigBuilderInterface(configBuilderPlugin: ConfigBuilderPlugin): ConfigBuilder
|
||||
@Binds fun bindTreatmentsInterface(treatmentsPlugin: TreatmentsPlugin): TreatmentsInterface
|
||||
|
||||
@Binds fun bindDatabaseHelperInterface(databaseHelperProvider: DatabaseHelperProvider): DatabaseHelperInterface
|
||||
@Binds fun bindConfigBuilderInterface(configBuilderPlugin: ConfigBuilderPlugin): ConfigBuilder
|
||||
@Binds fun bindNotificationHolderInterface(notificationHolder: NotificationHolderImpl): NotificationHolder
|
||||
@Binds fun bindImportExportPrefsInterface(importExportPrefs: ImportExportPrefsImpl): ImportExportPrefs
|
||||
@Binds fun bindIconsProviderInterface(iconsProvider: IconsProviderImplementation): IconsProvider
|
||||
|
@ -93,7 +84,6 @@ open class AppModule {
|
|||
@Binds fun bindDataSyncSelector(dataSyncSelectorImplementation: DataSyncSelectorImplementation): DataSyncSelector
|
||||
|
||||
@Binds fun bindPumpSync(pumpSyncImplementation: PumpSyncImplementation): PumpSync
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,9 +2,7 @@ package info.nightscout.androidaps.dependencyInjection
|
|||
|
||||
import dagger.Module
|
||||
import dagger.android.ContributesAndroidInjector
|
||||
import info.nightscout.androidaps.db.DatabaseHelper
|
||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus
|
||||
import info.nightscout.androidaps.plugins.treatments.TreatmentService
|
||||
import info.nightscout.androidaps.utils.wizard.BolusWizard
|
||||
import info.nightscout.androidaps.utils.wizard.QuickWizardEntry
|
||||
|
||||
|
@ -14,9 +12,6 @@ abstract class DataClassesModule {
|
|||
|
||||
@ContributesAndroidInjector abstract fun glucoseStatusInjector(): GlucoseStatus
|
||||
|
||||
@ContributesAndroidInjector abstract fun databaseHelperInjector(): DatabaseHelper
|
||||
@ContributesAndroidInjector abstract fun treatmentServiceInjector(): TreatmentService
|
||||
|
||||
@ContributesAndroidInjector abstract fun bolusWizardInjector(): BolusWizard
|
||||
@ContributesAndroidInjector abstract fun quickWizardEntryInjector(): QuickWizardEntry
|
||||
}
|
|
@ -8,6 +8,7 @@ import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin
|
|||
import info.nightscout.androidaps.danaRv2.DanaRv2Plugin
|
||||
import info.nightscout.androidaps.danar.DanaRPlugin
|
||||
import info.nightscout.androidaps.danars.DanaRSPlugin
|
||||
import info.nightscout.androidaps.diaconn.DiaconnG8Plugin
|
||||
import info.nightscout.androidaps.interfaces.PluginBase
|
||||
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
|
||||
import info.nightscout.androidaps.plugins.aps.openAPSAMA.OpenAPSAMAPlugin
|
||||
|
@ -25,7 +26,6 @@ import info.nightscout.androidaps.plugins.general.dataBroadcaster.DataBroadcastP
|
|||
import info.nightscout.androidaps.plugins.general.food.FoodPlugin
|
||||
import info.nightscout.androidaps.plugins.general.maintenance.MaintenancePlugin
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.NSClientPlugin
|
||||
import info.nightscout.androidaps.plugins.general.openhumans.OpenHumansUploader
|
||||
import info.nightscout.androidaps.plugins.general.overview.OverviewPlugin
|
||||
import info.nightscout.androidaps.plugins.general.persistentNotification.PersistentNotificationPlugin
|
||||
import info.nightscout.androidaps.plugins.general.smsCommunicator.SmsCommunicatorPlugin
|
||||
|
@ -48,7 +48,6 @@ import info.nightscout.androidaps.plugins.sensitivity.SensitivityAAPSPlugin
|
|||
import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin
|
||||
import info.nightscout.androidaps.plugins.sensitivity.SensitivityWeightedAveragePlugin
|
||||
import info.nightscout.androidaps.plugins.source.*
|
||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
||||
import javax.inject.Qualifier
|
||||
|
||||
@Module
|
||||
|
@ -150,11 +149,11 @@ abstract class PluginsModule {
|
|||
@IntKey(140)
|
||||
abstract fun bindComboPlugin(plugin: ComboPlugin): PluginBase
|
||||
|
||||
// @Binds
|
||||
// @PumpDriver
|
||||
// @IntoMap
|
||||
// @IntKey(150)
|
||||
// abstract fun bindMedtronicPumpPlugin(plugin: MedtronicPumpPlugin): PluginBase
|
||||
@Binds
|
||||
@PumpDriver
|
||||
@IntoMap
|
||||
@IntKey(150)
|
||||
abstract fun bindMedtronicPumpPlugin(plugin: MedtronicPumpPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@PumpDriver
|
||||
|
@ -168,6 +167,12 @@ abstract class PluginsModule {
|
|||
@IntKey(156)
|
||||
abstract fun bindOmnipodDashPumpPlugin(plugin: OmnipodDashPumpPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@PumpDriver
|
||||
@IntoMap
|
||||
@IntKey(155)
|
||||
abstract fun bindDiaconnG8Plugin(plugin: DiaconnG8Plugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@NotNSClient
|
||||
@IntoMap
|
||||
|
@ -210,12 +215,6 @@ abstract class PluginsModule {
|
|||
@IntKey(250)
|
||||
abstract fun bindAutomationPlugin(plugin: AutomationPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@AllConfigs
|
||||
@IntoMap
|
||||
@IntKey(260)
|
||||
abstract fun bindTreatmentsPlugin(plugin: TreatmentsPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@AllConfigs
|
||||
@IntoMap
|
||||
|
|
|
@ -191,7 +191,7 @@ class FillDialog : DialogFragmentWithDate() {
|
|||
commandQueue.bolus(detailedBolusInfo, object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
ErrorHelperActivity.runAlarm(ctx, result.comment, resourceHelper.gs(R.string.treatmentdeliveryerror), info.nightscout.androidaps.dana.R.raw.boluserror)
|
||||
ErrorHelperActivity.runAlarm(ctx, result.comment, resourceHelper.gs(R.string.treatmentdeliveryerror), R.raw.boluserror)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -224,7 +224,7 @@ class InsulinDialog : DialogFragmentWithDate() {
|
|||
commandQueue.bolus(detailedBolusInfo, object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
ErrorHelperActivity.runAlarm(ctx, result.comment, resourceHelper.gs(R.string.treatmentdeliveryerror), info.nightscout.androidaps.dana.R.raw.boluserror)
|
||||
ErrorHelperActivity.runAlarm(ctx, result.comment, resourceHelper.gs(R.string.treatmentdeliveryerror), R.raw.boluserror)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -279,7 +279,7 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
loopPlugin.setPluginEnabled(PluginType.LOOP, false)
|
||||
loopPlugin.setFragmentVisible(PluginType.LOOP, false)
|
||||
configBuilder.storeSettings("DisablingLoop")
|
||||
rxBus.send(EventRefreshOverview("suspendmenu"))
|
||||
rxBus.send(EventRefreshOverview("suspend_menu"))
|
||||
commandQueue.cancelTempBasal(true, object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
|
@ -302,7 +302,7 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
loopPlugin.setPluginEnabled(PluginType.LOOP, true)
|
||||
loopPlugin.setFragmentVisible(PluginType.LOOP, true)
|
||||
configBuilder.storeSettings("EnablingLoop")
|
||||
rxBus.send(EventRefreshOverview("suspendmenu"))
|
||||
rxBus.send(EventRefreshOverview("suspend_menu"))
|
||||
disposable += repository.runTransactionForResult(CancelCurrentOfflineEventIfAnyTransaction(dateUtil.now()))
|
||||
.subscribe({ result ->
|
||||
result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated OfflineEvent $it") }
|
||||
|
@ -320,11 +320,11 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
}, {
|
||||
aapsLogger.error(LTag.DATABASE, "Error while saving OfflineEvent", it)
|
||||
})
|
||||
rxBus.send(EventRefreshOverview("suspendmenu"))
|
||||
rxBus.send(EventRefreshOverview("suspend_menu"))
|
||||
commandQueue.cancelTempBasal(true, object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
ErrorHelperActivity.runAlarm(ctx, result.comment, resourceHelper.gs(R.string.tempbasaldeliveryerror), info.nightscout.androidaps.dana.R.raw.boluserror)
|
||||
ErrorHelperActivity.runAlarm(ctx, result.comment, resourceHelper.gs(R.string.tempbasaldeliveryerror), R.raw.boluserror)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -334,119 +334,74 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
|
||||
R.id.overview_suspend_1h -> {
|
||||
uel.log(Action.SUSPEND, Sources.LoopDialog, ValueWithUnit.Hour(1))
|
||||
disposable += repository.runTransactionForResult(InsertAndCancelCurrentOfflineEventTransaction(dateUtil.now(), T.hours(1).msecs(), OfflineEvent.Reason.SUSPEND))
|
||||
.subscribe({ result ->
|
||||
result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated OfflineEvent $it") }
|
||||
result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted OfflineEvent $it") }
|
||||
}, {
|
||||
aapsLogger.error(LTag.DATABASE, "Error while saving OfflineEvent", it)
|
||||
})
|
||||
rxBus.send(EventRefreshOverview("suspendmenu"))
|
||||
loopPlugin.suspendLoop(T.hours(1).mins().toInt())
|
||||
rxBus.send(EventRefreshOverview("suspend_menu"))
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.overview_suspend_2h -> {
|
||||
uel.log(Action.SUSPEND, Sources.LoopDialog, ValueWithUnit.Hour(2))
|
||||
disposable += repository.runTransactionForResult(InsertAndCancelCurrentOfflineEventTransaction(dateUtil.now(), T.hours(2).msecs(), OfflineEvent.Reason.SUSPEND))
|
||||
.subscribe({ result ->
|
||||
result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated OfflineEvent $it") }
|
||||
result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted OfflineEvent $it") }
|
||||
}, {
|
||||
aapsLogger.error(LTag.DATABASE, "Error while saving OfflineEvent", it)
|
||||
})
|
||||
rxBus.send(EventRefreshOverview("suspendmenu"))
|
||||
loopPlugin.suspendLoop(T.hours(2).mins().toInt())
|
||||
rxBus.send(EventRefreshOverview("suspend_menu"))
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.overview_suspend_3h -> {
|
||||
uel.log(Action.SUSPEND, Sources.LoopDialog, ValueWithUnit.Hour(3))
|
||||
disposable += repository.runTransactionForResult(InsertAndCancelCurrentOfflineEventTransaction(dateUtil.now(), T.hours(3).msecs(), OfflineEvent.Reason.SUSPEND))
|
||||
.subscribe({ result ->
|
||||
result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated OfflineEvent $it") }
|
||||
result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted OfflineEvent $it") }
|
||||
}, {
|
||||
aapsLogger.error(LTag.DATABASE, "Error while saving OfflineEvent", it)
|
||||
})
|
||||
rxBus.send(EventRefreshOverview("suspendmenu"))
|
||||
loopPlugin.suspendLoop(T.hours(3).mins().toInt())
|
||||
rxBus.send(EventRefreshOverview("suspend_menu"))
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.overview_suspend_10h -> {
|
||||
uel.log(Action.SUSPEND, Sources.LoopDialog, ValueWithUnit.Hour(10))
|
||||
disposable += repository.runTransactionForResult(InsertAndCancelCurrentOfflineEventTransaction(dateUtil.now(), T.hours(10).msecs(), OfflineEvent.Reason.SUSPEND))
|
||||
.subscribe({ result ->
|
||||
result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated OfflineEvent $it") }
|
||||
result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted OfflineEvent $it") }
|
||||
}, {
|
||||
aapsLogger.error(LTag.DATABASE, "Error while saving OfflineEvent", it)
|
||||
})
|
||||
rxBus.send(EventRefreshOverview("suspendmenu"))
|
||||
loopPlugin.suspendLoop(T.hours(10).mins().toInt())
|
||||
rxBus.send(EventRefreshOverview("suspend_menu"))
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.overview_disconnect_15m -> {
|
||||
profileFunction.getProfile()?.let { profile ->
|
||||
uel.log(Action.DISCONNECT, Sources.LoopDialog, ValueWithUnit.Minute(15))
|
||||
disposable += repository.runTransactionForResult(InsertAndCancelCurrentOfflineEventTransaction(dateUtil.now(), T.mins(15).msecs(), OfflineEvent.Reason.DISCONNECT_PUMP))
|
||||
.subscribe({ result ->
|
||||
result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated OfflineEvent $it") }
|
||||
result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted OfflineEvent $it") }
|
||||
}, {
|
||||
aapsLogger.error(LTag.DATABASE, "Error while saving OfflineEvent", it)
|
||||
})
|
||||
rxBus.send(EventRefreshOverview("suspendmenu"))
|
||||
loopPlugin.goToZeroTemp(T.mins(15).mins().toInt(), profile, OfflineEvent.Reason.DISCONNECT_PUMP)
|
||||
rxBus.send(EventRefreshOverview("suspend_menu"))
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.overview_disconnect_30m -> {
|
||||
profileFunction.getProfile()?.let { profile ->
|
||||
uel.log(Action.DISCONNECT, Sources.LoopDialog, ValueWithUnit.Minute(30))
|
||||
disposable += repository.runTransactionForResult(InsertAndCancelCurrentOfflineEventTransaction(dateUtil.now(), T.mins(30).msecs(), OfflineEvent.Reason.DISCONNECT_PUMP))
|
||||
.subscribe({ result ->
|
||||
result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated OfflineEvent $it") }
|
||||
result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted OfflineEvent $it") }
|
||||
}, {
|
||||
aapsLogger.error(LTag.DATABASE, "Error while saving OfflineEvent", it)
|
||||
})
|
||||
rxBus.send(EventRefreshOverview("suspendmenu"))
|
||||
loopPlugin.goToZeroTemp(T.mins(30).mins().toInt(), profile, OfflineEvent.Reason.DISCONNECT_PUMP)
|
||||
rxBus.send(EventRefreshOverview("suspend_menu"))
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.overview_disconnect_1h -> {
|
||||
profileFunction.getProfile()?.let { profile ->
|
||||
uel.log(Action.DISCONNECT, Sources.LoopDialog, ValueWithUnit.Hour(1))
|
||||
disposable += repository.runTransactionForResult(InsertAndCancelCurrentOfflineEventTransaction(dateUtil.now(), T.mins(60).msecs(), OfflineEvent.Reason.DISCONNECT_PUMP))
|
||||
.subscribe({ result ->
|
||||
result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated OfflineEvent $it") }
|
||||
result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted OfflineEvent $it") }
|
||||
}, {
|
||||
aapsLogger.error(LTag.DATABASE, "Error while saving OfflineEvent", it)
|
||||
})
|
||||
sp.putBoolean(R.string.key_objectiveusedisconnect, true)
|
||||
rxBus.send(EventRefreshOverview("suspendmenu"))
|
||||
loopPlugin.goToZeroTemp(T.hours(1).mins().toInt(), profile, OfflineEvent.Reason.DISCONNECT_PUMP)
|
||||
rxBus.send(EventRefreshOverview("suspend_menu"))
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.overview_disconnect_2h -> {
|
||||
profileFunction.getProfile()?.let { profile ->
|
||||
uel.log(Action.DISCONNECT, Sources.LoopDialog, ValueWithUnit.Hour(2))
|
||||
disposable += repository.runTransactionForResult(InsertAndCancelCurrentOfflineEventTransaction(dateUtil.now(), T.mins(120).msecs(), OfflineEvent.Reason.DISCONNECT_PUMP))
|
||||
.subscribe({ result ->
|
||||
result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated OfflineEvent $it") }
|
||||
result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted OfflineEvent $it") }
|
||||
}, {
|
||||
aapsLogger.error(LTag.DATABASE, "Error while saving OfflineEvent", it)
|
||||
})
|
||||
rxBus.send(EventRefreshOverview("suspendmenu"))
|
||||
loopPlugin.goToZeroTemp(T.hours(2).mins().toInt(), profile, OfflineEvent.Reason.DISCONNECT_PUMP)
|
||||
rxBus.send(EventRefreshOverview("suspend_menu"))
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.overview_disconnect_3h -> {
|
||||
profileFunction.getProfile()?.let { profile ->
|
||||
uel.log(Action.DISCONNECT, Sources.LoopDialog, ValueWithUnit.Hour(3))
|
||||
disposable += repository.runTransactionForResult(InsertAndCancelCurrentOfflineEventTransaction(dateUtil.now(), T.mins(180).msecs(), OfflineEvent.Reason.DISCONNECT_PUMP))
|
||||
.subscribe({ result ->
|
||||
result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated OfflineEvent $it") }
|
||||
result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted OfflineEvent $it") }
|
||||
}, {
|
||||
aapsLogger.error(LTag.DATABASE, "Error while saving OfflineEvent", it)
|
||||
})
|
||||
rxBus.send(EventRefreshOverview("suspendmenu"))
|
||||
loopPlugin.goToZeroTemp(T.hours(3).mins().toInt(), profile, OfflineEvent.Reason.DISCONNECT_PUMP)
|
||||
rxBus.send(EventRefreshOverview("suspend_menu"))
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -119,7 +119,7 @@ class TempBasalDialog : DialogFragmentWithDate() {
|
|||
val callback: Callback = object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
ErrorHelperActivity.runAlarm(ctx, result.comment, resourceHelper.gs(R.string.tempbasaldeliveryerror), info.nightscout.androidaps.dana.R.raw.boluserror)
|
||||
ErrorHelperActivity.runAlarm(ctx, result.comment, resourceHelper.gs(R.string.tempbasaldeliveryerror), R.raw.boluserror)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -174,7 +174,7 @@ class TreatmentDialog : DialogFragmentWithDate() {
|
|||
commandQueue.bolus(detailedBolusInfo, object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
ErrorHelperActivity.runAlarm(ctx, result.comment, resourceHelper.gs(R.string.treatmentdeliveryerror), info.nightscout.androidaps.dana.R.raw.boluserror)
|
||||
ErrorHelperActivity.runAlarm(ctx, result.comment, resourceHelper.gs(R.string.treatmentdeliveryerror), R.raw.boluserror)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
package info.nightscout.androidaps.events
|
||||
|
||||
class EventTreatmentUpdateGui : EventUpdateGui()
|
|
@ -1,6 +1,6 @@
|
|||
package info.nightscout.androidaps.plugins.aps.logger
|
||||
|
||||
import info.nightscout.androidaps.db.StaticInjector
|
||||
import info.nightscout.androidaps.di.StaticInjector
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import org.mozilla.javascript.ScriptableObject
|
||||
|
|
|
@ -170,7 +170,9 @@ open class LoopPlugin @Inject constructor(
|
|||
|
||||
override var enabled: Boolean
|
||||
get() = isEnabled()
|
||||
set(value) { setPluginEnabled(PluginType.LOOP, value)}
|
||||
set(value) {
|
||||
setPluginEnabled(PluginType.LOOP, value)
|
||||
}
|
||||
|
||||
val isLGS: Boolean
|
||||
get() {
|
||||
|
@ -209,6 +211,17 @@ open class LoopPlugin @Inject constructor(
|
|||
invoke(initiator, allowNotification, false)
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun isEmptyQueue(): Boolean {
|
||||
val maxMinutes = 2L
|
||||
val start = dateUtil.now()
|
||||
while (start + T.mins(maxMinutes).msecs() > dateUtil.now()) {
|
||||
if (commandQueue.size() == 0 && commandQueue.performing() == null) return true
|
||||
SystemClock.sleep(100)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
operator fun invoke(initiator: String, allowNotification: Boolean, tempBasalFallback: Boolean) {
|
||||
try {
|
||||
|
@ -247,6 +260,12 @@ open class LoopPlugin @Inject constructor(
|
|||
return
|
||||
} else rxBus.send(EventLoopInvoked())
|
||||
|
||||
if (!isEmptyQueue()) {
|
||||
aapsLogger.debug(LTag.APS, resourceHelper.gs(R.string.pumpbusy))
|
||||
rxBus.send(EventLoopSetLastRunGui(resourceHelper.gs(R.string.pumpbusy)))
|
||||
return
|
||||
}
|
||||
|
||||
// Prepare for pumps using % basals
|
||||
if (pump.pumpDescription.tempBasalStyle == PumpDescription.PERCENT && allowPercentage()) {
|
||||
apsResult.usePercent = true
|
||||
|
@ -311,15 +330,15 @@ open class LoopPlugin @Inject constructor(
|
|||
if (sp.getBoolean(R.string.key_enable_carbs_required_alert_local, true) && sp.getBoolean(R.string.key_raise_notifications_as_android_notifications, true)) {
|
||||
val intentAction5m = Intent(context, CarbSuggestionReceiver::class.java)
|
||||
intentAction5m.putExtra("ignoreDuration", 5)
|
||||
val pendingIntent5m = PendingIntent.getBroadcast(context, 1, intentAction5m, PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
val pendingIntent5m = PendingIntent.getBroadcast(context, 1, intentAction5m, PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
val actionIgnore5m = NotificationCompat.Action(R.drawable.ic_notif_aaps, resourceHelper.gs(R.string.ignore5m, "Ignore 5m"), pendingIntent5m)
|
||||
val intentAction15m = Intent(context, CarbSuggestionReceiver::class.java)
|
||||
intentAction15m.putExtra("ignoreDuration", 15)
|
||||
val pendingIntent15m = PendingIntent.getBroadcast(context, 1, intentAction15m, PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
val pendingIntent15m = PendingIntent.getBroadcast(context, 1, intentAction15m, PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
val actionIgnore15m = NotificationCompat.Action(R.drawable.ic_notif_aaps, resourceHelper.gs(R.string.ignore15m, "Ignore 15m"), pendingIntent15m)
|
||||
val intentAction30m = Intent(context, CarbSuggestionReceiver::class.java)
|
||||
intentAction30m.putExtra("ignoreDuration", 30)
|
||||
val pendingIntent30m = PendingIntent.getBroadcast(context, 1, intentAction30m, PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
val pendingIntent30m = PendingIntent.getBroadcast(context, 1, intentAction30m, PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
val actionIgnore30m = NotificationCompat.Action(R.drawable.ic_notif_aaps, resourceHelper.gs(R.string.ignore30m, "Ignore 30m"), pendingIntent30m)
|
||||
val builder = NotificationCompat.Builder(context, CHANNEL_ID)
|
||||
builder.setSmallIcon(R.drawable.notif_icon)
|
||||
|
@ -357,8 +376,7 @@ open class LoopPlugin @Inject constructor(
|
|||
}
|
||||
}
|
||||
if (resultAfterConstraints.isChangeRequested
|
||||
&& !commandQueue.bolusInQueue()
|
||||
&& !commandQueue.isRunning(Command.CommandType.BOLUS)) {
|
||||
&& !commandQueue.bolusInQueue()) {
|
||||
val waiting = PumpEnactResult(injector)
|
||||
waiting.queued = true
|
||||
if (resultAfterConstraints.tempBasalRequested) lastRun.tbrSetByPump = waiting
|
||||
|
@ -441,7 +459,7 @@ open class LoopPlugin @Inject constructor(
|
|||
stackBuilder.addParentStack(MainActivity::class.java)
|
||||
// Adds the Intent that starts the Activity to the top of the stack
|
||||
stackBuilder.addNextIntent(resultIntent)
|
||||
val resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
val resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
builder.setContentIntent(resultPendingIntent)
|
||||
builder.setVibrate(longArrayOf(1000, 1000, 1000, 1000, 1000))
|
||||
val mNotificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
||||
|
@ -613,7 +631,7 @@ open class LoopPlugin @Inject constructor(
|
|||
commandQueue.tempBasalAbsolute(0.0, durationInMinutes, true, profile, PumpSync.TemporaryBasalType.EMULATED_PUMP_SUSPEND, object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
ErrorHelperActivity.runAlarm(context, result.comment, resourceHelper.gs(R.string.tempbasaldeliveryerror), info.nightscout.androidaps.dana.R.raw.boluserror)
|
||||
ErrorHelperActivity.runAlarm(context, result.comment, resourceHelper.gs(R.string.tempbasaldeliveryerror), R.raw.boluserror)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -621,7 +639,7 @@ open class LoopPlugin @Inject constructor(
|
|||
commandQueue.tempBasalPercent(0, durationInMinutes, true, profile, PumpSync.TemporaryBasalType.EMULATED_PUMP_SUSPEND, object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
ErrorHelperActivity.runAlarm(context, result.comment, resourceHelper.gs(R.string.tempbasaldeliveryerror), info.nightscout.androidaps.dana.R.raw.boluserror)
|
||||
ErrorHelperActivity.runAlarm(context, result.comment, resourceHelper.gs(R.string.tempbasaldeliveryerror), R.raw.boluserror)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -630,7 +648,7 @@ open class LoopPlugin @Inject constructor(
|
|||
commandQueue.cancelExtended(object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
ErrorHelperActivity.runAlarm(context, result.comment, resourceHelper.gs(R.string.extendedbolusdeliveryerror), info.nightscout.androidaps.dana.R.raw.boluserror)
|
||||
ErrorHelperActivity.runAlarm(context, result.comment, resourceHelper.gs(R.string.extendedbolusdeliveryerror), R.raw.boluserror)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -648,7 +666,7 @@ open class LoopPlugin @Inject constructor(
|
|||
commandQueue.cancelTempBasal(true, object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
ErrorHelperActivity.runAlarm(context, result.comment, resourceHelper.gs(R.string.tempbasaldeliveryerror), info.nightscout.androidaps.dana.R.raw.boluserror)
|
||||
ErrorHelperActivity.runAlarm(context, result.comment, resourceHelper.gs(R.string.tempbasaldeliveryerror), R.raw.boluserror)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -114,7 +114,6 @@ class ConfigBuilderFragment : DaggerFragment() {
|
|||
createViewsForPlugins(R.string.configbuilder_loop, R.string.configbuilder_loop_description, PluginType.LOOP, activePlugin.getSpecificPluginsVisibleInList(PluginType.LOOP))
|
||||
createViewsForPlugins(R.string.constraints, R.string.configbuilder_constraints_description, PluginType.CONSTRAINTS, activePlugin.getSpecificPluginsVisibleInList(PluginType.CONSTRAINTS))
|
||||
}
|
||||
createViewsForPlugins(R.string.configbuilder_treatments, R.string.configbuilder_treatments_description, PluginType.TREATMENT, activePlugin.getSpecificPluginsVisibleInList(PluginType.TREATMENT))
|
||||
createViewsForPlugins(R.string.configbuilder_general, R.string.configbuilder_general_description, PluginType.GENERAL, activePlugin.getSpecificPluginsVisibleInList(PluginType.GENERAL))
|
||||
}
|
||||
|
||||
|
@ -139,22 +138,15 @@ class ConfigBuilderFragment : DaggerFragment() {
|
|||
|
||||
@Suppress("InflateParams")
|
||||
val baseView: LinearLayout = fragment.layoutInflater.inflate(R.layout.configbuilder_single_plugin, null) as LinearLayout
|
||||
private val enabledExclusive: RadioButton
|
||||
private val enabledInclusive: CheckBox
|
||||
private val pluginIcon: ImageView
|
||||
private val pluginName: TextView
|
||||
private val pluginDescription: TextView
|
||||
private val pluginPreferences: ImageButton
|
||||
private val pluginVisibility: CheckBox
|
||||
private val enabledExclusive: RadioButton = baseView.findViewById(R.id.plugin_enabled_exclusive)
|
||||
private val enabledInclusive: CheckBox = baseView.findViewById(R.id.plugin_enabled_inclusive)
|
||||
private val pluginIcon: ImageView = baseView.findViewById(R.id.plugin_icon)
|
||||
private val pluginName: TextView = baseView.findViewById(R.id.plugin_name)
|
||||
private val pluginDescription: TextView = baseView.findViewById(R.id.plugin_description)
|
||||
private val pluginPreferences: ImageButton = baseView.findViewById(R.id.plugin_preferences)
|
||||
private val pluginVisibility: CheckBox = baseView.findViewById(R.id.plugin_visibility)
|
||||
|
||||
init {
|
||||
enabledExclusive = baseView.findViewById(R.id.plugin_enabled_exclusive)
|
||||
enabledInclusive = baseView.findViewById(R.id.plugin_enabled_inclusive)
|
||||
pluginIcon = baseView.findViewById(R.id.plugin_icon)
|
||||
pluginName = baseView.findViewById(R.id.plugin_name)
|
||||
pluginDescription = baseView.findViewById(R.id.plugin_description)
|
||||
pluginPreferences = baseView.findViewById(R.id.plugin_preferences)
|
||||
pluginVisibility = baseView.findViewById(R.id.plugin_visibility)
|
||||
|
||||
pluginVisibility.setOnClickListener {
|
||||
plugin.setFragmentVisible(pluginType, pluginVisibility.isChecked)
|
||||
|
|
|
@ -120,7 +120,6 @@ class ConfigBuilderPlugin @Inject constructor(
|
|||
for (p in activePlugin.getPluginsList()) {
|
||||
aapsLogger.debug(LTag.CONFIGBUILDER, p.name + ":" +
|
||||
(if (p.isEnabled(PluginType.GENERAL)) " GENERAL" else "") +
|
||||
(if (p.isEnabled(PluginType.TREATMENT)) " TREATMENT" else "") +
|
||||
(if (p.isEnabled(PluginType.SENSITIVITY)) " SENSITIVITY" else "") +
|
||||
(if (p.isEnabled(PluginType.PROFILE)) " PROFILE" else "") +
|
||||
(if (p.isEnabled(PluginType.APS)) " APS" else "") +
|
||||
|
@ -185,7 +184,6 @@ class ConfigBuilderPlugin @Inject constructor(
|
|||
PluginType.APS -> pluginsInCategory = activePlugin.getSpecificPluginsListByInterface(APS::class.java)
|
||||
PluginType.PROFILE -> pluginsInCategory = activePlugin.getSpecificPluginsListByInterface(ProfileSource::class.java)
|
||||
PluginType.BGSOURCE -> pluginsInCategory = activePlugin.getSpecificPluginsListByInterface(BgSource::class.java)
|
||||
PluginType.TREATMENT -> pluginsInCategory = activePlugin.getSpecificPluginsListByInterface(TreatmentsInterface::class.java)
|
||||
PluginType.PUMP -> pluginsInCategory = activePlugin.getSpecificPluginsListByInterface(Pump::class.java)
|
||||
|
||||
else -> {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package info.nightscout.androidaps.plugins.configBuilder
|
||||
|
||||
import info.nightscout.androidaps.interfaces.Config
|
||||
import info.nightscout.androidaps.interfaces.*
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
|
@ -21,7 +20,6 @@ class PluginStore @Inject constructor(
|
|||
private var activeAPSStore: APS? = null
|
||||
private var activeInsulinStore: Insulin? = null
|
||||
private var activeSensitivityStore: Sensitivity? = null
|
||||
private var activeTreatmentsStore: TreatmentsInterface? = null
|
||||
|
||||
fun loadDefaults() {
|
||||
verifySelectionInCategories()
|
||||
|
@ -121,16 +119,6 @@ class PluginStore @Inject constructor(
|
|||
aapsLogger.debug(LTag.CONFIGBUILDER, "Defaulting PumpInterface")
|
||||
}
|
||||
setFragmentVisibilities((activePumpStore as PluginBase).name, pluginsInCategory, PluginType.PUMP)
|
||||
|
||||
// PluginType.TREATMENT
|
||||
pluginsInCategory = getSpecificPluginsList(PluginType.TREATMENT)
|
||||
activeTreatmentsStore = getTheOneEnabledInArray(pluginsInCategory, PluginType.TREATMENT) as TreatmentsInterface?
|
||||
if (activeTreatmentsStore == null) {
|
||||
activeTreatmentsStore = getDefaultPlugin(PluginType.TREATMENT) as TreatmentsInterface
|
||||
(activeTreatmentsStore as PluginBase).setPluginEnabled(PluginType.TREATMENT, true)
|
||||
aapsLogger.debug(LTag.CONFIGBUILDER, "Defaulting PumpInterface")
|
||||
}
|
||||
setFragmentVisibilities((activeTreatmentsStore as PluginBase).name, pluginsInCategory, PluginType.TREATMENT)
|
||||
}
|
||||
|
||||
private fun setFragmentVisibilities(activePluginName: String, pluginsInCategory: ArrayList<PluginBase>,
|
||||
|
@ -175,10 +163,6 @@ class PluginStore @Inject constructor(
|
|||
get() = activeSensitivityStore
|
||||
?: checkNotNull(activeSensitivityStore) { "No sensitivity selected" }
|
||||
|
||||
override val activeTreatments: TreatmentsInterface
|
||||
get() = activeTreatmentsStore
|
||||
?: checkNotNull(activeTreatmentsStore) { "No treatments selected" }
|
||||
|
||||
override val activeOverview: Overview
|
||||
get() = getSpecificPluginsListByInterface(Overview::class.java).first() as Overview
|
||||
|
||||
|
|
|
@ -67,14 +67,15 @@ class ProfileFunctionImplementation @Inject constructor(
|
|||
override fun getProfile(): Profile? =
|
||||
getProfile(dateUtil.now())
|
||||
|
||||
@Synchronized
|
||||
override fun getProfile(time: Long): Profile? {
|
||||
val rounded = time - time % 1000
|
||||
val cached = cache[rounded]
|
||||
if (cached != null) {
|
||||
// aapsLogger.debug("XXXXXXXXXXXXXXX HIT getProfile for $time $rounded")
|
||||
// aapsLogger.debug("HIT getProfile for $time $rounded")
|
||||
return cached
|
||||
}
|
||||
// aapsLogger.debug("XXXXXXXXXXXXXXX getProfile called for $time")
|
||||
// aapsLogger.debug("getProfile called for $time")
|
||||
val ps = repository.getEffectiveProfileSwitchActiveAt(time).blockingGet()
|
||||
if (ps is ValueWrapper.Existing) {
|
||||
val sealed = ProfileSealed.EPS(ps.value)
|
||||
|
|
|
@ -45,6 +45,7 @@ class ObjectivesPlugin @Inject constructor(
|
|||
var objectives: MutableList<Objective> = ArrayList()
|
||||
|
||||
companion object {
|
||||
|
||||
const val FIRST_OBJECTIVE = 0
|
||||
@Suppress("unused") const val USAGE_OBJECTIVE = 1
|
||||
@Suppress("unused") const val EXAM_OBJECTIVE = 2
|
||||
|
@ -60,7 +61,6 @@ class ObjectivesPlugin @Inject constructor(
|
|||
|
||||
public override fun onStart() {
|
||||
super.onStart()
|
||||
convertSP()
|
||||
setupObjectives()
|
||||
}
|
||||
|
||||
|
@ -68,26 +68,6 @@ class ObjectivesPlugin @Inject constructor(
|
|||
return activePlugin.activePump.pumpDescription.isTempBasalCapable
|
||||
}
|
||||
|
||||
// convert 2.3 SP version
|
||||
private fun convertSP() {
|
||||
doConvertSP(0, "config")
|
||||
doConvertSP(1, "openloop")
|
||||
doConvertSP(2, "maxbasal")
|
||||
doConvertSP(3, "maxiobzero")
|
||||
doConvertSP(4, "maxiob")
|
||||
doConvertSP(5, "autosens")
|
||||
doConvertSP(6, "ama")
|
||||
doConvertSP(7, "smb")
|
||||
}
|
||||
|
||||
private fun doConvertSP(number: Int, name: String) {
|
||||
if (!sp.contains("Objectives_" + name + "_started")) {
|
||||
sp.putLong("Objectives_" + name + "_started", sp.getLong("Objectives" + number + "started", 0L))
|
||||
sp.putLong("Objectives_" + name + "_accomplished", sp.getLong("Objectives" + number + "accomplished", 0L))
|
||||
}
|
||||
// TODO: we can remove Objectives1accomplished sometimes later
|
||||
}
|
||||
|
||||
private fun setupObjectives() {
|
||||
objectives.clear()
|
||||
objectives.add(Objective0(injector))
|
||||
|
@ -125,7 +105,7 @@ class ObjectivesPlugin @Inject constructor(
|
|||
val requestCode = sp.getString(R.string.key_objectives_request_code, "")
|
||||
var url = sp.getString(R.string.key_nsclientinternal_url, "").lowercase(Locale.getDefault())
|
||||
if (!url.endsWith("/")) url = "$url/"
|
||||
@Suppress("DEPRECATION") val hashNS = Hashing.sha1().hashString(url + BuildConfig.APPLICATION_ID + "/" + requestCode, Charsets.UTF_8).toString()
|
||||
@Suppress("DEPRECATION", "UnstableApiUsage") val hashNS = Hashing.sha1().hashString(url + BuildConfig.APPLICATION_ID + "/" + requestCode, Charsets.UTF_8).toString()
|
||||
if (request.equals(hashNS.substring(0, 10), ignoreCase = true)) {
|
||||
sp.putLong("Objectives_" + "openloop" + "_started", dateUtil.now())
|
||||
sp.putLong("Objectives_" + "openloop" + "_accomplished", dateUtil.now())
|
||||
|
|
|
@ -29,6 +29,7 @@ import info.nightscout.androidaps.extensions.toStringMedium
|
|||
import info.nightscout.androidaps.extensions.toStringShort
|
||||
import info.nightscout.androidaps.extensions.toVisibility
|
||||
import info.nightscout.androidaps.activities.HistoryBrowseActivity
|
||||
import info.nightscout.androidaps.diaconn.DiaconnG8Plugin
|
||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||
import info.nightscout.androidaps.interfaces.CommandQueueProvider
|
||||
import info.nightscout.androidaps.interfaces.Config
|
||||
|
@ -304,7 +305,11 @@ class ActionsFragment : DaggerFragment() {
|
|||
val activeBgSource = activePlugin.activeBgSource
|
||||
historyBrowser?.visibility = (profile != null).toVisibility()
|
||||
fill?.visibility = (pump.pumpDescription.isRefillingCapable && pump.isInitialized() && !pump.isSuspended()).toVisibility()
|
||||
if(pump is DiaconnG8Plugin) {
|
||||
pumpBatteryChange?.visibility = (pump.pumpDescription.isBatteryReplaceable && !pump.isBatteryChangeLoggingEnabled()).toVisibility()
|
||||
} else {
|
||||
pumpBatteryChange?.visibility = (pump.pumpDescription.isBatteryReplaceable || (pump is OmnipodErosPumpPlugin && pump.isUseRileyLinkBatteryLevel && pump.isBatteryChangeLoggingEnabled)).toVisibility()
|
||||
}
|
||||
tempTarget?.visibility = (profile != null && config.APS).toVisibility()
|
||||
tddStats?.visibility = pump.pumpDescription.supportsTDDs.toVisibility()
|
||||
|
||||
|
|
|
@ -363,7 +363,7 @@ class ImportExportPrefsImpl @Inject constructor(
|
|||
override fun exportUserEntriesCsv(activity: FragmentActivity, singleEntries: Single<List<UserEntry>>) {
|
||||
val entries = singleEntries.blockingGet()
|
||||
prefFileList.ensureExportDirExists()
|
||||
val newFile = prefFileList.newExportXmlFile()
|
||||
val newFile = prefFileList.newExportCsvFile()
|
||||
|
||||
try {
|
||||
classicPrefsFormat.saveCsv(newFile, entries)
|
||||
|
|
|
@ -16,11 +16,13 @@ import info.nightscout.androidaps.events.EventNewBG
|
|||
import info.nightscout.androidaps.insight.database.InsightDatabase
|
||||
import info.nightscout.androidaps.interfaces.DataSyncSelector
|
||||
import info.nightscout.androidaps.interfaces.ImportExportPrefs
|
||||
import info.nightscout.androidaps.interfaces.IobCobCalculator
|
||||
import info.nightscout.androidaps.interfaces.PumpSync
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.general.maintenance.activities.LogSettingActivity
|
||||
import info.nightscout.androidaps.plugins.general.overview.OverviewData
|
||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventNewHistoryData
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
|
@ -44,6 +46,8 @@ class MaintenanceFragment : DaggerFragment() {
|
|||
@Inject lateinit var uel: UserEntryLogger
|
||||
@Inject lateinit var dataSyncSelector: DataSyncSelector
|
||||
@Inject lateinit var pumpSync: PumpSync
|
||||
@Inject lateinit var iobCobCalculator: IobCobCalculator
|
||||
@Inject lateinit var overviewData: OverviewData
|
||||
|
||||
private val compositeDisposable = CompositeDisposable()
|
||||
|
||||
|
@ -63,7 +67,9 @@ class MaintenanceFragment : DaggerFragment() {
|
|||
binding.logSend.setOnClickListener { maintenancePlugin.sendLogs() }
|
||||
binding.logDelete.setOnClickListener {
|
||||
uel.log(Action.DELETE_LOGS, Sources.Maintenance)
|
||||
maintenancePlugin.deleteLogs()
|
||||
Thread {
|
||||
maintenancePlugin.deleteLogs(5)
|
||||
}.start()
|
||||
}
|
||||
binding.navResetdb.setOnClickListener {
|
||||
activity?.let { activity ->
|
||||
|
@ -75,6 +81,9 @@ class MaintenanceFragment : DaggerFragment() {
|
|||
insightDatabase.clearAllTables()
|
||||
dataSyncSelector.resetToNextFullSync()
|
||||
pumpSync.connectNewPump()
|
||||
overviewData.reset()
|
||||
iobCobCalculator.ads.reset()
|
||||
iobCobCalculator.clearCache()
|
||||
}
|
||||
.subscribeOn(aapsSchedulers.io)
|
||||
.observeOn(aapsSchedulers.main)
|
||||
|
|
|
@ -35,6 +35,7 @@ class MaintenancePlugin @Inject constructor(
|
|||
aapsLogger: AAPSLogger,
|
||||
private val buildHelper: BuildHelper,
|
||||
private val config: Config,
|
||||
private val fileListProvider: PrefFileListProvider,
|
||||
private val loggerUtils: LoggerUtils
|
||||
) : PluginBase(PluginDescription()
|
||||
.mainType(PluginType.GENERAL)
|
||||
|
@ -53,7 +54,7 @@ class MaintenancePlugin @Inject constructor(
|
|||
val recipient = sp.getString(R.string.key_maintenance_logs_email, "logs@androidaps.org")
|
||||
val amount = sp.getInt(R.string.key_maintenance_logs_amount, 2)
|
||||
val logs = getLogFiles(amount)
|
||||
val zipDir = context.getExternalFilesDir("exports")
|
||||
val zipDir = fileListProvider.ensureTempDirExists()
|
||||
val zipFile = File(zipDir, constructName())
|
||||
aapsLogger.debug("zipFile: ${zipFile.absolutePath}")
|
||||
val zip = zipLogs(zipFile, logs)
|
||||
|
@ -65,14 +66,14 @@ class MaintenancePlugin @Inject constructor(
|
|||
|
||||
//todo replace this with a call on startup of the application, specifically to remove
|
||||
// unnecessary garbage from the log exports
|
||||
fun deleteLogs() {
|
||||
fun deleteLogs(keep: Int) {
|
||||
val logDir = File(loggerUtils.logDirectory)
|
||||
val files = logDir.listFiles { _: File?, name: String ->
|
||||
(name.startsWith("AndroidAPS") && name.endsWith(".zip"))
|
||||
}
|
||||
Arrays.sort(files) { f1: File, f2: File -> f1.name.compareTo(f2.name) }
|
||||
Arrays.sort(files) { f1: File, f2: File -> f2.name.compareTo(f1.name) }
|
||||
var delFiles = listOf(*files)
|
||||
val amount = sp.getInt(R.string.key_logshipper_amount, 2)
|
||||
val amount = sp.getInt(R.string.key_logshipper_amount, keep)
|
||||
val keepIndex = amount - 1
|
||||
if (keepIndex < delFiles.size) {
|
||||
delFiles = delFiles.subList(keepIndex, delFiles.size)
|
||||
|
@ -80,7 +81,7 @@ class MaintenancePlugin @Inject constructor(
|
|||
file.delete()
|
||||
}
|
||||
}
|
||||
val exportDir = File(loggerUtils.logDirectory, "exports")
|
||||
val exportDir = fileListProvider.ensureTempDirExists()
|
||||
if (exportDir.exists()) {
|
||||
val expFiles = exportDir.listFiles()
|
||||
for (file in expFiles) {
|
||||
|
|
|
@ -360,10 +360,10 @@ class DataSyncSelectorImplementation @Inject constructor(
|
|||
when {
|
||||
// without nsId = create new
|
||||
te.first.interfaceIDs.nightscoutId == null ->
|
||||
nsClientPlugin.nsClientService?.dbAdd("treatments", te.first.toJson(true), DataSyncSelector.PairTherapyEvent(te.first, te.second), "$startId/$lastDbId")
|
||||
nsClientPlugin.nsClientService?.dbAdd("treatments", te.first.toJson(true, dateUtil), DataSyncSelector.PairTherapyEvent(te.first, te.second), "$startId/$lastDbId")
|
||||
// nsId = update
|
||||
te.first.interfaceIDs.nightscoutId != null ->
|
||||
nsClientPlugin.nsClientService?.dbUpdate("treatments", te.first.interfaceIDs.nightscoutId, te.first.toJson(false), DataSyncSelector.PairTherapyEvent(te.first, te.second), "$startId/$lastDbId")
|
||||
nsClientPlugin.nsClientService?.dbUpdate("treatments", te.first.interfaceIDs.nightscoutId, te.first.toJson(false, dateUtil), DataSyncSelector.PairTherapyEvent(te.first, te.second), "$startId/$lastDbId")
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
|
|
@ -193,6 +193,7 @@ class NSClientAddUpdateWorker(
|
|||
eventType == TherapyEvent.Type.ANNOUNCEMENT.text ||
|
||||
eventType == TherapyEvent.Type.QUESTION.text ||
|
||||
eventType == TherapyEvent.Type.EXERCISE.text ||
|
||||
eventType == TherapyEvent.Type.NOTE.text ||
|
||||
eventType == TherapyEvent.Type.PUMP_BATTERY_CHANGE.text ->
|
||||
if (sp.getBoolean(R.string.key_ns_receive_therapy_events, false) || config.NSCLIENT) {
|
||||
therapyEventFromJson(json)?.let { therapyEvent ->
|
||||
|
|
|
@ -16,7 +16,6 @@ import info.nightscout.androidaps.events.EventConfigBuilderChange
|
|||
import info.nightscout.androidaps.events.EventPreferenceChange
|
||||
import info.nightscout.androidaps.interfaces.Config
|
||||
import info.nightscout.androidaps.interfaces.DataSyncSelector
|
||||
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface
|
||||
import info.nightscout.androidaps.interfaces.PluginType
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
|
@ -71,7 +70,6 @@ class NSClientService : DaggerService() {
|
|||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||
@Inject lateinit var nsSettingsStatus: NSSettingsStatus
|
||||
@Inject lateinit var nsDeviceStatus: NSDeviceStatus
|
||||
@Inject lateinit var databaseHelper: DatabaseHelperInterface
|
||||
@Inject lateinit var rxBus: RxBusWrapper
|
||||
@Inject lateinit var resourceHelper: ResourceHelper
|
||||
@Inject lateinit var sp: SP
|
||||
|
@ -199,7 +197,7 @@ class NSClientService : DaggerService() {
|
|||
.build())
|
||||
}
|
||||
|
||||
fun processAuthAck(ack: NSAuthAck) {
|
||||
private fun processAuthAck(ack: NSAuthAck) {
|
||||
var connectionStatus = "Authenticated ("
|
||||
if (ack.read) connectionStatus += "R"
|
||||
if (ack.write) connectionStatus += "W"
|
||||
|
|
|
@ -29,7 +29,9 @@ class OHUploadWorker(context: Context, workerParameters: WorkerParameters)
|
|||
lateinit var resourceHelper: ResourceHelper
|
||||
|
||||
@kotlin.ExperimentalStdlibApi
|
||||
override fun createWork(): Single<Result> = Single.defer {
|
||||
override fun createWork(): Single<Result> =Single.just(Result.success())
|
||||
/*
|
||||
= Single.defer {
|
||||
|
||||
// Here we inject every time we create work
|
||||
// We could build our own WorkerFactory with dagger but this will create conflicts with other Workers
|
||||
|
@ -50,7 +52,7 @@ class OHUploadWorker(context: Context, workerParameters: WorkerParameters)
|
|||
Single.just(Result.retry())
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
private fun createForegroundInfo(): ForegroundInfo {
|
||||
val title = resourceHelper.gs(info.nightscout.androidaps.R.string.open_humans)
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ import androidx.work.WorkManager
|
|||
import dagger.android.support.DaggerFragment
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.events.Event
|
||||
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
|
@ -38,24 +37,23 @@ class OpenHumansFragment : DaggerFragment() {
|
|||
@Inject lateinit var openHumansUploader: OpenHumansUploader
|
||||
@Inject lateinit var resourceHelper: ResourceHelper
|
||||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||
@Inject lateinit var databaseHelper: DatabaseHelperInterface
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
compositeDisposable += Single.fromCallable { databaseHelper.getOHQueueSize() }
|
||||
.subscribeOn(aapsSchedulers.io)
|
||||
.repeatWhen {
|
||||
rxBus.toObservable(UpdateViewEvent::class.java)
|
||||
.cast(Any::class.java)
|
||||
.mergeWith(rxBus.toObservable(UpdateQueueEvent::class.java)
|
||||
.throttleLatest(5, TimeUnit.SECONDS))
|
||||
.toFlowable(BackpressureStrategy.LATEST)
|
||||
}
|
||||
.observeOn(aapsSchedulers.main)
|
||||
.subscribe({
|
||||
queueSizeValue = it
|
||||
updateGUI()
|
||||
}, {})
|
||||
// compositeDisposable += Single.fromCallable { databaseHelper.getOHQueueSize() }
|
||||
// .subscribeOn(aapsSchedulers.io)
|
||||
// .repeatWhen {
|
||||
// rxBus.toObservable(UpdateViewEvent::class.java)
|
||||
// .cast(Any::class.java)
|
||||
// .mergeWith(rxBus.toObservable(UpdateQueueEvent::class.java)
|
||||
// .throttleLatest(5, TimeUnit.SECONDS))
|
||||
// .toFlowable(BackpressureStrategy.LATEST)
|
||||
// }
|
||||
// .observeOn(aapsSchedulers.main)
|
||||
// .subscribe({
|
||||
// queueSizeValue = it
|
||||
// updateGUI()
|
||||
// }, {})
|
||||
context?.applicationContext?.let { appContext ->
|
||||
WorkManager.getInstance(appContext).getWorkInfosForUniqueWorkLiveData(OpenHumansUploader.WORK_NAME).observe(this, {
|
||||
val workInfo = it.lastOrNull()
|
||||
|
|
|
@ -21,14 +21,13 @@ import info.nightscout.androidaps.database.entities.TemporaryTarget
|
|||
import info.nightscout.androidaps.database.entities.TherapyEvent
|
||||
import info.nightscout.androidaps.db.*
|
||||
import info.nightscout.androidaps.events.EventPreferenceChange
|
||||
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface
|
||||
import info.nightscout.androidaps.extensions.toConstant
|
||||
import info.nightscout.androidaps.interfaces.PluginBase
|
||||
import info.nightscout.androidaps.interfaces.PluginDescription
|
||||
import info.nightscout.androidaps.interfaces.PluginType
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.extensions.toConstant
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||
|
@ -60,7 +59,6 @@ class OpenHumansUploader @Inject constructor(
|
|||
private val sp: SP,
|
||||
private val rxBus: RxBusWrapper,
|
||||
private val context: Context,
|
||||
private val databaseHelper: DatabaseHelperInterface,
|
||||
val repository: AppRepository
|
||||
) : PluginBase(
|
||||
PluginDescription()
|
||||
|
@ -306,11 +304,11 @@ class OpenHumansUploader @Inject constructor(
|
|||
jsonObject.put("structureVersion", structureVersion)
|
||||
jsonObject.put("queuedOn", System.currentTimeMillis())
|
||||
generator(jsonObject)
|
||||
val queueItem = OHQueueItem(
|
||||
file = file,
|
||||
content = jsonObject.toString()
|
||||
)
|
||||
databaseHelper.createOrUpdate(queueItem)
|
||||
// val queueItem = OHQueueItem(
|
||||
// file = file,
|
||||
// content = jsonObject.toString()
|
||||
// )
|
||||
// databaseHelper.createOrUpdate(queueItem)
|
||||
rxBus.send(OpenHumansFragment.UpdateQueueEvent)
|
||||
} catch (e: JSONException) {
|
||||
e.printStackTrace()
|
||||
|
@ -340,7 +338,7 @@ class OpenHumansUploader @Inject constructor(
|
|||
isSetup = false
|
||||
oAuthTokens = null
|
||||
projectMemberId = null
|
||||
databaseHelper.clearOpenHumansQueue()
|
||||
// databaseHelper.clearOpenHumansQueue()
|
||||
rxBus.send(OpenHumansFragment.UpdateViewEvent)
|
||||
}
|
||||
|
||||
|
@ -353,18 +351,18 @@ class OpenHumansUploader @Inject constructor(
|
|||
//Updating the notification for every item drastically slows down the operation
|
||||
if (currentProgress % 1000L == 0L) showOngoingNotification(maxProgress, currentProgress)
|
||||
}
|
||||
copyDisposable = Completable.fromCallable { databaseHelper.clearOpenHumansQueue() }
|
||||
// copyDisposable = Completable.fromCallable { databaseHelper.clearOpenHumansQueue() }
|
||||
// .andThen(Single.defer { Single.just(databaseHelper.getCountOfAllRows() + treatmentsPlugin.service.count()) })
|
||||
// .doOnSuccess { maxProgress = it }
|
||||
// .flatMapObservable { Observable.defer { Observable.fromIterable(treatmentsPlugin.service.getTreatmentData()) } }
|
||||
// .map { enqueueTreatment(it); increaseCounter() }
|
||||
// .ignoreElements()
|
||||
.andThen(Observable.defer { Observable.fromIterable(repository.compatGetBgReadingsDataFromTime(0, true).blockingGet()) })
|
||||
.map { enqueueBGReading(it); increaseCounter() }
|
||||
.ignoreElements()
|
||||
.andThen(Observable.defer { Observable.fromIterable(repository.compatGetTherapyEventDataFromTime(0, true).blockingGet()) })
|
||||
.map { enqueueTherapyEvent(it); increaseCounter() }
|
||||
.ignoreElements()
|
||||
// .andThen(Observable.defer { Observable.fromIterable(repository.compatGetBgReadingsDataFromTime(0, true).blockingGet()) })
|
||||
// .map { enqueueBGReading(it); increaseCounter() }
|
||||
// .ignoreElements()
|
||||
// .andThen(Observable.defer { Observable.fromIterable(repository.compatGetTherapyEventDataFromTime(0, true).blockingGet()) })
|
||||
// .map { enqueueTherapyEvent(it); increaseCounter() }
|
||||
// .ignoreElements()
|
||||
// .andThen(Observable.defer { Observable.fromIterable(databaseHelper.getAllExtendedBoluses()) })
|
||||
// .map { enqueueExtendedBolus(it); increaseCounter() }
|
||||
// .ignoreElements()
|
||||
|
@ -377,30 +375,30 @@ class OpenHumansUploader @Inject constructor(
|
|||
// .andThen(Observable.defer { Observable.fromIterable(databaseHelper.getAllTemporaryBasals()) })
|
||||
// .map { enqueueTemporaryBasal(it); increaseCounter() }
|
||||
// .ignoreElements()
|
||||
.andThen(Observable.defer { Observable.fromIterable(repository.compatGetTemporaryTargetData().blockingGet()) })
|
||||
.map { enqueueTempTarget(it); increaseCounter() }
|
||||
.ignoreElements()
|
||||
.doOnSubscribe {
|
||||
wakeLock.acquire(TimeUnit.MINUTES.toMillis(30))
|
||||
showOngoingNotification()
|
||||
}
|
||||
.doOnComplete {
|
||||
isSetup = true
|
||||
scheduleWorker(false)
|
||||
showSetupFinishedNotification()
|
||||
}
|
||||
.doOnError {
|
||||
logout()
|
||||
showSetupFailedNotification()
|
||||
}
|
||||
.doFinally {
|
||||
copyDisposable = null
|
||||
NotificationManagerCompat.from(context).cancel(COPY_NOTIFICATION_ID)
|
||||
wakeLock.release()
|
||||
}
|
||||
.onErrorComplete()
|
||||
.subscribeOn(aapsSchedulers.io)
|
||||
.subscribe()
|
||||
// .andThen(Observable.defer { Observable.fromIterable(repository.compatGetTemporaryTargetData().blockingGet()) })
|
||||
// .map { enqueueTempTarget(it); increaseCounter() }
|
||||
// .ignoreElements()
|
||||
// .doOnSubscribe {
|
||||
// wakeLock.acquire(TimeUnit.MINUTES.toMillis(30))
|
||||
// showOngoingNotification()
|
||||
// }
|
||||
// .doOnComplete {
|
||||
// isSetup = true
|
||||
// scheduleWorker(false)
|
||||
// showSetupFinishedNotification()
|
||||
// }
|
||||
// .doOnError {
|
||||
// logout()
|
||||
// showSetupFailedNotification()
|
||||
// }
|
||||
// .doFinally {
|
||||
// copyDisposable = null
|
||||
// NotificationManagerCompat.from(context).cancel(COPY_NOTIFICATION_ID)
|
||||
// wakeLock.release()
|
||||
// }
|
||||
// .onErrorComplete()
|
||||
// .subscribeOn(aapsSchedulers.io)
|
||||
// .subscribe()
|
||||
}
|
||||
|
||||
private fun showOngoingNotification(maxProgress: Long? = null, currentProgress: Long? = null) {
|
||||
|
@ -438,7 +436,7 @@ class OpenHumansUploader @Inject constructor(
|
|||
val notificationManager = NotificationManagerCompat.from(context)
|
||||
notificationManager.notify(FAILURE_NOTIFICATION_ID, notification)
|
||||
}
|
||||
|
||||
/*
|
||||
@kotlin.ExperimentalStdlibApi
|
||||
fun uploadDataSegmentally(): Completable =
|
||||
uploadData(UPLOAD_SEGMENT_SIZE)
|
||||
|
@ -478,7 +476,7 @@ class OpenHumansUploader @Inject constructor(
|
|||
.doOnSubscribe {
|
||||
aapsLogger.info(LTag.OHUPLOADER, "Starting upload")
|
||||
}
|
||||
|
||||
*/
|
||||
private fun uploadFile(accessToken: String, uploadData: UploadData) = Completable.defer {
|
||||
openHumansAPI.prepareFileUpload(accessToken, uploadData.fileName, uploadData.metadata)
|
||||
.flatMap { openHumansAPI.uploadFile(it.uploadURL, uploadData.content).andThen(Single.just(it.fileId)) }
|
||||
|
@ -495,7 +493,7 @@ class OpenHumansUploader @Inject constructor(
|
|||
Single.just(oAuthTokens.accessToken)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@kotlin.ExperimentalStdlibApi
|
||||
private fun gatherData(maxEntries: Long) = Single.defer {
|
||||
val items = databaseHelper.getAllOHQueueItems(maxEntries)
|
||||
|
@ -571,7 +569,7 @@ class OpenHumansUploader @Inject constructor(
|
|||
highestQueueId = items.map { it.id }.maxOrNull()
|
||||
))
|
||||
}
|
||||
|
||||
*/
|
||||
private fun ZipOutputStream.writeFile(name: String, bytes: ByteArray) {
|
||||
putNextEntry(ZipEntry(name))
|
||||
write(bytes)
|
||||
|
@ -579,7 +577,7 @@ class OpenHumansUploader @Inject constructor(
|
|||
}
|
||||
|
||||
private fun removeUploadedEntriesFromQueue(highestId: Long) = Completable.fromCallable {
|
||||
databaseHelper.removeAllOHQueueItemsWithIdSmallerThan(highestId)
|
||||
// databaseHelper.removeAllOHQueueItemsWithIdSmallerThan(highestId)
|
||||
}
|
||||
|
||||
private fun handleSignOut() {
|
||||
|
@ -649,4 +647,5 @@ class OpenHumansUploader @Inject constructor(
|
|||
private fun onSharedPreferenceChanged(event: EventPreferenceChange) {
|
||||
if (event.changedKey == "key_oh_charging_only" && isSetup) scheduleWorker(true)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -71,6 +71,44 @@ class OverviewData @Inject constructor(
|
|||
var fromTime: Long = 0
|
||||
var endTime: Long = 0
|
||||
|
||||
fun reset() {
|
||||
profile = null
|
||||
profileName = null
|
||||
profileNameWithRemainingTime = null
|
||||
calcProgress = ""
|
||||
lastBg = null
|
||||
temporaryBasal = null
|
||||
extendedBolus = null
|
||||
bolusIob = null
|
||||
basalIob = null
|
||||
cobInfo = null
|
||||
lastCarbsTime = 0L
|
||||
temporaryTarget = null
|
||||
lastAutosensData = null
|
||||
bgReadingsArray = ArrayList()
|
||||
bucketedGraphSeries = PointsWithLabelGraphSeries()
|
||||
bgReadingGraphSeries = PointsWithLabelGraphSeries()
|
||||
predictionsGraphSeries = PointsWithLabelGraphSeries()
|
||||
baseBasalGraphSeries = LineGraphSeries()
|
||||
tempBasalGraphSeries = LineGraphSeries()
|
||||
basalLineGraphSeries = LineGraphSeries()
|
||||
absoluteBasalGraphSeries = LineGraphSeries()
|
||||
activitySeries = FixedLineGraphSeries()
|
||||
activityPredictionSeries = FixedLineGraphSeries()
|
||||
iobSeries = FixedLineGraphSeries()
|
||||
absIobSeries = FixedLineGraphSeries()
|
||||
iobPredictions1Series = PointsWithLabelGraphSeries()
|
||||
iobPredictions2Series = PointsWithLabelGraphSeries()
|
||||
minusBgiSeries = FixedLineGraphSeries()
|
||||
minusBgiHistSeries = FixedLineGraphSeries()
|
||||
cobSeries = FixedLineGraphSeries()
|
||||
cobMinFailOverSeries = PointsWithLabelGraphSeries()
|
||||
deviationsSeries = BarGraphSeries()
|
||||
ratioSeries = LineGraphSeries()
|
||||
dsMaxSeries = LineGraphSeries()
|
||||
dsMinSeries = LineGraphSeries()
|
||||
}
|
||||
|
||||
fun initRange() {
|
||||
rangeToDisplay = sp.getInt(R.string.key_rangetodisplay, 6)
|
||||
|
||||
|
@ -187,7 +225,7 @@ class OverviewData @Inject constructor(
|
|||
if (!extendedBolus.isInProgress(dateUtil)) {
|
||||
this@OverviewData.extendedBolus = null
|
||||
""
|
||||
} else if (activePlugin.activePump.isFakingTempsByExtendedBoluses) resourceHelper.gs(R.string.pump_basebasalrate, extendedBolus.rate)
|
||||
} else if (!activePlugin.activePump.isFakingTempsByExtendedBoluses) resourceHelper.gs(R.string.pump_basebasalrate, extendedBolus.rate)
|
||||
else ""
|
||||
} ?: ""
|
||||
|
||||
|
|
|
@ -653,7 +653,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
|||
|
||||
OverviewData.Property.EXTENDED_BOLUS -> {
|
||||
binding.infoLayout.extendedBolus.text = overviewData.extendedBolusText
|
||||
binding.infoLayout.extendedBolus.setOnClickListener {
|
||||
binding.infoLayout.extendedLayout.setOnClickListener {
|
||||
activity?.let { OKDialog.show(it, resourceHelper.gs(R.string.extended_bolus), overviewData.extendedBolusDialogText) }
|
||||
}
|
||||
binding.infoLayout.extendedLayout.visibility = (overviewData.extendedBolus != null && !pump.isFakingTempsByExtendedBoluses).toVisibility()
|
||||
|
|
|
@ -3,10 +3,8 @@ package info.nightscout.androidaps.plugins.general.overview.graphExtensions
|
|||
import android.graphics.Color
|
||||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.core.R
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.database.entities.TherapyEvent
|
||||
import info.nightscout.androidaps.interfaces.GlucoseUnit
|
||||
import info.nightscout.androidaps.interfaces.Interval
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.utils.Translator
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
|
@ -17,7 +15,7 @@ class TherapyEventDataPoint @Inject constructor(
|
|||
private val resourceHelper: ResourceHelper,
|
||||
private val profileFunction: ProfileFunction,
|
||||
private val translator: Translator
|
||||
) : DataPointWithLabelInterface, Interval {
|
||||
) : DataPointWithLabelInterface {
|
||||
|
||||
private var yValue = 0.0
|
||||
|
||||
|
@ -52,7 +50,7 @@ class TherapyEventDataPoint @Inject constructor(
|
|||
if (data.note != null) data.note
|
||||
else translator.translate(data.type)
|
||||
|
||||
override fun getDuration(): Long = end() - start()
|
||||
override fun getDuration(): Long = data.duration
|
||||
override fun getShape(): PointsWithLabelGraphSeries.Shape =
|
||||
when {
|
||||
data.type == TherapyEvent.Type.NS_MBG -> PointsWithLabelGraphSeries.Shape.MBG
|
||||
|
@ -74,22 +72,4 @@ class TherapyEventDataPoint @Inject constructor(
|
|||
TherapyEvent.Type.APS_OFFLINE -> Color.GRAY and -0x7f000001
|
||||
else -> Color.GRAY
|
||||
}
|
||||
|
||||
// Interval interface
|
||||
private var cutEnd: Long? = null
|
||||
|
||||
override fun durationInMsec(): Long = data.duration
|
||||
override fun start(): Long = data.timestamp
|
||||
override fun originalEnd(): Long = data.timestamp + durationInMsec()
|
||||
override fun end(): Long = cutEnd ?: originalEnd()
|
||||
override fun cutEndTo(end: Long) {
|
||||
cutEnd = end
|
||||
}
|
||||
|
||||
override fun match(time: Long): Boolean = start() <= time && end() >= time
|
||||
override fun before(time: Long): Boolean = end() < time
|
||||
override fun after(time: Long): Boolean = start() > time
|
||||
override val isInProgress: Boolean get() = match(System.currentTimeMillis())
|
||||
override val isEndingEvent: Boolean get() = durationInMsec() == 0L
|
||||
override val isValid: Boolean get() = data.type == TherapyEvent.Type.APS_OFFLINE
|
||||
}
|
|
@ -128,7 +128,7 @@ class NotificationStore @Inject constructor(
|
|||
private fun deleteIntent(id: Int): PendingIntent {
|
||||
val intent = Intent(context, DismissNotificationService::class.java)
|
||||
intent.putExtra("alertID", id)
|
||||
return PendingIntent.getService(context, id, intent, PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
return PendingIntent.getService(context, id, intent, PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
}
|
||||
|
||||
fun createNotificationChannel() {
|
||||
|
|
|
@ -171,7 +171,7 @@ class PersistentNotificationPlugin @Inject constructor(
|
|||
val msgReadPendingIntent = PendingIntent.getBroadcast(context,
|
||||
notificationHolder.notificationID,
|
||||
msgReadIntent,
|
||||
PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
val msgReplyIntent = Intent()
|
||||
.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES)
|
||||
.setAction(REPLY_ACTION)
|
||||
|
@ -181,7 +181,7 @@ class PersistentNotificationPlugin @Inject constructor(
|
|||
context,
|
||||
notificationHolder.notificationID,
|
||||
msgReplyIntent,
|
||||
PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
// Build a RemoteInput for receiving voice input from devices
|
||||
val remoteInput = RemoteInput.Builder(EXTRA_VOICE_REPLY).build()
|
||||
// Create the UnreadConversation
|
||||
|
|
|
@ -1,13 +1,16 @@
|
|||
package info.nightscout.androidaps.plugins.general.smsCommunicator
|
||||
|
||||
import android.os.SystemClock
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.interfaces.CommandQueueProvider
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.plugins.general.smsCommunicator.otp.OneTimePassword
|
||||
import info.nightscout.androidaps.plugins.general.smsCommunicator.otp.OneTimePasswordValidationResult
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.T
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import javax.inject.Inject
|
||||
|
||||
|
@ -23,6 +26,7 @@ class AuthRequest internal constructor(
|
|||
@Inject lateinit var resourceHelper: ResourceHelper
|
||||
@Inject lateinit var otp: OneTimePassword
|
||||
@Inject lateinit var dateUtil: DateUtil
|
||||
@Inject lateinit var commandQueue: CommandQueueProvider
|
||||
|
||||
private var date = 0L
|
||||
private var processed = false
|
||||
|
@ -49,6 +53,19 @@ class AuthRequest internal constructor(
|
|||
}
|
||||
if (dateUtil.now() - date < Constants.SMS_CONFIRM_TIMEOUT) {
|
||||
processed = true
|
||||
if (action.pumpCommand) {
|
||||
val start = dateUtil.now()
|
||||
//wait for empty queue
|
||||
while (start + T.mins(3).msecs() > dateUtil.now()) {
|
||||
if (commandQueue.size() == 0) break
|
||||
SystemClock.sleep(100)
|
||||
}
|
||||
if (commandQueue.size() != 0) {
|
||||
aapsLogger.debug(LTag.SMS, "Command timed out: " + requester.text)
|
||||
smsCommunicatorPlugin.sendSMS(Sms(requester.phoneNumber, resourceHelper.gs(R.string.sms_timeout_while_wating)))
|
||||
return
|
||||
}
|
||||
}
|
||||
aapsLogger.debug(LTag.SMS, "Processing confirmed SMS: " + requester.text)
|
||||
action.run()
|
||||
return
|
||||
|
|
|
@ -1,37 +1,37 @@
|
|||
package info.nightscout.androidaps.plugins.general.smsCommunicator
|
||||
|
||||
abstract class SmsAction : Runnable {
|
||||
abstract class SmsAction(val pumpCommand: Boolean) : Runnable {
|
||||
|
||||
var aDouble: Double? = null
|
||||
var anInteger: Int? = null
|
||||
var secondInteger: Int? = null
|
||||
var secondLong: Long? = null
|
||||
var aString: String? = null
|
||||
|
||||
internal constructor()
|
||||
internal constructor(aDouble: Double) {
|
||||
internal constructor(pumpCommand: Boolean, aDouble: Double) : this(pumpCommand) {
|
||||
this.aDouble = aDouble
|
||||
}
|
||||
|
||||
internal constructor(aDouble: Double, secondInteger: Int) {
|
||||
internal constructor(pumpCommand: Boolean, aDouble: Double, secondInteger: Int) : this(pumpCommand) {
|
||||
this.aDouble = aDouble
|
||||
this.secondInteger = secondInteger
|
||||
}
|
||||
|
||||
internal constructor(aString: String, secondInteger: Int) {
|
||||
internal constructor(pumpCommand: Boolean, aString: String, secondInteger: Int) : this(pumpCommand) {
|
||||
this.aString = aString
|
||||
this.secondInteger = secondInteger
|
||||
}
|
||||
|
||||
internal constructor(anInteger: Int) {
|
||||
internal constructor(pumpCommand: Boolean, anInteger: Int) : this(pumpCommand) {
|
||||
this.anInteger = anInteger
|
||||
}
|
||||
|
||||
internal constructor(anInteger: Int, secondInteger: Int) {
|
||||
internal constructor(pumpCommand: Boolean, anInteger: Int, secondInteger: Int) : this(pumpCommand) {
|
||||
this.anInteger = anInteger
|
||||
this.secondInteger = secondInteger
|
||||
}
|
||||
|
||||
internal constructor(anInteger: Int, secondLong: Long) {
|
||||
internal constructor(pumpCommand: Boolean, anInteger: Int, secondLong: Long) : this(pumpCommand) {
|
||||
this.anInteger = anInteger
|
||||
this.secondLong = secondLong
|
||||
}
|
||||
|
|
|
@ -94,8 +94,8 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
|
||||
private val disposable = CompositeDisposable()
|
||||
var allowedNumbers: MutableList<String> = ArrayList()
|
||||
var messageToConfirm: AuthRequest? = null
|
||||
var lastRemoteBolusTime: Long = 0
|
||||
@Volatile var messageToConfirm: AuthRequest? = null
|
||||
@Volatile var lastRemoteBolusTime: Long = 0
|
||||
var messages = ArrayList<Sms>()
|
||||
|
||||
val commands = mapOf(
|
||||
|
@ -278,6 +278,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
else sendSMS(Sms(receivedSms.phoneNumber, resourceHelper.gs(R.string.wrongformat)))
|
||||
"BOLUS" ->
|
||||
if (!remoteCommandsAllowed) sendSMS(Sms(receivedSms.phoneNumber, resourceHelper.gs(R.string.smscommunicator_remotecommandnotallowed)))
|
||||
else if (commandQueue.bolusInQueue()) sendSMS(Sms(receivedSms.phoneNumber, resourceHelper.gs(R.string.smscommunicator_another_bolus_in_queue)))
|
||||
else if (divided.size == 2 && dateUtil.now() - lastRemoteBolusTime < minDistance) sendSMS(Sms(receivedSms.phoneNumber, resourceHelper.gs(R.string.smscommunicator_remotebolusnotallowed)))
|
||||
else if (divided.size == 2 && pump.isSuspended()) sendSMS(Sms(receivedSms.phoneNumber, resourceHelper.gs(R.string.pumpsuspended)))
|
||||
else if (divided.size == 2 || divided.size == 3) processBOLUS(divided, receivedSms)
|
||||
|
@ -303,9 +304,13 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
else sendSMS(Sms(receivedSms.phoneNumber, resourceHelper.gs(R.string.wrongformat)))
|
||||
else ->
|
||||
if (messageToConfirm?.requester?.phoneNumber == receivedSms.phoneNumber) {
|
||||
messageToConfirm?.action(divided[0])
|
||||
val execute = messageToConfirm
|
||||
messageToConfirm = null
|
||||
} else sendSMS(Sms(receivedSms.phoneNumber, resourceHelper.gs(R.string.smscommunicator_unknowncommand)))
|
||||
execute?.action(divided[0])
|
||||
} else {
|
||||
messageToConfirm = null
|
||||
sendSMS(Sms(receivedSms.phoneNumber, resourceHelper.gs(R.string.smscommunicator_unknowncommand)))
|
||||
}
|
||||
}
|
||||
}
|
||||
rxBus.send(EventSmsCommunicatorUpdateGui())
|
||||
|
@ -344,7 +349,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
val passCode = generatePassCode()
|
||||
val reply = String.format(resourceHelper.gs(R.string.smscommunicator_loopdisablereplywithcode), passCode)
|
||||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction() {
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(pumpCommand = false) {
|
||||
override fun run() {
|
||||
uel.log(Action.LOOP_DISABLED, Sources.SMS)
|
||||
loop.enabled = false
|
||||
|
@ -368,7 +373,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
val passCode = generatePassCode()
|
||||
val reply = String.format(resourceHelper.gs(R.string.smscommunicator_loopenablereplywithcode), passCode)
|
||||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction() {
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(pumpCommand = false) {
|
||||
override fun run() {
|
||||
uel.log(Action.LOOP_ENABLED, Sources.SMS)
|
||||
loop.enabled = true
|
||||
|
@ -395,7 +400,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
val passCode = generatePassCode()
|
||||
val reply = String.format(resourceHelper.gs(R.string.smscommunicator_loopresumereplywithcode), passCode)
|
||||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction() {
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(pumpCommand = true) {
|
||||
override fun run() {
|
||||
uel.log(Action.RESUME, Sources.SMS)
|
||||
disposable += repository.runTransactionForResult(CancelCurrentOfflineEventIfAnyTransaction(dateUtil.now()))
|
||||
|
@ -432,7 +437,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
val passCode = generatePassCode()
|
||||
val reply = String.format(resourceHelper.gs(R.string.smscommunicator_suspendreplywithcode), duration, passCode)
|
||||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(duration) {
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(pumpCommand = true, duration) {
|
||||
override fun run() {
|
||||
uel.log(Action.SUSPEND, Sources.SMS)
|
||||
commandQueue.cancelTempBasal(true, object : Callback() {
|
||||
|
@ -513,7 +518,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
val passCode = generatePassCode()
|
||||
val reply = String.format(resourceHelper.gs(R.string.smscommunicator_pumpconnectwithcode), passCode)
|
||||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction() {
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(pumpCommand = true) {
|
||||
override fun run() {
|
||||
uel.log(Action.RECONNECT, Sources.SMS)
|
||||
commandQueue.cancelTempBasal(true, object : Callback() {
|
||||
|
@ -546,7 +551,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
val passCode = generatePassCode()
|
||||
val reply = String.format(resourceHelper.gs(R.string.smscommunicator_pumpdisconnectwithcode), duration, passCode)
|
||||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction() {
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(pumpCommand = true) {
|
||||
override fun run() {
|
||||
uel.log(Action.DISCONNECT, Sources.SMS)
|
||||
val profile = profileFunction.getProfile() ?: return
|
||||
|
@ -601,7 +606,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
val reply = String.format(resourceHelper.gs(R.string.smscommunicator_profilereplywithcode), list[pIndex - 1], percentage, passCode)
|
||||
receivedSms.processed = true
|
||||
val finalPercentage = percentage
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(list[pIndex - 1] as String, finalPercentage) {
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(pumpCommand = true, list[pIndex - 1] as String, finalPercentage) {
|
||||
override fun run() {
|
||||
profileFunction.createProfileSwitch(store, list[pIndex - 1] as String, 0, finalPercentage, 0, dateUtil.now())
|
||||
val replyText = resourceHelper.gs(R.string.profileswitchcreated)
|
||||
|
@ -622,7 +627,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
val passCode = generatePassCode()
|
||||
val reply = String.format(resourceHelper.gs(R.string.smscommunicator_basalstopreplywithcode), passCode)
|
||||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction() {
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(pumpCommand = true) {
|
||||
override fun run() {
|
||||
commandQueue.cancelTempBasal(true, object : Callback() {
|
||||
override fun run() {
|
||||
|
@ -657,7 +662,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
val passCode = generatePassCode()
|
||||
val reply = String.format(resourceHelper.gs(R.string.smscommunicator_basalpctreplywithcode), tempBasalPct, duration, passCode)
|
||||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(tempBasalPct, duration) {
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(pumpCommand = true, tempBasalPct, duration) {
|
||||
override fun run() {
|
||||
commandQueue.tempBasalPercent(anInteger(), secondInteger(), true, profile, PumpSync.TemporaryBasalType.NORMAL, object : Callback() {
|
||||
override fun run() {
|
||||
|
@ -701,7 +706,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
val passCode = generatePassCode()
|
||||
val reply = String.format(resourceHelper.gs(R.string.smscommunicator_basalreplywithcode), tempBasal, duration, passCode)
|
||||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(tempBasal, duration) {
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(pumpCommand = true, tempBasal, duration) {
|
||||
override fun run() {
|
||||
commandQueue.tempBasalAbsolute(aDouble(), secondInteger(), true, profile, PumpSync.TemporaryBasalType.NORMAL, object : Callback() {
|
||||
override fun run() {
|
||||
|
@ -739,7 +744,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
val passCode = generatePassCode()
|
||||
val reply = String.format(resourceHelper.gs(R.string.smscommunicator_extendedstopreplywithcode), passCode)
|
||||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction() {
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(pumpCommand = true) {
|
||||
override fun run() {
|
||||
commandQueue.cancelExtended(object : Callback() {
|
||||
override fun run() {
|
||||
|
@ -769,7 +774,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
val passCode = generatePassCode()
|
||||
val reply = String.format(resourceHelper.gs(R.string.smscommunicator_extendedreplywithcode), extended, duration, passCode)
|
||||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(extended, duration) {
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(pumpCommand = true, extended, duration) {
|
||||
override fun run() {
|
||||
commandQueue.extendedBolus(aDouble(), secondInteger(), object : Callback() {
|
||||
override fun run() {
|
||||
|
@ -815,7 +820,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
else
|
||||
String.format(resourceHelper.gs(R.string.smscommunicator_bolusreplywithcode), bolus, passCode)
|
||||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(bolus) {
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(pumpCommand = true, bolus) {
|
||||
override fun run() {
|
||||
val detailedBolusInfo = DetailedBolusInfo()
|
||||
detailedBolusInfo.insulin = aDouble()
|
||||
|
@ -917,7 +922,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
val passCode = generatePassCode()
|
||||
val reply = String.format(resourceHelper.gs(R.string.smscommunicator_carbsreplywithcode), grams, dateUtil.timeString(time), passCode)
|
||||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(grams, time) {
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(pumpCommand = true, grams, time) {
|
||||
override fun run() {
|
||||
val detailedBolusInfo = DetailedBolusInfo()
|
||||
detailedBolusInfo.carbs = anInteger().toDouble()
|
||||
|
@ -954,7 +959,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
val passCode = generatePassCode()
|
||||
val reply = String.format(resourceHelper.gs(R.string.smscommunicator_temptargetwithcode), divided[1].uppercase(Locale.getDefault()), passCode)
|
||||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction() {
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(pumpCommand = false) {
|
||||
override fun run() {
|
||||
val units = profileFunction.getUnits()
|
||||
var keyDuration = 0
|
||||
|
@ -1016,7 +1021,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
val passCode = generatePassCode()
|
||||
val reply = String.format(resourceHelper.gs(R.string.smscommunicator_temptargetcancel), passCode)
|
||||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction() {
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(pumpCommand = false) {
|
||||
override fun run() {
|
||||
disposable += repository.runTransactionForResult(CancelCurrentTemporaryTargetIfAnyTransaction(dateUtil.now()))
|
||||
.subscribe({ result ->
|
||||
|
@ -1041,7 +1046,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
val passCode = generatePassCode()
|
||||
val reply = String.format(resourceHelper.gs(R.string.smscommunicator_stopsmswithcode), passCode)
|
||||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction() {
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(pumpCommand = false) {
|
||||
override fun run() {
|
||||
sp.putBoolean(R.string.key_smscommunicator_remotecommandsallowed, false)
|
||||
val replyText = String.format(resourceHelper.gs(R.string.smscommunicator_stoppedsms))
|
||||
|
@ -1059,7 +1064,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
val passCode = generatePassCode()
|
||||
val reply = String.format(resourceHelper.gs(R.string.smscommunicator_calibrationreplywithcode), cal, passCode)
|
||||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(cal) {
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(pumpCommand = false, cal) {
|
||||
override fun run() {
|
||||
val result = xdripCalibrations.sendIntent(aDouble!!)
|
||||
val replyText =
|
||||
|
|
|
@ -130,7 +130,7 @@ open class IobCobCalculatorPlugin @Inject constructor(
|
|||
runCalculation(reason, System.currentTimeMillis(), bgDataReload = false, limitDataToOldestAvailable = true, cause = event)
|
||||
}
|
||||
|
||||
fun clearCache() {
|
||||
override fun clearCache() {
|
||||
synchronized(dataLock) {
|
||||
aapsLogger.debug(LTag.AUTOSENS, "Clearing cached data.")
|
||||
iobTable = LongSparseArray()
|
||||
|
@ -482,7 +482,7 @@ open class IobCobCalculatorPlugin @Inject constructor(
|
|||
for (pos in extendedBoluses.indices) {
|
||||
val e = extendedBoluses[pos]
|
||||
if (e.timestamp > toTime) continue
|
||||
if (e.end > now) e.end = now
|
||||
if (e.end > now) e.duration = now - e.timestamp
|
||||
val profile = profileFunction.getProfile(e.timestamp) ?: return total
|
||||
val calc = e.iobCalc(toTime, profile, activePlugin.activeInsulin)
|
||||
total.plus(calc)
|
||||
|
@ -551,7 +551,7 @@ open class IobCobCalculatorPlugin @Inject constructor(
|
|||
val t = temporaryBasals[pos]
|
||||
if (t.timestamp > toTime) continue
|
||||
val profile = profileFunction.getProfile(t.timestamp) ?: continue
|
||||
if (t.end > now) t.end = now
|
||||
if (t.end > now) t.duration = now - t.timestamp
|
||||
val calc = t.iobCalc(toTime, profile, activePlugin.activeInsulin)
|
||||
//log.debug("BasalIOB " + new Date(time) + " >>> " + calc.basalIob);
|
||||
total.plus(calc)
|
||||
|
@ -563,7 +563,7 @@ open class IobCobCalculatorPlugin @Inject constructor(
|
|||
val e = extendedBoluses[pos]
|
||||
if (e.timestamp > toTime) continue
|
||||
val profile = profileFunction.getProfile(e.timestamp) ?: continue
|
||||
if (e.end > now) e.end = now
|
||||
if (e.end > now) e.duration = now - e.timestamp
|
||||
val calc = e.iobCalc(toTime, profile, activePlugin.activeInsulin)
|
||||
totalExt.plus(calc)
|
||||
}
|
||||
|
@ -586,7 +586,7 @@ open class IobCobCalculatorPlugin @Inject constructor(
|
|||
val t = temporaryBasals[pos]
|
||||
if (t.timestamp > toTime) continue
|
||||
val profile = profileFunction.getProfile(t.timestamp) ?: continue
|
||||
if (t.end > now) t.end = now
|
||||
if (t.end > now) t.duration = now - t.timestamp
|
||||
val calc = t.iobCalc(toTime, profile, lastAutosensResult, exercise_mode, half_basal_exercise_target, isTempTarget, activePlugin.activeInsulin)
|
||||
//log.debug("BasalIOB " + new Date(time) + " >>> " + calc.basalIob);
|
||||
total.plus(calc)
|
||||
|
@ -598,7 +598,7 @@ open class IobCobCalculatorPlugin @Inject constructor(
|
|||
val e = extendedBoluses[pos]
|
||||
if (e.timestamp > toTime) continue
|
||||
val profile = profileFunction.getProfile(e.timestamp) ?: continue
|
||||
if (e.end > now) e.end = now
|
||||
if (e.end > now) e.duration = now - e.timestamp
|
||||
val calc = e.iobCalc(toTime, profile, lastAutosensResult, exercise_mode, half_basal_exercise_target, isTempTarget, activePlugin.activeInsulin)
|
||||
totalExt.plus(calc)
|
||||
}
|
||||
|
|
|
@ -28,6 +28,8 @@ import info.nightscout.androidaps.utils.*
|
|||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import info.nightscout.androidaps.utils.ui.SpinnerHelper
|
||||
import info.nightscout.androidaps.utils.ui.TimeListEdit
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import java.text.DecimalFormat
|
||||
|
@ -127,7 +129,7 @@ class LocalProfileFragment : DaggerFragment() {
|
|||
binding.dia.setParams(currentProfile.dia, hardLimits.minDia(), hardLimits.maxDia(), 0.1, DecimalFormat("0.0"), false, binding.save, textWatch)
|
||||
binding.dia.tag = "LP_DIA"
|
||||
TimeListEdit(context, aapsLogger, dateUtil, view, R.id.ic, "IC", resourceHelper.gs(R.string.ic_label), currentProfile.ic, null, hardLimits.minIC(), hardLimits.maxIC(), 0.1, DecimalFormat("0.0"), save)
|
||||
basalView = TimeListEdit(context, aapsLogger, dateUtil, view, R.id.basal_holder, "BASAL", resourceHelper.gs(R.string.basal_label) + ": " + sumLabel(), currentProfile.basal, null, pumpDescription.basalMinimumRate, 10.0, 0.01, DecimalFormat("0.00"), save)
|
||||
basalView = TimeListEdit(context, aapsLogger, dateUtil, view, R.id.basal_holder, "BASAL", resourceHelper.gs(R.string.basal_label) + ": " + sumLabel(), currentProfile.basal, null, pumpDescription.basalMinimumRate, pumpDescription.basalMaximumRate, 0.01, DecimalFormat("0.00"), save)
|
||||
if (units == Constants.MGDL) {
|
||||
TimeListEdit(context, aapsLogger, dateUtil, view, R.id.isf, "ISF", resourceHelper.gs(R.string.isf_label), currentProfile.isf, null, HardLimits.MIN_ISF, HardLimits.MAX_ISF, 1.0, DecimalFormat("0"), save)
|
||||
TimeListEdit(context, aapsLogger, dateUtil, view, R.id.target, "TARGET", resourceHelper.gs(R.string.target_label), currentProfile.targetLow, currentProfile.targetHigh, HardLimits.VERY_HARD_LIMIT_TARGET_BG[0].toDouble(), HardLimits.VERY_HARD_LIMIT_TARGET_BG[1].toDouble(), 1.0, DecimalFormat("0"), save)
|
||||
|
|
|
@ -1,540 +0,0 @@
|
|||
package info.nightscout.androidaps.plugins.treatments;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.IBinder;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.j256.ormlite.android.apptools.OpenHelperManager;
|
||||
import com.j256.ormlite.android.apptools.OrmLiteBaseService;
|
||||
import com.j256.ormlite.dao.Dao;
|
||||
import com.j256.ormlite.dao.DaoManager;
|
||||
import com.j256.ormlite.stmt.PreparedQuery;
|
||||
import com.j256.ormlite.stmt.QueryBuilder;
|
||||
import com.j256.ormlite.stmt.Where;
|
||||
import com.j256.ormlite.support.ConnectionSource;
|
||||
import com.j256.ormlite.table.TableUtils;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import dagger.android.HasAndroidInjector;
|
||||
import info.nightscout.androidaps.db.DatabaseHelper;
|
||||
import info.nightscout.androidaps.db.Source;
|
||||
import info.nightscout.androidaps.db.Treatment;
|
||||
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface;
|
||||
import info.nightscout.androidaps.interfaces.TreatmentServiceInterface;
|
||||
import info.nightscout.androidaps.interfaces.UpdateReturn;
|
||||
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||
import info.nightscout.androidaps.logging.LTag;
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
|
||||
import info.nightscout.androidaps.plugins.general.openhumans.OpenHumansUploader;
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicPumpPlugin;
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy;
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers;
|
||||
|
||||
|
||||
/**
|
||||
* Created by mike on 24.09.2017.
|
||||
*/
|
||||
|
||||
public class TreatmentService extends OrmLiteBaseService<DatabaseHelper> implements TreatmentServiceInterface {
|
||||
|
||||
@Inject AAPSLogger aapsLogger;
|
||||
@Inject FabricPrivacy fabricPrivacy;
|
||||
@Inject RxBusWrapper rxBus;
|
||||
@Inject MedtronicPumpPlugin medtronicPumpPlugin;
|
||||
@Inject DatabaseHelperInterface databaseHelper;
|
||||
@Inject OpenHumansUploader openHumansUploader;
|
||||
@Inject AapsSchedulers aapsSchedulers;
|
||||
|
||||
public TreatmentService(HasAndroidInjector injector) {
|
||||
injector.androidInjector().inject(this);
|
||||
onCreate();
|
||||
dbInitialize();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is a simple re-implementation of the database create and up/downgrade functionality
|
||||
* in SQLiteOpenHelper#getDatabaseLocked method.
|
||||
* <p>
|
||||
* It is implemented to be able to late initialize separate plugins of the application.
|
||||
*/
|
||||
protected void dbInitialize() {
|
||||
DatabaseHelper helper = OpenHelperManager.getHelper(this, DatabaseHelper.class);
|
||||
int newVersion = helper.getNewVersion();
|
||||
int oldVersion = helper.getOldVersion();
|
||||
|
||||
if (oldVersion > newVersion) {
|
||||
onDowngrade(this.getConnectionSource(), oldVersion, newVersion);
|
||||
} else {
|
||||
onUpgrade(this.getConnectionSource(), oldVersion, newVersion);
|
||||
}
|
||||
}
|
||||
|
||||
public TreatmentDaoWrapper getDao() {
|
||||
try {
|
||||
return new TreatmentDaoWrapper(DaoManager.createDao(this.getConnectionSource(), Treatment.class));
|
||||
} catch (SQLException e) {
|
||||
aapsLogger.error("Cannot create Dao for Treatment.class");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
class TreatmentDaoWrapper {
|
||||
private final Dao<Treatment, Long> wrapped;
|
||||
|
||||
TreatmentDaoWrapper(Dao<Treatment, Long> wrapped) {
|
||||
this.wrapped = wrapped;
|
||||
}
|
||||
|
||||
public void executeRaw(String statement, String... arguments) throws SQLException {
|
||||
wrapped.executeRaw(statement, arguments);
|
||||
}
|
||||
|
||||
public List<Treatment> queryForAll() throws SQLException {
|
||||
return wrapped.queryForAll();
|
||||
}
|
||||
|
||||
public Treatment queryForId(long id) throws SQLException {
|
||||
return wrapped.queryForId(id);
|
||||
}
|
||||
|
||||
public QueryBuilder<Treatment, Long> queryBuilder() {
|
||||
return wrapped.queryBuilder();
|
||||
}
|
||||
|
||||
public List<Treatment> query(PreparedQuery<Treatment> data) throws SQLException {
|
||||
return wrapped.query(data);
|
||||
}
|
||||
|
||||
public long countOf() throws SQLException {
|
||||
return wrapped.countOf();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
try {
|
||||
aapsLogger.info(LTag.DATATREATMENTS, "onCreate");
|
||||
TableUtils.createTableIfNotExists(this.getConnectionSource(), Treatment.class);
|
||||
} catch (SQLException e) {
|
||||
aapsLogger.error("Can't create database", e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void onUpgrade(ConnectionSource connectionSource, int oldVersion, int newVersion) {
|
||||
if (oldVersion == 7 && newVersion == 8) {
|
||||
aapsLogger.debug("Upgrading database from v7 to v8");
|
||||
try {
|
||||
TableUtils.dropTable(connectionSource, Treatment.class, true);
|
||||
TableUtils.createTableIfNotExists(connectionSource, Treatment.class);
|
||||
} catch (SQLException e) {
|
||||
aapsLogger.error("Can't create database", e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
} else if (oldVersion == 8 && newVersion == 9) {
|
||||
aapsLogger.debug("Upgrading database from v8 to v9");
|
||||
try {
|
||||
getDao().executeRaw("ALTER TABLE `" + Treatment.TABLE_TREATMENTS + "` ADD COLUMN boluscalc STRING;");
|
||||
} catch (SQLException e) {
|
||||
aapsLogger.error("Unhandled exception", e);
|
||||
}
|
||||
} else {
|
||||
aapsLogger.info(LTag.DATATREATMENTS, "onUpgrade");
|
||||
// this.resetFood();
|
||||
}
|
||||
}
|
||||
|
||||
public void onDowngrade(ConnectionSource connectionSource, int oldVersion, int newVersion) {
|
||||
if (oldVersion == 9 && newVersion == 8) {
|
||||
try {
|
||||
getDao().executeRaw("ALTER TABLE `" + Treatment.TABLE_TREATMENTS + "` DROP COLUMN boluscalc STRING;");
|
||||
} catch (SQLException e) {
|
||||
aapsLogger.error("Unhandled exception", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public long count() {
|
||||
try {
|
||||
return this.getDao().countOf();
|
||||
} catch (SQLException e) {
|
||||
aapsLogger.error("Unhandled exception", e);
|
||||
}
|
||||
return 0L;
|
||||
}
|
||||
|
||||
/*
|
||||
{
|
||||
"_id": "551ee3ad368e06e80856e6a9",
|
||||
"type": "food",
|
||||
"category": "Zakladni",
|
||||
"subcategory": "Napoje",
|
||||
"name": "Mleko",
|
||||
"portion": 250,
|
||||
"carbs": 12,
|
||||
"gi": 1,
|
||||
"created_at": "2015-04-14T06:59:16.500Z",
|
||||
"unit": "ml"
|
||||
}
|
||||
*/
|
||||
// return true if new record is created
|
||||
public UpdateReturn createOrUpdate(Treatment treatment) {
|
||||
/*
|
||||
if (treatment != null && treatment.source == Source.NONE) {
|
||||
aapsLogger.error("Coder error: source is not set for treatment: " + treatment, new Exception());
|
||||
//FabricPrivacy.logException(new Exception("Coder error: source is not set for treatment: " + treatment));
|
||||
}
|
||||
try {
|
||||
Treatment old;
|
||||
treatment.date = databaseHelper.roundDateToSec(treatment.date);
|
||||
|
||||
if (treatment.source == Source.PUMP) {
|
||||
// check for changed from pump change in NS
|
||||
Treatment existingTreatment = getPumpRecordById(treatment.pumpId);
|
||||
if (existingTreatment != null) {
|
||||
boolean equalRePumpHistory = existingTreatment.equalsRePumpHistory(treatment);
|
||||
boolean sameSource = existingTreatment.source == treatment.source;
|
||||
if (!equalRePumpHistory) {
|
||||
// another treatment exists. Update it with the treatment coming from the pump
|
||||
aapsLogger.debug(LTag.DATATREATMENTS, "Pump record already found in database: " + existingTreatment.toString() + " wanting to add " + treatment.toString());
|
||||
long oldDate = existingTreatment.date;
|
||||
|
||||
//preserve carbs
|
||||
if (existingTreatment.isValid && existingTreatment.carbs > 0 && treatment.carbs == 0) {
|
||||
treatment.carbs = existingTreatment.carbs;
|
||||
// preserve insulin
|
||||
} else if (existingTreatment.isValid && existingTreatment.insulin > 0 && treatment.insulin == 0) {
|
||||
treatment.insulin = existingTreatment.insulin;
|
||||
}
|
||||
|
||||
getDao().delete(existingTreatment); // need to delete/create because date may change too
|
||||
existingTreatment.copyBasics(treatment);
|
||||
getDao().create(existingTreatment);
|
||||
DatabaseHelper.updateEarliestDataChange(oldDate);
|
||||
DatabaseHelper.updateEarliestDataChange(existingTreatment.date);
|
||||
scheduleTreatmentChange(treatment, true);
|
||||
return new UpdateReturn(sameSource, false); //updating a pump treatment with another one from the pump is not counted as clash
|
||||
}
|
||||
return new UpdateReturn(equalRePumpHistory, false);
|
||||
}
|
||||
existingTreatment = getDao().queryForId(treatment.date);
|
||||
if (existingTreatment != null) {
|
||||
// another treatment exists with different pumpID. Update it with the treatment coming from the pump
|
||||
boolean equalRePumpHistory = existingTreatment.equalsRePumpHistory(treatment);
|
||||
boolean sameSource = existingTreatment.source == treatment.source;
|
||||
long oldDate = existingTreatment.date;
|
||||
aapsLogger.debug(LTag.DATATREATMENTS, "Pump record already found in database: " + existingTreatment.toString() + " wanting to add " + treatment.toString());
|
||||
|
||||
//preserve carbs
|
||||
if (existingTreatment.isValid && existingTreatment.carbs > 0 && treatment.carbs == 0) {
|
||||
treatment.carbs = existingTreatment.carbs;
|
||||
}
|
||||
|
||||
getDao().delete(existingTreatment); // need to delete/create because date may change too
|
||||
existingTreatment.copyFrom(treatment);
|
||||
getDao().create(existingTreatment);
|
||||
DatabaseHelper.updateEarliestDataChange(oldDate);
|
||||
DatabaseHelper.updateEarliestDataChange(existingTreatment.date);
|
||||
scheduleTreatmentChange(treatment, true);
|
||||
return new UpdateReturn(equalRePumpHistory || sameSource, false);
|
||||
}
|
||||
getDao().create(treatment);
|
||||
aapsLogger.debug(LTag.DATATREATMENTS, "New record from: " + Source.getString(treatment.source) + " " + treatment.toString());
|
||||
DatabaseHelper.updateEarliestDataChange(treatment.date);
|
||||
scheduleTreatmentChange(treatment, true);
|
||||
return new UpdateReturn(true, true);
|
||||
}
|
||||
if (treatment.source == Source.NIGHTSCOUT) {
|
||||
old = getDao().queryForId(treatment.date);
|
||||
if (old != null) {
|
||||
if (!old.isEqual(treatment)) {
|
||||
boolean historyChange = old.isDataChanging(treatment);
|
||||
long oldDate = old.date;
|
||||
getDao().delete(old); // need to delete/create because date may change too
|
||||
old.copyFrom(treatment);
|
||||
getDao().create(old);
|
||||
aapsLogger.debug(LTag.DATATREATMENTS, "Updating record by date from: " + Source.getString(treatment.source) + " " + old.toString());
|
||||
if (historyChange) {
|
||||
DatabaseHelper.updateEarliestDataChange(oldDate);
|
||||
DatabaseHelper.updateEarliestDataChange(old.date);
|
||||
}
|
||||
scheduleTreatmentChange(treatment, false);
|
||||
return new UpdateReturn(true, true);
|
||||
}
|
||||
aapsLogger.debug(LTag.DATATREATMENTS, "Equal record by date from: " + Source.getString(treatment.source) + " " + old.toString());
|
||||
return new UpdateReturn(true, false);
|
||||
}
|
||||
// find by NS _id
|
||||
if (treatment._id != null) {
|
||||
old = findByNSId(treatment._id);
|
||||
if (old != null) {
|
||||
if (!old.isEqual(treatment)) {
|
||||
boolean historyChange = old.isDataChanging(treatment);
|
||||
long oldDate = old.date;
|
||||
getDao().delete(old); // need to delete/create because date may change too
|
||||
old.copyFrom(treatment);
|
||||
getDao().create(old);
|
||||
aapsLogger.debug(LTag.DATATREATMENTS, "Updating record by _id from: " + Source.getString(treatment.source) + " " + old.toString());
|
||||
if (historyChange) {
|
||||
DatabaseHelper.updateEarliestDataChange(oldDate);
|
||||
DatabaseHelper.updateEarliestDataChange(old.date);
|
||||
}
|
||||
scheduleTreatmentChange(treatment, false);
|
||||
return new UpdateReturn(true, true);
|
||||
}
|
||||
aapsLogger.debug(LTag.DATATREATMENTS, "Equal record by _id from: " + Source.getString(treatment.source) + " " + old.toString());
|
||||
return new UpdateReturn(true, false);
|
||||
}
|
||||
}
|
||||
getDao().create(treatment);
|
||||
aapsLogger.debug(LTag.DATATREATMENTS, "New record from: " + Source.getString(treatment.source) + " " + treatment.toString());
|
||||
DatabaseHelper.updateEarliestDataChange(treatment.date);
|
||||
scheduleTreatmentChange(treatment, false);
|
||||
return new UpdateReturn(true, true);
|
||||
}
|
||||
if (treatment.source == Source.USER) {
|
||||
getDao().create(treatment);
|
||||
aapsLogger.debug(LTag.DATATREATMENTS, "New record from: " + Source.getString(treatment.source) + " " + treatment.toString());
|
||||
DatabaseHelper.updateEarliestDataChange(treatment.date);
|
||||
scheduleTreatmentChange(treatment, true);
|
||||
return new UpdateReturn(true, true);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
aapsLogger.error("Unhandled exception", e);
|
||||
}
|
||||
*/
|
||||
return new UpdateReturn(false, false);
|
||||
}
|
||||
|
||||
|
||||
@NotNull public UpdateReturn createOrUpdateMedtronic(@NotNull Treatment treatment, boolean fromNightScout) {
|
||||
/*
|
||||
if (MedtronicHistoryData.doubleBolusDebug)
|
||||
aapsLogger.debug(LTag.DATATREATMENTS, "DoubleBolusDebug: createOrUpdateMedtronic:: originalTreatment={}, fromNightScout={}", treatment, fromNightScout);
|
||||
|
||||
try {
|
||||
treatment.date = databaseHelper.roundDateToSec(treatment.date);
|
||||
|
||||
Treatment existingTreatment = getRecord(treatment.pumpId, treatment.date);
|
||||
|
||||
if (MedtronicHistoryData.doubleBolusDebug)
|
||||
aapsLogger.debug(LTag.DATATREATMENTS, "DoubleBolusDebug: createOrUpdateMedtronic:: existingTreatment={}", treatment);
|
||||
|
||||
if (existingTreatment == null) {
|
||||
getDao().create(treatment);
|
||||
aapsLogger.debug(LTag.DATATREATMENTS, "New record from: " + Source.getString(treatment.source) + " " + treatment.toString());
|
||||
DatabaseHelper.updateEarliestDataChange(treatment.date);
|
||||
scheduleTreatmentChange(treatment, true);
|
||||
return new UpdateReturn(true, true);
|
||||
} else {
|
||||
|
||||
if (existingTreatment.date == treatment.date) {
|
||||
if (MedtronicHistoryData.doubleBolusDebug)
|
||||
aapsLogger.debug(LTag.DATATREATMENTS, "DoubleBolusDebug: createOrUpdateMedtronic::(existingTreatment.date==treatment.date)");
|
||||
|
||||
// we will do update only, if entry changed
|
||||
if (!optionalTreatmentCopy(existingTreatment, treatment, fromNightScout)) {
|
||||
return new UpdateReturn(true, false);
|
||||
}
|
||||
getDao().update(existingTreatment);
|
||||
DatabaseHelper.updateEarliestDataChange(existingTreatment.date);
|
||||
scheduleTreatmentChange(treatment, true);
|
||||
return new UpdateReturn(true, false);
|
||||
} else {
|
||||
if (MedtronicHistoryData.doubleBolusDebug)
|
||||
aapsLogger.debug(LTag.DATATREATMENTS, "DoubleBolusDebug: createOrUpdateMedtronic::(existingTreatment.date != treatment.date)");
|
||||
|
||||
// date is different, we need to remove entry
|
||||
getDao().delete(existingTreatment);
|
||||
optionalTreatmentCopy(existingTreatment, treatment, fromNightScout);
|
||||
getDao().create(existingTreatment);
|
||||
DatabaseHelper.updateEarliestDataChange(existingTreatment.date);
|
||||
scheduleTreatmentChange(treatment, true);
|
||||
return new UpdateReturn(true, false); //updating a pump treatment with another one from the pump is not counted as clash
|
||||
}
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
aapsLogger.error("Unhandled SQL exception: {}", e.getMessage(), e);
|
||||
}
|
||||
|
||||
*/
|
||||
return new UpdateReturn(false, false);
|
||||
}
|
||||
|
||||
|
||||
private boolean optionalTreatmentCopy(Treatment oldTreatment, Treatment newTreatment, boolean fromNightScout) {
|
||||
|
||||
aapsLogger.debug(LTag.DATATREATMENTS, "optionalTreatmentCopy [old={}, new={}]", oldTreatment.toString(), newTreatment.toString());
|
||||
|
||||
boolean changed = false;
|
||||
|
||||
if (oldTreatment.date != newTreatment.date) {
|
||||
oldTreatment.date = newTreatment.date;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (oldTreatment.isSMB != newTreatment.isSMB) {
|
||||
if (!oldTreatment.isSMB) {
|
||||
oldTreatment.isSMB = newTreatment.isSMB;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isSame(oldTreatment.carbs, newTreatment.carbs)) {
|
||||
if (isSame(oldTreatment.carbs, 0.0d)) {
|
||||
oldTreatment.carbs = newTreatment.carbs;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (oldTreatment.mealBolus != (oldTreatment.carbs > 0)) {
|
||||
oldTreatment.mealBolus = (oldTreatment.carbs > 0);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (!isSame(oldTreatment.insulin, newTreatment.insulin)) {
|
||||
if (!fromNightScout) {
|
||||
oldTreatment.insulin = newTreatment.insulin;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!StringUtils.equals(oldTreatment._id, newTreatment._id)) {
|
||||
if (StringUtils.isBlank(oldTreatment._id)) {
|
||||
oldTreatment._id = newTreatment._id;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
int source = Source.NONE;
|
||||
|
||||
if (oldTreatment.pumpId == 0) {
|
||||
if (newTreatment.pumpId > 0) {
|
||||
oldTreatment.pumpId = newTreatment.pumpId;
|
||||
source = Source.PUMP;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (source == Source.NONE) {
|
||||
|
||||
if (oldTreatment.source == newTreatment.source) {
|
||||
source = oldTreatment.source;
|
||||
} else {
|
||||
source = (oldTreatment.source == Source.NIGHTSCOUT || newTreatment.source == Source.NIGHTSCOUT) ? Source.NIGHTSCOUT : Source.USER;
|
||||
}
|
||||
}
|
||||
|
||||
if (oldTreatment.source != source) {
|
||||
oldTreatment.source = source;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
aapsLogger.debug(LTag.DATATREATMENTS, "optionalTreatmentCopy [changed={}, newAfterChange={}]", changed, oldTreatment.toString());
|
||||
return changed;
|
||||
}
|
||||
|
||||
|
||||
public static boolean isSame(Double d1, Double d2) {
|
||||
double diff = d1 - d2;
|
||||
|
||||
return (Math.abs(diff) <= 0.00001);
|
||||
}
|
||||
|
||||
public Treatment getRecord(long pumpId, long date) {
|
||||
|
||||
Treatment record = null;
|
||||
|
||||
if (pumpId > 0) {
|
||||
|
||||
record = getPumpRecordById(pumpId);
|
||||
|
||||
if (record != null) {
|
||||
return record;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
record = getDao().queryForId(date);
|
||||
} catch (SQLException ex) {
|
||||
aapsLogger.error("Error getting entry by id ({}", date);
|
||||
}
|
||||
|
||||
return record;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the record for the given id, null if none, throws RuntimeException
|
||||
* if multiple records with the same pump id exist.
|
||||
*/
|
||||
@Nullable
|
||||
public Treatment getPumpRecordById(long pumpId) {
|
||||
try {
|
||||
QueryBuilder<Treatment, Long> queryBuilder = getDao().queryBuilder();
|
||||
Where where = queryBuilder.where();
|
||||
where.eq("pumpId", pumpId);
|
||||
queryBuilder.orderBy("date", true);
|
||||
|
||||
List<Treatment> result = getDao().query(queryBuilder.prepare());
|
||||
if (result.isEmpty())
|
||||
return null;
|
||||
if (result.size() > 1)
|
||||
aapsLogger.warn(LTag.DATATREATMENTS, "Multiple records with the same pump id found (returning first one): " + result.toString());
|
||||
return result.get(0);
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* finds treatment by its NS Id.
|
||||
*
|
||||
* @param _id
|
||||
* @return
|
||||
*/
|
||||
@Nullable
|
||||
public Treatment findByNSId(String _id) {
|
||||
try {
|
||||
TreatmentDaoWrapper daoTreatments = getDao();
|
||||
QueryBuilder<Treatment, Long> queryBuilder = daoTreatments.queryBuilder();
|
||||
Where where = queryBuilder.where();
|
||||
where.eq("_id", _id);
|
||||
queryBuilder.limit(10L);
|
||||
PreparedQuery<Treatment> preparedQuery = queryBuilder.prepare();
|
||||
List<Treatment> trList = daoTreatments.query(preparedQuery);
|
||||
if (trList.size() != 1) {
|
||||
//log.debug("Treatment findTreatmentById query size: " + trList.size());
|
||||
return null;
|
||||
} else {
|
||||
//log.debug("Treatment findTreatmentById found: " + trList.get(0).log());
|
||||
return trList.get(0);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
aapsLogger.error("Unhandled exception", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,306 +0,0 @@
|
|||
package info.nightscout.androidaps.plugins.treatments;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import dagger.android.HasAndroidInjector;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.DetailedBolusInfo;
|
||||
import info.nightscout.androidaps.database.AppRepository;
|
||||
import info.nightscout.androidaps.db.ExtendedBolus;
|
||||
import info.nightscout.androidaps.db.TemporaryBasal;
|
||||
import info.nightscout.androidaps.db.Treatment;
|
||||
import info.nightscout.androidaps.interfaces.ActivePlugin;
|
||||
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.interfaces.PluginDescription;
|
||||
import info.nightscout.androidaps.interfaces.PluginType;
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction;
|
||||
import info.nightscout.androidaps.interfaces.TreatmentServiceInterface;
|
||||
import info.nightscout.androidaps.interfaces.TreatmentsInterface;
|
||||
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
|
||||
import info.nightscout.androidaps.utils.DateUtil;
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy;
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers;
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP;
|
||||
import io.reactivex.disposables.CompositeDisposable;
|
||||
|
||||
@Singleton
|
||||
public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface {
|
||||
|
||||
private final SP sp;
|
||||
private final RxBusWrapper rxBus;
|
||||
private final ProfileFunction profileFunction;
|
||||
private final ActivePlugin activePlugin;
|
||||
private final FabricPrivacy fabricPrivacy;
|
||||
private final DateUtil dateUtil;
|
||||
private final DatabaseHelperInterface databaseHelper;
|
||||
private final AppRepository repository;
|
||||
|
||||
private final CompositeDisposable disposable = new CompositeDisposable();
|
||||
|
||||
protected TreatmentServiceInterface service;
|
||||
|
||||
@Inject
|
||||
public TreatmentsPlugin(
|
||||
HasAndroidInjector injector,
|
||||
AAPSLogger aapsLogger,
|
||||
RxBusWrapper rxBus,
|
||||
AapsSchedulers aapsSchedulers,
|
||||
ResourceHelper resourceHelper,
|
||||
Context context,
|
||||
SP sp,
|
||||
ProfileFunction profileFunction,
|
||||
ActivePlugin activePlugin,
|
||||
FabricPrivacy fabricPrivacy,
|
||||
DateUtil dateUtil,
|
||||
DatabaseHelperInterface databaseHelper,
|
||||
AppRepository repository
|
||||
) {
|
||||
super(new PluginDescription()
|
||||
.mainType(PluginType.TREATMENT)
|
||||
.pluginIcon(R.drawable.ic_treatments)
|
||||
.pluginName(R.string.treatments)
|
||||
.shortName(R.string.treatments_shortname)
|
||||
.alwaysEnabled(true)
|
||||
.description(R.string.description_treatments)
|
||||
.setDefault(),
|
||||
aapsLogger, resourceHelper, injector
|
||||
);
|
||||
this.rxBus = rxBus;
|
||||
this.sp = sp;
|
||||
this.profileFunction = profileFunction;
|
||||
this.activePlugin = activePlugin;
|
||||
this.fabricPrivacy = fabricPrivacy;
|
||||
this.dateUtil = dateUtil;
|
||||
this.databaseHelper = databaseHelper;
|
||||
this.repository = repository;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
this.service = new TreatmentService(getInjector());
|
||||
super.onStart();
|
||||
// disposable.add(rxBus
|
||||
// .toObservable(EventReloadProfileSwitchData.class)
|
||||
// .observeOn(aapsSchedulers.getIo())
|
||||
// .subscribe(event -> initializeProfileSwitchData(range()),
|
||||
// fabricPrivacy::logException
|
||||
// ));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
disposable.clear();
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TreatmentServiceInterface getService() {
|
||||
return this.service;
|
||||
}
|
||||
|
||||
protected long range() {
|
||||
double dia = Constants.defaultDIA;
|
||||
if (profileFunction.getProfile() != null)
|
||||
dia = profileFunction.getProfile().getDia();
|
||||
return (long) (60 * 60 * 1000L * (24 + dia));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all Treatments after specified timestamp. Also returns invalid entries (required to
|
||||
* map "Fill Cannula" entries to history (and not to add double bolus for it)
|
||||
*
|
||||
* @param fromTimestamp
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public List<Treatment> getTreatmentsFromHistoryAfterTimestamp(long fromTimestamp) {
|
||||
return repository.getBolusesIncludingInvalidFromTimeToTime(fromTimestamp, dateUtil.now(), true)
|
||||
.blockingGet()
|
||||
.stream()
|
||||
.map(bolus -> new Treatment(getInjector(), bolus))
|
||||
.collect(Collectors.toList());
|
||||
/*
|
||||
List<Treatment> in5minback = new ArrayList<>();
|
||||
|
||||
long time = System.currentTimeMillis();
|
||||
synchronized (treatments) {
|
||||
// getAapsLogger().debug(MedtronicHistoryData.doubleBolusDebug, LTag.DATATREATMENTS, "DoubleBolusDebug: AllTreatmentsInDb: " + new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create().toJson(treatments));
|
||||
|
||||
for (Treatment t : treatments) {
|
||||
if (t.date >= fromTimestamp && t.date <= time)
|
||||
in5minback.add(t);
|
||||
}
|
||||
// getAapsLogger().debug(MedtronicHistoryData.doubleBolusDebug, LTag.DATATREATMENTS, "DoubleBolusDebug: FilteredTreatments: AfterTime={}, Items={} " + fromTimestamp + " " + new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create().toJson(in5minback));
|
||||
return in5minback;
|
||||
}
|
||||
*/
|
||||
}
|
||||
/*
|
||||
@Override
|
||||
public long getLastBolusTime() {
|
||||
Treatment last = getService().getLastBolus(false);
|
||||
if (last == null) {
|
||||
getAapsLogger().debug(LTag.DATATREATMENTS, "Last bolus time: NOTHING FOUND");
|
||||
return 0;
|
||||
} else {
|
||||
getAapsLogger().debug(LTag.DATATREATMENTS, "Last bolus time: " + dateUtil.dateAndTimeString(last.date));
|
||||
return last.date;
|
||||
}
|
||||
}
|
||||
|
||||
public long getLastBolusTime(boolean excludeSMB) {
|
||||
Treatment last = getService().getLastBolus(excludeSMB);
|
||||
if (last == null) {
|
||||
getAapsLogger().debug(LTag.DATATREATMENTS, "Last manual bolus time: NOTHING FOUND");
|
||||
return 0;
|
||||
} else {
|
||||
getAapsLogger().debug(LTag.DATATREATMENTS, "Last manual bolus time: " + dateUtil.dateAndTimeString(last.date));
|
||||
return last.date;
|
||||
}
|
||||
}
|
||||
|
||||
public long getLastCarbTime() {
|
||||
Treatment last = getService().getLastCarb();
|
||||
if (last == null) {
|
||||
getAapsLogger().debug(LTag.DATATREATMENTS, "Last Carb time: NOTHING FOUND");
|
||||
return 0;
|
||||
} else {
|
||||
getAapsLogger().debug(LTag.DATATREATMENTS, "Last Carb time: " + dateUtil.dateAndTimeString(last.date));
|
||||
return last.date;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public boolean addToHistoryExtendedBolus(ExtendedBolus extendedBolus) {
|
||||
throw new IllegalStateException("Migrate to new DB");
|
||||
//log.debug("Adding new ExtentedBolus record" + extendedBolus.log());
|
||||
/*
|
||||
boolean newRecordCreated = databaseHelper.createOrUpdate(extendedBolus);
|
||||
if (newRecordCreated) {
|
||||
if (extendedBolus.durationInMinutes == 0) {
|
||||
if (activePlugin.getActivePump().isFakingTempsByExtendedBoluses())
|
||||
nsUpload.uploadTempBasalEnd(extendedBolus.date, true, extendedBolus.pumpId);
|
||||
else
|
||||
nsUpload.uploadExtendedBolusEnd(extendedBolus.date, extendedBolus.pumpId);
|
||||
} else if (activePlugin.getActivePump().isFakingTempsByExtendedBoluses())
|
||||
nsUpload.uploadTempBasalStartAbsolute(new TemporaryBasal(extendedBolus), extendedBolus.insulin);
|
||||
else
|
||||
nsUpload.uploadExtendedBolus(extendedBolus);
|
||||
}
|
||||
return newRecordCreated;
|
||||
*/
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public boolean addToHistoryTempBasal(TemporaryBasal tempBasal) {
|
||||
throw new IllegalStateException("Migrate to new DB");
|
||||
/*
|
||||
//log.debug("Adding new TemporaryBasal record" + tempBasal.toString());
|
||||
boolean newRecordCreated = databaseHelper.createOrUpdate(tempBasal);
|
||||
if (newRecordCreated) {
|
||||
if (tempBasal.durationInMinutes == 0)
|
||||
nsUpload.uploadTempBasalEnd(tempBasal.date, false, tempBasal.pumpId);
|
||||
else if (tempBasal.isAbsolute)
|
||||
nsUpload.uploadTempBasalStartAbsolute(tempBasal, null);
|
||||
else
|
||||
nsUpload.uploadTempBasalStartPercent(tempBasal, profileFunction.getProfile(tempBasal.date));
|
||||
}
|
||||
return newRecordCreated;
|
||||
*/
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public TreatmentUpdateReturn createOrUpdateMedtronic(Treatment treatment, boolean fromNightScout) {
|
||||
throw new IllegalStateException("Migrate to new DB");
|
||||
/*
|
||||
UpdateReturn resultRecord = getService().createOrUpdateMedtronic(treatment, fromNightScout);
|
||||
|
||||
return new TreatmentUpdateReturn(resultRecord.getSuccess(), resultRecord.getNewRecord());
|
||||
*/
|
||||
}
|
||||
|
||||
// return true if new record is created
|
||||
@Deprecated
|
||||
@Override
|
||||
public boolean addToHistoryTreatment(DetailedBolusInfo detailedBolusInfo, boolean allowUpdate) {
|
||||
throw new IllegalStateException("Migrate to new DB");
|
||||
/*
|
||||
boolean medtronicPump = activePlugin.getActivePump() instanceof MedtronicPumpPlugin;
|
||||
|
||||
getAapsLogger().debug(MedtronicHistoryData.doubleBolusDebug, LTag.DATATREATMENTS, "DoubleBolusDebug: addToHistoryTreatment::isMedtronicPump={} " + medtronicPump);
|
||||
|
||||
Treatment treatment = new Treatment();
|
||||
treatment.date = detailedBolusInfo.timestamp;
|
||||
treatment.source = (detailedBolusInfo.getPumpType() == PumpType.USER) ? Source.USER : Source.PUMP;
|
||||
treatment.pumpId = detailedBolusInfo.getBolusPumpId() != null ? detailedBolusInfo.getBolusPumpId() : 0;
|
||||
treatment.insulin = detailedBolusInfo.insulin;
|
||||
treatment.isValid = detailedBolusInfo.getBolusType() != DetailedBolusInfo.BolusType.PRIMING;
|
||||
treatment.isSMB = detailedBolusInfo.getBolusType() == DetailedBolusInfo.BolusType.SMB;
|
||||
if (detailedBolusInfo.carbTime == 0)
|
||||
treatment.carbs = detailedBolusInfo.carbs;
|
||||
treatment.mealBolus = treatment.carbs > 0;
|
||||
// treatment.boluscalc = detailedBolusInfo.boluscalc != null ? detailedBolusInfo.boluscalc.toString() : null;
|
||||
treatment.boluscalc = null;
|
||||
UpdateReturn creatOrUpdateResult;
|
||||
|
||||
getAapsLogger().debug(medtronicPump && MedtronicHistoryData.doubleBolusDebug, LTag.DATATREATMENTS, "DoubleBolusDebug: addToHistoryTreatment::treatment={} " + treatment);
|
||||
|
||||
if (!medtronicPump)
|
||||
creatOrUpdateResult = getService().createOrUpdate(treatment);
|
||||
else
|
||||
creatOrUpdateResult = getService().createOrUpdateMedtronic(treatment, false);
|
||||
|
||||
boolean newRecordCreated = creatOrUpdateResult.getNewRecord();
|
||||
//log.debug("Adding new Treatment record" + treatment.toString());
|
||||
if (detailedBolusInfo.carbTime != 0) {
|
||||
|
||||
Treatment carbsTreatment = new Treatment();
|
||||
carbsTreatment.source = (detailedBolusInfo.getPumpType() == PumpType.USER) ? Source.USER : Source.PUMP;
|
||||
carbsTreatment.pumpId = detailedBolusInfo.getCarbsPumpId() != null ? detailedBolusInfo.getCarbsPumpId() : 0; // but this should never happen
|
||||
carbsTreatment.date = detailedBolusInfo.timestamp + detailedBolusInfo.carbTime * 60 * 1000L + 1000L; // add 1 sec to make them different records
|
||||
carbsTreatment.carbs = detailedBolusInfo.carbs;
|
||||
|
||||
getAapsLogger().debug(medtronicPump && MedtronicHistoryData.doubleBolusDebug, LTag.DATATREATMENTS, "DoubleBolusDebug: carbTime!=0, creating second treatment. CarbsTreatment={}" + carbsTreatment);
|
||||
|
||||
if (!medtronicPump)
|
||||
getService().createOrUpdate(carbsTreatment);
|
||||
else
|
||||
getService().createOrUpdateMedtronic(carbsTreatment, false);
|
||||
//log.debug("Adding new Treatment record" + carbsTreatment);
|
||||
}
|
||||
if (newRecordCreated && detailedBolusInfo.getBolusType() != DetailedBolusInfo.BolusType.PRIMING)
|
||||
nsUpload.uploadTreatmentRecord(detailedBolusInfo);
|
||||
|
||||
if (!allowUpdate && !creatOrUpdateResult.getSuccess()) {
|
||||
getAapsLogger().error("Treatment could not be added to DB", new Exception());
|
||||
|
||||
String status = String.format(resourceHelper.gs(R.string.error_adding_treatment_message), treatment.insulin, (int) treatment.carbs, dateUtil.dateAndTimeString(treatment.date));
|
||||
|
||||
ErrorHelperActivity.Companion.runAlarm(context, status, resourceHelper.gs(R.string.error_adding_treatment_title), R.raw.error);
|
||||
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(FirebaseAnalytics.Param.ITEM_LIST_ID, "TreatmentClash");
|
||||
bundle.putString(FirebaseAnalytics.Param.ITEM_LIST_NAME, status);
|
||||
fabricPrivacy.logCustom(bundle);
|
||||
}
|
||||
|
||||
return newRecordCreated;
|
||||
*/
|
||||
}
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
package info.nightscout.androidaps.plugins.treatments.events
|
||||
|
||||
import info.nightscout.androidaps.events.EventUpdateGui
|
||||
|
||||
class EventTreatmentUpdateGui : EventUpdateGui()
|
|
@ -68,12 +68,12 @@ open class CommandQueue @Inject constructor(
|
|||
private val disposable = CompositeDisposable()
|
||||
|
||||
private val queue = LinkedList<Command>()
|
||||
private var thread: QueueThread? = null
|
||||
@Volatile private var thread: QueueThread? = null
|
||||
|
||||
var performing: Command? = null
|
||||
@Volatile var performing: Command? = null
|
||||
|
||||
init {
|
||||
disposable.add(rxBus
|
||||
disposable += rxBus
|
||||
.toObservable(EventProfileSwitchChanged::class.java)
|
||||
.observeOn(aapsSchedulers.io)
|
||||
.subscribe({
|
||||
|
@ -109,8 +109,6 @@ open class CommandQueue @Inject constructor(
|
|||
})
|
||||
}
|
||||
}, fabricPrivacy::logException)
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
private fun executingNowError(): PumpEnactResult =
|
||||
|
@ -197,16 +195,17 @@ open class CommandQueue @Inject constructor(
|
|||
aapsLogger.debug(LTag.PUMPQUEUE, "Starting new queue")
|
||||
val tempCommandQueue = CommandQueue(injector, aapsLogger, rxBus, aapsSchedulers, resourceHelper, constraintChecker, profileFunction, activePlugin, context, sp, buildHelper, dateUtil, repository, fabricPrivacy)
|
||||
tempCommandQueue.readStatus(reason, callback)
|
||||
tempCommandQueue.disposable.clear()
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
override fun bolusInQueue(): Boolean {
|
||||
if (isRunning(CommandType.BOLUS)) return true
|
||||
if (isRunning(CommandType.SMB_BOLUS)) return true
|
||||
synchronized(queue) {
|
||||
for (i in queue.indices) {
|
||||
if (queue[i].commandType == CommandType.BOLUS) {
|
||||
return true
|
||||
}
|
||||
if (queue[i].commandType == CommandType.BOLUS) return true
|
||||
if (queue[i].commandType == CommandType.SMB_BOLUS) return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
|
@ -243,13 +242,15 @@ open class CommandQueue @Inject constructor(
|
|||
}
|
||||
var type = if (detailedBolusInfo.bolusType == DetailedBolusInfo.BolusType.SMB) CommandType.SMB_BOLUS else CommandType.BOLUS
|
||||
if (type == CommandType.SMB_BOLUS) {
|
||||
if (isRunning(CommandType.BOLUS) || isRunning(CommandType.SMB_BOLUS) || bolusInQueue()) {
|
||||
if (bolusInQueue()) {
|
||||
aapsLogger.debug(LTag.PUMPQUEUE, "Rejecting SMB since a bolus is queue/running")
|
||||
callback?.result(PumpEnactResult(injector).enacted(false).success(false))?.run()
|
||||
return false
|
||||
}
|
||||
val lastBolusTime = repository.getLastBolusRecord()?.timestamp ?: 0L
|
||||
if (detailedBolusInfo.lastKnownBolusTime < lastBolusTime) {
|
||||
aapsLogger.debug(LTag.PUMPQUEUE, "Rejecting bolus, another bolus was issued since request time")
|
||||
callback?.result(PumpEnactResult(injector).enacted(false).success(false))?.run()
|
||||
return false
|
||||
}
|
||||
removeAll(CommandType.SMB_BOLUS)
|
||||
|
|
|
@ -3,6 +3,7 @@ package info.nightscout.androidaps.queue.commands
|
|||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||
import info.nightscout.androidaps.interfaces.Dana
|
||||
import info.nightscout.androidaps.interfaces.Diaconn
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.queue.Callback
|
||||
import javax.inject.Inject
|
||||
|
@ -22,6 +23,13 @@ class CommandLoadEvents(
|
|||
aapsLogger.debug(LTag.PUMPQUEUE, "Result success: ${r.success} enacted: ${r.enacted}")
|
||||
callback?.result(r)?.run()
|
||||
}
|
||||
|
||||
if (pump is Diaconn) {
|
||||
val diaconnPump = pump as Diaconn
|
||||
val r = diaconnPump.loadHistory()
|
||||
aapsLogger.debug(LTag.PUMPQUEUE, "Result success: ${r.success} enacted: ${r.enacted}")
|
||||
callback?.result(r)?.run()
|
||||
}
|
||||
}
|
||||
|
||||
override fun status(): String = "LOAD EVENTS"
|
||||
|
|
|
@ -3,6 +3,7 @@ package info.nightscout.androidaps.queue.commands
|
|||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||
import info.nightscout.androidaps.interfaces.Dana
|
||||
import info.nightscout.androidaps.interfaces.Diaconn
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.queue.Callback
|
||||
import javax.inject.Inject
|
||||
|
@ -23,6 +24,13 @@ class CommandLoadHistory(
|
|||
aapsLogger.debug(LTag.PUMPQUEUE, "Result success: " + r.success + " enacted: " + r.enacted)
|
||||
callback?.result(r)?.run()
|
||||
}
|
||||
|
||||
if (pump is Diaconn) {
|
||||
val diaconnG8Pump = pump as Diaconn
|
||||
val r = diaconnG8Pump.loadHistory()
|
||||
aapsLogger.debug(LTag.PUMPQUEUE, "Result success: " + r.success + " enacted: " + r.enacted)
|
||||
callback?.result(r)?.run()
|
||||
}
|
||||
}
|
||||
|
||||
override fun status(): String = "LOAD HISTORY $type"
|
||||
|
|
|
@ -23,6 +23,7 @@ class CommandSMBBolus(
|
|||
override fun execute() {
|
||||
val r: PumpEnactResult
|
||||
val lastBolusTime = repository.getLastBolusRecord()?.timestamp ?: 0L
|
||||
aapsLogger.debug(LTag.PUMPQUEUE, "Last bolus: $lastBolusTime ${dateUtil.dateAndTimeAndSecondsString(lastBolusTime)}")
|
||||
if (lastBolusTime != 0L && lastBolusTime + T.mins(3).msecs() > dateUtil.now()) {
|
||||
aapsLogger.debug(LTag.PUMPQUEUE, "SMB requested but still in 3 min interval")
|
||||
r = PumpEnactResult(injector).enacted(false).success(false).comment("SMB requested but still in 3 min interval")
|
||||
|
|
|
@ -3,6 +3,7 @@ package info.nightscout.androidaps.queue.commands
|
|||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||
import info.nightscout.androidaps.interfaces.Dana
|
||||
import info.nightscout.androidaps.interfaces.Diaconn
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.queue.Callback
|
||||
import javax.inject.Inject
|
||||
|
@ -21,6 +22,12 @@ class CommandSetUserSettings(
|
|||
aapsLogger.debug(LTag.PUMPQUEUE, "Result success: ${r.success} enacted: ${r.enacted}")
|
||||
callback?.result(r)?.run()
|
||||
}
|
||||
|
||||
if (pump is Diaconn) {
|
||||
val r = pump.setUserOptions()
|
||||
aapsLogger.debug(LTag.PUMPQUEUE, "Result success: ${r.success} enacted: ${r.enacted}")
|
||||
callback?.result(r)?.run()
|
||||
}
|
||||
}
|
||||
|
||||
override fun status(): String = "SET USER SETTINGS"
|
||||
|
|
|
@ -28,6 +28,7 @@ import info.nightscout.androidaps.logging.LTag
|
|||
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.configBuilder.RunningConfiguration
|
||||
import info.nightscout.androidaps.plugins.general.maintenance.MaintenancePlugin
|
||||
import info.nightscout.androidaps.queue.commands.Command
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
|
@ -72,6 +73,7 @@ class KeepAliveReceiver : DaggerBroadcastReceiver() {
|
|||
@Inject lateinit var rxBus: RxBusWrapper
|
||||
@Inject lateinit var commandQueue: CommandQueueProvider
|
||||
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
||||
@Inject lateinit var maintenancePlugin: MaintenancePlugin
|
||||
|
||||
init {
|
||||
(context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
|
||||
|
@ -93,6 +95,8 @@ class KeepAliveReceiver : DaggerBroadcastReceiver() {
|
|||
localAlertUtils.checkStaleBGAlert()
|
||||
checkPump()
|
||||
checkAPS()
|
||||
maintenancePlugin.deleteLogs(30)
|
||||
|
||||
return Result.success()
|
||||
}
|
||||
|
||||
|
|
|
@ -40,6 +40,6 @@ class NotificationHolderImpl @Inject constructor(
|
|||
override fun openAppIntent(context: Context): PendingIntent? = TaskStackBuilder.create(context).run {
|
||||
addParentStack(MainActivity::class.java)
|
||||
addNextIntent(Intent(context, MainActivity::class.java))
|
||||
getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
getPendingIntent(0, PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,20 +2,22 @@ package info.nightscout.androidaps.utils.buildHelper
|
|||
|
||||
import info.nightscout.androidaps.BuildConfig
|
||||
import info.nightscout.androidaps.interfaces.Config
|
||||
import info.nightscout.androidaps.plugins.general.maintenance.LoggerUtils
|
||||
import info.nightscout.androidaps.plugins.general.maintenance.PrefFileListProvider
|
||||
import java.io.File
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Singleton
|
||||
class BuildHelper @Inject constructor(private val config: Config, loggerUtils: LoggerUtils) {
|
||||
class BuildHelper @Inject constructor(
|
||||
private val config: Config,
|
||||
fileListProvider: PrefFileListProvider
|
||||
) {
|
||||
|
||||
private var devBranch = false
|
||||
private var engineeringMode = false
|
||||
|
||||
init {
|
||||
val extFilesDir = loggerUtils.logDirectory
|
||||
val engineeringModeSemaphore = File(extFilesDir, "engineering__mode")
|
||||
val engineeringModeSemaphore = File(fileListProvider.ensureExtraDirExists(), "engineering__mode")
|
||||
|
||||
engineeringMode = engineeringModeSemaphore.exists() && engineeringModeSemaphore.isFile
|
||||
devBranch = BuildConfig.VERSION.contains("-") || BuildConfig.VERSION.matches(Regex(".*[a-zA-Z]+.*"))
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
package info.nightscout.androidaps.utils
|
||||
package info.nightscout.androidaps.utils.ui
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.utils.ui.NumberPicker
|
||||
|
||||
class NumberPickerVertical : NumberPicker {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.utils;
|
||||
package info.nightscout.androidaps.utils.ui;
|
||||
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.utils;
|
||||
package info.nightscout.androidaps.utils.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.Editable;
|
||||
|
@ -26,7 +26,10 @@ import java.util.List;
|
|||
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||
import info.nightscout.androidaps.utils.DateUtil;
|
||||
import info.nightscout.androidaps.utils.SafeParse;
|
||||
import info.nightscout.androidaps.utils.ui.NumberPicker;
|
||||
import info.nightscout.androidaps.utils.ui.SpinnerHelper;
|
||||
|
||||
/**
|
||||
* Created by mike on 29.12.2016.
|
|
@ -20,13 +20,13 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<info.nightscout.androidaps.utils.NumberPickerVertical
|
||||
<info.nightscout.androidaps.utils.ui.NumberPickerVertical
|
||||
android:id="@+id/timelistedit_edit1"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_marginRight="5dp" />
|
||||
|
||||
<info.nightscout.androidaps.utils.NumberPickerVertical
|
||||
<info.nightscout.androidaps.utils.ui.NumberPickerVertical
|
||||
android:id="@+id/timelistedit_edit2"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="100dp" />
|
||||
|
|
|
@ -75,8 +75,6 @@
|
|||
<string name="careportal">Careportal</string>
|
||||
<string name="configbuilder_pump">Pomp</string>
|
||||
<string name="configbuilder_pump_description">Watter pomp wil jy gebruik met AndroidAPS?</string>
|
||||
<string name="configbuilder_treatments">Behandelings</string>
|
||||
<string name="configbuilder_treatments_description">Watter plugin moet gebruik word vir behandeling hantering?</string>
|
||||
<string name="configbuilder_profile">Profiel</string>
|
||||
<string name="configbuilder_profile_description">Watter profiel moet AndroidAPS gebruik?</string>
|
||||
<string name="configbuilder_aps">APS</string>
|
||||
|
|
|
@ -81,8 +81,6 @@
|
|||
<string name="careportal">Careportal</string>
|
||||
<string name="configbuilder_pump">Помпа</string>
|
||||
<string name="configbuilder_pump_description">Каква помпа използвате с AndroidAPS?</string>
|
||||
<string name="configbuilder_treatments">Лечения</string>
|
||||
<string name="configbuilder_treatments_description">Коя приставка да използваме за леченията?</string>
|
||||
<string name="configbuilder_profile">Профил</string>
|
||||
<string name="configbuilder_profile_description">Кой тип профил да използва AndroidAPS?</string>
|
||||
<string name="configbuilder_aps">Алгоритъм за APS</string>
|
||||
|
|
|
@ -81,8 +81,6 @@
|
|||
<string name="careportal">Péče</string>
|
||||
<string name="configbuilder_pump">Pumpa</string>
|
||||
<string name="configbuilder_pump_description">Jakou pumpu chcete používat s AndroidAPS?</string>
|
||||
<string name="configbuilder_treatments">Ošetření</string>
|
||||
<string name="configbuilder_treatments_description">Jaký plugin chcete používat pro ukládání informací?</string>
|
||||
<string name="configbuilder_profile">Profil</string>
|
||||
<string name="configbuilder_profile_description">Jaký profil má AndroidAPS používat?</string>
|
||||
<string name="configbuilder_aps">APS</string>
|
||||
|
@ -911,6 +909,8 @@
|
|||
<string name="ns_receive_temp_target_summary">Přijmout dočasné cíle zadané prostřednictvím NS nebo NSClienta</string>
|
||||
<string name="ns_receive_profile_switch">Přijímat přepnutí profilu</string>
|
||||
<string name="ns_receive_profile_switch_summary">Přijmout přepnutí profilu zadané prostřednictvím NS nebo NSClienta</string>
|
||||
<string name="ns_receive_offline_event">Přijímat události APS offline</string>
|
||||
<string name="ns_receive_offline_event_summary">Přijmout APS offline události zadané prostřednictvím NS nebo NSClienta</string>
|
||||
<string name="ns_receive_insulin">Přijímat inzulín</string>
|
||||
<string name="ns_receive_insulin_summary">Přijmout inzulín vložený přes NS nebo NSClient (není dodán, pouze započítán do IOB)</string>
|
||||
<string name="ns_receive_carbs">Přijímat sacharidy</string>
|
||||
|
@ -919,4 +919,6 @@
|
|||
<string name="ns_receive_therapy_events_summary">Přijmout léčebné události (výměna setu, inzulínu, baterie atd.) zadané prostřednictvím NS nebo NSClienta</string>
|
||||
<string name="ns_receive_cgm">Přijímat/doplňovat glykémie</string>
|
||||
<string name="ns_receive_cgm_summary">Přijmout CGM data z NS</string>
|
||||
<string name="sms_timeout_while_wating">Vypršel časový limit při čekání na dokončení předchozí komunikace s pumpou</string>
|
||||
<string name="smscommunicator_another_bolus_in_queue">Ve frontě je další bolus. Zkuste to znovu později.</string>
|
||||
</resources>
|
||||
|
|
|
@ -81,8 +81,6 @@
|
|||
<string name="careportal">Careportal</string>
|
||||
<string name="configbuilder_pump">Pumpe</string>
|
||||
<string name="configbuilder_pump_description">Welche Pumpe möchtest Du mit AndroidAPS nutzen?</string>
|
||||
<string name="configbuilder_treatments">Behandlungen</string>
|
||||
<string name="configbuilder_treatments_description">Welches Plugin soll zum Verarbeiten von Behandlungen genutzt werden?</string>
|
||||
<string name="configbuilder_profile">Profil</string>
|
||||
<string name="configbuilder_profile_description">Welches Profil soll AndroidAPS nutzen?</string>
|
||||
<string name="configbuilder_aps">APS</string>
|
||||
|
@ -918,4 +916,6 @@ Unerwartetes Verhalten.</string>
|
|||
<string name="ns_receive_therapy_events_summary">Ereignisse (Kanülen-, Ampullen-, Batteriewechsel etc.) akzeptieren, die in NS oder NSClient eingegeben wurden</string>
|
||||
<string name="ns_receive_cgm">Historische CGM Daten ergänzen</string>
|
||||
<string name="ns_receive_cgm_summary">CGM Daten von NS akzeptieren</string>
|
||||
<string name="sms_timeout_while_wating">Zeitüberschreitung beim Warten auf das Ende der vorherigen Kommunikation mit der Pumpe</string>
|
||||
<string name="smscommunicator_another_bolus_in_queue">In der Warteschlange befindet sich ein weiterer Bolus. Bitte später erneut versuchen.</string>
|
||||
</resources>
|
||||
|
|
|
@ -77,8 +77,6 @@
|
|||
<string name="careportal">Φροντίδα</string>
|
||||
<string name="configbuilder_pump">Αντλία</string>
|
||||
<string name="configbuilder_pump_description">Ποια αντλία θα θέλατε να χρησιμοποιήσετε με το AndroidAPS;</string>
|
||||
<string name="configbuilder_treatments">Θεραπείες</string>
|
||||
<string name="configbuilder_treatments_description">Ποια προσθήκη πρέπει να χρησιμοποιηθεί για το χειρισμό της θεραπείας;</string>
|
||||
<string name="configbuilder_profile">Προφίλ</string>
|
||||
<string name="configbuilder_profile_description">Ποιο προφίλ πρέπει να χρησιμοποιήσει το AndroidAPS;</string>
|
||||
<string name="configbuilder_aps">APS</string>
|
||||
|
|
|
@ -81,8 +81,6 @@
|
|||
<string name="careportal">Portal de Tratamientos</string>
|
||||
<string name="configbuilder_pump">Bomba</string>
|
||||
<string name="configbuilder_pump_description">¿Qué bomba quieres utilizar con AndroidAPS?</string>
|
||||
<string name="configbuilder_treatments">Tratamientos</string>
|
||||
<string name="configbuilder_treatments_description">¿Que complemento quieres usar para el manejo del tratamiento?</string>
|
||||
<string name="configbuilder_profile">Perfil</string>
|
||||
<string name="configbuilder_profile_description">¿Qué perfil debe usar AndroidAPS?</string>
|
||||
<string name="configbuilder_aps">APS</string>
|
||||
|
|
|
@ -81,8 +81,6 @@
|
|||
<string name="careportal">Careportal</string>
|
||||
<string name="configbuilder_pump">Pompe</string>
|
||||
<string name="configbuilder_pump_description">Quelle pompe souhaitez-vous utiliser avec AndroidAPS ?</string>
|
||||
<string name="configbuilder_treatments">Traitements</string>
|
||||
<string name="configbuilder_treatments_description">Quel plugin doit être utilisé pour la gestion des traitements ?</string>
|
||||
<string name="configbuilder_profile">Profil</string>
|
||||
<string name="configbuilder_profile_description">Quel profil doit utiliser AndroidAPS ?</string>
|
||||
<string name="configbuilder_aps">APS</string>
|
||||
|
@ -96,7 +94,7 @@
|
|||
<string name="loop_aps_label">APS</string>
|
||||
<string name="loop_constraintsprocessed_label">Après traitement des restrictions</string>
|
||||
<string name="loop_tbrsetbypump_label">Basal temporaire défini par la pompe</string>
|
||||
<string name="noapsselected">Pas d\'APS séléctionné ou pas de résultat fourni</string>
|
||||
<string name="noapsselected">Pas d\'APS sélectionné ou pas de résultat fourni</string>
|
||||
<string name="safety">Sécurité</string>
|
||||
<string name="openapsma_disabled">Plugin désactivé</string>
|
||||
<string name="constraints_violation">Violation des restrictions</string>
|
||||
|
@ -732,7 +730,7 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
|
|||
<string name="slowabsorptiondetected"><![CDATA[<font color=\'%1$s\'>!!!!! Absorption lente des glucides détectée : %2$d%% du temps. Vérifiez de nouveau votre calcul. Les GA (Glucides Actifs) peuvent être surestimés et alors plus d\'insuline pourrait être délivré !!!!!</font>]]></string>
|
||||
<string name="partialboluswizard">Injecter cette partie de Bolus calculée par l’assistant [%]</string>
|
||||
<string name="deliverpartofboluswizard">L\'assistant Bolus effectue le calcul mais seulement cette partie de l\'insuline calculée est délivrée. Utile avec l\'algorithme SMB.</string>
|
||||
<string name="snooze">Report alarme</string>
|
||||
<string name="snooze">Masquer</string>
|
||||
<string name="increasingmaxbasal">Augmentation de la valeur du débit Basal max parce que ce paramètre est inférieur au débit Basal max de votre profil</string>
|
||||
<string name="smscommunicator_messagebody">Message invalide</string>
|
||||
<string name="format_bg_isf">%1$s SI: %2$.1f</string>
|
||||
|
@ -912,6 +910,8 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
|
|||
<string name="ns_receive_temp_target_summary">Accepter les cibles temporaires entrées via NS ou NSClient</string>
|
||||
<string name="ns_receive_profile_switch">Recevoir les changements de profil</string>
|
||||
<string name="ns_receive_profile_switch_summary">Accepter les changements de profil entrés via NS ou NSClient</string>
|
||||
<string name="ns_receive_offline_event">Recevoir les événements APS hors ligne</string>
|
||||
<string name="ns_receive_offline_event_summary">Accepter les événements APS hors ligne entrés via NS ou NSClient</string>
|
||||
<string name="ns_receive_insulin">Recevoir l\'insuline</string>
|
||||
<string name="ns_receive_insulin_summary">Acceptez l\'insuline entrée via NS ou NSClient (elle n\'est pas injectée, uniquement pour le calcul pour IA)</string>
|
||||
<string name="ns_receive_carbs">Recevoir les glucides</string>
|
||||
|
@ -920,4 +920,6 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
|
|||
<string name="ns_receive_therapy_events_summary">Accepter les événements de thérapie (canule, insuline, changement de batterie, etc.) entrés via NS ou NSClient</string>
|
||||
<string name="ns_receive_cgm">Recevoir/remplir les anciennes données MGC</string>
|
||||
<string name="ns_receive_cgm_summary">Accepter les données MGC de NS</string>
|
||||
<string name="sms_timeout_while_wating">Délai d\'attente pour finir la communication précédente avec la pompe</string>
|
||||
<string name="smscommunicator_another_bolus_in_queue">Un autre bolus est en file d\'attente. Réessayez plus tard.</string>
|
||||
</resources>
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
<string name="sms_delta">Deilte:</string>
|
||||
<string name="treatments">Cóireálacha</string>
|
||||
<string name="configbuilder_pump">Caidéil</string>
|
||||
<string name="configbuilder_treatments">Cóireálacha</string>
|
||||
<string name="configbuilder_profile">Próifíl</string>
|
||||
<string name="configbuilder_aps">APS</string>
|
||||
<string name="configbuilder_general">Ginearálta</string>
|
||||
|
|
|
@ -81,8 +81,6 @@
|
|||
<string name="careportal">Portale</string>
|
||||
<string name="configbuilder_pump">Micro</string>
|
||||
<string name="configbuilder_pump_description">Quale microinfusore desideri usare con AndroidAPS?</string>
|
||||
<string name="configbuilder_treatments">Trattamenti</string>
|
||||
<string name="configbuilder_treatments_description">Quale plugin dovrebbe essere usato per la gestione del trattamento?</string>
|
||||
<string name="configbuilder_profile">Profilo</string>
|
||||
<string name="configbuilder_profile_description">Quale profilo AndroidAPS dovrebbe usare?</string>
|
||||
<string name="configbuilder_aps">APS</string>
|
||||
|
@ -778,6 +776,7 @@
|
|||
<string name="randombg_short">BG</string>
|
||||
<string name="tools">Strumenti</string>
|
||||
<string name="show_calculation">Mostra calcolo</string>
|
||||
<string name="show_removed">Mostra rimossi</string>
|
||||
<string name="clearqueueconfirm">Cancellare la coda? Tutti i dati in coda andranno persi!</string>
|
||||
<string name="ebstopsloop">L\'uso della funzione bolo esteso interromperà la modalità loop chiuso per il tempo di esecuzione del bolo esteso. Lo vuoi davvero?</string>
|
||||
<string name="closed_loop_disabled_with_eb">Loop chiuso disabilitato a causa dell\'esecuzione di un bolo esteso</string>
|
||||
|
@ -899,9 +898,27 @@
|
|||
<string name="profile_max_daily_basal_value">Valore max basale (profilo)</string>
|
||||
<string name="current_basal_value">Valore basale corrente</string>
|
||||
<string name="profile_carbs_ratio_value">Valore rapporto CHO (profilo)</string>
|
||||
<string name="full_sync">Sincronizzazione completa</string>
|
||||
<string name="prime">Caricamento</string>
|
||||
<string name="ns_sync_options">Sincronizzazione</string>
|
||||
<string name="ns_upload_summary">Profili, boli, CHO, basali temporanee vengono caricati su NS</string>
|
||||
<string name="ns_upload">Carica dati su NS</string>
|
||||
<string name="ns_receive_profile_store">Ricevi \"store\" profilo</string>
|
||||
<string name="ns_receive_profile_store_summary">Sincronizza i profili da NS al profilo locale</string>
|
||||
<string name="ns_receive_temp_target">Ricevi target temporanei</string>
|
||||
<string name="ns_receive_temp_target_summary">Accetta target temporanei inseriti tramite NS o NSClient</string>
|
||||
<string name="ns_receive_profile_switch">Ricevi cambi profilo</string>
|
||||
<string name="ns_receive_profile_switch_summary">Accetta cambi profilo inseriti tramite NS o NSClient</string>
|
||||
<string name="ns_receive_offline_event">Ricevi eventi APS offline</string>
|
||||
<string name="ns_receive_offline_event_summary">Accetta eventi APS offline inseriti tramite NS o NSClient</string>
|
||||
<string name="ns_receive_insulin">Ricevi insulina</string>
|
||||
<string name="ns_receive_insulin_summary">Accetta insulina inserita tramite NS o NSClient (non viene erogata, solo calcolata per IOB)</string>
|
||||
<string name="ns_receive_carbs">Ricevi CHO</string>
|
||||
<string name="ns_receive_carbs_summary">Accetta CHO inseriti tramite NS o NSClient</string>
|
||||
<string name="ns_receive_therapy_events">Ricevi eventi terapia</string>
|
||||
<string name="ns_receive_therapy_events_summary">Accetta eventi terapia (cambio cannula, insulina, batteria, ecc.) inseriti tramite NS o NSClient</string>
|
||||
<string name="ns_receive_cgm">Ricevi/riempi dati CGM</string>
|
||||
<string name="ns_receive_cgm_summary">Accetta dati CGM da NS</string>
|
||||
<string name="sms_timeout_while_wating">Timeout nell\'attesa della fine della precedente comunicazione col micro.</string>
|
||||
<string name="smscommunicator_another_bolus_in_queue">C\'è un altro bolo in coda. Riprova più tardi.</string>
|
||||
</resources>
|
||||
|
|
|
@ -81,8 +81,6 @@
|
|||
<string name="careportal">פורטל טיפולים</string>
|
||||
<string name="configbuilder_pump">משאבה</string>
|
||||
<string name="configbuilder_pump_description">עם איזו משאבה אתם מעוניינים להשתמש ב-AndroidAPS?</string>
|
||||
<string name="configbuilder_treatments">טיפולים</string>
|
||||
<string name="configbuilder_treatments_description">איזה תוסף ישמש לתפעול הטיפולים?</string>
|
||||
<string name="configbuilder_profile">פרופיל</string>
|
||||
<string name="configbuilder_profile_description">באיזה פרופיל על AndroidAPS להשתמש?</string>
|
||||
<string name="configbuilder_aps">APS</string>
|
||||
|
@ -911,6 +909,8 @@
|
|||
<string name="ns_receive_temp_target_summary">קבלת ערכי מטרה זמניים שהוגדרו בנייטסקאוט או ב-NSClient</string>
|
||||
<string name="ns_receive_profile_switch">קבלת החלפות פרופיל</string>
|
||||
<string name="ns_receive_profile_switch_summary">קבלת החלפות פרופיל שהוגדרו בנייטסקאוט או ב-NSClient</string>
|
||||
<string name="ns_receive_offline_event">אחזר אירועים לא מקוונים</string>
|
||||
<string name="ns_receive_offline_event_summary">קבל אירועים לא מקוונים שנרשמו דרך נייטסקאוט או NSClient</string>
|
||||
<string name="ns_receive_insulin">קבלת אינסולין</string>
|
||||
<string name="ns_receive_insulin_summary">קבלת אינסולין שהוזן באמצעות נייטסקאוט או NSClient (הוא לא מוזרק, רק מחושב רק כאינסולין פעיל)</string>
|
||||
<string name="ns_receive_carbs">קבלת פחמימות</string>
|
||||
|
@ -919,4 +919,6 @@
|
|||
<string name="ns_receive_therapy_events_summary">קבלת אירועי טיפול (צינורית, אינסולין, החלפת סוללה) שצוינו באמצעות נייטסקאוט או NSClient</string>
|
||||
<string name="ns_receive_cgm">קבלת\\טעינת נתוני סנסור</string>
|
||||
<string name="ns_receive_cgm_summary">קבלת נתוני סנסור מנייטסקאוט</string>
|
||||
<string name="sms_timeout_while_wating">בהמתנה עד לסיום תקשורת קודמת עם המשאבה</string>
|
||||
<string name="smscommunicator_another_bolus_in_queue">ישנו בולוס נוסף בתור. נסו שוב מאוחר יותר.</string>
|
||||
</resources>
|
||||
|
|
|
@ -77,8 +77,6 @@
|
|||
<string name="careportal">케어포털</string>
|
||||
<string name="configbuilder_pump">펌프</string>
|
||||
<string name="configbuilder_pump_description">어떤 펌프를 AndroidAPS에서 사용하시겠습니까?</string>
|
||||
<string name="configbuilder_treatments">관리</string>
|
||||
<string name="configbuilder_treatments_description">관리를 위해서 어떤 플러그인을 사용합니까?</string>
|
||||
<string name="configbuilder_profile">프로파일</string>
|
||||
<string name="configbuilder_profile_description">어떤 프로파일을 AndroidAPS에서 사용합니까?</string>
|
||||
<string name="configbuilder_aps">APS</string>
|
||||
|
|
|
@ -80,8 +80,6 @@
|
|||
<string name="careportal">Priežiūra</string>
|
||||
<string name="configbuilder_pump">Pompa</string>
|
||||
<string name="configbuilder_pump_description">Kokią pompą naudosite su AndroidAPS?</string>
|
||||
<string name="configbuilder_treatments">Terapija</string>
|
||||
<string name="configbuilder_treatments_description">Kuris įskiepis bus naudojamas terapijos tvarkymui?</string>
|
||||
<string name="configbuilder_profile">Profilis</string>
|
||||
<string name="configbuilder_profile_description">Kurį profilį naudos AndroidAPS?</string>
|
||||
<string name="configbuilder_aps">DKS</string>
|
||||
|
|
|
@ -81,8 +81,6 @@
|
|||
<string name="careportal">Careportal</string>
|
||||
<string name="configbuilder_pump">Pomp</string>
|
||||
<string name="configbuilder_pump_description">Welke pomp wil je gaan gebruiken met AndroidAPS?</string>
|
||||
<string name="configbuilder_treatments">Behandelingen</string>
|
||||
<string name="configbuilder_treatments_description">Welke plugin moet worden gebruikt voor de Behandelingen?</string>
|
||||
<string name="configbuilder_profile">Profiel</string>
|
||||
<string name="configbuilder_profile_description">Welk profiel moet AndroidAPS gebruiken?</string>
|
||||
<string name="configbuilder_aps">APS</string>
|
||||
|
|
|
@ -81,8 +81,6 @@
|
|||
<string name="careportal">Careportal</string>
|
||||
<string name="configbuilder_pump">Pumpe</string>
|
||||
<string name="configbuilder_pump_description">Hvilken pumpe ønsker du å bruke sammen med AndroidAPS?</string>
|
||||
<string name="configbuilder_treatments">Behandlinger</string>
|
||||
<string name="configbuilder_treatments_description">Hvilken plugin burde brukes til håndtering av behandlinger?</string>
|
||||
<string name="configbuilder_profile">Profil</string>
|
||||
<string name="configbuilder_profile_description">Hvilken profil bør AndroidAPS bruke?</string>
|
||||
<string name="configbuilder_aps">APS</string>
|
||||
|
@ -778,6 +776,7 @@
|
|||
<string name="randombg_short">BS</string>
|
||||
<string name="tools">Verktøy</string>
|
||||
<string name="show_calculation">Vis beregning</string>
|
||||
<string name="show_removed">Vis slettede</string>
|
||||
<string name="clearqueueconfirm">Slett køen? All data i køen vil gå tapt!</string>
|
||||
<string name="ebstopsloop">Bruk av forlenget bolus funksjon vil deaktivere lukket loop i perioden med forlenget bolus. Vil du virkelig dette?</string>
|
||||
<string name="closed_loop_disabled_with_eb">Lukket loop deaktivert på grunn av forlenget bolus</string>
|
||||
|
@ -899,4 +898,25 @@
|
|||
<string name="profile_max_daily_basal_value">Profil maksimal basal dose</string>
|
||||
<string name="current_basal_value">Aktiv basal dose</string>
|
||||
<string name="profile_carbs_ratio_value">Profil karbohydratfaktor (IK)</string>
|
||||
<string name="full_sync">Full synkronisering</string>
|
||||
<string name="prime">Prime</string>
|
||||
<string name="ns_sync_options">Synkronisering</string>
|
||||
<string name="ns_upload_summary">Profiler, boluser, karbohydrater, midlertidige basaler lastes opp til NS</string>
|
||||
<string name="ns_upload">Last opp data til NS</string>
|
||||
<string name="ns_receive_profile_store">Hent lagrede profiler</string>
|
||||
<string name="ns_receive_profile_store_summary">Synkroniser profiler fra NS til lokal profil</string>
|
||||
<string name="ns_receive_temp_target">Motta midlertidige BS mål</string>
|
||||
<string name="ns_receive_temp_target_summary">Aksepter midlertidige mål angitt med NS eller NSClient</string>
|
||||
<string name="ns_receive_profile_switch">Motta profilbytter</string>
|
||||
<string name="ns_receive_profile_switch_summary">Aksepter profilbytter som er angitt via NS eller NSClient</string>
|
||||
<string name="ns_receive_offline_event">Motta APS offline hendelser</string>
|
||||
<string name="ns_receive_offline_event_summary">Aksepter APS offline hendelser lagt inn gjennom NS eller NSKlient</string>
|
||||
<string name="ns_receive_insulin">Motta insulin</string>
|
||||
<string name="ns_receive_insulin_summary">Aksepter insulin angitt via NS eller NSClient (enhetene er ikke dosert, kun beregnet mot IOB)</string>
|
||||
<string name="ns_receive_carbs">Motta karbohydrater</string>
|
||||
<string name="ns_receive_carbs_summary">Aksepter karbohydrater angitt med NS eller NSClient</string>
|
||||
<string name="ns_receive_therapy_events">Motta behandlingshendelser</string>
|
||||
<string name="ns_receive_therapy_events_summary">Godta behandlingshendelser (kanyle, insulin, batteribytte osv.) som er lagt inn gjennom NS eller NSClient</string>
|
||||
<string name="ns_receive_cgm">Motta/tilbakefyll CGM data</string>
|
||||
<string name="ns_receive_cgm_summary">Aksepter CGM data fra NS</string>
|
||||
</resources>
|
||||
|
|
|
@ -81,8 +81,6 @@
|
|||
<string name="careportal">PortalOpieki</string>
|
||||
<string name="configbuilder_pump">Pompa</string>
|
||||
<string name="configbuilder_pump_description">Którą pompę chcesz wykorzystać do AndroidAPS?</string>
|
||||
<string name="configbuilder_treatments">Terapia</string>
|
||||
<string name="configbuilder_treatments_description">Która wtyczka powinna być używana do obsługi leczenia?</string>
|
||||
<string name="configbuilder_profile">Profil</string>
|
||||
<string name="configbuilder_profile_description">Który profil będzie używany w AndroidAPS?</string>
|
||||
<string name="configbuilder_aps">APS</string>
|
||||
|
|
|
@ -78,8 +78,6 @@
|
|||
<string name="careportal">Careportal</string>
|
||||
<string name="configbuilder_pump">Bomba</string>
|
||||
<string name="configbuilder_pump_description">Qual a bomba que gostaria de usar com AndroidAPS?</string>
|
||||
<string name="configbuilder_treatments">Tratamentos</string>
|
||||
<string name="configbuilder_treatments_description">Qual o plugin que deve ser usado para os tratamentos?</string>
|
||||
<string name="configbuilder_profile">Perfil</string>
|
||||
<string name="configbuilder_profile_description">Qual perfil o AndroidAPS deve usar?</string>
|
||||
<string name="configbuilder_aps">APS</string>
|
||||
|
|
|
@ -81,8 +81,6 @@
|
|||
<string name="careportal">Careportal</string>
|
||||
<string name="configbuilder_pump">Bomba</string>
|
||||
<string name="configbuilder_pump_description">Qual a bomba que gostaria de utilizar com AndroidAPS?</string>
|
||||
<string name="configbuilder_treatments">Tratamentos</string>
|
||||
<string name="configbuilder_treatments_description">Qual o plugin que deve ser usado para os tratamentos?</string>
|
||||
<string name="configbuilder_profile">Perfil</string>
|
||||
<string name="configbuilder_profile_description">Que perfil deverá ser usado pelo AndroidAPS?</string>
|
||||
<string name="configbuilder_aps">APS</string>
|
||||
|
|
|
@ -81,8 +81,6 @@
|
|||
<string name="careportal">Careportal</string>
|
||||
<string name="configbuilder_pump">Pompă</string>
|
||||
<string name="configbuilder_pump_description">Ce pompă doriți să folosiți cu AndroidAPS?</string>
|
||||
<string name="configbuilder_treatments">Tratamente</string>
|
||||
<string name="configbuilder_treatments_description">Ce plugin doriți să folosiți pentru gestionarea tratamentelor?</string>
|
||||
<string name="configbuilder_profile">Profil</string>
|
||||
<string name="configbuilder_profile_description">Ce profil doriți să folosească AndroidAPS?</string>
|
||||
<string name="configbuilder_aps">APS</string>
|
||||
|
|
|
@ -81,8 +81,6 @@
|
|||
<string name="careportal">Портал лечения / назначений</string>
|
||||
<string name="configbuilder_pump">помпа</string>
|
||||
<string name="configbuilder_pump_description">Какой помпой вы хотели бы пользоваться с AndroidAPS?</string>
|
||||
<string name="configbuilder_treatments">назначения</string>
|
||||
<string name="configbuilder_treatments_description">Каким плагином пользоваться для выполнения назначений?</string>
|
||||
<string name="configbuilder_profile">профиль</string>
|
||||
<string name="configbuilder_profile_description">Какой профиль следует использовать в AndroidAPS?</string>
|
||||
<string name="configbuilder_aps">система ИПЖ</string>
|
||||
|
@ -921,4 +919,6 @@ Context | Edit Context</string>
|
|||
<string name="ns_receive_therapy_events_summary">Принимать события терапии (катетер, инсулин, изменение батареи и т. д.) через NS или NSClient</string>
|
||||
<string name="ns_receive_cgm">Получать/заполнять данные мониторинга CGM</string>
|
||||
<string name="ns_receive_cgm_summary">Принимать данные мониторинга CGM из NS</string>
|
||||
<string name="sms_timeout_while_wating">Таймаут во время ожидания окончания предыдущего соединения с помпой</string>
|
||||
<string name="smscommunicator_another_bolus_in_queue">В очереди есть еще один болюс. Повторите попытку позже.</string>
|
||||
</resources>
|
||||
|
|
|
@ -81,8 +81,6 @@
|
|||
<string name="careportal">Starostlivosť</string>
|
||||
<string name="configbuilder_pump">Pumpa</string>
|
||||
<string name="configbuilder_pump_description">Akú pumpu chcete používať s AndroidAPS?</string>
|
||||
<string name="configbuilder_treatments">Ošetrenia</string>
|
||||
<string name="configbuilder_treatments_description">Aký modul chcete používať pre spracovanie ošetrení?</string>
|
||||
<string name="configbuilder_profile">Profil</string>
|
||||
<string name="configbuilder_profile_description">Aký profil má používať AndroidAPS?</string>
|
||||
<string name="configbuilder_aps">APS</string>
|
||||
|
@ -911,6 +909,8 @@
|
|||
<string name="ns_receive_temp_target_summary">Prijať dočasné ciele zadané prostredníctvom NS, alebo NSClienta</string>
|
||||
<string name="ns_receive_profile_switch">Prijímať prepnutia profilov</string>
|
||||
<string name="ns_receive_profile_switch_summary">Prijať prepnutia profilov zadané prostredníctvom NS, alebo NSClienta</string>
|
||||
<string name="ns_receive_offline_event">Prijímať udalosti APS offline</string>
|
||||
<string name="ns_receive_offline_event_summary">Prijať APS offline udalosti zadané prostredníctvom NS, alebo NSClienta</string>
|
||||
<string name="ns_receive_insulin">Prijímať inzulín</string>
|
||||
<string name="ns_receive_insulin_summary">Prijať inzulín vložený cez NS, alebo NSClient (nie je dodaný, iba započítaný do IOB)</string>
|
||||
<string name="ns_receive_carbs">Prijímať sacharidy</string>
|
||||
|
|
|
@ -82,8 +82,6 @@ Eversense-appen.</string>
|
|||
<string name="careportal">Careportal</string>
|
||||
<string name="configbuilder_pump">Pump</string>
|
||||
<string name="configbuilder_pump_description">Vilken pump vill du använda med AndroidAPS?</string>
|
||||
<string name="configbuilder_treatments">Behandlingar</string>
|
||||
<string name="configbuilder_treatments_description">Vilket insticksprogram ska användas för att hantera behandlingar?</string>
|
||||
<string name="configbuilder_profile">Profil</string>
|
||||
<string name="configbuilder_profile_description">Vilken profil ska AndroidAPS använda?</string>
|
||||
<string name="configbuilder_aps">APS</string>
|
||||
|
|
|
@ -73,8 +73,6 @@
|
|||
<string name="careportal">Careportal</string>
|
||||
<string name="configbuilder_pump">Pompa</string>
|
||||
<string name="configbuilder_pump_description">Hangi pompa ile AndroidAPS kullanmak istersiniz?</string>
|
||||
<string name="configbuilder_treatments">Tedaviler</string>
|
||||
<string name="configbuilder_treatments_description">Hangi eklenti tedavi işleme için kullanılsın?</string>
|
||||
<string name="configbuilder_profile">Profil</string>
|
||||
<string name="configbuilder_profile_description">Hangi profili AndroidAPS kullanmalı?</string>
|
||||
<string name="configbuilder_aps">APS (YPS)</string>
|
||||
|
|
|
@ -74,8 +74,6 @@
|
|||
<string name="careportal">护理记录</string>
|
||||
<string name="configbuilder_pump">胰岛素泵</string>
|
||||
<string name="configbuilder_pump_description">你想用 AndroidAPS连接哪个胰岛素泵?</string>
|
||||
<string name="configbuilder_treatments">治疗</string>
|
||||
<string name="configbuilder_treatments_description">什么插件应该用于治疗处理?</string>
|
||||
<string name="configbuilder_profile">配置文件</string>
|
||||
<string name="configbuilder_profile_description">AndroidAPS 应该使用哪个配置文件?</string>
|
||||
<string name="configbuilder_aps">APS</string>
|
||||
|
|
|
@ -135,8 +135,6 @@
|
|||
|
||||
<string name="configbuilder_pump">Pump</string>
|
||||
<string name="configbuilder_pump_description">Which pump would you like to use with AndroidAPS?</string>
|
||||
<string name="configbuilder_treatments">Treatments</string>
|
||||
<string name="configbuilder_treatments_description">Which plugin should be used for treatment handling?</string>
|
||||
<string name="configbuilder_profile">Profile</string>
|
||||
<string name="configbuilder_profile_description">Which profile should AndroidAPS use?</string>
|
||||
<string name="configbuilder_aps">APS</string>
|
||||
|
@ -1155,5 +1153,7 @@
|
|||
<string name="key_ns_receive_cgm" translatable="false">ns_receive_cgm</string>
|
||||
<string name="ns_receive_cgm">Receive/backfill CGM data</string>
|
||||
<string name="ns_receive_cgm_summary">Accept CGM data from NS</string>
|
||||
<string name="sms_timeout_while_wating">Timeout while waiting for finish of previous pump communication</string>
|
||||
<string name="smscommunicator_another_bolus_in_queue">There is another bolus in queue. Try again later.</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -1,4 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<paths>
|
||||
<external-files-path name="exports" path="exports/" />
|
||||
<external-path
|
||||
name="external"
|
||||
path="." />
|
||||
<external-files-path
|
||||
name="external_files"
|
||||
path="." />
|
||||
<cache-path
|
||||
name="cache"
|
||||
path="." />
|
||||
<external-cache-path
|
||||
name="external_cache"
|
||||
path="." />
|
||||
<files-path
|
||||
name="files"
|
||||
path="." />
|
||||
</paths>
|
|
@ -23,7 +23,6 @@ open class TestBaseWithProfile : TestBase() {
|
|||
|
||||
@Mock lateinit var activePluginProvider: ActivePlugin
|
||||
@Mock lateinit var resourceHelper: ResourceHelper
|
||||
@Mock lateinit var treatmentsInterface: TreatmentsInterface
|
||||
@Mock lateinit var iobCobCalculator: IobCobCalculator
|
||||
@Mock lateinit var fabricPrivacy: FabricPrivacy
|
||||
@Mock lateinit var profileFunction: ProfileFunction
|
||||
|
|
|
@ -20,6 +20,7 @@ import info.nightscout.androidaps.plugins.constraints.objectives.ObjectivesPlugi
|
|||
import info.nightscout.androidaps.plugins.constraints.objectives.objectives.Objective
|
||||
import info.nightscout.androidaps.plugins.constraints.safety.SafetyPlugin
|
||||
import info.nightscout.androidaps.plugins.general.maintenance.LoggerUtils
|
||||
import info.nightscout.androidaps.plugins.general.maintenance.PrefFileListProvider
|
||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider
|
||||
import info.nightscout.androidaps.plugins.pump.combo.ComboPlugin
|
||||
import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage
|
||||
|
@ -51,7 +52,7 @@ import java.util.*
|
|||
ConstraintChecker::class, SP::class, Context::class,
|
||||
OpenAPSAMAPlugin::class, OpenAPSSMBPlugin::class,
|
||||
VirtualPumpPlugin::class, DetailedBolusInfoStorage::class, TemporaryBasalStorage::class, GlimpPlugin::class, Profiler::class,
|
||||
UserEntryLogger::class, LoggerUtils::class, AppRepository::class, InsightDatabaseDao::class)
|
||||
UserEntryLogger::class, PrefFileListProvider::class, AppRepository::class, InsightDatabaseDao::class)
|
||||
class ConstraintsCheckerTest : TestBaseWithProfile() {
|
||||
|
||||
@Mock lateinit var activePlugin: ActivePlugin
|
||||
|
@ -64,7 +65,7 @@ class ConstraintsCheckerTest : TestBaseWithProfile() {
|
|||
@Mock lateinit var sensitivityOref1Plugin: SensitivityOref1Plugin
|
||||
@Mock lateinit var profiler: Profiler
|
||||
@Mock lateinit var uel: UserEntryLogger
|
||||
@Mock lateinit var loggerUtils: LoggerUtils
|
||||
@Mock lateinit var fileListProvider: PrefFileListProvider
|
||||
@Mock lateinit var repository: AppRepository
|
||||
@Mock lateinit var pumpSync: PumpSync
|
||||
@Mock lateinit var insightDatabaseDao: InsightDatabaseDao
|
||||
|
@ -145,7 +146,7 @@ class ConstraintsCheckerTest : TestBaseWithProfile() {
|
|||
insightPlugin = LocalInsightPlugin(injector, aapsLogger, rxBus, resourceHelper, sp, commandQueue, profileFunction, context, ConfigImpl(), dateUtil, insightDbHelper, pumpSync)
|
||||
openAPSSMBPlugin = OpenAPSSMBPlugin(injector, aapsLogger, rxBus, constraintChecker, resourceHelper, profileFunction, context, activePlugin, iobCobCalculator, hardLimits, profiler, sp, dateUtil, repository, glucoseStatusProvider)
|
||||
openAPSAMAPlugin = OpenAPSAMAPlugin(injector, aapsLogger, rxBus, constraintChecker, resourceHelper, profileFunction, context, activePlugin, iobCobCalculator, hardLimits, profiler, fabricPrivacy, dateUtil, repository, glucoseStatusProvider)
|
||||
safetyPlugin = SafetyPlugin(injector, aapsLogger, resourceHelper, sp, rxBus, constraintChecker, openAPSAMAPlugin, openAPSSMBPlugin, sensitivityOref1Plugin, activePlugin, hardLimits, BuildHelper(ConfigImpl(), loggerUtils), iobCobCalculator, ConfigImpl(), dateUtil)
|
||||
safetyPlugin = SafetyPlugin(injector, aapsLogger, resourceHelper, sp, rxBus, constraintChecker, openAPSAMAPlugin, openAPSSMBPlugin, sensitivityOref1Plugin, activePlugin, hardLimits, BuildHelper(ConfigImpl(), fileListProvider), iobCobCalculator, ConfigImpl(), dateUtil)
|
||||
val constraintsPluginsList = ArrayList<PluginBase>()
|
||||
constraintsPluginsList.add(safetyPlugin)
|
||||
constraintsPluginsList.add(objectivesPlugin)
|
||||
|
|
|
@ -19,7 +19,7 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
import java.io.File
|
||||
|
||||
@RunWith(PowerMockRunner::class)
|
||||
@PrepareForTest(NSSettingsStatus::class, BuildHelper::class, LoggerUtils::class)
|
||||
@PrepareForTest(NSSettingsStatus::class, BuildHelper::class, LoggerUtils::class, PrefFileListProvider::class)
|
||||
class MaintenancePluginTest : TestBase() {
|
||||
|
||||
@Mock lateinit var injector: HasAndroidInjector
|
||||
|
@ -29,14 +29,16 @@ class MaintenancePluginTest : TestBase() {
|
|||
@Mock lateinit var nsSettingsStatus: NSSettingsStatus
|
||||
@Mock lateinit var buildHelper: BuildHelper
|
||||
@Mock lateinit var loggerUtils: LoggerUtils
|
||||
@Mock lateinit var fileListProvider: PrefFileListProvider
|
||||
|
||||
lateinit var sut: MaintenancePlugin
|
||||
|
||||
@Before
|
||||
fun mock() {
|
||||
sut = MaintenancePlugin(injector, context, resourceHelper, sp, nsSettingsStatus, aapsLogger, buildHelper, ConfigImpl(), loggerUtils)
|
||||
sut = MaintenancePlugin(injector, context, resourceHelper, sp, nsSettingsStatus, aapsLogger, buildHelper, ConfigImpl(), fileListProvider, loggerUtils)
|
||||
`when`(loggerUtils.suffix).thenReturn(".log.zip")
|
||||
`when`(loggerUtils.logDirectory).thenReturn("src/test/res/logger")
|
||||
`when`(fileListProvider.ensureTempDirExists()).thenReturn(File("src/test/res/logger"))
|
||||
}
|
||||
|
||||
@Test fun logFilesTest() {
|
||||
|
|
|
@ -56,7 +56,7 @@ class AuthRequestTest : TestBase() {
|
|||
|
||||
@Test fun doTests() {
|
||||
val requester = Sms("aNumber", "aText")
|
||||
val action: SmsAction = object : SmsAction() {
|
||||
val action: SmsAction = object : SmsAction(false) {
|
||||
override fun run() {
|
||||
actionCalled = true
|
||||
}
|
||||
|
|
|
@ -10,14 +10,14 @@ class SmsActionTest {
|
|||
|
||||
var result = ""
|
||||
@Test fun doTests() {
|
||||
var smsAction: SmsAction = object : SmsAction() {
|
||||
var smsAction: SmsAction = object : SmsAction(false) {
|
||||
override fun run() {
|
||||
result = "A"
|
||||
}
|
||||
}
|
||||
smsAction.run()
|
||||
Assert.assertEquals(result, "A")
|
||||
smsAction = object : SmsAction(1.0) {
|
||||
smsAction = object : SmsAction(false, 1.0) {
|
||||
override fun run() {
|
||||
result = "B"
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ class SmsActionTest {
|
|||
smsAction.run()
|
||||
Assert.assertEquals(result, "B")
|
||||
Assert.assertEquals(smsAction.aDouble(), 1.0, 0.000001)
|
||||
smsAction = object : SmsAction(1.0, 2) {
|
||||
smsAction = object : SmsAction(false, 1.0, 2) {
|
||||
override fun run() {
|
||||
result = "C"
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ class SmsActionTest {
|
|||
Assert.assertEquals(result, "C")
|
||||
Assert.assertEquals(smsAction.aDouble(), 1.0, 0.000001)
|
||||
Assert.assertEquals(smsAction.secondInteger().toLong(), 2)
|
||||
smsAction = object : SmsAction("aString", 3) {
|
||||
smsAction = object : SmsAction(false, "aString", 3) {
|
||||
override fun run() {
|
||||
result = "D"
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ class SmsActionTest {
|
|||
Assert.assertEquals(result, "D")
|
||||
Assert.assertEquals(smsAction.aString(), "aString")
|
||||
Assert.assertEquals(smsAction.secondInteger().toLong(), 3)
|
||||
smsAction = object : SmsAction(4) {
|
||||
smsAction = object : SmsAction(false, 4) {
|
||||
override fun run() {
|
||||
result = "E"
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ class SmsActionTest {
|
|||
smsAction.run()
|
||||
Assert.assertEquals(result, "E")
|
||||
Assert.assertEquals(smsAction.anInteger().toLong(), 4)
|
||||
smsAction = object : SmsAction(5, 6) {
|
||||
smsAction = object : SmsAction(false, 5, 6) {
|
||||
override fun run() {
|
||||
result = "F"
|
||||
}
|
||||
|
|
|
@ -86,6 +86,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() {
|
|||
it.resourceHelper = resourceHelper
|
||||
it.otp = otp
|
||||
it.dateUtil = dateUtil
|
||||
it.commandQueue = commandQueue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -262,7 +263,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() {
|
|||
Assert.assertTrue(smsCommunicatorPlugin.isCommand("BOLUS", ""))
|
||||
smsCommunicatorPlugin.messageToConfirm = null
|
||||
Assert.assertFalse(smsCommunicatorPlugin.isCommand("BLB", ""))
|
||||
smsCommunicatorPlugin.messageToConfirm = AuthRequest(injector, Sms("1234", "ddd"), "RequestText", "ccode", object : SmsAction() {
|
||||
smsCommunicatorPlugin.messageToConfirm = AuthRequest(injector, Sms("1234", "ddd"), "RequestText", "ccode", object : SmsAction(false) {
|
||||
override fun run() {}
|
||||
})
|
||||
Assert.assertTrue(smsCommunicatorPlugin.isCommand("BLB", "1234"))
|
||||
|
|
|
@ -4,9 +4,6 @@ import dagger.android.AndroidInjector
|
|||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.TestBaseWithProfile
|
||||
import info.nightscout.androidaps.database.AppRepository
|
||||
import info.nightscout.androidaps.db.TemporaryBasal
|
||||
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||
import org.junit.Test
|
||||
|
@ -17,23 +14,14 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
|
||||
@Suppress("SpellCheckingInspection")
|
||||
@RunWith(PowerMockRunner::class)
|
||||
@PrepareForTest(FabricPrivacy::class, DatabaseHelperInterface::class, AppRepository::class)
|
||||
@PrepareForTest(FabricPrivacy::class, AppRepository::class)
|
||||
class TreatmentsPluginTest : TestBaseWithProfile() {
|
||||
|
||||
@Mock lateinit var sp: SP
|
||||
@Mock lateinit var treatmentService: TreatmentService
|
||||
@Mock lateinit var repository: AppRepository
|
||||
@Mock lateinit var databaseHelper: DatabaseHelperInterface
|
||||
|
||||
val injector = HasAndroidInjector {
|
||||
AndroidInjector {
|
||||
if (it is TemporaryBasal) {
|
||||
it.aapsLogger = aapsLogger
|
||||
it.activePlugin = activePluginProvider
|
||||
it.profileFunction = profileFunction
|
||||
it.sp = sp
|
||||
it.dateUtil = DateUtil(context)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ import info.nightscout.androidaps.interfaces.PumpSync
|
|||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||
import info.nightscout.androidaps.plugins.general.maintenance.LoggerUtils
|
||||
import info.nightscout.androidaps.plugins.general.maintenance.PrefFileListProvider
|
||||
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin
|
||||
import info.nightscout.androidaps.queue.commands.*
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
|
@ -44,16 +44,16 @@ import java.util.*
|
|||
@RunWith(PowerMockRunner::class)
|
||||
@PrepareForTest(
|
||||
ConstraintChecker::class, VirtualPumpPlugin::class, ToastUtils::class, Context::class,
|
||||
FabricPrivacy::class, LoggerUtils::class, PowerManager::class,
|
||||
FabricPrivacy::class, PrefFileListProvider::class, PowerManager::class,
|
||||
AppRepository::class)
|
||||
class CommandQueueTest : TestBaseWithProfile() {
|
||||
|
||||
@Mock lateinit var constraintChecker: ConstraintChecker
|
||||
@Mock lateinit var activePlugin: ActivePlugin
|
||||
@Mock lateinit var sp: SP
|
||||
@Mock lateinit var loggerUtils: LoggerUtils
|
||||
@Mock lateinit var powerManager: PowerManager
|
||||
@Mock lateinit var repository: AppRepository
|
||||
@Mock lateinit var fileListProvider: PrefFileListProvider
|
||||
|
||||
class CommandQueueMocked(
|
||||
injector: HasAndroidInjector,
|
||||
|
@ -106,7 +106,7 @@ class CommandQueueTest : TestBaseWithProfile() {
|
|||
|
||||
@Before
|
||||
fun prepare() {
|
||||
commandQueue = CommandQueueMocked(injector, aapsLogger, rxBus, aapsSchedulers, resourceHelper, constraintChecker, profileFunction, activePlugin, context, sp, BuildHelper(ConfigImpl(), loggerUtils), dateUtil, repository, fabricPrivacy)
|
||||
commandQueue = CommandQueueMocked(injector, aapsLogger, rxBus, aapsSchedulers, resourceHelper, constraintChecker, profileFunction, activePlugin, context, sp, BuildHelper(ConfigImpl(), fileListProvider), dateUtil, repository, fabricPrivacy)
|
||||
testPumpPlugin = TestPumpPlugin(injector)
|
||||
|
||||
testPumpPlugin.pumpDescription.basalMinimumRate = 0.1
|
||||
|
@ -137,7 +137,7 @@ class CommandQueueTest : TestBaseWithProfile() {
|
|||
|
||||
@Test
|
||||
fun commandIsPickedUp() {
|
||||
val commandQueue = CommandQueue(injector, aapsLogger, rxBus, aapsSchedulers, resourceHelper, constraintChecker, profileFunction, activePlugin, context, sp, BuildHelper(ConfigImpl(), loggerUtils), dateUtil, repository, fabricPrivacy)
|
||||
val commandQueue = CommandQueue(injector, aapsLogger, rxBus, aapsSchedulers, resourceHelper, constraintChecker, profileFunction, activePlugin, context, sp, BuildHelper(ConfigImpl(), fileListProvider), dateUtil, repository, fabricPrivacy)
|
||||
// start with empty queue
|
||||
Assert.assertEquals(0, commandQueue.size())
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ import info.nightscout.androidaps.interfaces.PumpDescription
|
|||
import info.nightscout.androidaps.interfaces.PumpSync
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||
import info.nightscout.androidaps.plugins.general.maintenance.LoggerUtils
|
||||
import info.nightscout.androidaps.plugins.general.maintenance.PrefFileListProvider
|
||||
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin
|
||||
import info.nightscout.androidaps.queue.commands.Command
|
||||
import info.nightscout.androidaps.queue.commands.CommandTempBasalAbsolute
|
||||
|
@ -33,13 +34,13 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
@RunWith(PowerMockRunner::class)
|
||||
@PrepareForTest(
|
||||
ConstraintChecker::class, VirtualPumpPlugin::class, ToastUtils::class, Context::class,
|
||||
FabricPrivacy::class, LoggerUtils::class, PowerManager::class)
|
||||
FabricPrivacy::class, PrefFileListProvider::class, PowerManager::class)
|
||||
class QueueThreadTest : TestBaseWithProfile() {
|
||||
|
||||
@Mock lateinit var constraintChecker: ConstraintChecker
|
||||
@Mock lateinit var activePlugin: ActivePlugin
|
||||
@Mock lateinit var sp: SP
|
||||
@Mock lateinit var loggerUtils: LoggerUtils
|
||||
@Mock lateinit var fileListProvider: PrefFileListProvider
|
||||
@Mock lateinit var powerManager: PowerManager
|
||||
@Mock lateinit var repository: AppRepository
|
||||
|
||||
|
@ -62,7 +63,7 @@ class QueueThreadTest : TestBaseWithProfile() {
|
|||
@Before
|
||||
fun prepare() {
|
||||
pumpPlugin = TestPumpPlugin(injector)
|
||||
commandQueue = CommandQueue(injector, aapsLogger, rxBus, aapsSchedulers, resourceHelper, constraintChecker, profileFunction, activePlugin, context, sp, BuildHelper(ConfigImpl(), loggerUtils), dateUtil, repository, fabricPrivacy)
|
||||
commandQueue = CommandQueue(injector, aapsLogger, rxBus, aapsSchedulers, resourceHelper, constraintChecker, profileFunction, activePlugin, context, sp, BuildHelper(ConfigImpl(), fileListProvider), dateUtil, repository, fabricPrivacy)
|
||||
|
||||
val pumpDescription = PumpDescription()
|
||||
pumpDescription.basalMinimumRate = 0.1
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue