RecordingEventDetail
pub struct RecordingEventDetail
A RecordingEvent together with the recording it belongs to and,
when it ends that recording, the recording's final statistics.
Added in 12.0.15.
Delivered to Camera::on_recording_event_detail. A type of its
own rather than new fields on RecordingEvent, whose fields are
all public: a field added there would break every program that
builds or destructures one.
Use this when the callback hands events to a thread of its own.
Camera::recording_stats describes whichever recording is current
when it is read; if an alarm rule or your code has started the next
recording in the meantime, that start has reset it and a complete
file reads as 0 frames written. RecordingEventDetail::statistics
was taken when the recording ended.
# fn main() -> optris_sdk::Result<()> {
# let mut camera = optris_sdk::Camera::simulated(&optris_sdk::SimulatedConfig::new())?;
let (sender, receiver) = std::sync::mpsc::channel();
camera.on_recording_event_detail(move |detail| {
let _ = sender.send(detail); // Acted on later, on another thread.
})?;
// ... on that thread:
for detail in receiver.try_iter() {
if let Some(stats) = &detail.statistics {
println!("recording {} kept {} frames in {}",
detail.recording_id, stats.frames_written, detail.event.path);
}
}
# Ok(())
# }
RecordingEventDetail — fields
event: RecordingEvent
The event exactly as Camera::on_recording_event receives it.
recording_id: u64
Which recording the event is about: the same number on a
recording's RecordingPhase::Started, on everything it
reports in between and on its RecordingPhase::Stopped, and a
different number for every other recording of the same camera.
Never 0 for a recording's own events; 0 only on the events of a continuous recording, which is a rolling history rather than a recording that starts and stops. A recording that reaches its segment limit and starts a new one is two recordings with two numbers; the parts of a series share one. An identity, not a count.
statistics: Option<RecordingStats>
The recording's own statistics, as they were when it ended.
Some on RecordingPhase::Stopped and
RecordingPhase::Discarded, the two events that end a
recording, and None on every other phase. The figures
Camera::recording_stats reads at the moment of the stop,
except that a recording ended by its segment limit
(RecordingStopReason::SegmentLimit) gets the frame and byte
counters of its own file.