Alarm server events

The Alarm Server sends notifications to applications when alarm settings change; this includes indications when an alarm goes off. A client-side API for the alarm server is RASCliSession. It is a standard asynchronous service provider, and the client application should implement an active object to receive events.

To be able to use the Alarm Server services, client applications must first be connected to the server.

User::LeaveIfError(iAlarmServer.Connect());

In order to receive events, the NotifyChange(TRequestStatus &aStatus, TAlarmId &aAlarmId) function is called and the active object is set active.

iAlarmServer.NotifyChange(iStatus, iAlarmId); SetActive();

Notifications are cancelled by calling the NotifyOnChangeCancel() function.

 iAlarmServer.NotifyChangeCancel();

When alarm settings change, the RunL() function of the active object is called. Alarms in the alarm server database can be retrieved using the GetAlarmIdListL() function, which fills an array of alarm IDs.

void GetAlarmIdListL(RArray< TAlarmId > &aAlarmIds)

When using RArray, remember to call Close() or Reset() on it when it is not needed anymore. The GetAlarmDetails() function returns the TASShdAlarm structure for a specific alarm, which is identified by the alarm ID.

TInt GetAlarmDetails(TAlarmId aAlarmId, TASShdAlarm &aAlarm)

The TASShdAlarm structure contains information about an alarm, and information is accessed through simple inline functions. See the ASShdAlarm.h header file for further information.