|
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-F0BDE1EC-5042-5328-9290-22BB2189F6B4" xml:lang="en"><title>How |
|
13 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> |
|
14 <section><title>Required background</title> <p><xref href="GUID-A5510456-A5EB-59EC-B146-74D58A118875.dita">LBS |
|
15 system clock adjustment overview</xref> describes the set clock plug-in interface. </p> </section> |
|
16 <section><title>Introduction </title> <p>LBS contains a default implementation |
|
17 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 |
|
18 set the system clock by some other method, a licensee must create a set clock |
|
19 plug-in DLL and configure LBS to use it. </p> </section> |
|
20 <section><title>Implementing the plug-in class</title> <p>Licensee set clock |
|
21 plug-in classes must derive from the abstract base class <codeph>CGPSSetClockBase</codeph> shown |
|
22 in figure 1. </p> <p> <codeph>CGPSSetClockBase</codeph> is packaged in <filepath>GPSSetClock.dll</filepath>. |
|
23 An implementation includes <filepath>GPSSetClockBase.h</filepath> and links |
|
24 with <filepath>GPSSetClock.lib</filepath>. </p> <fig id="GUID-CAE2F49D-6B7A-5F6F-A0BD-25A8475CDE32"> |
|
25 <title> Figure 1. CGPSSetClockBase is the base class for LBS |
|
26 set clock plug-in classes. </title> |
|
27 <image href="GUID-9BA295BC-627C-5B82-B669-F4F7B55E3F82_d0e437287_href.png" placement="inline"/> |
|
28 </fig> <p>To implement a set clock plug-in a developer must follow the steps |
|
29 in the next section. </p> </section> |
|
30 <section><title>Procedure</title> <ol id="GUID-657B1DA8-2A2B-583B-AADD-3E94AEE04751"> |
|
31 <li id="GUID-D2515C64-C814-53BB-B161-DB571F4FE42B"><p>Create a class derived |
|
32 from <codeph>CGPSSetClockBase</codeph>: </p> <codeblock id="GUID-E4FE605C-689D-5A68-9FA4-E394DB366C5B" xml:space="preserve">#include <GPSSetClockBase.h> |
|
33 |
|
34 class CGPSSetClockImpl : public CGPSSetClockBase |
|
35 { |
|
36 |
|
37 public: |
|
38 static CGPSSetClockImpl* NewL(); |
|
39 |
|
40 virtual TInt SetUTCTime(const TTime& aTime); |
|
41 virtual ~CGPSSetClockImpl(); |
|
42 |
|
43 private: |
|
44 CGPSSetClockImpl(); |
|
45 void ConstructL(); |
|
46 |
|
47 }; |
|
48 </codeblock> <p> <i>Note that the implementation class must only allocate |
|
49 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 |
|
50 called. This is because LBS must always be able to respond to emergency services |
|
51 location requests and so must never run out of memory at runtime. Memory for |
|
52 the set clock plug-in DLL must therefore be allocated on startup of the LBS |
|
53 subsystem when the ECom framework loads the plug-in DLL and calls the <codeph>NewL()</codeph> function |
|
54 on the implementation class. </p> <codeblock id="GUID-4A865931-1C48-5396-BD5B-BF590CE031E9" xml:space="preserve">CGPSSetClockImpl* CGPSSetClockImpl::NewL() |
|
55 { |
|
56 // Allocate all required memory here or in ConstructL() |
|
57 ... |
|
58 } |
|
59 </codeblock> </li> |
|
60 <li id="GUID-AF16291B-786D-5E90-917C-ABE8F38D664D"><p>Implement the virtual |
|
61 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 |
|
62 of this method is licensee specific and depends on the method that the licensee |
|
63 uses to set the system clock. </p> <codeblock id="GUID-F5B3CC27-D8C1-5302-8AFE-CF92A2FEFD82" xml:space="preserve"> |
|
64 TInt CGPSSetClockImpl::SetUTCTime(const TTime& aTime) |
|
65 { |
|
66 // Licensee method of setting the system clock |
|
67 // Do not allocate any additional memory! |
|
68 ... |
|
69 } |
|
70 </codeblock> </li> |
|
71 <li id="GUID-25E5345F-9B40-55B2-9FE4-4EBF5549DB59"><p>Package the class as |
|
72 an ECom plug-in DLL. </p> <p>See <xref href="GUID-7B304B12-D597-550C-9EAA-AB8B2A6A8531.dita">How |
|
73 to create implementation collections</xref> for information on how to package |
|
74 an implementation class as an ECom plug-in DLL. </p> <p> <b>Note:</b> LBS |
|
75 must be configured to use the licensee set clock plug-in DLL to set the system |
|
76 clock. <xref href="GUID-23BBC1D8-B3A0-5148-A4F1-22ECF3043E4E.dita">LBS administration</xref> describes |
|
77 how to configure LBS system clock synchronisation settings using either the |
|
78 LBS Administration API or a repository initialisation file. </p> </li> |
|
79 </ol> </section> |
|
80 </conbody><related-links> |
|
81 <link href="GUID-A5510456-A5EB-59EC-B146-74D58A118875.dita"><linktext>LBS System |
|
82 Clock Synchronisation Overview</linktext></link> |
|
83 </related-links></concept> |