How to create alarm
来源:互联网 发布:互相依靠知乎 编辑:程序博客网 时间:2024/05/21 21:49
Reviewer Approved
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.lib
RASCliSession 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();
Description
S60 devices that are switched off can switch on automatically to react to alarm events.
In the alarm startup mode, the user will see and hear the alarm and can choose whether the phone will be switched on.
The alarm server (RASCliSession) can be used to set an alarm to wake up the phone in the alarm startup mode.
Solution
Alarms can be set programmatically to turn on the device (in alarm startup mode) at a specified time. Note however, that there are no APIs available to initiate a normal power-up cycle directly - when using alarms, user interaction is required to switch on the device in alarm startup mode.
A specific flag must be set for the alarm (TASShdAlarm) to indicate that it is a wakeup alarm and should wake the device up even when powered off.
const TInt KWakeupAlarmFlagIndex = 0;
TASShdAlarm alarm;
alarm.ClientFlags().Set( KWakeupAlarmFlagIndex );
- How to create alarm
- How to create singleton
- How to create WCF
- How to Create Tables
- Siebel HOW TO: How to create Products?
- How to Create a Customer
- How to create Firefox extensions
- How to create new geodatabases
- how to create cifs.ko
- How to create EPS files...
- How to create PFX file
- how to create a Makefile
- [AngularJS] How to create Directives?
- How to create recovery image
- how to create proxies pool
- How to create xorg.conf
- How to create more time?
- How to create function polymorphism in C
- 火狐关于html注释符的bug
- 慌------
- worker process 3577 exited on signal 11模拟
- DWR中Java方法的参数及返回值上篇
- 年度学习计划 (The study plan for next year)
- How to create alarm
- 转帖]汉语与英语的比较
- 简述C和C++程序员学习历程
- 饮水思源:Ubuntu用户应关注Debian
- JDK的RMI处理远程程序调用
- 随机读取txt文件某一行
- 新型的大型bbs架构(squid+nginx)
- SOCKET TCP 发送和接收示例代码
- 自动生成遮罩bmp图层