Palm Programming: GPS Receiver
This paper looks at the process of developing an application for a device running a Palm operating system; specifically, any device running OS 3.x or newer. The main focus is broken into two separate ideas: understanding the process flow and minimum requirements of any Palm application and the development of a program to receive and display data gathered from a Garmin GPS 25 LVC receiver unit. All of the programs, processes, and ideas contained herein are based on the use of CodeWarrior, a developer’s environment for the PC available as freeware from Metrowerks Corporation.As with any programming environment, the programmer must first learn the basics of how the computer functions. Most programmers are familiar with the PC environment and standard flow of an application. When programming in any language on a PC, the developer must create and include any functions or additional files that are necessary for use with the application being created. However, the Palm OS is slightly different, and rightfully so considering the limited storage capacity available on most handhelds. When a Palm application is being developed, many of the functions that are going to be needed for performing the most co
Another problem that may occur as the program runs is the loss of contact with enough satellites. Accurate latitude and longitude coordinates can only be calculated if there are at least 3 satellites in view of the GPS antenna but only one satellite is necessary for receiving the UTC. To inform the user that the GPS data is no longer valid, the latitude and longitude coordinates of the last successful read are removed from the screen and a label appears that states that the satellites have been lost. If at least one satellite is still visible, the UTC will continue to update as long as the program is running. The first step is to receive the data. To do this, a buffer is setup with enough space to receive about two full lines of information. After this data is received it is checked for validity by searching for a specific string that is the first byte of any valid transmission from the receiver unit. If this string is found, the sentences in the buffer are broken up into single characters and placed in an array for easy access to the strings. The data input is actually comma-delimited fields so when the array is constructed the comma positions are noted so that several characters can be recognized as one string to be displayed. Because all of the data is being saved as character elements and not numbers, no mathematical operations can be performed on the lat/long coordinates. After saving all of the data into the character array, the specific fields that are needed can be separated out. For example, according to the sentence structure of the original data, locations 2 thru 8 will contain the information for the UTC. By displaying these characters one after another with colons placed in the correct locations, the UTC appears to the user as a standard clock time in hours, minutes, and seconds. Before doing this with the lat/long data, another check must be performed. There is a particular flag in the data that lets us know whether there were enough satellites in view to triangulate the position of our receiver. By the use of conditional statements, the lost satellite label can be forced to appear on the screen or if the data is valid, the data can be displayed. The first step in developing the program was to decide how the user interface would appear and what special objects were necessary. It is only necessary to have one form for this project, which will keep the event handling fairly simple. Also, there is only one menu item that needed to be programmed and that is the about box. The about box is a standard feature of any program designed as a quick summary of what the program does and what version number it is. Because the data will be displayed all the time when the program is being run, static labels needed to be created so the user could easily differentiate between the numbers appearing on the screen. The user interface for this program appears on page 5 in Figure 1.
Some topics in this essay:
GPS Program,
Function ReadSerial,
Project Structure,
Constructor Figure,
PilotMain EventLoop,
Finishing Application,
Palm OS,
PilotMain RomVersionCompatible,
Palm C/C++,
Flowchart Figure,
serial port,
event loop,
main form,
user interface,
source code,
gps program,
source file,
resource file,
figure 1,
called pilotmain,
user interface elements,
created serial port,
messages created serial,
file resource file,
static labels created,
Join now to see the rest of the essay!
Approximate Word count = 3065
Approximate Pages = 12 (250 words per page double spaced)
CUSTOMER SERVICES
| |
|