diff --git a/.travis.yml b/.travis.yml index 6799bbf35f..52552b3ceb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,4 +15,7 @@ android: script: # Unit Test - - ./gradlew test \ No newline at end of file + - ./gradlew test jacocoTestReport + +after_success: + - bash <(curl -s https://codecov.io/bash) \ No newline at end of file diff --git a/README.md b/README.md index b700f18b7a..54d9bb092a 100644 --- a/README.md +++ b/README.md @@ -5,3 +5,5 @@ [![Gitter](https://badges.gitter.im/MilosKozak/AndroidAPS.svg)](https://gitter.im/MilosKozak/AndroidAPS?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Build status](https://travis-ci.org/MilosKozak/AndroidAPS.svg?branch=master)](https://travis-ci.org/MilosKozak/AndroidAPS) +[![codecov](https://codecov.io/gh/MilosKozak/AndroidAPS/branch/master/graph/badge.svg)](https://codecov.io/gh/MilosKozak/AndroidAPS) +dev: [![codecov](https://codecov.io/gh/MilosKozak/AndroidAPS/branch/dev/graph/badge.svg)](https://codecov.io/gh/MilosKozak/AndroidAPS) \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 716328c0be..fdb70171d9 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,14 +1,25 @@ buildscript { repositories { maven { url 'https://maven.fabric.io/public' } + jcenter() } dependencies { classpath 'io.fabric.tools:gradle:1.+' + classpath 'com.dicedmelon.gradle:jacoco-android:0.1.2' } } -apply plugin: 'com.android.application' -apply plugin: 'io.fabric' +apply plugin: "com.android.application" +apply plugin: "io.fabric" +apply plugin: "jacoco-android" + +ext { + supportLibraryVersion = "23.4.0" + ormLiteVersion = "4.46" + powermockVersion = "1.7.3" + dexmakerVersion = "1.2" +} + repositories { maven { url 'https://maven.fabric.io/public' } @@ -45,7 +56,7 @@ android { targetSdkVersion 23 multiDexEnabled true versionCode 1500 - version "1.56-smb" + version "1.57-smb" buildConfigField "String", "VERSION", '"' + version + '"' buildConfigField "String", "BUILDVERSION", generateGitBuild() @@ -55,12 +66,16 @@ android { } lintOptions { disable 'MissingTranslation' + disable 'ExtraTranslation' } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } + debug { + testCoverageEnabled true + } } productFlavors { flavorDimensions "standard" @@ -76,6 +91,7 @@ android { buildConfigField "boolean", "NSCLIENTOLNY", "false" buildConfigField "boolean", "CLOSEDLOOP", "true" buildConfigField "boolean", "G5UPLOADER", "false" + buildConfigField "boolean", "PUMPCONTROL", "false" } openloop { dimension "standard" @@ -89,6 +105,7 @@ android { buildConfigField "boolean", "NSCLIENTOLNY", "false" buildConfigField "boolean", "CLOSEDLOOP", "false" buildConfigField "boolean", "G5UPLOADER", "false" + buildConfigField "boolean", "PUMPCONTROL", "false" } pumpcontrol { dimension "standard" @@ -102,6 +119,7 @@ android { buildConfigField "boolean", "NSCLIENTOLNY", "false" buildConfigField "boolean", "CLOSEDLOOP", "false" buildConfigField "boolean", "G5UPLOADER", "false" + buildConfigField "boolean", "PUMPCONTROL", "true" } nsclient { dimension "standard" @@ -115,6 +133,7 @@ android { buildConfigField "boolean", "NSCLIENTOLNY", "true" buildConfigField "boolean", "CLOSEDLOOP", "false" buildConfigField "boolean", "G5UPLOADER", "false" + buildConfigField "boolean", "PUMPCONTROL", "false" } g5uploader { dimension "standard" @@ -128,6 +147,7 @@ android { buildConfigField "boolean", "NSCLIENTOLNY", "false" buildConfigField "boolean", "CLOSEDLOOP", "false" buildConfigField "boolean", "G5UPLOADER", "true" + buildConfigField "boolean", "PUMPCONTROL", "false" } } } @@ -145,53 +165,55 @@ dependencies { wearApp project(':wear') compile fileTree(include: ['*.jar'], dir: 'libs') - compile('com.crashlytics.sdk.android:crashlytics:2.6.7@aar') { + compile("com.crashlytics.sdk.android:crashlytics:2.6.7@aar") { transitive = true; } - compile('com.crashlytics.sdk.android:answers:1.3.12@aar') { + compile("com.crashlytics.sdk.android:answers:1.3.12@aar") { transitive = true; } - compile 'com.android.support:appcompat-v7:23.4.0' - compile 'com.android.support:support-v4:23.4.0' - compile 'com.android.support:cardview-v7:23.4.0' - compile 'com.android.support:recyclerview-v7:23.4.0' - compile 'com.android.support:gridlayout-v7:23.4.0' - compile "com.android.support:design:23.4.0" - compile "com.android.support:percent:23.4.0" - compile 'com.wdullaer:materialdatetimepicker:2.3.0' - compile 'com.squareup:otto:1.3.7' - compile 'com.j256.ormlite:ormlite-core:4.46' - compile 'com.j256.ormlite:ormlite-android:4.46' - compile('com.github.tony19:logback-android-classic:1.1.1-6') { - exclude group: 'com.google.android', module: 'android' + compile "com.android.support:appcompat-v7:${supportLibraryVersion}" + compile "com.android.support:support-v4:${supportLibraryVersion}" + compile "com.android.support:cardview-v7:${supportLibraryVersion}" + compile "com.android.support:recyclerview-v7:${supportLibraryVersion}" + compile "com.android.support:gridlayout-v7:${supportLibraryVersion}" + compile "com.android.support:design:${supportLibraryVersion}" + compile "com.android.support:percent:${supportLibraryVersion}" + compile "com.wdullaer:materialdatetimepicker:2.3.0" + compile "com.squareup:otto:1.3.7" + compile "com.j256.ormlite:ormlite-core:${ormLiteVersion}" + compile "com.j256.ormlite:ormlite-android:${ormLiteVersion}" + compile("com.github.tony19:logback-android-classic:1.1.1-6") { + exclude group: "com.google.android", module: "android" } - compile 'org.apache.commons:commons-lang3:3.6' - compile 'org.slf4j:slf4j-api:1.7.12' - compile 'com.jjoe64:graphview:4.0.1' - compile 'com.joanzapata.iconify:android-iconify-fontawesome:2.1.1' - compile 'com.google.android.gms:play-services-wearable:7.5.0' - compile 'junit:junit:4.12' - testCompile 'org.json:json:20140107' - testCompile 'org.mockito:mockito-core:2.7.22' - testCompile 'org.powermock:powermock-api-mockito2:1.7.3' - testCompile 'org.powermock:powermock-module-junit4-rule-agent:1.7.3' - testCompile 'org.powermock:powermock-module-junit4-rule:1.7.3' - testCompile 'org.powermock:powermock-module-junit4:1.7.3' - androidTestCompile 'org.mockito:mockito-core:2.7.22' - androidTestCompile 'com.google.dexmaker:dexmaker:1.2' - androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.2' - compile(name: 'android-edittext-validator-v1.3.4-mod', ext: 'aar') - compile('com.google.android:flexbox:0.3.0') { - exclude group: 'com.android.support' + compile "org.apache.commons:commons-lang3:3.6" + compile "org.slf4j:slf4j-api:1.7.12" + compile "com.jjoe64:graphview:4.0.1" + compile "com.joanzapata.iconify:android-iconify-fontawesome:2.1.1" + compile "com.google.android.gms:play-services-wearable:7.5.0" + compile(name: "android-edittext-validator-v1.3.4-mod", ext: "aar") + compile("com.google.android:flexbox:0.3.0") { + exclude group: "com.android.support" } - compile('io.socket:socket.io-client:0.8.3') { + compile("io.socket:socket.io-client:0.8.3") { // excluding org.json which is provided by Android - exclude group: 'org.json', module: 'json' + exclude group: "org.json", module: "json" } - compile 'com.google.code.gson:gson:2.7' - compile 'com.google.guava:guava:20.0' + compile "com.google.code.gson:gson:2.7" + compile "com.google.guava:guava:20.0" - compile 'net.danlew:android.joda:2.9.9.1' - testCompile 'joda-time:joda-time:2.9.4.2' + compile "net.danlew:android.joda:2.9.9.1" + + testCompile "junit:junit:4.12" + testCompile "org.json:json:20140107" + testCompile "org.mockito:mockito-core:2.7.22" + testCompile "org.powermock:powermock-api-mockito2:${powermockVersion}" + testCompile "org.powermock:powermock-module-junit4-rule-agent:${powermockVersion}" + testCompile "org.powermock:powermock-module-junit4-rule:${powermockVersion}" + testCompile "org.powermock:powermock-module-junit4:${powermockVersion}" + testCompile "joda-time:joda-time:2.9.4.2" + + androidTestCompile "org.mockito:mockito-core:2.7.22" + androidTestCompile "com.google.dexmaker:dexmaker:${dexmakerVersion}" + androidTestCompile "com.google.dexmaker:dexmaker-mockito:${dexmakerVersion}" } diff --git a/app/src/main/java/info/nightscout/androidaps/Config.java b/app/src/main/java/info/nightscout/androidaps/Config.java index 874f75d2bf..6775b8dac6 100644 --- a/app/src/main/java/info/nightscout/androidaps/Config.java +++ b/app/src/main/java/info/nightscout/androidaps/Config.java @@ -11,6 +11,7 @@ public class Config { // PLUGINS public static final boolean NSCLIENT = BuildConfig.NSCLIENTOLNY; public static final boolean G5UPLOADER = BuildConfig.G5UPLOADER; + public static final boolean PUMPCONTROL = BuildConfig.PUMPCONTROL; public static final boolean DANAR = BuildConfig.PUMPDRIVERS; diff --git a/app/src/main/java/info/nightscout/androidaps/MainApp.java b/app/src/main/java/info/nightscout/androidaps/MainApp.java index 9fe435d838..55189ac4ee 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainApp.java +++ b/app/src/main/java/info/nightscout/androidaps/MainApp.java @@ -167,10 +167,16 @@ public class MainApp extends Application { MainApp.getConfigBuilder().initialize(); } NSUpload.uploadAppStart(); - if (MainApp.getConfigBuilder().isClosedModeEnabled()) + if (Config.NSCLIENT) + Answers.getInstance().logCustom(new CustomEvent("AppStart-NSClient")); + else if (Config.G5UPLOADER) + Answers.getInstance().logCustom(new CustomEvent("AppStart-G5Uploader")); + else if (Config.PUMPCONTROL) + Answers.getInstance().logCustom(new CustomEvent("AppStart-PumpControl")); + else if (MainApp.getConfigBuilder().isClosedModeEnabled()) Answers.getInstance().logCustom(new CustomEvent("AppStart-ClosedLoop")); else - Answers.getInstance().logCustom(new CustomEvent("AppStart")); + Answers.getInstance().logCustom(new CustomEvent("AppStart-OpenLoop")); new Thread(new Runnable() { @Override @@ -225,6 +231,10 @@ public class MainApp extends Application { return sBus; } + public static String gs(int id) { + return sResources.getString(id); + } + public static MainApp instance() { return sInstance; } diff --git a/app/src/main/java/info/nightscout/androidaps/data/Profile.java b/app/src/main/java/info/nightscout/androidaps/data/Profile.java index b2e5d0d9dc..db34f9d692 100644 --- a/app/src/main/java/info/nightscout/androidaps/data/Profile.java +++ b/app/src/main/java/info/nightscout/androidaps/data/Profile.java @@ -120,7 +120,7 @@ public class Profile { } } catch (JSONException e) { log.error("Unhandled exception", e); - ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.invalidprofile)); + ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.gs(R.string.invalidprofile)); } } @@ -386,6 +386,8 @@ public class Profile { } public BasalValue[] getBasalValues() { + if (basal_v == null) + basal_v = convertToSparseArray(basal); BasalValue[] ret = new BasalValue[basal_v.size()]; for (Integer index = 0; index < basal_v.size(); index++) { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java index c6a5d4bbf9..be7fca5da9 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java @@ -437,22 +437,6 @@ public class ConfigBuilderPlugin implements PluginBase, ConstraintsInterface, Tr return true; } -/* - @Override - public PumpDescription getPumpDescription() { - if (activePump != null) - return activePump.getPumpDescription(); - else { - PumpDescription emptyDescription = new PumpDescription(); - emptyDescription.isBolusCapable = false; - emptyDescription.isExtendedBolusCapable = false; - emptyDescription.isSetBasalProfileCapable = false; - emptyDescription.isTempBasalCapable = true; // needs to be true before real driver is selected - emptyDescription.isRefillingCapable = false; - return emptyDescription; - } - } -*/ /** * Constraints interface @@ -652,7 +636,7 @@ public class ConfigBuilderPlugin implements PluginBase, ConstraintsInterface, Tr @Override @Nullable public TemporaryBasal getTempBasalFromHistory(long time) { - return activeTreatments.getTempBasalFromHistory(time); + return activeTreatments != null ? activeTreatments.getTempBasalFromHistory(time) : null; } @Override diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java index 2ae44c80ef..1f03c16987 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java @@ -1058,9 +1058,9 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, baseBasalView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - String fullText = MainApp.sResources.getString(R.string.virtualpump_basebasalrate_label) + ": " + DecimalFormatter.to2Decimal(MainApp.getConfigBuilder().getProfile().getBasal()) + "U/h\n"; + String fullText = MainApp.sResources.getString(R.string.pump_basebasalrate_label) + ": " + DecimalFormatter.to2Decimal(MainApp.getConfigBuilder().getProfile().getBasal()) + "U/h\n"; if (activeTemp != null) { - fullText += MainApp.sResources.getString(R.string.virtualpump_tempbasal_label) + ": " + activeTemp.toStringFull(); + fullText += MainApp.sResources.getString(R.string.pump_tempbasal_label) + ": " + activeTemp.toStringFull(); } OKDialog.show(getActivity(), MainApp.sResources.getString(R.string.basal), fullText, null); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Persistentnotification/PersistentNotificationPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Persistentnotification/PersistentNotificationPlugin.java index dc67a1449d..9e631def18 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Persistentnotification/PersistentNotificationPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Persistentnotification/PersistentNotificationPlugin.java @@ -139,8 +139,8 @@ public class PersistentNotificationPlugin implements PluginBase { } } - if (MainApp.getConfigBuilder().isTempBasalInProgress()) { - TemporaryBasal activeTemp = MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis()); + TemporaryBasal activeTemp = MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis()); + if (activeTemp != null) { line1 += " " + activeTemp.toStringShort(); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/services/DanaRSService.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/services/DanaRSService.java index bd6f5ca690..7790257640 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/services/DanaRSService.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/services/DanaRSService.java @@ -258,6 +258,7 @@ public class DanaRSService extends Service { MainApp.bus().post(bolusingEvent); SystemClock.sleep(1000); } + // do not call loadEvents() directly, reconnection may be needed ConfigBuilderPlugin.getCommandQueue().loadEvents(new Callback() { @Override public void run() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/services/DanaRv2ExecutionService.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/services/DanaRv2ExecutionService.java index 6d6ba34838..71a2f9ac79 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/services/DanaRv2ExecutionService.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/services/DanaRv2ExecutionService.java @@ -424,6 +424,7 @@ public class DanaRv2ExecutionService extends Service { MainApp.bus().post(bolusingEvent); SystemClock.sleep(1000); } + // do not call loadEvents() directly, reconnection may be needed ConfigBuilderPlugin.getCommandQueue().loadEvents(new Callback() { @Override public void run() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsPlugin.java index 05c90d27c4..513306fde8 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsPlugin.java @@ -439,8 +439,10 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface { @Override public double getTempBasalRemainingMinutesFromHistory() { - if (isTempBasalInProgress()) - return getTempBasalFromHistory(System.currentTimeMillis()).getPlannedRemainingMinutes(); + TemporaryBasal activeTemp = getTempBasalFromHistory(System.currentTimeMillis()); + if (activeTemp != null) { + return activeTemp.getPlannedRemainingMinutes(); + } return 0; } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/XDripStatusline/StatuslinePlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/XDripStatusline/StatuslinePlugin.java index 60d784d377..5fb902c2eb 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/XDripStatusline/StatuslinePlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/XDripStatusline/StatuslinePlugin.java @@ -182,10 +182,9 @@ public class StatuslinePlugin implements PluginBase { //Temp basal TreatmentsInterface treatmentsInterface = MainApp.getConfigBuilder(); - if (treatmentsInterface.isTempBasalInProgress()) { - TemporaryBasal activeTemp = treatmentsInterface.getTempBasalFromHistory(System.currentTimeMillis()); + TemporaryBasal activeTemp = treatmentsInterface.getTempBasalFromHistory(System.currentTimeMillis()); + if (activeTemp != null) { status += activeTemp.toStringShort(); - } //IOB diff --git a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java index 460366a872..39efae1dae 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java +++ b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java @@ -1,5 +1,6 @@ package info.nightscout.androidaps.queue; +import android.content.Context; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.text.Html; @@ -38,33 +39,33 @@ import info.nightscout.androidaps.queue.commands.CommandTempBasalPercent; /** * Created by mike on 08.11.2017. - * + *

