public async Task <IEnumerable <byte> > TransceiveAsync(byte[] request, CancellationToken cancellationToken) { var wasOpenBefore = _inner.IsOpen; if (!wasOpenBefore) { _inner.Open(); } var result = await _inner.TransceiveAsync(request, cancellationToken); if (PortMustBeClosed(wasOpenBefore)) { _inner.Close(); } return(result); }
public void Open() { _semaphore.WaitOne(); _inner.Open(); }
public void Open() { _serialPortTransceiverImplementation.Open(); }
public void Open() => _transceiver.Open();