Developing Software for Symbian OS: A Beginner's Guide to Creating Symbian OS v9 Smartphone Applications in C++

Developing Software for Symbian OS: A Beginner's Guide to Creating Symbian OS v9 Smartphone Applications in C++

Read it now on the O’Reilly learning platform with a 10-day free trial.

O’Reilly members get unlimited access to books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.

Book description

Many problems encountered by engineers developing code for specialized Symbian subsystems boil down to a lack of understanding of the core Symbian programming concepts. Developing Software for Symbian OS remedies this problem as it provides a comprehensive coverage of all the key concepts. Numerous examples and descriptions are also included, which focus on the concepts the author has seen developers struggle with the most. The book covers development ranging from low-level system programming to end user GUI applications. It also covers the development and packaging tools, as well as providing some detailed reference and examples for key APIs. The new edition includes a completely new chapter on platform security.

The overall goal of the book is to provide introductory coverage of Symbian OS v9 and help developers with little or no knowledge of Symbian OS to develop as quickly as possible. There are few people with long Symbian development experience compared to demand, due to the rapid growth of Symbian in recent years, and developing software for new generation wireless devices requires knowledge and experience of OS concepts. This book will use many comparisons between Symbian OS and other OSes to help in that transition.

Get yourself ahead with the perfect introduction to developing software for Symbian OS.

Show and hide more Table of contents Product information

