Symbian Application Development Concepts
-
Upload
fahadmudassar -
Category
Documents
-
view
218 -
download
0
Transcript of Symbian Application Development Concepts
-
8/14/2019 Symbian Application Development Concepts
1/28
Symbian:Symbian:Application DevelopmentApplication Development
ConceptsConcepts
-
8/14/2019 Symbian Application Development Concepts
2/28
Application ComponentsApplication Components
ApplicationApplication
DocumentDocument
AppUIAppUI ViewView
ContainerContainer
-
8/14/2019 Symbian Application Development Concepts
3/28
Application Components:Application Components:
Application ClassApplication Class
Entry Point for Symbian OperatingEntry Point for Symbian OperatingSystemSystem
Contains Application Unique IdentifierContains Application Unique Identifier
(UID)(UID)
Development UID automatically assigned byCarbide C++
Get UIDs for Public Applications athttp://www.symbiansigned.com/
Responsible for Creation of DocumentResponsible for Creation of Document
-
8/14/2019 Symbian Application Development Concepts
4/28
Application Components:Application Components:
Document ClassDocument Class
Manages Application Data ModelManages Application Data Model
Responsible for Creation of AppUI ClassResponsible for Creation of AppUI Class
ObjectObject
-
8/14/2019 Symbian Application Development Concepts
5/28
Application Components:Application Components:
AppUI ClassAppUI Class
Not a Visual Class i.e. its Objects are NotNot a Visual Class i.e. its Objects are NotVisibleVisible
Serves as Controller for the ApplicationServes as Controller for the Application
Manages Views (Container)Manages Views (Container)
Responsible for Application Wide EventResponsible for Application Wide EventHandlingHandling
-
8/14/2019 Symbian Application Development Concepts
6/28
Application Components:Application Components:
View ClassView Class
Provide Screens for the ApplicationProvide Screens for the Application
View Specific Command HandlingView Specific Command Handling
View Has a Unique IDView Has a Unique ID A View Can be Activated fromA View Can be Activated from Within the Same Application orWithin the Same Application or
From Another Application by Providing UID ofFrom Another Application by Providing UID of
the Application and ID of the Viewthe Application and ID of the View
-
8/14/2019 Symbian Application Development Concepts
7/28
Application Components:Application Components:
Container ClassContainer Class
Responsible for Handling UI ComponentsResponsible for Handling UI Components
A li ti St t O i i
-
8/14/2019 Symbian Application Development Concepts
8/28
Application Structure Overview inpp ca on ruc ure verv ew nS60S60
CApaApplication CApaDocument CCoeAppUi CCoeControl
CEikApplication CEikDocument CEikAppUi
CAknApplication CAknDocument CAknAppUi
CAknAppUiBase
CAknView
CAknViewAppUi
CExpApplication CExpDocument CExpAppUi CExpView CExpContaine
SymbianOS
Series60
ExpApp
-
8/14/2019 Symbian Application Development Concepts
9/28
Symbian Data TypesSymbian Data Types
TCharchar
VoidvoidTAny*void*
TBoolboolean
TReal64double
TReal32float
TUintunsigned int
TIntint
Symbian OSStandard C++
-
8/14/2019 Symbian Application Development Concepts
10/28
Symbian ClassesSymbian Classes
Class NamesClass Names Prefix+Class Name+SuffixPrefix+Class Name+Suffix
C Classes (C is Prefix in Class Name)C Classes (C is Prefix in Class Name) Derived Directly or Indirectly from CBaseDerived Directly or Indirectly from CBase
Constructed on Heap and Require CleanupConstructed on Heap and Require Cleanup
T Classes (T is Prefix in Class Name)T Classes (T is Prefix in Class Name) Also Called Data Type ClassesAlso Called Data Type Classes
Encapsulates a Value of Specific Type e.g. TCharEncapsulates a Value of Specific Type e.g. TChar Generally Do Not Use Dynamic Data i.e. Created on Stack but MayGenerally Do Not Use Dynamic Data i.e. Created on Stack but Mayalso Use Heap if Requiredalso Use Heap if Required
-
8/14/2019 Symbian Application Development Concepts
11/28
Symbian ClassesSymbian Classes
R Classes (R is Prefix in Class Name)R Classes (R is Prefix in Class Name) Also Called Resource ClassesAlso Called Resource Classes Owns a Resource HandleOwns a Resource Handle Can be Instantiated on Heap or StackCan be Instantiated on Heap or Stack
M Classes (M is Prefix in Class Name)M Classes (M is Prefix in Class Name) Also Called Interface ClassesAlso Called Interface Classes Equivalent to an Abstract Interface (Contains Pure Virtual Functions)Equivalent to an Abstract Interface (Contains Pure Virtual Functions) Used to Define Callback InterfacesUsed to Define Callback Interfaces
Static Classes (No Prefix Attached to Static Classes)Static Classes (No Prefix Attached to Static Classes) Contains Only Static FunctionsContains Only Static Functions Cannot be Instantiated into an ObjectCannot be Instantiated into an Object
-
8/14/2019 Symbian Application Development Concepts
12/28
Exception HandlingException Handling
Standard C++ Exception Handling inStandard C++ Exception Handling inSymbian OS v9 (try/catch mechanism)Symbian OS v9 (try/catch mechanism)
Lightweight Exceptions for PreviousLightweight Exceptions for PreviousSymbian OS (before OS v9)Symbian OS (before OS v9)
Leaves are Alternative to C++ ExceptionsLeaves are Alternative to C++ Exceptions
Leaves are Lightweight Exception HandlingLeaves are Lightweight Exception Handling
MechanismMechanism
-
8/14/2019 Symbian Application Development Concepts
13/28
Exception Handling: LeavesException Handling: Leaves
A LeaveA Leave Suspends Code Execution at the Point where Leave OccursSuspends Code Execution at the Point where Leave Occurs
Resumes Execution where Leave is TrappedResumes Execution where Leave is Trapped
Leaves May Occur while Performing Operations thatLeaves May Occur while Performing Operations that
May not SucceedMay not Succeed Allocation of MemoryAllocation of Memory
File CreationFile Creation
Traps are used to Catch Leaves and Allow them to beTraps are used to Catch Leaves and Allow them to beHandledHandled
Functions that May Leave have L as Suffix in theirFunctions that May Leave have L as Suffix in theirNameName
Panics Cannot be Caught and HandledPanics Cannot be Caught and Handled
-
8/14/2019 Symbian Application Development Concepts
14/28
Cleanup StackCleanup Stack
The cleanup stack is used to storepointers that may become orphaned if aleave occurs
Push Pointer to Objects on Cleanup Stacks
In case of a Leave, All Objects whosePointers are Pushed on Cleanup Stack will beProperly Destroyed
-
8/14/2019 Symbian Application Development Concepts
15/28
Two Phase Construction ofTwo Phase Construction of
ObjectsObjects
1.1. Make All Constructors Private or Protected.Make All Constructors Private or Protected.
2.2. Provide Static Factory Function(s) to CreateProvide Static Factory Function(s) to CreateObjects e.g.Objects e.g.
NewL()NewL() NewLC()NewLC()
Code that May Leave is Placed in FactoryCode that May Leave is Placed in FactoryMethodsMethods
No Code within a Constructor Should EverNo Code within a Constructor Should Ever
Leave.Leave.
-
8/14/2019 Symbian Application Development Concepts
16/28
DescriptorsDescriptors
Strings in Symbian OS are CalledStrings in Symbian OS are CalledDescriptorsDescriptors
May Contain Text and Binary DataMay Contain Text and Binary Data
TPtr88 bit CharactersNarrowTPtr88 bit CharactersNarrowDescriptorsDescriptors
TPtr1616 bit CharactersWideTPtr1616 bit CharactersWideDescriptorsDescriptors
Descriptors Can beDescriptors Can be Constant (Contents are Constant)Constant (Contents are Constant)
-
8/14/2019 Symbian Application Development Concepts
17/28
Pointer DescriptorsPointer Descriptors
Can Point to Text on the Heap, Stack orCan Point to Text on the Heap, Stack orROMROM
Constant: TPtrConstant: TPtrCC
Modifiable: TPtrModifiable: TPtr
0x1234566 !OLLEH
0x234567
10
6
!OLLEH
Length Pointer
Length
Max
Length
-
8/14/2019 Symbian Application Development Concepts
18/28
Buffer DescriptorsBuffer Descriptors
Stack Based, Useful for Relatively SmallStack Based, Useful for Relatively SmallStringsStrings
Directly Contain the StringDirectly Contain the String Constant: TBufConstant: TBufCC
Modifiable: TBufModifiable: TBuf
!OLLEH6
!OLLEH86
Length
LengthMax
-
8/14/2019 Symbian Application Development Concepts
19/28
Dynamic Descriptors (HeapDynamic Descriptors (Heap
Based)Based)
Can be Used for StringsCan be Used for Strings That are Too Big to be Placed on StackThat are Too Big to be Placed on Stack
For Which Size is Not Known at CompileFor Which Size is Not Known at Compile
TimeTime Constant: HBufConstant: HBufCC
!OLLEH6
Heap
0x345678
-
8/14/2019 Symbian Application Development Concepts
20/28
Dynamic Descriptors (HeapDynamic Descriptors (Heap
Based)Based)
RBuf is Modifiable and DynamicallyRBuf is Modifiable and DynamicallyAllocated DescriptorAllocated Descriptor
-
8/14/2019 Symbian Application Development Concepts
21/28
Threading and Active ObjectsThreading and Active Objects
Symbian Allows Application Programs toSymbian Allows Application Programs toCreate ThreadsCreate Threads
However, Recommendation is to UseHowever, Recommendation is to UseActive Objects where PossibleActive Objects where Possible
Alternative to Threads and PreferredAlternative to Threads and PreferredOption is UsingOption is Using
Asynchronous Functions along with ActiveAsynchronous Functions along with ActiveObjectsObjects
-
8/14/2019 Symbian Application Development Concepts
22/28
Active Object FrameworkActive Object Framework
Active Object FrameworkActive Object Framework Active ObjectsActive Objects
Active SchedulerActive Scheduler
Active Object Framework is Used forActive Object Framework is Used forEvent Driven MultitaskingEvent Driven Multitasking
-
8/14/2019 Symbian Application Development Concepts
23/28
Active ObjectActive Object
An Active Object:An Active Object: Requests an Asynchronous Service and
Handles the Resulting Completion of Event
Sometime After the Request.
May Ask to Cancel a Request
Is Listed with Active Scheduler
-
8/14/2019 Symbian Application Development Concepts
24/28
Active SchedulerActive Scheduler
When Asynchronous Service Completes,It Generates Events
Active Scheduler Detects Events
Determines Associated Active Object
Calls the Active Object to Handle the Event.
-
8/14/2019 Symbian Application Development Concepts
25/28
Submitting an AsynchronousSubmitting an Asynchronous
RequestRequest
Each Active Object Can Only Have OneOutstanding Request
Check for previous outstanding requests. If aRequest has Already been Placed, the Codemay Panic
Refuse
Cancel Outstanding Request and Submit New One
Issue the Request Mark Active Object as Waiting
-
8/14/2019 Symbian Application Development Concepts
26/28
Active Object Event HandlingActive Object Event Handling
Active Object Implements the Event Handling FunctionActive Object Implements the Event Handling Function Active Object Event Handler is the Function forActive Object Event Handler is the Function for
Handling Completion of Asynchronous CallHandling Completion of Asynchronous Call
Active Object Handler is Not Pre-EmptedActive Object Handler is Not Pre-Empted
Control Returns to the Active Scheduler When EventControl Returns to the Active Scheduler When EventHandler ReturnsHandler Returns
If multiple events have occurred before control returnsto the scheduler, they are handled sequentially inorder of their Priority
Active Scheduler Calls the Event Handling Function ofActive Scheduler Calls the Event Handling Function ofAssociated ObjectAssociated Object
-
8/14/2019 Symbian Application Development Concepts
27/28
Asynchronous Request HandlingAsynchronous Request Handling
Process OverviewProcess Overview
Event Handler Returns andControl is Given Back to ActiveScheduler
Active Scheduler Calls EventHandler of Active Object. Event
Handler Cannot be Preempted
Service Completes and ServiceProvider Notifies the Active Schedulerwith Results
Sets the Request Status to Pending
and Starts the Service
Issue Request
Check for Outstanding Requests
Asynchronous ServiceProvider
Active Object
Process Boundary
-
8/14/2019 Symbian Application Development Concepts
28/28
ReferencesReferences
Mobile computing : technology, applications,and service creation by Asoke K. Talukder,by Asoke K. Talukder,
Roopa R. YavagalRoopa R. Yavagal
S60 Programming by Paul Coulton and ReubenEdwards
Developing Software for Symbian OS by SteveBabin
The Accredited Symbian Developer Primer byMark Jacobs and Jo Stichbury