|
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 // @file ConnectionServer.TestSteps.cpp |
|
15 // |
|
16 // |
|
17 |
|
18 #include <commdbconnpref.h> |
|
19 #include <simtsy.h> |
|
20 #include <cs_subconevents.h> |
|
21 #include "ConnectionServer.TestSteps.h" |
|
22 #include "networking\qos3gpp_subconparams.h" |
|
23 #include <in_sock.h> |
|
24 |
|
25 #ifdef _DEBUG |
|
26 // Panic category for "absolutely impossible!" vanilla ASSERT()-type panics from this module |
|
27 // (if it could happen through user error then you should give it an explicit, documented, category + code) |
|
28 _LIT(KSpecAssert_ESockTestCnctnSr, "ESockTestCnctnSr"); |
|
29 #endif |
|
30 |
|
31 |
|
32 const TUint KMaxAccessPoints = 16; |
|
33 |
|
34 _LIT(KAccessPointFilter, "QueryAPStatusFilter"); |
|
35 _LIT(KQueryAPMatchFormat, "QueryAPMatch%d"); |
|
36 _LIT(KExpectedNumberOfAPs, "ExpectedNumberOfAPs"); |
|
37 _LIT(KExpectedAPFormat, "ExpectedAP%d"); |
|
38 _LIT(KExpectedAPStatusFormat, "ExpectedAP%dStatus"); |
|
39 |
|
40 using namespace ConnectionServ; |
|
41 |
|
42 // Create Connection Server |
|
43 //------------------------- |
|
44 |
|
45 CCreateRConnectionServStep::CCreateRConnectionServStep(CCEsockTestBase*& aEsockTest) |
|
46 : CTe_EsockStepBase(aEsockTest) |
|
47 { |
|
48 SetTestStepName(KCreateRConnectionServStep); |
|
49 } |
|
50 |
|
51 TVerdict CCreateRConnectionServStep::doTestStepPreambleL() |
|
52 { |
|
53 SetTestStepResult(EFail); |
|
54 |
|
55 if (iEsockTest==NULL) |
|
56 iEsockTest = new (ELeave) CCEsockTestBase; |
|
57 |
|
58 SetTestStepResult(EPass); |
|
59 return TestStepResult(); |
|
60 } |
|
61 |
|
62 TInt CCreateRConnectionServStep::ConfigureFromIni() |
|
63 { |
|
64 iConnectionServName.Set(KNullDesC); |
|
65 |
|
66 // Read in appropriate fields |
|
67 if((GetStringFromConfig(iSection, KConnectionServName, iConnectionServName) != 1) |
|
68 || (iConnectionServName.Length() == 0)) |
|
69 { |
|
70 INFO_PRINTF3(KErrString_MissingConfigFileField, &iSection, &KConnectionServName); |
|
71 return KErrNotFound; |
|
72 } |
|
73 |
|
74 // All ok if we got this far |
|
75 return KErrNone; |
|
76 } |
|
77 |
|
78 TVerdict CCreateRConnectionServStep::doSingleTestStep() |
|
79 { |
|
80 TInt error = iEsockTest->CreateConnectionServer(iConnectionServName); |
|
81 |
|
82 if (error!=KErrNone) |
|
83 { |
|
84 INFO_PRINTF2(_L("Could not create conneciton server instance (%S)."), &iConnectionServName); |
|
85 INFO_PRINTF2(_L("Error: %d."),error); |
|
86 return EFail; |
|
87 } |
|
88 |
|
89 return EPass; |
|
90 } |
|
91 |
|
92 |
|
93 // Connect Connection Server |
|
94 //-------------------------- |
|
95 _LIT(KTierName, "TierName"); |
|
96 CConnectRConnectionServStep::CConnectRConnectionServStep(CCEsockTestBase*& aEsockTest) |
|
97 : CTe_EsockStepBase(aEsockTest) |
|
98 { |
|
99 SetTestStepName(KConnectRConnectionServStep); |
|
100 } |
|
101 |
|
102 TInt CConnectRConnectionServStep::ConfigureFromIni() |
|
103 { |
|
104 // Default the name to nothing until we know what it is |
|
105 iConnectionServName.Set(KNullDesC); |
|
106 |
|
107 if((GetStringFromConfig(iSection, KConnectionServName, iConnectionServName) != 1)) |
|
108 { |
|
109 INFO_PRINTF3(KErrString_MissingConfigFileField, &iSection, &KConnectionServName); |
|
110 return KErrNotFound; |
|
111 } |
|
112 |
|
113 TBool tierIdExists = GetIntFromConfig(iSection, KConnectionServTierId, reinterpret_cast<TInt&>(iTierId)); |
|
114 |
|
115 // If no tier id then try for a tier name instead |
|
116 if(!tierIdExists) |
|
117 { |
|
118 TPtrC tierName; |
|
119 if((GetStringFromConfig(iSection, KTierName, tierName) != 1)) |
|
120 { |
|
121 INFO_PRINTF1(_L("Missing tier identifier. Require either TierName or TierId")); |
|
122 return KErrNotFound; |
|
123 } |
|
124 else |
|
125 { |
|
126 // Decode the tier name in to a tier id |
|
127 TInt error = TierNameToTierId(tierName, iTierId); |
|
128 if(error != KErrNone) |
|
129 { |
|
130 INFO_PRINTF1(_L("Unrecognised TierName field")); |
|
131 return KErrNotFound; |
|
132 } |
|
133 } |
|
134 } |
|
135 |
|
136 // All ok if we got this far |
|
137 return KErrNone; |
|
138 } |
|
139 |
|
140 _LIT(KLinkTier, "LinkTier"); |
|
141 const TInt KLinkTierId = 0x10281DF5; |
|
142 _LIT(KProtoTier, "ProtoTier"); |
|
143 const TInt KProtoTierId = 0x10281DF0; |
|
144 _LIT(KNetworkTier, "NetworkTier"); |
|
145 const TInt KNetworkTierId = KAfInet; //KAfInet=0x0800 |
|
146 _LIT(KDummyTier, "DummyTier"); |
|
147 const TInt KDummyTierId = 0x1028302B; |
|
148 _LIT(KWiFiTier, "WiFiTier"); |
|
149 const TInt KWiFiTierId = 0x1028300D; |
|
150 _LIT(KMBMSTier, "MBMSTier"); |
|
151 const TInt KMBMSTierId = 0x2001A35B; |
|
152 |
|
153 TInt CConnectRConnectionServStep::TierNameToTierId(const TDesC& aTierName, TUint& aTierId) |
|
154 { |
|
155 if(aTierName == KLinkTier) |
|
156 { |
|
157 aTierId = KLinkTierId; |
|
158 } |
|
159 else if (aTierName == KProtoTier) |
|
160 { |
|
161 aTierId = KProtoTierId; |
|
162 } |
|
163 else if (aTierName == KNetworkTier) |
|
164 { |
|
165 aTierId = KNetworkTierId; |
|
166 } |
|
167 else if (aTierName == KDummyTier) |
|
168 { |
|
169 aTierId = KDummyTierId; |
|
170 } |
|
171 else if (aTierName == KWiFiTier) |
|
172 { |
|
173 aTierId = KWiFiTierId; |
|
174 } |
|
175 else if (aTierName == KMBMSTier) // MBMS_BROADCAST |
|
176 { |
|
177 aTierId = KMBMSTierId; |
|
178 } |
|
179 else |
|
180 { |
|
181 return KErrNotFound; |
|
182 } |
|
183 |
|
184 return KErrNone; |
|
185 } |
|
186 |
|
187 TVerdict CConnectRConnectionServStep::doSingleTestStep() |
|
188 { |
|
189 SetTestStepResult(EFail); |
|
190 |
|
191 TInt error = iEsockTest->ConnectConnectionServer(iConnectionServName, iTierId); |
|
192 |
|
193 if (error != KErrNone) |
|
194 { |
|
195 INFO_PRINTF2(_L("Could not connect connection server (%S)."), &iConnectionServName); |
|
196 INFO_PRINTF2(_L("Error: %d."), error); |
|
197 SetTestStepError(error); |
|
198 } |
|
199 else |
|
200 { |
|
201 SetTestStepResult(EPass); |
|
202 } |
|
203 |
|
204 return TestStepResult(); |
|
205 } |
|
206 |
|
207 |
|
208 // Create Connection Server API Extension |
|
209 //--------------------------------------- |
|
210 CRConnectionServApiExtStep::CRConnectionServApiExtStep(CCEsockTestBase*& aEsockTest) |
|
211 : CTe_EsockStepBase(aEsockTest) |
|
212 { |
|
213 SetTestStepName(KRConnectionServApiExtStep); |
|
214 } |
|
215 |
|
216 |
|
217 TInt CRConnectionServApiExtStep::ConfigureFromIni() |
|
218 { |
|
219 // Default the name to nothing until we know what it is |
|
220 iConnectionServName.Set(KNullDesC); |
|
221 |
|
222 if((GetStringFromConfig(iSection, KConnectionServName, iConnectionServName) != 1)) |
|
223 { |
|
224 INFO_PRINTF3(KErrString_MissingConfigFileField, &iSection, &KConnectionServName); |
|
225 return KErrNotFound; |
|
226 } |
|
227 |
|
228 TBool tierIdExists = GetIntFromConfig(iSection, KConnectionServTierId, reinterpret_cast<TInt&>(iTierId)); |
|
229 |
|
230 // All ok if we got this far |
|
231 return KErrNone; |
|
232 } |
|
233 |
|
234 TVerdict CRConnectionServApiExtStep::doSingleTestStep() |
|
235 { |
|
236 SetTestStepResult(EFail); |
|
237 |
|
238 __UHEAP_MARK; |
|
239 RConnectionServ* connServ = iEsockTest->iConnectionServs.Find(iConnectionServName); |
|
240 if (connServ == NULL) |
|
241 { |
|
242 return TestStepResult(); |
|
243 } |
|
244 |
|
245 INFO_PRINTF1(_L("RConnectionServApiExt: Opening data monitoring extension")); |
|
246 TInt err = iExt.Open(*connServ); |
|
247 INFO_PRINTF1(_L("RConnectionServApiExt: Data monitoring extension opened")); |
|
248 |
|
249 |
|
250 TRequestStatus tStatus; |
|
251 TBuf8<1024> tResponseEventBuf; |
|
252 |
|
253 INFO_PRINTF1(_L("RConnectionServApiExt: RequestDataTransferred")); |
|
254 iExt.RequestDataTransferred(tResponseEventBuf, tStatus); |
|
255 User::WaitForRequest(tStatus); // wait for 2 seconds (Dummy TM implementation) |
|
256 INFO_PRINTF1(_L("RConnectionServApiExt: RequestDataTransferred returned")); |
|
257 |
|
258 |
|
259 INFO_PRINTF1(_L("RConnectionServApiExt: RequestDataTransferred")); |
|
260 iExt.RequestDataTransferred(tResponseEventBuf, tStatus); |
|
261 INFO_PRINTF1(_L("RConnectionServApiExt: CancelDataTransferredRequest")); |
|
262 iExt.CancelDataTransferredRequest(); |
|
263 |
|
264 RTimer timer; |
|
265 TRequestStatus timerStatus; |
|
266 timer.CreateLocal(); |
|
267 timer.After(timerStatus, 1e6); |
|
268 |
|
269 User::WaitForRequest(tStatus, timerStatus); // if it works properly, tStatus will be signalled first |
|
270 INFO_PRINTF1(_L("RConnectionServApiExt: RequestDataTransferred returned")); |
|
271 if (tStatus != KRequestPending) |
|
272 { |
|
273 if (tStatus == KErrCancel) |
|
274 { |
|
275 SetTestStepResult(EPass); |
|
276 } |
|
277 timer.Cancel(); |
|
278 } |
|
279 |
|
280 timer.Close(); |
|
281 iExt.Close(); |
|
282 |
|
283 __UHEAP_MARKEND; |
|
284 |
|
285 return TestStepResult(); |
|
286 } |
|
287 |
|
288 |
|
289 |
|
290 // Close Connection Server |
|
291 //------------------------ |
|
292 CCloseRConnectionServStep::CCloseRConnectionServStep(CCEsockTestBase*& aEsockTest) |
|
293 : CTe_EsockStepBase(aEsockTest) |
|
294 { |
|
295 SetTestStepName(KCloseRConnectionServStep); |
|
296 } |
|
297 |
|
298 TInt CCloseRConnectionServStep::ConfigureFromIni() |
|
299 { |
|
300 iConnectionServName.Set(KNullDesC); |
|
301 |
|
302 if((GetStringFromConfig(iSection, KConnectionServName, iConnectionServName) != 1) |
|
303 || (iConnectionServName.Length() == 0)) |
|
304 { |
|
305 INFO_PRINTF3(KErrString_MissingConfigFileField, &iSection, &KConnectionServName); |
|
306 return KErrNotFound; |
|
307 } |
|
308 |
|
309 // All ok if we got this far |
|
310 return KErrNone; |
|
311 } |
|
312 |
|
313 TVerdict CCloseRConnectionServStep::doSingleTestStep() |
|
314 { |
|
315 TInt error = iEsockTest->CloseConnectionServer(iConnectionServName); |
|
316 |
|
317 if (error != KErrNone) |
|
318 { |
|
319 INFO_PRINTF2(_L("Could not close connection server (%S)."), &iConnectionServName); |
|
320 INFO_PRINTF2(_L("Error: %d."), error); |
|
321 return EFail; |
|
322 } |
|
323 |
|
324 return EPass; |
|
325 } |
|
326 |
|
327 |
|
328 _LIT(KAccessPointGenericParameterSet, "GenericParameterSet"); |
|
329 _LIT(KAccessPointParametersType, "ParametersType"); |
|
330 _LIT(KNone, "none"); |
|
331 //_LIT(KAccessPointWifiParameterSet, "WifiParameterSet"); |
|
332 |
|
333 // Connection server query base class |
|
334 //----------------------------------- |
|
335 TInt CRConnectionServQueryTestStepBase::BuildQueryL(ConnectionServ::CConnectionServParameterBundle& aQueryBundle) |
|
336 { |
|
337 // Build a query from the ini settings |
|
338 // Fill in list of APs to limit scope to |
|
339 // We have zero or more AP matches to read in |
|
340 for(TInt index = 0; index < KMaxAccessPoints; index++) |
|
341 { |
|
342 TBuf<64> accessPointMatch; |
|
343 accessPointMatch.Format(KQueryAPMatchFormat, index); |
|
344 TInt accessPointId; |
|
345 |
|
346 // Try to read the next AP |
|
347 if((GetIntFromConfig(iSection, accessPointMatch, accessPointId) != 1)) |
|
348 { |
|
349 break; |
|
350 } |
|
351 else |
|
352 { |
|
353 // Add the newly found access point to the table |
|
354 TAccessPointInfo apInfo; |
|
355 apInfo.SetAccessPoint(accessPointId); |
|
356 aQueryBundle.AddMatchConditionL(apInfo); |
|
357 } |
|
358 } |
|
359 |
|
360 // Fetch and parse filter specification |
|
361 TPtrC filterDes; |
|
362 TAccessPointStatusFilter filter; |
|
363 if((GetStringFromConfig(iSection, KAccessPointFilter, filterDes) == 1) && (filterDes.Length() != 0)) |
|
364 { |
|
365 // We are potentially explicitly including no filter |
|
366 if(filterDes == KNone) |
|
367 { |
|
368 INFO_PRINTF1(_L("Access point filter explicitly set to none")); |
|
369 } |
|
370 else |
|
371 { |
|
372 TRAPD(error, FetchFilterL(filterDes, filter);) |
|
373 if(error != KErrNone) |
|
374 { |
|
375 INFO_PRINTF1(_L("Problem with filter syntax")); |
|
376 return KErrArgument; |
|
377 } |
|
378 |
|
379 // Add the filter to the bundle |
|
380 aQueryBundle.AddMatchConditionL(filter); |
|
381 } |
|
382 } |
|
383 else |
|
384 { |
|
385 INFO_PRINTF1(_L("No filter specified. No filter added to query")); |
|
386 } |
|
387 |
|
388 // Specify which type of parameters we want back |
|
389 TPtrC paramsType; |
|
390 if((GetStringFromConfig(iSection, KAccessPointParametersType, paramsType) == 1)) |
|
391 { |
|
392 if (paramsType.CompareF(KAccessPointGenericParameterSet) == 0) |
|
393 { |
|
394 aQueryBundle.AddParameterSetToReturnL |
|
395 (XAccessPointGenericParameterSet::Type()); |
|
396 INFO_PRINTF2(_L("Parameter set type:%S"), &KAccessPointGenericParameterSet); |
|
397 } |
|
398 /* else if (paramsType.CompareF(KAccessPointWifiParameterSet) == 0) |
|
399 { |
|
400 aQueryBundle.AddParameterSetToReturnL |
|
401 (XAccessPointGenericParameterSet::Type()); |
|
402 aQueryBundle.AddParameterSetToReturnL |
|
403 (XAccessPointWifiParameterSet::Type()); |
|
404 INFO_PRINTF3(_L("Parameter set types: %S and %S"), &KAccessPointGenericParameterSet, &KAccessPointWifiParameterSet); |
|
405 } |
|
406 */ else if (paramsType.CompareF(KNone) == 0) |
|
407 { |
|
408 INFO_PRINTF1(_L("Parameter set type set to *none*. None added to query.")); |
|
409 } |
|
410 else |
|
411 { |
|
412 INFO_PRINTF1(_L("Parameter set type not recognised.")); |
|
413 return KErrArgument; |
|
414 } |
|
415 } |
|
416 // Otherwise we use the generic set by default |
|
417 else |
|
418 { |
|
419 aQueryBundle.AddParameterSetToReturnL |
|
420 (XAccessPointGenericParameterSet::Type()); |
|
421 } |
|
422 |
|
423 |
|
424 // All ok if we got this far |
|
425 return KErrNone; |
|
426 } |
|
427 |
|
428 _LIT(KInvalid, "invalid"); |
|
429 |
|
430 void CRConnectionServQueryTestStepBase::FetchFilterL( |
|
431 const TDesC& aFilterDes, |
|
432 TAccessPointStatusFilter& aFetchedFilter) |
|
433 { |
|
434 // Is the filter perhaps supposed to be invalid |
|
435 if(aFilterDes == KInvalid) |
|
436 { |
|
437 aFetchedFilter = TAccessPointStatusFilter(-1); |
|
438 return; |
|
439 } |
|
440 |
|
441 // Otherwise parse it out from the string given |
|
442 TLex lexer; |
|
443 lexer.Assign(aFilterDes); |
|
444 TChar cCh; |
|
445 TChar rCh; |
|
446 TChar aCh; |
|
447 TChar sCh; |
|
448 if(! |
|
449 ( |
|
450 ( lexer.Get() == TChar('C') ) && ( cCh = lexer.Get() ) && |
|
451 ( lexer.Get() == TChar('R') ) && ( rCh = lexer.Get() ) && |
|
452 ( lexer.Get() == TChar('A') ) && ( aCh = lexer.Get() ) && |
|
453 ( lexer.Get() == TChar('S') ) && ( sCh = lexer.Get() ) |
|
454 ) |
|
455 ) |
|
456 { |
|
457 User::Leave(KErrArgument); |
|
458 } |
|
459 |
|
460 TAccessPointFlagFilterValue c, r, a, s; |
|
461 c = ReadFlagFilterValueL(cCh); |
|
462 r = ReadFlagFilterValueL(rCh); |
|
463 a = ReadFlagFilterValueL(aCh); |
|
464 s = ReadFlagFilterValueL(sCh); |
|
465 |
|
466 aFetchedFilter.Configured(c); |
|
467 aFetchedFilter.Restricted(r); |
|
468 aFetchedFilter.Available(a); |
|
469 aFetchedFilter.Started(s); |
|
470 } |
|
471 |
|
472 TInt CRConnectionServQueryTestStepBase::BuildExpectedResultsL( |
|
473 RArray<TExpectedAccessPointParameters>& aExpectedAPParameters, |
|
474 TInt& aNumExpectedAPs) |
|
475 { |
|
476 // Fetch the number of accesspoints expected to be returned |
|
477 if(GetIntFromConfig(iSection, KExpectedNumberOfAPs, aNumExpectedAPs) != 1) |
|
478 { |
|
479 INFO_PRINTF3(KErrString_MissingConfigFileField, &iSection, &KExpectedNumberOfAPs); |
|
480 return KErrNotFound; |
|
481 } |
|
482 |
|
483 // Fetch the list of access points and their status values |
|
484 TUint specificAPCount = 0; |
|
485 for(TInt index = 1; index < KMaxAccessPoints; index++) |
|
486 { |
|
487 TBuf<64> accessPointMatch; |
|
488 accessPointMatch.Format(KExpectedAPFormat, index); |
|
489 TInt accessPointId; |
|
490 |
|
491 // Try to read the next AP |
|
492 if((GetIntFromConfig(iSection, accessPointMatch, accessPointId) != 1)) |
|
493 { |
|
494 break; |
|
495 } |
|
496 else |
|
497 { |
|
498 // We have access point identifier |
|
499 TAccessPointInfo apInfo; |
|
500 apInfo.SetAccessPoint(accessPointId); |
|
501 |
|
502 // Now require expected status for the given access point identifier |
|
503 TBuf<64> expectedAPMatch; |
|
504 expectedAPMatch.Format(KExpectedAPStatusFormat, index); |
|
505 |
|
506 // Read in the access point status |
|
507 TPtrC apStatusBuf; |
|
508 if((GetStringFromConfig(iSection, expectedAPMatch, apStatusBuf) != 1)) |
|
509 { |
|
510 INFO_PRINTF3(KErrString_MissingConfigFileField, &iSection, &expectedAPMatch); |
|
511 User::Leave(KErrNotFound); |
|
512 } |
|
513 |
|
514 TExpectedAccessPointStatusMask apStatusMask; |
|
515 TRAPD(error, FetchFilterL(apStatusBuf, apStatusMask)); |
|
516 if(error != KErrNone) |
|
517 { |
|
518 INFO_PRINTF1(_L("Problem with result mask syntax")); |
|
519 return KErrArgument; |
|
520 } |
|
521 |
|
522 // Append the expected parameters to Set the expected parameters |
|
523 TExpectedAccessPointParameters apParameters(apInfo, apStatusMask); |
|
524 |
|
525 // Add the new parameters to a list of expected results |
|
526 aExpectedAPParameters.Append(apParameters); |
|
527 } |
|
528 |
|
529 // Update our count of specified access points we are expecting to see |
|
530 specificAPCount = index; |
|
531 } |
|
532 |
|
533 // Check that number of expected APs is less than or equal to the number of specific APs expected |
|
534 if(specificAPCount > aNumExpectedAPs) |
|
535 { |
|
536 INFO_PRINTF1(_L("More specific APs than total number expected")); |
|
537 return KErrArgument; |
|
538 } |
|
539 |
|
540 // All ok if we got this far |
|
541 return KErrNone; |
|
542 } |
|
543 |
|
544 TAccessPointFlagFilterValue CRConnectionServQueryTestStepBase::ReadFlagFilterValueL(TChar ch) |
|
545 { |
|
546 if(ch == TChar('?')) |
|
547 return EAccessPointFlagMatchAny; |
|
548 if(ch == TChar('T') || ch == TChar('Y')) |
|
549 return EAccessPointFlagMatchTrue; |
|
550 if(ch == TChar('F') || ch == TChar('N')) |
|
551 return EAccessPointFlagMatchFalse; |
|
552 if(ch == TChar('-') || ch == TChar('_')) |
|
553 return EAccessPointFlagIgnore; |
|
554 |
|
555 User::Leave(KErrArgument); |
|
556 return EAccessPointFlagIgnore; |
|
557 } |
|
558 |
|
559 TBool CRConnectionServQueryTestStepBase::CompareAgainstExpected( |
|
560 TInt aNumExpected, |
|
561 RArray<TExpectedAccessPointParameters>& aAPsExpected, |
|
562 ConnectionServ::CConnectionServParameterBundle& aResultsBundle) |
|
563 { |
|
564 // Default to not being valid results |
|
565 TBool verdict = EFalse; |
|
566 |
|
567 // Firstly compare the numbers of access points expected |
|
568 TUint numParamSetContainers = aResultsBundle.CountParamSetContainers(); |
|
569 |
|
570 if(numParamSetContainers == aNumExpected) |
|
571 { |
|
572 // We have the expected number of access points |
|
573 // Now check that each is expected and that its status is as expected |
|
574 // We require to find each AP in our 'expected' list in our 'results' list (with identical status) |
|
575 TBool anyExpectedAPsNotFound = EFalse; |
|
576 TUint numExpected = aAPsExpected.Count(); |
|
577 for(TUint i = 0; i < numExpected; i++) |
|
578 { |
|
579 const TExpectedAccessPointStatusMask& expectedAPStatus = aAPsExpected[i].AccessPointStatus(); |
|
580 const TAccessPointInfo& expectedAPInfo = aAPsExpected[i].AccessPointInfo(); |
|
581 |
|
582 TBool found = EFalse; |
|
583 |
|
584 TUint j = 0; |
|
585 const CParameterSetContainer* ctnr; |
|
586 while(TBool(ctnr = aResultsBundle.GetParamSetContainer(j++))) |
|
587 { |
|
588 TUint k = 0; |
|
589 const XParameterSetBase *set; |
|
590 while(TBool(set = ctnr->GetParameterSet(k++))) |
|
591 { |
|
592 if(set->IsTypeOf(XAccessPointGenericParameterSet::Type())) |
|
593 { |
|
594 const XAccessPointGenericParameterSet* params = static_cast<const XAccessPointGenericParameterSet*>(set); |
|
595 |
|
596 // Compare the values |
|
597 if((const_cast<TAccessPointInfo&>(params->AccessPointInfo()) == const_cast<TAccessPointInfo&>(expectedAPInfo)) && |
|
598 (expectedAPStatus.CompareToAPStatus(params->AccessPointStatus()))) |
|
599 { |
|
600 found = ETrue; |
|
601 break; |
|
602 } |
|
603 } |
|
604 } |
|
605 |
|
606 if(found) |
|
607 break; |
|
608 } |
|
609 |
|
610 if(!found) |
|
611 { |
|
612 anyExpectedAPsNotFound = ETrue; |
|
613 break; |
|
614 } |
|
615 } |
|
616 |
|
617 if(anyExpectedAPsNotFound == EFalse) |
|
618 { |
|
619 // If we got this far then everything must be as expected |
|
620 verdict = ETrue; |
|
621 } |
|
622 } |
|
623 |
|
624 return verdict; |
|
625 } |
|
626 |
|
627 void CRConnectionServQueryTestStepBase::BundleToString(const CParameterBundleBase* aBundle,TDes& aBuf) |
|
628 { |
|
629 aBuf.Append(_L("Bundle:\n")); |
|
630 const CParameterSetContainer* ctnr; |
|
631 TInt i=0; |
|
632 while(TBool(ctnr = aBundle->GetParamSetContainer(i++))) |
|
633 { |
|
634 ParamSetCtrToString(ctnr,aBuf); |
|
635 } |
|
636 } |
|
637 /* |
|
638 void CRConnectionServQueryTestStepBase::WifiParamsToString( |
|
639 const XAccessPointWifiParameterSet* aSet, |
|
640 TDes& aBuf) |
|
641 { |
|
642 aBuf.Append(_L("WPS:")); |
|
643 |
|
644 TBuf<256> temp; |
|
645 |
|
646 aBuf.Append(_L(" Ssid:")); |
|
647 temp.Copy(aSet->Ssid()); |
|
648 aBuf.Append(temp); |
|
649 aBuf.Append(_L(" ChannelId:")); |
|
650 aBuf.AppendNum(aSet->ChannelId()); |
|
651 aBuf.Append(_L(" Rssi:")); |
|
652 aBuf.AppendNum(aSet->Rssi()); |
|
653 } |
|
654 */ |
|
655 void CRConnectionServQueryTestStepBase::ParamSetCtrToString(const CParameterSetContainer* aCtnr,TDes& aBuf) |
|
656 { |
|
657 aBuf.Append(_L("\tContainer id ")); |
|
658 aBuf.AppendNum(aCtnr->Id()); |
|
659 aBuf.Append(_L(":\n")); |
|
660 const XParameterSetBase *set; |
|
661 TInt i=0; |
|
662 while(TBool(set = aCtnr->GetParameterSet(i++))) |
|
663 { |
|
664 aBuf.Append(_L("\t\t")); |
|
665 if(set->IsTypeOf(XAccessPointGenericParameterSet::Type())) |
|
666 { |
|
667 GenericParamsToString(static_cast<const XAccessPointGenericParameterSet*>(set),aBuf); |
|
668 } |
|
669 /* else if (set->IsTypeOf(XAccessPointWifiParameterSet::Type())) |
|
670 { |
|
671 WifiParamsToString(static_cast<const XAccessPointWifiParameterSet*>(set),aBuf); |
|
672 } |
|
673 */ else if (set->IsTypeOf(XMBMSServiceQuerySet::Type())) //MBMS_BROADCAST |
|
674 { |
|
675 MBMSParamsToString(static_cast<const XMBMSServiceQuerySet*>(set), aBuf); |
|
676 } |
|
677 else |
|
678 { |
|
679 aBuf.Append(_L("unrecognised data type")); |
|
680 } |
|
681 aBuf.Append(_L("\n")); |
|
682 } |
|
683 } |
|
684 |
|
685 void CRConnectionServQueryTestStepBase::GenericParamsToString( |
|
686 const XAccessPointGenericParameterSet* aSet, |
|
687 TDes& aBuf) |
|
688 { |
|
689 aBuf.Append(_L("GPS: AP:")); |
|
690 |
|
691 TAccessPointInfo inf = aSet->AccessPointInfo(); |
|
692 |
|
693 aBuf.AppendNum(inf.AccessPoint()); |
|
694 aBuf.Append(' '); |
|
695 |
|
696 TAccessPointStatus stat = aSet->AccessPointStatus(); |
|
697 |
|
698 aBuf.Append(_L("C:")); |
|
699 aBuf.Append(GetApFlagChar(stat.Configured())); |
|
700 aBuf.Append(_L(" R:")); |
|
701 aBuf.Append(GetApFlagChar(stat.Restricted())); |
|
702 aBuf.Append(_L(" A:")); |
|
703 aBuf.Append(GetApFlagChar(stat.Available())); |
|
704 aBuf.Append(_L(" S:")); |
|
705 aBuf.Append(GetApFlagChar(stat.Started())); |
|
706 } |
|
707 |
|
708 TChar CRConnectionServQueryTestStepBase::GetApFlagChar(TAccessPointFlagValue val) |
|
709 { |
|
710 switch(val) |
|
711 { |
|
712 case EAccessPointFlagFalse: return 'N'; |
|
713 case EAccessPointFlagTrue: return 'Y'; |
|
714 } |
|
715 |
|
716 return '?'; |
|
717 } |
|
718 |
|
719 void CRConnectionServQueryTestStepBase::MBMSParamsToString( |
|
720 const XMBMSServiceQuerySet* aSet, |
|
721 TDes& aBuf) |
|
722 { |
|
723 aBuf.Append(_L("MBMS PS:")); |
|
724 |
|
725 aBuf.Append(_L(" QueryType:")); |
|
726 if(aSet->GetQueryType() == ConnectionServ::XMBMSServiceQuerySet::EBearerAvailability) |
|
727 { |
|
728 aBuf.Append(_L("EBearerAvailability")); |
|
729 } |
|
730 else if(aSet->GetQueryType() == ConnectionServ::XMBMSServiceQuerySet::EAddService) |
|
731 { |
|
732 aBuf.Append(_L("EAddService")); |
|
733 } |
|
734 else if(aSet->GetQueryType() == ConnectionServ::XMBMSServiceQuerySet::ERemoveService) |
|
735 { |
|
736 aBuf.Append(_L("ERemoveService")); |
|
737 } |
|
738 else if(aSet->GetQueryType() == ConnectionServ::XMBMSServiceQuerySet::ERemoveAllService) |
|
739 { |
|
740 aBuf.Append(_L("ERemoveAllService")); |
|
741 } |
|
742 else |
|
743 { |
|
744 aBuf.Append(_L(" ")); |
|
745 } |
|
746 |
|
747 aBuf.Append(_L(" BearerAvailability:")); |
|
748 if(aSet->GetMBMSBearerAvailability() == EMbmsAvailabilityUnknown) |
|
749 { |
|
750 aBuf.Append(_L("EMbmsAvailabilityUnknown")); |
|
751 } |
|
752 else if (aSet->GetMBMSBearerAvailability() == EMbmsUnavailable) |
|
753 { |
|
754 aBuf.Append(_L("EMbmsUnavailable")); |
|
755 } |
|
756 else if (aSet->GetMBMSBearerAvailability() == EMbmsAvailable) |
|
757 { |
|
758 aBuf.Append(_L("EMbmsAvailable")); |
|
759 } |
|
760 else |
|
761 { |
|
762 aBuf.Append(_L(" ")); |
|
763 } |
|
764 } |
|
765 |
|
766 // CancelAccessPointStatusQuery |
|
767 //----------------------- |
|
768 |
|
769 CCancelAccessPointStatusQueryStep::CCancelAccessPointStatusQueryStep(CCEsockTestBase*& aEsockTest) |
|
770 : CRConnectionServQueryTestStepBase(aEsockTest) |
|
771 { |
|
772 SetTestStepName(KCancelAccessPointStatusQueryStep); |
|
773 } |
|
774 |
|
775 TInt CCancelAccessPointStatusQueryStep::ConfigureFromIni() |
|
776 { |
|
777 iConnectionServName.Set(KNullDesC); |
|
778 |
|
779 if((GetStringFromConfig(iSection, KConnectionServName, iConnectionServName) != 1) |
|
780 || (iConnectionServName.Length() == 0)) |
|
781 { |
|
782 INFO_PRINTF3(KErrString_MissingConfigFileField, &iSection, &KConnectionServName); |
|
783 return KErrNotFound; |
|
784 } |
|
785 |
|
786 TInt error; |
|
787 TRAP(error, iQueryBundle = CConnectionServParameterBundle::NewL()); |
|
788 if(error != KErrNone) |
|
789 return error; |
|
790 |
|
791 TRAP(error, iResultsBundle = CConnectionServParameterBundle::NewL()); |
|
792 if(error != KErrNone) |
|
793 return error; |
|
794 |
|
795 TRAP(error, BuildQueryL(*iQueryBundle);) |
|
796 if(error != KErrNone) |
|
797 return KErrNotFound; |
|
798 |
|
799 TRAP(error, BuildExpectedResultsL(iExpectedAPParameters, iNumExpectedAPs);) |
|
800 if(error != KErrNone) |
|
801 return KErrNotFound; |
|
802 |
|
803 return KErrNone; |
|
804 } |
|
805 |
|
806 CCancelAccessPointStatusQueryStep::~CCancelAccessPointStatusQueryStep() |
|
807 { |
|
808 iExpectedAPParameters.Close(); |
|
809 delete iResultsBundle; |
|
810 delete iQueryBundle; |
|
811 } |
|
812 |
|
813 TVerdict CCancelAccessPointStatusQueryStep::doSingleTestStep() |
|
814 { |
|
815 // Default to fail |
|
816 SetTestStepResult(EFail); |
|
817 |
|
818 // Perform the query already configured |
|
819 __ASSERT_DEBUG(iResultsBundle, User::Panic(KSpecAssert_ESockTestCnctnSr, 1)); |
|
820 TInt error = iEsockTest->CancelAccessPointStatusQuery(iConnectionServName, *iQueryBundle, *iResultsBundle); |
|
821 |
|
822 if(error == KErrCancel) |
|
823 { |
|
824 SetTestStepResult(EPass); |
|
825 } |
|
826 |
|
827 return TestStepResult(); |
|
828 } |
|
829 |
|
830 |
|
831 //AccessPointStatusQuery |
|
832 |
|
833 CAccessPointStatusQueryStep::CAccessPointStatusQueryStep(CCEsockTestBase*& aEsockTest) |
|
834 : CRConnectionServQueryTestStepBase(aEsockTest) |
|
835 { |
|
836 SetTestStepName(KAccessPointStatusQueryStep); |
|
837 } |
|
838 |
|
839 TInt CAccessPointStatusQueryStep::ConfigureFromIni() |
|
840 { |
|
841 iConnectionServName.Set(KNullDesC); |
|
842 |
|
843 if((GetStringFromConfig(iSection, KConnectionServName, iConnectionServName) != 1) |
|
844 || (iConnectionServName.Length() == 0)) |
|
845 { |
|
846 INFO_PRINTF3(KErrString_MissingConfigFileField, &iSection, &KConnectionServName); |
|
847 return KErrNotFound; |
|
848 } |
|
849 |
|
850 // Check if an error is expected |
|
851 if((GetIntFromConfig(iSection, KExpectedError, iExpectedError) == 1)) |
|
852 { |
|
853 INFO_PRINTF2(_L("Expecting Error %d"), iExpectedError); |
|
854 } |
|
855 |
|
856 TInt error; |
|
857 TRAP(error, iQueryBundle = CConnectionServParameterBundle::NewL()); |
|
858 if(error != KErrNone) |
|
859 return error; |
|
860 |
|
861 TRAP(error, iResultsBundle = CConnectionServParameterBundle::NewL()); |
|
862 if(error != KErrNone) |
|
863 return error; |
|
864 |
|
865 TRAP(error, error = BuildQueryL(*iQueryBundle);) |
|
866 if(error != KErrNone) |
|
867 return KErrNotFound; |
|
868 |
|
869 TRAP(error, error = BuildExpectedResultsL(iExpectedAPParameters, iNumExpectedAPs);) |
|
870 if(error != KErrNone) |
|
871 return KErrNotFound; |
|
872 |
|
873 return KErrNone; |
|
874 } |
|
875 |
|
876 CAccessPointStatusQueryStep::~CAccessPointStatusQueryStep() |
|
877 { |
|
878 iExpectedAPParameters.Close(); |
|
879 delete iResultsBundle; |
|
880 delete iQueryBundle; |
|
881 } |
|
882 |
|
883 TVerdict CAccessPointStatusQueryStep::doSingleTestStep() |
|
884 { |
|
885 // Default to fail |
|
886 SetTestStepResult(EFail); |
|
887 |
|
888 // Perform the query already configured |
|
889 __ASSERT_DEBUG(iResultsBundle, User::Panic(KSpecAssert_ESockTestCnctnSr, 2)); |
|
890 |
|
891 INFO_PRINTF1(_L("A different thread Exited")); |
|
892 TInt error = iEsockTest->ConnectionAccessPointStatusQuery(iConnectionServName, *iQueryBundle, *iResultsBundle); |
|
893 |
|
894 // Log the contents of the incoming results bundle |
|
895 TBuf<1000> logBuf; |
|
896 BundleToString(iResultsBundle, logBuf); |
|
897 INFO_PRINTF1(logBuf); |
|
898 |
|
899 // Compare against expected, and report any errors |
|
900 if((error == iExpectedError) && (error != KErrNone)) |
|
901 { |
|
902 INFO_PRINTF3(_L("Query error %d matched Expected error %d"), error, iExpectedError); |
|
903 SetTestStepResult(EPass); |
|
904 } |
|
905 else if(error != KErrNone) |
|
906 { |
|
907 INFO_PRINTF2(_L("Could not query connection server (%S)."), &iConnectionServName); |
|
908 INFO_PRINTF2(_L("Error: %d."), error); |
|
909 SetTestStepError(error); |
|
910 } |
|
911 else |
|
912 { |
|
913 TBool match = CompareAgainstExpected( |
|
914 iNumExpectedAPs, |
|
915 iExpectedAPParameters, |
|
916 *iResultsBundle); |
|
917 |
|
918 if(match) |
|
919 { |
|
920 SetTestStepResult(EPass); |
|
921 } |
|
922 else |
|
923 { |
|
924 INFO_PRINTF1(_L("Access point query results to not match those expected.")); |
|
925 } |
|
926 } |
|
927 |
|
928 return TestStepResult(); |
|
929 } |
|
930 |
|
931 |
|
932 TBool TExpectedAccessPointStatusMask::CompareToAPStatus(const ConnectionServ::TAccessPointStatus& aStatus) const |
|
933 { |
|
934 // Compare each of the 4 properties we are expecting |
|
935 TBool configured = CompareStatusFlagToMaskFlag( |
|
936 aStatus.Configured(), |
|
937 Configured()); |
|
938 |
|
939 TBool restricted = CompareStatusFlagToMaskFlag( |
|
940 aStatus.Restricted(), |
|
941 Restricted()); |
|
942 |
|
943 TBool available = CompareStatusFlagToMaskFlag( |
|
944 aStatus.Available(), |
|
945 Available()); |
|
946 |
|
947 TBool started = CompareStatusFlagToMaskFlag( |
|
948 aStatus.Started(), |
|
949 Started()); |
|
950 |
|
951 return (configured && restricted && available && started); |
|
952 } |
|
953 |
|
954 TBool TExpectedAccessPointStatusMask::CompareStatusFlagToMaskFlag( |
|
955 const ConnectionServ::TAccessPointFlagValue apFlag, |
|
956 const ConnectionServ::TAccessPointFlagFilterValue apMaskValue) const |
|
957 { |
|
958 // If mask is 'ignore' then we don't need to validate anything |
|
959 if(apMaskValue == ConnectionServ::EAccessPointFlagIgnore) |
|
960 { |
|
961 return ETrue; |
|
962 } |
|
963 |
|
964 if(apMaskValue == ConnectionServ::EAccessPointFlagMatchFalse) |
|
965 { |
|
966 if(apFlag != ConnectionServ::EAccessPointFlagFalse) |
|
967 { |
|
968 return EFalse; |
|
969 } |
|
970 else |
|
971 { |
|
972 return ETrue; |
|
973 } |
|
974 } |
|
975 |
|
976 if(apMaskValue == ConnectionServ::EAccessPointFlagMatchTrue) |
|
977 { |
|
978 if(apFlag != ConnectionServ::EAccessPointFlagTrue) |
|
979 { |
|
980 return EFalse; |
|
981 } |
|
982 else |
|
983 { |
|
984 return ETrue; |
|
985 } |
|
986 } |
|
987 |
|
988 // If expecting unknown then must be unknown |
|
989 if(apMaskValue == ConnectionServ::EAccessPointFlagMatchAny) |
|
990 { |
|
991 if(apFlag != ConnectionServ::EAccessPointFlagUnknown) |
|
992 { |
|
993 return EFalse; |
|
994 } |
|
995 else |
|
996 { |
|
997 return ETrue; |
|
998 } |
|
999 } |
|
1000 |
|
1001 // What are we doing here |
|
1002 __ASSERT_DEBUG(0, User::Panic(KSpecAssert_ESockTestCnctnSr, 3)); |
|
1003 return EFalse; |
|
1004 } |
|
1005 |
|
1006 // Request access point notification |
|
1007 //---------------------------------- |
|
1008 static const TInt KNotifThreadStackSize = (32 * 1024); // TODO_CDG really how big should our stack be? |
|
1009 _LIT(KNotificationName, "NotificationName"); |
|
1010 |
|
1011 CRequestAccessPointNotificationStep::CRequestAccessPointNotificationStep(CCEsockTestBase*& aEsockTest) |
|
1012 : CRConnectionServQueryTestStepBase(aEsockTest) |
|
1013 { |
|
1014 SetTestStepName(KRequestAccessPointNotificationStep); |
|
1015 } |
|
1016 |
|
1017 TInt CRequestAccessPointNotificationStep::ConfigureFromIni() |
|
1018 { |
|
1019 iConnectionServName.Set(KNullDesC); |
|
1020 |
|
1021 // Get the name of the connection server instance we are to use |
|
1022 if((GetStringFromConfig(iSection, KConnectionServName, iConnectionServName) != 1) |
|
1023 || (iConnectionServName.Length() == 0)) |
|
1024 { |
|
1025 INFO_PRINTF3(KErrString_MissingConfigFileField, &iSection, &KConnectionServName); |
|
1026 return KErrNotFound; |
|
1027 } |
|
1028 |
|
1029 // Get the name applied to the notification so we can look it up later when referring to the results |
|
1030 if((GetStringFromConfig(iSection, KNotificationName, iNotifName) != 1) |
|
1031 || (iNotifName.Length() == 0)) |
|
1032 { |
|
1033 INFO_PRINTF3(KErrString_MissingConfigFileField, &iSection, &KNotificationName); |
|
1034 return KErrNotFound; |
|
1035 } |
|
1036 |
|
1037 TInt error; |
|
1038 TRAP(error, iQueryBundle = CConnectionServParameterBundle::NewL()); |
|
1039 if(error != KErrNone) |
|
1040 return error; |
|
1041 |
|
1042 TRAP(error, BuildQueryL(*iQueryBundle);) |
|
1043 if(error != KErrNone) |
|
1044 return KErrNotFound; |
|
1045 |
|
1046 return KErrNone; |
|
1047 } |
|
1048 |
|
1049 TVerdict CRequestAccessPointNotificationStep::doSingleTestStep() |
|
1050 { |
|
1051 // Fail by default |
|
1052 SetTestStepResult(EFail); |
|
1053 |
|
1054 // Fetch the connection server on which to create the |
|
1055 RConnectionServ* connServ = iEsockTest->iConnectionServs.Find(iConnectionServName); |
|
1056 if(connServ == NULL) |
|
1057 { |
|
1058 INFO_PRINTF2(KErrString_NamedObjectNotFound, &iConnectionServName); |
|
1059 } |
|
1060 else |
|
1061 { |
|
1062 // Wrap up the request for the thread we will palm it off to |
|
1063 CConnServNotificationWatcher* notifMgr = CConnServNotificationWatcher::NewLC |
|
1064 (connServ, iQueryBundle); |
|
1065 CleanupStack::Pop(notifMgr); |
|
1066 |
|
1067 // Give the notifing thread a handle to us |
|
1068 notifMgr->iCommandThread.Open(RThread().Id(), EOwnerProcess); |
|
1069 |
|
1070 // Start a thread to manage the notifications as these occur with use of a scheduler |
|
1071 TInt error = notifMgr->iNotifThread.Create( |
|
1072 iNotifName, |
|
1073 CConnServNotificationWatcher::EntryPoint, |
|
1074 KNotifThreadStackSize, |
|
1075 NULL, |
|
1076 static_cast<TAny*>(notifMgr)); |
|
1077 |
|
1078 // If all ok then kick off the notification thread |
|
1079 if(error != KErrNone) |
|
1080 { |
|
1081 INFO_PRINTF2(_L("Could not start separate thread for capturing notifications. error:%d"), error); |
|
1082 } |
|
1083 else |
|
1084 { |
|
1085 // Get the thread started |
|
1086 INFO_PRINTF1(_L("Worker thread kicked off to register for and collect the notifications.")); |
|
1087 notifMgr->iNotifThread.Resume(); |
|
1088 |
|
1089 // Keep a reference to our notif manager for follow up test step |
|
1090 TInt addError = iEsockTest->iNotifWatchers.Add(notifMgr, iNotifName); |
|
1091 __ASSERT_DEBUG(addError == KErrNone, User::Panic(KSpecAssert_ESockTestCnctnSr, 4)); |
|
1092 |
|
1093 // Await the completion of the notification setup (to avoid race conditions when, say, |
|
1094 // the next test step will tweak availability before the provider has had a chance to start). |
|
1095 // Leaves if there was an error on startup.. |
|
1096 notifMgr->AwaitStartupCompletionL(); |
|
1097 INFO_PRINTF1(_L("Notification registration completed successfully.")); |
|
1098 |
|
1099 SetTestStepResult(EPass); |
|
1100 } |
|
1101 } |
|
1102 |
|
1103 return TestStepResult(); |
|
1104 } |
|
1105 |
|
1106 |
|
1107 |
|
1108 // Receive access point notification |
|
1109 //---------------------------------- |
|
1110 CReceiveAccessPointNotificationStep::CReceiveAccessPointNotificationStep(CCEsockTestBase*& aEsockTest) |
|
1111 : CRConnectionServQueryTestStepBase(aEsockTest) |
|
1112 { |
|
1113 SetTestStepName(KReceiveAccessPointNotificationStep); |
|
1114 } |
|
1115 |
|
1116 _LIT(KWaitPeriod, "WaitPeriod"); |
|
1117 _LIT(KExpectingNotification, "ExpectingNotification"); |
|
1118 |
|
1119 TInt CReceiveAccessPointNotificationStep::ConfigureFromIni() |
|
1120 { |
|
1121 iConnectionServName.Set(KNullDesC); |
|
1122 |
|
1123 // Get the name of the connection |
|
1124 if((GetStringFromConfig(iSection, KNotificationName, iNotifName) != 1) |
|
1125 || (iNotifName.Length() == 0)) |
|
1126 { |
|
1127 INFO_PRINTF3(KErrString_MissingConfigFileField, &iSection, &KNotificationName); |
|
1128 return KErrNotFound; |
|
1129 } |
|
1130 |
|
1131 // Offer the option of expecting no notification at all but default to expecting one |
|
1132 iExpectingNotification = ETrue; |
|
1133 // OPTIONAL |
|
1134 GetBoolFromConfig(iSection, KExpectingNotification, iExpectingNotification); |
|
1135 |
|
1136 // Get the delay period before expecting a notification |
|
1137 // OPTIONAL |
|
1138 GetIntFromConfig(iSection, KWaitPeriod, iInitialDelayInSeconds); |
|
1139 |
|
1140 // Get a list of the expected results |
|
1141 if(iExpectingNotification) |
|
1142 { |
|
1143 TRAPD(error, BuildExpectedResultsL(iExpectedAPParameters, iNumExpectedAPs);) |
|
1144 if(error != KErrNone) |
|
1145 return KErrNotFound; |
|
1146 } |
|
1147 |
|
1148 return KErrNone; |
|
1149 } |
|
1150 |
|
1151 const TInt KMicroSecondsPerSecond = 1000000; |
|
1152 |
|
1153 TVerdict CReceiveAccessPointNotificationStep::doSingleTestStep() |
|
1154 { |
|
1155 // Fail by default |
|
1156 SetTestStepResult(EFail); |
|
1157 |
|
1158 if (!iExpectingNotification) |
|
1159 { |
|
1160 // RJL for SMP: |
|
1161 // only delay for specified period if we're expecting to see nothing.. |
|
1162 // else wait on notification queue |
|
1163 User::After(iInitialDelayInSeconds * KMicroSecondsPerSecond); |
|
1164 } |
|
1165 |
|
1166 // Fetch the notification watching entity |
|
1167 CConnServNotificationWatcher* notifMgr = iEsockTest->iNotifWatchers.Find(iNotifName); |
|
1168 if(!notifMgr) |
|
1169 { |
|
1170 INFO_PRINTF3(KErrString_NamedObjectNotFound, &iSection, &iNotifName); |
|
1171 } |
|
1172 else |
|
1173 { |
|
1174 // ##### SYNCHRONISE ACCESS ##### |
|
1175 if(iExpectingNotification) |
|
1176 { |
|
1177 // wait for items to arrive in notification queue |
|
1178 notifMgr->WaitOnQueueL(); |
|
1179 } |
|
1180 notifMgr->Wait(); |
|
1181 |
|
1182 // Fetch the single oldest set of results only |
|
1183 // Any following notifications captured will be collected in subsequent calls to this test step |
|
1184 CConnectionServParameterBundle* resultsBundle = notifMgr->GetResultsBundle(); |
|
1185 //CleanupStack::PushL(resultsBundle); // Non leaving test function |
|
1186 |
|
1187 // Were we expecting a notification at all? |
|
1188 if(iExpectingNotification) |
|
1189 { |
|
1190 // If indeed there were results then compare them with those expected |
|
1191 if(resultsBundle != NULL) |
|
1192 { |
|
1193 // Firstly log the contents of the incoming results bundle |
|
1194 TBuf<1000> logBuf; |
|
1195 BundleToString(resultsBundle, logBuf); |
|
1196 INFO_PRINTF1(logBuf); |
|
1197 |
|
1198 TBool match = CompareAgainstExpected(iNumExpectedAPs, iExpectedAPParameters, *resultsBundle); |
|
1199 |
|
1200 // If they matched those expected then we passed |
|
1201 if(match) |
|
1202 { |
|
1203 SetTestStepResult(EPass); |
|
1204 } |
|
1205 else |
|
1206 { |
|
1207 INFO_PRINTF1(_L("Access point notification results do not match those expected.")); |
|
1208 } |
|
1209 } |
|
1210 else |
|
1211 { |
|
1212 INFO_PRINTF1(_L("Received no notifications when expecting at least one.")); |
|
1213 } |
|
1214 } |
|
1215 else |
|
1216 { |
|
1217 // If we were not expecting a notification and received one then we failed |
|
1218 if(resultsBundle != NULL) |
|
1219 { |
|
1220 INFO_PRINTF1(_L("Received a notificaiton when expecting none:")); |
|
1221 TBuf<1000> logBuf; |
|
1222 BundleToString(resultsBundle, logBuf); |
|
1223 INFO_PRINTF1(logBuf); |
|
1224 } |
|
1225 else |
|
1226 { |
|
1227 INFO_PRINTF1(_L("No notification expected and none witnessed.")); |
|
1228 SetTestStepResult(EPass); |
|
1229 } |
|
1230 } |
|
1231 |
|
1232 // ##### SYNCHRONISE ACCESS ##### |
|
1233 notifMgr->Signal(); |
|
1234 |
|
1235 // Get rid of the results we took ownership of |
|
1236 //CleanupStack::PopAndDestroy(resultsBundle); |
|
1237 } |
|
1238 |
|
1239 return TestStepResult(); |
|
1240 } |
|
1241 |
|
1242 |
|
1243 // Cancel access point notification |
|
1244 //---------------------------------- |
|
1245 CCancelAccessPointNotificationStep::CCancelAccessPointNotificationStep(CCEsockTestBase*& aEsockTest) |
|
1246 : CRConnectionServQueryTestStepBase(aEsockTest) |
|
1247 { |
|
1248 SetTestStepName(KCancelAccessPointNotificationStep); |
|
1249 } |
|
1250 |
|
1251 TInt CCancelAccessPointNotificationStep::ConfigureFromIni() |
|
1252 { |
|
1253 // Get the name of the notification |
|
1254 if((GetStringFromConfig(iSection, KNotificationName, iNotifName) != 1) |
|
1255 || (iNotifName.Length() == 0)) |
|
1256 { |
|
1257 INFO_PRINTF3(KErrString_MissingConfigFileField, &iSection, &KNotificationName); |
|
1258 return KErrNotFound; |
|
1259 } |
|
1260 |
|
1261 // Get the delay period before expecting a notification |
|
1262 // OPTIONAL |
|
1263 GetIntFromConfig(iSection, KWaitPeriod, iInitialDelayInSeconds); |
|
1264 |
|
1265 return KErrNone; |
|
1266 } |
|
1267 |
|
1268 TVerdict CCancelAccessPointNotificationStep::doSingleTestStep() |
|
1269 { |
|
1270 // Fail by default |
|
1271 SetTestStepResult(EFail); |
|
1272 |
|
1273 // Wait first for any specified delay to provide for notifications that may need time to propagate |
|
1274 User::After(iInitialDelayInSeconds * KMicroSecondsPerSecond); |
|
1275 |
|
1276 // Fetch the notification watching entity |
|
1277 CConnServNotificationWatcher* notifMgr = iEsockTest->iNotifWatchers.Find(iNotifName); |
|
1278 if(!notifMgr) |
|
1279 { |
|
1280 INFO_PRINTF3(KErrString_NamedObjectNotFound, &iSection, &iNotifName); |
|
1281 } |
|
1282 else |
|
1283 { |
|
1284 // Log on to our worker notif catcher thread in order to wait for it to finish |
|
1285 TRequestStatus logonStatus; |
|
1286 notifMgr->iNotifThread.Logon(logonStatus); |
|
1287 |
|
1288 // Send command to the thread managing the notification that we want cancelled |
|
1289 // this will then wait upon the thread to complete the command |
|
1290 notifMgr->CancelNotification(); |
|
1291 |
|
1292 // Now wait for the thread to complete |
|
1293 User::WaitForRequest(logonStatus); |
|
1294 TInt logonError = logonStatus.Int(); |
|
1295 |
|
1296 if(logonError == KErrNone) |
|
1297 { |
|
1298 INFO_PRINTF1(_L("Access point notification cancelled successfully.")); |
|
1299 SetTestStepResult(EPass); |
|
1300 } |
|
1301 |
|
1302 // Remove our NotificationWatcher and Close the thread |
|
1303 iEsockTest->iNotifWatchers.Remove(iNotifName); |
|
1304 notifMgr->iNotifThread.Close(); |
|
1305 delete notifMgr; |
|
1306 } |
|
1307 |
|
1308 return TestStepResult(); |
|
1309 } |
|
1310 |
|
1311 |
|
1312 // CConnServNotificationWatcher |
|
1313 //----------------------------- |
|
1314 |
|
1315 const TUid KAccessPointNotificationPubSubUid = {0x10272F4B}; |
|
1316 |
|
1317 CConnServNotificationWatcher* CConnServNotificationWatcher::NewLC( |
|
1318 ConnectionServ::RConnectionServ* aConnServ, |
|
1319 ConnectionServ::CConnectionServParameterBundle* aQueryBundle) |
|
1320 { |
|
1321 CConnServNotificationWatcher* inst = new(ELeave) CConnServNotificationWatcher(aConnServ); |
|
1322 CleanupStack::PushL(inst); |
|
1323 inst->ConstructL(aQueryBundle); |
|
1324 return inst; |
|
1325 } |
|
1326 |
|
1327 void CConnServNotificationWatcher::ConstructL(ConnectionServ::CConnectionServParameterBundle* aQueryBundle) |
|
1328 { |
|
1329 iQueryBundle = aQueryBundle; |
|
1330 iMutex.CreateLocal(); |
|
1331 User::LeaveIfError(iQueueProp.Define(KAccessPointNotificationPubSubUid,reinterpret_cast<TUint32>(this),RProperty::EInt)); |
|
1332 User::LeaveIfError(iQueueProp.Attach(KAccessPointNotificationPubSubUid,reinterpret_cast<TUint32>(this))); |
|
1333 } |
|
1334 |
|
1335 CConnServNotificationWatcher::~CConnServNotificationWatcher() |
|
1336 { |
|
1337 iQueueProp.Delete(KAccessPointNotificationPubSubUid,reinterpret_cast<TUint32>(this)); |
|
1338 iQueueProp.Close(); |
|
1339 iMutex.Close(); |
|
1340 delete iQueryBundle; |
|
1341 iNotificationBundles.ResetAndDestroy(); |
|
1342 iNotifThread.Close(); |
|
1343 } |
|
1344 |
|
1345 void CConnServNotificationWatcher::CancelNotification() |
|
1346 { |
|
1347 iNotifThread.RequestComplete(iCancelStatus, KErrNone); |
|
1348 } |
|
1349 |
|
1350 void CConnServNotificationWatcher::AccessPointNotification(CConnectionServParameterBundle* aResult) |
|
1351 { |
|
1352 __ASSERT_ALWAYS(aResult, User::Invariant()); |
|
1353 |
|
1354 // ##### SYNCHRONISE ACCESS ##### |
|
1355 Wait(); |
|
1356 |
|
1357 /* Check whether the test case is for MBMS*/ |
|
1358 CConnectionServParameterSetContainer* parSetCtr = iQueryBundle->GetParamSetContainer(0); |
|
1359 XMBMSServiceQuerySet* genParamSet = XMBMSServiceQuerySet::FindInParamSetContainer(*parSetCtr); |
|
1360 |
|
1361 if(genParamSet != NULL) |
|
1362 { |
|
1363 iHaveReceivedNotifSetupAck = ETrue; |
|
1364 } |
|
1365 |
|
1366 |
|
1367 // The first notification is simply acknowledgement of completion of notif set up so just consume |
|
1368 |
|
1369 if(!iHaveReceivedNotifSetupAck) |
|
1370 { |
|
1371 iHaveReceivedNotifSetupAck = ETrue; |
|
1372 |
|
1373 // We should check first that there are no bundles included which would be unexpected |
|
1374 if(aResult->CountParamSetContainers() && iErrCode == KErrNone) |
|
1375 { |
|
1376 iErrCode = KErrTooBig; |
|
1377 } |
|
1378 |
|
1379 // Send a signal to the "Request Notification" test step that setup has completed |
|
1380 iQueueProp.Set(0); |
|
1381 |
|
1382 // Finally delete the incoming bundle |
|
1383 delete aResult; |
|
1384 } |
|
1385 else |
|
1386 { |
|
1387 // Save our results away |
|
1388 TInt error = iNotificationBundles.Append(aResult); |
|
1389 |
|
1390 // Update queue size property. Potentially will happen when |
|
1391 // client is waiting for notifications (i.e. is subscribing to this |
|
1392 // property) which would cause the client to be signalled |
|
1393 iQueueProp.Set(iNotificationBundles.Count()); |
|
1394 |
|
1395 __ASSERT_ALWAYS(error == KErrNone, User::Invariant()); |
|
1396 } |
|
1397 |
|
1398 // ##### SYNCHRONISE ACCESS ##### |
|
1399 Signal(); |
|
1400 } |
|
1401 |
|
1402 |
|
1403 void CConnServNotificationWatcher::AccessPointNotificationError(TInt aErrCode) |
|
1404 { |
|
1405 iErrCode = aErrCode; |
|
1406 iQueueProp.Set(iNotificationBundles.Count()); // Notify the waiting test step... |
|
1407 } |
|
1408 |
|
1409 void CConnServNotificationWatcher::DoCancel() |
|
1410 { |
|
1411 iConnServ.CancelAccessPointNotification(); |
|
1412 } |
|
1413 |
|
1414 void CConnServNotificationWatcher::PerformNotificationRequestL() |
|
1415 { |
|
1416 // Perform the notification request |
|
1417 iConnServ.AccessPointNotification(*iQueryBundle, *this); |
|
1418 } |
|
1419 |
|
1420 ConnectionServ::CConnectionServParameterBundle* CConnServNotificationWatcher::GetResultsBundle() |
|
1421 { |
|
1422 if(iNotificationBundles.Count()) |
|
1423 { |
|
1424 // Return the top results bundle and remove it from the list we keep |
|
1425 ConnectionServ::CConnectionServParameterBundle* bundle = iNotificationBundles[0]; |
|
1426 iNotificationBundles.Remove(0); |
|
1427 |
|
1428 // Update queue size property. Should only happen when client has control of my mutex, |
|
1429 // so nobody will be signalled on this property change. |
|
1430 iQueueProp.Set(iNotificationBundles.Count()); |
|
1431 |
|
1432 return bundle; |
|
1433 } |
|
1434 else |
|
1435 { |
|
1436 return NULL; |
|
1437 } |
|
1438 } |
|
1439 |
|
1440 void CConnServNotificationWatcher::RunNotificationL() |
|
1441 { |
|
1442 // Create and install the active scheduler we know we will need |
|
1443 CActiveScheduler* scheduler = new(ELeave) CActiveScheduler; |
|
1444 CleanupStack::PushL(scheduler); |
|
1445 CActiveScheduler::Install(scheduler); |
|
1446 |
|
1447 // Call the notification |
|
1448 TRAP_IGNORE(PerformNotificationRequestL();) |
|
1449 |
|
1450 // Create an active object to wait on instruction to tell us to die |
|
1451 CNotifCancelControl* cancelCtrl = CNotifCancelControl::NewL(*this); |
|
1452 CleanupStack::PushL(cancelCtrl); |
|
1453 cancelCtrl->Wait(); |
|
1454 |
|
1455 // Start the active scheduler which will manage notification requests |
|
1456 TRAP_IGNORE(CActiveScheduler::Start()) |
|
1457 |
|
1458 // Cleanup |
|
1459 CleanupStack::PopAndDestroy(cancelCtrl); |
|
1460 CleanupStack::PopAndDestroy(scheduler); |
|
1461 } |
|
1462 |
|
1463 TInt CConnServNotificationWatcher::EntryPoint(TAny* iArgs) |
|
1464 { |
|
1465 // Need a cleanup stack |
|
1466 CTrapCleanup* cleanupStack = CTrapCleanup::New(); |
|
1467 |
|
1468 TRAP_IGNORE((static_cast<CConnServNotificationWatcher*>(iArgs))->RunNotificationL();) |
|
1469 |
|
1470 // Remove our cleanup stack |
|
1471 delete cleanupStack; |
|
1472 |
|
1473 return KErrNone; |
|
1474 } |
|
1475 |
|
1476 // waits for signal from other thread |
|
1477 void CConnServNotificationWatcher::AwaitStartupCompletionL(void) const |
|
1478 { |
|
1479 RProperty queueProp; |
|
1480 queueProp.Attach(KAccessPointNotificationPubSubUid,reinterpret_cast<TUint32>(this)); |
|
1481 TRequestStatus status; |
|
1482 // Wait on notification queue to be set for the first time |
|
1483 queueProp.Subscribe(status); |
|
1484 User::WaitForRequest(status); |
|
1485 queueProp.Close(); |
|
1486 User::LeaveIfError(iErrCode); |
|
1487 } |
|
1488 |
|
1489 // waits for signal from other thread |
|
1490 void CConnServNotificationWatcher::WaitOnQueueL(void) const |
|
1491 { |
|
1492 RProperty queueProp; |
|
1493 queueProp.Attach(KAccessPointNotificationPubSubUid,reinterpret_cast<TUint32>(this)); |
|
1494 TRequestStatus status; |
|
1495 // Wait on notification queue. This property is kept up to date with the number |
|
1496 // of items in the queue in the CConnServNotificationWatcher object. |
|
1497 queueProp.Subscribe(status); |
|
1498 TInt queueSize=0; |
|
1499 queueProp.Get(queueSize); |
|
1500 if(queueSize) // i.e. if things are in the queue |
|
1501 { |
|
1502 queueProp.Cancel(); |
|
1503 } |
|
1504 User::WaitForRequest(status); |
|
1505 queueProp.Close(); |
|
1506 User::LeaveIfError(iErrCode); |
|
1507 } |
|
1508 |
|
1509 |
|
1510 |
|
1511 |
|
1512 // Availability simulation |
|
1513 //------------------------ |
|
1514 |
|
1515 _LIT(KAccessPointId, "AccessPointId"); |
|
1516 _LIT(KAccessPointScore, "AccessPointScore"); |
|
1517 _LIT(KAccessPointState, "AccessPointState"); |
|
1518 |
|
1519 _LIT(KAvailable, "Available"); |
|
1520 _LIT(KUnavailable, "Unavailable"); |
|
1521 _LIT(KStalled, "Stalled"); |
|
1522 |
|
1523 CSetAccessPointAvailabilityStep::CSetAccessPointAvailabilityStep(CCEsockTestBase*& aEsockTest) |
|
1524 : CTe_EsockStepBase(aEsockTest) |
|
1525 { |
|
1526 SetTestStepName(KSetAccessPointAvailabilityStep); |
|
1527 } |
|
1528 |
|
1529 TVerdict CSetAccessPointAvailabilityStep::doTestStepPreambleL() |
|
1530 { |
|
1531 SetTestStepResult(EFail); |
|
1532 |
|
1533 if (iEsockTest==NULL) |
|
1534 iEsockTest = new (ELeave) CCEsockTestBase; |
|
1535 |
|
1536 SetTestStepResult(EPass); |
|
1537 return TestStepResult(); |
|
1538 } |
|
1539 |
|
1540 TInt CSetAccessPointAvailabilityStep::ConfigureFromIni() |
|
1541 { |
|
1542 // Read in access point ID (mandatory) |
|
1543 if((GetIntFromConfig(iSection, KAccessPointId, iAccessPointId) != 1)) |
|
1544 { |
|
1545 INFO_PRINTF3(KErrString_MissingConfigFileField, &iSection, &KAccessPointId); |
|
1546 return KErrNotFound; |
|
1547 } |
|
1548 |
|
1549 // Read in the availability attributes, score and status (mandatory) |
|
1550 TBool haveState(EFalse); |
|
1551 TBool haveScore(EFalse); |
|
1552 |
|
1553 if(GetIntFromConfig(iSection, KAccessPointScore, iAvailabilityScore)) |
|
1554 { |
|
1555 haveScore = ETrue; |
|
1556 } |
|
1557 |
|
1558 TPtrC availState; |
|
1559 if(GetStringFromConfig(iSection, KAccessPointState, availState)) |
|
1560 { |
|
1561 haveState = ETrue; |
|
1562 } |
|
1563 |
|
1564 // Check we only have one or the other |
|
1565 if((haveScore && haveState)) |
|
1566 { |
|
1567 INFO_PRINTF1(_L("State and score are mutually exclusive.")); |
|
1568 return KErrArgument; |
|
1569 } |
|
1570 |
|
1571 // If we have a score then make sure it is in valid range |
|
1572 // Also if we have a score then if we also have state it must be available otherwise a contradiction |
|
1573 if(haveScore) |
|
1574 { |
|
1575 if((iAvailabilityScore < ESock::TAvailabilityStatus::EMinAvailabilityScore) |
|
1576 || (iAvailabilityScore > ESock::TAvailabilityStatus::EMaxAvailabilityScore)) |
|
1577 { |
|
1578 INFO_PRINTF3(KErrString_OutOfBounds, &iSection, &KAccessPointScore); |
|
1579 return KErrArgument; |
|
1580 } |
|
1581 } |
|
1582 |
|
1583 // What settings do we have |
|
1584 else if(haveState) |
|
1585 { |
|
1586 if(availState == KAvailable) |
|
1587 { |
|
1588 iAvailabilityScore = ESock::TAvailabilityStatus::EMaxAvailabilityScore; |
|
1589 } |
|
1590 else if(availState == KUnavailable) |
|
1591 { |
|
1592 iAvailabilityScore = ESock::TAvailabilityStatus::EMinAvailabilityScore; |
|
1593 } |
|
1594 else if(availState == KStalled) |
|
1595 { |
|
1596 iAvailabilityScore = ESock::TAvailabilityStatus::EUnknownAvailabilityScore; |
|
1597 } |
|
1598 else |
|
1599 { |
|
1600 INFO_PRINTF1(_L("Avail state not valid (must be 'Available' or 'Unavailable'")); |
|
1601 return KErrArgument; |
|
1602 } |
|
1603 } |
|
1604 else |
|
1605 { |
|
1606 INFO_PRINTF1(_L("Must have either state or score.")); |
|
1607 return KErrArgument; |
|
1608 } |
|
1609 |
|
1610 // All ok if we got this far |
|
1611 return KErrNone; |
|
1612 } |
|
1613 |
|
1614 const TUid KAvailabilityTestingPubSubUid = {0x10272F42}; // TODO_CDG can't we grab this from somewhere else? |
|
1615 |
|
1616 TVerdict CSetAccessPointAvailabilityStep::doSingleTestStep() |
|
1617 { |
|
1618 RProperty a; |
|
1619 |
|
1620 // Fail by default |
|
1621 SetTestStepResult(EFail); |
|
1622 |
|
1623 // Set the availability of the access point as prescribed |
|
1624 TInt error = a.Define(KAvailabilityTestingPubSubUid, iAccessPointId, RProperty::EInt); |
|
1625 if((error == KErrAlreadyExists) || (error == KErrNone)) |
|
1626 { |
|
1627 // Successfully created the property so attach to it for use |
|
1628 error = a.Attach(KAvailabilityTestingPubSubUid, iAccessPointId); |
|
1629 if(error != KErrNone) |
|
1630 { |
|
1631 INFO_PRINTF1(_L("Could not attach to property used for availability simulation")); |
|
1632 SetTestStepError(error); |
|
1633 } |
|
1634 else |
|
1635 { |
|
1636 // Now set the availability as prescribed |
|
1637 a.Set(iAvailabilityScore); |
|
1638 |
|
1639 // We have done what was expected of us so we passed |
|
1640 SetTestStepResult(EPass); |
|
1641 } |
|
1642 } |
|
1643 else |
|
1644 { |
|
1645 INFO_PRINTF1(_L("Problem setting availability property")); |
|
1646 SetTestStepError(error); |
|
1647 } |
|
1648 |
|
1649 return TestStepResult(); |
|
1650 } |
|
1651 |
|
1652 // ppp specific availability simulation |
|
1653 CSetPppAccessPointAvailabilityStep::CSetPppAccessPointAvailabilityStep(CCEsockTestBase*& aEsockTest) |
|
1654 : CTe_EsockStepBase(aEsockTest) |
|
1655 { |
|
1656 SetTestStepName(KSetPppAccessPointAvailabilityStep); |
|
1657 } |
|
1658 |
|
1659 TVerdict CSetPppAccessPointAvailabilityStep::doTestStepPreambleL() |
|
1660 { |
|
1661 SetTestStepResult(EFail); |
|
1662 |
|
1663 if (iEsockTest==NULL) |
|
1664 iEsockTest = new (ELeave) CCEsockTestBase; |
|
1665 |
|
1666 SetTestStepResult(EPass); |
|
1667 return TestStepResult(); |
|
1668 } |
|
1669 |
|
1670 |
|
1671 _LIT(KRegistrationUnknown, "RegistrationUnknown"); |
|
1672 _LIT(KNotRegisteredNoService, "NotRegisteredNoService"); |
|
1673 _LIT(KNotRegisteredEmergencyOnly, "NotRegisteredEmergencyOnly"); |
|
1674 _LIT(KNotRegisteredSearching, "NotRegisteredSearching"); |
|
1675 _LIT(KRegisteredBusy, "RegisteredBusy"); |
|
1676 _LIT(KRegisteredOnHomeNetwork, "RegisteredOnHomeNetwork"); |
|
1677 _LIT(KRegistrationDenied, "RegistrationDenied"); |
|
1678 _LIT(KRegisteredRoaming, "RegisteredRoaming"); |
|
1679 |
|
1680 TInt CSetPppAccessPointAvailabilityStep::ConfigureFromIni() |
|
1681 { |
|
1682 TPtrC netRegState; |
|
1683 if(GetStringFromConfig(iSection, KAccessPointState, netRegState)) |
|
1684 { |
|
1685 // What settings do we have |
|
1686 if (netRegState == KRegistrationUnknown) |
|
1687 { |
|
1688 iRegStatus = RMobilePhone::ERegistrationUnknown; |
|
1689 } |
|
1690 else if (netRegState == KNotRegisteredNoService) |
|
1691 { |
|
1692 iRegStatus = RMobilePhone::ENotRegisteredNoService; |
|
1693 } |
|
1694 else if (netRegState == KNotRegisteredEmergencyOnly) |
|
1695 { |
|
1696 iRegStatus = RMobilePhone::ENotRegisteredEmergencyOnly; |
|
1697 } |
|
1698 else if (netRegState == KNotRegisteredSearching) |
|
1699 { |
|
1700 iRegStatus = RMobilePhone::ENotRegisteredSearching; |
|
1701 } |
|
1702 else if (netRegState == KRegisteredBusy) |
|
1703 { |
|
1704 iRegStatus = RMobilePhone::ERegisteredBusy; |
|
1705 } |
|
1706 else if (netRegState == KRegisteredOnHomeNetwork) |
|
1707 { |
|
1708 iRegStatus = RMobilePhone::ERegisteredOnHomeNetwork; |
|
1709 } |
|
1710 else if (netRegState == KRegistrationDenied) |
|
1711 { |
|
1712 iRegStatus = RMobilePhone::ERegistrationDenied; |
|
1713 } |
|
1714 else if (netRegState == KRegisteredRoaming) |
|
1715 { |
|
1716 iRegStatus = RMobilePhone::ERegisteredRoaming; |
|
1717 } |
|
1718 } |
|
1719 else |
|
1720 { |
|
1721 INFO_PRINTF1(_L("Must have network registration status set.")); |
|
1722 return KErrArgument; |
|
1723 } |
|
1724 |
|
1725 // All ok if we got this far |
|
1726 return KErrNone; |
|
1727 } |
|
1728 |
|
1729 TVerdict CSetPppAccessPointAvailabilityStep::doSingleTestStep() |
|
1730 { |
|
1731 RProperty a; |
|
1732 |
|
1733 // Fail by default |
|
1734 SetTestStepResult(EFail); |
|
1735 |
|
1736 // Set the availability of the access point as prescribed |
|
1737 TInt error = a.Define(KUidPSSimTsyCategory, KPSSimTsyRegStatChange, RProperty::EInt); |
|
1738 if((error != KErrAlreadyExists) || (error != KErrNone)) |
|
1739 { |
|
1740 // Successfully created the property so attach to it for use |
|
1741 error = a.Attach(KUidPSSimTsyCategory, KPSSimTsyRegStatChange); |
|
1742 if(error != KErrNone) |
|
1743 { |
|
1744 INFO_PRINTF1(_L("Could not attach to property used for ppp availability simulation")); |
|
1745 } |
|
1746 else |
|
1747 { |
|
1748 // Now set the availability as prescribed |
|
1749 a.Set(iRegStatus); |
|
1750 |
|
1751 // We have done what was expected of us so we passed |
|
1752 SetTestStepResult(EPass); |
|
1753 } |
|
1754 } |
|
1755 |
|
1756 return TestStepResult(); |
|
1757 } |
|
1758 |
|
1759 // wifi specific availability simulation |
|
1760 // Requires the "MockupWifiHardware" emulation mechanism to be enabled on udeb |
|
1761 CSetWifiAccessPointAvailabilityStep::CSetWifiAccessPointAvailabilityStep(CCEsockTestBase*& aEsockTest) |
|
1762 : CTe_EsockStepBase(aEsockTest) |
|
1763 { |
|
1764 SetTestStepName(KSetWifiAccessPointAvailabilityStep); |
|
1765 } |
|
1766 |
|
1767 TVerdict CSetWifiAccessPointAvailabilityStep::doTestStepPreambleL() |
|
1768 { |
|
1769 SetTestStepResult(EFail); |
|
1770 |
|
1771 if (iEsockTest==NULL) |
|
1772 iEsockTest = new (ELeave) CCEsockTestBase; |
|
1773 |
|
1774 SetTestStepResult(EPass); |
|
1775 return TestStepResult(); |
|
1776 } |
|
1777 |
|
1778 _LIT(KFakeWifiScanFile,"c:\\fake_wifi_scan.txt"); |
|
1779 _LIT(KTempFakeWifiScanFile,"c:\\temp_fake_wifi_scan.txt"); |
|
1780 |
|
1781 _LIT8(KNewLine, "\n"); |
|
1782 _LIT8(KLineFeed, "\r\n"); |
|
1783 |
|
1784 const TInt TotalNumberOfWifiFields = 10; |
|
1785 _LIT(KAPAvailable, "APAvailable"); |
|
1786 |
|
1787 // These mimic the entries in the "fake_wifi_scan.txt" file |
|
1788 _LIT(KBssid, "Bssid"); |
|
1789 _LIT(KSsid, "Ssid"); |
|
1790 _LIT(KSupportedRates, "SupportedRates"); |
|
1791 _LIT(KNetworkType, "NetworkType"); |
|
1792 _LIT(KAuthenticated, "Authenticated"); |
|
1793 _LIT(KEncrypt, "Encrypt"); |
|
1794 _LIT(KAPEncryptionType, "APEncryptionType"); |
|
1795 _LIT(KAssociated, "Associated"); |
|
1796 _LIT(KChannel, "Channel"); |
|
1797 _LIT(KRssi, "Rssi"); |
|
1798 |
|
1799 TInt CSetWifiAccessPointAvailabilityStep::ConfigureFromIni() |
|
1800 { |
|
1801 if(GetIntFromConfig(iSection, KAPAvailable, iAPAvailable) |
|
1802 && GetStringFromConfig(iSection, KSsid, iSsid) |
|
1803 && GetStringFromConfig(iSection, KBssid, iBssid) |
|
1804 && GetStringFromConfig(iSection, KSupportedRates, iSupportedRates) |
|
1805 && GetStringFromConfig(iSection, KNetworkType, iNetworkType) |
|
1806 && GetStringFromConfig(iSection, KAuthenticated, iAuthenticated) |
|
1807 && GetStringFromConfig(iSection, KEncrypt, iEncrypt) |
|
1808 && GetStringFromConfig(iSection, KAPEncryptionType, iAPEncryptionType) |
|
1809 && GetStringFromConfig(iSection, KAssociated, iAssociated) |
|
1810 && GetStringFromConfig(iSection, KChannel, iChannel) |
|
1811 && GetStringFromConfig(iSection, KRssi, iRssi)) |
|
1812 { |
|
1813 return KErrNone; |
|
1814 } |
|
1815 else |
|
1816 { |
|
1817 INFO_PRINTF1(_L("Incorrect Wifi Parameters")); |
|
1818 return KErrArgument; |
|
1819 } |
|
1820 } |
|
1821 |
|
1822 TVerdict CSetWifiAccessPointAvailabilityStep::doSingleTestStep() |
|
1823 { |
|
1824 // Pass by default |
|
1825 SetTestStepResult(EPass); |
|
1826 |
|
1827 // Connect to the FileServer |
|
1828 RFs rFS; |
|
1829 if (rFS.Connect() != KErrNone) |
|
1830 { |
|
1831 INFO_PRINTF1(_L("Couldnt connect to FileServer")); |
|
1832 SetTestStepResult(EFail); |
|
1833 return TestStepResult(); // Fail now |
|
1834 } |
|
1835 //CleanupClosePushL(rFS); // Non leaving test function |
|
1836 |
|
1837 // If Available == 2 then we delete the file if it exists |
|
1838 // In future we could make this "clear file" function more logical (magic number 2 is not clear) |
|
1839 if (iAPAvailable == 2) |
|
1840 { |
|
1841 rFS.Delete(KFakeWifiScanFile); |
|
1842 //CleanupStack::Pop(&rFS); |
|
1843 rFS.Close(); // close the file system |
|
1844 return TestStepResult(); // Pass now |
|
1845 } |
|
1846 |
|
1847 // Create the "c:\fake_wifi_scan.txt" for Mock Wifi Testing removing the old version if it exists |
|
1848 RFile rFile; |
|
1849 if (rFile.Open(rFS, KFakeWifiScanFile, EFileStreamText | EFileRead | EFileShareReadersOrWriters) != KErrNone) |
|
1850 { |
|
1851 if (rFile.Create(rFS, KFakeWifiScanFile, EFileStreamText | EFileRead | EFileShareReadersOrWriters) != KErrNone) |
|
1852 { |
|
1853 // File doesnt exist and couldnt be created |
|
1854 INFO_PRINTF1(_L("fake_wifi_scan.txt file couldnt be opened or created")); |
|
1855 SetTestStepResult(EFail); |
|
1856 //CleanupStack::Pop(&rFS); |
|
1857 rFS.Close(); // close the file system |
|
1858 return TestStepResult(); // Fail now |
|
1859 } |
|
1860 } |
|
1861 //CleanupClosePushL(rFile);// Non leaving test function |
|
1862 |
|
1863 // Create a new temporary "c:\temp_fake_wifi_scan.txt" for Mock Wifi Testing removing the old version if it exists |
|
1864 RFile rNewFile; |
|
1865 if (rNewFile.Replace(rFS, KTempFakeWifiScanFile, EFileStreamText | EFileWrite | EFileShareReadersOrWriters) != KErrNone) |
|
1866 { |
|
1867 // File doesnt exist and couldnt be created |
|
1868 INFO_PRINTF1(_L("temp_fake_wifi_scan.txt couldnt be created")); |
|
1869 SetTestStepResult(EFail); |
|
1870 //CleanupStack::Pop(&rFile); |
|
1871 rFile.Close(); |
|
1872 //CleanupStack::Pop(&rFS); |
|
1873 rFS.Close(); // close the file system |
|
1874 return TestStepResult(); // Fail now |
|
1875 } |
|
1876 //CleanupClosePushL(rNewFile);// Non leaving test function |
|
1877 |
|
1878 // Loop through each line in the old file |
|
1879 TInt WifiFieldNumber = TotalNumberOfWifiFields; |
|
1880 TBool foundEntry = EFalse; |
|
1881 TInt err = KErrNone; |
|
1882 TBuf8<512> line; |
|
1883 while (!err) |
|
1884 { |
|
1885 // Read one complete line from the old file |
|
1886 line.SetLength(0); |
|
1887 for(;;) |
|
1888 { |
|
1889 TBuf8<1> c; |
|
1890 err = rFile.Read(c); |
|
1891 if (err && err != KErrEof) |
|
1892 { |
|
1893 INFO_PRINTF1(_L("Error reading from fake_wifi_scan.txt")); |
|
1894 SetTestStepResult(EFail); |
|
1895 break; |
|
1896 } |
|
1897 if (c.Length() == 0) |
|
1898 { |
|
1899 err = KErrEof; |
|
1900 break; |
|
1901 } |
|
1902 else |
|
1903 { |
|
1904 if (c[0] == '\n') // break out if it is CR |
|
1905 break; |
|
1906 else |
|
1907 line.Append(c[0]); |
|
1908 } |
|
1909 } |
|
1910 |
|
1911 // Now we have read a complete line from the old file |
|
1912 if (err == KErrNone) |
|
1913 { |
|
1914 // Check if this line matches the SSID of the query |
|
1915 TBuf8<512> buf8Ssid; |
|
1916 buf8Ssid.Copy(iSsid); |
|
1917 if (line.Find(buf8Ssid) != KErrNotFound) |
|
1918 { |
|
1919 // We have found the specified SSID |
|
1920 foundEntry = ETrue; |
|
1921 } |
|
1922 |
|
1923 // If we are updating OR removing the entry we dont add it (yet) to the output |
|
1924 if (foundEntry && WifiFieldNumber) |
|
1925 { |
|
1926 // Decrement WifiFieldNumber |
|
1927 WifiFieldNumber--; |
|
1928 } |
|
1929 else |
|
1930 { |
|
1931 TInt pos = 0; |
|
1932 rNewFile.Seek(ESeekEnd, pos); |
|
1933 if (rNewFile.Write(line) != KErrNone) SetTestStepResult(EFail); |
|
1934 if (rNewFile.Write(KNewLine) != KErrNone) SetTestStepResult(EFail); |
|
1935 } |
|
1936 } |
|
1937 } |
|
1938 |
|
1939 // If this AP is available, (re)add it to the list |
|
1940 if (iAPAvailable == 1) |
|
1941 { |
|
1942 TBuf8<512> buf8; |
|
1943 |
|
1944 buf8.Copy(iSsid); |
|
1945 if (rNewFile.Write(buf8) != KErrNone) SetTestStepResult(EFail); |
|
1946 if (rNewFile.Write(KLineFeed) != KErrNone) SetTestStepResult(EFail); |
|
1947 |
|
1948 buf8.Copy(iBssid); |
|
1949 if (rNewFile.Write(buf8) != KErrNone) SetTestStepResult(EFail); |
|
1950 if (rNewFile.Write(KLineFeed) != KErrNone) SetTestStepResult(EFail); |
|
1951 |
|
1952 buf8.Copy(iSupportedRates); |
|
1953 if (rNewFile.Write(buf8) != KErrNone) SetTestStepResult(EFail); |
|
1954 if (rNewFile.Write(KLineFeed) != KErrNone) SetTestStepResult(EFail); |
|
1955 |
|
1956 buf8.Copy(iNetworkType); |
|
1957 if (rNewFile.Write(buf8) != KErrNone) SetTestStepResult(EFail); |
|
1958 if (rNewFile.Write(KLineFeed) != KErrNone) SetTestStepResult(EFail); |
|
1959 |
|
1960 buf8.Copy(iAuthenticated); |
|
1961 if (rNewFile.Write(buf8) != KErrNone) SetTestStepResult(EFail); |
|
1962 if (rNewFile.Write(KLineFeed) != KErrNone) SetTestStepResult(EFail); |
|
1963 |
|
1964 buf8.Copy(iEncrypt); |
|
1965 if (rNewFile.Write(buf8) != KErrNone) SetTestStepResult(EFail); |
|
1966 if (rNewFile.Write(KLineFeed) != KErrNone) SetTestStepResult(EFail); |
|
1967 |
|
1968 buf8.Copy(iAPEncryptionType); |
|
1969 if (rNewFile.Write(buf8) != KErrNone) SetTestStepResult(EFail); |
|
1970 if (rNewFile.Write(KLineFeed) != KErrNone) SetTestStepResult(EFail); |
|
1971 |
|
1972 buf8.Copy(iAssociated); |
|
1973 if (rNewFile.Write(buf8) != KErrNone) SetTestStepResult(EFail); |
|
1974 if (rNewFile.Write(KLineFeed) != KErrNone) SetTestStepResult(EFail); |
|
1975 |
|
1976 buf8.Copy(iChannel); |
|
1977 if (rNewFile.Write(buf8) != KErrNone) SetTestStepResult(EFail); |
|
1978 if (rNewFile.Write(KLineFeed) != KErrNone) SetTestStepResult(EFail); |
|
1979 |
|
1980 buf8.Copy(iRssi); |
|
1981 if (rNewFile.Write(buf8) != KErrNone) SetTestStepResult(EFail); |
|
1982 if (rNewFile.Write(KLineFeed) != KErrNone) SetTestStepResult(EFail); |
|
1983 } |
|
1984 |
|
1985 //CleanupStack::Pop(&rNewFile); |
|
1986 rNewFile.Close(); |
|
1987 |
|
1988 //CleanupStack::Pop(&rFile); |
|
1989 rFile.Close(); |
|
1990 |
|
1991 // Now we have created and updated temporary file, replace |
|
1992 if (rFS.Replace(KTempFakeWifiScanFile, KFakeWifiScanFile) != KErrNone) |
|
1993 { |
|
1994 // File doesnt exist and couldnt be created |
|
1995 INFO_PRINTF1(_L("fake_wifi_scan.txt couldnt be replaced")); |
|
1996 SetTestStepResult(EFail); |
|
1997 } |
|
1998 |
|
1999 //CleanupStack::Pop(&rFS); |
|
2000 rFS.Close(); // close the file system |
|
2001 |
|
2002 return TestStepResult(); |
|
2003 } |
|
2004 |
|
2005 // BearerAvailabilityNotificationStep |
|
2006 //----------------------------------- |
|
2007 _LIT(KExpectedValue,"ExpectedValue"); |
|
2008 _LIT(KExpectedValue1,"ExpectedValue1"); |
|
2009 _LIT(KTypeOfNotification,"TypeOfNotification"); |
|
2010 _LIT(KAccessBearer,"AccessBearer"); |
|
2011 _LIT(KServiceMode,"ServiceMode"); |
|
2012 _LIT(KNumOfTmgis,"NumOfTMGIs"); |
|
2013 _LIT(KMCC,"MCCID"); |
|
2014 _LIT(KMNC,"MNCID"); |
|
2015 _LIT(KServiceId,"ServiceId"); |
|
2016 _LIT(KAllTMGIvalid,"AllTMGIvalid"); |
|
2017 _LIT(KAllTMGIInvalid,"AllTMGIInvalid"); |
|
2018 _LIT(KRemoveAllService,"RemoveAllServices"); |
|
2019 |
|
2020 CRequestMBMSNtfnStep::CRequestMBMSNtfnStep(CCEsockTestBase*& aEsockTest) |
|
2021 : CRConnectionServQueryTestStepBase(aEsockTest) |
|
2022 { |
|
2023 SetTestStepName(KRequestMBMSNtfnStep); |
|
2024 } |
|
2025 |
|
2026 TInt CRequestMBMSNtfnStep::ConfigureFromIni() |
|
2027 { |
|
2028 iConnectionServName.Set(KNullDesC); |
|
2029 |
|
2030 // Get the name of the connection server instance we are to use |
|
2031 if((GetStringFromConfig(iSection, KConnectionServName, iConnectionServName) != 1) |
|
2032 || (iConnectionServName.Length() == 0)) |
|
2033 { |
|
2034 INFO_PRINTF3(KErrString_MissingConfigFileField, &iSection, &KConnectionServName); |
|
2035 return KErrNotFound; |
|
2036 } |
|
2037 |
|
2038 // Get the name applied to the notification so we can look it up later when referring to the results |
|
2039 if((GetStringFromConfig(iSection, KNotificationName, iNotifName) != 1) |
|
2040 || (iNotifName.Length() == 0)) |
|
2041 { |
|
2042 INFO_PRINTF3(KErrString_MissingConfigFileField, &iSection, &KNotificationName); |
|
2043 return KErrNotFound; |
|
2044 } |
|
2045 |
|
2046 //Get the type of notification request |
|
2047 GetIntFromConfig(iSection,KTypeOfNotification,reinterpret_cast<TInt&>(iNotificationType)); |
|
2048 |
|
2049 TInt error; |
|
2050 TRAP(error, iQueryBundle = CConnectionServParameterBundle::NewL()); |
|
2051 if(error != KErrNone) |
|
2052 { |
|
2053 return error; |
|
2054 } |
|
2055 |
|
2056 if(iNotificationType == EMbmsBearerAvailNtfn) |
|
2057 { |
|
2058 TRAP(error, BuildBearerAvailQueryL(*iQueryBundle);) |
|
2059 if(error != KErrNone) |
|
2060 { |
|
2061 return KErrNotFound; |
|
2062 } |
|
2063 } |
|
2064 |
|
2065 else if (iNotificationType == EMbmsServiceAvailNtfn) |
|
2066 { |
|
2067 TRAP(error, BuildServiceAvailQueryL(*iQueryBundle);) |
|
2068 if(error != KErrNone) |
|
2069 { |
|
2070 return KErrNotFound; |
|
2071 } |
|
2072 } |
|
2073 |
|
2074 else if (iNotificationType == EMbmsRemoveServiceNtfn) |
|
2075 { |
|
2076 |
|
2077 GetBoolFromConfig(iSection, KRemoveAllService, iRemoveAll); |
|
2078 |
|
2079 if(!iRemoveAll) |
|
2080 { |
|
2081 TRAP(error, BuildRemoveServiceQueryL(*iQueryBundle,ERemoveService);) |
|
2082 if(error != KErrNone) |
|
2083 { |
|
2084 return KErrNotFound; |
|
2085 } |
|
2086 } |
|
2087 else |
|
2088 { |
|
2089 TRAP(error, BuildRemoveServiceQueryL(*iQueryBundle,ERemoveAllServices);) |
|
2090 if(error != KErrNone) |
|
2091 { |
|
2092 return KErrNotFound; |
|
2093 } |
|
2094 } |
|
2095 |
|
2096 } |
|
2097 else if (iNotificationType == EMbmsActiveListNtfn) |
|
2098 { |
|
2099 TRAP(error, BuildActiveListQueryL(*iQueryBundle);) |
|
2100 if(error != KErrNone) |
|
2101 { |
|
2102 return KErrNotFound; |
|
2103 } |
|
2104 } |
|
2105 |
|
2106 else if(iNotificationType == EMbmsMonitorListNtfn) |
|
2107 { |
|
2108 TRAP(error, BuildMonitorListQueryL(*iQueryBundle);) |
|
2109 if(error != KErrNone) |
|
2110 { |
|
2111 return KErrNotFound; |
|
2112 } |
|
2113 } |
|
2114 return KErrNone; |
|
2115 } |
|
2116 |
|
2117 TVerdict CRequestMBMSNtfnStep::doSingleTestStep() |
|
2118 { |
|
2119 // Pass by default |
|
2120 SetTestStepResult(EPass); |
|
2121 |
|
2122 // Fetch the connection server on which to post the notification. |
|
2123 RConnectionServ* connServ = iEsockTest->iConnectionServs.Find(iConnectionServName); |
|
2124 if(connServ == NULL) |
|
2125 { |
|
2126 INFO_PRINTF2(KErrString_NamedObjectNotFound, &iConnectionServName); |
|
2127 } |
|
2128 else |
|
2129 { |
|
2130 // Wrap up the request for the thread we will palm it off to |
|
2131 CConnServNotificationWatcher* notifMgr = CConnServNotificationWatcher::NewLC |
|
2132 (connServ, iQueryBundle); |
|
2133 CleanupStack::Pop(notifMgr); |
|
2134 |
|
2135 // Give the notifing thread a handle to us |
|
2136 notifMgr->iCommandThread.Open(RThread().Id(), EOwnerProcess); |
|
2137 |
|
2138 // Start a thread to manage the notifications as these occur with use of a scheduler |
|
2139 TInt error = notifMgr->iNotifThread.Create( |
|
2140 iNotifName, |
|
2141 CConnServNotificationWatcher::EntryPoint, |
|
2142 KNotifThreadStackSize, |
|
2143 NULL, |
|
2144 static_cast<TAny*>(notifMgr)); |
|
2145 |
|
2146 // If all ok then kick off the notification thread |
|
2147 if(error != KErrNone) |
|
2148 { |
|
2149 INFO_PRINTF2(_L("Could not start separate thread for capturing notifications. error:%d"), error); |
|
2150 } |
|
2151 else |
|
2152 { |
|
2153 // Get the thread started |
|
2154 notifMgr->iNotifThread.Resume(); |
|
2155 |
|
2156 // Keep a reference to our notif manager for follow up test step |
|
2157 TInt addError = iEsockTest->iNotifWatchers.Add(notifMgr, iNotifName); |
|
2158 __ASSERT_DEBUG(addError == KErrNone, User::Panic(KSpecAssert_ESockTestCnctnSr, 5)); |
|
2159 } |
|
2160 } |
|
2161 return TestStepResult(); |
|
2162 } |
|
2163 |
|
2164 TInt CRequestMBMSNtfnStep::BuildBearerAvailQueryL(ConnectionServ::CConnectionServParameterBundle& aQueryBundle) |
|
2165 { |
|
2166 // Specify which type of parameters we want back |
|
2167 ConnectionServ::CConnectionServParameterSetContainer* parSetCtr = ConnectionServ::CConnectionServParameterSetContainer::NewL(aQueryBundle); |
|
2168 |
|
2169 XMBMSServiceQuerySet* mbmsQuery = XMBMSServiceQuerySet::NewL(*parSetCtr); |
|
2170 mbmsQuery->SetQueryType(XMBMSServiceQuerySet::EBearerAvailability); |
|
2171 |
|
2172 return KErrNone; |
|
2173 } |
|
2174 |
|
2175 TInt CRequestMBMSNtfnStep::BuildServiceAvailQueryL(ConnectionServ::CConnectionServParameterBundle& aQueryBundle) |
|
2176 { |
|
2177 if(GetIntFromConfig(iSection, KNumOfTmgis, reinterpret_cast<TInt&> (iNumTmgis)) != 1) |
|
2178 { |
|
2179 INFO_PRINTF3(KErrString_MissingConfigFileField, &iSection, &KNumOfTmgis); |
|
2180 } |
|
2181 |
|
2182 if(GetIntFromConfig(iSection, KAccessBearer, reinterpret_cast<TInt&> (iAccessBearer)) != 1) |
|
2183 { |
|
2184 INFO_PRINTF3(KErrString_MissingConfigFileField, &iSection, &KAccessBearer); |
|
2185 } |
|
2186 |
|
2187 if(GetIntFromConfig(iSection, KServiceMode, reinterpret_cast<TInt&> (iServiceMode)) != 1) |
|
2188 { |
|
2189 INFO_PRINTF3(KErrString_MissingConfigFileField, &iSection, &KServiceMode); |
|
2190 } |
|
2191 |
|
2192 for(int i=0;i<iNumTmgis;i++) |
|
2193 { |
|
2194 ConnectionServ::CConnectionServParameterSetContainer* parSetCtr = ConnectionServ::CConnectionServParameterSetContainer::NewL(aQueryBundle); |
|
2195 |
|
2196 XMBMSServiceQuerySet* mbmsQuery = XMBMSServiceQuerySet::NewL(*parSetCtr); |
|
2197 mbmsQuery->SetQueryType(XMBMSServiceQuerySet::EAddService); |
|
2198 |
|
2199 ConnectionServ::TMBMSChannelInfoV1* mbmsChannelInfo; |
|
2200 XMBMSServiceParameterSet* mbmsParameters = XMBMSServiceParameterSet::NewL(*parSetCtr); |
|
2201 mbmsChannelInfo = mbmsParameters->GetChannelInfo(); |
|
2202 TTmgi tmgi; |
|
2203 |
|
2204 TBuf<32> buf(KMCC); |
|
2205 buf.AppendNum(i+1); |
|
2206 |
|
2207 if(GetIntFromConfig(iSection, buf, reinterpret_cast<TInt&> (iMCC)) != 1) |
|
2208 { |
|
2209 INFO_PRINTF3(KErrString_MissingConfigFileField, &iSection, &buf); |
|
2210 } |
|
2211 |
|
2212 buf = KMNC; |
|
2213 buf.AppendNum(i+1); |
|
2214 |
|
2215 if(GetIntFromConfig(iSection, buf, reinterpret_cast<TInt&> (iMNC)) != 1) |
|
2216 { |
|
2217 INFO_PRINTF3(KErrString_MissingConfigFileField, &iSection, &buf); |
|
2218 } |
|
2219 |
|
2220 buf = KServiceId; |
|
2221 buf.AppendNum(i+1); |
|
2222 |
|
2223 if(GetIntFromConfig(iSection, buf, reinterpret_cast<TInt&> (iServiceId)) != 1) |
|
2224 { |
|
2225 INFO_PRINTF3(KErrString_MissingConfigFileField, &iSection, &buf); |
|
2226 } |
|
2227 |
|
2228 //constructing the TMGI |
|
2229 tmgi.SetMCC(iMCC); //1234 |
|
2230 tmgi.SetMNC(iMNC); |
|
2231 tmgi.SetServiceId(iServiceId); |
|
2232 |
|
2233 TMbmsScope mbmsScope; |
|
2234 mbmsScope = reinterpret_cast<TMbmsScope&>(iAccessBearer); |
|
2235 |
|
2236 //constructing the service Information. |
|
2237 mbmsChannelInfo->SetTmgi(tmgi); |
|
2238 mbmsChannelInfo->SetScope(mbmsScope); |
|
2239 |
|
2240 mbmsParameters->SetServiceMode(reinterpret_cast<TMbmsServiceMode&>(iServiceMode)); |
|
2241 } |
|
2242 |
|
2243 return KErrNone; |
|
2244 |
|
2245 } |
|
2246 |
|
2247 TInt CRequestMBMSNtfnStep::BuildRemoveServiceQueryL(ConnectionServ::CConnectionServParameterBundle& aQueryBundle,TAction aAction) |
|
2248 { |
|
2249 if (aAction == ERemoveAllServices) |
|
2250 { |
|
2251 ConnectionServ::CConnectionServParameterSetContainer* parSetCtr = ConnectionServ::CConnectionServParameterSetContainer::NewL(aQueryBundle); |
|
2252 XMBMSServiceQuerySet* mbmsQuery = XMBMSServiceQuerySet::NewL(*parSetCtr); |
|
2253 mbmsQuery->SetQueryType(XMBMSServiceQuerySet::ERemoveAllService); |
|
2254 return KErrNone; |
|
2255 } |
|
2256 else |
|
2257 { |
|
2258 // AccessBearer and ServiceMode are applicable only for remove specific MBMS service |
|
2259 // Validity of TMGIs are NOT needed when we are removing all the services. |
|
2260 |
|
2261 GetBoolFromConfig(iSection, KAllTMGIvalid, iAllTmgiValid); |
|
2262 GetBoolFromConfig(iSection, KAllTMGIInvalid, iAllTmgiInvalid); |
|
2263 |
|
2264 if(GetIntFromConfig(iSection, KAccessBearer, reinterpret_cast<TInt&> (iAccessBearer)) != 1) |
|
2265 { |
|
2266 INFO_PRINTF3(KErrString_MissingConfigFileField, &iSection, &KAccessBearer); |
|
2267 } |
|
2268 |
|
2269 if(GetIntFromConfig(iSection, KServiceMode, reinterpret_cast<TInt&> (iServiceMode)) != 1) |
|
2270 { |
|
2271 INFO_PRINTF3(KErrString_MissingConfigFileField, &iSection, &KServiceMode); |
|
2272 } |
|
2273 |
|
2274 if(GetIntFromConfig(iSection, KNumOfTmgis, reinterpret_cast<TInt&> (iNumTmgis)) != 1) |
|
2275 { |
|
2276 INFO_PRINTF3(KErrString_MissingConfigFileField, &iSection, &KNumOfTmgis); |
|
2277 } |
|
2278 |
|
2279 iTmgiList = new (ELeave) CArrayFixFlat<TTmgi>(iNumTmgis); |
|
2280 |
|
2281 for(int i=0;i<iNumTmgis;i++) |
|
2282 { |
|
2283 |
|
2284 ConnectionServ::CConnectionServParameterSetContainer* parSetCtr = ConnectionServ::CConnectionServParameterSetContainer::NewL(aQueryBundle); |
|
2285 XMBMSServiceQuerySet* mbmsQuery = XMBMSServiceQuerySet::NewL(*parSetCtr); |
|
2286 |
|
2287 if(aAction == ERemoveService) |
|
2288 { |
|
2289 mbmsQuery->SetQueryType(XMBMSServiceQuerySet::ERemoveService); |
|
2290 } |
|
2291 else // aAction == EAddService |
|
2292 { |
|
2293 mbmsQuery->SetQueryType(XMBMSServiceQuerySet::EAddService); |
|
2294 } |
|
2295 |
|
2296 ConnectionServ::TMBMSChannelInfoV1* mbmsChannelInfo; |
|
2297 |
|
2298 XMBMSServiceParameterSet* mbmsParameters = XMBMSServiceParameterSet::NewL(*parSetCtr); |
|
2299 mbmsChannelInfo = mbmsParameters->GetChannelInfo(); |
|
2300 |
|
2301 TTmgi tmgi; |
|
2302 TBuf<32> buf(KMCC); |
|
2303 buf.AppendNum(i+1); |
|
2304 |
|
2305 if(GetIntFromConfig(iSection, buf, reinterpret_cast<TInt&> (iMCC)) != 1) |
|
2306 { |
|
2307 INFO_PRINTF3(KErrString_MissingConfigFileField, &iSection, &buf); |
|
2308 } |
|
2309 |
|
2310 buf = KMNC; |
|
2311 buf.AppendNum(i+1); |
|
2312 |
|
2313 if(GetIntFromConfig(iSection, buf, reinterpret_cast<TInt&> (iMNC)) != 1) |
|
2314 { |
|
2315 INFO_PRINTF3(KErrString_MissingConfigFileField, &iSection, &buf); |
|
2316 } |
|
2317 |
|
2318 buf = KServiceId; |
|
2319 buf.AppendNum(i+1); |
|
2320 |
|
2321 if(GetIntFromConfig(iSection, buf, reinterpret_cast<TInt&> (iServiceId)) != 1) |
|
2322 { |
|
2323 INFO_PRINTF3(KErrString_MissingConfigFileField, &iSection, &buf); |
|
2324 } |
|
2325 |
|
2326 //constructing the TMGI |
|
2327 tmgi.SetMCC(iMCC); |
|
2328 tmgi.SetMNC(iMNC); |
|
2329 tmgi.SetServiceId(iServiceId); |
|
2330 |
|
2331 TMbmsScope mbmsScope; |
|
2332 mbmsScope = reinterpret_cast<TMbmsScope&>(iAccessBearer); |
|
2333 |
|
2334 //constructing the service Information. |
|
2335 mbmsChannelInfo->SetTmgi(tmgi); |
|
2336 mbmsChannelInfo->SetScope(mbmsScope); |
|
2337 |
|
2338 iTmgiList->AppendL(tmgi); |
|
2339 mbmsParameters->SetServiceMode(reinterpret_cast<TMbmsServiceMode&>(iServiceMode)); |
|
2340 |
|
2341 } |
|
2342 } |
|
2343 |
|
2344 return KErrNone; |
|
2345 } |
|
2346 |
|
2347 TInt CRequestMBMSNtfnStep::BuildActiveListQueryL(ConnectionServ::CConnectionServParameterBundle& aQueryBundle) |
|
2348 { |
|
2349 // Specify which type of parameters we want back |
|
2350 ConnectionServ::CConnectionServParameterSetContainer* parSetCtr = ConnectionServ::CConnectionServParameterSetContainer::NewL(aQueryBundle); |
|
2351 |
|
2352 XMBMSServiceQuerySet* mbmsQuery = XMBMSServiceQuerySet::NewL(*parSetCtr); |
|
2353 mbmsQuery->SetQueryType(XMBMSServiceQuerySet::ECountActiveServiceList); |
|
2354 |
|
2355 return KErrNone; |
|
2356 } |
|
2357 |
|
2358 TInt CRequestMBMSNtfnStep::BuildMonitorListQueryL(ConnectionServ::CConnectionServParameterBundle& aQueryBundle) |
|
2359 { |
|
2360 // Specify which type of parameters we want back |
|
2361 ConnectionServ::CConnectionServParameterSetContainer* parSetCtr = ConnectionServ::CConnectionServParameterSetContainer::NewL(aQueryBundle); |
|
2362 |
|
2363 XMBMSServiceQuerySet* mbmsQuery = XMBMSServiceQuerySet::NewL(*parSetCtr); |
|
2364 mbmsQuery->SetQueryType(XMBMSServiceQuerySet::ECountMonitorList); |
|
2365 |
|
2366 return KErrNone; |
|
2367 } |
|
2368 |
|
2369 |
|
2370 CRequestMBMSNtfnStep::~CRequestMBMSNtfnStep() |
|
2371 {} |
|
2372 |
|
2373 CReceiveMBMSNtfnStep::CReceiveMBMSNtfnStep(CCEsockTestBase*& aEsockTest) |
|
2374 : CRConnectionServQueryTestStepBase(aEsockTest) |
|
2375 { |
|
2376 SetTestStepName(KReceiveMBMSNtfnStep); |
|
2377 } |
|
2378 |
|
2379 TInt CReceiveMBMSNtfnStep::ConfigureFromIni() |
|
2380 { |
|
2381 iConnectionServName.Set(KNullDesC); |
|
2382 |
|
2383 // Get the name of the connection server instance we are to use |
|
2384 if((GetStringFromConfig(iSection, KConnectionServName, iConnectionServName) != 1) |
|
2385 || (iConnectionServName.Length() == 0)) |
|
2386 { |
|
2387 INFO_PRINTF3(KErrString_MissingConfigFileField, &iSection, &KConnectionServName); |
|
2388 return KErrNotFound; |
|
2389 } |
|
2390 |
|
2391 // Get the name applied to the notification so we can look it up later when referring to the results |
|
2392 if((GetStringFromConfig(iSection, KNotificationName, iNotifName) != 1) |
|
2393 || (iNotifName.Length() == 0)) |
|
2394 { |
|
2395 INFO_PRINTF3(KErrString_MissingConfigFileField, &iSection, &KNotificationName); |
|
2396 return KErrNotFound; |
|
2397 } |
|
2398 |
|
2399 // Get the delay period before expecting a notification |
|
2400 GetIntFromConfig(iSection, KWaitPeriod, iInitialDelayInSeconds); |
|
2401 |
|
2402 //Get the expected value from the configuration file |
|
2403 GetIntFromConfig(iSection,KExpectedValue,iExpectedValue); |
|
2404 |
|
2405 //Get the expected value from the configuration file |
|
2406 GetIntFromConfig(iSection,KExpectedValue1,iExpectedValue1); |
|
2407 |
|
2408 //Get the type of notification request |
|
2409 GetIntFromConfig(iSection,KTypeOfNotification,reinterpret_cast<TInt&>(iNotificationType)); |
|
2410 |
|
2411 if(iNotificationType == EMbmsRemoveServiceNtfn) |
|
2412 { |
|
2413 GetBoolFromConfig(iSection, KRemoveAllService, iRemoveAll); |
|
2414 if(!iRemoveAll) |
|
2415 { |
|
2416 // AccessBearer and ServiceMode are applicable only for remove specific MBMS service |
|
2417 // Validity of TMGIs are NOT needed when we are removing all the services. |
|
2418 |
|
2419 GetBoolFromConfig(iSection, KAllTMGIvalid, iAllTmgiValid); |
|
2420 GetBoolFromConfig(iSection, KAllTMGIInvalid, iAllTmgiInvalid); |
|
2421 |
|
2422 |
|
2423 if(GetIntFromConfig(iSection, KNumOfTmgis, reinterpret_cast<TInt&> (iNumTmgis)) != 1) |
|
2424 { |
|
2425 INFO_PRINTF3(KErrString_MissingConfigFileField, &iSection, &KNumOfTmgis); |
|
2426 return KErrNotFound; |
|
2427 } |
|
2428 |
|
2429 iTmgiList = new (ELeave) CArrayFixFlat<TTmgi>(iNumTmgis); |
|
2430 |
|
2431 for(int i=0;i<iNumTmgis;i++) |
|
2432 { |
|
2433 |
|
2434 ConnectionServ::TMBMSChannelInfoV1 mbmsChannelInfo; |
|
2435 TTmgi tmgi; |
|
2436 |
|
2437 TBuf<32> buf(KMCC); |
|
2438 buf.AppendNum(i+1); |
|
2439 |
|
2440 if(GetIntFromConfig(iSection, buf, reinterpret_cast<TInt&> (iMCC)) != 1) |
|
2441 { |
|
2442 INFO_PRINTF3(KErrString_MissingConfigFileField, &iSection, &buf); |
|
2443 } |
|
2444 |
|
2445 buf = KMNC; |
|
2446 buf.AppendNum(i+1); |
|
2447 |
|
2448 if(GetIntFromConfig(iSection, buf, reinterpret_cast<TInt&> (iMNC)) != 1) |
|
2449 { |
|
2450 INFO_PRINTF3(KErrString_MissingConfigFileField, &iSection, &buf); |
|
2451 } |
|
2452 |
|
2453 buf = KServiceId; |
|
2454 buf.AppendNum(i+1); |
|
2455 |
|
2456 if(GetIntFromConfig(iSection, buf, reinterpret_cast<TInt&> (iServiceId)) != 1) |
|
2457 { |
|
2458 INFO_PRINTF3(KErrString_MissingConfigFileField, &iSection, &buf); |
|
2459 } |
|
2460 |
|
2461 //constructing the TMGI |
|
2462 tmgi.SetMCC(iMCC); |
|
2463 tmgi.SetMNC(iMNC); |
|
2464 tmgi.SetServiceId(iServiceId); |
|
2465 |
|
2466 iTmgiList->AppendL(tmgi); |
|
2467 } |
|
2468 } |
|
2469 } |
|
2470 |
|
2471 return KErrNone; |
|
2472 } |
|
2473 |
|
2474 TVerdict CReceiveMBMSNtfnStep::doSingleTestStep() |
|
2475 { |
|
2476 // Fail by default |
|
2477 SetTestStepResult(EFail); |
|
2478 |
|
2479 // Fetch the connection server on which to post the notification. |
|
2480 RConnectionServ* connServ = iEsockTest->iConnectionServs.Find(iConnectionServName); |
|
2481 if(connServ == NULL) |
|
2482 { |
|
2483 INFO_PRINTF2(KErrString_NamedObjectNotFound, &iConnectionServName); |
|
2484 } |
|
2485 else |
|
2486 { |
|
2487 // Keep a reference to our notif manager for follow up test step |
|
2488 CConnServNotificationWatcher* notifMgr = iEsockTest->iNotifWatchers.Find(iNotifName); |
|
2489 if(!notifMgr) |
|
2490 { |
|
2491 INFO_PRINTF3(KErrString_NamedObjectNotFound, &iSection, &iNotifName); |
|
2492 } |
|
2493 else |
|
2494 { |
|
2495 |
|
2496 User::After(iInitialDelayInSeconds * KMicroSecondsPerSecond); |
|
2497 // ##### SYNCHRONISE ACCESS ##### |
|
2498 notifMgr->Wait(); |
|
2499 CConnectionServParameterBundle* resultsBundle = notifMgr->GetResultsBundle(); |
|
2500 |
|
2501 if(iNotificationType == EMbmsRemoveServiceNtfn && (iRemoveAll || !iAllTmgiValid)) |
|
2502 { |
|
2503 if(resultsBundle == NULL && !(iRemoveAll)) |
|
2504 { |
|
2505 if(notifMgr->ErrCode() == iExpectedValue) |
|
2506 { |
|
2507 INFO_PRINTF1(_L("MBMS Remove With Invalid Services returned expected Error Value!!!")); |
|
2508 SetTestStepResult(EPass); |
|
2509 } |
|
2510 } |
|
2511 else if(resultsBundle != NULL && iRemoveAll) |
|
2512 { |
|
2513 TInt numParamSetContainers1 = resultsBundle->CountParamSetContainers(); |
|
2514 if ( numParamSetContainers1 == 0) |
|
2515 { |
|
2516 INFO_PRINTF1(_L("MBMS Remove All Services Successful!!!")); |
|
2517 SetTestStepResult(EPass); |
|
2518 } |
|
2519 } |
|
2520 else |
|
2521 { |
|
2522 INFO_PRINTF1(_L("MBMS Remove Services NOT Successful!!!")); |
|
2523 SetTestStepResult(EFail); |
|
2524 } |
|
2525 return TestStepResult(); |
|
2526 } |
|
2527 |
|
2528 __ASSERT_DEBUG(resultsBundle, User::Panic(KSpecAssert_ESockTestCnctnSr, 6)); |
|
2529 |
|
2530 // Firstly log the contents of the incoming results bundle |
|
2531 //TODO - complete for different Set |
|
2532 /*TBuf<1000> logBuf; |
|
2533 BundleToString(resultsBundle, logBuf); |
|
2534 INFO_PRINTF1(logBuf);*/ |
|
2535 |
|
2536 TInt numParamSetContainers = resultsBundle->CountParamSetContainers(); |
|
2537 __ASSERT_DEBUG(numParamSetContainers>0, User::Panic(KSpecAssert_ESockTestCnctnSr, 7)); |
|
2538 |
|
2539 if(iNotificationType == EMbmsBearerAvailNtfn) |
|
2540 { |
|
2541 CConnectionServParameterSetContainer* parSetCtr = resultsBundle->GetParamSetContainer(0); |
|
2542 XMBMSServiceQuerySet* genParamSet = XMBMSServiceQuerySet::FindInParamSetContainer(*parSetCtr); |
|
2543 __ASSERT_DEBUG(genParamSet, User::Panic(KSpecAssert_ESockTestCnctnSr, 8)); |
|
2544 |
|
2545 if(genParamSet->GetMBMSBearerAvailability() == iExpectedValue) |
|
2546 { |
|
2547 INFO_PRINTF2(_L("Value of GetMBMSBearerAvailabilty = %d"), genParamSet->GetMBMSBearerAvailability()); |
|
2548 SetTestStepResult(EPass); |
|
2549 } |
|
2550 else |
|
2551 { |
|
2552 INFO_PRINTF2(_L("Value of GetMBMSBearerAvailabilty = %d"), genParamSet->GetMBMSBearerAvailability()); |
|
2553 INFO_PRINTF1(_L("Bearer Availability Notification results do not match those expected.")); |
|
2554 } |
|
2555 } |
|
2556 else if (iNotificationType == EMbmsServiceAvailNtfn) |
|
2557 { |
|
2558 CConnectionServParameterSetContainer* parSetCtr = resultsBundle->GetParamSetContainer(0); |
|
2559 XMBMSServiceParameterSet* genParamSet = XMBMSServiceParameterSet::FindInParamSetContainer(*parSetCtr); |
|
2560 |
|
2561 if(genParamSet->GetMBMSServiceAvailability() == iExpectedValue) |
|
2562 { |
|
2563 SetTestStepResult(EPass); |
|
2564 } |
|
2565 else |
|
2566 { |
|
2567 INFO_PRINTF1(_L("Service Availability results do not match to the expected value.")); |
|
2568 } |
|
2569 } |
|
2570 else if (iNotificationType == EMbmsRemoveServiceNtfn) |
|
2571 { |
|
2572 TBool tmgiRemoved = ETrue; |
|
2573 if(iAllTmgiValid && !iAllTmgiInvalid) // All Valid TMGI Scenario |
|
2574 { |
|
2575 for(int i=0;i<numParamSetContainers;i++) |
|
2576 { |
|
2577 CConnectionServParameterSetContainer* parSetCtr1 = resultsBundle->GetParamSetContainer(i); |
|
2578 |
|
2579 XMBMSServiceParameterSet* genParamSet1 = XMBMSServiceParameterSet::FindInParamSetContainer(*parSetCtr1); |
|
2580 TMBMSChannelInfoV1* mbmsChannelInfo = genParamSet1->GetChannelInfo(); |
|
2581 |
|
2582 for(int i=0;i<iTmgiList->Count();i++) |
|
2583 { |
|
2584 if( (iTmgiList->At(i).GetMCC() == mbmsChannelInfo->GetTmgi().GetMCC()) && |
|
2585 (iTmgiList->At(i).GetMNC() == mbmsChannelInfo->GetTmgi().GetMNC()) && |
|
2586 (iTmgiList->At(i).GetServiceId() == mbmsChannelInfo->GetTmgi().GetServiceId())) |
|
2587 { |
|
2588 tmgiRemoved = EFalse; |
|
2589 } |
|
2590 } |
|
2591 } |
|
2592 if(tmgiRemoved) // Tmgi removed Successfully. |
|
2593 { |
|
2594 SetTestStepResult(EPass); |
|
2595 } |
|
2596 else |
|
2597 { |
|
2598 INFO_PRINTF1(_L("Access point notification results do not match those expected.")); |
|
2599 } |
|
2600 } |
|
2601 |
|
2602 else if (iAllTmgiInvalid && !iAllTmgiValid) // All TMGIs InValid |
|
2603 { |
|
2604 |
|
2605 for(int i=0;i<numParamSetContainers;i++) |
|
2606 { |
|
2607 CConnectionServParameterSetContainer* parSetCtr1 = resultsBundle->GetParamSetContainer(0); |
|
2608 |
|
2609 XMBMSServiceParameterSet* genParamSet1 = XMBMSServiceParameterSet::FindInParamSetContainer(*parSetCtr1); |
|
2610 |
|
2611 TMBMSChannelInfoV1* mbmsChannelInfo = genParamSet1->GetChannelInfo(); |
|
2612 for(int i=0;i<iTmgiList->Count();i++) |
|
2613 { |
|
2614 if( (iTmgiList->At(i).GetMCC() == mbmsChannelInfo->GetTmgi().GetMCC()) && |
|
2615 (iTmgiList->At(i).GetMNC() == mbmsChannelInfo->GetTmgi().GetMNC()) && |
|
2616 (iTmgiList->At(i).GetServiceId() == mbmsChannelInfo->GetTmgi().GetServiceId())) |
|
2617 { |
|
2618 tmgiRemoved = EFalse; |
|
2619 } |
|
2620 } |
|
2621 } |
|
2622 |
|
2623 if(tmgiRemoved) |
|
2624 { |
|
2625 SetTestStepResult(EPass); |
|
2626 } |
|
2627 else |
|
2628 { |
|
2629 INFO_PRINTF1(_L("Remove MBMS Service has not removed all the requested TMGIs.")); |
|
2630 } |
|
2631 } |
|
2632 else // Partial invalid TMGIs |
|
2633 { |
|
2634 |
|
2635 for(int i=0;i<numParamSetContainers;i++) |
|
2636 { |
|
2637 CConnectionServParameterSetContainer* parSetCtr1 = resultsBundle->GetParamSetContainer(0); |
|
2638 |
|
2639 XMBMSServiceParameterSet* genParamSet1 = XMBMSServiceParameterSet::FindInParamSetContainer(*parSetCtr1); |
|
2640 |
|
2641 TMBMSChannelInfoV1* mbmsChannelInfo = genParamSet1->GetChannelInfo(); |
|
2642 |
|
2643 for(int i=0;i<iTmgiList->Count();i++) |
|
2644 { |
|
2645 if((iTmgiList->At(i).GetMCC() == mbmsChannelInfo->GetTmgi().GetMCC()) && |
|
2646 (iTmgiList->At(i).GetMNC() == mbmsChannelInfo->GetTmgi().GetMNC()) && |
|
2647 (iTmgiList->At(i).GetServiceId() == mbmsChannelInfo->GetTmgi().GetServiceId())) |
|
2648 { |
|
2649 tmgiRemoved = EFalse; |
|
2650 } |
|
2651 } |
|
2652 } |
|
2653 |
|
2654 TInt errorCode = notifMgr->ErrCode(); |
|
2655 |
|
2656 if(tmgiRemoved && errorCode == KErrNone) |
|
2657 { |
|
2658 SetTestStepResult(EPass); |
|
2659 } |
|
2660 else |
|
2661 { |
|
2662 INFO_PRINTF1(_L("Remove MBMS Service has not removed all the requested TMGIs.")); |
|
2663 } |
|
2664 } |
|
2665 } |
|
2666 else if(iNotificationType == EMbmsActiveListNtfn) |
|
2667 { |
|
2668 CConnectionServParameterSetContainer* parSetCtr = resultsBundle->GetParamSetContainer(0); |
|
2669 XMBMSServiceQuerySet* genParamSet = XMBMSServiceQuerySet::FindInParamSetContainer(*parSetCtr); |
|
2670 __ASSERT_DEBUG(genParamSet, User::Panic(KSpecAssert_ESockTestCnctnSr, 9)); |
|
2671 TUint test = genParamSet->GetListCount(); |
|
2672 TUint test1 = genParamSet->GetListMaxCount(); |
|
2673 if(genParamSet->GetListCount() == iExpectedValue && |
|
2674 genParamSet->GetListMaxCount() == iExpectedValue1) |
|
2675 { |
|
2676 INFO_PRINTF2(_L("Value of List Count = %d"), genParamSet->GetListCount()); |
|
2677 INFO_PRINTF2(_L("Value of Max Active Count = %d"), genParamSet->GetListMaxCount()); |
|
2678 SetTestStepResult(EPass); |
|
2679 } |
|
2680 else |
|
2681 { |
|
2682 INFO_PRINTF2(_L("Value of List Count = %d"), genParamSet->GetListCount()); |
|
2683 INFO_PRINTF2(_L("Value of Max Active Count = %d"), genParamSet->GetListMaxCount()); |
|
2684 } |
|
2685 } |
|
2686 |
|
2687 else if(iNotificationType == EMbmsMonitorListNtfn) |
|
2688 { |
|
2689 CConnectionServParameterSetContainer* parSetCtr = resultsBundle->GetParamSetContainer(0); |
|
2690 XMBMSServiceQuerySet* genParamSet = XMBMSServiceQuerySet::FindInParamSetContainer(*parSetCtr); |
|
2691 __ASSERT_DEBUG(genParamSet, User::Panic(KSpecAssert_ESockTestCnctnSr, 10)); |
|
2692 |
|
2693 if(genParamSet->GetListCount() == iExpectedValue && |
|
2694 genParamSet->GetListMaxCount() == iExpectedValue1) |
|
2695 { |
|
2696 INFO_PRINTF2(_L("Value of List Count = %d"), genParamSet->GetListCount()); |
|
2697 INFO_PRINTF2(_L("Value of Max Monitor Count = %d"), genParamSet->GetListMaxCount()); |
|
2698 SetTestStepResult(EPass); |
|
2699 } |
|
2700 else |
|
2701 { |
|
2702 INFO_PRINTF2(_L("Value of List Count = %d"), genParamSet->GetListCount()); |
|
2703 INFO_PRINTF2(_L("Value of Max Monitor Count = %d"), genParamSet->GetListMaxCount()); |
|
2704 } |
|
2705 } |
|
2706 else {} |
|
2707 notifMgr->Signal(); |
|
2708 } |
|
2709 } |
|
2710 return TestStepResult(); |
|
2711 } |
|
2712 |
|
2713 CReceiveMBMSNtfnStep::~CReceiveMBMSNtfnStep() |
|
2714 { |
|
2715 } |
|
2716 |
|
2717 // Cancellation of the BearerAvailability Notification CCancelBearerAvailabilityNtfnStep |
|
2718 |
|
2719 CCancelMBMSNtfnStep::CCancelMBMSNtfnStep(CCEsockTestBase*& aEsockTest) |
|
2720 : CRConnectionServQueryTestStepBase(aEsockTest) |
|
2721 { |
|
2722 SetTestStepName(KCancelMBMSNtfnStep); |
|
2723 } |
|
2724 |
|
2725 TInt CCancelMBMSNtfnStep::ConfigureFromIni() |
|
2726 { |
|
2727 iConnectionServName.Set(KNullDesC); |
|
2728 |
|
2729 // Get the name of the connection server instance we are to use |
|
2730 if((GetStringFromConfig(iSection, KConnectionServName, iConnectionServName) != 1) |
|
2731 || (iConnectionServName.Length() == 0)) |
|
2732 { |
|
2733 INFO_PRINTF3(KErrString_MissingConfigFileField, &iSection, &KConnectionServName); |
|
2734 return KErrNotFound; |
|
2735 } |
|
2736 |
|
2737 // Get the name applied to the notification so we can look it up later when referring to the results |
|
2738 if((GetStringFromConfig(iSection, KNotificationName, iNotifName) != 1) |
|
2739 || (iNotifName.Length() == 0)) |
|
2740 { |
|
2741 INFO_PRINTF3(KErrString_MissingConfigFileField, &iSection, &KNotificationName); |
|
2742 return KErrNotFound; |
|
2743 } |
|
2744 |
|
2745 return KErrNone; |
|
2746 } |
|
2747 |
|
2748 TVerdict CCancelMBMSNtfnStep::doSingleTestStep() |
|
2749 { |
|
2750 // Fail by default |
|
2751 SetTestStepResult(EFail); |
|
2752 |
|
2753 // Fetch the connection server on which to post the notification. |
|
2754 RConnectionServ* connServ = iEsockTest->iConnectionServs.Find(iConnectionServName); |
|
2755 if(connServ == NULL) |
|
2756 { |
|
2757 INFO_PRINTF2(KErrString_NamedObjectNotFound, &iConnectionServName); |
|
2758 } |
|
2759 else |
|
2760 { |
|
2761 // Fetch the notification watching entity |
|
2762 CConnServNotificationWatcher* CancelNotifMgr = iEsockTest->iNotifWatchers.Find(iNotifName); |
|
2763 if(!CancelNotifMgr) |
|
2764 { |
|
2765 INFO_PRINTF3(KErrString_NamedObjectNotFound, &iSection, &iNotifName); |
|
2766 } |
|
2767 else |
|
2768 { |
|
2769 // Log on to our worker notif catcher thread in order to wait for it to finish |
|
2770 TRequestStatus logonStatus; |
|
2771 CancelNotifMgr->iNotifThread.Logon(logonStatus); |
|
2772 |
|
2773 // Send command to the thread managing the notification that we want cancelled |
|
2774 // this will then wait upon the thread to complete the command |
|
2775 CancelNotifMgr->CancelNotification(); |
|
2776 |
|
2777 // Now wait for the thread to complete |
|
2778 User::WaitForRequest(logonStatus); |
|
2779 TInt logonError = logonStatus.Int(); |
|
2780 |
|
2781 if(logonError == KErrNone) |
|
2782 { |
|
2783 INFO_PRINTF1(_L("MBMS Service Availability Notification cancelled successfully.")); |
|
2784 SetTestStepResult(EPass); |
|
2785 } |
|
2786 |
|
2787 // Remove our NotificationWatcher and Close the thread |
|
2788 iEsockTest->iNotifWatchers.Remove(iNotifName); |
|
2789 CancelNotifMgr->iNotifThread.Close(); |
|
2790 delete CancelNotifMgr; |
|
2791 } |
|
2792 } |
|
2793 return TestStepResult(); |
|
2794 } |
|
2795 |
|
2796 CCancelMBMSNtfnStep::~CCancelMBMSNtfnStep() |
|
2797 { |
|
2798 } |
|
2799 |
|
2800 |
|
2801 |
|
2802 |