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

Function otaHandler

src/webInterface.cpp:544–566  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

542}
543
544esp_err_t otaHandler(httpd_req_t *req) {
545 if (!checkUserWebAuth(req)) return ESP_OK;
546 WebParamMap params = readParams(req);
547 if (params.has("update")) {
548 update = true;
549 sendText(req, "text/plain", "Update");
550 return ESP_OK;
551 }
552 if (params.has("command")) {
553 command = params.get("command").toInt();
554 if (params.has("size")) {
555 file_size = params.get("size").toInt();
556 if (file_size > 0) {
557 update = true;
558 runOnce = true;
559 sendText(req, "text/plain", "OK");
560 return ESP_OK;
561 }
562 }
563 }
564 sendText(req, 400, "text/plain", "Invalid OTA request");
565 return ESP_OK;
566}
567
568esp_err_t otaFileHandler(httpd_req_t *req) {
569 streamMultipartUpload(req);

Callers

nothing calls this directly

Calls 5

checkUserWebAuthFunction · 0.85
readParamsFunction · 0.85
sendTextFunction · 0.85
hasMethod · 0.80
getMethod · 0.80

Tested by

no test coverage detected