OptrisOptrisDocumentation

Documentation/OTC SDK/OTC SDK — C API referencev12.0

optris_sdk_camera_options

Where a camera's calibration may come from.

Initialise with optris_sdk_camera_options_init(), which sets the historical behaviour: no directory, download allowed.

The SDK needs a calibration file set for each camera and looks in three places, in this order: the camera's own memory, the calibration_directory named here, and Optris over the internet. The first two need no network. The third does, and it is the one that has to be switchable -- a factory PC is often offline or firewalled, and an SDK that reaches for the internet unconditionally on first open just stops there.

Public attributes

struct_size

uint32_t struct_size

Set to sizeof(optris_sdk_camera_options).

allow_calibration_download

uint8_t allow_calibration_download

Non-zero to allow fetching missing calibration files from Optris. One (allowed) after an _init, which is what the SDK has always done.

Zero 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.

reserved0

uint8_t reserved0[3]

Reserved; always zero. Named so the struct has no implicit padding.

calibration_directory

char calibration_directory[OPTRIS_SDK_MAX_PATH]

A directory to search for calibration files before going to the network, UTF-8, NUL-terminated. Empty for none.

This is where an operator points the SDK at files copied from a USB stick or a network share. It is searched after the camera's own memory and before the internet.

connection_timeout_ms

uint32_t connection_timeout_ms

How long without a frame counts as a stalled stream, in milliseconds. Zero -- the value after an _init -- means "use this camera's saved configuration", which is ten seconds from the factory but is a per-machine file and may be anything.

Appended after the rest of this struct, so a caller compiled against an older header is accepted at its own smaller size and keeps the saved value.

connect_timeout_ms

uint32_t connect_timeout_ms

How long to wait for the camera's control channel to answer before giving up, in milliseconds. Zero uses the SDK default of 5000, which is also what an _init writes here -- so the default can be read rather than looked up.

Not the same thing as connection_timeout_ms, 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 for a camera on USB, which has no connection to time out.

Also ignored by optris_sdk_imager_create_network_with_options(), which reads this bound off its optris_sdk_network_target instead. That record carries the same field, and optris_sdk_network_target_init() writes the default into it explicitly -- so the target never looks unset and always wins. Setting this one for that call therefore does nothing, silently. Set optris_sdk_network_target::connect_timeout_ms there. This field is the bound for the calls that take no target: optris_sdk_imager_create_with_options() and optris_sdk_imager_create_from_device_with_options().

When it expires the call returns OPTRIS_SDK_ERROR_TIMEOUT, not OPTRIS_SDK_ERROR_DEVICE: nothing answered at all, as opposed to something answering and the open failing. Nothing is left open either way.

discovery_timeout_ms

uint32_t discovery_timeout_ms

How long to wait for the camera to identify itself before opening it unverified, in milliseconds. Zero uses the SDK default of 3000, which is also what an _init writes here.

The other half of the bound, and the reason setting only connect_timeout_ms 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 connect_timeout_ms on the control channel. The worst case for an address nobody answers is the two added together.

Ignored for a camera on USB.

Also ignored by optris_sdk_imager_create_network_with_options() for the reason given on connect_timeout_ms above: set optris_sdk_network_target::discovery_timeout_ms there instead.

has_operation_mode

uint8_t has_operation_mode

Non-zero to open in operation_mode below. Zero -- the value after an _init -- opens in whatever mode the camera's saved configuration and calibration settle on, which is what every existing caller gets.

A separate flag rather than a sentinel inside the mode, because every field of an operation mode has a legitimate zero: a camera with no optics number configured is matched on the first optic, and "not asking" and "asking for the defaults" are different requests.

reserved1

uint8_t reserved1[3]

Reserved; always zero. Named so the struct has no implicit padding.

operation_mode

optris_sdk_operation_mode operation_mode

The operation mode to open in, refused if the camera has no such mode. Read only when has_operation_mode is non-zero.

Take one from optris_sdk_imager_get_operation_modes() on an earlier run, or from a stored layout. The point is the size of the first frame: without this, an application wanting a particular mode must open, see what the open chose, and then switch -- so its first frames arrive at the wrong size and its window resizes under the operator.

Honoured exactly or refused. A mode this camera's calibration does not offer fails the open with OPTRIS_SDK_ERROR_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 (see connection_timeout_ms's neighbours).

It also avoids a mode switch on a running camera, which re-enters the startup calibration and marks about thirty seconds of frames as not measurements before the readings are right again. An application that opens directly in the mode it wants never performs that switch, so it never pays for it.

Matched on the optics number and its label, both temperature limits, the frame size and the frame rate. optics_unit is not part of the match.

A mode taken from optris_sdk_imager_read_operation_modes() or from optris_sdk_device_info carries this camera's own label and matches. One filled in by hand has to carry the same label, or leave optics_fov at 0 with optics_text empty, which matches the camera's first optic rather than a named one.

Appended after the rest of this struct, so a caller compiled against an older header is accepted at its own smaller size and behaves exactly as before.