SDK for TESAIoT Dev Kit
API reference & tutorials (ModusToolbox)
Loading...
Searching...
No Matches
Results, registry and settling

Functions

bool ai_engine_snapshot (ai_result_t *out)
 Copy the latest verdict from any model — not valid inside a set.
bool ai_engine_snapshot_model (uint32_t index, ai_result_t *out)
 One model's last verdict — the reader to use inside a set.
uint32_t ai_engine_model_count (void)
 How many models are registered; the count leads the rows.
const ai_model_desc_t * ai_engine_model (uint32_t index)
 Registry entry, NULL if out of range — and NULL for a set pseudo-index.
bool ai_engine_mic_settling (void)
 True for a few seconds after a set starts, while its inputs settle; verdicts are withheld.
uint32_t ai_engine_mic_settle_pct (void)
 Settle progress 0..100; only meaningful inside a set (100 otherwise).

Detailed Description

Six functions: the two result readers (and when each is valid), the registry enumeration pair, and the two settle readings a set exposes.

Variant
mtb-mpy and mtb-only

Function Documentation

◆ ai_engine_snapshot()

bool ai_engine_snapshot ( ai_result_t * out)

Copy the latest verdict from any model — not valid inside a set.

Copy the latest result. Returns false if nothing has been published yet.

Contract
Copies the latest published verdict from any model; false if nothing has been published yet. It is therefore not valid inside a set — a cough detected at 0.94 is followed by three "unlabelled" verdicts from the other members before anyone reads it; the detection is not late, it is gone. Branch on ai_engine_active() being in [AI_PARALLEL_FIRST, AI_PARALLEL_MIC] and use ai_engine_snapshot_model() per member in that case. Test the whole range, not == AI_PARALLEL_MIC, which covers only one of the four sets. Reduce a result with ai_result_top_positive() — ai_result_t has no valid/label/confidence field (Header facts that are easy to get wrong).
Variant
mtb-mpy and mtb-only

◆ ai_engine_snapshot_model()

bool ai_engine_snapshot_model ( uint32_t index,
ai_result_t * out )

One model's last verdict — the reader to use inside a set.

One model's last verdict. Use this, not ai_engine_snapshot(), whenever several models may be publishing: that one reports whoever wrote most recently, so three quiet models can bury a detection before it is read. False if that model has never published.

Contract
One model's last verdict. Use this in sets. False means "this model has never published" — which is not the same as "silent" (a member that published once and then went quiet still returns true with a seq that no longer advances; the Edge AI page derives a per-row silence timer from how long seq has not changed). index must be a real registry index, never a set pseudo-index — obtain members from ai_engine_set_members() (active set) or ai_engine_set_models() (any set).
Variant
mtb-mpy and mtb-only

◆ ai_engine_model_count()

uint32_t ai_engine_model_count ( void )

How many models are registered; the count leads the rows.

Contract
How many models are registered (compiled-in plus rows added at run time). The count leads the rows**: ai_engine_model(i) for i < count may still return NULL for an index with no row behind it — continue, do not abort the enumeration.
Variant
mtb-mpy and mtb-only

◆ ai_engine_model()

const ai_model_desc_t * ai_engine_model ( uint32_t index)

Registry entry, NULL if out of range — and NULL for a set pseudo-index.

Registry entry (NULL if out of range).

Contract
Registry entry, NULL if out of range — and NULL for a set pseudo-index. Branch on idx >= AI_PARALLEL_FIRST first and walk the set's members with ai_engine_set_models() before touching a descriptor. Descriptors and the strings they point at stay valid for the life of the boot. Registry contract: class_labels[0] is the negative class; everything from 1 up is a positive detection.
Variant
mtb-mpy and mtb-only

◆ ai_engine_mic_settling()

bool ai_engine_mic_settling ( void )

True for a few seconds after a set starts, while its inputs settle; verdicts are withheld.

True for a few seconds after a set starts, while its inputs settle. Verdicts are withheld until it returns false; show it rather than silent zero bars.

Contract
True for a few seconds after a set starts, while the set's inputs settle; verdicts are withheld until it returns false. Show progress rather than silent zero bars — and keep the stats line updating during the settle, otherwise an NPU stall in that period is invisible. False outside a set.
Variant
mtb-mpy and mtb-only

◆ ai_engine_mic_settle_pct()

uint32_t ai_engine_mic_settle_pct ( void )

Settle progress 0..100; only meaningful inside a set (100 otherwise).

Settle progress, 0..100, for a caller that wants to show it moving.

Contract
Settle progress 0..100 for a caller that wants to show it moving. Only meaningful inside a set; returns 100 otherwise. The Edge AI page writes the label only when the value changed, to avoid redundant LVGL work.
Variant
mtb-mpy and mtb-only