1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-05 01:37:03 +01:00

Update the firmware-update notification based on the feedback we get from the band.

This commit is contained in:
Daniele Gobbetti 2015-07-31 13:12:15 +02:00
parent 2208d5088b
commit 5b3510fade

View File

@ -681,6 +681,7 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
break; break;
case MiBandService.NOTIFY_FIRMWARE_UPDATE_SUCCESS: case MiBandService.NOTIFY_FIRMWARE_UPDATE_SUCCESS:
if (rebootWhenBandReady) { if (rebootWhenBandReady) {
GB.updateInstallNotification("Firmware installation complete", false, 100, getContext());
onReboot(); onReboot();
} }
rebootWhenBandReady = false; rebootWhenBandReady = false;
@ -688,6 +689,7 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
case MiBandService.NOTIFY_FIRMWARE_UPDATE_FAILED: case MiBandService.NOTIFY_FIRMWARE_UPDATE_FAILED:
//TODO: the firmware transfer failed, but the miband should be still functional with the old firmware. What should we do? //TODO: the firmware transfer failed, but the miband should be still functional with the old firmware. What should we do?
GB.toast("Problem with the firmware transfer. DO NOT REBOOT YOUR MIBAND!!!", Toast.LENGTH_LONG, GB.ERROR); GB.toast("Problem with the firmware transfer. DO NOT REBOOT YOUR MIBAND!!!", Toast.LENGTH_LONG, GB.ERROR);
GB.updateInstallNotification("Firmware write failed", false, 0, getContext());
rebootWhenBandReady = false; rebootWhenBandReady = false;
break; break;
@ -998,7 +1000,6 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
LOG.info("Firmware update progress:" + firmwareProgress + " total len:" + len + " progress:" + (firmwareProgress / len)); LOG.info("Firmware update progress:" + firmwareProgress + " total len:" + len + " progress:" + (firmwareProgress / len));
if (firmwareProgress >= len) { if (firmwareProgress >= len) {
builder.write(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_CONTROL_POINT), new byte[]{MiBandService.COMMAND_SYNC}); builder.write(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_CONTROL_POINT), new byte[]{MiBandService.COMMAND_SYNC});
builder.add(new SetProgressAction("Firmware installation complete", false, 100, getContext()));
} else { } else {
GB.updateInstallNotification("Firmware write failed", false, 0, getContext()); GB.updateInstallNotification("Firmware write failed", false, 0, getContext());
} }