MsgStatusBasic extends MessageBase { public void handleMessage(byte[] bytes) { DanaRPump pump = DanaRPump.getInstance(); pump.pumpSuspended = intFromBuff(bytes, 0, 1) == 1; pump.calculatorEnabled = intFromBuff(bytes, 1, 1) == 1; pump.dailyTotalUnits = intFromBuff(bytes, 2, 3) / 750d; pump.maxDailyTotalUnits = intFromBuff(bytes, 5, 2) / 100; pump.reservoirRemainingUnits = intFromBuff(bytes, 7, 3) / 750d; pump.bolusBlocked = intFromBuff(bytes, 10, 1) == 1; pump.currentBasal = intFromBuff(bytes, 11, 2) / 100d; pump.batteryRemaining = intFromBuff(bytes, 20, 1); if (L.isEnabled(L.PUMPCOMM)) { log.debug("Pump suspended: " + pump.pumpSuspended); log.debug("Calculator enabled: " + pump.calculatorEnabled); log.debug("Daily total units: " + pump.dailyTotalUnits); log.debug("Max daily total units: " + pump.maxDailyTotalUnits); log.debug("Reservoir remaining units: " + pump.reservoirRemainingUnits); log.debug("Bolus blocked: " + pump.bolusBlocked); log.debug("Current basal: " + pump.currentBasal); } } MsgStatusBasic(); void handleMessage(byte[] bytes);  }
@Test public void runTest() { AAPSMocker.mockMainApp(); AAPSMocker.mockApplicationContext(); AAPSMocker.mockSP(); AAPSMocker.mockL(); MsgStatusBasic packet = new MsgStatusBasic(); packet.handleMessage(createArray(34, (byte) 7)); DanaRPump pump = DanaRPump.getInstance(); assertEquals((double) MessageBase.intFromBuff(createArray(34, (byte) 7), 0, 3) / 750d, pump.dailyTotalUnits,0); }