|
SDK for TESAIoT Dev Kit
API reference & tutorials (ModusToolbox)
|
The five WEAK hooks the consumer implements — and never calls. Compiled only with ENABLE_PAGE_BENTO_BUDDY=1 (default 0, proj_cm33_ns/Makefile:64, :305); rebuild after make getlibs — Flag gate (read first).
These five names are exactly template/lib/ble_nus/overridable.txt. The archive exports them WEAK; bento_secure_undeclared.h records "Define your own; yours wins at link time." The consumer implements them and never calls them — the archived radio scheduler calls into them. No shipped dist/ble_nus/include header declares them; the prototypes below are from template/proj_cm33_ns/wifi_init.h, and the strong definitions are in template/proj_cm33_ns/wifi_init.c (ships in both zips). Line mapping of those definitions, adjudicated in design review: :193 = app_wifi_connect_direct, :248 = app_wifi_disconnect, :256 = app_wifi_get_ipv4, :261 = lfs_save_wifi_creds, :304 = lfs_load_wifi_creds (numbers as of that review; the marker tags below are the durable reference). "0 template call sites" for all five is correct and expected.
Contract (what your definition must do). Initialise WCM if needed, then cy_wcm_connect_ap with 3 retries; return 0 on success, non-zero (cy_rslt_t) on failure. The shipped override prints [wifi-glue] lines on each attempt — a live observable (wifi_init.c has no printf mute).
Contract. Tear down the active link; 0 on success; must be safe when not connected.
Contract. Current IPv4 in network byte order, 0 if no link — the scheduler copies it into radio_status_t::ipv4.
Contract. Save credentials to LittleFS; 0 on success, non-zero on write failure; existing credentials for the same SSID are overwritten. Locking caveat: the shipped definition is a read-modify-write of the LFS file directly, with no wifi_creds_lock — it bypasses g_boot_wifi_creds and can race a concurrent lfs_wifi_creds_write on the same file (there is no file-level lock outside mtb-only's bs_lock()). Called by the archived radio_scheduler_set_wifi_creds().
Contract. true if credentials are present and non-empty, filling the output buffers NUL-terminated and truncated to cap - 1. In mtb-only this resolves against the C credential store. Read by the scheduler's boot decision (Wi-Fi if saved credentials exist under RADIO_BOOT_AUTO).