The following code snippet explains how to set an alarm in S60. This alarm is different from from the clock application's alarm and picks the same tone set for the calendar application's alarm. If vibration alert is on for the currently set profile, then vibrating alert will also be played when the alarm expires.
#include <ASCliSession.h>
#include <ASShdAlarm.h>
#include <ASShdDefs.h>
Link Against : alarmclient.lib
Link Against : alarmshared.libRASCliSession iSession; // client interface to alarm server
iSession.Connect();
TASShdAlarm iAlarm; //Alarm object
TTime ihomeTime;
ihomeTime.HomeTime(); // Get Current Hometime(local time set in mobile)
Tint interval;
// interval – Give seconds after which alarm should expire
TTimeIntervalSeconds intervalSecs(interval);
//Returns the time alarm is scheduled to expire
TTime& iNDT = iAlarm.NextDueTime();
//Set the NextDueTime in which alarm will expire
iNDT = ihomeTime + intervalSecs;
TAlarmMessage& imessage(iAlarm.Message());
imessage.Copy(_L("Alarm")); //Alarm message
iSession.AlarmAdd(iAlarm);
iSession.Close();
Bookmark
Email this
Hits: 411
Comments (0)

Write comment



