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>
impl<T: UsbTransfer> U3vDevice<T>
Sourcepub fn open(
transport: Arc<T>,
ep_in: u8,
ep_out: u8,
stream_ep: Option<u8>,
event_ep: Option<u8>,
) -> Result<Self, U3vError>
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.
Sourcepub fn transport(&self) -> Arc<T>
pub fn transport(&self) -> Arc<T>
Access the shared transport handle (e.g. to create additional streams).
Sourcepub fn read_mem(&mut self, addr: u64, len: usize) -> Result<Vec<u8>, U3vError>
pub fn read_mem(&mut self, addr: u64, len: usize) -> Result<Vec<u8>, U3vError>
Read len bytes from device memory at addr.
Sourcepub fn write_mem(&mut self, addr: u64, data: &[u8]) -> Result<(), U3vError>
pub fn write_mem(&mut self, addr: u64, data: &[u8]) -> Result<(), U3vError>
Write data to device memory at addr.
Sourcepub fn read_sirm(&mut self) -> Result<Sirm, U3vError>
pub fn read_sirm(&mut self) -> Result<Sirm, U3vError>
Read the SIRM (Streaming Interface Register Map) from the device.
Sourcepub fn fetch_xml(&mut self) -> Result<String, U3vError>
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.
Sourcepub fn stream_ep(&self) -> Option<u8>
pub fn stream_ep(&self) -> Option<u8>
The bulk IN endpoint for streaming data, if the device has one.
Sourcepub fn open_stream(
&mut self,
payload_size: u64,
) -> Result<U3vStream<T>, U3vError>
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.
Sourcepub fn stop_stream(&mut self) -> Result<(), U3vError>
pub fn stop_stream(&mut self) -> Result<(), U3vError>
Disable streaming via the SIRM control register.
Source§impl U3vDevice<RusbTransfer>
impl U3vDevice<RusbTransfer>
Sourcepub fn open_device(info: &U3vDeviceInfo) -> Result<Self, U3vError>
pub fn open_device(info: &U3vDeviceInfo) -> Result<Self, U3vError>
Open a USB3 Vision device from a U3vDeviceInfo
obtained via discover().