Table of Contents

Class DeferredUsbDeviceMonitor

Namespace
Huddly.Sdk
Assembly
Huddly.Sdk.dll

An IUsbDeviceMonitor that defers selecting (and constructing) the underlying monitor — USB proxy client vs. native LibUsb — until Start(SdkSession, int, CancellationToken) is called.

This guarantees that no discovery or proxy-probe IO happens during construction or dependency-injection wiring; the decision is made when monitoring actually starts.

public sealed class DeferredUsbDeviceMonitor : IUsbDeviceMonitor, IDeviceMonitor, IDisposable
Inheritance
DeferredUsbDeviceMonitor
Implements
Inherited Members

Constructors

DeferredUsbDeviceMonitor(Func<IUsbDeviceMonitor>, ILogger<DeferredUsbDeviceMonitor>)

public DeferredUsbDeviceMonitor(Func<IUsbDeviceMonitor> resolveInner, ILogger<DeferredUsbDeviceMonitor> logger)

Parameters

resolveInner Func<IUsbDeviceMonitor>

Factory invoked once, on Start(SdkSession, int, CancellationToken), to pick and build the real monitor. All proxy-probe and discovery IO must happen inside this delegate, never before.

logger ILogger<DeferredUsbDeviceMonitor>

A logger.

Properties

IsMonitoring

public bool IsMonitoring { get; }

Property Value

bool

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

GetDevices()

public ISet<IDevice> GetDevices()

Returns

ISet<IDevice>

GetDiscoveryType()

NOTE: The concrete discovery type, e.g. LibUsbDiscovery or UsbDiscoveryGrpcClient is unknown when the monitor is not started; the IUsbDiscovery interface type is reported when unknown.

[Obsolete("Method will be removed in SDK version 3.")]
public Type GetDiscoveryType()

Returns

Type

Resume()

public void Resume()

Start(SdkSession, int, CancellationToken)

public Task Start(SdkSession session, int timeout_ms = -1, CancellationToken ct = default)

Parameters

session SdkSession
timeout_ms int
ct CancellationToken

Returns

Task

Suspend()

public void Suspend()

TryGetDevice(string, out IDevice?)

public bool TryGetDevice(string deviceId, out IDevice? device)

Parameters

deviceId string
device IDevice

Returns

bool

Events

DeviceAccessDenied

This event is triggered when a connected device is inaccessible, e.g., when it is claimed by another process or when permission is denied.

public event EventHandler<DeviceAccessDeniedEventArgs>? DeviceAccessDenied

Event Type

EventHandler<DeviceAccessDeniedEventArgs>

DeviceConnected

This event is triggered when a device is connected. It will also trigger for all currently connected devices when device discovery starts.

public event EventHandler<DeviceConnectionChangeEventArgs>? DeviceConnected

Event Type

EventHandler<DeviceConnectionChangeEventArgs>

DeviceDisconnected

This event is triggered when a device is disconnected. It will only occur for devices that have previously triggered the DeviceConnected event.

public event EventHandler<DeviceConnectionChangeEventArgs>? DeviceDisconnected

Event Type

EventHandler<DeviceConnectionChangeEventArgs>