MCPcopy Create free account
hub / github.com/bmorcelli/Launcher / launcherRawUpdateHttpCb

Function launcherRawUpdateHttpCb

src/onlineLauncher.cpp:335–356  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

333}
334
335bool 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
358bool flashRawRangeFromHttp(
359 const String &url, uint32_t sourceOffset, size_t imageSize, const LauncherPartitionEntry &target,

Callers

nothing calls this directly

Calls 3

launcherRawUpdateBeginFunction · 0.85
progressHandlerFunction · 0.85
launcherRawUpdateWriteFunction · 0.85

Tested by

no test coverage detected