OptrisOptrisDocumentation

Documentation/OTC SDK/Optris.Sdk — C# API referencev12.0

CameraOptions

public sealed class CameraOptions

Where a camera's calibration may come from.

A camera cannot measure without its calibration files, and the SDK looks in three places for them: the camera's own memory, the CameraOptions.CalibrationDirectory named here, and Optris over the internet. The first two need no network.

The defaults are what the SDK has always done (no directory, and the download allowed), so passing no options at all behaves exactly as before. Set these when the machine cannot or may not reach the internet: a factory PC behind a firewall, or one where outbound HTTPS from production machines is not permitted.

When the files cannot be found and the download is switched off, ThermalCamera.Open(…) succeeds: the camera opens and streams, and its temperatures cannot be trusted. Ask rather than catch. ThermalCamera.CalibrationStatus reports CalibrationStatus.Missing and ThermalCamera.CalibrationDiagnosis names which source fell short (the directory, the download, or both), so an operator is told what to fix. A program that opens a camera and never asks ships streaming non-measurements with nothing reported.

Example A machine with the files on a network share and no route out:

var options = new CameraOptions
{
    CalibrationDirectory = @"\\fileserver\optris\calibration",
    AllowCalibrationDownload = false,
};

await using var camera = ThermalCamera.Open(device, options);

if (camera.CalibrationStatus == CalibrationStatus.Missing)
{
    // Says whether the directory was missing the files, the
    // download was disallowed, or both. The camera is streaming,
    // and its temperatures are wrong.
    Console.Error.WriteLine(camera.CalibrationDiagnosis);
}

CameraOptions: constructors

public CameraOptions()

CameraOptions: properties

public bool AllowCalibrationDownload { get; init; }

Whether the SDK may fetch missing calibration files from Optris over the internet.

false means the attempt is never made, rather than made and abandoned, so a machine with no route out fails immediately instead of waiting out a connection that cannot succeed.

public string? CalibrationDirectory { get; init; }

A directory to search for calibration files before going to the internet.

This is where an operator points the SDK at files copied from a USB stick or a network share. It is searched after the camera's own memory and before the internet.

public Nullable<TimeSpan> ConnectTimeout { get; init; }

How long to wait for a network camera's control channel to answer before giving up on the open.

Not the same thing as CameraOptions.ConnectionTimeout. That one is about a camera that is already open and has stopped sending frames. This one bounds getting it open at all, and it is what a mistyped address costs.

It is the same value as NetworkTarget.ConnectTimeout and exists here because that one is only reachable from ThermalCamera.Open(…), which has no progress reporting, no options and no cancellation. An application that wants both a bounded connect and the open phases sets it here and keeps one open path.

When it expires the open throws ConnectTimeoutException rather than a plain ThermalDeviceException: nothing answered, as against something answering and the open failing. Nothing is left open either way.

Ignored for a camera on USB, which has no connection to time out. Do not set it low to make a slow site fail faster. A camera on a loaded switch is not a broken camera; five seconds is the default because it is comfortably more than a healthy open needs, not because it is tight.

public TimeSpan ConnectionTimeout { get; init; }

How long without a frame before ThermalCamera.ConnectionStatus reports ConnectionStatus.Stalled.

Naming a value here makes the wait the application's rather than the machine's. That matters twice: a program that must react quickly to a dead picture cannot rely on a number it did not choose, and shortening the wait is the only lever over a camera that opens cleanly and then never delivers a frame.

Read it back with ThermalCamera.ConnectionTimeout, which resolves the zero to whatever is actually in force.

Carried as whole milliseconds: rounded, and never down to zero, since zero is the sentinel above. Any value above TimeSpan.Zero is at least one millisecond, so a short wait stays a short wait rather than becoming the saved one.

public Nullable<TimeSpan> DiscoveryTimeout { get; init; }

How long to wait for a network camera to identify itself before opening it on the connection details already in hand.

The other half of the bound, and the reason setting only CameraOptions.ConnectTimeout shortens a failed open by less than the arithmetic suggests: a network open asks the address who is there, waits this long for an answer, and only then spends CameraOptions.ConnectTimeout on the control channel. The worst case for an address nobody answers is the two added together.

A camera answers the next discovery message rather than one already in flight, so this needs to span more than one attempt. Ignored for a camera on USB.

public Nullable<OperationMode> OperationMode { get; init; }

The operation mode to open the camera in, refused if the camera has no such mode.

Pass one from ThermalCamera.OperationModes read on an earlier run, or one you kept from an earlier session. The point is the size of the first frame: without this, an application that wants a particular mode must open the camera, see which mode the open chose, and then switch, so its first frames arrive at the wrong size and its window resizes under the operator.

It is honoured exactly or refused. A mode this camera's calibration does not offer throws SdkConfigurationException naming what was asked for, and is not retried: a camera's modes come from its calibration, so asking again cannot change the answer. Nothing is rounded to a neighbouring mode. That refusal is the reason to use this rather than relying on the camera's stored preference, whose unhonourable frame rate is substituted on purpose, because a camera reachable on two cables declares two rates and only one preference is stored.

It also keeps you out of a running mode switch. Assigning ThermalCamera.ActiveOperationMode on a streaming camera re-enters the start-up calibration and marks about thirty seconds of frames as not measurements before the readings are right again. Opening directly in the mode you want means that switch never happens, so restoring a saved mode this way never pays for it.

Matched on the optics number and its label, both temperature limits, the frame size and the frame rate. A mode taken from the camera carries the label it came with and matches; one assembled by hand must carry the same label, or no optics number and no label at all, which matches the first optic.

This names the mode to open in. It does not answer "which mode would an open pick", which cannot be known before the camera is claimed: the mode list comes from what the camera reports it can deliver on the cable in use, and the same camera declares different frame rates over USB and over Ethernet.

Example Restoring a saved mode without the tile jumping:

var options = new CameraOptions { OperationMode = savedMode };

try
{
    await using var camera = ThermalCamera.Open(device, options);
    // The first frame is already savedMode's size.
}
catch (SdkConfigurationException ex)
{
    // This camera has no such mode: its calibration changed, or
    // the layout was saved against a different camera.
    Console.Error.WriteLine(ex.Message);
}