DeviceMonitorOptions
pub struct DeviceMonitorOptions
What a DeviceMonitor should watch for.
Every field starts at the SDK's own default, so
DeviceMonitorOptions::new() watches arrivals and removals on USB
and nothing else.
DeviceMonitorOptions — methods
pub fn new() -> Self
The SDK's defaults: USB arrivals and removals, nothing else.
pub fn watching_claims(mut self, yes: bool) -> Self
Also report DeviceChange::Claimed and
DeviceChange::Released.
Off by default because it costs a poll: nothing in the operating system pushes a notification when a camera is claimed, so the only way to see the transition is to keep looking.
pub fn watching_network(mut self, yes: bool) -> Self
Also report cameras on the network.
Off by default, and the reason is cost: nothing 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. Not instant either: up to one poll interval to appear and two to disappear, because one dropped reply is not a camera leaving. Discovery is a broadcast, so a camera behind a router stays invisible however healthy it is.
pub fn claim_poll_interval(mut self, interval: Duration) -> Result<Self>
How often to look for claim changes. Zero uses the SDK's 1 s.
Errors
Returns Status::InvalidArgument if the duration does not
fit the ABI's uint32_t of milliseconds.
pub fn network_poll_interval(mut self, interval: Duration) -> Result<Self>
How often to broadcast. Zero uses the SDK's 5 s.
Errors
As DeviceMonitorOptions::claim_poll_interval.
pub fn network_discovery_timeout(mut self, timeout: Duration) -> Result<Self>
How long one network pass may wait for replies. Zero uses the
SDK's 2 s. Must be comfortably shorter than
DeviceMonitorOptions::network_poll_interval or the poll
never rests.
Errors
As DeviceMonitorOptions::claim_poll_interval.
pub fn watches_claims(&self) -> bool
Whether claim transitions are reported.
pub fn watches_network(&self) -> bool
Whether cameras on the network are reported.
pub fn claim_poll_interval_ms(&self) -> u32
The claim poll interval in force.
pub fn network_poll_interval_ms(&self) -> u32
The network poll interval in force.
pub fn network_discovery_timeout_ms(&self) -> u32
The network discovery timeout in force.