Programando para Symbian OS - S60 Platform SDKs for Symbian OS , for C++

Page created by Manuel Webb
 
CONTINUE READING
Programando para Symbian OS - S60 Platform SDKs for Symbian OS , for C++
Programando para Symbian OS
S60 Platform SDKs for Symbian OS , for C++
                              Diego Mendes Rodrigues (diego@drsolutions.com.br)
                                                             01 Setembro/2007

                                  Aula2
                Conhecendo o SDK e compilando
                    o programa HelloWorld

Objetivo da aula:
Propiciar ao leitor uma visão geral do SDK (S60 Platform SDKs for Symbian OS , for
C++) e demonstrar o processo de compilação do programa HelloWorld através da linha
de comando e sua execução no emulador. Depois do programa testado no emulador,
ainda será demonstrado como gerar um arquivo de instalação (.sis/.sisx) e como
tranferir esse arquivo para um dispositivo (Nokia E61).

Tópicos abordados:
   • Conhecendo o SDK
   • Ferramentas de desenvolvimento para Symbian OS
   • Processo de compilação na linha de comando
   • Conhecendo o Emulador e testando o HelloWorld
   • Gerando arquivos de Instalação .SIS/.SISX
Programando para Symbian OS - S60 Platform SDKs for Symbian OS , for C++
1. Symbian OS - Plataforma S60 x UIQ
Symbian OS has a flexible architecture which allows different mobile phone platforms
to run on top of the core operating system. The two most widely of used of these are
S60 (formerly known as Series 60) and UIQ, which are both discussed in this tutorial.

Platforms provides a graphical user interface (GUI) framework, applications which use
it, such as messaging or calendar, and can supply additional application and middleware
services.

The platforms are said to be open because, in addition to these built-in applications, a
user may additionally install others such as games, enterprise applications, like push e-
mail, or utilities. This tutorial explains the process of creating such distributable
applications.

1.1. Plataforma Series 60 (S60)

The Nokia S60 platform is used in the majority of Symbian OS smartphones shipped to
date. Although owned by Nokia, it is also licensed to other handset manufacturers such
as Panasonic, Samsung and Siemens.

S60 has been designed for easy one-handed use. It does not have a touch screen but
instead has various input keys, including two soft keys, a five-way navigator pad (4
ways plus a centre selection button), the number keys and several dedicated keys such
as the menu key.

When programming for S60, since there is no touch screen, pointer events are not
supported. Another consequence of having no touch screen input is that developer
should consider the type of user input required. For example, in some situations it may
be appropriate to replace a text entry box with a pre-filled list, from which a selection
can be made.

1.2. Plataforma UIQ

The UIQ Platform is owned by UIQ Technology AB – a wholly-owned subsidiary of
Symbian Ltd. The platform originates from a Symbian reference design and is licensed
to several handset manufacturers, such as Sony Ericsson, Motorola, BenQ and Arima.

UIQ supports both keypad and touchscreen input (through virtual keyboard,
handwriting recognition or interaction with typical UI controls). It can be configured
with respect to touch/non-touch screens, screen size, the use of a menu bar or the use of
soft keys.

2. Conhecendo o SDK
The key elements of an SDK are:
drSolutions Tecnologia e Informática Ltda (drsolutions.com.br)                        2/15
Diego Mendes Rodrigues
Programando para Symbian OS - S60 Platform SDKs for Symbian OS , for C++
a Windows-based emulation of a phone. Programs are initially developed and tested on
the emulator.

header files and binary library files both for emulator development and for running the
code on real ARM processor-based phones

a GCC-based compiler for building for ARM-based targets

additional tools for building and application deployment

documentation (the Symbian OS Library) and examples

2.1. Estrutura de diretórios do SDK

Asdsadasd
Asds

Sadas
Asdd

epoc32\: binaries and tools to support development, including emulator files, libraries,
header files, and tools. The form of this directory is explained in detail in the following
table.

