Symbian3/SDK/Source/GUID-59D2B677-63D7-5FE7-98F4-549D9C235E56.dita
changeset 7 51a74ef9ed63
parent 0 89d6a7a84779
equal deleted inserted replaced
6:43e37759235e 7:51a74ef9ed63
       
     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-59D2B677-63D7-5FE7-98F4-549D9C235E56" xml:lang="en"><title>Alarm
       
    13 Play Tutorials</title><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    14 <p>This tutorial assists the device creators in customizing the Alarm Server
       
    15 behavior for playing an alarm continuously. </p>
       
    16 <p>The <xref href="GUID-8FAC10FB-BCD1-3373-9440-EF2EED70A861.dita"><apiname>RASCliSession</apiname></xref> class provides
       
    17 functions to set and get the continuous state for a previously created alarm. </p>
       
    18 <section><title>Introduction</title> <p>It is possible to customize or disable
       
    19 the UI application’s control of alarm sound intervals and durations. In certain
       
    20 scenarios, it may be preferable for the alarm sound to have an infinite duration.
       
    21 For more information on intervals and durations, refer to <xref href="GUID-A5F65344-BE05-5295-85BB-E8114505FB82.dita">Sound
       
    22 Control</xref>. </p> </section>
       
    23 <section><title>Procedure</title> <p>To play an alarm continuously, or to
       
    24 disable alarm play control, refer the following respective sections: </p> <ul>
       
    25 <li id="GUID-31AA12C8-38AE-5735-985B-40CB58A0D459"><p><b>Playing an alarm
       
    26 continuously</b> - A continuous alarm is one that does not follow the pattern
       
    27 of sound play defined as a series of intervals and durations in the <filepath>alarmserver.rsc</filepath> file.
       
    28 Instead, the alarm sound is played once and has an infinite interval and duration.
       
    29  </p> <p>Follow the steps given below to create a continuous alarm: </p><ol id="GUID-87FE2F8F-7181-5162-A312-AC0F0021640A">
       
    30 <li id="GUID-4B696D1D-F852-5609-BEA1-C31AE072AC2F"><p>Connect to the Alarm
       
    31 Server using <xref href="GUID-8FAC10FB-BCD1-3373-9440-EF2EED70A861.dita"><apiname>RASCliSession</apiname></xref>. </p> </li>
       
    32 <li id="GUID-44DC069A-FB71-566B-8B2A-22D84D02C85F"><p>Add a new <xref href="GUID-8FAC10FB-BCD1-3373-9440-EF2EED70A861.dita"><apiname>TASShdAlarm</apiname></xref> alarm. </p> </li>
       
    33 <li id="GUID-1014B745-72A6-52E8-8C19-F9667DB7E895"><p>Use the <xref href="GUID-8FAC10FB-BCD1-3373-9440-EF2EED70A861.dita"><apiname>SetContinuous()</apiname></xref> function
       
    34 to set the alarm as a continuous alarm. </p> <p>The <xref href="GUID-8FAC10FB-BCD1-3373-9440-EF2EED70A861.dita"><apiname>EAlarmRepeatDefintionRepeatDaily</apiname></xref> value
       
    35 makes the alarm repeat daily. </p> </li>
       
    36 <li id="GUID-F57517DA-9C66-5276-A7B3-882F9F7C1DD0"><p>Add the alarm to the
       
    37 Alarm Server by using the <xref href="GUID-8FAC10FB-BCD1-3373-9440-EF2EED70A861.dita"><apiname>AlarmAdd()</apiname></xref> function. </p> </li>
       
    38 </ol> <p>The following code snippet explains how to play an alarm continuously: </p> <codeblock id="GUID-CA419D6F-5918-5565-B51E-C71203F18C8F" xml:space="preserve">#include &lt;ASCliSession.h&gt; // For RASCliSession.
       
    39 #include &lt;ASShdAlarm.h&gt;   // For TASShdAlarm.
       
    40 
       
    41 …
       
    42 
       
    43 // Connect to Alarm Server.
       
    44 RASCliSession alarmSession;
       
    45 User::LeaveIfError( alarmSession.Connect() );
       
    46 CleanupClosePushL( alarmSession );
       
    47 
       
    48 // Create a daily alarm that once activated is continuous.
       
    49 TASShdAlarm alarm;
       
    50 alarm.RepeatDefinition() = EAlarmRepeatDefintionRepeatDaily; 
       
    51 alarm.SetContinuous( ETrue );
       
    52 
       
    53 // Add the alarm to Alarm Server.
       
    54 User::LeaveIfError( alarmSession.AlarmAdd( alarm ) );
       
    55 
       
    56 CleanupStack::PopAndDestroy();
       
    57 </codeblock><p/></li>
       
    58 <li id="GUID-3795991B-7CCD-57A9-B9D4-7ACE26A5CC06"><p><b>Disable alarm play
       
    59 control</b> - This is a special case of Alarm Play Interval configuration
       
    60 described in <xref href="GUID-A5F65344-BE05-5295-85BB-E8114505FB82.dita">Sound
       
    61 Control</xref> section. Disabling the Alarm Play control requires an empty
       
    62 interval list as shown in the following code snippet:</p> <codeblock id="GUID-FB21B72C-4A20-5509-BB49-1851A37F60B6" xml:space="preserve">RESOURCE sound_controller
       
    63     {
       
    64     // disable alarm server control of alarm intervals
       
    65     intervals = {};
       
    66     }</codeblock> <p>This configuration cannot be overridden at runtime. <xref href="GUID-8FAC10FB-BCD1-3373-9440-EF2EED70A861.dita"><apiname>RASCliSession::SetAlarmPlayIntervalsL()</apiname></xref> cannot
       
    67 be used to change this option, that is, the function can neither turn OFF
       
    68 the alarm sound control by specifying an empty sequence, nor turn ON the alarm
       
    69 sound control by overriding an empty sequence in the resource file. </p> <p>Durations
       
    70 that extend into the next interval cause the whole sequence to revert to the
       
    71 default hard-coded values. </p></li>
       
    72 </ul> </section>
       
    73 </conbody></concept>