|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. --> |
|
3 <!-- This component and the accompanying materials are made available under the terms of the License |
|
4 "Eclipse Public License v1.0" which accompanies this distribution, |
|
5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". --> |
|
6 <!-- Initial Contributors: |
|
7 Nokia Corporation - initial contribution. |
|
8 Contributors: |
|
9 --> |
|
10 <!DOCTYPE concept |
|
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
|
12 <concept id="GUID-387DB01C-EA48-5A10-A960-9706F3D2D0B1" xml:lang="en"><title>Activating |
|
13 an Alarm on Given Days</title><shortdesc>This tutorial explains the steps required to activate an alarm |
|
14 that expires, or goes OFF on one or more days of the week. </shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
15 <section><title>Introduction</title> <p>The <codeph>TASShdAlarm</codeph> class |
|
16 provides functions that enable an alarm to repeat on specified days of the |
|
17 week. This alarm is known as a <i>Daily On Given Days</i> alarm. The alarm |
|
18 can be repeated weekly on a single day or on multiple days. The alarms can |
|
19 also be repeated at the same time on every specified day. </p> <p>If the user |
|
20 changes the system date or time, the alarm expires once. Unlike a <i>Repeat |
|
21 Once</i> alarm, a <i>Daily On Given Days</i> alarm is not deleted but rescheduled |
|
22 for the next available expiry time. </p> </section> |
|
23 <section><title>Procedure</title> <p>Follow the steps given below to create |
|
24 a <i>Daily On Given Days</i> alarm that is active on Monday and Wednesday |
|
25 of every week: </p> <ol id="GUID-55067C23-0A8E-5EC8-A029-8B2045BDAFC4"> |
|
26 <li id="GUID-C189432B-4468-56D1-B547-D5A9DBFCF998"><p>Create an alarm with |
|
27 the <codeph>TASShdAlarm</codeph> class. </p> </li> |
|
28 <li id="GUID-AA3EA741-F3AB-5A4D-B279-AA2C053D7313"><p>Use the<codeph>SetAlarmDays()</codeph> API |
|
29 to specify the required days. <codeph>EAlarmDayMonday</codeph> and <codeph>EAlarmDayWednesday</codeph> are |
|
30 the parameters to specify that the alarm must repeat on Monday and Wednesday |
|
31 as shown in the code fragment. </p> <p> <b>NOTE</b>: <xref href="GUID-1AA25731-023C-315B-8047-8FBFEEF71712.dita"><apiname>SetAlarmDays()</apiname></xref> must |
|
32 be specifically used for <codeph>EAlarmRepeatDefinitionRepeatDailyOnGivenDays</codeph> repeat |
|
33 definition only. </p> </li> |
|
34 <li id="GUID-81AC5FBA-A003-5196-B692-B53632467F01"><p>Use <codeph>RASCliSession</codeph> to |
|
35 create a session with the Alarm Server. </p> </li> |
|
36 <li id="GUID-A4D4B840-0A7A-58D4-A192-9CBCA12C1493"><p>Add the alarm to the |
|
37 Alarm Server using the <xref href="GUID-1AA25731-023C-315B-8047-8FBFEEF71712.dita"><apiname>AlarmAdd()</apiname></xref> API. </p> </li> |
|
38 </ol> <p>The following code fragment illustrates how to activate an alarm |
|
39 on the given days: </p> <codeblock id="GUID-876EF47E-4699-54C7-B102-518679A7DF3B" xml:space="preserve"> |
|
40 #include <ASCliSession.h> // For RASCliSession. |
|
41 #include <ASShdAlarm.h> // For TASShdAlarm. |
|
42 |
|
43 … |
|
44 |
|
45 // Create an alarm that is active on Monday and Wednesday. |
|
46 TASShdAlarm alarm; |
|
47 alarm.RepeatDefinition() = EAlarmRepeatDefinitionRepeatDailyOnGivenDays; |
|
48 alarm.SetAlarmDays( EAlarmDayMonday | EAlarmDayWednesday ); |
|
49 |
|
50 // Connect to Alarm Server. |
|
51 RASCliSession alarmSession; |
|
52 User::LeaveIfError( alarmSession.Connect() ); |
|
53 CleanupClosePushL( alarmSession ); |
|
54 |
|
55 // Add the alarm to Alarm Server. |
|
56 User::LeaveIfError( alarmSession.AlarmAdd( alarm ) ); |
|
57 |
|
58 CleanupStack::PopAndDestroy(); |
|
59 </codeblock> </section> |
|
60 <section><title>Results</title> <p>The alarm is set to repeat every week on |
|
61 Monday and Wednesday. </p> </section> |
|
62 </conbody><related-links> |
|
63 <link href="GUID-114D4F3F-9358-5B50-94DC-45CCBA783DF4.dita"><linktext>Alarm Server |
|
64 Overview</linktext></link> |
|
65 <link href="GUID-E6788741-EF34-57B7-B4D4-8AAC21B25774.dita"><linktext>Alarm Server |
|
66 Concepts</linktext></link> |
|
67 </related-links></concept> |