Ejemplo n.º 1
0
 public void StartListening()
 {
     _listeningTask = Task.Run(async() =>
     {
         while (!_cancelationTokenSource.IsCancellationRequested)
         {
             try
             {
                 await _dataReader.LoadAsync(1);
                 var b = _dataReader.ReadByte();
                 _dataRead.Add(b);
             }
             catch (Exception ex)
             {
                 Debug.WriteLine(ex.Message);
                 ReadingErrorOccured?.Invoke(this, ex.Message);
             }
         }
     });
 }
Ejemplo n.º 2
0
 private void HandleErrorReceived(SerialDevice sender, ErrorReceivedEventArgs args)
 {
     ReadingErrorOccured?.Invoke(this, $"Error received: {args.Error}");
 }