pub enum Alert {
OutOfRange {
reading: f32,
},
RunningOut {
samples: u32,
},
ChangingFast {
rate: f32,
},
InvalidReading {
reading: f32,
},
Custom {
code: &'static str,
value: f32,
},
}Expand description
An alert raised when a reading crosses a profile’s safety threshold.
Variants§
OutOfRange
A controlled reading drifted outside its safe band.
For a cold-chain fridge this is a spoilage excursion: the cooler may be running, but the contents are no longer within the safe temperature range.
RunningOut
A falling level will reach its empty mark within this many more samples.
ChangingFast
A reading is changing faster than its safe rate.
For a river gauge this is a flash-flood warning: the level jumped further in one sample than the profile allows.
InvalidReading
A reading that is not a finite number, such as the NaN a failed probe or a garbled payload produces.
Every built-in kind but a monitor raises it, since a node that goes quiet when its sensor fails looks exactly like one whose readings are fine. The reading changes nothing: a setpoint’s output holds its last state, and a level or a surge carries on from the last good reading.
Custom
A condition a policy of your own raised, named by a code it chose.
The code is a fixed identifier the policy’s author picks, such as
"FrostRisk", and the value is the measurement behind it. The bindings carry
it as they carry the built-in kinds, as the code and a number, so a custom
condition reads the same wherever the node’s code is written.
Implementations§
Source§impl Alert
impl Alert
Sourcepub fn kind(self) -> &'static str
pub fn kind(self) -> &'static str
Returns the name of the condition, without the measurement that triggered it.
The bindings carry an alert as a kind and a value, so this is the same word in every language, which is what lets one reading be logged or compared the same way wherever the node’s code is written.
§Returns
One of "OutOfRange", "RunningOut", "ChangingFast", or "InvalidReading",
or the code a custom alert was raised with.