pub struct Cameras { /* private fields */ }Expand description
The cameras of a home and their gate (spec 3.7 §8.2): every frame passes Cameras::offer,
which drops what a switched-off or stopped camera sends and holds the rest in memory only.
§Example
let cameras = Cameras::new(Arc::new(OneCamera));
let frame = || CameraFrame::new(b"jpeg".to_vec(), "image/jpeg", 1920, 1080, chrono::Utc::now());
assert!(matches!(cameras.offer("line-2", frame()).await, Offered::Shown { .. }));
cameras.switch("line-2", false, "ana", chrono::Utc::now()).await.unwrap();
assert_eq!(cameras.offer("line-2", frame()).await, Offered::Dropped(DropReason::Off));
assert!(cameras.latest("line-2").await.is_none());Implementations§
Source§impl Cameras
impl Cameras
Sourcepub fn new(source: Arc<dyn CameraSource>) -> Self
pub fn new(source: Arc<dyn CameraSource>) -> Self
The hub over source. Each camera’s switch starts as its facts say.
Sourcepub fn with_governance(self, control: GovernanceControl) -> Self
pub fn with_governance(self, control: GovernanceControl) -> Self
Follows control as well as Stop all: while it is frozen the gate drops every frame of
every camera, wherever the freeze came from (spec 3.7 V-I17).
Sourcepub fn is_frozen(&self) -> bool
pub fn is_frozen(&self) -> bool
Whether every camera is paused: by Stop all, or by the kill switch the hub follows.
Sourcepub async fn freeze_all(&self) -> Result<()>
pub async fn freeze_all(&self) -> Result<()>
Stop all (spec 3.7 V-I17): the gate drops every frame of every camera from now on, then the source is told to pause its streams. The frames held stay, so a card can still be raised from one.
§Errors
The source’s error, after the gate closed.
Sourcepub async fn thaw_all(&self) -> Result<()>
pub async fn thaw_all(&self) -> Result<()>
Resume all: the gate opens again for every camera a person has not switched off or stopped, then the source is told.
§Errors
The source’s error, after the gate opened.
Sourcepub fn voice_camera(&self) -> Option<String>
pub fn voice_camera(&self) -> Option<String>
The camera the voice screen’s camera feeds, when the source serves one.
Sourcepub fn takes_frames(&self, camera: &str) -> bool
pub fn takes_frames(&self, camera: &str) -> bool
Whether camera takes the frames a screen captures (ingest): its
source has a pipeline’s push side for it, as the web home’s own camera does.
Sourcepub async fn ingest(
&self,
camera: &str,
bytes: Vec<u8>,
at: DateTime<Utc>,
) -> Offered
pub async fn ingest( &self, camera: &str, bytes: Vec<u8>, at: DateTime<Utc>, ) -> Offered
Hands a frame a screen captured for camera to the camera’s frame pipeline, once it
passes the gate: dropped when the camera is off, stopped, paused by Stop all or unknown,
when it comes within a MAX_SCREEN_FPS interval of the last frame taken, or when no
pipeline takes its frames. The pipeline offers what it makes of the frame — redacted,
with what it found — to offer; nothing is held here.
Sourcepub fn source(&self) -> &Arc<dyn CameraSource> ⓘ
pub fn source(&self) -> &Arc<dyn CameraSource> ⓘ
The source.
Sourcepub async fn offer(&self, camera: &str, frame: CameraFrame) -> Offered
pub async fn offer(&self, camera: &str, frame: CameraFrame) -> Offered
Offers frame of camera: dropped when the camera is off, stopped, paused by Stop all or
unknown, else held in memory as its newest frame and shown to whoever watches. Never
written anywhere.
Sourcepub async fn switch(
&self,
camera: &str,
on: bool,
by: &str,
at: DateTime<Utc>,
) -> Result<()>
pub async fn switch( &self, camera: &str, on: bool, by: &str, at: DateTime<Utc>, ) -> Result<()>
Turns camera on or off for by at at. The gate changes first, so no frame passes
after an off, and off forgets every frame held; then the source is told.
§Errors
surface.not_found for an unknown camera; the source’s error, after the gate changed.
Sourcepub async fn stop(
&self,
camera: &str,
by: &str,
at: DateTime<Utc>,
) -> Result<()>
pub async fn stop( &self, camera: &str, by: &str, at: DateTime<Utc>, ) -> Result<()>
Ends camera’s stream for by at at: the gate closes for good and every frame held is
forgotten; then the source is told.
§Errors
surface.not_found for an unknown camera; the source’s error, after the gate closed.
Sourcepub async fn started(&self, camera: &str)
pub async fn started(&self, camera: &str)
The pipeline started camera’s stream again after a stop: its gate opens.
Sourcepub fn changed(&self, camera: &str)
pub fn changed(&self, camera: &str)
Tells whoever watches camera to read it again: a zone, a watch or the governor changed.
Sourcepub async fn latest(&self, camera: &str) -> Option<HeldFrame>
pub async fn latest(&self, camera: &str) -> Option<HeldFrame>
The newest frame held for camera.
Sourcepub async fn held(&self, camera: &str, digest: &str) -> Option<HeldFrame>
pub async fn held(&self, camera: &str, digest: &str) -> Option<HeldFrame>
The frame of camera with digest, while the hub still holds it: among the latest, or
frozen for a card.
Sourcepub async fn freeze(
&self,
camera: &str,
digest: &str,
at: DateTime<Utc>,
) -> Option<Vec<HeldFrame>>
pub async fn freeze( &self, camera: &str, digest: &str, at: DateTime<Utc>, ) -> Option<Vec<HeldFrame>>
Freezes frame digest of camera at at for a card (board choice C11): held in memory
for FROZEN_MINUTES, the newest FROZEN_FRAMES of them, and forgotten when the camera
is switched off. Nothing is written. Returns the frames up to it, oldest first, for its
trails; None when the hub no longer holds it.
Sourcepub async fn is_on(&self, camera: &str) -> bool
pub async fn is_on(&self, camera: &str) -> bool
Whether camera is on: switched on, not stopped and not paused by Stop all.
Sourcepub fn subscribe(&self) -> Receiver<CameraUpdate>
pub fn subscribe(&self) -> Receiver<CameraUpdate>
Every frame that passes the gate and every change, as it happens.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Cameras
impl !UnwindSafe for Cameras
impl Forget for Cameras
impl Freeze for Cameras
impl Move for Cameras
impl Send for Cameras
impl Sync for Cameras
impl Unpin for Cameras
impl UnsafeUnpin for Cameraswhere
*const ArcInner<HubInner> is !null: UnsafeUnpin,
PhantomData<ArcInner<HubInner>>: UnsafeUnpin,
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more