Class DeviceListener
Handles connection of devices. This is not the recommended approach. Please use DeviceManager where possible. Documentation href="https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.iloggerfactory"
Inheritance
System.Object
DeviceListener
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Device.Net
Assembly: Device.Net.dll
Syntax
public sealed class DeviceListener : IDeviceListener, IDisposable
Constructors
DeviceListener(IDeviceFactory, Nullable<Int32>, ILoggerFactory)
Handles connecting to and disconnecting from a set of potential devices by their definition
Declaration
public DeviceListener(IDeviceFactory deviceFactory, int? pollMilliseconds = 1000, ILoggerFactory loggerFactory = null)
Parameters
Type | Name | Description |
---|---|---|
IDeviceFactory | deviceFactory | |
System.Nullable<System.Int32> | pollMilliseconds | |
Microsoft.Extensions.Logging.ILoggerFactory | loggerFactory |
Properties
DeviceFactory
Declaration
public IDeviceFactory DeviceFactory { get; }
Property Value
Type | Description |
---|---|
IDeviceFactory |
Methods
CheckForDevicesAsync(CancellationToken)
Declaration
public async Task CheckForDevicesAsync(CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.Threading.CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Dispose()
Declaration
public void Dispose()
Start()
Starts the polling for devices if polling is being used.
Declaration
public void Start()
Stop()
Declaration
public void Stop()
Events
DeviceDisconnected
Declaration
public event EventHandler<DeviceEventArgs> DeviceDisconnected
Event Type
Type | Description |
---|---|
System.EventHandler<DeviceEventArgs> |
DeviceInitialized
Declaration
public event EventHandler<DeviceEventArgs> DeviceInitialized
Event Type
Type | Description |
---|---|
System.EventHandler<DeviceEventArgs> |
Implements
System.IDisposable