@NonNull public static String getLastStatusLine() { if (isCurrent()) { return PersistentStore.getString(EXTERNAL_STATUS_STORE); } else { return ""; // ignore if more than 8 hours old } }
@NonNull public static String getLastStatusLine() { if (isCurrent()) { return PersistentStore.getString(EXTERNAL_STATUS_STORE); } else { return ""; // ignore if more than 8 hours old } }
private static boolean isCurrent() { return isCurrent(getLastStatusLineTime()); }
private static boolean isCurrent() { return isCurrent(getLastStatusLineTime()); }
public static void update(long timestamp, String statusline, boolean receivedLocally) { if (statusline != null) { if (statusline.length() > MAX_LEN) { statusline = statusline.substring(0, MAX_LEN); } // store the data if (isCurrent(timestamp)) { PersistentStore.setString(EXTERNAL_STATUS_STORE, statusline); PersistentStore.setLong(EXTERNAL_STATUS_STORE_TIME, timestamp); } if (statusline.length() > 0) { final Integer percent = getTBRInt(); if (percent != null) { APStatus.createEfficientRecord(timestamp, percent); } else { UserError.Log.wtf(TAG, "Could not parse TBR from: " + statusline); } } // notify observers NewDataObserver.newExternalStatus(receivedLocally); } }
public static void update(long timestamp, String statusline, boolean receivedLocally) { if (statusline != null) { if (statusline.length() > MAX_LEN) { statusline = statusline.substring(0, MAX_LEN); } // store the data if (isCurrent(timestamp)) { PersistentStore.setString(EXTERNAL_STATUS_STORE, statusline); PersistentStore.setLong(EXTERNAL_STATUS_STORE_TIME, timestamp); } if (statusline.length() > 0) { final Integer percent = getTBRInt(); if (percent != null) { APStatus.createEfficientRecord(timestamp, percent); } else { UserError.Log.wtf(TAG, "Could not parse TBR from: " + statusline); } } // notify observers NewDataObserver.newExternalStatus(receivedLocally); } }