Java Code Examples for com.eveningoutpost.dexdrip.ImportedLibraries.dexcom.records.EGVRecord#getBGValue()

The following examples show how to use com.eveningoutpost.dexdrip.ImportedLibraries.dexcom.records.EGVRecord#getBGValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BgReading.java    From xDrip-Experimental with GNU General Public License v3.0 6 votes vote down vote up
public static void create(EGVRecord egvRecord, long addativeOffset, Context context) {
    BgReading bgReading = BgReading.getForTimestamp(egvRecord.getSystemTime().getTime() + addativeOffset);
    Log.i(TAG, "create: Looking for BG reading to tag this thing to: " + egvRecord.getBGValue());
    if(bgReading != null) {
        bgReading.calculated_value = egvRecord.getBGValue();
        if (egvRecord.getBGValue() <= 13) {
            Calibration calibration = bgReading.calibration;
            double firstAdjSlope = calibration.first_slope + (calibration.first_decay * (Math.ceil(new Date().getTime() - calibration.timestamp)/(1000 * 60 * 10)));
            double calSlope = (calibration.first_scale / firstAdjSlope)*1000;
            double calIntercept = ((calibration.first_scale * calibration.first_intercept) / firstAdjSlope)*-1;
            bgReading.raw_calculated = (((calSlope * bgReading.raw_data) + calIntercept) - 5);
        }
        Log.i(TAG, "create: NEW VALUE CALCULATED AT: " + bgReading.calculated_value);
        Pair<Double, Boolean> slopePair = BgReading.slopefromName(egvRecord.getTrend().friendlyTrendName());
        bgReading.calculated_value_slope = slopePair.first;
        bgReading.hide_slope = slopePair.second;
        bgReading.noise = egvRecord.noiseValue();
        bgReading.save();
        bgReading.find_new_curve();
        bgReading.find_new_raw_curve();
        context.startService(new Intent(context, Notifications.class));
        BgSendQueue.handleNewBgReading(bgReading, "create", context);
    }
}
 
Example 2
Source File: BgReading.java    From xDrip with GNU General Public License v3.0 6 votes vote down vote up
public static void create(EGVRecord egvRecord, long addativeOffset, Context context) {
    BgReading bgReading = BgReading.getForTimestamp(egvRecord.getSystemTime().getTime() + addativeOffset);
    Log.w(TAG, "Looking for BG reading to tag this thing to: " + egvRecord.getBGValue());
    if(bgReading != null) {
        bgReading.calculated_value = egvRecord.getBGValue();
        if (egvRecord.getBGValue() <= 13) {
            Calibration calibration = bgReading.calibration;
            double firstAdjSlope = calibration.first_slope + (calibration.first_decay * (Math.ceil(new Date().getTime() - calibration.timestamp)/(1000 * 60 * 10)));
            double calSlope = (calibration.first_scale / firstAdjSlope)*1000;
            double calIntercept = ((calibration.first_scale * calibration.first_intercept) / firstAdjSlope)*-1;
            bgReading.raw_calculated = (((calSlope * bgReading.raw_data) + calIntercept) - 5);
            bgReading.noise = egvRecord.noiseValue();
        }
        Log.w(TAG, "NEW VALUE CALCULATED AT: " + bgReading.calculated_value);
        bgReading.calculated_value_slope = bgReading.slopefromName(egvRecord.getTrend().friendlyTrendName());
        if(egvRecord.getTrend().friendlyTrendName().compareTo("NOT_COMPUTABLE") == 0 || egvRecord.getTrend().friendlyTrendName().compareTo("OUT_OF_RANGE") == 0) {
            bgReading.hide_slope = true;
        }
        bgReading.save();
        bgReading.find_new_curve();
        bgReading.find_new_raw_curve();
        Notifications.notificationSetter(context);
        BgSendQueue.addToQueue(bgReading, "create", context);
    }
}
 
