OptrisOptrisDocumentation

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

ProcessInterface

pub struct ProcessInterface<'a>

A camera's process interface.

Borrows the crate::Camera it came from, so it cannot outlive the controller it points at.

ProcessInterface — methods

pub fn identity(&self) -> Result<PifIdentity>

Who is attached, and whether that was detected or declared.

Errors

Returns Status::InvalidHandle if the camera has been dropped.

pub fn hardware_info(&self) -> Result<PifHardwareInfo>

What the attached PIF can do.

Errors

As ProcessInterface::identity.

pub fn is_connected(&self) -> Result<bool>

Whether the PIF is reachable right now.

Errors

As ProcessInterface::identity.

pub fn set_identity(&mut self, kind: PifDeviceKind, device_count: u8) -> Result<()>

State what is attached, when the camera cannot tell.

Required on the PI 1 family, for a proprietary PIF, for an external temperature probe, and on an autonomous camera whose type switch disagrees with what is physically there.

Applying it re-derives the capabilities and clears the channel table: a table configured against one PIF does not carry over to a different one.

Errors

Returns Status::NotSupported if this camera does not accept that kind.

pub fn redetect_identity(&mut self) -> Result<()>

Ask the camera again what is attached.

This is how an interface that was powered up or plugged in after the camera was opened is found. ProcessInterface::set_identity is not: declaring is for the kinds a camera cannot see, so on a PI camera other than the PI 1 a Standard or Industrial declaration is refused in every state while re-detection finds it.

Offer this as "automatic" beside ProcessInterface::supported_device_kinds.

Errors

Returns Status::NotSupported on a camera that cannot detect its interface at all: the PI 1 family, where declaring is the only route.

pub fn supported_device_kinds(&self) -> Result<Vec<PifDeviceKind>>

The PIF kinds this camera accepts.

A camera family accepts a subset; offering the rest in a user interface would offer configurations that cannot be applied.

Errors

As ProcessInterface::identity.

pub fn supported_analog_output_ranges(&self) -> Result<Vec<AnalogRange>>

The analog output ranges this hardware supports.

Errors

As ProcessInterface::identity.

pub fn channel_trim(

The trim one analog channel actually has, from the device.

index is a flat channel index in the same space ProcessInterface::write_analog_output uses, bounded by the matching count on PifHardwareInfo.

Check PifChannelTrim::source before believing the gain and offset: see PifTrimSource.

Errors

Returns Status::OutOfRange if index is not below the channel count for direction, and otherwise as ProcessInterface::identity.

pub fn configure(&mut self, channels: &[PifChannelConfig]) -> Result<()>

Apply a whole channel table, replacing whatever was configured.

The table is validated in full before anything is written, so a rejected configuration leaves the device exactly as it was and the error names the specific channel and problem. Every configured output is then re-asserted, even one whose settings did not change.

Errors

Returns Status::Configuration with a message naming the offending channel if the table is not applicable.

pub fn configuration(&self) -> Result<Vec<PifChannelConfig>>

Read back the configured channel table.

Errors

As ProcessInterface::identity.

pub fn set_analog_calibration(&mut self, calibration: PifAnalogCalibration) -> Result<()>

Set the device-wide analog calibration.

This changes nothing on a camera. The value is stored and the channel table re-encoded with it, but the pair handed to the device is the one read from the camera's calibration file when the interface was created, and an interface with an EEPROM of its own applies its per-channel factory trim instead. The call is kept because it is how the layer that owns calibration data pushes these values down; the interface never reads a calibration file itself. See PifAnalogCalibration.

Errors

As ProcessInterface::identity.

pub fn analog_calibration(&self) -> Result<PifAnalogCalibration>

Read the device-wide analog calibration the camera's calibration file declared.

On an interface with its own EEPROM this pair takes part in no value the camera produces. The per-channel trim that does is ProcessInterface::channel_trim; this doc comment used to say it "cannot be read", which stopped being true when that method landed. See PifAnalogCalibration.

Errors

As ProcessInterface::identity.

pub fn set_fail_safe(&mut self, config: PifFailSafeConfig) -> Result<()>

Configure the fail-safe watchdog.

Errors

Returns Status::NotSupported if this hardware has no fail-safe line.

pub fn fail_safe(&self) -> Result<PifFailSafeConfig>

Read the fail-safe configuration.

Errors

As ProcessInterface::identity.

pub fn fail_safe_health(&self) -> Result<PifFailSafeStatus>

What the fail-safe line is actually doing.

ProcessInterface::fail_safe answers what was asked for; this answers what is happening on the wire. The two disagree exactly when something is wrong, which is the only time either matters.

Errors

As ProcessInterface::identity.

pub fn read_digital_input(&self, index: u8) -> Result<DigitalState>

Read a digital input.

Errors

Returns Status::NotFound when no PIF is attached, or Status::OutOfRange when index is beyond the hardware's digital input count. Both are routine on a machine whose PIF may simply be unplugged.

pub fn write_digital_output(&mut self, index: u8, state: DigitalState) -> Result<()>

Drive a digital output.

Errors

As ProcessInterface::read_digital_input.

pub fn read_digital_output(&self, index: u8) -> Result<DigitalState>

Read back what a digital output is driving.

What this SDK last drove onto it. DigitalState::Unknown when nothing has driven it since the interface was attached or last configured, as IoSnapshot::digital_outputs reports that pin on a camera; an answer, not an error. Never the level of an input: up to 12.0.28 an undriven output answered with the digital input of the same index on a simulated interface, and failed on a camera.

Errors

As ProcessInterface::read_digital_input.

pub fn read_analog_input(&self, index: u8) -> Result<f32>

Read an analog input, in the channel's configured unit: the SDK's temperature unit for a channel whose unit is a temperature.

Errors

As ProcessInterface::read_digital_input.

pub fn read_raw_analog_input(&self, index: u8) -> Result<f32>

Read an analog input as it is on the wire, in volts, before any channel decode.

The single-read counterpart of IoSnapshot::raw_analog_inputs. ProcessInterface::read_analog_input answers in the channel's own unit, so on a configured channel the wire reading was unobtainable: with a gain of 0.1 and 4.0 V on the pin it answers 40.0, and nothing answered 4.0.

Always volts, whether or not a channel is configured, and in either temperature unit. NaN before the first reading has arrived.

Errors

As ProcessInterface::read_digital_input.

pub fn external_probe_temperature(&self) -> Result<Option<f32>>

The external temperature probe's reading, in the SDK's temperature unit (Celsius unless crate::set_temperature_unit chose Fahrenheit), or None if none has arrived.

The probe is its own measurement, not a channel: it has no index, no gain and no direction. Declaring PifDeviceKind::TemperatureProbe made ProcessInterface::identity read it back and nothing returned a temperature: the frame path decoded the probe and the controller kept it, reachable only from inside the SDK.

None on a camera with no probe fitted, and until the first frame that carries a reading. The same value is published as crate::enums::SignalField::ProbeTemperature on the device domain, so an interlock on the reference probe is an ordinary alarm rule rather than a poll.

Only while the interface is declared a temperature probe (PifDeviceKind::TemperatureProbe): no camera can detect a probe, so the declaration is the only way one is known. On any other interface, and on a camera with none, this is None whatever the frame carries.

Whether a frame carries a reading is decided at the frame decode, per camera family, by the probe's I2C bus answering validly: a read nothing acknowledged (the bus's all-zero or all-ones non-answer) counts as no probe, never as a temperature, so an unpopulated connector reads None rather than a full-scale 511.9375 C.

