I recently took delivery of a new Dell Latitude E6400 laptop to use as primary workstation. All things considered it’s turning out to be an excellent choice.
One of the things that surprised me was the presence of a GPS transciever built into the laptop as part of the HSPA 3G wireless card. Viewing in Windows Device Manager it appears as a component connected to the USB sub-interface on the card:

Device Manager Screenshot
The interface to the GPS unit is simple NMEA over the virtual COM port 7. By default there’s not much you can do with this – Google Earth will interface pretty much out of the box, but not much else.
I decided it would be fun to write a little Java application to map the current position of the laptop, as given by the GPS unit.
I looked around a bit and found JXMapKit, which is part of the swingx project. Using some of this tutorial to get me started, I had a basic mapping application up and running in about 20 minutes.
The next step was to interface with the GPS unit. This is where Java falls down a little, espcially on Windows machines. In the end I settled for the RXTX library which uses native implementation (JNI) to provide access to serial devices from within a Java app.
The Latitude’s GPS unit spews out location information on the COM port as it becomes available, so all you need to do is ‘listen’, and then handle the stream in an event-driven manner.
A sample GGA ‘fix’ sentence looks like this:
$GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47
I couldn’t find any NMEA parsing libraries for Java online, so another 2 hours and I’d written my own. There’s a core class which validates the NMEA sentence and then invokes a specific handler class depending on the NMEA sentence type. For example, GGA (fix) sentences are handled by NmeaLocationMessage, GSA (overall satellite data) sentences are handled by NmeaSatelliteGeneralDataMessage, GSV (detailed satellite data) sentences are handled by NmeaSatelliteDetailMessage and so on.
Each of these ‘handler’ classes contains the logic to further parse the specific sentence type. Just to get up and running I only implemented handlers for GGA, GSA, RMC and GSV messages, which were more than enough to get a fix on the map.
Finally I wrote the code to invoke the NMEA parser on serial port events. The core event handling code looks like this:
NmeaMessage message = new NmeaParser().parseSentence(line);
if (NmeaLocationMessage.class.isInstance(message)) {
NmeaLocationMessage location = (NmeaLocationMessage) message;
if (location.getLatitude() != lastLat || location.getLongitude() != lastLon) {
lastLat = location.getLatitude();
lastLon = location.getLongitude();
map.setAddressLocation(
new GeoPosition(
location.getLatitude(),
location.getLongitude()));
}
}
Nice and simple!
The net result is that everytime the GPS reports a new Latitude or Longitude, the map is re-centered accordingly.
So finally, here’s a location plot as I’m sitting on a train at London Paddington Station waiting to depart:
GPS Tracker Screenshot
I wrote this really for a bit of fun, since clearly it’s not massively practical. If you have an E6400 with GPS, or a similar notebook and would like to play around with it please let me know and I’ll gladly send you the app and/or sourcecode.
23 Comments
I would love to have the app for GPS
Hi. Very interesting. I am using an E6400 with internal 5530 HSPA card too. I would like to test the app/sourcecode that you developed for the GPS. Kind regards, Shan
Hi. It would be great to use your app on my E6400 .
Hey… that’s nice, can you please send me your code… i would like to try this in my E6400 as well…
Hi, would love to have a play with app / source code ? any chance you could mail it to me ?
I would love this app please for my E6400, thanks
Hi! This sounds interesting – would you be so kind to send me the app?
I have Latitude e6400 , look like cool application , could u shared me pls?
I too would love this app please for my E6400, thanks
Hi Timothy,
Can u send me the app for my e6400, i would like to try it in my E6400. Best regards, Bulend.
Hi Timothy
Can u send me the app pls for my e6400. i would love it to play with my dell e6400. Best regards. Bulend
I have just recieved my E6400 pc for my job and tryes to use the gps. Please send me the application.
/Thomas Crona, Sweden
I have just seen your interesting article on using GPS with JXMapKit. Please could you send me the source code?
Thanks.
Jim
Since I’ve had so many requests for this, I will create a new post with the source code shortly…!
I’m interested too
Regards
Google have a app called Latitude that works with Chrome and Dell Latitude E6400
Does it talk to Google Maps equally easily out of the box? The Google Latitude app (an option within Google Maps) can publish your location to other chosen users of Google Latitude, as well as keep a for your eyes only record of your movements. Cheers
Yes I think it does, but at the time that I wrote this Google Maps didn’t support it.
Sorry took so long to approve your post – for some reason I didn’t get an email alert and my blog updates have been slow to say the least!
I’m very interested in your app. I want to try it on my new E6410. Please send me a copy. Thanks!
Hi dear.would you mind please send me a copy.I have a e6400 and really like this application.
Could you send me the source code please?
Thanks,
Mike
Hi
I have dell inspirion mini with gps built in.
Since I am new at this I might ask stupid questions, but, here goes. I would like to use it also as navigation when on the move. Since this means working offline first some sort of map must be installed and then some program to connect gps signal to show position, speed etc… Any ideas how to go about it?
Much appreciate any help
Ales
Hi Ales,
Sorry didn’t reply before; there were some issues with the comments on my blog.
You might take a look at Microsoft MapPoint for this. It does a pretty good job for exactly what you’ve described. Also, you can do similar with Google Earth (not maps), although it depends what you’re looking to achieve.
Hope that helps.