Table of Contents

Method GetDeviceAsync

Namespace
Kepware.Api.ClientHandler
Assembly
Kepware.Api.dll

GetDeviceAsync(Channel, string, CancellationToken)

Gets or creates a device with the specified name and driver in the specified channel.

public Task<Device?> GetDeviceAsync(Channel channel, string name, CancellationToken cancellationToken = default)

Parameters

channel Channel

The channel to which the device belongs.

name string

The name of the device.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<Device>

A task that represents the asynchronous operation. The task result contains the loaded Device or null if it does not exist.

Exceptions

ArgumentNullException

Thrown when the channel is null.

ArgumentException

Thrown when the device name is null or empty.

InvalidOperationException

Thrown when the device cannot be created or loaded.