ProtoCore
v0.0.2
Deterministic, zero-heap network stack for embedded targets
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 (PC_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 PC_ENABLE_OTA is 0 or off-Arduino.
13
*
14
* @author Douglas Quigg (dstroy0)
15
* @date 2026
16
*/
17
18
#ifndef PROTOCORE_OTA_SERVICE_H
19
#define PROTOCORE_OTA_SERVICE_H
20
21
#include "
protocore_config.h
"
22
23
class
PC
;
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
pc_ota_begin
(
PC
&server,
const
char
*path,
const
char
*user,
const
char
*pass);
42
43
#endif
// PROTOCORE_OTA_SERVICE_H
PC
Single-port HTTP server with deterministic, zero-allocation execution.
Definition
protocore.h:348
pc_ota_begin
void pc_ota_begin(PC &server, const char *path, const char *user, const char *pass)
Register an authenticated streaming OTA endpoint.
Definition
ota_service.cpp:152
protocore_config.h
User-facing configuration for ProtoCore.
src
services
system
ota_service
ota_service.h
Generated by
1.9.8