EventNewNotification, EventDismissNotification -> RxBus
This commit is contained in:
parent
654c90a836
commit
4642f0ab5b
69 changed files with 399 additions and 388 deletions
|
@ -291,9 +291,11 @@ dependencies {
|
||||||
}
|
}
|
||||||
testImplementation "org.skyscreamer:jsonassert:1.5.0"
|
testImplementation "org.skyscreamer:jsonassert:1.5.0"
|
||||||
testImplementation "org.hamcrest:hamcrest-all:1.3"
|
testImplementation "org.hamcrest:hamcrest-all:1.3"
|
||||||
|
/*
|
||||||
testImplementation("uk.org.lidalia:slf4j-test:1.2.0") {
|
testImplementation("uk.org.lidalia:slf4j-test:1.2.0") {
|
||||||
exclude group: "com.google.guava", module: "guava"
|
exclude group: "com.google.guava", module: "guava"
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
androidTestImplementation "org.mockito:mockito-core:2.8.47"
|
androidTestImplementation "org.mockito:mockito-core:2.8.47"
|
||||||
androidTestImplementation "com.google.dexmaker:dexmaker:${dexmakerVersion}"
|
androidTestImplementation "com.google.dexmaker:dexmaker:${dexmakerVersion}"
|
||||||
|
|
|
@ -54,7 +54,6 @@ import info.nightscout.androidaps.plugins.general.overview.OverviewPlugin;
|
||||||
import info.nightscout.androidaps.plugins.general.persistentNotification.PersistentNotificationPlugin;
|
import info.nightscout.androidaps.plugins.general.persistentNotification.PersistentNotificationPlugin;
|
||||||
import info.nightscout.androidaps.plugins.general.signatureVerifier.SignatureVerifier;
|
import info.nightscout.androidaps.plugins.general.signatureVerifier.SignatureVerifier;
|
||||||
import info.nightscout.androidaps.plugins.general.smsCommunicator.SmsCommunicatorPlugin;
|
import info.nightscout.androidaps.plugins.general.smsCommunicator.SmsCommunicatorPlugin;
|
||||||
import info.nightscout.androidaps.plugins.general.tidepool.TidepoolPlugin;
|
|
||||||
import info.nightscout.androidaps.plugins.general.versionChecker.VersionCheckerPlugin;
|
import info.nightscout.androidaps.plugins.general.versionChecker.VersionCheckerPlugin;
|
||||||
import info.nightscout.androidaps.plugins.general.wear.WearPlugin;
|
import info.nightscout.androidaps.plugins.general.wear.WearPlugin;
|
||||||
import info.nightscout.androidaps.plugins.general.xdripStatusline.StatuslinePlugin;
|
import info.nightscout.androidaps.plugins.general.xdripStatusline.StatuslinePlugin;
|
||||||
|
@ -169,7 +168,7 @@ public class MainApp extends Application {
|
||||||
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.INSTANCE);
|
||||||
pluginsList.add(IobCobCalculatorPlugin.getPlugin());
|
pluginsList.add(IobCobCalculatorPlugin.getPlugin());
|
||||||
if (Config.ACTION) pluginsList.add(ActionsPlugin.INSTANCE);
|
if (Config.ACTION) pluginsList.add(ActionsPlugin.INSTANCE);
|
||||||
pluginsList.add(InsulinOrefRapidActingPlugin.getPlugin());
|
pluginsList.add(InsulinOrefRapidActingPlugin.getPlugin());
|
||||||
|
|
|
@ -230,8 +230,8 @@ public class HistoryBrowseActivity extends NoSplashActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
final String units = profile.getUnits();
|
final String units = profile.getUnits();
|
||||||
final double lowLine = OverviewPlugin.getPlugin().determineLowLine(units);
|
final double lowLine = OverviewPlugin.INSTANCE.determineLowLine(units);
|
||||||
final double highLine = OverviewPlugin.getPlugin().determineHighLine(units);
|
final double highLine = OverviewPlugin.INSTANCE.determineHighLine(units);
|
||||||
|
|
||||||
buttonDate.setText(DateUtil.dateAndTimeString(start));
|
buttonDate.setText(DateUtil.dateAndTimeString(start));
|
||||||
buttonZoom.setText(String.valueOf(rangeToDisplay));
|
buttonZoom.setText(String.valueOf(rangeToDisplay));
|
||||||
|
|
|
@ -17,6 +17,7 @@ import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.interfaces.PumpDescription;
|
import info.nightscout.androidaps.interfaces.PumpDescription;
|
||||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
||||||
|
@ -230,7 +231,7 @@ public class Profile {
|
||||||
if (notify && secondsFromMidnight % 3600 != 0) {
|
if (notify && secondsFromMidnight % 3600 != 0) {
|
||||||
if (Config.APS) {
|
if (Config.APS) {
|
||||||
Notification notification = new Notification(Notification.BASAL_PROFILE_NOT_ALIGNED_TO_HOURS, String.format(MainApp.gs(R.string.basalprofilenotaligned), from), Notification.NORMAL);
|
Notification notification = new Notification(Notification.BASAL_PROFILE_NOT_ALIGNED_TO_HOURS, String.format(MainApp.gs(R.string.basalprofilenotaligned), from), Notification.NORMAL);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -262,11 +263,11 @@ public class Profile {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void sendBelowMinimumNotification(String from) {
|
protected void sendBelowMinimumNotification(String from) {
|
||||||
MainApp.bus().post(new EventNewNotification(new Notification(Notification.MINIMAL_BASAL_VALUE_REPLACED, String.format(MainApp.gs(R.string.minimalbasalvaluereplaced), from), Notification.NORMAL)));
|
RxBus.INSTANCE.send(new EventNewNotification(new Notification(Notification.MINIMAL_BASAL_VALUE_REPLACED, String.format(MainApp.gs(R.string.minimalbasalvaluereplaced), from), Notification.NORMAL)));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void sendAboveMaximumNotification(String from) {
|
protected void sendAboveMaximumNotification(String from) {
|
||||||
MainApp.bus().post(new EventNewNotification(new Notification(Notification.MAXIMUM_BASAL_VALUE_REPLACED, String.format(MainApp.gs(R.string.maximumbasalvaluereplaced), from), Notification.NORMAL)));
|
RxBus.INSTANCE.send(new EventNewNotification(new Notification(Notification.MAXIMUM_BASAL_VALUE_REPLACED, String.format(MainApp.gs(R.string.maximumbasalvaluereplaced), from), Notification.NORMAL)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validate(LongSparseArray array) {
|
private void validate(LongSparseArray array) {
|
||||||
|
|
|
@ -216,8 +216,8 @@ public class BgReading implements DataPointWithLabelInterface {
|
||||||
@Override
|
@Override
|
||||||
public int getColor() {
|
public int getColor() {
|
||||||
String units = ProfileFunctions.getInstance().getProfileUnits();
|
String units = ProfileFunctions.getInstance().getProfileUnits();
|
||||||
Double lowLine = OverviewPlugin.getPlugin().determineLowLine(units);
|
Double lowLine = OverviewPlugin.INSTANCE.determineLowLine(units);
|
||||||
Double highLine = OverviewPlugin.getPlugin().determineHighLine(units);
|
Double highLine = OverviewPlugin.INSTANCE.determineHighLine(units);
|
||||||
int color = MainApp.gc(R.color.inrange);
|
int color = MainApp.gc(R.color.inrange);
|
||||||
if (isPrediction())
|
if (isPrediction())
|
||||||
return getPredectionColor();
|
return getPredectionColor();
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package info.nightscout.androidaps.db;
|
package info.nightscout.androidaps.db;
|
||||||
|
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import com.j256.ormlite.field.DatabaseField;
|
import com.j256.ormlite.field.DatabaseField;
|
||||||
|
@ -18,6 +19,7 @@ import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.data.Profile;
|
import info.nightscout.androidaps.data.Profile;
|
||||||
import info.nightscout.androidaps.interfaces.Interval;
|
import info.nightscout.androidaps.interfaces.Interval;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.graphExtensions.DataPointWithLabelInterface;
|
import info.nightscout.androidaps.plugins.general.overview.graphExtensions.DataPointWithLabelInterface;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.graphExtensions.PointsWithLabelGraphSeries;
|
import info.nightscout.androidaps.plugins.general.overview.graphExtensions.PointsWithLabelGraphSeries;
|
||||||
|
@ -221,7 +223,7 @@ public class ProfileSwitch implements Interval, DataPointWithLabelInterface {
|
||||||
|
|
||||||
public void createNotificationInvalidProfile(String detail) {
|
public void createNotificationInvalidProfile(String detail) {
|
||||||
Notification notification = new Notification(Notification.ZERO_VALUE_IN_PROFILE, String.format(MainApp.gs(R.string.zerovalueinprofile), detail), Notification.LOW, 5);
|
Notification notification = new Notification(Notification.ZERO_VALUE_IN_PROFILE, String.format(MainApp.gs(R.string.zerovalueinprofile), detail), Notification.LOW, 5);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isEvent5minBack(List<ProfileSwitch> list, long time, boolean zeroDurationOnly) {
|
public static boolean isEvent5minBack(List<ProfileSwitch> list, long time, boolean zeroDurationOnly) {
|
||||||
|
|
|
@ -15,6 +15,7 @@ import info.nightscout.androidaps.interfaces.PluginType;
|
||||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin;
|
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin;
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
||||||
|
@ -89,6 +90,6 @@ public class DstHelperPlugin extends PluginBase implements ConstraintsInterface
|
||||||
|
|
||||||
private void warnUser(int id, String warningText) {
|
private void warnUser(int id, String warningText) {
|
||||||
Notification notification = new Notification(id, warningText, Notification.LOW);
|
Notification notification = new Notification(id, warningText, Notification.LOW);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -16,6 +16,7 @@ import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
import info.nightscout.androidaps.plugins.aps.openAPSAMA.OpenAPSAMAPlugin;
|
import info.nightscout.androidaps.plugins.aps.openAPSAMA.OpenAPSAMAPlugin;
|
||||||
import info.nightscout.androidaps.plugins.aps.openAPSMA.OpenAPSMAPlugin;
|
import info.nightscout.androidaps.plugins.aps.openAPSMA.OpenAPSMAPlugin;
|
||||||
import info.nightscout.androidaps.plugins.aps.openAPSSMB.OpenAPSSMBPlugin;
|
import info.nightscout.androidaps.plugins.aps.openAPSSMB.OpenAPSSMBPlugin;
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
||||||
|
@ -68,7 +69,7 @@ public class SafetyPlugin extends PluginBase implements ConstraintsInterface {
|
||||||
if (!MainApp.isEngineeringModeOrRelease()) {
|
if (!MainApp.isEngineeringModeOrRelease()) {
|
||||||
if (value.value()) {
|
if (value.value()) {
|
||||||
Notification n = new Notification(Notification.TOAST_ALARM, MainApp.gs(R.string.closed_loop_disabled_on_dev_branch), Notification.NORMAL);
|
Notification n = new Notification(Notification.TOAST_ALARM, MainApp.gs(R.string.closed_loop_disabled_on_dev_branch), Notification.NORMAL);
|
||||||
MainApp.bus().post(new EventNewNotification(n));
|
RxBus.INSTANCE.send(new EventNewNotification(n));
|
||||||
}
|
}
|
||||||
value.set(false, MainApp.gs(R.string.closed_loop_disabled_on_dev_branch), this);
|
value.set(false, MainApp.gs(R.string.closed_loop_disabled_on_dev_branch), this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ import info.nightscout.androidaps.interfaces.PluginBase;
|
||||||
import info.nightscout.androidaps.interfaces.PluginDescription;
|
import info.nightscout.androidaps.interfaces.PluginDescription;
|
||||||
import info.nightscout.androidaps.interfaces.PluginType;
|
import info.nightscout.androidaps.interfaces.PluginType;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
||||||
|
@ -56,9 +57,9 @@ public class StorageConstraintPlugin extends PluginBase implements ConstraintsIn
|
||||||
if (diskfree < Constants.MINIMUM_FREE_SPACE) {
|
if (diskfree < Constants.MINIMUM_FREE_SPACE) {
|
||||||
value.set(false, MainApp.gs(R.string.diskfull, Constants.MINIMUM_FREE_SPACE), this);
|
value.set(false, MainApp.gs(R.string.diskfull, Constants.MINIMUM_FREE_SPACE), this);
|
||||||
Notification notification = new Notification(Notification.DISKFULL, MainApp.gs(R.string.diskfull, Constants.MINIMUM_FREE_SPACE), Notification.NORMAL);
|
Notification notification = new Notification(Notification.DISKFULL, MainApp.gs(R.string.diskfull, Constants.MINIMUM_FREE_SPACE), Notification.NORMAL);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
} else {
|
} else {
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.DISKFULL));
|
RxBus.INSTANCE.send(new EventDismissNotification(Notification.DISKFULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
|
|
|
@ -63,16 +63,22 @@ public class TriggerBg extends Trigger {
|
||||||
public synchronized boolean shouldRun() {
|
public synchronized boolean shouldRun() {
|
||||||
GlucoseStatus glucoseStatus = GlucoseStatus.getGlucoseStatusData();
|
GlucoseStatus glucoseStatus = GlucoseStatus.getGlucoseStatusData();
|
||||||
|
|
||||||
if (lastRun > DateUtil.now() - T.mins(5).msecs())
|
if (lastRun > DateUtil.now() - T.mins(5).msecs()) {
|
||||||
|
if (L.isEnabled(L.AUTOMATION))
|
||||||
|
log.debug("NOT ready for execution: " + friendlyDescription());
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (glucoseStatus == null && comparator.getValue().equals(Comparator.Compare.IS_NOT_AVAILABLE)) {
|
if (glucoseStatus == null && comparator.getValue().equals(Comparator.Compare.IS_NOT_AVAILABLE)) {
|
||||||
if (L.isEnabled(L.AUTOMATION))
|
if (L.isEnabled(L.AUTOMATION))
|
||||||
log.debug("Ready for execution: " + friendlyDescription());
|
log.debug("Ready for execution: " + friendlyDescription());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (glucoseStatus == null)
|
if (glucoseStatus == null) {
|
||||||
|
if (L.isEnabled(L.AUTOMATION))
|
||||||
|
log.debug("NOT ready for execution: " + friendlyDescription());
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
boolean doRun = comparator.getValue().check(glucoseStatus.glucose, Profile.toMgdl(bg.getValue(), bg.getUnits()));
|
boolean doRun = comparator.getValue().check(glucoseStatus.glucose, Profile.toMgdl(bg.getValue(), bg.getUnits()));
|
||||||
if (doRun) {
|
if (doRun) {
|
||||||
|
@ -80,6 +86,9 @@ public class TriggerBg extends Trigger {
|
||||||
log.debug("Ready for execution: " + friendlyDescription());
|
log.debug("Ready for execution: " + friendlyDescription());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (L.isEnabled(L.AUTOMATION))
|
||||||
|
log.debug("NOT ready for execution: " + friendlyDescription());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ package info.nightscout.androidaps.plugins.general.nsclient.data;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
|
@ -16,12 +17,13 @@ import java.util.Objects;
|
||||||
import info.nightscout.androidaps.Config;
|
import info.nightscout.androidaps.Config;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
|
import info.nightscout.androidaps.logging.BundleLogger;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.OverviewPlugin;
|
import info.nightscout.androidaps.plugins.general.overview.OverviewPlugin;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
||||||
import info.nightscout.androidaps.logging.BundleLogger;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
{
|
{
|
||||||
|
@ -154,22 +156,22 @@ public class NSSettingsStatus {
|
||||||
try {
|
try {
|
||||||
if (nsClientVersionCode < MainApp.instance().getPackageManager().getPackageInfo(MainApp.instance().getPackageName(), 0).versionCode) {
|
if (nsClientVersionCode < MainApp.instance().getPackageManager().getPackageInfo(MainApp.instance().getPackageName(), 0).versionCode) {
|
||||||
Notification notification = new Notification(Notification.OLD_NSCLIENT, MainApp.gs(R.string.unsupportedclientver), Notification.URGENT);
|
Notification notification = new Notification(Notification.OLD_NSCLIENT, MainApp.gs(R.string.unsupportedclientver), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
} else {
|
} else {
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.OLD_NSCLIENT));
|
RxBus.INSTANCE.send(new EventDismissNotification(Notification.OLD_NSCLIENT));
|
||||||
}
|
}
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
log.error("Unhandled exception", e);
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
if (nightscoutVersionCode < Config.SUPPORTEDNSVERSION) {
|
if (nightscoutVersionCode < Config.SUPPORTEDNSVERSION) {
|
||||||
Notification notification = new Notification(Notification.OLD_NS, MainApp.gs(R.string.unsupportednsversion), Notification.NORMAL);
|
Notification notification = new Notification(Notification.OLD_NS, MainApp.gs(R.string.unsupportednsversion), Notification.NORMAL);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
} else {
|
} else {
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.OLD_NS));
|
RxBus.INSTANCE.send(new EventDismissNotification(Notification.OLD_NS));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Notification notification = new Notification(Notification.OLD_NSCLIENT, MainApp.gs(R.string.unsupportedclientver), Notification.URGENT);
|
Notification notification = new Notification(Notification.OLD_NSCLIENT, MainApp.gs(R.string.unsupportedclientver), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
}
|
}
|
||||||
if (bundle.containsKey("status")) {
|
if (bundle.containsKey("status")) {
|
||||||
try {
|
try {
|
||||||
|
@ -180,9 +182,9 @@ public class NSSettingsStatus {
|
||||||
Double targetHigh = getThreshold("bgTargetTop");
|
Double targetHigh = getThreshold("bgTargetTop");
|
||||||
Double targetlow = getThreshold("bgTargetBottom");
|
Double targetlow = getThreshold("bgTargetBottom");
|
||||||
if (targetHigh != null)
|
if (targetHigh != null)
|
||||||
OverviewPlugin.bgTargetHigh = targetHigh;
|
OverviewPlugin.INSTANCE.setBgTargetHigh(targetHigh);
|
||||||
if (targetlow != null)
|
if (targetlow != null)
|
||||||
OverviewPlugin.bgTargetLow = targetlow;
|
OverviewPlugin.INSTANCE.setBgTargetLow(targetlow);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
log.error("Unhandled exception", e);
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@ import info.nightscout.androidaps.events.EventConfigBuilderChange;
|
||||||
import info.nightscout.androidaps.events.EventPreferenceChange;
|
import info.nightscout.androidaps.events.EventPreferenceChange;
|
||||||
import info.nightscout.androidaps.interfaces.PluginType;
|
import info.nightscout.androidaps.interfaces.PluginType;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.NSClientPlugin;
|
import info.nightscout.androidaps.plugins.general.nsclient.NSClientPlugin;
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.UploadQueue;
|
import info.nightscout.androidaps.plugins.general.nsclient.UploadQueue;
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.acks.NSAddAck;
|
import info.nightscout.androidaps.plugins.general.nsclient.acks.NSAddAck;
|
||||||
|
@ -269,7 +270,7 @@ public class NSClientService extends Service {
|
||||||
MainApp.bus().post(new EventNSClientNewLog("WATCHDOG", "connections in last " + WATCHDOG_INTERVAL_MINUTES + " mins: " + reconnections.size() + "/" + WATCHDOG_MAXCONNECTIONS));
|
MainApp.bus().post(new EventNSClientNewLog("WATCHDOG", "connections in last " + WATCHDOG_INTERVAL_MINUTES + " mins: " + reconnections.size() + "/" + WATCHDOG_MAXCONNECTIONS));
|
||||||
if (reconnections.size() >= WATCHDOG_MAXCONNECTIONS) {
|
if (reconnections.size() >= WATCHDOG_MAXCONNECTIONS) {
|
||||||
Notification n = new Notification(Notification.NSMALFUNCTION, MainApp.gs(R.string.nsmalfunction), Notification.URGENT);
|
Notification n = new Notification(Notification.NSMALFUNCTION, MainApp.gs(R.string.nsmalfunction), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(n));
|
RxBus.INSTANCE.send(new EventNewNotification(n));
|
||||||
MainApp.bus().post(new EventNSClientNewLog("WATCHDOG", "pausing for " + WATCHDOG_RECONNECT_IN + " mins"));
|
MainApp.bus().post(new EventNSClientNewLog("WATCHDOG", "pausing for " + WATCHDOG_RECONNECT_IN + " mins"));
|
||||||
NSClientPlugin.getPlugin().pause(true);
|
NSClientPlugin.getPlugin().pause(true);
|
||||||
MainApp.bus().post(new EventNSClientUpdateGUI());
|
MainApp.bus().post(new EventNSClientUpdateGUI());
|
||||||
|
@ -347,9 +348,9 @@ public class NSClientService extends Service {
|
||||||
}
|
}
|
||||||
if (!hasWriteAuth) {
|
if (!hasWriteAuth) {
|
||||||
Notification noperm = new Notification(Notification.NSCLIENT_NO_WRITE_PERMISSION, MainApp.gs(R.string.nowritepermission), Notification.URGENT);
|
Notification noperm = new Notification(Notification.NSCLIENT_NO_WRITE_PERMISSION, MainApp.gs(R.string.nowritepermission), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(noperm));
|
RxBus.INSTANCE.send(new EventNewNotification(noperm));
|
||||||
} else {
|
} else {
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.NSCLIENT_NO_WRITE_PERMISSION));
|
RxBus.INSTANCE.send(new EventDismissNotification(Notification.NSCLIENT_NO_WRITE_PERMISSION));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -686,7 +687,7 @@ public class NSClientService extends Service {
|
||||||
if ((System.currentTimeMillis() - latestDateInReceivedData) / (60 * 1000L) < 15L)
|
if ((System.currentTimeMillis() - latestDateInReceivedData) / (60 * 1000L) < 15L)
|
||||||
lessThan15MinAgo = true;
|
lessThan15MinAgo = true;
|
||||||
if (Notification.isAlarmForStaleData() && lessThan15MinAgo) {
|
if (Notification.isAlarmForStaleData() && lessThan15MinAgo) {
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.NSALARM));
|
RxBus.INSTANCE.send(new EventDismissNotification(Notification.NSALARM));
|
||||||
}
|
}
|
||||||
BroadcastSgvs.handleNewSgv(sgvs, MainApp.instance().getApplicationContext(), isDelta);
|
BroadcastSgvs.handleNewSgv(sgvs, MainApp.instance().getApplicationContext(), isDelta);
|
||||||
}
|
}
|
||||||
|
|
|
@ -827,7 +827,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
final String profileName = ProfileFunctions.getInstance().getProfileName();
|
final String profileName = ProfileFunctions.getInstance().getProfileName();
|
||||||
final PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
final PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
|
|
||||||
final QuickWizardEntry quickWizardEntry = OverviewPlugin.getPlugin().quickWizard.getActive();
|
final QuickWizardEntry quickWizardEntry = OverviewPlugin.INSTANCE.getQuickWizard().getActive();
|
||||||
if (quickWizardEntry != null && actualBg != null && profile != null && pump != null) {
|
if (quickWizardEntry != null && actualBg != null && profile != null && pump != null) {
|
||||||
quickWizardButton.setVisibility(View.VISIBLE);
|
quickWizardButton.setVisibility(View.VISIBLE);
|
||||||
final BolusWizard wizard = quickWizardEntry.doCalc(profile, profileName, actualBg, true);
|
final BolusWizard wizard = quickWizardEntry.doCalc(profile, profileName, actualBg, true);
|
||||||
|
@ -1008,7 +1008,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
timeView.setText(DateUtil.timeString(new Date()));
|
timeView.setText(DateUtil.timeString(new Date()));
|
||||||
}
|
}
|
||||||
|
|
||||||
OverviewPlugin.getPlugin().notificationStore.updateNotifications(notificationsView);
|
OverviewPlugin.INSTANCE.getNotificationStore().updateNotifications(notificationsView);
|
||||||
|
|
||||||
pumpStatusLayout.setVisibility(View.GONE);
|
pumpStatusLayout.setVisibility(View.GONE);
|
||||||
loopStatusLayout.setVisibility(View.GONE);
|
loopStatusLayout.setVisibility(View.GONE);
|
||||||
|
@ -1030,8 +1030,8 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
final String profileName = ProfileFunctions.getInstance().getProfileName();
|
final String profileName = ProfileFunctions.getInstance().getProfileName();
|
||||||
|
|
||||||
final String units = profile.getUnits();
|
final String units = profile.getUnits();
|
||||||
final double lowLine = OverviewPlugin.getPlugin().determineLowLine(units);
|
final double lowLine = OverviewPlugin.INSTANCE.determineLowLine(units);
|
||||||
final double highLine = OverviewPlugin.getPlugin().determineHighLine(units);
|
final double highLine = OverviewPlugin.INSTANCE.determineHighLine(units);
|
||||||
|
|
||||||
//Start with updating the BG as it is unaffected by loop.
|
//Start with updating the BG as it is unaffected by loop.
|
||||||
// **** BG value ****
|
// **** BG value ****
|
||||||
|
@ -1221,7 +1221,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
}
|
}
|
||||||
|
|
||||||
// QuickWizard button
|
// QuickWizard button
|
||||||
QuickWizardEntry quickWizardEntry = OverviewPlugin.getPlugin().quickWizard.getActive();
|
QuickWizardEntry quickWizardEntry = OverviewPlugin.INSTANCE.getQuickWizard().getActive();
|
||||||
if (quickWizardEntry != null && lastBG != null && pump.isInitialized() && !pump.isSuspended()) {
|
if (quickWizardEntry != null && lastBG != null && pump.isInitialized() && !pump.isSuspended()) {
|
||||||
quickWizardButton.setVisibility(View.VISIBLE);
|
quickWizardButton.setVisibility(View.VISIBLE);
|
||||||
String text = quickWizardEntry.buttonText() + "\n" + DecimalFormatter.to0Decimal(quickWizardEntry.carbs()) + "g";
|
String text = quickWizardEntry.buttonText() + "\n" + DecimalFormatter.to0Decimal(quickWizardEntry.carbs()) + "g";
|
||||||
|
|
|
@ -1,111 +0,0 @@
|
||||||
package info.nightscout.androidaps.plugins.general.overview;
|
|
||||||
|
|
||||||
import com.squareup.otto.Subscribe;
|
|
||||||
|
|
||||||
import org.json.JSONArray;
|
|
||||||
import org.json.JSONException;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
|
||||||
import info.nightscout.androidaps.R;
|
|
||||||
import info.nightscout.androidaps.data.Profile;
|
|
||||||
import info.nightscout.androidaps.data.QuickWizard;
|
|
||||||
import info.nightscout.androidaps.events.EventRefreshOverview;
|
|
||||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
|
||||||
import info.nightscout.androidaps.interfaces.PluginDescription;
|
|
||||||
import info.nightscout.androidaps.interfaces.PluginType;
|
|
||||||
import info.nightscout.androidaps.logging.L;
|
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
|
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
|
||||||
import info.nightscout.androidaps.plugins.general.overview.notifications.NotificationStore;
|
|
||||||
import info.nightscout.androidaps.utils.SP;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mike on 05.08.2016.
|
|
||||||
*/
|
|
||||||
public class OverviewPlugin extends PluginBase {
|
|
||||||
private static Logger log = LoggerFactory.getLogger(L.OVERVIEW);
|
|
||||||
|
|
||||||
private static OverviewPlugin overviewPlugin = new OverviewPlugin();
|
|
||||||
|
|
||||||
public static OverviewPlugin getPlugin() {
|
|
||||||
if (overviewPlugin == null)
|
|
||||||
overviewPlugin = new OverviewPlugin();
|
|
||||||
return overviewPlugin;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static double bgTargetLow = 80d;
|
|
||||||
public static double bgTargetHigh = 180d;
|
|
||||||
|
|
||||||
public QuickWizard quickWizard = new QuickWizard();
|
|
||||||
|
|
||||||
public NotificationStore notificationStore = new NotificationStore();
|
|
||||||
|
|
||||||
public OverviewPlugin() {
|
|
||||||
super(new PluginDescription()
|
|
||||||
.mainType(PluginType.GENERAL)
|
|
||||||
.fragmentClass(OverviewFragment.class.getName())
|
|
||||||
.alwaysVisible(true)
|
|
||||||
.alwaysEnabled(true)
|
|
||||||
.pluginName(R.string.overview)
|
|
||||||
.shortName(R.string.overview_shortname)
|
|
||||||
.preferencesId(R.xml.pref_overview)
|
|
||||||
.description(R.string.description_overview)
|
|
||||||
);
|
|
||||||
String storedData = SP.getString("QuickWizard", "[]");
|
|
||||||
try {
|
|
||||||
quickWizard.setData(new JSONArray(storedData));
|
|
||||||
} catch (JSONException e) {
|
|
||||||
log.error("Unhandled exception", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onStart() {
|
|
||||||
MainApp.bus().register(this);
|
|
||||||
super.onStart();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onStop() {
|
|
||||||
MainApp.bus().unregister(this);
|
|
||||||
super.onStop();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Subscribe
|
|
||||||
public void onStatusEvent(final EventNewNotification n) {
|
|
||||||
if (notificationStore.add(n.notification))
|
|
||||||
MainApp.bus().post(new EventRefreshOverview("EventNewNotification"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Subscribe
|
|
||||||
public void onStatusEvent(final EventDismissNotification n) {
|
|
||||||
if (notificationStore.remove(n.id))
|
|
||||||
MainApp.bus().post(new EventRefreshOverview("EventDismissNotification"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public double determineHighLine(String units) {
|
|
||||||
double highLineSetting = SP.getDouble("high_mark", Profile.fromMgdlToUnits(OverviewPlugin.bgTargetHigh, units));
|
|
||||||
if (highLineSetting < 1)
|
|
||||||
highLineSetting = Profile.fromMgdlToUnits(180d, units);
|
|
||||||
return highLineSetting;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double determineLowLine() {
|
|
||||||
Profile profile = ProfileFunctions.getInstance().getProfile();
|
|
||||||
if (profile == null) {
|
|
||||||
return bgTargetLow;
|
|
||||||
}
|
|
||||||
return determineLowLine(profile.getUnits());
|
|
||||||
}
|
|
||||||
|
|
||||||
public double determineLowLine(String units) {
|
|
||||||
double lowLineSetting = SP.getDouble("low_mark", Profile.fromMgdlToUnits(OverviewPlugin.bgTargetLow, units));
|
|
||||||
if (lowLineSetting < 1)
|
|
||||||
lowLineSetting = Profile.fromMgdlToUnits(76d, units);
|
|
||||||
return lowLineSetting;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,100 @@
|
||||||
|
package info.nightscout.androidaps.plugins.general.overview
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.MainApp
|
||||||
|
import info.nightscout.androidaps.R
|
||||||
|
import info.nightscout.androidaps.data.Profile
|
||||||
|
import info.nightscout.androidaps.data.QuickWizard
|
||||||
|
import info.nightscout.androidaps.events.EventRefreshOverview
|
||||||
|
import info.nightscout.androidaps.interfaces.PluginBase
|
||||||
|
import info.nightscout.androidaps.interfaces.PluginDescription
|
||||||
|
import info.nightscout.androidaps.interfaces.PluginType
|
||||||
|
import info.nightscout.androidaps.logging.L
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
|
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions
|
||||||
|
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification
|
||||||
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
|
||||||
|
import info.nightscout.androidaps.plugins.general.overview.notifications.NotificationStore
|
||||||
|
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||||
|
import info.nightscout.androidaps.utils.SP
|
||||||
|
import info.nightscout.androidaps.utils.plusAssign
|
||||||
|
import io.reactivex.disposables.CompositeDisposable
|
||||||
|
import io.reactivex.schedulers.Schedulers
|
||||||
|
import org.json.JSONArray
|
||||||
|
import org.json.JSONException
|
||||||
|
import org.slf4j.LoggerFactory
|
||||||
|
|
||||||
|
object OverviewPlugin : PluginBase(PluginDescription()
|
||||||
|
.mainType(PluginType.GENERAL)
|
||||||
|
.fragmentClass(OverviewFragment::class.qualifiedName)
|
||||||
|
.alwaysVisible(true)
|
||||||
|
.alwaysEnabled(true)
|
||||||
|
.pluginName(R.string.overview)
|
||||||
|
.shortName(R.string.overview_shortname)
|
||||||
|
.preferencesId(R.xml.pref_overview)
|
||||||
|
.description(R.string.description_overview)) {
|
||||||
|
|
||||||
|
private val log = LoggerFactory.getLogger(L.OVERVIEW)
|
||||||
|
private var disposable: CompositeDisposable = CompositeDisposable()
|
||||||
|
|
||||||
|
var bgTargetLow = 80.0
|
||||||
|
var bgTargetHigh = 180.0
|
||||||
|
|
||||||
|
var quickWizard = QuickWizard()
|
||||||
|
|
||||||
|
var notificationStore = NotificationStore()
|
||||||
|
|
||||||
|
init {
|
||||||
|
val storedData = SP.getString("QuickWizard", "[]")
|
||||||
|
try {
|
||||||
|
quickWizard.setData(JSONArray(storedData))
|
||||||
|
} catch (e: JSONException) {
|
||||||
|
log.error("Unhandled exception", e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onStart() {
|
||||||
|
super.onStart()
|
||||||
|
disposable += RxBus
|
||||||
|
.toObservable(EventNewNotification::class.java)
|
||||||
|
.observeOn(Schedulers.io())
|
||||||
|
.subscribe({ n ->
|
||||||
|
if (notificationStore.add(n.notification))
|
||||||
|
MainApp.bus().post(EventRefreshOverview("EventNewNotification"))
|
||||||
|
}, {
|
||||||
|
FabricPrivacy.logException(it)
|
||||||
|
})
|
||||||
|
disposable += RxBus
|
||||||
|
.toObservable(EventDismissNotification::class.java)
|
||||||
|
.observeOn(Schedulers.io())
|
||||||
|
.subscribe({ n ->
|
||||||
|
if (notificationStore.remove(n.id))
|
||||||
|
MainApp.bus().post(EventRefreshOverview("EventDismissNotification"))
|
||||||
|
}, {
|
||||||
|
FabricPrivacy.logException(it)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onStop() {
|
||||||
|
disposable.clear()
|
||||||
|
super.onStop()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun determineHighLine(units: String): Double {
|
||||||
|
var highLineSetting = SP.getDouble("high_mark", Profile.fromMgdlToUnits(bgTargetHigh, units))!!
|
||||||
|
if (highLineSetting < 1)
|
||||||
|
highLineSetting = Profile.fromMgdlToUnits(180.0, units)
|
||||||
|
return highLineSetting
|
||||||
|
}
|
||||||
|
|
||||||
|
fun determineLowLine(): Double {
|
||||||
|
val profile = ProfileFunctions.getInstance().profile ?: return bgTargetLow
|
||||||
|
return determineLowLine(profile.units)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun determineLowLine(units: String): Double {
|
||||||
|
var lowLineSetting = SP.getDouble("low_mark", Profile.fromMgdlToUnits(bgTargetLow, units))!!
|
||||||
|
if (lowLineSetting < 1)
|
||||||
|
lowLineSetting = Profile.fromMgdlToUnits(76.0, units)
|
||||||
|
return lowLineSetting
|
||||||
|
}
|
||||||
|
}
|
|
@ -123,7 +123,7 @@ public class QuickWizardListActivity extends NoSplashAppCompatActivity implement
|
||||||
llm = new LinearLayoutManager(this);
|
llm = new LinearLayoutManager(this);
|
||||||
recyclerView.setLayoutManager(llm);
|
recyclerView.setLayoutManager(llm);
|
||||||
|
|
||||||
RecyclerViewAdapter adapter = new RecyclerViewAdapter(MainApp.getSpecificPlugin(OverviewPlugin.class).quickWizard, getSupportFragmentManager());
|
RecyclerViewAdapter adapter = new RecyclerViewAdapter(OverviewPlugin.INSTANCE.getQuickWizard(), getSupportFragmentManager());
|
||||||
recyclerView.setAdapter(adapter);
|
recyclerView.setAdapter(adapter);
|
||||||
|
|
||||||
adButton = (Button) findViewById(R.id.overview_quickwizardactivity_add_button);
|
adButton = (Button) findViewById(R.id.overview_quickwizardactivity_add_button);
|
||||||
|
@ -164,7 +164,7 @@ public class QuickWizardListActivity extends NoSplashAppCompatActivity implement
|
||||||
activity.runOnUiThread(new Runnable() {
|
activity.runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
RecyclerViewAdapter adapter = new RecyclerViewAdapter(MainApp.getSpecificPlugin(OverviewPlugin.class).quickWizard, getSupportFragmentManager());
|
RecyclerViewAdapter adapter = new RecyclerViewAdapter(MainApp.getSpecificPlugin(OverviewPlugin.class).getQuickWizard(), getSupportFragmentManager());
|
||||||
recyclerView.swapAdapter(adapter, false);
|
recyclerView.swapAdapter(adapter, false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class EditQuickWizardDialog extends DialogFragment implements View.OnClic
|
||||||
private static Logger log = LoggerFactory.getLogger(EditQuickWizardDialog.class);
|
private static Logger log = LoggerFactory.getLogger(EditQuickWizardDialog.class);
|
||||||
|
|
||||||
QuickWizardEntry entry = new QuickWizard().newEmptyItem();
|
QuickWizardEntry entry = new QuickWizard().newEmptyItem();
|
||||||
QuickWizard quickWizard = MainApp.getSpecificPlugin(OverviewPlugin.class).quickWizard;
|
QuickWizard quickWizard = MainApp.getSpecificPlugin(OverviewPlugin.class).getQuickWizard();
|
||||||
|
|
||||||
EditText buttonEdit;
|
EditText buttonEdit;
|
||||||
EditText carbsEdit;
|
EditText carbsEdit;
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
package info.nightscout.androidaps.plugins.general.overview.events;
|
|
||||||
|
|
||||||
import info.nightscout.androidaps.events.Event;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mike on 03.12.2016.
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class EventDismissNotification extends Event {
|
|
||||||
public int id;
|
|
||||||
|
|
||||||
public EventDismissNotification(int did) {
|
|
||||||
id = did;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
package info.nightscout.androidaps.plugins.general.overview.events
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.events.Event
|
||||||
|
|
||||||
|
class EventDismissNotification(var id: Int) : Event()
|
|
@ -1,16 +0,0 @@
|
||||||
package info.nightscout.androidaps.plugins.general.overview.events;
|
|
||||||
|
|
||||||
import info.nightscout.androidaps.events.Event;
|
|
||||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mike on 03.12.2016.
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class EventNewNotification extends Event {
|
|
||||||
public Notification notification;
|
|
||||||
|
|
||||||
public EventNewNotification(Notification n) {
|
|
||||||
notification = n;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
package info.nightscout.androidaps.plugins.general.overview.events
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.events.Event
|
||||||
|
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
|
||||||
|
|
||||||
|
class EventNewNotification(var notification: Notification) : Event()
|
|
@ -3,9 +3,11 @@ package info.nightscout.androidaps.plugins.general.overview.notifications;
|
||||||
import android.app.IntentService;
|
import android.app.IntentService;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
|
||||||
|
|
||||||
public class DismissNotificationService extends IntentService {
|
public class DismissNotificationService extends IntentService {
|
||||||
|
@ -25,7 +27,7 @@ public class DismissNotificationService extends IntentService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onHandleIntent(@Nullable Intent intent) {
|
protected void onHandleIntent(@Nullable Intent intent) {
|
||||||
MainApp.bus().post(new EventDismissNotification(intent.getIntExtra("alertID", -1)));
|
RxBus.INSTANCE.send(new EventDismissNotification(intent.getIntExtra("alertID", -1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PendingIntent deleteIntent(int id) {
|
public static PendingIntent deleteIntent(int id) {
|
||||||
|
|
|
@ -20,6 +20,7 @@ import java.util.Objects;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.broadcasts.BroadcastAckAlarm;
|
import info.nightscout.androidaps.plugins.general.nsclient.broadcasts.BroadcastAckAlarm;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.OverviewPlugin;
|
import info.nightscout.androidaps.plugins.general.overview.OverviewPlugin;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
|
||||||
|
@ -90,7 +91,7 @@ public class NotificationRecyclerViewAdapter extends RecyclerView.Adapter<Notifi
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Notification notification = (Notification) v.getTag();
|
Notification notification = (Notification) v.getTag();
|
||||||
MainApp.bus().post(new EventDismissNotification(notification.id));
|
RxBus.INSTANCE.send(new EventDismissNotification(notification.id));
|
||||||
if (notification.nsAlarm != null) {
|
if (notification.nsAlarm != null) {
|
||||||
BroadcastAckAlarm.handleClearAlarm(notification.nsAlarm, MainApp.instance().getApplicationContext(), 60 * 60 * 1000L);
|
BroadcastAckAlarm.handleClearAlarm(notification.nsAlarm, MainApp.instance().getApplicationContext(), 60 * 60 * 1000L);
|
||||||
}
|
}
|
||||||
|
@ -98,7 +99,7 @@ public class NotificationRecyclerViewAdapter extends RecyclerView.Adapter<Notifi
|
||||||
if (L.isEnabled(L.NOTIFICATION))
|
if (L.isEnabled(L.NOTIFICATION))
|
||||||
log.debug("Notification text is: " + notification.text);
|
log.debug("Notification text is: " + notification.text);
|
||||||
if (notification.text.equals(MainApp.gs(R.string.nsalarm_staledata))) {
|
if (notification.text.equals(MainApp.gs(R.string.nsalarm_staledata))) {
|
||||||
NotificationStore nstore = OverviewPlugin.getPlugin().notificationStore;
|
NotificationStore nstore = OverviewPlugin.INSTANCE.getNotificationStore();
|
||||||
long msToSnooze = SP.getInt("nsalarm_staledatavalue", 15) * 60 * 1000L;
|
long msToSnooze = SP.getInt("nsalarm_staledatavalue", 15) * 60 * 1000L;
|
||||||
if (L.isEnabled(L.NOTIFICATION))
|
if (L.isEnabled(L.NOTIFICATION))
|
||||||
log.debug("snooze nsalarm_staledatavalue in minutes is " + SP.getInt("nsalarm_staledatavalue", 15) + "\n in ms is: " + msToSnooze + " currentTimeMillis is: " + System.currentTimeMillis());
|
log.debug("snooze nsalarm_staledatavalue in minutes is " + SP.getInt("nsalarm_staledatavalue", 15) + "\n in ms is: " + msToSnooze + " currentTimeMillis is: " + System.currentTimeMillis());
|
||||||
|
|
|
@ -32,6 +32,7 @@ import info.nightscout.androidaps.interfaces.PluginBase;
|
||||||
import info.nightscout.androidaps.interfaces.PluginDescription;
|
import info.nightscout.androidaps.interfaces.PluginDescription;
|
||||||
import info.nightscout.androidaps.interfaces.PluginType;
|
import info.nightscout.androidaps.interfaces.PluginType;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
||||||
import info.nightscout.androidaps.utils.SP;
|
import info.nightscout.androidaps.utils.SP;
|
||||||
|
@ -103,7 +104,7 @@ public class SignatureVerifier extends PluginBase implements ConstraintsInterfac
|
||||||
|
|
||||||
private void showNotification() {
|
private void showNotification() {
|
||||||
Notification notification = new Notification(Notification.INVALID_VERSION, MainApp.gs(R.string.running_invalid_version), Notification.URGENT);
|
Notification notification = new Notification(Notification.INVALID_VERSION, MainApp.gs(R.string.running_invalid_version), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasIllegalSignature() {
|
private boolean hasIllegalSignature() {
|
||||||
|
|
|
@ -35,6 +35,7 @@ import info.nightscout.androidaps.interfaces.ProfileInterface;
|
||||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin;
|
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin;
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
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.nsclient.NSUpload;
|
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
|
||||||
|
@ -769,10 +770,10 @@ public class SmsCommunicatorPlugin extends PluginBase {
|
||||||
messages.add(sms);
|
messages.add(sms);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
Notification notification = new Notification(Notification.INVALID_PHONE_NUMBER, MainApp.gs(R.string.smscommunicator_invalidphonennumber), Notification.NORMAL);
|
Notification notification = new Notification(Notification.INVALID_PHONE_NUMBER, MainApp.gs(R.string.smscommunicator_invalidphonennumber), Notification.NORMAL);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
} catch (java.lang.SecurityException e) {
|
} catch (java.lang.SecurityException e) {
|
||||||
Notification notification = new Notification(Notification.MISSING_SMS_PERMISSION, MainApp.gs(R.string.smscommunicator_missingsmspermission), Notification.NORMAL);
|
Notification notification = new Notification(Notification.MISSING_SMS_PERMISSION, MainApp.gs(R.string.smscommunicator_missingsmspermission), Notification.NORMAL);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
}
|
}
|
||||||
MainApp.bus().post(new EventSmsCommunicatorUpdateGui());
|
MainApp.bus().post(new EventSmsCommunicatorUpdateGui());
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package info.nightscout.androidaps.plugins.general.versionChecker
|
||||||
import info.nightscout.androidaps.MainApp
|
import info.nightscout.androidaps.MainApp
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
import info.nightscout.androidaps.interfaces.*
|
import info.nightscout.androidaps.interfaces.*
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
|
||||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
|
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
|
||||||
import info.nightscout.androidaps.utils.SP
|
import info.nightscout.androidaps.utils.SP
|
||||||
|
@ -46,7 +47,7 @@ object VersionCheckerPlugin : PluginBase(PluginDescription()
|
||||||
//notify
|
//notify
|
||||||
val message = MainApp.gs(R.string.new_version_warning, Math.round((now - SP.getLong(R.string.key_last_time_this_version_detected, now)) / TimeUnit.DAYS.toMillis(1).toDouble()))
|
val message = MainApp.gs(R.string.new_version_warning, Math.round((now - SP.getLong(R.string.key_last_time_this_version_detected, now)) / TimeUnit.DAYS.toMillis(1).toDouble()))
|
||||||
val notification = Notification(Notification.OLDVERSION, message, Notification.NORMAL)
|
val notification = Notification(Notification.OLDVERSION, message, Notification.NORMAL)
|
||||||
MainApp.bus().post(EventNewNotification(notification))
|
RxBus.send(EventNewNotification(notification))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ import info.nightscout.androidaps.BuildConfig
|
||||||
import info.nightscout.androidaps.MainApp
|
import info.nightscout.androidaps.MainApp
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
import info.nightscout.androidaps.logging.L
|
import info.nightscout.androidaps.logging.L
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
|
||||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
|
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
|
||||||
import info.nightscout.androidaps.utils.SP
|
import info.nightscout.androidaps.utils.SP
|
||||||
|
@ -82,7 +83,7 @@ fun onNewVersionDetected(currentVersion: String, newVersion: String?) {
|
||||||
if (now > SP.getLong(R.string.key_last_versionchecker_warning, 0) + WARN_EVERY) {
|
if (now > SP.getLong(R.string.key_last_versionchecker_warning, 0) + WARN_EVERY) {
|
||||||
log.debug("Version ${currentVersion} outdated. Found $newVersion")
|
log.debug("Version ${currentVersion} outdated. Found $newVersion")
|
||||||
val notification = Notification(Notification.NEWVERSIONDETECTED, String.format(MainApp.gs(R.string.versionavailable), newVersion.toString()), Notification.LOW)
|
val notification = Notification(Notification.NEWVERSIONDETECTED, String.format(MainApp.gs(R.string.versionavailable), newVersion.toString()), Notification.LOW)
|
||||||
MainApp.bus().post(EventNewNotification(notification))
|
RxBus.send(EventNewNotification(notification))
|
||||||
SP.putLong(R.string.key_last_versionchecker_warning, now)
|
SP.putLong(R.string.key_last_versionchecker_warning, now)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.general.wear;
|
||||||
|
|
||||||
import android.app.NotificationManager;
|
import android.app.NotificationManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.HandlerThread;
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
|
@ -31,15 +31,15 @@ import info.nightscout.androidaps.interfaces.APSInterface;
|
||||||
import info.nightscout.androidaps.interfaces.Constraint;
|
import info.nightscout.androidaps.interfaces.Constraint;
|
||||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
import info.nightscout.androidaps.plugins.general.actions.dialogs.FillDialog;
|
|
||||||
import info.nightscout.androidaps.plugins.general.careportal.Dialogs.NewNSTreatmentDialog;
|
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
|
||||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.CobInfo;
|
|
||||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin;
|
|
||||||
import info.nightscout.androidaps.plugins.aps.loop.APSResult;
|
import info.nightscout.androidaps.plugins.aps.loop.APSResult;
|
||||||
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin;
|
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin;
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
||||||
|
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
||||||
|
import info.nightscout.androidaps.plugins.general.careportal.Dialogs.NewNSTreatmentDialog;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
|
||||||
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.CobInfo;
|
||||||
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin;
|
||||||
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin;
|
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin;
|
||||||
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump;
|
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump;
|
||||||
import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin;
|
import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin;
|
||||||
|
@ -244,7 +244,8 @@ public class ActionStringHandler {
|
||||||
rMessage += "\nFrom Carbs: " + format.format(bolusWizard.getInsulinFromCarbs()) + "U";
|
rMessage += "\nFrom Carbs: " + format.format(bolusWizard.getInsulinFromCarbs()) + "U";
|
||||||
if (useCOB)
|
if (useCOB)
|
||||||
rMessage += "\nFrom" + formatInt.format(cobInfo.displayCob) + "g COB : " + format.format(bolusWizard.getInsulinFromCOB()) + "U";
|
rMessage += "\nFrom" + formatInt.format(cobInfo.displayCob) + "g COB : " + format.format(bolusWizard.getInsulinFromCOB()) + "U";
|
||||||
if (useBG) rMessage += "\nFrom BG: " + format.format(bolusWizard.getInsulinFromBG()) + "U";
|
if (useBG)
|
||||||
|
rMessage += "\nFrom BG: " + format.format(bolusWizard.getInsulinFromBG()) + "U";
|
||||||
if (useBolusIOB)
|
if (useBolusIOB)
|
||||||
rMessage += "\nBolus IOB: " + format.format(bolusWizard.getInsulinFromBolusIOB()) + "U";
|
rMessage += "\nBolus IOB: " + format.format(bolusWizard.getInsulinFromBolusIOB()) + "U";
|
||||||
if (useBasalIOB)
|
if (useBasalIOB)
|
||||||
|
@ -634,7 +635,7 @@ public class ActionStringHandler {
|
||||||
|
|
||||||
doECarbs(carbs, starttime, duration);
|
doECarbs(carbs, starttime, duration);
|
||||||
} else if ("dismissoverviewnotification".equals(act[0])) {
|
} else if ("dismissoverviewnotification".equals(act[0])) {
|
||||||
MainApp.bus().post(new EventDismissNotification(SafeParse.stringToInt(act[1])));
|
RxBus.INSTANCE.send(new EventDismissNotification(SafeParse.stringToInt(act[1])));
|
||||||
} else if ("changeRequest".equals(act[0])) {
|
} else if ("changeRequest".equals(act[0])) {
|
||||||
LoopPlugin.getPlugin().acceptChangeRequest();
|
LoopPlugin.getPlugin().acceptChangeRequest();
|
||||||
NotificationManager notificationManager =
|
NotificationManager notificationManager =
|
||||||
|
|
|
@ -316,11 +316,11 @@ public class WatchUpdaterService extends WearableListenerService implements Goog
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lowLine < 1) {
|
if (lowLine < 1) {
|
||||||
lowLine = OverviewPlugin.bgTargetLow;
|
lowLine = OverviewPlugin.INSTANCE.getBgTargetLow();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (highLine < 1) {
|
if (highLine < 1) {
|
||||||
highLine = OverviewPlugin.bgTargetHigh;
|
highLine = OverviewPlugin.INSTANCE.getBgTargetHigh();
|
||||||
}
|
}
|
||||||
|
|
||||||
long sgvLevel = 0l;
|
long sgvLevel = 0l;
|
||||||
|
|
|
@ -1,19 +1,18 @@
|
||||||
package info.nightscout.androidaps.plugins.insulin;
|
package info.nightscout.androidaps.plugins.insulin;
|
||||||
|
|
||||||
import com.squareup.otto.Bus;
|
|
||||||
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.data.Iob;
|
import info.nightscout.androidaps.data.Iob;
|
||||||
import info.nightscout.androidaps.data.Profile;
|
import info.nightscout.androidaps.data.Profile;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
|
||||||
import info.nightscout.androidaps.plugins.treatments.Treatment;
|
|
||||||
import info.nightscout.androidaps.interfaces.InsulinInterface;
|
import info.nightscout.androidaps.interfaces.InsulinInterface;
|
||||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||||
import info.nightscout.androidaps.interfaces.PluginDescription;
|
import info.nightscout.androidaps.interfaces.PluginDescription;
|
||||||
import info.nightscout.androidaps.interfaces.PluginType;
|
import info.nightscout.androidaps.interfaces.PluginType;
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
|
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
||||||
|
import info.nightscout.androidaps.plugins.treatments.Treatment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by adrian on 13.08.2017.
|
* Created by adrian on 13.08.2017.
|
||||||
|
@ -35,10 +34,6 @@ public abstract class InsulinOrefBasePlugin extends PluginBase implements Insuli
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Bus getBus() {
|
|
||||||
return MainApp.bus();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getDia() {
|
public double getDia() {
|
||||||
double dia = getUserDefinedDia();
|
double dia = getUserDefinedDia();
|
||||||
|
@ -54,7 +49,7 @@ public abstract class InsulinOrefBasePlugin extends PluginBase implements Insuli
|
||||||
if ((System.currentTimeMillis() - lastWarned) > 60 * 1000) {
|
if ((System.currentTimeMillis() - lastWarned) > 60 * 1000) {
|
||||||
lastWarned = System.currentTimeMillis();
|
lastWarned = System.currentTimeMillis();
|
||||||
Notification notification = new Notification(Notification.SHORT_DIA, String.format(this.getNotificationPattern(), dia, MIN_DIA), Notification.URGENT);
|
Notification notification = new Notification(Notification.SHORT_DIA, String.format(this.getNotificationPattern(), dia, MIN_DIA), Notification.URGENT);
|
||||||
this.getBus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ package info.nightscout.androidaps.plugins.iob.iobCobCalculator;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
|
|
||||||
import androidx.collection.LongSparseArray;
|
import androidx.collection.LongSparseArray;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -24,6 +25,7 @@ import info.nightscout.androidaps.db.TempTarget;
|
||||||
import info.nightscout.androidaps.events.Event;
|
import info.nightscout.androidaps.events.Event;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
import info.nightscout.androidaps.plugins.aps.openAPSSMB.SMBDefaults;
|
import info.nightscout.androidaps.plugins.aps.openAPSSMB.SMBDefaults;
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
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.overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
||||||
|
@ -199,7 +201,7 @@ public class IobCobOref1Thread extends Thread {
|
||||||
log.debug(bucketed_data.toString());
|
log.debug(bucketed_data.toString());
|
||||||
log.debug(IobCobCalculatorPlugin.getPlugin().getBgReadings().toString());
|
log.debug(IobCobCalculatorPlugin.getPlugin().getBgReadings().toString());
|
||||||
Notification notification = new Notification(Notification.SENDLOGFILES, MainApp.gs(R.string.sendlogfiles), Notification.LOW);
|
Notification notification = new Notification(Notification.SENDLOGFILES, MainApp.gs(R.string.sendlogfiles), Notification.LOW);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
SP.putBoolean("log_AUTOSENS", true);
|
SP.putBoolean("log_AUTOSENS", true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -225,7 +227,7 @@ public class IobCobOref1Thread extends Thread {
|
||||||
log.debug(bucketed_data.toString());
|
log.debug(bucketed_data.toString());
|
||||||
log.debug(IobCobCalculatorPlugin.getPlugin().getBgReadings().toString());
|
log.debug(IobCobCalculatorPlugin.getPlugin().getBgReadings().toString());
|
||||||
Notification notification = new Notification(Notification.SENDLOGFILES, MainApp.gs(R.string.sendlogfiles), Notification.LOW);
|
Notification notification = new Notification(Notification.SENDLOGFILES, MainApp.gs(R.string.sendlogfiles), Notification.LOW);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
SP.putBoolean("log_AUTOSENS", true);
|
SP.putBoolean("log_AUTOSENS", true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -199,7 +199,7 @@ public class IobCobThread extends Thread {
|
||||||
log.debug(bucketed_data.toString());
|
log.debug(bucketed_data.toString());
|
||||||
log.debug(IobCobCalculatorPlugin.getPlugin().getBgReadings().toString());
|
log.debug(IobCobCalculatorPlugin.getPlugin().getBgReadings().toString());
|
||||||
Notification notification = new Notification(Notification.SENDLOGFILES, MainApp.gs(R.string.sendlogfiles), Notification.LOW);
|
Notification notification = new Notification(Notification.SENDLOGFILES, MainApp.gs(R.string.sendlogfiles), Notification.LOW);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
SP.putBoolean("log_AUTOSENS", true);
|
SP.putBoolean("log_AUTOSENS", true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -225,7 +225,7 @@ public class IobCobThread extends Thread {
|
||||||
log.debug(bucketed_data.toString());
|
log.debug(bucketed_data.toString());
|
||||||
log.debug(IobCobCalculatorPlugin.getPlugin().getBgReadings().toString());
|
log.debug(IobCobCalculatorPlugin.getPlugin().getBgReadings().toString());
|
||||||
Notification notification = new Notification(Notification.SENDLOGFILES, MainApp.gs(R.string.sendlogfiles), Notification.LOW);
|
Notification notification = new Notification(Notification.SENDLOGFILES, MainApp.gs(R.string.sendlogfiles), Notification.LOW);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
SP.putBoolean("log_AUTOSENS", true);
|
SP.putBoolean("log_AUTOSENS", true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ import info.nightscout.androidaps.interfaces.PluginType;
|
||||||
import info.nightscout.androidaps.interfaces.PumpDescription;
|
import info.nightscout.androidaps.interfaces.PumpDescription;
|
||||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
import info.nightscout.androidaps.plugins.common.ManufacturerType;
|
import info.nightscout.androidaps.plugins.common.ManufacturerType;
|
||||||
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;
|
||||||
|
@ -66,6 +67,7 @@ import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
|
||||||
import info.nightscout.androidaps.utils.DateUtil;
|
import info.nightscout.androidaps.utils.DateUtil;
|
||||||
import info.nightscout.androidaps.utils.InstanceId;
|
import info.nightscout.androidaps.utils.InstanceId;
|
||||||
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.
|
||||||
*/
|
*/
|
||||||
|
@ -231,15 +233,15 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
||||||
// issues a READSTATE when starting to issue commands which initializes the pump
|
// issues a READSTATE when starting to issue commands which initializes the pump
|
||||||
log.error("setNewBasalProfile not initialized");
|
log.error("setNewBasalProfile not initialized");
|
||||||
Notification notification = new Notification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED, MainApp.gs(R.string.pumpNotInitializedProfileNotSet), Notification.URGENT);
|
Notification notification = new Notification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED, MainApp.gs(R.string.pumpNotInitializedProfileNotSet), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
return new PumpEnactResult().success(false).enacted(false).comment(MainApp.gs(R.string.pumpNotInitializedProfileNotSet));
|
return new PumpEnactResult().success(false).enacted(false).comment(MainApp.gs(R.string.pumpNotInitializedProfileNotSet));
|
||||||
}
|
}
|
||||||
|
|
||||||
BasalProfile requestedBasalProfile = convertProfileToComboProfile(profile);
|
BasalProfile requestedBasalProfile = convertProfileToComboProfile(profile);
|
||||||
if (pump.basalProfile.equals(requestedBasalProfile)) {
|
if (pump.basalProfile.equals(requestedBasalProfile)) {
|
||||||
//dismiss previously "FAILED" overview notifications
|
//dismiss previously "FAILED" overview notifications
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED));
|
RxBus.INSTANCE.send(new EventDismissNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED));
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.FAILED_UDPATE_PROFILE));
|
RxBus.INSTANCE.send(new EventDismissNotification(Notification.FAILED_UDPATE_PROFILE));
|
||||||
return new PumpEnactResult().success(true).enacted(false);
|
return new PumpEnactResult().success(true).enacted(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,18 +254,18 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
||||||
() -> ruffyScripter.setBasalProfile(requestedBasalProfile));
|
() -> ruffyScripter.setBasalProfile(requestedBasalProfile));
|
||||||
if (!setResult.success) {
|
if (!setResult.success) {
|
||||||
Notification notification = new Notification(Notification.FAILED_UDPATE_PROFILE, MainApp.gs(R.string.failedupdatebasalprofile), Notification.URGENT);
|
Notification notification = new Notification(Notification.FAILED_UDPATE_PROFILE, MainApp.gs(R.string.failedupdatebasalprofile), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
return new PumpEnactResult().success(false).enacted(false).comment(MainApp.gs(R.string.failedupdatebasalprofile));
|
return new PumpEnactResult().success(false).enacted(false).comment(MainApp.gs(R.string.failedupdatebasalprofile));
|
||||||
}
|
}
|
||||||
|
|
||||||
pump.basalProfile = requestedBasalProfile;
|
pump.basalProfile = requestedBasalProfile;
|
||||||
|
|
||||||
//dismiss previously "FAILED" overview notifications
|
//dismiss previously "FAILED" overview notifications
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED));
|
RxBus.INSTANCE.send(new EventDismissNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED));
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.FAILED_UDPATE_PROFILE));
|
RxBus.INSTANCE.send(new EventDismissNotification(Notification.FAILED_UDPATE_PROFILE));
|
||||||
//issue success notification
|
//issue success notification
|
||||||
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));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
return new PumpEnactResult().success(true).enacted(true);
|
return new PumpEnactResult().success(true).enacted(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -339,7 +341,7 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
||||||
// trigger a connect, which will update state and check history
|
// trigger a connect, which will update state and check history
|
||||||
CommandResult stateResult = runCommand(null, 1, ruffyScripter::readPumpState);
|
CommandResult stateResult = runCommand(null, 1, ruffyScripter::readPumpState);
|
||||||
if (stateResult.invalidSetup) {
|
if (stateResult.invalidSetup) {
|
||||||
MainApp.bus().post(new EventNewNotification(
|
RxBus.INSTANCE.send(new EventNewNotification(
|
||||||
new Notification(Notification.COMBO_PUMP_ALARM, MainApp.gs(R.string.combo_invalid_setup), Notification.URGENT)));
|
new Notification(Notification.COMBO_PUMP_ALARM, MainApp.gs(R.string.combo_invalid_setup), Notification.URGENT)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -360,7 +362,7 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
||||||
MainApp.gs(R.string.combo_force_disabled_notification),
|
MainApp.gs(R.string.combo_force_disabled_notification),
|
||||||
Notification.URGENT);
|
Notification.URGENT);
|
||||||
n.soundId = R.raw.alarm;
|
n.soundId = R.raw.alarm;
|
||||||
MainApp.bus().post(new EventNewNotification(n));
|
RxBus.INSTANCE.send(new EventNewNotification(n));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -382,7 +384,7 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
if (lastBolusTimestamp < now - 24 * 60 * 60 * 1000 || lastBolusTimestamp > now + 5 * 60 * 1000) {
|
if (lastBolusTimestamp < now - 24 * 60 * 60 * 1000 || lastBolusTimestamp > now + 5 * 60 * 1000) {
|
||||||
Notification notification = new Notification(Notification.COMBO_PUMP_ALARM, MainApp.gs(R.string.combo_check_date), Notification.URGENT);
|
Notification notification = new Notification(Notification.COMBO_PUMP_ALARM, MainApp.gs(R.string.combo_check_date), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -600,7 +602,7 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
if (lastPumpBolus.timestamp < now - 10 * 60 * 1000 || lastPumpBolus.timestamp > now + 10 * 60 * 1000) {
|
if (lastPumpBolus.timestamp < now - 10 * 60 * 1000 || lastPumpBolus.timestamp > now + 10 * 60 * 1000) {
|
||||||
Notification notification = new Notification(Notification.COMBO_PUMP_ALARM, MainApp.gs(R.string.combo_suspious_bolus_time), Notification.URGENT);
|
Notification notification = new Notification(Notification.COMBO_PUMP_ALARM, MainApp.gs(R.string.combo_suspious_bolus_time), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
}
|
}
|
||||||
|
|
||||||
// update `recentBoluses` so the bolus was just delivered won't be detected as a new
|
// update `recentBoluses` so the bolus was just delivered won't be detected as a new
|
||||||
|
@ -627,7 +629,7 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
||||||
} finally {
|
} finally {
|
||||||
pump.activity = null;
|
pump.activity = null;
|
||||||
MainApp.bus().post(new EventComboPumpUpdateGUI());
|
MainApp.bus().post(new EventComboPumpUpdateGUI());
|
||||||
MainApp.bus().post(new EventRefreshOverview("Bolus"));
|
RxBus.INSTANCE.send(new EventRefreshOverview("Bolus"));
|
||||||
cancelBolus = false;
|
cancelBolus = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -648,7 +650,9 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Creates a treatment record based on the request in DetailBolusInfo and the delivered bolus. */
|
/**
|
||||||
|
* Creates a treatment record based on the request in DetailBolusInfo and the delivered bolus.
|
||||||
|
*/
|
||||||
private boolean addBolusToTreatments(DetailedBolusInfo detailedBolusInfo, Bolus lastPumpBolus) {
|
private boolean addBolusToTreatments(DetailedBolusInfo detailedBolusInfo, Bolus lastPumpBolus) {
|
||||||
DetailedBolusInfo dbi = detailedBolusInfo.copy();
|
DetailedBolusInfo dbi = detailedBolusInfo.copy();
|
||||||
dbi.date = calculateFakeBolusDate(lastPumpBolus);
|
dbi.date = calculateFakeBolusDate(lastPumpBolus);
|
||||||
|
@ -661,7 +665,7 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
||||||
log.error("Adding treatment record failed", e);
|
log.error("Adding treatment record failed", e);
|
||||||
if (dbi.isSMB) {
|
if (dbi.isSMB) {
|
||||||
Notification notification = new Notification(Notification.COMBO_PUMP_ALARM, MainApp.gs(R.string.combo_error_updating_treatment_record), Notification.URGENT);
|
Notification notification = new Notification(Notification.COMBO_PUMP_ALARM, MainApp.gs(R.string.combo_error_updating_treatment_record), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -880,7 +884,7 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
||||||
MainApp.gs(R.string.combo_force_disabled_notification),
|
MainApp.gs(R.string.combo_force_disabled_notification),
|
||||||
Notification.URGENT);
|
Notification.URGENT);
|
||||||
n.soundId = R.raw.alarm;
|
n.soundId = R.raw.alarm;
|
||||||
MainApp.bus().post(new EventNewNotification(n));
|
RxBus.INSTANCE.send(new EventNewNotification(n));
|
||||||
ConfigBuilderPlugin.getPlugin().getCommandQueue().cancelTempBasal(true, null);
|
ConfigBuilderPlugin.getPlugin().getCommandQueue().cancelTempBasal(true, null);
|
||||||
}
|
}
|
||||||
updateLocalData(commandResult);
|
updateLocalData(commandResult);
|
||||||
|
@ -926,7 +930,7 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
||||||
notification.id = Notification.COMBO_PUMP_ALARM;
|
notification.id = Notification.COMBO_PUMP_ALARM;
|
||||||
notification.level = Notification.URGENT;
|
notification.level = Notification.URGENT;
|
||||||
notification.text = MainApp.gs(R.string.combo_is_in_error_state, activeAlert.errorCode, activeAlert.message);
|
notification.text = MainApp.gs(R.string.combo_is_in_error_state, activeAlert.errorCode, activeAlert.message);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
return preCheckResult.success(false);
|
return preCheckResult.success(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -989,10 +993,10 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
||||||
if (readBasalResult.success) {
|
if (readBasalResult.success) {
|
||||||
pump.basalProfile = readBasalResult.basalProfile;
|
pump.basalProfile = readBasalResult.basalProfile;
|
||||||
Notification notification = new Notification(Notification.COMBO_PUMP_ALARM, MainApp.gs(R.string.combo_warning_pump_basal_rate_changed), Notification.NORMAL);
|
Notification notification = new Notification(Notification.COMBO_PUMP_ALARM, MainApp.gs(R.string.combo_warning_pump_basal_rate_changed), Notification.NORMAL);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
} else {
|
} else {
|
||||||
Notification notification = new Notification(Notification.COMBO_PUMP_ALARM, MainApp.gs(R.string.combo_error_failure_reading_changed_basal_rate), Notification.URGENT);
|
Notification notification = new Notification(Notification.COMBO_PUMP_ALARM, MainApp.gs(R.string.combo_error_failure_reading_changed_basal_rate), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1008,12 +1012,12 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
||||||
if (L.isEnabled(L.PUMP))
|
if (L.isEnabled(L.PUMP))
|
||||||
log.debug("Pump clock needs update, pump time: " + state.pumpTime + " (" + new Date(state.pumpTime) + ")");
|
log.debug("Pump clock needs update, pump time: " + state.pumpTime + " (" + new Date(state.pumpTime) + ")");
|
||||||
Notification notification = new Notification(Notification.COMBO_PUMP_ALARM, MainApp.gs(R.string.combo_notification_check_time_date), Notification.URGENT);
|
Notification notification = new Notification(Notification.COMBO_PUMP_ALARM, MainApp.gs(R.string.combo_notification_check_time_date), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
} else if (Math.abs(state.pumpTime - System.currentTimeMillis()) >= 3 * 60 * 1000) {
|
} else if (Math.abs(state.pumpTime - System.currentTimeMillis()) >= 3 * 60 * 1000) {
|
||||||
if (L.isEnabled(L.PUMP))
|
if (L.isEnabled(L.PUMP))
|
||||||
log.debug("Pump clock needs update, pump time: " + state.pumpTime + " (" + new Date(state.pumpTime) + ")");
|
log.debug("Pump clock needs update, pump time: " + state.pumpTime + " (" + new Date(state.pumpTime) + ")");
|
||||||
Notification notification = new Notification(Notification.COMBO_PUMP_ALARM, MainApp.gs(R.string.combo_notification_check_time_date), Notification.NORMAL);
|
Notification notification = new Notification(Notification.COMBO_PUMP_ALARM, MainApp.gs(R.string.combo_notification_check_time_date), Notification.NORMAL);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1035,7 +1039,7 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
||||||
} else if (activeAlert.warningCode == PumpWarningCodes.TBR_CANCELLED) {
|
} else if (activeAlert.warningCode == PumpWarningCodes.TBR_CANCELLED) {
|
||||||
notification.text = MainApp.gs(R.string.combo_pump_tbr_cancelled_warrning);
|
notification.text = MainApp.gs(R.string.combo_pump_tbr_cancelled_warrning);
|
||||||
}
|
}
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkForUnsafeUsage(CommandResult commandResult) {
|
private void checkForUnsafeUsage(CommandResult commandResult) {
|
||||||
|
@ -1058,7 +1062,7 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
||||||
MainApp.gs(R.string.combo_low_suspend_forced_notification),
|
MainApp.gs(R.string.combo_low_suspend_forced_notification),
|
||||||
Notification.URGENT);
|
Notification.URGENT);
|
||||||
n.soundId = R.raw.alarm;
|
n.soundId = R.raw.alarm;
|
||||||
MainApp.bus().post(new EventNewNotification(n));
|
RxBus.INSTANCE.send(new EventNewNotification(n));
|
||||||
violationWarningRaisedForBolusAt = lowSuspendOnlyLoopEnforcedUntil;
|
violationWarningRaisedForBolusAt = lowSuspendOnlyLoopEnforcedUntil;
|
||||||
ConfigBuilderPlugin.getPlugin().getCommandQueue().cancelTempBasal(true, null);
|
ConfigBuilderPlugin.getPlugin().getCommandQueue().cancelTempBasal(true, null);
|
||||||
}
|
}
|
||||||
|
@ -1132,7 +1136,9 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
||||||
return historyResult.success;
|
return historyResult.success;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Return value indicates whether a new record was created. */
|
/**
|
||||||
|
* Return value indicates whether a new record was created.
|
||||||
|
*/
|
||||||
private boolean updateDbFromPumpHistory(@NonNull PumpHistory history) {
|
private boolean updateDbFromPumpHistory(@NonNull PumpHistory history) {
|
||||||
boolean updated = false;
|
boolean updated = false;
|
||||||
for (Bolus pumpBolus : history.bolusHistory) {
|
for (Bolus pumpBolus : history.bolusHistory) {
|
||||||
|
@ -1216,7 +1222,7 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
||||||
log.debug("Bolus with same amount within the same minute imported. Only one will make it to the DB.");
|
log.debug("Bolus with same amount within the same minute imported. Only one will make it to the DB.");
|
||||||
Notification notification = new Notification(Notification.COMBO_PUMP_ALARM, MainApp.gs(R.string.
|
Notification notification = new Notification(Notification.COMBO_PUMP_ALARM, MainApp.gs(R.string.
|
||||||
combo_error_multiple_boluses_with_identical_timestamp), Notification.URGENT);
|
combo_error_multiple_boluses_with_identical_timestamp), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
}
|
}
|
||||||
|
|
||||||
pumpHistoryChanged = updateDbFromPumpHistory(historyResult.history);
|
pumpHistoryChanged = updateDbFromPumpHistory(historyResult.history);
|
||||||
|
|
|
@ -29,6 +29,7 @@ import info.nightscout.androidaps.interfaces.ProfileInterface;
|
||||||
import info.nightscout.androidaps.interfaces.PumpDescription;
|
import info.nightscout.androidaps.interfaces.PumpDescription;
|
||||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
import info.nightscout.androidaps.plugins.common.ManufacturerType;
|
import info.nightscout.androidaps.plugins.common.ManufacturerType;
|
||||||
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.defs.CustomActionType;
|
import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType;
|
||||||
|
@ -107,22 +108,22 @@ public abstract class AbstractDanaRPlugin extends PluginBase implements PumpInte
|
||||||
if (!isInitialized()) {
|
if (!isInitialized()) {
|
||||||
log.error("setNewBasalProfile not initialized");
|
log.error("setNewBasalProfile not initialized");
|
||||||
Notification notification = new Notification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED, MainApp.gs(R.string.pumpNotInitializedProfileNotSet), Notification.URGENT);
|
Notification notification = new Notification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED, MainApp.gs(R.string.pumpNotInitializedProfileNotSet), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
result.comment = MainApp.gs(R.string.pumpNotInitializedProfileNotSet);
|
result.comment = MainApp.gs(R.string.pumpNotInitializedProfileNotSet);
|
||||||
return result;
|
return result;
|
||||||
} else {
|
} else {
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED));
|
RxBus.INSTANCE.send(new EventDismissNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED));
|
||||||
}
|
}
|
||||||
if (!sExecutionService.updateBasalsInPump(profile)) {
|
if (!sExecutionService.updateBasalsInPump(profile)) {
|
||||||
Notification notification = new Notification(Notification.FAILED_UDPATE_PROFILE, MainApp.gs(R.string.failedupdatebasalprofile), Notification.URGENT);
|
Notification notification = new Notification(Notification.FAILED_UDPATE_PROFILE, MainApp.gs(R.string.failedupdatebasalprofile), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
result.comment = MainApp.gs(R.string.failedupdatebasalprofile);
|
result.comment = MainApp.gs(R.string.failedupdatebasalprofile);
|
||||||
return result;
|
return result;
|
||||||
} else {
|
} else {
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED));
|
RxBus.INSTANCE.send(new EventDismissNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED));
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.FAILED_UDPATE_PROFILE));
|
RxBus.INSTANCE.send(new EventDismissNotification(Notification.FAILED_UDPATE_PROFILE));
|
||||||
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));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
result.success = true;
|
result.success = true;
|
||||||
result.enacted = true;
|
result.enacted = true;
|
||||||
result.comment = "OK";
|
result.comment = "OK";
|
||||||
|
|
|
@ -6,6 +6,7 @@ import org.slf4j.LoggerFactory;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
||||||
|
@ -45,9 +46,9 @@ public class MsgInitConnStatusBolus extends MessageBase {
|
||||||
|
|
||||||
if (!pump.isExtendedBolusEnabled) {
|
if (!pump.isExtendedBolusEnabled) {
|
||||||
Notification notification = new Notification(Notification.EXTENDED_BOLUS_DISABLED, MainApp.gs(R.string.danar_enableextendedbolus), Notification.URGENT);
|
Notification notification = new Notification(Notification.EXTENDED_BOLUS_DISABLED, MainApp.gs(R.string.danar_enableextendedbolus), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
} else {
|
} else {
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.EXTENDED_BOLUS_DISABLED));
|
RxBus.INSTANCE.send(new EventDismissNotification(Notification.EXTENDED_BOLUS_DISABLED));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import org.slf4j.LoggerFactory;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
||||||
|
@ -45,9 +46,9 @@ public class MsgInitConnStatusOption extends MessageBase {
|
||||||
|
|
||||||
if (!DanaRPump.getInstance().isPasswordOK()) {
|
if (!DanaRPump.getInstance().isPasswordOK()) {
|
||||||
Notification notification = new Notification(Notification.WRONG_PUMP_PASSWORD, MainApp.gs(R.string.wrongpumppassword), Notification.URGENT);
|
Notification notification = new Notification(Notification.WRONG_PUMP_PASSWORD, MainApp.gs(R.string.wrongpumppassword), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
} else {
|
} else {
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.WRONG_PUMP_PASSWORD));
|
RxBus.INSTANCE.send(new EventDismissNotification(Notification.WRONG_PUMP_PASSWORD));
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is last message of initial sequence
|
// This is last message of initial sequence
|
||||||
|
|
|
@ -8,6 +8,7 @@ import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.events.EventRefreshGui;
|
import info.nightscout.androidaps.events.EventRefreshGui;
|
||||||
import info.nightscout.androidaps.interfaces.PluginType;
|
import info.nightscout.androidaps.interfaces.PluginType;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
||||||
|
@ -29,7 +30,7 @@ public class MsgInitConnStatusTime extends MessageBase {
|
||||||
public void handleMessage(byte[] bytes) {
|
public void handleMessage(byte[] bytes) {
|
||||||
if (bytes.length - 10 > 7) {
|
if (bytes.length - 10 > 7) {
|
||||||
Notification notification = new Notification(Notification.WRONG_DRIVER, MainApp.gs(R.string.pumpdrivercorrected), Notification.NORMAL);
|
Notification notification = new Notification(Notification.WRONG_DRIVER, MainApp.gs(R.string.pumpdrivercorrected), Notification.NORMAL);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
MainApp.getSpecificPlugin(DanaRPlugin.class).disconnect("Wrong Model");
|
MainApp.getSpecificPlugin(DanaRPlugin.class).disconnect("Wrong Model");
|
||||||
log.error("Wrong model selected. Switching to Korean DanaR");
|
log.error("Wrong model selected. Switching to Korean DanaR");
|
||||||
MainApp.getSpecificPlugin(DanaRKoreanPlugin.class).setPluginEnabled(PluginType.PUMP, true);
|
MainApp.getSpecificPlugin(DanaRKoreanPlugin.class).setPluginEnabled(PluginType.PUMP, true);
|
||||||
|
|
|
@ -6,6 +6,7 @@ import org.slf4j.LoggerFactory;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
||||||
|
|
||||||
|
@ -37,12 +38,12 @@ public class MsgSetBasalProfile extends MessageBase {
|
||||||
if (L.isEnabled(L.PUMPCOMM))
|
if (L.isEnabled(L.PUMPCOMM))
|
||||||
log.debug("Set basal profile result: " + result + " FAILED!!!");
|
log.debug("Set basal profile result: " + result + " FAILED!!!");
|
||||||
Notification reportFail = new Notification(Notification.PROFILE_SET_FAILED, MainApp.gs(R.string.profile_set_failed), Notification.URGENT);
|
Notification reportFail = new Notification(Notification.PROFILE_SET_FAILED, MainApp.gs(R.string.profile_set_failed), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(reportFail));
|
RxBus.INSTANCE.send(new EventNewNotification(reportFail));
|
||||||
} else {
|
} else {
|
||||||
if (L.isEnabled(L.PUMPCOMM))
|
if (L.isEnabled(L.PUMPCOMM))
|
||||||
log.debug("Set basal profile result: " + result);
|
log.debug("Set basal profile result: " + result);
|
||||||
Notification reportOK = new Notification(Notification.PROFILE_SET_OK, MainApp.gs(R.string.profile_set_ok), Notification.INFO, 60);
|
Notification reportOK = new Notification(Notification.PROFILE_SET_OK, MainApp.gs(R.string.profile_set_ok), Notification.INFO, 60);
|
||||||
MainApp.bus().post(new EventNewNotification(reportOK));
|
RxBus.INSTANCE.send(new EventNewNotification(reportOK));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ import org.slf4j.LoggerFactory;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
||||||
|
|
||||||
|
@ -34,12 +35,12 @@ public class MsgSetSingleBasalProfile extends MessageBase {
|
||||||
if (L.isEnabled(L.PUMPCOMM))
|
if (L.isEnabled(L.PUMPCOMM))
|
||||||
log.debug("Set basal profile result: " + result + " FAILED!!!");
|
log.debug("Set basal profile result: " + result + " FAILED!!!");
|
||||||
Notification reportFail = new Notification(Notification.PROFILE_SET_FAILED, MainApp.gs(R.string.profile_set_failed), Notification.URGENT);
|
Notification reportFail = new Notification(Notification.PROFILE_SET_FAILED, MainApp.gs(R.string.profile_set_failed), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(reportFail));
|
RxBus.INSTANCE.send(new EventNewNotification(reportFail));
|
||||||
} else {
|
} else {
|
||||||
if (L.isEnabled(L.PUMPCOMM))
|
if (L.isEnabled(L.PUMPCOMM))
|
||||||
log.debug("Set basal profile result: " + result);
|
log.debug("Set basal profile result: " + result);
|
||||||
Notification reportOK = new Notification(Notification.PROFILE_SET_OK, MainApp.gs(R.string.profile_set_ok), Notification.INFO, 60);
|
Notification reportOK = new Notification(Notification.PROFILE_SET_OK, MainApp.gs(R.string.profile_set_ok), Notification.INFO, 60);
|
||||||
MainApp.bus().post(new EventNewNotification(reportOK));
|
RxBus.INSTANCE.send(new EventNewNotification(reportOK));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.interfaces.PluginType;
|
import info.nightscout.androidaps.interfaces.PluginType;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
||||||
|
@ -51,16 +52,16 @@ public class MsgSettingMeal extends MessageBase {
|
||||||
|
|
||||||
if (pump.basalStep != 0.01d) {
|
if (pump.basalStep != 0.01d) {
|
||||||
Notification notification = new Notification(Notification.WRONGBASALSTEP, MainApp.gs(R.string.danar_setbasalstep001), Notification.URGENT);
|
Notification notification = new Notification(Notification.WRONGBASALSTEP, MainApp.gs(R.string.danar_setbasalstep001), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
} else {
|
} else {
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.WRONGBASALSTEP));
|
RxBus.INSTANCE.send(new EventDismissNotification(Notification.WRONGBASALSTEP));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pump.isConfigUD) {
|
if (pump.isConfigUD) {
|
||||||
Notification notification = new Notification(Notification.UD_MODE_ENABLED, MainApp.gs(R.string.danar_switchtouhmode), Notification.URGENT);
|
Notification notification = new Notification(Notification.UD_MODE_ENABLED, MainApp.gs(R.string.danar_switchtouhmode), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
} else {
|
} else {
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.UD_MODE_ENABLED));
|
RxBus.INSTANCE.send(new EventDismissNotification(Notification.UD_MODE_ENABLED));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -217,7 +217,7 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService {
|
||||||
log.debug("Approaching daily limit: " + danaRPump.dailyTotalUnits + "/" + danaRPump.maxDailyTotalUnits);
|
log.debug("Approaching daily limit: " + danaRPump.dailyTotalUnits + "/" + danaRPump.maxDailyTotalUnits);
|
||||||
if (System.currentTimeMillis() > lastApproachingDailyLimit + 30 * 60 * 1000) {
|
if (System.currentTimeMillis() > lastApproachingDailyLimit + 30 * 60 * 1000) {
|
||||||
Notification reportFail = new Notification(Notification.APPROACHING_DAILY_LIMIT, MainApp.gs(R.string.approachingdailylimit), Notification.URGENT);
|
Notification reportFail = new Notification(Notification.APPROACHING_DAILY_LIMIT, MainApp.gs(R.string.approachingdailylimit), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(reportFail));
|
RxBus.INSTANCE.send(new EventNewNotification(reportFail));
|
||||||
NSUpload.uploadError(MainApp.gs(R.string.approachingdailylimit) + ": " + danaRPump.dailyTotalUnits + "/" + danaRPump.maxDailyTotalUnits + "U");
|
NSUpload.uploadError(MainApp.gs(R.string.approachingdailylimit) + ": " + danaRPump.dailyTotalUnits + "/" + danaRPump.maxDailyTotalUnits + "U");
|
||||||
lastApproachingDailyLimit = System.currentTimeMillis();
|
lastApproachingDailyLimit = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import org.slf4j.LoggerFactory;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
||||||
|
@ -42,16 +43,16 @@ public class MsgInitConnStatusBasic_k extends MessageBase {
|
||||||
|
|
||||||
if (pump.isEasyModeEnabled) {
|
if (pump.isEasyModeEnabled) {
|
||||||
Notification notification = new Notification(Notification.EASYMODE_ENABLED, MainApp.gs(R.string.danar_disableeasymode), Notification.URGENT);
|
Notification notification = new Notification(Notification.EASYMODE_ENABLED, MainApp.gs(R.string.danar_disableeasymode), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
} else {
|
} else {
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.EASYMODE_ENABLED));
|
RxBus.INSTANCE.send(new EventDismissNotification(Notification.EASYMODE_ENABLED));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!DanaRPump.getInstance().isPasswordOK()) {
|
if (!DanaRPump.getInstance().isPasswordOK()) {
|
||||||
Notification notification = new Notification(Notification.WRONG_PUMP_PASSWORD, MainApp.gs(R.string.wrongpumppassword), Notification.URGENT);
|
Notification notification = new Notification(Notification.WRONG_PUMP_PASSWORD, MainApp.gs(R.string.wrongpumppassword), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
} else {
|
} else {
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.WRONG_PUMP_PASSWORD));
|
RxBus.INSTANCE.send(new EventDismissNotification(Notification.WRONG_PUMP_PASSWORD));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import org.slf4j.LoggerFactory;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
||||||
|
@ -48,9 +49,9 @@ public class MsgInitConnStatusBolus_k extends MessageBase {
|
||||||
|
|
||||||
if (!pump.isExtendedBolusEnabled) {
|
if (!pump.isExtendedBolusEnabled) {
|
||||||
Notification notification = new Notification(Notification.EXTENDED_BOLUS_DISABLED, MainApp.gs(R.string.danar_enableextendedbolus), Notification.URGENT);
|
Notification notification = new Notification(Notification.EXTENDED_BOLUS_DISABLED, MainApp.gs(R.string.danar_enableextendedbolus), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
} else {
|
} else {
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.EXTENDED_BOLUS_DISABLED));
|
RxBus.INSTANCE.send(new EventDismissNotification(Notification.EXTENDED_BOLUS_DISABLED));
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is last message of initial sequence
|
// This is last message of initial sequence
|
||||||
|
|
|
@ -8,6 +8,7 @@ import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.events.EventRefreshGui;
|
import info.nightscout.androidaps.events.EventRefreshGui;
|
||||||
import info.nightscout.androidaps.interfaces.PluginType;
|
import info.nightscout.androidaps.interfaces.PluginType;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
||||||
|
@ -31,7 +32,7 @@ public class MsgInitConnStatusTime_k extends MessageBase {
|
||||||
|
|
||||||
if (bytes.length - 10 < 10) {
|
if (bytes.length - 10 < 10) {
|
||||||
Notification notification = new Notification(Notification.WRONG_DRIVER, MainApp.gs(R.string.pumpdrivercorrected), Notification.NORMAL);
|
Notification notification = new Notification(Notification.WRONG_DRIVER, MainApp.gs(R.string.pumpdrivercorrected), Notification.NORMAL);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
DanaRKoreanPlugin.getPlugin().disconnect("Wrong Model");
|
DanaRKoreanPlugin.getPlugin().disconnect("Wrong Model");
|
||||||
log.error("Wrong model selected. Switching to export DanaR");
|
log.error("Wrong model selected. Switching to export DanaR");
|
||||||
MainApp.getSpecificPlugin(DanaRKoreanPlugin.class).setPluginEnabled(PluginType.PUMP, false);
|
MainApp.getSpecificPlugin(DanaRKoreanPlugin.class).setPluginEnabled(PluginType.PUMP, false);
|
||||||
|
|
|
@ -220,7 +220,7 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
|
||||||
log.debug("Approaching daily limit: " + danaRPump.dailyTotalUnits + "/" + danaRPump.maxDailyTotalUnits);
|
log.debug("Approaching daily limit: " + danaRPump.dailyTotalUnits + "/" + danaRPump.maxDailyTotalUnits);
|
||||||
if (System.currentTimeMillis() > lastApproachingDailyLimit + 30 * 60 * 1000) {
|
if (System.currentTimeMillis() > lastApproachingDailyLimit + 30 * 60 * 1000) {
|
||||||
Notification reportFail = new Notification(Notification.APPROACHING_DAILY_LIMIT, MainApp.gs(R.string.approachingdailylimit), Notification.URGENT);
|
Notification reportFail = new Notification(Notification.APPROACHING_DAILY_LIMIT, MainApp.gs(R.string.approachingdailylimit), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(reportFail));
|
RxBus.INSTANCE.send(new EventNewNotification(reportFail));
|
||||||
NSUpload.uploadError(MainApp.gs(R.string.approachingdailylimit) + ": " + danaRPump.dailyTotalUnits + "/" + danaRPump.maxDailyTotalUnits + "U");
|
NSUpload.uploadError(MainApp.gs(R.string.approachingdailylimit) + ": " + danaRPump.dailyTotalUnits + "/" + danaRPump.maxDailyTotalUnits + "U");
|
||||||
lastApproachingDailyLimit = System.currentTimeMillis();
|
lastApproachingDailyLimit = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ import info.nightscout.androidaps.interfaces.ProfileInterface;
|
||||||
import info.nightscout.androidaps.interfaces.PumpDescription;
|
import info.nightscout.androidaps.interfaces.PumpDescription;
|
||||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
import info.nightscout.androidaps.plugins.common.ManufacturerType;
|
import info.nightscout.androidaps.plugins.common.ManufacturerType;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.DetailedBolusInfoStorage;
|
import info.nightscout.androidaps.plugins.configBuilder.DetailedBolusInfoStorage;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
||||||
|
@ -305,22 +306,22 @@ public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInte
|
||||||
if (!isInitialized()) {
|
if (!isInitialized()) {
|
||||||
log.error("setNewBasalProfile not initialized");
|
log.error("setNewBasalProfile not initialized");
|
||||||
Notification notification = new Notification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED, MainApp.gs(R.string.pumpNotInitializedProfileNotSet), Notification.URGENT);
|
Notification notification = new Notification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED, MainApp.gs(R.string.pumpNotInitializedProfileNotSet), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
result.comment = MainApp.gs(R.string.pumpNotInitializedProfileNotSet);
|
result.comment = MainApp.gs(R.string.pumpNotInitializedProfileNotSet);
|
||||||
return result;
|
return result;
|
||||||
} else {
|
} else {
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED));
|
RxBus.INSTANCE.send(new EventDismissNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED));
|
||||||
}
|
}
|
||||||
if (!danaRSService.updateBasalsInPump(profile)) {
|
if (!danaRSService.updateBasalsInPump(profile)) {
|
||||||
Notification notification = new Notification(Notification.FAILED_UDPATE_PROFILE, MainApp.gs(R.string.failedupdatebasalprofile), Notification.URGENT);
|
Notification notification = new Notification(Notification.FAILED_UDPATE_PROFILE, MainApp.gs(R.string.failedupdatebasalprofile), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
result.comment = MainApp.gs(R.string.failedupdatebasalprofile);
|
result.comment = MainApp.gs(R.string.failedupdatebasalprofile);
|
||||||
return result;
|
return result;
|
||||||
} else {
|
} else {
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED));
|
RxBus.INSTANCE.send(new EventDismissNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED));
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.FAILED_UDPATE_PROFILE));
|
RxBus.INSTANCE.send(new EventDismissNotification(Notification.FAILED_UDPATE_PROFILE));
|
||||||
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));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
result.success = true;
|
result.success = true;
|
||||||
result.enacted = true;
|
result.enacted = true;
|
||||||
result.comment = "OK";
|
result.comment = "OK";
|
||||||
|
@ -361,10 +362,14 @@ public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInte
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getReservoirLevel() { return DanaRPump.getInstance().reservoirRemainingUnits; }
|
public double getReservoirLevel() {
|
||||||
|
return DanaRPump.getInstance().reservoirRemainingUnits;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getBatteryLevel() { return DanaRPump.getInstance().batteryRemaining; }
|
public int getBatteryLevel() {
|
||||||
|
return DanaRPump.getInstance().batteryRemaining;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized PumpEnactResult deliverTreatment(DetailedBolusInfo detailedBolusInfo) {
|
public synchronized PumpEnactResult deliverTreatment(DetailedBolusInfo detailedBolusInfo) {
|
||||||
|
|
|
@ -11,6 +11,7 @@ import java.util.Locale;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
||||||
|
@ -57,9 +58,9 @@ public class DanaRS_Packet_Basal_Get_Basal_Rate extends DanaRS_Packet {
|
||||||
if (pump.basalStep != 0.01d) {
|
if (pump.basalStep != 0.01d) {
|
||||||
failed = true;
|
failed = true;
|
||||||
Notification notification = new Notification(Notification.WRONGBASALSTEP, MainApp.gs(R.string.danar_setbasalstep001), Notification.URGENT);
|
Notification notification = new Notification(Notification.WRONGBASALSTEP, MainApp.gs(R.string.danar_setbasalstep001), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
} else {
|
} else {
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.WRONGBASALSTEP));
|
RxBus.INSTANCE.send(new EventDismissNotification(Notification.WRONGBASALSTEP));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import org.slf4j.LoggerFactory;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
||||||
|
@ -105,10 +106,10 @@ public class DanaRS_Packet_Bolus_Get_Bolus_Option extends DanaRS_Packet {
|
||||||
|
|
||||||
if (!pump.isExtendedBolusEnabled) {
|
if (!pump.isExtendedBolusEnabled) {
|
||||||
Notification notification = new Notification(Notification.EXTENDED_BOLUS_DISABLED, MainApp.gs(R.string.danar_enableextendedbolus), Notification.URGENT);
|
Notification notification = new Notification(Notification.EXTENDED_BOLUS_DISABLED, MainApp.gs(R.string.danar_enableextendedbolus), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
failed = true;
|
failed = true;
|
||||||
} else {
|
} else {
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.EXTENDED_BOLUS_DISABLED));
|
RxBus.INSTANCE.send(new EventDismissNotification(Notification.EXTENDED_BOLUS_DISABLED));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (L.isEnabled(L.PUMPCOMM)) {
|
if (L.isEnabled(L.PUMPCOMM)) {
|
||||||
|
|
|
@ -8,6 +8,7 @@ import org.slf4j.LoggerFactory;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
||||||
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump;
|
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump;
|
||||||
|
@ -49,7 +50,7 @@ public class DanaRS_Packet_General_Get_Pump_Check extends DanaRS_Packet {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pump.productCode < 2) {
|
if (pump.productCode < 2) {
|
||||||
MainApp.bus().post(new EventNewNotification(new Notification(Notification.UNSUPPORTED_FIRMWARE, MainApp.gs(R.string.unsupportedfirmware), Notification.URGENT)));
|
RxBus.INSTANCE.send(new EventNewNotification(new Notification(Notification.UNSUPPORTED_FIRMWARE, MainApp.gs(R.string.unsupportedfirmware), Notification.URGENT)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,8 @@ import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.events.EventPumpStatusChanged;
|
import info.nightscout.androidaps.events.EventPumpStatusChanged;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
|
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
||||||
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump;
|
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump;
|
||||||
|
@ -35,7 +37,6 @@ import info.nightscout.androidaps.plugins.pump.danaRS.comm.DanaRSMessageHashTabl
|
||||||
import info.nightscout.androidaps.plugins.pump.danaRS.comm.DanaRS_Packet;
|
import info.nightscout.androidaps.plugins.pump.danaRS.comm.DanaRS_Packet;
|
||||||
import info.nightscout.androidaps.plugins.pump.danaRS.events.EventDanaRSPacket;
|
import info.nightscout.androidaps.plugins.pump.danaRS.events.EventDanaRSPacket;
|
||||||
import info.nightscout.androidaps.plugins.pump.danaRS.events.EventDanaRSPairingSuccess;
|
import info.nightscout.androidaps.plugins.pump.danaRS.events.EventDanaRSPairingSuccess;
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
|
|
||||||
import info.nightscout.androidaps.utils.SP;
|
import info.nightscout.androidaps.utils.SP;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -454,7 +455,7 @@ public class BLEComm {
|
||||||
MainApp.bus().post(new EventPumpStatusChanged(EventPumpStatusChanged.DISCONNECTED, MainApp.gs(R.string.pumperror)));
|
MainApp.bus().post(new EventPumpStatusChanged(EventPumpStatusChanged.DISCONNECTED, MainApp.gs(R.string.pumperror)));
|
||||||
NSUpload.uploadError(MainApp.gs(R.string.pumperror));
|
NSUpload.uploadError(MainApp.gs(R.string.pumperror));
|
||||||
Notification n = new Notification(Notification.PUMPERROR, MainApp.gs(R.string.pumperror), Notification.URGENT);
|
Notification n = new Notification(Notification.PUMPERROR, MainApp.gs(R.string.pumperror), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(n));
|
RxBus.INSTANCE.send(new EventNewNotification(n));
|
||||||
} else if (inputBuffer.length == 6 && inputBuffer[2] == 'B' && inputBuffer[3] == 'U' && inputBuffer[4] == 'S' && inputBuffer[5] == 'Y') {
|
} else if (inputBuffer.length == 6 && inputBuffer[2] == 'B' && inputBuffer[3] == 'U' && inputBuffer[4] == 'S' && inputBuffer[5] == 'Y') {
|
||||||
if (L.isEnabled(L.PUMPBTCOMM))
|
if (L.isEnabled(L.PUMPBTCOMM))
|
||||||
log.debug("<<<<< " + "ENCRYPTION__PUMP_CHECK (BUSY)" + " " + DanaRS_Packet.toHexString(inputBuffer));
|
log.debug("<<<<< " + "ENCRYPTION__PUMP_CHECK (BUSY)" + " " + DanaRS_Packet.toHexString(inputBuffer));
|
||||||
|
@ -468,7 +469,7 @@ public class BLEComm {
|
||||||
MainApp.bus().post(new EventPumpStatusChanged(EventPumpStatusChanged.DISCONNECTED, MainApp.gs(R.string.connectionerror)));
|
MainApp.bus().post(new EventPumpStatusChanged(EventPumpStatusChanged.DISCONNECTED, MainApp.gs(R.string.connectionerror)));
|
||||||
SP.remove(MainApp.gs(R.string.key_danars_pairingkey) + DanaRSPlugin.mDeviceName);
|
SP.remove(MainApp.gs(R.string.key_danars_pairingkey) + DanaRSPlugin.mDeviceName);
|
||||||
Notification n = new Notification(Notification.WRONGSERIALNUMBER, MainApp.gs(R.string.wrongpassword), Notification.URGENT);
|
Notification n = new Notification(Notification.WRONGSERIALNUMBER, MainApp.gs(R.string.wrongpassword), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(n));
|
RxBus.INSTANCE.send(new EventNewNotification(n));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
// 2nd packet, pairing key
|
// 2nd packet, pairing key
|
||||||
|
@ -666,7 +667,7 @@ public class BLEComm {
|
||||||
String devicename = getConnectDeviceName();
|
String devicename = getConnectDeviceName();
|
||||||
if (devicename == null || devicename.equals("")) {
|
if (devicename == null || devicename.equals("")) {
|
||||||
Notification n = new Notification(Notification.DEVICENOTPAIRED, MainApp.gs(R.string.pairfirst), Notification.URGENT);
|
Notification n = new Notification(Notification.DEVICENOTPAIRED, MainApp.gs(R.string.pairfirst), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(n));
|
RxBus.INSTANCE.send(new EventNewNotification(n));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
byte[] bytes = BleCommandUtil.getInstance().getEncryptedPacket(BleCommandUtil.DANAR_PACKET__OPCODE_ENCRYPTION__PUMP_CHECK, null, devicename);
|
byte[] bytes = BleCommandUtil.getInstance().getEncryptedPacket(BleCommandUtil.DANAR_PACKET__OPCODE_ENCRYPTION__PUMP_CHECK, null, devicename);
|
||||||
|
|
|
@ -220,7 +220,7 @@ public class DanaRSService extends Service {
|
||||||
log.debug("Approaching daily limit: " + danaRPump.dailyTotalUnits + "/" + danaRPump.maxDailyTotalUnits);
|
log.debug("Approaching daily limit: " + danaRPump.dailyTotalUnits + "/" + danaRPump.maxDailyTotalUnits);
|
||||||
if (System.currentTimeMillis() > lastApproachingDailyLimit + 30 * 60 * 1000) {
|
if (System.currentTimeMillis() > lastApproachingDailyLimit + 30 * 60 * 1000) {
|
||||||
Notification reportFail = new Notification(Notification.APPROACHING_DAILY_LIMIT, MainApp.gs(R.string.approachingdailylimit), Notification.URGENT);
|
Notification reportFail = new Notification(Notification.APPROACHING_DAILY_LIMIT, MainApp.gs(R.string.approachingdailylimit), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(reportFail));
|
RxBus.INSTANCE.send(new EventNewNotification(reportFail));
|
||||||
NSUpload.uploadError(MainApp.gs(R.string.approachingdailylimit) + ": " + danaRPump.dailyTotalUnits + "/" + danaRPump.maxDailyTotalUnits + "U");
|
NSUpload.uploadError(MainApp.gs(R.string.approachingdailylimit) + ": " + danaRPump.dailyTotalUnits + "/" + danaRPump.maxDailyTotalUnits + "U");
|
||||||
lastApproachingDailyLimit = System.currentTimeMillis();
|
lastApproachingDailyLimit = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.events.EventRefreshGui;
|
import info.nightscout.androidaps.events.EventRefreshGui;
|
||||||
import info.nightscout.androidaps.interfaces.PluginType;
|
import info.nightscout.androidaps.interfaces.PluginType;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
||||||
|
@ -43,7 +44,7 @@ public class MsgCheckValue_v2 extends MessageBase {
|
||||||
if (pump.model != DanaRPump.EXPORT_MODEL) {
|
if (pump.model != DanaRPump.EXPORT_MODEL) {
|
||||||
pump.lastConnection = 0;
|
pump.lastConnection = 0;
|
||||||
Notification notification = new Notification(Notification.WRONG_DRIVER, MainApp.gs(R.string.pumpdrivercorrected), Notification.NORMAL);
|
Notification notification = new Notification(Notification.WRONG_DRIVER, MainApp.gs(R.string.pumpdrivercorrected), Notification.NORMAL);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
MainApp.getSpecificPlugin(DanaRPlugin.class).disconnect("Wrong Model");
|
MainApp.getSpecificPlugin(DanaRPlugin.class).disconnect("Wrong Model");
|
||||||
log.error("Wrong model selected. Switching to Korean DanaR");
|
log.error("Wrong model selected. Switching to Korean DanaR");
|
||||||
MainApp.getSpecificPlugin(DanaRKoreanPlugin.class).setPluginEnabled(PluginType.PUMP, true);
|
MainApp.getSpecificPlugin(DanaRKoreanPlugin.class).setPluginEnabled(PluginType.PUMP, true);
|
||||||
|
@ -68,7 +69,7 @@ public class MsgCheckValue_v2 extends MessageBase {
|
||||||
if (pump.protocol != 2) {
|
if (pump.protocol != 2) {
|
||||||
pump.lastConnection = 0;
|
pump.lastConnection = 0;
|
||||||
Notification notification = new Notification(Notification.WRONG_DRIVER, MainApp.gs(R.string.pumpdrivercorrected), Notification.NORMAL);
|
Notification notification = new Notification(Notification.WRONG_DRIVER, MainApp.gs(R.string.pumpdrivercorrected), Notification.NORMAL);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
DanaRKoreanPlugin.getPlugin().disconnect("Wrong Model");
|
DanaRKoreanPlugin.getPlugin().disconnect("Wrong Model");
|
||||||
log.error("Wrong model selected. Switching to non APS DanaR");
|
log.error("Wrong model selected. Switching to non APS DanaR");
|
||||||
(MainApp.getSpecificPlugin(DanaRv2Plugin.class)).setPluginEnabled(PluginType.PUMP, false);
|
(MainApp.getSpecificPlugin(DanaRv2Plugin.class)).setPluginEnabled(PluginType.PUMP, false);
|
||||||
|
|
|
@ -263,7 +263,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
||||||
log.debug("Approaching daily limit: " + danaRPump.dailyTotalUnits + "/" + danaRPump.maxDailyTotalUnits);
|
log.debug("Approaching daily limit: " + danaRPump.dailyTotalUnits + "/" + danaRPump.maxDailyTotalUnits);
|
||||||
if (System.currentTimeMillis() > lastApproachingDailyLimit + 30 * 60 * 1000) {
|
if (System.currentTimeMillis() > lastApproachingDailyLimit + 30 * 60 * 1000) {
|
||||||
Notification reportFail = new Notification(Notification.APPROACHING_DAILY_LIMIT, MainApp.gs(R.string.approachingdailylimit), Notification.URGENT);
|
Notification reportFail = new Notification(Notification.APPROACHING_DAILY_LIMIT, MainApp.gs(R.string.approachingdailylimit), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(reportFail));
|
RxBus.INSTANCE.send(new EventNewNotification(reportFail));
|
||||||
NSUpload.uploadError(MainApp.gs(R.string.approachingdailylimit) + ": " + danaRPump.dailyTotalUnits + "/" + danaRPump.maxDailyTotalUnits + "U");
|
NSUpload.uploadError(MainApp.gs(R.string.approachingdailylimit) + ": " + danaRPump.dailyTotalUnits + "/" + danaRPump.maxDailyTotalUnits + "U");
|
||||||
lastApproachingDailyLimit = System.currentTimeMillis();
|
lastApproachingDailyLimit = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,7 @@ import info.nightscout.androidaps.interfaces.PluginType;
|
||||||
import info.nightscout.androidaps.interfaces.PumpDescription;
|
import info.nightscout.androidaps.interfaces.PumpDescription;
|
||||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
import info.nightscout.androidaps.plugins.common.ManufacturerType;
|
import info.nightscout.androidaps.plugins.common.ManufacturerType;
|
||||||
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;
|
||||||
|
@ -354,7 +355,7 @@ public class LocalInsightPlugin extends PluginBase implements PumpInterface, Con
|
||||||
setDateTimeMessage.setPumpTime(pumpTime);
|
setDateTimeMessage.setPumpTime(pumpTime);
|
||||||
connectionService.requestMessage(setDateTimeMessage).await();
|
connectionService.requestMessage(setDateTimeMessage).await();
|
||||||
Notification notification = new Notification(Notification.INSIGHT_DATE_TIME_UPDATED, MainApp.gs(R.string.pump_time_updated), Notification.INFO, 60);
|
Notification notification = new Notification(Notification.INSIGHT_DATE_TIME_UPDATED, MainApp.gs(R.string.pump_time_updated), Notification.INFO, 60);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -440,7 +441,7 @@ public class LocalInsightPlugin extends PluginBase implements PumpInterface, Con
|
||||||
@Override
|
@Override
|
||||||
public PumpEnactResult setNewBasalProfile(Profile profile) {
|
public PumpEnactResult setNewBasalProfile(Profile profile) {
|
||||||
PumpEnactResult result = new PumpEnactResult();
|
PumpEnactResult result = new PumpEnactResult();
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED));
|
RxBus.INSTANCE.send(new EventDismissNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED));
|
||||||
List<BasalProfileBlock> profileBlocks = new ArrayList<>();
|
List<BasalProfileBlock> profileBlocks = new ArrayList<>();
|
||||||
for (int i = 0; i < profile.getBasalValues().length; i++) {
|
for (int i = 0; i < profile.getBasalValues().length; i++) {
|
||||||
Profile.ProfileValue basalValue = profile.getBasalValues()[i];
|
Profile.ProfileValue basalValue = profile.getBasalValues()[i];
|
||||||
|
@ -460,9 +461,9 @@ public class LocalInsightPlugin extends PluginBase implements PumpInterface, Con
|
||||||
BRProfileBlock profileBlock = new BRProfile1Block();
|
BRProfileBlock profileBlock = new BRProfile1Block();
|
||||||
profileBlock.setProfileBlocks(profileBlocks);
|
profileBlock.setProfileBlocks(profileBlocks);
|
||||||
ParameterBlockUtil.writeConfigurationBlock(connectionService, profileBlock);
|
ParameterBlockUtil.writeConfigurationBlock(connectionService, profileBlock);
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.FAILED_UDPATE_PROFILE));
|
RxBus.INSTANCE.send(new EventDismissNotification(Notification.FAILED_UDPATE_PROFILE));
|
||||||
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));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
result.success = true;
|
result.success = true;
|
||||||
result.enacted = true;
|
result.enacted = true;
|
||||||
result.comment = MainApp.gs(R.string.virtualpump_resultok);
|
result.comment = MainApp.gs(R.string.virtualpump_resultok);
|
||||||
|
@ -474,17 +475,17 @@ public class LocalInsightPlugin extends PluginBase implements PumpInterface, Con
|
||||||
} catch (AppLayerErrorException e) {
|
} catch (AppLayerErrorException e) {
|
||||||
log.info("Exception while setting profile: " + e.getClass().getCanonicalName() + " (" + e.getErrorCode() + ")");
|
log.info("Exception while setting profile: " + e.getClass().getCanonicalName() + " (" + e.getErrorCode() + ")");
|
||||||
Notification notification = new Notification(Notification.FAILED_UDPATE_PROFILE, MainApp.gs(R.string.failedupdatebasalprofile), Notification.URGENT);
|
Notification notification = new Notification(Notification.FAILED_UDPATE_PROFILE, MainApp.gs(R.string.failedupdatebasalprofile), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
result.comment = ExceptionTranslator.getString(e);
|
result.comment = ExceptionTranslator.getString(e);
|
||||||
} catch (InsightException e) {
|
} catch (InsightException e) {
|
||||||
log.info("Exception while setting profile: " + e.getClass().getCanonicalName());
|
log.info("Exception while setting profile: " + e.getClass().getCanonicalName());
|
||||||
Notification notification = new Notification(Notification.FAILED_UDPATE_PROFILE, MainApp.gs(R.string.failedupdatebasalprofile), Notification.URGENT);
|
Notification notification = new Notification(Notification.FAILED_UDPATE_PROFILE, MainApp.gs(R.string.failedupdatebasalprofile), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
result.comment = ExceptionTranslator.getString(e);
|
result.comment = ExceptionTranslator.getString(e);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Exception while setting profile", e);
|
log.error("Exception while setting profile", e);
|
||||||
Notification notification = new Notification(Notification.FAILED_UDPATE_PROFILE, MainApp.gs(R.string.failedupdatebasalprofile), Notification.URGENT);
|
Notification notification = new Notification(Notification.FAILED_UDPATE_PROFILE, MainApp.gs(R.string.failedupdatebasalprofile), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
result.comment = ExceptionTranslator.getString(e);
|
result.comment = ExceptionTranslator.getString(e);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -1585,7 +1586,7 @@ public class LocalInsightPlugin extends PluginBase implements PumpInterface, Con
|
||||||
public void onStateChanged(InsightState state) {
|
public void onStateChanged(InsightState state) {
|
||||||
if (state == InsightState.CONNECTED) {
|
if (state == InsightState.CONNECTED) {
|
||||||
statusLoaded = false;
|
statusLoaded = false;
|
||||||
new Handler(Looper.getMainLooper()).post(() -> MainApp.bus().post(new EventDismissNotification(Notification.INSIGHT_TIMEOUT_DURING_HANDSHAKE)));
|
new Handler(Looper.getMainLooper()).post(() -> RxBus.INSTANCE.send(new EventDismissNotification(Notification.INSIGHT_TIMEOUT_DURING_HANDSHAKE)));
|
||||||
} else if (state == InsightState.NOT_PAIRED) {
|
} else if (state == InsightState.NOT_PAIRED) {
|
||||||
connectionService.withdrawConnectionRequest(this);
|
connectionService.withdrawConnectionRequest(this);
|
||||||
statusLoaded = false;
|
statusLoaded = false;
|
||||||
|
@ -1611,7 +1612,7 @@ public class LocalInsightPlugin extends PluginBase implements PumpInterface, Con
|
||||||
@Override
|
@Override
|
||||||
public void onTimeoutDuringHandshake() {
|
public void onTimeoutDuringHandshake() {
|
||||||
Notification notification = new Notification(Notification.INSIGHT_TIMEOUT_DURING_HANDSHAKE, MainApp.gs(R.string.timeout_during_handshake), Notification.URGENT);
|
Notification notification = new Notification(Notification.INSIGHT_TIMEOUT_DURING_HANDSHAKE, MainApp.gs(R.string.timeout_during_handshake), Notification.URGENT);
|
||||||
new Handler(Looper.getMainLooper()).post(() -> MainApp.bus().post(new EventNewNotification(notification)));
|
new Handler(Looper.getMainLooper()).post(() -> RxBus.INSTANCE.send(new EventNewNotification(notification)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -766,7 +766,7 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
|
||||||
|
|
||||||
if (clock.timeDifference == 0) {
|
if (clock.timeDifference == 0) {
|
||||||
Notification notification = new Notification(Notification.INSIGHT_DATE_TIME_UPDATED, MainApp.gs(R.string.pump_time_updated), Notification.INFO, 60);
|
Notification notification = new Notification(Notification.INSIGHT_DATE_TIME_UPDATED, MainApp.gs(R.string.pump_time_updated), Notification.INFO, 60);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ((clock.localDeviceTime.getYear() > 2015)) {
|
if ((clock.localDeviceTime.getYear() > 2015)) {
|
||||||
|
|
|
@ -231,7 +231,7 @@ public class MedtronicUtil extends RileyLinkUtil {
|
||||||
notificationType.getNotificationType(), //
|
notificationType.getNotificationType(), //
|
||||||
MainApp.gs(notificationType.getResourceId()), //
|
MainApp.gs(notificationType.getResourceId()), //
|
||||||
notificationType.getNotificationUrgency());
|
notificationType.getNotificationUrgency());
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -240,12 +240,12 @@ public class MedtronicUtil extends RileyLinkUtil {
|
||||||
notificationType.getNotificationType(), //
|
notificationType.getNotificationType(), //
|
||||||
MainApp.gs(notificationType.getResourceId(), parameters), //
|
MainApp.gs(notificationType.getResourceId(), parameters), //
|
||||||
notificationType.getNotificationUrgency());
|
notificationType.getNotificationUrgency());
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void dismissNotification(MedtronicNotificationType notificationType) {
|
public static void dismissNotification(MedtronicNotificationType notificationType) {
|
||||||
MainApp.bus().post(new EventDismissNotification(notificationType.getNotificationType()));
|
RxBus.INSTANCE.send(new EventDismissNotification(notificationType.getNotificationType()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ import info.nightscout.androidaps.interfaces.PluginType;
|
||||||
import info.nightscout.androidaps.interfaces.PumpDescription;
|
import info.nightscout.androidaps.interfaces.PumpDescription;
|
||||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
import info.nightscout.androidaps.plugins.common.ManufacturerType;
|
import info.nightscout.androidaps.plugins.common.ManufacturerType;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
||||||
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction;
|
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction;
|
||||||
|
@ -219,7 +220,7 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
|
||||||
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));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,10 +245,14 @@ 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) {
|
||||||
|
|
|
@ -224,7 +224,7 @@ public class Treatment implements DataPointWithLabelInterface, DbObjectBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getY() {
|
public double getY() {
|
||||||
return isSMB ? OverviewPlugin.getPlugin().determineLowLine() : yValue;
|
return isSMB ? OverviewPlugin.INSTANCE.determineLowLine() : yValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -42,6 +42,7 @@ import info.nightscout.androidaps.interfaces.PluginType;
|
||||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
import info.nightscout.androidaps.interfaces.TreatmentsInterface;
|
import info.nightscout.androidaps.interfaces.TreatmentsInterface;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
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.nsclient.NSUpload;
|
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
|
||||||
|
@ -741,7 +742,7 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
|
||||||
@Override
|
@Override
|
||||||
public void addToHistoryProfileSwitch(ProfileSwitch profileSwitch) {
|
public void addToHistoryProfileSwitch(ProfileSwitch profileSwitch) {
|
||||||
//log.debug("Adding new TemporaryBasal record" + profileSwitch.log());
|
//log.debug("Adding new TemporaryBasal record" + profileSwitch.log());
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.PROFILE_SWITCH_MISSING));
|
RxBus.INSTANCE.send(new EventDismissNotification(Notification.PROFILE_SWITCH_MISSING));
|
||||||
MainApp.getDbHelper().createOrUpdate(profileSwitch);
|
MainApp.getDbHelper().createOrUpdate(profileSwitch);
|
||||||
NSUpload.uploadProfileSwitch(profileSwitch);
|
NSUpload.uploadProfileSwitch(profileSwitch);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,10 +3,11 @@ package info.nightscout.androidaps.queue;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.text.Spanned;
|
import android.text.Spanned;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -21,6 +22,7 @@ import info.nightscout.androidaps.events.EventBolusRequested;
|
||||||
import info.nightscout.androidaps.interfaces.Constraint;
|
import info.nightscout.androidaps.interfaces.Constraint;
|
||||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
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.overview.dialogs.BolusProgressDialog;
|
import info.nightscout.androidaps.plugins.general.overview.dialogs.BolusProgressDialog;
|
||||||
|
@ -380,7 +382,7 @@ public class CommandQueue {
|
||||||
|
|
||||||
if (!MainApp.isEngineeringModeOrRelease()) {
|
if (!MainApp.isEngineeringModeOrRelease()) {
|
||||||
Notification notification = new Notification(Notification.NOT_ENG_MODE_OR_RELEASE, MainApp.gs(R.string.not_eng_mode_or_release), Notification.URGENT);
|
Notification notification = new Notification(Notification.NOT_ENG_MODE_OR_RELEASE, MainApp.gs(R.string.not_eng_mode_or_release), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
if (callback != null)
|
if (callback != null)
|
||||||
callback.result(new PumpEnactResult().success(false).enacted(false).comment(MainApp.gs(R.string.not_eng_mode_or_release))).run();
|
callback.result(new PumpEnactResult().success(false).enacted(false).comment(MainApp.gs(R.string.not_eng_mode_or_release))).run();
|
||||||
return false;
|
return false;
|
||||||
|
@ -393,14 +395,14 @@ public class CommandQueue {
|
||||||
for (Profile.ProfileValue basalValue : basalValues) {
|
for (Profile.ProfileValue basalValue : basalValues) {
|
||||||
if (basalValue.value < pump.getPumpDescription().basalMinimumRate) {
|
if (basalValue.value < pump.getPumpDescription().basalMinimumRate) {
|
||||||
Notification notification = new Notification(Notification.BASAL_VALUE_BELOW_MINIMUM, MainApp.gs(R.string.basalvaluebelowminimum), Notification.URGENT);
|
Notification notification = new Notification(Notification.BASAL_VALUE_BELOW_MINIMUM, MainApp.gs(R.string.basalvaluebelowminimum), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
if (callback != null)
|
if (callback != null)
|
||||||
callback.result(new PumpEnactResult().success(false).enacted(false).comment(MainApp.gs(R.string.basalvaluebelowminimum))).run();
|
callback.result(new PumpEnactResult().success(false).enacted(false).comment(MainApp.gs(R.string.basalvaluebelowminimum))).run();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.BASAL_VALUE_BELOW_MINIMUM));
|
RxBus.INSTANCE.send(new EventDismissNotification(Notification.BASAL_VALUE_BELOW_MINIMUM));
|
||||||
|
|
||||||
// remove all unfinished
|
// remove all unfinished
|
||||||
removeAll(Command.CommandType.BASALPROFILE);
|
removeAll(Command.CommandType.BASALPROFILE);
|
||||||
|
|
|
@ -93,7 +93,7 @@ public class QueueThread extends Thread {
|
||||||
SystemClock.sleep(1000);
|
SystemClock.sleep(1000);
|
||||||
//start over again once after watchdog barked
|
//start over again once after watchdog barked
|
||||||
//Notification notification = new Notification(Notification.OLD_NSCLIENT, "Watchdog", Notification.URGENT);
|
//Notification notification = new Notification(Notification.OLD_NSCLIENT, "Watchdog", Notification.URGENT);
|
||||||
//MainApp.bus().post(new EventNewNotification(notification));
|
//RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
connectionStartTime = lastCommandTime = System.currentTimeMillis();
|
connectionStartTime = lastCommandTime = System.currentTimeMillis();
|
||||||
pump.connect("watchdog");
|
pump.connect("watchdog");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -10,8 +10,8 @@ import org.json.JSONObject;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.data.NSAlarm;
|
import info.nightscout.androidaps.plugins.general.nsclient.data.NSAlarm;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
||||||
|
@ -41,11 +41,11 @@ public class NSAlarmReceiver extends BroadcastReceiver {
|
||||||
case Intents.ACTION_URGENT_ALARM:
|
case Intents.ACTION_URGENT_ALARM:
|
||||||
Notification notification = new Notification(nsAlarm);
|
Notification notification = new Notification(nsAlarm);
|
||||||
if (notification.isEnabled())
|
if (notification.isEnabled())
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
break;
|
break;
|
||||||
case Intents.ACTION_CLEAR_ALARM:
|
case Intents.ACTION_CLEAR_ALARM:
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.NSALARM));
|
RxBus.INSTANCE.send(new EventDismissNotification(Notification.NSALARM));
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.NSURGENTALARM));
|
RxBus.INSTANCE.send(new EventDismissNotification(Notification.NSURGENTALARM));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,15 +16,17 @@ import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.db.CareportalEvent;
|
import info.nightscout.androidaps.db.CareportalEvent;
|
||||||
import info.nightscout.androidaps.events.EventNsFood;
|
import info.nightscout.androidaps.events.EventNsFood;
|
||||||
import info.nightscout.androidaps.events.EventNsTreatment;
|
import info.nightscout.androidaps.events.EventNsTreatment;
|
||||||
|
import info.nightscout.androidaps.logging.BundleLogger;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.data.NSDeviceStatus;
|
import info.nightscout.androidaps.plugins.general.nsclient.data.NSDeviceStatus;
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.data.NSMbg;
|
import info.nightscout.androidaps.plugins.general.nsclient.data.NSMbg;
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.data.NSSettingsStatus;
|
import info.nightscout.androidaps.plugins.general.nsclient.data.NSSettingsStatus;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
||||||
|
import info.nightscout.androidaps.plugins.general.smsCommunicator.SmsCommunicatorPlugin;
|
||||||
import info.nightscout.androidaps.plugins.profile.ns.NSProfilePlugin;
|
import info.nightscout.androidaps.plugins.profile.ns.NSProfilePlugin;
|
||||||
import info.nightscout.androidaps.plugins.pump.danaR.activities.DanaRNSHistorySync;
|
import info.nightscout.androidaps.plugins.pump.danaR.activities.DanaRNSHistorySync;
|
||||||
import info.nightscout.androidaps.plugins.general.smsCommunicator.SmsCommunicatorPlugin;
|
|
||||||
import info.nightscout.androidaps.plugins.source.SourceDexcomPlugin;
|
import info.nightscout.androidaps.plugins.source.SourceDexcomPlugin;
|
||||||
import info.nightscout.androidaps.plugins.source.SourceEversensePlugin;
|
import info.nightscout.androidaps.plugins.source.SourceEversensePlugin;
|
||||||
import info.nightscout.androidaps.plugins.source.SourceGlimpPlugin;
|
import info.nightscout.androidaps.plugins.source.SourceGlimpPlugin;
|
||||||
|
@ -34,7 +36,6 @@ import info.nightscout.androidaps.plugins.source.SourcePoctechPlugin;
|
||||||
import info.nightscout.androidaps.plugins.source.SourceTomatoPlugin;
|
import info.nightscout.androidaps.plugins.source.SourceTomatoPlugin;
|
||||||
import info.nightscout.androidaps.plugins.source.SourceXdripPlugin;
|
import info.nightscout.androidaps.plugins.source.SourceXdripPlugin;
|
||||||
import info.nightscout.androidaps.receivers.DataReceiver;
|
import info.nightscout.androidaps.receivers.DataReceiver;
|
||||||
import info.nightscout.androidaps.logging.BundleLogger;
|
|
||||||
import info.nightscout.androidaps.utils.JsonHelper;
|
import info.nightscout.androidaps.utils.JsonHelper;
|
||||||
import info.nightscout.androidaps.utils.SP;
|
import info.nightscout.androidaps.utils.SP;
|
||||||
|
|
||||||
|
@ -254,7 +255,7 @@ public class DataService extends IntentService {
|
||||||
if (date > now - 15 * 60 * 1000L && !notes.isEmpty()
|
if (date > now - 15 * 60 * 1000L && !notes.isEmpty()
|
||||||
&& !enteredBy.equals(SP.getString("careportal_enteredby", "AndroidAPS"))) {
|
&& !enteredBy.equals(SP.getString("careportal_enteredby", "AndroidAPS"))) {
|
||||||
Notification announcement = new Notification(Notification.NSANNOUNCEMENT, notes, Notification.ANNOUNCEMENT, 60);
|
Notification announcement = new Notification(Notification.NSANNOUNCEMENT, notes, Notification.ANNOUNCEMENT, 60);
|
||||||
MainApp.bus().post(new EventNewNotification(announcement));
|
RxBus.INSTANCE.send(new EventNewNotification(announcement));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
||||||
|
@ -84,18 +85,18 @@ public class AndroidPermission {
|
||||||
notification.action(R.string.request, () -> AndroidPermission.askForPermission(activity, new String[]{Manifest.permission.RECEIVE_SMS,
|
notification.action(R.string.request, () -> AndroidPermission.askForPermission(activity, new String[]{Manifest.permission.RECEIVE_SMS,
|
||||||
Manifest.permission.SEND_SMS,
|
Manifest.permission.SEND_SMS,
|
||||||
Manifest.permission.RECEIVE_MMS}, AndroidPermission.CASE_SMS));
|
Manifest.permission.RECEIVE_MMS}, AndroidPermission.CASE_SMS));
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
} else
|
} else
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.PERMISSION_SMS));
|
RxBus.INSTANCE.send(new EventDismissNotification(Notification.PERMISSION_SMS));
|
||||||
// Following is a bug in Android 8
|
// Following is a bug in Android 8
|
||||||
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.O) {
|
||||||
if (permissionNotGranted(activity, Manifest.permission.READ_PHONE_STATE)) {
|
if (permissionNotGranted(activity, Manifest.permission.READ_PHONE_STATE)) {
|
||||||
NotificationWithAction notification = new NotificationWithAction(Notification.PERMISSION_PHONESTATE, MainApp.gs(R.string.smscommunicator_missingphonestatepermission), Notification.URGENT);
|
NotificationWithAction notification = new NotificationWithAction(Notification.PERMISSION_PHONESTATE, MainApp.gs(R.string.smscommunicator_missingphonestatepermission), Notification.URGENT);
|
||||||
notification.action(R.string.request, () ->
|
notification.action(R.string.request, () ->
|
||||||
AndroidPermission.askForPermission(activity, new String[]{Manifest.permission.READ_PHONE_STATE}, AndroidPermission.CASE_PHONE_STATE));
|
AndroidPermission.askForPermission(activity, new String[]{Manifest.permission.READ_PHONE_STATE}, AndroidPermission.CASE_PHONE_STATE));
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
} else
|
} else
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.PERMISSION_PHONESTATE));
|
RxBus.INSTANCE.send(new EventDismissNotification(Notification.PERMISSION_PHONESTATE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,9 +105,9 @@ public class AndroidPermission {
|
||||||
if (permissionNotGranted(activity, Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS)) {
|
if (permissionNotGranted(activity, Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS)) {
|
||||||
NotificationWithAction notification = new NotificationWithAction(Notification.PERMISSION_BATTERY, String.format(MainApp.gs(R.string.needwhitelisting), MainApp.gs(R.string.app_name)), Notification.URGENT);
|
NotificationWithAction notification = new NotificationWithAction(Notification.PERMISSION_BATTERY, String.format(MainApp.gs(R.string.needwhitelisting), MainApp.gs(R.string.app_name)), Notification.URGENT);
|
||||||
notification.action(R.string.request, () -> AndroidPermission.askForPermission(activity, new String[]{Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS}, AndroidPermission.CASE_BATTERY));
|
notification.action(R.string.request, () -> AndroidPermission.askForPermission(activity, new String[]{Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS}, AndroidPermission.CASE_BATTERY));
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
} else
|
} else
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.PERMISSION_BATTERY));
|
RxBus.INSTANCE.send(new EventDismissNotification(Notification.PERMISSION_BATTERY));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static synchronized void notifyForStoragePermission(Activity activity) {
|
public static synchronized void notifyForStoragePermission(Activity activity) {
|
||||||
|
@ -114,17 +115,17 @@ public class AndroidPermission {
|
||||||
NotificationWithAction notification = new NotificationWithAction(Notification.PERMISSION_STORAGE, MainApp.gs(R.string.needstoragepermission), Notification.URGENT);
|
NotificationWithAction notification = new NotificationWithAction(Notification.PERMISSION_STORAGE, MainApp.gs(R.string.needstoragepermission), Notification.URGENT);
|
||||||
notification.action(R.string.request, () -> AndroidPermission.askForPermission(activity, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE,
|
notification.action(R.string.request, () -> AndroidPermission.askForPermission(activity, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE,
|
||||||
Manifest.permission.WRITE_EXTERNAL_STORAGE}, AndroidPermission.CASE_STORAGE));
|
Manifest.permission.WRITE_EXTERNAL_STORAGE}, AndroidPermission.CASE_STORAGE));
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
} else
|
} else
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.PERMISSION_STORAGE));
|
RxBus.INSTANCE.send(new EventDismissNotification(Notification.PERMISSION_STORAGE));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static synchronized void notifyForLocationPermissions(Activity activity) {
|
public static synchronized void notifyForLocationPermissions(Activity activity) {
|
||||||
if (permissionNotGranted(activity, Manifest.permission.ACCESS_FINE_LOCATION)) {
|
if (permissionNotGranted(activity, Manifest.permission.ACCESS_FINE_LOCATION)) {
|
||||||
NotificationWithAction notification = new NotificationWithAction(Notification.PERMISSION_LOCATION, MainApp.gs(R.string.needlocationpermission), Notification.URGENT);
|
NotificationWithAction notification = new NotificationWithAction(Notification.PERMISSION_LOCATION, MainApp.gs(R.string.needlocationpermission), Notification.URGENT);
|
||||||
notification.action(R.string.request, () -> AndroidPermission.askForPermission(activity, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, AndroidPermission.CASE_LOCATION));
|
notification.action(R.string.request, () -> AndroidPermission.askForPermission(activity, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, AndroidPermission.CASE_LOCATION));
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
} else
|
} else
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.PERMISSION_LOCATION));
|
RxBus.INSTANCE.send(new EventDismissNotification(Notification.PERMISSION_LOCATION));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,9 +10,10 @@ import info.nightscout.androidaps.data.Profile;
|
||||||
import info.nightscout.androidaps.db.BgReading;
|
import info.nightscout.androidaps.db.BgReading;
|
||||||
import info.nightscout.androidaps.db.DatabaseHelper;
|
import info.nightscout.androidaps.db.DatabaseHelper;
|
||||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
|
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin;
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
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.aps.loop.LoopPlugin;
|
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
|
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
||||||
|
@ -43,13 +44,13 @@ public class LocalAlertUtils {
|
||||||
Notification n = new Notification(Notification.PUMP_UNREACHABLE, MainApp.gs(R.string.pump_unreachable), Notification.URGENT);
|
Notification n = new Notification(Notification.PUMP_UNREACHABLE, MainApp.gs(R.string.pump_unreachable), Notification.URGENT);
|
||||||
n.soundId = R.raw.alarm;
|
n.soundId = R.raw.alarm;
|
||||||
SP.putLong("nextPumpDisconnectedAlarm", System.currentTimeMillis() + pumpUnreachableThreshold());
|
SP.putLong("nextPumpDisconnectedAlarm", System.currentTimeMillis() + pumpUnreachableThreshold());
|
||||||
MainApp.bus().post(new EventNewNotification(n));
|
RxBus.INSTANCE.send(new EventNewNotification(n));
|
||||||
if (SP.getBoolean(R.string.key_ns_create_announcements_from_errors, true)) {
|
if (SP.getBoolean(R.string.key_ns_create_announcements_from_errors, true)) {
|
||||||
NSUpload.uploadError(n.text);
|
NSUpload.uploadError(n.text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!isStatusOutdated && !alarmTimeoutExpired)
|
if (!isStatusOutdated && !alarmTimeoutExpired)
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.PUMP_UNREACHABLE));
|
RxBus.INSTANCE.send(new EventDismissNotification(Notification.PUMP_UNREACHABLE));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Presnoozes the alarms with 5 minutes if no snooze exists.
|
/*Presnoozes the alarms with 5 minutes if no snooze exists.
|
||||||
|
@ -97,7 +98,7 @@ public class LocalAlertUtils {
|
||||||
Notification n = new Notification(Notification.BG_READINGS_MISSED, MainApp.gs(R.string.missed_bg_readings), Notification.URGENT);
|
Notification n = new Notification(Notification.BG_READINGS_MISSED, MainApp.gs(R.string.missed_bg_readings), Notification.URGENT);
|
||||||
n.soundId = R.raw.alarm;
|
n.soundId = R.raw.alarm;
|
||||||
SP.putLong("nextMissedReadingsAlarm", System.currentTimeMillis() + missedReadingsThreshold());
|
SP.putLong("nextMissedReadingsAlarm", System.currentTimeMillis() + missedReadingsThreshold());
|
||||||
MainApp.bus().post(new EventNewNotification(n));
|
RxBus.INSTANCE.send(new EventNewNotification(n));
|
||||||
if (SP.getBoolean(R.string.key_ns_create_announcements_from_errors, true)) {
|
if (SP.getBoolean(R.string.key_ns_create_announcements_from_errors, true)) {
|
||||||
NSUpload.uploadError(n.text);
|
NSUpload.uploadError(n.text);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,29 +6,20 @@ import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.annotation.IdRes;
|
|
||||||
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
||||||
|
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
||||||
|
|
||||||
|
|
||||||
public class ToastUtils {
|
public class ToastUtils {
|
||||||
public static void showToastInUiThread(final Context ctx,
|
public static void showToastInUiThread(final Context ctx, final int stringId) {
|
||||||
final int stringId) {
|
|
||||||
showToastInUiThread(ctx, MainApp.gs(stringId));
|
showToastInUiThread(ctx, MainApp.gs(stringId));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void showToastInUiThread(final Context ctx,
|
public static void showToastInUiThread(final Context ctx, final String string) {
|
||||||
final String string) {
|
|
||||||
|
|
||||||
Handler mainThread = new Handler(Looper.getMainLooper());
|
Handler mainThread = new Handler(Looper.getMainLooper());
|
||||||
mainThread.post(new Runnable() {
|
mainThread.post(() -> Toast.makeText(ctx, string, Toast.LENGTH_SHORT).show());
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
Toast.makeText(ctx, string, Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void showToastInUiThread(final Context ctx,
|
public static void showToastInUiThread(final Context ctx,
|
||||||
|
@ -36,23 +27,13 @@ public class ToastUtils {
|
||||||
|
|
||||||
showToastInUiThread(ctx, string);
|
showToastInUiThread(ctx, string);
|
||||||
playSound(ctx, soundID);
|
playSound(ctx, soundID);
|
||||||
new Thread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
Notification notification = new Notification(Notification.TOAST_ALARM, string, Notification.URGENT);
|
Notification notification = new Notification(Notification.TOAST_ALARM, string, Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void playSound(final Context ctx, final int soundID) {
|
private static void playSound(final Context ctx, final int soundID) {
|
||||||
final MediaPlayer soundMP = MediaPlayer.create(ctx, soundID);
|
final MediaPlayer soundMP = MediaPlayer.create(ctx, soundID);
|
||||||
soundMP.start();
|
soundMP.start();
|
||||||
soundMP.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
|
soundMP.setOnCompletionListener(MediaPlayer::release);
|
||||||
@Override
|
|
||||||
public void onCompletion(MediaPlayer mp) {
|
|
||||||
mp.release();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -99,7 +99,7 @@ public class ProfileTest {
|
||||||
//Test basal profile below limit
|
//Test basal profile below limit
|
||||||
p = new Profile(new JSONObject(belowLimitValidProfile), 100, 0);
|
p = new Profile(new JSONObject(belowLimitValidProfile), 100, 0);
|
||||||
p.isValid("Test");
|
p.isValid("Test");
|
||||||
Assert.assertEquals(true, ((AAPSMocker.MockedBus) MainApp.bus()).notificationSent);
|
//Assert.assertEquals(true, ((AAPSMocker.MockedBus) MainApp.bus()).notificationSent);
|
||||||
|
|
||||||
// Test profile w/o units
|
// Test profile w/o units
|
||||||
p = new Profile(new JSONObject(noUnitsValidProfile), 100, 0);
|
p = new Profile(new JSONObject(noUnitsValidProfile), 100, 0);
|
||||||
|
@ -137,7 +137,7 @@ public class ProfileTest {
|
||||||
((AAPSMocker.MockedBus) MainApp.bus()).notificationSent = false;
|
((AAPSMocker.MockedBus) MainApp.bus()).notificationSent = false;
|
||||||
p = new Profile(new JSONObject(notAllignedBasalValidProfile), 100, 0);
|
p = new Profile(new JSONObject(notAllignedBasalValidProfile), 100, 0);
|
||||||
p.isValid("Test");
|
p.isValid("Test");
|
||||||
Assert.assertEquals(true, ((AAPSMocker.MockedBus) MainApp.bus()).notificationSent);
|
//Assert.assertEquals(true, ((AAPSMocker.MockedBus) MainApp.bus()).notificationSent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
|
|
|
@ -67,7 +67,7 @@ class VersionCheckerUtilsKtTest {
|
||||||
|
|
||||||
compareWithCurrentVersion(newVersion = "2.2.3", currentVersion = "2.2.1")
|
compareWithCurrentVersion(newVersion = "2.2.3", currentVersion = "2.2.1")
|
||||||
|
|
||||||
verify(bus, times(1)).post(any())
|
//verify(bus, times(1)).post(any())
|
||||||
|
|
||||||
PowerMockito.verifyStatic(SP::class.java, times(1))
|
PowerMockito.verifyStatic(SP::class.java, times(1))
|
||||||
SP.getLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
|
SP.getLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
|
||||||
|
@ -84,7 +84,7 @@ class VersionCheckerUtilsKtTest {
|
||||||
|
|
||||||
compareWithCurrentVersion(newVersion = "2.2.3", currentVersion = "2.2.1-dev")
|
compareWithCurrentVersion(newVersion = "2.2.3", currentVersion = "2.2.1-dev")
|
||||||
|
|
||||||
verify(bus, times(1)).post(any())
|
//verify(bus, times(1)).post(any())
|
||||||
|
|
||||||
PowerMockito.verifyStatic(SP::class.java, times(1))
|
PowerMockito.verifyStatic(SP::class.java, times(1))
|
||||||
SP.getLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
|
SP.getLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
|
||||||
|
@ -100,7 +100,7 @@ class VersionCheckerUtilsKtTest {
|
||||||
|
|
||||||
compareWithCurrentVersion(newVersion = "2.2.3", currentVersion = "2.1")
|
compareWithCurrentVersion(newVersion = "2.2.3", currentVersion = "2.1")
|
||||||
|
|
||||||
verify(bus, times(1)).post(any())
|
//verify(bus, times(1)).post(any())
|
||||||
|
|
||||||
PowerMockito.verifyStatic(SP::class.java, times(1))
|
PowerMockito.verifyStatic(SP::class.java, times(1))
|
||||||
SP.getLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
|
SP.getLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
|
||||||
|
@ -116,7 +116,7 @@ class VersionCheckerUtilsKtTest {
|
||||||
|
|
||||||
compareWithCurrentVersion(newVersion = "2.2", currentVersion = "2.1.1")
|
compareWithCurrentVersion(newVersion = "2.2", currentVersion = "2.1.1")
|
||||||
|
|
||||||
verify(bus, times(1)).post(any())
|
//verify(bus, times(1)).post(any())
|
||||||
|
|
||||||
PowerMockito.verifyStatic(SP::class.java, times(1))
|
PowerMockito.verifyStatic(SP::class.java, times(1))
|
||||||
SP.getLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
|
SP.getLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
|
||||||
|
@ -131,7 +131,7 @@ class VersionCheckerUtilsKtTest {
|
||||||
val bus = prepareBus()
|
val bus = prepareBus()
|
||||||
compareWithCurrentVersion(newVersion = "2.2.1", currentVersion = "2.2-dev")
|
compareWithCurrentVersion(newVersion = "2.2.1", currentVersion = "2.2-dev")
|
||||||
|
|
||||||
verify(bus, times(1)).post(any())
|
//verify(bus, times(1)).post(any())
|
||||||
|
|
||||||
PowerMockito.verifyStatic(SP::class.java, times(1))
|
PowerMockito.verifyStatic(SP::class.java, times(1))
|
||||||
SP.getLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
|
SP.getLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
|
||||||
|
@ -146,7 +146,7 @@ class VersionCheckerUtilsKtTest {
|
||||||
val bus = prepareBus()
|
val bus = prepareBus()
|
||||||
compareWithCurrentVersion(newVersion = "2.2.1", currentVersion = "2.2dev")
|
compareWithCurrentVersion(newVersion = "2.2.1", currentVersion = "2.2dev")
|
||||||
|
|
||||||
verify(bus, times(1)).post(any())
|
//verify(bus, times(1)).post(any())
|
||||||
|
|
||||||
PowerMockito.verifyStatic(SP::class.java, times(1))
|
PowerMockito.verifyStatic(SP::class.java, times(1))
|
||||||
SP.getLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
|
SP.getLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
|
||||||
|
@ -188,7 +188,7 @@ class VersionCheckerUtilsKtTest {
|
||||||
val bus = prepareBus()
|
val bus = prepareBus()
|
||||||
compareWithCurrentVersion(findVersion(buildGradle), currentVersion = "2.2.2")
|
compareWithCurrentVersion(findVersion(buildGradle), currentVersion = "2.2.2")
|
||||||
|
|
||||||
verify(bus, times(1)).post(any())
|
//verify(bus, times(1)).post(any())
|
||||||
|
|
||||||
PowerMockito.verifyStatic(SP::class.java, times(1))
|
PowerMockito.verifyStatic(SP::class.java, times(1))
|
||||||
SP.getLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
|
SP.getLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
|
||||||
|
|
|
@ -12,8 +12,8 @@ import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.RawHistoryPage;
|
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.RawHistoryPage;
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.MedtronicPumpHistoryDecoder;
|
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.MedtronicPumpHistoryDecoder;
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpHistoryEntry;
|
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpHistoryEntry;
|
||||||
import uk.org.lidalia.slf4jtest.TestLogger;
|
//import uk.org.lidalia.slf4jtest.TestLogger;
|
||||||
import uk.org.lidalia.slf4jtest.TestLoggerFactory;
|
//import uk.org.lidalia.slf4jtest.TestLoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by andy on 3/10/19.
|
* Created by andy on 3/10/19.
|
||||||
|
@ -21,7 +21,7 @@ import uk.org.lidalia.slf4jtest.TestLoggerFactory;
|
||||||
@Ignore
|
@Ignore
|
||||||
public class MedtronicHistoryDataUTest {
|
public class MedtronicHistoryDataUTest {
|
||||||
|
|
||||||
TestLogger LOGGER = TestLoggerFactory.getTestLogger(MedtronicHistoryDataUTest.class);
|
//TestLogger LOGGER = TestLoggerFactory.getTestLogger(MedtronicHistoryDataUTest.class);
|
||||||
|
|
||||||
byte[] historyPageData = ByteUtil
|
byte[] historyPageData = ByteUtil
|
||||||
.createByteArrayFromString("16 00 12 EC 14 47 13 33 00 14 F2 14 47 13 00 16 01 14 F2 14 47 13 33 00 1C C9 15 47 13 00 16 00 1C C9 15 47 13 33 4E 31 D3 15 47 13 00 16 01 31 D3 15 47 13 33 00 1A F1 15 47 13 00 16 00 1A F1 15 47 13 33 50 1D F1 15 47 13 00 16 01 1D F1 15 47 13 33 50 11 D8 16 47 13 00 16 01 11 D8 16 47 13 33 50 31 FB 16 47 13 00 16 01 31 FB 16 47 13 33 50 12 E3 17 47 13 00 16 01 12 E3 17 47 13 33 00 1E FB 17 47 13 00 16 00 1E FB 17 47 13 33 D8 21 FB 17 47 13 00 16 01 21 FB 17 47 13 07 00 00 05 CC 27 93 6D 27 93 05 0C 00 E8 00 00 00 00 05 CC 05 CC 64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0C 00 E8 00 00 00 33 00 36 C4 00 48 13 00 16 00 36 C4 00 48 13 33 D8 29 C9 00 48 13 00 16 01 29 C9 00 48 13 33 00 12 E7 00 48 13 00 16 00 12 E7 00 48 13 33 BC 19 C9 01 48 13 00 16 01 19 C9 01 48 13 33 00 26 CE 01 48 13 00 16 00 26 CE 01 48 13 33 44 29 CE 01 48 13 00 16 01 29 CE 01 48 13 33 00 13 D3 01 48 13 00 16 00 13 D3 01 48 13 33 64 31 F1 01 48 13 00 16 01 31 F1 01 48 13 33 00 0B F7 01 48 13 00 16 00 0B F7 01 48 13 33 00 12 D8 02 48 13 00 16 01 12 D8 02 48 13 33 00 10 F1 02 48 13 00 16 00 10 F1 02 48 13 33 00 30 C4 03 48 13 00 16 01 30 C4 03 48 13 33 00 04 CA 03 48 13 00 16 00 04 CA 03 48 13 33 00 2F D3 03 48 13 00 16 01 2F D3 03 48 13 33 00 30 D8 03 48 13 00 16 00 30 D8 03 48 13 33 00 13 E7 03 48 13 00 16 01 13 E7 03 48 13 33 00 2E FB 03 48 13 00 16 00 2E FB 03 48 13 19 00 00 C1 04 08 13 07 00 00 04 0C 28 93 6D 28 93 05 0C 00 E8 00 00 00 00 04 0C 04 0C 64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0C 00 E8 00 00 00 06 3E 03 7A 19 DC 48 49 13 0C 3E 0C E6 08 09 13 07 00 00 01 E4 29 93 6D 29 93 05 0C 00 E8 00 00 00 00 01 E4 01 E4 64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0C 00 E8 00 00 00 1A 00 13 D2 0D 0A 13 1A 01 28 D2 0D 0A 13 21 00 2A D8 0D 0A 13 03 00 00 00 0E 2D D9 2D 0A 13 33 98 26 DE 0D 4A 13 00 16 01 26 DE 0D 4A 13 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5D 70");
|
.createByteArrayFromString("16 00 12 EC 14 47 13 33 00 14 F2 14 47 13 00 16 01 14 F2 14 47 13 33 00 1C C9 15 47 13 00 16 00 1C C9 15 47 13 33 4E 31 D3 15 47 13 00 16 01 31 D3 15 47 13 33 00 1A F1 15 47 13 00 16 00 1A F1 15 47 13 33 50 1D F1 15 47 13 00 16 01 1D F1 15 47 13 33 50 11 D8 16 47 13 00 16 01 11 D8 16 47 13 33 50 31 FB 16 47 13 00 16 01 31 FB 16 47 13 33 50 12 E3 17 47 13 00 16 01 12 E3 17 47 13 33 00 1E FB 17 47 13 00 16 00 1E FB 17 47 13 33 D8 21 FB 17 47 13 00 16 01 21 FB 17 47 13 07 00 00 05 CC 27 93 6D 27 93 05 0C 00 E8 00 00 00 00 05 CC 05 CC 64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0C 00 E8 00 00 00 33 00 36 C4 00 48 13 00 16 00 36 C4 00 48 13 33 D8 29 C9 00 48 13 00 16 01 29 C9 00 48 13 33 00 12 E7 00 48 13 00 16 00 12 E7 00 48 13 33 BC 19 C9 01 48 13 00 16 01 19 C9 01 48 13 33 00 26 CE 01 48 13 00 16 00 26 CE 01 48 13 33 44 29 CE 01 48 13 00 16 01 29 CE 01 48 13 33 00 13 D3 01 48 13 00 16 00 13 D3 01 48 13 33 64 31 F1 01 48 13 00 16 01 31 F1 01 48 13 33 00 0B F7 01 48 13 00 16 00 0B F7 01 48 13 33 00 12 D8 02 48 13 00 16 01 12 D8 02 48 13 33 00 10 F1 02 48 13 00 16 00 10 F1 02 48 13 33 00 30 C4 03 48 13 00 16 01 30 C4 03 48 13 33 00 04 CA 03 48 13 00 16 00 04 CA 03 48 13 33 00 2F D3 03 48 13 00 16 01 2F D3 03 48 13 33 00 30 D8 03 48 13 00 16 00 30 D8 03 48 13 33 00 13 E7 03 48 13 00 16 01 13 E7 03 48 13 33 00 2E FB 03 48 13 00 16 00 2E FB 03 48 13 19 00 00 C1 04 08 13 07 00 00 04 0C 28 93 6D 28 93 05 0C 00 E8 00 00 00 00 04 0C 04 0C 64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0C 00 E8 00 00 00 06 3E 03 7A 19 DC 48 49 13 0C 3E 0C E6 08 09 13 07 00 00 01 E4 29 93 6D 29 93 05 0C 00 E8 00 00 00 00 01 E4 01 E4 64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0C 00 E8 00 00 00 1A 00 13 D2 0D 0A 13 1A 01 28 D2 0D 0A 13 21 00 2A D8 0D 0A 13 03 00 00 00 0E 2D D9 2D 0A 13 33 98 26 DE 0D 4A 13 00 16 01 26 DE 0D 4A 13 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5D 70");
|
||||||
|
@ -58,7 +58,7 @@ public class MedtronicHistoryDataUTest {
|
||||||
System.out.println("PumpHistoryEntries: " + pumpHistoryEntries.size());
|
System.out.println("PumpHistoryEntries: " + pumpHistoryEntries.size());
|
||||||
|
|
||||||
Log.d("Test", "Log.d");
|
Log.d("Test", "Log.d");
|
||||||
LOGGER.debug("Logger.debug");
|
//LOGGER.debug("Logger.debug");
|
||||||
|
|
||||||
for (PumpHistoryEntry pumpHistoryEntry : pumpHistoryEntries) {
|
for (PumpHistoryEntry pumpHistoryEntry : pumpHistoryEntries) {
|
||||||
Log.d("MedtronicHistoryDataUTest", pumpHistoryEntry.toString());
|
Log.d("MedtronicHistoryDataUTest", pumpHistoryEntry.toString());
|
||||||
|
@ -79,7 +79,7 @@ public class MedtronicHistoryDataUTest {
|
||||||
System.out.println("PumpHistoryEntries: " + pumpHistoryEntries.size());
|
System.out.println("PumpHistoryEntries: " + pumpHistoryEntries.size());
|
||||||
|
|
||||||
Log.d("Test", "Log.d");
|
Log.d("Test", "Log.d");
|
||||||
LOGGER.debug("Logger.debug");
|
//LOGGER.debug("Logger.debug");
|
||||||
|
|
||||||
for (PumpHistoryEntry pumpHistoryEntry : pumpHistoryEntries) {
|
for (PumpHistoryEntry pumpHistoryEntry : pumpHistoryEntries) {
|
||||||
Log.d("MedtronicHistoryDataUTest", pumpHistoryEntry.toString());
|
Log.d("MedtronicHistoryDataUTest", pumpHistoryEntry.toString());
|
||||||
|
|
Loading…
Reference in a new issue