`
`Creating Location
`Services for the
`Wireless Web
`
`Johan Hjelm
`
`Wiley Computer Publishing
`
`John Wiley & Sons, Inc.
`
`UA-1011.001
`
`
`
`Publisher: Robert Ipsen
`Editor: Carol A. Long
`Developmental Editor: Adaobi Obi
`Managing Editor: Angela Smith
`New Media Editor: Brian Snapp
`Text Design & Composition: D&G Limited, LLC
`
`Designations used by companies to distinguish their products are often claimed as
`trademarks. In all instances where John Wiley & Sons, Inc., is aware of a claim, the product
`names appear in initial capital or ALL CAPITAL LETTERS. Readers, however, should contact
`the appropriate companies for more complete information regarding trademarks and
`registration.
`
`This book is printed on acid-free paper.
`
`Copyright © 2002 by Johan Hjelm. All rights reserved.
`
`Published by John Wiley & Sons, Inc., New York
`
`Published simultaneously in Canada.
`
`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 as permitted under Sections 107 or 108 of the 1976 United States
`Copyright Act, without either the prior written permission of the Publisher, or authoriza-
`tion through payment of the appropriate per-copy fee to the Copyright Clearance Center,
`222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 750-4744. Requests to
`the Publisher for permission should be addressed to the Permissions Department, John
`Wiley & Sons, Inc., 605 Third Avenue, New York, NY 10158-0012, (212) 850-6011, fax (212)
`850-6008, E-Mail: PERMREQ @ WILEY.COM.
`
`This publication is designed to provide accurate and authoritative information in regard
`to the subject matter covered. It is sold with the understanding that the publisher is not
`engaged in professional services. If professional advice or other expert assistance is
`required, the services of a competent professional person should be sought.
`
`Library of Congress Cataloging-in-Publication Data:
`
`Hjelm, Johan.
`Creating location services for the wireless web : professional
`developer’s guide / Johan Hjelm.
`p. cm.
`ISBN 0-471-40261-3
`1. Wireless Application Protocol (Computer network protocol) 2. Web
`site development. 3. Geographic information systems. 4. Cellular
`telephone systems.
`I. Title.
`TK5105.5865.H554 2002
`005.2'76– –dc21
`
`2001006512
`
`Printed in the United States of America.
`
`10 9 8 7 6 5 4 3 2 1
`
`UA-1011.002
`
`
`
`Professional Developer’s Guide Series
`Other titles in the series:
`
`Mobile Information Device Profile for Java 2 Micro Edition by Enrique
`Ortiz and Eric Giguere, ISBN 0-471-03465-7
`
`Voice XML: Strategies and Techniques for Effective Voice Application
`Development by Chetan Sharma and Jeff Kunins, ISBN 0-471-41893-5
`
`WAP Integration by Robert Laberge and Srdjan Vujosevic,
`ISBN 0-471-41767-X
`
`XSLT: The Ultimate Guide to Transforming Web Data by Johan Hjelm and
`Peter Stark, ISBN 0-471-40603-1
`
`GPRS and 3G Wireless Applications by Christoffer Andersson,
`ISBN 0-471-41405-0
`
`Constructing Intelligent Agents Using Java by Joseph P. Bigus and
`Jennifer Bigus, ISBN, 0-471-39601-X
`
`Advanced Palm Programming by Steve Mann and Ray Rischpater,
`ISBN 0-471-39087-9
`
`WAP Servlets by John L. Cook, III, ISBN, 0-471-39307-X
`
`Java 2 Micro Edition by Eric Giguere, ISBN 0-471-39065-8
`
`Scripting XML and WMI for Microsoft® SQL Server™ 2000 by Tobias
`Martinsson, ISBN 0-471-39951-5
`
`UA-1011.003
`
`
`
`Location-Based Services in Terminals
`
`297
`
`use up a significant portion of the traffic, assuming that the return messages
`with the personalized information are the same, independent of the technology
`used. Another matter is pricing. Nobody knows how the tariffs will be set in the
`end, but given the charges of some European operators for the GPRS traffic
`(the packet data traffic on the GSM network), it would become extremely
`expensive to keep sending your position.
`
`Benefon Esc
`One of the first mobile phones that has a built-in GPS receiver is the Benefon
`Esc, built by the other Finnish mobile phone company, which in a sense com-
`bines the best of two worlds (Benefon is actually based in Finland, the same as
`market leader Nokia, but it has never reached their market volumes and remains
`specialized in niche applications). It is shown in Figure 11.1. While it uses GPS
`and has all the mobile communications possibilities of a mobile phone, it actu-
`ally loses out because the GPS function cannot handle assisted GPS.
`
`Strictly speaking, with the Benefon Esc you are not developing for the mobile
`phone; instead, you are developing for the system. The adaptation of the data
`is done in the service center (in other words, the application server), and the
`phone is providing coordinates that are used to adapt the data. The service
`center is a specialized application server (although it should not be too hard
`for application server developers to provide this kind of functionality if it
`becomes popular). The phone has a built-in GPS receiver, but it can also
`
`Figure 11.1 The Benefon Esc.
`
`UA-1011.004
`
`
`
`298
`
`C H A P T E R 1 1
`
`receive position information from the GSM network (or, strictly speaking, the
`service center can).
`
`To enable development by others and to allow service providers to supply
`information, Benefon has released the protocol, the Mobile Phone Telematics
`Protocol, which is used between a service center and a terminal. It uses the
`Short Message System (SMS) of GSM as a carrier format, but that is not an
`absolute binding—other carrier formats could be used if required. The format
`has two parts, text and binary, so the conversion should be simple. The com-
`munication between the service center and the mobile terminal is binary, but
`when communicating with a regular GSM phone, it uses text format. Functions
`enabled in the protocol are primarily intended to handle emergency calls and
`security and safety applications.
`
`In addition to the message part of the protocol, it also has a numbering for a
`series of images that can be used as icons. They include circles, squares,
`arrows (relative to the compass directions), and a lethal danger symbol in
`addition to icons for buildings such as banks, hospitals, kiosks, camping
`sites, and photo shops. It also includes religious buildings such as syna-
`gogues, mosques, churches, and temples. There are icons to represent differ-
`ent modes of transportation (possibly only Finnish developers would have
`imagined a snowmobile as a standard mode of transportation) and travel
`symbols such as electric outlets, sight, shower, toilet (and again, betraying its
`Finnish roots with symbols for lean-to shelter and orienteering control point).
`Sports symbols include golf, riding, ice hockey, and swimming (but not
`bandy).
`
`The commands are based on characters already implemented in GSM and use
`ASCII text as the base format. Messages in the protocol have a header that is
`always constant. All field lengths except the header and CMD include one field
`separator character; in other words, the preceding underscore. The field sepa-
`rator is the underscore ( _ ) character. All messages from the service center or
`normal to a GSM phone start with a question mark (?), and all messages from a
`terminal using the protocol terminal start with an exclamation point (!). If
`information is not available, the corresponding field is filled with “-” characters.
`
`The basic commands of the protocol are listed in Table 10.1. They are what are
`supported by the Esc telephone, but Benefon also has several other models
`that can provide functions that are more complicated.
`
`The idea is that the service center sends one of these commands to the mobile
`terminal, which then responds with a message reporting its status and position.
`It looks like Table 10.2. The second-row figures are the length of the fields, the
`third row is an explanation, and the fourth is an example.
`
`The Benefon protocol does not use HTTP but SMS for data transfer, which
`makes it somewhat different from Web-based applications. The terminal can
`
`UA-1011.005
`
`
`
`Location-Based Services in Terminals
`
`299
`
`Table 10.1 The Basic Commands of the MPTP Protocol
`
`COMMAND
`CRO
`
`EMG
`LOC
`NMR
`RSE
`RWP
`STO
`
`SWP
`TRC
`
`DIRECTION
`EXPLANATION
`Create route: MPTP terminal can send MPTP terminal to SC
`create route request to SC.
`Emergency
`Location information
`Network measurement report
`Route sending
`Request waypoints
`Stop trigger: This will stop only those
`triggers, which are activated with the
`easy version of tracking TRC.
`Send waypoints
`Easy version of tracking
`
`MPTP terminal to SC
`SC to MPTP terminal to SC
`SC to MPTP terminal to SC
`SC to MPTP terminal to SC
`MPTP terminal to SC
`SC to MPTP terminal
`
`SC to MPTP terminal
`SC to MPTP terminal
`
`send back a position in response to a request from the service center. The
`request from the service center is sent as a response to a request from the user.
`
`The TRC command is intended to set up a tracking service based on the num-
`ber of tracking messages and the interval between them (the tracking messages
`here go from the phone to the service center).
`
`The system can also transmit a route to the terminal by using the RSE com-
`mand. The route points can have names (instead of numbers) in addition to
`coordinates. Up to four route points can be sent in one message, but by using
`the “part” field, messages can be chained so that up to 99 messages can be sent
`(because the field length is six and has to contain the number of the current
`message, a slash, and the number of total messages). The last point of the route
`has a name and an icon (one of the encoded icons that are part of the protocol).
`The terminal can also request a route and a waypoint from the service center.
`
`The terminal can also be used to send network measurements to the service
`center (and it is likely that this market will be big for it in the short run, because
`there are many network operators who want to measure where their competi-
`tors’ cells are located). The network measurement includes the country and
`network codes, the cell identification number, the time advance, the transmis-
`sion power, and other related data.
`
`SIM Toolkit
`
`Traffic is one factor to consider, because it might make GPS receivers in termi-
`nals unsustainable. Another factor is the processing capacity. The mobile station
`
`UA-1011.006
`
`
`
`available
`blank if not
`GPS. Can be
`Calculated from Calculated from Optional
`
`available
`left blank if not
`GPS. Can be
`
`60
`DATA
`
`7
`
`DIRECTION
`
`8
`
`SPEED
`
`norm
`and test (test mode)
`(normal); emer (emergency);
`Three values are possible: norm
`Indicates terminal operating status. Battery status in Two possible values:
`
`gps
`
`gnet (GSM network)
`ps (GPS receiver);
`
`025%
`figures
`charged, three
`percent of fully
`
`4
`
`SOURCE
`POSITION
`
`5
`
`STATUS
`BATTERY
`
`5
`
`MODE
`
`6
`
`3
`
`1
`
`HEADERCOMMANDPART
`
`Table 10.2Position and Status Reporting Message
`
`300
`
`90deg
`
`40 km/h
`
`31.12.1999; 12:13:15
`
`2
`
`(WGS84); 2 (UTM)
`0 (unknown); 1
`Three possible values: Position information. If the GPS time
`
`20
`STAMP
`TIME
`
`25
`POSITION
`
`2
`
`FORMAT
`POSITION
`
`10/12
`
`LOC
`
`command this message is
`Indicates which part of the
`
`Table 9.1
`According to
`
`N68.28.43,9 E027.27.02,4
`available, filled with blanks.
`be sent. If no position is
`the network position can
`position is not available,
`
`UA-1011.007



