New York University
Computer
Science Department
Courant
Institute of Mathematical Sciences
Session 9: The
Basics of the Palm Platform, and the PalmOS Emulator
(A review of
pre-MIDP technology)
Course Title: Extreme Java Course Number:
g22.3033-007
Instructor: Jean-Claude Franchitti Session: 9
The Palm platform is built on the proposition that a
strong developer community and good tools enable the creation of interesting
applications and a broad user base. This handout shows you how to leverage the
strengths of the PalmOS and its development environment to build
consumer-device applications in Java.
Palm connected organizers have proven successful
beyond the dreams of even their most devoted followers. In a few short years,
Palm Computing and licensees such as IBM, Symbol Technologies, QUALCOMM, and
Handspring have gone through several generations of devices and built a loyal
following of users and programmers alike.
With the thousands of programmers and millions of
deployed devices have come tools and emulators of all sorts. The richness of
the development-tool ecosystem for the PalmOS makes the devices prime
candidates for introducing Java-device programming capabilities. That is why
Sun has chosen PalmOS as the reference platform for the K Virtual Machine.
Profiles and configurations
The J2ME profiles/API groupings sit on top of underlying Java runtimes
and provide a certain level of portability and interoperability within classes
of devices targeted at specific markets or vertical industries.
In addition, however, Sun and the J2ME development
community have also seen fit to carefully specify the underlying core
technologies for families of Java-enabled devices in profiles known as configurations.
Configurations are meant to specify the memory and CPU requirements for target
devices as well as for one or more virtual machines (such as the KVM,
PersonalJava VM, Classic VM, and so on) and for core J2ME APIs that may be used
to implement the base J2ME functionality on these devices.
Developers are proposing that configurations become
a part of the Java Community Process (JCP). Back in October 1999, two J2ME
configurations were already under consideration:
·
The
J2ME Connected Device Configuration, for applications requiring
moderate amounts of memory and a midrange CPU, such as those for digital TV
set-top boxes, Internet screenphones, and automotive entertainment and
navigation systems.
·
The
J2ME Connected, Limited Device Configuration, for applications used by
memory-, CPU-, and bandwidth-constrained networked devices such as mobile
phones, pagers, mobile point-of-sale (POS) terminals, and PDAs.
The JCP site has recently posted the first J2ME
application profile: the Mobile Information Device Profile, which
Motorola and several other community members are beginning to work on. This
profile will center on mobile phones and wireless application APIs. The APIs
will be specified so that they can be implemented on devices built to include
support for the J2ME Connected, Limited Device Configuration. (See Resources at the end of this handout for more
information on J2ME configurations and profiles, as well as a link to the JCP
site.)
Always remember that for consumer devices, every
hardware and software decision involves resource considerations and
compromises. Configurations and profiles are an attempt to engineer reasonable
sets of compromises for related families of devices and end user applications.
Keep these Java Specification Requests for
configurations and profiles in mind as Palm devices are being discussed. Palms
are exactly the sorts of devices, along with Net-enabled mobile phones, on
which you will begin to see widespread Java application deployment in the
months ahead.
The Palm platform
The Palm platform consists of the core PalmOS, a set of applications included
with each Palm device, and related hardware and software tools. It is assumed
that readers are either already familiar with the device, its HotSync cradle,
and so on, or willing to browse through the numerous Web sites dedicated to
Palm devices to learn the lingo and read up on Palm-related gadgets. (If you
need to take the latter approach, a good place to start is the Palm Computing
homepage, which is listed in the Resources.)
No discussion of Palm would be complete, however,
without a brief rundown of the Palm devices in use and an attempt to alleviate
some of the confusion over the names of the various generations of devices. Why
has Palm Computing used Pilot, then PalmPilot, and now simply Palm for its
devices? What do other manufacturers of PalmOS-based devices use?
The short of it is this: Palm Computing has released
several generations of devices. Because of some legal issues, first with the
Pilot Pen company and then with Microsoft, Palm Computing has had to carefully
position and reposition their naming structure. (For more information, please
refer to the "What's in a Name -- Is It a Pilot or a Palm?" in the
preface of Palm Programming: The Developer's Guide, available online
for free from the URL in Resources.)
In any event, this handout will refer to all of Palm
Computing's devices, as well as those of the various other companies that have
licensed and used the PalmOS to build their own devices, as Palm
devices. The handout will refer to the PalmOS and its related tools
collectively as the Palm platform.
The generations of Palm Computing's own devices have
so far included:
·
Pilot
1000, Pilot 5000
·
PalmPilot
Personal, PalmPilot Professional
·
Palm
III (in many variations, such as III, IIIe, and so on)
·
Palm
V (with a sleeker case than those of previous generations, plus -- finally -- a
rechargeable battery and recharger built into docking station)
·
Palm
VII (similar in form to the Palm III, but with hardware and software to access
Palm.net wireless Web clipping services)
One gotcha to note here is that the release of a new
generation of Palm devices does not preclude the continuing sale of previous generations.
Palm III, V, and VII series devices are all currently available from Palm
Computing. Users pick the model they want based on features and of course cost.
In general, each new generation of Palm Computing devices has brought an
increase in retail price for the new device along with steadily decreasing
prices for previous generations.
Some other Palm platform-based devices on the
market:
·
IBM
Workpads
·
Symbol
barcode-scanning PDAs
·
QUALCOMM's
pdQ smartphone (which includes a built-in Palm connected organizer and some
custom applications that link the organizer functionality to the phone; you can
tap on phone number to dial a contact, for instance)
·
Handspring's
new line of Visor devices, including the Springboard expansion modules
Handspring is the newest entrant in the Palm arena.
Cofounded by the creator of the Palm platform, Jeff Hawkins, Handspring
announced new PalmOS-based devices, named Visor, in September 1999. This
handout includes some Resources for more information
on Handspring's devices and, in particular, the Springboard expansion modules.
Springboard promises to offer interesting opportunities for enterprising
developers of both hardware and software.
One of the beauties of the Palm platform is that, like
the creators of Java, Palm Computing has expended a lot of effort to ensure the
compatibility of new devices: Palm applications that run on one generation of
devices should (with few exceptions) run unchanged on later generations.
Java-based Palm solutions such as the KVM can therefore run on most Palm
devices -- unchanged. The cross-platform portability of Java is reinforced.
Up and running with the PalmOS Emulator
Even though each new generation of devices costs more than the previous one,
fear not: you need not lay out a single penny to get started with Palm
programming in Java. All the tools you need are available for free from the
Web.
The centerpiece tool is a software emulator known as
the PalmOS Emulator, or POSE. Mimicking a Palm device, POSE is a Win32 Palm
emulator supported by Palm Computing. It is based on an open source emulator
called Copilot, developed by Greg Hewgill and others on the Web.
The core of the Copilot emulator, in fact, is still
available as open source and is a central piece of many other emulators
available on the Web. Though POSE is significantly slower on many machines than
PalmOS running on relatively modest Palm devices, it does give you a lot of
flexibility and debugging features useful in building Palm apps. POSE is used
in this handout, but you should feel free to use another Palm emulator. URLs
for downloading POSE and other emulators are available in Resources
below.
POSE is the only emulator supported by Palm
Computing, so your mileage may vary if you use one of the others. This handout
refers to POSE version 2.1 d29 unless otherwise noted.
When you download and unzip POSE, you will have a
directory containing
·
A
Docs
subdirectory (read through the documentation for more on the original design of
Copilot and the use of POSE)
·
Emulator.exe and Emulator_Profile.exe
-- the actual emulator executables
·
ROM Transfer.prc -- a Palm application that can download the ROM
image from a Palm device for the emulator to use
·
HostControl.h -- a header file that we will not need
You should place POSE in a directory of your choice,
such as C:\Palm\POSE.
There is one remaining requirement: before launching
POSE and develop and load applications into it. You will need a Palm ROM image.
For the Palm platform, the ROM image contains the core of PalmOS. POSE, in
fact, actually emulates the Palm device hardware; it runs the PalmOS loaded
from the ROM image within itself while handling input and output to the POSE
window on your workstation.
Because a Palm ROM image contains the actual PalmOS,
Palm Computing does not bundle a ROM with POSE, but rather tracks its usage
with a separate download, which requires a more intricate license agreement.
Whereas you can click through the POSE license and download the emulator
immediately, you have to agree to a more stringent set of stipulations and wait
for Palm Computing to process your ROM license request before you receive your
ROM image to enable POSE.
Luckily, developers who already own a physical Palm
device have a way around this hassle and delay. You can simply download the ROM
image from your Palm device and use it in POSE. To do this,
1.
Load
Rom Transfer.prc
on your Palm device using Palm Computing's Install tool
2.
Execute
Emulator.exe
3.
Select
the option to download a ROM from the Palm device
4.
Follow
the downloading instructions (select the COM port, speed, and so on) and save
the ROM on your development system
If using your own ROM is so easy, why wouldn't
everyone simply do it? Two reasons:
1.
Not
everyone has a Palm device handy when they want to start using POSE.
2.
Palm
Computing provides a debugging-enabled ROM when you sign its license agreement.
Some POSE debugging features will not be available if you do not use the
debugging ROM from Palm Computing.
This handout is based on using a ROM image from a
Palm VII. Even though a device's ROM is being used, it is still possible to use
many of POSE's debugging features, including its interestingly named Gremlins,
to generate random input. You should try out as many of the POSE debugging
features as you can. If you find you need access to one that does not work
using a device ROM, you can sign the Palm Computing ROM agreement and use the
debugging version.
Note: Several issues may come up when trying to
transfer a ROM image from a Palm VII to a workstation, such as problems with IR
Link as the software used to do infrared HotSyncs. The ROM transfer application
conflicts with IR Link's use of the Palm's communications systems. In the end
you may need to remove IR Link to complete the installation while looking for a
less drastic workaround.
After loading a ROM image into POSE, you can create
a new POSE emulation session and start using the emulator. You can name your
session as you like (e.g., kDemos in reference to some KVM demo apps).
You will note that the new POSE session behaves just
like a new Palm device, as seen in Figure 1. You have to go through the same
pen-based input training and date/time setup. Since most development systems do
not have pen-based input, POSE uses the input from your mouse as if it were the
penlike stylus on a real Palm device.
You may also configure POSE to look like various
Palm devices. A Palm III and a Palm V look are shown in this handout to
illustrate this flexibility, but by loading custom faceplates you can also
configure POSE to look like many whimsical Palm devices or an IBM Workpad (with
a Japanese silkscreen). (You should visit skinz.org from the Resources section to search for POSE faceplates, known on
that site as skins.)
Note: POSE 2.1 d26 seems to have a bug that causes
the Palm V faceplate to display incorrectly. On my development system,
selecting the Palm V look under d26 still resulted in POSE's emulating a Palm
III. Upgrading to POSE 2.1 d29 fixed the problem for me.
You can right-click on the emulator to access its
properties, save sessions, take screenshots (screen only), and turn debugging
features on or off.
Now that you have POSE up and running, it is time to
get a feel for Java on the Palm.
Figure 1. A new POSE session waits to be
used after training and setup are complete.
This example uses the Palm III faceplate in
POSE 2.1 d26.
Loading a sample app: POSE and the preview
KVM
This handout uses the KVM for double duty, both as
an example of how to load and execute a Palm application in POSE and also as an
indicator of how Java performs on small devices like the Palm. We will first
load the KVM into POSE, then load a few sample KVM applications.
The JavaOne preview KVM will run in POSE and Palm
devices provided they use PalmOS version 3.0 or later (equivalent to Palm III
generation devices or later). In the case of this handout, the ROM image loaded
into POSE came from a Palm VI organizer, so the KVM is compatible, no problem.
The preview KVM has been posted to Sun's kvm-interest list; therefore,
it has been archived into the mailing list archives (see the KVM Archive under Resources).
To install the KVM into POSE, you need to
1.
Download
the VM by saving the archived files KJavaVM.prc
and KJavaVM.pdb:
the former is the actual executable; the latter is a Palm database containing
supporting J2ME and Palm-specific class files
2.
Right-click
on your POSE session, select Install Application/Database, select Other..., and
choose KJavaVM.prc
3.
Repeat
step 2, then choose KJavaVM.pdb
4.
Right-click
on POSE and select Reset so that your new applications will show up in the
emulator
Now that you have installed the KVM, it should be
available from the Application launcher in POSE, from the Unfiled menu. In the
case of the POSE session described in this handout, a kDemos menu was created
and moved the KVM and demo apps into that menu.
After installing the KVM itself, as seen in Figure
2, you are ready to install a few Java applications so that you can see simple
examples of Java-enabled graphics and algorithms on devices like the Palm. This
handout shows three applications from the KVM Archive:
·
PalmDuke,
by John Riney III
·
TripleTSZ,
by Scotte Zinn
·
kBioSig,
by Michael Kroll
Figure 2. A little waving Duke icon
represents the JavaOne early preview
KVM, aka KJavaVM, on PalmOS. For
this example, POSE 2.1 d29 was set
to emulate the Palm V look.
Note that the first time you execute the KVM, either
directly or by executing a Java application that uses the KVM (such as the
examples given above), you will need to accept Sun's click-through Source Code
Demonstration License Agreement. The usual caveats apply (read the whole thing,
make sure you understand it, and so on). After that you will see a splash
screen that indicates that the KVM is loading and preparing to execute Java
code, shown in Figure 3.
Figure 3. Duke juggles a little
bit as the KVM loads class files
to begin execution
Figure 4. This screenshot shows
the PalmDuke app running
in KVM on POSE
Figure 4 shows the first of these example
applications: PalmDuke, which demonstrates some simple interactive graphics. In
Figure 5, the second app -- TripleTSZ -- implements tic-tac-toe in Java and
illustrates that you can build all sorts of interesting algorithms using basic
programming know-how and the J2ME core libraries. Finally, a third application
included below is kBioSig -- seen in Figure 6 -- as an example of how Java
programming for the Palm can be used for more serious scientific and business
applications, in this case for a signal-processing application.
Figure 5. You can play
tic-tac-toe with TripleTSZ
Figure 6. kBioSig running in
KVM can display the cosine wave
You are strongly encouraged to download and try out
a number of the other applications in the KVM Archive. Most include source code
and can give you a much better idea of the kinds of things that are becoming
possible using Java and the J2ME on small devices like the Palm.
Additional help
For more in-depth discussions of device programming, please join the
conversation on the Device Programming
discussion on ITworld.com's Java Forum. Also refer to The K
virtual machine and the Palm V, Part 1, Java-device programming FAQ,
mailing list, and KVM Archive.
Discussions
·
Bill
Day's Device Programming discussion on the ITworld.com Community page will help
get you started programming small devices with Java:
http://forums.itworld.com/webx?230@@.ee6b808!skip=50
Related JavaWorld articles
·
"Program
Java devices -- An overview," Bill Day (JavaWorld, July 1999).
http://www.javaworld.com/jw-07-1999/jw-07-device.html
·
"The
K virtual machine and the Palm V, Part 1," Chuck McManis (JavaWorld,
September 1999) outlines the JavaOne preview of the KVM for PalmOS.
http://www.javaworld.com/jw-09-1999/jw-09-kvm.html
Downloads for this handout, including POSE,
alternate emulators, and the KVM
·
Palm
Computing provides a Win32 PalmOS Emulator, nicknamed POSE. Read about and
download POSE.
http://www.palm.com/devzone/pose/pose.html
·
Alternatively,
there are emulators available for several other platforms. Palm Computing lists
the ones of which it is aware.
http://www.palm.com/devzone/pose/pose_thirdparty.html
·
The
KVM Archive provides information on apps and tools written to take advantage of
J2ME and the KVM. Download the JavaOne preview of KVM for PalmOS as well as
public domain KVM applications, many of which include source code.
http://www.billday.com/KVMArchive/
·
Download
various real and fanciful Palm device faceplates. (Search for PalmOS Emu in the
right-hand margin of the Skins listing.)
Palm Computing resources
·
Palm
Computing's DevZone is the metasite for Palm developers. From there you can
link to just about anywhere of interest in the Palm-development universe.
·
Palm
Computing provides an online version of the O'Reilly and Associates book Palm
Programming: The Developer's Guide, by Neil Rhodes and Julie McKeehan, for
free on its developer site. It's an outstanding resource for Java developers
and anyone else targeting PalmOS applications.
http://www.palm.com/devzone/docs/pptdg/TableOfContents.htm
Handspring resources
·
Read
about Handspring's Visor devices in CNN's "Son of Palm" feature.
http://cnn.com/TECH/ptech/9909/13/visor.main
·
A
related CNN article focuses on the Springboard, describing its use as a
software delivery mechanism as well as the more obvious hardware upgrade
capability.
http://cnn.com/TECH/ptech/9909/14/visor.springboard
·
Intrigued
by Springboard? Read up on it in Handspring's developer site.
http://216.35.16.11/developers.html
Other POSE and KVM information
·
Scott
Hommel provides a basic set of instructions for getting started with POSE and
the KVM.
http://java.sun.com/people/shommel/KVM/index.html
J2ME resources
·
The
J2ME Connected, Limited Device Configuration (JSR-000030) documents the
resources requirements for small Java-enabled networked consumer devices. This
proposal would specify interfaces and VM features for the J2ME core for such
devices. One or more profiles would then be implemented on top of this
configuration to build a Java-enabled device such as a PDA or the pdQ
smartphone.
http://java.sun.com/jcp/jsr/jsr_030_j2melc.html
·
The
J2ME Connected Device Configuration (JSR-000036) proposes a similar
specification for consumer devices with somewhat more memory, a bigger CPU, and
related resources. The larger footprints are targeted at different applications
such as digital television and automobile entertainment.
http://java.sun.com/jcp/jsr/jsr_036_j2mecd.html
·
Mobile
Information Device Profile for J2ME (JSR-000037) proposes a specification for
wireless-device APIs. It is expected that this profile will be implemented on
top of the Connected, Limited Device Configuration.
http://java.sun.com/jcp/jsr/jsr_037_mid.html
·
Watch
the Java Community Process site for J2ME-related configurations and profiles.
http://java.sun.com/jcp/
·
Still
not clear on the various components of the J2ME? Please refer to my technical
overview. It describes how configurations and profiles relate to the J2ME and
discusses the KVM, PersonalJava, Java in several prominent vertical markets
(telephony, digital television, and automotive), Java Card, and Embedded Java.
http://www.billday.com/Work/J2ME/
Bill Day's Java Device Programming resources
·
The
Java Device Programming FAQ has answers to many of your
nagging questions. Not in the FAQ? Please email Bill your questions.
http://www.billday.com/Work/devicefaq.txt
·
Download
the complete Device and Media Programming code archive from the Resources
section of Bill's Web site. Also contains links to previous columns and related
materials.
http://www.billday.com/Work/index.html#Column