Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

Introduction to GPS, Part 1

After his college basketball career came to an end without a multiyear contract to play for the L.A. Lakers, Frank Ableson shifted his focus to computer software design. He enjoys solving complex problems, particularly in the areas of communications and hardware interfacing. When not working, he can be found spending time with his wife Nikki and their children. You can reach Frank at frank@cfgsolutions.com.

Summary:  This tutorial is the first in a series of tutorials exploring GPS and the Java programming language's applicability to GPS applications. It is designed for developers and product managers who are evaluating the Java programming language as an option for use in Global Positioning System (GPS) applications.

Date:  16 Jul 2002
Level:  Introductory PDF:  A4 and Letter (156 KB | 25 pages)Get Adobe® Reader®

Activity:  10237 views
Comments:  

Introduction

Should I take this tutorial?

This tutorial, the first in a three-part series, is designed for developers and product managers who are evaluating the Java programming language as an option for use in Global Positioning System (GPS) applications. More generally, anyone familiar with serial communications in another programming language such as C or BASIC, but who is interested in learning how to achieve serial communications by using the Java programming language, will find the sample application a useful exercise. Familiarity with the Java programming language is recommended. Tutorial resources contains links to useful primers on the Java language if you need to brush up your skills.

This tutorial is a prerequisite for subsequent tutorials in this series. Upcoming tutorials discuss GPS concepts in further depth as well as look at the task of porting the sample Java application from the desktop to a portable computing environment.


What is this tutorial about?

This tutorial explores GPS and the Java programming language's applicability to GPS applications. Basic GPS concepts serve as a foundation for the sample application. In addition to the GPS topics, this tutorial presents a high-level discussion of Java architecture with respect to the Java Native Interface (JNI) and platform-specific issues related to physical device communications. The tutorial works with the Java Communications API package for serial communications with a GPS unit. The sample application is also designed to be portable; therefore, the application employs the Java Abstract Windowing Toolkit (AWT) for the user interface.

  • What is GPS? -- This section discusses the basics of GPS, including information on the official U.S. government agencies that have authority over the system and common applications and devices available for GPS. Subsequent sections examine the data protocols available for GPS (the tutorial's sample application optionally parses out National Marine Electronics Association, or NMEA, sentences), and the merits of Java for development of GPS applications. GPS applications are inherently portable and demand a versatile programming environment such as the Java environment.
  • Why Java for GPS? -- This section shifts gears and delves into the development environment of choice, the Java programming language. It explores JNI, which enables the Java programming language to leverage native resources and talk to a portable GPS unit, and the javax.comm package, which Sun Microsystems provides as a reference implementation of a JNI solution to device communications. The sample application employs this package. This discussion of the package examines the prescribed communications driver architecture.
  • Build environment -- This section walks through the acquisition, installation, and verification of the proper build environment required for the tutorial's sample application. The Tools section contains links for each of the tools used in the tutorial.
  • Sample application -- The tutorial's sample application is constructed step-by-step in the this section.
  • User interface and options for the sample application -- This section describes the user interface and the major options available to the user.

Source code map

This tutorial's sample application demonstrates serial communications, Java graphical user interface programming, and GPS NMEA sentence parsing. The full source code is available for download from Tools. Here are the code snippets discussed in this tutorial:

  • Verifying the build environment -- The verifybuildenvclass exercises core functionality of the Java Communications API, verifying the build environment.
  • Ibmdwgps.properties -- This property file specifies required runtime parameters.
  • Property access -- This code snippet demonstrates loading a properties file into the System object's properties collection.
  • User interface -- This code creates the graphical user interface via the Java programming language's AWT.
  • Action handler -- This routine processes events the user initiates.
  • Start option -- The Start routine initiates communications with the serial port resource.
  • Port configuration -- Serial ports have a variety of modes and parameters requiring configuration. This code demonstrates the steps necessary to prepare the port for use.
  • Java I/O streams -- Java code "talks" to other systems by using a mechanism known as streams. This code sets up the streams necessary for interaction with the serial port.
  • Serial event -- This routine handles data that arrives at the port's input stream.
  • NMEA sentence parsing -- NMEA sentences represent various data from the GPS unit. This code employs a simple parsing technique to handle the NMEA message.
  • Stop option -- The Stop routine closes the communications resources.
  • Save option -- The Save routine prompts the user for a filename to save information into.

Some helpful terms

  • GPS -- Global Positioning System, a networked system providing longitude, latitude, and elevation information to specially designed receivers.
  • JDK -- Java Developers Kit, otherwise known as the Java SDK. This is the core Java toolset available from Sun Microsystems.
  • Communications port -- Physical connector and circuitry in a computer used for the purpose of transferring information to another computer or device. Common examples include serial and parallel ports on personal computers.
  • Portability -- The term given to software characterizing the ease with which you can convert an application from one platform to another; for example, converting a program that was written on the Windows platform and enabling it to run on a UNIX platform.
  • Cross-platform development -- The practice of employing one operating system and/or hardware combination to develop applications for another platform. Developing a Palm OS application on a Linux computer is an example of cross-platform development.
  • Data protocol -- The rules computers use when talking to one another. Common examples are found in Electronic Data Interchange (EDI), Hypertext Transfer Protocol (HTTP), File Transfer Protocol (FTP), X-Modem, etc.

Tools

The following resources are required to complete this tutorial:

  • Java SDK (JDK) -- The Java SDK is the core Java development platform required for any Java application. You must install this to build the sample application. You can find the JDK at http://java.sun.com/j2se.
  • Java Communications API -- You can find the Java package, javax.comm, used in the sample application for communicating with the GPS unit, at http://java.sun.com/products/javacomm/index.html. Follow the steps outlined below in the Build environment section to ensure proper installation of this package.
  • Tutorial sample code -- You can find the complete code to the tutorial's sample application at http://www.palm-communications.com/ibmdw.
  • GPS unit -- The tutorial's sample application demonstrates communications with a consumer GPS unit available at http://www.garmin.com/mobile/. Any unit capable of producing NMEA sentences over a serial communications port is sufficient.

1 of 9 | Next

Comments



Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Java technology
ArticleID=136648
TutorialTitle=Introduction to GPS, Part 1
publish-date=07162002
author1-email=
author1-email-cc=

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).