Skip to main content

Cameras

Struct Cameras 

Source
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

Source

pub fn new(source: Arc<dyn CameraSource>) -> Self

The hub over source. Each camera’s switch starts as its facts say.

Source

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).

Source

pub fn is_frozen(&self) -> bool

Whether every camera is paused: by Stop all, or by the kill switch the hub follows.

Source

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.

Source

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.

Source

pub fn voice_camera(&self) -> Option<String>

The camera the voice screen’s camera feeds, when the source serves one.

Source

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.

Source

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.

Source

pub fn source(&self) -> &Arc<dyn CameraSource> ⓘ

The source.

Source

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.

Source

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.

Source

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.

Source

pub async fn started(&self, camera: &str)

The pipeline started camera’s stream again after a stop: its gate opens.

Source

pub fn changed(&self, camera: &str)

Tells whoever watches camera to read it again: a zone, a watch or the governor changed.

Source

pub async fn latest(&self, camera: &str) -> Option<HeldFrame>

The newest frame held for camera.

Source

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.

Source

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.

Source

pub async fn dropped(&self, camera: &str) -> u64

How many frames of camera the gate dropped.

Source

pub async fn is_on(&self, camera: &str) -> bool

Whether camera is on: switched on, not stopped and not paused by Stop all.

Source

pub fn subscribe(&self) -> Receiver<CameraUpdate>

Every frame that passes the gate and every change, as it happens.

Trait Implementations§

Source§

impl Clone for Cameras

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Cameras

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Cameras

§

impl !UnwindSafe for Cameras

§

impl Forget for Cameras

§

impl Freeze for Cameras
where *const ArcInner<HubInner> is !null: Freeze, PhantomData<ArcInner<HubInner>>: Freeze,

§

impl Move for Cameras

§

impl Send for Cameras
where Arc<HubInner>: Send,

§

impl Sync for Cameras
where Arc<HubInner>: Sync,

§

impl Unpin for Cameras
where Arc<HubInner>: Unpin,

§

impl UnsafeUnpin for Cameras
where *const ArcInner<HubInner> is !null: UnsafeUnpin, PhantomData<ArcInner<HubInner>>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self> ⓘ

Attaches the current Context to this type, returning a WithContext wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more