Symbian3/PDK/Source/GUID-F0BDE1EC-5042-5328-9290-22BB2189F6B4.dita
author Dominic Pinkman <Dominic.Pinkman@Nokia.com>
Tue, 30 Mar 2010 11:42:04 +0100
changeset 4 4816d766a08a
parent 3 46218c8b8afa
child 5 f345bda72bc4
permissions -rw-r--r--
Week 12 contribution of SDK documentation_content. See release notes for details. Fixes Bug 1892, Bug 1522, Bug 1520, Bug 394, Bug 1319, Bug 344, Bug 1897

<?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-F0BDE1EC-5042-5328-9290-22BB2189F6B4" xml:lang="en"><title>How
to Implement a LBS Set Clock Plug-in DLL</title><shortdesc>This topic describes how to implement a LBS set clock plug-in class. </shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
<section><title>Required background</title> <p><xref href="GUID-A5510456-A5EB-59EC-B146-74D58A118875.dita">LBS
system clock adjustment overview</xref> describes the set clock plug-in interface. </p> </section>
<section><title>Introduction </title> <p>LBS contains a default implementation
of a set clock module that sets the system clock time by calling <xref href="GUID-C197C9A7-EA05-3F24-9854-542E984C612D.dita#GUID-C197C9A7-EA05-3F24-9854-542E984C612D/GUID-145F52E6-2A29-3FF1-8AD1-7009BE0074D7"><apiname>User::SetUTCTime()</apiname></xref>. </p> <p>To
set the system clock by some other method, a licensee must create a set clock
plug-in DLL and configure LBS to use it. </p> </section>
<section><title>Implementing the plug-in class</title> <p>Licensee set clock
plug-in classes must derive from the abstract base class <codeph>CGPSSetClockBase</codeph> shown
in figure 1. </p> <p> <codeph>CGPSSetClockBase</codeph> is packaged in <filepath>GPSSetClock.dll</filepath>.
An implementation includes <filepath>GPSSetClockBase.h</filepath> and links
with <filepath>GPSSetClock.lib</filepath>. </p> <fig id="GUID-CAE2F49D-6B7A-5F6F-A0BD-25A8475CDE32">
<title>              Figure 1. CGPSSetClockBase is the base class for LBS
set clock              plug-in classes.            </title>
<image href="GUID-9BA295BC-627C-5B82-B669-F4F7B55E3F82_d0e437287_href.png" placement="inline"/>
</fig> <p>To implement a set clock plug-in a developer must follow the steps
in the next section. </p> </section>
<section><title>Procedure</title> <ol id="GUID-657B1DA8-2A2B-583B-AADD-3E94AEE04751">
<li id="GUID-D2515C64-C814-53BB-B161-DB571F4FE42B"><p>Create a class derived
from <codeph>CGPSSetClockBase</codeph>: </p> <codeblock id="GUID-E4FE605C-689D-5A68-9FA4-E394DB366C5B" xml:space="preserve">#include &lt;GPSSetClockBase.h&gt;

class CGPSSetClockImpl : public CGPSSetClockBase
{
    
    public:
  static CGPSSetClockImpl* NewL();
     
  virtual TInt SetUTCTime(const TTime&amp; aTime);
  virtual ~CGPSSetClockImpl();
  
 private:
  CGPSSetClockImpl();
  void ConstructL();
     
};
</codeblock> <p> <i>Note that the implementation class must only allocate
memory on construction</i>, not when <xref href="GUID-E5ED4ACA-5EC4-3AE2-862A-AC204DCA83B5.dita#GUID-E5ED4ACA-5EC4-3AE2-862A-AC204DCA83B5/GUID-F6922F15-F4D3-31D9-86AD-B2809AA111A1"><apiname>CGPSSetClockBase::SetUTCTime()</apiname></xref> is
called. This is because LBS must always be able to respond to emergency services
location requests and so must never run out of memory at runtime. Memory for
the set clock plug-in DLL must therefore be allocated on startup of the LBS
subsystem when the ECom framework loads the plug-in DLL and calls the <codeph>NewL()</codeph> function
on the implementation class. </p> <codeblock id="GUID-4A865931-1C48-5396-BD5B-BF590CE031E9" xml:space="preserve">CGPSSetClockImpl* CGPSSetClockImpl::NewL()
{
    // Allocate all required memory here or in ConstructL()
 ...
}
</codeblock> </li>
<li id="GUID-AF16291B-786D-5E90-917C-ABE8F38D664D"><p>Implement the virtual
method <xref href="GUID-E5ED4ACA-5EC4-3AE2-862A-AC204DCA83B5.dita#GUID-E5ED4ACA-5EC4-3AE2-862A-AC204DCA83B5/GUID-F6922F15-F4D3-31D9-86AD-B2809AA111A1"><apiname>CGPSSetClockBase::SetUTCTime()</apiname></xref>. The implementation
of this method is licensee specific and depends on the method that the licensee
uses to set the system clock. </p> <codeblock id="GUID-F5B3CC27-D8C1-5302-8AFE-CF92A2FEFD82" xml:space="preserve">
TInt CGPSSetClockImpl::SetUTCTime(const TTime&amp; aTime)
{
    // Licensee method of setting the system clock
 // Do not allocate any additional memory!
    ...
}
</codeblock> </li>
<li id="GUID-25E5345F-9B40-55B2-9FE4-4EBF5549DB59"><p>Package the class as
an ECom plug-in DLL. </p> <p>See <xref href="GUID-7B304B12-D597-550C-9EAA-AB8B2A6A8531.dita">How
to create implementation collections</xref> for information on how to package
an implementation class as an ECom plug-in DLL. </p> <p> <b>Note:</b> LBS
must be configured to use the licensee set clock plug-in DLL to set the system
clock. <xref href="GUID-23BBC1D8-B3A0-5148-A4F1-22ECF3043E4E.dita">LBS administration</xref> describes
how to configure LBS system clock synchronisation settings using either the
LBS Administration API or a repository initialisation file. </p> </li>
</ol> </section>
</conbody><related-links>
<link href="GUID-A5510456-A5EB-59EC-B146-74D58A118875.dita"><linktext>LBS System
Clock Synchronisation Overview</linktext></link>
</related-links></concept>