OptrisOptrisDocumentation

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

optris::sdk::SnapshotAction

Write a still image when the alarm fires.

Public attributes

format

SnapshotFormat format = SnapshotFormat::kPng

image or CSV

directory

std::string directory

Empty uses the Imager's output directory, then the CWD.

name_pattern

std::string name_pattern = "{rule}_{timestamp}"

Stem without extension. See File name patterns for the placeholders; {timestamp} and {sequence} changed meaning on this path in v12.

min_interval

std::chrono::milliseconds min_interval {1000}

Minimum spacing between two snapshots from this action. A chattering alarm must not fill the disk.

Zero means no spacing at all -- every activation writes a still, however fast they come. That is a legitimate request and not a sentinel: it is what the field literally says, and ActionRunner::Execute() implements it by comparing against a zero interval, which no elapsed time is ever less than.

Across the C ABI this field has three states and not two: Across the C ABI this field has three states and not two optris_sdk_action::min_interval_ms reads 0 as "use the SDK default" and has a named constant, OPTRIS_SDK_SNAPSHOT_NO_MIN_INTERVAL, for "no spacing". The asymmetry is deliberate, and the reason for it is this: C has no member initialiser to carry the one-second default, so the default has to be expressible as a value there, and a C caller who passes 0 -- or who zeroed an options struct -- has to keep getting the behaviour the header has always promised rather than an unbounded still rate filling a disk.

What was wrong was not that the two differ but that the difference was unbridged: .NET spelled both null and TimeSpan.Zero as 0 ms, so an application that switched the limit off still got one still a second -- measured at 1 a second against an alarm activating 16 times a second. The bindings translate now, and every high-level surface agrees with this field: zero is no spacing, and "the default" is spelled by not saying anything (null, None, a default-constructed action).

options

rec::SnapshotOptions options

How to write the file -- the compression level, the 16-bit TIFF variant and the fixed Kelvin-per-count scale.

The same struct Recorder::SaveSnapshot() takes, and that is the point: two stills of one frame must not differ by who asked for them. Until this existed the imager wrote an alarm still with the defaults whatever the application had chosen for its own, so a user who picked a 16-bit TIFF because their tool cannot read float32 got alarm stills that tool could not open.

The defaults are the ones the field documents, which are exactly what an alarm still got before this field existed -- so a rule nobody has touched writes the same file it always did.