Expand description
GigE Vision cameras for programs without an async runtime.
Discovery and opening a camera are asynchronous in the rest of this
crate; here they block. A camera opened with connect carries a small
runtime of its own — one worker thread that drives its socket, its
control-channel keepalive and its timers — and shuts it down when it is
dropped, after giving control back. Everything else is the ordinary
Camera: its feature access, the standard-feature helpers and
Camera::open_stream are synchronous already, and frames come from
FrameStream::next_frame_blocking.
Commands wait with Camera::execute_and_wait_blocking.
use std::time::Duration;
use viva_genicam::{blocking, StreamOptions};
let devices = blocking::discover(Duration::from_millis(500))?;
let mut camera = blocking::connect(&devices[0])?;
camera.set_exposure_time(5_000.0)?;
let mut frames = camera.open_stream(StreamOptions::new())?;
camera.acquisition_start()?;
let frame = frames.next_frame_blocking(Duration::from_secs(1))?;
camera.acquisition_stop()?;These functions refuse to run inside an async runtime, where blocking
would stall it: there, use gige::discover and
connect_gige.
USB3 Vision needs nothing from here to open a camera — connect_u3v is
synchronous — but its frame stream still runs on a Tokio runtime.
Functions§
- connect
- Open a GigE Vision camera and take control of it:
connect_gige, blocking. - connect_
as - Open a GigE Vision camera with the given
Access, returning the GenICam XML it was built from too:connect_gige_as, blocking. - discover
- Find GigE Vision cameras by broadcast:
gige::discover, blocking fortimeout. - discover_
ip - Ask the camera at
ipdirectly:gige::discover_ip, blocking for up totimeout. - discover_
with - Find GigE Vision cameras as
optionssay:gige::discover_with, blocking fortimeout.