* DATA FLOW: * --------- - * + *

* (request) - > ConfigBuilder.getCommandQueue().bolus(...) - * + *

* app no longer waits for result but passes Callback - * + *

* request is added to queue, if another request of the same type already exists in queue, it's removed prior adding * but if request of the same type is currently executed (probably important only for bolus which is running long time), new request is declined * new QueueThread is created and started if current if finished * CommandReadStatus is added automatically before command if queue is empty - * + *

* biggest change is we don't need exec pump commands in Handler because it's finished immediately * command queueing if not realized by stacking in different Handlers and threads anymore but by internal queue with better control - * + *

* QueueThread calls ConfigBuilder#connect which is passed to getActivePump().connect * connect should be executed on background and return immediately. afterwards isConnecting() is expected to be true - * + *

* while isConnecting() == true GUI is updated by posting connection progress - * + *

* if connect is successful: isConnected() becomes true, isConnecting() becomes false - * CommandQueue starts calling execute() of commands. execute() is expected to be blocking (return after finish). - * callback with result is called after finish automatically + * CommandQueue starts calling execute() of commands. execute() is expected to be blocking (return after finish). + * callback with result is called after finish automatically * if connect failed: isConnected() becomes false, isConnecting() becomes false - * connect() is called again - * + * connect() is called again + *

