Symbian OS Communications Programming. 2nd Edition

Similar documents
S60 Programming A Tutorial Guide

QoS OVER HETEROGENEOUS NETWORKS

SDH/SONET Explained in Functional Models

Next Generation Networks Perspectives and Potentials. Dr Jingming Li Salina LiSalina Consulting, Switzerland Pascal Salina Swisscom SA, Switzerland

Multimedia Messaging Service

Network Convergence. Services, Applications, Transport, and Operations Support. Hu Hanrahan. John Wiley & Sons, Ltd

Digital Data Integrity

COMPUTATIONAL DYNAMICS

FUZZY LOGIC WITH ENGINEERING APPLICATIONS

Inside Symbian SQL. Lead Authors Ivan Litovski with Richard Maynard. Head of Technical Communications, Symbian Foundation Jo Stichbury

Advanced Wireless Networks

Applied C# in Financial Markets. Martin Worner

ADVANCED CELLULAR NETWORK PLANNING AND OPTIMISATION 2G/2.5G/3G... EVOLUTION TO 4G

Exploiting Distributed Resources in Wireless, Mobile and Social Networks Frank H. P. Fitzek and Marcos D. Katz

EMERGING WIRELESS MULTIMEDIA SERVICES AND TECHNOLOGIES

SHORT MESSAGE SERVICE (SMS)

Semantic Web Technologies Trends and Research in Ontology-based Systems

Common Design Patterns for Symbian OS

Speech in Mobile and Pervasive Environments

Video Compression and Communications

Study Guide. Robert Schmidt Dane Charlton

COPYRIGHTED MATERIAL. Introduction. 1.1 What is in this Book

Linux Command Line and Shell Scripting Bible. Third Edtion

Join the p2p.wrox.com. Wrox Programmer to Programmer. Beginning PHP 5.3. Matt Doyle

7 Windows Tweaks. A Comprehensive Guide to Customizing, Increasing Performance, and Securing Microsoft Windows 7. Steve Sinchak

Common Design Patterns for Symbian OS

Cloud Phone Systems. Andrew Moore. Making Everything Easier! Nextiva Special Edition. Learn:

Internet Security Cryptographic Principles, Algorithms and Protocols

Symbian OS C++ for Mobile Phones Volume 2

Developing Software for Symbian OS

COPYRIGHTED MATERIAL. Background. 1.1 A Little History. 1.2 About UIQ Technology

GSM Architecture, Protocols and Services Third Edition

Security for Microsoft Windows System Administrators

LEGITIMATE APPLICATIONS OF PEER-TO-PEER NETWORKS

SPECTRAL ELEMENT METHOD IN STRUCTURAL DYNAMICS

Linux Command Line and Shell Scripting Bible

Mastering UNIX Shell Scripting

LEGITIMATE APPLICATIONS OF PEER-TO-PEER NETWORKS DINESH C. VERMA IBM T. J. Watson Research Center A JOHN WILEY & SONS, INC., PUBLICATION

The Accredited Symbian Developer Primer

PROGRAMMING MOBILE DEVICES

TOWARDS THE SEMANTIC WEB

Professional ASP.NET 2.0 Databases. Thiru Thangarathinam

Multi-Core Programming

COSO Enterprise Risk Management

Beginning Transact-SQL with SQL Server 2000 and Paul Turley with Dan Wood

Real-Time Optimization by Extremum-Seeking Control

Fundamentals of Operating Systems. Fifth Edition

GSM Architecture, Protocols and Services

Validation of Communications Systems with SDL The Art of SDL Simulation and Reachability Analysis

INFORMATION RETRIEVAL: SEARCHING IN THE 21ST CENTURY

Linux. The book you need to succeed! Boot up to Ubuntu, Fedora, KNOPPIX, Debian, opensuse, and 13 Other Distributions Edition.

An Introduction to Programming with IDL

The Internet of Things

Relational Database Index Design and the Optimizers

Network Performance Analysis

COMPONENT-ORIENTED PROGRAMMING

Securing SCADA Systems. Ronald L. Krutz

THE ARCHITECTURE OF COMPUTER HARDWARE, SYSTEM SOFTWARE, AND NETWORKING

IP MULTICAST WITH APPLICATIONS TO IPTV AND MOBILE DVB-H

Beginning Web Programming with HTML, XHTML, and CSS. Second Edition. Jon Duckett

Hands-On Oracle Application Express Security

