Casting
Native C operators should be used for casting Cannot be used as there is no run time type information with Symbian OS Used to cast a base class to derived class and between base types Used to cast a pointer type to another pointer type, to cast an integer type to pointer type and vice versa Used to remove the const attribute from a type Casting is used to convert between classes and types. C casts are still legal in Symbian OS, but C casts should be used in preference since they remove any...
Using Trap Harnesses
TRAPD err, DoFunctionl no value returned, recover perform a cleanup , or TRAPD err, value G et Sortie t h ingL value returned If err function left and value is not defined recover, ignore or panic else Typically after a trap, a function checks the leave variable to test whether processing returned normally or by a leave, and acts appropriately. Special mechanisms discussed later are provided to handle cleanup after the exception. Two use cases are shown on the slide. In the first one the...
T Classes
Classes that do not own external objects resources and so can be declared on the stack TMyPoint Tint aX, Tint aY Tint iX The most fundamental types are value types. These are given type, or class, names beginning with 'T'. 'T' types contain their value. They do not own any external object, either directly by pointer or indirectly by handle . Therefore, they do not need a destructor to cleanup resources. 'T' types may be allocated either on the stack that is locally as C automatic variables or...
Exercise Using the Cleanup Stack to prevent Memory Leaks
Task 3.1 - Running the application with no memory leaks This task illustrates what should happen when a string buffer is allocated on the heap and used to set the value of the bottom label of the application. 1. Launch the emulator and navigate to and open the S60MemoryLab application. 2. When the application is open, select the Options softkey to bring up the options menu. 3. Select the Cleanup Stack Test menu item from the options menu. The bottom label of the application is changed as shown...
Character Conversions 1
CCnvCharacterSetConverter - provides methods to convert text between Unicode and other character sets 1. Construct an instance of the class 2. Specify the non-Unicode character set being converted to or from. This is done by calling 3. Convert the text using one of ConvertFromUnicode or ConvertToUnicode . When descriptors are used as strings, their array consists of numbers that represent characters. Each number means a specific character in a character set. Many existing services, protocols...
Two Phase Construction 1
C constructor must never leave as the destructor will not be called All dynamic memory resources should be created in a second constructor ConstructL , for example void CMyClass ConstuctL Tint aBufSize Static functions, TJewL and WewLC , are used to simplify two phase construction CMyClass CMyClass NewLC Tint aBufSize CMyClass self new ELeave CMyClass CleanupStack EushL self self- gt ConstructL aBufSize Another important Symbian OS concept is two-phase construction. The need for this arises if...
Symbian OS Basics
This course pack contains Workbook IMPORTANT READ CAREFULLY BEFORE INSTALLING, DOWNLOADING, OR USING THE NOKIA OFFICIAL COURSEWARE This Nokia End-User Agreement this Agreement is between You the end user either an individual or an entity , and Nokia Corp. Nokia , the licensor. This Agreement authorizes You to use the Nokia Official Courseware specified in Section 1 below, which may be stored on a CD-ROM, sent to You by electronic mail or in written hardcopy, or downloaded from Nokia's Web pages...
Pointer Descriptors TPtr and TPtrC 1
Use to reference data stored elsewhere Usage example - porting from legacy code 0x00, 0x33, 0x66, 0x99, Oxbk., Oxff TPtrC8 bufferPtr KBuffer, sizeof KBuff er send data via connected TCP IP socket iSo ck.e t. Write hiufferPt r, iStatus Refers to data stored elsewhere that is not owned by the descriptor. Using a TPtr or TPtrC to access a string is much safer than maintaining pointers to zero-terminated C strings. TPtrC is derived from TDesc and only provides additional methods to associate the...
Container Class
class CMyAppContainer public CCoeControl, static CMyAppContainer Nepali const TRect aRect CMyAppContainer private void ConstructL const TRectiL aRect private functions from base classes void SiseChanged Tint CountComponentControls const CCoeControl ComponentControl Tint alndex const void Draw const TRect aRect const event handling section e.g Listbox events void HandleControlEventl CCoeControl aControl, TCoeEvent aEventType CEikLabel iLabel example label CEikLabel iToDoLabel example label The...
Memory Management
Memory Module Why Memory Stack and Leaves The Cleanup Two Phase Best Memory Lab 04304.cb1 Using
Calling Asynchronous Functions
Could wait synchronously for request to complete e.g RTimer timer timer.CreateLocal TRequestStatus status,-timer.After status, 1000000 User WaitForRequest status However this causes the thread to hang for 1 second Instead, it is much better to be notified when the timer completes by implementing an active object A developer may think, Why should I be interested in the active object framework . The example on the slide illustrates the problems faced without its use. The example shows how to...
Course Objectives
At the end of the course, students should be able to do the following Explain what Symbian OS is. Understand what a UI design platform is and be able to give examples. Use the Carbide.c IDE to create a new S60 3rd Edition application project. Use the Carbide.c IDE to import an existing S60 3rd Edition application project from a MMP file. Use the Symbian OS exception handling mechanism. Understand the application framework and what classes are involved. Explain what an active object is, and know...
Server Plugins 1
The client server architecture has a fair degree of extensibility to it. Some servers allow plug-in modules to be added to them to offer functionality for new technologies, protocols and media. This additional functionality is accessed via the generic API as normal, but may use a different initialisation constant or parameter. The slide illustrates two different examples of this plug-in architecture The message server allows messages to be sent and received via a range of messaging protocols....
Lab Instructions Upq
1. Ensure that a compatible SDK has been installed. A list of compatible SDKs to use with this lab is given in the table in the Introduction. 2. Ensure that a compatible IDE has been installed. A list of compatible IDEs to use with this lab is given in the table in the Introduction. 3. Ensure that the lab files are located in the folder c Labs Lab_04305.cbi . If this is not the case please refer to the setup guide for details of how to obtain them. Task 1.2 - Make sure the emulator is in text...
Implementing Active Objects
Set the priority level EPrioritystandard is common Call CActiveScheduler Add to register active object Receive an interface reference or pointer to notify caller. Optional Provide a member function that calls an async function Pass CActive istatus into the asynchronous function. Call CActive setActive so that Active Scheduler knows a request is outstanding. Implement RunL to handle async response Notify caller if we have an interface reference or pointer. Optional Implement DoCancel to cancel...
Contents
About This Course Student Course Document Forum Forum Nokia's The Nokia Vision Life Goes Supporting Developers Through All Stages of the Application Life Forum Nokia Forum Nokia The Platform The Nokia Get It Right from the Get the Development Resources You Need Online___________________________22 Keep Your Project Moving Have Expert Guidance Every Step of the Stay on the Cutting Get Your Applications Tested and Learn from Develop and Test on the Latest Nokia Symbian OS Module Symbian Symbian...





