dahua_camera_core/lib.rs
1//! Shared types for the `dahua-camera` workspace.
2//!
3//! This crate is the centre of the dependency graph. Every other crate depends
4//! on it; it depends on none of them. It contains **no I/O**: no sockets, no
5//! files, no spawning. What lives here is either plain data or an abstract
6//! port — a trait whose implementations live in the crates above.
7//!
8//! Keeping it I/O-free is what allows a consumer to depend on, say,
9//! `dahua-camera-events` without dragging in `retina`, and what makes every
10//! type here cheap to use in a test.
11//!
12//! # Contents
13//!
14//! | Module | What it holds |
15//! |---|---|
16//! | [`id`] | [`CameraId`] |
17//! | [`camera`] | [`CameraConfig`], [`CameraStatus`], [`CameraStats`], [`AppConfig`] |
18//! | [`capability`] | [`Capability`], [`CapabilitySet`] — what a device *reports* it can do |
19//! | [`codec`] | [`CodecParameters`], [`StreamParams`] |
20//! | [`error`] | [`CameraError`], [`Result`] |
21//! | [`event`] | [`Event`], [`EventKind`], [`EventState`], [`Severity`], [`BoundingBox`] |
22//! | [`frame`] | [`Sample`] (aka [`Frame`]) — one encoded access unit |
23//! | [`ports`] | Cross-crate traits: control, events, configuration |
24//!
25//! # Nothing is assumed
26//!
27//! A [`CapabilitySet`] is empty until a probe confirms something. Calls that
28//! depend on hardware go through
29//! [`CapabilitySet::require`], which refuses with
30//! [`CameraError::CapabilityUnsupported`] rather than sending a request to a
31//! device that may not understand it.
32//!
33//! # Safety
34//!
35//! Read [`Event`] before acting on any detection. Camera IVS/SMD analytics are
36//! an operator aid and are **not safety-rated**. See `SAFETY.md` at the
37//! workspace root.
38//!
39//! # Features
40//!
41//! - `decode` — adds the [`CameraError::Decode`] variant. Enabled for you by
42//! `dahua-camera-rtsp/decode`; there is no reason to set it directly.
43//! - `testing` — shared test fixtures. A dev-dependency only.
44
45#![warn(missing_docs)]
46#![forbid(unsafe_code)]
47
48pub mod camera;
49pub mod capability;
50pub mod codec;
51pub mod error;
52pub mod event;
53pub mod frame;
54pub mod id;
55pub mod ports;
56
57#[cfg(feature = "testing")]
58pub mod testing;
59
60pub use camera::{AppConfig, CameraConfig, CameraStats, CameraStatus, ServerConfig};
61pub use capability::{Capability, CapabilitySet};
62pub use codec::{CodecParameters, SharedParams, StreamParams};
63pub use error::{CameraError, Result};
64pub use event::{BoundingBox, Event, EventKind, EventState, Severity};
65pub use frame::{Frame, Sample, SharedSample};
66pub use id::CameraId;
67pub use ports::{UnsupportedControl, UnsupportedControlFactory};