Example 3
Source File: BgReading.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
public static void create(EGVRecord egvRecord, long addativeOffset, Context context) {
    BgReading bgReading = BgReading.getForTimestamp(egvRecord.getSystemTime().getTime() + addativeOffset);
    Log.i(TAG, "create: Looking for BG reading to tag this thing to: " + egvRecord.getBGValue());
    if (bgReading != null) {
        bgReading.calculated_value = egvRecord.getBGValue();
        if (egvRecord.getBGValue() <= 13) {
            Calibration calibration = bgReading.calibration;
            double firstAdjSlope = calibration.first_slope + (calibration.first_decay * (Math.ceil(new Date().getTime() - calibration.timestamp) / (1000 * 60 * 10)));
            double calSlope = (calibration.first_scale / firstAdjSlope) * 1000;
            double calIntercept = ((calibration.first_scale * calibration.first_intercept) / firstAdjSlope) * -1;
            bgReading.raw_calculated = (((calSlope * bgReading.raw_data) + calIntercept) - 5);
        }
        Log.i(TAG, "create: NEW VALUE CALCULATED AT: " + bgReading.calculated_value);
        bgReading.calculated_value_slope = bgReading.slopefromName(egvRecord.getTrend().friendlyTrendName());
        bgReading.noise = egvRecord.noiseValue();
        String friendlyName = egvRecord.getTrend().friendlyTrendName();
        if (friendlyName.compareTo("NONE") == 0 ||
                friendlyName.compareTo("NOT_COMPUTABLE") == 0 ||
                friendlyName.compareTo("NOT COMPUTABLE") == 0 ||
                friendlyName.compareTo("OUT OF RANGE") == 0 ||
                friendlyName.compareTo("OUT_OF_RANGE") == 0) {
            bgReading.hide_slope = true;
        }
        bgReading.save();
        bgReading.find_new_curve();
        bgReading.find_new_raw_curve();
        //context.startService(new Intent(context, Notifications.class));
        Notifications.start(); // this may not be needed as it is duplicated in handleNewBgReading
        BgSendQueue.handleNewBgReading(bgReading, "create", context);
    }
}
 
Example 4
Source File: BgReading.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
public static void create(EGVRecord egvRecord, long addativeOffset, Context context) {
    BgReading bgReading = BgReading.getForTimestamp(egvRecord.getSystemTime().getTime() + addativeOffset);
    Log.i(TAG, "create: Looking for BG reading to tag this thing to: " + egvRecord.getBGValue());
    if (bgReading != null) {
        bgReading.calculated_value = egvRecord.getBGValue();
        if (egvRecord.getBGValue() <= 13) {
            Calibration calibration = bgReading.calibration;
            double firstAdjSlope = calibration.first_slope + (calibration.first_decay * (Math.ceil(new Date().getTime() - calibration.timestamp) / (1000 * 60 * 10)));
            double calSlope = (calibration.first_scale / firstAdjSlope) * 1000;
            double calIntercept = ((calibration.first_scale * calibration.first_intercept) / firstAdjSlope) * -1;
            bgReading.raw_calculated = (((calSlope * bgReading.raw_data) + calIntercept) - 5);
        }
        Log.i(TAG, "create: NEW VALUE CALCULATED AT: " + bgReading.calculated_value);
        bgReading.calculated_value_slope = bgReading.slopefromName(egvRecord.getTrend().friendlyTrendName());
        bgReading.noise = egvRecord.noiseValue();
        String friendlyName = egvRecord.getTrend().friendlyTrendName();
        if (friendlyName.compareTo("NONE") == 0 ||
                friendlyName.compareTo("NOT_COMPUTABLE") == 0 ||
                friendlyName.compareTo("NOT COMPUTABLE") == 0 ||
                friendlyName.compareTo("OUT OF RANGE") == 0 ||
                friendlyName.compareTo("OUT_OF_RANGE") == 0) {
            bgReading.hide_slope = true;
        }
        bgReading.save();
        bgReading.find_new_curve();
        bgReading.find_new_raw_curve();
        //context.startService(new Intent(context, Notifications.class));
        Notifications.start(); // this may not be needed as it is duplicated in handleNewBgReading
        BgSendQueue.handleNewBgReading(bgReading, "create", context);
    }
}
 
