public static double estimated_bg(double timestamp) { timestamp = timestamp + BESTOFFSET; BgReading latest = BgReading.last(); if (latest == null) { return 0; } else { return (latest.a * timestamp * timestamp) + (latest.b * timestamp) + latest.c; } }
public static boolean gotData() { if (got_data) return true; if (BgReading.last(true) != null) { got_data = true; return true; } else { return false; } }
public static double estimated_bg(double timestamp) { timestamp = timestamp + BESTOFFSET; BgReading latest = BgReading.last(); if (latest == null) { return 0; } else { return (latest.a * timestamp * timestamp) + (latest.b * timestamp) + latest.c; } }
public static double estimated_bg(double timestamp) { timestamp = timestamp + BESTOFFSET; BgReading latest = BgReading.last(); if (latest == null) { return 0; } else { return (latest.a * timestamp * timestamp) + (latest.b * timestamp) + latest.c; } }
public static boolean gotData() { if (got_data) return true; if (BgReading.last(true) != null) { got_data = true; return true; } else { return false; } }
public static Long getTimeSinceLastReading() { BgReading bgReading = BgReading.last(); if (bgReading != null) { return (new Date().getTime() - bgReading.timestamp); } return (long) 0; }
public static Long getTimeSinceLastReading() { BgReading bgReading = BgReading.last(); if (bgReading != null) { return (new Date().getTime() - bgReading.timestamp); } return (long) 0; }
public static Long getTimeSinceLastReading() { BgReading bgReading = BgReading.last(); if (bgReading != null) { return (new Date().getTime() - bgReading.timestamp); } return (long) 0; }
private static void updateLastBg() { if ((last_bg == null) || JoH.ratelimit("follower-bg-status", 5)) { last_bg = BgReading.last(); } }
public static BgReading last() { return BgReading.last(Home.get_follower()); }
private static void updateLastBg() { if ((last_bg == null) || JoH.ratelimit("follower-bg-status", 5)) { last_bg = BgReading.last(); } }
public static void speakNow(long grace) { final BgReading bgReading = BgReading.last(); if (bgReading != null) { final BestGlucose.DisplayGlucose dg = BestGlucose.getDisplayGlucose(); if (dg != null) { BgToSpeech.realSpeakNow(dg.mgdl, dg.timestamp + grace, dg.delta_name); } else { BgToSpeech.realSpeakNow(bgReading.calculated_value, bgReading.timestamp + grace, bgReading.slopeName()); } } }
public static boolean isSlopeFlatEnough() { BgReading bgReading = BgReading.last(true); if (bgReading == null) return false; if (JoH.msSince(bgReading.timestamp) > Home.stale_data_millis()) { UserError.Log.d(TAG, "Slope cannot be flat enough as data is stale"); return false; } // TODO check if stale, check previous slope also, check that reading parameters also return isSlopeFlatEnough(bgReading); }
public static boolean isSlopeFlatEnough() { BgReading bgReading = BgReading.last(true); if (bgReading == null) return false; if (JoH.msSince(bgReading.timestamp) > Home.stale_data_millis()) { UserError.Log.d(TAG, "Slope cannot be flat enough as data is stale"); return false; } // TODO check if stale, check previous slope also, check that reading parameters also return isSlopeFlatEnough(bgReading); }
private void estimateAnticipateFromLinkedData() { final BgReading bg = BgReading.last(); if (bg != null && bg.timestamp > static_last_connected && JoH.msSince(bg.timestamp) < HOUR_IN_MS * 3) { final long ts = bg.timestamp - Constants.SECOND_IN_MS; UserError.Log.d(TAG, "Updating Sync Keeper with network learned timestamp: " + JoH.dateTimeText(ts)); DexSyncKeeper.store(transmitterID, ts); } }
public static boolean isSlopeFlatEnough() { BgReading bgReading = BgReading.last(true); if (bgReading == null) return false; if (JoH.msSince(bgReading.timestamp) > Home.stale_data_millis()) { UserError.Log.d(TAG, "Slope cannot be flat enough as data is stale"); return false; } // TODO check if stale, check previous slope also, check that reading parameters also return isSlopeFlatEnough(bgReading); }
private void estimateAnticipateFromLinkedData() { final BgReading bg = BgReading.last(); if (bg != null && bg.timestamp > static_last_connected && JoH.msSince(bg.timestamp) < HOUR_IN_MS * 3) { final long ts = bg.timestamp - Constants.SECOND_IN_MS; UserError.Log.d(TAG, "Updating Sync Keeper with network learned timestamp: " + JoH.dateTimeText(ts)); DexSyncKeeper.store(transmitterID, ts); } }
private void estimateAnticipateFromLinkedData() { final BgReading bg = BgReading.last(); if (bg != null && bg.timestamp > static_last_connected && JoH.msSince(bg.timestamp) < HOUR_IN_MS * 3) { final long ts = bg.timestamp - Constants.SECOND_IN_MS; UserError.Log.d(TAG, "Updating Sync Keeper with network learned timestamp: " + JoH.dateTimeText(ts)); DexSyncKeeper.store(transmitterID, ts); } }
private void sendData() { BgReading bg = BgReading.last(); if (bg != null) { forceGoogleApiConnect(); if (wear_integration) { final int battery = PowerStateReceiver.getBatteryLevel(getApplicationContext()); new SendToDataLayerThread(WEARABLE_DATA_PATH, googleApiClient).executeOnExecutor(xdrip.executor, dataMap(bg, mPrefs, new BgGraphBuilder(getApplicationContext()), battery)); } } }
private void sendData() { BgReading bg = BgReading.last(); if (bg != null) { forceGoogleApiConnect(); if (wear_integration) { final int battery = PowerStateReceiver.getBatteryLevel(getApplicationContext()); new SendToDataLayerThread(WEARABLE_DATA_PATH, googleApiClient).executeOnExecutor(xdrip.executor, dataMap(bg, mPrefs, new BgGraphBuilder(getApplicationContext()), battery)); } } }