AttachmentRequest
public sealed record AttachmentRequest : IEquatable<AttachmentRequest>
What the SDK tells an attachment provider about the file it is about to write.
AttachmentRequest: constructors
public AttachmentRequest(AttachmentScope Scope, uint SegmentIndex, bool IsOnSdkThread, TimeSpan Timestamp, AttachmentFormat Format, bool CanCarryAttachments, string Path, AlarmEvent? Cause)
What the SDK tells an attachment provider about the file it is about to write.
Scope: Which kind of file is being written.SegmentIndex: 0 for a snapshot or the first file of a recording, then 1, 2, … for each subsequent segment.IsOnSdkThread:truewhen the SDK is driving the provider itself, an alarm or a segment rollover, rather than running it on a thread your own code drove. Do not use this to decide whether your own locks are already held. It isfalsein two cases where the SDK is driving. A recording's provider never runs on the thread that started the recording, yet this still readsfalsefor the first file of a manually started recording, where it runs on the thread that writes the recording. It also readsfalsefor an interval-capture snapshot, which runs on the SDK's timer thread. For anything other than a snapshot, assume the provider is on an SDK thread whatever this says. What it does distinguish reliably today: a manualSaveSnapshot(false, and genuinely the caller's thread) from an alarm-fired file or a segment rollover (true).Timestamp: Capture time of the frame that opened this file, on the frame's own clock, orTimeSpan.Zerowhen unknown. A stopwatch reading, not a date. It is the frame'sTimestampUsverbatim (monotonic, on whatever epoch the transport counts from), so a difference between two of these is a duration and the absolute value means nothing as a time of day. A snapshot used to report the computer's wall clock here while a recording reported the frame's, so the two were not comparable at all.Format: Which container is being written. Use it to decide what to attach; for whether you may, readCanCarryAttachments.CanCarryAttachments: Whether this file can carry an attachment at all.falsefor a CSV and a JPEG still, which have nowhere to put one. If you return files anyway they are dropped, a line goes in the log naming the format and the count, and the file is still written. There used to be no way to ask, and the write was refused over whatever came back, so an application that registers one provider per camera and keeps it lost every CSV and every JPEG alarm still: the file, not the attachment. Attachments you put onSnapshotInfoby hand are still refused, because there the SDK never asked you.Path: The file about to be written.Cause: The alarm that caused this file, ornullfor a manual save or a manual recording.
AttachmentRequest: properties
public bool CanCarryAttachments { get; init; }
Whether this file can carry an attachment at all. false for a CSV and a JPEG still, which have nowhere to put one.
If you return files anyway they are dropped, a line goes in the log naming the format and the count, and the file is still written. There used to be no way to ask, and the write was refused over whatever came back, so an application that registers one provider per camera and keeps it lost every CSV and every JPEG alarm still: the file, not the attachment. Attachments you put on SnapshotInfo by hand are still refused, because there the SDK never asked you.
public AlarmEvent? Cause { get; init; }
The alarm that caused this file, or null for a manual save or a manual recording.
public AttachmentFormat Format { get; init; }
Which container is being written. Use it to decide what to attach; for whether you may, read CanCarryAttachments.
public bool IsOnSdkThread { get; init; }
true when the SDK is driving the provider itself, an alarm or a segment rollover, rather than running it on a thread your own code drove.
Do not use this to decide whether your own locks are already held. It is false in two cases where the SDK is driving. A recording's provider never runs on the thread that started the recording, yet this still reads false for the first file of a manually started recording, where it runs on the thread that writes the recording. It also reads false for an interval-capture snapshot, which runs on the SDK's timer thread. For anything other than a snapshot, assume the provider is on an SDK thread whatever this says.
What it does distinguish reliably today: a manual SaveSnapshot (false, and genuinely the caller's thread) from an alarm-fired file or a segment rollover (true).
public string Path { get; init; }
The file about to be written.
public AttachmentScope Scope { get; init; }
Which kind of file is being written.
public uint SegmentIndex { get; init; }
0 for a snapshot or the first file of a recording, then 1, 2, … for each subsequent segment.
public TimeSpan Timestamp { get; init; }
Capture time of the frame that opened this file, on the frame's own clock, or TimeSpan.Zero when unknown.
A stopwatch reading, not a date. It is the frame's TimestampUs verbatim (monotonic, on whatever epoch the transport counts from), so a difference between two of these is a duration and the absolute value means nothing as a time of day. A snapshot used to report the computer's wall clock here while a recording reported the frame's, so the two were not comparable at all.