Alarm Server Example

The concepts of this chapter are illustrated by developing a module accessing the Symbian "alarm server". The client API to this server is the Symbian class RASCliSession. AlarmModule.cpp contains the complete source of the module and is also part of the NMI SDK.

We call our module alarm. And again, after studying the services offered by the alarm server API, we specify it:

  1. Alarms are identified by integers (TAlarmId is a TInt).
  2. The module alarm should provide the following functions:
  3. The module should respect the permissions granted by the user: ReadApp for all alarm functions, WriteApp for the functions modifying alarm data.
From this spec, we can directly write the skeleton of our module:

#include "NativeModule.h"
#include <asclisession.h>
#include <asshdalarm.h>

class AlarmModule : public NativeModule {
private:
  enum Functions {
    AddFunction, AllFunction, DeleteFunction, GetFunction, OnFunction,
    WaitFunction
  };

  RASCliSession session;
  TASShdAlarm alarm;

  // destroying the mod