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