Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Quick Start

From nothing to a list of the cameras on your network.

Install what you need

  • A Rust application: add the facade crate and an async runtime. Rust 1.88 or newer.

    cargo add viva-genicam
    cargo add tokio --features full
    
  • The command line: viva-camctl comes with the Python package (pip install viva-genicam), and in the viva-genicam-<version>-<platform> archives on each GitHub release, next to viva-service.

  • Python: pip install viva-genicam — see Install & hello-camera.

  • A desktop app: Viva Studio.

For a GigE Vision camera, the host must allow UDP broadcast on the network interface the camera is on; Networking covers firewalls, addressing and jumbo frames.

Find your cameras

From the command line:

viva-camctl list
# Only on one network interface, named by its address or its OS name:
viva-camctl list --iface 192.168.0.5

From Rust, discovery is one call; the snippet comes from the list_cameras example:

    // `discover` broadcasts on the interfaces the library can see; naming one
    // pins it to that NIC, which is what you want on a multi-homed host.
    // `IfaceSelector` takes either spelling — `--iface 192.168.0.5` or
    // `--iface eth0` — so the flag means the same thing here as in
    // `viva-camctl` and `viva-service`.
    let devices = if let Some(selector) = iface.as_ref() {
        let iface = selector.resolve()?;
        viva_genicam::gige::discover_on_interface(timeout, iface.name()).await?
    } else {
        viva_genicam::gige::discover(timeout).await?
    };

    if devices.is_empty() {
        println!("No cameras found.");
        return Ok(());
    }

    println!("{:<16} {:<17} {:<20} Model", "IP", "MAC", "Manufacturer");
    for dev in devices {
        println!(
            "{:<16} {:<17} {:<20} {}",
            dev.ip,
            format_mac(&dev.mac),
            dev.manufacturer.as_deref().unwrap_or("-"),
            dev.model.as_deref().unwrap_or("-"),
        );
    }

Then connect to one and read or write a feature by name (get_set_feature):

    // `connect_gige` fetches the GenApi XML and builds the NodeMap, so every
    // feature the camera declares is addressable by name from here on.
    let mut camera = connect_gige(&device).await?;

    // Feature access is synchronous even inside an async program: the register
    // I/O behind it blocks, and `GigeRegisterIo` steps off the async worker on
    // its own rather than making every caller do it.
    println!("{name} = {}", camera.get(&name)?);

    if let Some(value) = value.as_deref() {
        camera.set(&name, value)?;
        println!("{name} = {} (after write)", camera.get(&name)?);
    }

From a clone of the repository the examples run as cargo run -p viva-genicam --example list_cameras, and the CLI as cargo run -p viva-camctl -- list.

Control path: read / write & XML

# Read a feature by name
viva-camctl get --ip 192.168.0.10 --name ExposureTime

# Set a feature value
viva-camctl set --ip 192.168.0.10 --name ExposureTime --value 5000

# Dump the camera's GenApi XML
viva-camctl xml --ip 192.168.0.10 --out camera.xml

When something does not work

# Collect everything a bug report needs, in one file
viva-camctl report --ip 192.168.0.10 --out viva-report.txt

The report lists the network interfaces the library can see, the camera’s reply to discovery, its bootstrap registers, its GenApi XML, and any feature the camera has that this library could not build. Neither report nor xml needs the camera to open successfully — that is what they are for — so both still produce output when nothing else does. Attach the file to an issue.

Streaming

# Receive a GVSP stream and save 2 frames to the current directory.
# By default the camera's GevSCPSPacketSize is kept; --auto sizes packets from
# the NIC MTU, --packet-size N sets an explicit ceiling.
viva-camctl stream --ip 192.168.0.10 --iface 192.168.0.5 --auto --save 2

See Streaming → Packet size and MTU.

Windows specifics

The firewall prompt, NIC power saving and jumbo frames are the usual obstacles; see Networking → Windows. A USB3 Vision camera needs the WinUSB driver; see USB3 Vision setup → Windows.

Next steps

  • Read the Primer for the concepts behind discovery, control, and streaming.
  • Jump to the Discovery tutorial for a step‑by‑step walkthrough with troubleshooting tips.
  • No camera yet? Testing without hardware runs everything against an in-process fake.