| 333 | } |
| 334 | |
| 335 | bool launcherRawUpdateHttpCb(const uint8_t *data, size_t len, void *ctx) { |
| 336 | RawHttpUpdateContext *updateCtx = static_cast<RawHttpUpdateContext *>(ctx); |
| 337 | if (!updateCtx) return false; |
| 338 | if (!updateCtx->started) { |
| 339 | if (!launcherRawUpdateBegin( |
| 340 | updateCtx->address, updateCtx->partitionSize, updateCtx->expected, updateCtx->appImage |
| 341 | )) { |
| 342 | return false; |
| 343 | } |
| 344 | updateCtx->started = true; |
| 345 | progressHandler(0, updateCtx->expected); |
| 346 | } |
| 347 | const size_t remaining = |
| 348 | updateCtx->written < updateCtx->expected ? updateCtx->expected - updateCtx->written : 0; |
| 349 | const size_t writeLen = len > remaining ? remaining : len; |
| 350 | if (writeLen == 0) return true; |
| 351 | size_t wrote = launcherRawUpdateWrite(data, writeLen); |
| 352 | if (wrote != writeLen) { return false; } |
| 353 | updateCtx->written += wrote; |
| 354 | progressHandler(updateCtx->written, updateCtx->expected); |
| 355 | return true; |
| 356 | } |
| 357 | |
| 358 | bool flashRawRangeFromHttp( |
| 359 | const String &url, uint32_t sourceOffset, size_t imageSize, const LauncherPartitionEntry &target, |
nothing calls this directly
no test coverage detected