Skip to main content

CameraAvStreamHandler

Struct CameraAvStreamHandler 

Source
pub struct CameraAvStreamHandler<'a, H, const NV: usize, const NA: usize = 0>{ /* private fields */ }
Expand description

Handler for the Camera AV Stream Management cluster (0x0551).

See the module documentation for architecture and usage.

Implementations§

Source§

impl<'a, H, const NV: usize, const NA: usize> CameraAvStreamHandler<'a, H, NV, NA>

Source

pub const CLUSTER: Cluster<'static>

Cluster metadata advertising the VIDEO feature only and the minimal mandatory attribute set under that feature.

Use this when the camera does not (yet) need watermark / OSD / audio / snapshot. For other combinations build a Cluster value directly via the generated decl::FULL_CLUSTER.with_features(...).

Source

pub const CLUSTER_VIDEO_AUDIO: Cluster<'static>

Cluster metadata advertising both VIDEO and AUDIO features.

Use this (together with CameraAvStreamConfig::mic_capabilities: Some(...)) when the camera also exposes a microphone and pre-allocated audio streams.

Source

pub const fn new( dataver: Dataver, endpoint_id: u16, config: CameraAvStreamConfig<'a>, features: u32, hooks: H, ) -> CameraAvStreamHandler<'a, H, NV, NA>

Construct a new handler.

features MUST equal the feature_map of the Cluster this handler is registered with; the handler uses it to decide whether WATERMARK / ON_SCREEN_DISPLAY toggles are legal in VideoStreamAllocate / VideoStreamModify.

Panics if features advertises AUDIO but config.mic_capabilities is None. The MicrophoneCapabilities attribute is mandatory whenever AUDIO is enabled (per Matter Spec) and must be supplied at construction.

Source

pub const fn adapt( self, ) -> HandlerAsyncAdaptor<CameraAvStreamHandler<'a, H, NV, NA>>

Wrap in the generic async adaptor for registration with a rs-matter Node.

Source

pub const fn endpoint_id(&self) -> u16

Endpoint this handler is mounted on.

Source

pub fn acquire_video(&self, video_stream_id: u16) -> Result<(), Error>

Increment the reference count of an allocated video stream so that [Self::deallocate_video] cannot remove it underneath the caller. Cross-cluster consumers (WebRTC, PushAV) MUST pair this with Self::release_video when their session ends.

Returns NOT_FOUND if the stream does not exist.

Source

pub fn release_video(&self, video_stream_id: u16)

Decrement the reference count of an allocated video stream (saturating at 0). Best-effort: silently ignores unknown IDs so that callers can release in Drop without an extra existence check after a parallel deallocation.

Source

pub fn video_streams(&self) -> Vec<VideoStream, NV>

Snapshot the current set of allocated video streams. Useful for applications that want to query state outside the data-model dispatch path (e.g. logging, diagnostics).

Source

pub fn add_preallocated_video(&self, stream: VideoStream) -> Result<u16, Error>

Pre-seed an entry into AllocatedVideoStreams at boot without invoking CameraAvStreamHooks::allocate_video. Suitable for devices that have a single fixed encoder configuration baked into the firmware and only need the cluster as a registry.

The stream’s video_stream_id field is overwritten with a freshly allocated ID; reference_count is reset to 0. No spec validation is performed — the caller is presumed to know what the device can do.

Returns the assigned ID, or RESOURCE_EXHAUSTED if the table is full.

Source

pub fn audio_streams(&self) -> Vec<AudioStream, NA>

Snapshot the current set of allocated audio streams.

Source

pub fn add_preallocated_audio(&self, stream: AudioStream) -> Result<u16, Error>

Pre-seed an entry into AllocatedAudioStreams at boot without calling any hooks. Mirrors Self::add_preallocated_video.

Returns the assigned ID, or RESOURCE_EXHAUSTED if the table is full (or NA = 0).

Trait Implementations§

Source§

impl<'a, H, const NV: usize, const NA: usize> ClusterAsyncHandler for CameraAvStreamHandler<'a, H, NV, NA>

Source§

const CLUSTER: Cluster<'static> = Self::CLUSTER

The cluster-metadata corresponding to this handler trait.
Source§

fn dataver(&self) -> u32

Source§

fn dataver_changed(&self)

Source§

async fn max_content_buffer_size( &self, _ctx: impl ReadContext, ) -> Result<u32, Error>

Source§

async fn max_network_bandwidth( &self, _ctx: impl ReadContext, ) -> Result<u32, Error>

Source§

async fn max_concurrent_encoders( &self, _ctx: impl ReadContext, ) -> Result<u8, Error>

Source§

async fn max_encoded_pixel_rate( &self, _ctx: impl ReadContext, ) -> Result<u32, Error>

Source§

async fn video_sensor_params<P>( &self, _ctx: impl ReadContext, builder: VideoSensorParamsStructBuilder<P>, ) -> Result<P, Error>

Source§

async fn min_viewport_resolution<P>( &self, _ctx: impl ReadContext, builder: VideoResolutionStructBuilder<P>, ) -> Result<P, Error>

Source§

async fn rate_distortion_trade_off_points<P>( &self, _ctx: impl ReadContext, builder: ArrayAttributeRead<RateDistortionTradeOffPointsStructArrayBuilder<P>, RateDistortionTradeOffPointsStructBuilder<P>>, ) -> Result<P, Error>

Source§

async fn supported_stream_usages<P>( &self, _ctx: impl ReadContext, builder: ArrayAttributeRead<ToTLVArrayBuilder<P, StreamUsageEnum>, ToTLVBuilder<P, StreamUsageEnum>>, ) -> Result<P, Error>

Source§

async fn stream_usage_priorities<P>( &self, _ctx: impl ReadContext, builder: ArrayAttributeRead<ToTLVArrayBuilder<P, StreamUsageEnum>, ToTLVBuilder<P, StreamUsageEnum>>, ) -> Result<P, Error>

Source§

async fn allocated_video_streams<P>( &self, _ctx: impl ReadContext, builder: ArrayAttributeRead<VideoStreamStructArrayBuilder<P>, VideoStreamStructBuilder<P>>, ) -> Result<P, Error>

Source§

async fn handle_video_stream_allocate<P>( &self, ctx: impl InvokeContext, request: VideoStreamAllocateRequest<'_>, response: VideoStreamAllocateResponseBuilder<P>, ) -> Result<P, Error>

Source§

async fn handle_video_stream_modify( &self, ctx: impl InvokeContext, request: VideoStreamModifyRequest<'_>, ) -> Result<(), Error>

Source§

async fn handle_video_stream_deallocate( &self, ctx: impl InvokeContext, request: VideoStreamDeallocateRequest<'_>, ) -> Result<(), Error>

Source§

async fn handle_set_stream_priorities( &self, ctx: impl InvokeContext, request: SetStreamPrioritiesRequest<'_>, ) -> Result<(), Error>

Source§

async fn microphone_capabilities<P>( &self, _ctx: impl ReadContext, builder: AudioCapabilitiesStructBuilder<P>, ) -> Result<P, Error>

Source§

async fn allocated_audio_streams<P>( &self, _ctx: impl ReadContext, builder: ArrayAttributeRead<AudioStreamStructArrayBuilder<P>, AudioStreamStructBuilder<P>>, ) -> Result<P, Error>

Source§

async fn handle_audio_stream_allocate<P>( &self, _ctx: impl InvokeContext, _request: AudioStreamAllocateRequest<'_>, _response: AudioStreamAllocateResponseBuilder<P>, ) -> Result<P, Error>

Source§

async fn handle_audio_stream_deallocate( &self, _ctx: impl InvokeContext, _request: AudioStreamDeallocateRequest<'_>, ) -> Result<(), Error>

Source§

async fn handle_snapshot_stream_allocate<P>( &self, _ctx: impl InvokeContext, _request: SnapshotStreamAllocateRequest<'_>, _response: SnapshotStreamAllocateResponseBuilder<P>, ) -> Result<P, Error>

Source§

async fn handle_snapshot_stream_modify( &self, _ctx: impl InvokeContext, _request: SnapshotStreamModifyRequest<'_>, ) -> Result<(), Error>

Source§

async fn handle_snapshot_stream_deallocate( &self, _ctx: impl InvokeContext, _request: SnapshotStreamDeallocateRequest<'_>, ) -> Result<(), Error>

Source§

async fn handle_capture_snapshot<P>( &self, _ctx: impl InvokeContext, _request: CaptureSnapshotRequest<'_>, _response: CaptureSnapshotResponseBuilder<P>, ) -> Result<P, Error>

Source§

fn lifecycle( &self, _ctx: impl HandlerContext, _op: LifecycleOp, ) -> Result<(), Error>

Source§

fn run( &self, _ctx: impl HandlerContext, ) -> impl Future<Output = Result<(), Error>>

Source§

fn night_vision_uses_infrared( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<bool, Error>>

Source§

fn speaker_capabilities<P>( &self, ctx: impl ReadContext, builder: AudioCapabilitiesStructBuilder<P>, ) -> impl Future<Output = Result<P, Error>>

Source§

fn two_way_talk_support( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<TwoWayTalkSupportTypeEnum, Error>>

Source§

fn snapshot_capabilities<P>( &self, ctx: impl ReadContext, builder: ArrayAttributeRead<SnapshotCapabilitiesStructArrayBuilder<P>, SnapshotCapabilitiesStructBuilder<P>>, ) -> impl Future<Output = Result<P, Error>>

Source§

fn current_frame_rate( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<u16, Error>>

Source§

fn hdr_mode_enabled( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<bool, Error>>

Source§

fn allocated_snapshot_streams<P>( &self, ctx: impl ReadContext, builder: ArrayAttributeRead<SnapshotStreamStructArrayBuilder<P>, SnapshotStreamStructBuilder<P>>, ) -> impl Future<Output = Result<P, Error>>

Source§

fn soft_recording_privacy_mode_enabled( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<bool, Error>>

Source§

fn soft_livestream_privacy_mode_enabled( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<bool, Error>>

Source§

fn hard_privacy_mode_on( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<bool, Error>>

Source§

fn night_vision( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<TriStateAutoEnum, Error>>

Source§

fn night_vision_illum( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<TriStateAutoEnum, Error>>

Source§

fn viewport<P>( &self, ctx: impl ReadContext, builder: ViewportStructBuilder<P>, ) -> impl Future<Output = Result<P, Error>>

Source§

fn speaker_muted( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<bool, Error>>

Source§

fn speaker_volume_level( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<u8, Error>>

Source§

fn speaker_max_level( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<u8, Error>>

Source§

fn speaker_min_level( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<u8, Error>>

Source§

fn microphone_muted( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<bool, Error>>

Source§

fn microphone_volume_level( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<u8, Error>>

Source§

fn microphone_max_level( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<u8, Error>>

Source§

fn microphone_min_level( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<u8, Error>>

Source§

fn microphone_agc_enabled( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<bool, Error>>

Source§

fn image_rotation( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<u16, Error>>

Source§

fn image_flip_horizontal( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<bool, Error>>

Source§

fn image_flip_vertical( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<bool, Error>>

Source§

fn local_video_recording_enabled( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<bool, Error>>

Source§

fn local_snapshot_recording_enabled( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<bool, Error>>

Source§

fn status_light_enabled( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<bool, Error>>

Source§

fn status_light_brightness( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<ThreeLevelAutoEnum, Error>>

Source§

fn image_rotation_discrete_angles( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<u16, Error>>

Source§

fn set_hdr_mode_enabled( &self, ctx: impl WriteContext, value: bool, ) -> impl Future<Output = Result<(), Error>>

Source§

fn set_soft_recording_privacy_mode_enabled( &self, ctx: impl WriteContext, value: bool, ) -> impl Future<Output = Result<(), Error>>

Source§

fn set_soft_livestream_privacy_mode_enabled( &self, ctx: impl WriteContext, value: bool, ) -> impl Future<Output = Result<(), Error>>

Source§

fn set_night_vision( &self, ctx: impl WriteContext, value: TriStateAutoEnum, ) -> impl Future<Output = Result<(), Error>>

Source§

fn set_night_vision_illum( &self, ctx: impl WriteContext, value: TriStateAutoEnum, ) -> impl Future<Output = Result<(), Error>>

Source§

fn set_viewport( &self, ctx: impl WriteContext, value: ViewportStruct<'_>, ) -> impl Future<Output = Result<(), Error>>

Source§

fn set_speaker_muted( &self, ctx: impl WriteContext, value: bool, ) -> impl Future<Output = Result<(), Error>>

Source§

fn set_speaker_volume_level( &self, ctx: impl WriteContext, value: u8, ) -> impl Future<Output = Result<(), Error>>

Source§

fn set_microphone_muted( &self, ctx: impl WriteContext, value: bool, ) -> impl Future<Output = Result<(), Error>>

Source§

fn set_microphone_volume_level( &self, ctx: impl WriteContext, value: u8, ) -> impl Future<Output = Result<(), Error>>

Source§

fn set_microphone_agc_enabled( &self, ctx: impl WriteContext, value: bool, ) -> impl Future<Output = Result<(), Error>>

Source§

fn set_image_rotation( &self, ctx: impl WriteContext, value: u16, ) -> impl Future<Output = Result<(), Error>>

Source§

fn set_image_flip_horizontal( &self, ctx: impl WriteContext, value: bool, ) -> impl Future<Output = Result<(), Error>>

Source§

fn set_image_flip_vertical( &self, ctx: impl WriteContext, value: bool, ) -> impl Future<Output = Result<(), Error>>

Source§

fn set_local_video_recording_enabled( &self, ctx: impl WriteContext, value: bool, ) -> impl Future<Output = Result<(), Error>>

Source§

fn set_local_snapshot_recording_enabled( &self, ctx: impl WriteContext, value: bool, ) -> impl Future<Output = Result<(), Error>>

Source§

fn set_status_light_enabled( &self, ctx: impl WriteContext, value: bool, ) -> impl Future<Output = Result<(), Error>>

Source§

fn set_status_light_brightness( &self, ctx: impl WriteContext, value: ThreeLevelAutoEnum, ) -> impl Future<Output = Result<(), Error>>

Source§

fn set_image_rotation_discrete_angles( &self, ctx: impl WriteContext, value: u16, ) -> impl Future<Output = Result<(), Error>>

Auto Trait Implementations§

§

impl<'a, H, const NV: usize, const NA: usize = 0> !Freeze for CameraAvStreamHandler<'a, H, NV, NA>

§

impl<'a, H, const NV: usize, const NA: usize = 0> !RefUnwindSafe for CameraAvStreamHandler<'a, H, NV, NA>

§

impl<'a, H, const NV: usize, const NA: usize = 0> !Sync for CameraAvStreamHandler<'a, H, NV, NA>

§

impl<'a, H, const NV: usize, const NA: usize> Send for CameraAvStreamHandler<'a, H, NV, NA>
where H: Send,

§

impl<'a, H, const NV: usize, const NA: usize> Unpin for CameraAvStreamHandler<'a, H, NV, NA>
where H: Unpin,

§

impl<'a, H, const NV: usize, const NA: usize> UnsafeUnpin for CameraAvStreamHandler<'a, H, NV, NA>
where H: UnsafeUnpin,

§

impl<'a, H, const NV: usize, const NA: usize> UnwindSafe for CameraAvStreamHandler<'a, H, NV, NA>
where H: UnwindSafe,

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<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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, E> Init<T, E> for T

Source§

unsafe fn __init(self, slot: *mut T) -> Result<(), E>

Initializes slot. Read more
Source§

fn chain<F>(self, f: F) -> ChainInit<Self, F, T, E>
where F: FnOnce(&mut T) -> Result<(), E>,

First initializes the value using self then calls the function f with the initialized value. 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, I> IntoFallibleInit<T> for I
where I: Init<T>,

Source§

fn into_fallible<E>(self) -> impl Init<T, E>

Convert the infallible initializer to a fallible one.
Source§

impl<Source, Target> OctetsInto<Target> for Source
where Target: OctetsFrom<Source>,

Source§

type Error = <Target as OctetsFrom<Source>>::Error

Source§

fn try_octets_into( self, ) -> Result<Target, <Source as OctetsInto<Target>>::Error>

Performs the conversion.
Source§

fn octets_into(self) -> Target
where Self::Error: Into<Infallible>,

Performs an infallible conversion.
Source§

impl<T, E> PinInit<T, E> for T

Source§

unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), E>

Initializes slot. Read more
Source§

fn pin_chain<F>(self, f: F) -> ChainPinInit<Self, F, T, E>
where F: FnOnce(Pin<&mut T>) -> Result<(), E>,

First initializes the value using self then calls the function f with the initialized value. Read more
Source§

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

Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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