Create Your Own GPS Applications Using C# (5)
Sunday, February 4th, 2007Continuing with our GPS program, we now need to add a method to read from the GPS device. This step will grab the NMEA information, parse it, and store it in the classes provided in from the Coding 4 Fun project.
public bool ReadData()
{
byte[] bData = new byte[256];
try
{
_port.Read(bData, 0, 256);
_protocol.ParseBuffer(bData);
_validData = true;
return true;
}
catch
{
_validData = false;
return false;
}
}