private static void processFromMessage(BgReadingMessage btm) { if ((btm != null) && (btm.uuid != null) && (btm.uuid.length() == 36)) { BgReading bg = byUUID(btm.uuid); if (bg != null) { // we already have this uuid and we don't have a circumstance to update the record, so quick return here return; } if (bg == null) { bg = getForPreciseTimestamp(Wire.get(btm.timestamp, BgReadingMessage.DEFAULT_TIMESTAMP), CLOSEST_READING_MS, false); if (bg != null) { UserError.Log.wtf(TAG, "Error matches a different uuid with the same timestamp: " + bg.uuid + " vs " + btm.uuid + " skipping!"); return; } bg = new BgReading(); } bg.timestamp = Wire.get(btm.timestamp, BgReadingMessage.DEFAULT_TIMESTAMP); bg.calculated_value = Wire.get(btm.calculated_value, BgReadingMessage.DEFAULT_CALCULATED_VALUE); bg.filtered_calculated_value = Wire.get(btm.filtered_calculated_value, BgReadingMessage.DEFAULT_FILTERED_CALCULATED_VALUE); bg.calibration_flag = Wire.get(btm.calibration_flag, BgReadingMessage.DEFAULT_CALIBRATION_FLAG); bg.raw_calculated = Wire.get(btm.raw_calculated, BgReadingMessage.DEFAULT_RAW_CALCULATED); bg.raw_data = Wire.get(btm.raw_data, BgReadingMessage.DEFAULT_RAW_DATA); bg.calculated_value_slope = Wire.get(btm.calculated_value_slope, BgReadingMessage.DEFAULT_CALCULATED_VALUE_SLOPE); bg.calibration_uuid = btm.calibration_uuid; bg.uuid = btm.uuid; bg.save(); } else { UserError.Log.wtf(TAG, "processFromMessage uuid is null or invalid"); } }
private static void processFromMessage(BgReadingMessage btm) { if ((btm != null) && (btm.uuid != null) && (btm.uuid.length() == 36)) { BgReading bg = byUUID(btm.uuid); if (bg != null) { // we already have this uuid and we don't have a circumstance to update the record, so quick return here return; } if (bg == null) { bg = getForPreciseTimestamp(Wire.get(btm.timestamp, BgReadingMessage.DEFAULT_TIMESTAMP), CLOSEST_READING_MS, false); if (bg != null) { UserError.Log.wtf(TAG, "Error matches a different uuid with the same timestamp: " + bg.uuid + " vs " + btm.uuid + " skipping!"); return; } bg = new BgReading(); } bg.timestamp = Wire.get(btm.timestamp, BgReadingMessage.DEFAULT_TIMESTAMP); bg.calculated_value = Wire.get(btm.calculated_value, BgReadingMessage.DEFAULT_CALCULATED_VALUE); bg.filtered_calculated_value = Wire.get(btm.filtered_calculated_value, BgReadingMessage.DEFAULT_FILTERED_CALCULATED_VALUE); bg.calibration_flag = Wire.get(btm.calibration_flag, BgReadingMessage.DEFAULT_CALIBRATION_FLAG); bg.raw_calculated = Wire.get(btm.raw_calculated, BgReadingMessage.DEFAULT_RAW_CALCULATED); bg.raw_data = Wire.get(btm.raw_data, BgReadingMessage.DEFAULT_RAW_DATA); bg.calculated_value_slope = Wire.get(btm.calculated_value_slope, BgReadingMessage.DEFAULT_CALCULATED_VALUE_SLOPE); bg.calibration_uuid = btm.calibration_uuid; bg.uuid = btm.uuid; bg.save(); } else { UserError.Log.wtf(TAG, "processFromMessage uuid is null or invalid"); } }
private static void processFromMessage(BgReadingMessage btm) { if ((btm != null) && (btm.uuid != null) && (btm.uuid.length() == 36)) { BgReading bg = byUUID(btm.uuid); if (bg != null) { // we already have this uuid and we don't have a circumstance to update the record, so quick return here return; } if (bg == null) { bg = getForPreciseTimestamp(Wire.get(btm.timestamp, BgReadingMessage.DEFAULT_TIMESTAMP), CLOSEST_READING_MS, false); if (bg != null) { UserError.Log.wtf(TAG, "Error matches a different uuid with the same timestamp: " + bg.uuid + " vs " + btm.uuid + " skipping!"); return; } bg = new BgReading(); } bg.timestamp = Wire.get(btm.timestamp, BgReadingMessage.DEFAULT_TIMESTAMP); bg.calculated_value = Wire.get(btm.calculated_value, BgReadingMessage.DEFAULT_CALCULATED_VALUE); bg.filtered_calculated_value = Wire.get(btm.filtered_calculated_value, BgReadingMessage.DEFAULT_FILTERED_CALCULATED_VALUE); bg.calibration_flag = Wire.get(btm.calibration_flag, BgReadingMessage.DEFAULT_CALIBRATION_FLAG); bg.raw_calculated = Wire.get(btm.raw_calculated, BgReadingMessage.DEFAULT_RAW_CALCULATED); bg.raw_data = Wire.get(btm.raw_data, BgReadingMessage.DEFAULT_RAW_DATA); bg.calculated_value_slope = Wire.get(btm.calculated_value_slope, BgReadingMessage.DEFAULT_CALCULATED_VALUE_SLOPE); bg.calibration_uuid = btm.calibration_uuid; bg.uuid = btm.uuid; bg.save(); } else { UserError.Log.wtf(TAG, "processFromMessage uuid is null or invalid"); } }