1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-17 23:49:25 +01:00

Fix ordering problem with firmwareInfoSent state variable #234

This commit is contained in:
cpfeiffer 2016-03-30 21:56:00 +02:00
parent cc7f5406ef
commit ffc006c21c

View File

@ -323,8 +323,8 @@ public class UpdateFirmwareOperation extends AbstractMiBandOperation {
TransactionBuilder builder = performInitialized("send firmware info"); TransactionBuilder builder = performInitialized("send firmware info");
getSupport().setLowLatency(builder); getSupport().setLowLatency(builder);
builder.add(new SetDeviceBusyAction(getDevice(), getContext().getString(R.string.updating_firmware), getContext())); builder.add(new SetDeviceBusyAction(getDevice(), getContext().getString(R.string.updating_firmware), getContext()));
builder.add(new FirmwareInfoSentAction()); // Note: *before* actually sending the info, otherwise it's too late!
builder.write(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_CONTROL_POINT), getFirmwareInfo()); builder.write(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_CONTROL_POINT), getFirmwareInfo());
builder.add(new FirmwareInfoSucceededAction());
builder.queue(getQueue()); builder.queue(getQueue());
return true; return true;
} catch (IOException e) { } catch (IOException e) {
@ -440,7 +440,7 @@ public class UpdateFirmwareOperation extends AbstractMiBandOperation {
} }
} }
private class FirmwareInfoSucceededAction extends PlainAction { private class FirmwareInfoSentAction extends PlainAction {
@Override @Override
public boolean run(BluetoothGatt gatt) { public boolean run(BluetoothGatt gatt) {
if (isOperationRunning()) { if (isOperationRunning()) {