use of sugar.free.sightparser.applayer.messages.configuration.ReadConfigurationBlockMessage 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;
}
use of sugar.free.sightparser.applayer.messages.configuration.ReadConfigurationBlockMessage in project SightRemote by TebbeUbben.
the class ReadConfigurationTaskRunner method run.
@Override
protected AppLayerMessage run(AppLayerMessage message) throws Exception {
if (message instanceof ReadConfigurationBlockMessage) {
ReadConfigurationBlockMessage readMessage = (ReadConfigurationBlockMessage) message;
configurationBlocks.add(readMessage.getConfigurationBlock());
}
if (IDs.size() != 0) {
ReadConfigurationBlockMessage readMessage = new ReadConfigurationBlockMessage();
readMessage.setConfigurationBlockID(IDs.get(0));
IDs.remove(0);
return readMessage;
} else
finish(configurationBlocks);
return null;
}
Aggregations