DeterministicESPAsyncWebServer
v6.28.0
Zero-allocation, bounded-execution async HTTP server for ESP32
Loading...
Searching...
No Matches
ota_service.h
Go to the documentation of this file.
1
// Copyright (C) 2026 Douglas Quigg (dstroy0) <dquigg123@gmail.com>
2
// SPDX-License-Identifier: AGPL-3.0-or-later
3
4
/**
5
* @file ota_service.h
6
* @brief Optional authenticated OTA firmware update (DETWS_ENABLE_OTA).
7
*
8
* Registers a POST endpoint that streams a firmware image straight into the
9
* ESP32 `Update` API via the parser's streaming-body hook
10
* (http_parser_set_stream_hooks), so the image never has to fit in RAM. On a
11
* successful flash the device responds and reboots into the new firmware.
12
* Compiled to a no-op stub when DETWS_ENABLE_OTA is 0 or off-Arduino.
13
*
14
* @author Douglas Quigg (dstroy0)
15
* @date 2026
16
*/
17
18
#ifndef DETERMINISTICESPASYNCWEBSERVER_OTA_SERVICE_H
19
#define DETERMINISTICESPASYNCWEBSERVER_OTA_SERVICE_H
20
21
#include "
ServerConfig.h
"
22
23
class
DetWebServer
;
24
25
/**
26
* @brief Register an authenticated streaming OTA endpoint.
27
*
28
* Call after begin(). A `POST @p path` carrying a raw firmware image and valid
29
* HTTP Basic credentials is streamed into `Update`; on success the device
30
* replies `200` and reboots. Unauthorized or failed uploads get `401` / `400`.
31
*
32
* @param server The running server (the route + stream hooks are installed on it).
33
* @param path URL to accept the upload on (e.g. "/update"). Persistent string.
34
* @param user Required HTTP Basic username.
35
* @param pass Required HTTP Basic password.
36
*
37
* @code
38
* curl -u admin:s3cret --data-binary @firmware.bin http://<ip>/update
39
* @endcode
40
*/
41
void
detws_ota_begin
(
DetWebServer
&server,
const
char
*path,
const
char
*user,
const
char
*pass);
42
43
#endif
// DETERMINISTICESPASYNCWEBSERVER_OTA_SERVICE_H
ServerConfig.h
User-facing configuration for DeterministicESPAsyncWebServer.
DetWebServer
Single-port HTTP server with deterministic, zero-allocation execution.
Definition
dwserver.h:348
detws_ota_begin
void detws_ota_begin(DetWebServer &server, const char *path, const char *user, const char *pass)
Register an authenticated streaming OTA endpoint.
Definition
ota_service.cpp:134
src
services
ota_service
ota_service.h
Generated by
1.9.8