Example 5
Source File: BgReading.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
public static void create(EGVRecord egvRecord, long addativeOffset, Context context) {
    BgReading bgReading = BgReading.getForTimestamp(egvRecord.getSystemTime().getTime() + addativeOffset);
    Log.i(TAG, "create: Looking for BG reading to tag this thing to: " + egvRecord.getBGValue());
    if (bgReading != null) {
        bgReading.calculated_value = egvRecord.getBGValue();
        if (egvRecord.getBGValue() <= 13) {
            Calibration calibration = bgReading.calibration;
            double firstAdjSlope = calibration.first_slope + (calibration.first_decay * (Math.ceil(new Date().getTime() - calibration.timestamp) / (1000 * 60 * 10)));
            double calSlope = (calibration.first_scale / firstAdjSlope) * 1000;
            double calIntercept = ((calibration.first_scale * calibration.first_intercept) / firstAdjSlope) * -1;
            bgReading.raw_calculated = (((calSlope * bgReading.raw_data) + calIntercept) - 5);
        }
        Log.i(TAG, "create: NEW VALUE CALCULATED AT: " + bgReading.calculated_value);
        bgReading.calculated_value_slope = bgReading.slopefromName(egvRecord.getTrend().friendlyTrendName());
        bgReading.noise = egvRecord.noiseValue();
        String friendlyName = egvRecord.getTrend().friendlyTrendName();
        if (friendlyName.compareTo("NONE") == 0 ||
                friendlyName.compareTo("NOT_COMPUTABLE") == 0 ||
                friendlyName.compareTo("NOT COMPUTABLE") == 0 ||
                friendlyName.compareTo("OUT OF RANGE") == 0 ||
                friendlyName.compareTo("OUT_OF_RANGE") == 0) {
            bgReading.hide_slope = true;
        }
        bgReading.save();
        bgReading.find_new_curve();
        bgReading.find_new_raw_curve();
        //context.startService(new Intent(context, Notifications.class));
        Notifications.start(); // this may not be needed as it is duplicated in handleNewBgReading
        BgSendQueue.handleNewBgReading(bgReading, "create", context);
    }
}
 
Example 6
Source File: BgReading.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
public static void create(EGVRecord egvRecord, long addativeOffset, Context context) {
    BgReading bgReading = BgReading.getForTimestamp(egvRecord.getSystemTime().getTime() + addativeOffset);
    Log.i(TAG, "create: Looking for BG reading to tag this thing to: " + egvRecord.getBGValue());
    if (bgReading != null) {
        bgReading.calculated_value = egvRecord.getBGValue();
        if (egvRecord.getBGValue() <= 13) {
            Calibration calibration = bgReading.calibration;
            double firstAdjSlope = calibration.first_slope + (calibration.first_decay * (Math.ceil(new Date().getTime() - calibration.timestamp) / (1000 * 60 * 10)));
            double calSlope = (calibration.first_scale / firstAdjSlope) * 1000;
            double calIntercept = ((calibration.first_scale * calibration.first_intercept) / firstAdjSlope) * -1;
            bgReading.raw_calculated = (((calSlope * bgReading.raw_data) + calIntercept) - 5);
        }
        Log.i(TAG, "create: NEW VALUE CALCULATED AT: " + bgReading.calculated_value);
        bgReading.calculated_value_slope = bgReading.slopefromName(egvRecord.getTrend().friendlyTrendName());
        bgReading.noise = egvRecord.noiseValue();
        String friendlyName = egvRecord.getTrend().friendlyTrendName();
        if (friendlyName.compareTo("NONE") == 0 ||
                friendlyName.compareTo("NOT_COMPUTABLE") == 0 ||
                friendlyName.compareTo("NOT COMPUTABLE") == 0 ||
                friendlyName.compareTo("OUT OF RANGE") == 0 ||
                friendlyName.compareTo("OUT_OF_RANGE") == 0) {
            bgReading.hide_slope = true;
        }
        bgReading.save();
        bgReading.find_new_curve();
        bgReading.find_new_raw_curve();
        //context.startService(new Intent(context, Notifications.class));
        Notifications.start(); // this may not be needed as it is duplicated in handleNewBgReading
        BgSendQueue.handleNewBgReading(bgReading, "create", context);
    }
}