OptrisOptrisDocumentation

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

optris_sdk_device_info

One device, as reported by enumeration.

Public attributes

struct_size

uint32_t struct_size

Set to sizeof(optris_sdk_device_info).

type

optris_sdk_device_type type

Camera model.

connection

optris_sdk_connection_type connection

How it is attached.

width

uint32_t width

Sensor width in pixels.

height

uint32_t height

Sensor height in pixels.

vendor_id

uint16_t vendor_id

USB vendor and product identifiers, or 0 for a device that is not on USB.

product_id

uint16_t product_id

The product half of that pair.

It is the same for every Optris camera on USB. The whole family shares one product id, so this does not tell a PI 640i from an Xi 80 and cannot be used to choose a model or a calibration -- use type, or model for something to show a user.

What it is good for is finding the camera in the operating system's own device list: a udev rule, a WinUSB binding, a line of lsusb. Nothing in this API takes a USB id back.

reserved0

uint32_t reserved0

Reserved; always zero.

serial

char serial[OPTRIS_SDK_MAX_SERIAL]

Serial number, UTF-8, NUL-terminated.

model

char model[OPTRIS_SDK_MAX_MODEL]

Model name for display, UTF-8, NUL-terminated.

video_path

char video_path[OPTRIS_SDK_MAX_PATH]

Platform-specific video node, UTF-8, NUL-terminated. Empty when the device has none.

control_path

char control_path[OPTRIS_SDK_MAX_PATH]

Platform-specific control node, UTF-8, NUL-terminated. Empty when the device has none.

capabilities

optris_sdk_device_capabilities capabilities

What this device can do.

address

char address[OPTRIS_SDK_MAX_ADDRESS]

Where the device is, when connection is OPTRIS_SDK_CONNECTION_NETWORK: the address it answered discovery from, UTF-8, NUL-terminated. Empty for a device on USB.

Pass the whole struct to optris_sdk_imager_create_from_device() to open it; a caller that keeps only the serial loses the address and cannot reach the camera.

port

uint16_t port

The UDP port the device streams to, when connection is OPTRIS_SDK_CONNECTION_NETWORK. Zero on USB.

reserved1

uint16_t reserved1

Reserved; always zero.

name

char name[OPTRIS_SDK_MAX_NAME]

What the user calls this camera, UTF-8, NUL-terminated. Empty for a camera nobody has named.

Read from the host during enumeration, keyed by serial, with no traffic to the camera -- so it is filled in for a camera you have not opened, which is the case it exists for. Set it with optris_sdk_device_set_name(); writing here changes nothing.

Added after capabilities. A caller compiled against an older header passes a smaller struct_size and this field is left alone; that caller's buffer is never written past its own end.

is_claimed

uint8_t is_claimed

Non-zero when some process has this camera open, as far as enumeration could tell -- including this one.

It is not "another process". A claim is exclusive against every client, this process included: a second optris_sdk_imager_create_from_device() for a camera this program already has open is refused exactly as another program's would be. So "claimed" is the right answer to "can this be opened", which is what this field is for. Use claimed_by_this_process to tell the two apart.

A hint, never a promise. Nothing is reserved to answer it: a camera can be claimed between the sweep that set this and the optris_sdk_imager_create_from_device() that follows, so a zero here does not mean the open will succeed and the open must still be allowed to fail with OPTRIS_SDK_ERROR_BUSY. It exists so a device list can show a camera as busy without opening it, which is otherwise the only way to find out and is not a side-effect-free probe.

Added after name, and subject to the same struct_size rule.

claimed_by_this_process

uint8_t claimed_by_this_process

Non-zero when the holder is this process.

Only meaningful when is_claimed is non-zero. Took one of the three bytes that were reserved beside is_claimed, so the struct did not grow and no offset moved: a caller built against an older header reads it as part of a reserved field it was told to ignore, and struct_size is unchanged.

Zero for a camera nobody holds, and zero on one path even for a camera this process is using: an Ethernet camera's claim state starts from the camera's own busy word, which cannot say who is streaming. A sweep that reads that word while this process streams, and reaches the claim file after this process has let it go, reports a claim with this zero. Read it as "known to be ours" rather than as "not ours".

reserved2

uint8_t reserved2[2]

Reserved; always zero.

claimed_by

char claimed_by[OPTRIS_SDK_MAX_NAME]

Who holds it, e.g. optris-relay (pid 4711), UTF-8, NUL-terminated. Empty when nobody holds it and when the holder cannot be identified.

Both platforms can name a holder, by different means. On Linux it comes from the kernel's lock table; on Windows, where a sharing violation names nobody, it comes from a small file the claiming process writes beside the lock. It is not Linux only. A claim taken by an older build, or by another program, leaves no owner file, so this can still be empty for a camera that is definitely claimed -- on either platform.

Never test this to decide whether a camera is free; that is what is_claimed is for. Never test it to decide whether the holder is you either; that is claimed_by_this_process.