Parker's DevEd Blog

Musings on all software development technologies, and education involving computer science and fraud investigation

SerialPort Saves the Day!

So, I just got this little GPS unit, it's a EverMore GM-R900 about $50. After installing the drivers which were a breeze, we plugged it in using USB, and ran the included sample application to make sure everything was working. Then plugged the returned latitude and longitude coordinates into google earth, to see almost exactly (within 10ft.) where I was on the earth. Now I started to think about how I could program against this, in my own programs. Here's what I was thinking...

1. The installed driver basically maps a COM port to the USB port, in my case it turned out to be COM4. So, immediately after looking up some specs I opened up HyperTerminal and opened a connection to COM4, at 4800bps, using the rest of the default settings. Immediately my terminal window was receiving messages constantly some weird messages and the GPS location message.

2. So, for my app all I was thinking, was I'd just open up a TcpClient to the COM port, start a timer to read every second. Soon did I find out you can't use a TcpClient to connect to COM port, so now it was time to do a little research. Of course, immediately I found a VB6 sample, it looked fairly simple, but wanted to keep searching to see if I could find any advantages/easier ways of implementing using the technology I would be using (.NET Framework 2.0+). Immediately after I learned of the System.IO.Ports.SerialPort class, this makes connecting to the GPS a cakewalk. Then it's just parsing out the message.

 Code post to come soon...

Comments

No Comments