Distributed Development at Symbian. Deepak Modgil Configuration Management Engineer Symbian Ltd

Implementing Security and Tokens: Current Standards, Tools, and Practices


TASK SCHEDULING FOR PARALLEL SYSTEMS

Agile Database Techniques Effective Strategies for the Agile Software Developer. Scott W. Ambler


Inside Relational Databases with Examples in Access

0 Mastering Microsoft Office

Concrete Abstractions

Microprocessor Theory

MOBILE PEER TO PEER (P2P)

HASHING IN COMPUTER SCIENCE FIFTY YEARS OF SLICING AND DICING

DIGITAL VIDEO DISTRIBUTION IN BROADBAND, TELEVISION, MOBILE AND CONVERGED NETWORKS

Multimedia Messaging Service

Networking. 11th Edition. by Doug Lowe

iwork DUMmIES 2ND EDITION FOR

Client Server System for e-services Providing in Mobile Communications Networks

HTML5 MOBILE WEBSITES

Essential Angular for ASP.NET Core MVC

ethernet networks Fourth Edition GILBERT HELD Design Implementation Operation Management 4-Degree Consulting, Macon, Georgia, USA

Opera - Simply The Best Internet Experience. 3Q04 Results. November 12, 2004

Wireless Sensor Network Designs. Anna Hać University of Hawaii at Manoa, Honolulu, USA

Pump Solutions Group CASE STUDY. The Whitewater gateway and the Veeam software work very well together to improve VM data protection.

Oracle PL/SQL. DUMmIES. by Michael Rosenblum and Dr. Paul Dorsey FOR

Web Development with Java

DIFFERENTIAL EQUATION ANALYSIS IN BIOMEDICAL SCIENCE AND ENGINEERING

Creating Web Pages. Learn to: Bud E. Smith. Making Everything Easier! 9th Edition. Design, build, and post a Web page

Mastering. Pascal and Delphi Programming

Information Retrieval: SciFinder

DATA VISUALIZATION WITH FLASH BUILDER

MODERN MULTITHREADING

Government-issued identification numbers (e.g., tax identification numbers)

Microsoft Computer Vision APIs Distilled

Practical Database Programming with Visual Basic.NET

OpenSolaris. The book you need to succeed! Nicholas A. Solter, Gerald Jelinek, and David Miner. Explore the OpenSolaris operating environment

Flash Lite. Mobile Development. Professional. Build Flash Applications for Mobile Devices. Jermaine G. Anderson. Join the p2p.wrox.

Client Server System for e-services Access Using Mobile Communications Networks

Oracle 10g Developing Media Rich Applications

Ruby on Rails. Bible

Transcription:

Symbian OS Communications Programming 2nd Edition

Symbian OS Communications Programming 2nd Edition By Iain Campbell With Dale Self, Emlyn Howell, Ian Bunning, Ibrahim Rahman, Lucy Caffery, Malcolm Box, Matthew Elliott, Natasha Ho, Pierre Cochart, Tim Howes, Twm Davies Reviewed by Chris Notton, Dan Handley, David Harper, David Singleton, Donald Page, Graeme Duncan, Ian Bunning, John Roe, Malcolm Box, Tim Howes Head of Symbian Press Freddie Gjertsen Managing Editor Satu McNabb

