1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-09-26 16:26:52 +02:00

InifiniTime: set device busy during firmware upgrade

Since this is the only busy task in use we just call gbDevice.unsetBusyTask()
upon completion/error
This commit is contained in:
Andreas Shimokawa 2021-01-06 15:12:00 +01:00
parent c0090e29cb
commit a50cc8d42d

View File

@ -167,7 +167,7 @@ public class PineTimeJFSupport extends AbstractBTLEDeviceSupport implements DfuL
handler = null;
controller = null;
DfuServiceListenerHelper.unregisterProgressListener(getContext(), progressListener);
gbDevice.unsetBusyTask();
// TODO: Request reconnection
}
@ -180,11 +180,13 @@ public class PineTimeJFSupport extends AbstractBTLEDeviceSupport implements DfuL
@Override
public void onDfuAborted(final String mac) {
this.setProgressText(getContext().getString(R.string.devicestatus_upload_aborted));
gbDevice.unsetBusyTask();
}
@Override
public void onError(final String mac, int error, int errorType, final String message) {
this.setProgressText(getContext().getString(R.string.devicestatus_upload_failed));
gbDevice.unsetBusyTask();
}
@Override
@ -312,11 +314,15 @@ public class PineTimeJFSupport extends AbstractBTLEDeviceSupport implements DfuL
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(new Intent(GB.ACTION_SET_PROGRESS_TEXT)
.putExtra(GB.DISPLAY_MESSAGE_MESSAGE, getContext().getString(R.string.devicestatus_upload_starting))
);
gbDevice.setBusyTask("firmware upgrade");
} else {
// TODO: Handle invalid firmware files
}
} catch (Exception ex) {
GB.toast(getContext(), getContext().getString(R.string.updatefirmwareoperation_write_failed) + ":" + ex.getMessage(), Toast.LENGTH_LONG, GB.ERROR, ex);
if (gbDevice.isBusy()) {
gbDevice.unsetBusyTask();
}
}
}