Skip to content

Commit

Permalink
Store iob data in keystore
Browse files Browse the repository at this point in the history
  • Loading branch information
jamorham committed Feb 15, 2023
1 parent 12b1b52 commit 094b09c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1782,7 +1782,10 @@ private synchronized void addBgReadingValues(final boolean simple) {
df.setMaximumFractionDigits(2);
df.setMinimumIntegerDigits(1);
// iv.setLabel("IoB: " + df.format(iob.iob));
Home.updateStatusLine("iob", df.format(iob.iob));
val iobformatted = df.format(iob.iob);
keyStore.putS("last_iob", iobformatted);
keyStore.putL("last_iob_timestamp", JoH.tsl());
Home.updateStatusLine("iob", iobformatted);
// annotationValues.add(iv); // needs to be different value list so we can make annotation nicer

}
Expand Down Expand Up @@ -1818,18 +1821,20 @@ private synchronized void addBgReadingValues(final boolean simple) {
if (evaluation[0] > Profile.minimum_carb_recommendation) {
//PointValue iv = new HPointValue((double) fuzzed_timestamp, (float) (10 * bgScale));
//iv.setLabel("+Carbs: " + JoH.qs(evaluation[0], 0));
bwp_update = "\u224F" + " Carbs: " + JoH.qs(evaluation[0], 0);
bwp_update = "\u224F" + " Carbs: " + JoH.qs(evaluation[0], 0); // TODO I18n
//annotationValues.add(iv); // needs to be different value list so we can make annotation nicer
} else if (evaluation[1] > Profile.minimum_insulin_recommendation) {
//PointValue iv = new HPointValue((double) fuzzed_timestamp, (float) (11 * bgScale));
//iv.setLabel("+Insulin: " + JoH.qs(evaluation[1], 1));
keyStore.putS("bwp_last_insulin", JoH.qs(evaluation[1], 1) + ((low_occurs_at > 0) ? ("!") : ""));
keyStore.putL("bwp_last_insulin_timestamp", JoH.tsl());
bwp_update = "\u224F" + " Insulin: " + JoH.qs(evaluation[1], 1) + ((low_occurs_at > 0) ? (" " + "\u26A0") : ""); // warning symbol
bwp_update = "\u224F" + " Insulin: " + JoH.qs(evaluation[1], 1) + ((low_occurs_at > 0) ? (" " + "\u26A0") : ""); // warning symbol // TODO I18n
//annotationValues.add(iv); // needs to be different value list so we can make annotation nicer
}
}
}
keyStore.putS("last_bwp", bwp_update);
keyStore.putL("last_bwp_timestamp", JoH.tsl());
Home.updateStatusLine("bwp", bwp_update); // always send so we can blank if needed
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.eveningoutpost.dexdrip.store;

import java.util.HashMap;
import java.util.concurrent.ConcurrentHashMap;

/**
* Created by jamorham on 08/11/2017.
Expand All @@ -15,8 +16,8 @@
public class FastStore implements KeyStore {

private static final FastStore mFastStore = new FastStore();
private static final HashMap<String, String> stringStore = new HashMap<>();
private static final HashMap<String, Long> longStore = new HashMap<>();
private static final ConcurrentHashMap<String, String> stringStore = new ConcurrentHashMap<>();
private static final ConcurrentHashMap<String, Long> longStore = new ConcurrentHashMap<>();

// we trade substitution flexibility at the expense of some object creation

Expand Down

0 comments on commit 094b09c

Please sign in to comment.