Upload
caraafim51
View
221
Download
0
Embed Size (px)
Citation preview
8/3/2019 Programando_Symbian_Aula_2
1/15
Program ando para Sym bian OSS60 Plat form SDK s for Sym bian OS , for C++
Diego Mendes Rodrigues ([email protected])
01 Setembro/2007
Aula2
Conhecendo o SDK e c ompi landoo program a Hel loWor ld
Objetivo da aula:Propiciar ao leitor uma viso geral do SDK (S60 Platform SDKs for Symbian OS , for
C++) e demonstrar o processo de compilao do programa HelloWorld atravs da linhade comando e sua execuo no emulador. Depois do programa testado no emulador,
ainda ser demonstrado como gerar um arquivo de instalao (.sis/.sisx) e como
tranferir esse arquivo para um dispositivo (Nokia E61).
Tpicos abordados: Conhecendo o SDK Ferramentas de desenvolvimento para Symbian OS Processo de compilao na linha de comando Conhecendo o Emulador e testando o HelloWorld Gerando arquivos de Instalao .SIS/.SISX
8/3/2019 Programando_Symbian_Aula_2
2/15
drSo lu t ions Tecno log ia e In fo rmt ic a L tda (d rso lu t ions.com.br )
Diego Mendes Rodrigues
2/15
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:
8/3/2019 Programando_Symbian_Aula_2
3/15
drSo lu t ions Tecno log ia e In fo rmt ic a L tda (d rso lu t ions.com.br )
Diego Mendes Rodrigues
3/15
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 diretrios 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.
8/3/2019 Programando_Symbian_Aula_2
4/15
drSo lu t ions Tecno log ia e In fo rmt ic a L tda (d rso lu t ions.com.br )
Diego Mendes Rodrigues
4/15
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 theROM 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 buildyour project - build output files such as .exe or .dll are
8/3/2019 Programando_Symbian_Aula_2
5/15
drSo lu t ions Tecno log ia e In fo rmt ic a L tda (d rso lu t ions.com.br )
Diego Mendes Rodrigues
5/15
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
filebld.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 HelpCompiler. cshlpcmp_gui is a GUI for this compiler (not used in S60).
8/3/2019 Programando_Symbian_Aula_2
6/15
drSo lu t ions Tecno log ia e In fo rmt ic a L tda (d rso lu t ions.com.br )
Diego Mendes Rodrigues
6/15
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 asmakesis 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 theproject, 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 convertsexecutables 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 tericos
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.
8/3/2019 Programando_Symbian_Aula_2
7/15
drSo lu t ions Tecno log ia e In fo rmt ic a L tda (d rso lu t ions.com.br )
Diego Mendes Rodrigues
7/15
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.
3.2. Compilando (aplicando a teoria)
Abra o Prompt de comando do Windows no diretrio:
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).
bld.inf
projectfile.mnp
Arquivos Fonte
(.cpp)
> bldmake bldfiles
> abld build winscw udeb
Arquivos Intermedirios de
compilao em:
\epoc32\build\
ABDL.BAT em:
Arquivos Intermedirios em:
\epoc32\build\
Arquivos Binrios em:
\epoc32\release\winscw\udeb\
ENTRADAS COMANDOS SADAS
8/3/2019 Programando_Symbian_Aula_2
8/15
drSo lu t ions Tecno log ia e In fo rmt ic a L tda (d rso lu t ions.com.br )
Diego Mendes Rodrigues
8/15
Agora voc deve gerar o arquivo abld.bat. Esse procedimento automatizado com o
comando bldmake bldfiles.
8/3/2019 Programando_Symbian_Aula_2
9/15
drSo lu t ions Tecno log ia e In fo rmt ic a L tda (d rso lu t ions.com.br )
Diego Mendes Rodrigues
9/15
Agora o leitor gerou o ABLD.BAT, j possvel 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 binrio 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, parabns! Voc compilou o seu primeiro programa para Symbian!
8/3/2019 Programando_Symbian_Aula_2
10/15
drSo lu t ions Tecno log ia e In fo rmt ic a L tda (d rso lu t ions.com.br )
Diego Mendes Rodrigues
10/15
Os arquivos intermedirios resultantes do processo de compilao foram armazenados
dentro do diretrio:
C:\Symbian\9.2\S60_3rd_FP1\Epoc32\BUILD\Symbian\9.2\S60_3rd_FP1\S60Ex\Hell
oWorldBasic\
O arquivo binrio resultado da compilao (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.
8/3/2019 Programando_Symbian_Aula_2
11/15
drSo lu t ions Tecno log ia e In fo rmt ic a L tda (d rso lu t ions.com.br )
Diego Mendes Rodrigues
11/15
Asdsad
Sadsad
Asdmnsakd
Sadksad
Saldksa
group\bld.inf
group\
helloworldbasic.mmp
Arquivos Fonte:
src\helloworldbasic.cpp
.
helloworldbasicquerydialog.cpp
inc\
helloworldbasic.h
.
helloworldbasicquerydialog.h
.
> bldmake bldfiles
> abld build winscw udeb
Arqs. Interm. de compilao em:C:\Symbian\9.2\S60_3rd_FP1\Epo
c32\BUILD\Symbian\9.2\S60_3rd_
FP1\S60Ex\HelloWorldBasic\
ABDL.BAT em:
C:\Symbian\9.2\S60_3rd_FP1\S60
Ex\HelloWorldBasic\group
Arquivos Intermedirios em:
C:\Symbian\9.2\S60_3rd_FP1\Epo
c32\BUILD\Symbian\9.2\S60_3rd_
FP1\S60Ex\HelloWorldBasic\
Arquivos Binrios em:
C:\Symbian\9.2\S60_3rd_FP1\Epo
c32\release\winscw\udeb
ENTRADAS COMANDOS SADAS
8/3/2019 Programando_Symbian_Aula_2
12/15
drSo lu t ions Tecno log ia e In fo rmt ic a L tda (d rso lu t ions.com.br )
Diego Mendes Rodrigues
12/15
4. Rodando o HelloWorld no Emulador
Existem vrias maneiras de usarmos o emulador. A mais trivial delas atravs do menu
Iniciar do windows, seguindo a seqncia Inciar Todos os Programas S60
Developer Tools 3rd Edition FP1 SDK 1.0 Emulator
Observao:O emulador demora
vrios segundos para
inicializar!
8/3/2019 Programando_Symbian_Aula_2
13/15
drSo lu t ions Tecno log ia e In fo rmt ic a L tda (d rso lu t ions.com.br )
Diego Mendes Rodrigues
13/15
Voc pode tambm abrir o emulador digitando epoc na linha de comando:
4.1. Acessando o HelloWorld atravs dos controles doemulador
Todas as aplicaes instaladas no emulador ficam dentro da pasta Instaled.
Para navegar peloemulador use os
botes da interface!
8/3/2019 Programando_Symbian_Aula_2
14/15
drSo lu t ions Tecno log ia e In fo rmt ic a L tda (d rso lu t ions.com.br )
Diego Mendes Rodrigues
14/15
m sistema operacional criado para rodar embarcado em dispositivos mveis
"multimdia" com suporte cmeras fotogrficas, MMS, wireless, bluetooth, Wi-Fi
dentre outras funes.
Este sistema operacional predominantemente baseado em um ambiente grfico
bastante simples. Atualmente ele utilizado na maioria dos recentes modelos de
telefones celulares dos grandes fabricantes.
A grande preocupao do Symbian OS evitar ao mximo o desperdcio de recursos do
celular, como bateria e memria. Para isso ele conta com diversos mecanismos que so
eficientes ao tratar desses problemas. Em sua verso mais nova 9.5, foi reduzido o
consumo de memria em 30% em relao verso anterior. Atualmente o Symbian
lidera como sendo o SO mais utilizado em smartphones, a frente do Linux, Windows
Mobile e outros concorrentes.
Finalmente, o
HelloWorld!
8/3/2019 Programando_Symbian_Aula_2
15/15
drSo lu t ions Tecno log ia e In fo rmt ic a L tda (d rso lu t ions.com.br )
Diego Mendes Rodrigues
15/15
Correes e atualizaes desse documento estaro disponveis em:http://www.drsolutions.com.br/programando_symbian