Copyright 2007 Published by Symbian Software Ltd John Wiley & Sons, Ltd The Atrium, Southern Gate, Chichester, West Sussex PO19 8SQ, England Telephone (+44) 1243 779777 Email (for orders and customer service enquiries): cs-books@wiley.co.uk Visit our Home Page on www.wileyeurope.com or www.wiley.com All Rights Reserved. No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except under the terms of the Copyright, Designs and Patents Act 1988 or under the terms of a licence issued by the Copyright Licensing Agency Ltd, 90 Tottenham Court Road, London W1T 4LP, UK, without the permission in writing of the Publisher. Requests to the Publisher should be addressed to the Permissions Department, John Wiley & Sons Ltd, The Atrium, Southern Gate, Chichester, West Sussex PO19 8SQ, England, or emailed to permreq@wiley.co.uk, or faxed to (+44) 1243 770620. Designations used by companies to distinguish their products are often claimed as trademarks. All brand names and product names used in this book are trade names, service marks, trademarks or registered trademarks of their respective owners. The Publisher is not associated with any product or vendor mentioned in this book. This publication is designed to provide accurate and authoritative information in regard to the subject matter covered. It is sold on the understanding that the Publisher is not engaged in rendering professional services. If professional advice or other expert assistance is required, the services of a competent professional should be sought. The Bluetooth word mark and logos are registered trademarks owned by Bluetooth SIG, Inc. and any use of such marks by Symbian Software Ltd is under license. Other trademarks and trade names are those of their respective owners. Other Wiley Editorial Offices John Wiley & Sons Inc., 111 River Street, Hoboken, NJ 07030, USA Jossey-Bass, 989 Market Street, San Francisco, CA 94103-1741, USA Wiley-VCH Verlag GmbH, Boschstr. 12, D-69469 Weinheim, Germany John Wiley & Sons Australia Ltd, 42 McDougall Street, Milton, Queensland 4064, Australia John Wiley & Sons (Asia) Pte Ltd, 2 Clementi Loop #02-01, Jin Xing Distripark, Singapore 129809 John Wiley & Sons Canada Ltd, 6045 Freemont Blvd, Mississauga, Ontario, L5R 4J3, Canada Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic books. Library of Congress Cataloging-in-Publication Data Campbell, Iain. Symbian OS communications programming / Iain Campbell, with Dale Self... [et al.]. 2nd Edition. p. cm. Previously published: Symbian OS communications programming / Michael J. Jipping, 2002. Includes bibliographical references and index. ISBN 978-0-470-51228-9 (pbk. : alk. paper) 1. Symbian OS (Computer file) 2. Operating systems (Computers) 3. Data transmission systems. I. Jipping, Michael J. Symbian OS communications programming. II. Title. QA76.76.063J56 2997 055.4 482 dc22 2007011028 British Library Cataloguing in Publication Data A catalogue record for this book is available from the British Library ISBN: 978-0-470-51228-9 Typeset in 10/12pt Optima by Laserwords Private Limited, Chennai, India Printed and bound in Great Britain by Bell & Bain, Glasgow This book is printed on acid-free paper responsibly manufactured from sustainable forestry in which at least two trees are planted for each one used for paper production.

Contents Contributors About the Authors Acknowledgments Symbian Press Acknowledgements ix xi xv xvii Section I: Introduction and Overview 1 Introduction 3 1.1 What is in this Book 3 1.2 What isn t in this Book 4 1.3 Expected Level of Knowledge 6 1.4 Structure of this Book 7 1.5 To which Versions of Symbian OS does the Information in this Book Apply? 8 1.6 Example Applications 9 1.7 Reading Guide 9 1.8 Other Sources of Information 9 1.9 The History of Symbian OS Communications 10 1.10 Summary 12 2 Overview 13 2.1 Low-level Functionality 14 2.2 High-level Functionality 19 2.3 Summary 23

vi CONTENTS Section II: Low-level Technology and Frameworks 3 An Introduction to ESOCK 27 3.1 Overview of ESOCK 27 3.2 Into Practice 52 3.3 Summary 62 4 Bluetooth 63 4.1 Bluetooth Technology Overview 63 4.2 Bluetooth in Symbian OS 82 4.3 Example Symbian OS Bluetooth Application 112 4.4 AV Protocols and Profiles 118 4.5 Summary 124 5 Infrared 125 5.1 Introduction 125 5.2 Infrared Overview 125 5.3 IrDA in Symbian OS 129 5.4 Summary 153 6 IP and Related Technologies 155 6.1 IP Networks Overview 156 6.2 IP Networks and Symbian OS 160 6.3 Network Bearer Technologies in Symbian OS 163 6.4 Using the Network Connection 175 6.5 Information Gathering and Connection Management 193 6.6 Quality of Service 197 6.7 Summary 203 7 Telephony in Symbian OS 205 7.1 Overview 206 7.2 Using the ETel ISV API 207 7.3 Restrictions and Considerations 211 7.4 Summary 214 Section III: High-level Technology and Frameworks 8 Receiving Messages 217 8.1 Example Application Summary Screen 218 8.2 The Message Server 220 8.3 The Message Store 223 8.4 Messaging Application Design and Implementation 233

