OptrisOptrisDocumentation

Documentation/OTC SDK/optris_sdk — Rust API referencev12.0

AttachmentRequest

pub struct AttachmentRequest

What the SDK tells an attachment provider about the file it is about to write.

An owned copy: the C hands the provider a borrowed struct with a borrowed path, both valid only for the duration of the call, so nothing here points into the SDK's memory.

AttachmentRequest — fields

scope: AttachmentScope

Which kind of file is being opened.

segment_index: u32

0 for a snapshot or the first file of a recording, then 1, 2, … for each subsequent segment.

on_action_thread: bool

Whether the SDK is driving the provider itself, an alarm or a segment rollover, rather than running it on a thread the application 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, and synchronise accordingly.

What it does distinguish reliably today: a manual snapshot save (false, and genuinely the caller's thread) from an alarm-fired file or a segment rollover (true).

timestamp_us: u64

Capture timestamp of the frame that opened this file, in microseconds, or 0 when unknown.

A stopwatch reading, not a date. It is the frame's own 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 used to report the host's wall clock here while a recording reported the frame's, so the two were not comparable at all.

format: AttachmentFormat

Which container is being written.

Use it to decide what to attach; for whether you may, read Self::can_carry_attachments.

can_carry_attachments: bool

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 add 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 keeps one provider registered for the life of a camera lost every CSV and every JPEG alarm still: the file, not the attachment.

path: String

Path of the file about to be written.

cause: Option<AlarmEvent>

The alarm that caused this file, or None for a manual save or a manual recording.