OptrisOptrisDocumentation

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

AlarmEvent

pub struct AlarmEvent

A state transition, carrying its own cause.

Everything needed to report "which region fired, and why" is in here, so a handler never has to call back into the camera, which matters, because it is invoked on the SDK's action thread and the header forbids re-entering the imager from there.

AlarmEvent — fields

rule_id: u64

Which rule changed state.

rule_name: String

Its name, possibly empty.

previous: AlarmState

The state before the transition.

current: AlarmState

The state after it.

input: SignalId

The signal that caused it.

value: f64

Its value at the transition, in the signal's own unit: a temperature in the SDK's temperature unit (Celsius unless crate::set_temperature_unit chose Fahrenheit), a standard deviation or a rule with a reference a difference in degrees of it, and a coverage, count or voltage as it is.

Reads NaN in Fahrenheit on a transition to AlarmState::Orphaned, where the signal has no value.

limit: f32

The limit that was crossed, in the same unit as AlarmEvent::value.

A placeholder when AlarmEvent::limit_kind is LimitKind::None: it reads NaN there when the SDK's unit is Fahrenheit.

limit_kind: LimitKind

Which limit that was.

region_id: u64

The region owning the rule, or 0 for a rule attached to none.

region_name: String

That region's name, possibly empty.

timestamp_us: u64

When the input was observed, in microseconds.

Which clock that is depends on the rule, because this is the driving observation's own stamp carried over unchanged: the monotonic frame clock counting from the camera's start for a region or device rule, the poll time for a PIF rule, and wall-clock microseconds since the Unix epoch for a value the application published. Two of these are comparable only when both rules watch the same kind of signal, and none of them can be formatted as a time of day -- use AlarmEvent::host_time_us for that.

sequence: u64

The evaluation cycle this transition belongs to.

host_time_us: u64

When the transition happened, in microseconds since the Unix epoch, read from the system clock at the evaluation that raised it.

The field to put in a log row: unlike timestamp_us it is a date whatever kind of rule fired, and every event of one evaluation cycle carries the same value. It is read where the transition is decided rather than where it is delivered, so the delivery latency is not in it.

It is not monotonic and timestamp_us is. NTP can step the system clock in either direction and an operator can set it, so this can jump or go backwards between two consecutive events. Order by sequence, measure with timestamp_us, display this.

AlarmEvent — methods

pub fn is_activation(&self) -> bool

Whether this transition raised the alarm rather than clearing it.