OptrisOptrisDocumentation

Documentation/OTC SDK/optris_sdk — Rust API referencev12.0

CameraOptions

pub struct CameraOptions

Everything an open can be asked for.

CameraOptions::new reads the SDK's own defaults out of optris_sdk_camera_options_init, so the defaults can be read rather than looked up: CameraOptions::new() opens exactly as Camera::open does.

CameraOptions — methods

pub fn new() -> Self

The SDK's defaults: calibration download allowed, no local calibration directory, the camera's own saved connection timeout, 5000 ms to connect, 3000 ms to discover, and whatever mode the camera settles on.

pub fn allow_calibration_download(mut self, allow: bool) -> Self

Whether missing calibration may be fetched from Optris.

false means the attempt is never made, rather than made and abandoned, so an offline machine fails immediately instead of waiting out a connection that cannot succeed.

pub fn calibration_download_allowed(&self) -> bool

Whether downloading is allowed.

pub fn calibration_directory(mut self, directory: &str) -> Result<Self>

A directory to search for calibration files before going to the network.

Where an operator points the SDK at files copied from a USB stick or a network share. Searched after the camera's own memory and before the internet.

Errors

Returns Status::InvalidArgument if the path does not fit the ABI's field or carries an interior NUL byte, refused rather than truncated, because a truncated path points at a different directory.

pub fn connection_timeout(mut self, timeout: Duration) -> Result<Self>

How long without a frame counts as a stalled stream.

Duration::ZERO, the default, means "use this camera's saved configuration", which is ten seconds from the factory but is a per-machine file and may be anything.

Errors

Returns Status::InvalidArgument if the duration does not fit the ABI's uint32_t of milliseconds.

pub fn connect_timeout(mut self, timeout: Duration) -> Result<Self>

How long to wait for the camera's control channel to answer before giving up.

Not the same thing as CameraOptions::connection_timeout, which is about a camera that is already open and has stopped sending frames. This one bounds getting it open in the first place, and it is what a mistyped address costs. Ignored on USB.

When it expires the open returns crate::Status::Timeout, not crate::Status::Device: nothing answered at all, as opposed to something answering and the open failing.

Errors

As CameraOptions::connection_timeout.

pub fn discovery_timeout(mut self, timeout: Duration) -> Result<Self>

How long to wait for the camera to identify itself before opening it unverified.

The other half of the bound, and the reason setting only CameraOptions::connect_timeout does not shorten a failed open as much as the arithmetic suggests: a network open asks the address who is there first, waits this long for an answer, and only then spends the connect timeout on the control channel. The worst case for an address nobody answers is the two added together. Ignored on USB.

Errors

As CameraOptions::connection_timeout.

pub fn timeouts(&self) -> (Duration, Duration, Duration)

The three timeouts in force, as (connection, connect, discovery).

pub fn operation_mode(mut self, mode: &OperationMode) -> Self

Open directly in this mode.

Honoured exactly or refused. A mode this camera's calibration does not offer fails the open with crate::Status::Configuration, naming what was asked for, and is not retried: a camera's modes come from its calibration, so asking again cannot change the answer. Nothing is rounded to a neighbouring mode. That refusal is the reason to use this rather than the camera's stored preference, whose unhonourable frame rate is substituted on purpose.

Take a mode from Camera::operation_modes on an earlier run, or from a DeviceInfo. Matched on the optics number and its label, both temperature limits, the frame size and the frame rate.

The mode is handed over byte for byte as the camera produced it, which is why this takes an OperationMode rather than the numbers inside one: a mode assembled by hand carries a label the camera does not recognise and is refused.

pub fn any_operation_mode(mut self) -> Self

Open in whatever mode the camera settles on, undoing CameraOptions::operation_mode.

pub fn requested_operation_mode(&self) -> Option<OperationMode>

The mode the open will ask for, or None for the camera's own choice.