Search in sources :

Example 11 with SingleMessageTaskRunner

use of sugar.free.sightparser.handling.SingleMessageTaskRunner in project SightRemote by TebbeUbben.

the class HistorySyncService method onStatusChange.

@Override
public void onStatusChange(Status status) {
    if (status == Status.CONNECTED) {
        connector.connect();
        ReadStatusParamBlockMessage readMessage = new ReadStatusParamBlockMessage();
        readMessage.setStatusBlockId(SystemIdentificationBlock.ID);
        new SingleMessageTaskRunner(connector, readMessage).fetch(this);
    } else if (status == Status.DISCONNECTED) {
        connector.disconnect();
        connector.disconnectFromService();
        syncing = false;
        sendBroadcast(new Intent(HistoryBroadcast.ACTION_SYNC_FINISHED));
        if (wakeLock.isHeld())
            wakeLock.release();
    }
}
Also used : ReadStatusParamBlockMessage(sugar.free.sightparser.applayer.messages.status_param.ReadStatusParamBlockMessage) PendingIntent(android.app.PendingIntent) Intent(android.content.Intent) HistorySendIntent(sugar.free.sightremote.utils.HistorySendIntent) SingleMessageTaskRunner(sugar.free.sightparser.handling.SingleMessageTaskRunner)

Example 12 with SingleMessageTaskRunner

use of sugar.free.sightparser.handling.SingleMessageTaskRunner in project SightRemote by TebbeUbben.

the class StandardBolusActivity method onClick.

@Override
public void onClick(View view) {
    StandardBolusMessage message = new StandardBolusMessage();
    message.setAmount(bolusAmountPicker.getPickerValue());
    final SingleMessageTaskRunner taskRunner = new SingleMessageTaskRunner(getServiceConnector(), message);
    (confirmationDialog = new ConfirmationDialog(this, HTMLUtil.getHTML(R.string.standard_bolus_confirmation, UnitFormatter.formatUnits(bolusAmountPicker.getPickerValue())), () -> {
        showLoadingIndicator();
        taskRunner.fetch(StandardBolusActivity.this);
    })).show();
}
Also used : StandardBolusMessage(sugar.free.sightparser.applayer.messages.remote_control.StandardBolusMessage) SingleMessageTaskRunner(sugar.free.sightparser.handling.SingleMessageTaskRunner) ConfirmationDialog(sugar.free.sightremote.dialogs.ConfirmationDialog)

Aggregations

SingleMessageTaskRunner (sugar.free.sightparser.handling.SingleMessageTaskRunner)12 ConfirmationDialog (sugar.free.sightremote.dialogs.ConfirmationDialog)4 CustomEvent (com.crashlytics.android.answers.CustomEvent)3 PendingIntent (android.app.PendingIntent)2 Intent (android.content.Intent)2 ReadDateTimeMessage (sugar.free.sightparser.applayer.messages.status.ReadDateTimeMessage)2 ReadStatusParamBlockMessage (sugar.free.sightparser.applayer.messages.status_param.ReadStatusParamBlockMessage)2 HistorySendIntent (sugar.free.sightremote.utils.HistorySendIntent)2 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 List (java.util.List)1 Timer (java.util.Timer)1 TimerTask (java.util.TimerTask)1 AppLayerMessage (sugar.free.sightparser.applayer.messages.AppLayerMessage)1 CancelBolusMessage (sugar.free.sightparser.applayer.messages.remote_control.CancelBolusMessage)1 CancelTBRMessage (sugar.free.sightparser.applayer.messages.remote_control.CancelTBRMessage)1 DismissAlertMessage (sugar.free.sightparser.applayer.messages.remote_control.DismissAlertMessage)1 ExtendedBolusMessage (sugar.free.sightparser.applayer.messages.remote_control.ExtendedBolusMessage)1 MultiwaveBolusMessage (sugar.free.sightparser.applayer.messages.remote_control.MultiwaveBolusMessage)1 MuteAlertMessage (sugar.free.sightparser.applayer.messages.remote_control.MuteAlertMessage)1