cryptnox-pos 1.0.0
Standalone USDC payment terminal firmware (ESP32 + Cryptnox smart card)
Loading...
Searching...
No Matches
ui.h File Reference

Touchscreen UI API: screens, events and transaction states for the CYD (ILI9341 + XPT2046) payment flow. More...

#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
#include "net.h"
Include dependency graph for ui.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef void(* ui_event_cb_t) (ui_event_t event, uint64_t payload)
 Callback invoked from the UI task on user interaction.

Enumerations

enum  ui_screen_t {
  UI_SCREEN_SPLASH , UI_SCREEN_AMOUNT , UI_SCREEN_CONFIRM , UI_SCREEN_PIN ,
  UI_SCREEN_WIFI_LIST , UI_SCREEN_WIFI_PASS , UI_SCREEN_WIFI_CONNECTING , UI_SCREEN_SETTINGS ,
  UI_SCREEN_TX_STATUS , UI_SCREEN_BOOT_ERROR , UI_SCREEN_ADMIN_SET , UI_SCREEN_ADMIN_UNLOCK ,
  UI_SCREEN_WELCOME , UI_SCREEN_PROV , UI_SCREEN_CARD_WAIT , UI_SCREEN_TOUCH_CAL
}
 Top-level screens of the payment flow. More...
enum  ui_event_t {
  UI_EVENT_AMOUNT_CONFIRMED , UI_EVENT_CONFIRM_OK , UI_EVENT_CONFIRM_CANCEL , UI_EVENT_PIN_ENTERED ,
  UI_EVENT_WIFI_SCAN , UI_EVENT_WIFI_TRY , UI_EVENT_TX_RETRY , UI_EVENT_ADMIN_SET ,
  UI_EVENT_WELCOME_DONE , UI_EVENT_PROV_AUTH , UI_EVENT_PROV_VALUE , UI_EVENT_PROV_VALUE_SET ,
  UI_EVENT_PROV_VALUE_NO , UI_EVENT_PROV_CARD , UI_EVENT_PROV_SCAN , UI_EVENT_PROV_NEXT ,
  UI_EVENT_PROV_FINISH , UI_EVENT_CARD_PIN , UI_EVENT_OTA_STAGED , UI_EVENT_TX_RECHECK ,
  UI_EVENT_PROV_STOP
}
 Events emitted by the UI task towards the main task. More...
enum  ui_tx_state_t {
  UI_TX_STATE_PLACE_CARD , UI_TX_STATE_PROCESSING , UI_TX_STATE_SIGNING , UI_TX_STATE_SENDING ,
  UI_TX_STATE_CONFIRMING , UI_TX_STATE_DONE , UI_TX_STATE_FAILED , UI_TX_STATE_UNCONFIRMED
}
 States shown on the transaction-status screen. More...
enum  ui_boot_err_t { UI_BOOT_ERR_NFC , UI_BOOT_ERR_WALLET , UI_BOOT_ERR_CONFIG }
 Startup faults shown on UI_SCREEN_BOOT_ERROR. More...

Functions

void ui_init (ui_event_cb_t cb)
 Initialise display + touch and start the UI task.
void ui_show_splash (void)
 Switch to the splash screen.
void ui_show_amount_entry (void)
 Switch to the amount-entry screen (forces a value redraw).
void ui_show_confirm (uint64_t amount_units, const char *dest_addr, const char *fee)
 Switch to the confirm screen.
void ui_show_tx_status (ui_tx_state_t state, const char *info)
 Switch to the transaction-status screen.
void ui_set_tx_info (const char *info)
 Replace the transaction screen's info line without rebuilding it.
size_t ui_take_pin (char *out, size_t n)
 Copy the most recently entered PIN out and wipe the UI's copy.
void ui_show_wifi_list (const net_wifi_ap_t *aps, uint16_t n, const char *note)
 Show the scanned Wi-Fi networks for the user to pick from.
void ui_show_boot_error (ui_boot_err_t kind, const char *detail)
 Show a startup fault, naming the cause and what to do about it.
void ui_set_addresses (const char *token_contract, const char *dest_addr)
 Provide the token contract and destination addresses for the confirm screen and the settings "Tx" tab (pointers stored as-is; pass static/literal storage that outlives the call).
void ui_refresh_addresses (void)
 Implemented by main: repoint those two rows at the selected chain.
void ui_refresh_addresses_for (uint8_t chain)
 Same, for any chain (a pos_chain_t) rather than the one sales use.