Documentation\: On UIQ SDKs, Symbian OS and UIQ documentation.

drSolutions Tecnologia e Informática Ltda (drsolutions.com.br)                        3/15
Diego Mendes Rodrigues
examples\: generic Symbian OS example code. On UIQ SDKs, UIQ specific examples
are contained in examples\UIQ.

S60Doc: On S60 SDKs, S60 and Symbian OS documentation.

S60Ex: On S60 SDKs, S60 example programs

         Directory         Description
         BUILD             Intermediate build files (makefiles, object code, project
                           browsing information). This directory is created when a
                           project is built.
         data              Emulator configuration files. The files stored under the z
                           subdirectory are combined with the
                           \epoc32\release\winscw\udeb\z or
                           \epoc32\release\winscw\urel\z directory to make up the
                           ROM drive for the emulator. See \release\ for more
                           information.
         gcc               GNU GCC toolchain required for various build utilities (this
                           is not however the compiler now used for building application
                           code).
         include           UIQ or S60 and Symbian OS C++ system include files.
         localisation Localisable files.

         release           This is where the executables will be placed when you build
                           your project - build output files such as .exe or .dll are

drSolutions Tecnologia e Informática Ltda (drsolutions.com.br)                          4/15
Diego Mendes Rodrigues
stored here. The directory has sub-directories for each build
                           target. The armv5 and gcce directories contain files for ARM
                           targets and winscw contains build output for the emulator.
                           Each directory will have subdirectories for debug (udeb), and
                           release (urel) builds.

                           For emulator build targets, under udeb and urel there will be
                           a subdirectory called z which contains the contents of the
                           ROM drive for the emulator.

                           For phone build targets, the release directory is used to store
                           the executables before they are packaged into an install file
                           for installation onto a phone.
         tools             Windows-based SDK tools such as batch files, perl scripts,
                           Windows, DOS and Java executables.
         winscw            The emulated drives of the emulator (C:\ etc) are stored
                           under here.

2.2. Ferramentas de desenvolvimento do SDK

Asdsa

The kits supply tools that allow projects to be built from the command line. This is not
as easy as using the IDE to control a build, but it does allow for building from batch
processes, such as automatic build and test scripts. The following table summarises the
command line tools, most of which will be discussed further in the Building, debugging
and deploying an application section of this tutorial.

Tool           Description
abld           Build tool used to control all aspects of building a project. It is created in
               the current directory by the bldmake tool from a component description
               file—bld.inf. For a command line reference, see the abld command
               syntax. abld invokes the resource compiler and bitmap converter,
               described below.
bldmake        Build tool that processes the component description file (bld.inf) in the
               current directory and generates the batch file abld and several build
               batch makefiles (.make). For command line reference, see the Bldmake
               command syntax.
bmconv         Bitmap converter that takes one or more Windows bitmap files (.bmp)
               and generates a single Symbian OS multi-bitmap file (.mbm). For
               command line syntax, see the Bitmap converter syntax.
cshlpcmp       Context sensitive help compiler that builds .hlp help files using
               information defined in a project file, .rtf source file or files, and an
               optional customisation file. For command line reference, see the CS Help
               Compiler. cshlpcmp_gui is a GUI for this compiler (not used in S60).

drSolutions Tecnologia e Informática Ltda (drsolutions.com.br)                           5/15
Diego Mendes Rodrigues
epocrc         Combines the actions of passing a resource file through the C++
               preprocessor, and then compiling it with rcomp. For command line
               reference, see Resource builder tool: epocrc.
createSIS The createSIS tool creates and signs software installation packages (SIS
               files). It provides a wrapper around lower level installation tools such as
               makesis and makekeys.
makeSIS        Installation File Generator that creates software installation packages
               based on source PC/target Symbian OS file locations defined in a .pkg
               package file. For command line reference, see the Installation File
               Generator syntax.
