private synchronized void syncHeartSensorData(DataMap dataMap, boolean bBenchmark) { Log.d(TAG, "syncHeartSensorData"); ArrayList<DataMap> entries = dataMap.getDataMapArrayList("entries"); long timeOfLastEntry = 0; Log.d(TAG, "syncHeartSensorData add to Table"); if (entries != null) { final Gson gson = JoH.defaultGsonInstance(); //final HeartRate pm = HeartRate.last(); Log.d(TAG, "syncHeartSensorData add Table entries count=" + entries.size()); for (DataMap entry : entries) { if (entry != null) { Log.d(TAG, "syncHeartSensorData add Table entry=" + entry); String record = entry.getString("entry"); if (record != null) { Log.d(TAG, "syncHeartSensorData add Table record=" + record); final HeartRate data = gson.fromJson(record, HeartRate.class); if (data != null) { timeOfLastEntry = (long) data.timestamp + 1; Log.d(TAG, "syncHeartSensorData add Entry Wear=" + data.toString() + " " + record); Log.d(TAG, "syncHeartSensorData WATCH data.metric=" + data.bpm + " timestamp=" + JoH.dateTimeText((long) data.timestamp)); if (!bBenchmark) data.saveit(); } } } } sendDataReceived(DATA_ITEM_RECEIVED_PATH, "DATA_RECEIVED_LOGS count=" + entries.size(), timeOfLastEntry, bBenchmark ? "BM" : "HEART", -1); } }
private synchronized void syncHeartSensorData(DataMap dataMap, boolean bBenchmark) { Log.d(TAG, "syncHeartSensorData"); ArrayList<DataMap> entries = dataMap.getDataMapArrayList("entries"); long timeOfLastEntry = 0; Log.d(TAG, "syncHeartSensorData add to Table"); if (entries != null) { final Gson gson = JoH.defaultGsonInstance(); //final HeartRate pm = HeartRate.last(); Log.d(TAG, "syncHeartSensorData add Table entries count=" + entries.size()); for (DataMap entry : entries) { if (entry != null) { Log.d(TAG, "syncHeartSensorData add Table entry=" + entry); String record = entry.getString("entry"); if (record != null) { Log.d(TAG, "syncHeartSensorData add Table record=" + record); final HeartRate data = gson.fromJson(record, HeartRate.class); if (data != null) { timeOfLastEntry = (long) data.timestamp + 1; Log.d(TAG, "syncHeartSensorData add Entry Wear=" + data.toString() + " " + record); Log.d(TAG, "syncHeartSensorData WATCH data.metric=" + data.bpm + " timestamp=" + JoH.dateTimeText((long) data.timestamp)); if (!bBenchmark) data.saveit(); } } } } sendDataReceived(DATA_ITEM_RECEIVED_PATH, "DATA_RECEIVED_LOGS count=" + entries.size(), timeOfLastEntry, bBenchmark ? "BM" : "HEART", -1); } }
sendDataReceived(DATA_ITEM_RECEIVED_PATH, "DATA_RECEIVED_LOGS count=" + entries.size(), timeOfLastEntry, bBenchmark ? "BM" : "STEP", -1);
sendDataReceived(DATA_ITEM_RECEIVED_PATH, "DATA_RECEIVED_LOGS count=" + entries.size(), timeOfLastEntry, bBenchmark ? "BM" : "STEP", -1);
Log.d(TAG, "syncLogData No records saved due to being duplicates! timeOfLastEntry=" + JoH.dateTimeText(timeOfLastEntry) + " count=" + entries.size()); sendDataReceived(DATA_ITEM_RECEIVED_PATH, "DATA_RECEIVED_LOGS count=" + entries.size(), timeOfLastEntry, bBenchmark ? "BM" : "LOG", watch_syncLogsRequested);
Log.d(TAG, "syncLogData No records saved due to being duplicates! timeOfLastEntry=" + JoH.dateTimeText(timeOfLastEntry) + " count=" + entries.size()); sendDataReceived(DATA_ITEM_RECEIVED_PATH, "DATA_RECEIVED_LOGS count=" + entries.size(), timeOfLastEntry, bBenchmark ? "BM" : "LOG", watch_syncLogsRequested);
sendDataReceived(DATA_ITEM_RECEIVED_PATH, "DATA_RECEIVED_LOGS count=" + entries.size(), timeOfLastEntry, bBenchmark ? "BM" : "TREATMENTS", -1);
sendDataReceived(DATA_ITEM_RECEIVED_PATH, "DATA_RECEIVED_LOGS count=" + entries.size(), timeOfLastEntry, bBenchmark ? "BM" : "TREATMENTS", -1);
private byte[] decompressBytes(String pathdesc, byte[] bytes, boolean bBenchmark) { byte[] decomprBytes; if ((bytes.length > 8) && (bytes[0] == (byte) 0x1F) && (bytes[1] == (byte) 0x8B) && (bytes[2] == (byte) 0x08) && (bytes[3] == (byte) 0x00)) { if (bBenchmark) { double benchmark_time = ts(); JoH.benchmark(null); decomprBytes = JoH.decompressBytesToBytes(bytes); String msg = pathdesc + " JoH.decompressBytesToBytes from length=" + bytes.length + " to length=" + decomprBytes.length; JoH.benchmark(msg); msg = msg + " " + (ts() - benchmark_time) + " ms"; sendDataReceived(DATA_ITEM_RECEIVED_PATH, msg, 1, "BM", -1);//"DATA_RECEIVED" return decomprBytes; } else { decomprBytes = JoH.decompressBytesToBytes(bytes); Log.d(TAG, pathdesc + " JoH.decompressBytesToBytes from length=" + bytes.length + " to length=" + decomprBytes.length); return decomprBytes; } } else { Log.d(TAG, "Benchmark: decompressBytesToBytes DataMap is not compressed! Process as normal. length=" + bytes.length); return bytes; } }
sendDataReceived(DATA_ITEM_RECEIVED_PATH, "DATA_RECEIVED_BGS count=" + entries.size(), timeOfLastBG, bBenchmark ? "BM" : "BG", -1);
private byte[] decompressBytes(String pathdesc, byte[] bytes, boolean bBenchmark) { byte[] decomprBytes; if ((bytes.length > 8) && (bytes[0] == (byte) 0x1F) && (bytes[1] == (byte) 0x8B) && (bytes[2] == (byte) 0x08) && (bytes[3] == (byte) 0x00)) { if (bBenchmark) { double benchmark_time = ts(); JoH.benchmark(null); decomprBytes = JoH.decompressBytesToBytes(bytes); String msg = pathdesc + " JoH.decompressBytesToBytes from length=" + bytes.length + " to length=" + decomprBytes.length; JoH.benchmark(msg); msg = msg + " " + (ts() - benchmark_time) + " ms"; sendDataReceived(DATA_ITEM_RECEIVED_PATH, msg, 1, "BM", -1);//"DATA_RECEIVED" return decomprBytes; } else { decomprBytes = JoH.decompressBytesToBytes(bytes); Log.d(TAG, pathdesc + " JoH.decompressBytesToBytes from length=" + bytes.length + " to length=" + decomprBytes.length); return decomprBytes; } } else { Log.d(TAG, "Benchmark: decompressBytesToBytes DataMap is not compressed! Process as normal. length=" + bytes.length); return bytes; } }
sendDataReceived(DATA_ITEM_RECEIVED_PATH, "DATA_RECEIVED_BGS count=" + entries.size(), timeOfLastBG, bBenchmark ? "BM" : "BG", -1);
sendDataReceived(DATA_ITEM_RECEIVED_PATH, "DATA_RECEIVED_BGS count=" + entries.size(), timeOfLastBG, "BG", -1);
sendDataReceived(DATA_ITEM_RECEIVED_PATH, "DATA_RECEIVED_BGS count=" + entries.size(), timeOfLastBG, "BG", -1);