cryptnox-pos
1.0.0
Standalone USDC payment terminal firmware (ESP32 + Cryptnox smart card)
Toggle main menu visibility
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
49
extern
"C"
{
50
#endif
51
53
#define OTA_ERR_MAX 160U
54
74
bool
ota_mark_valid
(
void
);
75
81
const
char
*
ota_running_version
(
void
);
82
100
bool
ota_last_update_failed
(
void
);
101
116
bool
ota_begin
(
size_t
len,
const
char
**err);
117
119
bool
ota_write
(
const
void
*buf,
size_t
n);
120
135
bool
ota_end
(
char
*ver,
size_t
ver_n,
const
char
**err);
136
138
void
ota_abort
(
void
);
139
141
bool
ota_receiving
(
void
);
142
154
bool
ota_staged
(
char
*version,
size_t
version_n,
bool
*older);
155
165
bool
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 */
ota_abort
void ota_abort(void)
Give up on an upload in progress. Nothing is installed. Safe always.
Definition
ota.cpp:156
ota_running_version
const char * ota_running_version(void)
The running firmware's version, from the image header.
Definition
ota.cpp:263
ota_mark_valid
bool ota_mark_valid(void)
Confirm the running image, cancelling the rollback armed by the bootloader.
Definition
ota.cpp:231
ota_receiving
bool ota_receiving(void)
Whether an upload is in flight, so a second can be refused.
Definition
ota.cpp:165
ota_end
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
ota_staged
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
ota_last_update_failed
bool ota_last_update_failed(void)
Whether the last update was installed and then thrown away.
Definition
ota.cpp:221
ota_write
bool ota_write(const void *buf, size_t n)
Append n bytes to the open slot.
Definition
ota.cpp:145
ota_commit
bool ota_commit(bool install)
Resolve a staged image.
Definition
ota.cpp:291
ota_begin
bool ota_begin(size_t len, const char **err)
Open the idle slot for an image of len bytes.
Definition
ota.cpp:94
main
ota.h
Generated by
1.17.0