unstatic IobCobCalculatorPlugin

This commit is contained in:
Milos Kozak 2018-02-12 19:49:08 +01:00
parent da777d9660
commit 0ab2d5ba38
13 changed files with 48 additions and 52 deletions

View file

@ -82,9 +82,9 @@ public class QuickWizardEntry {
double cob = 0d; double cob = 0d;
AutosensData autosensData; AutosensData autosensData;
if (_synchronized) if (_synchronized)
autosensData = IobCobCalculatorPlugin.getLastAutosensDataSynchronized("QuickWizard COB"); autosensData = IobCobCalculatorPlugin.getPlugin().getLastAutosensDataSynchronized("QuickWizard COB");
else else
autosensData = IobCobCalculatorPlugin.getLastAutosensData("QuickWizard COB"); autosensData = IobCobCalculatorPlugin.getPlugin().getLastAutosensData("QuickWizard COB");
if (autosensData != null && useCOB() == YES) { if (autosensData != null && useCOB() == YES) {
cob = autosensData.cob; cob = autosensData.cob;

View file

@ -41,19 +41,19 @@ import info.nightscout.utils.DateUtil;
public class IobCobCalculatorPlugin implements PluginBase { public class IobCobCalculatorPlugin implements PluginBase {
private static Logger log = LoggerFactory.getLogger(IobCobCalculatorPlugin.class); private static Logger log = LoggerFactory.getLogger(IobCobCalculatorPlugin.class);
private static LongSparseArray<IobTotal> iobTable = new LongSparseArray<>(); // oldest at index 0 private LongSparseArray<IobTotal> iobTable = new LongSparseArray<>(); // oldest at index 0
private static LongSparseArray<AutosensData> autosensDataTable = new LongSparseArray<>(); // oldest at index 0 private LongSparseArray<AutosensData> autosensDataTable = new LongSparseArray<>(); // oldest at index 0
private static LongSparseArray<BasalData> basalDataTable = new LongSparseArray<>(); // oldest at index 0 private LongSparseArray<BasalData> basalDataTable = new LongSparseArray<>(); // oldest at index 0
private static volatile List<BgReading> bgReadings = null; // newest at index 0 private volatile List<BgReading> bgReadings = null; // newest at index 0
private static volatile List<BgReading> bucketed_data = null; private volatile List<BgReading> 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; boolean stopCalculationTrigger = false;
IobCobThread thread = null; private IobCobThread thread = null;
private static IobCobCalculatorPlugin plugin = null; private static IobCobCalculatorPlugin plugin = null;
@ -63,11 +63,11 @@ public class IobCobCalculatorPlugin implements PluginBase {
return plugin; return plugin;
} }
public static LongSparseArray<AutosensData> getAutosensDataTable() { public LongSparseArray<AutosensData> getAutosensDataTable() {
return autosensDataTable; return autosensDataTable;
} }
public static List<BgReading> getBucketedData() { public List<BgReading> getBucketedData() {
return bucketed_data; return bucketed_data;
} }
@ -136,7 +136,7 @@ public class IobCobCalculatorPlugin implements PluginBase {
} }
@Nullable @Nullable
public static List<BgReading> getBucketedData(long fromTime) { public List<BgReading> getBucketedData(long fromTime) {
//log.debug("Locking getBucketedData"); //log.debug("Locking getBucketedData");
synchronized (dataLock) { synchronized (dataLock) {
if (bucketed_data == null) { if (bucketed_data == null) {
@ -154,7 +154,7 @@ public class IobCobCalculatorPlugin implements PluginBase {
return null; return null;
} }
private static int indexNewerThan(long time) { private int indexNewerThan(long time) {
for (int index = 0; index < bucketed_data.size(); index++) { for (int index = 0; index < bucketed_data.size(); index++) {
if (bucketed_data.get(index).date < time) if (bucketed_data.get(index).date < time)
return index - 1; return index - 1;
@ -332,13 +332,13 @@ public class IobCobCalculatorPlugin implements PluginBase {
return getBGDataFrom; return getBGDataFrom;
} }
public static IobTotal calculateFromTreatmentsAndTempsSynchronized(long time) { public IobTotal calculateFromTreatmentsAndTempsSynchronized(long time) {
synchronized (dataLock) { synchronized (dataLock) {
return calculateFromTreatmentsAndTemps(time); return calculateFromTreatmentsAndTemps(time);
} }
} }
public static IobTotal calculateFromTreatmentsAndTemps(long time) { public IobTotal calculateFromTreatmentsAndTemps(long time) {
long now = System.currentTimeMillis(); long now = System.currentTimeMillis();
time = roundUpTime(time); time = roundUpTime(time);
if (time < now && iobTable.get(time) != null) { if (time < now && iobTable.get(time) != null) {
@ -373,7 +373,7 @@ public class IobCobCalculatorPlugin implements PluginBase {
} }
@Nullable @Nullable
private static Long findPreviousTimeFromBucketedData(long time) { private Long findPreviousTimeFromBucketedData(long time) {
if (bucketed_data == null) if (bucketed_data == null)
return null; return null;
for (int index = 0; index < bucketed_data.size(); index++) { for (int index = 0; index < bucketed_data.size(); index++) {
@ -383,7 +383,7 @@ public class IobCobCalculatorPlugin implements PluginBase {
return null; return null;
} }
public static BasalData getBasalData(long time) { public BasalData getBasalData(long time) {
long now = System.currentTimeMillis(); long now = System.currentTimeMillis();
time = roundUpTime(time); time = roundUpTime(time);
BasalData retval = basalDataTable.get(time); BasalData retval = basalDataTable.get(time);
@ -409,7 +409,7 @@ public class IobCobCalculatorPlugin implements PluginBase {
} }
@Nullable @Nullable
public static AutosensData getAutosensData(long time) { public AutosensData getAutosensData(long time) {
synchronized (dataLock) { synchronized (dataLock) {
long now = System.currentTimeMillis(); long now = System.currentTimeMillis();
if (time > now) if (time > now)
@ -434,7 +434,7 @@ public class IobCobCalculatorPlugin implements PluginBase {
} }
@Nullable @Nullable
public static AutosensData getLastAutosensDataSynchronized(String reason) { public AutosensData getLastAutosensDataSynchronized(String reason) {
synchronized (dataLock) { synchronized (dataLock) {
return getLastAutosensData(reason); return getLastAutosensData(reason);
} }
@ -442,7 +442,7 @@ public class IobCobCalculatorPlugin implements PluginBase {
@Nullable @Nullable
public static AutosensData getLastAutosensData(String reason) { public AutosensData getLastAutosensData(String reason) {
if (autosensDataTable.size() < 1) { if (autosensDataTable.size() < 1) {
log.debug("AUTOSENSDATA null: autosensDataTable empty (" + reason + ")"); log.debug("AUTOSENSDATA null: autosensDataTable empty (" + reason + ")");
return null; return null;
@ -467,7 +467,7 @@ public class IobCobCalculatorPlugin implements PluginBase {
} }
} }
public static IobTotal[] calculateIobArrayInDia() { public IobTotal[] calculateIobArrayInDia() {
Profile profile = MainApp.getConfigBuilder().getProfile(); Profile profile = MainApp.getConfigBuilder().getProfile();
// predict IOB out to DIA plus 30m // predict IOB out to DIA plus 30m
long time = System.currentTimeMillis(); long time = System.currentTimeMillis();
@ -484,7 +484,7 @@ public class IobCobCalculatorPlugin implements PluginBase {
return array; return array;
} }
public static IobTotal[] calculateIobArrayForSMB() { public IobTotal[] calculateIobArrayForSMB() {
Profile profile = MainApp.getConfigBuilder().getProfile(); Profile profile = MainApp.getConfigBuilder().getProfile();
// predict IOB out to DIA plus 30m // predict IOB out to DIA plus 30m
long time = System.currentTimeMillis(); long time = System.currentTimeMillis();
@ -501,7 +501,7 @@ public class IobCobCalculatorPlugin implements PluginBase {
return array; return array;
} }
public static AutosensResult detectSensitivityWithLock(long fromTime, long toTime) { public AutosensResult detectSensitivityWithLock(long fromTime, long toTime) {
synchronized (dataLock) { synchronized (dataLock) {
return detectSensitivity(fromTime, toTime); return detectSensitivity(fromTime, toTime);
} }

View file

@ -22,10 +22,6 @@ import info.nightscout.androidaps.events.Event;
import info.nightscout.androidaps.plugins.IobCobCalculator.events.EventAutosensCalculationFinished; import info.nightscout.androidaps.plugins.IobCobCalculator.events.EventAutosensCalculationFinished;
import info.nightscout.androidaps.queue.QueueThread; 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. * Created by mike on 23.01.2018.
*/ */
@ -68,14 +64,14 @@ public class IobCobThread extends Thread {
Object dataLock = iobCobCalculatorPlugin.dataLock; Object dataLock = iobCobCalculatorPlugin.dataLock;
long oldestTimeWithData = oldestDataAvailable(); long oldestTimeWithData = iobCobCalculatorPlugin.oldestDataAvailable();
synchronized (dataLock) { synchronized (dataLock) {
if (bgDataReload) { if (bgDataReload) {
iobCobCalculatorPlugin.loadBgData(); iobCobCalculatorPlugin.loadBgData();
iobCobCalculatorPlugin.createBucketedData(); iobCobCalculatorPlugin.createBucketedData();
} }
List<BgReading> bucketed_data = getBucketedData(); List<BgReading> bucketed_data = iobCobCalculatorPlugin.getBucketedData();
LongSparseArray<AutosensData> autosensDataTable = iobCobCalculatorPlugin.getAutosensDataTable(); LongSparseArray<AutosensData> autosensDataTable = iobCobCalculatorPlugin.getAutosensDataTable();
if (bucketed_data == null || bucketed_data.size() < 3) { if (bucketed_data == null || bucketed_data.size() < 3) {
@ -83,7 +79,7 @@ public class IobCobThread extends Thread {
return; 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()); log.debug("Prev data time: " + new Date(prevDataTime).toLocaleString());
AutosensData previous = autosensDataTable.get(prevDataTime); AutosensData previous = autosensDataTable.get(prevDataTime);
// start from oldest to be able sub cob // start from oldest to be able sub cob
@ -95,7 +91,7 @@ public class IobCobThread extends Thread {
} }
// check if data already exists // check if data already exists
long bgTime = bucketed_data.get(i).date; long bgTime = bucketed_data.get(i).date;
bgTime = roundUpTime(bgTime); bgTime = iobCobCalculatorPlugin.roundUpTime(bgTime);
if (bgTime > System.currentTimeMillis()) if (bgTime > System.currentTimeMillis())
continue; continue;
Profile profile = MainApp.getConfigBuilder().getProfile(bgTime); Profile profile = MainApp.getConfigBuilder().getProfile(bgTime);

View file

@ -183,7 +183,7 @@ public class OpenAPSAMAPlugin implements PluginBase, APSInterface {
Date start = new Date(); Date start = new Date();
Date startPart = new Date(); Date startPart = new Date();
IobTotal[] iobArray = IobCobCalculatorPlugin.calculateIobArrayInDia(); IobTotal[] iobArray = IobCobCalculatorPlugin.getPlugin().calculateIobArrayInDia();
Profiler.log(log, "calculateIobArrayInDia()", startPart); Profiler.log(log, "calculateIobArrayInDia()", startPart);
startPart = new Date(); startPart = new Date();
@ -222,7 +222,7 @@ public class OpenAPSAMAPlugin implements PluginBase, APSInterface {
startPart = new Date(); startPart = new Date();
if (MainApp.getConfigBuilder().isAMAModeEnabled()) { if (MainApp.getConfigBuilder().isAMAModeEnabled()) {
lastAutosensResult = IobCobCalculatorPlugin.detectSensitivityWithLock(IobCobCalculatorPlugin.oldestDataAvailable(), System.currentTimeMillis()); lastAutosensResult = IobCobCalculatorPlugin.getPlugin().detectSensitivityWithLock(IobCobCalculatorPlugin.oldestDataAvailable(), System.currentTimeMillis());
} else { } else {
lastAutosensResult = new AutosensResult(); lastAutosensResult = new AutosensResult();
} }

View file

@ -188,7 +188,7 @@ public class OpenAPSSMBPlugin implements PluginBase, APSInterface {
Date start = new Date(); Date start = new Date();
Date startPart = new Date(); Date startPart = new Date();
IobTotal[] iobArray = IobCobCalculatorPlugin.calculateIobArrayForSMB(); IobTotal[] iobArray = IobCobCalculatorPlugin.getPlugin().calculateIobArrayForSMB();
Profiler.log(log, "calculateIobArrayInDia()", startPart); Profiler.log(log, "calculateIobArrayInDia()", startPart);
startPart = new Date(); startPart = new Date();
@ -224,7 +224,7 @@ public class OpenAPSSMBPlugin implements PluginBase, APSInterface {
startPart = new Date(); startPart = new Date();
if (MainApp.getConfigBuilder().isAMAModeEnabled()) { if (MainApp.getConfigBuilder().isAMAModeEnabled()) {
lastAutosensResult = IobCobCalculatorPlugin.detectSensitivityWithLock(IobCobCalculatorPlugin.oldestDataAvailable(), System.currentTimeMillis()); lastAutosensResult = IobCobCalculatorPlugin.getPlugin().detectSensitivityWithLock(IobCobCalculatorPlugin.oldestDataAvailable(), System.currentTimeMillis());
} else { } else {
lastAutosensResult = new AutosensResult(); lastAutosensResult = new AutosensResult();
} }

View file

@ -476,7 +476,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
// COB // COB
Double c_cob = 0d; Double c_cob = 0d;
if (cobCheckbox.isChecked()) { if (cobCheckbox.isChecked()) {
AutosensData autosensData = IobCobCalculatorPlugin.getLastAutosensData("Wizard COB"); AutosensData autosensData = IobCobCalculatorPlugin.getPlugin().getLastAutosensData("Wizard COB");
if(autosensData != null) { if(autosensData != null) {
c_cob = autosensData.cob; c_cob = autosensData.cob;

View file

@ -1276,7 +1276,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
// cob // cob
if (cobView != null) { // view must not exists if (cobView != null) { // view must not exists
String cobText = ""; String cobText = "";
AutosensData autosensData = IobCobCalculatorPlugin.getLastAutosensData("Overview COB"); AutosensData autosensData = IobCobCalculatorPlugin.getPlugin().getLastAutosensData("Overview COB");
if (autosensData != null) if (autosensData != null)
cobText = (int) autosensData.cob + " g"; cobText = (int) autosensData.cob + " g";
cobView.setText(cobText); cobView.setText(cobText);

View file

@ -129,7 +129,7 @@ public class GraphData {
double lastBaseBasal = 0; double lastBaseBasal = 0;
double lastTempBasal = 0; double lastTempBasal = 0;
for (long time = fromTime; time < toTime; time += 60 * 1000L) { 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 baseBasalValue = basalData.basal;
double absoluteLineValue = baseBasalValue; double absoluteLineValue = baseBasalValue;
double tempBasalValue = 0; double tempBasalValue = 0;
@ -335,7 +335,7 @@ public class GraphData {
Scale iobScale = new Scale(); Scale iobScale = new Scale();
for (long time = fromTime; time <= toTime; time += 5 * 60 * 1000L) { 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.02) {
if (Math.abs(lastIob - iob) > 0.2) if (Math.abs(lastIob - iob) > 0.2)
iobArray.add(new ScaledDataPoint(time, lastIob, iobScale)); iobArray.add(new ScaledDataPoint(time, lastIob, iobScale));
@ -370,7 +370,7 @@ public class GraphData {
Scale cobScale = new Scale(); Scale cobScale = new Scale();
for (long time = fromTime; time <= toTime; time += 5 * 60 * 1000L) { for (long time = fromTime; time <= toTime; time += 5 * 60 * 1000L) {
AutosensData autosensData = IobCobCalculatorPlugin.getAutosensData(time); AutosensData autosensData = IobCobCalculatorPlugin.getPlugin().getAutosensData(time);
if (autosensData != null) { if (autosensData != null) {
int cob = (int) autosensData.cob; int cob = (int) autosensData.cob;
if (cob != lastCob) { if (cob != lastCob) {
@ -417,7 +417,7 @@ public class GraphData {
Scale devScale = new Scale(); Scale devScale = new Scale();
for (long time = fromTime; time <= toTime; time += 5 * 60 * 1000L) { for (long time = fromTime; time <= toTime; time += 5 * 60 * 1000L) {
AutosensData autosensData = IobCobCalculatorPlugin.getAutosensData(time); AutosensData autosensData = IobCobCalculatorPlugin.getPlugin().getAutosensData(time);
if (autosensData != null) { if (autosensData != null) {
int color = Color.BLACK; // "=" int color = Color.BLACK; // "="
if (autosensData.pastSensitivity.equals("C")) color = Color.GRAY; if (autosensData.pastSensitivity.equals("C")) color = Color.GRAY;
@ -455,7 +455,7 @@ public class GraphData {
Scale ratioScale = new Scale(-1d); Scale ratioScale = new Scale(-1d);
for (long time = fromTime; time <= toTime; time += 5 * 60 * 1000L) { for (long time = fromTime; time <= toTime; time += 5 * 60 * 1000L) {
AutosensData autosensData = IobCobCalculatorPlugin.getAutosensData(time); AutosensData autosensData = IobCobCalculatorPlugin.getPlugin().getAutosensData(time);
if (autosensData != null) { if (autosensData != null) {
ratioArray.add(new ScaledDataPoint(time, autosensData.autosensRatio, ratioScale)); ratioArray.add(new ScaledDataPoint(time, autosensData.autosensRatio, ratioScale));
maxRatioValueFound = Math.max(maxRatioValueFound, Math.abs(autosensData.autosensRatio)); maxRatioValueFound = Math.max(maxRatioValueFound, Math.abs(autosensData.autosensRatio));
@ -489,7 +489,7 @@ public class GraphData {
Scale dsMinScale = new Scale(); Scale dsMinScale = new Scale();
for (long time = fromTime; time <= toTime; time += 5 * 60 * 1000L) { for (long time = fromTime; time <= toTime; time += 5 * 60 * 1000L) {
AutosensData autosensData = IobCobCalculatorPlugin.getAutosensData(time); AutosensData autosensData = IobCobCalculatorPlugin.getPlugin().getAutosensData(time);
if (autosensData != null) { if (autosensData != null) {
dsMaxArray.add(new ScaledDataPoint(time, autosensData.slopeFromMaxDeviation, dsMaxScale)); dsMaxArray.add(new ScaledDataPoint(time, autosensData.slopeFromMaxDeviation, dsMaxScale));
dsMinArray.add(new ScaledDataPoint(time, autosensData.slopeFromMinDeviation, dsMinScale)); dsMinArray.add(new ScaledDataPoint(time, autosensData.slopeFromMinDeviation, dsMinScale));

View file

@ -105,7 +105,7 @@ public class SensitivityAAPSPlugin implements PluginBase, SensitivityInterface{
@Override @Override
public AutosensResult detectSensitivity(long fromTime, long toTime) { public AutosensResult detectSensitivity(long fromTime, long toTime) {
LongSparseArray<AutosensData> autosensDataTable = IobCobCalculatorPlugin.getAutosensDataTable(); LongSparseArray<AutosensData> autosensDataTable = IobCobCalculatorPlugin.getPlugin().getAutosensDataTable();
String age = SP.getString(R.string.key_age, ""); String age = SP.getString(R.string.key_age, "");
int defaultHours = 24; int defaultHours = 24;
@ -119,7 +119,7 @@ public class SensitivityAAPSPlugin implements PluginBase, SensitivityInterface{
return new AutosensResult(); 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 (current == null) {
log.debug("No autosens data available"); log.debug("No autosens data available");
return new AutosensResult(); return new AutosensResult();

View file

@ -104,7 +104,7 @@ public class SensitivityOref0Plugin implements PluginBase, SensitivityInterface
@Override @Override
public AutosensResult detectSensitivity(long fromTime, long toTime) { public AutosensResult detectSensitivity(long fromTime, long toTime) {
LongSparseArray<AutosensData> autosensDataTable = IobCobCalculatorPlugin.getAutosensDataTable(); LongSparseArray<AutosensData> autosensDataTable = IobCobCalculatorPlugin.getPlugin().getAutosensDataTable();
String age = SP.getString(R.string.key_age, ""); String age = SP.getString(R.string.key_age, "");
int defaultHours = 24; int defaultHours = 24;
@ -120,7 +120,7 @@ public class SensitivityOref0Plugin implements PluginBase, SensitivityInterface
return new AutosensResult(); 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 (current == null) {
log.debug("No current autosens data available"); log.debug("No current autosens data available");
return new AutosensResult(); return new AutosensResult();

View file

@ -101,7 +101,7 @@ public class SensitivityWeightedAveragePlugin implements PluginBase, Sensitivity
@Override @Override
public AutosensResult detectSensitivity(long fromTime, long toTime) { public AutosensResult detectSensitivity(long fromTime, long toTime) {
LongSparseArray<AutosensData> autosensDataTable = IobCobCalculatorPlugin.getAutosensDataTable(); LongSparseArray<AutosensData> autosensDataTable = IobCobCalculatorPlugin.getPlugin().getAutosensDataTable();
String age = SP.getString(R.string.key_age, ""); String age = SP.getString(R.string.key_age, "");
int defaultHours = 24; int defaultHours = 24;
@ -116,7 +116,7 @@ public class SensitivityWeightedAveragePlugin implements PluginBase, Sensitivity
return new AutosensResult(); 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 (current == null) {
if (Config.logAutosensData) if (Config.logAutosensData)
log.debug("No autosens data available"); log.debug("No autosens data available");

View file

@ -252,7 +252,7 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
} }
} }
AutosensData autosensData = IobCobCalculatorPlugin.getLastAutosensDataSynchronized("getMealData()"); AutosensData autosensData = IobCobCalculatorPlugin.getPlugin().getLastAutosensDataSynchronized("getMealData()");
if (autosensData != null) { if (autosensData != null) {
result.mealCOB = autosensData.cob; result.mealCOB = autosensData.cob;
result.slopeFromMinDeviation = autosensData.slopeFromMinDeviation; result.slopeFromMinDeviation = autosensData.slopeFromMinDeviation;

View file

@ -663,7 +663,7 @@ public class WatchUpdaterService extends WearableListenerService implements
private String generateCOBString() { private String generateCOBString() {
String cobStringResult = "--"; String cobStringResult = "--";
AutosensData autosensData = IobCobCalculatorPlugin.getLastAutosensData("WatcherUpdaterService"); AutosensData autosensData = IobCobCalculatorPlugin.getPlugin().getLastAutosensData("WatcherUpdaterService");
if (autosensData != null) { if (autosensData != null) {
cobStringResult = (int) autosensData.cob + "g"; cobStringResult = (int) autosensData.cob + "g";
} }