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