pub struct GigeRegisterIo { /* private fields */ }Expand description
Blocking adapter turning an asynchronous GigeDevice into a RegisterIo
implementation.
The adapter uses [tokio::runtime::Handle::block_on] to synchronously wait
on GVCP register transactions. When called from within a tokio runtime
context it automatically wraps the call in [tokio::task::block_in_place]
so the executor can keep making progress. This makes it safe to call from
both async and plain synchronous contexts.
Note: block_in_place requires a multi-thread runtime. Using a
current_thread runtime will still panic.
§Control channel keepalive
Constructing the adapter spawns a background task that keeps the device’s
control channel alive; see GigeRegisterIo::new. Holding a
GigeRegisterIo is therefore enough to keep control privilege — no caller
has to run a heartbeat of its own.
Implementations§
Source§impl GigeRegisterIo
impl GigeRegisterIo
Sourcepub fn new(handle: Handle, device: GigeDevice) -> Self
pub fn new(handle: Handle, device: GigeDevice) -> Self
Create a new adapter using the provided runtime handle and device.
This also spawns the control-channel keepalive on handle. A GigE Vision
device revokes control privilege if it receives no GVCP command within
GevHeartbeatTimeout (3 000 ms on both viva-fake-gige and the aravis
fake camera, arvfakecamera.c:1082), and GVSP image traffic does not
count — so a camera can sit at an interactive prompt, or stream frames for
a minute, and then refuse the next write with ACCESS_DENIED.
Nothing in an application’s normal flow refreshes that timer, which is why three consumers of this crate had each grown their own copy of the loop — and why the Python bindings, which had none, hit the failure.
The keepalive stops when the adapter is dropped, so privilege is maintained for exactly as long as the transport that needs it.
Sourcepub fn lock_device(&self) -> Result<MutexGuard<'_, GigeDevice>, GenicamError>
pub fn lock_device(&self) -> Result<MutexGuard<'_, GigeDevice>, GenicamError>
Lock the underlying GigeDevice for direct async operations.
This is intended for callers that need the raw device (e.g. stream
channel configuration) while the Camera wrapper holds the transport.