void ui_show_wifi_connecting (const char *ssid)
 Show a "Connecting to <ssid>…" screen while main associates.
void ui_set_boot_status (const char *step)
 Set the one-line progress note on the splash screen.
void ui_fees_changed (void)
 Note that the stored gas caps have changed, so the Tx tab can catch up.
void ui_clock_changed (void)
 Note that the stored UTC offset has changed, so the clock can catch up.
void ui_show_welcome (const char *sub)
 Greet the operator at the start of first-run setup, or after an update.
void ui_show_admin_set (void)
 Run the first-run admin-code creation (enter, then confirm).
size_t ui_take_wifi_creds (char *ssid, size_t ssid_n, char *pass, size_t pass_n)
 Fetch the selected SSID + entered password and wipe the UI's copy.
void ui_stage_wifi_creds (const char *ssid, const char *pass)
 Load credentials into the same handoff buffers the picker fills.
void ui_show_prov (int step)
 Show the setup screen: QR code, AP name and passphrase.
void ui_show_prov_confirm (void)
 Raise the modal that asks the operator to accept a value a browser proposed, reading the pending proposal from provision.h.
void ui_show_prov_auth (void)
 Demand the admin code so a browser can be authorised.
void ui_show_card_pin (void)
 Ask for the card PIN before reading an address off a Cryptnox card.
void ui_set_prov_note (const char *msg)
 Put a failure line on the setup screen, in red under the step title.
void ui_show_card_wait (const char *note)
 "Hold your card to the reader" while the address is read.
void ui_show_ota_confirm (void)
 Raise the modal that asks the operator to accept a firmware image the update page has uploaded, reading it from ota.h.

Detailed Description

Touchscreen UI API: screens, events and transaction states for the CYD (ILI9341 + XPT2046) payment flow.

Definition in file ui.h.

Typedef Documentation

◆ ui_event_cb_t

typedef void(* ui_event_cb_t) (ui_event_t event, uint64_t payload)

Callback invoked from the UI task on user interaction.

Runs in the UI task context — keep it short and non-blocking.

Parameters
[in]eventEvent identifier.
[in]payloadAmount in USDC base units for UI_EVENT_AMOUNT_CONFIRMED, 0 otherwise.

Definition at line 128 of file ui.h.

Enumeration Type Documentation

◆ ui_boot_err_t

Startup faults shown on UI_SCREEN_BOOT_ERROR.

Bring-up problems, not declined payments — hence their own screen. Wording lives in ui.cpp; the caller only names the fault.

Enumerator
UI_BOOT_ERR_NFC 

PN532 did not answer — wiring/power/I2C.

UI_BOOT_ERR_WALLET 

Reader answered, wallet layer failed to start.

UI_BOOT_ERR_CONFIG 

A config.h address in this build is invalid.

Definition at line 113 of file ui.h.

◆ ui_event_t

enum ui_event_t

Events emitted by the UI task towards the main task.

Enumerator
UI_EVENT_AMOUNT_CONFIRMED 

CONFIRM tapped; payload = amount.

UI_EVENT_CONFIRM_OK 

Send tapped on the Confirm screen.

UI_EVENT_CONFIRM_CANCEL 

Cancel tapped (Confirm or card wait).

UI_EVENT_PIN_ENTERED 

PIN keypad validated; fetch via ui_take_pin.

UI_EVENT_WIFI_SCAN 

User opened the Wi-Fi picker; main should scan.

UI_EVENT_WIFI_TRY 

Wi-Fi creds entered; fetch via ui_take_wifi_creds.

UI_EVENT_TX_RETRY 

New sale after Done/Failed, or Clear on Unconfirmed.

UI_EVENT_ADMIN_SET 

Admin code created and stored (first run).

UI_EVENT_WELCOME_DONE 

Start tapped on the welcome screen.

UI_EVENT_PROV_AUTH 

A browser asked to be authorised; the admin code has to be taken on the panel.

UI_EVENT_PROV_VALUE 

A payout address or token contract was proposed; needs accepting on the panel.

UI_EVENT_PROV_VALUE_SET 

That value was accepted and stored.

UI_EVENT_PROV_VALUE_NO 

That value was rejected on the panel. Its own event so a caller holding a second value to offer is not left waiting on an accept that will never come.

UI_EVENT_PROV_CARD 

The page asked the terminal to read the payout addresses off a Cryptnox card.

