com.eveningoutpost.dexdrip.ImportedLibraries.dexcom.records.EGVRecord Java Examples
The following examples show how to use
com.eveningoutpost.dexdrip.ImportedLibraries.dexcom.records.EGVRecord.
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: SyncingService.java From xDrip with GNU General Public License v3.0 | 6 votes |
private void broadcastSGVToUI(EGVRecord egvRecord, boolean uploadStatus, long nextUploadTime, long displayTime, JSONArray json, int batLvl) { Log.d(TAG, "Current EGV: " + egvRecord.getBGValue()); Intent broadcastIntent = new Intent(); // broadcastIntent.setAction(MainActivity.CGMStatusReceiver.PROCESS_RESPONSE); broadcastIntent.addCategory(Intent.CATEGORY_DEFAULT); broadcastIntent.putExtra(RESPONSE_SGV, egvRecord.getBGValue()); broadcastIntent.putExtra(RESPONSE_TREND, egvRecord.getTrend().getID()); broadcastIntent.putExtra(RESPONSE_TIMESTAMP, egvRecord.getDisplayTime().getTime()); broadcastIntent.putExtra(RESPONSE_NEXT_UPLOAD_TIME, nextUploadTime); broadcastIntent.putExtra(RESPONSE_UPLOAD_STATUS, uploadStatus); broadcastIntent.putExtra(RESPONSE_DISPLAY_TIME, displayTime); if (json!=null) broadcastIntent.putExtra(RESPONSE_JSON, json.toString()); broadcastIntent.putExtra(RESPONSE_BAT, batLvl); sendBroadcast(broadcastIntent); }
Example #2
Source File: ReadData.java From xDrip with GNU General Public License v3.0 | 6 votes |
public EGVRecord[] getRecentEGVsPages(int numOfRecentPages) { if (numOfRecentPages < 1) { throw new IllegalArgumentException("Number of pages must be greater than 1."); } Log.d(TAG, "Reading EGV page range..."); int recordType = Constants.RECORD_TYPES.EGV_DATA.ordinal(); int endPage = readDataBasePageRange(recordType); Log.d(TAG, "Reading " + numOfRecentPages + " EGV page(s)..."); numOfRecentPages = numOfRecentPages - 1; EGVRecord[] allPages = new EGVRecord[0]; for (int i = Math.min(numOfRecentPages,endPage); i >= 0; i--) { int nextPage = endPage - i; Log.d(TAG, "Reading #" + i + " EGV pages (page number " + nextPage + ")"); EGVRecord[] ithEGVRecordPage = readDataBasePage(recordType, nextPage); EGVRecord[] result = Arrays.copyOf(allPages, allPages.length + ithEGVRecordPage.length); System.arraycopy(ithEGVRecordPage, 0, result, allPages.length, ithEGVRecordPage.length); allPages = result; } Log.d(TAG, "Read complete of EGV pages."); return allPages; }
Example #3
Source File: BgReading.java From xDrip with GNU General Public License v3.0 | 6 votes |
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 #4
Source File: ReadData.java From xDrip-plus with GNU General Public License v3.0 | 6 votes |
public EGVRecord[] getRecentEGVsPages(int numOfRecentPages) { if (numOfRecentPages < 1) { throw new IllegalArgumentException("Number of pages must be greater than 1."); } Log.d(TAG, "Reading EGV page range..."); int recordType = Dex_Constants.RECORD_TYPES.EGV_DATA.ordinal(); int endPage = readDataBasePageRange(recordType); Log.d(TAG, "Reading " + numOfRecentPages + " EGV page(s)..."); numOfRecentPages = numOfRecentPages - 1; EGVRecord[] allPages = new EGVRecord[0]; for (int i = Math.min(numOfRecentPages,endPage); i >= 0; i--) { int nextPage = endPage - i; Log.d(TAG, "Reading #" + i + " EGV pages (page number " + nextPage + ")"); EGVRecord[] ithEGVRecordPage = readDataBasePage(recordType, nextPage); EGVRecord[] result = Arrays.copyOf(allPages, allPages.length + ithEGVRecordPage.length); System.arraycopy(ithEGVRecordPage, 0, result, allPages.length, ithEGVRecordPage.length); allPages = result; } Log.d(TAG, "Read complete of EGV pages."); return allPages; }
Example #5
Source File: SyncingService.java From xDrip-plus with GNU General Public License v3.0 | 6 votes |
private void broadcastSGVToUI(EGVRecord egvRecord, boolean uploadStatus, long nextUploadTime, long displayTime, JSONArray json, int batLvl) { Log.d(TAG, "Current EGV: " + egvRecord.getBGValue()); Intent broadcastIntent = new Intent(); // broadcastIntent.setAction(MainActivity.CGMStatusReceiver.PROCESS_RESPONSE); broadcastIntent.addCategory(Intent.CATEGORY_DEFAULT); broadcastIntent.putExtra(RESPONSE_SGV, egvRecord.getBGValue()); broadcastIntent.putExtra(RESPONSE_TREND, egvRecord.getTrend().getID()); broadcastIntent.putExtra(RESPONSE_TIMESTAMP, egvRecord.getDisplayTime().getTime()); broadcastIntent.putExtra(RESPONSE_NEXT_UPLOAD_TIME, nextUploadTime); broadcastIntent.putExtra(RESPONSE_UPLOAD_STATUS, uploadStatus); broadcastIntent.putExtra(RESPONSE_DISPLAY_TIME, displayTime); if (json!=null) broadcastIntent.putExtra(RESPONSE_JSON, json.toString()); broadcastIntent.putExtra(RESPONSE_BAT, batLvl); sendBroadcast(broadcastIntent); }
Example #6
Source File: SyncingService.java From xDrip-Experimental with GNU General Public License v3.0 | 6 votes |
private void broadcastSGVToUI(EGVRecord egvRecord, boolean uploadStatus, long nextUploadTime, long displayTime, JSONArray json, int batLvl) { Log.d(TAG, "Current EGV: " + egvRecord.getBGValue()); Intent broadcastIntent = new Intent(); // broadcastIntent.setAction(MainActivity.CGMStatusReceiver.PROCESS_RESPONSE); broadcastIntent.addCategory(Intent.CATEGORY_DEFAULT); broadcastIntent.putExtra(RESPONSE_SGV, egvRecord.getBGValue()); broadcastIntent.putExtra(RESPONSE_TREND, egvRecord.getTrend().getID()); broadcastIntent.putExtra(RESPONSE_TIMESTAMP, egvRecord.getDisplayTime().getTime()); broadcastIntent.putExtra(RESPONSE_NEXT_UPLOAD_TIME, nextUploadTime); broadcastIntent.putExtra(RESPONSE_UPLOAD_STATUS, uploadStatus); broadcastIntent.putExtra(RESPONSE_DISPLAY_TIME, displayTime); if (json!=null) broadcastIntent.putExtra(RESPONSE_JSON, json.toString()); broadcastIntent.putExtra(RESPONSE_BAT, batLvl); sendBroadcast(broadcastIntent); }
Example #7
Source File: ReadData.java From xDrip with GNU General Public License v3.0 | 6 votes |
public EGVRecord[] getRecentEGVsPages(int numOfRecentPages) { if (numOfRecentPages < 1) { throw new IllegalArgumentException("Number of pages must be greater than 1."); } Log.d(TAG, "Reading EGV page range..."); int recordType = Dex_Constants.RECORD_TYPES.EGV_DATA.ordinal(); int endPage = readDataBasePageRange(recordType); Log.d(TAG, "Reading " + numOfRecentPages + " EGV page(s)..."); numOfRecentPages = numOfRecentPages - 1; EGVRecord[] allPages = new EGVRecord[0]; for (int i = Math.min(numOfRecentPages,endPage); i >= 0; i--) { int nextPage = endPage - i; Log.d(TAG, "Reading #" + i + " EGV pages (page number " + nextPage + ")"); EGVRecord[] ithEGVRecordPage = readDataBasePage(recordType, nextPage); EGVRecord[] result = Arrays.copyOf(allPages, allPages.length + ithEGVRecordPage.length); System.arraycopy(ithEGVRecordPage, 0, result, allPages.length, ithEGVRecordPage.length); allPages = result; } Log.d(TAG, "Read complete of EGV pages."); return allPages; }
Example #8
Source File: ReadData.java From xDrip-Experimental with GNU General Public License v3.0 | 6 votes |
public EGVRecord[] getRecentEGVsPages(int numOfRecentPages) { if (numOfRecentPages < 1) { throw new IllegalArgumentException("Number of pages must be greater than 1."); } Log.d(TAG, "Reading EGV page range..."); int recordType = Constants.RECORD_TYPES.EGV_DATA.ordinal(); int endPage = readDataBasePageRange(recordType); Log.d(TAG, "Reading " + numOfRecentPages + " EGV page(s)..."); numOfRecentPages = numOfRecentPages - 1; EGVRecord[] allPages = new EGVRecord[0]; for (int i = Math.min(numOfRecentPages,endPage); i >= 0; i--) { int nextPage = endPage - i; Log.d(TAG, "Reading #" + i + " EGV pages (page number " + nextPage + ")"); EGVRecord[] ithEGVRecordPage = readDataBasePage(recordType, nextPage); EGVRecord[] result = Arrays.copyOf(allPages, allPages.length + ithEGVRecordPage.length); System.arraycopy(ithEGVRecordPage, 0, result, allPages.length, ithEGVRecordPage.length); allPages = result; } Log.d(TAG, "Read complete of EGV pages."); return allPages; }
Example #9
Source File: SyncingService.java From xDrip with GNU General Public License v3.0 | 6 votes |
private void broadcastSGVToUI(EGVRecord egvRecord, boolean uploadStatus, long nextUploadTime, long displayTime, JSONArray json, int batLvl) { Log.d(TAG, "Current EGV: " + egvRecord.getBGValue()); Intent broadcastIntent = new Intent(); // broadcastIntent.setAction(MainActivity.CGMStatusReceiver.PROCESS_RESPONSE); broadcastIntent.addCategory(Intent.CATEGORY_DEFAULT); broadcastIntent.putExtra(RESPONSE_SGV, egvRecord.getBGValue()); broadcastIntent.putExtra(RESPONSE_TREND, egvRecord.getTrend().getID()); broadcastIntent.putExtra(RESPONSE_TIMESTAMP, egvRecord.getDisplayTime().getTime()); broadcastIntent.putExtra(RESPONSE_NEXT_UPLOAD_TIME, nextUploadTime); broadcastIntent.putExtra(RESPONSE_UPLOAD_STATUS, uploadStatus); broadcastIntent.putExtra(RESPONSE_DISPLAY_TIME, displayTime); if (json!=null) broadcastIntent.putExtra(RESPONSE_JSON, json.toString()); broadcastIntent.putExtra(RESPONSE_BAT, batLvl); sendBroadcast(broadcastIntent); }
Example #10
Source File: BgReading.java From xDrip-Experimental with GNU General Public License v3.0 | 6 votes |
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 #11
Source File: BgReading.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
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 #12
Source File: Utils.java From xDrip with GNU General Public License v3.0 | 5 votes |
public static GlucoseDataSet[] mergeGlucoseDataRecords(EGVRecord[] egvRecords, SensorRecord[] sensorRecords) { int egvLength = egvRecords.length; int sensorLength = sensorRecords.length; int smallerLength = egvLength < sensorLength ? egvLength : sensorLength; GlucoseDataSet[] glucoseDataSets = new GlucoseDataSet[smallerLength]; for (int i = 1; i <= smallerLength; i++) { glucoseDataSets[smallerLength - i] = new GlucoseDataSet(egvRecords[egvLength - i], sensorRecords[sensorLength - i]); } return glucoseDataSets; }
Example #13
Source File: ReadDataShare.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
public void getTimeSinceEGVRecord(final EGVRecord egvRecord, final Action1<Long> timeSinceEgvRecord) { Action1<Long> tempSystemTimeListener = new Action1<Long>() { @Override public void call(Long s) { Observable.just(s - egvRecord.getSystemTimeSeconds()).subscribe(timeSinceEgvRecord); } }; readSystemTime(tempSystemTimeListener); }
Example #14
Source File: Utils.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
public static GlucoseDataSet[] mergeGlucoseDataRecords(EGVRecord[] egvRecords, SensorRecord[] sensorRecords) { int egvLength = egvRecords.length; int sensorLength = sensorRecords.length; int smallerLength = egvLength < sensorLength ? egvLength : sensorLength; GlucoseDataSet[] glucoseDataSets = new GlucoseDataSet[smallerLength]; for (int i = 1; i <= smallerLength; i++) { glucoseDataSets[smallerLength - i] = new GlucoseDataSet(egvRecords[egvLength - i], sensorRecords[sensorLength - i]); } return glucoseDataSets; }
Example #15
Source File: ReadDataShare.java From xDrip-Experimental with GNU General Public License v3.0 | 5 votes |
public void getTimeSinceEGVRecord(final EGVRecord egvRecord, final Action1<Long> timeSinceEgvRecord) { Action1<Long> tempSystemTimeListener = new Action1<Long>() { @Override public void call(Long s) { Observable.just(s - egvRecord.getSystemTimeSeconds()).subscribe(timeSinceEgvRecord); } }; readSystemTime(tempSystemTimeListener); }
Example #16
Source File: Utils.java From xDrip-Experimental with GNU General Public License v3.0 | 5 votes |
public static GlucoseDataSet[] mergeGlucoseDataRecords(EGVRecord[] egvRecords, SensorRecord[] sensorRecords) { int egvLength = egvRecords.length; int sensorLength = sensorRecords.length; int smallerLength = egvLength < sensorLength ? egvLength : sensorLength; GlucoseDataSet[] glucoseDataSets = new GlucoseDataSet[smallerLength]; for (int i = 1; i <= smallerLength; i++) { glucoseDataSets[smallerLength - i] = new GlucoseDataSet(egvRecords[egvLength - i], sensorRecords[sensorLength - i]); } return glucoseDataSets; }
Example #17
Source File: ReadDataShare.java From xDrip with GNU General Public License v3.0 | 5 votes |
public void getTimeSinceEGVRecord(final EGVRecord egvRecord, final Action1<Long> timeSinceEgvRecord) { Action1<Long> tempSystemTimeListener = new Action1<Long>() { @Override public void call(Long s) { Observable.just(s - egvRecord.getSystemTimeSeconds()).subscribe(timeSinceEgvRecord); } }; readSystemTime(tempSystemTimeListener); }
Example #18
Source File: ReadDataShare.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
public void getTimeSinceEGVRecord(final EGVRecord egvRecord, final Action1<Long> timeSinceEgvRecord) { Action1<Long> tempSystemTimeListener = new Action1<Long>() { @Override public void call(Long s) { Observable.just(s - egvRecord.getSystemTimeSeconds()).subscribe(timeSinceEgvRecord); } }; readSystemTime(tempSystemTimeListener); }
Example #19
Source File: BgReading.java From xDrip with GNU General Public License v3.0 | 5 votes |
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 #20
Source File: BgReading.java From xDrip with GNU General Public License v3.0 | 5 votes |
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 #21
Source File: BgReading.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
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 #22
Source File: ReadDataShare.java From xDrip with GNU General Public License v3.0 | 5 votes |
public void getTimeSinceEGVRecord(final EGVRecord egvRecord, final Action1<Long> timeSinceEgvRecord) { Action1<Long> tempSystemTimeListener = new Action1<Long>() { @Override public void call(Long s) { Observable.just(s - egvRecord.getSystemTimeSeconds()).subscribe(timeSinceEgvRecord); } }; readSystemTime(tempSystemTimeListener); }
Example #23
Source File: Utils.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
public static GlucoseDataSet[] mergeGlucoseDataRecords(EGVRecord[] egvRecords, SensorRecord[] sensorRecords) { int egvLength = egvRecords.length; int sensorLength = sensorRecords.length; int smallerLength = egvLength < sensorLength ? egvLength : sensorLength; GlucoseDataSet[] glucoseDataSets = new GlucoseDataSet[smallerLength]; for (int i = 1; i <= smallerLength; i++) { glucoseDataSets[smallerLength - i] = new GlucoseDataSet(egvRecords[egvLength - i], sensorRecords[sensorLength - i]); } return glucoseDataSets; }
Example #24
Source File: Utils.java From xDrip with GNU General Public License v3.0 | 5 votes |
public static GlucoseDataSet[] mergeGlucoseDataRecords(EGVRecord[] egvRecords, SensorRecord[] sensorRecords) { int egvLength = egvRecords.length; int sensorLength = sensorRecords.length; int smallerLength = egvLength < sensorLength ? egvLength : sensorLength; GlucoseDataSet[] glucoseDataSets = new GlucoseDataSet[smallerLength]; for (int i = 1; i <= smallerLength; i++) { glucoseDataSets[smallerLength - i] = new GlucoseDataSet(egvRecords[egvLength - i], sensorRecords[sensorLength - i]); } return glucoseDataSets; }
Example #25
Source File: Utils.java From xDrip with GNU General Public License v3.0 | 5 votes |
public static GlucoseDataSet[] mergeGlucoseDataRecords(EGVRecord[] egvRecords, SensorRecord[] sensorRecords) { int egvLength = egvRecords.length; int sensorLength = sensorRecords.length; int smallerLength = egvLength < sensorLength ? egvLength : sensorLength; GlucoseDataSet[] glucoseDataSets = new GlucoseDataSet[smallerLength]; for (int i = 1; i <= smallerLength; i++) { glucoseDataSets[smallerLength - i] = new GlucoseDataSet(egvRecords[egvLength - i], sensorRecords[sensorLength - i]); } return glucoseDataSets; }
Example #26
Source File: ReadDataShare.java From xDrip with GNU General Public License v3.0 | 5 votes |
public void getTimeSinceEGVRecord(final EGVRecord egvRecord, final Action1<Long> timeSinceEgvRecord) { Action1<Long> tempSystemTimeListener = new Action1<Long>() { @Override public void call(Long s) { Observable.just(s - egvRecord.getSystemTimeSeconds()).subscribe(timeSinceEgvRecord); } }; readSystemTime(tempSystemTimeListener); }
Example #27
Source File: ShareTest.java From xDrip with GNU General Public License v3.0 | 4 votes |
public void attemptRead() { final ReadDataShare readData = new ReadDataShare(this); final Action1<Long> systemTimeListener = new Action1<Long>() { @Override public void call(Long s) { Log.d(TAG, "Made the full round trip, got " + s + " as the system time"); Log.d("SYSTTIME", "Made the full round trip, got " + s + " as the system time"); final long addativeSystemTimeOffset = new Date().getTime() - s; Log.d(TAG, "Made the full round trip, got " + addativeSystemTimeOffset + " offset"); Log.d("SYSTTIME", "Made the full round trip, got " + addativeSystemTimeOffset + " offset"); final Action1<CalRecord[]> calRecordListener = new Action1<CalRecord[]>() { @Override public void call(CalRecord[] calRecords) { Log.d(TAG, "Made the full round trip, got " + calRecords.length + " Cal Records"); Calibration.create(calRecords, addativeSystemTimeOffset, getApplicationContext()); final Action1<SensorRecord[]> sensorRecordListener = new Action1<SensorRecord[]>() { @Override public void call(SensorRecord[] sensorRecords) { Log.d(TAG, "Made the full round trip, got " + sensorRecords.length + " Sensor Records"); BgReading.create(sensorRecords, addativeSystemTimeOffset, getApplicationContext()); final Action1<EGVRecord[]> evgRecordListener = new Action1<EGVRecord[]>() { @Override public void call(EGVRecord[] egvRecords) { Log.d(TAG, "Made the full round trip, got " + egvRecords.length + " EVG Records"); BgReading.create(egvRecords, addativeSystemTimeOffset, getApplicationContext()); } }; readData.getRecentEGVs(evgRecordListener); } }; readData.getRecentSensorRecords(sensorRecordListener); } }; readData.getRecentCalRecords(calRecordListener); } }; readData.readSystemTime(systemTimeListener); }
Example #28
Source File: ReadData.java From xDrip with GNU General Public License v3.0 | 4 votes |
public long getTimeSinceEGVRecord(EGVRecord egvRecord) { return readSystemTime() - egvRecord.getSystemTimeSeconds(); }
Example #29
Source File: BgReading.java From xDrip with GNU General Public License v3.0 | 4 votes |
public static void create(EGVRecord[] egvRecords, long addativeOffset, Context context) { for(EGVRecord egvRecord : egvRecords) { BgReading.create(egvRecord, addativeOffset, context); } }
Example #30
Source File: BgReading.java From xDrip with GNU General Public License v3.0 | 4 votes |
public static void create(EGVRecord[] egvRecords, long addativeOffset, Context context) { for (EGVRecord egvRecord : egvRecords) { BgReading.create(egvRecord, addativeOffset, context); } }