Symbian development tutorial

Source: Internet
Author: User
Tags bmp image

Symbian development tutorial

Luo chaohui (floating white clouds) 2009.07.09

Http://www.cppblog.com/kesalin

(Indicate the author and source when reprinting. Do not use it for commercial purposes without permission)

Directory:
I. Environment Configuration
2. Project Settings
3. Development Process
4. Reference Books

I. Environment Configuration
1. Download development tools

Development Environment selection of jdk1.5 + ActivePerl-5.6 + s60_3rd + carbide. c ++. V2.0, please download the files in turn to the D:/symbiantools directory:

Jdk1.5:
Http://java.sun.com/javase/downloads/index_jdk5.jsp

ActivePerl-5.6.1.635-MSWin32-x86.msi:
: Http://downloads.activestate.com/ActivePerl/Windows/5.6/

 

S60 platform sdks for Symbian OS, for C ++:
: Http://www.forum.nokia.com/info/sw.nokia.com/id/4a7149a5-95a5-4726-913a-3c6f21eb65a5/S60-SDK-0616-3.0-mr.html
Select: s60 3rd edition, Feature Pack 1

 

Carbide. c ++ 2.0
: Http://www.forum.nokia.com/Tools_Docs_and_Code/Tools/IDEs/Carbide.c++/

2. Install development tools

Note: Install the above three tools on the same disk (for example, C:/), or you may encounter strange problems later, in addition, the project code must be put on the same disk as the development tool to run. The development tool of Nokia is really picky ,:)

Install JDK to C:/apps/. After installation, install ActivePerl to C:/apps/. After installation, install s60_3rd SDK to C, when installing the s60 SDK, I will ask: do you want to install CSL arm toolchain immediately if it is not installed? Select "Install now", and a warning dialog box may pop up later. Ignore the dialog box without any impact.

Install carbide. c ++ 2.0. Select Professional Edition during installation.

3. Development Environment Configuration

A) language switching:
The English simulator environment is installed by default. If you need to use a Chinese simulator or display Chinese characters on the simulator, you need to do this: choose Start> program> s60 Developer Tools> 3rd edition fp2> 1.01> languages> change to Chinese.

B) enter path in the command line to check whether your path environment variable contains the installation path of CSL arm toolchain. If it is not added to the PATH environment variable, for example, add C:/program files/CSL arm toolchain/bin

C), console Print Output debugging:
Modify the file C:/Symbian/9.2/s60_3rd_fp1_6/epoc32/data/EPOC. ini
Logtofile 0
Logtodebugger 0
Is
Logtofile 1
Logtodebugger 1

When used, open the project's MMP file, add the ecrt0 Library to the static libraries, and include the header file # include <e32debug in the file that needs to output information on the console. h>, then we can use it like using printf in C:
Rdebug: Print (_ L ("### cimagemanager: LoadImage % d/N"), idx); to output the print information to the console.

D). Sometimes the following problems may occur during compilation:
The file 'aknexnote. rsg' cannot be opened
Or similar to "project name_xxxx. an error cannot be found in the RSG file. Open the command line and go to the C:/Symbian/9.2/s60_3rd_fp1_6/series60ex/NOTE/group directory, enter the following commands in sequence:

Bldmake bldfiles
Abld build winscw udeb

In this way, the RSG file is generated under C:/Symbian/9.2/s60_3rd_fp1_6/epoc32/build/carbide/workspace/project name/group/project name/winscw.

E) The system header file may be due to version incompatibility issues. During compilation, it may be said that ECOM cannot be found. h header file, which needs to be modified here: C:/Symbian/9.2/s60_3rd_fp1_6/epoc32/include/HTTP/cauthenticationfilterinterface. h header file contains path, # include <ECOM. h> change to # include <ECOM/ECOM. h>.

2. Project Settings

1. Choose Start> program> carbide. c ++ V2.0 open carbide. the C ++ compiler sets the workspace in the same disk where the development tool is installed (as mentioned above ). Check show line numbers on the left of window-> preferences-> General-> editors-> text editors to display the code line number.

2. Import project: Select File> Import. In the dialog box, select Symbian OS> symbina OS BLD inf file, next, and select C: /Symbian/9.2/s60_3rd_fp1_6/examples/basics/helloworld/bld. INF, and next, all the way to default, until the finish can be imported into the project.

