Illustrated C/C++ source sheets, symbol index, API relationship graph, compiler console and debug trace

LIVE AI / FLEXIBLE SENSING / FLIGHT CONTEXT

Sensoraia API

Live AI and sensing, connected to the flight.
See, listen, inspect and return supported results while airborne.

Loading...
Searching...
No Matches
inference_settings.c File Reference

Strict shared fields and deterministic application_settings.ini lookup. More...

#include "inference_settings.h"
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
Include dependency graph for inference_settings.c:

Go to the source code of this file.

Data Structures

struct  settings_parser
 Borrowed dispatch state scoped to one destructive INI parse. More...

Functions

void inference_settings_init (struct inference_settings *settings, enum inference_backend backend)
 Reset storage and select conservative thread/timeout defaults.
static bool text_copy (char *destination, size_t capacity, const char *source)
 Reject truncation and control characters before accepting configuration text.
int inference_settings_field (struct inference_settings *settings, const char *key, const char *value)
 Parse one common key without consuming module-specific keys.
bool inference_resolve_path (const char *base_file, const char *value, char *destination, size_t capacity)
 Resolve an INI-relative path without requiring its destination to exist yet.
static bool settings_field (void *context, const char *key, const char *value)
 Delegate only unknown common keys; an invalid common key must not be accepted by a module.
bool inference_settings_read (struct inference_settings *settings, const char *filename, ini_field_handler extra, void *context, char *error, size_t capacity)
 Parse one flat INI, delegate application keys and resolve paths against the selected file.
bool inference_settings_find (const char *application, const char *module, char *filename, size_t capacity)
 Discover application_settings.ini in adjacent, development-module, then installed-share order.

Detailed Description

Strict shared fields and deterministic application_settings.ini lookup.

Module callbacks own module-specific keys; this layer never guesses a model's meaning.

Definition in file inference_settings.c.

Function Documentation

◆ inference_resolve_path()

bool inference_resolve_path ( const char * base_file,
const char * value,
char * destination,
size_t capacity )

Resolve an INI-relative path without requiring its destination to exist yet.

Parameters
base_fileSettings filename whose parent supplies the relative base.
valueAbsolute or relative path; control characters are rejected.
destinationWritable normalized absolute path, distinct from the inputs.
capacityDestination capacity including its terminator.
Returns
True for a complete, nontruncated path. This is lexical normalization, not symlink resolution.

Definition at line 93 of file inference_settings.c.

◆ inference_settings_field()

int inference_settings_field ( struct inference_settings * settings,
const char * key,
const char * value )

Parse one common key without consuming module-specific keys.

Parameters
settingsInitialized destination; its seen mask rejects duplicates.
keyFlat key emitted by the bounded INI parser.
valueNonempty parsed value; no pointer into it is retained.
Returns
One if accepted, zero if unknown, minus one if invalid/duplicate.

Definition at line 53 of file inference_settings.c.

◆ inference_settings_find()

bool inference_settings_find ( const char * application,
const char * module,
char * filename,
size_t capacity )

Discover application_settings.ini in adjacent, development-module, then installed-share order.

Supports both bin/ application executables and the root-level USHER owner, without consulting the caller's current directory.

Parameters
applicationLowercase executable name without an architecture suffix.
moduleLowercase module directory name, such as spotter_cam.
filenameDestination path; meaningful only on success.
capacityAvailable bytes in filename.
Returns
True after finding a regular file, never a current-directory fallback.

Definition at line 202 of file inference_settings.c.

◆ inference_settings_init()

void inference_settings_init ( struct inference_settings * settings,
enum inference_backend backend )

Reset storage and select conservative thread/timeout defaults.

Parameters
settingsWritable owner, or NULL to do nothing.
backendApplication default used when the INI omits the backend.

Definition at line 28 of file inference_settings.c.

◆ inference_settings_read()

bool inference_settings_read ( struct inference_settings * settings,
const char * filename,
ini_field_handler extra,
void * context,
char * error,
size_t capacity )

Parse one flat INI, delegate application keys and resolve paths against the selected file.

Parameters
settingsInitialized destination; discard partially parsed values on failure.
filenameSelected settings file, independent of the caller's current directory.
extraOptional handler for application-specific fields.
contextBorrowed extra-handler state, used only during this call.
errorWritable failure diagnostic, cleared on success.
capacityAvailable bytes in error.
Returns
True for valid bounded syntax, accepted fields and resolvable lexical paths.

AUTO resolves .onnx/.rpk suffixes and an omitted ONNX descriptor to the same-name .ini. It does not test availability or fall back after errors.

Definition at line 158 of file inference_settings.c.

◆ settings_field()

bool settings_field ( void * context,
const char * key,
const char * value )
static

Delegate only unknown common keys; an invalid common key must not be accepted by a module.

Definition at line 151 of file inference_settings.c.

◆ text_copy()

bool text_copy ( char * destination,
size_t capacity,
const char * source )
static

Reject truncation and control characters before accepting configuration text.

Definition at line 40 of file inference_settings.c.