use of com.google.android.gms.wearable.DataMap in project xDrip by NightscoutFoundation.
the class ListenerService method getBloodTests.
public static DataMap getBloodTests(long startTime) {
BloodTest last = BloodTest.last();
if (last != null) {
Log.d(TAG, "getBloodTests last.timestamp:" + JoH.dateTimeText(last.timestamp));
}
List<BloodTest> graph = BloodTest.latestForGraph(60, startTime);
if (!graph.isEmpty()) {
Log.d(TAG, "getBloodTests graph size=" + graph.size());
final ArrayList<DataMap> dataMaps = new ArrayList<>(graph.size());
DataMap entries = dataMapForWatchface(graph.get(0));
for (BloodTest data : graph) {
dataMaps.add(dataMapForWatchface(data));
}
entries.putDataMapArrayList("entries", dataMaps);
Log.d(TAG, "getBloodTests entries=" + entries);
return entries;
} else {
Log.d(TAG, "getBloodTests no entries for startTime=" + JoH.dateTimeText(startTime));
return null;
}
}
use of com.google.android.gms.wearable.DataMap in project xDrip by NightscoutFoundation.
the class ListenerService method sendReplyMsg.
private synchronized void sendReplyMsg(String msg, long last_timestamp, String path, boolean showToast, int length) {
Log.d(TAG, "sendReplyMsg msg=" + msg);
DataMap dataMap = new DataMap();
dataMap.putString("msg", msg);
dataMap.putLong("last_timestamp", last_timestamp);
// eg. START_COLLECTOR_PATH
dataMap.putString("action_path", path);
Log.d(TAG, "sendReplyMsg dataMap=" + dataMap);
if (showToast) {
sendLocalToast(msg, length);
}
sendData(WEARABLE_REPLYMSG_PATH, dataMap.toByteArray());
}
use of com.google.android.gms.wearable.DataMap in project xDrip by NightscoutFoundation.
the class ListenerService method getCalibrations.
public static DataMap getCalibrations(long startTime) {
Calibration last = Calibration.last();
if (last != null) {
Log.d(TAG, "getCalibrations last.timestamp:" + JoH.dateTimeText(last.timestamp));
}
List<Calibration> graph = Calibration.latestForGraph(60, startTime, Long.MAX_VALUE);
// calibrations = Calibration.latestForGraph(numValues, start - (3 * Constants.DAY_IN_MS), end);
if (!graph.isEmpty()) {
Log.d(TAG, "getCalibrations graph size=" + graph.size());
final ArrayList<DataMap> dataMaps = new ArrayList<>(graph.size());
DataMap entries = null;
// if (last.slope_confidence != 0) entries = dataMapForWatchface(last);
for (Calibration data : graph) {
if (data.slope_confidence != 0) {
if (entries == null) {
entries = dataMapForWatchface(data);
dataMaps.add(dataMapForWatchface(data));
} else
dataMaps.add(dataMapForWatchface(data));
}
}
if (entries != null) {
entries.putDataMapArrayList("entries", dataMaps);
Log.d(TAG, "getCalibrations entries=" + entries);
}
return entries;
} else
return null;
}
use of com.google.android.gms.wearable.DataMap in project xDrip by NightscoutFoundation.
the class ListenerService method dataMap.
private DataMap dataMap(TransmitterData bg) {
// KS
DataMap dataMap = new DataMap();
String json = bg.toS();
Log.d(TAG, "dataMap BG GSON: " + json);
dataMap.putString("bgs", json);
return dataMap;
}
use of com.google.android.gms.wearable.DataMap in project xDrip by NightscoutFoundation.
the class ListenerService method dataMapForWatchface.
private static DataMap dataMapForWatchface(BloodTest data) {
DataMap dataMap = new DataMap();
dataMap.putDouble("timestamp", data.timestamp);
dataMap.putDouble("sgvDouble", data.mgdl);
return dataMap;
}
Aggregations