Пример #1
0
 private void SerialPortDataReceived( object sender, BytesReceivedEventArgs e )
 {
     lock ( _byteStream )
     {
         foreach ( var b in e.Bytes )
         {
             _byteStream.Enqueue( b );
         }
         // Keep reading until there's no complete chunk to be read.
         while ( ReadAndProcessBytes() )
         { }
     }
 }
Пример #2
0
 private void SerialPortDataReceived(object sender, BytesReceivedEventArgs e)
 {
     lock ( _byteStream )
     {
         foreach (var b in e.Bytes)
         {
             _byteStream.Enqueue(b);
         }
         // Keep reading until there's no complete chunk to be read.
         while (ReadAndProcessBytes())
         {
         }
     }
 }