Merge branch 'medtronic_andy' of https://github.com/andyrozman/AndroidAPS into medtronic_andy
This commit is contained in:
commit
3489f4a746
|
@ -68,7 +68,7 @@ android {
|
|||
buildConfigField "String", "VERSION", '"' + version + '"'
|
||||
buildConfigField "String", "BUILDVERSION", '"' + generateGitBuild() + '-' + generateDate() + '"'
|
||||
buildConfigField "String", "HEAD", '"' + generateGitBuild() + '"'
|
||||
buildConfigField "String", "DEV_VERSION", '"2.2.1"'
|
||||
buildConfigField "String", "DEV_VERSION", '"2.2.1-dev"'
|
||||
buildConfigField "String", "DEV_DATE", '"30.3.2019"'
|
||||
buildConfigField "String", "DEV_CHECKIN", '"361ffa91c8c66d3901b1e8ae92b8b54bf0e2a4ce"'
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
|
@ -82,7 +82,7 @@ android {
|
|||
// TODO remove once wear dependency com.google.android.gms:play-services-wearable:7.3.0
|
||||
// has been upgraded (requiring significant code changes), which currently fails release
|
||||
// build with a deprecation warning
|
||||
abortOnError false
|
||||
// abortOnError false
|
||||
// (disabled entirely to avoid reports on the error, which would still be displayed
|
||||
// and it's easy to overlook that it's ignored)
|
||||
checkReleaseBuilds false
|
||||
|
@ -95,7 +95,7 @@ android {
|
|||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
debug {
|
||||
testCoverageEnabled(project.hasProperty('coverage') ? true : false)
|
||||
testCoverageEnabled(project.hasProperty('coverage'))
|
||||
}
|
||||
}
|
||||
productFlavors {
|
||||
|
@ -104,7 +104,7 @@ android {
|
|||
applicationId "info.nightscout.androidaps"
|
||||
dimension "standard"
|
||||
resValue "string", "app_name", "AndroidAPS"
|
||||
versionName version + "-pumpcontrol"
|
||||
versionName version
|
||||
manifestPlaceholders = [
|
||||
appIcon: "@mipmap/ic_launcher",
|
||||
appIconRound: "@mipmap/ic_launcher_round"
|
||||
|
@ -114,7 +114,7 @@ android {
|
|||
applicationId "info.nightscout.aapspumpcontrol"
|
||||
dimension "standard"
|
||||
resValue "string", "app_name", "Pumpcontrol"
|
||||
versionName version
|
||||
versionName version + "-pumpcontrol"
|
||||
manifestPlaceholders = [
|
||||
appIcon: "@mipmap/ic_pumpcontrol",
|
||||
appIconRound: "@null"
|
||||
|
@ -188,18 +188,17 @@ dependencies {
|
|||
implementation "com.android.support:design:${supportLibraryVersion}"
|
||||
implementation "com.android.support:percent:${supportLibraryVersion}"
|
||||
implementation "com.wdullaer:materialdatetimepicker:2.3.0"
|
||||
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
|
||||
implementation "com.squareup:otto:1.3.7"
|
||||
implementation "com.j256.ormlite:ormlite-core:${ormLiteVersion}"
|
||||
implementation "com.j256.ormlite:ormlite-android:${ormLiteVersion}"
|
||||
implementation("com.github.tony19:logback-android-classic:1.1.1-6") {
|
||||
exclude group: "com.google.android", module: "android"
|
||||
}
|
||||
implementation "org.apache.commons:commons-lang3:3.6"
|
||||
implementation "org.slf4j:slf4j-api:1.7.12"
|
||||
implementation "org.apache.commons:commons-lang3:3.7"
|
||||
implementation "org.slf4j:slf4j-api:1.7.21"
|
||||
implementation "com.jjoe64:graphview:4.0.1"
|
||||
implementation "com.joanzapata.iconify:android-iconify-fontawesome:2.1.1"
|
||||
implementation "com.google.android.gms:play-services-wearable:7.5.0"
|
||||
implementation 'com.google.android.gms:play-services-wearable:10.2.1'
|
||||
implementation(name: "android-edittext-validator-v1.3.4-mod", ext: "aar")
|
||||
implementation(name: "sightparser-release", ext: "aar")
|
||||
implementation 'com.madgag.spongycastle:core:1.58.0.0'
|
||||
|
@ -211,8 +210,8 @@ dependencies {
|
|||
// excluding org.json which is provided by Android
|
||||
exclude group: "org.json", module: "json"
|
||||
}
|
||||
implementation "com.google.code.gson:gson:2.7"
|
||||
implementation "com.google.guava:guava:20.0"
|
||||
implementation "com.google.code.gson:gson:2.8.2"
|
||||
implementation "com.google.guava:guava:24.1-jre"
|
||||
|
||||
implementation "net.danlew:android.joda:2.9.9.1"
|
||||
implementation "uk.com.robust-it:cloning:1.9.9"
|
||||
|
@ -224,17 +223,19 @@ dependencies {
|
|||
|
||||
testImplementation "junit:junit:4.12"
|
||||
testImplementation "org.json:json:20140107"
|
||||
testImplementation "org.mockito:mockito-core:2.7.22"
|
||||
testImplementation "org.mockito:mockito-core:2.8.47"
|
||||
testImplementation "org.powermock:powermock-api-mockito2:${powermockVersion}"
|
||||
testImplementation "org.powermock:powermock-module-junit4-rule-agent:${powermockVersion}"
|
||||
testImplementation "org.powermock:powermock-module-junit4-rule:${powermockVersion}"
|
||||
testImplementation "org.powermock:powermock-module-junit4:${powermockVersion}"
|
||||
testImplementation "joda-time:joda-time:2.9.4.2"
|
||||
testImplementation "joda-time:joda-time:2.9.9"
|
||||
testImplementation "com.google.truth:truth:0.39"
|
||||
testImplementation 'org.robolectric:robolectric:3.8'
|
||||
testImplementation "org.skyscreamer:jsonassert:1.5.0"
|
||||
testImplementation "org.hamcrest:hamcrest-all:1.3"
|
||||
testImplementation "uk.org.lidalia:slf4j-test:1.2.0"
|
||||
|
||||
androidTestImplementation "org.mockito:mockito-core:2.7.22"
|
||||
androidTestImplementation "org.mockito:mockito-core:2.8.47"
|
||||
androidTestImplementation "com.google.dexmaker:dexmaker:${dexmakerVersion}"
|
||||
androidTestImplementation "com.google.dexmaker:dexmaker-mockito:${dexmakerVersion}"
|
||||
}
|
||||
|
|
|
@ -1,12 +1,25 @@
|
|||
package info.nightscout.androidaps;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.danlew.android.joda.JodaTimeAndroid;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import android.app.Application;
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.res.Resources;
|
||||
import android.os.SystemClock;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.PluralsRes;
|
||||
import android.support.v4.content.LocalBroadcastManager;
|
||||
import android.util.Log;
|
||||
|
||||
import com.crashlytics.android.Crashlytics;
|
||||
import com.crashlytics.android.answers.Answers;
|
||||
|
@ -15,14 +28,6 @@ import com.squareup.otto.Bus;
|
|||
import com.squareup.otto.LoggingBus;
|
||||
import com.squareup.otto.ThreadEnforcer;
|
||||
|
||||
import net.danlew.android.joda.JodaTimeAndroid;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import info.nightscout.androidaps.data.ConstraintChecker;
|
||||
import info.nightscout.androidaps.db.DatabaseHelper;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
|
@ -93,8 +98,8 @@ import info.nightscout.androidaps.utils.FabricPrivacy;
|
|||
import info.nightscout.androidaps.utils.SP;
|
||||
import io.fabric.sdk.android.Fabric;
|
||||
|
||||
|
||||
public class MainApp extends Application {
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(L.CORE);
|
||||
private static KeepAliveReceiver keepAliveReceiver;
|
||||
|
||||
|
@ -112,10 +117,12 @@ public class MainApp extends Application {
|
|||
private static AckAlarmReceiver ackAlarmReciever = new AckAlarmReceiver();
|
||||
private static DBAccessReceiver dbAccessReciever = new DBAccessReceiver();
|
||||
private LocalBroadcastManager lbm;
|
||||
private BroadcastReceiver btReceiver; // used for RileyLink (Medtronic and Omnipod)
|
||||
|
||||
public static boolean devBranch;
|
||||
public static boolean engineeringMode;
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
|
@ -150,12 +157,15 @@ public class MainApp extends Application {
|
|||
|
||||
registerLocalBroadcastReceiver();
|
||||
|
||||
setBTReceiver();
|
||||
|
||||
if (pluginsList == null) {
|
||||
pluginsList = new ArrayList<>();
|
||||
// Register all tabs in app here
|
||||
pluginsList.add(OverviewPlugin.getPlugin());
|
||||
pluginsList.add(IobCobCalculatorPlugin.getPlugin());
|
||||
if (Config.ACTION) pluginsList.add(ActionsFragment.getPlugin());
|
||||
if (Config.ACTION)
|
||||
pluginsList.add(ActionsFragment.getPlugin());
|
||||
pluginsList.add(InsulinOrefRapidActingPlugin.getPlugin());
|
||||
pluginsList.add(InsulinOrefUltraRapidActingPlugin.getPlugin());
|
||||
pluginsList.add(InsulinOrefFreePeakPlugin.getPlugin());
|
||||
|
@ -163,29 +173,45 @@ public class MainApp extends Application {
|
|||
pluginsList.add(SensitivityAAPSPlugin.getPlugin());
|
||||
pluginsList.add(SensitivityWeightedAveragePlugin.getPlugin());
|
||||
pluginsList.add(SensitivityOref1Plugin.getPlugin());
|
||||
if (Config.PUMPDRIVERS) pluginsList.add(DanaRPlugin.getPlugin());
|
||||
if (Config.PUMPDRIVERS) pluginsList.add(DanaRKoreanPlugin.getPlugin());
|
||||
if (Config.PUMPDRIVERS) pluginsList.add(DanaRv2Plugin.getPlugin());
|
||||
if (Config.PUMPDRIVERS) pluginsList.add(DanaRSPlugin.getPlugin());
|
||||
if (Config.PUMPDRIVERS) pluginsList.add(LocalInsightPlugin.getPlugin());
|
||||
if (Config.PUMPDRIVERS)
|
||||
pluginsList.add(DanaRPlugin.getPlugin());
|
||||
if (Config.PUMPDRIVERS)
|
||||
pluginsList.add(DanaRKoreanPlugin.getPlugin());
|
||||
if (Config.PUMPDRIVERS)
|
||||
pluginsList.add(DanaRv2Plugin.getPlugin());
|
||||
if (Config.PUMPDRIVERS)
|
||||
pluginsList.add(DanaRSPlugin.getPlugin());
|
||||
if (Config.PUMPDRIVERS)
|
||||
pluginsList.add(LocalInsightPlugin.getPlugin());
|
||||
pluginsList.add(CareportalPlugin.getPlugin());
|
||||
if (Config.PUMPDRIVERS)
|
||||
pluginsList.add(ComboPlugin.getPlugin());
|
||||
if (Config.MDI)
|
||||
pluginsList.add(MDIPlugin.getPlugin());
|
||||
if (Config.PUMPDRIVERS && engineeringMode) {
|
||||
pluginsList.add(MedtronicPumpPlugin.getPlugin());
|
||||
}
|
||||
pluginsList.add(CareportalPlugin.getPlugin());
|
||||
if (Config.PUMPDRIVERS) pluginsList.add(ComboPlugin.getPlugin());
|
||||
if (Config.MDI) pluginsList.add(MDIPlugin.getPlugin());
|
||||
pluginsList.add(VirtualPumpPlugin.getPlugin());
|
||||
if (Config.APS) pluginsList.add(LoopPlugin.getPlugin());
|
||||
if (Config.APS) pluginsList.add(OpenAPSMAPlugin.getPlugin());
|
||||
if (Config.APS) pluginsList.add(OpenAPSAMAPlugin.getPlugin());
|
||||
if (Config.APS) pluginsList.add(OpenAPSSMBPlugin.getPlugin());
|
||||
if (Config.APS)
|
||||
pluginsList.add(LoopPlugin.getPlugin());
|
||||
if (Config.APS)
|
||||
pluginsList.add(OpenAPSMAPlugin.getPlugin());
|
||||
if (Config.APS)
|
||||
pluginsList.add(OpenAPSAMAPlugin.getPlugin());
|
||||
if (Config.APS)
|
||||
pluginsList.add(OpenAPSSMBPlugin.getPlugin());
|
||||
pluginsList.add(NSProfilePlugin.getPlugin());
|
||||
if (Config.OTHERPROFILES) pluginsList.add(SimpleProfilePlugin.getPlugin());
|
||||
if (Config.OTHERPROFILES) pluginsList.add(LocalProfilePlugin.getPlugin());
|
||||
if (Config.OTHERPROFILES)
|
||||
pluginsList.add(SimpleProfilePlugin.getPlugin());
|
||||
if (Config.OTHERPROFILES)
|
||||
pluginsList.add(LocalProfilePlugin.getPlugin());
|
||||
pluginsList.add(TreatmentsPlugin.getPlugin());
|
||||
if (Config.SAFETY) pluginsList.add(SafetyPlugin.getPlugin());
|
||||
if (Config.SAFETY) pluginsList.add(StorageConstraintPlugin.getPlugin());
|
||||
if (Config.APS) pluginsList.add(ObjectivesPlugin.getPlugin());
|
||||
if (Config.SAFETY)
|
||||
pluginsList.add(SafetyPlugin.getPlugin());
|
||||
if (Config.SAFETY)
|
||||
pluginsList.add(StorageConstraintPlugin.getPlugin());
|
||||
if (Config.APS)
|
||||
pluginsList.add(ObjectivesPlugin.getPlugin());
|
||||
pluginsList.add(SourceXdripPlugin.getPlugin());
|
||||
pluginsList.add(SourceNSClientPlugin.getPlugin());
|
||||
pluginsList.add(SourceMM640gPlugin.getPlugin());
|
||||
|
@ -195,7 +221,8 @@ public class MainApp extends Application {
|
|||
pluginsList.add(SourcePoctechPlugin.getPlugin());
|
||||
pluginsList.add(SourceTomatoPlugin.getPlugin());
|
||||
pluginsList.add(SourceEversensePlugin.getPlugin());
|
||||
if (Config.SMSCOMMUNICATORENABLED) pluginsList.add(SmsCommunicatorPlugin.getPlugin());
|
||||
if (Config.SMSCOMMUNICATORENABLED)
|
||||
pluginsList.add(SmsCommunicatorPlugin.getPlugin());
|
||||
pluginsList.add(FoodPlugin.getPlugin());
|
||||
|
||||
pluginsList.add(WearPlugin.initPlugin(this));
|
||||
|
@ -208,6 +235,7 @@ public class MainApp extends Application {
|
|||
|
||||
pluginsList.add(DstHelperPlugin.getPlugin());
|
||||
|
||||
|
||||
ConfigBuilderPlugin.getPlugin().initialize();
|
||||
}
|
||||
|
||||
|
@ -223,6 +251,7 @@ public class MainApp extends Application {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private void registerLocalBroadcastReceiver() {
|
||||
lbm = LocalBroadcastManager.getInstance(this);
|
||||
lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_NEW_TREATMENT));
|
||||
|
@ -238,19 +267,58 @@ public class MainApp extends Application {
|
|||
lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_NEW_DEVICESTATUS));
|
||||
lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_NEW_CAL));
|
||||
|
||||
//register alarms
|
||||
// register alarms
|
||||
lbm.registerReceiver(alarmReciever, new IntentFilter(Intents.ACTION_ALARM));
|
||||
lbm.registerReceiver(alarmReciever, new IntentFilter(Intents.ACTION_ANNOUNCEMENT));
|
||||
lbm.registerReceiver(alarmReciever, new IntentFilter(Intents.ACTION_CLEAR_ALARM));
|
||||
lbm.registerReceiver(alarmReciever, new IntentFilter(Intents.ACTION_URGENT_ALARM));
|
||||
|
||||
//register ack alarm
|
||||
// register ack alarm
|
||||
lbm.registerReceiver(ackAlarmReciever, new IntentFilter(Intents.ACTION_ACK_ALARM));
|
||||
|
||||
//register dbaccess
|
||||
// register dbaccess
|
||||
lbm.registerReceiver(dbAccessReciever, new IntentFilter(Intents.ACTION_DATABASE));
|
||||
}
|
||||
|
||||
|
||||
private void setBTReceiver() {
|
||||
|
||||
// SP.putDouble(RileyLinkConst.Prefs.LastGoodDeviceFrequency, null);
|
||||
SP.remove(MedtronicConst.Statistics.LastPumpHistoryEntry); // FIXME remove
|
||||
|
||||
// SP.putString(MedtronicConst.Prefs.PumpFrequency, "US (916 MHz)");
|
||||
|
||||
// RileyLink framework needs to know, when BT was reconnected, so that we can reconnect to RL device
|
||||
btReceiver = new BroadcastReceiver() {
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
final String action = intent.getAction();
|
||||
|
||||
if (action.equals(BluetoothAdapter.ACTION_STATE_CHANGED)) {
|
||||
final int state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR);
|
||||
switch (state) {
|
||||
case BluetoothAdapter.STATE_OFF:
|
||||
case BluetoothAdapter.STATE_TURNING_OFF:
|
||||
case BluetoothAdapter.STATE_TURNING_ON:
|
||||
break;
|
||||
|
||||
case BluetoothAdapter.STATE_ON:
|
||||
Log.v("MainApp", "Bluetooth on");
|
||||
RileyLinkUtil.sendBroadcastMessage(RileyLinkConst.Intents.BluetoothReconnected);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Register for broadcasts on BluetoothAdapter state change
|
||||
IntentFilter filter = new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED);
|
||||
registerReceiver(btReceiver, filter);
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void startKeepAliveService() {
|
||||
if (keepAliveReceiver == null) {
|
||||
keepAliveReceiver = new KeepAliveReceiver();
|
||||
|
@ -258,11 +326,13 @@ public class MainApp extends Application {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public void stopKeepAliveService() {
|
||||
if (keepAliveReceiver != null)
|
||||
KeepAliveReceiver.cancelAlarm(this);
|
||||
}
|
||||
|
||||
|
||||
public static void subscribe(Object subscriber) {
|
||||
try {
|
||||
bus().register(subscriber);
|
||||
|
@ -271,6 +341,7 @@ public class MainApp extends Application {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public static void unsubscribe(Object subscriber) {
|
||||
try {
|
||||
bus().unregister(subscriber);
|
||||
|
@ -279,34 +350,42 @@ public class MainApp extends Application {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public static Bus bus() {
|
||||
return sBus;
|
||||
}
|
||||
|
||||
|
||||
public static String gs(int id) {
|
||||
return sResources.getString(id);
|
||||
}
|
||||
|
||||
|
||||
public static String gs(int id, Object... args) {
|
||||
return sResources.getString(id, args);
|
||||
}
|
||||
|
||||
|
||||
public static String gq(@PluralsRes int id, int quantity, Object... args) {
|
||||
return sResources.getQuantityString(id, quantity, args);
|
||||
}
|
||||
|
||||
|
||||
public static int gc(int id) {
|
||||
return sResources.getColor(id);
|
||||
}
|
||||
|
||||
|
||||
public static MainApp instance() {
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
|
||||
public static DatabaseHelper getDbHelper() {
|
||||
return sDatabaseHelper;
|
||||
}
|
||||
|
||||
|
||||
public static void closeDbHelper() {
|
||||
if (sDatabaseHelper != null) {
|
||||
sDatabaseHelper.close();
|
||||
|
@ -314,14 +393,17 @@ public class MainApp extends Application {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public static ConstraintChecker getConstraintChecker() {
|
||||
return sConstraintsChecker;
|
||||
}
|
||||
|
||||
|
||||
public static ArrayList<PluginBase> getPluginsList() {
|
||||
return pluginsList;
|
||||
}
|
||||
|
||||
|
||||
public static ArrayList<PluginBase> getSpecificPluginsList(PluginType type) {
|
||||
ArrayList<PluginBase> newList = new ArrayList<>();
|
||||
|
||||
|
@ -336,6 +418,7 @@ public class MainApp extends Application {
|
|||
return newList;
|
||||
}
|
||||
|
||||
|
||||
public static ArrayList<PluginBase> getSpecificPluginsVisibleInList(PluginType type) {
|
||||
ArrayList<PluginBase> newList = new ArrayList<>();
|
||||
|
||||
|
@ -351,6 +434,7 @@ public class MainApp extends Application {
|
|||
return newList;
|
||||
}
|
||||
|
||||
|
||||
public static ArrayList<PluginBase> getSpecificPluginsListByInterface(Class interfaceClass) {
|
||||
ArrayList<PluginBase> newList = new ArrayList<>();
|
||||
|
||||
|
@ -365,6 +449,7 @@ public class MainApp extends Application {
|
|||
return newList;
|
||||
}
|
||||
|
||||
|
||||
public static ArrayList<PluginBase> getSpecificPluginsVisibleInListByInterface(Class interfaceClass, PluginType type) {
|
||||
ArrayList<PluginBase> newList = new ArrayList<>();
|
||||
|
||||
|
@ -380,12 +465,13 @@ public class MainApp extends Application {
|
|||
return newList;
|
||||
}
|
||||
|
||||
|
||||
@Nullable
|
||||
public static <T extends PluginBase> T getSpecificPlugin(Class<T> pluginClass) {
|
||||
if (pluginsList != null) {
|
||||
for (PluginBase p : pluginsList) {
|
||||
if (pluginClass.isAssignableFrom(p.getClass()))
|
||||
return (T) p;
|
||||
return (T)p;
|
||||
}
|
||||
} else {
|
||||
log.error("pluginsList=null");
|
||||
|
@ -393,16 +479,26 @@ public class MainApp extends Application {
|
|||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static boolean isEngineeringMode() {
|
||||
if (!Config.APS)
|
||||
return true;
|
||||
return engineeringMode;
|
||||
}
|
||||
|
||||
|
||||
public static boolean isEngineeringModeOrRelease() {
|
||||
if (!Config.APS)
|
||||
return true;
|
||||
return engineeringMode || !devBranch;
|
||||
}
|
||||
|
||||
|
||||
public static boolean isDev() {
|
||||
return devBranch;
|
||||
}
|
||||
|
||||
|
||||
public static int getIcon() {
|
||||
if (Config.NSCLIENT)
|
||||
return R.mipmap.ic_yellowowl;
|
||||
|
@ -412,6 +508,7 @@ public class MainApp extends Application {
|
|||
return R.mipmap.ic_launcher;
|
||||
}
|
||||
|
||||
|
||||
public static int getNotificationIcon() {
|
||||
if (Config.NSCLIENT)
|
||||
return R.drawable.ic_notif_nsclient;
|
||||
|
@ -421,6 +518,7 @@ public class MainApp extends Application {
|
|||
return R.drawable.ic_notif_aaps;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onTerminate() {
|
||||
if (L.isEnabled(L.CORE))
|
||||
|
@ -430,5 +528,9 @@ public class MainApp extends Application {
|
|||
sDatabaseHelper.close();
|
||||
sDatabaseHelper = null;
|
||||
}
|
||||
|
||||
if (btReceiver != null) {
|
||||
unregisterReceiver(btReceiver);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
package info.nightscout.androidaps.plugins.general.actions;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
|
@ -21,12 +25,13 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.activities.HistoryBrowseActivity;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.activities.HistoryBrowseActivity;
|
||||
import info.nightscout.androidaps.activities.TDDStatsActivity;
|
||||
import info.nightscout.androidaps.db.ExtendedBolus;
|
||||
import info.nightscout.androidaps.db.TemporaryBasal;
|
||||
import info.nightscout.androidaps.events.EventCustomActionsChanged;
|
||||
import info.nightscout.androidaps.events.EventExtendedBolusChange;
|
||||
import info.nightscout.androidaps.events.EventInitializationChanged;
|
||||
import info.nightscout.androidaps.events.EventRefreshOverview;
|
||||
|
@ -35,14 +40,13 @@ import info.nightscout.androidaps.interfaces.PumpInterface;
|
|||
import info.nightscout.androidaps.plugins.common.SubscriberFragment;
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
||||
import info.nightscout.androidaps.plugins.general.actions.ActionsPlugin;
|
||||
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction;
|
||||
import info.nightscout.androidaps.plugins.general.actions.dialogs.FillDialog;
|
||||
import info.nightscout.androidaps.plugins.general.actions.dialogs.NewExtendedBolusDialog;
|
||||
import info.nightscout.androidaps.plugins.general.actions.dialogs.NewTempBasalDialog;
|
||||
import info.nightscout.androidaps.plugins.general.careportal.CareportalFragment;
|
||||
import info.nightscout.androidaps.plugins.general.careportal.Dialogs.NewNSTreatmentDialog;
|
||||
import info.nightscout.androidaps.plugins.general.careportal.OptionsToShow;
|
||||
import info.nightscout.androidaps.plugins.general.careportal.Dialogs.NewNSTreatmentDialog;
|
||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy;
|
||||
import info.nightscout.androidaps.utils.SingleClickButton;
|
||||
|
@ -55,6 +59,7 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
|
|||
|
||||
static ActionsPlugin actionsPlugin = new ActionsPlugin();
|
||||
|
||||
|
||||
static public ActionsPlugin getPlugin() {
|
||||
return actionsPlugin;
|
||||
}
|
||||
|
@ -70,27 +75,27 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
|
|||
SingleClickButton tddStats;
|
||||
SingleClickButton history;
|
||||
|
||||
private Map<String,CustomAction> pumpCustomActions = new HashMap<>();
|
||||
private Map<String, CustomAction> pumpCustomActions = new HashMap<>();
|
||||
private List<SingleClickButton> pumpCustomButtons = new ArrayList<>();
|
||||
|
||||
|
||||
public ActionsFragment() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
try {
|
||||
View view = inflater.inflate(R.layout.actions_fragment, container, false);
|
||||
|
||||
profileSwitch = (SingleClickButton) view.findViewById(R.id.actions_profileswitch);
|
||||
tempTarget = (SingleClickButton) view.findViewById(R.id.actions_temptarget);
|
||||
extendedBolus = (SingleClickButton) view.findViewById(R.id.actions_extendedbolus);
|
||||
extendedBolusCancel = (SingleClickButton) view.findViewById(R.id.actions_extendedbolus_cancel);
|
||||
tempBasal = (SingleClickButton) view.findViewById(R.id.actions_settempbasal);
|
||||
tempBasalCancel = (SingleClickButton) view.findViewById(R.id.actions_canceltempbasal);
|
||||
fill = (SingleClickButton) view.findViewById(R.id.actions_fill);
|
||||
profileSwitch = (SingleClickButton)view.findViewById(R.id.actions_profileswitch);
|
||||
tempTarget = (SingleClickButton)view.findViewById(R.id.actions_temptarget);
|
||||
extendedBolus = (SingleClickButton)view.findViewById(R.id.actions_extendedbolus);
|
||||
extendedBolusCancel = (SingleClickButton)view.findViewById(R.id.actions_extendedbolus_cancel);
|
||||
tempBasal = (SingleClickButton)view.findViewById(R.id.actions_settempbasal);
|
||||
tempBasalCancel = (SingleClickButton)view.findViewById(R.id.actions_canceltempbasal);
|
||||
fill = (SingleClickButton)view.findViewById(R.id.actions_fill);
|
||||
tddStats = view.findViewById(R.id.actions_tddstats);
|
||||
history = view.findViewById(R.id.actions_historybrowser);
|
||||
|
||||
|
@ -115,34 +120,47 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
|
|||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventInitializationChanged ev) {
|
||||
updateGUI();
|
||||
}
|
||||
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventRefreshOverview ev) {
|
||||
updateGUI();
|
||||
}
|
||||
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventExtendedBolusChange ev) {
|
||||
updateGUI();
|
||||
}
|
||||
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventTempBasalChange ev) {
|
||||
updateGUI();
|
||||
}
|
||||
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventCustomActionsChanged ev) {
|
||||
updateGUI();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void updateGUI() {
|
||||
Activity activity = getActivity();
|
||||
if (activity != null)
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (ConfigBuilderPlugin.getPlugin().getActiveProfileInterface() != null && ConfigBuilderPlugin.getPlugin().getActiveProfileInterface().getProfile() != null) {
|
||||
if (ConfigBuilderPlugin.getPlugin().getActiveProfileInterface() != null
|
||||
&& ConfigBuilderPlugin.getPlugin().getActiveProfileInterface().getProfile() != null) {
|
||||
profileSwitch.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
profileSwitch.setVisibility(View.GONE);
|
||||
|
@ -160,34 +178,37 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
|
|||
|
||||
final PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||
final boolean basalprofileEnabled = MainApp.isEngineeringModeOrRelease()
|
||||
&& pump.getPumpDescription().isSetBasalProfileCapable;
|
||||
&& pump.getPumpDescription().isSetBasalProfileCapable;
|
||||
|
||||
if (!basalprofileEnabled || !pump.isInitialized() || pump.isSuspended())
|
||||
profileSwitch.setVisibility(View.GONE);
|
||||
else
|
||||
profileSwitch.setVisibility(View.VISIBLE);
|
||||
|
||||
if (!pump.getPumpDescription().isExtendedBolusCapable || !pump.isInitialized() || pump.isSuspended() || pump.isFakingTempsByExtendedBoluses()) {
|
||||
if (!pump.getPumpDescription().isExtendedBolusCapable || !pump.isInitialized()
|
||||
|| pump.isSuspended() || pump.isFakingTempsByExtendedBoluses()) {
|
||||
extendedBolus.setVisibility(View.GONE);
|
||||
extendedBolusCancel.setVisibility(View.GONE);
|
||||
} else {
|
||||
ExtendedBolus activeExtendedBolus = TreatmentsPlugin.getPlugin().getExtendedBolusFromHistory(System.currentTimeMillis());
|
||||
ExtendedBolus activeExtendedBolus = TreatmentsPlugin.getPlugin().getExtendedBolusFromHistory(
|
||||
System.currentTimeMillis());
|
||||
if (activeExtendedBolus != null) {
|
||||
extendedBolus.setVisibility(View.GONE);
|
||||
extendedBolusCancel.setVisibility(View.VISIBLE);
|
||||
extendedBolusCancel.setText(MainApp.gs(R.string.cancel) + " " + activeExtendedBolus.toString());
|
||||
extendedBolusCancel.setText(MainApp.gs(R.string.cancel) + " "
|
||||
+ activeExtendedBolus.toString());
|
||||
} else {
|
||||
extendedBolus.setVisibility(View.VISIBLE);
|
||||
extendedBolusCancel.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!pump.getPumpDescription().isTempBasalCapable || !pump.isInitialized() || pump.isSuspended()) {
|
||||
tempBasal.setVisibility(View.GONE);
|
||||
tempBasalCancel.setVisibility(View.GONE);
|
||||
} else {
|
||||
final TemporaryBasal activeTemp = TreatmentsPlugin.getPlugin().getTempBasalFromHistory(System.currentTimeMillis());
|
||||
final TemporaryBasal activeTemp = TreatmentsPlugin.getPlugin().getTempBasalFromHistory(
|
||||
System.currentTimeMillis());
|
||||
if (activeTemp != null) {
|
||||
tempBasal.setVisibility(View.GONE);
|
||||
tempBasalCancel.setVisibility(View.VISIBLE);
|
||||
|
@ -208,6 +229,11 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
|
|||
else
|
||||
tempTarget.setVisibility(View.VISIBLE);
|
||||
|
||||
if (!Config.APS)
|
||||
tempTarget.setVisibility(View.GONE);
|
||||
else
|
||||
tempTarget.setVisibility(View.VISIBLE);
|
||||
|
||||
if (!pump.getPumpDescription().supportsTDDs)
|
||||
tddStats.setVisibility(View.GONE);
|
||||
else
|
||||
|
@ -219,7 +245,6 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
View.OnClickListener pumpCustomActionsListener = v -> {
|
||||
|
||||
SingleClickButton btn = (SingleClickButton)v;
|
||||
|
@ -241,19 +266,23 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
|
|||
return;
|
||||
}
|
||||
|
||||
// add new actions
|
||||
List<CustomAction> customActions = activePump.getCustomActions();
|
||||
|
||||
if (customActions != null && customActions.size()>0) {
|
||||
if (customActions != null && customActions.size() > 0) {
|
||||
|
||||
LinearLayout ll = actionsFragmentView.findViewById(R.id.action_buttons_layout);
|
||||
|
||||
for (CustomAction customAction : customActions) {
|
||||
|
||||
if (!customAction.isEnabled())
|
||||
continue;
|
||||
|
||||
SingleClickButton btn = new SingleClickButton(getContext(), null, android.R.attr.buttonStyle);
|
||||
btn.setText(MainApp.gs(customAction.getName()));
|
||||
|
||||
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT, 0.5f);
|
||||
LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT, 0.5f);
|
||||
layoutParams.setMargins(20, 8, 20, 8); // 10,3,10,3
|
||||
|
||||
btn.setLayoutParams(layoutParams);
|
||||
|
@ -275,7 +304,7 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
|
|||
|
||||
private void removePumpCustomActions() {
|
||||
|
||||
if (pumpCustomActions.size()==0)
|
||||
if (pumpCustomActions.size() == 0)
|
||||
return;
|
||||
|
||||
LinearLayout ll = actionsFragmentView.findViewById(R.id.action_buttons_layout);
|
||||
|
|
|
@ -12,31 +12,33 @@ public class CustomAction {
|
|||
private String iconName;
|
||||
private CustomActionType customActionType;
|
||||
private int iconResourceId;
|
||||
private boolean enabled = true;
|
||||
|
||||
|
||||
public CustomAction(int nameResourceId, CustomActionType actionType) {
|
||||
this.name = nameResourceId;
|
||||
this.customActionType = actionType;
|
||||
this.iconResourceId = R.drawable.icon_actions_profileswitch;
|
||||
this(nameResourceId, actionType, R.drawable.icon_actions_profileswitch, true);
|
||||
}
|
||||
|
||||
|
||||
public CustomAction(int nameResourceId, CustomActionType actionType, int iconResourceId) {
|
||||
this(nameResourceId, actionType, iconResourceId, true);
|
||||
}
|
||||
|
||||
|
||||
public CustomAction(int nameResourceId, CustomActionType actionType, int iconResourceId, boolean enabled) {
|
||||
this.name = nameResourceId;
|
||||
this.customActionType = actionType;
|
||||
this.iconResourceId = iconResourceId;
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
|
||||
public int getName() {
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public CustomActionType getCustomActionType() {
|
||||
|
||||
return customActionType;
|
||||
}
|
||||
|
||||
|
@ -44,4 +46,15 @@ public class CustomAction {
|
|||
public int getIconResourceId() {
|
||||
return iconResourceId;
|
||||
}
|
||||
|
||||
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -258,6 +258,12 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canHandleDST() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Pump Plugin
|
||||
|
||||
private boolean isServiceSet() {
|
||||
|
@ -1377,13 +1383,13 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
|
|||
// LOG.debug("MedtronicPumpPlugin::stopConnecting");
|
||||
// }
|
||||
|
||||
List<CustomAction> customActions = null;
|
||||
private List<CustomAction> customActions = null;
|
||||
|
||||
CustomAction customActionWakeUpAndTune = new CustomAction(R.string.medtronic_custom_action_wake_and_tune,
|
||||
private CustomAction customActionWakeUpAndTune = new CustomAction(R.string.medtronic_custom_action_wake_and_tune,
|
||||
MedtronicCustomActionType.WakeUpAndTune);
|
||||
|
||||
CustomAction customActionClearBolusBlock = new CustomAction(R.string.medtronic_custom_action_clear_bolus_block,
|
||||
MedtronicCustomActionType.ClearBolusBlock);
|
||||
private CustomAction customActionClearBolusBlock = new CustomAction(
|
||||
R.string.medtronic_custom_action_clear_bolus_block, MedtronicCustomActionType.ClearBolusBlock);
|
||||
|
||||
|
||||
@Override
|
||||
|
@ -1398,7 +1404,7 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
|
|||
|
||||
|
||||
@Override
|
||||
public PumpEnactResult executeCustomAction(CustomActionType customActionType) {
|
||||
public void executeCustomAction(CustomActionType customActionType) {
|
||||
|
||||
MedtronicCustomActionType mcat = (MedtronicCustomActionType)customActionType;
|
||||
|
||||
|
@ -1419,7 +1425,6 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
|
|||
break;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
package info.nightscout.androidaps.plugins.pump.virtual;
|
||||
|
||||
import android.os.SystemClock;
|
||||
|
||||
import com.squareup.otto.Subscribe;
|
||||
import java.util.List;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.List;
|
||||
import android.os.SystemClock;
|
||||
|
||||
import com.squareup.otto.Subscribe;
|
||||
|
||||
import info.nightscout.androidaps.BuildConfig;
|
||||
import info.nightscout.androidaps.Config;
|
||||
|
@ -41,11 +41,11 @@ import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
|
|||
import info.nightscout.androidaps.utils.DateUtil;
|
||||
import info.nightscout.androidaps.utils.SP;
|
||||
|
||||
|
||||
/**
|
||||
* Created by mike on 05.08.2016.
|
||||
*/
|
||||
public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
|
||||
|
||||
private Logger log = LoggerFactory.getLogger(L.PUMP);
|
||||
|
||||
Integer batteryPercent = 50;
|
||||
|
@ -56,16 +56,12 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
|
|||
private long lastDataTime = 0;
|
||||
private PumpDescription pumpDescription = new PumpDescription();
|
||||
|
||||
|
||||
public VirtualPumpPlugin() {
|
||||
super(new PluginDescription()
|
||||
.mainType(PluginType.PUMP)
|
||||
.fragmentClass(VirtualPumpFragment.class.getName())
|
||||
.pluginName(R.string.virtualpump)
|
||||
.shortName(R.string.virtualpump_shortname)
|
||||
.preferencesId(R.xml.pref_virtualpump)
|
||||
.neverVisible(Config.NSCLIENT)
|
||||
.description(R.string.description_pump_virtual)
|
||||
);
|
||||
super(new PluginDescription().mainType(PluginType.PUMP).fragmentClass(VirtualPumpFragment.class.getName())
|
||||
.pluginName(R.string.virtualpump).shortName(R.string.virtualpump_shortname)
|
||||
.preferencesId(R.xml.pref_virtualpump).neverVisible(Config.NSCLIENT)
|
||||
.description(R.string.description_pump_virtual));
|
||||
pumpDescription.isBolusCapable = true;
|
||||
pumpDescription.bolusStep = 0.1d;
|
||||
|
||||
|
@ -85,7 +81,6 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
|
|||
pumpDescription.tempDurationStep30mAllowed = true;
|
||||
pumpDescription.tempMaxDuration = 24 * 60;
|
||||
|
||||
|
||||
pumpDescription.isSetBasalProfileCapable = true;
|
||||
pumpDescription.basalStep = 0.01d;
|
||||
pumpDescription.basalMinimumRate = 0.01d;
|
||||
|
@ -96,6 +91,7 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
|
|||
pumpDescription.is30minBasalRatesCapable = true;
|
||||
}
|
||||
|
||||
|
||||
public static VirtualPumpPlugin getPlugin() {
|
||||
if (plugin == null)
|
||||
plugin = new VirtualPumpPlugin();
|
||||
|
@ -103,19 +99,23 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
|
|||
return plugin;
|
||||
}
|
||||
|
||||
|
||||
private void loadFakingStatus() {
|
||||
fromNSAreCommingFakedExtendedBoluses = SP.getBoolean(R.string.key_fromNSAreCommingFakedExtendedBoluses, false);
|
||||
}
|
||||
|
||||
|
||||
public boolean getFakingStatus() {
|
||||
return fromNSAreCommingFakedExtendedBoluses;
|
||||
}
|
||||
|
||||
|
||||
public void setFakingStatus(boolean newStatus) {
|
||||
fromNSAreCommingFakedExtendedBoluses = newStatus;
|
||||
SP.putBoolean(R.string.key_fromNSAreCommingFakedExtendedBoluses, fromNSAreCommingFakedExtendedBoluses);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
|
@ -123,72 +123,86 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
|
|||
refreshConfiguration();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
MainApp.bus().unregister(this);
|
||||
}
|
||||
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventPreferenceChange s) {
|
||||
if (s.isChanged(R.string.key_virtualpump_type))
|
||||
refreshConfiguration();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isFakingTempsByExtendedBoluses() {
|
||||
return (Config.NSCLIENT) && fromNSAreCommingFakedExtendedBoluses;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PumpEnactResult loadTDDs() {
|
||||
//no result, could read DB in the future?
|
||||
// no result, could read DB in the future?
|
||||
return new PumpEnactResult();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<CustomAction> getCustomActions() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void executeCustomAction(CustomActionType customActionType) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isInitialized() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isSuspended() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isBusy() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isConnected() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isConnecting() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isHandshakeInProgress() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void finishHandshaking() {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void connect(String reason) {
|
||||
if (!Config.NSCLIENT)
|
||||
|
@ -196,40 +210,48 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
|
|||
lastDataTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void disconnect(String reason) {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void stopConnecting() {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void getPumpStatus() {
|
||||
lastDataTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PumpEnactResult setNewBasalProfile(Profile profile) {
|
||||
lastDataTime = System.currentTimeMillis();
|
||||
// Do nothing here. we are using ConfigBuilderPlugin.getPlugin().getActiveProfile().getProfile();
|
||||
PumpEnactResult result = new PumpEnactResult();
|
||||
result.success = true;
|
||||
Notification notification = new Notification(Notification.PROFILE_SET_OK, MainApp.gs(R.string.profile_set_ok), Notification.INFO, 60);
|
||||
Notification notification = new Notification(Notification.PROFILE_SET_OK, MainApp.gs(R.string.profile_set_ok),
|
||||
Notification.INFO, 60);
|
||||
MainApp.bus().post(new EventNewNotification(notification));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isThisProfileSet(Profile profile) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long lastDataTime() {
|
||||
return lastDataTime;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public double getBaseBasalRate() {
|
||||
Profile profile = ProfileFunctions.getInstance().getProfile();
|
||||
|
@ -241,10 +263,16 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
|
|||
|
||||
|
||||
@Override
|
||||
public double getReservoirLevel() { return reservoirInUnits; }
|
||||
public double getReservoirLevel() {
|
||||
return reservoirInUnits;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getBatteryLevel() { return batteryPercent; }
|
||||
public int getBatteryLevel() {
|
||||
return batteryPercent;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PumpEnactResult deliverTreatment(DetailedBolusInfo detailedBolusInfo) {
|
||||
|
@ -262,7 +290,7 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
|
|||
SystemClock.sleep(200);
|
||||
EventOverviewBolusProgress bolusingEvent = EventOverviewBolusProgress.getInstance();
|
||||
bolusingEvent.status = String.format(MainApp.gs(R.string.bolusdelivering), delivering);
|
||||
bolusingEvent.percent = Math.min((int) (delivering / detailedBolusInfo.insulin * 100), 100);
|
||||
bolusingEvent.percent = Math.min((int)(delivering / detailedBolusInfo.insulin * 100), 100);
|
||||
MainApp.bus().post(bolusingEvent);
|
||||
delivering += 0.1d;
|
||||
}
|
||||
|
@ -273,25 +301,26 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
|
|||
MainApp.bus().post(bolusingEvent);
|
||||
SystemClock.sleep(1000);
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("Delivering treatment insulin: " + detailedBolusInfo.insulin + "U carbs: " + detailedBolusInfo.carbs + "g " + result);
|
||||
log.debug("Delivering treatment insulin: " + detailedBolusInfo.insulin + "U carbs: "
|
||||
+ detailedBolusInfo.carbs + "g " + result);
|
||||
MainApp.bus().post(new EventVirtualPumpUpdateGui());
|
||||
lastDataTime = System.currentTimeMillis();
|
||||
TreatmentsPlugin.getPlugin().addToHistoryTreatment(detailedBolusInfo, false);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void stopBolusDelivering() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PumpEnactResult setTempBasalAbsolute(Double absoluteRate, Integer durationInMinutes, Profile profile, boolean enforceNew) {
|
||||
|
||||
TemporaryBasal tempBasal = new TemporaryBasal()
|
||||
.date(System.currentTimeMillis())
|
||||
.absolute(absoluteRate)
|
||||
.duration(durationInMinutes)
|
||||
.source(Source.USER);
|
||||
@Override
|
||||
public PumpEnactResult setTempBasalAbsolute(Double absoluteRate, Integer durationInMinutes, Profile profile,
|
||||
boolean enforceNew) {
|
||||
|
||||
TemporaryBasal tempBasal = new TemporaryBasal().date(System.currentTimeMillis()).absolute(absoluteRate)
|
||||
.duration(durationInMinutes).source(Source.USER);
|
||||
PumpEnactResult result = new PumpEnactResult();
|
||||
result.success = true;
|
||||
result.enacted = true;
|
||||
|
@ -307,13 +336,12 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
|
|||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes, Profile profile, boolean enforceNew) {
|
||||
TemporaryBasal tempBasal = new TemporaryBasal()
|
||||
.date(System.currentTimeMillis())
|
||||
.percent(percent)
|
||||
.duration(durationInMinutes)
|
||||
.source(Source.USER);
|
||||
public PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes, Profile profile,
|
||||
boolean enforceNew) {
|
||||
TemporaryBasal tempBasal = new TemporaryBasal().date(System.currentTimeMillis()).percent(percent)
|
||||
.duration(durationInMinutes).source(Source.USER);
|
||||
PumpEnactResult result = new PumpEnactResult();
|
||||
result.success = true;
|
||||
result.enacted = true;
|
||||
|
@ -330,17 +358,15 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
|
|||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PumpEnactResult setExtendedBolus(Double insulin, Integer durationInMinutes) {
|
||||
PumpEnactResult result = cancelExtendedBolus();
|
||||
if (!result.success)
|
||||
return result;
|
||||
|
||||
ExtendedBolus extendedBolus = new ExtendedBolus()
|
||||
.date(System.currentTimeMillis())
|
||||
.insulin(insulin)
|
||||
.durationInMinutes(durationInMinutes)
|
||||
.source(Source.USER);
|
||||
ExtendedBolus extendedBolus = new ExtendedBolus().date(System.currentTimeMillis()).insulin(insulin)
|
||||
.durationInMinutes(durationInMinutes).source(Source.USER);
|
||||
result.success = true;
|
||||
result.enacted = true;
|
||||
result.bolusDelivered = insulin;
|
||||
|
@ -355,6 +381,7 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
|
|||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PumpEnactResult cancelTempBasal(boolean force) {
|
||||
PumpEnactResult result = new PumpEnactResult();
|
||||
|
@ -365,7 +392,7 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
|
|||
result.enacted = true;
|
||||
TemporaryBasal tempStop = new TemporaryBasal().date(System.currentTimeMillis()).source(Source.USER);
|
||||
TreatmentsPlugin.getPlugin().addToHistoryTempBasal(tempStop);
|
||||
//tempBasal = null;
|
||||
// tempBasal = null;
|
||||
if (L.isEnabled(L.PUMPCOMM))
|
||||
log.debug("Canceling temp basal: " + result);
|
||||
MainApp.bus().post(new EventVirtualPumpUpdateGui());
|
||||
|
@ -374,6 +401,7 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
|
|||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PumpEnactResult cancelExtendedBolus() {
|
||||
PumpEnactResult result = new PumpEnactResult();
|
||||
|
@ -393,6 +421,7 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
|
|||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public JSONObject getJSONStatus(Profile profile, String profileName) {
|
||||
long now = System.currentTimeMillis();
|
||||
|
@ -436,25 +465,30 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
|
|||
return pump;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String deviceID() {
|
||||
return "VirtualPump";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PumpDescription getPumpDescription() {
|
||||
return pumpDescription;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String shortStatus(boolean veryShort) {
|
||||
return "Virtual Pump";
|
||||
}
|
||||
|
||||
|
||||
public PumpType getPumpType() {
|
||||
return pumpType;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canHandleDST() {
|
||||
return true;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--Generated by crowdin.com-->
|
||||
<?xml version="1.0" encoding="utf-8"?><!--Generated by crowdin.com-->
|
||||
<resources>
|
||||
<string name="treatmentssafety_title">Sécurités des traitements</string>
|
||||
<string name="treatmentssafety_maxbolus_title">Maximum Bolus autorisé [U]</string>
|
||||
|
@ -344,7 +343,7 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
|
|||
<string name="smscommunicator_basalreplywithcode">Pour démarrer Basal %1$.2fU/h pendant %2$d min, renvoyer le code %3$s</string>
|
||||
<string name="smscommunicator_profilereplywithcode">Pour changer le profil vers %1$s %2$d%%, renvoyer le code %3$s</string>
|
||||
<string name="smscommunicator_extendedreplywithcode">Pour démarrer le Bolus étendu %1$.2fU pendant %2$d min, renvoyer le code %3$s</string>
|
||||
<string name="smscommunicator_basalpctreplywithcode">Pour démarrer le Basal %1$d% pendant %2$d min, renvoyer le code %3$s</string>
|
||||
<string name="smscommunicator_basalpctreplywithcode">Pour démarrer le Basal %1$d%% pendant %2$d min, renvoyer le code %3$s</string>
|
||||
<string name="smscommunicator_suspendreplywithcode">Envoyer le code %2$s pour suspendre la Boucle pour %1$d minutes</string>
|
||||
<string name="smscommunicator_tempbasalset">Démarrage réussi pour %1$.2fU/h de basal temporaire pour %2$d min</string>
|
||||
<string name="smscommunicator_extendedset">Le Bolus étendu %1$.2fU pendant %2$d min a commencé avec succès</string>
|
||||
|
|
|
@ -1326,7 +1326,6 @@
|
|||
<string name="sms_wrongcode">Wrong code. Command cancelled.</string>
|
||||
<string name="notconfigured">Not configured</string>
|
||||
<string name="profileswitchcreated">Profile switch created</string>
|
||||
|
||||
|
||||
<!-- Pump Abstract -->
|
||||
<string name="pump_operation_not_supported_by_pump_driver">Operation not supported by pump and/or driver.</string>
|
||||
|
|
Loading…
Reference in a new issue