OptrisOptrisDocumentation

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

ReconnectConfig

pub struct ReconnectConfig

The backoff schedule an automatic reconnect follows.

ReconnectConfig::new reads the SDK's own defaults out of optris_sdk_reconnect_config_init.

ReconnectConfig — methods

pub fn new() -> Self

The SDK's defaults.

pub fn max_attempts(&self) -> Option<i32>

How many attempts, or None for unlimited.

The ABI spells unlimited as a non-positive int32_t; this is the one place that is translated.

A wait does not spend an attempt. A USB camera that is not enumerated is waited for, ReconnectPhase::WaitingForDevice, so a camera left unplugged is looked for indefinitely rather than exhausting the budget against an empty bus. A network camera that answers discovery nowhere is waited for the same way.

pub fn initial_delay(&self) -> Duration

How long before the first attempt.

pub fn max_delay(&self) -> Duration

The ceiling the backoff climbs to.

pub fn backoff_multiplier(&self) -> f32

What the delay is multiplied by after each failure.

pub fn with_max_attempts(mut self, attempts: Option<i32>) -> Self

Cap the attempts. None is unlimited.

pub fn with_delays(mut self, initial: Duration, max: Duration) -> Result<Self>

Set the first delay and the ceiling.

Errors

Returns Status::InvalidArgument if either duration does not fit the ABI's uint32_t of milliseconds.

pub fn with_backoff_multiplier(mut self, multiplier: f32) -> Self

Set the backoff multiplier.