Skip to main content

U3vDevice

Struct U3vDevice 

Source
pub struct U3vDevice<T: UsbTransfer> { /* private fields */ }
Expand description

High-level handle for a USB3 Vision device.

Wraps a ControlChannel and parsed bootstrap registers. The generic T parameter allows production use with RusbTransfer and testing with MockUsbTransfer.

Implementations§

Source§

impl<T: UsbTransfer> U3vDevice<T>

Source

pub fn open( transport: Arc<T>, ep_in: u8, ep_out: u8, stream_ep: Option<u8>, event_ep: Option<u8>, ) -> Result<Self, U3vError>

Open a U3V device given a shared USB transport and endpoint addresses.

Reads the ABRM and SBRM bootstrap registers, then re-creates the control channel with the device-reported maximum transfer sizes.

Source

pub fn transport(&self) -> Arc<T>

Access the shared transport handle (e.g. to create additional streams).

Source

pub fn abrm(&self) -> &Abrm

Reference to the parsed ABRM.

Source

pub fn sbrm(&self) -> &Sbrm

Reference to the parsed SBRM.

Source

pub fn read_mem(&mut self, addr: u64, len: usize) -> Result<Vec<u8>, U3vError>

Read len bytes from device memory at addr.

Source

pub fn write_mem(&mut self, addr: u64, data: &[u8]) -> Result<(), U3vError>

Write data to device memory at addr.

Source

pub fn read_sirm(&mut self) -> Result<Sirm, U3vError>

Read the SIRM (Streaming Interface Register Map) from the device.

Source

pub fn fetch_xml(&mut self) -> Result<String, U3vError>

Fetch the GenICam XML descriptor from the device’s manifest table.

If the manifest payload is ZIP-compressed (starts with PK\x03\x04), it is decompressed transparently. Returns the XML as a UTF-8 string.

Source

pub fn stream_ep(&self) -> Option<u8>

The bulk IN endpoint for streaming data, if the device has one.

Source

pub fn event_ep(&self) -> Option<u8>

The bulk IN endpoint for events, if the device has one.

Source

pub fn open_stream( &mut self, payload_size: u64, ) -> Result<U3vStream<T>, U3vError>

Read the SIRM, configure stream sizes, and create a crate::stream::U3vStream for receiving frames.

The stream endpoint must have been discovered during device open. Configures the SIRM with the device’s maximum leader/trailer sizes and the specified payload size, then enables streaming.

Source

pub fn stop_stream(&mut self) -> Result<(), U3vError>

Disable streaming via the SIRM control register.

Source§

impl U3vDevice<RusbTransfer>

Source

pub fn open_device(info: &U3vDeviceInfo) -> Result<Self, U3vError>

Open a USB3 Vision device from a U3vDeviceInfo obtained via discover().

Auto Trait Implementations§

§

impl<T> Freeze for U3vDevice<T>

§

impl<T> RefUnwindSafe for U3vDevice<T>
where T: RefUnwindSafe,

§

impl<T> Send for U3vDevice<T>

§

impl<T> Sync for U3vDevice<T>

§

impl<T> Unpin for U3vDevice<T>

§

impl<T> UnsafeUnpin for U3vDevice<T>

§

impl<T> UnwindSafe for U3vDevice<T>
where T: RefUnwindSafe,

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