public async Task <bool> InstallFirmwareAsync(FirmwareBundle bundle, IProgress <ProgressValue> progress = null) { if (bundle == null) { throw new ArgumentNullException("bundle"); } if (progress != null) { progress.Report(new ProgressValue("Starting firmware install", 1)); } if ((await _pebble.SendSystemMessageAsync(SystemMessage.FirmwareStart)).Success == false) { return(false); } if (bundle.HasResources) { if (progress != null) { progress.Report(new ProgressValue("Transfering firmware resources", 25)); } if (await _pebble.PutBytesClient.PutBytes(bundle.Resources, TransferType.SysResources, index: 0) == false) { return(false); } } if (progress != null) { progress.Report(new ProgressValue("Transfering firmware", 50)); } if (await _pebble.PutBytesClient.PutBytes(bundle.Firmware, TransferType.Firmware, index: 0) == false) { return(false); } if (progress != null) { progress.Report(new ProgressValue("Completing firmware install", 75)); } bool success = (await _pebble.SendSystemMessageAsync(SystemMessage.FirmwareComplete)).Success; if (progress != null) { progress.Report(new ProgressValue("Done installing firmware", 100)); } return(success); }