makekeys       Certification Generator that creates a private/public key pair and issues
               certificate requests. For a command line reference, see the Certification
               Generator syntax.
makmake        Build tool that takes a .mmp project file which lists the components of the
               project, and produces a makefile. Uses GNU cpp to evaluate
               dependencies. Generated headers from resource compilation and multi-
               bitmap compilation, etc., should be available before makmake is run. For
               a command line reference, see the makmake command syntax.
petran         For Portable Executable Translation. The petran tool converts
               executables from Portable Executable format (the standard format for
               executable and object files) to the Symbian OS executable format. It is
               invoked at the final stage of the build process for ARM targets.
rcomp          Resource compiler that compiles source (.rss) resource files into a
               resource data file (default extension .rsc) which can be used by
               applications, and a resource header file (.rsg). The operation of the
               resource compiler is usually wrapped in an abld batch file. For command
               line reference, see the Resource compiler syntax.

Asdsad

3. Compilando o HelloWorld

3.1. Conceitos teóricos

You can build for any target from the command line once you have a component
definition file (bld.inf) and project definition file (mmp file). Firstly, run bldmake from
the project directory (usually \group) where the bld.inf file is located:

> bldmake bldfiles

This creates a batch file, called abld.bat, which you use in the next step.

drSolutions Tecnologia e Informática Ltda (drsolutions.com.br)                         6/15
Diego Mendes Rodrigues
To build the project, you call abld build which will build the project for all default
targets in both release and debug variants. To build for a particular target and variant,
use abld build target-name variant, for example:

> abld build winscw udeb

builds the project for the debug variant of WINSCW only.

  ENTRADAS                         COMANDOS                                         SAÍDAS

      bld.inf                 > bldmake bldfiles                    Arquivos Intermediários de
                                                                         compilação em:
                                                                 \epoc32\build\

  projectfile.mnp                                                       ABDL.BAT em:
                                                                       
 Arquivos Fonte
     (.cpp)                                                        Arquivos Intermediários em:
                                                                 \epoc32\build\
                              > abld build winscw udeb
                                                                     Arquivos Binários em:
                                                                  \epoc32\release\winscw\udeb\

3.2. Compilando (aplicando a teoria)

Abra o Prompt de comando do Windows no diretório:
 “C:\Symbian\9.2\S60_3rd_FP1\S60Ex\HelloWorldBasic\group”
(espero que o leitor tenha instalado o Power Toy sugerido no final da Aula 1).

drSolutions Tecnologia e Informática Ltda (drsolutions.com.br)                               7/15
Diego Mendes Rodrigues
Agora você deve gerar o arquivo “abld.bat”. Esse procedimento é automatizado com o
comando “bldmake bldfiles”.

drSolutions Tecnologia e Informática Ltda (drsolutions.com.br)               8/15
Diego Mendes Rodrigues
Agora o leitor gerou o ABLD.BAT, já é possível compilar o programa para ser testado
no emulador. Nesse caso dizemos que o “alvo” do programa é o WINSCW, que nada
mais é que a pasta raiz do sistema de arquivos do emulador.

Para gerar o arquivo binário que pode ser executado no emulador, execute o comando
“abld build winscw udeb”.

Muita coisa deve aparecer na sua tela. Se o resultado final for algo como mostrado na
figura abaixo, parabéns! Você compilou o seu primeiro programa para Symbian!

drSolutions Tecnologia e Informática Ltda (drsolutions.com.br)                  9/15
Diego Mendes Rodrigues
Os arquivos intermediários resultantes do processo de compilação foram armazenados
dentro do diretório:
“C:\Symbian\9.2\S60_3rd_FP1\Epoc32\BUILD\Symbian\9.2\S60_3rd_FP1\S60Ex\Hell
oWorldBasic\”

O arquivo binário resultado da compilação (HelloWorldBasic.exe) foi automaticamente
colocado dentro da pasta “C:\Symbian\9.2\S60_3rd_FP1\Epoc32\release\winscw\udeb”
para que possa ser executado no emulador.