UI_EVENT_PROV_SCAN 

The page asked for a fresh Wi-Fi scan.

UI_EVENT_PROV_NEXT 

Continue tapped in the browser wizard.

UI_EVENT_PROV_FINISH 

Finish tapped on the panel's last screen.

UI_EVENT_CARD_PIN 

PIN entered for a card read, not a payment; fetch via ui_take_pin.

UI_EVENT_OTA_STAGED 

Firmware uploaded and verified; needs accepting on the panel before it boots.

UI_EVENT_TX_RECHECK 

Recheck tapped on Unconfirmed: poll the same sale's receipt again.

UI_EVENT_PROV_STOP 

The UI wants the config portal down (closed card, refused/failed update, admin window over). Main calls prov_stop(): it blocks for up to ~2 s, which froze the panel on the UI task.

Definition at line 55 of file ui.h.

◆ ui_screen_t

Top-level screens of the payment flow.

Enumerator
UI_SCREEN_SPLASH 

Boot splash while WiFi/RPC/wallet come up.

UI_SCREEN_AMOUNT 

Amount entry with +/- buttons.

UI_SCREEN_CONFIRM 

Amount + destination review.

UI_SCREEN_PIN 

Numeric keypad to enter the card PIN.

UI_SCREEN_WIFI_LIST 

Scanned Wi-Fi networks to pick from.

UI_SCREEN_WIFI_PASS 

Keyboard to enter the Wi-Fi password.

UI_SCREEN_WIFI_CONNECTING 

"Connecting…" while main associates.

UI_SCREEN_SETTINGS 

Full-screen settings (tabs).

UI_SCREEN_TX_STATUS 

Card wait / signing / broadcast progress.

UI_SCREEN_BOOT_ERROR 

Startup fault — names the cause, not "Declined".

UI_SCREEN_ADMIN_SET 

First-run creation of the admin code.

UI_SCREEN_ADMIN_UNLOCK 

Admin code demanded before the settings.

UI_SCREEN_WELCOME 

Greeting opening first-run setup.

UI_SCREEN_PROV 

QR + AP credentials for phone-based setup.

UI_SCREEN_CARD_WAIT 

"Tap your card" while an address is read.

UI_SCREEN_TOUCH_CAL 

Two-point touch calibration (Screen tab).

Definition at line 35 of file ui.h.

◆ ui_tx_state_t

States shown on the transaction-status screen.

Enumerator
UI_TX_STATE_PLACE_CARD 

Waiting for the card on the reader.

UI_TX_STATE_PROCESSING 

Card tapped — opening the secure channel.

UI_TX_STATE_SIGNING 

Card found, signing in progress.

UI_TX_STATE_SENDING 

Broadcasting the signed tx.

UI_TX_STATE_CONFIRMING 

Broadcast — waiting for the mined receipt.

UI_TX_STATE_DONE 

Receipt mined with status 0x1.

UI_TX_STATE_FAILED 

Nothing was sent; info line says why.

UI_TX_STATE_UNCONFIRMED 

Sent, or maybe sent, and no verdict yet — info is the tx hash. Never "Declined": the payment may still land.

Definition at line 94 of file ui.h.

Function Documentation

◆ ui_clock_changed()

void ui_clock_changed ( void )

Note that the stored UTC offset has changed, so the clock can catch up.

Same handoff as ui_fees_changed and for the same reason: the config page writes the offset straight through from the HTTP task, and the band's clock caches it rather than opening NVS on every three-second tick. Without this the panel keeps the old hour until something rebuilds the screen.

Safe from the HTTP task: applied by the UI task on its next pass.

Definition at line 788 of file ui.cpp.

References s_tz_dirty.

Referenced by clock_post().

◆ ui_fees_changed()

void ui_fees_changed ( void )

Note that the stored gas caps have changed, so the Tx tab can catch up.

The caps are the one setting the config page writes straight through, and that page is opened from a card raised over the settings screen — so the two gas rows underneath keep the values they were built with until the operator leaves the screen and comes back. This retexts them in place.

Safe from the HTTP task: applied by the UI task on its next pass, and a no-op when the rows are not on screen (any other screen, or Tron, which has no caps).

Definition at line 783 of file ui.cpp.

References s_fees_dirty.

Referenced by fees_post().

◆ ui_init()

void ui_init ( ui_event_cb_t cb)

Initialise display + touch and start the UI task.

Parameters
[in]cbEvent callback; must remain valid for the program lifetime.

