Click here to Skip to main content
14,240,857 members
Rate this:
Please Sign up or sign in to vote.
See more:
How to read GPS data through Serial port in Windows CE 6.0 application?

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 2

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, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100