|
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 ctlbsstep_setupprotocolstub.cpp |
|
15 // Sets up the multiple PM stubs |
|
16 // |
|
17 // |
|
18 |
|
19 /** |
|
20 @file |
|
21 @internalTechnology |
|
22 @test |
|
23 */ |
|
24 |
|
25 #include "ctlbsstepsetupmultipleprotocolstubs.h" |
|
26 #include <lbs/lbsadmin.h> |
|
27 |
|
28 CT_LbsStep_SetupMultipleProtocolStubs::CT_LbsStep_SetupMultipleProtocolStubs(CT_LbsServer& aParent) : CT_LbsStep(aParent) |
|
29 { |
|
30 SetTestStepName(KLbsStep_SetupMultipleProtocolStubs); |
|
31 } |
|
32 |
|
33 /** |
|
34 Static Constructor |
|
35 */ |
|
36 CT_LbsStep_SetupMultipleProtocolStubs* CT_LbsStep_SetupMultipleProtocolStubs::New(CT_LbsServer& aParent) |
|
37 { |
|
38 return new CT_LbsStep_SetupMultipleProtocolStubs(aParent); |
|
39 // Note the lack of ELeave. |
|
40 // This means that having insufficient memory will return NULL; |
|
41 } |
|
42 |
|
43 |
|
44 /** |
|
45 @pre |
|
46 @return Test verdict |
|
47 @post GPSMode set to autonomous |
|
48 */ |
|
49 TVerdict CT_LbsStep_SetupMultipleProtocolStubs::doTestStepL() |
|
50 { |
|
51 INFO_PRINTF1(_L(">>CT_LbsStep_SetupMultipleProtocolStubs::doTestStepL()")); |
|
52 |
|
53 CLbsAdmin* admin = CLbsAdmin::NewL(); |
|
54 CleanupStack::PushL(admin); |
|
55 |
|
56 TLbsAdminProtocolModulesInfo info; |
|
57 TLbsAdminProtocolModulesInfo::TLbsProtocolModuleIdArray uidArray; |
|
58 |
|
59 _LIT(KProtocolModuleUid, "ProtocolModuleUid%d"); |
|
60 TBool found = ETrue; |
|
61 TInt numOfPms = 0; |
|
62 TInt currentPmId = 1; |
|
63 |
|
64 //Loop through all the Protocol Modules required |
|
65 while(found) |
|
66 { |
|
67 TPtrC testModuleIdPtr; |
|
68 TUint32 testModuleId; |
|
69 TBuf<25> pmIdName; |
|
70 pmIdName.AppendFormat(KProtocolModuleUid, currentPmId); |
|
71 currentPmId++; |
|
72 if (GetStringFromConfig(ConfigSection(), pmIdName, testModuleIdPtr)) |
|
73 { |
|
74 TLex lex(testModuleIdPtr); |
|
75 User::LeaveIfError(lex.Val(testModuleId, EHex)); |
|
76 uidArray[numOfPms] = TUid::Uid(testModuleId); |
|
77 numOfPms++; |
|
78 INFO_PRINTF2(_L(">>ProtocolModuleUid read from .ini file section : %x"), testModuleId); |
|
79 } |
|
80 else |
|
81 { |
|
82 //Cannot find anymore PM's to add |
|
83 found = EFalse; |
|
84 } |
|
85 } |
|
86 |
|
87 info.SetModuleIds(uidArray,numOfPms); |
|
88 User::LeaveIfError(admin->Set(KLbsSettingHomeProtocolModule, info)); |
|
89 |
|
90 //Also, set Admin to handle 10 simultaneous requests (default is 1) |
|
91 TUint maxNumberOfRequests = 10; |
|
92 User::LeaveIfError(admin->Set(KLbsSettingMaximumExternalLocateRequests, maxNumberOfRequests)); |
|
93 |
|
94 CleanupStack::PopAndDestroy(admin); |
|
95 |
|
96 // Alow he setting to be propagated |
|
97 User::After(2000000); |
|
98 |
|
99 INFO_PRINTF1(_L("<<CT_LbsStep_SetupMultipleProtocolStubs::doTestStepL()")); |
|
100 |
|
101 return TestStepResult(); |
|
102 } |
|
103 |