This project is read-only.


Oct 6, 2007 at 9:32 AM
i don't know how can I set the GPSSharp gps object property to raise GPS Fix Event in e.g 5 second intervals, I've set the Timeout property for 5 (the default value is 5), but the NewGPSFix event is raising very fast.
thanks Afrough
Oct 6, 2007 at 5:36 PM
The event is raised everytime the GPS sends a NMEA sentence, so if you want to change that, you will need to change your GPS. Most devices sends NMEA data every 1-2 seconds. Every time the GPS sends some data, it will send multiple set of messages, so this is why you probably see multple events raised very fast after each other. You will probably see a burst of 3-5 events right after each other, then a short 1-2 second break, and then a burst of events again.
Check the "TypeOfEvent" of the GPSEventArgs type in your handler to see which kind of message it is, and just ignore the ones you don't need. Usually if you just want position, speed and heading, check for "GPSEventType.GPRMC"
private void GPSEventHandler(object sender, GPSHandler.GPSEventArgs e)
	switch (e.TypeOfEvent)
		case GPSEventType.GPRMC:  //Recommended minimum specific GPS/Transit data
		if(GPS.HasGPSFix) //Is a GPS fix available?
			lbPosition.Text = GPS.RMC.Longitude.ToString() + "," + GPS.RMC.Latitude.ToString();
			lbHeading.Text = GPS.RMC.Course.ToString();
			lbSpeed.Text = GPS.RMC.Speed.ToString() + " mph";
			lbTimeOfFix.Text = GPS.RMC.TimeOfFix + " - " + GPS.RMC.DateOfFix;
			lbPosition.Text = "No fix";
			lbHeading.Text = "N/A";
			lbSpeed.Text = "N/A";
			lbTimeOfFix.Text = "N/A";