Websites Navigation: Airbit | Shop | m-shell.net
Languages: EN | DE

World Server Example

The concepts of this and the next two chapters are illustrated by developing a module accessing the Symbian "world server". The client API to this server is the Symbian class RWorldServer. WorldModule.cpp contains the complete source of the module and is part of the NMI SDK.

We call our module world[1], and after studying the services offered by the world server API, we specify it as follows:

  1. The module world should provide the following functions:
    • world.count()→Number returns the number of cities in the database.
    • world.find(city,country=null)→Array searches for the first city with the given name or name prefix. The search can optionally be limited to a country.
    • world.first()→Array returns the first city in the database.
    • world.home()→Array returns the configured home city of the phone owner.
    • world.next()→Array returns the next city in the database.
  2. A city should be returned as an array with the following members:

    KeyContents
    nameThe city's name.
    natThe city's nationial phone number code.
    areaThe city's area code.
    utcofsThe city's time zone as an offset to UTC.
    latThe latitude of the city's position.
    longThe longitude of the city's position.
    countryThe name of the country the city is in.
    capitalThe name of the country's capital.

    If the city does not exist, the functions should return null.

  3. For the sake of this example, we would also like the module to maintain a variable world.calls counting the number of calls we make to the module.

© 2004-2011 airbit AG, CH-8008 Zürich
Document AB-M-NMI-887
mShell Home  > Documentation  > Manuals