DeviceWatchOptions
public sealed class DeviceWatchOptions
What Sdk.WatchDevicesAsync(…) reports.
DeviceWatchOptions: constructors
public DeviceWatchOptions()
DeviceWatchOptions: properties
public TimeSpan ClaimPollInterval { get; set; }
How often to look, when DeviceWatchOptions.WatchClaims is set.
TimeSpan.Zero is refused: zero on the wire means "use the SDK's own interval", so a caller who computed a zero would silently get one second rather than the fastest poll they were asking for. Leave the property alone for the default. In earlier releases a zero here was ignored without an error.
public TimeSpan NetworkDiscoveryTimeout { get; set; }
How long one network pass may wait for replies, when DeviceWatchOptions.WatchNetwork is set.
This is the whole cost of a pass (silence takes as long to hear as an answer), so it must be comfortably shorter than DeviceWatchOptions.NetworkPollInterval or the poll never rests.
TimeSpan.Zero is refused, for the reason given on DeviceWatchOptions.ClaimPollInterval.
public TimeSpan NetworkPollInterval { get; set; }
How often to broadcast, when DeviceWatchOptions.WatchNetwork is set.
Five rather than the claim poll's one: a pass costs the discovery timeout on every network this machine can broadcast into, which is seconds and not microseconds, and a camera being switched on is not an event an operator times with a stopwatch.
TimeSpan.Zero is refused, for the reason given on DeviceWatchOptions.ClaimPollInterval.
public bool WatchClaims { get; set; }
Also report DeviceChangeKind.Claimed and DeviceChangeKind.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. A caller that only wants arrivals pays nothing for claims being supported.
public bool WatchNetwork { get; set; }
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 program with only USB cameras should not pay that every few seconds.
With it set, a camera that answers discovery for the first time arrives as DeviceChangeKind.Arrived and one that stops answering leaves as DeviceChangeKind.Removed, carrying the same DeviceInfo an enumeration with network discovery would describe: address, port and claim state included. With DeviceWatchOptions.WatchClaims also set, its claim changes come from the camera's own busy word.
It is not instant. A camera appears up to one DeviceWatchOptions.NetworkPollInterval after it is powered, and leaves two intervals after it stops answering; one 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 network segment only, so a camera behind a router is invisible here however healthy it is. Use Sdk.Probe(…) for one you can name.