diff --git a/app/build.gradle b/app/build.gradle
index 959dd342da..84ad51a2e5 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -177,6 +177,7 @@ dependencies {
wearApp project(':wear')
implementation project(':core')
+ implementation project(':combo')
implementation project(':database')
implementation project(':dana')
implementation project(':danars')
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 60c668dcc4..aaf88349c4 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -58,7 +58,6 @@
Shows an ongoing notification with a short overview of what your loop is doing
Define a profile which is available offline.
Provides the profile you have defined in Nightscout
- Pump integration for Accu-Chek Combo pumps, requires having ruffy installed
Pump integration for people who do multiple daily injections for their diabetes therapy
Pump integration for pumps which don\'t have any driver yet (Open Loop)
Sensitivity is calculated the same way like Oref0, but you can specify timeframe to the past. Minimal carb absorption is calculated from max carb absorption time from preferences.
@@ -92,7 +91,6 @@
Bolus IOB
Run now
VIRTUAL PUMP
- OK
Last run
Input parameters
Glucose status
@@ -163,7 +161,6 @@
New suggestion available
Carbs Suggestion
Unsupported version of Nightscout
- LOOP DISABLED BY CONSTRAINTS
Basal IOB
Bolus constraint applied
Carbs constraint applied
@@ -233,7 +230,6 @@
Minimum number of minutes that must elapse between one remote bolus and the next
How many minutes must elapse, at least, between one bolus and the next
For your safety, to edit this preference you need to add at least 2 phone numbers.
- Bolus %1$.2f U delivered successfully
Going to deliver %1$.2f U
Bolus %1$.2f U delivered successfully
Meal Bolus %1$.2f U delivered successfully
@@ -241,8 +237,6 @@
Target %1$s for %2$d minutes set successfully
Temp Target canceled successfully
Allow remote commands via SMS
- Bolus stopped
- Stopping bolus
Loop has been disabled
Loop has been enabled
Loop is disabled
@@ -556,8 +550,6 @@
Cancel
Not all profiles loaded!
Values not stored!
- Accu-Chek Combo
- COMBO
Enable broadcasts to other apps (like xDrip+). Do not enable if you have more than one instance of AAPS or NSClient installed!
Enable local Broadcasts.
Duration [min]
@@ -602,7 +594,6 @@
Fat
]]>
Command is executed right now
- Pump unreachable
Missed BG readings
raise_urgent_alarms_as_android_notification
Use system notifications for alerts and notifications
@@ -650,40 +641,6 @@
Closed mode enabled
Maximal IOB set properly
BG available from selected source
- Programming pump for bolusing
- State
- Activity
- No connection for %1$d min
- %1$d%% (%2$d min remaining)
- %1$.1f %2$s (%3$s)
- Initializing
- Suspended due to error
- Suspended by user
- Running
- Cancelling TBR
- Setting TBR (%1$d%% / %2$d min)
- Bolusing (%1$.1f U)
- Refreshing
- Requested operation not supported by pump
- Unsafe usage: extended or multiwave boluses are active. Loop mode has been set to low-suspend only 6 hours. Only normal boluses are supported in loop mode
- Unsafe usage: the pump uses a different basal rate profile than the first. The loop has been disabled. Select the first profile on the pump and refresh.
- A bolus with the same amount was requested within the last two minutes. To prevent accidental double boluses and to guard against bugs this is disallowed.
- Now
- Reading pump history
- Setting basal profile
- Pump cartridge level is low
- Pump battery is low
- The pump is showing the error E%1$d: %2$s
- Low
- Empty
- Normal
- Pump clock update needed
- TBR CANCELLED warning was confirmed
- The pump could not be reached. No bolus was given
- Bolus delivery failed. It appears no bolus was delivered. To be sure, please check the pump to avoid a double bolus and then bolus again. To guard against bugs, boluses are not automatically retried.
- Only %1$.2f U of the requested bolus of %2$.2f U was delivered due to an error. Please check the pump to verify this and take appropriate actions.
- Delivering the bolus and verifying the pump\'s history failed, please check the pump. If a bolus was delivered, it will be added to treatments during the next connection to the pump.
- Not enough insulin for bolus left in reservoir
Extended bolus delivery error
Sight
enableSMB_always
@@ -763,23 +720,8 @@
Running dev version. Closed loop is disabled.
fromNSAreCommingFakedExtendedBoluses
Engineering mode enabled
- Reading basal profile
- The pump history has changed after the bolus calculation was performed. The bolus was not delivered. Please recalculate if a bolus is still needed.
- Bolus successfully delivered, but adding the treatment entry failed. This can happen if two small boluses of the same size are administered within the last two minutes. Please check the pump history and treatment entries and use the Careportal to add missing entries. Make sure not to add any entries for the exact same minute and same amount.
- Rejecting high temp since calculation didn\'t consider recently changed pump history
- Refreshing pump state
- The basal rate on the pump has changed and will be updated soon
- Basal rate changed on pump, but reading it failed
- Checking for history changes
- Multiple boluses with the same amount within the same minute were just imported. Only one record could be added to treatments. Please check the pump and manually add a bolus record using the Careportal tab. Make sure to create a bolus with a time no other bolus uses.
- \n\ndocumentation:\nhttps://androidaps.readthedocs.io\n\nfacebook:\nhttps://www.facebook.com/groups/AndroidAPSUsers
- The last bolus is older than 24 hours or is in the future. Please check the date on the pump is set correctly.
- Time/date of the delivered bolus on pump seems wrong, IOB is likely incorrect. Please check pump time/date.
ProfileSwitch missing. Please do a profile switch or press \"Activate Profile\" in the LocalProfile.
- Bolus count
- TBR count
Pump is not temp basal capable
- No valid basal rate read from pump
Closed loop mode disabled in preferences
Autosens disabled in preferences
SMB disabled in preferences
@@ -795,13 +737,11 @@
Basal set correctly
treatmentssafety_maxbolus
Limiting extended bolus to %1$.1f U because of %2$s
- Limiting max IOB to %1$.1f U because of %2$s
Limiting carbs to %1$d g because of %2$s
Limiting IOB to %1$.1f U because of %2$s
max value in preferences
hard limit
treatmentssafety_maxcarbs
- unsafe usage
openapsama_useautosens
Read status failed
Record pump site change
@@ -910,7 +850,6 @@
sensitivity_raises_target
Sensitivity raises target
When sensitivity is detected, raise the target glucose
- Invalid pump setup, check the docs and verify that the Quick Info menu is named QUICK INFO using the 360 configuration software.
keep_screen_on
Clean AndroidAPS started
Stored settings found
diff --git a/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt b/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt
index df2e00d3af..201af4160f 100644
--- a/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt
+++ b/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt
@@ -69,10 +69,11 @@ class ConstraintsCheckerTest : TestBaseWithProfile() {
@Mock lateinit var uploadQueue: UploadQueue
@Mock lateinit var uel: UserEntryLogger
@Mock lateinit var loggerUtils: LoggerUtils
+ @Mock lateinit var databaseHelper: DatabaseHelperInterface
- lateinit var danaPump: DanaPump
+ private lateinit var danaPump: DanaPump
- lateinit var constraintChecker: ConstraintChecker
+ private lateinit var constraintChecker: ConstraintChecker
private lateinit var safetyPlugin: SafetyPlugin
private lateinit var objectivesPlugin: ObjectivesPlugin
private lateinit var comboPlugin: ComboPlugin
@@ -123,7 +124,7 @@ class ConstraintsCheckerTest : TestBaseWithProfile() {
danaPump = DanaPump(aapsLogger, sp, injector)
hardLimits = HardLimits(aapsLogger, rxBus, sp, resourceHelper, context, nsUpload)
objectivesPlugin = ObjectivesPlugin(injector, aapsLogger, resourceHelper, activePlugin, sp, Config(), uel)
- comboPlugin = ComboPlugin(injector, aapsLogger, rxBus, resourceHelper, profileFunction, treatmentsInterface, sp, commandQueue, context)
+ comboPlugin = ComboPlugin(injector, aapsLogger, rxBus, resourceHelper, profileFunction, treatmentsInterface, sp, commandQueue, context, databaseHelper)
danaRPlugin = DanaRPlugin(injector, aapsLogger, aapsSchedulers, rxBus, context, resourceHelper, constraintChecker, activePlugin, sp, commandQueue, danaPump, dateUtil, fabricPrivacy)
danaRSPlugin = DanaRSPlugin(injector, aapsLogger, aapsSchedulers, rxBus, context, resourceHelper, constraintChecker, profileFunction, activePluginProvider, sp, commandQueue, danaPump, detailedBolusInfoStorage, fabricPrivacy, dateUtil)
insightPlugin = LocalInsightPlugin(injector, aapsLogger, rxBus, resourceHelper, treatmentsInterface, sp, commandQueue, profileFunction, nsUpload, context, uploadQueue, Config(), dateUtil)
diff --git a/combo/.gitignore b/combo/.gitignore
new file mode 100644
index 0000000000..796b96d1c4
--- /dev/null
+++ b/combo/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/combo/build.gradle b/combo/build.gradle
new file mode 100644
index 0000000000..8020051b31
--- /dev/null
+++ b/combo/build.gradle
@@ -0,0 +1,20 @@
+apply plugin: 'com.android.library'
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-kapt'
+apply plugin: 'com.hiya.jacoco-android'
+
+apply from: "${project.rootDir}/gradle/android_dependencies.gradle"
+apply from: "${project.rootDir}/gradle/android_module_dependencies.gradle"
+apply from: "${project.rootDir}/gradle/test_dependencies.gradle"
+
+
+android {
+ defaultConfig {
+ versionCode 1
+ versionName "1.0"
+ }
+}
+
+dependencies {
+ implementation project(':core')
+}
\ No newline at end of file
diff --git a/combo/consumer-rules.pro b/combo/consumer-rules.pro
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/combo/proguard-rules.pro b/combo/proguard-rules.pro
new file mode 100644
index 0000000000..481bb43481
--- /dev/null
+++ b/combo/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
\ No newline at end of file
diff --git a/combo/src/main/AndroidManifest.xml b/combo/src/main/AndroidManifest.xml
new file mode 100644
index 0000000000..559e7533ca
--- /dev/null
+++ b/combo/src/main/AndroidManifest.xml
@@ -0,0 +1,5 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/aidl/org/monkey/d/ruffy/ruffy/driver/IRTHandler.aidl b/combo/src/main/aidl/org/monkey/d/ruffy/ruffy/driver/IRTHandler.aidl
similarity index 100%
rename from app/src/main/aidl/org/monkey/d/ruffy/ruffy/driver/IRTHandler.aidl
rename to combo/src/main/aidl/org/monkey/d/ruffy/ruffy/driver/IRTHandler.aidl
diff --git a/app/src/main/aidl/org/monkey/d/ruffy/ruffy/driver/IRuffyService.aidl b/combo/src/main/aidl/org/monkey/d/ruffy/ruffy/driver/IRuffyService.aidl
similarity index 100%
rename from app/src/main/aidl/org/monkey/d/ruffy/ruffy/driver/IRuffyService.aidl
rename to combo/src/main/aidl/org/monkey/d/ruffy/ruffy/driver/IRuffyService.aidl
diff --git a/app/src/main/aidl/org/monkey/d/ruffy/ruffy/driver/display/Menu.aidl b/combo/src/main/aidl/org/monkey/d/ruffy/ruffy/driver/display/Menu.aidl
similarity index 100%
rename from app/src/main/aidl/org/monkey/d/ruffy/ruffy/driver/display/Menu.aidl
rename to combo/src/main/aidl/org/monkey/d/ruffy/ruffy/driver/display/Menu.aidl
diff --git a/app/src/main/aidl/org/monkey/d/ruffy/ruffy/driver/package-info.java b/combo/src/main/aidl/org/monkey/d/ruffy/ruffy/driver/package-info.java
similarity index 100%
rename from app/src/main/aidl/org/monkey/d/ruffy/ruffy/driver/package-info.java
rename to combo/src/main/aidl/org/monkey/d/ruffy/ruffy/driver/package-info.java
diff --git a/combo/src/main/java/info/nightscout/androidaps/combo/di/ComboModule.kt b/combo/src/main/java/info/nightscout/androidaps/combo/di/ComboModule.kt
new file mode 100644
index 0000000000..ae64ed1683
--- /dev/null
+++ b/combo/src/main/java/info/nightscout/androidaps/combo/di/ComboModule.kt
@@ -0,0 +1,7 @@
+package info.nightscout.androidaps.combo.di
+
+import dagger.Module
+
+@Module(includes = [
+])
+open class ComboModule
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboFragment.java b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboFragment.java
similarity index 93%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboFragment.java
rename to combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboFragment.java
index fd76ef6ae9..d2358de9d7 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboFragment.java
+++ b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboFragment.java
@@ -16,13 +16,13 @@ import androidx.fragment.app.FragmentActivity;
import javax.inject.Inject;
import dagger.android.support.DaggerFragment;
-import info.nightscout.androidaps.R;
+import info.nightscout.androidaps.combo.R;
+import info.nightscout.androidaps.interfaces.CommandQueueProvider;
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
import info.nightscout.androidaps.plugins.pump.combo.events.EventComboPumpUpdateGUI;
import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.PumpState;
import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.history.Bolus;
import info.nightscout.androidaps.queue.Callback;
-import info.nightscout.androidaps.queue.CommandQueue;
import info.nightscout.androidaps.queue.events.EventQueueChanged;
import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.FabricPrivacy;
@@ -31,9 +31,9 @@ import info.nightscout.androidaps.utils.rx.AapsSchedulers;
import info.nightscout.androidaps.utils.sharedPreferences.SP;
import io.reactivex.disposables.CompositeDisposable;
-public class ComboFragment extends DaggerFragment implements View.OnClickListener {
+public class ComboFragment extends DaggerFragment {
@Inject ComboPlugin comboPlugin;
- @Inject CommandQueue commandQueue;
+ @Inject CommandQueueProvider commandQueue;
@Inject ResourceHelper resourceHelper;
@Inject RxBusWrapper rxBus;
@Inject SP sp;
@@ -71,7 +71,15 @@ public class ComboFragment extends DaggerFragment implements View.OnClickListene
tbrCount = view.findViewById(R.id.combo_tbr_count);
refreshButton = view.findViewById(R.id.combo_refresh_button);
- refreshButton.setOnClickListener(this);
+ refreshButton.setOnClickListener(v -> {
+ refreshButton.setEnabled(false);
+ commandQueue.readStatus("User request", new Callback() {
+ @Override
+ public void run() {
+ runOnUiThread(() -> refreshButton.setEnabled(true));
+ }
+ });
+ });
return view;
}
@@ -105,21 +113,6 @@ public class ComboFragment extends DaggerFragment implements View.OnClickListene
}
}
- @Override
- public void onClick(View view) {
- switch (view.getId()) {
- case R.id.combo_refresh_button:
- refreshButton.setEnabled(false);
- commandQueue.readStatus("User request", new Callback() {
- @Override
- public void run() {
- runOnUiThread(() -> refreshButton.setEnabled(true));
- }
- });
- break;
- }
- }
-
public void updateGui() {
// state
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPlugin.java b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPlugin.java
similarity index 98%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPlugin.java
rename to combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPlugin.java
index 354468f7aa..cdf9e416d8 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPlugin.java
+++ b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPlugin.java
@@ -6,6 +6,7 @@ import android.os.SystemClock;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
+import org.jetbrains.annotations.NotNull;
import org.json.JSONObject;
import java.util.ArrayList;
@@ -20,8 +21,7 @@ import javax.inject.Inject;
import javax.inject.Singleton;
import dagger.android.HasAndroidInjector;
-import info.nightscout.androidaps.MainApp;
-import info.nightscout.androidaps.R;
+import info.nightscout.androidaps.combo.R;
import info.nightscout.androidaps.data.DetailedBolusInfo;
import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.data.PumpEnactResult;
@@ -35,6 +35,7 @@ import info.nightscout.androidaps.events.EventRefreshOverview;
import info.nightscout.androidaps.interfaces.CommandQueueProvider;
import info.nightscout.androidaps.interfaces.Constraint;
import info.nightscout.androidaps.interfaces.ConstraintsInterface;
+import info.nightscout.androidaps.interfaces.DatabaseHelperInterface;
import info.nightscout.androidaps.interfaces.PluginDescription;
import info.nightscout.androidaps.interfaces.PluginType;
import info.nightscout.androidaps.interfaces.ProfileFunction;
@@ -64,10 +65,8 @@ import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.history.PumpH
import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.history.PumpHistoryRequest;
import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.history.Tdd;
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
-import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.InstanceId;
-import info.nightscout.androidaps.utils.TimeChangeType;
import info.nightscout.androidaps.utils.resources.ResourceHelper;
import info.nightscout.androidaps.utils.sharedPreferences.SP;
@@ -79,13 +78,13 @@ public class ComboPlugin extends PumpPluginBase implements PumpInterface, Constr
static final String COMBO_TBRS_SET = "combo_tbrs_set";
static final String COMBO_BOLUSES_DELIVERED = "combo_boluses_delivered";
- private final ResourceHelper resourceHelper;
private final ProfileFunction profileFunction;
private final TreatmentsInterface treatmentsPlugin;
private final info.nightscout.androidaps.utils.sharedPreferences.SP sp;
private RxBusWrapper rxBus;
private final CommandQueueProvider commandQueue;
private final Context context;
+ private final DatabaseHelperInterface databaseHelper;
private final static PumpDescription pumpDescription = new PumpDescription();
@@ -140,7 +139,8 @@ public class ComboPlugin extends PumpPluginBase implements PumpInterface, Constr
TreatmentsInterface treatmentsPlugin,
SP sp,
CommandQueueProvider commandQueue,
- Context context
+ Context context,
+ DatabaseHelperInterface databaseHelper
) {
super(new PluginDescription()
.mainType(PluginType.PUMP)
@@ -152,12 +152,12 @@ public class ComboPlugin extends PumpPluginBase implements PumpInterface, Constr
injector, aapsLogger, resourceHelper, commandQueue
);
this.rxBus = rxBus;
- this.resourceHelper = resourceHelper;
this.profileFunction = profileFunction;
this.treatmentsPlugin = treatmentsPlugin;
this.sp = sp;
this.commandQueue = commandQueue;
this.context = context;
+ this.databaseHelper = databaseHelper;
pumpDescription.setPumpDescription(PumpType.AccuChekCombo);
}
@@ -752,9 +752,9 @@ public class ComboPlugin extends PumpPluginBase implements PumpInterface, Constr
}
if (adjustedPercent % 10 != 0) {
- Long rounded = Math.round(adjustedPercent / 10d) * 10;
+ long rounded = Math.round(adjustedPercent / 10d) * 10;
getAapsLogger().debug(LTag.PUMP, "Rounded requested percentage:" + adjustedPercent + " -> " + rounded);
- adjustedPercent = rounded.intValue();
+ adjustedPercent = (int) rounded;
}
// do a soft TBR-cancel when requested rate was rounded to 100% (>94% && <104%)
@@ -964,8 +964,7 @@ public class ComboPlugin extends PumpPluginBase implements PumpInterface, Constr
checkAndResolveTbrMismatch(preCheckResult.state);
checkPumpTime(preCheckResult.state);
checkBasalRate(preCheckResult.state);
- CommandResult historyCheckError = checkHistory();
- return historyCheckError;
+ return checkHistory();
} else {
long now = System.currentTimeMillis();
TemporaryBasal aapsTbr = treatmentsPlugin.getTempBasalFromHistory(now);
@@ -1256,7 +1255,7 @@ public class ComboPlugin extends PumpPluginBase implements PumpInterface, Constr
}
@NonNull @Override
- public JSONObject getJSONStatus(Profile profile, String profileName, String version) {
+ public JSONObject getJSONStatus(@NotNull Profile profile, @NotNull String profileName, @NotNull String version) {
if (!pump.initialized) {
return null;
}
@@ -1360,7 +1359,7 @@ public class ComboPlugin extends PumpPluginBase implements PumpInterface, Constr
Collection uniqueColl = map.values();
for (TDD currTdd : uniqueColl) {
- MainApp.getDbHelper().createOrUpdateTDD(currTdd);
+ databaseHelper.createOrUpdateTDD(currTdd);
}
}
}
@@ -1390,10 +1389,4 @@ public class ComboPlugin extends PumpPluginBase implements PumpInterface, Constr
public boolean canHandleDST() {
return false;
}
-
- @Override
- public void timezoneOrDSTChanged(TimeChangeType changeType) {
- }
-
-
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPump.java b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPump.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPump.java
rename to combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPump.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/events/EventComboPumpUpdateGUI.kt b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/events/EventComboPumpUpdateGUI.kt
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/events/EventComboPumpUpdateGUI.kt
rename to combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/events/EventComboPumpUpdateGUI.kt
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/BasalProfile.java b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/BasalProfile.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/BasalProfile.java
rename to combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/BasalProfile.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/BolusProgressReporter.java b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/BolusProgressReporter.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/BolusProgressReporter.java
rename to combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/BolusProgressReporter.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/CommandResult.java b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/CommandResult.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/CommandResult.java
rename to combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/CommandResult.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/PumpErrorCodes.java b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/PumpErrorCodes.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/PumpErrorCodes.java
rename to combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/PumpErrorCodes.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/PumpState.java b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/PumpState.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/PumpState.java
rename to combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/PumpState.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/PumpWarningCodes.java b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/PumpWarningCodes.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/PumpWarningCodes.java
rename to combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/PumpWarningCodes.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/RuffyCommands.java b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/RuffyCommands.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/RuffyCommands.java
rename to combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/RuffyCommands.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/RuffyScripter.java b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/RuffyScripter.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/RuffyScripter.java
rename to combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/RuffyScripter.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/WarningOrErrorCode.java b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/WarningOrErrorCode.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/WarningOrErrorCode.java
rename to combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/WarningOrErrorCode.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/BaseCommand.java b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/BaseCommand.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/BaseCommand.java
rename to combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/BaseCommand.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/BolusCommand.java b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/BolusCommand.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/BolusCommand.java
rename to combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/BolusCommand.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/CancelTbrCommand.java b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/CancelTbrCommand.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/CancelTbrCommand.java
rename to combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/CancelTbrCommand.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/Command.java b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/Command.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/Command.java
rename to combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/Command.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/CommandException.java b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/CommandException.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/CommandException.java
rename to combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/CommandException.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/ConfirmAlertCommand.java b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/ConfirmAlertCommand.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/ConfirmAlertCommand.java
rename to combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/ConfirmAlertCommand.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/ReadBasalProfileCommand.java b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/ReadBasalProfileCommand.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/ReadBasalProfileCommand.java
rename to combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/ReadBasalProfileCommand.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/ReadHistoryCommand.java b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/ReadHistoryCommand.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/ReadHistoryCommand.java
rename to combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/ReadHistoryCommand.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/ReadPumpStateCommand.java b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/ReadPumpStateCommand.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/ReadPumpStateCommand.java
rename to combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/ReadPumpStateCommand.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/ReadQuickInfoCommand.java b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/ReadQuickInfoCommand.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/ReadQuickInfoCommand.java
rename to combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/ReadQuickInfoCommand.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/SetBasalProfileCommand.java b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/SetBasalProfileCommand.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/SetBasalProfileCommand.java
rename to combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/SetBasalProfileCommand.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/SetTbrCommand.java b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/SetTbrCommand.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/SetTbrCommand.java
rename to combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/SetTbrCommand.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/Bolus.java b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/Bolus.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/Bolus.java
rename to combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/Bolus.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/HistoryRecord.java b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/HistoryRecord.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/HistoryRecord.java
rename to combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/HistoryRecord.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/PumpAlert.java b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/PumpAlert.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/PumpAlert.java
rename to combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/PumpAlert.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/PumpHistory.java b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/PumpHistory.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/PumpHistory.java
rename to combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/PumpHistory.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/PumpHistoryRequest.java b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/PumpHistoryRequest.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/PumpHistoryRequest.java
rename to combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/PumpHistoryRequest.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/Tbr.java b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/Tbr.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/Tbr.java
rename to combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/Tbr.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/Tdd.java b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/Tdd.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/Tdd.java
rename to combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/Tdd.java
diff --git a/app/src/main/java/org/monkey/d/ruffy/ruffy/driver/display/Menu.java b/combo/src/main/java/org/monkey/d/ruffy/ruffy/driver/display/Menu.java
similarity index 100%
rename from app/src/main/java/org/monkey/d/ruffy/ruffy/driver/display/Menu.java
rename to combo/src/main/java/org/monkey/d/ruffy/ruffy/driver/display/Menu.java
diff --git a/app/src/main/java/org/monkey/d/ruffy/ruffy/driver/display/MenuAttribute.java b/combo/src/main/java/org/monkey/d/ruffy/ruffy/driver/display/MenuAttribute.java
similarity index 100%
rename from app/src/main/java/org/monkey/d/ruffy/ruffy/driver/display/MenuAttribute.java
rename to combo/src/main/java/org/monkey/d/ruffy/ruffy/driver/display/MenuAttribute.java
diff --git a/app/src/main/java/org/monkey/d/ruffy/ruffy/driver/display/MenuType.java b/combo/src/main/java/org/monkey/d/ruffy/ruffy/driver/display/MenuType.java
similarity index 100%
rename from app/src/main/java/org/monkey/d/ruffy/ruffy/driver/display/MenuType.java
rename to combo/src/main/java/org/monkey/d/ruffy/ruffy/driver/display/MenuType.java
diff --git a/app/src/main/java/org/monkey/d/ruffy/ruffy/driver/display/menu/BolusType.java b/combo/src/main/java/org/monkey/d/ruffy/ruffy/driver/display/menu/BolusType.java
similarity index 100%
rename from app/src/main/java/org/monkey/d/ruffy/ruffy/driver/display/menu/BolusType.java
rename to combo/src/main/java/org/monkey/d/ruffy/ruffy/driver/display/menu/BolusType.java
diff --git a/app/src/main/java/org/monkey/d/ruffy/ruffy/driver/display/menu/MenuBlink.java b/combo/src/main/java/org/monkey/d/ruffy/ruffy/driver/display/menu/MenuBlink.java
similarity index 100%
rename from app/src/main/java/org/monkey/d/ruffy/ruffy/driver/display/menu/MenuBlink.java
rename to combo/src/main/java/org/monkey/d/ruffy/ruffy/driver/display/menu/MenuBlink.java
diff --git a/app/src/main/java/org/monkey/d/ruffy/ruffy/driver/display/menu/MenuDate.java b/combo/src/main/java/org/monkey/d/ruffy/ruffy/driver/display/menu/MenuDate.java
similarity index 100%
rename from app/src/main/java/org/monkey/d/ruffy/ruffy/driver/display/menu/MenuDate.java
rename to combo/src/main/java/org/monkey/d/ruffy/ruffy/driver/display/menu/MenuDate.java
diff --git a/app/src/main/java/org/monkey/d/ruffy/ruffy/driver/display/menu/MenuTime.java b/combo/src/main/java/org/monkey/d/ruffy/ruffy/driver/display/menu/MenuTime.java
similarity index 100%
rename from app/src/main/java/org/monkey/d/ruffy/ruffy/driver/display/menu/MenuTime.java
rename to combo/src/main/java/org/monkey/d/ruffy/ruffy/driver/display/menu/MenuTime.java
diff --git a/app/src/main/res/drawable/ic_combo.xml b/combo/src/main/res/drawable/ic_combo.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_combo.xml
rename to combo/src/main/res/drawable/ic_combo.xml
diff --git a/app/src/main/res/drawable/ic_combo_128.xml b/combo/src/main/res/drawable/ic_combo_128.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_combo_128.xml
rename to combo/src/main/res/drawable/ic_combo_128.xml
diff --git a/app/src/main/res/layout/combopump_fragment.xml b/combo/src/main/res/layout/combopump_fragment.xml
similarity index 100%
rename from app/src/main/res/layout/combopump_fragment.xml
rename to combo/src/main/res/layout/combopump_fragment.xml
diff --git a/combo/src/main/res/values/strings.xml b/combo/src/main/res/values/strings.xml
new file mode 100644
index 0000000000..5c41d1ab90
--- /dev/null
+++ b/combo/src/main/res/values/strings.xml
@@ -0,0 +1,57 @@
+
+
+ Accu-Chek Combo
+ COMBO
+ Pump integration for Accu-Chek Combo pumps, requires having ruffy installed
+ Programming pump for bolusing
+ State
+ Activity
+ No connection for %1$d min
+ %1$d%% (%2$d min remaining)
+ %1$.1f %2$s (%3$s)
+ Initializing
+ Suspended due to error
+ Suspended by user
+ Running
+ Cancelling TBR
+ Setting TBR (%1$d%% / %2$d min)
+ Bolusing (%1$.1f U)
+ Refreshing
+ Requested operation not supported by pump
+ Unsafe usage: extended or multiwave boluses are active. Loop mode has been set to low-suspend only 6 hours. Only normal boluses are supported in loop mode
+ Unsafe usage: the pump uses a different basal rate profile than the first. The loop has been disabled. Select the first profile on the pump and refresh.
+ A bolus with the same amount was requested within the last two minutes. To prevent accidental double boluses and to guard against bugs this is disallowed.
+ Now
+ Reading pump history
+ Setting basal profile
+ Pump cartridge level is low
+ Pump battery is low
+ The pump is showing the error E%1$d: %2$s
+ Low
+ Empty
+ Normal
+ Pump clock update needed
+ TBR CANCELLED warning was confirmed
+ The pump could not be reached. No bolus was given
+ Bolus delivery failed. It appears no bolus was delivered. To be sure, please check the pump to avoid a double bolus and then bolus again. To guard against bugs, boluses are not automatically retried.
+ Only %1$.2f U of the requested bolus of %2$.2f U was delivered due to an error. Please check the pump to verify this and take appropriate actions.
+ Delivering the bolus and verifying the pump\'s history failed, please check the pump. If a bolus was delivered, it will be added to treatments during the next connection to the pump.
+ Not enough insulin for bolus left in reservoir
+ Invalid pump setup, check the docs and verify that the Quick Info menu is named QUICK INFO using the 360 configuration software.
+ Reading basal profile
+ The pump history has changed after the bolus calculation was performed. The bolus was not delivered. Please recalculate if a bolus is still needed.
+ Bolus successfully delivered, but adding the treatment entry failed. This can happen if two small boluses of the same size are administered within the last two minutes. Please check the pump history and treatment entries and use the Careportal to add missing entries. Make sure not to add any entries for the exact same minute and same amount.
+ Rejecting high temp since calculation didn\'t consider recently changed pump history
+ Refreshing pump state
+ The basal rate on the pump has changed and will be updated soon
+ Basal rate changed on pump, but reading it failed
+ Checking for history changes
+ Multiple boluses with the same amount within the same minute were just imported. Only one record could be added to treatments. Please check the pump and manually add a bolus record using the Careportal tab. Make sure to create a bolus with a time no other bolus uses.
+ \n\ndocumentation:\nhttps://androidaps.readthedocs.io\n\nfacebook:\nhttps://www.facebook.com/groups/AndroidAPSUsers
+ The last bolus is older than 24 hours or is in the future. Please check the date on the pump is set correctly.
+ Time/date of the delivered bolus on pump seems wrong, IOB is likely incorrect. Please check pump time/date.
+ Bolus count
+ TBR count
+ Bolus stopped
+ Stopping bolus
+
\ No newline at end of file
diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/combo/ComboPluginTest.kt b/combo/src/test/java/info/nightscout/androidaps/plugins/pump/combo/ComboPluginTest.kt
similarity index 76%
rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/combo/ComboPluginTest.kt
rename to combo/src/test/java/info/nightscout/androidaps/plugins/pump/combo/ComboPluginTest.kt
index bf455dd0bc..78207ea792 100644
--- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/combo/ComboPluginTest.kt
+++ b/combo/src/test/java/info/nightscout/androidaps/plugins/pump/combo/ComboPluginTest.kt
@@ -4,19 +4,10 @@ import android.content.Context
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.TestBase
-import info.nightscout.androidaps.MainApp
-import info.nightscout.androidaps.R
-import info.nightscout.androidaps.interfaces.ActivePluginProvider
-import info.nightscout.androidaps.interfaces.CommandQueueProvider
-import info.nightscout.androidaps.interfaces.Constraint
-import info.nightscout.androidaps.interfaces.PluginType
+import info.nightscout.androidaps.combo.R
+import info.nightscout.androidaps.interfaces.*
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
-import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
-import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
-import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.history.Bolus
-import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
-import info.nightscout.androidaps.queue.CommandQueue
import info.nightscout.androidaps.utils.resources.ResourceHelper
import info.nightscout.androidaps.utils.sharedPreferences.SP
import org.junit.Assert
@@ -29,17 +20,17 @@ import org.powermock.core.classloader.annotations.PrepareForTest
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
-@PrepareForTest(MainApp::class, ConfigBuilderPlugin::class, ConstraintChecker::class, Context::class, CommandQueue::class)
+@PrepareForTest(Context::class)
class ComboPluginTest : TestBase() {
@Mock lateinit var resourceHelper: ResourceHelper
@Mock lateinit var profileFunction: ProfileFunction
- @Mock lateinit var constraintChecker: ConstraintChecker
@Mock lateinit var activePlugin: ActivePluginProvider
@Mock lateinit var commandQueue: CommandQueueProvider
- @Mock lateinit var treatmentsPlugin: TreatmentsPlugin
+ @Mock lateinit var treatmentsPlugin: TreatmentsInterface
@Mock lateinit var sp: SP
@Mock lateinit var context: Context
+ @Mock lateinit var databaseHelper: DatabaseHelperInterface
val injector = HasAndroidInjector {
AndroidInjector {
@@ -51,7 +42,7 @@ class ComboPluginTest : TestBase() {
@Before
fun prepareMocks() {
`when`(resourceHelper.gs(R.string.novalidbasalrate)).thenReturn("No valid basal rate read from pump")
- comboPlugin = ComboPlugin(injector, aapsLogger, RxBusWrapper(aapsSchedulers), resourceHelper, profileFunction, treatmentsPlugin, sp, commandQueue, context)
+ comboPlugin = ComboPlugin(injector, aapsLogger, RxBusWrapper(aapsSchedulers), resourceHelper, profileFunction, treatmentsPlugin, sp, commandQueue, context, databaseHelper)
}
@Test
diff --git a/combo/src/test/java/info/nightscout/androidaps/plugins/pump/combo/TestBase.kt b/combo/src/test/java/info/nightscout/androidaps/plugins/pump/combo/TestBase.kt
new file mode 100644
index 0000000000..573c9dcbcc
--- /dev/null
+++ b/combo/src/test/java/info/nightscout/androidaps/plugins/pump/combo/TestBase.kt
@@ -0,0 +1,40 @@
+package info.nightscout.androidaps
+
+import info.nightscout.androidaps.logging.AAPSLoggerTest
+import info.nightscout.androidaps.utils.rx.AapsSchedulers
+import info.nightscout.androidaps.utils.rx.TestAapsSchedulers
+import org.junit.Before
+import org.junit.Rule
+import org.mockito.Mockito
+import org.mockito.junit.MockitoJUnit
+import org.mockito.junit.MockitoRule
+import java.util.*
+
+@Suppress("SpellCheckingInspection")
+open class TestBase {
+
+ val aapsLogger = AAPSLoggerTest()
+ val aapsSchedulers: AapsSchedulers = TestAapsSchedulers()
+
+ // Add a JUnit rule that will setup the @Mock annotated vars and log.
+ // Another possibility would be to add `MockitoAnnotations.initMocks(this) to the setup method.
+ @get:Rule
+ val mockitoRule: MockitoRule = MockitoJUnit.rule()
+
+ @Before
+ fun setupLocale() {
+ Locale.setDefault(Locale.ENGLISH)
+ System.setProperty("disableFirebase", "true")
+ }
+
+ // Workaround for Kotlin nullability.
+ // https://medium.com/@elye.project/befriending-kotlin-and-mockito-1c2e7b0ef791
+ // https://stackoverflow.com/questions/30305217/is-it-possible-to-use-mockito-in-kotlin
+ fun anyObject(): T {
+ Mockito.any()
+ return uninitialized()
+ }
+
+ @Suppress("Unchecked_Cast")
+ fun uninitialized(): T = null as T
+}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/events/EventUpdateGui.kt b/core/src/main/java/info/nightscout/androidaps/events/EventUpdateGui.kt
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/events/EventUpdateGui.kt
rename to core/src/main/java/info/nightscout/androidaps/events/EventUpdateGui.kt
diff --git a/app/src/main/res/raw/alarm.mp3 b/core/src/main/res/raw/alarm.mp3
similarity index 100%
rename from app/src/main/res/raw/alarm.mp3
rename to core/src/main/res/raw/alarm.mp3
diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml
index 7d22c30592..fb51c24e8b 100644
--- a/core/src/main/res/values/strings.xml
+++ b/core/src/main/res/values/strings.xml
@@ -99,6 +99,13 @@
Pairing
Yes
No
+ LOOP DISABLED BY CONSTRAINTS
+ Bolus %1$.2f U delivered successfully
+ OK
+ No valid basal rate read from pump
+ Limiting max IOB to %1$.1f U because of %2$s
+ unsafe usage
+ Pump unreachable
Limiting max basal rate to %1$.2f U/h because of %2$s
diff --git a/crowdin.yml b/crowdin.yml
index e104a81abd..c925871f8f 100644
--- a/crowdin.yml
+++ b/crowdin.yml
@@ -15,6 +15,8 @@ files:
translation: /core/src/main/res/values-%android_code%/validator.xml
- source: /core/src/main/res/values/strings.xml
translation: /core/src/main/res/values-%android_code%/strings.xml
+ - source: /combo/src/main/res/values/strings.xml
+ translation: /combo/src/main/res/values-%android_code%/strings.xml
- source: /dana/src/main/res/values/strings.xml
translation: /dana/src/main/res/values-%android_code%/strings.xml
- source: /medtronic/src/main/res/values/strings.xml
diff --git a/settings.gradle b/settings.gradle
index 2090bffc04..57fc55802f 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,2 +1,12 @@
-include ':app', ':database', ':wear', ':core', ':dana', ':danar', ':danars', ':rileylink', ':medtronic', ':omnipod-eros', ':omnipod-dash'
-
+include ':app'
+include ':wear'
+include ':database'
+include ':core'
+include ':combo'
+include ':dana'
+include ':danar'
+include ':danars'
+include ':rileylink'
+include ':medtronic'
+include ':omnipod-eros'
+include ':omnipod-dash'
\ No newline at end of file