cryptnox-pos 1.0.0
Standalone USDC payment terminal firmware (ESP32 + Cryptnox smart card)
Loading...
Searching...
No Matches
ota.h
Go to the documentation of this file.
1/*
2 * SPDX-License-Identifier: LGPL-3.0-or-later
3 * Copyright (c) 2026 Cryptnox SA
4 */
5
41
42#ifndef OTA_H
43#define OTA_H
44
45#include <stdbool.h>
46#include <stddef.h>
47
48#ifdef __cplusplus
49extern "C" {
50#endif
51
53#define OTA_ERR_MAX 160U
54
74bool ota_mark_valid(void);
75
81const char *ota_running_version(void);
82
100bool ota_last_update_failed(void);
101
116bool ota_begin(size_t len, const char **err);
117
119bool ota_write(const void *buf, size_t n);
120
135bool ota_end(char *ver, size_t ver_n, const char **err);
136
138void ota_abort(void);
139
141bool ota_receiving(void);
142
154bool ota_staged(char *version, size_t version_n, bool *older);
155
165bool ota_commit(bool install);
166
167/* There is deliberately no ota_forget(). Closing the config portal used to
168 * withdraw a staged image, and since an upload spends minutes of the portal's own
169 * 15-minute window, that window kept expiring while the operator was reading the
170 * Install button — the offer went away and the tap did nothing, which is what "the
171 * update did not install" turned out to be. A staged image is signature-verified
172 * and gated on the panel, so nothing needs to take it away on a timer:
173 * @ref ota_commit is the only thing that resolves it, either way. */
174
175#ifdef __cplusplus
176}
177#endif
178
179#endif /* OTA_H */
void ota_abort(void)
Give up on an upload in progress. Nothing is installed. Safe always.
Definition ota.cpp:156
const char * ota_running_version(void)
The running firmware's version, from the image header.
Definition ota.cpp:263
bool ota_mark_valid(void)
Confirm the running image, cancelling the rollback armed by the bootloader.
Definition ota.cpp:231
bool ota_receiving(void)
Whether an upload is in flight, so a second can be refused.
Definition ota.cpp:165
bool ota_end(char *ver, size_t ver_n, const char **err)
Close and verify the received image, then stage it for the panel.
Definition ota.cpp:167
bool ota_staged(char *version, size_t version_n, bool *older)
Fetch the version of an image that has been received and verified but not yet installed.
Definition ota.cpp:275
bool ota_last_update_failed(void)
Whether the last update was installed and then thrown away.
Definition ota.cpp:221
bool ota_write(const void *buf, size_t n)
Append n bytes to the open slot.
Definition ota.cpp:145
bool ota_commit(bool install)
Resolve a staged image.
Definition ota.cpp:291
bool ota_begin(size_t len, const char **err)
Open the idle slot for an image of len bytes.
Definition ota.cpp:94