diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/IobCobCalculator/CobInfo.java b/app/src/main/java/info/nightscout/androidaps/plugins/IobCobCalculator/CobInfo.java index 90b72132bd..f05d443bba 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/IobCobCalculator/CobInfo.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/IobCobCalculator/CobInfo.java @@ -1,7 +1,10 @@ package info.nightscout.androidaps.plugins.IobCobCalculator; +import android.support.annotation.NonNull; import android.support.annotation.Nullable; +import info.nightscout.utils.DecimalFormatter; + public class CobInfo { /** All COB up to now, including carbs not yet processed by IobCob calculation. */ @Nullable @@ -12,4 +15,19 @@ public class CobInfo { this.displayCob = displayCob; this.futureCarbs = futureCarbs; } + + @NonNull + public static String generateCOBString() { + + String cobStringResult = "--"; + CobInfo cobInfo = IobCobCalculatorPlugin.getPlugin().getCobInfo(false, "WatcherUpdaterService"); + if (cobInfo.displayCob != null) { + cobStringResult = DecimalFormatter.to0Decimal(cobInfo.displayCob); + if (cobInfo.futureCarbs > 0) { + cobStringResult += "(" + DecimalFormatter.to0Decimal(cobInfo.futureCarbs) + ")"; + } + cobStringResult += "g"; + } + return cobStringResult; + } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/wearintegration/WatchUpdaterService.java b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/wearintegration/WatchUpdaterService.java index 0d809a7bab..e999a9f4b9 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/wearintegration/WatchUpdaterService.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/wearintegration/WatchUpdaterService.java @@ -42,8 +42,6 @@ import info.nightscout.androidaps.plugins.Treatments.Treatment; import info.nightscout.androidaps.interfaces.PluginType; import info.nightscout.androidaps.interfaces.TreatmentsInterface; import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; -import info.nightscout.androidaps.plugins.IobCobCalculator.AutosensData; -import info.nightscout.androidaps.plugins.IobCobCalculator.IobCobCalculatorPlugin; import info.nightscout.androidaps.plugins.Loop.LoopPlugin; import info.nightscout.androidaps.plugins.NSClientInternal.data.NSDeviceStatus; import info.nightscout.androidaps.plugins.Overview.OverviewPlugin; @@ -592,7 +590,7 @@ public class WatchUpdaterService extends WearableListenerService implements iobSum = DecimalFormatter.to2Decimal(bolusIob.iob + basalIob.basaliob); iobDetail = "(" + DecimalFormatter.to2Decimal(bolusIob.iob) + "|" + DecimalFormatter.to2Decimal(basalIob.basaliob) + ")"; - cobString = generateCOBString(); + cobString = CobInfo.generateCOBString(); currentBasal = generateBasalString(treatmentsInterface); //bgi @@ -715,21 +713,6 @@ public class WatchUpdaterService extends WearableListenerService implements return basalStringResult; } - @NonNull - private String generateCOBString() { - - String cobStringResult = "--"; - CobInfo cobInfo = IobCobCalculatorPlugin.getPlugin().getCobInfo(false, "WatcherUpdaterService"); - if (cobInfo.displayCob != null) { - cobStringResult = DecimalFormatter.to0Decimal(cobInfo.displayCob); - if (cobInfo.futureCarbs > 0) { - cobStringResult += "(" + DecimalFormatter.to0Decimal(cobInfo.futureCarbs) + ")"; - } - cobStringResult += "g"; - } - return cobStringResult; - } - @Override public void onDestroy() { if (googleApiClient != null && googleApiClient.isConnected()) {