Quick Recipes on Symbian OS: Mastering C++ Smartphone Development

Book description

Symbian OS continues to be the top operating system for smartphones across the world, with the number of Symbian OS phones sold now well beyond the 100 million mark. As more and more developers realize the huge opportunities available designing with Symbian OS, one of the first major obstacles they face is the sheer length of time it takes to start producing functional C++ applications for Symbian OS phones. "Quick Recipes on Symbian OS" provides easy-to-use recipes for mastering common development tasks. The book's structured, time-focused approach to becoming familiar with the basics allows readers to get up and running quickly.

From the Author

This book is meant as an entry point into the Symbian OS C++ development ecosystem.

Our goal is to allow you to create a working prototype of your application for Symbian OS withing 2 weeks, using only this book, a computer, an internet connection and a Symbian phone.

Inside, you will find reusable modules implementing the most common tasks developers usually have to labour on, along with enough information for you to understand them and integrate them into your own application.

This book can be used in several ways:

- as a learning exercise.

- to complement a university course.

- as a reference to keep on your desk.

Table of contents

  1. Copyright
  2. Foreword
  3. About this Book
  4. About the Authors
    1. Michael Aubert
    2. Alexey Gusev
    3. Tanzim Husain
    4. Jenny Mulholland
    5. Antony Pranata
    6. Jukka Silvennoinen
    7. Jo Stichbury
  5. Acknowledgments
  6. Symbian OS Code Conventions and Notations Used in the Book
    1. 1.1. Capitalization
    2. 1.2. Prefixes
    3. 1.3. Suffixes
  7. 1. Introduction and Setup
    1. 1.1. Tools: What You Need and Where to Find It
      1. 1.1.1. System Requirements
      2. 1.1.2. IDE
      3. 1.1.3. SDKs
      4. 1.1.4. Compilers
    2. 1.2. While You are Waiting
      1. 1.2.1. Carbide.c++
      2. 1.2.2. Development Communities
      3. 1.2.3. Concepts of Mobile Development
      4. 1.2.4. ARM Hardware
      5. 1.2.5. Emulator
    3. 1.3. Post-Installation
      1. 1.3.1. Command Line Tools
      2. 1.3.2. SDK Directories Structure
      3. 1.3.3. Emulators
  8. 2. Quick Start
    1. 2.1. Hello World Project Template
    2. 2.2. Running Carbide.c++ IDE
    3. 2.3. Generating the Hello World Project
    4. 2.4. Building the Hello World Project
    5. 2.5. Running the Hello World Application on the Emulator
      1. 2.5.1. Configuring the Emulator
    6. 2.6. Running the Hello World Application on the Device
    7. 2.7. Modifying the Hello World Project
      1. 2.7.1. Adding a New Menu Item
      2. 2.7.2. Handling a Menu Event
    8. 2.8. Advanced Topics on Carbide.c++
      1. 2.8.1. Modifying the Project Files
      2. 2.8.2. Importing Project Files
      3. 2.8.3. Changing the Certificate/Key Pair
    9. 2.9. Links
  9. 3. Symbian OS Development Basics
    1. 3.1. Fundamental Data Types on Symbian OS
    2. 3.2. Symbian OS Class Conventions
      1. 3.2.1. T Classes
      2. 3.2.2. C Classes
      3. 3.2.3. R Classes
      4. 3.2.4. M Classes
      5. 3.2.5. Static Classes
    3. 3.3. Leaves and Exception Handling
      1. 3.3.1. The Difference between Panics and Leaves
      2. 3.3.2. TRAP and TRAPD Macros
      3. 3.3.3. What Causes a Leave?
      4. 3.3.4. new(ELeave)
    4. 3.4. The Cleanup Stack
    5. 3.5. The Cleanup Stack FAQ: Advanced Information
      1. 3.5.1. Why Does PushL( ) Leave?
      2. 3.5.2. Why Do I Get a Panic When I Try To Use the Cleanup Stack?
      3. 3.5.3. Why Do I Get a Panic When My Code Leaves a TRAP?
      4. 3.5.4. Why Do I Get a Panic When I Call CleanupStack::Pop( )?
      5. 3.5.5. How Do I Mix Leaves, Exceptions and the Cleanup Stack?
    6. 3.6. Two-Phase Construction
    7. 3.7. Thin Templates
    8. 3.8. Descriptors – Symbian OS Strings
      1. 3.8.1. Character Size
      2. 3.8.2. TDesC
      3. 3.8.3. TDes
      4. 3.8.4. The Derived Descriptor Classes
      5. 3.8.5. Pointer Descriptors: TPtrC and TPtr
      6. 3.8.6. Stack-Based Buffer Descriptors TBufC and TBuf
      7. 3.8.7. Dynamic Descriptors: HBufC and RBuf
      8. 3.8.8. Using RBuf
      9. 3.8.9. Literal Descriptors
      10. 3.8.10. Descriptor Class Types: Summary
      11. 3.8.11. Using the Descriptor APIs
      12. 3.8.12. Descriptors as Function Parameters and Return Types
    9. 3.9. Arrays on Symbian OS
      1. 3.9.1. Static Arrays
      2. 3.9.2. Dynamic Arrays
      3. 3.9.3. Cleanup of the RArray Classes
      4. 3.9.4. When Should You Use CArrayX Arrays?
      5. 3.9.5. Sorting and Searching
    10. 3.10. Executable Files
      1. 3.10.1. UID1
      2. 3.10.2. UID2
      3. 3.10.3. UID3
    11. 3.11. Platform Security: Capabilities
    12. 3.12. Platform Security: Data Caging
    13. 3.13. Stack Size and Heap Size
    14. 3.14. Streams
      1. 3.14.1. Externalize and Internalize
    15. 3.15. Active Objects
      1. 3.15.1. Preemption
      2. 3.15.2. Class CActive
      3. 3.15.3. Class TRequestStatus
      4. 3.15.4. The Active Scheduler
      5. 3.15.5. Common Problems with Active Objects
    16. 3.16. Threads
    17. 3.17. Timers and Callbacks
    18. 3.18. Summary
  10. 4. Symbian C++ Recipes
    1. 4.1. File Handling
      1. 4.1.1. Easy Recipes
        1. 4.1.1.1. Get a File Server Session
        2. 4.1.1.2. Write Binary Data to a File
        3. 4.1.1.3. Read Binary Data from a File
        4. 4.1.1.4. Read Text from a File
      2. 4.1.2. Intermediate Recipes
        1. 4.1.2.1. Get the Path of a Private Folder
        2. 4.1.2.2. Read from and Write to a File Stream
        3. 4.1.2.3. Read and Write Class Members from and to a File Stream
      3. 4.1.3. Advanced Recipes
        1. 4.1.3.1. Read from and Write to a File Store
        2. 4.1.3.2. Share Files between Processes
      4. 4.1.4. Resources
    2. 4.2. Contacts and Calendar
      1. 4.2.1. Before You Start with Contacts
      2. 4.2.2. Before You Start with Calendar
      3. 4.2.3. Easy Recipes
        1. 4.2.3.1. Write Data to a Contact
        2. 4.2.3.2. Read Data from a Contact
        3. 4.2.3.3. Add a New Contact
        4. 4.2.3.4. Remove a Contact
        5. 4.2.3.5. Modify a Calendar Event
        6. 4.2.3.6. Add a New Calendar Event
        7. 4.2.3.7. Remove a Calendar Event
      4. 4.2.4. Intermediate Recipes
        1. 4.2.4.1. Sort Contacts
        2. 4.2.4.2. Use the vCard Format
        3. 4.2.4.3. Use the vCal Format
        4. 4.2.4.4. Create a Repeating Calendar Event
      5. 4.2.5. Advanced Recipes
        1. 4.2.5.1. Find a Contact
        2. 4.2.5.2. Move a Contact to Another Group
        3. 4.2.5.3. Find Out If You are Available
        4. 4.2.5.4. Get Attendee List
    3. 4.3. Networking
      1. 4.3.1. Getting Started
      2. 4.3.2. Setting Up the Environment
        1. 4.3.2.1. Using the SDK Configuration Tools
        2. 4.3.2.2. Using WinPCap
        3. 4.3.2.3. Using WinTAP
        4. 4.3.2.4. Using WinSock
      3. 4.3.3. HTTP
      4. 4.3.4. InetProtUtils
      5. 4.3.5. Easy Recipes
        1. 4.3.5.1. Send/Receive Data Using TCP Sockets
        2. 4.3.5.2. Force a Connection to Use a Specific Bearer
        3. 4.3.5.3. Force a Connection to Use a Specific IAP
        4. 4.3.5.4. Resolve Domain Name
        5. 4.3.5.5. Use HTTP GET Request
        6. 4.3.5.6. Parse a URI
        7. 4.3.5.7. Create a URI
      6. 4.3.6. Intermediate Recipes
        1. 4.3.6.1. Listen for an Incoming Connection Using TCP
        2. 4.3.6.2. Observe Connection Status
        3. 4.3.6.3. Get Active Connection Information
        4. 4.3.6.4. Use Secure Socket
        5. 4.3.6.5. Use HTTP POST Request
        6. 4.3.6.6. Set Advanced HTTP Properties
        7. 4.3.6.7. Extract Local Filename from URI
      7. 4.3.7. Advanced Recipes
        1. 4.3.7.1. Retrieve HTTP Proxy Information
      8. 4.3.8. Resources
    4. 4.4. Messaging
      1. 4.4.1. Supported Bearers
      2. 4.4.2. SendAs
      3. 4.4.3. Services
      4. 4.4.4. The Message Store
        1. 4.4.4.1. Structure and Main Classes
        2. 4.4.4.2. Types of Entry
      5. 4.4.3. Tips for Writing Messaging Applications
        1. 4.4.3.1. Messaging Libraries
        2. 4.4.3.2. Multimode SMS
        3. 4.4.3.3. UI Implementation Differences
        4. 4.4.3.4. Mail Store Debugging
      6. 4.4.4. About the Recipes
        1. 4.4.4.1. Required Capabilities
      7. 4.4.5. Recipes
        1. 4.4.5.1. Initialize your Application to Use Messaging
        2. 4.4.5.2. Create a Folder
        3. 4.4.5.3. Create a Message
        4. 4.4.5.4. Read Message Details
        5. 4.4.5.5. Edit a Message
        6. 4.4.5.6. Retrieve and Edit Message Settings
        7. 4.4.5.7. Copy a Message
        8. 4.4.5.8. Move a Message
        9. 4.4.5.9. Send a Message
        10. 4.4.5.10. Delete Messages
        11. 4.4.5.11. Handle Incoming Messages
      8. 4.4.6. Resources
    5. 4.5. Graphics and Drawing
      1. 4.5.1. Easy Recipes
        1. 4.5.1.1. Draw Lines and Shapes
        2. 4.5.1.2. Draw Background Color or Fill a Shape
        3. 4.5.1.3. Load and Draw MBM or MIF Images
        4. 4.5.1.4. Draw an Image with a Transparent Section
      2. 4.5.2. Intermediate Recipes
        1. 4.5.2.1. Load a JPG or PNG Image
        2. 4.5.2.2. Draw Text to the Screen
        3. 4.5.2.3. Load Fonts
        4. 4.5.2.4. Draw Controls Inside Another Control
      3. 4.5.3. Advanced Recipes
        1. 4.5.3.1. Use Off-Screen Images for Drawing
        2. 4.5.3.2. Load GIF Animation Images
        3. 4.5.3.3. Draw Skins as Backgrounds (S60 Only)
        4. 4.5.3.4. Draw Outside the Symbian OS Application Framework
        5. 4.5.3.5. Draw with Direct Screen Access
    6. 4.6. 3D Graphics Using OpenGL ES
      1. 4.6.1. OpenGL ES Primer
      2. 4.6.2. OpenGL to OpenGL ES
      3. 4.6.3. Easy Recipes
        1. 4.6.3.1. Full-Screen Setup
        2. 4.6.3.2. Display a 3D Object
        3. 4.6.3.3. Translate a 3D Object
        4. 4.6.3.4. Rotate a 3D Object
      4. 4.6.4. Intermediate Recipes
        1. 4.6.4.1. Apply a Texture to a 3D Object
        2. 4.6.4.2. Part-Screen Setup
      5. 4.6.5. Advanced Recipes
        1. 4.6.5.1. Animate a Scene
        2. 4.6.5.2. Adapt Performances
      6. 4.6.6. Resources
    7. 4.7. Multimedia
      1. 4.7.1. Easy Recipes
        1. 4.7.1.1. Play an Audio Clip
        2. 4.7.1.2. Perform Basic Audio Operations
        3. 4.7.1.3. Play an Audio Tone
        4. 4.7.1.4. Play a MIDI File
      2. 4.7.2. Intermediate Recipes
        1. 4.7.2.1. Get the Default Multimedia Storage Location
        2. 4.7.2.2. Play a Video Clip
        3. 4.7.2.3. Audio Streaming
      3. 4.7.3. Advanced Recipes
        1. 4.7.3.1. Record Audio
        2. 4.7.3.2. Record a Phone Call
        3. 4.7.3.3. Display a Camera Viewfinder
        4. 4.7.3.4. Capture Still Images from a Camera
        5. 4.7.3.5. Record Video
      4. 4.7.4. Resources
    8. 4.8. Telephony
      1. 4.8.1. Easy Recipes
        1. 4.8.1.1. Handle Phone Calls
        2. 4.8.1.2. Send DTMF Tones to the Phone Line
        3. 4.8.1.3. Observe the Phone Line State
        4. 4.8.1.4. Retrieve the Network Signal Strength
        5. 4.8.1.5. Retrieve the Battery Status
        6. 4.8.1.6. Retrieve the IMEI Number of the Device
        7. 4.8.1.7. Retrieve the Current Network Name
        8. 4.8.1.8. Retrieve the Current Operator Name
        9. 4.8.1.9. Retrieve the Flight Mode Status
        10. 4.8.1.10. Retrieve the Network Registration Status
      2. 4.8.2. Intermediate Recipes
        1. 4.8.2.1. Retrieve the Phone Number from an Incoming/Outgoing Call
        2. 4.8.2.2. Match a Name to a Phone Number
        3. 4.8.2.3. Retrieve the IMSI Number of the SIM Card
        4. 4.8.2.4. Retrieve the Phone Lock Status
      3. 4.8.3. Advanced Recipes
        1. 4.8.3.1. Retrieve Cell ID and Network Information
        2. 4.8.3.2. Retrieve Call Forwarding Status
        3. 4.8.3.3. Retrieve Call Barring Status
    9. 4.9. Connectivity
      1. 4.9.1. Easy Recipes
        1. 4.9.1.1. Print over IrDA
        2. 4.9.1.2. Discover Infrared Devices
        3. 4.9.1.3. Discover Bluetooth Devices
        4. 4.9.1.4. Discover Bluetooth Services for a Given Device
      2. 4.9.2. Intermediate Recipes
        1. 4.9.2.1. Use the Sockets API
        2. 4.9.2.2. Create a Simple OBEX Client
        3. 4.9.2.3. Create a Simple OBEX Server over Bluetooth
      3. 4.9.3. Advanced Recipes
        1. 4.9.3.1. Advertise Bluetooth Services
    10. 4.10. Location-Based Services
      1. 4.10.1. Easy Recipes
        1. 4.10.1.1. Get the List of Available Positioning Technology Modules
        2. 4.10.1.2. Retrieve the Current Module Status Information
        3. 4.10.1.3. Receive Module Status Change Notifications
        4. 4.10.1.4. Set the Module Selection Criteria
      2. 4.10.2. Intermediate Recipes
        1. 4.10.2.1. Request Location Information
        2. 4.10.2.2. Request Extended Location Information
  11. 5. Next Level Development
    1. 5.1. Advanced Technologies
      1. 5.1.1. Publish and Subscribe: System-wide Properties
      2. 5.1.2. Creating a Server Process: File Sharing
      3. 5.1.3. Advanced Platform-Specific User Interface
      4. 5.1.4. Advanced Messaging: A New Protocol
    2. 5.2. Symbian Partners Only
      1. 5.2.1. File Server Plug-in: Separate File System
      2. 5.2.2. Advanced Multimedia: Additional Format Streaming
    3. 5.3. Advanced Application Deployment
      1. 5.3.1. Automatic Installation
      2. 5.3.2. Custom Install
      3. 5.3.3. Embedded Binaries
  12. 6. Releasing Your Application
    1. 6.1. What To Do Before You Release Your Application
      1. 6.1.1. Look At It!
      2. 6.1.2. Test It!
      3. 6.1.3. Optimize It!
      4. 6.1.4. Protect It!
      5. 6.1.5. Sign It!
      6. 6.1.6. Internationalize It!
    2. 6.2. How To Distribute Your Application
      1. 6.2.1. Network Operators
      2. 6.2.2. Independent Software Channels
      3. 6.2.3. Content Aggregators
      4. 6.2.4. Pre-Installed Applications
      5. 6.2.5. Open Source
    3. 6.3. Where To Go Next
      1. 6.3.1. Symbian Press Books
      2. 6.3.2. Partnering with Symbian
      3. 6.3.3. Partnering Within the Symbian Ecosystem

Product information

  • Title: Quick Recipes on Symbian OS: Mastering C++ Smartphone Development
  • Author(s):
  • Release date: August 2008
  • Publisher(s): Wiley
  • ISBN: 9780470997833