pub struct CameraManager { /* private fields */ }Expand description
Camera manager used to enumerate available cameras in the system.
Implementations§
Source§impl CameraManager
impl CameraManager
Sourcepub fn new_unstarted() -> Result<Self>
pub fn new_unstarted() -> Result<Self>
Create a CameraManager without starting it.
Call Self::start before using it to enumerate cameras.
Sourcepub fn try_stop(&mut self) -> Result<()>
pub fn try_stop(&mut self) -> Result<()>
Attempt to stop only if no tracked cameras are still alive.
Sourcepub fn restart(&mut self) -> Result<()>
pub fn restart(&mut self) -> Result<()>
Restart the manager by stopping (if safe) and starting again.
Sourcepub fn is_started(&self) -> bool
pub fn is_started(&self) -> bool
Returns true if the manager has been started.
Sourcepub fn cameras<'a>(&self) -> CameraList<'a>
pub fn cameras<'a>(&self) -> CameraList<'a>
Enumerates cameras within the system.
Sourcepub fn log_set_level(&self, category: &str, level: LoggingLevel)
pub fn log_set_level(&self, category: &str, level: LoggingLevel)
Set the log level.
§Parameters
category- Free-form category string, a list of those can be seen by runninggrep 'LOG_DEFINE_CATEGORY(' -Ron thelibcamerasource codelevel- Maximum log importance level to show, anything more less important than that will be hidden.
Sourcepub fn on_camera_added(
&mut self,
cb: impl FnMut(Camera<'static>) + Send + 'static,
)
pub fn on_camera_added( &mut self, cb: impl FnMut(Camera<'static>) + Send + 'static, )
Register a callback for camera-added events.
§Warning
The callback is invoked on libcamera’s internal thread. Do not block in the callback; send work to another thread/channel if needed.
Sourcepub fn on_camera_removed(
&mut self,
cb: impl FnMut(Camera<'static>) + Send + 'static,
)
pub fn on_camera_removed( &mut self, cb: impl FnMut(Camera<'static>) + Send + 'static, )
Register a callback for camera-removed events.
§Warning
The callback is invoked on libcamera’s internal thread. Do not block in the callback; send work to another thread/channel if needed.
Sourcepub fn subscribe_hotplug_events(&mut self) -> Receiver<HotplugEvent>
pub fn subscribe_hotplug_events(&mut self) -> Receiver<HotplugEvent>
Subscribe to hotplug events via a channel.
The returned Receiver yields HotplugEvent values. Internally this hooks into the libcamera hotplug signals
and forwards them; it uses the same callbacks as on_camera_added/removed, so do not mix different senders
without care.