1 /* |
|
2 * Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Specific class for MiscPhone tests |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include <e32svr.h> |
|
23 #include <stifparser.h> |
|
24 #include <stiftestinterface.h> |
|
25 #include "miscphone.h" |
|
26 |
|
27 |
|
28 // CONSTANTS |
|
29 _LIT8( KLine, "---------------------------------" ); |
|
30 |
|
31 |
|
32 |
|
33 // ============================ MEMBER FUNCTIONS =============================== |
|
34 |
|
35 // ----------------------------------------------------------------------------- |
|
36 // CCSDI::Delete |
|
37 // Delete here all resources allocated and opened from test methods. |
|
38 // Called from destructor. |
|
39 // ----------------------------------------------------------------------------- |
|
40 // |
|
41 void CMiscPhone::Delete() |
|
42 { |
|
43 |
|
44 } |
|
45 |
|
46 // ----------------------------------------------------------------------------- |
|
47 // CCSDI::RunMethodL |
|
48 // Run specified method. Contains also table of test methods and their names. |
|
49 // ----------------------------------------------------------------------------- |
|
50 // |
|
51 TInt CMiscPhone::RunMethodL( |
|
52 CStifItemParser& aItem ) |
|
53 { |
|
54 _LIT8 (KLog, "MiscPhone: RunMethodL" ); |
|
55 iMiscPhoneLog->Log((TDesC8)KLog); |
|
56 |
|
57 static TStifFunctionInfo const KFunctions[] = |
|
58 { |
|
59 // Copy this line for every implemented function. |
|
60 // First string is the function name used in TestScripter script file. |
|
61 // Second is the actual implementation member function. |
|
62 ENTRY( "GetCustomerServiceProfile", CMiscPhone::GetCustomerServiceProfile ), |
|
63 ENTRY( "GetPhoneId", CMiscPhone::GetPhoneId ), |
|
64 ENTRY( "RunIscTestCase", CCore::RunIscTestCase), |
|
65 ENTRY( "SyncIscTestCase", CCore::SyncIscTestCase), |
|
66 ENTRY( "SetDriveMode", CMiscPhone::SetDriveMode), |
|
67 ENTRY( "HandleSpecifiedRequests", CCore::HandleSpecifiedRequests), |
|
68 ENTRY( "InitializeIPCRequestTable", CCore::InitializeIPCRequestTable), |
|
69 ENTRY( "SetExpectedCompleteIPC", CCore::SetExpectedCompleteIPC), |
|
70 |
|
71 }; |
|
72 |
|
73 |
|
74 const TInt count = sizeof( KFunctions ) / |
|
75 sizeof( TStifFunctionInfo ); |
|
76 |
|
77 return RunInternalL( KFunctions, count, aItem ); |
|
78 |
|
79 } |
|
80 |
|
81 // ----------------------------------------------------------------------------- |
|
82 // CMiscPhone::GetCustomerServiceProfile |
|
83 // Getting customer service profile |
|
84 // ----------------------------------------------------------------------------- |
|
85 // |
|
86 TInt CMiscPhone::GetCustomerServiceProfile( CStifItemParser& /*aItem*/ ) |
|
87 { |
|
88 _LIT8(KPbInit, "CMiscPhone::GetCustomerServiceProfile"); |
|
89 iMiscPhoneLog->Log((TDesC8)KPbInit); |
|
90 |
|
91 TInt ret( KErrNotFound ); |
|
92 |
|
93 |
|
94 ret = HandleRequestL( EMobilePhoneGetCustomerServiceProfile ); |
|
95 |
|
96 if ( KErrNone == ret ) |
|
97 { |
|
98 _LIT8( KSendOk, "GetCustomerServiceProfile request send ok" ); |
|
99 iMiscPhoneLog->Log((TDesC8)KSendOk ); |
|
100 } |
|
101 else |
|
102 { |
|
103 _LIT8( KSendFailed, "GetCustomerServiceProfile request send failed: %d" ); |
|
104 iMiscPhoneLog->Log((TDesC8)KSendFailed, ret ); |
|
105 } |
|
106 |
|
107 |
|
108 return ret; |
|
109 |
|
110 } |
|
111 |
|
112 |
|
113 // ----------------------------------------------------------------------------- |
|
114 // CMiscPhone::CompleteGetCustomerServiceProfile |
|
115 // Complete GetCustomerServiceProfile method function. |
|
116 // ----------------------------------------------------------------------------- |
|
117 // |
|
118 void CMiscPhone::CompleteGetCustomerServiceProfile |
|
119 ( |
|
120 TInt aResult, CMmDataPackage* aDataPackage |
|
121 ) |
|
122 { |
|
123 _LIT8( KResult, "CompleteGetCustomerServiceProfile result: %d" ); |
|
124 iMiscPhoneLog->Log((TDesC8)KResult, aResult ); |
|
125 |
|
126 if( KErrNone != aResult ) |
|
127 { |
|
128 _LIT8( KFail, "CompleteGetCustomerServiceProfile Failed: %d" ); |
|
129 iMiscPhoneLog->Log((TDesC8)KFail, aResult ); |
|
130 } |
|
131 else |
|
132 { |
|
133 RMobilePhone::TMobilePhoneCspFileV1 cspFileEtel; |
|
134 |
|
135 aDataPackage->UnPackData ( cspFileEtel ); |
|
136 |
|
137 _LIT8( KCCS, "Call completion services: %d" ); |
|
138 iMiscPhoneLog->Log((TDesC8)KCCS, cspFileEtel.iCallCompletionServices ); |
|
139 |
|
140 _LIT8( KCOS, "Call offering services: %d" ); |
|
141 iMiscPhoneLog->Log((TDesC8)KCOS, cspFileEtel.iCallOfferingServices ); |
|
142 |
|
143 _LIT8( KCRS, "Call restriction services: %d" ); |
|
144 iMiscPhoneLog->Log((TDesC8)KCRS, cspFileEtel.iCallRestrictionServices ); |
|
145 |
|
146 _LIT8( KCF, "Cphs features: %d" ); |
|
147 iMiscPhoneLog->Log((TDesC8)KCF, cspFileEtel.iCphsFeatures ); |
|
148 |
|
149 _LIT8( KCT, "Cphs teleservices: %d" ); |
|
150 iMiscPhoneLog->Log((TDesC8)KCT, cspFileEtel.iCphsTeleservices ); |
|
151 |
|
152 _LIT8( KNIS, "Number ident services: %d" ); |
|
153 iMiscPhoneLog->Log((TDesC8)KNIS, cspFileEtel.iNumberIdentServices ); |
|
154 |
|
155 _LIT8( KOSS, "Other supp services: %d" ); |
|
156 iMiscPhoneLog->Log((TDesC8)KOSS, cspFileEtel.iOtherSuppServices ); |
|
157 |
|
158 _LIT8( KP2PS, "Phase 2 plus services: %d" ); |
|
159 iMiscPhoneLog->Log((TDesC8)KP2PS, cspFileEtel.iPhase2PlusServices ); |
|
160 |
|
161 _LIT8( KT, "Teleservices: %d" ); |
|
162 iMiscPhoneLog->Log((TDesC8)KT, cspFileEtel.iTeleservices ); |
|
163 |
|
164 _LIT8( KVAS, "Value added services: %d" ); |
|
165 iMiscPhoneLog->Log((TDesC8)KVAS, cspFileEtel.iValueAddedServices ); |
|
166 |
|
167 } |
|
168 |
|
169 Signal( aResult ); |
|
170 |
|
171 } |
|
172 |
|
173 |
|
174 |
|
175 |
|
176 // ----------------------------------------------------------------------------- |
|
177 // CMiscPhone::GetPhoneId |
|
178 // Getting phone ID |
|
179 // ----------------------------------------------------------------------------- |
|
180 // |
|
181 TInt CMiscPhone::GetPhoneId( CStifItemParser& /*aItem*/ ) |
|
182 { |
|
183 _LIT8(KPbInit, "CMiscPhone::GetPhoneId"); |
|
184 iMiscPhoneLog->Log((TDesC8)KPbInit); |
|
185 |
|
186 TInt ret( KErrNotFound ); |
|
187 |
|
188 |
|
189 ret = HandleRequestL( EMobilePhoneGetPhoneId ); |
|
190 |
|
191 if ( KErrNone == ret ) |
|
192 { |
|
193 _LIT8( KSendOk, "GetPhoneId request send ok" ); |
|
194 iMiscPhoneLog->Log((TDesC8)KSendOk ); |
|
195 } |
|
196 else |
|
197 { |
|
198 _LIT8( KSendFailed, "GetPhoneId request send failed: %d" ); |
|
199 iMiscPhoneLog->Log((TDesC8)KSendFailed, ret ); |
|
200 } |
|
201 |
|
202 |
|
203 |
|
204 return ret; |
|
205 |
|
206 } |
|
207 |
|
208 |
|
209 // ----------------------------------------------------------------------------- |
|
210 // CMiscPhone::CompleteGetPhoneId |
|
211 // Complete GetPhoneId method function. |
|
212 // ----------------------------------------------------------------------------- |
|
213 // |
|
214 void CMiscPhone::CompleteGetPhoneId |
|
215 ( |
|
216 TInt aResult, CMmDataPackage* aDataPackage |
|
217 ) |
|
218 { |
|
219 _LIT8( KResult, "CompleteGetPhoneId result: %d" ); |
|
220 iMiscPhoneLog->Log((TDesC8)KResult, aResult ); |
|
221 |
|
222 TBuf8<50> id; |
|
223 |
|
224 aDataPackage->UnPackData(id); |
|
225 |
|
226 |
|
227 TBuf8<255> Buffer; |
|
228 _LIT8(KRowFormatter, "Phone id is: %S"); |
|
229 |
|
230 Buffer.Format(KRowFormatter,&id); |
|
231 |
|
232 iMiscPhoneLog->Log(Buffer); |
|
233 |
|
234 if( KErrNone != aResult ) |
|
235 { |
|
236 _LIT8( KFail, "CompleteGetPhoneId Failed: %d" ); |
|
237 iMiscPhoneLog->Log((TDesC8)KFail, aResult ); |
|
238 } |
|
239 |
|
240 |
|
241 Signal( aResult ); |
|
242 |
|
243 } |
|
244 |
|
245 // ----------------------------------------------------------------------------- |
|
246 // CMiscPhone::SetDriveMode |
|
247 // Setting drive mode |
|
248 // ----------------------------------------------------------------------------- |
|
249 // |
|
250 |
|
251 TInt CMiscPhone::SetDriveMode( CStifItemParser& aItem) |
|
252 { |
|
253 _LIT8(KPbInit, "CMiscPhone::SetDriveMode"); |
|
254 iMiscPhoneLog->Log((TDesC8)KPbInit); |
|
255 |
|
256 TInt ret( KErrNotFound ); |
|
257 TBool supported( ETrue ); |
|
258 TPtrC modestring; |
|
259 |
|
260 aItem.GetNextString ( modestring ); |
|
261 |
|
262 RMmCustomAPI::TSetDriveMode mode; |
|
263 |
|
264 if ( _L("DeactivateDriveMode") == modestring ) |
|
265 { |
|
266 mode = RMmCustomAPI::EDeactivateDriveMode; |
|
267 } |
|
268 else if ( _L("ActivateDriveMode") == modestring ) |
|
269 { |
|
270 mode = RMmCustomAPI::EActivateDriveMode; |
|
271 } |
|
272 else |
|
273 { |
|
274 _LIT8(KNotSupp, "CMiscPhone::Selected drive mode setting not supported"); |
|
275 iMiscPhoneLog->Log((TDesC8)KNotSupp); |
|
276 supported = EFalse; |
|
277 } |
|
278 |
|
279 //Create package |
|
280 CMmDataPackage package; |
|
281 |
|
282 // Set package data |
|
283 package.PackData( &mode ); |
|
284 |
|
285 |
|
286 if( supported ) |
|
287 { |
|
288 |
|
289 ret = HandleRequestL( ECustomSetDriveModeIPC, &package ); |
|
290 |
|
291 if ( KErrNone == ret ) |
|
292 { |
|
293 _LIT8( KSendOk, "SetDriveMode request send ok" ); |
|
294 iMiscPhoneLog->Log((TDesC8)KSendOk ); |
|
295 } |
|
296 else |
|
297 { |
|
298 _LIT8( KSendFailed, "SetDriveMode request send failed: %d" ); |
|
299 iMiscPhoneLog->Log((TDesC8)KSendFailed, ret ); |
|
300 } |
|
301 } |
|
302 else |
|
303 { |
|
304 ret = KErrNotSupported; |
|
305 } |
|
306 |
|
307 return ret; |
|
308 |
|
309 } |
|
310 |
|
311 |
|
312 // ----------------------------------------------------------------------------- |
|
313 // CMiscPhone::CompleteSetDriveMode |
|
314 // Complete SetDriveMode method function. |
|
315 // ----------------------------------------------------------------------------- |
|
316 // |
|
317 |
|
318 void CMiscPhone::CompleteSetDriveMode |
|
319 ( |
|
320 TInt aResult |
|
321 ) |
|
322 { |
|
323 _LIT8( KResult, "CompleteSetDriveMode result: %d" ); |
|
324 iMiscPhoneLog->Log((TDesC8)KResult, aResult ); |
|
325 |
|
326 |
|
327 if( KErrNone != aResult ) |
|
328 { |
|
329 _LIT8( KFail, "CompleteSetDriveMode Failed: %d" ); |
|
330 iMiscPhoneLog->Log((TDesC8)KFail, aResult ); |
|
331 } |
|
332 |
|
333 |
|
334 Signal( aResult ); |
|
335 |
|
336 } |
|
337 |
|
338 |
|
339 |
|
340 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
341 // None |
|
342 |
|
343 |
|
344 // End of File |
|
345 |
|