Skip to main content

GigeRegisterIo

Struct GigeRegisterIo 

Source
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

Source

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.

Source

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.

Trait Implementations§

Source§

impl RegisterIo for GigeRegisterIo

Source§

fn read(&self, addr: u64, len: usize) -> Result<Vec<u8>, GenApiError>

Read len bytes starting at addr.
Source§

fn write(&self, addr: u64, data: &[u8]) -> Result<(), GenApiError>

Write data starting at addr.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more