public static LibreBlock createAndSave(String reference, long timestamp, byte[] blocks, int byte_start, boolean allowUpload) { final LibreBlock lb = create(reference, timestamp, blocks, byte_start); if (lb != null) { lb.save(); if(byte_start == 0 && blocks.length == 344 && allowUpload) { Log.d(TAG, "sending new item to queue"); UploaderQueue.newTransmitterDataEntry("create" ,lb); } } return lb; }
public static LibreBlock createAndSave(String reference, long timestamp, byte[] blocks, int byte_start) { return createAndSave(reference, timestamp, blocks, byte_start, false); }
public static void updateDB() { fixUpTable(schema, false); }
public static void UpdateBgVal(long timestamp, double calculated_value) { LibreBlock libreBlock = getForTimestamp(timestamp); if (libreBlock == null) { return; } Log.e(TAG, "Updating bg for timestamp " + timestamp); libreBlock.calculated_bg = calculated_value; libreBlock.save(); }
public static List<PointValue> getTrendDataPointsOld(boolean doMgdl, long start_time, long end_time) { // TODO needs to cut off if would exceed the current graph scope final float conversion_factor_mmol = (float) (doMgdl ? 1 : Constants.MGDL_TO_MMOLL); final LibreBlock libreBlock= LibreBlock.getLatestForTrend(start_time, end_time ); if (libreBlock != null) { final ArrayList<Float> bg_data = getLatestBg(libreBlock); if (bg_data != null) { final ArrayList<PointValue> points = new ArrayList<>(bg_data.size()); long time_offset = 0; for (Float bg : bg_data) { points.add(new PointValue((float) ((libreBlock.timestamp - time_offset) / FUZZER), bg * conversion_factor_mmol)); time_offset += Constants.MINUTE_IN_MS; } return points; } } return null; }
private static void updateMigrations() { Sensor.InitDb(context);//ensure database has already been initialized BgReading.updateDB(); LibreBlock.updateDB(); LibreData.updateDB(); }
private static LibreBlock create(String reference, long timestamp, byte[] blocks, int byte_start) { UserError.Log.e(TAG,"Backtrack: "+JoH.backTrace()); if (reference == null) { UserError.Log.e(TAG, "Cannot save block with null reference"); return null; } if (blocks == null) { UserError.Log.e(TAG, "Cannot save block with null data"); return null; } final LibreBlock lb = new LibreBlock(); lb.reference = reference; lb.blockbytes = blocks; lb.byte_start = byte_start; lb.byte_end = byte_start + blocks.length; lb.timestamp = timestamp; lb.uuid = UUID.randomUUID().toString(); return lb; }
public static void newBgReading(BgReading bgReading, boolean is_follower) { sendToPebble(); sendToWear(); sendToAmazfit(); sendToLeFun(); Notifications.start(); uploadToShare(bgReading, is_follower); textToSpeech(bgReading, null); LibreBlock.UpdateBgVal(bgReading.timestamp, bgReading.calculated_value); LockScreenWallPaper.setIfEnabled(); TidepoolEntry.newData(); }
final LibreBlock this_LibreBlock = LibreBlock.byid(up.reference_id); if (this_LibreBlock != null) { libreBlock.add(this_LibreBlock);
public static List<PointValue> getTrendDataPointsOld(boolean doMgdl, long start_time, long end_time) { // TODO needs to cut off if would exceed the current graph scope final float conversion_factor_mmol = (float) (doMgdl ? 1 : Constants.MGDL_TO_MMOLL); final LibreBlock libreBlock= LibreBlock.getLatestForTrend(start_time, end_time ); if (libreBlock != null) { final ArrayList<Float> bg_data = getLatestBg(libreBlock); if (bg_data != null) { final ArrayList<PointValue> points = new ArrayList<>(bg_data.size()); long time_offset = 0; for (Float bg : bg_data) { points.add(new PointValue((float) ((libreBlock.timestamp - time_offset) / FUZZER), bg * conversion_factor_mmol)); time_offset += Constants.MINUTE_IN_MS; } return points; } } return null; }
public static void UpdateBgVal(long timestamp, double calculated_value) { LibreBlock libreBlock = getForTimestamp(timestamp); if (libreBlock == null) { return; } Log.e(TAG, "Updating bg for timestamp " + timestamp); libreBlock.calculated_bg = calculated_value; libreBlock.save(); }
public void performAll() { migrateBGAlerts(); migrateToNewStyleRestUris(); BgReading.updateDB(); LibreBlock.updateDB(); LibreData.updateDB(); APStatus.updateDB(); Prediction.updateDB(); DesertSync.updateDB(); JoH.clearCache(); IncompatibleApps.notifyAboutIncompatibleApps(); CompatibleApps.notifyAboutCompatibleApps(); }
private static LibreBlock create(String reference, long timestamp, byte[] blocks, int byte_start) { UserError.Log.e(TAG,"Backtrack: "+JoH.backTrace()); if (reference == null) { UserError.Log.e(TAG, "Cannot save block with null reference"); return null; } if (blocks == null) { UserError.Log.e(TAG, "Cannot save block with null data"); return null; } final LibreBlock lb = new LibreBlock(); lb.reference = reference; lb.blockbytes = blocks; lb.byte_start = byte_start; lb.byte_end = byte_start + blocks.length; lb.timestamp = timestamp; lb.uuid = UUID.randomUUID().toString(); return lb; }
public static void newBgReading(BgReading bgReading, boolean is_follower) { sendToPebble(); sendToWear(); sendToAmazfit(); sendToLeFun(); Notifications.start(); uploadToShare(bgReading, is_follower); textToSpeech(bgReading, null); LibreBlock.UpdateBgVal(bgReading.timestamp, bgReading.calculated_value); LockScreenWallPaper.setIfEnabled(); TidepoolEntry.newData(); }
final LibreBlock this_LibreBlock = LibreBlock.byid(up.reference_id); if (this_LibreBlock != null) { libreBlock.add(this_LibreBlock);
public static LibreBlock getLatestForTrend() { return getLatestForTrend(JoH.tsl() - Constants.DAY_IN_MS, JoH.tsl() ); }
public static LibreBlock createAndSave(String reference, long timestamp, byte[] blocks, int byte_start, boolean allowUpload) { final LibreBlock lb = create(reference, timestamp, blocks, byte_start); if (lb != null) { lb.save(); if(byte_start == 0 && blocks.length == 344 && allowUpload) { Log.d(TAG, "sending new item to queue"); UploaderQueue.newTransmitterDataEntry("create" ,lb); } } return lb; }
public static void UpdateBgVal(long timestamp, double calculated_value) { LibreBlock libreBlock = getForTimestamp(timestamp); if (libreBlock == null) { return; } Log.e(TAG, "Updating bg for timestamp " + timestamp); libreBlock.calculated_bg = calculated_value; libreBlock.save(); }
public static LibreBlock createAndSave(String reference, long timestamp, byte[] blocks, int byte_start) { return createAndSave(reference, timestamp, blocks, byte_start, false); }
public void performAll() { migrateBGAlerts(); migrateToNewStyleRestUris(); BgReading.updateDB(); LibreBlock.updateDB(); LibreData.updateDB(); APStatus.updateDB(); Prediction.updateDB(); DesertSync.updateDB(); JoH.clearCache(); IncompatibleApps.notifyAboutIncompatibleApps(); CompatibleApps.notifyAboutCompatibleApps(); }