From 0ab2d5ba3840e657123b946157e19150e3d7d096 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Mon, 12 Feb 2018 19:49:08 +0100 Subject: [PATCH] unstatic IobCobCalculatorPlugin --- .../androidaps/data/QuickWizardEntry.java | 4 +- .../IobCobCalculatorPlugin.java | 44 +++++++++---------- .../IobCobCalculator/IobCobThread.java | 12 ++--- .../plugins/OpenAPSAMA/OpenAPSAMAPlugin.java | 4 +- .../plugins/OpenAPSSMB/OpenAPSSMBPlugin.java | 4 +- .../Overview/Dialogs/WizardDialog.java | 2 +- .../plugins/Overview/OverviewFragment.java | 2 +- .../plugins/Overview/graphData/GraphData.java | 12 ++--- .../SensitivityAAPSPlugin.java | 4 +- .../SensitivityOref0Plugin.java | 4 +- .../SensitivityWeightedAveragePlugin.java | 4 +- .../plugins/Treatments/TreatmentsPlugin.java | 2 +- .../wearintegration/WatchUpdaterService.java | 2 +- 13 files changed, 48 insertions(+), 52 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/data/QuickWizardEntry.java b/app/src/main/java/info/nightscout/androidaps/data/QuickWizardEntry.java index 35a7265f2a..b08926f119 100644 --- a/app/src/main/java/info/nightscout/androidaps/data/QuickWizardEntry.java +++ b/app/src/main/java/info/nightscout/androidaps/data/QuickWizardEntry.java @@ -82,9 +82,9 @@ public class QuickWizardEntry { double cob = 0d; AutosensData autosensData; if (_synchronized) - autosensData = IobCobCalculatorPlugin.getLastAutosensDataSynchronized("QuickWizard COB"); + autosensData = IobCobCalculatorPlugin.getPlugin().getLastAutosensDataSynchronized("QuickWizard COB"); else - autosensData = IobCobCalculatorPlugin.getLastAutosensData("QuickWizard COB"); + autosensData = IobCobCalculatorPlugin.getPlugin().getLastAutosensData("QuickWizard COB"); if (autosensData != null && useCOB() == YES) { cob = autosensData.cob; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/IobCobCalculator/IobCobCalculatorPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/IobCobCalculator/IobCobCalculatorPlugin.java index c891f60d49..16b1edd10c 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/IobCobCalculator/IobCobCalculatorPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/IobCobCalculator/IobCobCalculatorPlugin.java @@ -41,19 +41,19 @@ import info.nightscout.utils.DateUtil; public class IobCobCalculatorPlugin implements PluginBase { private static Logger log = LoggerFactory.getLogger(IobCobCalculatorPlugin.class); - private static LongSparseArray iobTable = new LongSparseArray<>(); // oldest at index 0 - private static LongSparseArray autosensDataTable = new LongSparseArray<>(); // oldest at index 0 - private static LongSparseArray basalDataTable = new LongSparseArray<>(); // oldest at index 0 + private LongSparseArray iobTable = new LongSparseArray<>(); // oldest at index 0 + private LongSparseArray autosensDataTable = new LongSparseArray<>(); // oldest at index 0 + private LongSparseArray basalDataTable = new LongSparseArray<>(); // oldest at index 0 - private static volatile List bgReadings = null; // newest at index 0 - private static volatile List bucketed_data = null; + private volatile List bgReadings = null; // newest at index 0 + private volatile List bucketed_data = null; - private static double dia = Constants.defaultDIA; + private double dia = Constants.defaultDIA; - static final Object dataLock = new Object(); + final Object dataLock = new Object(); boolean stopCalculationTrigger = false; - IobCobThread thread = null; + private IobCobThread thread = null; private static IobCobCalculatorPlugin plugin = null; @@ -63,11 +63,11 @@ public class IobCobCalculatorPlugin implements PluginBase { return plugin; } - public static LongSparseArray getAutosensDataTable() { + public LongSparseArray getAutosensDataTable() { return autosensDataTable; } - public static List getBucketedData() { + public List getBucketedData() { return bucketed_data; } @@ -136,7 +136,7 @@ public class IobCobCalculatorPlugin implements PluginBase { } @Nullable - public static List getBucketedData(long fromTime) { + public List getBucketedData(long fromTime) { //log.debug("Locking getBucketedData"); synchronized (dataLock) { if (bucketed_data == null) { @@ -154,7 +154,7 @@ public class IobCobCalculatorPlugin implements PluginBase { return null; } - private static int indexNewerThan(long time) { + private int indexNewerThan(long time) { for (int index = 0; index < bucketed_data.size(); index++) { if (bucketed_data.get(index).date < time) return index - 1; @@ -332,13 +332,13 @@ public class IobCobCalculatorPlugin implements PluginBase { return getBGDataFrom; } - public static IobTotal calculateFromTreatmentsAndTempsSynchronized(long time) { + public IobTotal calculateFromTreatmentsAndTempsSynchronized(long time) { synchronized (dataLock) { return calculateFromTreatmentsAndTemps(time); } } - public static IobTotal calculateFromTreatmentsAndTemps(long time) { + public IobTotal calculateFromTreatmentsAndTemps(long time) { long now = System.currentTimeMillis(); time = roundUpTime(time); if (time < now && iobTable.get(time) != null) { @@ -373,7 +373,7 @@ public class IobCobCalculatorPlugin implements PluginBase { } @Nullable - private static Long findPreviousTimeFromBucketedData(long time) { + private Long findPreviousTimeFromBucketedData(long time) { if (bucketed_data == null) return null; for (int index = 0; index < bucketed_data.size(); index++) { @@ -383,7 +383,7 @@ public class IobCobCalculatorPlugin implements PluginBase { return null; } - public static BasalData getBasalData(long time) { + public BasalData getBasalData(long time) { long now = System.currentTimeMillis(); time = roundUpTime(time); BasalData retval = basalDataTable.get(time); @@ -409,7 +409,7 @@ public class IobCobCalculatorPlugin implements PluginBase { } @Nullable - public static AutosensData getAutosensData(long time) { + public AutosensData getAutosensData(long time) { synchronized (dataLock) { long now = System.currentTimeMillis(); if (time > now) @@ -434,7 +434,7 @@ public class IobCobCalculatorPlugin implements PluginBase { } @Nullable - public static AutosensData getLastAutosensDataSynchronized(String reason) { + public AutosensData getLastAutosensDataSynchronized(String reason) { synchronized (dataLock) { return getLastAutosensData(reason); } @@ -442,7 +442,7 @@ public class IobCobCalculatorPlugin implements PluginBase { @Nullable - public static AutosensData getLastAutosensData(String reason) { + public AutosensData getLastAutosensData(String reason) { if (autosensDataTable.size() < 1) { log.debug("AUTOSENSDATA null: autosensDataTable empty (" + reason + ")"); return null; @@ -467,7 +467,7 @@ public class IobCobCalculatorPlugin implements PluginBase { } } - public static IobTotal[] calculateIobArrayInDia() { + public IobTotal[] calculateIobArrayInDia() { Profile profile = MainApp.getConfigBuilder().getProfile(); // predict IOB out to DIA plus 30m long time = System.currentTimeMillis(); @@ -484,7 +484,7 @@ public class IobCobCalculatorPlugin implements PluginBase { return array; } - public static IobTotal[] calculateIobArrayForSMB() { + public IobTotal[] calculateIobArrayForSMB() { Profile profile = MainApp.getConfigBuilder().getProfile(); // predict IOB out to DIA plus 30m long time = System.currentTimeMillis(); @@ -501,7 +501,7 @@ public class IobCobCalculatorPlugin implements PluginBase { return array; } - public static AutosensResult detectSensitivityWithLock(long fromTime, long toTime) { + public AutosensResult detectSensitivityWithLock(long fromTime, long toTime) { synchronized (dataLock) { return detectSensitivity(fromTime, toTime); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/IobCobCalculator/IobCobThread.java b/app/src/main/java/info/nightscout/androidaps/plugins/IobCobCalculator/IobCobThread.java index 4f63cacf62..69ded468a3 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/IobCobCalculator/IobCobThread.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/IobCobCalculator/IobCobThread.java @@ -22,10 +22,6 @@ import info.nightscout.androidaps.events.Event; import info.nightscout.androidaps.plugins.IobCobCalculator.events.EventAutosensCalculationFinished; import info.nightscout.androidaps.queue.QueueThread; -import static info.nightscout.androidaps.plugins.IobCobCalculator.IobCobCalculatorPlugin.getBucketedData; -import static info.nightscout.androidaps.plugins.IobCobCalculator.IobCobCalculatorPlugin.oldestDataAvailable; -import static info.nightscout.androidaps.plugins.IobCobCalculator.IobCobCalculatorPlugin.roundUpTime; - /** * Created by mike on 23.01.2018. */ @@ -68,14 +64,14 @@ public class IobCobThread extends Thread { Object dataLock = iobCobCalculatorPlugin.dataLock; - long oldestTimeWithData = oldestDataAvailable(); + long oldestTimeWithData = iobCobCalculatorPlugin.oldestDataAvailable(); synchronized (dataLock) { if (bgDataReload) { iobCobCalculatorPlugin.loadBgData(); iobCobCalculatorPlugin.createBucketedData(); } - List bucketed_data = getBucketedData(); + List bucketed_data = iobCobCalculatorPlugin.getBucketedData(); LongSparseArray autosensDataTable = iobCobCalculatorPlugin.getAutosensDataTable(); if (bucketed_data == null || bucketed_data.size() < 3) { @@ -83,7 +79,7 @@ public class IobCobThread extends Thread { return; } - long prevDataTime = roundUpTime(bucketed_data.get(bucketed_data.size() - 3).date); + long prevDataTime = iobCobCalculatorPlugin.roundUpTime(bucketed_data.get(bucketed_data.size() - 3).date); log.debug("Prev data time: " + new Date(prevDataTime).toLocaleString()); AutosensData previous = autosensDataTable.get(prevDataTime); // start from oldest to be able sub cob @@ -95,7 +91,7 @@ public class IobCobThread extends Thread { } // check if data already exists long bgTime = bucketed_data.get(i).date; - bgTime = roundUpTime(bgTime); + bgTime = iobCobCalculatorPlugin.roundUpTime(bgTime); if (bgTime > System.currentTimeMillis()) continue; Profile profile = MainApp.getConfigBuilder().getProfile(bgTime); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/OpenAPSAMAPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/OpenAPSAMAPlugin.java index 19cbecd469..bfe4fedf1f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/OpenAPSAMAPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/OpenAPSAMAPlugin.java @@ -183,7 +183,7 @@ public class OpenAPSAMAPlugin implements PluginBase, APSInterface { Date start = new Date(); Date startPart = new Date(); - IobTotal[] iobArray = IobCobCalculatorPlugin.calculateIobArrayInDia(); + IobTotal[] iobArray = IobCobCalculatorPlugin.getPlugin().calculateIobArrayInDia(); Profiler.log(log, "calculateIobArrayInDia()", startPart); startPart = new Date(); @@ -222,7 +222,7 @@ public class OpenAPSAMAPlugin implements PluginBase, APSInterface { startPart = new Date(); if (MainApp.getConfigBuilder().isAMAModeEnabled()) { - lastAutosensResult = IobCobCalculatorPlugin.detectSensitivityWithLock(IobCobCalculatorPlugin.oldestDataAvailable(), System.currentTimeMillis()); + lastAutosensResult = IobCobCalculatorPlugin.getPlugin().detectSensitivityWithLock(IobCobCalculatorPlugin.oldestDataAvailable(), System.currentTimeMillis()); } else { lastAutosensResult = new AutosensResult(); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/OpenAPSSMBPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/OpenAPSSMBPlugin.java index 2bed09d744..c992f0e739 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/OpenAPSSMBPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/OpenAPSSMBPlugin.java @@ -188,7 +188,7 @@ public class OpenAPSSMBPlugin implements PluginBase, APSInterface { Date start = new Date(); Date startPart = new Date(); - IobTotal[] iobArray = IobCobCalculatorPlugin.calculateIobArrayForSMB(); + IobTotal[] iobArray = IobCobCalculatorPlugin.getPlugin().calculateIobArrayForSMB(); Profiler.log(log, "calculateIobArrayInDia()", startPart); startPart = new Date(); @@ -224,7 +224,7 @@ public class OpenAPSSMBPlugin implements PluginBase, APSInterface { startPart = new Date(); if (MainApp.getConfigBuilder().isAMAModeEnabled()) { - lastAutosensResult = IobCobCalculatorPlugin.detectSensitivityWithLock(IobCobCalculatorPlugin.oldestDataAvailable(), System.currentTimeMillis()); + lastAutosensResult = IobCobCalculatorPlugin.getPlugin().detectSensitivityWithLock(IobCobCalculatorPlugin.oldestDataAvailable(), System.currentTimeMillis()); } else { lastAutosensResult = new AutosensResult(); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/WizardDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/WizardDialog.java index d74c9caadf..185ee5996d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/WizardDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/WizardDialog.java @@ -476,7 +476,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com // COB Double c_cob = 0d; if (cobCheckbox.isChecked()) { - AutosensData autosensData = IobCobCalculatorPlugin.getLastAutosensData("Wizard COB"); + AutosensData autosensData = IobCobCalculatorPlugin.getPlugin().getLastAutosensData("Wizard COB"); if(autosensData != null) { c_cob = autosensData.cob; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java index adde4474de..75d5c6bbb1 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java @@ -1276,7 +1276,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, // cob if (cobView != null) { // view must not exists String cobText = ""; - AutosensData autosensData = IobCobCalculatorPlugin.getLastAutosensData("Overview COB"); + AutosensData autosensData = IobCobCalculatorPlugin.getPlugin().getLastAutosensData("Overview COB"); if (autosensData != null) cobText = (int) autosensData.cob + " g"; cobView.setText(cobText); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/graphData/GraphData.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/graphData/GraphData.java index c84046b477..80e590dff8 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/graphData/GraphData.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/graphData/GraphData.java @@ -129,7 +129,7 @@ public class GraphData { double lastBaseBasal = 0; double lastTempBasal = 0; for (long time = fromTime; time < toTime; time += 60 * 1000L) { - BasalData basalData = IobCobCalculatorPlugin.getBasalData(time); + BasalData basalData = IobCobCalculatorPlugin.getPlugin().getBasalData(time); double baseBasalValue = basalData.basal; double absoluteLineValue = baseBasalValue; double tempBasalValue = 0; @@ -335,7 +335,7 @@ public class GraphData { Scale iobScale = new Scale(); for (long time = fromTime; time <= toTime; time += 5 * 60 * 1000L) { - double iob = IobCobCalculatorPlugin.calculateFromTreatmentsAndTempsSynchronized(time).iob; + double iob = IobCobCalculatorPlugin.getPlugin().calculateFromTreatmentsAndTempsSynchronized(time).iob; if (Math.abs(lastIob - iob) > 0.02) { if (Math.abs(lastIob - iob) > 0.2) iobArray.add(new ScaledDataPoint(time, lastIob, iobScale)); @@ -370,7 +370,7 @@ public class GraphData { Scale cobScale = new Scale(); for (long time = fromTime; time <= toTime; time += 5 * 60 * 1000L) { - AutosensData autosensData = IobCobCalculatorPlugin.getAutosensData(time); + AutosensData autosensData = IobCobCalculatorPlugin.getPlugin().getAutosensData(time); if (autosensData != null) { int cob = (int) autosensData.cob; if (cob != lastCob) { @@ -417,7 +417,7 @@ public class GraphData { Scale devScale = new Scale(); for (long time = fromTime; time <= toTime; time += 5 * 60 * 1000L) { - AutosensData autosensData = IobCobCalculatorPlugin.getAutosensData(time); + AutosensData autosensData = IobCobCalculatorPlugin.getPlugin().getAutosensData(time); if (autosensData != null) { int color = Color.BLACK; // "=" if (autosensData.pastSensitivity.equals("C")) color = Color.GRAY; @@ -455,7 +455,7 @@ public class GraphData { Scale ratioScale = new Scale(-1d); for (long time = fromTime; time <= toTime; time += 5 * 60 * 1000L) { - AutosensData autosensData = IobCobCalculatorPlugin.getAutosensData(time); + AutosensData autosensData = IobCobCalculatorPlugin.getPlugin().getAutosensData(time); if (autosensData != null) { ratioArray.add(new ScaledDataPoint(time, autosensData.autosensRatio, ratioScale)); maxRatioValueFound = Math.max(maxRatioValueFound, Math.abs(autosensData.autosensRatio)); @@ -489,7 +489,7 @@ public class GraphData { Scale dsMinScale = new Scale(); for (long time = fromTime; time <= toTime; time += 5 * 60 * 1000L) { - AutosensData autosensData = IobCobCalculatorPlugin.getAutosensData(time); + AutosensData autosensData = IobCobCalculatorPlugin.getPlugin().getAutosensData(time); if (autosensData != null) { dsMaxArray.add(new ScaledDataPoint(time, autosensData.slopeFromMaxDeviation, dsMaxScale)); dsMinArray.add(new ScaledDataPoint(time, autosensData.slopeFromMinDeviation, dsMinScale)); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/SensitivityAAPS/SensitivityAAPSPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/SensitivityAAPS/SensitivityAAPSPlugin.java index f45d6cec40..ebe8ddfe31 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/SensitivityAAPS/SensitivityAAPSPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/SensitivityAAPS/SensitivityAAPSPlugin.java @@ -105,7 +105,7 @@ public class SensitivityAAPSPlugin implements PluginBase, SensitivityInterface{ @Override public AutosensResult detectSensitivity(long fromTime, long toTime) { - LongSparseArray autosensDataTable = IobCobCalculatorPlugin.getAutosensDataTable(); + LongSparseArray autosensDataTable = IobCobCalculatorPlugin.getPlugin().getAutosensDataTable(); String age = SP.getString(R.string.key_age, ""); int defaultHours = 24; @@ -119,7 +119,7 @@ public class SensitivityAAPSPlugin implements PluginBase, SensitivityInterface{ return new AutosensResult(); } - AutosensData current = IobCobCalculatorPlugin.getAutosensData(toTime); // this is running inside lock already + AutosensData current = IobCobCalculatorPlugin.getPlugin().getAutosensData(toTime); // this is running inside lock already if (current == null) { log.debug("No autosens data available"); return new AutosensResult(); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/SensitivityOref0/SensitivityOref0Plugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/SensitivityOref0/SensitivityOref0Plugin.java index bf7d6ce8f5..eaabb4ecc9 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/SensitivityOref0/SensitivityOref0Plugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/SensitivityOref0/SensitivityOref0Plugin.java @@ -104,7 +104,7 @@ public class SensitivityOref0Plugin implements PluginBase, SensitivityInterface @Override public AutosensResult detectSensitivity(long fromTime, long toTime) { - LongSparseArray autosensDataTable = IobCobCalculatorPlugin.getAutosensDataTable(); + LongSparseArray autosensDataTable = IobCobCalculatorPlugin.getPlugin().getAutosensDataTable(); String age = SP.getString(R.string.key_age, ""); int defaultHours = 24; @@ -120,7 +120,7 @@ public class SensitivityOref0Plugin implements PluginBase, SensitivityInterface return new AutosensResult(); } - AutosensData current = IobCobCalculatorPlugin.getAutosensData(toTime); // this is running inside lock already + AutosensData current = IobCobCalculatorPlugin.getPlugin().getAutosensData(toTime); // this is running inside lock already if (current == null) { log.debug("No current autosens data available"); return new AutosensResult(); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/SensitivityWeightedAverage/SensitivityWeightedAveragePlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/SensitivityWeightedAverage/SensitivityWeightedAveragePlugin.java index 5f9e996a8a..91053e2654 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/SensitivityWeightedAverage/SensitivityWeightedAveragePlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/SensitivityWeightedAverage/SensitivityWeightedAveragePlugin.java @@ -101,7 +101,7 @@ public class SensitivityWeightedAveragePlugin implements PluginBase, Sensitivity @Override public AutosensResult detectSensitivity(long fromTime, long toTime) { - LongSparseArray autosensDataTable = IobCobCalculatorPlugin.getAutosensDataTable(); + LongSparseArray autosensDataTable = IobCobCalculatorPlugin.getPlugin().getAutosensDataTable(); String age = SP.getString(R.string.key_age, ""); int defaultHours = 24; @@ -116,7 +116,7 @@ public class SensitivityWeightedAveragePlugin implements PluginBase, Sensitivity return new AutosensResult(); } - AutosensData current = IobCobCalculatorPlugin.getAutosensData(toTime); // this is running inside lock already + AutosensData current = IobCobCalculatorPlugin.getPlugin().getAutosensData(toTime); // this is running inside lock already if (current == null) { if (Config.logAutosensData) log.debug("No autosens data available"); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsPlugin.java index dad53a0560..1842d3b504 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsPlugin.java @@ -252,7 +252,7 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface { } } - AutosensData autosensData = IobCobCalculatorPlugin.getLastAutosensDataSynchronized("getMealData()"); + AutosensData autosensData = IobCobCalculatorPlugin.getPlugin().getLastAutosensDataSynchronized("getMealData()"); if (autosensData != null) { result.mealCOB = autosensData.cob; result.slopeFromMinDeviation = autosensData.slopeFromMinDeviation; 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 4adec23560..74423fe7ac 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 @@ -663,7 +663,7 @@ public class WatchUpdaterService extends WearableListenerService implements private String generateCOBString() { String cobStringResult = "--"; - AutosensData autosensData = IobCobCalculatorPlugin.getLastAutosensData("WatcherUpdaterService"); + AutosensData autosensData = IobCobCalculatorPlugin.getPlugin().getLastAutosensData("WatcherUpdaterService"); if (autosensData != null) { cobStringResult = (int) autosensData.cob + "g"; }