A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service
The following text references the Nokia literature in large numbers (because I am more detailed and correct)
S60 C ++ application example helloworld
Symbian OS 6.1
The key to the success of the 60 series platform is the Symbian OS, which is the basis of the product. Symbian OS is a 32-bit multi-task operating system in which events often occur differently, so applications are designed to interact with each other. For example, a sudden call may interrupt the user's ongoing email editing work; a user may switch from email to calendar during the call; or, A received short message may trigger the user to access the contact database and then forward the received short message. According to the platform architecture and software design guidance, Application designers can provide orderly management means for such events that smart phone users encounter in their daily lives.
60 series C ++ software development kit
The 60-series platform has its own SDK, which is based on the Symbian SDK. Third-party developers can use APIs to use C ++ to develop new applications of the 60 series platform and include these applications into their own products, or as a variety of value-added applications different from sales applications. The 60 series of sdks provide development partners with support for documents, tools, and sample code, as well as a simulator that can run on Microsoft Windows. This SDK is very important for developing, testing and debugging various C ++ applications.
C ++ application example
Two "Hello World" applications for 60 series devices, one of which is a console application and the other is a basic graphic user interface application. You need to use Microsoft's Visual C ++ 6.0 (Service Pack 3) to build these applications. Because the Compiling System Of This SDK calls the Perl script, you must also install the Perl application.
The first "Hello World" example is a console application that contains a single executable file with the extension. EXE. In Symbian OS, this executable file is mainly used for two purposes: as a server without a user interface, or as a testing tool with only a very simple character interface. Applications are used for various typical complex graphical applications.
Program Framework and various user interface libraries. This article will introduce a "hello World" Application Based on a graphical user interface later.
Create and run the command line
Open the command prompt, select the drive with the 60 series SDK to enter the folder containing the project code, for example:/Symbian/6.1/Series60/Epoc32Ex/Basics/HelloWorld
The folder contains three files:
HelloWorld. cpp-source file
HelloWorld. mmp -project definition file
Bld. inf-component definition file
To create this sample program, type the "bldmake bldfiles" command to generate a new file, namely, ABLD. BAT. This file is always automatically generated as required and cannot be edited.
To compile and link this project, type the "abld build wins udeb" command to create a project for the 60 series debugging simulator.
Run the program in the following way: Enter the folder containing the program helloworld.exe in the command prompt. For example:/Symbian/6.1/Series60/Epoc32/Release/wins/udeb at the command prompt, type: helloworld
In this way, the 60 series simulator is started.
Build and run programs from IDE (integrated development environment)
Generally, application projects such as HelloWorld are created and run in Microsoft's Visual C ++ 6.0 IDE (integrated development environment,
The procedure is as follows: if the ABLD. BAT file does not exist (or, if the. mmp file or bld. inf file has been changed), you must enter the following command to generate the CREATE (Build) command file.
: Bldmake bldfiles
The following command creates a Visual C ++ project and a workspace file (. dsp and. dsw) by running abld makefile vc6 ).
These two files are located in the/epoc32/build subdirectory, namely: /epoc32/build/Symbian/6.1/series60/epoc32ex/basics/helloworld/wins open the workspace file helloworld in Visual C ++. DSW: Press F7 to create the application, and press Ctrl + F5 to run the application.
The console simulator will automatically start as the helloworld application runs.
Symbian OS Application Framework
Uikon and standard Eikon are two important parts of the application framework. They not only provide a framework for loading various applications, but also provide a series of standard controls for the running of applications.
(Such as dialog box, Digital editor, and date editor ).
In practice, typical applications written for Symbian OS are composed of four different components, each of which corresponds to a class in the uikon/Eikon framework. They are:
Application shell class-inherited from ceikapplication class. This class was first instantiated by the application framework. Once created, it takes responsibility for initializing other codes. Inheritance
The new class from ceikapplication will then create the following class.
Document class-inherits from the ceikdocument class. All applications have classes inherited from ceikdocument. By default, when the application is run for the first time, ceikdocument
Creates a default document file. However, not all programs are based on files. That is to say, some programs do not have to provide users with functions such as creating, opening, or editing documents. For
These non-file-based applications, such as telephone applications, do not require such document-class instances to create Appui-class instances and typical modules/
Engine instance. For file-based applications, the document class can be stored to read permanent data.
Application User Interface Class-inherits the ceikappui class from uikon. This class provides the most important functions for all applications, such as event processing, control creation, and numerous accesses.
. Classes inherited from CEikAppUi often need to create one or more application views.
View class-This class provides users with what they actually see on the screen. All applications have one default view or multiple complex views. For example, a calendar can provide many
Views. A view can only be used to display data (such as the example in HelloWorld), or collect data from users in many interactive applications. For example, the number of data input applications
The data editor is only the Uikon standard control contained in the view. In most applications, views inherit from the CCoeControl class, that is, they are self-managed controls.
60 series program framework
Avkon is a user interface layer dedicated to the 60 series platform. It provides a wide range of user interface components and implements many classes inherited from UIKON and standard EIKON framework base classes.
The Avkon application gives various attributes and expressiveness specific to the 60 series of platforms.
CAknDocument-This class inherits from the CEikDocument class and serves as the base class of the application document. This class is used to access a default application document file without initialization.
Most Avkon applications are suitable for this situation. Use the CAknDocument class as the base class of the application document. By default, Avkon cannot create document files.
CAknAppUi-Avkon applications (Summary t view architecture applications) derive from this class. This class supports
Several Avkon-specific functionalities:
CAknAppUi-various Avkon applications (excluding view framework applications) inherit from this class. This class supports several Avkon functions: • supports key tone • CBA and StatusPane
Attachment support • TextResolver (Text analyzer)-AknAppUI: Avkon error report implemented by HandleError () • Avkon view framework integration • Control Transfer-program tuning
Test features CAknViewAppUi all applications based on the view framework (see "other graphic user interface design" below) must inherit from this class, And it inherits from the CAknAppUi class. Various
The application view can be inherited from the CAknView class.
Application startup-The CAknApplication class inherits from the CEikApplication class. This class restructured the PreDocConstructL () function and OpenIniFileLC (RFs & aFs) function, from
And modified the CEikApplication class. To implement the PreDocConstructL function, ensure that the application instance being constructed does not exist. If the application instance already exists
Automatically switch to the instance in sequence, and then exit. Perform this check only for non-embedded applications. By default, various 60 series applications do not support. ini files.
If OpenIniFileLC () is called, it will implement a simple exception export.
If you must use the. ini file, the application must implement the call method CEikApplication: OpenIniFileLC in the application class.
Symbian OS uses resource files (such as HelloWorld. rss) to define the screen appearance of graphical user interface applications,
Many definition information about the application's appearance, behavior, and functions are stored in the resource file; as the external body of the program, the Status Pane, menu, and hot key, even each dialog box can be defined in the resource file.
The runtime can efficiently load various resources as needed, so there is little memory demand. The Application resource file is defined by a text script file (its typical extension is. rss.
When they are created, they are compiled into compressed binary files (the default extension is. rsc ). You can support localization through resource files without re-compiling the main program. All user interface texts are usually separated and placed in a separate header file (the agreed extension is. and reference it in the primary resource file using the # include statement.
You only need to translate the. loc file into different languages to complete localization. Resource files are complex at first, but gradually become simple and clear.
Complete descriptions and examples of application resource files are provided in the 60 series sdks.
The following files constitute the main parts of the application:
HelloWorldAppUi. cpp-Application User Interface
HelloWorld. rss-Defines standard resource files for many user interfaces.
Before compiling the source file, the resource compiler will automatically call this file (only when the resource file is updated after the resource compiler was last run ).
The resource compiler outputs binary files to provide resource information for application running, such as HelloWorld. rsc.
HelloWorld_caption.rss-contains the title of the application icon, that is, the name of the application displayed in "app launcher" on the 60-series user interface.
The user interface has two scaling levels. This file is also called by the resource compiler during creation.
Hello. uid. cpp-UID source file, which is automatically generated by the creation tool. It is usually located at:/epoc32/build/symbian/6.1/series60/helloworld/group/helloworld/wins.
Trackback: http://tb.blog.csdn.net/TrackBack.aspx? Postid = 216217
Start building with 50+ products and up to 12 months usage for Elastic Compute Service