Definition at line 696 of file ui.cpp.

References s_cb, s_req_screen, s_screen_dirty, s_ui_mx, UI_SCREEN_SPLASH, and ui_task().

Referenced by pos_boot().

◆ ui_refresh_addresses()

void ui_refresh_addresses ( void )

Implemented by main: repoint those two rows at the selected chain.

The asset picker switches the chain on the UI task and rebuilds the page immediately, so it asks for the new pair here rather than posting an event and racing its own redraw. main owns the per-chain contract and payout strings; this only reads them.

Definition at line 170 of file pay.cpp.

References settings_get_chain(), and ui_refresh_addresses_for().

Referenced by app_main(), btn_event_cb(), and pos_boot().

◆ ui_refresh_addresses_for()

void ui_refresh_addresses_for ( uint8_t c)

Same, for any chain (a pos_chain_t) rather than the one sales use.

Point the UI's address rows at the selected chain.

The admin Tx tab browses another asset's contract and payout without switching what the terminal charges in.

Same, for any chain (a pos_chain_t) rather than the one sales use.

Called on every entry to the confirm screen and from the asset picker, since the chain can be switched while this task is parked on its queue (see ui.h).

Definition at line 155 of file pay.cpp.

References active_token(), pos_chain_is_polygon(), pos_chain_is_tron(), s_payout_eth, s_payout_tron, token_t::str, and ui_set_addresses().

Referenced by build_settings(), and ui_refresh_addresses().

◆ ui_set_addresses()

void ui_set_addresses ( const char * token_contract,
const char * dest_addr )

Provide the token contract and destination addresses for the confirm screen and the settings "Tx" tab (pointers stored as-is; pass static/literal storage that outlives the call).

Definition at line 764 of file ui.cpp.

References s_addr_dest, and s_addr_usdc.

Referenced by ui_refresh_addresses_for().

◆ ui_set_boot_status()

void ui_set_boot_status ( const char * step)

Set the one-line progress note on the splash screen.

Updates the splash in place instead of switching screens. Safe from the main task: applied by the UI task on its next pass.

Parameters
[in]stepShort label ("Starting NFC reader"), copied internally. NULL or "" clears the line.

Definition at line 776 of file ui.cpp.

References s_boot_step, and s_boot_step_dirty.

Referenced by app_main(), pos_boot(), run_wizard(), and wifi_try_saved().

◆ ui_set_prov_note()

void ui_set_prov_note ( const char * msg)

Put a failure line on the setup screen, in red under the step title.

For the card read: a refused card, a wrong PIN or sixty seconds with no tap all end with the panel back on the step it started from, and without a reason there that reads as the terminal having reset itself mid-read. The browser gets the same sentence through prov_set_note — this is the copy for the person actually holding the card.

Cleared by ui_show_card_pin, so each attempt starts clean.

Parameters
[in]msgMessage, copied. NULL or "" clears it.

Definition at line 880 of file ui.cpp.

References s_prov_msg.

Referenced by run_wizard().

◆ ui_set_tx_info()

void ui_set_tx_info ( const char * info)

Replace the transaction screen's info line without rebuilding it.

For progress on a state that lasts: the receipt poll can run for two minutes, and calling ui_show_tx_status per pass would restart the spinner the operator is reading as "still working". No-op unless the transaction screen is up in one of its spinner states.

Parameters
[in]infoLine to show; copied internally, may be NULL to clear.

Definition at line 910 of file ui.cpp.

References s_tx_info, and s_tx_info_dirty.

Referenced by settle_inflight(), and sign_and_broadcast().

◆ ui_show_admin_set()

void ui_show_admin_set ( void )

Run the first-run admin-code creation (enter, then confirm).

Deliberately has no way out: everything behind the burger menu — Wi-Fi, fees, factory reset — sits behind this code, so the terminal must not become usable without one. Emits UI_EVENT_ADMIN_SET once stored.

Definition at line 818 of file ui.cpp.

References request_screen(), s_admin_confirming, s_admin_first, s_admin_note, and UI_SCREEN_ADMIN_SET.

Referenced by pos_boot().

◆ ui_show_amount_entry()

void ui_show_amount_entry ( void )

Switch to the amount-entry screen (forces a value redraw).

Definition at line 711 of file ui.cpp.

References request_screen(), s_amount_cents, s_amount_units, and UI_SCREEN_AMOUNT.

Referenced by app_main().

