use of sugar.free.sightparser.applayer.descriptors.configuration_blocks.FactoryMinBolusAmountBlock in project SightRemote by TebbeUbben.
the class BolusPreparationTaskRunner method run.
@Override
protected AppLayerMessage run(AppLayerMessage message) throws Exception {
if (message == null)
return new PumpStatusMessage();
else if (message instanceof PumpStatusMessage) {
preperationResult.pumpStarted = ((PumpStatusMessage) message).getPumpStatus().equals(PumpStatus.STARTED);
if (preperationResult.pumpStarted)
return new AvailableBolusesMessage();
else {
ReadConfigurationBlockMessage readMessage = new ReadConfigurationBlockMessage();
readMessage.setConfigurationBlockID(FactoryMinBolusAmountBlock.ID);
return readMessage;
}
} else if (message instanceof AvailableBolusesMessage) {
preperationResult.availableBoluses = (AvailableBolusesMessage) message;
ReadConfigurationBlockMessage readMessage = new ReadConfigurationBlockMessage();
readMessage.setConfigurationBlockID(FactoryMinBolusAmountBlock.ID);
return readMessage;
} else {
ReadConfigurationBlockMessage readMessage = (ReadConfigurationBlockMessage) message;
if (readMessage.getConfigurationBlock() instanceof FactoryMinBolusAmountBlock) {
preperationResult.minBolusAmount = ((FactoryMinBolusAmountBlock) readMessage.getConfigurationBlock()).getMinimumAmount();
readMessage = new ReadConfigurationBlockMessage();
readMessage.setConfigurationBlockID(MaxBolusAmountBlock.ID);
return readMessage;
} else if (readMessage.getConfigurationBlock() instanceof MaxBolusAmountBlock) {
preperationResult.maxBolusAmount = ((MaxBolusAmountBlock) readMessage.getConfigurationBlock()).getMaximumAmount();
finish(preperationResult);
}
}
return null;
}
Aggregations