* when queue is empty, disconnect is called */ @@ -72,7 +73,7 @@ public class CommandQueue { private static Logger log = LoggerFactory.getLogger(CommandQueue.class); private LinkedList queue = new LinkedList<>(); - private Command performing; + protected Command performing; private QueueThread thread = null; @@ -94,10 +95,19 @@ public class CommandQueue { } } + private synchronized boolean isLastScheduled(Command.CommandType type) { + if (queue.size() > 0 && queue.get(queue.size() - 1).commandType == type) { + return true; + } + return false; + } + + private synchronized void inject(Command command) { + // inject as a first command + queue.addFirst(command); + } + private synchronized void add(Command command) { - // inject reading of status when adding first command to the queue - if (queue.size() == 0 && command.commandType != Command.CommandType.READSTATUS) - queue.add(new CommandReadStatus("Queue", null)); queue.add(command); } @@ -128,7 +138,7 @@ public class CommandQueue { // After new command added to the queue // start thread again if not already running - private synchronized void notifyAboutNewCommand() { + protected synchronized void notifyAboutNewCommand() { if (thread == null || thread.getState() == Thread.State.TERMINATED) { thread = new QueueThread(this); thread.start(); @@ -166,28 +176,13 @@ public class CommandQueue { add(new CommandBolus(detailedBolusInfo, callback)); // Bring up bolus progress dialog (start here, so the dialog is shown when the bolus is requested, // not when the Bolus command is starting. The command closes the dialog upon completion). - if (detailedBolusInfo.context != null) { - BolusProgressDialog bolusProgressDialog = new BolusProgressDialog(); - bolusProgressDialog.setInsulin(detailedBolusInfo.insulin); - bolusProgressDialog.show(((AppCompatActivity) detailedBolusInfo.context).getSupportFragmentManager(), "BolusProgress"); - } else { - Intent i = new Intent(); - i.putExtra("insulin", detailedBolusInfo.insulin); - i.setClass(MainApp.instance(), BolusProgressHelperActivity.class); - i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - MainApp.instance().startActivity(i); - } + showBolusProgressDialog(detailedBolusInfo.insulin, detailedBolusInfo.context); // Notify Wear about upcoming bolus MainApp.bus().post(new EventBolusRequested(detailedBolusInfo.insulin)); } notifyAboutNewCommand(); - // Notify Wear about upcoming bolus - MainApp.bus().post(new EventBolusRequested(detailedBolusInfo.insulin)); - - notifyAboutNewCommand(); - return true; } @@ -336,11 +331,12 @@ public class CommandQueue { // returns true if command is queued public boolean readStatus(String reason, Callback callback) { - //if (isRunning(Command.CommandType.READSTATUS)) { - // if (callback != null) - // callback.result(executingNowError()).run(); - // return false; - //} + if (isLastScheduled(Command.CommandType.READSTATUS)) { + log.debug("QUEUE: READSTATUS " + reason + " ignored as duplicated"); + if (callback != null) + callback.result(executingNowError()).run(); + return false; + } // remove all unfinished //removeAll(Command.CommandType.READSTATUS); @@ -419,4 +415,18 @@ public class CommandQueue { } else return true; } + protected void showBolusProgressDialog(Double insulin, Context context) { + if (context != null) { + BolusProgressDialog bolusProgressDialog = new BolusProgressDialog(); + bolusProgressDialog.setInsulin(insulin); + bolusProgressDialog.show(((AppCompatActivity) context).getSupportFragmentManager(), "BolusProgress"); + } else { + Intent i = new Intent(); + i.putExtra("insulin", insulin); + i.setClass(MainApp.instance(), BolusProgressHelperActivity.class); + i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + MainApp.instance().startActivity(i); + } + } + } diff --git a/app/src/main/java/info/nightscout/androidaps/queue/commands/Command.java b/app/src/main/java/info/nightscout/androidaps/queue/commands/Command.java index 9c5a8cf6ab..8875ff84a8 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/commands/Command.java +++ b/app/src/main/java/info/nightscout/androidaps/queue/commands/Command.java @@ -30,7 +30,7 @@ public abstract class Command { public void cancel() { PumpEnactResult result = new PumpEnactResult(); result.success = false; - result.comment = MainApp.sResources.getString(R.string.connectiontimedout); + result.comment = MainApp.gs(R.string.connectiontimedout); if (callback != null) callback.result(result).run(); } diff --git a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandReadStatus.java b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandReadStatus.java index 46c524fa29..44c778c5f7 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandReadStatus.java +++ b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandReadStatus.java @@ -27,6 +27,6 @@ public class CommandReadStatus extends Command { @Override public String status() { - return "READSTATUS"; + return "READSTATUS " + reason; } } diff --git a/app/src/main/res/layout/danar_fragment.xml b/app/src/main/res/layout/danar_fragment.xml index ac48032690..93166c9483 100644 --- a/app/src/main/res/layout/danar_fragment.xml +++ b/app/src/main/res/layout/danar_fragment.xml @@ -151,7 +151,7 @@ android:layout_weight="1" android:gravity="end" android:paddingRight="5dp" - android:text="@string/virtualpump_battery_label" + android:text="@string/pump_battery_label" android:textSize="14sp" /> IOB от болуси ОБШО Старт сега - Базова базална стойност - Батерия + Базова базална стойност + Батерия Удължен болус - Резервоар + Резервоар OK Грешка в базата данни - Временен базал + Временен базал ВИРТУАЛНА ПОМПА Последно изпълнение Параметри на входа @@ -223,7 +223,7 @@ Грешка при свързване с помпата IOB на помпата Инсулин за деня - Последен болус: + Последен болус: ч по-рано Грешни входящи данни Неправилна стойност @@ -543,7 +543,7 @@ PRE BAS Firmware - Последно свързване + Последно свързване Bluetooh статус За приложението Missing SMS permission diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 1d43753930..751d559130 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -153,13 +153,13 @@ Bezpečnost zadání ošetřeni Nepodporovaná verze NSClient Virtualní pumpa - Základní hodnota bazálu - Baterie + Základní hodnota bazálu + Baterie Prodloužený bolus - Zásobník + Zásobník OK Chyba databáze - Dočasný bazál + Dočasný bazál VIRTUÁLNÍ PUMPA xDrip Prodloužený bolus @@ -199,7 +199,7 @@ Jednotek za den Chybná vstupní data IOB z pumpy - Poslední bolus + Poslední bolus Hodnota nenastavena správně Zobrazit profil Vybrané zařízení nenalezeno @@ -212,7 +212,7 @@ Obnovit profil Uložit Úspěch - Poslední spojení + Poslední spojení Zrušit dočasný bazál Bolus %.2fU aplikován úspěšně Chyba při aplikování bolusu diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 8d178cb301..33a4b1bed4 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -23,6 +23,7 @@ Ratio: Dauer: Bolus-Abgabefehler + Batterie OK Basal Bolus @@ -91,11 +92,13 @@ IE Auf Virtuelle Pumpe + Reservoir xDrip VIRTUELLE PUMPE SQL Error Verlängerter Bolus Sichtbar + Basis-Basalrate GESAMT Nicht unterstützte Version des Nightscout-Clients BZ @@ -204,6 +207,8 @@ Profil neuladen Speichern Erfolgreich + Letzte Verbindung + Letzter Bolus: Profil anzeigen DanaR Profil-Einstellungen DIA [h] @@ -300,7 +305,7 @@ SP PROF HOME - OBJ + ZIEL OAPS LOOP LP @@ -314,7 +319,7 @@ Bitte verwende nur Ziffern von %1$s - %2$s. Warte auf Pumpe Wear - Verwende das kurze durchschnittliche Delta statt des einfachen Deltas + Verwende immer das kurze durchschnittliche Delta statt des einfachen Deltas Sinnvoll, wenn die Daten von einer ungefilterten Quelle Signalrauschen haben. Tagesinsulin-Limit wird erreicht BR @@ -327,11 +332,11 @@ Bluetooth-Status Kumulative TDD Datum - Exponentiell Gewichtete TDD + Exponentiell gewichtete TDD Veraltete Daten, bitte klicke auf \"Reload\" xds - xDrip Statuszeile (Uhr) - xDrip Status (Uhr) + xDrip+ Statuszeile (Uhr) + xDrip+ Status (Uhr) xDrip+ nicht installiert Zeige BGI Füge BGI zur Statuszeile hinzu @@ -444,7 +449,7 @@ Logs anzeigen nicht erfolgreich - bitte Telefon prüfen Nicht verfügbar - NSClient hat keine Schreibrechte. Falscher API-Key? + Nightscout-Client hat keine Schreibrechte. Falscher API-Key? Alarm-Optionen Aktiviere Broadcasts für andere Apps (z. B. xDrip+). Aktiviere lokale Broadcasts. @@ -543,7 +548,7 @@ Bitte Rechte gewähren Hoch- und Niedrig-Werte für die Übersicht- und die Smartwatch-Anzeige Zielbereich für die Grafikanzeige - Stelle bei aktivierter Autosense-Funktion sicher, dass du alle gegessenen Kohlenhydrate eingibst. Ansonsten können die Kohlenhydrate-Abweichung zu falsche Resistenz-/Empfindlichkeitswerten führen! + Stelle bei aktivierter Autosense-Funktion sicher, dass du alle gegessenen Kohlenhydrate eingibst. Ansonsten können die Kohlenhydrate-Abweichung zu falschen Resistenz-/Empfindlichkeitswerten führen! Sensitivität AAPS Sensitivität Oref0 Durchschnittliche Sensitivität @@ -587,7 +592,7 @@ Zeige die Übersichtsbenachrichtigungen auch auf der Uhr an. Kurzes durchschnittl. Delta Rapid-Acting Oref - Vorgabe: true. Erlaubt Autosense den Ziel-BZ-Bereich in Verbindung mit ISF und Basal anzupassen. + Vorgabe: erlaubt. Erlaubt Autosense den Ziel-BZ-Bereich in Verbindung mit ISF und Basal anzupassen. Intervall für Autosense [h] Anzahl der vergangenen Stunden, die verwendet werden, um die Sensitivität zu erkennen (Zeit, in der KH resorbiert werden, ist nicht berücksichtigt) Entscheide anhand von dieser Erfahrung, wie hoch max Basal sein sollte, und übernehme den Wert in die Pumpen- und AAPS-Einstellungen @@ -597,7 +602,7 @@ Fein-Einstellung des Closed-Loops, Erhöhen von max IOB über 0 und langsames Heruntersetzen des Zielbereichs Eine Woche erfolgreiches Loopen am Tag mit regelmäßiger Kohlenhydrat-Eingabe Passe, falls notwendig, Basal und Faktoren an und aktiviere dann die Autosense-Funktion - Aktiviere zusätzliche Funktionen wie z. B. den Mahlzeitenassistent + Aktiviere zusätzliche Funktionen, wie z. B. den Mahlzeitenassistent Stark veraltete Daten Stark veraltete Daten seit [Min.] Dutch @@ -665,8 +670,8 @@ Alarm, wenn keine Glukose-Daten empfangen werden Alarm, wenn die Pumpe nicht erreichbar ist Pumpe ist nicht erreichbar Grenze [Min.] + Aktualisieren TZ - Bitte starte dein Telefon neu oder starte AndroidAPS in den System-Einstellungen neu. Andernfalls wird AndroidAPS nicht protokolliert (wichtig zum Nachverfolgen und Verifizieren, dass der Algorithmus korrekt funktioniert) TBR Pumpen-Speicher Aktiviere die SuperBolus-Funktion im Wizard. Nicht aktivieren, wenn du nicht weißt, welche Auswirkungen dieser Bolus hat! ES KANN ZU EINER ÜBERDOSIERUNG AN INSULIN KOMMEN! @@ -695,6 +700,67 @@ Wähle in xDrip+ 640g/Eversense als Daten-Quelle Nightscout-Client BZ Basal-Wert wurde durch den kleinst möglichen Wert ersetzt + APS ausgewählt + Loop aktiviert + Nightscout-Client hat Schreibrechte + Maximales IOB richtig gesetzt + Closed mode aktiviert + Aktiviere zusätzliche Funktionen wie z. B. den SMB + BT Watchdog + DexcomG5 App (patched) + Aktivität + %d%% (%d Min. verbleibend) + Keine Verbindung zur Pumpe seit %d Min. + Bolusabgabe gestoppt + Bolusabgabe wird abgebrochen + Fehlerprotokol + Status + Keine Verbindung zur Pumpe + Gestoppt (Benutzer) + Gestoppt (Fehler) + In Betrieb + TDDS + Bolusabgabe wird vorbereitet + TBR wird abgebrochen + TBR wird gesetzt (%d%% / %d Min.) + Bolus (%.1f IE) wird abgegeben + Bitte starte dein Telefon neu oder starte AndroidAPS in den System-Einstellungen neu. Andernfalls wird AndroidAPS nicht protokolliert (wichtig zum Nachverfolgen und Verifizieren, dass der Algorithmus korrekt funktioniert) + TBR + %.1f IE (%s, %s) + Nutze System-Benachrichtigungen für Alarme + Ein gleich großer Bolus wurde in der letzten Minute angefordert. Dies ist nicht zulässig, um ungewollte Doppelboli zu verhindern und vor eventuellen Bugs zu schützen. + Historie wird gelesen + Basalratenprofil wird aktualisiert + Verbindung wird wieder hergestellt + Der abgegebene Bolus konnte nicht bestätigt werden. Bitte prüfe auf der Pumpe, ob ein Bolus abgegeben wurde und erstelle einen Eintrag im Careportal falls nötig. + Die Bolusabgabe ist fehlgeschlagen: Es wurde scheinbar kein Bolus abgegeben. Bitte prüfe auf der Pumpe, ob ein Bolus abgegeben wurde. Um doppelte Boli durch Programmfehler zu vermeiden, werden Boli nicht automatisch wiederholt. + Wegen eines Fehlers wurden nur %.2f IE von den angeforderten %.2f IE abgegeben. Bitte prüfe den abgegebenen Bolus auf der Pumpe. + Historie + Status wird aktualisiert + Die Pumpe wird initialisiert + Jetzt + Nie + Der Alarm \"TBR ABBRUCH\" wurde bestätigt + Warnung + Leer + Niedrig + Normal + Durchschnitt: %3.1f IE + Maximum: %3.1f IE + Minimum: %3.1f IE + Diese Aktion wird von der Pumpe nicht unterstützt + Alarme + Die Batterie in der Pumpe ist fast leer + Das Reservoir in der Pumpe ist fast leer + Die Pumpe zeigt einen Fehler an E%d: %s + Unsichere Verwendung: In der Pumpe ist nicht das erste Basalratenprofil gewählt. Der Loop wird deaktiviert bis dies korrigiert ist. + Unsichere Verwendung: Ein erweiterter oder Multiwave-Bolus ist aktiv. Der Loop wird für die nächsten 6 Stunden kein zusätzliches Insulin abgeben. + Um die Fehlerhistorie der Pumpe zu lesen, drücke lange auf ALARME.\nWARNUNG: Es gibt einen bekannten Fehler in der Pumpe, der dazu führt, dass die Pumpe nach dieser Aktion erst wieder Verbindungen annimmt, wenn auf der Pumpe selbst eine Taste gedrückt wird. Aus diesem Grund sollte diese Aktion nicht durchgeführt werden. + Bitte aktualisiere die Uhrzeit der Pumpe + Um die TDD-Statistik der Pumpe zu lesen, drücken Sie den TDDS Knopf lange.\nWARNUNG: Es gibt einen bekannten Fehler in der Pumpe der dazu führt, dass die Pumpe nach dieser Aktion erst wieder Verbindungen annimmt, wenn auf der Pumpe selbst ein Konpf gedrückt wird. Aus diesem Grund sollte diese Aktion nicht durchgeführt werden. + Dies wird den gesamten Speicher und den Status der Pumpe auslesen sowie alle Einträge in „Meine Daten“ und die Basalrate. Boli und TBR werden unter Behandlungen gespeichert, sofern sie nicht bereits vorhanden sind. Dies kann zu doppelten Einträgen führen, wenn die Uhrzeit der Pumpe abweicht. Das Auslesen des Speichers ist normaler Weise für das Loopen unnötig und nur für besondere Umstände vorgesehen. Wenn Du es dennoch tun willst, drücke noch einmal länger den Button. ACHTUNG: Dies kann einen Fehler auslösen, der dazu führt, dass die Pumpe keine Verbindungsversuche mehr akzeptiert. Erst die Betätigung einer Taste an der Pumpe beendet diesen Zustand. Nach Möglichkeit sollte daher das Auslesen vermieden werden. + Möchtest Du wirklich den gesamten Speicher der Pumpe auslesen und die möglichen Konsequenzen des Vorgangs tragen? + Nicht mehr genug Insulin im Reservoir für den Bolus Ja Nein BZ Berechnung @@ -713,18 +779,4 @@ Standarwert: 2\nBolus snooze (\"Bolus-Schlummer\") bremst den Loop nach einem Mahleiten-Bolus, damit dieser nicht mit niedrigen TBR reagiert, wenn Du gerade gegessen hast. Beispiel: Der Standardwert 2 bewirkt, dass bei einem 3 Stunden DIA der Bolus snooze während 1.5 Stunden nach dem Bolus linear ausläuft (3 h Dia / 2 = 1.5 h Bolus snooze). Standardwert: 3.0\nDies ist eine Einstellung für die Standard-Kohlenhydrat-Absorptionswirkung pro 5 Minuten. Der Standardwert ist 3mg/dl/5min. Dies wirkt sich darauf aus, wie schnell der COB-Wert fällt und wieviel KH-Absorption bei der Berechnung des vorhergesagten BZ angenommen wird, wenn der BZ stärker als erwartet fällt oder nicht so stark wie erwartet steigt. Achtung! Normalerweise musst Du diese Werte nicht ändern. Bitte KLICKE HIER und LESE den Text. Verändere Werte erst, wenn Du den Inhalt des Textes verstanden hast. - APS ausgewählt - Loop aktiviert - Nightscout-Client hat Schreibrechte - Maximales IOB richtig gesetzt - Closed mode aktiviert - Letzte Verbindung - Basis-Basalrate - TBR - Batterie - Reservoir - Letzter Bolus: - Aktiviere zusätzliche Funktionen wie z. B. den SMB - BT Watchdog - DexcomG5 App (patched) diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index c986fdba7f..b9fd9bff78 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -50,11 +50,11 @@ Σύνολο Έναρξη τώρα ΕΙΚΟΝΙΚΗ ΑΝΤΛΙΑ - Βάση Βασικού Ρυθμού - Προσωρ. Ρυθμός + Βάση Βασικού Ρυθμού + Προσωρ. Ρυθμός Εκτετεμμένο bolus - Μπαταρία - Ρεζερβουάρ + Μπαταρία + Ρεζερβουάρ ΟΚ Λάθος SQL Τελευταίος Υπολογισμός @@ -219,7 +219,7 @@ Λάθος σύνδεσης αντλίας IOB αντλίας "Μονάδες ανά ημέρα " - Τελευταίο Bolus: + Τελευταίο Bolus: ώρες πριν Μη έγκυρα δεδομένα Η τιμή δεν μπήκε σωστά @@ -540,7 +540,7 @@ PRE Β.Ρ. Firmware - Τελευταία σύνδεση + Τελευταία σύνδεση Κατάσταση Bluetooth Σχετικά με Λείπει εξουσιοδότηση SMS diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index a87b40330f..7259194dee 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -46,11 +46,11 @@ TOTAL Ejecutar ahora BOMBA VIRTUAL - Dosis Basal Base - Basal Temporal + Dosis Basal Base + Basal Temporal Bolo extendido - Batería - Depósito: + Batería + Depósito: OK Error de SQL Última ejecución @@ -210,10 +210,10 @@ No se encuentra adaptador Bluetooth El dispositivo seleccionado no se encuentra Error de conexión de la bomba - Última conexión + Última conexión Bomba IOB Unidades diarias - Último bolo: + Último bolo: h antes Datos invalidos Valor no establecido correctamente diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 5e72429865..148b1aab2d 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -115,7 +115,7 @@ Ricaricare Data Errata IOB Microinfusore - Ultimo Bolo + Ultimo Bolo Password Microinfusore Setting Micro ricarica @@ -412,7 +412,7 @@ Abilitazione di funzioni aggiuntive per l\'uso quotidiano, ad esempio assistenza avanzata del pasto Errore SQL - Basale temporale + Basale temporale Visibile Pompa Virtuale In attesa del micro @@ -437,12 +437,12 @@ VPUMP Impostazioni del Micro virtuale ok - Serbatoio - Ultima conessione + Serbatoio + Ultima conessione Firmware Bolo Esteso - Batteria - Base basale + Batteria + Base basale Micro Virtuale UpLoading Aggiornamento basale diff --git a/app/src/main/res/values-ko/strings.xml b/app/src/main/res/values-ko/strings.xml index 538dbb2023..3b62dffeab 100644 --- a/app/src/main/res/values-ko/strings.xml +++ b/app/src/main/res/values-ko/strings.xml @@ -48,11 +48,11 @@ 지금 실행 가상 펌프 - 기본 기초주입량 - 임시기초주입 + 기본 기초주입량 + 임시기초주입 확장식사주입 - 배터리 - 인슐린 잔량 + 배터리 + 인슐린 잔량 OK SQL 에러 최근 실행 @@ -224,7 +224,7 @@ 펌프 연결 에러 펌프 IOB 일 인슐린 총량 - 최근 식사주입: + 최근 식사주입: 시간 전 사용할수 없는 입력 데이터 값이 제대로 설정되지 않았습니다 @@ -553,7 +553,7 @@ PRE BAS 펌웨어 - 최근 연결 + 최근 연결 블루투스 상태 버전정보 SMS 권한 누락 @@ -646,7 +646,6 @@ ACTIVATE PROFILE Date INVALID - 펌프연동 대기중 연동완료 연동시간초과 @@ -679,5 +678,4 @@ 워치로 작동하기 임시목표와 관리입력을 워치로 설정합니다. 연결시간초과 - diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index a9151cde59..4c553da786 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -1,6 +1,5 @@ - AndroidAPS Glimp MM640g Absoluut @@ -13,7 +12,7 @@ Volwassene Uitgebreide instellingen Herstart je telefoon of herstart AndroidAPS vanuit de systeem instellingen a.u.b. anders zal AndroidAPS geen logboek hebben (Belangrijk om te controleren of de algoritmes correct werken)! - Nuttig wanneer gevens van niet gefilterde bronnes zoals Xdrip wispelturig zijn + Nuttig wanneer gegevens van niet gedempte bronnen zoals Xdrip wispelturig zijn AndroidAPS gestart Insuline daglimiet bereikt APS Mode @@ -40,17 +39,17 @@ VIRTUELE POMP Toon Upload status naar NS - Tijdelijk basaal + Tijdelijk basaal SQL Storing VP Virtuele pomp instellingen OK - Reservoir - Laatste verbinding + Reservoir + Laatste verbinding Firmware EXT Vertraagde bolus - Batterij + Batterij Virtuele Pomp Uploaden UPLD @@ -92,7 +91,6 @@ CGM & OPENAPS CGM Sens. ingebracht CGM Sens. Start - Multiwave bolus Correctie bolus Sport Ouderdom insuline @@ -175,7 +173,7 @@ Activeer vertraagde bolussen op de pomp Storing glucose - Geschiedenis + Historiek Alarm Herstart Resultaat @@ -275,7 +273,7 @@ OpenAPS OAPS OpenAPS AMA - Laatste bolus + Laatste bolus Pomp wachtwoord DanaR pomp instellingen Hervullen @@ -454,7 +452,7 @@ Maximaal basaal IOB OpenAPS kan toedienen [E] Profiel Waarde %s is buiten de toegestane limieten - Basis basale dosis + Basis basale dosis Laatse berekening Laatste uitvoering Glucose gegevens @@ -462,7 +460,6 @@ Berekende gegevens IOB gegevens DIt is de maximale waarde waarop het basaal door OpenAPS ingesteld kan worden - Profiel wissel NS Profiel NSPROFIEL Pomp @@ -510,9 +507,9 @@ Verwijder Wijzig Home - Geldigheid: + Beschikbaarheid: Koolhydraten: - Knop tekst: + Naam: Kalibratie Bolus wizard E bolus @@ -566,7 +563,7 @@ DOEL Afsluiting Lopende berichten - Opene instellingen op Wear + Open instellingen op Wear Maximale E/u dat OpenAPS kan toedienen Verschil instellingen Bereik voor visualisatie @@ -592,8 +589,8 @@ Pomp uitschakelen Pomp onderbreken Pomp onderbroken. Klik om de status te vernieuwen - Instelassisten - Instelassistent instellingen + Vaste maaltijd + Vaste maaltijd instellingen SEN Verwijder gegeven: Verzend alle gegevens opnieuw @@ -679,4 +676,115 @@ Bedieningen via horloge Ampull leeg Wachten op koppelen van de pomp + Storingen + Wijzigingen van profiel + Bluetooth + Voeding + Waarschuwing bij niet bereikbare pomp + Een bolus met dezelfde hoeveelheid was gevraagd binnen de minuut. Om accidentiële of door bugs veroorzaakte dubbele bolussen te vermijden is deze bolus geannuleerd + estopt Bolus toediening wordt + Vet + Bolus toediening gestopt + Gebruik systeem notificaties voor waarschuwingen + Toon gedetaillieerde delta + Niet ondersteune pomp firmware + DexcomG5 App (aangepast) + g + kJ + En + Prot + INFO + BT Watchdog + Desactiveert de bluetooth functie van de telefoon gedurende een ogenblik. Dit kan op sommige gsm\'s een vastgelopen bluetooth service verhelpen. + Geen BG metingen + Uitvoeren van gebeurtenis + Pomp niet beschikbaar + Pomp niet beschikbaar sinds [min] + Pomp service gecorrigeerd + Lokaal gegenereerde waarschuwingen + Bolus toediening gestart + Toon delta met eenextra decimaal punt + Wacht op complete bolus toediening Resterend %d sec. + Dringend alarm + TT + Gebruik systeem notficaties voor waarchuwingen en notificaties + Opdracht is nu uitgevoerd + Alarm als er geen BG gegevens ontvangen zijn + Aangepaste APK downloaden + Upload BG gegevens naar NS + G5 Upload instellingen + Loop Actief + Ja + Nee + In xDrip+ kies 640g/Eversense data bron + NSClient BG + Basaal IOB meerekenen + APS geslecteerd + Stuur BG data naar xDrip+ + Basale waarde vervangen door minimaal ondersteunde waarde + Tijdelijk doel berekenen + Superbolus berekening + NSClient heeft schrijf rechten + Activeren van extra functies tijdes de dag zoals SMB + BG meerekenen + Bolus IOB meerekenen + Closed modus actief + COB berekening + ]]> + ]]> + AndroidAPS + Nul waarde in basaal profiel + BG beschikbaar op gekozen bron + Enkel positief + Enkel negatief + Maximum IOB juist ingesteld + Trend berekening + Profiel wissel ontvangen via NS maar dit profiel bestaat niet op gsm + "Bolus in pomp programmeren " + Vernieuw + Status + Geen verbinding%d%% (%d min resterend) + %.1f E (%s, %s) + Initialiseren + Verbinding verbroken + Herstel van verbroken verbindng + Waarschuwing + Pomp klok moet bijgesteld worden + Leeg + Bijna leeg + Maximum: %3.1f E + Normaal + Nooit + Vernieuwen + Historiek + Storingen + Batterij pomp is bijna leeg + Gevraagde is niet momeglijk met de pomp + Zojuist + TB GEANNULEERD Waarschuwing is bevestigd + Annuleren van TB + Gestopt door een storing + Gestopt door de gebruiker + Actief + Insuline ampul is bijna leeg + Pomp is in storing, controleer op de pomp + Bolus (%.1f E) + Minimum: %3.1f E + Gemiddelde: %3.1f E + Instellen van basaal profiel + Lezen van pomp historiek + Ben je zeker dat je alle data van de pomp wil ophalen en de consequenties hiervan wil dragen? + Om de pomp fouthistoriek op te halen, druk lang op de Storingen knop OPGELET: dit kan een bug veroorzaken waardoor de pomp alle verbindingen verbreekt en het vereist is op een knop op de pomp te duwen, dit wordt daarom afgeraden. + Maar %.2f E van de gevraagde %.2f E zijn toegediend door een storing. Gelieve op de pomp te controleren en het gepaste gevolg uit te voeren. + "Om de TTD van de pomp op te halen, lang duwen op de TDDS knop OPGELET: dit kan een bug veroorzaken waardoor de pomp alle verbindingen verbreekt en het vereist is op een knop op de pomp te duwen, dit wordt daarom afgeraden." + Toedienen en controleren van de bolus in de pomp historiek is mislukt, controleer de pomp en creëer een manuele bolus in het Careportal tabblad + Bolus toedienen mislukt. Waarschijnlijk is er geen bolus toegediend. Gelieve de pomp te controleren om een dubbele bolus te vermijden. Als bescherming tegen programmeerfouten worden bolussen niet automatisch opnieuw uitgevoerd. + Actie + Instellen TBR (%d%% / %d min) + Dit zal de volledige hystoriek en status van de pomp ophalen. Alles in Mijn Gegevens en basale patronen. Bolussen en TBR zullen aan de behandelingen worden toegevoegd indien deze nog niet aanwezig zijn. Dit kan eveneens dubbele invoeren genereren als de pomp tijd niet synchroon is. Gebruik maken van deze functie tijdens looped wordt afgeraden enkel gebruiken in speciale gevallen. Als je dit echt wil doen, duw lang op deze knop. OPGELET: dit kan een bug veroorzaken waardoor de pomp alle verbindingen verbreekt en het vereist is op een knop op de pomp te duwen, dit wordt daarom afgeraden. + Onvoorzichtig gebruik: Vertraagde of multi wave bolussen zijn toegediend in de afgelopen 6 uur op het geselecteerde basaal patroon is niet 1. Loop is onderbroken tot de 6 uur nadat deze bolussen of andere basale patronen zijn gedetecteerd. Alleen normale bolussen en basaal patroon 1 zijn mogelijk binnen basaal patroon 1 + TDDS + Opgelet: verlengde en multi wafe bolussen zijn actief. Loop is naar onderdruk lage waardes enkel overgeschakeld gedurende 6 uur. Alleen gewone bolussen worden onderdsteund in loop modus. + Niet genoeg insuline aanwezig in reservoir voor de bolus + Combinatie-Bolus diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index ba0e44644c..1535d82c26 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -136,7 +136,7 @@ замена введенные данные неверны активный инсулин на помпе - предыдущий болюс + предыдущий болюс модель: %02X протокол: %02X код: %02X пароль помпы настройки помпы DanaR @@ -527,17 +527,17 @@ обновление значений базала передача данных виртуальная помпа - базовая величина базала - батарея + базовая величина базала + батарея продленный болюс прошивка - прошлое соединение - резервуар + прошлое соединение + резервуар OK настройки вирт помпы ВиртПомпа ошибка SQL - врем базал + врем базал статус передачи данных в NS виден ВИРТУАЛЬНАЯ ПОМПА diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 9b84ac7660..b27b70da43 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -134,7 +134,7 @@ Ladda om Fel på inlagd data Pump IOB - Sista bolus + Sista bolus Lösenord Pump DanaR pump inställningar Påfyllnad @@ -307,17 +307,17 @@ Virtuell Synlig Ladda upp till NS - Temp basal + Temp basal SQL Error VPUMP Virtuell pump inställningar OK - Reservoir - Sista kontakt + Reservoir + Sista kontakt Programversion Förlängd bolus - Batteri - Grund basal hastighet + Batteri + Grund basal hastighet Virtuell Pump Uppladdning Uppdaterar basal hastigheter diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 83f4a5ca2b..2b72b70b36 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -50,11 +50,11 @@ TOTAL Run now VIRTUAL PUMP - Base basal rate - Temp basal + Base basal rate + Temp basal Extended bolus - Battery - Reservoir + Battery + Reservoir OK SQL Error Last run @@ -234,7 +234,7 @@ Pump connection error Pump IOB Daily units - Last bolus: + Last bolus h ago Invalid input data Value not set properly @@ -268,7 +268,7 @@ DIA [h] Duration of Insulin Activity Failed to update basal profile - History + Errors Reload Uploading E bolus @@ -397,7 +397,7 @@ MM640g Ongoing Notification OLD DATA - %dmin ago + %d min ago %dmin ago Local Profile OpenAPS AMA @@ -591,7 +591,7 @@ PRE BAS Firmware - Last connection + Last connection Bluetooh status About Missing SMS permission @@ -682,6 +682,8 @@ Values not stored! Overview Notifications Pass the Overview Notifications through as wear confirmation messages. + Accu-Chek Combo + COMBO Enable broadcasts to other apps (like xDrip). Enable local Broadcasts. ACTIVITY & FEEDBACK @@ -821,5 +823,54 @@ Basal values not aligned to hours Zero value in profile Received profile switch from NS but profile doesn\'t exist localy + Programming pump for bolusing + Refresh + TDDS + State + Activity + No connection for %d min + %d%% (%d min remaining) + %.1f U (%s, %s) + Initializing + Disconnected + Suspended due to error + Suspended by user + Running + Cancelling TBR + Setting TBR (%d%% / %d min) + Bolusing (%.1f U) + Refreshing + Never + Requested operation not supported by pump + Unsafe usage: extended or multiwave boluses are active. Loop mode has been set to low-suspend only 6 hours. Only normal boluses are supported in loop mode + Unsafe usage: the pump uses a different basal rate profile than the first. The loop has been disabled. Select the first profile on the pump and refresh. + A bolus with the same amount was requested within the last minute. To prevent accidental double boluses and to guard against bugs this is disallowed. + Now + Reading pump history + pump history + Alerts + Setting basal profile + Pump cartridge level is low + Pump battery is low + The pump is showing the error E%d: %s + To read the pump\'s error history, long press the ALERTS button\n\nWARNING: this can trigger a bug which causes the pump to reject all connection attempts and requires pressing a button on the pump to recover and should therefore be avoided. + To read the pump\'s TDD history, long press the TDDS button\n\nWARNING: this can trigger a bug which causes the pump to reject all connection attempts and requires pressing a button on the pump to recover and should therefore be avoided. + Minimum: %3.1f U + Average: %3.1f U + Maximum: %3.1f U + Low + Empty + Normal + Pump clock update needed + History + Warning + This will read the full history and state of the pump. Everything in \"My Data\" and the basal rate. Boluses and TBRs will be added to Treatments if they don\'t already exist. This can cause entries to be duplicated because the pump\'s time is imprecise. Using this when normally looping with the pump is highly discouraged and reserved for special circumstances. If you still want to do this, long press this button again.\n\nWARNING: this can trigger a bug which causes the pump to reject all connection attempts and requires pressing a button on the pump to recover and should therefore be avoided. + Are you really sure you want to read all pump data and take the consequences of this action? + TBR CANCELLED warning was confirmed + Bolus delivery failed. It appears no bolus was delivered. To be sure, please check the pump to avoid a double bolus and then bolus again. To guard against bugs, boluses are not automatically retried. + Only %.2f U of the requested bolus of %.2f U was delivered due to an error. Please check the pump to verify this and take appropriate actions. + Delivering the bolus and verifying the pump\'s history failed, please check the pump and manually create a bolus record using the Careportal tab if a bolus was delivered. + Recovering from connection loss + Not enough insulin for bolus left in reservoir diff --git a/app/src/test/java/info/nightscout/androidaps/queue/CommandQueueTest.java b/app/src/test/java/info/nightscout/androidaps/queue/CommandQueueTest.java new file mode 100644 index 0000000000..31d8636de2 --- /dev/null +++ b/app/src/test/java/info/nightscout/androidaps/queue/CommandQueueTest.java @@ -0,0 +1,143 @@ +package info.nightscout.androidaps.queue; + +import android.content.Context; +import android.text.Html; + +import com.squareup.otto.Bus; +import com.squareup.otto.ThreadEnforcer; + +import junit.framework.Assert; + +import org.json.JSONObject; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; + +import info.nightscout.androidaps.Constants; +import info.nightscout.androidaps.MainApp; +import info.nightscout.androidaps.data.DetailedBolusInfo; +import info.nightscout.androidaps.data.Profile; +import info.nightscout.androidaps.interfaces.PumpInterface; +import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; +import info.nightscout.androidaps.plugins.PumpMDI.MDIPlugin; +import info.nightscout.androidaps.queue.commands.Command; +import info.nightscout.utils.ToastUtils; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +/** + * Created by mike on 14.01.2018. + */ + +@RunWith(PowerMockRunner.class) +@PrepareForTest({MainApp.class, ConfigBuilderPlugin.class, ConfigBuilderPlugin.class, ToastUtils.class, Context.class}) +public class CommandQueueTest extends CommandQueue { + + String profileJson = "{\"dia\":\"3\",\"carbratio\":[{\"time\":\"00:00\",\"value\":\"30\"}],\"carbs_hr\":\"20\",\"delay\":\"20\",\"sens\":[{\"time\":\"00:00\",\"value\":\"100\"}],\"timezone\":\"UTC\",\"basal\":[{\"time\":\"00:00\",\"value\":\"0.1\"}],\"target_low\":[{\"time\":\"00:00\",\"value\":\"4\"}],\"target_high\":[{\"time\":\"00:00\",\"value\":\"5\"}],\"startDate\":\"1970-01-01T00:00:00.000Z\",\"units\":\"mmol\"}"; + + @Test + public void doTests() throws Exception { + prepareMock(0d, 0); + + // start with empty queue + Assert.assertEquals(0, size()); + + // add bolus command + bolus(new DetailedBolusInfo(), null); + Assert.assertEquals(1, size()); + + // add READSTATUS + readStatus("anyString", null); + Assert.assertEquals(2, size()); + + // adding another bolus should remove the first one (size still == 2) + bolus(new DetailedBolusInfo(), null); + Assert.assertEquals(2, size()); + + // clear the queue should reset size + clear(); + Assert.assertEquals(0, size()); + + // add tempbasal + tempBasalAbsolute(0, 30, true, null); + Assert.assertEquals(1, size()); + + // add tempbasal percent. it should replace previous TEMPBASAL + tempBasalPercent(0, 30, true, null); + Assert.assertEquals(1, size()); + + // add extended bolus + extendedBolus(1, 30, null); + Assert.assertEquals(2, size()); + + // add cancel temp basal should remove previous 2 temp basal setting + extendedBolus(1, 30, null); + Assert.assertEquals(2, size()); + + // cancel extended bolus should replace previous extended + extendedBolus(1, 30, null); + Assert.assertEquals(2, size()); + + // add setProfile + setProfile(new Profile(new JSONObject(profileJson), Constants.MGDL), null); + Assert.assertEquals(3, size()); + + // add loadHistory + loadHistory((byte) 0, null); + Assert.assertEquals(4, size()); + + // add loadEvents + loadEvents(null); + Assert.assertEquals(5, size()); + + clear(); + tempBasalAbsolute(0, 30, true, null); + pickup(); + Assert.assertEquals(0, size()); + Assert.assertNotNull(performing); + Assert.assertEquals(Command.CommandType.TEMPBASAL, performing.commandType); + resetPerforming(); + Assert.assertNull(performing); + } + + private void prepareMock(Double insulin, Integer carbs) throws Exception { + ConfigBuilderPlugin configBuilderPlugin = mock(ConfigBuilderPlugin.class); + when(configBuilderPlugin.applyBolusConstraints(insulin)).thenReturn(insulin); + when(configBuilderPlugin.applyCarbsConstraints(carbs)).thenReturn(carbs); + + PowerMockito.mockStatic(ConfigBuilderPlugin.class); + PumpInterface pump = MDIPlugin.getPlugin(); + when(ConfigBuilderPlugin.getActivePump()).thenReturn(pump); + + PowerMockito.mockStatic(MainApp.class); + MainApp mainApp = mock(MainApp.class); + when(MainApp.getConfigBuilder()).thenReturn(configBuilderPlugin); + when(MainApp.instance()).thenReturn(mainApp); + + PowerMockito.mockStatic(ToastUtils.class); + Context context = mock(Context.class); + String message = null; + PowerMockito.doNothing().when(ToastUtils.class, "showToastInUiThread", context, message); + + Bus bus = new Bus(ThreadEnforcer.ANY); + + when(MainApp.bus()).thenReturn(bus); + when(MainApp.gs(0)).thenReturn(""); + } + + @Override + protected synchronized void notifyAboutNewCommand() { + } + + @Override + protected void showBolusProgressDialog(Double insulin, Context context) { + } + + @Override + public boolean isThisProfileSet(Profile profile) { + return false; + } +} diff --git a/app/src/test/java/info/nightscout/utils/RoundTest.java b/app/src/test/java/info/nightscout/utils/RoundTest.java index d95ab2b391..1a801d2a7d 100644 --- a/app/src/test/java/info/nightscout/utils/RoundTest.java +++ b/app/src/test/java/info/nightscout/utils/RoundTest.java @@ -14,18 +14,21 @@ public class RoundTest { public void roundToTest() throws Exception { assertEquals( 0.55d, Round.roundTo(0.54d, 0.05d), 0.00000001d ); assertEquals( 1d, Round.roundTo(1.49d, 1d), 0.00000001d ); + assertEquals( 0d, Round.roundTo(0d, 1d), 0.00000001d ); } @Test public void floorToTest() throws Exception { assertEquals( 0.5d, Round.floorTo(0.54d, 0.05d), 0.00000001d ); assertEquals( 1d, Round.floorTo(1.59d, 1d), 0.00000001d ); + assertEquals( 0d, Round.floorTo(0d, 1d), 0.00000001d ); } @Test public void ceilToTest() throws Exception { assertEquals( 0.6d, Round.ceilTo(0.54d, 0.1d), 0.00000001d ); assertEquals( 2d, Round.ceilTo(1.49999d, 1d), 0.00000001d ); + assertEquals( 0d, Round.ceilTo(0d, 1d), 0.00000001d ); } } \ No newline at end of file diff --git a/wear/build.gradle b/wear/build.gradle index 682577fc8e..a28a5cc5cd 100644 --- a/wear/build.gradle +++ b/wear/build.gradle @@ -1,5 +1,10 @@ apply plugin: 'com.android.application' +ext { + supportLibraryVersion = "23.0.1" + wearableVersion = "2.0.1" +} + def generateGitBuild = { -> StringBuilder stringBuilder = new StringBuilder(); @@ -56,12 +61,12 @@ allprojects { dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') - //compile 'com.ustwo.android:clockwise-wearable:1.0.2' - provided 'com.google.android.wearable:wearable:2.0.1' - compile 'com.google.android.support:wearable:2.0.1' - compile 'com.google.android.gms:play-services-wearable:7.3.0' - compile files('libs/hellocharts-library-1.5.5.jar') - compile(name:'ustwo-clockwise-debug', ext:'aar') - compile 'com.android.support:support-v4:23.0.1' - compile 'me.denley.wearpreferenceactivity:wearpreferenceactivity:0.5.0' + compile files("libs/hellocharts-library-1.5.5.jar") + //compile "com.ustwo.android:clockwise-wearable:1.0.2" + provided "com.google.android.wearable:wearable:${wearableVersion}" + compile "com.google.android.support:wearable:${wearableVersion}" + compile "com.google.android.gms:play-services-wearable:7.3.0" + compile(name:"ustwo-clockwise-debug", ext:"aar") + compile "com.android.support:support-v4:23.0.1" + compile "me.denley.wearpreferenceactivity:wearpreferenceactivity:0.5.0" } diff --git a/wear/src/main/java/info/nightscout/androidaps/watchfaces/Steampunk.java b/wear/src/main/java/info/nightscout/androidaps/watchfaces/Steampunk.java index 06f50edfb0..3549b2a67d 100644 --- a/wear/src/main/java/info/nightscout/androidaps/watchfaces/Steampunk.java +++ b/wear/src/main/java/info/nightscout/androidaps/watchfaces/Steampunk.java @@ -178,7 +178,11 @@ public class Steampunk extends BaseWatchFace { gridColor = ContextCompat.getColor(getApplicationContext(), R.color.grey_steampunk); basalBackgroundColor = ContextCompat.getColor(getApplicationContext(), R.color.basal_dark); basalCenterColor = ContextCompat.getColor(getApplicationContext(), R.color.basal_dark); - pointSize = 1; + if (Integer.parseInt(sharedPrefs.getString("chart_timeframe", "3")) < 3) { + pointSize = 2; + } else { + pointSize = 1; + } setupCharts(); } @@ -237,7 +241,12 @@ public class Steampunk extends BaseWatchFace { private void changeChartTimeframe() { int timeframe = Integer.parseInt(sharedPrefs.getString("chart_timeframe", "3")); timeframe = (timeframe%5) + 1; + if (timeframe < 3) { + pointSize = 2; + } else { + pointSize = 1; + } + setupCharts(); sharedPrefs.edit().putString("chart_timeframe", "" + timeframe).commit(); } - } \ No newline at end of file