optris::sdk::RecordingAction
Start or stop a recording when the alarm fires.
Public types
Mode
enum Mode
What ends the recording.
There is one recorder, so these are statements about it globally and not about a stream belonging to this rule. A rule that fires while a recording is already open neither starts a second one nor restarts the first, and a kFixedDuration rule that fires again mid-recording does not extend the deadline.
Which recording a mode ends: Which recording a mode ends kWhileActive and kFixedDuration end the recording this rule started, and nothing else. A rule that did not start one -- a rule that activated while a recording was already open, which reports that it did not start one -- stops nothing on its clear, and neither does a rule whose own recording has already ended and been replaced by another. In both cases the rule says so through the action-error channel rather than going quiet.
That is the difference from kStop, which stops whatever is recording even if a different rule started it. Reach for kStop when an alarm should end a recording it has nothing to do with; the other two are about their own.
A cycle with no reading does not end one: A cycle with no reading does not end one kWhileActive is a held state, so it follows the same rule as PifOutputAction: a rule in AlarmState::kOrphaned has no reading rather than a cleared condition, and its recording stays open through the gap. It used to stop and the return used to start a second file, so one excursion produced two recordings with a seam nothing in either of them declared.
Before v12 all three stopped whatever was open, so an operator's manual recording ended the moment an unrelated alarm cleared, with nothing saying why.
| Value | Initialiser | Description |
|---|---|---|
kWhileActive |
start on activate, stop its own on clear | |
kFixedDuration |
start on activate, stop its own after duration |
|
kStop |
stop whatever is recording |
Public attributes
mode
Mode mode = Mode::kWhileActive
when the recording stops
duration
std::chrono::seconds duration {10}
How long to record under kFixedDuration; ignored otherwise.
directory
std::string directory
Empty uses the Imager's output directory, then the CWD.
name_pattern
std::string name_pattern = "{rule}_{timestamp}"
Stem without extension. See File name patterns for the placeholders; {timestamp} and {sequence} changed meaning on this path in v12.
options
rec::RecordingOptions options
How to write the recording -- the segment limits and the lossy options.
The same struct Recorder::Start() takes, so an alarm recording can be asked for what a manual one can. The segment limits are the reason this is not cosmetic: with max_segment_bytes zero a recording never rolls over, so on a destination that caps a single file the recording fails at that cap instead of continuing in a new part. Set max_segment_bytes to whatever the destination holds if it has such a cap. An alarm recording is the one case where nobody is watching when that happens.
rec::RecordingOptions::duration is ignored here -- mode and duration are this action's stop, and the header on that field says what goes wrong if two stops run at once.
The defaults are all-zero, which is exactly what an alarm recording got before this field existed, so a rule nobody has touched records as it always did.