◆ ui_show_boot_error()

void ui_show_boot_error ( ui_boot_err_t kind,
const char * detail )

Show a startup fault, naming the cause and what to do about it.

Parameters
[in]kindWhich bring-up step failed.
[in]detailOptional technical detail for a technician (an esp_err_t name, say); copied internally, may be NULL.

Definition at line 795 of file ui.cpp.

References request_screen(), s_boot_detail, s_boot_err, and UI_SCREEN_BOOT_ERROR.

Referenced by boot_fault().

◆ ui_show_card_pin()

void ui_show_card_pin ( void )

Ask for the card PIN before reading an address off a Cryptnox card.

The card will not export a public key without a verified PIN, so deriving a payout address needs one exactly as signing does. Emits UI_EVENT_CARD_PIN, or UI_EVENT_CONFIRM_CANCEL if the operator backs out.

Definition at line 873 of file ui.cpp.

References request_screen(), s_pin_for_card, s_prov_msg, and UI_SCREEN_PIN.

Referenced by app_main(), and run_wizard().

◆ ui_show_card_wait()

void ui_show_card_wait ( const char * note)

"Hold your card to the reader" while the address is read.

Its own screen rather than the transaction one: nothing is being paid here, and the tx screen's wording and its Cancel semantics both belong to a sale.

Parameters
[in]noteOptional line under the prompt, copied internally.

Definition at line 886 of file ui.cpp.

References request_screen(), s_card_note, and UI_SCREEN_CARD_WAIT.

Referenced by card_connect().

◆ ui_show_confirm()

void ui_show_confirm ( uint64_t amount_units,
const char * dest_addr,
const char * fee )

Switch to the confirm screen.

Parameters
[in]amount_unitsAmount in USDC base units (6 decimals).
[in]dest_addr"0x..."-prefixed destination address; copied internally, may be NULL for none.
[in]feeThe network-fee ceiling as a line ("Fee up to 0.0013 ETH"), copied; NULL or "" for none.

Definition at line 718 of file ui.cpp.

References request_screen(), s_confirm_addr, s_confirm_amount, s_confirm_fee, and UI_SCREEN_CONFIRM.

Referenced by app_main().

◆ ui_show_ota_confirm()

void ui_show_ota_confirm ( void )

Raise the modal that asks the operator to accept a firmware image the update page has uploaded, reading it from ota.h.

Call after UI_EVENT_OTA_STAGED. Accepting reboots into the new firmware and does not return; declining discards the staging and leaves the running firmware alone. The panel is the only place either can happen — an upload on its own changes nothing about what boots.

Definition at line 893 of file ui.cpp.

References s_ota_modal_dirty.

Referenced by app_main().

◆ ui_show_prov()

void ui_show_prov ( int step)

Show the setup screen: QR code, AP name and passphrase.

The same screen at every wizard step, captioned with whichever one is current. There is deliberately no "use this screen instead" escape any more: the whole wizard past the admin code happens in the browser, so the panel's job here is to carry the QR code and to report progress.

Parameters
[in]stepThe prov_step_t the portal is serving. Typed as int to keep this header free of provision.h, which includes this one.

Definition at line 850 of file ui.cpp.

References request_screen(), s_prov_step, and UI_SCREEN_PROV.

Referenced by run_wizard().

◆ ui_show_prov_auth()

void ui_show_prov_auth ( void )

Demand the admin code so a browser can be authorised.

Same screen as the settings unlock, but a correct code calls prov_auth_resolve(true) instead of opening the menu, and backing out refuses the request rather than silently leaving the browser waiting.

Definition at line 861 of file ui.cpp.

References admin_penalty_ms(), request_screen(), s_admin_confirming, s_admin_for_portal, s_admin_lock_ms, s_admin_lock_start, s_admin_note, settings_admin_fail_count(), and UI_SCREEN_ADMIN_UNLOCK.

Referenced by app_main(), and run_wizard().

◆ ui_show_prov_confirm()

void ui_show_prov_confirm ( void )

Raise the modal that asks the operator to accept a value a browser proposed, reading the pending proposal from provision.h.

Call after UI_EVENT_PROV_VALUE. Accepting emits UI_EVENT_PROV_VALUE_SET; rejecting emits nothing and drops the proposal, so a caller waiting on the step stays where it is and can be offered another.

Definition at line 856 of file ui.cpp.

References s_addr_modal_dirty.

Referenced by app_main(), and run_wizard().

