Search in sources :

Example 6 with MeterRecord

use of com.nightscout.core.dexcom.records.MeterRecord in project android-uploader by nightscout.

the class MeterRecordTest method shouldParseMeterRecord.

// Meter Record: 28 80 18 0B C5 2B 18 0B 71 00 0A 80 18 0B AC
// Record EGV: 113 Meter time: 186155018 display time: 1416926645000 system time: 186155048
// Meter Record: 7CD01A0B1A7C1A0B06015ED01A0B06
// Record EGV: 262 Meter time: 186306654 display time: 1417078282000 system time: 186306684
@Test
public void shouldParseMeterRecord() throws Exception {
    byte[] record = new byte[] { (byte) 0x28, (byte) 0x80, (byte) 0x18, (byte) 0x0B, (byte) 0xC5, (byte) 0x2B, (byte) 0x18, (byte) 0x0B, (byte) 0x71, (byte) 0x00, (byte) 0x0A, (byte) 0x80, (byte) 0x18, (byte) 0x0B, (byte) 0xAC };
    MeterRecord meterRecord = new MeterRecord(record);
    assertThat(meterRecord.getBgMgdl(), is(113));
    assertThat(meterRecord.getRawDisplayTimeSeconds(), is(186133445L));
    assertThat(meterRecord.getRawSystemTimeSeconds(), is(186155048L));
    assertThat(meterRecord.getMeterTime(), is(186155018));
}
Also used : MeterRecord(com.nightscout.core.dexcom.records.MeterRecord) Test(org.junit.Test)

Example 7 with MeterRecord

use of com.nightscout.core.dexcom.records.MeterRecord in project android-uploader by nightscout.

the class MeterRecordTest method shouldNotParseLargeMeterRecord.

@Test(expected = InvalidRecordLengthException.class)
public void shouldNotParseLargeMeterRecord() throws Exception {
    byte[] record = new byte[] { (byte) 0x28, (byte) 0x80, (byte) 0x18, (byte) 0x0B, (byte) 0xC5, (byte) 0x2B, (byte) 0x18, (byte) 0x0B, (byte) 0x71, (byte) 0x00, (byte) 0x0A, (byte) 0x80, (byte) 0x18, (byte) 0x0B, (byte) 0x00, (byte) 0x00 };
    MeterRecord meterRecord = new MeterRecord(record);
}
Also used : MeterRecord(com.nightscout.core.dexcom.records.MeterRecord) Test(org.junit.Test)

Aggregations

MeterRecord (com.nightscout.core.dexcom.records.MeterRecord)7 Test (org.junit.Test)4 ArrayList (java.util.ArrayList)3 CalRecord (com.nightscout.core.dexcom.records.CalRecord)2 EGVRecord (com.nightscout.core.dexcom.records.EGVRecord)2 SensorRecord (com.nightscout.core.dexcom.records.SensorRecord)2 InvalidRecordLengthException (com.nightscout.core.dexcom.InvalidRecordLengthException)1 PageHeader (com.nightscout.core.dexcom.records.PageHeader)1 ReadData (com.nightscout.core.drivers.ReadData)1 CalibrationEntry (com.nightscout.core.model.CalibrationEntry)1 DownloadResults (com.nightscout.core.model.DownloadResults)1 DownloadStatus (com.nightscout.core.model.DownloadStatus)1 G4Download (com.nightscout.core.model.G4Download)1 MeterEntry (com.nightscout.core.model.MeterEntry)1 SensorEntry (com.nightscout.core.model.SensorEntry)1 SensorGlucoseValueEntry (com.nightscout.core.model.SensorGlucoseValueEntry)1 IOException (java.io.IOException)1 DateFormat (java.text.DateFormat)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1