use of com.nightscout.core.dexcom.records.GlucoseDataSet in project android-uploader by nightscout.
the class MockFactory method mockGlucoseDataSet.
public static GlucoseDataSet mockGlucoseDataSet() {
EGVRecord egvRecord = new EGVRecord(1, TrendArrow.DOUBLE_DOWN, new DateTime(0).toDate(), new DateTime(5).toDate(), G4Noise.CLEAN);
SensorRecord sensorRecord = new SensorRecord(new byte[SensorRecord.RECORD_SIZE]);
return new GlucoseDataSet(egvRecord, sensorRecord);
}
use of com.nightscout.core.dexcom.records.GlucoseDataSet in project android-uploader by nightscout.
the class Uploader method upload.
public boolean upload(DownloadResults downloadResults) {
G4Download download = downloadResults.getDownload();
List<GlucoseDataSet> glucoseDataSets = Utils.mergeGlucoseDataRecords(download.sgv, download.sensor);
return upload(glucoseDataSets, download.meter, download.cal);
}
use of com.nightscout.core.dexcom.records.GlucoseDataSet in project android-uploader by nightscout.
the class Utils method mergeGlucoseDataRecords.
public static List<GlucoseDataSet> mergeGlucoseDataRecords(List<SensorGlucoseValueEntry> egvRecords, List<SensorEntry> sensorRecords) {
int egvLength = egvRecords.size();
int sensorLength = sensorRecords.size();
List<GlucoseDataSet> glucoseDataSets = new ArrayList<>();
if (egvLength >= 0 && sensorLength == 0) {
for (int i = 1; i <= egvLength; i++) {
glucoseDataSets.add(new GlucoseDataSet(egvRecords.get(egvLength - i)));
}
return glucoseDataSets;
}
int smallerLength = egvLength < sensorLength ? egvLength : sensorLength;
for (int i = 1; i <= smallerLength; i++) {
glucoseDataSets.add(new GlucoseDataSet(egvRecords.get(egvLength - i), sensorRecords.get(sensorLength - i)));
}
return glucoseDataSets;
}
use of com.nightscout.core.dexcom.records.GlucoseDataSet in project android-uploader by nightscout.
the class Uploader method upload.
public boolean upload(DownloadResults downloadResults, int numRecords) {
G4Download download = downloadResults.getDownload();
List<SensorGlucoseValueEntry> sgvList = filterRecords(numRecords, download.sgv);
List<CalibrationEntry> calList = filterRecords(numRecords, download.cal);
List<MeterEntry> meterList = filterRecords(numRecords, download.meter);
List<SensorEntry> sensorList = filterRecords(numRecords, download.sensor);
List<GlucoseDataSet> glucoseDataSets = Utils.mergeGlucoseDataRecords(sgvList, sensorList);
return upload(glucoseDataSets, meterList, calList);
}
Aggregations