private async Task <Response> ExecuteAsync(IViscaTransport transport, Command command, CancellationToken cancellationToken) { var response = await transport.SendAsync(command, cancellationToken).ConfigureAwait(false); Intercept(command, response); return(response); }
public CameraConnection( IViscaTransport transport, string?name = null, uint retryTimeout = 1000, ILogger <CameraConnection>?logger = null) { if (retryTimeout < 100) { throw new ArgumentOutOfRangeException(nameof(retryTimeout), retryTimeout, "The retry timeout must be > 10ms."); } _transport = transport; Name = name ?? transport.ToString(); RetryTimeout = retryTimeout; _logger = logger; Task.Run(() => MonitorAsync(_monitorCancellationTokenSource !.Token), _monitorCancellationTokenSource !.Token) .ConfigureAwait(false); }