@Override public void run() { if (highestSequenceStore > 0) { PersistentStore.setLong(PREF_HIGHEST_SEQUENCE + mBluetoothDeviceAddress, highestSequenceStore); } } });
public static void resetDatabase() { Sensor.DeleteAndInitDb(xdrip.getAppContext()); PersistentStore.setLong(pref_last_send_previous, 0); PersistentStore.setLong(pref_last_send_previous_log, 0); PersistentStore.setLong(pref_last_send_previous_step_sensor, 0); PersistentStore.setLong(pref_last_send_previous_heart_sensor, 0); PersistentStore.setLong(pref_last_send_previous_treatments, 0); }
public static long incrementLong(String name) { final long val = getLong(name) + 1; setLong(name, val); return val; }
public static synchronized void clearRatelimit(final String name) { if (PersistentStore.getLong(name) > 0) { PersistentStore.setLong(name, 0); } if (rateLimits.containsKey(name)) { rateLimits.remove(name); } }
public static synchronized void clearRatelimit(final String name) { if (PersistentStore.getLong(name) > 0) { PersistentStore.setLong(name, 0); } if (rateLimits.containsKey(name)) { rateLimits.remove(name); } }
public static long incrementLong(String name) { final long val = getLong(name) + 1; setLong(name, val); return val; }
public static long incrementLong(String name) { final long val = getLong(name) + 1; setLong(name, val); return val; }
public static short getNext() { final short value = (short) (counter.incrementAndGet() % 9999); UserError.Log.d("Pendiq", "Returning sequence number: " + value); Inevitable.task("save-pendiq-counter", 5000, () -> PersistentStore.setLong(STORE_REF, counter.get())); return value; }
public static void resetTransmitterBatteryStatus() { final String transmitterId = Pref.getString("dex_txid", "NULL"); PersistentStore.setString(G5_BATTERY_MARKER + transmitterId, ""); PersistentStore.setLong(G5_BATTERY_FROM_MARKER + transmitterId, 0); PersistentStore.setLong(G5_BATTERY_LEVEL_MARKER + transmitterId, 0); PersistentStore.commit(); }
public static short getNext() { final short value = (short) (counter.incrementAndGet() % 9999); UserError.Log.d("Pendiq", "Returning sequence number: " + value); Inevitable.task("save-pendiq-counter", 5000, () -> PersistentStore.setLong(STORE_REF, counter.get())); return value; }
public static synchronized void addCalibration(final int glucose, long timestamp) { if (acceptCommands()) { // avoid double calibrations if (glucose == 0 || JoH.ratelimit("medtrum-calibration-cooldown", 5)) { PersistentStore.setLong(PENDING_CALIBRATION_TIMESTAMP, timestamp); PersistentStore.setLong(PENDING_CALIBRATION_GLUCOSE, glucose); if (glucose != 0) { Inevitable.task("medtrum-ping", 1000, MedtrumCollectionService::calibratePing); } } } }
private static void setHighestRecord(int m) { if (mBluetoothDeviceAddress == null) { UserError.Log.wtf(TAG, "Null BT address in setHighestRecord"); return; } if (getHighestRecord() >= m) return; // not higher PersistentStore.setLong(BluetoothGlucoseMeter.mBluetoothDeviceAddress + "-verio-highest", (long) m); }
public static void updateLast(long timestamp) { if ((static_last_timestamp == 0) && (transmitterID != null)) { final String ref = "last-ob1-data-" + transmitterID; if (PersistentStore.getLong(ref) == 0) { PersistentStore.setLong(ref, timestamp); if (!android_wear) JoH.playResourceAudio(R.raw.labbed_musical_chime); } } static_last_timestamp = timestamp; }
public static void updateLast(long timestamp) { if ((static_last_timestamp == 0) && (transmitterID != null)) { final String ref = "last-ob1-data-" + transmitterID; if (PersistentStore.getLong(ref) == 0) { PersistentStore.setLong(ref, timestamp); if (!android_wear) JoH.playResourceAudio(R.raw.labbed_musical_chime); } } static_last_timestamp = timestamp; }
private static void updateStreamedTillTimeForBackfill() { // interact with ListenerService if (JoH.areWeRunningOnAndroidWear()) { final String pref_last_send_previous = "last_send_previous"; final long last_send_previous = PersistentStore.getLong(pref_last_send_previous); PersistentStore.setLong(pref_last_send_previous, Math.min(last_send_previous, JoH.tsl() - MAX_BACKFILL_PERIOD_MS)); } }
private static void updateStreamedTillTimeForBackfill() { // interact with ListenerService if (JoH.areWeRunningOnAndroidWear()) { final String pref_last_send_previous = "last_send_previous"; final long last_send_previous = PersistentStore.getLong(pref_last_send_previous); PersistentStore.setLong(pref_last_send_previous, Math.min(last_send_previous, JoH.tsl() - MAX_BACKFILL_PERIOD_MS)); } }
public static void store(final String transmitterId, final long when) { if ((transmitterId == null) || (transmitterId.length() != 6)) { UserError.Log.e(TAG, "Invalid dex transmitter in store: " + transmitterId); return; } if (when < OLDEST_POSSIBLE) { UserError.Log.wtf(TAG, "Invalid timestamp to store: " + JoH.dateTimeText(when)); return; } PersistentStore.setLong(DEX_SYNC_STORE + transmitterId, when); UserError.Log.d(TAG, "Sync time updated to: " + JoH.dateTimeText(when)); }
public static void store(final String transmitterId, final long when) { if ((transmitterId == null) || (transmitterId.length() != 6)) { UserError.Log.e(TAG, "Invalid dex transmitter in store: " + transmitterId); return; } if (when < OLDEST_POSSIBLE) { UserError.Log.wtf(TAG, "Invalid timestamp to store: " + JoH.dateTimeText(when)); return; } PersistentStore.setLong(DEX_SYNC_STORE + transmitterId, when); UserError.Log.d(TAG, "Sync time updated to: " + JoH.dateTimeText(when)); }
public static void setLastEnd(final long when) { if (when > getLastEnd()) { PersistentStore.setLong(LAST_UPLOAD_END_PREF, when); UserError.Log.d(TAG, "Updating last end to: " + dateTimeText(when)); } else { UserError.Log.e(TAG, "Cannot set last end to: " + dateTimeText(when) + " vs " + dateTimeText(getLastEnd())); } }
public static void setLastEnd(final long when) { if (when > getLastEnd()) { PersistentStore.setLong(LAST_UPLOAD_END_PREF, when); UserError.Log.d(TAG, "Updating last end to: " + dateTimeText(when)); } else { UserError.Log.e(TAG, "Cannot set last end to: " + dateTimeText(when) + " vs " + dateTimeText(getLastEnd())); } }