pub struct GigeDevice { /* private fields */ }Expand description
GVCP device handle.
Implementations§
Source§impl GigeDevice
impl GigeDevice
Sourcepub async fn open(addr: SocketAddr) -> Result<Self, GigeError>
pub async fn open(addr: SocketAddr) -> Result<Self, GigeError>
Connect to a device GVCP endpoint.
The connection is ready for register read/write but does not claim
control privilege. Call Self::claim_control before configuring streaming
or starting acquisition.
Sourcepub async fn claim_control(&mut self) -> Result<(), GigeError>
pub async fn claim_control(&mut self) -> Result<(), GigeError>
Claim control channel privilege (CCP).
Required by the GigE Vision specification before the device accepts stream configuration or acquisition commands.
Sourcepub async fn release_control(&mut self) -> Result<(), GigeError>
pub async fn release_control(&mut self) -> Result<(), GigeError>
Release control channel privilege.
Sourcepub fn remote_addr(&self) -> SocketAddr
pub fn remote_addr(&self) -> SocketAddr
Return the remote GVCP socket address associated with this device.
Sourcepub async fn read_register(&mut self, addr: u32) -> Result<u32, GigeError>
pub async fn read_register(&mut self, addr: u32) -> Result<u32, GigeError>
Read a single 32-bit bootstrap or device register.
Uses GVCP READREG format: 4-byte register address. The acknowledgement carries the 4-byte register value.
Sourcepub async fn write_register(
&mut self,
addr: u32,
value: u32,
) -> Result<(), GigeError>
pub async fn write_register( &mut self, addr: u32, value: u32, ) -> Result<(), GigeError>
Write a single 32-bit bootstrap or device register.
Uses GVCP WRITEREG format: 4-byte register address + 4-byte value. The acknowledgement carries a 4-byte data index placeholder.
Sourcepub async fn read_mem(
&mut self,
addr: u64,
len: usize,
) -> Result<Vec<u8>, GigeError>
pub async fn read_mem( &mut self, addr: u64, len: usize, ) -> Result<Vec<u8>, GigeError>
Read a block of memory from the remote device with chunking and retries.
Uses GVCP READMEM format: 4-byte address + 2-byte reserved + 2-byte count. The acknowledgement carries: 4-byte address echo + data bytes.
Sourcepub async fn write_mem(
&mut self,
addr: u64,
data: &[u8],
) -> Result<(), GigeError>
pub async fn write_mem( &mut self, addr: u64, data: &[u8], ) -> Result<(), GigeError>
Write a block of memory to the remote device with chunking and retries.
Uses GVCP WRITEMEM format: 4-byte address + data bytes. The acknowledgement carries: 4-byte reserved (index).
Sourcepub async fn set_message_destination(
&mut self,
ip: Ipv4Addr,
port: u16,
) -> Result<(), GigeError>
pub async fn set_message_destination( &mut self, ip: Ipv4Addr, port: u16, ) -> Result<(), GigeError>
Configure the message channel destination address/port.
Sourcepub async fn set_stream_destination(
&mut self,
channel: u32,
ip: Ipv4Addr,
port: u16,
) -> Result<(), GigeError>
pub async fn set_stream_destination( &mut self, channel: u32, ip: Ipv4Addr, port: u16, ) -> Result<(), GigeError>
Configure the GVSP host destination for the provided channel.
Sourcepub async fn set_stream_packet_size(
&mut self,
channel: u32,
packet_size: u32,
) -> Result<(), GigeError>
pub async fn set_stream_packet_size( &mut self, channel: u32, packet_size: u32, ) -> Result<(), GigeError>
Configure the packet size for the stream channel.
Sourcepub async fn set_stream_packet_delay(
&mut self,
channel: u32,
packet_delay: u32,
) -> Result<(), GigeError>
pub async fn set_stream_packet_delay( &mut self, channel: u32, packet_delay: u32, ) -> Result<(), GigeError>
Configure the packet delay (GevSCPD).
Sourcepub async fn negotiate_stream(
&mut self,
channel: u32,
iface: &Iface,
port: u16,
target_mtu: Option<u32>,
) -> Result<StreamParams, GigeError>
pub async fn negotiate_stream( &mut self, channel: u32, iface: &Iface, port: u16, target_mtu: Option<u32>, ) -> Result<StreamParams, GigeError>
Negotiate GVSP parameters with the device given the host interface.
Sourcepub async fn enable_event_raw(
&mut self,
id: u16,
on: bool,
) -> Result<(), GigeError>
pub async fn enable_event_raw( &mut self, id: u16, on: bool, ) -> Result<(), GigeError>
Enable or disable delivery of the provided event identifier.
Sourcepub async fn read_persistent_ip(
&mut self,
) -> Result<(Ipv4Addr, Ipv4Addr, Ipv4Addr), GigeError>
pub async fn read_persistent_ip( &mut self, ) -> Result<(Ipv4Addr, Ipv4Addr, Ipv4Addr), GigeError>
Read the persistent IP configuration from the device.
Returns (ip, subnet, gateway).
Sourcepub async fn write_persistent_ip(
&mut self,
ip: Ipv4Addr,
subnet: Ipv4Addr,
gateway: Ipv4Addr,
) -> Result<(), GigeError>
pub async fn write_persistent_ip( &mut self, ip: Ipv4Addr, subnet: Ipv4Addr, gateway: Ipv4Addr, ) -> Result<(), GigeError>
Write the persistent IP configuration to the device.
Sourcepub async fn enable_persistent_ip(&mut self) -> Result<(), GigeError>
pub async fn enable_persistent_ip(&mut self) -> Result<(), GigeError>
Enable persistent IP mode in the device configuration flags.
Sets bit 1 (persistent IP) in the CurrentIPConfiguration register.