Class DeviceManager
Manages the workflow of connecting and disconnecting devices for use with Observables. Slightly outdated documentation: href="https://melbournedeveloper.github.io/Device.Net/articles/DeviceManager.html"
Inheritance
System.Object
DeviceManager
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 class DeviceManager : IDeviceManager, IDisposable
Constructors
DeviceManager(DeviceNotify, NotifyDeviceError, Func<IDevice, Task>, GetConnectedDevicesAsync, GetDeviceAsync, Int32, ILoggerFactory, Boolean)
Manages the workflow of connecting and disconnecting devices for use with Observables
Declaration
public DeviceManager(DeviceNotify notifyDeviceInitialized, NotifyDeviceError notifyDeviceException, Func<IDevice, Task> initializeDeviceAction, GetConnectedDevicesAsync getConnectedDevicesAsync, GetDeviceAsync getDevice, int pollMilliseconds, ILoggerFactory loggerFactory = null, bool filterMiddleMessages = true)
Parameters
Type | Name | Description |
---|---|---|
Device |
notifyDeviceInitialized | |
Notify |
notifyDeviceException | |
System. |
initializeDeviceAction | |
Get |
getConnectedDevicesAsync | |
Get |
getDevice | |
System. |
pollMilliseconds | |
Microsoft. |
loggerFactory | |
System. |
filterMiddleMessages |
Properties
ConnectedDevicesObservable
Declaration
public IObservable<IReadOnlyCollection<ConnectedDeviceDefinition>> ConnectedDevicesObservable { get; }
Property Value
Type | Description |
---|---|
System. |
FilterMiddleMessages
Placeholder. Don't use. This functionality will be injected in
Declaration
public bool FilterMiddleMessages { get; }
Property Value
Type | Description |
---|---|
System. |
SelectedDevice
Declaration
public IDevice SelectedDevice { get; }
Property Value
Type | Description |
---|---|
IDevice |
Methods
Dispose()
Declaration
public void Dispose()
QueueRequest(IRequest)
Declaration
public void QueueRequest(IRequest request)
Parameters
Type | Name | Description |
---|---|---|
IRequest | request |
SelectDevice(ConnectedDeviceDefinition)
Sets the selected device
Declaration
public void SelectDevice(ConnectedDeviceDefinition connectedDevice)
Parameters
Type | Name | Description |
---|---|---|
Connected |
connectedDevice |
Start()
Declaration
public async Task Start()
Returns
Type | Description |
---|---|
System. |
WriteAndReadAsync<TResponse>(IRequest, Func<Byte[], TResponse>)
Declaration
public async Task<TResponse> WriteAndReadAsync<TResponse>(IRequest request, Func<byte[], TResponse> convertFunc)
Parameters
Type | Name | Description |
---|---|---|
IRequest | request | |
System. |
convertFunc |
Returns
Type | Description |
---|---|
System. |
Type Parameters
Name | Description |
---|---|
TResponse |
Implements
System.IDisposable