OptrisOptrisDocumentation

Documentation/OTC SDK/OTC SDK — C API referencev12.0

optris_sdk_attachment_request

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

Public attributes

struct_size

uint32_t struct_size

Stamped by the SDK with sizeof(optris_sdk_attachment_request). A provider compiled against an older header reads only the fields it knows; compare this against its own sizeof before touching a field added later.

scope

optris_sdk_attachment_scope scope

Which kind of file is being opened. One of the optris_sdk_attachment_scope values.

segment_index

uint32_t segment_index

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

on_action_thread

int32_t on_action_thread

Non-zero when the SDK is driving the provider itself -- an alarm or a segment rollover -- rather than running it on a thread the application drove.

Warning: Do not use this to decide whether your own locks are already held. It reads zero in two cases where the SDK is driving. A recording's provider never runs on the thread that called optris_sdk_imager_start_recording(), yet this still reads zero for the first file of a manually started recording -- where it runs on the thread that writes the recording. It also reads zero 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.

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

timestamp_us

uint64_t timestamp_us

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

path

const char * path

Path of the file about to be written, UTF-8. Borrowed: valid only for the duration of the callback.

has_cause

int32_t has_cause

Non-zero when cause carries the alarm that caused this file. Zero for a manual save or a manual recording.

cause

optris_sdk_alarm_event cause

The alarm that caused this file. Meaningful only when has_cause is non-zero.

format

optris_sdk_attachment_format format

Which container is being written. One of the optris_sdk_attachment_format values.

Use it to decide what to attach. For whether anything may be attached at all, read can_carry_attachments below: that is the SDK's own answer to its own container rule and does not have to be revisited when a format is added.

can_carry_attachments

int32_t can_carry_attachments

Non-zero when this file can carry an attachment at all. Zero for a CSV and a JPEG still, which have nowhere to put one.

If a provider adds files anyway, they are dropped, a line goes in the log naming the format and the count, and the file is still written. Refusing the write instead would cost an application that keeps one provider registered for the life of a camera every CSV and every JPEG alarm still -- the file, not the attachment. Attachments set on optris_sdk_snapshot_info by hand are still refused: there the SDK never asked.