Merge pull request #57 from 0pen-dash/avereha/merge

avereha/merge
This commit is contained in:
Andrei Vereha 2021-07-11 12:38:37 +02:00 committed by GitHub
commit 21a36b4864
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
576 changed files with 20660 additions and 6193 deletions

View file

@ -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" />
@ -143,6 +144,7 @@
</codeStyleSettings>
<codeStyleSettings language="kotlin">
<option name="RIGHT_MARGIN" value="120" />
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
<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" />

View file

@ -6,15 +6,7 @@ apply plugin: 'com.hiya.jacoco-android'
apply plugin: 'com.google.firebase.crashlytics'
apply from: "${project.rootDir}/gradle/android_dependencies.gradle"
jacoco {
toolVersion = "0.8.6"
}
tasks.withType(Test) {
jacoco.includeNoLocationClasses = true
jacoco.excludes = ['jdk.internal.*']
}
apply from: "${project.rootDir}/gradle/jacoco_global.gradle"
repositories {
mavenCentral()
@ -111,7 +103,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 +184,7 @@ dependencies {
implementation project(':omnipod-common')
implementation project(':omnipod-eros')
implementation project(':omnipod-dash')
implementation project(':diaconn')
implementation fileTree(include: ['*.jar'], dir: 'libs')

View file

@ -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" />
@ -115,11 +117,11 @@
</intent-filter>
</receiver>
<!-- Receiver keepalive, scheduled every 30 min -->
<!-- Receiver keep alive, scheduled every 30 min -->
<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

View file

@ -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">

View file

@ -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
}
}

View file

@ -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)

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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;
}
}

View file

@ -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);
}
}

View file

@ -1,2 +0,0 @@
package info.nightscout.androidaps.db

View file

@ -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> {

View file

@ -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
}
}

View file

@ -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
}

View file

@ -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
@ -42,13 +42,11 @@ import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin
import info.nightscout.androidaps.plugins.pump.mdi.MDIPlugin
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicPumpPlugin
import info.nightscout.androidaps.plugins.pump.omnipod.dash.OmnipodDashPumpPlugin
import info.nightscout.androidaps.plugins.pump.omnipod.eros.OmnipodErosPumpPlugin
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin
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,17 +148,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(155)
abstract fun bindOmnipodErosPumpPlugin(plugin: OmnipodErosPumpPlugin): PluginBase
@IntKey(150)
abstract fun bindMedtronicPumpPlugin(plugin: MedtronicPumpPlugin): PluginBase
@Binds
@PumpDriver
@ -168,6 +160,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 +208,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

View file

@ -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)
}
}
})

View file

@ -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)
}
}
})

View file

@ -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 -> {
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"))
profileFunction.getProfile()?.let { profile ->
uel.log(Action.DISCONNECT, Sources.LoopDialog, ValueWithUnit.Minute(15))
loopPlugin.goToZeroTemp(T.mins(15).mins().toInt(), profile, OfflineEvent.Reason.DISCONNECT_PUMP)
rxBus.send(EventRefreshOverview("suspend_menu"))
}
return true
}
R.id.overview_disconnect_30m -> {
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"))
profileFunction.getProfile()?.let { profile ->
uel.log(Action.DISCONNECT, Sources.LoopDialog, ValueWithUnit.Minute(30))
loopPlugin.goToZeroTemp(T.mins(30).mins().toInt(), profile, OfflineEvent.Reason.DISCONNECT_PUMP)
rxBus.send(EventRefreshOverview("suspend_menu"))
}
return true
}
R.id.overview_disconnect_1h -> {
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"))
profileFunction.getProfile()?.let { profile ->
uel.log(Action.DISCONNECT, Sources.LoopDialog, ValueWithUnit.Hour(1))
loopPlugin.goToZeroTemp(T.hours(1).mins().toInt(), profile, OfflineEvent.Reason.DISCONNECT_PUMP)
rxBus.send(EventRefreshOverview("suspend_menu"))
}
return true
}
R.id.overview_disconnect_2h -> {
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"))
profileFunction.getProfile()?.let { profile ->
uel.log(Action.DISCONNECT, Sources.LoopDialog, ValueWithUnit.Hour(2))
loopPlugin.goToZeroTemp(T.hours(2).mins().toInt(), profile, OfflineEvent.Reason.DISCONNECT_PUMP)
rxBus.send(EventRefreshOverview("suspend_menu"))
}
return true
}
R.id.overview_disconnect_3h -> {
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"))
profileFunction.getProfile()?.let { profile ->
uel.log(Action.DISCONNECT, Sources.LoopDialog, ValueWithUnit.Hour(3))
loopPlugin.goToZeroTemp(T.hours(3).mins().toInt(), profile, OfflineEvent.Reason.DISCONNECT_PUMP)
rxBus.send(EventRefreshOverview("suspend_menu"))
}
return true
}
}

View file

@ -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)
}
}
}

View file

@ -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)
}
}
})

View file

@ -0,0 +1,3 @@
package info.nightscout.androidaps.events
class EventTreatmentUpdateGui : EventUpdateGui()

View file

@ -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

View file

@ -166,11 +166,13 @@ open class LoopPlugin @Inject constructor(
}
override val isSuspended: Boolean
get() = repository.getOfflineEventActiveAt(dateUtil.now()).blockingGet() is ValueWrapper.Existing
get() = repository.getOfflineEventActiveAt(dateUtil.now()).blockingGet() is ValueWrapper.Existing
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)
}
}
})

View file

@ -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)

View file

@ -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 "") +
@ -135,7 +134,12 @@ class ConfigBuilderPlugin @Inject constructor(
// Ask when switching to physical pump plugin
fun switchAllowed(changedPlugin: PluginBase, newState: Boolean, activity: FragmentActivity?, type: PluginType) {
if (changedPlugin.getType() == PluginType.PUMP && changedPlugin.name != resourceHelper.gs(R.string.virtualpump)) confirmPumpPluginActivation(changedPlugin, newState, activity, type) else performPluginSwitch(changedPlugin, newState, type)
if (changedPlugin.getType() == PluginType.PUMP && changedPlugin.name != resourceHelper.gs(R.string.virtualpump))
confirmPumpPluginActivation(changedPlugin, newState, activity, type)
else if (changedPlugin.getType() == PluginType.PUMP) {
performPluginSwitch(changedPlugin, newState, type)
pumpSync.connectNewPump()
} else performPluginSwitch(changedPlugin, newState, type)
}
private fun confirmPumpPluginActivation(changedPlugin: PluginBase, newState: Boolean, activity: FragmentActivity?, type: PluginType) {
@ -185,7 +189,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 -> {

View file

@ -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

View file

@ -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)
@ -116,9 +117,27 @@ class ProfileFunctionImplementation @Inject constructor(
}
override fun createProfileSwitch(durationInMinutes: Int, percentage: Int, timeShiftInHours: Int) {
val profileStore = activePlugin.activeProfileSource.profile ?: return
val profileName = activePlugin.activeProfileSource.profile?.getDefaultProfileName()
?: return
createProfileSwitch(profileStore, profileName, durationInMinutes, percentage, timeShiftInHours, dateUtil.now())
val profile = repository.getPermanentProfileSwitch(dateUtil.now())
?: throw InvalidParameterSpecException("No active ProfileSwitch")
val ps = ProfileSwitch(
timestamp = dateUtil.now(),
basalBlocks = profile.basalBlocks,
isfBlocks = profile.isfBlocks,
icBlocks = profile.icBlocks,
targetBlocks = profile.targetBlocks,
glucoseUnit = profile.glucoseUnit,
profileName = profile.profileName,
timeshift = T.hours(timeShiftInHours.toLong()).msecs(),
percentage = percentage,
duration = T.mins(durationInMinutes.toLong()).msecs(),
insulinConfiguration = activePlugin.activeInsulin.insulinConfiguration
)
disposable += repository.runTransactionForResult(InsertOrUpdateProfileSwitch(ps))
.subscribe({ result ->
result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted ProfileSwitch $it") }
result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated ProfileSwitch $it") }
}, {
aapsLogger.error(LTag.DATABASE, "Error while saving ProfileSwitch", it)
})
}
}

View file

@ -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())

