wear show on status when loop is disabled
This commit is contained in:
parent
d113d39916
commit
abaafb87eb
2 changed files with 28 additions and 0 deletions
|
@ -15,6 +15,7 @@ import info.nightscout.androidaps.events.EventRefreshGui;
|
|||
import info.nightscout.androidaps.events.EventTempBasalChange;
|
||||
import info.nightscout.androidaps.events.EventTreatmentChange;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
|
||||
import info.nightscout.androidaps.plugins.Loop.events.EventNewOpenLoopNotification;
|
||||
import info.nightscout.androidaps.plugins.Overview.events.EventOverviewBolusProgress;
|
||||
import info.nightscout.androidaps.plugins.Wear.wearintegration.WatchUpdaterService;
|
||||
|
@ -146,6 +147,17 @@ public class WearPlugin implements PluginBase {
|
|||
sendDataToWatch(false, true, false);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventRefreshGui ev) {
|
||||
|
||||
LoopPlugin activeloop = MainApp.getConfigBuilder().getActiveLoop();
|
||||
if (activeloop == null) return;
|
||||
|
||||
if(WatchUpdaterService.shouldReportLoopStatus(activeloop.isEnabled(PluginBase.LOOP))) {
|
||||
sendDataToWatch(true, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventOverviewBolusProgress ev) {
|
||||
|
|
|
@ -28,8 +28,10 @@ import info.nightscout.androidaps.R;
|
|||
import info.nightscout.androidaps.data.GlucoseStatus;
|
||||
import info.nightscout.androidaps.db.BgReading;
|
||||
import info.nightscout.androidaps.db.TempBasal;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||
import info.nightscout.androidaps.data.IobTotal;
|
||||
import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
|
||||
import info.nightscout.androidaps.plugins.Overview.OverviewPlugin;
|
||||
import info.nightscout.androidaps.plugins.Wear.ActionStringHandler;
|
||||
import info.nightscout.androidaps.plugins.Wear.WearPlugin;
|
||||
|
@ -66,6 +68,7 @@ public class WatchUpdaterService extends WearableListenerService implements
|
|||
|
||||
boolean wear_integration = false;
|
||||
SharedPreferences mPrefs;
|
||||
private static boolean lastLoopStatus;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
|
@ -503,6 +506,15 @@ public class WatchUpdaterService extends WearableListenerService implements
|
|||
String status = "";
|
||||
boolean shortString = true;
|
||||
|
||||
LoopPlugin activeloop = MainApp.getConfigBuilder().getActiveLoop();
|
||||
|
||||
if (activeloop != null && !activeloop.isEnabled(PluginBase.LOOP)) {
|
||||
status += getString(R.string.disabledloop) + "\n";
|
||||
lastLoopStatus = false;
|
||||
} else if (activeloop != null && activeloop.isEnabled(PluginBase.LOOP)) {
|
||||
lastLoopStatus = true;
|
||||
}
|
||||
|
||||
//Temp basal
|
||||
PumpInterface pump = MainApp.getConfigBuilder();
|
||||
|
||||
|
@ -555,6 +567,10 @@ public class WatchUpdaterService extends WearableListenerService implements
|
|||
public void onConnectionFailed(ConnectionResult connectionResult) {
|
||||
}
|
||||
|
||||
public static boolean shouldReportLoopStatus(boolean enabled){
|
||||
return (lastLoopStatus != enabled);
|
||||
}
|
||||
|
||||
public static int getBatteryLevel(Context context) {
|
||||
Intent batteryIntent = context.registerReceiver(null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
|
||||
int level = batteryIntent.getIntExtra(BatteryManager.EXTRA_LEVEL, -1);
|
||||
|
|
Loading…
Reference in a new issue