|
SDK for TESAIoT Dev Kit
API reference & tutorials (ModusToolbox)
|
Functions | |
| bool | ble_nus_init (const ble_nus_config_t *cfg) |
| Initialise the AIROC stack and start advertising; the chip-power task must own the boot call. | |
| int | ble_nus_send (const uint8_t *data, size_t len) |
| Send bytes over NUS TX; -1 unless connected with notifications on. Weak stub exists pre-init. | |
| ble_nus_state_t | ble_nus_get_state (void) |
| Lock-free state read, safe before init; the firmware polls it rather than trusting the callback. | |
| void | ble_nus_deinit (void) |
| Soft-stop: drops advertising and the link, keeps the AIROC host stack alive. | |
| void | ble_nus_rearm_advertising (void) |
| Re-arm advertising on an already-initialised stack; idempotent from any state. | |
| const char * | ble_nus_get_adv_name (void) |
| Pointer to the static Bento-XXXX advertising name; NULL until the BD address resolves. | |
| void | ble_nus_passkey_cb (const char *passkey_6_digits) |
| Weak pairing-passkey callback — not reached in this build. | |
| void | ble_nus_get_diagnostics (ble_nus_diag_t *out) |
| Fill a caller-owned diagnostics snapshot — the _diag.ble block of bento.fw.query. | |
Eight functions: the ble_nus_* transport — init, deinit, send, get_state, get_adv_name, rearm_advertising, passkey_cb, get_diagnostics. Compiled only with ENABLE_PAGE_BENTO_BUDDY=1 (default 0, proj_cm33_ns/Makefile:64, :305); rebuild after make getlibs — Flag gate (read first).
Declarations: ble_nus.h. Implementation ble_nus.c is archived in libbento_secure.a. Two of these functions have weak stubs in ble_nus.c (ble_nus_send at :65, ble_nus_get_state at :68) so a translation unit may reference them before the stack exists; the real definitions (:878, :964) win when the BLE component links.
| bool ble_nus_init | ( | const ble_nus_config_t * | cfg | ) |
Initialise the AIROC stack and start advertising; the chip-power task must own the boot call.
Initialize the AIROC BLE host stack, register NUS GATT service, and start advertising. Returns false on stack init failure (check UART log).
| int ble_nus_send | ( | const uint8_t * | data, |
| size_t | len ) |
Send bytes over NUS TX; -1 unless connected with notifications on. Weak stub exists pre-init.
Send a notification on NUS TX characteristic. Fragmented into MTU-sized chunks internally. Thread-safe (enqueues to BLE task). Returns bytes queued, or -1 if disconnected / not initialized.
| ble_nus_state_t ble_nus_get_state | ( | void | ) |
Lock-free state read, safe before init; the firmware polls it rather than trusting the callback.
Current connection state (polled from UI layer).
| void ble_nus_deinit | ( | void | ) |
Soft-stop: drops advertising and the link, keeps the AIROC host stack alive.
Soft-stop: stop advertising + drop any active GATT link, but keep the AIROC host stack alive. Pair with ble_nus_rearm_advertising to toggle the link without re-running the heavy stack init/deinit cycle (which crashed CM33 when invoked from the IPC RX task — see ISSUE-029).
| void ble_nus_rearm_advertising | ( | void | ) |
Re-arm advertising on an already-initialised stack; idempotent from any state.
Re-arm undirected-high advertising on a stack that's already been initialized once via ble_nus_init. Idempotent — safe to call from any state (skips the start_advertisements call if state isn't OFF).
| const char * ble_nus_get_adv_name | ( | void | ) |
Pointer to the static Bento-XXXX advertising name; NULL until the BD address resolves.
Pointer to the static "Bento-XXXX" advertising name (lifetime = process). Returns NULL until ble_nus_init has resolved the local BD address and built the suffix.
| void ble_nus_passkey_cb | ( | const char * | passkey_6_digits | ) |
Weak pairing-passkey callback — not reached in this build.
Weak callback for a pairing passkey notification.
NOT REACHED IN THIS BUILD, and no passkey is ever shown. Pairing is configured as Just Works: ble_nus.c sets local_io_cap = BTM_IO_CAPABILITIES_NONE (NoInputNoOutput) auth_req = BTM_LE_AUTH_REQ_SC_BOND (no MITM bit) and a NoInputNoOutput association never raises BTM_PASSKEY_NOTIFICATION_EVT, so this callback is not invoked.
The DisplayOnly + 6-digit passkey flow it was written for is NOT YET IMPLEMENTED. The hook is kept so the integration layer (e.g. bento_buddy_task.c) can forward the code to the CM55 UI once that flow ships. The default implementation is a no-op.
| void ble_nus_get_diagnostics | ( | ble_nus_diag_t * | out | ) |
Fill a caller-owned diagnostics snapshot — the _diag.ble block of bento.fw.query.