Localalerts settings by adrian

This commit is contained in:
Milos Kozak 2017-11-28 21:48:46 +01:00
parent 7d5d327c5d
commit d1aec1ff18
43 changed files with 475 additions and 264 deletions

View file

@ -42,7 +42,7 @@
<activity <activity
android:name=".plugins.Overview.Dialogs.BolusProgressHelperActivity" android:name=".plugins.Overview.Dialogs.BolusProgressHelperActivity"
android:theme="@style/Theme.AppCompat.Translucent" /> android:theme="@style/Theme.AppCompat.Translucent" />
<activity <activity
android:name=".plugins.Overview.Dialogs.ErrorHelperActivity" android:name=".plugins.Overview.Dialogs.ErrorHelperActivity"
android:theme="@style/Theme.AppCompat.Translucent" /> android:theme="@style/Theme.AppCompat.Translucent" />
<activity android:name=".AgreementActivity" /> <activity android:name=".AgreementActivity" />
@ -143,6 +143,9 @@
android:name=".Services.AlarmSoundService" android:name=".Services.AlarmSoundService"
android:enabled="true" android:enabled="true"
android:exported="true" /> android:exported="true" />
<service
android:name=".plugins.Overview.notifications.DismissNotificationService"
android:exported="false"></service>
<meta-data <meta-data
android:name="io.fabric.ApiKey" android:name="io.fabric.ApiKey"

View file

@ -24,7 +24,7 @@ import info.nightscout.androidaps.plugins.NSClientInternal.data.NSMbg;
import info.nightscout.androidaps.plugins.NSClientInternal.data.NSSgv; import info.nightscout.androidaps.plugins.NSClientInternal.data.NSSgv;
import info.nightscout.androidaps.data.ProfileStore; import info.nightscout.androidaps.data.ProfileStore;
import info.nightscout.androidaps.plugins.NSClientInternal.data.NSSettingsStatus; import info.nightscout.androidaps.plugins.NSClientInternal.data.NSSettingsStatus;
import info.nightscout.androidaps.plugins.Overview.Notification; import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.androidaps.plugins.Overview.OverviewPlugin; import info.nightscout.androidaps.plugins.Overview.OverviewPlugin;
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification; import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;

View file

