Adaptation/GUID-8D237BD6-9759-4180-B190-F1624594017F.dita
author Graeme Price <GRAEME.PRICE@NOKIA.COM>
Fri, 15 Oct 2010 14:32:18 +0100
changeset 15 307f4279f433
permissions -rw-r--r--
Initial contribution of the Adaptation Documentation.

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE concept
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<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>
<p>The Time client interface methods can be executed independently.
The following examples show the Time client interface functions being
used along with an explanation.</p>
<section id="GUID-98F7B0DE-CBA6-430C-972D-02F9AB444E1B"><title>Using
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();
TPckgBuf&lt;TBool&gt; boolPckg;
TRequestStatus status;

rtcAdaptation-&gt;ValidateRtc(boolPckg, status);
</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
Time Clock (RTC) as a boolean value. The second parameter returns
the completion status of the request. If the RTC clock is valid, then
this would be <codeph>KErrNone</codeph>.</p></section>
<section id="GUID-3D0DD0AB-4F3F-4411-B5E8-9199AB71F1A6"><title>Using
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;
TInt r;
r = Asic_class::SetSystemTimeCalibration(30);</codeblock><p>In the
above example, the RTC is being set with a time calibration value
of 30ppm (parts per million). This means that the RTC can lose up
to one second every 30 million seconds.</p><p>The value returned by
this function is either <codeph>KErrNone</codeph> or a system wide
error code if something went wrong.</p></section>
<section id="GUID-813CB223-3385-4293-9D1C-8C712B031E8F"><title>Using
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 &lt;TTime&gt; timePckg(testTime);
 rtcAdaptation-&gt;SetWakeupAlarm(timePckg, status); </codeblock><p>In
the above example, the first line declares the variable to be used
and initializes it. The second line is used to set the wake-up alarm
time.</p></section>
<section id="GUID-DE156EC7-759F-4BFC-BCAA-FE0E84CC83D9"><title>Using
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;
rtcAdaptation-&gt;UnsetWakeupAlarm(status);
</codeblock><p>The first line declares the variable that is to be
used. The second line deletes the current device wake-up alarm time.</p></section>
<section id="GUID-1111CFEA-D85C-4107-BB14-618C6A5A0B3F"><title>Using
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-&gt;Cancel();
</codeblock><p>In the above example, the last request made to the
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>
<section id="GUID-2EE46E01-006D-431E-B6C0-CAEBDDE5D53A"><title>Using
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-&gt;Release();
</codeblock><p>In the above example, a call to the destructor in the
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>
<section id="GUID-C69C0225-1779-4FFC-B071-D18B71C18A74"><title>Using
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;
TInt hwrtc = 0;
Asic_class::SystemTimeInSecondsFrom2000(hwrtc);
</codeblock><p>The first and second lines declare and initialize the
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
of seconds since the start of the year 2000 is placed in the variable
that has been passed as a parameter.</p><p>The value returned by this
function is either <codeph>KErrNone</codeph> or a system wide error
code (if something went wrong).</p></section>
<section id="GUID-1BFBAEE5-AE48-4624-BD34-3D6B936C8C3B"><title>Using
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;
TInt r=0;
r = Asic_class::SetSystemTimeInSecondsFrom2000(0);</codeblock><p>The
first and second lines declare and initialize the variables and classes
that are to be used. The third line sets the RTC to be zero seconds
from the start of the year 2000.</p><p>The value returned by this
function is either <codeph>KErrNone</codeph> or a system wide error
code (if something went wrong).</p></section>
</conbody><related-links>
<link href="GUID-10D79C75-6AB9-4717-87EF-057F19CB8283.dita"><linktext>Time
Implementation Guide</linktext></link>
</related-links></concept>