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
ai_cam_pipe.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/**
19 * @file ai_cam_pipe.h
20 * @brief Parent-side contract for stock and native Raspberry Pi camera capture.
21 * @details Both modes publish private JPEGs and preserve no-replay behavior;
22 * only the native worker provides USHER sensor timing evidence.
23 */
24#ifndef USHER_AI_CAM_PIPE_H
25#define USHER_AI_CAM_PIPE_H
26
27#include <stddef.h>
28#include <stdbool.h>
29
31
32/** @brief Select native or system-camera capture before startup.
33 * @param enabled True for native photo-only capture.
34 * @return Zero on success, or -1 while either mode has an owned child.
35 * @details Refuse to switch modes without releasing the previous owner. */
37/** @brief Report whether the selected AIcam mode uses native photo-only capture.
38 * @return True for native mode.
39 * @details Reports configuration, not whether the camera has started. */
40bool ai_cam_pipe_native(void);
41/** @brief Pass the shutdown flag to native worker supervision.
42 * @param host Nullable backend host; its running flag must outlive the worker.
43 * @details Retain only the borrowed flag, not the host structure.
44 * A null host clears the flag. */
45void ai_cam_pipe_configure(const struct camera_backend_host *host);
46
47/**
48 * @brief Validate storage and start the selected camera owner.
49 * @param[in] unused Reserved backend argument.
50 * @return Zero for usable storage, otherwise -1.
51 * @details All operations require the owning backend's serialization. Native
52 * startup waits for a valid frame; the system-camera path checks its child per shot. */
53int ai_cam_pipe_init(const char *unused);
54
55/**
56 * @brief Select a borrowed directory before initialization.
57 * @param[in] directory Caller-owned path, or NULL for the compiled default.
58 * @details Retain the pointer, not a copy; keep the path valid through capture.
59 */
60void ai_cam_pipe_set_photo_directory(const char *directory);
61
62/**
63 * @brief Capture one ordinary JPEG into private staging for metadata completion.
64 * @param[out] filename Receives the .pending path, empty on failure.
65 * @param[in] filename_size Buffer capacity including NUL.
66 * @param[in] image_number USHER shot number.
67 * @return Zero for a nonempty regular image, otherwise -1.
68 * @details A failure after triggering never replays the exposure. The system
69 * camera path does not supply Sensoraia's sensor evidence. The caller completes
70 * metadata before exposing the final filename.
71 */
72int ai_cam_pipe_shoot(char *filename, size_t filename_size, int image_number);
73
74/** @brief Stop the native and system-camera subprocesses.
75 * @details Attempt bounded shutdown; an unreaped system-camera child retains
76 * ownership rather than allowing a second process to open the camera. */
77void ai_cam_pipe_deinit(void);
78
79#endif
int ai_cam_pipe_init(const char *unused)
Validate storage and start the selected camera owner.
int ai_cam_pipe_shoot(char *filename, size_t filename_size, int image_number)
Capture one ordinary JPEG into private staging for metadata completion.
void ai_cam_pipe_configure(const struct camera_backend_host *host)
Pass the shutdown flag to native worker supervision.
void ai_cam_pipe_deinit(void)
Stop the native and system-camera subprocesses.
bool ai_cam_pipe_native(void)
Report whether the selected AIcam mode uses native photo-only capture.
void ai_cam_pipe_set_photo_directory(const char *directory)
Select a borrowed directory before initialization.
int ai_cam_pipe_set_native(bool enabled)
Select native or system-camera capture before startup.
static bool enabled(void)
Report explicit opt-in independently of process or model readiness.