Bounded asynchronous saved-photo adapter for LOOM_cam. More...
#include "camera_backend.h"

Go to the source code of this file.
Macros | |
| #define | LOOM_IMAGE_PREFIX 'o' |
| LOOM photographs and outbound references use 'o', not AIcam's 'a'. | |
Functions | |
| int | loom_cam_init (const char *references, const char *model) |
| Start one saved-photo worker; does not acquire another camera. | |
| int | loom_cam_set_settings (const char *settings) |
| Select executable settings before starting the saved-photo worker. | |
| bool | loom_cam_enabled (void) |
| Report whether this optional stream is running and not stopping. | |
| int | loom_cam_completion_fd (void) |
| Borrow the nonblocking completion descriptor; minus one when not initialized. | |
| bool | loom_cam_start (uint32_t session_id) |
| Select outbound reference collection and discard old-phase mailbox work. | |
| bool | loom_cam_stop (uint32_t session_id) |
| Select return matching and discard old-phase mailbox work. | |
| void | loom_cam_image_saved (const char *filename, const union dc_shot_union *shot) |
| Copy the newest completed AIcam photo request into bounded worker storage. | |
| bool | loom_cam_poll_result (struct camera_point_result *result) |
| Consume a result on the serial owner; session_id carries the photo number for this stream. | |
| void | loom_cam_deinit (void) |
| Cancel pending work and join the worker before reusing adapter state. | |
Detailed Description
Bounded asynchronous saved-photo adapter for LOOM_cam.
USHER's capture owner supplies immutable, EXIF-tagged AIcam photos. This adapter records outbound references or runs a saved-photo child; it does not own the sensor, transmit UART or mutate waypoints. One pending request and one completion mailbox prioritize freshness over processing every photograph.
Each START creates a unique reference subdirectory, retaining only that sortie's links for its return phase. A per-sortie cap bounds directory growth without pruning evidence. Phase tokens select collection/return modes; FC photo numbers correlate individual results. Keeping those identities separate prevents old mode work from looking like a fresh candidate route point after START or STOP.
- Warning
- Accepted points require a declared return model and validated observation evidence.
Definition in file loom_cam.h.
Macro Definition Documentation
◆ LOOM_IMAGE_PREFIX
| #define LOOM_IMAGE_PREFIX 'o' |
LOOM photographs and outbound references use 'o', not AIcam's 'a'.
Definition at line 38 of file loom_cam.h.
Function Documentation
◆ loom_cam_completion_fd()
| int loom_cam_completion_fd | ( | void | ) |
Borrow the nonblocking completion descriptor; minus one when not initialized.
Definition at line 613 of file loom_cam.c.
◆ loom_cam_deinit()
| void loom_cam_deinit | ( | void | ) |
Cancel pending work and join the worker before reusing adapter state.
Wakes an idle worker or causes its child watchdog to terminate/reap the process. Unlike admission/polling, shutdown waits for the worker to exit.
- Precondition
- Lifecycle calls are serialized; do not call from the worker itself.
Definition at line 695 of file loom_cam.c.
◆ loom_cam_enabled()
| bool loom_cam_enabled | ( | void | ) |
Report whether this optional stream is running and not stopping.
- Returns
- True when phase callbacks may be admitted; false otherwise.
- Note
- Uses atomic lifecycle flags; no camera acquisition or mutex wait occurs.
Definition at line 608 of file loom_cam.c.
◆ loom_cam_image_saved()
| void loom_cam_image_saved | ( | const char * | filename, |
| const union dc_shot_union * | shot ) |
Copy the newest completed AIcam photo request into bounded worker storage.
- Parameters
-
filename Immutable saved JPEG path, borrowed only for this call. shot Completed photo pose/request; its positive number correlates the update.
Thread-safe and nonblocking; pending work is fresh-first, not an evidence archive. Busy admission, invalid input, overlong paths and duplicate/reversed photo numbers are dropped. The file itself must remain available to the worker.
Definition at line 669 of file loom_cam.c.
◆ loom_cam_init()
| int loom_cam_init | ( | const char * | references, |
| const char * | model ) |
Start one saved-photo worker; does not acquire another camera.
- Parameters
-
references Optional outbound-photo directory, copied before return. model Optional native capture RPK path, copied before return.
- Returns
- Zero on startup, -1 for invalid paths or worker setup failure.
Starts in return mode; only the configured current-photo model vector is interpreted. Outbound references are retained but are not yet compared. NULL paths select empty configuration; overlong paths are rejected, not truncated.
- Precondition
- Lifecycle calls are serialized by the owning USHER control thread.
Definition at line 568 of file loom_cam.c.
◆ loom_cam_poll_result()
| bool loom_cam_poll_result | ( | struct camera_point_result * | result | ) |
Consume a result on the serial owner; session_id carries the photo number for this stream.
- Parameters
-
result Required destination in existing point units.
- Returns
- True for a new matched or no-match result; false when absent/busy.
Consumes the single mailbox entry. True means a completion exists, not that result->valid is true; FC navigation checks must still be applied.
Definition at line 685 of file loom_cam.c.
◆ loom_cam_set_settings()
| int loom_cam_set_settings | ( | const char * | settings | ) |
Select executable settings before starting the saved-photo worker.
- Parameters
-
settings Copied path or NULL to restore executable discovery.
- Returns
- Zero when accepted, minus one while running or for an invalid path.
Definition at line 560 of file loom_cam.c.
◆ loom_cam_start()
| bool loom_cam_start | ( | uint32_t | session_id | ) |
Select outbound reference collection and discard old-phase mailbox work.
- Parameters
-
session_id Admitted nonzero FC session token, not a photo number.
- Returns
- True if accepted by a running worker; false for zero or shutdown.
Advances a phase generation to suppress in-flight old-phase results. The original photo archive remains authoritative if reference work is dropped.
Definition at line 621 of file loom_cam.c.
◆ loom_cam_stop()
| bool loom_cam_stop | ( | uint32_t | session_id | ) |
Select return matching and discard old-phase mailbox work.
- Parameters
-
session_id Nonzero token matching the most recently admitted START.
- Returns
- True if the token is accepted; false if absent, mismatched or stopping.
- Note
- Acceptance changes local mode; it does not prove a neural match exists.
Definition at line 652 of file loom_cam.c.