cryptnox-pos 1.0.0
Standalone USDC payment terminal firmware (ESP32 + Cryptnox smart card)
Loading...
Searching...
No Matches
provision.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
85
86#ifndef PROVISION_H
87#define PROVISION_H
88
89#include <stdbool.h>
90#include <stddef.h>
91#include <stdint.h>
92
93#include "net.h" /* net_wifi_ap_t — the browser is offered the device's own scan */
94#include "ui.h" /* ui_event_cb_t — submissions are reported as UI events */
95
96#ifdef __cplusplus
97extern "C" {
98#endif
99
101#define PROV_WINDOW_MIN 15U
102
109
126
135
158
165void prov_stop(void);
166
169
171void prov_set_step(prov_step_t step);
172
175
177unsigned prov_window_left_min(void);
178
180const char *prov_ap_ssid(void);
181
183const char *prov_ap_pass(void);
184
192const char *prov_qr_payload(void);
193
200bool prov_auth_pending(void);
201
207void prov_auth_resolve(bool grant);
208
210bool prov_authed(void);
211
224bool prov_pair_code(char *out, size_t out_size);
225
240void prov_set_wifi_only(void);
241
243bool prov_wifi_only(void);
244
254void prov_set_note(const char *note);
255
267void prov_set_scan(const net_wifi_ap_t *aps, uint16_t n);
268
279bool prov_pending(prov_ask_t *kind, char *label, size_t label_n,
280 char *value, size_t value_n);
281
289bool prov_pending_commit(bool accept);
290
303bool prov_propose(prov_ask_t kind, const char *addr);
304
305#ifdef __cplusplus
306}
307#endif
308
309#endif /* PROVISION_H */
Network bring-up: Wi-Fi station (init/scan/connect/RSSI) and SNTP time sync. No application-protocol ...
void prov_auth_resolve(bool grant)
Answer a pending authorisation request from the panel.
bool prov_pair_code(char *out, size_t out_size)
The 4-digit pairing code of the browser asking to be let in.
void prov_set_step(prov_step_t step)
Tell the portal which wizard step is current.
prov_step_t prov_step(void)
The current step.
const char * prov_ap_pass(void)
AP passphrase, or "" while no portal is up.
void prov_set_note(const char *note)
Put a one-line message on the page.
bool prov_pending_commit(bool accept)
Resolve a pending proposal from the panel.
prov_ask_t
What the panel is being asked to accept, for prov_pending.
Definition provision.h:128
@ PROV_ASK_PAYOUT_TRON
Definition provision.h:131
@ PROV_ASK_CONTRACT_ETH
Definition provision.h:132
@ PROV_ASK_PAYOUT_ETH
Definition provision.h:130
@ PROV_ASK_CONTRACT_TRON
Definition provision.h:133
@ PROV_ASK_NONE
Definition provision.h:129
void prov_set_wifi_only(void)
Cut the wizard down to the Wi-Fi step, with no admin code.
bool prov_wifi_only(void)
Whether the portal is the cut-down Wi-Fi-only flow.
const char * prov_qr_payload(void)
What the panel's QR code should carry.
const char * prov_ap_ssid(void)
AP SSID, or "" while no portal is up.
bool prov_propose(prov_ask_t kind, const char *addr)
Propose a value on behalf of the panel itself.
prov_step_t
Where the wizard has got to.
Definition provision.h:118
@ PROV_STEP_WIFI
Definition provision.h:122
@ PROV_STEP_AUTH
Definition provision.h:120
@ PROV_STEP_IDLE
Definition provision.h:119
@ PROV_STEP_ADMIN
Definition provision.h:124
@ PROV_STEP_ADDR
Definition provision.h:121
@ PROV_STEP_DONE
Definition provision.h:123
bool prov_authed(void)
Whether the browser session is authorised to change anything.
bool prov_auth_pending(void)
Whether a browser has asked to be authorised.
prov_mode_t prov_mode(void)
Which mode is running, or PROV_MODE_OFF.
void prov_stop(void)
Stop the portal, drop the AP, and withdraw anything unaccepted.
void prov_set_scan(const net_wifi_ap_t *aps, uint16_t n)
Hand the portal a Wi-Fi scan for the browser to choose from.
prov_mode_t
Which of the two portals is running.
Definition provision.h:104
@ PROV_MODE_WIZARD
Definition provision.h:106
@ PROV_MODE_OFF
Definition provision.h:105
@ PROV_MODE_ADMIN
Definition provision.h:107
bool prov_pending(prov_ask_t *kind, char *label, size_t label_n, char *value, size_t value_n)
Fetch the value a browser proposed but nobody has accepted.
bool prov_start(prov_mode_t mode, ui_event_cb_t cb)
Raise the portal.
unsigned prov_window_left_min(void)
Minutes left before the portal closes itself, 0 once it has.
A scanned access point (subset of fields the UI needs).
Definition net.h:33
Touchscreen UI API: screens, events and transaction states for the CYD (ILI9341 + XPT2046) payment fl...
void(* ui_event_cb_t)(ui_event_t event, uint64_t payload)
Callback invoked from the UI task on user interaction.
Definition ui.h:128