|
SDK for TESAIoT Dev Kit
API reference & tutorials (ModusToolbox)
|
Functions | |
| bool | wifi_saved_probe_start (void) |
| Sends the OPTIGA presence probe; strict start → ready → finish order. | |
| bool | wifi_saved_probe_ready (void) |
| May be true immediately after probe_start() — handle the cached fast path. | |
| void | wifi_saved_probe_finish (void) |
| Exactly once per probe, only after probe_ready(); sets the OPTIGA / RAM-fallback state. | |
| bool | wifi_saved_read_start (int index) |
| One in-flight slot read at a time; a false return skips the slot. | |
| bool | wifi_saved_read_ready (void) |
| Not ready means try again next tick. | |
| bool | wifi_saved_read_result (wifi_saved_entry_t *out) |
| Fills a caller-owned entry; false means the slot is absent. | |
| int | wifi_saved_find (const char *ssid) |
| Find a saved network by SSID. | |
| bool | wifi_saved_erase (int index) |
| Erase a saved network from OPTIGA slot. | |
| bool | wifi_saved_add (const char *ssid, const char *password, uint8_t security) |
| Add or update a network in saved list. If SSID already exists, updates in-place. If not, uses the first empty slot (or overwrites slot 0 if full). | |
| int | wifi_saved_load_all (wifi_saved_entry_t *entries) |
| Load all saved networks into an array. | |
| bool | wifi_saved_load (int index, wifi_saved_entry_t *out) |
| Load a saved network from OPTIGA slot. | |
| bool | wifi_saved_store (int index, const wifi_saved_entry_t *entry) |
| Store a network entry to OPTIGA slot. | |
| int | wifi_saved_count (void) |
| Count number of valid saved networks. | |
Header: wifi_saved.h. Implementation: archived wifi_saved.c (libbento_cm55.a). Up to WIFI_SAVED_MAX (6) entries of 106 packed bytes each, one per OPTIGA Type 3 data object, with LRU eviction and a RAM fallback when OPTIGA is absent. Two access styles exist and the template uses both deliberately: the synchronous wifi_saved_load_all() (~1.5 s, used for post-mutation refresh) and the asynchronous probe + slot-read machinery (used for the initial page load so the screen never blocks). The template caller for everything in this topic is proj_cm55/modules/page-components/wifi_connect/demo/wifi_connect_native/wifi_connect_native.c, and every one of its callbacks re-checks s_ctx.ui == NULL first because the page can be destroyed while IPC is in flight.
| bool wifi_saved_probe_start | ( | void | ) |
Sends the OPTIGA presence probe; strict start → ready → finish order.
probe_start() then poll probe_ready() then probe_finish(). The caller polls at 100 ms and deletes its own timer before advancing. LVGL timer / GFX-task context. | bool wifi_saved_probe_ready | ( | void | ) |
May be true immediately after probe_start() — handle the cached fast path.
probe_start() (cached result) — the caller must handle that fast path rather than unconditionally arming a poll timer, which is why the template has two call sites. GFX-task context. | void wifi_saved_probe_finish | ( | void | ) |
Exactly once per probe, only after probe_ready(); sets the OPTIGA / RAM-fallback state.
probe_ready() returned true; it sets the OPTIGA / RAM-fallback state the reads depend on. After it, wifi_saved_load() skips the probe. GFX-task context. | bool wifi_saved_read_start | ( | int | index | ) |
One in-flight slot read at a time; a false return skips the slot.
read_ready(). A false return is a real error path — the template skips that slot and advances, it does not retry or abort. Only after the probe sequence completed (the slot callback is created only post-probe_finish()). GFX-task context. | bool wifi_saved_read_ready | ( | void | ) |
Not ready means try again next tick.
| bool wifi_saved_read_result | ( | wifi_saved_entry_t * | out | ) |
Fills a caller-owned entry; false means the slot is absent.
wifi_saved_entry_t; copy it out immediately. A false return is non-fatal — the slot is simply absent from the result and the index advances. GFX-task context. | int wifi_saved_find | ( | const char * | ssid | ) |
Find a saved network by SSID.
Resolves SSID to storage slot — UI list index is not the slot index.
| ssid | SSID to search for |
< 0 on a miss. Internally driven by wifi_saved_load(), so the storage layer (probe) must be up. | bool wifi_saved_erase | ( | int | index | ) |
Erase a saved network from OPTIGA slot.
Erases one slot, resolved via wifi_saved_find(); recovery is a full refresh.
| index | Slot index 0..5 |
slot >= 0 from wifi_saved_find(). The bool return is deliberately ignored by the shipped caller: recovery is a full UI refresh through wifi_saved_load_all(). | bool wifi_saved_add | ( | const char * | ssid, |
| const char * | password, | ||
| uint8_t | security ) |
Add or update a network in saved list. If SSID already exists, updates in-place. If not, uses the first empty slot (or overwrites slot 0 if full).
Saves credentials only after a confirmed successful association.
| ssid | Network SSID |
| password | Network password |
| security | Security type |
find, zero-fill, NUL-termination at ssid[32] / password[64], flags = 0x01 (auto-connect) and last_used are all internal (wifi_saved.c:266-304), and the write goes through wifi_saved_store(). The return is not checked by the shipped caller; the follow-up refresh is the de-facto verification. | int wifi_saved_load_all | ( | wifi_saved_entry_t * | entries | ) |
Load all saved networks into an array.
Synchronous full read (~1.5 s) into wifi_saved_entry_t[WIFI_SAVED_MAX].
| entries | Output array (must have WIFI_SAVED_MAX elements) |
wifi_saved_entry_t[WIFI_SAVED_MAX] — there is no capacity argument. Returns the populated count (compacted), not a status. This is the synchronous path (a wifi_saved_load() loop, ~1.5 s — see the comment at wifi_connect_native.c:136-143), used for post-mutation refresh; the initial page load uses the async probe + read machinery instead. Keep that split. | bool wifi_saved_load | ( | int | index, |
| wifi_saved_entry_t * | out ) |
Load a saved network from OPTIGA slot.
Reads one slot synchronously; internal — consumers use load_all()/find().
| index | Slot index 0..5 |
| out | Output entry (filled on success) |
wifi_saved.c (:252, :271, :282, :312, :325). Consumers use wifi_saved_load_all() or wifi_saved_find(); the authored example says so and shows the one legitimate reason to reach for it. | bool wifi_saved_store | ( | int | index, |
| const wifi_saved_entry_t * | entry ) |
Store a network entry to OPTIGA slot.
Writes one slot; internal to wifi_saved_add() — direct calls bypass dedupe.
| index | Slot index 0..5 |
| entry | Entry to write |
wifi_saved.c:304, from inside wifi_saved_add() after that function has built the entry. Consumers use wifi_saved_add(); calling this directly bypasses dedupe, NUL-termination and the LRU timestamp. | int wifi_saved_count | ( | void | ) |
Count number of valid saved networks.
Returns 0..6; zero callers workspace-wide.
wifi_saved_load_all()'s return instead. Authored.