Class DeviceFactory
Inheritance
System.Object
DeviceFactory
Implements
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 DeviceFactory : IDeviceFactory
Constructors
DeviceFactory(ILoggerFactory, GetConnectedDeviceDefinitionsAsync, GetDeviceAsync, Func<ConnectedDeviceDefinition, CancellationToken, Task<Boolean>>)
Constructs a DeviceFactory
Declaration
public DeviceFactory(ILoggerFactory loggerFactory, GetConnectedDeviceDefinitionsAsync getConnectedDevicesAsync, GetDeviceAsync getDevice, Func<ConnectedDeviceDefinition, CancellationToken, Task<bool>> supportsDevice)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Extensions.Logging.ILoggerFactory | loggerFactory | The factory for creating new loggers for each device |
GetConnectedDeviceDefinitionsAsync | getConnectedDevicesAsync | A delegate that returns matching connected device definitions |
GetDeviceAsync | getDevice | A delegate to construct the device based on the specified connected device definition |
System.Func<ConnectedDeviceDefinition, System.Threading.CancellationToken, System.Threading.Tasks.Task<System.Boolean>> | supportsDevice | A delegate that returns whether or not this factory supports the connected device |
Methods
GetConnectedDeviceDefinitionsAsync(CancellationToken)
Declaration
public Task<IEnumerable<ConnectedDeviceDefinition>> GetConnectedDeviceDefinitionsAsync(CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.Threading.CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<ConnectedDeviceDefinition>> |
GetDeviceAsync(ConnectedDeviceDefinition, CancellationToken)
Declaration
public Task<IDevice> GetDeviceAsync(ConnectedDeviceDefinition connectedDeviceDefinition, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
ConnectedDeviceDefinition | connectedDeviceDefinition | |
System.Threading.CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<IDevice> |
SupportsDeviceAsync(ConnectedDeviceDefinition, CancellationToken)
Declaration
public Task<bool> SupportsDeviceAsync(ConnectedDeviceDefinition connectedDeviceDefinition, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
ConnectedDeviceDefinition | connectedDeviceDefinition | |
System.Threading.CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Boolean> |