public static void clearAll(){ List<CalibrationRequest> calibrationRequests = new Select() .from(CalibrationRequest.class) .execute(); if (calibrationRequests.size() >=1) { for (CalibrationRequest calibrationRequest : calibrationRequests) { calibrationRequest.delete(); } } }
public static List<Calibration> futureCalibrations() { double timestamp = new Date().getTime(); return new Select() .from(Calibration.class) .where("timestamp > " + timestamp) .orderBy("timestamp desc") .execute(); }
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 List<UserError> all() { return new Select() .from(UserError.class) .orderBy("timestamp desc") .execute(); }
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 BgReading findByUuid(String uuid) { return new Select() .from(BgReading.class) .where("uuid = ?", uuid) .executeSingle(); }
public static Calibration findByUuid(String uuid) { return new Select() .from(Calibration.class) .where("uuid = ?", uuid) .executeSingle(); }
public static List<BloodTest> latest(int number) { try { return new Select() .from(BloodTest.class) .orderBy("timestamp desc") .limit(number) .execute(); } catch (android.database.sqlite.SQLiteException e) { fixUpTable(); return new ArrayList<>(); } }
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 Prediction last() { try { return new Select() .from(Prediction.class) .orderBy("timestamp desc") .executeSingle(); } catch (android.database.sqlite.SQLiteException e) { updateDB(); return null; } }
public static PebbleMovement last() { try { return new Select() .from(PebbleMovement.class) .orderBy("timestamp desc") .executeSingle(); } catch (android.database.sqlite.SQLiteException e) { fixUpTable(); 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 List<Treatments> last(int num) { try { return new Select() .from(Treatments.class) .orderBy("timestamp desc") .limit(num) .execute(); } catch (android.database.sqlite.SQLiteException e) { fixUpTable(); return null; } }
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 List<Calibration> latest(int number) { Sensor sensor = Sensor.currentSensor(); if (sensor == null) { return null; } return new Select() .from(Calibration.class) .where("Sensor = ? ", sensor.getId()) .orderBy("timestamp desc") .limit(number) .execute(); }
public static List<BgReading> latest_by_size(int number) { final Sensor sensor = Sensor.currentSensor(); if (sensor == null) return null; return new Select() .from(BgReading.class) .where("Sensor = ? ", sensor.getId()) .where("raw_data != 0") .orderBy("timestamp desc") .limit(number) .execute(); }