CONTENTS vii 8.5 Receiving Application-specific SMS Messages 235 8.6 Summary 240 9 Sending Messages 241 9.1 Examples Provided in this Chapter 242 9.2 SendAs Overview 242 9.3 Services/Accounts 246 9.4 Technical Description 246 9.5 Using the UI Platform Send Dialogs 250 9.6 A Brief Background to MTMs 255 9.7 The Flickr MTM 257 9.8 The Flickr Data MTM 260 9.9 The Flickr UI MTM 262 9.10 Flickr Client MTM 263 9.11 The Flickr Server MTM 265 9.12 MTM DLLs and Platsec 268 9.13 FlickrMTM Shared Settings 269 9.14 Installation of an MTM 269 9.15 Summary 271 10 OBEX 273 10.1 OBEX Overview 273 10.2 OBEX in Symbian OS 289 10.3 Summary 341 11 HTTP 343 11.1 HTTP Overview 343 11.2 Getting Started: Creating a Session 344 11.3 Creating and Submitting a Transaction 347 11.4 Supplying Body Data 349 11.5 Monitoring a Transaction 350 11.6 Cancelling a Transaction 353 11.7 Closing a Transaction 353 11.8 Stringpool 353 11.9 Proxy Support 355 11.10 Cookie Handling 356 11.11 HTTP Connection Configuration 356 11.12 Platform Security 361 11.13 Filters 361 11.14 Summary 364 12 OMA Device Management 365 12.1 Introduction 365 12.2 Device Management In Symbian OS 366 12.3 OMA Device Management Essentials 367

viii CONTENTS 12.4 The Example DM Adapter 372 12.5 Summary 387 Section IV: Development Tips 13 Setting Up for Development 391 13.1 Bluetooth 391 13.2 IrDA 394 13.3 Network Connections for IP 396 13.4 Telephony 403 13.5 Help, help, my serial port s been stolen 404 13.6 Summary 406 14 The Future 407 14.1 Better Networks 407 14.2 Better Interaction 409 14.3 Better Services 410 14.4 The End 411 Appendix A: Web Resources 413 Appendix B: Authorizing FlickrMTM to Use Your Flickr Account 415 Appendix C: SendWorkBench.app Guide 419 Index 421

Contributors Head of Symbian Press Freddie Gjertsen Authors Iain Campbell Dale Self Emlyn Howell Ian Bunning Ibrahim Rahman Lucy Caffery Malcolm Box Matthew Elliott Natasha Ho Pierre Cochart Tim Howes Twm Davies Symbian Press Editorial Managing Editor Satu McNabb

x CONTRIBUTORS Reviewers and additional contributors Chris Notton Dan Handley David Harper David Singleton Donald Page Graeme Duncan Ian Bunning John Roe Malcolm Box Tim Howes

About the Authors Iain Campbell, lead author Iain joined the comms team (as it then was) in Symbian in 2001, working on Symbian OS v6.1, v7.0 and v7.0s for the Nokia 7650, Sony Ericsson P800 and Nokia 6600, respectively. After spending a year working in the Bluetooth team creating the Symbian OS PAN profile implementation, he moved to Symbian s Technical Consulting group where he has spent the last three years helping Symbian s licensees and partners build Symbian OS-based phones. As part of this Iain has been involved in many aspects of Symbian OS from debugging components at all levels of the system, through advising on adaptation to particular hardware platforms, to high-level system design. Iain received an MEng in Information Systems Engineering from Imperial College, London, and enjoys spending his spare time finding out how things work. Malcolm Box Malcolm first joined Psion Software in 1998, shortly before it became Symbian. His first job was writing the kernel for the Ericsson R380 phone, following which he led the design and implementation of the Symbian OS Bluetooth stack. Subsequently he s worked in the System Architecture group, Symbian s reference design team and with licensees as a senior consultant. He has previously co-authored Symbian C++ for Mobile Phones and contributes to various open-source projects. He would like to thank his wife, Judith, and children Franz and Abigail for their support and patience during the writing of this book.