3. In the project explorer view, right-click the project helloworld and select build project from the pop-up menu. The project can be compiled successfully, then select Run as-> RUN symbina OS appion in the pop-up menu, and select finish in the pop-up dialog box. In this way, you can run the program in the simulator. (The simulator startup speed may be slow. You can click the blue oval button under the camera button in the simulator interface to enter the application interface, and select installed to enter the installed program interface, you can find the installed helloworld program)

3. Development Process
1. How to import image resources to a project:
A) copy the BMP image (the name must be in English) to the project name/GFX directory. c ++ open the project name under the group. select the MPs file and select the sources column (the libraries column is the configuration library, and the debugging Library mentioned above is set here). Select bitmaps on the right. If there is no MBM file below, add one. If yes, double-click it. In the displayed dialog box, select Add from project and select the BMP image you just copied to the GFX directory. OK.

B), and then re-compile the project, the project name will be automatically generated in the C:/Symbian/9.2/s60_3rd_fp1_6/epoc32/include directory. the mbg file defines some Enum variables corresponding to the image ID you added. You can use these IDs in the code to reference image resources.

C), so that you can load images in the project as shown in the following code:
_ Translate (kimagesfilename, "// system // apps // project name. MBM ");
Cfbsbitmap * ifbsbmp = m_eikenv.createbitmapl (kimagesfilename, image ID );

2. How to add a Chinese string to the project:
A). Only utf8 text can be used. Therefore, you need to convert the text file in the text format (gb2312) to utf8 for use in the project. For more information, see.

 

B) add the text file cntext.txt TO THE DATA DIRECTORY. The content is as follows: (Note that character_set utf8 is indispensable !)

Character_set utf8
# Define qtn_connect_confirm "can an application access the network? "
# Define qtn_exit_confirm "are you sure you want to exit the application? "

 

C) add the BAT file charconverter. bat to the data directory. The content is as follows:

@ Echo off
Charconv-input = gb2312 cntext.txt-output = utf8 cntext. Loc

Pause

 

D) run the bat command to generate cntext in the data directory. in the carbide. in C ++, you can see the three files under the Data Directory of the project. Open the data/project name. RSS file, add include

 

# Include "starservice. Loc"

 

Add the following content in the resources for messages section below:

 

Resource tbuf32 r_connect_confirm {Buf = qtn_connect_confirm ;}
Resource tbuf32 r_exit_confirm {Buf = qtn_exit_confirm ;}

 

Open Data/Project name_reg. RSS file to see if there is any project name _ 0xxxxxxx. RSG file (XXXX is a hexadecimal uid, which is automatically generated in the C:/Symbian/9.2/s60_3rd_fp1_6/epoc32/include directory during project compilation ), if not, add the following content:

 

# Include <project name_0xxxxxxx. RSG>

 

E), re-compile the project, and the string resource ID will be generated in the project name_0xxxxxxx. RSG file.

# Define r_connect_confirm 0x5edfa00e
# Define r_exit_confirm 0x5edfa00f

 

F), so that you can use the following code to use a Chinese string in the project.

Caknquerydialog * DLG = caknquerydialog: newl ();
Hbufc * pformat = stringloader: loadlc (r_exit_confirm );
DLG-> setpromptl (* pformat );
If (DLG-> executeld (r_star_confirmation_query ))
{
Exit ();
}

 

3), publish it to your mobile phone, right-click the project in carbide. c ++, select project properties from the pop-up menu, and select

Build deployments under carbider. c ++, and select phone release in configuration on the right.

(Gcce), add a new SIS in the following SIS builder, select the SIS/project name _ s60 _... _. PKG file, and then OK,

Apply, OK. Re-compilation will be generated under the SIS directory:
Project name _ s60 _... _. Sis
Project name _ s60 _... _. Six
Copy the two files to your mobile phone to install the application.

 

4). Common key values:

Left soft key 0xa4 164
Right soft key 0xa5 165
Key 0xa7 167
Left-click 0xe 14
Right-click 0xf 15
0x10 16
Down key 0x11 17

 

5) Remove the default left menu automatically generated by the Project Wizard. Just clear the r_menu in the project name. RSS.

Resource menu_pane r_menu
{}

4. Reference Books
After comparison, a good reference book is the third edition of <Symbian OS C ++ for mobile phones>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.