I started having some problems with my Big Red Bee Beeline GPS at the last launch we went to.  I could not get a signal from it.   So I put together this little app so I could pull the feed from the serial port while the BRB was doing it’s thing.  If you have Visual Studio here is the code behind the form.

using System;
using System.IO;
using System.Data;
using System.Linq;
using System.Text;
using System.Drawing;
using System.IO.Ports;
using System.Windows.Forms;
using System.ComponentModel;
using System.Threading.Tasks;
using System.Collections.Generic;

namespace BRB_Port_Reader
{
public partial class Form1 : Form
{
private SerialPort BRB_Port;
private Queue<byte> recievedData = new Queue<byte>();

public Form1()
{
InitializeComponent();
}

private void ReadData_Click(object sender, EventArgs e)
{
BRB_Port = new SerialPort(“COM3″);
BRB_Port.Open();

BRB_Port.DataReceived += BRB_Port_DataReceived;
ReadData.Enabled = false;
}

void BRB_Port_DataReceived(object s, SerialDataReceivedEventArgs e)
{
byte[] data = new byte[BRB_Port.BytesToRead];
BRB_Port.Read(data, 0, data.Length);

data.ToList().ForEach(b => recievedData.Enqueue(b));
processData(data);
}

void processData(byte[] data)
{
SetText(System.Text.Encoding.ASCII.GetString(data));
}

delegate void SetTextCallback(string text);
private void SetText(string text)
{
if (this.textBox1.InvokeRequired)
{
SetTextCallback d = new SetTextCallback(SetText);
this.Invoke(d, new object[] { ” ” + text });
}
else
{
this.textBox1.Text = this.textBox1.Text + ” ” + text;
}
}

private void SetNewLine()
{
if (this.textBox1.InvokeRequired)
{
SetTextCallback d = new SetTextCallback(SetText);
this.Invoke(d, new object[] { this.textBox1.Text + System.Environment.NewLine});
}
else
{
this.textBox1.Text = this.textBox1.Text + System.Environment.NewLine;
}
}

}
}