AlarmRule
public sealed class AlarmRule
One signal, one condition, optional suppression, and what to do about it.
This is the whole alarm model. A measuring area's over-temperature alarm, an alarm on a process-interface input and an alarm on a value your application publishes are three instances of this class.
Example
var rule = new AlarmRule { Name = "bearing too hot", Input = SignalId.Region(SignalField.Max), Condition = AlarmCondition.Above(80.0f, hysteresis: 2.0f) with { OnDelay = TimeSpan.FromMilliseconds(250), }, }; rule.Actions.Add(new SnapshotAction()); ulong id = camera.AddRule(regionId, rule);
AlarmRule: constructors
public AlarmRule()
AlarmRule: properties
public Collection<AlarmAction> Actions { get; }
What the rule does when it changes state.
public AlarmCondition Condition { get; set; }
When it fires.
public ulong Id { get; }
The rule's id once it is installed, or 0 while it is not.
Assigned by the camera. Setting it has no effect: identity belongs to the camera's rule set, not to a copy of the rule.
public int InhibitCount { get; }
How many inhibit sources the installed rule has, on a rule read back with ThermalCamera.GetRule.
The SDK reports a rule's inhibit sources as a count without their contents, so on a read-back rule AlarmRule.Inhibits is empty and this is the only sign that the rule has any. Check it before writing a read-back rule back with UpdateRule: a nonzero count means the update would drop that many inhibit sources unless you add them to AlarmRule.Inhibits again.
0 on a rule you build yourself, whose inhibit sources are AlarmRule.Inhibits. Setting it has no effect.
public Collection<AlarmInhibit> Inhibits { get; }
Signals that hold the rule clear while their own conditions hold.
public SignalId Input { get; set; }
What the rule watches.
public bool IsEnabled { get; set; }
Whether the rule is evaluated. A disabled rule reports AlarmState.Disabled.
public string Name { get; set; }
A name for the rule, carried on every event it produces.
Truncated to 63 bytes of UTF-8. Names need not be unique.
public Nullable<SignalId> Reference { get; set; }
A second signal to compare AlarmRule.Input against, or null to compare the input against the condition's limits alone.
When set, every band of AlarmRule.Condition is tested against the input minus the reference, so the limits are offsets. "Region A's maximum more than 2 K above region B's maximum" is AlarmCondition.Above(2.0f) with this naming B's SignalField.Max; "a spot within 5 K of a reference region either way" is AlarmCondition.Outside(-5.0f, 5.0f). The warning band, hysteresis, both delays, latching, inhibits and actions apply to the difference unchanged, and AlarmEvent.Value carries the difference.
Either signal missing orphans the rule: it reports AlarmState.Orphaned while the input or the reference is not being produced (a region removed, a replay that does not carry it), exactly as a rule whose input is missing does, and resumes when both are back.
A region reference built with SignalId.Region(…) means the rule's own region and is resolved by AddRule(regionId, rule); to name another region, use the slot from ThermalCamera.GetRegionSignalSlot. A reference that is the same signal as the input is refused.
public ulong RegionId { get; }
The region this rule was attached to, or 0 for a rule attached to none.
Filled in by ThermalCamera.GetRule. Setting it has no effect: which region a rule belongs to is decided by the AddRule overload you call, and cannot be changed afterwards.