Prev: DLL Structure
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:
- 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.
- A city should be returned as an array with the following members:
| Key | Contents |
| name | The city's name. |
| nat | The city's nationial phone number code. |
| area | The city's area code. |
| utcofs | The city's time zone as an offset to UTC. |
| lat | The latitude of the city's position. |
| long | The longitude of the city's position. |
| country | The name of the country the city is in. |
| capital | The name of the country's capital. |
| |
If the city does not exist, the functions should return null.
- 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.
Next: Module Class© 2004-2011 airbit AG, CH-8008 Zürich
Document AB-M-NMI-887