OptrisOptrisDocumentation

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

Status

pub enum Status

What went wrong, as a machine-readable code.

Mirrors optris_sdk_status. Status::Ok is never carried by an Error: a zero status is success and is turned into Ok(_) before an error is ever built.

Marked #[non_exhaustive] because the C header says new enumerators may be appended, so matching on it needs a default arm and always will.

Status — variants

Ok

The call succeeded.

Unknown

An error the SDK could not classify.

InvalidArgument

A parameter was NULL, outside its documented domain, or carried a struct_size the library does not understand.

InvalidHandle

A handle was NULL or of the wrong type.

BufferTooSmall

The supplied buffer was too small.

This crate sizes its own buffers, so seeing this from a safe method is a bug in the binding rather than in your code.

NotSupported

The hardware or the current configuration cannot do this.

NotFound

The named device, region, rule or channel does not exist.

Timeout

The operation did not complete within its timeout.

WouldBlock

Nothing is available right now, routine rather than wrong.

Returned by non-blocking frame acquisition. The safe API turns this into Ok(None) wherever it is the expected answer, so it rarely reaches you as an error.

Device

The device could not be opened, is unreachable, or refused the command.

Calibration

Calibration data is missing or unusable.

Configuration

A configuration or parameter value was rejected.

Capture

Frame capture failed.

Io

A file could not be read or written.

NotConnected

The device is known but not currently connected.

OutOfRange

An index was past the end of the range the hardware reports.

OutOfMemory

An allocation failed.

InvalidState

Valid, but not right now.

Busy

The camera would not carry the operation out, and may next time.

The hardware declining to finish something it accepts, as opposed to Status::Configuration, which is the request being rejected. The SDK has already retried before returning it, and repeating the call unchanged is a reasonable response, the only status here of which that is true.

AlreadyExists

A file is already at the path, and the SDK will not destroy it.

Returned when a recording is started on a path that already holds a regular file: nothing is opened, nothing is truncated, and the file that is there is untouched. The message names the path.

Distinct from Status::InvalidArgument, which it used to arrive as, and from Status::Io: nothing failed to be read or written, the SDK deliberately did not try. A caller that means to overwrite removes the file itself first.

InsufficientSpace

The destination has less free space than the caller's own floor, so the recording was not started.

RecordingOptions::min_free_bytes was set and the destination's file system is below it. Refused before anything is opened; the message names what was free and what was required.

Distinct from Status::Io (nothing failed to be read or written, the SDK deliberately did not try), and from Status::OutOfRange, which is the destination's per-file ceiling: more free space fixes this one and cannot fix that one. It is the caller's own threshold, so there are always two actions: free space, or lower the floor.

Other — (i32)

A status this build of the crate does not know about.

The header reserves the right to add codes; this is where they land rather than being silently reported as Status::Unknown.

Status — methods

pub fn from_raw(raw: sys::optris_sdk_status) -> Self

Interpret a raw optris_sdk_status.

pub fn as_raw(self) -> sys::optris_sdk_status

The raw code this came from.

pub fn name(self) -> &'static str

The SDK's short, stable identifier for this code, for a log line.

e.g. "OPTRIS_SDK_ERROR_TIMEOUT". Not for display to an end user; Error::message is.