View file

@ -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()
pumpBatteryChange?.visibility = (pump.pumpDescription.isBatteryReplaceable || (pump is OmnipodErosPumpPlugin && pump.isUseRileyLinkBatteryLevel && pump.isBatteryChangeLoggingEnabled)).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()

View file

@ -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)

View file

@ -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)

View file

@ -8,8 +8,8 @@ import androidx.preference.PreferenceFragmentCompat
import androidx.preference.SwitchPreference
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.BuildConfig
import info.nightscout.androidaps.interfaces.Config
import info.nightscout.androidaps.R
import info.nightscout.androidaps.interfaces.Config
import info.nightscout.androidaps.interfaces.PluginBase
import info.nightscout.androidaps.interfaces.PluginDescription
import info.nightscout.androidaps.interfaces.PluginType
@ -35,17 +35,19 @@ 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)
.fragmentClass(MaintenanceFragment::class.java.name)
.alwaysVisible(false)
.alwaysEnabled(true)
.pluginIcon(R.drawable.ic_maintenance)
.pluginName(R.string.maintenance)
.shortName(R.string.maintenance_shortname)
.preferencesId(R.xml.pref_maintenance)
.description(R.string.description_maintenance),
) : PluginBase(
PluginDescription()
.mainType(PluginType.GENERAL)
.fragmentClass(MaintenanceFragment::class.java.name)
.alwaysVisible(false)
.alwaysEnabled(true)
.pluginIcon(R.drawable.ic_maintenance)
.pluginName(R.string.maintenance)
.shortName(R.string.maintenance_shortname)
.preferencesId(R.xml.pref_maintenance)
.description(R.string.description_maintenance),
aapsLogger, resourceHelper, injector
) {
@ -53,11 +55,12 @@ 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)
val attachmentUri = FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID + ".fileprovider", zip)
val attachmentUri =
FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID + ".fileprovider", zip)
val emailIntent: Intent = this.sendMail(attachmentUri, recipient, "Log Export")
aapsLogger.debug("sending emailIntent")
context.startActivity(emailIntent)
@ -65,14 +68,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 +83,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) {
@ -192,7 +195,12 @@ class MaintenancePlugin @Inject constructor(
*
* @return
*/
private fun sendMail(attachmentUri: Uri, recipient: String, subject: String, body: String): Intent {
private fun sendMail(
attachmentUri: Uri,
recipient: String,
subject: String,
body: String
): Intent {
aapsLogger.debug("sending email to $recipient with subject $subject")
val emailIntent = Intent(Intent.ACTION_SEND)
emailIntent.type = "text/plain"
@ -207,8 +215,9 @@ class MaintenancePlugin @Inject constructor(
override fun preprocessPreferences(preferenceFragment: PreferenceFragmentCompat) {
super.preprocessPreferences(preferenceFragment)
val encryptSwitch = preferenceFragment.findPreference(resourceHelper.gs(R.string.key_maintenance_encrypt_exported_prefs)) as SwitchPreference?
?: return
val encryptSwitch =
preferenceFragment.findPreference(resourceHelper.gs(R.string.key_maintenance_encrypt_exported_prefs)) as SwitchPreference?
?: return
encryptSwitch.isVisible = buildHelper.isEngineeringMode()
encryptSwitch.isEnabled = buildHelper.isEngineeringMode()
}

View file

@ -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
}

View file

@ -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 ->

View file

@ -3,6 +3,7 @@ package info.nightscout.androidaps.plugins.general.nsclient.services
import android.annotation.SuppressLint
import android.content.Context
import android.content.Intent
import android.content.pm.ResolveInfo
import android.os.*
import androidx.work.OneTimeWorkRequest
import com.google.common.base.Charsets
@ -16,7 +17,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 +71,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 +198,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"
@ -488,7 +487,7 @@ class NSClientService : DaggerService() {
val intent = Intent(Intents.ACTION_NEW_PROFILE)
intent.putExtras(bundle)
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES)
sendBroadcast(intent)
broadcast(intent)
}
}
}
@ -516,7 +515,7 @@ class NSClientService : DaggerService() {
val intent = Intent(Intents.ACTION_REMOVED_TREATMENT)
intent.putExtras(bundle)
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES)
sendBroadcast(intent)
broadcast(intent)
}
}
if (addedOrUpdatedTreatments.length() > 0) {
@ -533,7 +532,7 @@ class NSClientService : DaggerService() {
val intent = Intent(Intents.ACTION_CHANGED_TREATMENT)
intent.putExtras(bundle)
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES)
sendBroadcast(intent)
broadcast(intent)
}
}
}
@ -581,7 +580,7 @@ class NSClientService : DaggerService() {
val intent = Intent(Intents.ACTION_NEW_SGV)
intent.putExtras(bundle)
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES)
sendBroadcast(intent)
broadcast(intent)
}
}
}
@ -721,6 +720,16 @@ class NSClientService : DaggerService() {
return ret
}
private fun broadcast(intent: Intent) {
val receivers: List<ResolveInfo> = packageManager.queryBroadcastReceivers(intent, 0)
for (resolveInfo in receivers)
resolveInfo.activityInfo.packageName?.let {
intent.setPackage(it)
sendBroadcast(intent)
aapsLogger.debug(LTag.CORE, "Sending broadcast " + intent.action + " to: " + it)
}
}
init {
if (handler == null) {
val handlerThread = HandlerThread(NSClientService::class.java.simpleName + "Handler")

View file

@ -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)

View file

@ -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()

View file

@ -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)
}
}

View file

@ -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 ""
} ?: ""

View file

@ -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()

View file

@ -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
}

View file

@ -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() {

View file

@ -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

View file

@ -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

View file

@ -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
}

View file

@ -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,10 +373,10 @@ 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
loop.enabled = true
sendSMS(Sms(receivedSms.phoneNumber, resourceHelper.gs(R.string.smscommunicator_loophasbeenenabled)))
rxBus.send(EventRefreshOverview("SMS_LOOP_START"))
}
@ -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() {
@ -478,7 +483,7 @@ class SmsCommunicatorPlugin @Inject constructor(
@kotlin.ExperimentalStdlibApi
private fun processHELP(divided: Array<String>, receivedSms: Sms) {
when {
divided.size == 1 -> {
divided.size == 1 -> {
sendSMS(Sms(receivedSms.phoneNumber, commands.keys.toString().replace("[", "").replace("]", "")))
receivedSms.processed = true
}
@ -490,7 +495,7 @@ class SmsCommunicatorPlugin @Inject constructor(
}
}
else -> sendSMS(Sms(receivedSms.phoneNumber, resourceHelper.gs(R.string.wrongformat)))
else -> sendSMS(Sms(receivedSms.phoneNumber, resourceHelper.gs(R.string.wrongformat)))
}
}
@ -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 =

View file

@ -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)
}

View file

@ -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)

View file

@ -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;
}
}

View file

@ -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;
*/
}
}

View file

@ -1,5 +0,0 @@
package info.nightscout.androidaps.plugins.treatments.events
import info.nightscout.androidaps.events.EventUpdateGui
class EventTreatmentUpdateGui : EventUpdateGui()

