Search in sources :

Example 1 with GlucoseDataSet

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);
}
Also used : SensorRecord(com.nightscout.core.dexcom.records.SensorRecord) EGVRecord(com.nightscout.core.dexcom.records.EGVRecord) DateTime(org.joda.time.DateTime) GlucoseDataSet(com.nightscout.core.dexcom.records.GlucoseDataSet)

Example 2 with GlucoseDataSet

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);
}
Also used : G4Download(com.nightscout.core.model.G4Download) GlucoseDataSet(com.nightscout.core.dexcom.records.GlucoseDataSet)

Example 3 with GlucoseDataSet

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;
}
Also used : ArrayList(java.util.ArrayList) GlucoseDataSet(com.nightscout.core.dexcom.records.GlucoseDataSet)

Example 4 with GlucoseDataSet

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);
}
Also used : SensorEntry(com.nightscout.core.model.SensorEntry) SensorGlucoseValueEntry(com.nightscout.core.model.SensorGlucoseValueEntry) MeterEntry(com.nightscout.core.model.MeterEntry) CalibrationEntry(com.nightscout.core.model.CalibrationEntry) G4Download(com.nightscout.core.model.G4Download) GlucoseDataSet(com.nightscout.core.dexcom.records.GlucoseDataSet)

Aggregations

GlucoseDataSet (com.nightscout.core.dexcom.records.GlucoseDataSet)4 G4Download (com.nightscout.core.model.G4Download)2 EGVRecord (com.nightscout.core.dexcom.records.EGVRecord)1 SensorRecord (com.nightscout.core.dexcom.records.SensorRecord)1 CalibrationEntry (com.nightscout.core.model.CalibrationEntry)1 MeterEntry (com.nightscout.core.model.MeterEntry)1 SensorEntry (com.nightscout.core.model.SensorEntry)1 SensorGlucoseValueEntry (com.nightscout.core.model.SensorGlucoseValueEntry)1 ArrayList (java.util.ArrayList)1 DateTime (org.joda.time.DateTime)1