OptrisOptrisDocumentation

Documentation/OTC SDK/Optris.Sdk — C# API referencev12.0

RecordingEvent

public sealed record RecordingEvent : IEquatable<RecordingEvent>

One thing that happened to a recording.

Delivered to the handler registered with ThermalCamera.OnRecording(…). This is the only way to learn that a recording ended on its own duration, was started by an alarm rule, or died on a write error; polling ThermalCamera.IsRecording can see that something changed but never which of the three it was.

RecordingEvent: constructors

public RecordingEvent(RecordingPhase Phase, string Path, string Message, int Source = -1, RecordingStopReason StopReason = 0)

One thing that happened to a recording.

  • Phase: What happened.
  • Path: The file the phase is about. For RecordingPhase.SegmentCompleted it is the segment that was just finished, not the one now being written.
  • Message: Human-readable detail, never null but usually empty. The failure reason on RecordingPhase.Failed, and the reason on the three per-source phases.
  • Source: Which source of a RecordingSession this is about, or −1 for an event about the recording as a whole. −1 on every event a single-camera recording produces, which is every event that existed before sessions did. A session's RecordingPhase.Failed used to be one of those: it said a write had failed and gave no way to tell which of five cameras it had failed for, so an application could report "recording error" and nothing more useful.
  • StopReason: Who ended the recording, on RecordingPhase.Stopped. RecordingStopReason.Unknown on every other phase. Branch on this rather than on Message, which is the same answer in words and is free to be reworded. Last in the list, mirroring the C++ struct, where the field is appended for a reason worth repeating: every RecordingEvent{phase, path, message} in that tree is a positional aggregate initialiser, and a field inserted before Source would silently change what those expressions mean rather than failing to compile.

Delivered to the handler registered with ThermalCamera.OnRecording(…). This is the only way to learn that a recording ended on its own duration, was started by an alarm rule, or died on a write error; polling ThermalCamera.IsRecording can see that something changed but never which of the three it was.

RecordingEvent: properties

public string Message { get; init; }

Human-readable detail, never null but usually empty. The failure reason on RecordingPhase.Failed, and the reason on the three per-source phases.

public string Path { get; init; }

The file the phase is about. For RecordingPhase.SegmentCompleted it is the segment that was just finished, not the one now being written.

public RecordingPhase Phase { get; init; }

What happened.

public ulong RecordingId { get; init; }

Which recording this event is about. Added in 12.0.15.

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. So an application that acts on its events later, on a thread of its own, can tell which Started a Stopped belongs to even when the next recording reuses the same file name.

Never 0 on an event from ThermalCamera.OnRecording(…). 0 on the events of a continuous recording, which is a rolling history rather than a recording that starts and stops, and on every event from RecordingSession.OnEvent(…), which does not number its recordings.

A recording that reaches its segment limit with SegmentLimitAction.StartNewRecording is two recordings and gets two numbers: the Stopped for the finished file carries the old one and the Started for the next file a new one. The parts of a recording that continues as a series share one.

An identity, not a count: compare two, do not do arithmetic on them.

public int Source { get; init; }

Which source of a RecordingSession this is about, or −1 for an event about the recording as a whole.

−1 on every event a single-camera recording produces, which is every event that existed before sessions did. A session's RecordingPhase.Failed used to be one of those: it said a write had failed and gave no way to tell which of five cameras it had failed for, so an application could report "recording error" and nothing more useful.

public RecordingStatistics? Statistics { get; init; }

The final statistics of the recording this event ends, or null. Added in 12.0.15.

Set on RecordingPhase.Stopped and on RecordingPhase.Discarded, the two events that end a recording, and null on every other phase.

Read this rather than ThermalCamera.RecordingStatistics when your handler queues the event and acts on it later. That property describes whichever recording is current when it is read: if an alarm rule's recording action, or your own code, has started the next recording in the meantime, the start has reset it and a complete file reads as FramesWritten = 0. These figures were taken when the recording ended and stay that recording's however late they are read.

The same figures ThermalCamera.RecordingStatistics reads at the moment of the stop, with one difference: a recording that ended at its segment limit (RecordingStopReason.SegmentLimit) gets the frame and byte counters of its own file, where the property counts on across the files from the moment the camera started recording.

Example

camera.OnRecording(e => queue.Add(e));   // Acted on later.
//... on your own thread:
if (e.Phase == RecordingPhase.Stopped &&
    e.Statistics is { FramesWritten: 0 })
{
    ui.Error($"Nothing was recorded to {e.Path}");
}
public RecordingStopReason StopReason { get; init; }

Who ended the recording, on RecordingPhase.Stopped. RecordingStopReason.Unknown on every other phase. Branch on this rather than on Message, which is the same answer in words and is free to be reworded.

Last in the list, mirroring the C++ struct, where the field is appended for a reason worth repeating: every RecordingEvent{phase, path, message} in that tree is a positional aggregate initialiser, and a field inserted before Source would silently change what those expressions mean rather than failing to compile.