Search in sources :

Example 1 with LibreTrendUtil

use of com.eveningoutpost.dexdrip.utils.LibreTrendUtil in project xDrip-plus by jamorham.

the class LibreAlarmReceiver method processReadingDataTransferObject.

public static void processReadingDataTransferObject(ReadingData readingData, long CaptureDateTime, String tagid, boolean allowUpload, byte[] patchUid, byte[] patchInfo) {
    Log.d(TAG, "Data that was recieved from librealarm is " + HexDump.dumpHexString(readingData.raw_data));
    // Save raw block record (we start from block 0)
    LibreBlock libreBlock = LibreBlock.createAndSave(tagid, CaptureDateTime, readingData.raw_data, 0, allowUpload, patchUid, patchInfo);
    if (Pref.getBooleanDefaultFalse("external_blukon_algorithm")) {
        if (readingData.raw_data == null) {
            Log.e(TAG, "Please update LibreAlarm to use OOP algorithm");
            JoH.static_toast_long(gs(R.string.please_update_librealarm_to_use_oop_algorithm));
            return;
        }
        LibreOOPAlgorithm.sendData(readingData.raw_data, CaptureDateTime, tagid);
        return;
    }
    LibreTrendUtil libreTrendUtil = LibreTrendUtil.getInstance();
    // Get the data for the last 24 hours, as this affects the cache.
    List<LibreTrendPoint> libreTrendPoints = libreTrendUtil.getData(JoH.tsl() - Constants.DAY_IN_MS, JoH.tsl(), true);
    readingData.ClearErrors(libreTrendPoints);
    boolean use_smoothed_data = Pref.getBooleanDefaultFalse("libre_use_smoothed_data");
    if (use_smoothed_data) {
        readingData.calculateSmoothDataImproved(libreTrendPoints);
    }
    CalculateFromDataTransferObject(readingData, use_smoothed_data, true);
}
Also used : LibreTrendUtil(com.eveningoutpost.dexdrip.utils.LibreTrendUtil) LibreBlock(com.eveningoutpost.dexdrip.Models.LibreBlock) LibreTrendPoint(com.eveningoutpost.dexdrip.utils.LibreTrendPoint)

Example 2 with LibreTrendUtil

use of com.eveningoutpost.dexdrip.utils.LibreTrendUtil in project xDrip by NightscoutFoundation.

the class LibreAlarmReceiver method processReadingDataTransferObject.

public static void processReadingDataTransferObject(ReadingData readingData, long CaptureDateTime, String tagid, boolean allowUpload, byte[] patchUid, byte[] patchInfo) {
    Log.d(TAG, "Data that was recieved from librealarm is " + HexDump.dumpHexString(readingData.raw_data));
    // Save raw block record (we start from block 0)
    LibreBlock libreBlock = LibreBlock.createAndSave(tagid, CaptureDateTime, readingData.raw_data, 0, allowUpload, patchUid, patchInfo);
    if (Pref.getBooleanDefaultFalse("external_blukon_algorithm")) {
        if (readingData.raw_data == null) {
            Log.e(TAG, "Please update LibreAlarm to use OOP algorithm");
            JoH.static_toast_long(gs(R.string.please_update_librealarm_to_use_oop_algorithm));
            return;
        }
        LibreOOPAlgorithm.sendData(readingData.raw_data, CaptureDateTime, tagid);
        return;
    }
    LibreTrendUtil libreTrendUtil = LibreTrendUtil.getInstance();
    // Get the data for the last 24 hours, as this affects the cache.
    List<LibreTrendPoint> libreTrendPoints = libreTrendUtil.getData(JoH.tsl() - Constants.DAY_IN_MS, JoH.tsl(), true);
    readingData.ClearErrors(libreTrendPoints);
    boolean use_smoothed_data = Pref.getBooleanDefaultFalse("libre_use_smoothed_data");
    if (use_smoothed_data) {
        readingData.calculateSmoothDataImproved(libreTrendPoints);
    }
    CalculateFromDataTransferObject(readingData, use_smoothed_data, true);
}
Also used : LibreTrendUtil(com.eveningoutpost.dexdrip.utils.LibreTrendUtil) LibreBlock(com.eveningoutpost.dexdrip.Models.LibreBlock) LibreTrendPoint(com.eveningoutpost.dexdrip.utils.LibreTrendPoint)

Aggregations

LibreBlock (com.eveningoutpost.dexdrip.Models.LibreBlock)2 LibreTrendPoint (com.eveningoutpost.dexdrip.utils.LibreTrendPoint)2 LibreTrendUtil (com.eveningoutpost.dexdrip.utils.LibreTrendUtil)2