|
1 // Copyright (c) 2008-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 // Example CTestStep derived implementation |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file ExtGpsPsyStep.cpp |
|
20 @internalTechnology |
|
21 */ |
|
22 #include "ExtGpsPsyStep.h" |
|
23 #include "Te_defproxySuiteDefs.h" |
|
24 |
|
25 CExtGpsPsyStep::~CExtGpsPsyStep() |
|
26 /** |
|
27 * Destructor |
|
28 */ |
|
29 { |
|
30 } |
|
31 |
|
32 CExtGpsPsyStep::CExtGpsPsyStep() |
|
33 /** |
|
34 * Constructor |
|
35 */ |
|
36 { |
|
37 SetTestStepName(KExtGpsPsyStep); |
|
38 } |
|
39 |
|
40 TVerdict CExtGpsPsyStep::doTestStepPreambleL() |
|
41 /** |
|
42 * @return - TVerdict code |
|
43 * Override of base class virtual |
|
44 */ |
|
45 { |
|
46 CTe_defproxySuiteStepBase::doTestStepPreambleL(); |
|
47 SetTestStepResult(EPass); |
|
48 return TestStepResult(); |
|
49 } |
|
50 |
|
51 |
|
52 TVerdict CExtGpsPsyStep::doTestStepL() |
|
53 /** |
|
54 * @return - TVerdict code |
|
55 * Override of base class pure virtual |
|
56 * Our implementation only gets called if the base class doTestStepPreambleL() did |
|
57 * not leave. That being the case, the current test result value will be EPass. |
|
58 */ |
|
59 { |
|
60 StandardPrepareL(); |
|
61 InitPsySettingsL(6, KIntGpsPsy1, 1, KIntGpsPsy2, 1, |
|
62 KNetworkPsy1, 0, KExtGpsPsy1, 1, KExtGpsPsy2, 0, |
|
63 KNetworkPsy2, 1); |
|
64 |
|
65 TRequestStatus status; |
|
66 TPositionInfo posInfo; |
|
67 TPositionUpdateOptions options; |
|
68 |
|
69 //1. If a internal GPS PSY always return a fix. After certain time, |
|
70 //Default porxy shall try external GPS PSY. And if it can give a fix, |
|
71 //after that external GPS PSY shall be used. |
|
72 TTime startTime; |
|
73 startTime.UniversalTime(); |
|
74 for(;;) |
|
75 { |
|
76 iPositioner.NotifyPositionUpdate(posInfo, status); |
|
77 User::WaitForRequest(status); |
|
78 TTime now; |
|
79 now.UniversalTime(); |
|
80 TTimeIntervalSeconds interval; |
|
81 now.SecondsFrom(startTime,interval); |
|
82 if(posInfo.ModuleId()==KExtGpsPsy1) |
|
83 { |
|
84 if(interval.Int()<60) |
|
85 { |
|
86 //This can't be true since the external GPS PSY checking time is |
|
87 //60 seconds |
|
88 ERR_PRINTF2(KLocationRequestSucceededTooSoon, KErrCorrupt); |
|
89 SetTestStepResult(EFail); |
|
90 return TestStepResult(); |
|
91 } |
|
92 break; |
|
93 } |
|
94 if(interval.Int()>70) |
|
95 { |
|
96 //If the external GPS PSY is not used in 70 seconds the test failed |
|
97 ERR_PRINTF2(KLocationRequestStillNotCompleted, KErrGeneral); |
|
98 SetTestStepResult(EFail); |
|
99 return TestStepResult(); |
|
100 } |
|
101 } |
|
102 |
|
103 //Next location request shall be completed from External GPS PSY |
|
104 PositionRequestWithCheck(posInfo, KErrNone, KExtGpsPsy1); |
|
105 |
|
106 |
|
107 //2. If there is no location request on going, default proxy shall not check |
|
108 //fix state of external GPS PSY. |
|
109 ConfigPsyL(KExtGpsPsy1, 1, |
|
110 KConfigLRErrNoMemory |
|
111 ); |
|
112 |
|
113 //Move Int GPS1 to the top of the list |
|
114 iPositioner.NotifyPositionUpdate(posInfo, status); |
|
115 User::WaitForRequest(status); |
|
116 //Check location request is not completed from ExtGpsPsy1 |
|
117 if(posInfo.ModuleId()==KExtGpsPsy1) |
|
118 { |
|
119 ERR_PRINTF2(KLocationRequestStillCompleted, KErrCorrupt); |
|
120 SetTestStepResult(EFail); |
|
121 return TestStepResult(); |
|
122 } |
|
123 |
|
124 |
|
125 iPositioner.NotifyPositionUpdate(posInfo, status); |
|
126 User::WaitForRequest(status); |
|
127 //Check location request is not completed from ExtGpsPsy1 |
|
128 if(posInfo.ModuleId()==KExtGpsPsy1) |
|
129 { |
|
130 ERR_PRINTF2(KLocationRequestStillCompleted, KErrCorrupt); |
|
131 SetTestStepResult(EFail); |
|
132 return TestStepResult(); |
|
133 } |
|
134 |
|
135 StandardCleanup(); |
|
136 return TestStepResult(); |
|
137 } |
|
138 |
|
139 |
|
140 |
|
141 TVerdict CExtGpsPsyStep::doTestStepPostambleL() |
|
142 /** |
|
143 * @return - TVerdict code |
|
144 * Override of base class virtual |
|
145 */ |
|
146 { |
|
147 CTe_defproxySuiteStepBase::doTestStepPostambleL(); |
|
148 return TestStepResult(); |
|
149 } |