drSolutions Tecnologia e Informática Ltda (drsolutions.com.br)               10/15
Diego Mendes Rodrigues
Asdsad
Sadsad

  ENTRADAS                               COMANDOS                                    SAÍDAS

 group\                             > bldmake bldfiles            Arqs. Interm. de compilação em:
   bld.inf                                                       C:\Symbian\9.2\S60_3rd_FP1\Epo
                                                                 c32\BUILD\Symbian\9.2\S60_3rd_
                                                                   FP1\S60Ex\HelloWorldBasic\

 group\
  helloworldbasic.mmp                                                   ABDL.BAT em:
                                                                 C:\Symbian\9.2\S60_3rd_FP1\S60
                                                                    Ex\HelloWorldBasic\group

 Arquivos Fonte:
 src\                                                               Arquivos Intermediários em:
  helloworldbasic.cpp                                            C:\Symbian\9.2\S60_3rd_FP1\Epo
  ….                                                             c32\BUILD\Symbian\9.2\S60_3rd_
   helloworldbasicquerydialog.cpp                                  FP1\S60Ex\HelloWorldBasic\
 inc\
  helloworldbasic.h                 > abld build winscw udeb
  ….
  helloworldbasicquerydialog.h                                        Arquivos Binários em:
 ….                                                              C:\Symbian\9.2\S60_3rd_FP1\Epo
                                                                     c32\release\winscw\udeb

Asdmnsakd
Sadçksadç
Saçldkçsa

drSolutions Tecnologia e Informática Ltda (drsolutions.com.br)                              11/15
Diego Mendes Rodrigues
4. Rodando o HelloWorld no Emulador
Existem várias maneiras de usarmos o emulador. A mais trivial delas é através do menu
Iniciar do windows, seguindo a seqüência Inciar Î Todos os Programas Î S60
Developer Tools Î 3rd Edition FP1 SDK Î 1.0 Î Emulator

                                    Observação:
                                    O emulador demora
                                    vários segundos para
                                    inicializar!

drSolutions Tecnologia e Informática Ltda (drsolutions.com.br)                 12/15
Diego Mendes Rodrigues
Você pode também abrir o emulador digitando “epoc” na linha de comando:

4.1. Acessando o HelloWorld através dos controles do
emulador

Todas as aplicações instaladas no emulador ficam dentro da pasta “Instaled”.

    Para navegar pelo
     emulador use os
   botões da interface!

drSolutions Tecnologia e Informática Ltda (drsolutions.com.br)                 13/15
Diego Mendes Rodrigues
Finalmente, o
                                      HelloWorld!

m sistema operacional criado para rodar embarcado em dispositivos móveis
"multimídia" com suporte à câmeras fotográficas, MMS, wireless, bluetooth, Wi-Fi
dentre outras funções.

Este sistema operacional é predominantemente baseado em um ambiente gráfico
bastante simples. Atualmente ele é utilizado na maioria dos recentes modelos de
telefones celulares dos grandes fabricantes.

A grande preocupação do Symbian OS é evitar ao máximo o desperdício de recursos do
celular, como bateria e memória. Para isso ele conta com diversos mecanismos que são
eficientes ao tratar desses problemas. Em sua versão mais nova 9.5, foi reduzido o
consumo de memória em 30% em relação à versão anterior. Atualmente o Symbian
lidera como sendo o SO mais utilizado em smartphones, a frente do Linux, Windows
Mobile e outros concorrentes.

drSolutions Tecnologia e Informática Ltda (drsolutions.com.br)                14/15
Diego Mendes Rodrigues
Correções e atualizações desse documento estarão disponíveis em:
http://www.drsolutions.com.br/programando_symbian

drSolutions Tecnologia e Informática Ltda (drsolutions.com.br)     15/15
Diego Mendes Rodrigues
You can also read