private void populateV1APIBGEntry(JSONArray array, BgReading record) throws Exception { JSONObject json = new JSONObject(); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", Locale.US); format.setTimeZone(TimeZone.getDefault()); json.put("device", getDeviceString(record)); if (record != null) {//KS json.put("date", record.timestamp); json.put("dateString", format.format(record.timestamp)); if(prefs.getBoolean("cloud_storage_api_use_best_glucose", false)){ json.put("sgv", (int) record.getDg_mgdl()); json.put("delta", new BigDecimal(record.getDg_slope() * 5 * 60 * 1000).setScale(3, BigDecimal.ROUND_HALF_UP)); json.put("direction", record.getDg_deltaName()); } else { json.put("sgv", (int) record.calculated_value); json.put("delta", new BigDecimal(record.currentSlope() * 5 * 60 * 1000).setScale(3, BigDecimal.ROUND_HALF_UP)); // jamorham for automation json.put("direction", record.slopeName()); } json.put("type", "sgv"); json.put("filtered", record.ageAdjustedFiltered() * 1000); json.put("unfiltered", record.usedRaw() * 1000); json.put("rssi", 100); json.put("noise", record.noiseValue()); json.put("sysTime", format.format(record.timestamp)); array.put(json); } else Log.e(TAG, "doRESTUploadTo BG record is null."); }
private void populateV1APIBGEntry(JSONArray array, BgReading record) throws Exception { JSONObject json = new JSONObject(); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", Locale.US); format.setTimeZone(TimeZone.getDefault()); json.put("device", getDeviceString(record)); if (record != null) {//KS json.put("date", record.timestamp); json.put("dateString", format.format(record.timestamp)); if(prefs.getBoolean("cloud_storage_api_use_best_glucose", false)){ json.put("sgv", (int) record.getDg_mgdl()); json.put("delta", new BigDecimal(record.getDg_slope() * 5 * 60 * 1000).setScale(3, BigDecimal.ROUND_HALF_UP)); json.put("direction", record.getDg_deltaName()); } else { json.put("sgv", (int) record.calculated_value); json.put("delta", new BigDecimal(record.currentSlope() * 5 * 60 * 1000).setScale(3, BigDecimal.ROUND_HALF_UP)); // jamorham for automation json.put("direction", record.slopeName()); } json.put("type", "sgv"); json.put("filtered", record.ageAdjustedFiltered() * 1000); json.put("unfiltered", record.usedRaw() * 1000); json.put("rssi", 100); json.put("noise", record.noiseValue()); json.put("sysTime", format.format(record.timestamp)); array.put(json); } else Log.e(TAG, "doRESTUploadTo BG record is null."); }
UserError.Log.e(TAG, "Could not pass delta to webservice as was invalid number"); item.put("direction", reading.getDg_deltaName()); item.put("noise", reading.noiseValue());
UserError.Log.e(TAG, "Could not pass delta to webservice as was invalid number"); item.put("direction", reading.getDg_deltaName()); item.put("noise", reading.noiseValue());