|
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_setupstandaloneprivacyandsimplectlr.cpp |
|
15 // This is the class implementation for the Set Autonomous Mode Test Step |
|
16 // |
|
17 // |
|
18 |
|
19 /** |
|
20 @file |
|
21 @internalTechnology |
|
22 @test |
|
23 */ |
|
24 |
|
25 #include "ctlbsstepsetupstandaloneprivacyandsimplectlr.h" |
|
26 #include <lbs/lbsadmin.h> |
|
27 #include <centralrepository.h> |
|
28 |
|
29 |
|
30 CT_LbsStep_SetupStandalonePrivacyAndSimpleCtlr::CT_LbsStep_SetupStandalonePrivacyAndSimpleCtlr(CT_LbsServer& aParent) : CT_LbsStep(aParent) |
|
31 { |
|
32 SetTestStepName(KLbsStep_SetupStandalonePrivacyAndSimpleCtlr); |
|
33 } |
|
34 |
|
35 /** |
|
36 Static Constructor |
|
37 */ |
|
38 CT_LbsStep_SetupStandalonePrivacyAndSimpleCtlr* CT_LbsStep_SetupStandalonePrivacyAndSimpleCtlr::New(CT_LbsServer& aParent) |
|
39 { |
|
40 return new CT_LbsStep_SetupStandalonePrivacyAndSimpleCtlr(aParent); |
|
41 // Note the lack of ELeave. |
|
42 // This means that having insufficient memory will return NULL; |
|
43 } |
|
44 |
|
45 |
|
46 /** |
|
47 @pre |
|
48 @return Test verdict |
|
49 @post LBS sub-system set to standalone privacy mode and using simple controller. |
|
50 */ |
|
51 TVerdict CT_LbsStep_SetupStandalonePrivacyAndSimpleCtlr::doTestStepL() |
|
52 { |
|
53 |
|
54 // lbsroot stuff (not ideal, currently defined in internal header file lbsrootcenrepdefs.h |
|
55 const TUint KLbsCenRepUidValue = 0x10282266; |
|
56 const TUid KLbsCenRepUid = {KLbsCenRepUidValue}; |
|
57 |
|
58 const TUint32 KLbsRootProcessNameFirstKey = 0x00001000; |
|
59 const TUint32 KLbsRootProcessUidFirstKey = 0x00002000; |
|
60 const TUint32 KLbsRootProcessIsServerFirstKey = 0x00003000; |
|
61 |
|
62 const TUint32 KLbsSystemTransientKey = 0x00000001; |
|
63 const TUint32 KLbsRootProcessTransientKey = 0x00000002; |
|
64 |
|
65 const TUint32 KRootKeyMask = 0xFFFFF000; // don't care what the last 3 digits are |
|
66 |
|
67 INFO_PRINTF1(_L(">>CT_LbsStep_SetupStandalonePrivacyAndSimpleCtlr::doTestStepL()")); |
|
68 |
|
69 // Set the privacy protocol module as the protocol module to load in admin settings |
|
70 CLbsAdmin* adminApi = CLbsAdmin::NewL(); |
|
71 CleanupStack::PushL(adminApi); |
|
72 |
|
73 const TLbsProtocolModuleId KPrivacyPMUid = { 0x1028373C }; |
|
74 TInt err = adminApi->Set(KLbsSettingHomeProtocolModule, KPrivacyPMUid); |
|
75 User::LeaveIfError(err); |
|
76 TUid uid; |
|
77 err = adminApi->Get(KLbsSettingHomeProtocolModule, uid); |
|
78 User::LeaveIfError(err); |
|
79 |
|
80 if(uid.iUid != KPrivacyPMUid.iUid) |
|
81 { |
|
82 INFO_PRINTF1(_L("Admin setting didn't work")); |
|
83 SetTestStepResult(EFail); |
|
84 } |
|
85 |
|
86 //Get privacy handler type |
|
87 CLbsAdmin::TPrivacyHandler privacyHandlerType; |
|
88 err = adminApi->Get(KLbsSettingPrivacyHandler, privacyHandlerType); |
|
89 User::LeaveIfError(err); |
|
90 |
|
91 // Set the privacy timeout action as 'network defined' |
|
92 err = adminApi->Set(KLbsSettingPrivacyTimeoutAction, CLbsAdmin::EPrivacyTimeoutNetworkDefined); |
|
93 User::LeaveIfError(err); |
|
94 |
|
95 // Set the maximum number of simultaneous privacy requests allowed |
|
96 const TUint KMaxExternalLocateRequests(150); |
|
97 err = adminApi->Set(KLbsSettingMaximumExternalLocateRequests, KMaxExternalLocateRequests); |
|
98 User::LeaveIfError(err); |
|
99 |
|
100 CleanupStack::PopAndDestroy(adminApi); |
|
101 |
|
102 // Alow the setting to be propagated |
|
103 User::After(2000000); |
|
104 |
|
105 // Set-up the LbsRoot cenrep file so that: |
|
106 // 1) LbsRoot is transient. |
|
107 // 2) LbsRoot starts the LBS subsystem in transient mode |
|
108 // 3) LbsRoot only starts the NRH and NG. |
|
109 |
|
110 CRepository* rootRep = CRepository::NewLC(KLbsCenRepUid); |
|
111 |
|
112 // Set Lbs system and LbsRoot process as transient. |
|
113 |
|
114 // Start the LBS sub-system in transient mode. |
|
115 User::LeaveIfError(rootRep->Set(KLbsSystemTransientKey, 1)); |
|
116 User::LeaveIfError(rootRep->Set(KLbsRootProcessTransientKey, 1)); |
|
117 |
|
118 // Set only NRH and NG to be started. |
|
119 // First, clear out any existing startup entries. |
|
120 TUint32 errorKey; |
|
121 User::LeaveIfError(rootRep->Delete(KLbsRootProcessNameFirstKey, KRootKeyMask, errorKey)); |
|
122 User::LeaveIfError(rootRep->Delete(KLbsRootProcessUidFirstKey, KRootKeyMask, errorKey)); |
|
123 User::LeaveIfError(rootRep->Delete(KLbsRootProcessIsServerFirstKey, KRootKeyMask, errorKey)); |
|
124 |
|
125 // Set NRH and NG as startup entries. |
|
126 _LIT(KNGProcessName, "lbsnetgateway.exe"); |
|
127 const TUid KLbsNetworkGatewayUid = { 0x10281D46 }; |
|
128 User::LeaveIfError(rootRep->Set(KLbsRootProcessNameFirstKey, KNGProcessName)); |
|
129 User::LeaveIfError(rootRep->Set(KLbsRootProcessUidFirstKey, TInt(KLbsNetworkGatewayUid.iUid))); |
|
130 User::LeaveIfError(rootRep->Set(KLbsRootProcessIsServerFirstKey, EFalse)); |
|
131 |
|
132 _LIT(KNRHProcessName, "lbsnetworkrequesthandler.exe"); |
|
133 const TUid KLbsNetRequestHandlerUid = { 0x10281D45 }; |
|
134 User::LeaveIfError(rootRep->Set(KLbsRootProcessNameFirstKey+1, KNRHProcessName)); |
|
135 User::LeaveIfError(rootRep->Set(KLbsRootProcessUidFirstKey+1, TInt(KLbsNetRequestHandlerUid.iUid))); |
|
136 User::LeaveIfError(rootRep->Set(KLbsRootProcessIsServerFirstKey+1, ETrue)); |
|
137 |
|
138 //If we are using Privacy Controller mode, start privacy controller as well |
|
139 if(privacyHandlerType == CLbsAdmin::EPrivacyHandleByController) |
|
140 { |
|
141 _LIT(KPrivCtrlProcessName, "lbstestprivacycontrollersimple.exe"); |
|
142 const TUid KLbsPrivacyControllerUid = { 0x10283746 }; |
|
143 User::LeaveIfError(rootRep->Set(KLbsRootProcessNameFirstKey+2, KPrivCtrlProcessName)); |
|
144 User::LeaveIfError(rootRep->Set(KLbsRootProcessUidFirstKey+2, TInt(KLbsPrivacyControllerUid.iUid))); |
|
145 User::LeaveIfError(rootRep->Set(KLbsRootProcessIsServerFirstKey+2, EFalse)); |
|
146 } |
|
147 else |
|
148 { |
|
149 ERR_PRINTF1(_L("FAIL - Test Step is only useful with Privacy Controller")); |
|
150 SetTestStepResult(EFail); |
|
151 } |
|
152 |
|
153 CleanupStack::PopAndDestroy(rootRep); |
|
154 |
|
155 INFO_PRINTF1(_L("<<CT_LbsStep_SetupStandalonePrivacyAndSimpleCtlr::doTestStepL()")); |
|
156 |
|
157 return TestStepResult(); |
|
158 } |
|
159 |