Table of contents

  1. Copyright
  2. Foreword
  3. Foreword1
  4. Biography
  5. Author Acknowledgments
  6. Symbian Press Acknowledgments
  7. Symbian OS Code Conventions and Notations Used in the Book
    1. Capitalization
    2. Prefixes
    3. Suffixes
    4. Underscores
    5. Code Layout
    1. 1.1. Notes on this New Edition
    2. 1.2. Smartphone Concepts
    3. 1.3. Smartphone Features
      1. 1.3.1. How Smartphones Communicate
        1. 1.3.1.1. Generations of mobile communication
        2. 1.3.1.2. GSM
        3. 1.3.1.3. CDMA
        4. 1.3.1.4. CSD
        5. 1.3.1.5. GPRS
        6. 1.3.1.6. HSCSD
        7. 1.3.1.7. EDGE
        8. 1.3.1.8. UMTS
        9. 1.3.1.9. HSDPA
        10. 1.3.1.10. Wi-Fi
        1. 1.3.2.1. SMS
        2. 1.3.2.2. MMS
        3. 1.3.2.3. Email
        4. 1.3.2.4. Fax
        1. 1.3.3.1. WAP
        2. 1.3.3.2. HTML
        1. 1.3.4.1. USB/Serial cable connection
        2. 1.3.4.2. Infrared (IR)
        3. 1.3.4.3. Bluetooth technology
        1. 1.4.1. What Makes a Good Smartphone OS?
        1. 1.5.1. Symbian OS Overview
        2. 1.5.2. One OS, Various Flavors
        1. 1.6.1. Sony Ericsson P990i
        2. 1.6.2. Nokia N95
        3. 1.6.3. Nokia 9300i Communicator
        1. 1.7.1. Windows Mobile
        2. 1.7.2. BlackBerry
        3. 1.7.3. Palm OS
        4. 1.7.4. Linux
        1. 2.1. What Do You Need to Get Started?
          1. 2.1.1. Build Tools Overview
          2. 2.1.2. What is the Symbian OS Emulator?
          3. 2.1.3. Getting the Symbian OS SDK
          4. 2.1.4. Some Example SDKs
          5. 2.1.5. Getting a Windows Development Package
          6. 2.1.6. More on Carbide.c++
          7. 2.1.7. Carbide.vs
          8. 2.1.8. Is Windows the Only Development Operating System Supported?
          1. 2.2.1. Quick Test of the Emulator
          2. 2.2.2. Quick Test Drive of Carbide.c++
          3. 2.2.3. Build Some Examples
            1. 2.2.3.1. Building a S60 example
            2. 2.2.3.2. Building a UIQ example
            3. 2.2.3.3. Building examples using Carbide.c++
            4. 2.2.3.4. Library freezing
            1. 2.3.1. Application Components
            2. 2.3.2. Overview of SimpleEx
            3. 2.3.3. Header Files
            4. 2.3.4. Resource File
              1. 2.3.4.1. SimpleEx.hrh
              2. 2.3.4.2. SimpleEx_reg.rss
              1. 2.3.5.1. SimpleEx.cpp
              2. 2.3.5.2. SimpleEx_App.cpp
              3. 2.3.5.3. SimpleEx_Doc.cpp
              4. 2.3.5.4. SimpleEx_UI.cpp
              5. 2.3.5.5. SimpleEx_View.cpp
              1. 2.3.6.1. Creating the SimpleEx.mmp project definition file
              2. 2.3.6.2. Creating the bld.inf file
              1. 3.1. Components in Symbian OS
              2. 3.2. Multitasking in Symbian OS
                1. 3.2.1. Threads
                2. 3.2.2. Processes
                1. 3.3.1. Static Interface Libraries
                2. 3.3.2. Polymorphic DLLs
                3. 3.3.3. ECOM Framework
                4. 3.3.4. Static Data in DLLs
                1. 3.5.1. How Memory is Addressed
                2. 3.5.2. Chunks in Symbian OS
                3. 3.5.3. A Process in Memory
                4. 3.5.4. Virtual Memory Map in Symbian OS
                5. 3.5.5. Switching Processes — Detailed Example
                6. 3.5.6. Protecting Processes from Each Other
                7. 3.5.7. Performance in Switching Processes
                8. 3.5.8. Fixed Processes
                1. 3.6.1. Symbian OS Kernels: EKA2 and EKA1
                2. 3.6.2. Kernel Architecture
                  1. 3.6.2.1. Abstracting the hardware
                  2. 3.6.2.2. User library
                  3. 3.6.2.3. Nanokernel
                  1. 3.6.3.1. Two-processor smartphone model
                  2. 3.6.3.2. One processor using the real-time nanokernel
                  1. 3.8.1. Customizing the UI
                  2. 3.8.2. Introducing the GUI Framework
                  1. 4.1. Use of C++ in Symbian OS
                  2. 4.2. Non-standard C++ Characteristics
                  3. 4.3. Basic Data Types
                  4. 4.4. Symbian OS Classes
                    1. 4.4.1. Data Type Classes: T classes
                    2. 4.4.2. Heap Classes: C classes
                    3. 4.4.3. Resource Classes: R classes
                    4. 4.4.4. Interface Classes: M classes
                    1. 4.5.1. Error Handling via Return Codes
                    2. 4.5.2. Leaves and TRAP Harnesses
                    3. 4.5.3. The TRAP and TRAPD Macros
                    4. 4.5.4. Leave Functions
                    5. 4.5.5. What Does the 'L' Suffix Mean?
                    6. 4.5.6. Cleanup Stack
                    7. 4.5.7. Object Types and the Cleanup Stack
                    8. 4.5.8. More Complex Cleanup
                    9. 4.5.9. Other Cleanup Functions
                      1. 4.5.9.1. CleanupClosePushL(T& obj)
                      2. 4.5.9.2. CleanupReleasePushL (T& obj)
                      3. 4.5.9.3. CleanupDeletePushL (T *obj)
                      1. 4.6.1. Creating a Library
                      2. 4.6.2. Import Libraries
                      3. 4.6.3. RLibrary API
                      4. 4.6.4. Polymorphic DLLs
                      5. 4.6.5. Static Data in DLLs
                      1. 4.8.1.
                        1. 4.8.1.1. Class names
                        2. 4.8.1.2. Variable names
                        3. 4.8.1.3. Constants
                        4. 4.8.1.4. Enumerations
                        5. 4.8.1.5. Macros
                        6. 4.8.1.6. Function names
                        1. 5.1. SDK Directory Structure
                          1. 5.1.1. The epoC32 Directory
                            1. 5.1.1.1. epoc32\nclude
                            2. 5.1.1.2. epoc32\build
                            3. 5.1.1.3. epoc32\tools
                            4. 5.1.1.4. epoc32\release
                            5. 5.1.1.5. epoc32\data\z
                            6. 5.1.1.6. epoc32\winscw
                            1. 5.3.1. A Closer Look at abld.bat
                            2. 5.3.2. The MMP File
                            1. 5.4.1. Emulator Build Targets
                            2. 5.4.2. Native Build Targets
                              1. 5.4.2.1. Application binary interface (ABI)
                              2. 5.4.2.2. Import libraries for native builds
                              3. 5.4.2.3. LIB and DSO files
                              4. 5.4.2.4. ARM and THUMB instruction set
                              1. 5.5.1. Getting a UID
                              2. 5.5.2. Vendor ID
                              1. 5.6.1. Emulator Configuration
                                1. 5.6.1.1. Virtual drives
                                2. 5.6.1.2. Customizing virtual drives
                                3. 5.6.1.3. Memory capacity
                                4. 5.6.1.4. Other emulator configurations
                                1. 5.7.1. MMP File for Shared Library
                                2. 5.7.2. Referencing Functions by Ordinal
                                3. 5.7.3. RLibrary API Class
                                1. 5.8.1.
                                  1. 5.8.1.1. Why is DLL freezing important?
                                  2. 5.8.1.2. Disabling interface freezing
                                  3. 5.8.1.3. Enabling interface freezing
                                  4. 5.8.1.4. What does the abld freeze command do?
                                  5. 5.8.1.5. How is the DEF file used?
                                  6. 5.8.1.6. First build of a DLL
                                  7. 5.8.1.7. Sample DEF file
                                  8. 5.8.1.8. Inserting a new function
                                  9. 5.8.1.9. Interface violation
                                  10. 5.8.1.10. Unfreezing a DLL
                                  1. 5.9.1. Where Do I Put My Files?
                                  2. 5.9.2. Format of the PKG File
                                    1. 5.9.2.1. Package file comments
                                    2. 5.9.2.2. Package header
                                    3. 5.9.2.3. Package options
                                    4. 5.9.2.4. Package type
                                    5. 5.9.2.5. Product target
                                    6. 5.9.2.6. Specifying files to install
                                    1. 5.9.3.1. Text notices
                                    2. 5.9.3.2. Removing runtime-generated files
                                    3. 5.9.3.3. Embedding SIS files
                                    4. 5.9.3.4. Running executables on install or uninstall
                                    5. 5.9.3.5. Requisite lines
                                    1. 5.9.4.1. How does makesis use the language information?
                                    2. 5.9.4.2. Language-dependent files
                                    3. 5.9.4.3. Other language-dependent statements
                                    1. 6.1. Introducing the Text Console
                                    2. 6.2. Descriptors for Strings and Binary Data
                                      1. 6.2.1. Strings versus Binary Data
                                      2. 6.2.2. Preventing Memory Overruns
                                      3. 6.2.3. Simple Descriptor Example
                                      1. 6.3.1.
                                        1. 6.3.1.1. 16-Bit default for Unicode
                                        2. 6.3.1.2. Descriptor class hierarchy
                                        1. 6.3.6.1. HBufC descriptor
                                        2. 6.3.6.2. Modifying HBufC data
                                        3. 6.3.6.3. Creating a HBufC descriptor from another descriptor
                                        4. 6.3.6.4. RBuf descriptor
                                        5. 6.3.6.5. Using RBuf::CleanupClosePushL()
                                        6. 6.3.6.6. Creating RBuf from another descriptor
                                        7. 6.3.6.7. Taking ownership of preallocated buffers
                                        8. 6.3.6.8. Multiple RBuf assignments
                                        9. 6.3.6.9. Resizing buffers
                                        1. 6.4.1. Non-modifying Methods
                                          1. 6.4.1.1. Comparing descriptor data
                                          2. 6.4.1.2. Finding substrings within a descriptor
                                          3. 6.4.1.3. Extracting substrings from descriptors
                                          1. 6.4.2.1. Copying data to a descriptor
                                          2. 6.4.2.2. Appending data to a descriptor
                                          3. 6.4.2.3. Formatting descriptor data
                                          4. 6.4.2.4. Changing the case of a descriptor string
                                          5. 6.4.2.5. Deleting data from a descriptor
                                          6. 6.4.2.6. Converting to NULL-terminated strings
                                          7. 6.4.2.7. Setting the descriptor size
                                          1. 6.6.1. When Should I Use Dynamic Buffers?
                                          2. 6.6.2. Flat and Segmented Buffers
                                          3. 6.6.3. Dynamic Buffer Methods
                                            1. 6.6.3.1. Reading and writing a dynamic buffer
                                            2. 6.6.3.2. Inserting and deleting data
                                            3. 6.6.3.3. Manually changing the size of a dynamic buffer
                                            4. 6.6.3.4. Getting a pointer to an area in a dynamic buffer
                                            1. 6.8.1. Fixed Arrays
                                            2. 6.8.2. Descriptor Arrays
                                            3. 6.8.3. Dynamic Arrays
                                              1. 6.8.3.1. RArray
                                              2. 6.8.3.2. Inserting and appending array data
                                              3. 6.8.3.3. Finding data in an array
                                              4. 6.8.3.4. Sorting an array
                                              5. 6.8.3.5. Miscellaneous array functions
                                              6. 6.8.3.6. An example using RArray
                                              7. 6.8.3.7. RPointerArray
                                              1. 6.9.1. Linked Lists
                                              2. 6.9.2. Circular Buffers
                                              1. 7.1. What is Platform Security?
                                              2. 7.2. What Platform Security is Not
                                              3. 7.3. What this Means to a Developer
                                              4. 7.4. Capabilities for API Security
                                                1. 7.4.1. Basic Capabilities
                                                  1. 7.4.1.1. LocalServices
                                                  2. 7.4.1.2. Location
                                                  3. 7.4.1.3. NetworkServices
                                                  4. 7.4.1.4. ReadUserData
                                                  5. 7.4.1.5. WriteUserData
                                                  6. 7.4.1.6. UserEnvironment
                                                  7. 7.4.1.7. User granting basic capabilities
                                                  8. 7.4.1.8. Symbian Signing and basic capabilities
                                                  1. 7.4.2.1. PowerMgmt
                                                  2. 7.4.2.2. ProtServ
                                                  3. 7.4.2.3. ReadDeviceData
                                                  4. 7.4.2.4. WriteDeviceData
                                                  5. 7.4.2.5. SurroundingsDD
                                                  6. 7.4.2.6. SwEvent
                                                  7. 7.4.2.7. TrustedUI
                                                  1. 7.4.3.1. AllFiles
                                                  2. 7.4.3.2. CommDD
                                                  3. 7.4.3.3. DiskAdmin
                                                  4. 7.4.3.4. MultiMediaDD
                                                  5. 7.4.3.5. NetworkControl
                                                  6. 7.4.3.6. Drm
                                                  7. 7.4.3.7. Tcb
                                                  1. 7.4.5.1. PlatSecEnforcement
                                                  2. 7.4.5.2. PlatSecDisableCaps
                                                  3. 7.4.5.3. PlatSecDiagnostics
                                                  1. 7.4.8.1. \sys directory
                                                  2. 7.4.8.2. \resource directory
                                                  3. 7.4.8.3. \private directory
                                                  1. 7.5.1. Digital Signing Overview
                                                  2. 7.5.2. Application Signing
                                                    1. 7.5.2.1. Unsigned
                                                    2. 7.5.2.2. Self-signing
                                                    3. 7.5.2.3. Trusted and untrusted certificates
                                                    4. 7.5.2.4. Symbian Signed
                                                    5. 7.5.2.5. Installation errors related to signing
                                                    6. 7.5.2.6. UIDs, SIDs, and application signing
                                                    1. 7.6.1. Test Criteria
                                                    2. 7.6.2. Symbian Signed Process Options
                                                      1. 7.6.2.1. Freeware signing
                                                      2. 7.6.2.2. Publisher certifier signing
                                                      1. 7.6.3.1. Getting a Publisher ID
                                                      2. 7.6.3.2. Sign your application with the Publisher ID
                                                      3. 7.6.3.3. Submit your application to Symbian Signed
                                                      4. 7.6.3.4. Support the test house as needed
                                                      5. 7.6.3.5. Receiving your Symbian Signed application
                                                      6. 7.6.3.6. If you require phone manufacturer capabilities
                                                      1. 7.7.1. What is a Developer Certificate?
                                                        1. 7.7.1.1. Developer certificate
                                                        2. 7.7.1.2. Phone manufacturer certificate
                                                        1. 7.7.2.1. Download the DevCertRequest tool
                                                        2. 7.7.2.2. Create the CSR request file using DevCertRequest
                                                        3. 7.7.2.3. Upload the request file
                                                        4. 7.7.2.4. Download the certificate
                                                        1. 8.1. Asynchronous Functions
                                                        2. 8.2. Introducing Active Objects
                                                          1. 8.2.1. The Non-Pre-Emptive Multitasking Model
                                                          2. 8.2.2. Creating an Active Object Class
                                                            1. 8.2.2.1. Constructing an active object
                                                            2. 8.2.2.2. Adding an active object to the active scheduler
                                                            3. 8.2.2.3. Implementing requestor functions
                                                            4. 8.2.2.4. Implementing RunL()
                                                            5. 8.2.2.5. Implementing a DoCancel() function
                                                            6. 8.2.2.6. Overriding the RunError() method
                                                            1. 8.3.1. Installing and Starting an Active Scheduler
                                                            2. 8.3.2. Background Information
                                                            3. 8.3.3. CActiveScheduler Methods
                                                            4. 8.3.4. Customizing the Active Scheduler
                                                            1. 8.8.1. CCountdown Active Object
                                                            2. 8.8.2. Modifications to SimpleEx
                                                            1. 8.9.1. Do Not Block in an Active Object
                                                            2. 8.9.2. Avoid Stray-Signal Panics
                                                            3. 8.9.3. Have One Outstanding Event at a Time
                                                            1. 8.10.1. CTimer
                                                            1. 9.1. Processes
                                                              1. 9.1.1. An Example Process
                                                              2. 9.1.2. Launching a Process
                                                              3. 9.1.3. Setting and Retrieving Process Arguments
                                                              4. 9.1.4. Communicating with Other Processes
                                                              5. 9.1.5. Process Names
                                                              6. 9.1.6. Querying the Phone's Running Processes
                                                              7. 9.1.7. Process Priority
                                                              8. 9.1.8. Terminating a Process
                                                              9. 9.1.9. Checking the Status of a Process
                                                              10. 9.1.10. Signaling when a Process Ends
                                                              11. 9.1.11. Other Symbian OS Process Facts
                                                              1. 9.2.1. Creating a Thread
                                                              2. 9.2.2. Opening an Existing Thread
                                                              3. 9.2.3. Thread Priorities
                                                              4. 9.2.4. Terminating a Thread
                                                              5. 9.2.5. Waiting for a Thread to End
                                                              1. 9.4.1. Local Memory Chunks
                                                              1. 9.5.1. Using Semaphores
                                                              2. 9.5.2. Creating and Opening Semaphores
                                                              3. 9.5.3. The Use of Semaphores in Symbian OS
                                                              4. 9.5.4. Mutexes
                                                              5. 9.5.5. Critical Sections
                                                              6. 9.5.6. Using Rendezvous()
                                                              1. 10.1. Client–Server Overview
                                                              2. 10.2. A Look at the Client–Server Classes
                                                              3. 10.3. Client–Server Example
                                                                1. 10.3.1. Client-Side Class
                                                                  1. 10.3.1.1. Connecting to the server
                                                                  2. 10.3.1.2. Invoking the server's services
                                                                  1. 10.3.2.1. Processing messages from the client
                                                                  2. 10.3.2.2. Transferring data between the client and server
                                                                  1. 11.1. Introduction to TCP/IP
                                                                    1. 11.1.1. IP Addresses and Ports
                                                                    2. 11.1.2. Client– Server Network Model
                                                                    3. 11.1.3. Well-Known Server-Side Port Addresses
                                                                    4. 11.1.4. Client-Side Port Addresses
                                                                    1. 11.2.1. Client–Server Socket Flow
                                                                      1. 11.2.1.1. Client-side code
                                                                      2. 11.2.1.2. Server-side code
                                                                      1. 11.2.3.1. Creating the socket
                                                                      2. 11.2.3.2. Converting domain names to IP addresses
                                                                      3. 11.2.3.3. Connecting the socket
                                                                      4. 11.2.3.4. Sending data
                                                                      5. 11.2.3.5. Receiving data
                                                                      6. 11.2.3.6. Cleaning up the connection
                                                                      1. 11.3.1. Socket API Classes
                                                                      2. 11.3.2. HTTP Example Using Symbian OS Socket API
                                                                        1. 11.3.2.1. Connecting to the socket server
                                                                        2. 11.3.2.2. Creating the socket
                                                                        3. 11.3.2.3. Setting the destination address
                                                                        4. 11.3.2.4. Connection to the remote server
                                                                        5. 11.3.2.5. Sending a packet
                                                                        6. 11.3.2.6. Receiving packets
                                                                        7. 11.3.2.7. Closing the socket and socket server
                                                                        1. 11.4.1. wunderground.com
                                                                        2. 11.4.2. Adding this Code to SimpleEx
                                                                        1. 11.5.1. Establishing a Connection for a Program
                                                                        1. 12.1. Symbian OS User Interfaces
                                                                          1. 12.1.1. UIQ 3 Phones
                                                                            1. 12.1.1.1. User input
                                                                            2. 12.1.1.2. UIQ paper metaphor
                                                                            3. 12.1.1.3. UIQ dialogs
                                                                            1. 12.1.2.1. User input
                                                                            2. 12.1.2.2. S60 dialogs
                                                                            1. 12.3.1. E32Main() Entrypoint and NewApplication()
                                                                            2. 12.3.2. Examining the GUI Application Classes
                                                                              1. 12.3.2.1. The application class
                                                                              2. 12.3.2.2. The document class
                                                                              3. 12.3.2.3. The application UI class
                                                                              4. 12.3.2.4. The application view class
                                                                              1. 12.4.1. Resource File Format
                                                                              2. 12.4.2. SimpleEx's Resource File
                                                                                1. 12.4.2.1. UIQ SimpleEx resource
                                                                                2. 12.4.2.2. S60 SimpleEx resource
                                                                                1. 12.5.1. Creating a Basic UIQ Dialog
                                                                                  1. 12.5.1.1. Launching the dialog
                                                                                  1. 12.5.3.1. Dialogs common to all UI platforms
                                                                                  2. 12.5.3.2. UIQ stock dialogs
                                                                                  3. 12.5.3.3. S60 predefined dialogs
                                                                                  4. 12.5.3.4. Confirmation query dialog
                                                                                  5. 12.5.3.5. Text query
                                                                                  1. 12.6.1. Types of Control
                                                                                    1. 12.6.1.1. Edit controls
                                                                                    2. 12.6.1.2. List boxes
                                                                                    3. 12.6.1.3. Progress bars
                                                                                    4. 12.6.1.4. Option buttons
                                                                                    5. 12.6.1.5. Check boxes
                                                                                    6. 12.6.1.6. Choice list
                                                                                    7. 12.6.1.7. Combo box
                                                                                    1. 12.8.1. Creating the Icon Bitmaps
                                                                                    2. 12.8.2. Creating the Localized Application Information Resource
                                                                                    3. 12.8.3. Building Information File and Bitmaps
                                                                                    1. Online References
                                                                                    Show and hide more

                                                                                    Product information

                                                                                    • Title: Developing Software for Symbian OS: A Beginner's Guide to Creating Symbian OS v9 Smartphone Applications in C++
                                                                                    • Author(s): Steve Babin
                                                                                    • Release date: December 2007
                                                                                    • Publisher(s): Wiley
                                                                                    • ISBN: 9780470725702