miguel rodriguez
miguel rodriguez

Reputation: 1

how can i connect to the port com8 to access the GPS coordinates in C# .net 3.5

I'm trying to get the gps location of a device running .net 3.5 compact framework. but i don't know how to access then.

SerialPort port = new SerialPort("COM8", 4800);
            port.DataReceived += new SerialDataReceivedEventHandler(DataReceivedHandler);

            port.Open();

            string gp = port.ReadLine();

 void DataReceivedHandler(object sender, SerialDataReceivedEventArgs e)
        {
            SerialPort sp = (SerialPort)sender;
            string indata = sp.ReadExisting();
            MessageBox.Show("Data Received:");
            MessageBox.Show(indata);
        }

Upvotes: 0

Views: 262

Answers (1)

josef
josef

Reputation: 5959

Normally, if you are on a Windows Mobile 5.x/6.x device, you can use the MS GPS Intermediate Driver (GPSID).

If you can not use GPSID, you will get raw GPS data, either in ASCII (NMEA) format or in binary format. That data then needs to be parsed to get location and other informations, something like done here.

My sample will work with GPSID and raw ASCII data but not with GPS binary RAW (then only GPSID is available).

Upvotes: 1

Related Questions