/// <summary> /// Connects to the <paramref name="device"/>. /// </summary> /// <param name="adapter">Target adapter.</param> /// <param name="device">Device to connect to.</param> /// <param name="cancellationToken">The token to monitor for cancellation requests. The default value is None.</param> /// <returns>A task that represents the asynchronous read operation. The Task will finish after the device has been connected successfuly.</returns> /// <exception cref="DeviceConnectionException">Thrown if the device connection fails.</exception> public static Task ConnectToDeviceAync(this IAdapter adapter, IDevice device, CancellationToken cancellationToken) { return(adapter.ConnectToDeviceAync(device, cancellationToken: cancellationToken)); }