Hi, I'm using opennetcf to try and connect my GPS. When I run the
following code, I get the Opening message, then right after get the
stopped. I never get a running message. I'm sure I'm using the right
port and baud rate. I've tried 3rd party GPS software on my device to
verify it does work. Just curious if anyone sees anything wrong with
this code. Thanks so much
using OpenNETCF.IO.Serial.GPS;
private void button1_Click(object sender, EventArgs e)
{
gps.GpsSentence += new
OpenNETCF.IO.Serial.GPS.GPS.GpsSentenceEventHandler(gps_GpsSentence);
gps.GpsCommState += new
OpenNETCF.IO.Serial.GPS.GPS.GpsCommStateEventHandler(gps_GpsCommState);
OpenNETCF.IO.Serial.BaudRates br =
OpenNETCF.IO.Serial.BaudRates.CBR_9600;
gps.BaudRate = br;
gps.ComPort = "COM4:";
gps.MinBaudRate = br;
gps.MaxBaudRate = br;
//gps.AutoDiscovery = true;
gps.Start();
}
private void gps_GpsCommState(object sender,
GpsCommStateEventArgs e)
{
switch (e.State)
{
case OpenNETCF.IO.Serial.GPS.States.Opening:
MessageBox.Show("GPS Opening");
break;
case OpenNETCF.IO.Serial.GPS.States.Running:
MessageBox.Show("GPS Started");
break;
case OpenNETCF.IO.Serial.GPS.States.Stopped:
MessageBox.Show("GPS Stop");
break;
case OpenNETCF.IO.Serial.GPS.States.Stopping:
MessageBox.Show("GPS Stopping");
break;
}
}