|
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 ctlbsstepsetatamode.cpp |
|
15 // This is the class implementation for the Set Behaviour Mode Original Step |
|
16 // |
|
17 // |
|
18 |
|
19 |
|
20 |
|
21 /** |
|
22 @file |
|
23 @internalTechnology |
|
24 @test |
|
25 */ |
|
26 |
|
27 #include "ctlbsstepsetatamode.h" |
|
28 #include <lbsadmin.h> |
|
29 |
|
30 CT_LbsStep_SetATAMode::CT_LbsStep_SetATAMode(CT_LbsServer& aParent) : CT_LbsStep(aParent) |
|
31 { |
|
32 SetTestStepName(KLbsStep_SetATAMode); |
|
33 } |
|
34 |
|
35 /** |
|
36 Static Constructor |
|
37 */ |
|
38 CT_LbsStep_SetATAMode* CT_LbsStep_SetATAMode::New(CT_LbsServer& aParent) |
|
39 { |
|
40 return new CT_LbsStep_SetATAMode(aParent); |
|
41 // Note the lack of ELeave. |
|
42 // This means that having insufficient memory will return NULL; |
|
43 } |
|
44 |
|
45 |
|
46 /** |
|
47 */ |
|
48 TBool CT_LbsStep_SetATAMode::SetAndVerifyATAModeL() |
|
49 { |
|
50 TBool ret = TRUE; |
|
51 CLbsAdmin* adminApi = CLbsAdmin::NewL(); |
|
52 CleanupStack::PushL(adminApi); |
|
53 |
|
54 TInt err = adminApi->Set(KLbsSettingRoamingGpsMode, CLbsAdmin::EGpsAlwaysTerminalAssisted); |
|
55 User::LeaveIfError(err); |
|
56 err = adminApi->Set(KLbsSettingHomeGpsMode, CLbsAdmin::EGpsAlwaysTerminalAssisted); |
|
57 User::LeaveIfError(err); |
|
58 // Alow he setting to be propagated |
|
59 User::After(2000000); |
|
60 |
|
61 CLbsAdmin::TGpsMode gpsMode; |
|
62 err = adminApi->Get(KLbsSettingRoamingGpsMode, gpsMode); |
|
63 User::LeaveIfError(err); |
|
64 if(gpsMode != CLbsAdmin::EGpsAlwaysTerminalAssisted) |
|
65 { |
|
66 INFO_PRINTF1(_L("Admin setting didn't work")); |
|
67 ret = FALSE; |
|
68 } |
|
69 |
|
70 err = adminApi->Get(KLbsSettingHomeGpsMode, gpsMode); |
|
71 User::LeaveIfError(err); |
|
72 if(gpsMode != CLbsAdmin::EGpsAlwaysTerminalAssisted) |
|
73 { |
|
74 INFO_PRINTF1(_L("Admin setting didn't work")); |
|
75 ret = FALSE; |
|
76 } |
|
77 CleanupStack::PopAndDestroy(adminApi); |
|
78 |
|
79 return ret; |
|
80 } |
|
81 |
|
82 /** |
|
83 @pre |
|
84 @return Test verdict |
|
85 @post Lbs Behaviour mode set to "original" |
|
86 */ |
|
87 TVerdict CT_LbsStep_SetATAMode::doTestStepL() |
|
88 { |
|
89 INFO_PRINTF1(_L(">>CT_LbsStep_SetATAMode::doTestStepL()")); |
|
90 |
|
91 if(!SetAndVerifyATAModeL()) |
|
92 { |
|
93 SetTestStepResult(EFail); |
|
94 } |
|
95 |
|
96 INFO_PRINTF1(_L("<<CT_LbsStep_SetATAMode::doTestStepL()")); |
|
97 |
|
98 return TestStepResult(); |
|
99 } |