OptrisOptrisDocumentation

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

optris_sdk_shutter_event

The internal shutter changed position.

Everything a shutter display needs is in here, so a handler never has to call back into the imager.

Public attributes

struct_size

uint32_t struct_size

Set to sizeof(optris_sdk_shutter_event).

previous

optris_sdk_shutter_state previous

The state before. Equal to current only on the first event, which reports the state the imager started in.

current

optris_sdk_shutter_state current

The state now.

timestamp_us

uint64_t timestamp_us

When, in microseconds on the SDK's monotonic clock -- the one C++ callers get through std::chrono::steady_clock.

Monotonic and not a date: this exists to time a cycle, and a cycle timed across a wall-clock adjustment would be wrong exactly when it mattered. For a date, read host_time_us.

Unlike optris_sdk_alarm_event::timestamp_us, this one is always the same clock -- a shutter transition has only one source. The two structs are not stamped from a common clock, whatever earlier releases of this header said: an alarm event carries its input observation's timestamp, which for a published signal is wall clock. Do not subtract one from the other.

sequence

uint64_t sequence

Transitions since the imager was created, from 1. A consumer that missed one can tell.

host_time_us

uint64_t host_time_us

The same transition as a date: microseconds since the Unix epoch, read from std::chrono::system_clock at the point the shutter transition was published.

This is the field for a data-log row that has to say when the shutter moved. It is taken in the same breath as timestamp_us, where the transition is detected, and not when this callback runs -- so the delivery latency is not in it.

This clock is not monotonic and timestamp_us is. NTP can step the system clock forwards or backwards, and an operator can set it, so this value can jump or go backwards between two consecutive events. timestamp_us never will. Time a shutter cycle with timestamp_us; date a log row with this. Neither is computed from the other -- they are two real readings of two different clocks, taken adjacently so that a consumer that needs to correlate them can.

How far this can be from the shutter actually moving. It is stamped where the SDK decides the transition, and that is not always where the shutter moves:

  • OPTRIS_SDK_SHUTTER_CLOSING is the command. It is stamped when the SDK tells the shutter to close, before the mechanism has done anything.
  • OPTRIS_SDK_SHUTTER_CLOSED and OPTRIS_SDK_SHUTTER_OPENING are observations, and the only thing that observes the shutter is the frame: the camera puts the flag position in each frame's metadata, so the SDK learns of a movement on the first frame captured after it. The stamp lags the movement by up to one frame period, uniformly distributed, plus that frame's transport and processing time. That is 31 ms on a PI 640 at 32 Hz, 20 ms on an Xi 80 at 50 Hz, 40 ms on an Xi 410 at 25 Hz over Ethernet, and 244 ms on an Xi 410 at 4.1 Hz over USB, the worst case across the supported formats. Host-side frame subsampling does not make it worse -- it is bypassed for the duration of a cycle, so these are wire rates.
  • OPTRIS_SDK_SHUTTER_OPEN at the end of a cycle is a timer rather than an observation: the cycle thread waits out the reopen and publishes. Use the OPENING stamp for the observed reopen.

This is an offset on when a transition is learned of, not clock jitter: both timestamps are read at the same instant and carry the same lag, so CLOSED to OPENING still measures the closed window correctly. Read a log row as "no earlier than this, by up to one frame period".

Added after this struct's first release. The SDK fills the struct it hands to the callback and reports its own struct_size; a caller built against an older header should check struct_size before reading this field.