|
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-8D237BD6-9759-4180-B190-F1624594017F" xml:lang="en"><title>Time Client Interface Tutorial — Using the Interface</title><shortdesc>Provides examples of how the Time client interface is used.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
13 <p>The Time client interface methods can be executed independently. |
|
14 The following examples show the Time client interface functions being |
|
15 used along with an explanation.</p> |
|
16 <section id="GUID-98F7B0DE-CBA6-430C-972D-02F9AB444E1B"><title>Using |
|
17 the <xref href="GUID-CC79A63E-15DF-3437-983B-9A90966B3004.dita#GUID-CC79A63E-15DF-3437-983B-9A90966B3004/GUID-AC7C2EFB-BE71-301A-9C03-A15BDC0EF310"><apiname>MRtcAdaptation::ValidateRtc()</apiname></xref> function</title><p>An example of the use of this function is:</p><codeblock xml:space="preserve">MRtcAdaptation* rtcAdaptation = NewRtcAdaptationL(); |
|
18 TPckgBuf<TBool> boolPckg; |
|
19 TRequestStatus status; |
|
20 |
|
21 rtcAdaptation->ValidateRtc(boolPckg, status); |
|
22 </codeblock><p>The first three lines define the instance of the <xref href="GUID-CC79A63E-15DF-3437-983B-9A90966B3004.dita"><apiname>MRtcAdaptation</apiname></xref> class and the variables that are to be used.</p><p>The fifth line invokes the <xref href="GUID-CC79A63E-15DF-3437-983B-9A90966B3004.dita#GUID-CC79A63E-15DF-3437-983B-9A90966B3004/GUID-AC7C2EFB-BE71-301A-9C03-A15BDC0EF310"><apiname>MRtcAdaptation::ValidateRtc()</apiname></xref> method. The first parameter will return the validity of the Real |
|
23 Time Clock (RTC) as a boolean value. The second parameter returns |
|
24 the completion status of the request. If the RTC clock is valid, then |
|
25 this would be <codeph>KErrNone</codeph>.</p></section> |
|
26 <section id="GUID-3D0DD0AB-4F3F-4411-B5E8-9199AB71F1A6"><title>Using |
|
27 the <xref href="GUID-69C70CA3-1121-3C5B-AEA4-B2E0245539B9.dita#GUID-69C70CA3-1121-3C5B-AEA4-B2E0245539B9/GUID-2D7976BE-F6D5-3FC4-8253-C34A592A63D3"><apiname>ASIC::SetSystemTimeCalibration()</apiname></xref> function</title><p>An example of the use of this function is:</p><codeblock xml:space="preserve">Asic Asic_class; |
|
28 TInt r; |
|
29 r = Asic_class::SetSystemTimeCalibration(30);</codeblock><p>In the |
|
30 above example, the RTC is being set with a time calibration value |
|
31 of 30ppm (parts per million). This means that the RTC can lose up |
|
32 to one second every 30 million seconds.</p><p>The value returned by |
|
33 this function is either <codeph>KErrNone</codeph> or a system wide |
|
34 error code if something went wrong.</p></section> |
|
35 <section id="GUID-813CB223-3385-4293-9D1C-8C712B031E8F"><title>Using |
|
36 the <xref href="GUID-C82E90BC-451B-3BB4-83E0-243061BCFA14.dita#GUID-C82E90BC-451B-3BB4-83E0-243061BCFA14/GUID-611E6535-9CCA-39E3-8236-654FF280B7CD"><apiname>MRtcAdaption::SetWakeUpAlarm()</apiname></xref> function</title><p>An example of the use of this function is:</p><codeblock xml:space="preserve"> TPckgC <TTime> timePckg(testTime); |
|
37 rtcAdaptation->SetWakeupAlarm(timePckg, status); </codeblock><p>In |
|
38 the above example, the first line declares the variable to be used |
|
39 and initializes it. The second line is used to set the wake-up alarm |
|
40 time.</p></section> |
|
41 <section id="GUID-DE156EC7-759F-4BFC-BCAA-FE0E84CC83D9"><title>Using |
|
42 the <xref href="GUID-CC79A63E-15DF-3437-983B-9A90966B3004.dita#GUID-CC79A63E-15DF-3437-983B-9A90966B3004/GUID-C2A7DE1F-6354-31D6-A397-5CE690C4C67E"><apiname>MRtcAdaptation::UnsetWakeUpAlarm()</apiname></xref> function</title><p>An example of the use of this function is:</p><codeblock xml:space="preserve">TRequestStatus status; |
|
43 rtcAdaptation->UnsetWakeupAlarm(status); |
|
44 </codeblock><p>The first line declares the variable that is to be |
|
45 used. The second line deletes the current device wake-up alarm time.</p></section> |
|
46 <section id="GUID-1111CFEA-D85C-4107-BB14-618C6A5A0B3F"><title>Using |
|
47 the <xref href="GUID-CC79A63E-15DF-3437-983B-9A90966B3004.dita#GUID-CC79A63E-15DF-3437-983B-9A90966B3004/GUID-ADC7041A-23F0-319F-A163-29E8BB261D0B"><apiname>MRtcAdaptation::Cancel()</apiname></xref> function</title><p>An example of the use of this function is:</p><codeblock xml:space="preserve">rtcAdaptation->Cancel(); |
|
48 </codeblock><p>In the above example, the last request made to the |
|
49 instance of the <xref href="GUID-CC79A63E-15DF-3437-983B-9A90966B3004.dita"><apiname>MRtcAdaptation</apiname></xref> class, defined as <codeph>rtcAdaptation</codeph> in the above example, will be deleted.</p></section> |
|
50 <section id="GUID-2EE46E01-006D-431E-B6C0-CAEBDDE5D53A"><title>Using |
|
51 the <xref href="GUID-CC79A63E-15DF-3437-983B-9A90966B3004.dita#GUID-CC79A63E-15DF-3437-983B-9A90966B3004/GUID-C44E98E9-6568-3628-9A7E-85379C4298FD"><apiname>MRtcAdaptation::Release()</apiname></xref> function</title><p>An example of the use of this function is:</p><codeblock xml:space="preserve">rtcAdaptation->Release(); |
|
52 </codeblock><p>In the above example, a call to the destructor in the |
|
53 instance of the <xref href="GUID-CC79A63E-15DF-3437-983B-9A90966B3004.dita"><apiname>MRtcAdaptation</apiname></xref> class, defined as <codeph>rtcAdaptation</codeph> in the above example, is made.</p></section> |
|
54 <section id="GUID-C69C0225-1779-4FFC-B071-D18B71C18A74"><title>Using |
|
55 the <xref href="GUID-69C70CA3-1121-3C5B-AEA4-B2E0245539B9.dita#GUID-69C70CA3-1121-3C5B-AEA4-B2E0245539B9/GUID-EE99A729-F30E-3B3A-BCA2-0F10B383AB6C"><apiname>ASIC::SystemTimeInSecondsFrom2000()</apiname></xref> function</title><p>An example of the use of this function is:</p><codeblock xml:space="preserve">Asic Asic_class; |
|
56 TInt hwrtc = 0; |
|
57 Asic_class::SystemTimeInSecondsFrom2000(hwrtc); |
|
58 </codeblock><p>The first and second lines declare and initialize the |
|
59 variables and classes that are to be used. The third line calls the <xref href="GUID-69C70CA3-1121-3C5B-AEA4-B2E0245539B9.dita#GUID-69C70CA3-1121-3C5B-AEA4-B2E0245539B9/GUID-EE99A729-F30E-3B3A-BCA2-0F10B383AB6C"><apiname>ASIC::SystemTimeInSecondsFrom2000()</apiname></xref> function. The number |
|
60 of seconds since the start of the year 2000 is placed in the variable |
|
61 that has been passed as a parameter.</p><p>The value returned by this |
|
62 function is either <codeph>KErrNone</codeph> or a system wide error |
|
63 code (if something went wrong).</p></section> |
|
64 <section id="GUID-1BFBAEE5-AE48-4624-BD34-3D6B936C8C3B"><title>Using |
|
65 the <xref href="GUID-69C70CA3-1121-3C5B-AEA4-B2E0245539B9.dita#GUID-69C70CA3-1121-3C5B-AEA4-B2E0245539B9/GUID-C6983BB7-6496-3863-8109-6845F5DA62CF"><apiname>ASIC::SetSystemTimeInSecondsFrom2000()</apiname></xref> function</title><p>An example of the use of this function is:</p><codeblock xml:space="preserve">Asic Asic_class; |
|
66 TInt r=0; |
|
67 r = Asic_class::SetSystemTimeInSecondsFrom2000(0);</codeblock><p>The |
|
68 first and second lines declare and initialize the variables and classes |
|
69 that are to be used. The third line sets the RTC to be zero seconds |
|
70 from the start of the year 2000.</p><p>The value returned by this |
|
71 function is either <codeph>KErrNone</codeph> or a system wide error |
|
72 code (if something went wrong).</p></section> |
|
73 </conbody><related-links> |
|
74 <link href="GUID-10D79C75-6AB9-4717-87EF-057F19CB8283.dita"><linktext>Time |
|
75 Implementation Guide</linktext></link> |
|
76 </related-links></concept> |