@ -12,17 +12,15 @@ import org.slf4j.LoggerFactory;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone; import java.util.TimeZone;
import info.nightscout.androidaps.Constants; import info.nightscout.androidaps.Constants;
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.Overview.Notification; import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification; import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.utils.DecimalFormatter; import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.SafeParse;
import info.nightscout.utils.ToastUtils; import info.nightscout.utils.ToastUtils;
public class Profile { public class Profile {

View file

@ -1,12 +1,8 @@
package info.nightscout.androidaps.plugins.ConfigBuilder; package info.nightscout.androidaps.plugins.ConfigBuilder;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.PowerManager;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
@ -14,7 +10,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import info.nightscout.androidaps.Config; import info.nightscout.androidaps.Config;
@ -32,24 +27,18 @@ import info.nightscout.androidaps.db.ProfileSwitch;
import info.nightscout.androidaps.db.TempTarget; import info.nightscout.androidaps.db.TempTarget;
import info.nightscout.androidaps.db.TemporaryBasal; import info.nightscout.androidaps.db.TemporaryBasal;
import info.nightscout.androidaps.db.Treatment; import info.nightscout.androidaps.db.Treatment;
import info.nightscout.androidaps.events.EventBolusRequested;
import info.nightscout.androidaps.interfaces.APSInterface; import info.nightscout.androidaps.interfaces.APSInterface;
import info.nightscout.androidaps.interfaces.BgSourceInterface; import info.nightscout.androidaps.interfaces.BgSourceInterface;
import info.nightscout.androidaps.interfaces.ConstraintsInterface; import info.nightscout.androidaps.interfaces.ConstraintsInterface;
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.ProfileInterface; import info.nightscout.androidaps.interfaces.ProfileInterface;
import info.nightscout.androidaps.interfaces.PumpDescription;
import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.interfaces.SensitivityInterface; import info.nightscout.androidaps.interfaces.SensitivityInterface;
import info.nightscout.androidaps.interfaces.TreatmentsInterface; import info.nightscout.androidaps.interfaces.TreatmentsInterface;
import info.nightscout.androidaps.plugins.Loop.APSResult; import info.nightscout.androidaps.plugins.Loop.APSResult;
import info.nightscout.androidaps.plugins.Loop.LoopPlugin; import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
import info.nightscout.androidaps.plugins.Overview.Dialogs.BolusProgressDialog; import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.androidaps.plugins.Overview.Dialogs.BolusProgressHelperActivity;
import info.nightscout.androidaps.plugins.Overview.Notification;
import info.nightscout.androidaps.plugins.Overview.events.EventDismissBolusprogressIfRunning;
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.PumpVirtual.VirtualPumpPlugin; import info.nightscout.androidaps.plugins.PumpVirtual.VirtualPumpPlugin;
import info.nightscout.androidaps.queue.Callback; import info.nightscout.androidaps.queue.Callback;

View file

@ -1,13 +1,12 @@
package info.nightscout.androidaps.plugins.Insulin; package info.nightscout.androidaps.plugins.Insulin;
import info.nightscout.androidaps.Constants;
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.db.Treatment; import info.nightscout.androidaps.db.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.plugins.Overview.Notification; import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
/** /**

View file

@ -57,6 +57,7 @@ public class LoopPlugin implements PluginBase {
private long loopSuspendedTill = 0L; // end of manual loop suspend private long loopSuspendedTill = 0L; // end of manual loop suspend
private boolean isSuperBolus = false; private boolean isSuperBolus = false;
private boolean isDisconnected = false;
public class LastRun { public class LastRun {
public APSResult request = null; public APSResult request = null;
@ -74,6 +75,7 @@ public class LoopPlugin implements PluginBase {
MainApp.bus().register(this); MainApp.bus().register(this);
loopSuspendedTill = SP.getLong("loopSuspendedTill", 0L); loopSuspendedTill = SP.getLong("loopSuspendedTill", 0L);
isSuperBolus = SP.getBoolean("isSuperBolus", false); isSuperBolus = SP.getBoolean("isSuperBolus", false);
isDisconnected = SP.getBoolean("isDisconnected", false);
} }
@Override @Override
@ -161,13 +163,28 @@ public class LoopPlugin implements PluginBase {
public void suspendTo(long endTime) { public void suspendTo(long endTime) {
loopSuspendedTill = endTime; loopSuspendedTill = endTime;
isSuperBolus = false; isSuperBolus = false;
isDisconnected = false;
SP.putLong("loopSuspendedTill", loopSuspendedTill); SP.putLong("loopSuspendedTill", loopSuspendedTill);
SP.putBoolean("isSuperBolus", isSuperBolus);
SP.putBoolean("isDisconnected", isDisconnected);
} }
public void superBolusTo(long endTime) { public void superBolusTo(long endTime) {
loopSuspendedTill = endTime; loopSuspendedTill = endTime;
isSuperBolus = true; isSuperBolus = true;
isDisconnected = false;
SP.putLong("loopSuspendedTill", loopSuspendedTill); SP.putLong("loopSuspendedTill", loopSuspendedTill);
SP.putBoolean("isSuperBolus", isSuperBolus);
SP.putBoolean("isDisconnected", isDisconnected);
}
public void disconnectTo(long endTime) {
loopSuspendedTill = endTime;
isSuperBolus = false;
isDisconnected = true;
SP.putLong("loopSuspendedTill", loopSuspendedTill);
SP.putBoolean("isSuperBolus", isSuperBolus);
SP.putBoolean("isDisconnected", isDisconnected);
} }
public int minutesToEndOfSuspend() { public int minutesToEndOfSuspend() {
@ -213,6 +230,19 @@ public class LoopPlugin implements PluginBase {
return isSuperBolus; return isSuperBolus;
} }
public boolean isDisconnected() {
if (loopSuspendedTill == 0)
return false;
long now = System.currentTimeMillis();
if (loopSuspendedTill <= now) { // time exceeded
suspendTo(0L);
return false;
}
return isDisconnected;
}
public void invoke(String initiator, boolean allowNotification) { public void invoke(String initiator, boolean allowNotification) {
try { try {
if (Config.logFunctionCalls) if (Config.logFunctionCalls)

View file

@ -58,7 +58,7 @@ import info.nightscout.androidaps.plugins.NSClientInternal.data.NSTreatment;
import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientNewLog; import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientNewLog;
import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientRestart; import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientRestart;
import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientStatus; import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientStatus;
import info.nightscout.androidaps.plugins.Overview.Notification; import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification; import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.utils.DateUtil; import info.nightscout.utils.DateUtil;

View file

@ -47,6 +47,10 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
private Integer maxCarbs; private Integer maxCarbs;
private Double maxInsulin; private Double maxInsulin;
//one shot guards
private boolean accepted;
private boolean okClicked;
public NewTreatmentDialog() { public NewTreatmentDialog() {
} }
@ -96,15 +100,21 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
editInsulin = (NumberPicker) view.findViewById(R.id.treatments_newtreatment_insulinamount); editInsulin = (NumberPicker) view.findViewById(R.id.treatments_newtreatment_insulinamount);
editCarbs.setParams(0d, 0d, (double) maxCarbs, 1d, new DecimalFormat("0"), false, textWatcher); editCarbs.setParams(0d, 0d, (double) maxCarbs, 1d, new DecimalFormat("0"), false, textWatcher);
editInsulin.setParams(0d, 0d, maxInsulin,ConfigBuilderPlugin.getActivePump().getPumpDescription().bolusStep, new DecimalFormat("0.00"), false, textWatcher); editInsulin.setParams(0d, 0d, maxInsulin, ConfigBuilderPlugin.getActivePump().getPumpDescription().bolusStep, new DecimalFormat("0.00"), false, textWatcher);
return view; return view;
} }
@Override @Override
public void onClick(View view) { public synchronized void onClick(View view) {
switch (view.getId()) { switch (view.getId()) {
case R.id.ok: case R.id.ok:
if (okClicked) {
log.debug("guarding: ok already clicked");
dismiss();
return;
}
okClicked = true;
try { try {
Double insulin = SafeParse.stringToDouble(editInsulin.getText()); Double insulin = SafeParse.stringToDouble(editInsulin.getText());
@ -125,41 +135,51 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
final int finalCarbsAfterConstraints = carbsAfterConstraints; final int finalCarbsAfterConstraints = carbsAfterConstraints;
final Context context = getContext(); final Context context = getContext();
AlertDialog.Builder builder = new AlertDialog.Builder(context); final AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(this.getContext().getString(R.string.confirmation)); builder.setTitle(this.getContext().getString(R.string.confirmation));
builder.setMessage(Html.fromHtml(confirmMessage)); builder.setMessage(Html.fromHtml(confirmMessage));
builder.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() { builder.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) { public void onClick(DialogInterface dialog, int id) {
if (finalInsulinAfterConstraints > 0 || finalCarbsAfterConstraints > 0) { synchronized (builder) {
DetailedBolusInfo detailedBolusInfo = new DetailedBolusInfo(); if (accepted) {
if (finalInsulinAfterConstraints == 0) log.debug("guarding: already accepted");
detailedBolusInfo.eventType = CareportalEvent.CARBCORRECTION; return;
if (finalCarbsAfterConstraints == 0) }
detailedBolusInfo.eventType = CareportalEvent.CORRECTIONBOLUS; accepted = true;
detailedBolusInfo.insulin = finalInsulinAfterConstraints; if (finalInsulinAfterConstraints > 0 || finalCarbsAfterConstraints > 0) {
detailedBolusInfo.carbs = finalCarbsAfterConstraints; DetailedBolusInfo detailedBolusInfo = new DetailedBolusInfo();
detailedBolusInfo.context = context; if (finalInsulinAfterConstraints == 0)
detailedBolusInfo.source = Source.USER; detailedBolusInfo.eventType = CareportalEvent.CARBCORRECTION;
ConfigBuilderPlugin.getCommandQueue().bolus(detailedBolusInfo, new Callback() { if (finalCarbsAfterConstraints == 0)
@Override detailedBolusInfo.eventType = CareportalEvent.CORRECTIONBOLUS;
public void run() { detailedBolusInfo.insulin = finalInsulinAfterConstraints;
if (!result.success) { detailedBolusInfo.carbs = finalCarbsAfterConstraints;
Intent i = new Intent(MainApp.instance(), ErrorHelperActivity.class); detailedBolusInfo.context = context;
i.putExtra("soundid", R.raw.boluserror); detailedBolusInfo.source = Source.USER;
i.putExtra("status", result.comment); ConfigBuilderPlugin.getCommandQueue().bolus(detailedBolusInfo, new Callback() {
i.putExtra("title", MainApp.sResources.getString(R.string.treatmentdeliveryerror)); @Override
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); public void run() {
MainApp.instance().startActivity(i); if (!result.success) {
Intent i = new Intent(MainApp.instance(), ErrorHelperActivity.class);
i.putExtra("soundid", R.raw.boluserror);
i.putExtra("status", result.comment);
i.putExtra("title", MainApp.sResources.getString(R.string.treatmentdeliveryerror));
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
MainApp.instance().startActivity(i);
}
} }
} });
}); Answers.getInstance().logCustom(new CustomEvent("Bolus"));
Answers.getInstance().logCustom(new CustomEvent("Bolus")); }
} }
} }
}); });
builder.setNegativeButton(getString(R.string.cancel), null); builder.setNegativeButton(
getString(R.string.cancel), null);
builder.show(); builder.show();
dismiss(); dismiss();
} catch (Exception e) { } catch (Exception e) {
log.error("Unhandled exception", e); log.error("Unhandled exception", e);

View file

@ -106,6 +106,10 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
Context context; Context context;
//one shot guards
private boolean accepted;
private boolean okClicked;
public WizardDialog() { public WizardDialog() {
super(); super();
} }
@ -289,6 +293,12 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
public void onClick(View view) { public void onClick(View view) {
switch (view.getId()) { switch (view.getId()) {
case R.id.ok: case R.id.ok:
if (okClicked) {
log.debug("guarding: ok already clicked");
dismiss();
return;
}
okClicked = true;
if (calculatedTotalInsulin > 0d || calculatedCarbs > 0d) { if (calculatedTotalInsulin > 0d || calculatedCarbs > 0d) {
DecimalFormat formatNumber2decimalplaces = new DecimalFormat("0.00"); DecimalFormat formatNumber2decimalplaces = new DecimalFormat("0.00");
@ -316,56 +326,63 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
final int carbTime = SafeParse.stringToInt(editCarbTime.getText()); final int carbTime = SafeParse.stringToInt(editCarbTime.getText());
final boolean useSuperBolus = superbolusCheckbox.isChecked(); final boolean useSuperBolus = superbolusCheckbox.isChecked();
AlertDialog.Builder builder = new AlertDialog.Builder(context); final AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(MainApp.sResources.getString(R.string.confirmation)); builder.setTitle(MainApp.sResources.getString(R.string.confirmation));
builder.setMessage(Html.fromHtml(confirmMessage)); builder.setMessage(Html.fromHtml(confirmMessage));
builder.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() { builder.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) { public void onClick(DialogInterface dialog, int id) {
if (finalInsulinAfterConstraints > 0 || finalCarbsAfterConstraints > 0) { synchronized (builder) {
if (useSuperBolus) { if (accepted) {
final LoopPlugin activeloop = ConfigBuilderPlugin.getActiveLoop(); log.debug("guarding: already accepted");
if (activeloop != null) { return;
activeloop.superBolusTo(System.currentTimeMillis() + 2 * 60L * 60 * 1000); }
MainApp.bus().post(new EventRefreshOverview("WizardDialog")); accepted = true;
if (finalInsulinAfterConstraints > 0 || finalCarbsAfterConstraints > 0) {
if (useSuperBolus) {
final LoopPlugin activeloop = ConfigBuilderPlugin.getActiveLoop();
if (activeloop != null) {
activeloop.superBolusTo(System.currentTimeMillis() + 2 * 60L * 60 * 1000);
MainApp.bus().post(new EventRefreshOverview("WizardDialog"));
}
ConfigBuilderPlugin.getCommandQueue().tempBasalAbsolute(0d, 120, true, new Callback() {
@Override
public void run() {
if (!result.success) {
Intent i = new Intent(MainApp.instance(), ErrorHelperActivity.class);
i.putExtra("soundid", R.raw.boluserror);
i.putExtra("status", result.comment);
i.putExtra("title", MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
MainApp.instance().startActivity(i);
}
}
});
} }
ConfigBuilderPlugin.getCommandQueue().tempBasalAbsolute(0d, 120, true, new Callback() { DetailedBolusInfo detailedBolusInfo = new DetailedBolusInfo();
detailedBolusInfo.eventType = CareportalEvent.BOLUSWIZARD;
detailedBolusInfo.insulin = finalInsulinAfterConstraints;
detailedBolusInfo.carbs = finalCarbsAfterConstraints;
detailedBolusInfo.context = context;
detailedBolusInfo.glucose = bg;
detailedBolusInfo.glucoseType = "Manual";
detailedBolusInfo.carbTime = carbTime;
detailedBolusInfo.boluscalc = boluscalcJSON;
detailedBolusInfo.source = Source.USER;
ConfigBuilderPlugin.getCommandQueue().bolus(detailedBolusInfo, new Callback() {
@Override @Override
public void run() { public void run() {
if (!result.success) { if (!result.success) {
Intent i = new Intent(MainApp.instance(), ErrorHelperActivity.class); Intent i = new Intent(MainApp.instance(), ErrorHelperActivity.class);
i.putExtra("soundid", R.raw.boluserror); i.putExtra("soundid", R.raw.boluserror);
i.putExtra("status", result.comment); i.putExtra("status", result.comment);
i.putExtra("title", MainApp.sResources.getString(R.string.tempbasaldeliveryerror)); i.putExtra("title", MainApp.sResources.getString(R.string.treatmentdeliveryerror));
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
MainApp.instance().startActivity(i); MainApp.instance().startActivity(i);
} }
} }
}); });
Answers.getInstance().logCustom(new CustomEvent("Wizard"));
} }
DetailedBolusInfo detailedBolusInfo = new DetailedBolusInfo();
detailedBolusInfo.eventType = CareportalEvent.BOLUSWIZARD;
detailedBolusInfo.insulin = finalInsulinAfterConstraints;
detailedBolusInfo.carbs = finalCarbsAfterConstraints;
detailedBolusInfo.context = context;
detailedBolusInfo.glucose = bg;
detailedBolusInfo.glucoseType = "Manual";
detailedBolusInfo.carbTime = carbTime;
detailedBolusInfo.boluscalc = boluscalcJSON;
detailedBolusInfo.source = Source.USER;
ConfigBuilderPlugin.getCommandQueue().bolus(detailedBolusInfo, new Callback() {
@Override
public void run() {
if (!result.success) {
Intent i = new Intent(MainApp.instance(), ErrorHelperActivity.class);
i.putExtra("soundid", R.raw.boluserror);
i.putExtra("status", result.comment);
i.putExtra("title", MainApp.sResources.getString(R.string.treatmentdeliveryerror));
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
MainApp.instance().startActivity(i);
}
}
});
Answers.getInstance().logCustom(new CustomEvent("Wizard"));
} }
} }
}); });

View file

@ -100,6 +100,8 @@ import info.nightscout.androidaps.plugins.Overview.Dialogs.WizardDialog;
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification; import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
import info.nightscout.androidaps.plugins.Overview.events.EventSetWakeLock; import info.nightscout.androidaps.plugins.Overview.events.EventSetWakeLock;
import info.nightscout.androidaps.plugins.Overview.graphData.GraphData; import info.nightscout.androidaps.plugins.Overview.graphData.GraphData;
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.androidaps.plugins.Overview.notifications.NotificationStore;
import info.nightscout.androidaps.plugins.SourceXdrip.SourceXdripPlugin; import info.nightscout.androidaps.plugins.SourceXdrip.SourceXdripPlugin;
import info.nightscout.androidaps.plugins.Treatments.fragments.ProfileViewerDialog; import info.nightscout.androidaps.plugins.Treatments.fragments.ProfileViewerDialog;
import info.nightscout.androidaps.queue.Callback; import info.nightscout.androidaps.queue.Callback;
@ -166,6 +168,8 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
public static boolean shorttextmode = false; public static boolean shorttextmode = false;
private boolean accepted;
private int rangeToDisplay = 6; // for graph private int rangeToDisplay = 6; // for graph
Handler sLoopHandler = new Handler(); Handler sLoopHandler = new Handler();
@ -473,7 +477,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
NSUpload.uploadOpenAPSOffline(600); NSUpload.uploadOpenAPSOffline(600);
return true; return true;
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.disconnectpumpfor30m))) { } else if (item.getTitle().equals(MainApp.sResources.getString(R.string.disconnectpumpfor30m))) {
activeloop.suspendTo(System.currentTimeMillis() + 30L * 60 * 1000); activeloop.disconnectTo(System.currentTimeMillis() + 30L * 60 * 1000);
updateGUI("suspendmenu"); updateGUI("suspendmenu");
ConfigBuilderPlugin.getCommandQueue().tempBasalAbsolute(0d, 30, true, new Callback() { ConfigBuilderPlugin.getCommandQueue().tempBasalAbsolute(0d, 30, true, new Callback() {
@Override @Override
@ -486,7 +490,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
NSUpload.uploadOpenAPSOffline(30); NSUpload.uploadOpenAPSOffline(30);
return true; return true;
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.disconnectpumpfor1h))) { } else if (item.getTitle().equals(MainApp.sResources.getString(R.string.disconnectpumpfor1h))) {
activeloop.suspendTo(System.currentTimeMillis() + 1 * 60L * 60 * 1000); activeloop.disconnectTo(System.currentTimeMillis() + 1 * 60L * 60 * 1000);
updateGUI("suspendmenu"); updateGUI("suspendmenu");
ConfigBuilderPlugin.getCommandQueue().tempBasalAbsolute(0d, 60, true, new Callback() { ConfigBuilderPlugin.getCommandQueue().tempBasalAbsolute(0d, 60, true, new Callback() {
@Override @Override
@ -499,7 +503,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
NSUpload.uploadOpenAPSOffline(60); NSUpload.uploadOpenAPSOffline(60);
return true; return true;
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.disconnectpumpfor2h))) { } else if (item.getTitle().equals(MainApp.sResources.getString(R.string.disconnectpumpfor2h))) {
activeloop.suspendTo(System.currentTimeMillis() + 2 * 60L * 60 * 1000); activeloop.disconnectTo(System.currentTimeMillis() + 2 * 60L * 60 * 1000);
updateGUI("suspendmenu"); updateGUI("suspendmenu");
ConfigBuilderPlugin.getCommandQueue().tempBasalAbsolute(0d, 2 * 60, true, new Callback() { ConfigBuilderPlugin.getCommandQueue().tempBasalAbsolute(0d, 2 * 60, true, new Callback() {
@Override @Override
@ -512,7 +516,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
NSUpload.uploadOpenAPSOffline(120); NSUpload.uploadOpenAPSOffline(120);
return true; return true;
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.disconnectpumpfor3h))) { } else if (item.getTitle().equals(MainApp.sResources.getString(R.string.disconnectpumpfor3h))) {
activeloop.suspendTo(System.currentTimeMillis() + 3 * 60L * 60 * 1000); activeloop.disconnectTo(System.currentTimeMillis() + 3 * 60L * 60 * 1000);
updateGUI("suspendmenu"); updateGUI("suspendmenu");
ConfigBuilderPlugin.getCommandQueue().tempBasalAbsolute(0d, 3 * 60, true, new Callback() { ConfigBuilderPlugin.getCommandQueue().tempBasalAbsolute(0d, 3 * 60, true, new Callback() {
@Override @Override
@ -662,33 +666,41 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
final Double finalInsulinAfterConstraints = insulinAfterConstraints; final Double finalInsulinAfterConstraints = insulinAfterConstraints;
final Integer finalCarbsAfterConstraints = carbsAfterConstraints; final Integer finalCarbsAfterConstraints = carbsAfterConstraints;
final Context context = getContext(); final Context context = getContext();
AlertDialog.Builder builder = new AlertDialog.Builder(context); final AlertDialog.Builder builder = new AlertDialog.Builder(context);
accepted = false;
builder.setTitle(MainApp.sResources.getString(R.string.confirmation)); builder.setTitle(MainApp.sResources.getString(R.string.confirmation));
builder.setMessage(confirmMessage); builder.setMessage(confirmMessage);
builder.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() { builder.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) { public void onClick(DialogInterface dialog, int id) {
if (finalInsulinAfterConstraints > 0 || finalCarbsAfterConstraints > 0) { synchronized (builder) {
DetailedBolusInfo detailedBolusInfo = new DetailedBolusInfo(); if (accepted) {
detailedBolusInfo.eventType = CareportalEvent.BOLUSWIZARD; log.debug("guarding: already accepted");
detailedBolusInfo.insulin = finalInsulinAfterConstraints; return;
detailedBolusInfo.carbs = finalCarbsAfterConstraints; }
detailedBolusInfo.context = context; accepted = true;
detailedBolusInfo.boluscalc = boluscalcJSON; if (finalInsulinAfterConstraints > 0 || finalCarbsAfterConstraints > 0) {
detailedBolusInfo.source = Source.USER; DetailedBolusInfo detailedBolusInfo = new DetailedBolusInfo();
ConfigBuilderPlugin.getCommandQueue().bolus(detailedBolusInfo, new Callback() { detailedBolusInfo.eventType = CareportalEvent.BOLUSWIZARD;
@Override detailedBolusInfo.insulin = finalInsulinAfterConstraints;
public void run() { detailedBolusInfo.carbs = finalCarbsAfterConstraints;
if (!result.success) { detailedBolusInfo.context = context;
Intent i = new Intent(MainApp.instance(), ErrorHelperActivity.class); detailedBolusInfo.boluscalc = boluscalcJSON;
i.putExtra("soundid", R.raw.boluserror); detailedBolusInfo.source = Source.USER;
i.putExtra("status", result.comment); ConfigBuilderPlugin.getCommandQueue().bolus(detailedBolusInfo, new Callback() {
i.putExtra("title", MainApp.sResources.getString(R.string.treatmentdeliveryerror)); @Override
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); public void run() {
MainApp.instance().startActivity(i); if (!result.success) {
Intent i = new Intent(MainApp.instance(), ErrorHelperActivity.class);
i.putExtra("soundid", R.raw.boluserror);
i.putExtra("status", result.comment);
i.putExtra("title", MainApp.sResources.getString(R.string.treatmentdeliveryerror));
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
MainApp.instance().startActivity(i);
}
} }
} });
}); Answers.getInstance().logCustom(new CustomEvent("QuickWizard"));
Answers.getInstance().logCustom(new CustomEvent("QuickWizard")); }
} }
} }
}); });

View file

@ -13,6 +13,7 @@ import info.nightscout.androidaps.events.EventRefreshOverview;
import info.nightscout.androidaps.interfaces.PluginBase; import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification; import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.Overview.notifications.NotificationStore;
import info.nightscout.utils.SP; import info.nightscout.utils.SP;
/** /**

View file

@ -1,7 +1,7 @@
package info.nightscout.androidaps.plugins.Overview.events; package info.nightscout.androidaps.plugins.Overview.events;
import info.nightscout.androidaps.events.Event; import info.nightscout.androidaps.events.Event;
import info.nightscout.androidaps.plugins.Overview.Notification; import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
/** /**
* Created by mike on 03.12.2016. * Created by mike on 03.12.2016.

View file

@ -0,0 +1,36 @@
package info.nightscout.androidaps.plugins.Overview.notifications;
import android.app.IntentService;
import android.app.PendingIntent;
import android.content.Intent;
import android.support.annotation.Nullable;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
public class DismissNotificationService extends IntentService {
/**
* Creates an IntentService. Invoked by your subclass's constructor.
*
* @param name Used to name the worker thread, important only for debugging.
*/
public DismissNotificationService(String name) {
super(name);
}
public DismissNotificationService(){
super("DismissNotificationService");
};
@Override
protected void onHandleIntent(@Nullable Intent intent) {
MainApp.bus().post(new EventDismissNotification(intent.getIntExtra("alertID", -1)));
}
public static PendingIntent deleteIntent(int id){
Intent intent = new Intent(MainApp.instance(), DismissNotificationService.class);
intent.putExtra("alertID", id);
return PendingIntent.getService(MainApp.instance(), id, intent, PendingIntent.FLAG_UPDATE_CURRENT);
}
}

View file

@ -1,5 +1,8 @@
package info.nightscout.androidaps.plugins.Overview; package info.nightscout.androidaps.plugins.Overview.notifications;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Date; import java.util.Date;
@ -11,15 +14,14 @@ import info.nightscout.androidaps.plugins.NSClientInternal.data.NSSettingsStatus
import info.nightscout.utils.SP; import info.nightscout.utils.SP;
// Added by Rumen for debugging // Added by Rumen for debugging
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Created by mike on 03.12.2016. * Created by mike on 03.12.2016.
*/ */
public class Notification { public class Notification {
private static Logger log = LoggerFactory.getLogger(Notification.class); private static Logger log = LoggerFactory.getLogger(Notification.class);
public static final int URGENT = 0; public static final int URGENT = 0;
public static final int NORMAL = 1; public static final int NORMAL = 1;
public static final int LOW = 2; public static final int LOW = 2;
@ -50,8 +52,9 @@ public class Notification {
public static final int SHORT_DIA = 21; public static final int SHORT_DIA = 21;
public static final int TOAST_ALARM = 22; public static final int TOAST_ALARM = 22;
public static final int WRONGBASALSTEP = 23; public static final int WRONGBASALSTEP = 23;
public static final int BOLUS_DELIVERY_ERROR = 24;
public static final int WRONG_DRIVER = 24; public static final int WRONG_DRIVER = 24;
public static final int PUMP_UNREACHABLE = 26;
public static final int BG_READINGS_MISSED = 27;
public int id; public int id;
public Date date; public Date date;
@ -122,7 +125,7 @@ public class Notification {
this.id = NSALARM; this.id = NSALARM;
this.level = NORMAL; this.level = NORMAL;
this.text = nsAlarm.getTile(); this.text = nsAlarm.getTile();
if (isAlarmForLow() && SP.getBoolean(R.string.key_nsalarm_low, false) || isAlarmForHigh() && SP.getBoolean(R.string.key_nsalarm_high, false) || isAlarmForStaleData() && SP.getBoolean(R.string.key_nsalarm_staledata,false)) if (isAlarmForLow() && SP.getBoolean(R.string.key_nsalarm_low, false) || isAlarmForHigh() && SP.getBoolean(R.string.key_nsalarm_high, false) || isAlarmForStaleData() && SP.getBoolean(R.string.key_nsalarm_staledata, false))
this.soundId = R.raw.alarm; this.soundId = R.raw.alarm;
break; break;
case 2: case 2:
@ -140,8 +143,7 @@ public class Notification {
return true; return true;
if (level == ANNOUNCEMENT) if (level == ANNOUNCEMENT)
return true; return true;
if (level == NORMAL && isAlarmForLow() && SP.getBoolean(R.string.key_nsalarm_low, false) || isAlarmForHigh() && SP.getBoolean(R.string.key_nsalarm_high, false) || isAlarmForStaleData() && SP.getBoolean(R.string.key_nsalarm_staledata, false)) if (level == NORMAL && isAlarmForLow() && SP.getBoolean(R.string.key_nsalarm_low, false) || isAlarmForHigh() && SP.getBoolean(R.string.key_nsalarm_high, false) || isAlarmForStaleData() && SP.getBoolean(R.string.key_nsalarm_staledata, false)) {
{
return true; return true;
} }
if (level == URGENT && isAlarmForLow() && SP.getBoolean(R.string.key_nsalarm_urgent_low, false) || isAlarmForHigh() && SP.getBoolean(R.string.key_nsalarm_urgent_high, false) || isAlarmForStaleData() && SP.getBoolean(R.string.key_nsalarm_urgent_staledata, false)) if (level == URGENT && isAlarmForLow() && SP.getBoolean(R.string.key_nsalarm_urgent_low, false) || isAlarmForHigh() && SP.getBoolean(R.string.key_nsalarm_urgent_high, false) || isAlarmForStaleData() && SP.getBoolean(R.string.key_nsalarm_urgent_staledata, false))
@ -172,14 +174,14 @@ public class Notification {
return true; return true;
return false; return false;
} }
static boolean isAlarmForStaleData(){ static boolean isAlarmForStaleData() {
if(SP.getLong("snoozedTo", 0L) != 0L){ if (SP.getLong("snoozedTo", 0L) != 0L) {
if(System.currentTimeMillis() < SP.getLong("snoozedTo", 0L)) { if (System.currentTimeMillis() < SP.getLong("snoozedTo", 0L)) {
//log.debug("Alarm is snoozed for next "+(SP.getLong("snoozedTo", 0L)-System.currentTimeMillis())/1000+" seconds"); //log.debug("Alarm is snoozed for next "+(SP.getLong("snoozedTo", 0L)-System.currentTimeMillis())/1000+" seconds");
return false; return false;
} }
} }
BgReading bgReading = MainApp.getDbHelper().lastBg(); BgReading bgReading = MainApp.getDbHelper().lastBg();
if (bgReading == null) if (bgReading == null)
return false; return false;
@ -187,20 +189,20 @@ public class Notification {
int bgReadingAgoMin = (int) (bgReadingAgo / (1000 * 60)); int bgReadingAgoMin = (int) (bgReadingAgo / (1000 * 60));
// Added for testing // Added for testing
//bgReadingAgoMin = 20; //bgReadingAgoMin = 20;
log.debug("bgReadingAgoMin value is:"+bgReadingAgoMin); log.debug("bgReadingAgoMin value is:" + bgReadingAgoMin);
Double threshold = NSSettingsStatus.getInstance().getThreshold("alarmTimeagoWarnMins"); Double threshold = NSSettingsStatus.getInstance().getThreshold("alarmTimeagoWarnMins");
boolean openAPSEnabledAlerts = NSSettingsStatus.getInstance().openAPSEnabledAlerts(); boolean openAPSEnabledAlerts = NSSettingsStatus.getInstance().openAPSEnabledAlerts();
log.debug("OpenAPS Alerts enabled: "+openAPSEnabledAlerts); log.debug("OpenAPS Alerts enabled: " + openAPSEnabledAlerts);
// if no thresshold from Ns get it loccally // if no thresshold from Ns get it loccally
if(threshold == null) threshold = SP.getDouble(R.string.key_nsalarm_staledatavalue,15D); if (threshold == null) threshold = SP.getDouble(R.string.key_nsalarm_staledatavalue, 15D);
// No threshold of OpenAPS Alarm so using the one for BG // No threshold of OpenAPS Alarm so using the one for BG
// Added OpenAPSEnabledAlerts to alarm check // Added OpenAPSEnabledAlerts to alarm check
if((bgReadingAgoMin > threshold && SP.getBoolean(R.string.key_nsalarm_staledata, false))||(bgReadingAgoMin > threshold && openAPSEnabledAlerts)){ if ((bgReadingAgoMin > threshold && SP.getBoolean(R.string.key_nsalarm_staledata, false)) || (bgReadingAgoMin > threshold && openAPSEnabledAlerts)) {
return true; return true;
} }
//snoozing for threshold //snoozing for threshold
SP.putLong("snoozedTo", (long) (bgReading.date+(threshold*1000*60L))); SP.putLong("snoozedTo", (long) (bgReading.date + (threshold * 1000 * 60L)));
//log.debug("New bg data is available Alarm is snoozed for next "+threshold*1000*60+" seconds"); //log.debug("New bg data is available Alarm is snoozed for next "+threshold*1000*60+" seconds");
return false; return false;
} }
} }

View file

@ -1,6 +1,14 @@
package info.nightscout.androidaps.plugins.Overview; package info.nightscout.androidaps.plugins.Overview.notifications;
import android.app.NotificationManager;
import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.media.AudioAttributes;
import android.media.RingtoneManager;
import android.net.Uri;
import android.support.v4.app.NotificationCompat;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -8,7 +16,6 @@ import org.slf4j.LoggerFactory;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.Date;
import java.util.List; import java.util.List;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
@ -26,6 +33,7 @@ public class NotificationStore {
private static Logger log = LoggerFactory.getLogger(NotificationStore.class); private static Logger log = LoggerFactory.getLogger(NotificationStore.class);
public List<Notification> store = new ArrayList<Notification>(); public List<Notification> store = new ArrayList<Notification>();
public long snoozedUntil = 0L; public long snoozedUntil = 0L;
public NotificationStore() { public NotificationStore() {
} }
@ -49,21 +57,50 @@ public class NotificationStore {
return; return;
} }
} }
if (n.soundId != null) {
Intent alarm = new Intent(MainApp.instance().getApplicationContext(), AlarmSoundService.class);
alarm.putExtra("soundid", n.soundId);
MainApp.instance().startService(alarm);
}
store.add(n); store.add(n);
if (SP.getBoolean(MainApp.sResources.getString(R.string.key_raise_notifications_as_android_notifications), false)) {
raiseSystemNotification(n);
} else {
if (n.soundId != null) {
Intent alarm = new Intent(MainApp.instance().getApplicationContext(), AlarmSoundService.class);
alarm.putExtra("soundid", n.soundId);
MainApp.instance().startService(alarm);
}
}
WearPlugin wearPlugin = MainApp.getSpecificPlugin(WearPlugin.class); WearPlugin wearPlugin = MainApp.getSpecificPlugin(WearPlugin.class);
if(wearPlugin!= null && wearPlugin.isEnabled()) { if (wearPlugin != null && wearPlugin.isEnabled()) {
wearPlugin.overviewNotification(n.id, "OverviewNotification:\n" + n.text); wearPlugin.overviewNotification(n.id, "OverviewNotification:\n" + n.text);
} }
Collections.sort(store, new NotificationComparator()); Collections.sort(store, new NotificationComparator());
} }
private void raiseSystemNotification(Notification n) {
Context context = MainApp.instance().getApplicationContext();
NotificationManager mgr = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
Bitmap largeIcon = BitmapFactory.decodeResource(context.getResources(), R.mipmap.blueowl);
Uri sound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM);
NotificationCompat.Builder notificationBuilder =
new NotificationCompat.Builder(context)
.setSmallIcon(R.drawable.ic_notification)
.setLargeIcon(largeIcon)
.setContentText(n.text)
.setPriority(NotificationCompat.PRIORITY_MAX)
.setDeleteIntent(DismissNotificationService.deleteIntent(n.id));
if (n.level == Notification.URGENT) {
notificationBuilder.setVibrate(new long[]{1000, 1000, 1000, 1000})
.setContentTitle(MainApp.sResources.getString(R.string.urgent_alarm))
.setSound(sound, AudioAttributes.USAGE_ALARM);
} else {
notificationBuilder.setVibrate(new long[]{0, 100, 50, 100, 50})
.setContentTitle(MainApp.sResources.getString(R.string.info))
;
}
mgr.notify(n.id, notificationBuilder.build());
}
public boolean remove(int id) { public boolean remove(int id) {
for (int i = 0; i < store.size(); i++) { for (int i = 0; i < store.size(); i++) {
if (get(i).id == id) { if (get(i).id == id) {
@ -87,14 +124,14 @@ public class NotificationStore {
} }
} }
} }
public void snoozeTo(long timeToSnooze){ public void snoozeTo(long timeToSnooze) {
log.debug("Snoozing alarm until: "+timeToSnooze); log.debug("Snoozing alarm until: " + timeToSnooze);
SP.putLong("snoozedTo", timeToSnooze); SP.putLong("snoozedTo", timeToSnooze);
} }
public void unSnooze(){ public void unSnooze() {
if(Notification.isAlarmForStaleData()){ if (Notification.isAlarmForStaleData()) {
Notification notification = new Notification(Notification.NSALARM, MainApp.sResources.getString(R.string.nsalarm_staledata), Notification.URGENT); Notification notification = new Notification(Notification.NSALARM, MainApp.sResources.getString(R.string.nsalarm_staledata), Notification.URGENT);
SP.putLong("snoozedTo", System.currentTimeMillis()); SP.putLong("snoozedTo", System.currentTimeMillis());
add(notification); add(notification);

View file

@ -38,7 +38,7 @@ import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.data.ProfileStore; import info.nightscout.androidaps.data.ProfileStore;
import info.nightscout.androidaps.plugins.Overview.Notification; import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification; import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.ProfileNS.NSProfilePlugin; import info.nightscout.androidaps.plugins.ProfileNS.NSProfilePlugin;
@ -229,7 +229,7 @@ public class DanaRPlugin implements PluginBase, PumpInterface, DanaRInterface, C
@Override @Override
public boolean isInitialized() { public boolean isInitialized() {
return pump.lastConnection.getTime() > 0 && pump.isExtendedBolusEnabled; return pump.lastConnection.getTime() > 0 && pump.isExtendedBolusEnabled && pump.maxBasal > 0;
} }
@Override @Override

View file

@ -7,7 +7,7 @@ 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.plugins.PumpDanaR.DanaRPump; import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
import info.nightscout.androidaps.plugins.Overview.Notification; import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification; import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;

View file

@ -9,15 +9,13 @@ 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.events.EventRefreshGui; import info.nightscout.androidaps.events.EventRefreshGui;
import info.nightscout.androidaps.events.EventRefreshOverview;
import info.nightscout.androidaps.interfaces.PluginBase; import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.Overview.Notification; import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPlugin; import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPlugin;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump; import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
import info.nightscout.androidaps.plugins.PumpDanaRKorean.DanaRKoreanPlugin; import info.nightscout.androidaps.plugins.PumpDanaRKorean.DanaRKoreanPlugin;
import info.nightscout.utils.ToastUtils;
public class MsgInitConnStatusTime extends MessageBase { public class MsgInitConnStatusTime extends MessageBase {
private static Logger log = LoggerFactory.getLogger(MsgInitConnStatusTime.class); private static Logger log = LoggerFactory.getLogger(MsgInitConnStatusTime.class);

View file

@ -6,7 +6,7 @@ import org.slf4j.LoggerFactory;
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.plugins.Overview.Notification; import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
public class MsgSetBasalProfile extends MessageBase { public class MsgSetBasalProfile extends MessageBase {

View file

@ -1,14 +1,12 @@
package info.nightscout.androidaps.plugins.PumpDanaR.comm; package info.nightscout.androidaps.plugins.PumpDanaR.comm;
import com.j256.ormlite.stmt.query.Not;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
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.plugins.Overview.Notification; import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
public class MsgSetSingleBasalProfile extends MessageBase { public class MsgSetSingleBasalProfile extends MessageBase {

View file

@ -6,7 +6,7 @@ import org.slf4j.LoggerFactory;
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.plugins.Overview.Notification; import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification; import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump; import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;

View file

@ -10,7 +10,6 @@ import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.os.Binder; import android.os.Binder;
import android.os.IBinder; import android.os.IBinder;
import android.os.PowerManager;
import android.os.SystemClock; import android.os.SystemClock;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
@ -33,7 +32,6 @@ import info.nightscout.androidaps.events.EventAppExit;
import info.nightscout.androidaps.events.EventInitializationChanged; import info.nightscout.androidaps.events.EventInitializationChanged;
import info.nightscout.androidaps.events.EventPreferenceChange; import info.nightscout.androidaps.events.EventPreferenceChange;
import info.nightscout.androidaps.events.EventPumpStatusChanged; import info.nightscout.androidaps.events.EventPumpStatusChanged;
import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.Overview.events.EventOverviewBolusProgress; import info.nightscout.androidaps.plugins.Overview.events.EventOverviewBolusProgress;
@ -81,7 +79,7 @@ import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgStatusBolusExtended;
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgStatusTempBasal; import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgStatusTempBasal;
import info.nightscout.androidaps.plugins.PumpDanaR.comm.RecordTypes; import info.nightscout.androidaps.plugins.PumpDanaR.comm.RecordTypes;
import info.nightscout.androidaps.plugins.PumpDanaR.events.EventDanaRNewStatus; import info.nightscout.androidaps.plugins.PumpDanaR.events.EventDanaRNewStatus;
import info.nightscout.androidaps.plugins.Overview.Notification; import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.androidaps.queue.Callback; import info.nightscout.androidaps.queue.Callback;
import info.nightscout.utils.NSUpload; import info.nightscout.utils.NSUpload;

View file

@ -38,7 +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.plugins.ConfigBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.Overview.Notification; import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification; import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.ProfileNS.NSProfilePlugin; import info.nightscout.androidaps.plugins.ProfileNS.NSProfilePlugin;
@ -231,7 +231,7 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, DanaRInterf
@Override @Override
public boolean isInitialized() { public boolean isInitialized() {
return pump.lastConnection.getTime() > 0 && !pump.isConfigUD && !pump.isEasyModeEnabled && pump.isExtendedBolusEnabled; return pump.lastConnection.getTime() > 0 && pump.maxBasal > 0 && !pump.isConfigUD && !pump.isEasyModeEnabled && pump.isExtendedBolusEnabled;
} }
@Override @Override

View file

@ -6,7 +6,7 @@ import org.slf4j.LoggerFactory;
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.plugins.Overview.Notification; import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification; import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump; import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;

View file

@ -8,7 +8,7 @@ import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump; import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MessageBase; import info.nightscout.androidaps.plugins.PumpDanaR.comm.MessageBase;
import info.nightscout.androidaps.plugins.Overview.Notification; import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification; import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;

View file

@ -11,13 +11,12 @@ import info.nightscout.androidaps.R;
import info.nightscout.androidaps.events.EventRefreshGui; import info.nightscout.androidaps.events.EventRefreshGui;
import info.nightscout.androidaps.interfaces.PluginBase; import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.Overview.Notification; import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPlugin; import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPlugin;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump; import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MessageBase; import info.nightscout.androidaps.plugins.PumpDanaR.comm.MessageBase;
import info.nightscout.androidaps.plugins.PumpDanaRKorean.DanaRKoreanPlugin; import info.nightscout.androidaps.plugins.PumpDanaRKorean.DanaRKoreanPlugin;
import info.nightscout.utils.ToastUtils;
public class MsgInitConnStatusTime_k extends MessageBase { public class MsgInitConnStatusTime_k extends MessageBase {
private static Logger log = LoggerFactory.getLogger(MsgInitConnStatusTime_k.class); private static Logger log = LoggerFactory.getLogger(MsgInitConnStatusTime_k.class);

View file

@ -10,7 +10,6 @@ import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.os.Binder; import android.os.Binder;
import android.os.IBinder; import android.os.IBinder;
import android.os.PowerManager;
import android.os.SystemClock; import android.os.SystemClock;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
@ -33,7 +32,6 @@ import info.nightscout.androidaps.events.EventAppExit;
import info.nightscout.androidaps.events.EventInitializationChanged; import info.nightscout.androidaps.events.EventInitializationChanged;
import info.nightscout.androidaps.events.EventPreferenceChange; import info.nightscout.androidaps.events.EventPreferenceChange;
import info.nightscout.androidaps.events.EventPumpStatusChanged; import info.nightscout.androidaps.events.EventPumpStatusChanged;
import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.Overview.events.EventOverviewBolusProgress; import info.nightscout.androidaps.plugins.Overview.events.EventOverviewBolusProgress;
@ -73,7 +71,7 @@ import info.nightscout.androidaps.plugins.PumpDanaR.comm.RecordTypes;
import info.nightscout.androidaps.plugins.PumpDanaR.events.EventDanaRNewStatus; import info.nightscout.androidaps.plugins.PumpDanaR.events.EventDanaRNewStatus;
import info.nightscout.androidaps.plugins.PumpDanaRKorean.DanaRKoreanPlugin; import info.nightscout.androidaps.plugins.PumpDanaRKorean.DanaRKoreanPlugin;
import info.nightscout.androidaps.plugins.PumpDanaRKorean.SerialIOThread; import info.nightscout.androidaps.plugins.PumpDanaRKorean.SerialIOThread;
import info.nightscout.androidaps.plugins.Overview.Notification; import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.PumpDanaRKorean.comm.MsgCheckValue_k; import info.nightscout.androidaps.plugins.PumpDanaRKorean.comm.MsgCheckValue_k;
import info.nightscout.androidaps.plugins.PumpDanaRKorean.comm.MsgSettingBasal_k; import info.nightscout.androidaps.plugins.PumpDanaRKorean.comm.MsgSettingBasal_k;

View file

@ -38,7 +38,7 @@ import info.nightscout.androidaps.interfaces.PumpDescription;
import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.ConfigBuilder.DetailedBolusInfoStorage; import info.nightscout.androidaps.plugins.ConfigBuilder.DetailedBolusInfoStorage;
import info.nightscout.androidaps.plugins.Overview.Notification; import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification; import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.ProfileNS.NSProfilePlugin; import info.nightscout.androidaps.plugins.ProfileNS.NSProfilePlugin;
@ -360,7 +360,7 @@ public class DanaRSPlugin implements PluginBase, PumpInterface, DanaRInterface,
@Override @Override
public boolean isInitialized() { public boolean isInitialized() {
return pump.lastConnection.getTime() > 0; return pump.lastConnection.getTime() > 0 && pump.maxBasal > 0;
} }
@Override @Override

View file

@ -7,7 +7,7 @@ import org.slf4j.LoggerFactory;
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.plugins.Overview.Notification; import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification; import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump; import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;

View file

@ -8,7 +8,7 @@ import com.cozmo.danar.util.BleCommandUtil;
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.Overview.Notification; import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification; import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump; import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;

View file

@ -6,11 +6,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.Config; import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.Overview.Notification;
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump; import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
public class DanaRS_Packet_General_Get_Pump_Check extends DanaRS_Packet { public class DanaRS_Packet_General_Get_Pump_Check extends DanaRS_Packet {

View file

@ -1,11 +1,9 @@
package info.nightscout.androidaps.plugins.PumpDanaRS.services; package info.nightscout.androidaps.plugins.PumpDanaRS.services;
import android.app.Service; import android.app.Service;
import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Binder; import android.os.Binder;
import android.os.IBinder; import android.os.IBinder;
import android.os.PowerManager;
import android.os.SystemClock; import android.os.SystemClock;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
@ -26,7 +24,7 @@ import info.nightscout.androidaps.events.EventAppExit;
import info.nightscout.androidaps.events.EventInitializationChanged; import info.nightscout.androidaps.events.EventInitializationChanged;
import info.nightscout.androidaps.events.EventPumpStatusChanged; import info.nightscout.androidaps.events.EventPumpStatusChanged;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.Overview.Notification; import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.Overview.events.EventOverviewBolusProgress; import info.nightscout.androidaps.plugins.Overview.events.EventOverviewBolusProgress;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump; import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;

View file

@ -38,7 +38,7 @@ import info.nightscout.androidaps.interfaces.PumpDescription;
import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.ConfigBuilder.DetailedBolusInfoStorage; import info.nightscout.androidaps.plugins.ConfigBuilder.DetailedBolusInfoStorage;
import info.nightscout.androidaps.plugins.Overview.Notification; import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification; import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.ProfileNS.NSProfilePlugin; import info.nightscout.androidaps.plugins.ProfileNS.NSProfilePlugin;
@ -216,7 +216,7 @@ public class DanaRv2Plugin implements PluginBase, PumpInterface, DanaRInterface,
@Override @Override
public boolean isInitialized() { public boolean isInitialized() {
return pump.lastConnection.getTime() > 0; return pump.lastConnection.getTime() > 0 && pump.maxBasal > 0;
} }
@Override @Override

View file

@ -9,17 +9,15 @@ 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.events.EventRefreshGui; import info.nightscout.androidaps.events.EventRefreshGui;
import info.nightscout.androidaps.events.EventRefreshOverview;
import info.nightscout.androidaps.interfaces.PluginBase; import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.Overview.Notification; import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPlugin; import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPlugin;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump; import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MessageBase; import info.nightscout.androidaps.plugins.PumpDanaR.comm.MessageBase;
import info.nightscout.androidaps.plugins.PumpDanaRKorean.DanaRKoreanPlugin; import info.nightscout.androidaps.plugins.PumpDanaRKorean.DanaRKoreanPlugin;
import info.nightscout.androidaps.plugins.PumpDanaRv2.DanaRv2Plugin; import info.nightscout.androidaps.plugins.PumpDanaRv2.DanaRv2Plugin;
import info.nightscout.utils.ToastUtils;
/** /**
* Created by mike on 30.06.2016. * Created by mike on 30.06.2016.

View file

@ -10,7 +10,6 @@ import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.os.Binder; import android.os.Binder;
import android.os.IBinder; import android.os.IBinder;
import android.os.PowerManager;
import android.os.SystemClock; import android.os.SystemClock;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
@ -33,10 +32,9 @@ import info.nightscout.androidaps.events.EventAppExit;
import info.nightscout.androidaps.events.EventInitializationChanged; import info.nightscout.androidaps.events.EventInitializationChanged;
import info.nightscout.androidaps.events.EventPreferenceChange; import info.nightscout.androidaps.events.EventPreferenceChange;
import info.nightscout.androidaps.events.EventPumpStatusChanged; import info.nightscout.androidaps.events.EventPumpStatusChanged;
import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.Overview.Notification; import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.Overview.events.EventOverviewBolusProgress; import info.nightscout.androidaps.plugins.Overview.events.EventOverviewBolusProgress;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump; import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;

View file

@ -25,18 +25,15 @@ import info.nightscout.androidaps.data.DetailedBolusInfo;
import info.nightscout.androidaps.data.GlucoseStatus; import info.nightscout.androidaps.data.GlucoseStatus;
import info.nightscout.androidaps.data.IobTotal; import info.nightscout.androidaps.data.IobTotal;
import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.data.PumpEnactResult;
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.db.Source; import info.nightscout.androidaps.db.Source;
import info.nightscout.androidaps.events.EventPreferenceChange; import info.nightscout.androidaps.events.EventPreferenceChange;
import info.nightscout.androidaps.events.EventRefreshOverview; import info.nightscout.androidaps.events.EventRefreshOverview;
import info.nightscout.androidaps.interfaces.PluginBase; import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.Loop.LoopPlugin; import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
import info.nightscout.androidaps.plugins.Overview.Dialogs.ErrorHelperActivity; import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.androidaps.plugins.Overview.Notification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPlugin; import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPlugin;
import info.nightscout.androidaps.plugins.PumpDanaRKorean.DanaRKoreanPlugin; import info.nightscout.androidaps.plugins.PumpDanaRKorean.DanaRKoreanPlugin;

View file

@ -20,7 +20,7 @@ import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.Overview.Dialogs.BolusProgressDialog; import info.nightscout.androidaps.plugins.Overview.Dialogs.BolusProgressDialog;
import info.nightscout.androidaps.plugins.Overview.Dialogs.BolusProgressHelperActivity; import info.nightscout.androidaps.plugins.Overview.Dialogs.BolusProgressHelperActivity;
import info.nightscout.androidaps.plugins.Overview.Notification; import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification; import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.androidaps.queue.commands.Command; import info.nightscout.androidaps.queue.commands.Command;

View file

@ -9,9 +9,7 @@ import android.app.PendingIntent;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences;
import android.os.PowerManager; import android.os.PowerManager;
import android.preference.PreferenceManager;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -20,12 +18,31 @@ import java.util.Date;
import info.nightscout.androidaps.Constants; import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.db.BgReading;
import info.nightscout.androidaps.db.DatabaseHelper;
import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.utils.SP;
public class KeepAliveReceiver extends BroadcastReceiver { public class KeepAliveReceiver extends BroadcastReceiver {
private static Logger log = LoggerFactory.getLogger(KeepAliveReceiver.class); private static Logger log = LoggerFactory.getLogger(KeepAliveReceiver.class);
public static final long STATUS_UPDATE_FREQUENCY = 15 * 60 * 1000L;
// TODO consider moving this into an Alarms plugin that works offline and can be configured
// (e.g. override silent mode at night only)
private static int missedReadingsThreshold() {
return SP.getInt(MainApp.sResources.getString(R.string.key_missed_bg_readings_threshold), 30) * 60 * 1000;
}
private static int pumpUnreachableThreshold() {
return SP.getInt(MainApp.sResources.getString(R.string.key_pump_unreachable_threshold), 30) * 60 * 1000;
}
@Override @Override
public void onReceive(Context context, Intent rIntent) { public void onReceive(Context context, Intent rIntent) {
@ -33,20 +50,45 @@ public class KeepAliveReceiver extends BroadcastReceiver {
PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, ""); PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "");
wl.acquire(); wl.acquire();
shortenSnoozeInterval();
checkBg();
checkPump();
log.debug("KeepAlive received");
wl.release();
}
private void checkBg() {
BgReading bgReading = DatabaseHelper.lastBg();
if (SP.getBoolean(MainApp.sResources.getString(R.string.key_enable_missed_bg_readings_alert), false)
&& bgReading != null && bgReading.date + missedReadingsThreshold() < System.currentTimeMillis()
&& SP.getLong("nextMissedReadingsAlarm", 0l) < System.currentTimeMillis()) {
Notification n = new Notification(Notification.BG_READINGS_MISSED, MainApp.sResources.getString(R.string.missed_bg_readings), Notification.URGENT);
n.soundId = R.raw.alarm;
SP.putLong("nextMissedReadingsAlarm", System.currentTimeMillis() + missedReadingsThreshold());
MainApp.bus().post(new EventNewNotification(n));
}
}
private void checkPump() {
final PumpInterface pump = ConfigBuilderPlugin.getActivePump(); final PumpInterface pump = ConfigBuilderPlugin.getActivePump();
final Profile profile = MainApp.getConfigBuilder().getProfile(); final Profile profile = MainApp.getConfigBuilder().getProfile();
if (pump != null && profile != null && profile.getBasal() != null) { if (pump != null && profile != null && profile.getBasal() != null) {
boolean isBasalOutdated = false;
boolean isStatusOutdated = false;
Date lastConnection = pump.lastDataTime(); Date lastConnection = pump.lastDataTime();
if (lastConnection.getTime() + 30 * 60 * 1000L < System.currentTimeMillis()) boolean isStatusOutdated = lastConnection.getTime() + STATUS_UPDATE_FREQUENCY < System.currentTimeMillis();
isStatusOutdated = true; boolean isBasalOutdated = Math.abs(profile.getBasal() - pump.getBaseBasalRate()) > pump.getPumpDescription().basalStep;
if (Math.abs(profile.getBasal() - pump.getBaseBasalRate()) > pump.getPumpDescription().basalStep)
isBasalOutdated = true; boolean alarmTimeoutExpired = lastConnection.getTime() + pumpUnreachableThreshold() < System.currentTimeMillis();
boolean nextAlarmOccurrenceReached = SP.getLong("nextPumpDisconnectedAlarm", 0l) < System.currentTimeMillis();
if (SP.getBoolean(MainApp.sResources.getString(R.string.key_enable_pump_unreachable_alert), true)
&& isStatusOutdated && alarmTimeoutExpired && nextAlarmOccurrenceReached && !ConfigBuilderPlugin.getActiveLoop().isDisconnected()) {
Notification n = new Notification(Notification.PUMP_UNREACHABLE, MainApp.sResources.getString(R.string.pump_unreachable), Notification.URGENT);
n.soundId = R.raw.alarm;
SP.putLong("nextPumpDisconnectedAlarm", System.currentTimeMillis() + pumpUnreachableThreshold());
MainApp.bus().post(new EventNewNotification(n));
}
SharedPreferences SP = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext());
if (SP.getBoolean("syncprofiletopump", false) && !pump.isThisProfileSet(profile)) { if (SP.getBoolean("syncprofiletopump", false) && !pump.isThisProfileSet(profile)) {
MainApp.getConfigBuilder().getCommandQueue().setProfile(profile, null); MainApp.getConfigBuilder().getCommandQueue().setProfile(profile, null);
} else if (isStatusOutdated && !pump.isBusy()) { } else if (isStatusOutdated && !pump.isBusy()) {
@ -55,12 +97,14 @@ public class KeepAliveReceiver extends BroadcastReceiver {
MainApp.getConfigBuilder().getCommandQueue().readStatus("KeepAlive. Basal outdated.", null); MainApp.getConfigBuilder().getCommandQueue().readStatus("KeepAlive. Basal outdated.", null);
} }
} }
log.debug("KeepAlive received");
wl.release();
} }
//called by MainApp at first app start
public void setAlarm(Context context) { public void setAlarm(Context context) {
shortenSnoozeInterval();
presnoozeAlarms();
AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
Intent i = new Intent(context, KeepAliveReceiver.class); Intent i = new Intent(context, KeepAliveReceiver.class);
PendingIntent pi = PendingIntent.getBroadcast(context, 0, i, 0); PendingIntent pi = PendingIntent.getBroadcast(context, 0, i, 0);
@ -72,10 +116,33 @@ public class KeepAliveReceiver extends BroadcastReceiver {
am.setInexactRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), Constants.keepAliveMsecs, pi); am.setInexactRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), Constants.keepAliveMsecs, pi);
} }
/*Presnoozes the alarms with 5 minutes if no snooze exists.
* Call only at startup!
*/
public void presnoozeAlarms() {
if (SP.getLong("nextMissedReadingsAlarm", 0l) < System.currentTimeMillis()) {
SP.putLong("nextMissedReadingsAlarm", System.currentTimeMillis() + 5 * 60 * 1000);
}
if (SP.getLong("nextPumpDisconnectedAlarm", 0l) < System.currentTimeMillis()) {
SP.putLong("nextPumpDisconnectedAlarm", System.currentTimeMillis() + 5 * 60 * 1000);
}
}
public void cancelAlarm(Context context) { public void cancelAlarm(Context context) {
Intent intent = new Intent(context, KeepAliveReceiver.class); Intent intent = new Intent(context, KeepAliveReceiver.class);
PendingIntent sender = PendingIntent.getBroadcast(context, 0, intent, 0); PendingIntent sender = PendingIntent.getBroadcast(context, 0, intent, 0);
AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
alarmManager.cancel(sender); alarmManager.cancel(sender);
} }
static void shortenSnoozeInterval() {
//shortens alarm times in case of setting changes or future data
long nextMissedReadingsAlarm = SP.getLong("nextMissedReadingsAlarm", 0L);
nextMissedReadingsAlarm = Math.min(System.currentTimeMillis() + missedReadingsThreshold(), nextMissedReadingsAlarm);
SP.putLong("nextMissedReadingsAlarm", nextMissedReadingsAlarm);
long nextPumpDisconnectedAlarm = SP.getLong("nextPumpDisconnectedAlarm", 0L);
nextPumpDisconnectedAlarm = Math.min(System.currentTimeMillis() + pumpUnreachableThreshold(), nextPumpDisconnectedAlarm);
SP.putLong("nextPumpDisconnectedAlarm", nextPumpDisconnectedAlarm);
}
} }

View file

@ -13,7 +13,7 @@ import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.Services.Intents; import info.nightscout.androidaps.Services.Intents;
import info.nightscout.androidaps.plugins.NSClientInternal.data.NSAlarm; import info.nightscout.androidaps.plugins.NSClientInternal.data.NSAlarm;
import info.nightscout.androidaps.plugins.Overview.Notification; import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification; import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;

View file

@ -7,7 +7,7 @@ import android.os.Looper;
import android.widget.Toast; import android.widget.Toast;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.plugins.Overview.Notification; import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;

View file

@ -758,5 +758,19 @@
<string name="startingbolus">Starting bolus delivery</string> <string name="startingbolus">Starting bolus delivery</string>
<string name="executingrightnow">Command is executed right now</string> <string name="executingrightnow">Command is executed right now</string>
<string name="pumpdrivercorrected">Pump driver corrected</string> <string name="pumpdrivercorrected">Pump driver corrected</string>
<string name="pump_unreachable">Pump unreachable</string>
<string name="missed_bg_readings">Missed BG readings</string>
<string name="key_raise_notifications_as_android_notifications" translatable="false">raise_urgent_alarms_as_android_notification</string>
<string name="raise_notifications_as_android_notifications">Use system notifications for alerts and notifications</string>
<string name="key_enable_pump_unreachable_alert" translatable="false">enable_pump_unreachable_alert</string>
<string name="key_enable_missed_bg_readings_alert" translatable="false">enable_missed_bg_readings</string>
<string name="localalertsettings_title">Local alerts</string>
<string name="enable_missed_bg_readings_alert">Alert if no BG data is received</string>
<string name="enable_pump_unreachable_alert">Alert if pump is unreachable</string>
<string name="pump_unreachable_threshold">Pump unreachable threshold [min]</string>
<string name="key_pump_unreachable_threshold" translatable="false">pump_unreachable_threshold</string>
<string name="key_missed_bg_readings_threshold" translatable="false">missed_bg_readings_threshold</string>
<string name="urgent_alarm">Urgent Alarm</string>
<string name="info">INFO</string>
</resources> </resources>

View file

@ -3,73 +3,88 @@
<PreferenceCategory <PreferenceCategory
android:key="others" android:key="others"
android:title="@string/othersettings_title"> android:title="@string/othersettings_title">
<PreferenceScreen <PreferenceScreen android:title="@string/default_temptargets">
android:title="@string/default_temptargets">
<EditTextPreference <EditTextPreference
android:title="@string/eatingsoon_duration" android:defaultValue="0"
android:inputType="number"
android:key="@string/key_eatingsoon_duration" android:key="@string/key_eatingsoon_duration"
android:defaultValue="0" android:title="@string/eatingsoon_duration"></EditTextPreference>
android:inputType="number">
</EditTextPreference>
<EditTextPreference <EditTextPreference
android:title="@string/eatingsoon_target" android:defaultValue="0"
android:inputType="numberDecimal"
android:key="@string/key_eatingsoon_target" android:key="@string/key_eatingsoon_target"
android:defaultValue="0" android:title="@string/eatingsoon_target"></EditTextPreference>
android:inputType="numberDecimal">
</EditTextPreference>
<EditTextPreference <EditTextPreference
android:title="@string/activity_duration" android:defaultValue="0"
android:inputType="number"
android:key="@string/key_activity_duration" android:key="@string/key_activity_duration"
android:defaultValue="0" android:title="@string/activity_duration"></EditTextPreference>
android:inputType="number">
</EditTextPreference>
<EditTextPreference <EditTextPreference
android:title="@string/activity_target" android:defaultValue="0"
android:inputType="numberDecimal"
android:key="@string/key_activity_target" android:key="@string/key_activity_target"
android:defaultValue="0" android:title="@string/activity_target"></EditTextPreference>
android:inputType="numberDecimal">
</EditTextPreference>
</PreferenceScreen> </PreferenceScreen>
<PreferenceScreen <PreferenceScreen android:title="@string/fillbolus_title">
android:title="@string/fillbolus_title">
<EditTextPreference <EditTextPreference
android:title="@string/button1"
android:key="fill_button1"
android:defaultValue="0.3" android:defaultValue="0.3"
android:inputType="numberDecimal"> android:inputType="numberDecimal"
</EditTextPreference> android:key="fill_button1"
android:title="@string/button1"></EditTextPreference>
<EditTextPreference <EditTextPreference
android:title="@string/button2" android:defaultValue="0"
android:inputType="numberDecimal"
android:key="fill_button2" android:key="fill_button2"
android:defaultValue="0" android:title="@string/button2"></EditTextPreference>
android:inputType="numberDecimal">
</EditTextPreference>
<EditTextPreference <EditTextPreference
android:title="@string/button3"
android:key="fill_button3"
android:defaultValue="0" android:defaultValue="0"
android:inputType="numberDecimal"> android:inputType="numberDecimal"
</EditTextPreference> android:key="fill_button3"
android:title="@string/button3"></EditTextPreference>
</PreferenceScreen> </PreferenceScreen>
<PreferenceScreen <PreferenceScreen
android:title="@string/prefs_range_title" android:summary="@string/prefs_range_summary"
android:summary= "@string/prefs_range_summary"> android:title="@string/prefs_range_title">
<EditTextPreference <EditTextPreference
android:title="@string/low_mark" android:defaultValue="0"
android:inputType="numberDecimal"
android:key="low_mark" android:key="low_mark"
android:defaultValue="0" android:title="@string/low_mark"></EditTextPreference>
android:inputType="numberDecimal">
</EditTextPreference>
<EditTextPreference <EditTextPreference
android:title="@string/high_mark"
android:key="high_mark"
android:defaultValue="0" android:defaultValue="0"
android:inputType="numberDecimal"> android:inputType="numberDecimal"
</EditTextPreference> android:key="high_mark"
android:title="@string/high_mark"></EditTextPreference>
</PreferenceScreen> </PreferenceScreen>
<SwitchPreference <SwitchPreference
android:defaultValue="false" android:defaultValue="false"
android:key="short_tabtitles" android:key="short_tabtitles"
android:title="@string/short_tabtitles"/> android:title="@string/short_tabtitles" />
</PreferenceCategory> </PreferenceCategory>
<PreferenceScreen android:title="@string/localalertsettings_title">
<SwitchPreference
android:defaultValue="false"
android:key="@string/key_enable_missed_bg_readings_alert"
android:title="@string/enable_missed_bg_readings_alert" />
<EditTextPreference
android:defaultValue="30"
android:dependency="@string/key_enable_missed_bg_readings_alert"
android:inputType="number"
android:key="@string/key_missed_bg_readings_threshold"
android:title="@string/nsalarm_staledatavalue_label"></EditTextPreference>
<SwitchPreference
android:defaultValue="true"
android:key="@string/key_enable_pump_unreachable_alert"
android:title="@string/enable_pump_unreachable_alert" />
<EditTextPreference
android:defaultValue="30"
android:dependency="@string/key_enable_pump_unreachable_alert"
android:inputType="number"
android:key="@string/key_pump_unreachable_threshold"
android:title="@string/pump_unreachable_threshold"></EditTextPreference>
</PreferenceScreen>
<SwitchPreference
android:defaultValue="false"
android:key="@string/key_raise_notifications_as_android_notifications"
android:title="@string/raise_notifications_as_android_notifications" />
</PreferenceScreen> </PreferenceScreen>

View file

@ -7,26 +7,20 @@
<SwitchPreference <SwitchPreference
android:defaultValue="false" android:defaultValue="false"
android:key="wearcontrol" android:key="wearcontrol"
android:title="@string/wearcontrol_title" android:summary="@string/wearcontrol_summary"
android:summary="@string/wearcontrol_summary"/> android:title="@string/wearcontrol_title" />
<SwitchPreference <SwitchPreference
android:defaultValue="true" android:defaultValue="true"
android:key="wear_detailediob" android:key="wear_detailediob"
android:title="@string/wear_detailedIOB_title" android:summary="@string/wear_detailedIOB_summary"
android:summary="@string/wear_detailedIOB_summary"/> android:title="@string/wear_detailedIOB_title" />
<SwitchPreference <SwitchPreference
android:defaultValue="false" android:defaultValue="false"
android:key="wear_showbgi" android:key="wear_showbgi"
android:title="@string/wear_showbgi_title" android:summary="@string/wear_showbgi_summary"
android:summary="@string/wear_showbgi_summary"/> android:title="@string/wear_showbgi_title" />
<SwitchPreference
android:defaultValue="false"
android:key="wear_overview_notification"
android:title="@string/wear_overviewnotifications"
android:summary="@string/wear_overviewnotifications_summary"/>
</PreferenceCategory> </PreferenceCategory>