Click here to Skip to main content
14,690,616 members
Please Sign up or sign in to vote.
2.00/5 (2 votes)
See more:
How to read GPS data through Serial port in Windows CE 6.0 application?

1 solution

Hi there,

Create a gps handler first, as follows

int GpsHandler = CreateFile("COM8:", GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0);

where, COM8: = your devices gps port(will be different)

1.Then set the gps port timeouts value like ReadIntervalTimeout.
2.Then set the Baud rate,stop bits,parity and bytesize, for the gps port.

At last as desired interval you need to read the data from the gps port:
static byte[] ByteArray= new byte[1024];

ReadFile(GpsHandler, ByteArray, 1024, ref RedItems, 0);

this red data will be a byte value ,change it to a string like this

string gpsdata = System.Text.Encoding.ASCII.GetString(ByteArray, 0, RedItems);

Result: gpsdata will have your gps related data

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900