Show / Hide Table of Contents

Interface IDevice

Inherited Members
System.IDisposable.Dispose()
Namespace: Device.Net
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
Type Description
ConnectedDeviceDefinition

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
string DeviceId { get; }
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
void Close()

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
Type Description
System.Threading.Tasks.Task<TransferResult>

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
Type Description
System.Threading.Tasks.Task<TransferResult>

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>
In This Article
Back to top Generated by DocFX