OptrisOptrisDocumentation

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

optris_sdk_simulated_config

How a simulated camera is configured: its geometry, frame rate and test pattern, the device it reports itself as, and the raw-detector mode above.

Fill it with optris_sdk_simulated_config_init() before setting anything, so struct_size and every default is this library's own rather than whatever was on the stack.

Public attributes

struct_size

uint32_t struct_size

Set to sizeof(optris_sdk_simulated_config).

device_type

optris_sdk_device_type device_type

Model to impersonate; determines the default resolution.

width

uint32_t width

Frame width in pixels, or 0 for the model's default.

height

uint32_t height

Frame height in pixels, or 0 for the model's default.

framerate

uint32_t framerate

Frame rate in Hz.

pattern

optris_sdk_test_pattern pattern

Pattern to generate.

gradient_direction

optris_sdk_gradient_direction gradient_direction

Direction of a gradient pattern.

temp_min_c

float temp_min_c

Coolest temperature in the generated scene, in the SDK's temperature unit (Celsius unless optris_sdk_set_temperature_unit() chose Fahrenheit).

temp_max_c

float temp_max_c

Warmest temperature in the generated scene, in the SDK's temperature unit.

seed

uint64_t seed

Seed for the generator, so a run is reproducible. 0 seeds it randomly.

flag_interval_s

float flag_interval_s

Seconds between simulated flag cycles; 0 for none.

flag_duration_s

float flag_duration_s

How long a simulated flag stays closed, in seconds.

checker_size

uint32_t checker_size

Block size of a checkerboard pattern, in pixels.

hotspot_radius

uint32_t hotspot_radius

Radius of a hot-spot pattern, in pixels.

hotspot_speed

float hotspot_speed

How fast a hot-spot pattern travels its path -- not pixels per second, which this said until it was measured. It scales an angular rate: the spot wanders about the frame centre by 2 * hotspot_radius pixels on each axis, horizontally as cos(0.1 * hotspot_speed * t) and vertically as sin(0.13 * hotspot_speed * t) for t in seconds. It changes how long a lap takes, never how far the spot goes, and zero parks it 2 * hotspot_radius right of centre -- which is the only way to hold the spot still from C, there being no field here for the pinned position the C++ SimulatedConfig carries.

frame_cycle_steps

uint32_t frame_cycle_steps

How many temperatures OPTRIS_SDK_PATTERN_FRAME_CYCLE steps through, OPTRIS_SDK_FRAME_CYCLE_MIN_STEPS to OPTRIS_SDK_FRAME_CYCLE_MAX_STEPS; zero means the default, 4, which optris_sdk_simulated_config_init() fills in. Any other value fails with OPTRIS_SDK_ERROR_CONFIGURATION, whatever the pattern. A scene field: it may change while the camera runs.

This was reserved0, documented as always zero. Taking it rather than appending a field keeps sizeof and every offset as they were, which mattered for this struct in particular: before ABI 34 its _init() wrote this library's full size whatever the caller had allocated (see raw_detector below), so growing it would have overrun every caller built against the shorter one. A caller built before this field existed either keeps what _init() wrote here or, if it zeroed the struct itself, hands over a zero -- and zero is the default, not a refusal.

serial

char serial[OPTRIS_SDK_MAX_SERIAL]

Serial number the simulated device reports, UTF-8.

frame_file_path

char frame_file_path[OPTRIS_SDK_MAX_PATH]

Frame source for OPTRIS_SDK_PATTERN_FROM_FILE, UTF-8.

raw_detector

optris_sdk_simulated_raw_detector raw_detector

Run the scene through a calibration with physics in it.

Appended after frame_file_path rather than placed beside the other scene fields, so that every offset above it is the one an older caller compiled against.

Keeping the offsets was necessary and, until ABI 34, not sufficient. It is worth knowing why, because the answer is what makes this struct safe to grow at all.

optris_sdk_simulated_config_init() used to assign a whole optris_sdk_simulated_config{}into the caller's object. It is the function that SETSstruct_size`, so it had nothing to respect and wrote this library's full size regardless of what the caller had allocated. A program compiled against a shorter version of this struct was therefore written past the end of its own object by the very first call this header tells it to make, whatever the offsets above did. Growing this struct broke the Python, Rust and .NET bindings in exactly that way -- all three segfaulted until their mirrors were regenerated -- and they are in this repository. A program that is not would have had no warning at all.

Since ABI 34 every _init on this surface takes the caller's own sizeof and writes no further, so that hole is closed and this struct may be appended to again under the ordinary rule: add at the end, leave the offsets above alone, and guard the new field's read with its offset. optris_sdk_imager_get_simulated_config() was already written that way and copies out at the declared size.