xii ABOUT THE AUTHORS Ian Bunning Ian attended Trinity Hall at the University of Cambridge, where he gained an MA in Computer Science. On graduating in 2001 he joined the Shortlink team at Symbian, and soon became the expert on the IrDA subsystem. Since then he has also worked on a number of OBEX projects, as well as a smaller number of Bluetooth projects the main one being part of the initial implementation of Bluetooth PAN profile. He is currently focusing on USB, but frequently supports maintenance work on IrDA and OBEX. Out of work hours, Ian is a keen photographer, and also makes items of jewellery. Lucy Caffery Pierre Cochart Lucy has been at Symbian since 2000, where she has worked for the Licensee Product Development team helping UIQ licensees to create Symbian products. Starting out as a Bluetooth specialist, she became Head of the Comms Porting group in LPD, a team which specializes in consultancy in all areas of the Symbian OS Comms subsystem. More recently Lucy has become the Deputy Head of LPD. Lucy has been involved in comms on all the UIQ devices that have shipped to date: Sony Ericsson P8xx, P9xx, M600i, W950i and P990, Motorola A92x, A1000 and M1000. Pierre Cochart graduated from King s College London in 2000. He then joined Symbian as a graduate in the telephony team to help with the development of the 7.0 OS release. In 2003 he joined Licensee Product Development group to work in the Comms Porting group where he assisted customers with software development in various areas of comms. Pierre is now responsible for handling the communications area for the Japanese licensees. Twm Davies Twm joined Symbian as a graduate in 1999. Twm has had a varied career within Symbian, initially working as a developer of the crystal messaging application which provided the UI to the Nokia communicator range, then as a technical consultant for Motorola, Nokia and significantly the technical lead on the first non-nokia S60 handset, the Siemens SX1. Twm currently works as Product Manager for performance. Twm graduated

ABOUT THE AUTHORS xiii from Cardiff University with a First Honours Computer Science BSc. Interests outside of work include collecting mispronunciations of his name, scuba diving, Vespas and he runs a web site selling his art works. Matt Elliott Matt joined Symbian in 2004 as a software engineer, and has spent his time at Symbian in the Device Provisioning team. He graduated with a BEng in Digital Electronics from the University of Kent, and coming from a hardware background still misses his soldering iron (but not the burnt fingers). Matt would like to thank all the past and present members of the Device Provisioning team for their carefully worded criticism/help, and his long suffering girlfriend Elaine. Natasha Ho Natasha joined Symbian in 1998, where she worked on the development of the Ericsson R380. Since then, she has contributed to almost every UIQ smartphone including the Motorola A920 and A1000, the Arima U300 and more recently the Sony Ericsson P800, P900, M600i, W950i and P990i. She has worked on various parts of the Symbian OS but now likes to concentrate solely on networking. Prior to Symbian, Natasha worked at Motorola designing and writing software for the GSM and GPRS cellular infrastructures. Natasha graduated from University College London with a BSc in Computer Science. Emlyn Howell Emlyn Howell has worked on various technologies within Symbian over the past seven years including messaging and telephony. He is currently the Comms Architect for the Reference Designs team. He lives and works in Cambridge. Tim Howes After studying for a PhD in the effects of indirect lightning strikes on power lines, Tim joined Symbian Software, where for seven years he has worked primarily within the Bluetooth area. Within the Bluetooth SIG, Tim represents Symbian on the Bluetooth Architecture Review Board, and contributes to the Core Specification, Audio Video and Medical Devices Working groups. Despite the high technology area Tim works in, he has a strong interest in mechanical timepieces.

xiv ABOUT THE AUTHORS Ibrahim Rahman Ibrahim has been at Symbian for eight years. Working as a software developer in areas including email and HTTP. Dale Self Dale started work for Psion Software in mid-1998, which transformed to Symbian about a week later. Initially working in the messaging team on an IMAP4 mail client, he later moved to the PAN team where he has worked with Bluetooth, OBEX and USB technologies ever since. During this time he has seen a great deal of growth; both in Symbian, and, sadly, in his waist measurement.

Acknowledgements Firstly we d like to thank the Symbian Press team who helped put this book together, especially Satu, who kept us working on it until it was finished without her it would probably be sitting half-written on various hard disks around Symbian. Secondly we d like to thank all of our wives, husbands, partners and significant others for putting up with us whilst we hid away in the evenings and weekends writing the material for this book. I d like to thank Apple for creating a computer that s a pleasure to use it made the whole editing process so much less painful. And finally I d like to extend an additional thank you to my wife Chris, who put up with me not moving from in front of the computer for a month whilst I pulled the book into shape. Iain Campbell

Symbian Press Acknowledgements Symbian Press would like to thank Iain for his patience during this project and for the countless hours he spent polishing the text into perfection. We d also like to thank the authors Dale, Emlyn, Ian, Ibrahim, Lucy, Malcolm, Matt, Natasha, Pierre, Tim and Twm for their dedication and hard work, and all the reviewers for their time and willingness to share their technical knowledge.