pub struct CameraAvStreamHandler<'a, H, const NV: usize, const NA: usize = 0>where
H: CameraAvStreamHooks,{ /* 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>where
H: CameraAvStreamHooks,
impl<'a, H, const NV: usize, const NA: usize> CameraAvStreamHandler<'a, H, NV, NA>where
H: CameraAvStreamHooks,
Sourcepub const CLUSTER: Cluster<'static>
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(...).
Sourcepub const CLUSTER_VIDEO_AUDIO: Cluster<'static>
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.
Sourcepub const fn new(
dataver: Dataver,
endpoint_id: u16,
config: CameraAvStreamConfig<'a>,
features: u32,
hooks: H,
) -> CameraAvStreamHandler<'a, H, NV, NA>
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.
Sourcepub const fn adapt(
self,
) -> HandlerAsyncAdaptor<CameraAvStreamHandler<'a, H, NV, NA>>
pub const fn adapt( self, ) -> HandlerAsyncAdaptor<CameraAvStreamHandler<'a, H, NV, NA>>
Wrap in the generic async adaptor for registration with a
rs-matter Node.
Sourcepub const fn endpoint_id(&self) -> u16
pub const fn endpoint_id(&self) -> u16
Endpoint this handler is mounted on.
Sourcepub fn acquire_video(&self, video_stream_id: u16) -> Result<(), Error>
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.
Sourcepub fn release_video(&self, video_stream_id: u16)
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.
Sourcepub fn video_streams(&self) -> Vec<VideoStream, NV>
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).
Sourcepub fn add_preallocated_video(&self, stream: VideoStream) -> Result<u16, Error>
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.
Sourcepub fn audio_streams(&self) -> Vec<AudioStream, NA>
pub fn audio_streams(&self) -> Vec<AudioStream, NA>
Snapshot the current set of allocated audio streams.
Sourcepub fn add_preallocated_audio(&self, stream: AudioStream) -> Result<u16, Error>
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>where
H: CameraAvStreamHooks,
impl<'a, H, const NV: usize, const NA: usize> ClusterAsyncHandler for CameraAvStreamHandler<'a, H, NV, NA>where
H: CameraAvStreamHooks,
Source§const CLUSTER: Cluster<'static> = Self::CLUSTER
const CLUSTER: Cluster<'static> = Self::CLUSTER
fn dataver(&self) -> u32
fn dataver_changed(&self)
async fn max_content_buffer_size( &self, _ctx: impl ReadContext, ) -> Result<u32, Error>
async fn max_network_bandwidth( &self, _ctx: impl ReadContext, ) -> Result<u32, Error>
async fn max_concurrent_encoders( &self, _ctx: impl ReadContext, ) -> Result<u8, Error>
async fn max_encoded_pixel_rate( &self, _ctx: impl ReadContext, ) -> Result<u32, Error>
async fn video_sensor_params<P>(
&self,
_ctx: impl ReadContext,
builder: VideoSensorParamsStructBuilder<P>,
) -> Result<P, Error>where
P: TLVBuilderParent,
async fn min_viewport_resolution<P>(
&self,
_ctx: impl ReadContext,
builder: VideoResolutionStructBuilder<P>,
) -> Result<P, Error>where
P: TLVBuilderParent,
async fn rate_distortion_trade_off_points<P>(
&self,
_ctx: impl ReadContext,
builder: ArrayAttributeRead<RateDistortionTradeOffPointsStructArrayBuilder<P>, RateDistortionTradeOffPointsStructBuilder<P>>,
) -> Result<P, Error>where
P: TLVBuilderParent,
async fn supported_stream_usages<P>(
&self,
_ctx: impl ReadContext,
builder: ArrayAttributeRead<ToTLVArrayBuilder<P, StreamUsageEnum>, ToTLVBuilder<P, StreamUsageEnum>>,
) -> Result<P, Error>where
P: TLVBuilderParent,
async fn stream_usage_priorities<P>(
&self,
_ctx: impl ReadContext,
builder: ArrayAttributeRead<ToTLVArrayBuilder<P, StreamUsageEnum>, ToTLVBuilder<P, StreamUsageEnum>>,
) -> Result<P, Error>where
P: TLVBuilderParent,
async fn allocated_video_streams<P>(
&self,
_ctx: impl ReadContext,
builder: ArrayAttributeRead<VideoStreamStructArrayBuilder<P>, VideoStreamStructBuilder<P>>,
) -> Result<P, Error>where
P: TLVBuilderParent,
async fn handle_video_stream_allocate<P>(
&self,
ctx: impl InvokeContext,
request: VideoStreamAllocateRequest<'_>,
response: VideoStreamAllocateResponseBuilder<P>,
) -> Result<P, Error>where
P: TLVBuilderParent,
async fn handle_video_stream_modify( &self, ctx: impl InvokeContext, request: VideoStreamModifyRequest<'_>, ) -> Result<(), Error>
async fn handle_video_stream_deallocate( &self, ctx: impl InvokeContext, request: VideoStreamDeallocateRequest<'_>, ) -> Result<(), Error>
async fn handle_set_stream_priorities( &self, ctx: impl InvokeContext, request: SetStreamPrioritiesRequest<'_>, ) -> Result<(), Error>
async fn microphone_capabilities<P>(
&self,
_ctx: impl ReadContext,
builder: AudioCapabilitiesStructBuilder<P>,
) -> Result<P, Error>where
P: TLVBuilderParent,
async fn allocated_audio_streams<P>(
&self,
_ctx: impl ReadContext,
builder: ArrayAttributeRead<AudioStreamStructArrayBuilder<P>, AudioStreamStructBuilder<P>>,
) -> Result<P, Error>where
P: TLVBuilderParent,
async fn handle_audio_stream_allocate<P>(
&self,
_ctx: impl InvokeContext,
_request: AudioStreamAllocateRequest<'_>,
_response: AudioStreamAllocateResponseBuilder<P>,
) -> Result<P, Error>where
P: TLVBuilderParent,
async fn handle_audio_stream_deallocate( &self, _ctx: impl InvokeContext, _request: AudioStreamDeallocateRequest<'_>, ) -> Result<(), Error>
async fn handle_snapshot_stream_allocate<P>(
&self,
_ctx: impl InvokeContext,
_request: SnapshotStreamAllocateRequest<'_>,
_response: SnapshotStreamAllocateResponseBuilder<P>,
) -> Result<P, Error>where
P: TLVBuilderParent,
async fn handle_snapshot_stream_modify( &self, _ctx: impl InvokeContext, _request: SnapshotStreamModifyRequest<'_>, ) -> Result<(), Error>
async fn handle_snapshot_stream_deallocate( &self, _ctx: impl InvokeContext, _request: SnapshotStreamDeallocateRequest<'_>, ) -> Result<(), Error>
async fn handle_capture_snapshot<P>(
&self,
_ctx: impl InvokeContext,
_request: CaptureSnapshotRequest<'_>,
_response: CaptureSnapshotResponseBuilder<P>,
) -> Result<P, Error>where
P: TLVBuilderParent,
fn lifecycle( &self, _ctx: impl HandlerContext, _op: LifecycleOp, ) -> Result<(), Error>
fn run( &self, _ctx: impl HandlerContext, ) -> impl Future<Output = Result<(), Error>>
fn night_vision_uses_infrared( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<bool, Error>>
fn speaker_capabilities<P>(
&self,
ctx: impl ReadContext,
builder: AudioCapabilitiesStructBuilder<P>,
) -> impl Future<Output = Result<P, Error>>where
P: TLVBuilderParent,
fn two_way_talk_support( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<TwoWayTalkSupportTypeEnum, Error>>
fn snapshot_capabilities<P>(
&self,
ctx: impl ReadContext,
builder: ArrayAttributeRead<SnapshotCapabilitiesStructArrayBuilder<P>, SnapshotCapabilitiesStructBuilder<P>>,
) -> impl Future<Output = Result<P, Error>>where
P: TLVBuilderParent,
fn current_frame_rate( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<u16, Error>>
fn hdr_mode_enabled( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<bool, Error>>
fn allocated_snapshot_streams<P>(
&self,
ctx: impl ReadContext,
builder: ArrayAttributeRead<SnapshotStreamStructArrayBuilder<P>, SnapshotStreamStructBuilder<P>>,
) -> impl Future<Output = Result<P, Error>>where
P: TLVBuilderParent,
fn soft_recording_privacy_mode_enabled( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<bool, Error>>
fn soft_livestream_privacy_mode_enabled( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<bool, Error>>
fn hard_privacy_mode_on( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<bool, Error>>
fn night_vision( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<TriStateAutoEnum, Error>>
fn night_vision_illum( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<TriStateAutoEnum, Error>>
fn viewport<P>(
&self,
ctx: impl ReadContext,
builder: ViewportStructBuilder<P>,
) -> impl Future<Output = Result<P, Error>>where
P: TLVBuilderParent,
fn speaker_muted( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<bool, Error>>
fn speaker_volume_level( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<u8, Error>>
fn speaker_max_level( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<u8, Error>>
fn speaker_min_level( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<u8, Error>>
fn microphone_muted( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<bool, Error>>
fn microphone_volume_level( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<u8, Error>>
fn microphone_max_level( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<u8, Error>>
fn microphone_min_level( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<u8, Error>>
fn microphone_agc_enabled( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<bool, Error>>
fn image_rotation( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<u16, Error>>
fn image_flip_horizontal( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<bool, Error>>
fn image_flip_vertical( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<bool, Error>>
fn local_video_recording_enabled( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<bool, Error>>
fn local_snapshot_recording_enabled( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<bool, Error>>
fn status_light_enabled( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<bool, Error>>
fn status_light_brightness( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<ThreeLevelAutoEnum, Error>>
fn image_rotation_discrete_angles( &self, ctx: impl ReadContext, ) -> impl Future<Output = Result<u16, Error>>
fn set_hdr_mode_enabled( &self, ctx: impl WriteContext, value: bool, ) -> impl Future<Output = Result<(), Error>>
fn set_soft_recording_privacy_mode_enabled( &self, ctx: impl WriteContext, value: bool, ) -> impl Future<Output = Result<(), Error>>
fn set_soft_livestream_privacy_mode_enabled( &self, ctx: impl WriteContext, value: bool, ) -> impl Future<Output = Result<(), Error>>
fn set_night_vision( &self, ctx: impl WriteContext, value: TriStateAutoEnum, ) -> impl Future<Output = Result<(), Error>>
fn set_night_vision_illum( &self, ctx: impl WriteContext, value: TriStateAutoEnum, ) -> impl Future<Output = Result<(), Error>>
fn set_viewport( &self, ctx: impl WriteContext, value: ViewportStruct<'_>, ) -> impl Future<Output = Result<(), Error>>
fn set_speaker_muted( &self, ctx: impl WriteContext, value: bool, ) -> impl Future<Output = Result<(), Error>>
fn set_speaker_volume_level( &self, ctx: impl WriteContext, value: u8, ) -> impl Future<Output = Result<(), Error>>
fn set_microphone_muted( &self, ctx: impl WriteContext, value: bool, ) -> impl Future<Output = Result<(), Error>>
fn set_microphone_volume_level( &self, ctx: impl WriteContext, value: u8, ) -> impl Future<Output = Result<(), Error>>
fn set_microphone_agc_enabled( &self, ctx: impl WriteContext, value: bool, ) -> impl Future<Output = Result<(), Error>>
fn set_image_rotation( &self, ctx: impl WriteContext, value: u16, ) -> impl Future<Output = Result<(), Error>>
fn set_image_flip_horizontal( &self, ctx: impl WriteContext, value: bool, ) -> impl Future<Output = Result<(), Error>>
fn set_image_flip_vertical( &self, ctx: impl WriteContext, value: bool, ) -> impl Future<Output = Result<(), Error>>
fn set_local_video_recording_enabled( &self, ctx: impl WriteContext, value: bool, ) -> impl Future<Output = Result<(), Error>>
fn set_local_snapshot_recording_enabled( &self, ctx: impl WriteContext, value: bool, ) -> impl Future<Output = Result<(), Error>>
fn set_status_light_enabled( &self, ctx: impl WriteContext, value: bool, ) -> impl Future<Output = Result<(), Error>>
fn set_status_light_brightness( &self, ctx: impl WriteContext, value: ThreeLevelAutoEnum, ) -> impl Future<Output = Result<(), Error>>
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> 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> 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