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.h
Go to the documentation of this file.
1/*
2 * Copyright 2026 OpenUAS
3 * SPDX-License-Identifier: Apache-2.0
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18/** @file inference_settings.h
19 * @brief Shared application_settings.ini discovery with module-owned extra keys. */
20#ifndef SENSORAIA_INFERENCE_SETTINGS_H
21#define SENSORAIA_INFERENCE_SETTINGS_H
22
23#include "bounded_ini.h"
24#include <stddef.h>
25#include <stdint.h>
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31#define INFERENCE_PATH_CAPACITY 4096U
32
33/** @brief Backend selection; AUTO resolves the model suffix, never an execution error. */
35/** @brief Acquisition choice, deliberately independent of the inference backend. */
37
38/** @brief Per-application configuration; all resolved paths belong to this caller-owned value. */
49
50/** @brief Reset storage and select conservative thread/timeout defaults.
51 * @param settings Writable owner, or NULL to do nothing.
52 * @param backend Application default used when the INI omits the backend. */
54 enum inference_backend backend);
55/** @brief Parse one common key without consuming module-specific keys.
56 * @param settings Initialized destination; its seen mask rejects duplicates.
57 * @param key Flat key emitted by the bounded INI parser.
58 * @param value Nonempty parsed value; no pointer into it is retained.
59 * @return One if accepted, zero if unknown, minus one if invalid/duplicate. */
61 const char *key, const char *value);
62/** @brief Parse one flat INI, delegate application keys and resolve paths against the selected file.
63 * @param settings Initialized destination; discard partially parsed values on failure.
64 * @param filename Selected settings file, independent of the caller's current directory.
65 * @param extra Optional handler for application-specific fields.
66 * @param context Borrowed extra-handler state, used only during this call.
67 * @param error Writable failure diagnostic, cleared on success.
68 * @param capacity Available bytes in error.
69 * @return True for valid bounded syntax, accepted fields and resolvable lexical paths.
70 * @details AUTO resolves .onnx/.rpk suffixes and an omitted ONNX descriptor to
71 * the same-name .ini. It does not test availability or fall back after errors. */
72bool inference_settings_read(struct inference_settings *settings, const char *filename,
73 ini_field_handler extra, void *context,
74 char *error, size_t capacity);
75/** @brief Discover application_settings.ini in adjacent, development-module, then installed-share order.
76 * @details Supports both bin/ application executables and the root-level USHER
77 * owner, without consulting the caller's current directory.
78 * @param application Lowercase executable name without an architecture suffix.
79 * @param module Lowercase module directory name, such as spotter_cam.
80 * @param filename Destination path; meaningful only on success.
81 * @param capacity Available bytes in filename.
82 * @return True after finding a regular file, never a current-directory fallback. */
83bool inference_settings_find(const char *application, const char *module,
84 char *filename, size_t capacity);
85/** @brief Resolve an INI-relative path without requiring its destination to exist yet.
86 * @param base_file Settings filename whose parent supplies the relative base.
87 * @param value Absolute or relative path; control characters are rejected.
88 * @param destination Writable normalized absolute path, distinct from the inputs.
89 * @param capacity Destination capacity including its terminator.
90 * @return True for a complete, nontruncated path. This is lexical normalization, not symlink resolution. */
91bool inference_resolve_path(const char *base_file, const char *value,
92 char *destination, size_t capacity);
93
94#ifdef __cplusplus
95}
96#endif
97#endif
Allocation-free flat key=value mechanics; callers own schemas and storage.
bool(* ini_field_handler)(void *context, const char *key, const char *value)
Definition bounded_ini.h:35
static unsigned capacity[COVERAGE_CAMERAS]
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.
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.
inference_source
Acquisition choice, deliberately independent of the inference backend.
@ INFERENCE_IMAGE
@ INFERENCE_LIVE
@ INFERENCE_FAKE
int inference_settings_field(struct inference_settings *settings, const char *key, const char *value)
Parse one common key without consuming module-specific keys.
#define INFERENCE_PATH_CAPACITY
inference_backend
Backend selection; AUTO resolves the model suffix, never an execution error.
@ INFERENCE_NATIVE
@ INFERENCE_AUTO
@ INFERENCE_ONNX
@ INFERENCE_IMX500
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.
void inference_settings_init(struct inference_settings *settings, enum inference_backend backend)
Reset storage and select conservative thread/timeout defaults.
struct jpeg_error_mgr error
Definition lwir_image.c:60
Per-application configuration; all resolved paths belong to this caller-owned value.
enum inference_backend backend
char model[INFERENCE_PATH_CAPACITY]
char input[INFERENCE_PATH_CAPACITY]
enum inference_source source
char descriptor[INFERENCE_PATH_CAPACITY]
char library_directory[INFERENCE_PATH_CAPACITY]