Errors

As ProcessInterface::read_digital_input, except that "no reading" is Ok(None) rather than an error.

pub fn write_analog_output(&mut self, index: u8, value: f32) -> Result<()>

Drive an analog output, in the channel's configured unit: the SDK's temperature unit for a channel whose unit is a temperature, which the channel's gain and offset turn into the level on the wire. ProcessInterface::read_analog_output reads back that level, not the temperature.

Errors

As ProcessInterface::read_digital_input.

pub fn read_analog_output(&self, index: u8) -> Result<f32>

Read back what an analog output is driving, as it is on the wire: in the unit of the channel's output range (volts in 0-10 V, milliamperes in 0-20 mA and 4-20 mA), and in volts on an output with no channel configured.

The same number in Celsius and in Fahrenheit. A wire value is never a temperature, so on a temperature channel this is not the number ProcessInterface::write_analog_output took: 50 C written at 0.1 V per degree and 0.5 V at zero (122 F in Fahrenheit) reads back 5.5 in either unit. Up to 12.0.27 Fahrenheit answered 41.9.

NaN when nothing has driven it since the interface was attached or last configured. Never the reading of an input: up to 12.0.28 an undriven output answered with the analog input of the same index on a simulated interface, and failed on a camera.

Errors

As ProcessInterface::read_digital_input.

pub fn read_all(&self) -> Result<IoSnapshot>

Read every channel in one transaction.

Errors

As ProcessInterface::identity.

pub fn set_outputs_blocked(&mut self, blocked: bool) -> Result<()>

Hold every PIF output at its inactive level without losing the configuration or the alarm state underneath.

Used while a process is knowingly disturbed; the outputs resume when released.

Errors

As ProcessInterface::identity.

pub fn outputs_blocked(&self) -> Result<bool>

Whether the outputs are currently held.

Errors

As ProcessInterface::identity.

pub fn poll(&mut self) -> Result<()>

Advance the controller: read inputs, decode them, publish signals, dispatch handlers, and step the fail-safe watchdog.

Call it as often as the process needs; the watchdog paces itself from its configured period rather than from the call rate.

Errors

As ProcessInterface::identity.