Programmer une application pour palm

    Il existe tout une série de language de programmation que l'on peut utiliser pour le palm C/C++, Java, Pascal, Basic, Python, Forth, Scheme, Smalltalk, CASL, and assembly language. Dans le cas de ce projet, le language C était le plus adapté avec quelques parties en assembleur pour ce qui touche directement le hardware.

Pourquoi programmer pour Palm OS est différent ?

    Ecrire une application pour un PDA et spécifiquement pour une plateforme Palm OS est un peu différent d'une application pour un PC car les plateformes Palm OS sont concue différemment. Il suffit de voir la différence concernant les interactions avec l'utilisateur par rapport à un PC.

- Taille de l'écran
    L'écran du palm a une résolution de 160x160 pixels, donc la quantité d'information affichable est limitée. Pour cette raison, il faut concevoir les interfaces utilisateurs conciencieusement et avec des objectifs et de priorités différentes par rapport au écran habituel.
- Rapidité de réponse
    Sur un PC, les utilisateurs sont prêt à attendre quelques secondes pour le chargement d'une application car ils utiliseront cette application durant un certain temps. Par contre, la plupart des utilisateurs de palm utilise une application entre 15 à 20 fois par jour pendant des périodes beaucoup plus brèves, habituellement quelques secondes. La rapidité est donc un objectif essentiel dans la conception d'application palm. Le temps total nécéssaire pour naviguer, séléctionner et exécuter des commandes a un impact important sur la qualité d'une application.

- Connectivité avec le PC
    La connection au PC est un composant entier d'une plateforme Palm OS. Le PDA viens avec un berceau (cradle) pour se connecter au PC et avec le programme pour le PC qui fournit en un seul bouton le backup et la synchronisation de toutes les données entre le PDA et le PC. La plupart des applications Palm OS ont une application correspondante sur le PC. Pour partager les données entre l'application sur le PDA et le PC, il faut écrire un "conduit". Un conduit est un plug-in pour la technologie HotSync® qui démarre quand on presse le bouton HotSync. Un conduit synchronise les données entre les applications du PDA et du PC

- Méthodes d'entrée
    Les utilisateur de Palm n'ont pas de clavier ou de souris, ils utilisent un crayon pour entrer les données. Ils peuvent aussi soit écrire dans la zone Graffiti ® ou utiliser la boite de dialogue du clavier fournit avec le Palm.

- Puissance
    Les plateformes Palm OS utilisent des batteries et n'ont donc pas la meme puissance de calcul qu'un PC. Le but est d'avoir fournir une vue portable des informations correspondantes aux applications du PC. Si on veut une application qui effectue une tache de calcul intense, il vaut mieu l'implémenter sur l'application PC au lieu de l'application Palm si c'est possible.

- Mémoire
    Les machines Palm OS ont une capacité de stockage limité. Les machines ont entre 512K et 8Mb de mémoire disponible. A cause de cette limitation d'espace et de puissance, l'optimisation est indispensable. Pour avoir une application aussi rapide et efficace que possible, il est conseillé d'optimiser dans l'ordre, l'espace mémoire, la rapidité et la taille du code.

- Système de fichier
    A cause de l'espace de stockage limité et pour rendre la synchronisation avec le PC plus efficace, Palm OS n'utilise pas un système de fichier traditionnel. Les données sont enregistrée dans des gros morceau de mémoire (chunks) appelé enregistrement (records), qui sont groupé en bases de données (databases). Une database est analogue à un fichier. La différence est que les données sont découpée en plusieurs records au lieu d'etre enregistrer dans un espace contigu. Pour gagner de l'espace, on édite une database directemnet en mémoire au lieu de la créer en RAM et puis de la recopier pour l'enregistrer.

- Compatibilité
    Différentes version de platforme Palm OS sont disponible, chacune possèdent une version différente de Palm OS. Les mises à jour de l'OS sont concue de telle manière qu'il est soit facile de garder une compatibilité avec les anciennes versions.

Concepts de programmation Palm OS


Palm OS Programming Concepts

Palm OS applications are generally single-threaded, event-driven programs. Only one program runs at a time. To successfully build a Palm OS application, you have to understand how the system itself is structured and how to structure your application.

Each application has a PilotMain function that is equivalent to main in C programs. To launch an application, the system calls PilotMain and sends it a launch code . The launch code may specify that the application is to become active and display its user interface (called a normal launch), or it may specify that the application should simply perform a small task and exit without displaying its user interface.

The sole purpose of the PilotMain function is to receive launch codes and respond to them. (See Chapter 3, "Application Startup and Stop.")

Palm OS is an event-based operating system, so Palm OS applications contain an event loop; however, this event loop is only started in response to the normal launch. Your application may perform work outside the event loop in response to other launch codes. Chapter 4, "Event Loop," describes the main event loop.

Most Palm OS applications contain a user interface made up of forms , which are analogous to windows in a desktop application. The user interface may contain both predefined UI elements (sometimes referred to as UI objects ), and custom UI elements. (See Chapter 5, "User Interface.")

All applications should use the memory and data management facilities provided by the system. (See Chapter 6, "Memory." and Chapter 7, "Files and Databases.")

You implement an application's features by calling Palm OS functions. Palm OS consists of several managers, which are groups of functions that work together to implement a feature. As a rule, all functions that belong to one manager use the same prefix and work together to implement a certain aspect of functionality.

Managers are available to, for example, generate sounds, send alarms, perform network communication, and beam information through an infrared port. A good way to find out the capabilities of the Palm OS is to scan the Table of Contents of this guide.


IMPORTANT: The ANSI C libraries are not part of the Palm development platform. In many cases, you can perform the same function using a Palm OS API call as you can with a call to a ANSI C function. For example, the Palm OS provides a string manager that performs many of the string functions you'd expect to be able to perform in an ANSI C program. If you do use a standard C function, the code for the function is linked into your application and results in a bigger executable.

Programming Tools

Several tools are available that help you build, test, and debug Palm OS applications. The most widely used tool is the CodeWarrior Interactive Development Environment (IDE). Documentation for the CodeWarrior IDE is provided with CodeWarrior. (See http://www.palmos.com/dev/tech/tools/ for information about other development tools.)

As with most applications, the user interface is generally stored in one or more resource files. You use the Palm OS Constructor to create these resources. To learn how, refer to the Constructor documentation.

To debug and test your application, there are several tools available:

The CodeWarrior Debugger handles source-level debugging. You can use it with an application running on the Palm OS device, or you can use it in conjunction with one of the other debugging tools below.

The Palm OS Emulator (POSE) tests your application on the desktop computer before downloading it onto the device.

On the Macintosh, you can build a Simulator version of your application to test it. This is a standalone Mac OS application that runs your Palm OS application on a Macintosh computer.

The Palm Debugger is an assembly-level tool. You can also use it to enter commands directly to the Palm device.

The book Palm OS Programming Development Tools Guide describes the Palm-provided debugging tools available on your development platform. For CodeWarrior Debugger documentation, refer to the CodeWarrior CD.



2) Les outils

PRC-Tools (a.k.a. GCC) is a free suite of tools built around the GNU Project's GCC toolchain. PRC-Tools runs on 32-bit Windows and Linux/Unix, and I've heard that there is a port to Mac OS X under way. If you've programmed with command-line compilers and debuggers before, you won't have any trouble with PRC-Tools. There are also several GUI IDEs available for PRC-Tools.

I think everyone should at least try PRC-Tools, since it's free and is capable of building any type of Palm application. To that end, there's a FAQ article that tells you how to get started with PRC-Tools.



3) Exemples