optris::sdk::Rule
One signal, one condition, optional suppression, some actions. This is the whole alarm model: a PIF alarm, a measuring-area alarm and a free alarm are three values of this struct. A differential alarm, one signal against another, is one of these plus a reference signal, which the rule set holds beside it: see RuleEngine::SetReference().
Public attributes
id
uint64_t id = 0
Assigned by the owner (RegionStore or the imager's rule set).
name
std::string name
Free text for people, copied into every AlarmEvent this rule produces so a log line needs no lookup. Not unique and not an identifier -- id is that. It also expands into {rule} in a snapshot or recording file name, where path separators, spaces and control characters become underscores and an empty name falls back to the decimal id.
enabled
bool enabled = true
False parks the rule in kDisabled: no band is tested, and the delay counters and any latch are cleared, so re-enabling starts from scratch rather than resuming mid-delay.
This is the operator's switch, and an HMI must not conflate it with kOrphaned. Disabling the region is a different thing: its statistics stop being published, so its rules go kOrphaned, not kDisabled. Disabling a rule that is ringing counts as leaving a ringing state, so its kOnClear actions run and a PIF output it was holding de-asserts.
input
SignalId input
The one signal the rule watches.
A region rule must name the region's generational slot, not its id. RuleEngine::Add(region_id, rule) fills that in for you. A Rule sitting in Region::rules is a manifest, not a live rule, and one carried onto a reshaped or combined region still names the old slot until it is attached.
A rule whose field does not belong to its domain is rejected rather than clamped: SignalId::Device(SignalField::kMax) never becomes a working rule.
condition
Condition condition
The limits and the temporal shaping. Every rule has one; the default is "above 0.0, no warning band, no delays, no latch".
inhibit
std::vector< Inhibit > inhibit
Signals that suppress this rule while they hold. Evaluated in order and short-circuiting -- the first one that holds wins and the rule reports kInhibited. Empty is the ordinary case.
Being inhibited clears the delay counters but NOT the latch. Leaving kInhibited re-adopts the band's level at once -- a delay shapes a change, not an arrival -- and a latched rule is then held at kActive as it was before, so an excursion that has already passed is still waiting for its operator. Only Acknowledge() and disabling the rule drop a latch.
The distinction is between "cannot observe" and "turned off". kOrphaned keeps the latch for the same reason this does: the signal going away says nothing about what already happened. kDisabled clears it because that is a deliberate act on the rule. A shutter cycle is not one, and an earlier release silently acknowledged a latched alarm every few minutes because of it.
A held output -- a PifOutputAction, a kWhileActive RecordingAction -- draws its line in nearly the same place and not quite: it holds through kOrphaned, as the latch does, and de-asserts on kInhibited, which the latch survives. An inhibit is configured by an operator to suppress the alarm while a known condition holds, and one that left the relay energised would suppress nothing an installer can see. Nobody configures an orphan. See PifOutputAction.
An inhibit signal that stops being produced does not suppress.
actions
std::vector< Action > actions
What to do about transitions. Each is matched against the transition by its ActionTrigger and run in this order, on a worker thread and never on the thread delivering frames. ActionError::action_index indexes into this vector.
The queue behind it is bounded. Under a chattering alarm the oldest snapshot, callback and PIF jobs are dropped and counted; recording starts and stops are never dropped, because losing one leaves the recorder in the wrong state rather than losing a single file.