OptrisOptrisDocumentation

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

optris::sdk::DeviceMonitorOptions

What the monitor watches for.

Public attributes

watch_claims

bool watch_claims = false

Also report kClaimed and kReleased.

Off by default because it costs a poll: nothing in the operating system pushes a notification when a lock is taken, so the only way to see the transition is to look. A caller that only wants arrivals pays nothing for claims being supported.

claim_poll_interval

std::chrono::milliseconds claim_poll_interval {1000}

How often to look, when watch_claims is set. The cost of a pass is one open() and one non-blocking flock() per known camera, so this can be brisk; a second is chosen to be invisible to an operator without being a busy loop.

watch_network

bool watch_network = false

Also report cameras on the network.

Off by default, and the reason is cost rather than taste: nothing in the operating system reports a camera appearing on a network, so seeing one means broadcasting a discovery datagram and waiting for replies -- and silence takes as long to hear as an answer. A USB application should not pay that every few seconds.

With it set, a camera that answers discovery for the first time arrives as kArrived and one that stops answering leaves as kRemoved, carrying the same DeviceInfo an EnumerateDevices() with include_network would describe -- address, port and claim state included. With watch_claims also set, its claim transitions are reported from the camera's own busy word, which on Ethernet is the authoritative source.

Two things it is not: Two things it is not It is not instant. A camera appears up to one network_poll_ interval after it is powered, and leaves two intervals after it stops answering -- a single dropped reply is not a camera leaving, so a removal needs consecutive silence.

It is not every camera on the site. Discovery is a broadcast, and a broadcast reaches the local segment only, so a camera behind a router is invisible here however healthy it is. Use ProbeNetworkDevice() for one you can name.

network_poll_interval

std::chrono::milliseconds network_poll_interval {5000}

How often to broadcast, when watch_network is set.

Five seconds rather than the claim poll's one: a pass costs the discovery timeout on every network this host can broadcast into, which is seconds and not microseconds, and a camera being powered on is not an event an operator times with a stopwatch.

network_discovery_timeout

std::chrono::milliseconds network_discovery_timeout {2000}

How long one network pass may spend waiting for replies, when watch_network is set. The same budget EnumerationOptions applies to a single sweep, and it must be comfortably shorter than network_poll_interval or the poll never rests.