Skip to main content

Crate viva_genicam

Crate viva_genicam 

Source
Expand description

High level GenICam facade that re-exports the workspace crates and provides convenience wrappers.

use viva_genicam::{gige, genapi, Camera, GenicamError};
use std::time::Duration;

let timeout = Duration::from_millis(500);
let devices = gige::discover(timeout)
    .await
    .expect("discover cameras");
println!("found {} cameras", devices.len());
let mut camera = Camera::new(open_transport().await?, load_nodemap());
camera.set("ExposureTime", "5000")?;
use std::net::Ipv4Addr;
let ids = ["FrameStart", "ExposureEnd"];
let iface = Ipv4Addr::new(127, 0, 0, 1);
camera.configure_events(iface, 10020, &ids).await?;
let stream = camera.open_event_stream(iface, 10020).await?;
let event = stream.next().await?;
println!("event id=0x{:04X} payload={} bytes", event.id, event.data.len());
use viva_genicam::gige::{send_action, ActionParams};
use std::net::SocketAddr;
let params = ActionParams {
    device_key: 0,
    group_key: 1,
    group_mask: 0xFFFF_FFFF,
    scheduled_time: None,
};
let dest: SocketAddr = "255.255.255.255:3956".parse().unwrap();
let summary = send_action(dest, &params, 200).await?;
println!("acks={}", summary.acks);
Ok(())

Re-exports§

pub use viva_genapi as genapi;
pub use viva_gencp as gencp;
pub use viva_gige as gige;
pub use viva_pfnc as pfnc;
pub use viva_sfnc as sfnc;
pub use viva_u3v as u3v;

Modules§

blocking
GigE Vision cameras for programs without an async runtime.
image_io
Saving frames as PNG or TIFF at the camera’s bit depth.
report
A diagnostic report: everything we ask someone with a camera for, in one plain-text file.

Structs§

AckSummary
Summary of the broadcast performed by send_action.
ActionParams
Parameters used to construct an action command.
Camera
Camera facade combining a nodemap with a transport implementing RegisterIo.
ChunkConfig
Configuration for enabling chunk data via SFNC features.
ChunkData
The chunks of one stream buffer, by chunk ID: what a nodemap’s chunk ports read.
Event
Public representation of a GigE Vision event.
EventConfiguration
Event settings changed by one successful setup, tied to its camera session.
EventRestoreFailure
One setting that could not be restored. Other independent settings are still attempted while the camera remains writable.
EventRestoreReport
The outcome of restoring only the settings an event setup changed.
EventSetupError
Setup failed; Self::source retains the error and Self::restoration says whether rollback succeeded. A failed rollback must not be reported as a successful cleanup.
EventStream
Asynchronous stream of events delivered over the GVCP message channel.
EvsBlock
One raw event-vision block reassembled from GVSP packets.
Frame
Image frame produced by the GigE Vision stream reassembler.
FrameStream
Frames from one GVSP stream, assembled by a receive thread of its own.
GenericStreamBlock
An opaque complete GVSP block with common metadata accessors.
GigeRegisterIo
Blocking adapter turning an asynchronous GigeDevice into a RegisterIo implementation.
Reopen
How reopen_gige looks for a camera that went away, and what it puts back.
Reopened
A camera reopen_gige opened again.
ResolvedFeature
The node a standard feature resolved to on this camera.
Roi
A region of interest: the offsets of its top-left corner on the sensor, and its size, in pixels.
Stream
Handle returned by StreamBuilder: the bound socket and the negotiated parameters, ready for FrameStream::new.
StreamBuilder
Builder for configuring a GVSP stream.
StreamOptions
How Camera::open_stream sets up a GigE stream. The defaults: the interface the operating system routes to the camera, unicast to a port the operating system picks, the camera’s own packet size (path-probed, ADR-0021) and packet delay, packet resend when the camera supports it, and a receive buffer the engine sizes from the frame.
StreamStats
Snapshot of one stream’s counters (backlog SR-07).
StreamStatsAccumulator
Shared, cloneable handle to one stream’s counters.
TimeSync
Maintain a linear mapping between device ticks and host time.
U3vConnection
Whether a USB3 Vision camera is gone, readable apart from its transport (U3vRegisterIo::connection).
U3vEventStream
Events from a USB3 Vision camera’s event interface, read on a thread of its own (backlog TC-27 (4)).
U3vFrameStream
Frames from a USB3 Vision camera, read on a thread of its own.
U3vRegisterIo
Blocking RegisterIo adapter wrapping a U3vDevice.
U3vStreamBuilder
Builder for a USB3 Vision U3vFrameStream on a camera’s transport — the device, as GigE Vision’s StreamBuilder takes the device.
U3vStreamOptions
How a stream reads: the payload size to use when the device does not say, and the transfers it keeps queued.
WriteRefused
Why a GigeRegisterIo refused a write before it reached the camera: the session does not hold control. The source of the GenApiError::Io a refused feature write returns, so a caller can tell it from a camera’s refusal by downcasting.

Enums§

Access
How connect_gige_as opens a camera.
ChunkError
A chunk payload that does not tile into tagged chunks.
ControlState
Where a GigE session stands with the camera’s control channel privilege (CCP). Only a session that holds it writes registers: in every other state a write is refused before it reaches the camera.
EventRestoreSkipped
Why restoration deliberately performed no further writes.
EvsFormat
Encoding used by a LUCID event-vision stream block.
FrameStatus
How a frame’s block ended.
GenicamError
Error type produced by the high level GenICam facade.
ResendPolicy
Whether a stream asks the camera to send lost packets again (SR-04).
StandardFeature
A standard feature the helpers look up, by the names cameras declare it under.
StreamBlock
The semantic payload carried by one complete GVSP block.
StreamDest
Destination for GVSP packets received by the stream.

Constants§

COMMAND_POLL_INTERVAL
How often Camera::execute_and_wait asks a command whether it has finished, when the command declares no <PollingTime>.
COMMAND_TIMEOUT
How long the helpers that wait for a command — the user-set helpers, among them — give it to finish, and what consumers of this crate wait by default.

Functions§

chunk_data
Split a GigE Vision chunk payload into a ChunkData, by chunk ID.
connect_gige
Connect to a GigE Vision camera and return a fully configured Camera.
connect_gige_as
Connect to a GigE Vision camera with the given Access, returning the Camera and the GenICam XML it was built from.
connect_gige_with_xml
Connect to a GigE Vision camera and return both a Camera and the raw GenICam XML string fetched from the device.
connect_u3v
Connect to a USB3 Vision camera and return a fully configured Camera.
connect_u3v_with_xml
Connect to a USB3 Vision camera and return both a Camera and the raw GenICam XML string fetched from the device.
open_u3v_device
Create a Camera from an already-opened U3vDevice with any UsbTransfer backend.
reopen_gige
Open again a GigE Vision camera that went away: unplugged, power-cycled, or with its heartbeat expired.