示例#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);
        }
示例#2
0
 public void Open()
 {
     _semaphore.WaitOne();
     _inner.Open();
 }
示例#3
0
 public void Open()
 {
     _serialPortTransceiverImplementation.Open();
 }
示例#4
0
 public void Open() => _transceiver.Open();