|
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // GPSSetClockTestPlugin.cpp |
|
15 // |
|
16 // |
|
17 |
|
18 // System includes. |
|
19 #include <e32std.h> |
|
20 #include <ecom/implementationproxy.h> |
|
21 #include <e32property.h> |
|
22 |
|
23 // Lbs includes. |
|
24 #include <lbs/gpssetclockbase.h> |
|
25 |
|
26 // Lbs test includes. |
|
27 #include <lbs/test/tlbsutils.h> |
|
28 |
|
29 |
|
30 /** |
|
31 Test clock adjust plugin. |
|
32 @internalTechnology |
|
33 */ |
|
34 NONSHARABLE_CLASS(CGPSSetClockTestPlugin) : public CGPSSetClockBase |
|
35 { |
|
36 public: |
|
37 static CGPSSetClockBase* NewL(); |
|
38 ~CGPSSetClockTestPlugin(); |
|
39 virtual TInt SetUTCTime(const TTime &aUTCTime); |
|
40 private: |
|
41 CGPSSetClockTestPlugin(); |
|
42 void ConstructL(); |
|
43 }; |
|
44 |
|
45 |
|
46 CGPSSetClockBase* CGPSSetClockTestPlugin::NewL() |
|
47 { |
|
48 CGPSSetClockTestPlugin* self = new(ELeave) CGPSSetClockTestPlugin; |
|
49 CleanupStack::PushL(self); |
|
50 self->ConstructL(); |
|
51 CleanupStack::Pop(self); |
|
52 return self; |
|
53 } |
|
54 |
|
55 CGPSSetClockTestPlugin::~CGPSSetClockTestPlugin() |
|
56 { |
|
57 } |
|
58 |
|
59 /** |
|
60 Test version of the method that performs the product specific means of changing the system clock. |
|
61 |
|
62 @param aUTCTime The system clock should be set to this UTC time. |
|
63 @return KErrNone if the system clock has been successfully changed. Otherwise a |
|
64 standard Symbian OS error code. |
|
65 @internalTechnology |
|
66 */ |
|
67 TInt CGPSSetClockTestPlugin::SetUTCTime(const TTime& aUTCTime) |
|
68 { |
|
69 TInt err; |
|
70 TTime time = aUTCTime; |
|
71 |
|
72 // Send msg to test harness via a test property - this allows the test harness to determine |
|
73 // if the plugin was invoked instead of the default behaviour. |
|
74 TPckgBuf<TClockPluginDataOut> pluginDataOutBuf; |
|
75 TClockPluginDataOut& pluginDataOut = pluginDataOutBuf(); |
|
76 |
|
77 pluginDataOut.iResponse = TClockPluginDataOut::EClockPluginResponseOk; |
|
78 |
|
79 err = RProperty::Set(KUidSystemCategory, ELbsTestClockPluginOut, pluginDataOutBuf); |
|
80 |
|
81 // Set the system clock. |
|
82 if (err == KErrNone) |
|
83 { |
|
84 err = User::SetUTCTime(time); |
|
85 } |
|
86 |
|
87 return err; |
|
88 } |
|
89 |
|
90 |
|
91 CGPSSetClockTestPlugin::CGPSSetClockTestPlugin() |
|
92 {} |
|
93 |
|
94 |
|
95 void CGPSSetClockTestPlugin::ConstructL() |
|
96 {} |
|
97 |
|
98 |
|
99 const TImplementationProxy KImplementationTable[] = |
|
100 { |
|
101 IMPLEMENTATION_PROXY_ENTRY(0x10281D72, CGPSSetClockTestPlugin::NewL) |
|
102 }; |
|
103 |
|
104 |
|
105 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) |
|
106 { |
|
107 aTableCount = sizeof(KImplementationTable) / sizeof(KImplementationTable); |
|
108 return KImplementationTable; |
|
109 } |