pub struct FrameStream { /* private fields */ }Expand description
High-level async iterator over reassembled GVSP frames.
Wraps a low-level Stream and handles packet parsing, reassembly,
and optional resend requests automatically.
§Example
let raw_stream = StreamBuilder::new(&mut device)
.iface(iface)
.build()
.await?;
let mut frame_stream = FrameStream::new(raw_stream, None);
while let Some(frame) = frame_stream.next_frame().await? {
println!("Frame: {}x{}", frame.width, frame.height);
}Implementations§
Source§impl FrameStream
impl FrameStream
Sourcepub fn set_frame_timeout(&mut self, timeout: Duration)
pub fn set_frame_timeout(&mut self, timeout: Duration)
Set the frame assembly timeout.
If a frame is not complete within this duration, it will be dropped and assembly will move on to the next frame.
Sourcepub fn set_time_sync(&mut self, time_sync: TimeSync)
pub fn set_time_sync(&mut self, time_sync: TimeSync)
Update or set the time synchronization model for timestamp mapping.
Sourcepub fn stats_handle(&self) -> StreamStatsAccumulator
pub fn stats_handle(&self) -> StreamStatsAccumulator
Obtain a clone of the statistics accumulator handle.
Sourcepub fn stats(&self) -> StreamStats
pub fn stats(&self) -> StreamStats
Snapshot the collected statistics.
Sourcepub fn params(&self) -> StreamParams
pub fn params(&self) -> StreamParams
Access the negotiated stream parameters.
Sourcepub fn config(&self) -> &StreamConfig
pub fn config(&self) -> &StreamConfig
Immutable view of the stream configuration.
Sourcepub fn socket(&self) -> Option<&UdpSocket>
pub fn socket(&self) -> Option<&UdpSocket>
Borrow the underlying UDP socket (returns None when using a custom transport).
Sourcepub async fn next_frame(&mut self) -> Result<Option<Frame>, GenicamError>
pub async fn next_frame(&mut self) -> Result<Option<Frame>, GenicamError>
Receive the next complete frame.
This method handles packet reception, parsing, and reassembly internally.
Returns Ok(Some(frame)) when a complete frame is available, or
Ok(None) if the stream has ended (socket closed).