Communicator: Tutorial 1 – On Device Programming

  • By admin
  • November 21, 2003
  • Comments Off on Communicator: Tutorial 1 – On Device Programming

Posted by: Arjen
Posted: Sep 6 2005, 02:05 AM

Introduction
If you want to program OPL, there are two ways of doing it:
– On a PC
– On the device itself.
This tutorial discusses the second, most convenient, method, since you can immediately see and test the results if you program directly on the device. But, the biggest problem starting OPL programmers face is getting all the stuff necessary for programming, since the resources seem to be scattered all over the internet. As you will see from this tutorial it’s not all that bad. I’ll explain, in a few easy steps, where to get the necessary files and what files to install where in order to get started on programming. All the steps described in this tutorial are valid for programming on a Nokia 9210(i) as well as for the new range of Communicators (9300/9500).

Get the OPL developers pack
To start programming you need the OPL developers package, which can be downloaded from the OPL pages at sourceforge net (direct link to download). The size of this file is about 1.36MB. Although the filename is 9200-OPL-DevPack, it can be used on a 9300/9500 as well. For the moment, this is the only file you need to start development on your Communicator.

Extracting the needed files
After downloading this file, unzip it to a temporary folder on your PC’s harddisk (make sure you select “Use folder names” in WinZip so the files are extracted to the correct folders).

A lot of the files in the developer package are needed for OPL development on a PC. But, for this kind of development, you also need to have the 9210 or S80 SDK installed (which is a 200 to 300Mb download). Since this tutorial only focusses on programming on the device itself, we can delete all the PC related stuff:
The OPL developers package contains two folders: \Binaries\ and \Examplesrc\. In the \Binaries\ folder you’ll find the folder SisFiles\. The \Binaries\, SisFiles\ and \Examplesrc folders also contain a folder called Pc\. Since we don’t need any of the files in these Pc\ folders it’s ok to completely delete all of them.

Installing the OPL runtime
If you do not have the OPL runtime installed yet, you need to install it first.
There’s a small snag here. The OPL developers package only contains the OPL runtime for the Nokia 9210. If you want to develop OPL on a Nokia 9300/9500 you need to install the runtime for the 9300/9500 which you need to download first (direct link to download).

To install the OPL runtime on a Nokia 9210, install the file \Binaries\Target\Other\OPL.sis to your Communicator.
To install the OPL runtime on a Nokia 9300/9500, download the runtime from the above link, extract it to a temporary folder and install the file 9500-opl-public-2004-11-28.sis to your Communicator.

It is recommended to install the OPL runtime on your MMC card.

If you want to verify if the OPL installation works correctly, you can install \Binaries\Target\Other\DemoOPL.sis. After installation of this file you should see a new program in Extras (9210) or Desk (9300/9500). If you can start and run this program, the OPL runtime is installed correctly.

Installing the OPL program editor
All development on the Communicator is done with the OPL editor. The name of this application is “Program” and can be installed (both for 9210 and 9300/9500) from the folder \Binaries\SIS Files\Target\Other\OPLDev.sis.

Installing OPX’s and header files
With the installation of the OPL program editor, three OPX’s (OPL extension libraries written in C++) were installed as well in the \System\OPX\ folder (AppFrame.opx, SendAs.opx and System.opx). To be able to use these OPX libraries in your OPL program, you need a header file which describes the exported functions in this OPX. The extension of these header files is .OXH. Header files are always installed in \System\OPL\ (you can already find AppInfo.oxh, SendAs.oxh and System.oxh in this folder).

The OPL developer package contains a lot more OPX’s that you can use for OPL programming. It’s easiest to install them all. They take up very little disk space and once you need them it’s very convenient to have them installed already.

To install the OPX’s, install all SIS files from the \Binaries\SIS Files\Target\OPX\ to your Communicator (preferrably on the same drive you installed the OPL runtime on). Of course you don’t need to reinstall AppFrame.opx, SendAs.opx and System.opx.

After this copy all the header files for these OPX’s in the \System\OPL\ folder on the same drive you installed the OPX files. The header files for all OPX’s can be found in \ExampleSrc\Target\System\OPL\.

After this, you’re ready to the “Program” application and start developing your OPL applications on your Communicator.

Next steps
The next tutorial will explain how to write a basic OPL application (we will write a small game from scratch). It will cover the following topics:
– basic application framework (using AppFrame.opx)
– handling events
– creating application bitmaps
– packaging and distributing your application

Categories: Uncategorized