|
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-6457E7C4-1203-47B6-8AD3-A6998798943B" xml:lang="en"><title>Alarm |
|
13 server events</title><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
14 <p>The Alarm Server sends notifications to applications when alarm settings |
|
15 change; this includes indications when an alarm goes off. A client-side API |
|
16 for the alarm server is <xref href="jar:GUID-35228542-8C95-4849-A73F-2B4F082F0C44.jar!/sdk/doc_source/reference/reference-cpp/ALARMSERVER/RASCliSessionClass.html#%3a%3aRASCliSession" format="application/java-archive"><parmname>RASCliSession</parmname></xref>. It is a standard asynchronous service provider, and the client application |
|
17 should implement an active object to receive events. </p> |
|
18 <p>To be able to use the Alarm Server services, client applications must |
|
19 first be connected to the server.</p> |
|
20 <codeblock id="GUID-6F5DAB79-F391-4DDD-A85C-EE1C0663E766" xml:space="preserve">User::LeaveIfError( iAlarmServer.Connect() ); |
|
21 </codeblock> |
|
22 <p>In order to receive events, the <parmname>NotifyChange( TRequestStatus |
|
23 &aStatus, TAlarmId &aAlarmId</parmname> ) function is called and the |
|
24 active object is set active.</p> |
|
25 <codeblock id="GUID-6B9CCD08-AE3C-440E-A220-BB3C1766E432" xml:space="preserve">iAlarmServer.NotifyChange( iStatus, iAlarmId ); SetActive();</codeblock> |
|
26 <p>Notifications are cancelled by calling the <parmname>NotifyOnChangeCancel()</parmname> function.</p> |
|
27 <codeblock id="GUID-CC3EF80B-FF85-4F7C-9665-04C350E5F110" xml:space="preserve"> iAlarmServer.NotifyChangeCancel();</codeblock> |
|
28 <p>When alarm settings change, the <parmname>RunL()</parmname> function |
|
29 of the active object is called. Alarms in the alarm server database can be |
|
30 retrieved using the <parmname>GetAlarmIdListL()</parmname> function, which |
|
31 fills an array of alarm IDs.</p> |
|
32 <codeblock id="GUID-C583D59A-28BB-46D1-A929-82B748B2CAED" xml:space="preserve">void GetAlarmIdListL( RArray< TAlarmId > &aAlarmIds )</codeblock> |
|
33 <p>When using <parmname>RArray</parmname>, remember to call <parmname>Close()</parmname> or <parmname>Reset()</parmname> on |
|
34 it when it is not needed anymore. The <parmname>GetAlarmDetails()</parmname> function |
|
35 returns the <parmname>TASShdAlarm</parmname> structure for a specific alarm, |
|
36 which is identified by the alarm ID. </p> |
|
37 <codeblock id="GUID-4870E0F6-42D2-489E-B1AF-2E65D852AEA1" xml:space="preserve">TInt GetAlarmDetails( TAlarmId aAlarmId, TASShdAlarm &aAlarm )</codeblock> |
|
38 <p>The <parmname>TASShdAlarm</parmname> structure contains information |
|
39 about an alarm, and information is accessed through simple inline functions. |
|
40 See the<parmname> ASShdAlarm.h</parmname> header file for further information.</p> |
|
41 </conbody></concept> |