public static BgReading readingNearTimeStamp(double startTime) { final double margin = (4 * 60 * 1000); final DecimalFormat df = new DecimalFormat("#"); df.setMaximumFractionDigits(1); return new Select() .from(BgReading.class) .where("timestamp >= " + df.format(startTime - margin)) .where("timestamp <= " + df.format(startTime + margin)) .where("calculated_value != 0") .where("raw_data != 0") .executeSingle(); }
public static BgReading readingNearTimeStamp(double startTime) { final double margin = (4 * 60 * 1000); final DecimalFormat df = new DecimalFormat("#"); df.setMaximumFractionDigits(1); return new Select() .from(BgReading.class) .where("timestamp >= " + df.format(startTime - margin)) .where("timestamp <= " + df.format(startTime + margin)) .where("calculated_value != 0") .where("raw_data != 0") .executeSingle(); }
public static Reminder byid(long id) { return new Select() .from(Reminder.class) .where("_ID = ?", id) .executeSingle(); }
public static synchronized ActiveBluetoothDevice first() { return new Select() .from(ActiveBluetoothDevice.class) .orderBy("_ID asc") .executeSingle(); }
public static TransmitterData findByUuid(String uuid) {//KS try { return new Select() .from(TransmitterData.class) .where("uuid = ?", uuid) .executeSingle(); } catch (Exception e) { Log.e(TAG,"findByUuid() Got exception on Select : "+e.toString()); return null; } }
public static TransmitterData byid(long id) { return new Select() .from(TransmitterData.class) .where("_ID = ?", id) .executeSingle(); }
public static BgReading findByUuid(String uuid) { return new Select() .from(BgReading.class) .where("uuid = ?", uuid) .executeSingle(); }
public static BloodTest getForPreciseTimestamp(long timestamp, long precision) { BloodTest bloodTest = new Select() .from(BloodTest.class) .where("timestamp <= ?", (timestamp + precision)) .where("timestamp >= ?", (timestamp - precision)) .orderBy("abs(timestamp - " + timestamp + ") asc") .executeSingle(); if ((bloodTest != null) && (Math.abs(bloodTest.timestamp - timestamp) < precision)) { return bloodTest; } return null; }
public static BloodTest byid(long id) { try { return new Select() .from(BloodTest.class) .where("_ID = ?", id) .executeSingle(); } catch (android.database.sqlite.SQLiteException e) { fixUpTable(); return null; } }
public static Calibration byuuid(String uuid) { if (uuid == null) return null; return new Select() .from(Calibration.class) .where("uuid = ?", uuid) .orderBy("_ID desc") .executeSingle(); }
public static BloodTest byUUID(String uuid) { if (uuid == null) return null; try { return new Select() .from(BloodTest.class) .where("uuid = ?", uuid) .executeSingle(); } catch (android.database.sqlite.SQLiteException e) { fixUpTable(); return null; } }
public static APStatus last() { try { return new Select() .from(APStatus.class) .orderBy("timestamp desc") .executeSingle(); } catch (android.database.sqlite.SQLiteException e) { updateDB(); return null; } }
public static BloodTest byUUID(String uuid) { if (uuid == null) return null; try { return new Select() .from(BloodTest.class) .where("uuid = ?", uuid) .executeSingle(); } catch (android.database.sqlite.SQLiteException e) { fixUpTable(); return null; } }
public static SensorSendQueue nextSensorJob() { SensorSendQueue job = new Select() .from(SensorSendQueue.class) .where("success =", false) .orderBy("_ID desc") .limit(1) .executeSingle(); return job; }
public static BgReading lastNoSenssor() { return new Select() .from(BgReading.class) .where("calculated_value != 0") .where("raw_data != 0") // .where("timestamp <= ?", JoH.tsl()) .orderBy("timestamp desc") .executeSingle(); }
public static Sensor getByUuid(String xDrip_sensor_uuid) { if(xDrip_sensor_uuid == null) { Log.e("SENSOR", "xDrip_sensor_uuid is null"); return null; } Log.d("SENSOR", "xDrip_sensor_uuid is " + xDrip_sensor_uuid); return new Select() .from(Sensor.class) .where("uuid = ?", xDrip_sensor_uuid) .executeSingle(); }
public static Calibration last() { Sensor sensor = Sensor.currentSensor(); if (sensor == null) { return null; } return new Select() .from(Calibration.class) .where("Sensor = ? ", sensor.getId()) .orderBy("timestamp desc") .executeSingle(); }
public static Calibration getByTimestamp(double timestamp) {//KS Sensor sensor = Sensor.currentSensor(); if(sensor == null) { return null; } return new Select() .from(Calibration.class) .where("Sensor = ? ", sensor.getId()) .where("timestamp = ?", timestamp) .executeSingle(); }
public static LibreBlock getLatestForTrend(long start_time, long end_time) { return new Select() .from(LibreBlock.class) .where("bytestart == 0") .where("byteend >= 344") .where("timestamp >= ?", start_time) .where("timestamp <= ?", end_time) .orderBy("timestamp desc") .executeSingle(); }
public static Calibration first() { Sensor sensor = Sensor.currentSensor(); return new Select() .from(Calibration.class) .where("Sensor = ? ", sensor.getId()) .where("slope_confidence != 0") .where("sensor_confidence != 0") .orderBy("timestamp asc") .executeSingle(); }