pub struct Camera<R: VmbRuntime> { /* private fields */ }Expand description
Open handle to a Vimba camera.
Dropping the camera cleanly ends any running capture (via
Camera::stop_capture) and closes the adapter-side resources.
Implementations§
Source§impl<R: VmbRuntime> Camera<R>
impl<R: VmbRuntime> Camera<R>
Sourcepub fn open(runtime: Arc<R>, id: &str) -> Result<Self>
pub fn open(runtime: Arc<R>, id: &str) -> Result<Self>
Open a camera by its transport-layer ID. Usually called via
VmbSystem::open_camera.
Sourcepub fn id(&self) -> &str
pub fn id(&self) -> &str
The camera ID originally passed to Camera::open.
Sourcepub fn load_settings(&self, path: &Path) -> Result<()>
pub fn load_settings(&self, path: &Path) -> Result<()>
Load a Vimba settings XML (day/night profile).
Sourcepub fn start_capture<F>(
&mut self,
num_buffers: usize,
callback: F,
) -> Result<()>
pub fn start_capture<F>( &mut self, num_buffers: usize, callback: F, ) -> Result<()>
Start continuous capture.
The closure is invoked for every received frame; it MUST be fast
and immediately copy the frame bytes (the adapter re-queues the
buffer as soon as the callback returns). The closure may run on
any thread the adapter chooses and must be Send + Sync.
num_buffers is the number of frame buffers to pre-announce; 4
is a reasonable default.
§Cleanup contract
All resources claimed between the first announce_frame and the
final Ok(()) are unwound on any error path before returning.
This guarantees self.session is only populated when the
adapter is fully primed — preventing a latent use-after-free
where the SDK could otherwise hold pointers into callback
allocations that get dropped when Camera::drop skips
stop_capture.
Sourcepub fn stop_capture(&mut self) -> Result<()>
pub fn stop_capture(&mut self) -> Result<()>
Stop an in-progress capture. Safe to call when no capture is running — the call is a no-op in that case.