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() ) { } } }
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()) { } } }