View file

@ -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)

View file

@ -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"

View file

@ -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"

View file

@ -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")

View file

@ -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"

View file

@ -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()
}

View file

@ -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)
}
}

View file

@ -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]+.*"))

View file

@ -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 {

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.utils;
package info.nightscout.androidaps.utils.ui;
import android.view.MotionEvent;
import android.view.View;

View file

@ -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.

View file

@ -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" />

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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 lassistant [%]</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>

View file

@ -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>

View file

@ -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>

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="objectives_button_start">התחל</string>
<string name="objectives_button_verify">אמת</string>
<string name="objectives_button_verify">סיום</string>
<string name="nth_objective">%1$d. משימה</string>
<string name="objectivenotstarted">מטרה %1$d לא החלה</string>
<string name="objectivenotfinished">משימה %1$d לא בוצעה במלואה</string>

View file

@ -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>

View file

@ -1,54 +1,215 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="dia_whatmeansdia">DIA에 대하여 올바른 것은?</string>
<string name="dia_label_exam">활성 인슐린 지속 시간 (DIA)</string>
<string name="dia_profile">프로파일에 DIA 값을 입력해야 합니다.</string>
<string name="dia_minimumis5h">허용되는 최소값은 5시간입니다.</string>
<string name="dia_hint1">https://androidaps.readthedocs.io/en/latest/CROWDIN/ko/Configuration/Config-Builder.html?#insulin</string>
<string name="dia_meaningisequaltodiapump">AndroidAPS를 사용하기 전에 펌프에서 사용했던 DIA 값이 잘 작동하여 만족했다면, looping을 시작하기 전에 이 값을 변경할 필요는 없습니다.</string>
<string name="dia_valuemustbedetermined">적절한 DIA 값을 스스로 찾아야 합니다.</string>
<string name="hypott_label">저혈당 임시 목표</string>
<string name="hypott_whenhypott">저혈당 임시 목표를 설정하는 가장 중요한 이유는 무엇인가요?</string>
<string name="hypott_wrongbasal">잘못된 basal 양 설정으로 인한 저혈당을 수정하기 위함.</string>
<string name="hypott_preventoversmb">저혈당에 대한 처치로 빠르게 작용하는 탄수화물을 섭취하여 혈당 상승이 있을 때 AndoridAPS가 이를 과수정하는 것을 방지하기 위함.</string>
<string name="hypott_exercise">운동으로 인한 저혈당을 교정하기 위함.</string>
<string name="hypott_0basal">0% 임시 basal이 이미 적용되고 있는 상황에서 혈당이 낮아지는 것을 방지하기 위함.</string>
<string name="hypott_hint1">https://androidaps.readthedocs.io/en/latest/CROWDIN/ko/Usage/temptarget.html</string>
<string name="offlineprofile_whatprofile">어떤 프로파일이 오프라인에서 설정할 수 있습니까?</string>
<string name="offlineprofile_label">주제: 오프라인 프로파일</string>
<string name="offlineprofile_nsprofile">NS 프로파일이 사용될 수 있지만, 오프라인 상에서 설정할 수는 없습니다.</string>
<string name="offlineprofile_hint1">https://androidaps.readthedocs.io/en/latest/CROWDIN/ko/Configuration/Config-Builder.html#profile</string>
<string name="pumpdisconnect_label">AndroidAPS에서 \"펌프 연결 해제\"를 적용하는 이유들</string>
<string name="pumpdisconnect_whattodo">펌프 일시중지할땐 무엇을 해야합니까?</string>
<string name="pumpdisconnect_unnecessary">펌프가 물리적으로 연결되어 있지 않을 때에는 인슐린이 주입되지 않으므로 이 기능이 필요하지 않습니다.</string>
<string name="pumpdisconnect_missinginsulin">이 기능은 펌프가 물리적으로 떨어져 있는 동안에 주입되지 않은 인슐린을 AndroidAPS가 계산하지 않도록 합니다.</string>
<string name="pumpdisconnect_notstop">펌프가 연결된 채로 있다면 이 기능은 인슐린 주입을 멈추지 않습니다.</string>
<string name="pumpdisconnect_openloop">이 기능은 AndroidAPS를 open loop 모드로 전환합니다.</string>
<string name="pumpdisconnect_hint1">https://androidaps.readthedocs.io/en/latest/CROWDIN/ko/Getting-Started/FAQ.html#other-settings</string>
<string name="objectives_label">AndroidAPS 설정들</string>
<string name="objectives2_label">AndroidAPS 설정들</string>
<string name="objectives_howtosave">설정을 백업하는 가장 좋은 방법은 무엇인가요?</string>
<string name="objectives_notesettings">적용된 설정을 따로 기록해둔다면 설정값을 \"내보내기\" 하지 않아도 됩니다.</string>
<string name="objectives_afterobjective">목표를 보두 수행한 뒤 설정값을 \"내보내기\" 합니다.</string>
<string name="objectives_afterchange">설정이 바뀐 부분이 있다면 설정값을 \"내보내기\" 합니다.</string>
<string name="objectives_afterinitialsetup">초기 구성을 마치고, 개별 설정을 입력한 뒤 설정값을 \"내보내기\" 합니다.</string>
<string name="objectives2_maintenance">관리 메뉴에서 설정값을 현재 기기로 \"내보내기\" 합니다.</string>
<string name="objectives2_internalstorage">핸드폰의 Internal Storage/AAPS/preferences 폴더에서 설정값을 찾을 수 있습니다.</string>
<string name="objectives2_cloud">안전한 외부 기기 (예를 들어, 클라우드 드라이브, 컴퓨터에 케이블 연결, email, 등)에 설정 파일을 복사합니다.</string>
<string name="objectives2_easyrestore">핸드폰을 잃어버렸거나 고장난 경우, 백업해놓지 않아도 설정값을 원격으로 쉽게 되살릴 수 있습니다.</string>
<string name="objectives_hint1">https://androidaps.readthedocs.io/en/latest/CROWDIN/ko/Usage/ExportImportSettings.html</string>
<string name="objectives_hint2">https://androidaps.readthedocs.io/en/latest/CROWDIN/ko/Getting-Started/FAQ.html#what-emergency-equipment-is-recommended-to-take-with-me</string>
<string name="noisycgm_label">노이즈가 심한 CGM의 혈당값</string>
<string name="noisycgm_whattodo">CGM 혈당의 노이즈가 심하다면 어떻게 해야합니까?</string>
<string name="noisycgm_nothing">특별한 조치를 하지 않습니다. - AndroidAPS가 이를 알아서 처리할 것입니다.</string>
<string name="noisycgm_pause">과량주입 또는 과소주입의 가능성을 막기 위해 closed loop 기능을 끕니다.</string>
<string name="noisycgm_replacesensor">지속적인 노이즈나 부정확한 센서를 교체합니다.</string>
<string name="noisycgm_checksmoothing">사용 중인 CGM 어플이 데이터 평활화 기능을 제공하는지 확인합니다.</string>
<string name="noisycgm_hint1">https://androidaps.readthedocs.io/en/latest/CROWDIN/ko/Usage/Smoothing-Blood-Glucose-Data-in-xDrip.html#smoothing-blood-glucose-data</string>
<string name="exerciseprofile_label">운동과 프로파일</string>
<string name="exerciseprofile_whattodo">유산소 운동을 할 때 프로파일을 어떻게 설정하는 것이 시스템에 가장 도움이 될까요?</string>
<string name="exerciseprofile_switchprofilebelow100">프로파일을 100% 보다 낮게 변경합니다.</string>
<string name="exerciseprofile_switchprofileabove100">프로파일을 100% 보다 높게 변경합니다.</string>
<string name="exerciseprofile_leaveat100">프로파일을 100%로 그대로 둡니다.</string>
<string name="exerciseprofile_suspendloop">Loop 기능을 중지합니다.</string>
<string name="exerciseprofile_hint1">https://androidaps.readthedocs.io/en/latest/CROWDIN/ko/Usage/temptarget.html#activity-temp-target</string>
<string name="exercise_label">운동과 임시 목표</string>
<string name="exercise_whattodo">유산소 운동을 할 때 임시 목표를 어떻게 설정하는 것이 시스템에 가장 도움이 될까요?</string>
<string name="exercise_settt">운동을 시작하기 전 적절한 시간에 \"운동 시 임시 목표\"가 작동하도록 설정합니다.</string>
<string name="exercise_setfinished">운동이 끝난 후 \"운동 시 임시 목표\"를 설정합니다.</string>
<string name="exercise_setunchanged">임시 목표를 변경하지 않습니다.</string>
<string name="exercise_15g">\"저혈당 임시 목표\"보다 혈당이 떨어질 때까지 기다린 후 빠르게 반응하는 탄수화물 15g을 섭취합니다.</string>
<string name="exercise_hint1">https://androidaps.readthedocs.io/en/latest/CROWDIN/ko/Usage/temptarget.html#activity-temp-target</string>
<string name="suspendloop_label">중지 또는 일시중지된 loop</string>
<string name="suspendloop_doigetinsulin">Loop가 중지/일시중지 되었을때 인슐린이 주입됩니까?</string>
<string name="suspendloop_yes">네, Basal 인슐린은 계속 주입됩니다.</string>
<string name="suspendloop_no">아니오, 인슐린 주입이 모두 중지됩니다.</string>
<string name="basaltest_label">Basal, ISF, and I:C 테스트</string>
<string name="basaltest_when">언제 이 값들을 확인해야할까요?</string>
<string name="basaltest_beforeloop">Looping을 시작하게 전</string>
<string name="basaltest_havingregularhighlow">자주 고혈당 또는 저혈당을 경험할 때</string>
<string name="basaltest_weekly">적어도 일주일에 한 번</string>
<string name="basaltest_fixed">한 번 설정하고 확인하면, 이 값은 계속 변하면 안됨.</string>
<string name="basaltest_hint1">https://androidaps.readthedocs.io/en/latest/CROWDIN/ko/Getting-Started/FAQ.html#androidaps-settings</string>
<string name="prerequisites_label">기본 준비사항</string>
<string name="prerequisites_what">AndroidAPS를 설정하고 사용하기 위해 필수적인 것은 무엇일까요?</string>
<string name="prerequisites_determinedcorrectprofile">유효한 프로파일 정보 (Basal, IC, ISF, DIA).</string>
<string name="prerequisites_computer">Android Studio가 설치되고 환경설정된 컴퓨터</string>
<string name="prerequisites_phone">지원되는 폰.</string>
<string name="prerequisites_pump">Closed loop을 사용할 계획이라면 호환되는 인슐린 펌프</string>
<string name="prerequisites_nightscout">모든 데이터의 log를 보관하고 설정을 검토하기 위한 Nightscout</string>
<string name="prerequisites_tidepoolaccount">Tidepool 계정.</string>
<string name="prerequisites_googleaccount">구글(Google) 계정.</string>
<string name="prerequisites_githubaccount">깃허브(Github) 계정.</string>
<string name="prerequisites_beanandroiddeveloper">프로그래밍이나 코딩을 해 본 경험</string>
<string name="prerequisites_own670g">미니메드(MiniMed) 670G 펌프.</string>
<string name="prerequisites_hint1">https://androidaps.readthedocs.io/en/latest/CROWDIN/ko/Module/module.html</string>
<string name="prerequisites_smartwatch">스마트워치.</string>
<string name="prerequisites_supportedcgm">지원되는 연속혈당측정기(CGM).</string>
<string name="prerequisites2_label">기본 준비사항</string>
<string name="prerequisites2_what">AndroidAPS를 설정하고 사용하기 위해 필수적인 것은 무엇일까요?</string>
<string name="prerequisites2_profile">프로파일을 설정하기 위해 확인된 정보 (ISF, I:C ratio, basal 양, DIA 등).</string>
<string name="prerequisites2_device">호환되는 Android 장치 (예를 들어, 핸드폰, Android 워치, 또는 태블릿).</string>
<string name="prerequisites2_internet">Closed loop을 실행하기 위해서는 AndroidAPS가 인터넷에 연결되어 있어야 함.</string>
<string name="prerequisites2_supportedcgm">지원되는 CGM과 핸드폰 또는 장치에 혈당값을 수신하기 위한 적절한 어플.</string>
<string name="prerequisites2_hint1">https://androidaps.readthedocs.io/en/latest/CROWDIN/ko/Module/module.html</string>
<string name="update_label">AndroidAPS 업데이트하기</string>
<string name="whatistrue">올바른 답변을 모두 체크하세요.</string>
<string name="update_git">컴퓨터에 Git을 설치하고 환경 설정해야 합니다.</string>
<string name="update_asap">AndroidAPS의 업데이트된 버전이 배포되면, 일정 시간이 지난 후 이전 버전은 원격으로 제한됩니다.</string>
<string name="update_keys">Keystore의 위치를 저장하고 기록해두어야 이전에 설치할 때 사용했던 동일한 signing key를 업데이트할 때 사용할 수 있습니다.</string>
<string name="update_neverupdate">시스템이 잘 작동한다면 절대 업데이트하지마세요.</string>
<string name="update_askfriend">만약 apk를 만드는 것이 어렵다면, 친구가 만든 apk를 사용하여 설치할 수 있습니다.</string>
<string name="update_hint1">https://androidaps.readthedocs.io/en/latest/CROWDIN/ko/Installing-AndroidAPS/Update-to-new-version.html#update-to-a-new-version-or-branch</string>
<string name="troubleshooting_label">문제 해결</string>
<string name="troubleshooting_wheretoask">어디에서 AndroidAPS에 대한 도움을 받을 수 있을까요?</string>
<string name="troubleshooting_fb">Facebook의 AndrioidAPS 사용자 그룹에 조언을 요청할 수 있습니다.</string>
<string name="troubleshooting_wiki">AndroidAPS 문서를 읽어야 (그리고 다시 읽어야) 합니다.</string>
<string name="troubleshooting_gitter">AndroidAPS Gitter room에 기술적 문제들을 기록하고, 조언을 요청할 수 있습니다.</string>
<string name="troubleshooting_yourendo">당뇨병 클리닉/내분비내과의사에게 문의해야 합니다.</string>
<string name="troubleshooting_hint1">https://androidaps.readthedocs.io/en/latest/CROWDIN/ko/Installing-AndroidAPS/Update-to-new-version.html#troubleshooting</string>
<string name="troubleshooting_hint2">https://www.facebook.com/groups/AndroidAPSUsers/</string>
<string name="troubleshooting_hint3">https://gitter.im/MilosKozak/AndroidAPS</string>
<string name="insulin_label">인슐린 플러그인</string>
<string name="insulin_ultrarapid">어떤 인슐린에서 초-초속효성의 Oref 플러그인을 사용해야 할까요?</string>
<string name="insulin_fiasp">피아스프(Fiasp®)</string>
<string name="insulin_novorapid">노보래피드(NovoRapid®)/노보로그(Novolog®)</string>
<string name="insulin_humalog">휴마로그(Humalog®)</string>
<string name="insulin_actrapid">액트라피드(Actrapid®)/휴말린 R(Humalin R®)/\"보통의\" 인간 인슐린.</string>
<string name="insulin_hint1">https://androidaps.readthedocs.io/en/latest/CROWDIN/ko/Configuration/Config-Builder.html#insulin</string>
<string name="sensitivity_label">민감도 플러그인</string>
<string name="sensitivity_which">올바른 답변을 모두 체크하세요.</string>
<string name="sensitivity_adjust">민감도 플러그인은 AndroidAPS가 일시적 또는 단기적으로 인슐린 민감도를 조절할 수 있도록 합니다. (예를 들어, 호르몬 변화 또는 주입 부위에서 흡수의 문제)</string>
<string name="sensitivity_edit">민감도 플러그인은 프로파일을 수정할 때 사용할 수 있도록 basal 양, I:C ratio, ISF의 추천되는 변화값을 사용자에게 제공합니다.</string>
<string name="sensitivity_cannula">캐뉼라 교체를 입력하면 Autosens 비율은 100%로 되돌아갑니다.</string>
<string name="sensitivity_time">일부 플러그인 옵션은 사용자가 설정 가능한 시간 범위를 갖습니다.</string>
<string name="sensitivity_hint1">https://androidaps.readthedocs.io/en/latest/CROWDIN/ko/Configuration/Sensitivity-detection-and-COB.html</string>
<string name="wrongcarbs_label">탄수화물 입력 오류</string>
<string name="wrongcarbs_whattodo">부적절한 탄수화물을 입력하였다면 어떻게 하여야 합니까?</string>
<string name="wrongcarbs_treatmentstab">관리 메뉴에서 잘못된 입력을 삭제하고, 새로운 탄수화물 양으로 수정합니다.</string>
<string name="wrongcarbs_addinsulin">주입 세트 교체 메뉴의 prime 기능을 사용하여 bolus 인슐린을 주입합니다.</string>
<string name="wrongcarbs_donothing">특별한 조치를 하지 않습니다. - AndroidAPS가 적절한 조정을 할 것입니다.</string>
<string name="wrongcarbs_bolus">홈 화면에서 \"인슐린 (bolus)\" 버튼을 사용하여 bolus 인슐린을 주입합니다.</string>
<string name="wronginsulin_label">인슐린 주입/입력 오류</string>
<string name="wronginsulin_whattodo">만약 펌프 기록에서 보여지는 것보다 인슐린이 적게 주입되었을 때 어떻게 해야 할까요? (예를 들어, 주입 막힘, 캐뉼라 문제, 샤워 후 펌프 재부착을 잊어버렸을 때)</string>
<string name="wronginsulin_careportal">Nightscout 케어포탈에서 인슐린 데이터를 삭제하여 펌프 기록에서 이를 제거합니다.</string>
<string name="wronginsulin_compare">AndroidAPS와 펌프 기록을 비교합니다.</string>
<string name="wronginsulin_prime">\"주입되지 않은\" 인슐린양을 계산하여 시린지/펜 또는 prime 기능을 사용하여 인슐린을 주입합니다.</string>
<string name="wronginsulin_donothing">특별한 조치를 취하지 않고, AndroidAPS가 결과적으로 높은 혈당 정도를 조정할 수 있도록 합니다.</string>
<string name="iob_label">활성 인슐린 (IOB)</string>
<string name="iob_which">올바른 답변을 모두 체크하세요.</string>
<string name="iob_value">IOB 값은 실행된 임시 basal의 영향을 받습니다.</string>
<string name="iob_hightemp">혈당이 목표보다 낮을 경우 높은 임시 basal은 실행되지 않습니다.</string>
<string name="iob_negiob">운동 없이도 음수의 IOB (마이너스 IOB) 구간이 많을 경우, 프로파일이 너무 강한 것이며 인슐린 양을 적게 설정해야 합니다.</string>
<string name="iob_posiob">양수의 IOB (플러스 IOB) 구간이 많을 경우, 인슐린 저항성 또는 입력하지 않은 식사를 의미합니다.</string>
<string name="breadgrams_label">탄수화물 입력과 bolus</string>
<string name="breadgrams_grams">섭취한 탄수화물을 계산하고 기록할 때 gram 단위만을 사용해야 합니다.</string>
<string name="breadgrams_exchange">섭취한 탄수화물은 적절한 변환 방식 (예를 들어, DAFNE \"CHO\" 변환 또는 유럽의 \"Bread Units\")을 이용하여 기록할 수 있습니다.</string>
<string name="breadgrams_decay">AndroidAPS는 탄수화물의 \"소화\"를 예측하고 COB를 계산하기 위해 dynamic model을 사용합니다.</string>
<string name="breadgrams_calc">만약 혈당이 적절한 값을 벗어나면 (너무 낮거나 너무 높은 경우), 탄수화물 또는 교정 인슐린의 제안을 위해 bolus 계산기를 사용할 수 있습니다.</string>
<string name="breadgrams_hint1">https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#insulin-to-carb-ratio-ic-g-u</string>
<string name="extendedcarbs_label">확장 탄수화물 (e-carbs)</string>
<string name="extendedcarbs_handling">c-carbs (확장 탄수화물)을 언제 사용할 수 있을까요?</string>
<string name="extendedcarbs_future">(일정 기간에 걸쳐 인슐린을 나눠서 주입하는 확장 bolus와 유사하게) 일정 기간에 걸쳐 나눠서 탄수화물을 섭취할 계획이 있을 때.</string>
<string name="extendedcarbs_free">AndroidAPS가 모르게 (인슐린 주입없이) 운동 시 섭취하는 \'free\' 탄수화물을 기록하기 위함.</string>
<string name="extendedcarbs_fat">(이후에 나눠서 섭취할) 확장 탄수화물 (e-carbs)은 AndroidAPS가 고지방/고단백질 식이를 조절하는데 도움을 줄 수 있습니다.</string>
<string name="extendedcarbs_rescue">저혈당 처치를 위해 사용한 탄수화물의 제거를 기록하기 위함.</string>
<string name="extendedcarbs_hint1">https://androidaps.readthedocs.io/en/latest/CROWDIN/ko/Usage/Extended-Carbs.html</string>
<string name="nsclient_label">원격 모니터링</string>
<string name="nsclient_howcanyou">어떻게 AndroidAPS를 원격으로 모니터링할 수 있을까요 (예를 들어, 아이들)?</string>
<string name="nsclient_nightscout">NS Client 어플, Nightscout 어플, Nightscout 웹페이지 모두 AndroidAPS를 원격으로 팔로우 할 수 있게 합니다.</string>
<string name="nsclient_dexcomfollow">다른 어플들(예를 들어, Dexcom 팔로우, 팔로우 모드의 xDrip)은 일부 변수들(혈당/센서 수치)을 원격으로 팔로우 할 수 있지만, 알고리즘이 달라 부정확한 IOB 또는 COB 값을 보여줄 수 있습니다.</string>
<string name="nsclient_data">AndroidAPS를 원격으로 팔로우하기 위해서는 Wi-Fi나 모바일/셀룰러 네트워크 데이터를 이용하여 두 기기가 모두 인터넷에 연결되어 있어야 합니다.</string>
<string name="nsclient_fullcontrol">NS Client를 원격 팔로워로 사용하면 모니터링과 AndroidAPS의 완전한 제어가 가능합니다.</string>
<string name="nsclient_hint1">https://androidaps.readthedocs.io/en/latest/CROWDIN/ko/Children/Children.html</string>
<string name="isf_label_exam">인슐린 민감도 (ISF)</string>
<string name="isf_increasingvalue">ISF 값을 올리면 일정한 양의 탄수화물을 다루기 위해 더 많은 인슐린이 주입하게 합니다.</string>
<string name="isf_decreasingvalue">ISF 값을 낮추면 목표 혈당보다 높을 때 교정을 위해 더 많은 인슐린이 주입하게 합니다.</string>
<string name="isf_noeffect">혈당이 목표보다 낮을 때에는 ISF를 높이거나 낮추는 것이 인슐린 주입에 영향을 주지 않습니다.</string>
<string name="isf_preferences">ISF를 AndroidAPS 설정에 입력해야 합니다.</string>
<string name="isf_profile">변경사항을 적용하는데 프로파일에서 ISF 값 변경하는 것으로 충분합니다.</string>
<string name="isf_hint1">https://androidaps.readthedocs.io/en/latest/CROWDIN/ko/Getting-Started/FAQ.html#insulin-sensitivity-factor-isf-mmol-l-u-or-mg-dl-u</string>
<string name="isf_hint2">https://androidaps.readthedocs.io/en/latest/CROWDIN/ko/Usage/Profiles.html</string>
<string name="ic_multiple">프로파일에서 한 개 이상의 I:C ratio를 사용할 수 있습니다.</string>
<string name="ic_isf">프로파일에서 ISF를 바꾸면, I:C ratio도 항상 바꿔줘야 합니다.</string>
<string name="ic_label_exam">인슐린 대 탄수화물 비율 (I:C ratio)</string>
<string name="ic_increasingvalue">높은 I:C ratio은 탄수화물 섭취 시 인슐린을 적게 주입하게 합니다.</string>
<string name="ic_decreasingvalue">높은 I:C ratio은 탄수화물 섭취 시 인슐린을 적게 주입하게 합니다.</string>
<string name="ic_noeffect">COB가 0 인 경우 IC 비율을 변경하면 혈당을 교정하기 위해 다른 양의 인슐린이 주입됩니다.</string>
<string name="ic_different">Bread unit (교환 단위)를 10g 또는 12g으로 계산하면 IC 값도 달라지게 됩니다.</string>
<string name="ic_meaning">IC: 1U의 인슐린으로 bread uits (교환 단위)를 얼마나 섭취할 수 있는 지를 의미합니다.</string>
<string name="ic_hint1">https://androidaps.readthedocs.io/en/latest/CROWDIN/ko/Getting-Started/FAQ.html#carbohydrate-to-insulin-ratio-cr-g-u</string>
<string name="profileswitch_label">프로파일 변경</string>
<string name="profileswitch_pctwillchange">프로파일을 90%로 변경하였을 때, 다음 중 옳은 것은?</string>
<string name="profileswitch_basallower">Basal 양이 10% 감소합니다.</string>
<string name="profileswitch_isfhigher">ISF가 10% 증가합니다.</string>
<string name="profileswitch_iclower">I:C ratio 값이 10% 작은 수가 됩니다.</string>
<string name="profileswitch_unchanged">ISF와 I:C ratio는 변하지 않습니다.</string>
<string name="profileswitch_hint1" formatted="false">https://androidaps.readthedocs.io/en/latest/CROWDIN/ko/Usage/Profiles.html?highlight=profile%20switch#profile-switch</string>
<string name="profileswitch2_label">프로파일 변경</string>
<string name="profileswitch2_pctwillchange">프로파일을 120%로 변경하였을 때, 다음 중 옳은 것은?</string>
<string name="profileswitch2_bghigher">목표 혈당값이 20% 높아집니다.</string>
<string name="profileswitch2_basalhigher">Basal 양이 20% 증가합니다.</string>
<string name="profileswitch2_bgunchanged">목표 혈당값은 변하지 않습니다.</string>
<string name="profileswitch2_isfhigher">ISF가 20% 증가합니다.</string>
<string name="profileswitchtime_label">프로파일 변경</string>
<string name="profileswitchtime_iwant">평소보다 2시간 먼저 일어난 경우, 변경된 일정을 AndroidAPS에게 어떻게 입력해야 할까요?</string>
<string name="profileswitchtime_2">시간이동 2으로 프로파일을 변경합니다.</string>
<string name="profileswitchtime__2">시간이동 -2으로 프로파일을 변경합니다.</string>
<string name="profileswitchtime_tt">\"식사 전 임시 목표\"로 설정합니다.</string>
<string name="profileswitchtime_100">프로파일을 100% 보다 높게 변경합니다.</string>
<string name="profileswitchtime_hint1">https://androidaps.readthedocs.io/en/latest/CROWDIN/ko/Usage/Profiles.html?highlight=profile%20switch#timeshift</string>
<string name="profileswitch4_label">프로파일의 변화</string>
<string name="profileswitch4_rates">Basal rates, ISF, I:C ratio 등을 프로파일에서 설정해야 합니다.</string>
<string name="profileswitch4_internet">Nightscout 프로파일에서의 변화를 활성화 시키려면, AndroidAPS용 핸드폰이 인터넷에 연결되어 있어야 합니다.</string>
<string name="profileswitch4_sufficient">변경된 것을 실행하려면, 프로파일에서 변화된 값을 수정하기만 하면 됩니다.</string>
<string name="profileswitch4_multi">변화하는 상황 (예를 들어, 호르몬 변화, 교대근무, 평일/주말 생활 방식)에 적응하기 위하여 여러 개의 프로파일을 만들어서 선택할 수 있습니다.</string>
<string name="basalhelp_hint1">https://androidaps.readthedocs.io/en/latest/CROWDIN/ko/Module/module.html#good-individual-dosage-algorithm-for-your-diabetes-therapy</string>
<string name="basalhelp_label">Basal 양에 대한 도움</string>
<string name="basalhelp_where">Basal값 등과 관련된 도움을 어디서 받아야 하나요?</string>
<string name="basalhelp_diabetesteam">의료진</string>
<string name="basalhelp_google">구글(Google)</string>
<string name="basalhelp_facebook">페이스북(Facebook)</string>
<string name="other_medication_label">다른 약물. 하단의 문구를 읽고, 내용을 수용하면 네모칸에 체크하십시오.</string>
<string name="other_medication_text">AndroidAPS는 혈당을 올리기 위하여 basal값을 내리거나 중단합니다. SGLT2 억제제 (gliflozins) 계열의 약물들은 혈당 상승을 억제하여 DKA (케톤산증)을 일으킬 정도로 위험한 인슐린의 결핍을 유발할 수 있습니다.
\n일반적인 브랜드명은 다음과 같습니다: Invokana®, Forxiga®, Jardiance®, Steglatro®, Suglat®, Apleway®, Deberza®, Synjardy®, Vokanamet®, Xigduo®.\n\n본인은 AndroidAPS를 사용할 때 이러한 약물들을 복용하지 않을 것, 또는 이러한 약물들을 복용하기 전에 loop을 비활성화 할 것을 약속합니다.</string>
</resources>

View file

@ -19,7 +19,10 @@
<string name="objectives_autosens_gate">섭취한 탄수화물양을 입력하고 1주일동안 낮시간대에 loop를 성공적으로 사용하여 봅니다</string>
<string name="objectives_ama_objective">AMA(Advanced Meal Assist)같은 낮시간대를 위한 추가적인 기능들을 실행하여 봅니다</string>
<string name="objectives_smb_objective">낮시간대에 SMB(Super Micro Bolus)같은 추가기능을 활성화해 사용해봅니다</string>
<string name="objectives_auto_objective">자동화 사용</string>
<string name="objectives_smb_gate">SMB가 잘 작동하게 하기위해서 wiki를 반드시 읽은 다음 maxIOB 값을 올려보세요! maxIOB=평균 식사 Bolus + 3 x 최대하루 Basal이면 적당한 시작값입니다</string>
<string name="objectives_auto_gate">자동화가 어떻게 작동하는지 설명서를 확인하세요. 간단한 첫 번째 규칙을 만들어 보십시오. 실행하기 전에 AAPS가 알림을 보여주도록 설정합니다. 자동화가 적시에 잘 작동하는 것을 확인하면 알림을 실제 실행으로 변경하십시오.
(https://androidaps.readthedocs.io/en/latest/EN/Usage/Automation.html)</string>
<string name="objectives_bgavailableinns">NS에서 혈당이 확인 가능합니다</string>
<string name="objectives_pumpstatusavailableinns">NS에서 펌프상태가 확인 가능합니다</string>
<string name="objectives_manualenacts">수동 주입</string>
@ -34,9 +37,11 @@
<string name="objectives_useloop">Loop 플러그인 내용을 표시합니다</string>
<string name="objectives_usescale">홈의 혈당 차트를 길게 눌러 차트 시간을 변경하세요</string>
<string name="objectives_button_enter">입력</string>
<string name="enter_code_obtained_from_developers_to_bypass_the_rest_of_objectives">다른 시스템에서 closed loop을 적어도 3개월 동안 사용한 경우 목표를 건너뛸 수 있는 코드를 받을 수 있습니다. 자세한 정보는 https://androidaps.readthedocs.io/en/latest/EN/Usage/Objectives.html#skip-objectives를 참고하십시오.</string>
<string name="codeaccepted">코드 인증</string>
<string name="codeinvalid">잘못된 코드</string>
<string name="objectives_exam_objective">당신의 지식을 확인해봅니다</string>
<string name="objectives_exam_gate">문제들에 대한 공부. 각각의 질문에 네 개의 답변이 주어집니다. 한 개 이상의 정답이 있을 수 있습니다. 올바른 것을 모두 체크하고, 확인을 선택하십시오.</string>
<string name="answerdisabledto">다음 시간까지 답변 불가능: %1$s</string>
<string name="wronganswer">잘못된 답변!</string>
<string name="unfinshed_button">다음 미답변</string>

View file

@ -6,6 +6,7 @@
<string name="treatmentssafety_title">관리 안전설정</string>
<string name="treatmentssafety_maxbolus_title">최대 허용 Bolus [U]</string>
<string name="treatmentssafety_maxcarbs_title">최대 허용 탄수화물 [g]</string>
<string name="nav_preferences_plugin">%1$s 설정</string>
<string name="nav_preferences">설정</string>
<string name="nav_refreshtreatments">NS에서 관리 새로고침</string>
<string name="nav_resetdb">데이터베이스 초기화</string>
@ -19,6 +20,7 @@
<string name="description_food">Nightscout에서 정의된 음식 설정을 표시합니다.</string>
<string name="description_insulin_rapid">휴마로그와 노보래피드에 대한 인슐린 설정</string>
<string name="description_insulin_ultra_rapid">피아스프에 대한 인슐린 설정</string>
<string name="description_insulin_lyumjev">Lyumjev에 대한 인슐린 설정</string>
<string name="description_insulin_free_peak">인슐린활동의 피크를 직접 정의할 수 있습니다. 고급 사용자만 사용해야 합니다.</string>
<string name="description_loop">Loop를 활성화 혹은 비활성화합니다.</string>
<string name="description_ns_client">Nightscout과 데이터 동기화하기</string>
@ -30,11 +32,13 @@
<string name="description_pump_mdi">다회요법으로 관리하는 사용자를 위한 설정</string>
<string name="description_pump_virtual">가상용 펌프를 위한 설정(Open Loop)</string>
<string name="description_sensitivity_aaps">Oref0와 동일한 방법으로 민감도가 계산되지만, 과거 시간을 지정할 수 있습니다. 최소 탄수화물 흡수는 설정에서 최대 탄수화물 흡수 시간으로 부터 계산됩니다.</string>
<string name="description_sensitivity_oref1">민감도가 과거 8시간의 데이터로 부터 계산됩니다. (흡수되지 않은 경우) 탄수화물은 설정에서 설정된 시간이 지나면 없어집니다. UAM(알리지 않은 음식)도 계산합니다.</string>
<string name="description_sensitivity_weighted_average">민감도가 편차의 가중평균으로 계산됩니다. 최근의 편차가 더 가중됩니다. 최소 탄수화물 흡수는 설정에서 최대 탄수화물 흡수 시간으로 부터 계산됩니다. 이 알고리즘의 민감도가 가장 빠릅니다.</string>
<string name="description_source_eversense">패치된 Eversense 앱에서 혈당값 받기</string>
<string name="description_source_glimp">Glimp에서 혈당값 받기</string>
<string name="description_source_mm640g">600SeriesAndroidUploader에서 혈당값 받기</string>
<string name="description_source_ns_client">Nightscout에서 다운로드하여 혈당값 받기</string>
<string name="description_source_xdrip">xDrip+에서 혈당값 받기</string>
<string name="description_treatments">모든 관리를 저장합니다.</string>
<string name="description_wear">WearOS 워치를 이용하여 AndroidAPS를 모니터하고 제어합니다.</string>
<string name="description_xdrip_status_line">xDrip+ 워치페이스에서 Loop정보 보여주기</string>
@ -77,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>
@ -107,11 +109,14 @@
<string name="changeyourinput">입력값을 변경하세요!</string>
<string name="configbuilder_bgsource">혈당 출처</string>
<string name="configbuilder_bgsource_description">AndroidAPS가 어디에서 데이터를 가져옵니까?</string>
<string name="xdrip">xDrip+</string>
<string name="apsmode_title">APS 모드</string>
<string name="closedloop">Closed Loop</string>
<string name="openloop">Open Loop</string>
<string name="lowglucosesuspend">저혈당 주입정지</string>
<string name="disabledloop">Loop 중지됨</string>
<string name="openloop_newsuggestion">새로운 제안이 있습니다</string>
<string name="carbssuggestion">탄수화물 제안</string>
<string name="unsupportednsversion">지원하지 않는 Nightscout 버전입니다</string>
<string name="treatments_wizard_basaliob_label">Basal IOB</string>
<string name="bolusconstraintapplied">Bolus 제한이 적용되었습니다</string>
@ -126,7 +131,9 @@
<string name="overview_tempbasal_button">임시Basal</string>
<string name="overview_extendedbolus_button">확장 Bolus</string>
<string name="configbuilder_nightscoutversion_label">Nightscout 버전:</string>
<string name="missing_carbs">부족 %1$d g</string>
<string name="exported">설정이 저장되었습니다</string>
<string name="ue_exported">사용자 입력 사항들이 저장됨</string>
<string name="export_to">다음 위치에 설정을 저장하시겠습니까</string>
<string name="import_from">다음 위치에서 설정을 불러오시겠습니까</string>
<string name="setting_imported">설정을 불러왔습니다</string>
@ -136,6 +143,17 @@
<string name="openapsma_maxbasal_summary">이 값은 OpenAPS에서 Max Basal(최대 Basal)로 설정되는 값입니다</string>
<string name="openapsma_maxiob_title">OpenAPS가 주입할수 있는 최대 Basal IOB [U]</string>
<string name="openapsma_maxiob_summary">이 값은 OpenAPS에서 Max IOB라고 부르는 값입니다\n기본값은 0으로 설정되어 있습니다. 몇일 혹은 몇주 정도 사용 후 적절한 값으로 변경할 수 있습니다.</string>
<string name="password_preferences_encrypt_prompt">내보낸 preferences 암호화 하기 위해 마스터 비밀번호가 필요합니다.</string>
<string name="password_preferences_decrypt_prompt">내보낸 preferences를 가져오기 위해서는 마스터 비밀번호가 필요합니다.</string>
<string name="preferences_export_canceled">내보내기 취소됩니다! 환경 설정을 내보내지 않았습니다!</string>
<string name="preferences_import_canceled">가져오고 취소됩니다! 환경설정을 가져오지 않았습니다.</string>
<string name="check_preferences_before_import">가져오기 전에 환경설정을 확인하세요.</string>
<string name="check_preferences_cannot_import">환경 설정을 가져올 수가 없습니다.</string>
<string name="check_preferences_dangerous_import">환경 설정을 가져오면 안됩니다.</string>
<string name="check_preferences_details_btn">환경설정 가져오기 문제 설명</string>
<string name="check_preferences_details_title">환경설정 가져오기 문제의 상세정보</string>
<string name="check_preferences_import_btn">가져오기</string>
<string name="check_preferences_import_anyway_btn">무시하고 가져오기 (위험!)</string>
<string name="end_user_license_agreement">최종 사용자 라이선스 동의서</string>
<string name="end_user_license_agreement_text">이 프로그램을 의학적 결정을 내리는 데 사용해서는 안되며, 여기에 대한 어떠한 보증도 없습니다. 이 프로그램의 품질과 성능에 관한 모든 위험은 사용자에게 있습니다.\nMUST NOT BE USED TO MAKE MEDICAL DECISIONS. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.</string>
<string name="end_user_license_agreement_i_understand">모두 이해하였고 동의합니다.</string>
@ -249,6 +267,8 @@
<string name="smscommunicator_invalidphonennumber">SMS폰번호가 유효하지 않습니다</string>
<string name="overview_calibration">보정</string>
<string name="xdripnotinstalled">xDrip+가 설치되지 않았습니다</string>
<string name="calibrationsent">보정이 xDrip으로 전송되었습니다+</string>
<string name="smscommunicator_calibrationsent">보정 전송됨. xDrip에서 수신이 되도록 설정되어 있어야 합니다+.</string>
<string name="pumpsuspended">펌프 일시중지됨</string>
<string name="executing">실행중</string>
<string name="virtualpump_settings">가상펌프 설정</string>
@ -275,6 +295,7 @@
<string name="wear_detailedIOB_title">IOB 자세하게 보여주기</string>
<string name="wear_detailedIOB_summary">워치페이스에 IOB를 Bolus IOB와 Basal IOB로 나누어서 보여줍니다.</string>
<string name="nosuccess">성공하지 못했습니다. 폰을 확인하세요</string>
<string name="notavailable">사용불가</string>
<string name="child">어린이</string>
<string name="teenage">청소년</string>
<string name="adult">성인</string>
@ -287,11 +308,16 @@
<string name="suspendloopfor2h">2시간동안 Loop 일시중지</string>
<string name="suspendloopfor3h">3시간동안 Loop 일시중지</string>
<string name="suspendloopfor10h">10시간동안 Loop 일시중지</string>
<string name="disconnectpump">펌프 일시중지</string>
<string name="disconnectpumpfor15m">15분동안 펌프 일시중지</string>
<string name="disconnectpumpfor30m">30분동안 펌프 일시중지</string>
<string name="disconnectpumpfor1h">1시간동안 펌프 일시중지</string>
<string name="disconnectpumpfor2h">2시간동안 펌프 일시중지</string>
<string name="disconnectpumpfor3h">3시간동안 펌프 일시중지</string>
<string name="duration1h">1시간</string>
<string name="duration2h">2시간</string>
<string name="duration3h">3시간</string>
<string name="duration10h">10시간</string>
<string name="resume">재실행</string>
<string name="reconnect">펌프 재연결</string>
<string name="smscommunicator_wrongduration">기간이 잘못되었습니다.</string>
@ -311,6 +337,8 @@
<string name="show_statuslights">홈화면에 상태 표시등 보여주기</string>
<string name="statuslights_res_warning">주사기량 경고 기준값[U]</string>
<string name="statuslights_res_critical">주사기량 위험 기준값[U]</string>
<string name="basal_shortname">BAS</string>
<string name="activity_shortname">ACT</string>
<string name="nav_about">버전정보</string>
<string name="smscommunicator_missingsmspermission">SMS 권한 누락</string>
<string name="smscommunicator_missingphonestatepermission">전화 상태 권한이 허가되지 않았습니다</string>
@ -319,6 +347,9 @@
<string name="wear_showbgi_summary">BGI를 상태라인에 추가하기</string>
<string name="overview_extendedbolus_cancel_button">확장Bolus 취소</string>
<string name="doprofileswitch">프로파일 변경 실행</string>
<string name="careportal_sensor_label">센서</string>
<string name="careportal_insulin_label">인슐린</string>
<string name="careportal_age_label">나이:</string>
<string name="ns_alarmoptions">알람 옵션</string>
<string name="nsalarm_staledatavalue_label">누락 데이터 기준값 [min]</string>
<string name="nsalarm_urgent_staledatavalue_label">위험 누락 데이터 기준값 [min]</string>
@ -549,6 +580,7 @@
<string name="allow_hardware_pump_text">주의: 활성화하고 펌프에 연결하게되면, AndroidAPS는 프로파일의 Basal설정을 복사해서 기존에 펌프에 저장되어 있던 Basal설정을 덮어쓰게 될것입니다. AndroidAPS의 Basal설정이 올바른지 반드시 확인하세요. 만약 확실치 않거나 Basal설정을 덮어씌우길 원치않는다면, 취소버튼을 누르고 나중에 다시 연결하세요.</string>
<string name="error_adding_treatment_title">관리 데이터가 불완전합니다</string>
<string name="maintenance_settings">정비 설정</string>
<string name="maintenance_email">Email</string>
<string name="maintenance_amount">전송할 로그 수</string>
<string name="maintenance">정비</string>
<string name="maintenance_shortname">MAINT</string>
@ -634,6 +666,7 @@
<string name="low_mark_comment">혈당 정상범위의 하한값(표시 전용)</string>
<string name="high_mark_comment">혈당 정상범위의 상한값(표시 전용)</string>
<string name="age">나이:</string>
<string name="weight_label">몸무게:</string>
<string name="id">ID:</string>
<string name="submit">확인</string>
<string name="mostcommonprofile">가장 많이 사용된 프로파일:</string>
@ -661,4 +694,7 @@
<string name="loop_tbrrequest_time_label">임시 Basal 요청시간</string>
<string name="loop_tbrexecution_time_label">임시 Basal 실행시간</string>
<!-- SMS Communicator & OTP Authenticator -->
<string name="overview_show_predictions">예측</string>
<string name="chart_menu">차트 메뉴</string>
<string name="prime">교체</string>
</resources>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>
@ -913,6 +911,8 @@ Context | Edit Context</string>
<string name="ns_receive_temp_target_summary">Принимать временные цели, установленные через NS или NSClient</string>
<string name="ns_receive_profile_switch">Получать переключения профиля</string>
<string name="ns_receive_profile_switch_summary">Принимать переключения профиля, введенные через NS или NSClient</string>
<string name="ns_receive_offline_event">Принимать события APS автономно</string>
<string name="ns_receive_offline_event_summary">Принимать события APS введенные через NS или клиент NS автономно</string>
<string name="ns_receive_insulin">Принимать инсулин</string>
<string name="ns_receive_insulin_summary">Принимать инсулин, введенный через NS или NSClient (не подается, только рассчитывается как активный IOB)</string>
<string name="ns_receive_carbs">Принимать углеводы</string>
@ -921,4 +921,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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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

View file

@ -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)

View file

@ -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() {

View file

@ -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
}

View file

@ -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"
}

View file

@ -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"))

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