optris::sdk::rec::AttachmentRequest
Context handed to an AttachmentProvider so it can decide what to attach without having to track SDK state itself.
One name for one seam: One name for one seam This type and AttachmentScope are the agreed names; the ROI and alarm work's AttachmentContext / AttachmentTarget fold into them, contributing cause. AttachmentScope additionally carries kRecordingSegment, which their enum lacked.
Public attributes
scope
AttachmentScope scope = AttachmentScope::kSnapshot
Which kind of file is being written.
format
AttachmentFormat format = AttachmentFormat::kUnknown
Which container is being written.
Use it to decide what to attach. For whether you may attach anything at all, read can_carry_attachments below, which is the SDK's own answer and does not have to be revisited when a format is added.
can_carry_attachments
bool can_carry_attachments = true
Whether this file can carry an attachment at all.
CanCarryAttachments(format), computed by the SDK. False for a CSV and a JPEG still, which have nowhere to put one.
What happens if you answer anyway: it is dropped, and a line goes in the log naming the format and the count. The file is still written. Losing the file would be a worse answer than losing the attachment: an application that registers one provider for the whole life of a camera would otherwise lose every CSV and every JPEG alarm still.
Attachments put into rec::SnapshotInfo::attachments by hand are still refused, unchanged: there the SDK never asked, so it still has to say that the context did not travel with the file.
path
std::string path
Path of the file about to be written.
segment_index
uint32_t segment_index = 0
0 for a snapshot or the first file of a recording, then 1, 2, ... for each subsequent segment.
timestamp_us
uint64_t timestamp_us = 0
Capture timestamp in microseconds of the frame that opened this file: the triggering frame for a triggered recording, the oldest pre-roll frame for a recording that flushes a buffer, and the frame being written for a still. 0 when unknown.
The frame's own clock, which is a stopwatch and not a date. It is ThermalFrame::GetMetadata().timestamp_us 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 still carries the same clock, so comparing a snapshot's stamp with a recording's is comparing like with like.
on_action_thread
bool on_action_thread = false
True when the SDK is driving the provider itself rather than running it on a thread the application drove.
A provider that shares state with the application's own code needs to know which it is on: a manual SaveSnapshot() runs the provider on the caller's thread, where its locks are already held, while an alarm-fired one or a segment rollover does not.
Warning: Do not use this to decide whether your own locks are already held. It reads false in two cases where the SDK is driving. A recording's provider never runs on the thread that started the recording -- see AttachmentProvider for where it does run -- 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 field says, and synchronize accordingly.
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).
cause
std::optional< optris::sdk::AlarmEvent > cause
The alarm that caused this file, or empty for a manual StartRecording() / SaveSnapshot(). A provider can attach different things for different alarms without tracking them itself.