Esempio n. 1
0
        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);
        }
Esempio n. 2
0
 public void Close()
 {
     _inner.Close();
     _semaphore.Release();
 }
Esempio n. 3
0
 public void Close()
 {
     _serialPortTransceiverImplementation.Close();
 }
Esempio n. 4
0
 public void Close() => _transceiver.Close();