SDK for TESAIoT Dev Kit
API reference & tutorials (ModusToolbox)
Loading...
Searching...
No Matches

Functions

int sensor_stream_init (void)
 One-time task spawn, invoked lazily by sensor_stream_start() — never call directly.
int sensor_stream_start (const char *id, uint32_t interval_ms)
 Start streaming one sensor; the shipped caller clamps the interval to [10, 5000] ms.
void sensor_stream_stop (const char *id)
 Stop the active stream; idempotent.
void sensor_stream_stop_all (void)
 Stop any active stream unconditionally — the quiesce-before-update path.
bool sensor_stream_is_active (void)
 True iff a stream is active; the update handler's "busy" guard.
uint32_t sensor_stream_dropped_count (void)
 Samples the NUS TX path refused (link down or buffer full); board-info diagnostics.
int voice_capture_start (const char *id, uint32_t sample_rate_hz)
 Start a (stub) capture; emits one second of silence synchronously — the caller blocks.
void voice_capture_stop (void)
 Idempotent stop; emits a final "final":true chunk if a capture is active.
bool voice_capture_is_running (void)
 True iff a capture is running; the mic-button label and start guard. No caller anywhere.

Detailed Description

Nine functions: sensor_stream_* and voice_capture_*. 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: sensor_stream.h, voice_capture.h. Implementation sensor_stream.c / voice_capture.c is archived in libbento_secure.a. voice_capture is a stub by its own header: the real PDM-PCM path is not wired; it emits one synthetic second of silence as bento.voice.chunk frames so the desktop parser can be validated end to end.

Variant
mtb-mpy and mtb-only

Function Documentation

◆ sensor_stream_init()

int sensor_stream_init ( void )

One-time task spawn, invoked lazily by sensor_stream_start() — never call directly.

Contract
One-time FreeRTOS task spawn; subsequent calls are no-ops. Invoked lazily by sensor_stream_start() itself — never call directly. Template call sites: 0; archived call site sensor_stream.c:236 (if (sensor_stream_init() != 0) return -1; inside sensor_stream_start — compiled into libbento_secure.a, not shipped as source).
Variant
mtb-mpy and mtb-only

◆ sensor_stream_start()

int sensor_stream_start ( const char * id,
uint32_t interval_ms )

Start streaming one sensor; the shipped caller clamps the interval to [10, 5000] ms.

Contract
Starts streaming sensor id at interval_ms; the shipped caller clamps the interval to [10, 5000] ms before the call. Replaces any in-progress stream (v1 is single-stream). Returns 0, or -1 when the id is not recognised — the caller answers with an unknown_id nack. Template call sites: 0 (archived: 1).
Variant
mtb-mpy and mtb-only
Origin
Lifted from BENTO-TESAIoT-libraries/claw/common/ble_nus/nus_commands.c:770-784 (compiled into the prebuilt archive; not shipped as source).

◆ sensor_stream_stop()

void sensor_stream_stop ( const char * id)

Stop the active stream; idempotent.

Contract
Stops the active stream; idempotent. Template call sites: 0; archived call site nus_commands.c:790 (sensor_stream_stop(id); — the bento.sensor.stream.stop verb; compiled into libbento_secure.a, not shipped as source).
Variant
mtb-mpy and mtb-only

◆ sensor_stream_stop_all()

void sensor_stream_stop_all ( void )

Stop any active stream unconditionally — the quiesce-before-update path.

Contract
Stops any active stream unconditionally; idempotent. Used by the firmware-update flow on Y-approve so the flasher operates on a quiescent device. Template call sites: 0; archived call site bento_fw.c:343 (sensor_stream_stop_all(); — the quiesce-before-update path; compiled into libbento_secure.a, not shipped as source).
Variant
mtb-mpy and mtb-only

◆ sensor_stream_is_active()

bool sensor_stream_is_active ( void )

True iff a stream is active; the update handler's "busy" guard.

Contract
True iff a stream is active; the update handler uses it to answer {"ok":false,"error":"busy"} when a flash attempt races a running stream. Template call sites: 0; archived call site bento_fw.c:299 (if (sensor_stream_is_active()) { — compiled into libbento_secure.a, not shipped as source).
Variant
mtb-mpy and mtb-only

◆ sensor_stream_dropped_count()

uint32_t sensor_stream_dropped_count ( void )

Samples the NUS TX path refused (link down or buffer full); board-info diagnostics.

Contract
Samples dropped because the NUS TX path refused them (link down or buffer full); exposed in the board-info diagnostics. Template call sites: 0; archived call site nus_commands.c:1334 ((unsigned)sensor_stream_dropped_count(), in the diagnostics JSON — compiled into libbento_secure.a, not shipped as source).
Variant
mtb-mpy and mtb-only

◆ voice_capture_start()

int voice_capture_start ( const char * id,
uint32_t sample_rate_hz )

Start a (stub) capture; emits one second of silence synchronously — the caller blocks.

Contract
id travels on every bento.voice.chunk frame; sample_rate_hz is advisory (the stub uses the 16 kHz default). Returns 0, or -1 if a capture is already running or no link is available. The stub emits one second of silence synchronously (comment at ipc_bento_buddy_bridge.c:133), so the caller blocks for the emission. Template call sites: 0; archived call site ipc_bento_buddy_bridge.c:138 ((void)voice_capture_start((const char *)msg->data, — CM55 mic-button tap via IPC; compiled into libbento_secure.a, not shipped as source).
Variant
mtb-mpy and mtb-only

◆ voice_capture_stop()

void voice_capture_stop ( void )

Idempotent stop; emits a final "final":true chunk if a capture is active.

Contract
Idempotent; emits a final "final":true chunk if a capture is active so the desktop can close its accumulator. Template call sites: 0; archived call site ipc_bento_buddy_bridge.c:141 (voice_capture_stop(); — compiled into libbento_secure.a, not shipped as source).
Variant
mtb-mpy and mtb-only

◆ voice_capture_is_running()

bool voice_capture_is_running ( void )

True iff a capture is running; the mic-button label and start guard. No caller anywhere.

Contract
True iff a capture is running; meant for the mic-button label and as the guard before voice_capture_start(). No caller anywhere.
Variant
mtb-mpy and mtb-only
Example (authored — no shipped call site)
static void bento_ex_voice_capture_is_running(void)
{
voice_capture_stop(); /* toggle off — idempotent, emits a
* final "final":true chunk */
} else {
/* Toggle on: id travels on every bento.voice.chunk frame. */
if (voice_capture_start("clip-1",
/* already running (race) or no link — leave the label as-is */
}
}
}