use of sugar.free.sightparser.applayer.messages.status.PumpStatusMessage in project SightRemote by TebbeUbben.
the class TemporaryBasalRateActivity method statusChanged.
@Override
protected void statusChanged(Status status) {
if (status == Status.CONNECTED) {
new SingleMessageTaskRunner(getServiceConnector(), new PumpStatusMessage()).fetch(this);
showLoadingIndicator();
hideManualOverlay();
} else {
if (confirmationDialog != null)
confirmationDialog.hide();
showManualOverlay();
hideLoadingIndicator();
}
}
use of sugar.free.sightparser.applayer.messages.status.PumpStatusMessage 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.status.PumpStatusMessage in project SightRemote by TebbeUbben.
the class TemporaryBasalRateActivity method onResult.
@Override
public void onResult(Object result) {
if (result instanceof PumpStatusMessage) {
PumpStatusMessage pumpStatusMessage = (PumpStatusMessage) result;
if (pumpStatusMessage.getPumpStatus() != PumpStatus.STARTED) {
showManualOverlay();
hideLoadingIndicator();
showSnackbar(Snackbar.make(getRootView(), R.string.pump_not_started, Snackbar.LENGTH_INDEFINITE));
} else {
hideLoadingIndicator();
hideManualOverlay();
dismissSnackbar();
}
} else {
Answers.getInstance().logCustom(new CustomEvent("TBR Programmed"));
finish();
}
}
Aggregations