Interface IDevice
Inherited Members
System.IDisposable.Dispose()
Assembly: Device.Net.dll
Syntax
public interface IDevice : IDisposable
Properties
ConnectedDeviceDefinition
Information about the device. This information should be collected from initialization and will be null before initialization and after disposal
Declaration
ConnectedDeviceDefinition ConnectedDeviceDefinition { get; }
Property Value
DeviceId
Device unique OS level Id for the type of device. The device should have been constructed with this Id. It is used to initialize the device.
Declaration
Property Value
Type |
Description |
System.String |
|
IsInitialized
Whether or not the device has been successfully initialized
Declaration
bool IsInitialized { get; }
Property Value
Type |
Description |
System.Boolean |
|
Methods
Close()
Closes the device, but allows for it to be reopened at a later point in time (as opposed to disposing)
Declaration
Flush(CancellationToken)
Flushes the device. Note: Only available for serial port devices currently
Declaration
Task Flush(CancellationToken cancellationToken)
Parameters
Type |
Name |
Description |
System.Threading.CancellationToken |
cancellationToken |
|
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
InitializeAsync(CancellationToken)
Close any existing connections and reinitialize the device.
Declaration
Task InitializeAsync(CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type |
Name |
Description |
System.Threading.CancellationToken |
cancellationToken |
|
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
ReadAsync(CancellationToken)
Read a page of data. Warning: this is not thread safe. WriteAndReadAsync() should be preferred.
Declaration
Task<TransferResult> ReadAsync(CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type |
Name |
Description |
System.Threading.CancellationToken |
cancellationToken |
|
Returns
WriteAndReadAsync(Byte[], CancellationToken)
Write a page of data and then wait for the device to return a page. If the implementation derives from DeviceBase, this method is thread safe.
Declaration
Task<TransferResult> WriteAndReadAsync(byte[] writeBuffer, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type |
Name |
Description |
System.Byte[] |
writeBuffer |
|
System.Threading.CancellationToken |
cancellationToken |
|
Returns
WriteAsync(Byte[], CancellationToken)
Write a page of data. Warning: this is not thread safe. WriteAndReadAsync() should be preferred.
Declaration
Task<uint> WriteAsync(byte[] data, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type |
Name |
Description |
System.Byte[] |
data |
|
System.Threading.CancellationToken |
cancellationToken |
|
Returns
Type |
Description |
System.Threading.Tasks.Task<System.UInt32> |
|