◆ ui_show_splash()

void ui_show_splash ( void )

Switch to the splash screen.

Definition at line 706 of file ui.cpp.

References request_screen(), and UI_SCREEN_SPLASH.

Referenced by pos_boot().

◆ ui_show_tx_status()

void ui_show_tx_status ( ui_tx_state_t state,
const char * info )

Switch to the transaction-status screen.

Parameters
[in]stateTransaction state to display.
[in]infoOptional info line (tx hash, error message); copied internally, may be NULL for none.

Definition at line 898 of file ui.cpp.

References request_screen(), s_tx_info, s_tx_state, and UI_SCREEN_TX_STATUS.

Referenced by app_main(), card_connect(), settle_inflight(), sign_and_broadcast(), and sign_and_broadcast_tron().

◆ ui_show_welcome()

void ui_show_welcome ( const char * sub)

Greet the operator at the start of first-run setup, or after an update.

Shown on a virgin or factory-reset terminal, before the Wi-Fi and admin-code steps, and again on the first boot of a freshly installed image. Emits UI_EVENT_WELCOME_DONE when Start is tapped.

Parameters
[in]subLine under the product name, copied internally. NULL keeps the first-run wording ("Let's configure your terminal.").

Definition at line 807 of file ui.cpp.

References request_screen(), s_welcome_sent, s_welcome_sub, and UI_SCREEN_WELCOME.

Referenced by pos_boot().

◆ ui_show_wifi_connecting()

void ui_show_wifi_connecting ( const char * ssid)

Show a "Connecting to <ssid>…" screen while main associates.

Interactive picker only; unattended boot reports through ui_set_boot_status and stays on the splash.

Definition at line 770 of file ui.cpp.

References request_screen(), set_wifi_progress(), and UI_SCREEN_WIFI_CONNECTING.

Referenced by app_main(), run_wizard(), and wifi_picker().

◆ ui_show_wifi_list()

void ui_show_wifi_list ( const net_wifi_ap_t * aps,
uint16_t n,
const char * note )

Show the scanned Wi-Fi networks for the user to pick from.

Parameters
[in]apsArray of scanned APs (copied internally).
[in]nNumber of entries in aps.
[in]noteOptional one-line reason the picker (re)opened, shown above the list; copied internally, NULL for none. Applied on every call, so a stale note cannot survive a later render.

Definition at line 747 of file ui.cpp.

References request_screen(), s_ap_count, s_aps, s_wifi_note, UI_SCREEN_WIFI_LIST, and WIFI_MAX_APS.

Referenced by app_main(), and wifi_picker().

◆ ui_stage_wifi_creds()

void ui_stage_wifi_creds ( const char * ssid,
const char * pass )

Load credentials into the same handoff buffers the picker fills.

Lets the setup page hand Wi-Fi credentials to main through the existing UI_EVENT_WIFI_TRY path, so a form submission and a screen tap reach the connect-and-verify loop identically. The caller emits the event afterwards.

Parameters
[in]ssidNetwork name.
[in]passPassphrase; the caller wipes its own copy.

Definition at line 842 of file ui.cpp.

References s_wifi_pass, and s_wifi_ssid.

Referenced by wifi_post().

◆ ui_take_pin()

size_t ui_take_pin ( char * out,
size_t n )

Copy the most recently entered PIN out and wipe the UI's copy.

Call once after UI_EVENT_PIN_ENTERED. The internal buffer is secure-wiped on read, so a second call returns 0.

Parameters
[out]outDestination buffer (NUL-terminated on return).
[in]nCapacity of out.
Returns
number of PIN digits copied (0 if none available).

Definition at line 733 of file ui.cpp.

References s_pin, and s_pin_len.

Referenced by app_main(), and run_wizard().

◆ ui_take_wifi_creds()

size_t ui_take_wifi_creds ( char * ssid,
size_t ssid_n,
char * pass,
size_t pass_n )

Fetch the selected SSID + entered password and wipe the UI's copy.

Call once after UI_EVENT_WIFI_TRY.

Parameters
[out]ssidSSID buffer (>= 33 bytes).
[in]ssid_nCapacity of ssid.
[out]passPassword buffer (>= 65 bytes).
[in]pass_nCapacity of pass.
Returns
length of the SSID (0 if none available).

Definition at line 827 of file ui.cpp.

References s_wifi_pass, and s_wifi_ssid.

Referenced by app_main(), run_wizard(), and wifi_picker().