pub trait CameraSource: Send + Sync {
// Required methods
fn cameras<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<CameraFacts>, SurfaceError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn keep_frame<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
camera: &'life1 CameraFacts,
frame: &'life2 HeldFrame,
) -> Pin<Box<dyn Future<Output = Result<ImageEvidence, SurfaceError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
// Provided methods
fn switch<'life0, 'life1, 'async_trait>(
&'life0 self,
camera: &'life1 str,
on: bool,
) -> Pin<Box<dyn Future<Output = Result<(), SurfaceError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait { ... }
fn stop<'life0, 'life1, 'async_trait>(
&'life0 self,
camera: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), SurfaceError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait { ... }
fn retry<'life0, 'life1, 'async_trait>(
&'life0 self,
camera: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), SurfaceError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait { ... }
fn save_zone<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
camera: &'life1 str,
zone: &'life2 ZoneFacts,
) -> Pin<Box<dyn Future<Output = Result<(), SurfaceError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait { ... }
fn freeze<'life0, 'async_trait>(
&'life0 self,
frozen: bool,
) -> Pin<Box<dyn Future<Output = Result<(), SurfaceError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait { ... }
fn intake(&self, camera: &str) -> Option<Arc<dyn FrameIntake>> { ... }
fn voice_camera(&self) -> Option<String> { ... }
}surface only.Expand description
Where the live camera surface reads cameras and acts on them (spec 3.7 §8.2): the seam between the surface and a frame pipeline.
The pipeline reports facts — the stream’s state, the governor’s numbers, tracks, watches,
zones — and offers frames to the Cameras hub; the surface turns them into words. A
person’s switch and stop reach the source after the hub has already closed its gate, so a
source that keeps sending sends to nobody.
§Example
use std::sync::Arc;
use adk_surface::camera::{CameraFacts, CameraSource, Cameras, HeldFrame, ZoneFacts};
struct OneCamera;
#[async_trait::async_trait]
impl CameraSource for OneCamera {
async fn cameras(&self) -> adk_surface::Result<Vec<CameraFacts>> {
Ok(vec![CameraFacts::new("line-2", "Line 2 camera", "inspector", "s-line")])
}
async fn keep_frame(
&self,
camera: &CameraFacts,
frame: &HeldFrame,
) -> adk_surface::Result<adk_core::ImageEvidence> {
let _ = (camera, frame);
Err(adk_surface::SurfaceError::unsupported("keeping frames"))
}
}
let cameras = Cameras::new(Arc::new(OneCamera));Required Methods§
Sourcefn cameras<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<CameraFacts>, SurfaceError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn cameras<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<CameraFacts>, SurfaceError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Sourcefn keep_frame<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
camera: &'life1 CameraFacts,
frame: &'life2 HeldFrame,
) -> Pin<Box<dyn Future<Output = Result<ImageEvidence, SurfaceError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn keep_frame<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
camera: &'life1 CameraFacts,
frame: &'life2 HeldFrame,
) -> Pin<Box<dyn Future<Output = Result<ImageEvidence, SurfaceError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Keeps frame of camera as evidence: everyone in it blurred first, then written once,
kept EVIDENCE_RETENTION_DAYS (board choice C11, spec
3.7 V-I9). Returns the evidence a card and a held call carry: the kept copy’s digest, its
artifact and its regions.
§Errors
The source’s error; nothing is kept then.
Provided Methods§
Sourcefn switch<'life0, 'life1, 'async_trait>(
&'life0 self,
camera: &'life1 str,
on: bool,
) -> Pin<Box<dyn Future<Output = Result<(), SurfaceError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn switch<'life0, 'life1, 'async_trait>(
&'life0 self,
camera: &'life1 str,
on: bool,
) -> Pin<Box<dyn Future<Output = Result<(), SurfaceError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Turns camera on or off at the source: off, it captures and sends nothing. The hub has
already closed or opened its gate. The default does nothing more.
§Errors
The source’s error.
Sourcefn stop<'life0, 'life1, 'async_trait>(
&'life0 self,
camera: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), SurfaceError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn stop<'life0, 'life1, 'async_trait>(
&'life0 self,
camera: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), SurfaceError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Ends camera’s stream. The default does nothing more than the hub’s gate.
§Errors
The source’s error.
Sourcefn retry<'life0, 'life1, 'async_trait>(
&'life0 self,
camera: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), SurfaceError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn retry<'life0, 'life1, 'async_trait>(
&'life0 self,
camera: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), SurfaceError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Sourcefn save_zone<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
camera: &'life1 str,
zone: &'life2 ZoneFacts,
) -> Pin<Box<dyn Future<Output = Result<(), SurfaceError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn save_zone<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
camera: &'life1 str,
zone: &'life2 ZoneFacts,
) -> Pin<Box<dyn Future<Output = Result<(), SurfaceError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Changes zone zone of camera: every watch that uses it reads the new corners from its
next frame (board choice C12).
§Errors
surface.unsupported by default.
Sourcefn freeze<'life0, 'async_trait>(
&'life0 self,
frozen: bool,
) -> Pin<Box<dyn Future<Output = Result<(), SurfaceError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn freeze<'life0, 'async_trait>(
&'life0 self,
frozen: bool,
) -> Pin<Box<dyn Future<Output = Result<(), SurfaceError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Pauses (true) or resumes (false) every camera at the source: Stop all, or Resume all
(spec 3.7 V-I17). The hub has already closed or opened its gate. The default does nothing
more.
§Errors
The source’s error.
Sourcefn intake(&self, camera: &str) -> Option<Arc<dyn FrameIntake>>
fn intake(&self, camera: &str) -> Option<Arc<dyn FrameIntake>>
Where the frames a screen captures for camera go once they pass the hub’s gate
(Cameras::ingest): the frame pipeline’s push side. None, the default, for a camera
whose source reads its own frames.
Sourcefn voice_camera(&self) -> Option<String>
fn voice_camera(&self) -> Option<String>
The camera the voice screen’s camera feeds, when this source serves one: the voice view
hands that camera’s frames to Cameras::ingest and mirrors its switch.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".