资料收集站

SDL

Thursday
Jan 08th
Text size
  • Increase font size
  • Default font size
  • Decrease font size

How to create alarm

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.

SDK Used : S60 3rd edition

#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();
Comments (0)Add Comment

Write comment

busy
 

Google 搜索

在线用户

We have 115 guests online