1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-27 12:26:48 +01: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; handler = null;
controller = null; controller = null;
DfuServiceListenerHelper.unregisterProgressListener(getContext(), progressListener); DfuServiceListenerHelper.unregisterProgressListener(getContext(), progressListener);
gbDevice.unsetBusyTask();
// TODO: Request reconnection // TODO: Request reconnection
} }
@ -180,11 +180,13 @@ public class PineTimeJFSupport extends AbstractBTLEDeviceSupport implements DfuL
@Override @Override
public void onDfuAborted(final String mac) { public void onDfuAborted(final String mac) {
this.setProgressText(getContext().getString(R.string.devicestatus_upload_aborted)); this.setProgressText(getContext().getString(R.string.devicestatus_upload_aborted));
gbDevice.unsetBusyTask();
} }
@Override @Override
public void onError(final String mac, int error, int errorType, final String message) { public void onError(final String mac, int error, int errorType, final String message) {
this.setProgressText(getContext().getString(R.string.devicestatus_upload_failed)); this.setProgressText(getContext().getString(R.string.devicestatus_upload_failed));
gbDevice.unsetBusyTask();
} }
@Override @Override
@ -312,11 +314,15 @@ public class PineTimeJFSupport extends AbstractBTLEDeviceSupport implements DfuL
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(new Intent(GB.ACTION_SET_PROGRESS_TEXT) LocalBroadcastManager.getInstance(getContext()).sendBroadcast(new Intent(GB.ACTION_SET_PROGRESS_TEXT)
.putExtra(GB.DISPLAY_MESSAGE_MESSAGE, getContext().getString(R.string.devicestatus_upload_starting)) .putExtra(GB.DISPLAY_MESSAGE_MESSAGE, getContext().getString(R.string.devicestatus_upload_starting))
); );
gbDevice.setBusyTask("firmware upgrade");
} else { } else {
// TODO: Handle invalid firmware files // TODO: Handle invalid firmware files
} }
} catch (Exception ex) { } catch (Exception ex) {
GB.toast(getContext(), getContext().getString(R.string.updatefirmwareoperation_write_failed) + ":" + ex.getMessage(), Toast.LENGTH_LONG, GB.ERROR, ex); GB.toast(getContext(), getContext().getString(R.string.updatefirmwareoperation_write_failed) + ":" + ex.getMessage(), Toast.LENGTH_LONG, GB.ERROR, ex);
if (gbDevice.isBusy()) {
gbDevice.unsetBusyTask();
}
} }
} }