|
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 // |
|
15 |
|
16 /** |
|
17 @file SimTsy.TestSteps.cpp |
|
18 */ |
|
19 |
|
20 #include "Connections.TestSteps.h" |
|
21 #include "SocketServer.TestSteps.h" |
|
22 |
|
23 |
|
24 // Start SimTsy |
|
25 //------------- |
|
26 |
|
27 CStartSimTSYStep::CStartSimTSYStep(CCEsockTestBase*& aEsockTest) |
|
28 : CTe_EsockStepBase(aEsockTest) |
|
29 { |
|
30 SetTestStepName(KStartSimTSYStep); |
|
31 } |
|
32 |
|
33 //Set and get methods for SIM TSYs section number |
|
34 void CStartSimTSYStep::SetTestSectionNumber(TInt aTestSectionNumber) |
|
35 { |
|
36 iTestSectionNumber = aTestSectionNumber; |
|
37 } |
|
38 |
|
39 TInt CStartSimTSYStep::TestSectionNumber() const |
|
40 { |
|
41 return iTestSectionNumber; |
|
42 } |
|
43 |
|
44 TVerdict CStartSimTSYStep::doTestStepPreambleL() |
|
45 { |
|
46 SetTestStepResult(EFail); |
|
47 |
|
48 if (iEsockTest==NULL) |
|
49 iEsockTest = new (ELeave) CCEsockTestBase; |
|
50 |
|
51 SetTestStepResult(EPass); |
|
52 return TestStepResult(); |
|
53 } |
|
54 |
|
55 TInt CStartSimTSYStep::ConfigureFromIni() |
|
56 { |
|
57 //Read the test number from the ini file |
|
58 TInt testNumber=0; |
|
59 if (GetIntFromConfig(iSection, KSimTsySectionNumber, testNumber) != 1) |
|
60 { |
|
61 SetTestSectionNumber(0); |
|
62 } |
|
63 else |
|
64 { |
|
65 SetTestSectionNumber(testNumber); |
|
66 } |
|
67 |
|
68 return KErrNone; |
|
69 } |
|
70 |
|
71 TVerdict CStartSimTSYStep::doSingleTestStep() |
|
72 { |
|
73 TInt error = 0; |
|
74 |
|
75 // Apply the test number to the instance of simtsy |
|
76 if (TestSectionNumber() >= 0) |
|
77 { |
|
78 error = iEsockTest->iSimTsy.SetTestNumber(TestSectionNumber()); |
|
79 } |
|
80 |
|
81 if (error != KErrNone) |
|
82 { |
|
83 INFO_PRINTF3(_L("Could not set simtsy test number. number:%d, error:%d"), TestSectionNumber(), error); |
|
84 return EFail; |
|
85 } |
|
86 |
|
87 // Start the sim tsy with its given settings |
|
88 error = iEsockTest->iSimTsy.Start(); |
|
89 |
|
90 if (error!=KErrNone) |
|
91 { |
|
92 INFO_PRINTF2(_L("Could not start simtsy. error:%d"), error); |
|
93 return EFail; |
|
94 } |
|
95 |
|
96 return EPass; |
|
97 } |
|
98 |
|
99 |
|
100 // Stop SimTsy |
|
101 //------------ |
|
102 |
|
103 CStopSimTSYStep::CStopSimTSYStep(CCEsockTestBase*& aEsockTest) |
|
104 : CTe_EsockStepBase(aEsockTest) |
|
105 { |
|
106 SetTestStepName(KStopSimTSYStep); |
|
107 } |
|
108 |
|
109 TInt CStopSimTSYStep::ConfigureFromIni() |
|
110 { |
|
111 // No configuration involved |
|
112 return KErrNone; |
|
113 } |
|
114 |
|
115 TVerdict CStopSimTSYStep::doSingleTestStep() |
|
116 { |
|
117 iEsockTest->iSimTsy.Stop(); |
|
118 return EPass; |
|
119 } |
|
120 |
|
121 |
|
122 // SimTsy Trigger Event |
|
123 //--------------------- |
|
124 |
|
125 CSimTSYTriggerEventStep::CSimTSYTriggerEventStep(CCEsockTestBase*& aEsockTest) |
|
126 : CTe_EsockStepBase(aEsockTest) |
|
127 { |
|
128 SetTestStepName(KSimTSYTriggerEventStep); |
|
129 } |
|
130 |
|
131 TVerdict CSimTSYTriggerEventStep::doTestStepPreambleL() |
|
132 { |
|
133 SetTestStepResult(EFail); |
|
134 |
|
135 if (iEsockTest==NULL) |
|
136 iEsockTest = new (ELeave) CCEsockTestBase; |
|
137 |
|
138 SetTestStepResult(EPass); |
|
139 return TestStepResult(); |
|
140 } |
|
141 |
|
142 TInt CSimTSYTriggerEventStep::ConfigureFromIni() |
|
143 { |
|
144 //clean parameters from previous runs |
|
145 iParams.Reset(); |
|
146 |
|
147 if (GetStringFromConfig(iSection, KTe_SimtsyTriggerEventName, iParams.iSimTsyEventName)!=1 |
|
148 || iParams.iSimTsyEventName.Length()==0) |
|
149 return KErrNotFound; |
|
150 |
|
151 |
|
152 if (!GetStringFromConfig(iSection,KTe_ConnectionName,iParams.iConnectionName)) |
|
153 { |
|
154 INFO_PRINTF2(_L("%S: Connection name missing."),&iParams.iSimTsyEventName); |
|
155 return KErrNotFound; |
|
156 } |
|
157 |
|
158 if (!GetStringFromConfig(iSection,KTe_SimTsyEventName,iParams.iEventName)) |
|
159 { |
|
160 INFO_PRINTF2(_L("%S: Event name missing."),&iParams.iSimTsyEventName); |
|
161 return KErrNotFound; |
|
162 } |
|
163 |
|
164 if (!GetIntFromConfig(iSection,KTe_SimTsyEventIndex,iParams.iEventIndex)) |
|
165 { |
|
166 INFO_PRINTF2(_L("%S: Event index missing."),&iParams.iSimTsyEventName); |
|
167 return KErrNotFound; |
|
168 } |
|
169 |
|
170 if(iParams.iEventName.Compare(_L("ENetworkQoSChange")) == 0) |
|
171 { |
|
172 iParams.iEventKey = KPSSimTsyNetworkQoSChange; |
|
173 } |
|
174 else if(iParams.iEventName.Compare(_L("ENetworkChangeRegStatus")) == 0) |
|
175 { |
|
176 iParams.iEventKey = KPSSimtsyPacketServiceNtwkRegStatusChange; |
|
177 } |
|
178 else if(iParams.iEventName.Compare(_L("EContextStatusChange")) == 0) |
|
179 { |
|
180 iParams.iEventKey = KPSSimtsyPacketContextStatusChange; |
|
181 } |
|
182 else if((iParams.iEventName.Compare(_L("EMbmsServAvailChange")) == 0) || |
|
183 (iParams.iEventName.Compare(_L("EMbmsBearerAvailChange")) == 0) || |
|
184 (iParams.iEventName.Compare(_L("EMbmsServiceRemove")) == 0) || |
|
185 (iParams.iEventName.Compare(_L("EMbmsActiveListChange")) == 0) || |
|
186 (iParams.iEventName.Compare(_L("EMbmsMonitorListChange")) == 0)) |
|
187 { |
|
188 iParams.iEventKey = KPSSimTsyMbmsService; |
|
189 } |
|
190 else |
|
191 { |
|
192 ERR_PRINTF2(_L("Unknown event [%S] requested"), &iParams.iEventName); |
|
193 return KErrNotFound; |
|
194 } |
|
195 |
|
196 return KErrNone; |
|
197 } |
|
198 |
|
199 TVerdict CSimTSYTriggerEventStep::doSingleTestStep() |
|
200 { |
|
201 |
|
202 // Will fire after we register for notifications |
|
203 TInt error = iEsockTest->EtelRequestL(iParams.iEventKey, iParams.iEventIndex); |
|
204 if (error!=KErrNone) |
|
205 { |
|
206 INFO_PRINTF1(_L("Could not trigger simtsy event.")); |
|
207 INFO_PRINTF2(_L("Error: %d."),error); |
|
208 return EFail; |
|
209 } |
|
210 return EPass; |
|
211 |
|
212 } |
|
213 |
|
214 |