| 314 | }; |
| 315 | |
| 316 | bool launcherUpdateHttpCb(const uint8_t *data, size_t len, void *ctx) { |
| 317 | HttpUpdateContext *updateCtx = static_cast<HttpUpdateContext *>(ctx); |
| 318 | if (!updateCtx) return false; |
| 319 | if (!updateCtx->started) { |
| 320 | if (!launcherUpdateBegin(updateCtx->target, updateCtx->expected)) return false; |
| 321 | updateCtx->started = true; |
| 322 | progressHandler(0, updateCtx->expected); |
| 323 | } |
| 324 | const size_t remaining = |
| 325 | updateCtx->written < updateCtx->expected ? updateCtx->expected - updateCtx->written : 0; |
| 326 | const size_t writeLen = len > remaining ? remaining : len; |
| 327 | if (writeLen == 0) return true; |
| 328 | size_t wrote = launcherUpdateWrite(data, writeLen); |
| 329 | if (wrote != writeLen) { return false; } |
| 330 | updateCtx->written += wrote; |
| 331 | progressHandler(updateCtx->written, updateCtx->expected); |
| 332 | return true; |
| 333 | } |
| 334 | |
| 335 | bool launcherRawUpdateHttpCb(const uint8_t *data, size_t len, void *ctx) { |
| 336 | RawHttpUpdateContext *updateCtx = static_cast<RawHttpUpdateContext *>(ctx); |
nothing calls this directly
no test coverage detected