OptrisOptrisDocumentation

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

NetworkTarget

pub struct NetworkTarget

Which camera to open over Ethernet, and where to look for it.

Built with NetworkTarget::new, which applies the SDK's own defaults: no address, no serial, a 5000 ms connect timeout and a 3000 ms discovery timeout.

Address and serial are different questions

An address says where to look; a serial says which camera to accept. They are independent, and all three useful combinations work:

  • Serial only: a discovery broadcast finds it. What a camera on this host's own segment needs, and the form to prefer: an address on a plant gets reassigned and a serial does not.
  • Address only: the SDK probes the address, takes the serial of whatever answers, and opens that. What an operator typing into an "add camera" box needs. The identity check is not skipped, it is answered by the camera instead of by the caller.
  • Both: look here, and refuse anything that is not this camera.

NetworkTarget — methods

pub fn new() -> Self

A target with the SDK's defaults and nothing named yet.

pub fn serial(mut self, serial: &str) -> Result<Self>

Which camera to accept.

Errors

Returns Status::InvalidArgument if serial contains an interior NUL byte.

pub fn address(mut self, address: &str) -> Result<Self>

Where to look, e.g. "10.0.0.21".

Errors

Returns Status::InvalidArgument if address contains an interior NUL byte.

pub fn port(mut self, port: u16) -> Self

The UDP port the camera streams to. Leave unset for the camera's own configured port.

pub fn connect_timeout_ms(mut self, ms: u32) -> Self

How long to wait for the control channel to answer, in whole milliseconds.

This is what a mistyped address costs. Note that it does not shorten a failed open as much as the arithmetic suggests: a network open asks the address who is there before it connects, and with no serial named it never gets past that, see NetworkTarget::discovery_timeout_ms.

This is also the record to set a bound on when calling Camera::open_network_with, which takes a target and a crate::CameraOptions. CameraOptions carries the same two fields and they have no effect on that call: the SDK fills this record with the defaults, so it never looks unset and is always applied last. Measured: 200 ms asked for on the options costs 3040 ms, the same 200 ms asked for here costs 608 ms.

Zero means the SDK's default of 5000 ms, not "give up at once"; that is the ABI's own meaning for this field, and this builder takes raw ABI milliseconds rather than a Duration, so it carries the ABI's meaning unchanged. Leave the builder uncalled for the default; a computed zero is the one value this field cannot say. The .NET and Python bindings take a duration here and refuse a zero for that reason.

Duration: core::time::Duration

pub fn discovery_timeout_ms(mut self, ms: u32) -> Self

How long the SDK waits for a camera to answer discovery, in whole milliseconds.

Ignored by an open only when an address and a serial are both set; then there is nothing to discover. With an address and no serial, which is the form an "add camera by address" box needs, the SDK asks that address who is there to learn the serial, and this field is then the whole cost of a failed open: measured against a documentation-range address, 200 ms here costs 608 ms and 3000 ms costs 3040 ms, while NetworkTarget::connect_timeout_ms is never reached. (This said "ignored by an open when an address is set", which was false for exactly that case.)

It also bounds crate::probe_network, which is the same discovery exchange addressed to one host without the open.

Zero means the SDK's default of 3000 ms, for the reason given on NetworkTarget::connect_timeout_ms.