|
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_setautonomousmode.cpp |
|
15 // This is the class implementation for the Set Autonomous Moder Test Step |
|
16 // |
|
17 // |
|
18 |
|
19 |
|
20 |
|
21 /** |
|
22 @file |
|
23 @internalTechnology |
|
24 @test |
|
25 */ |
|
26 |
|
27 #include "ctlbsstepsetautonomousmode.h" |
|
28 #include <lbsadmin.h> |
|
29 |
|
30 CT_LbsStep_SetAutonomousMode::CT_LbsStep_SetAutonomousMode(CT_LbsServer& aParent) : CT_LbsStep(aParent) |
|
31 { |
|
32 SetTestStepName(KLbsStep_SetAutonomousMode); |
|
33 } |
|
34 |
|
35 /** |
|
36 Static Constructor |
|
37 */ |
|
38 CT_LbsStep_SetAutonomousMode* CT_LbsStep_SetAutonomousMode::New(CT_LbsServer& aParent) |
|
39 { |
|
40 return new CT_LbsStep_SetAutonomousMode(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_SetAutonomousMode::SetAndVerifyAutonomousGpsModeL() |
|
49 { |
|
50 TBool ret = TRUE; |
|
51 CLbsAdmin* adminApi = CLbsAdmin::NewL(); |
|
52 CleanupStack::PushL(adminApi); |
|
53 CLbsAdmin::TGpsMode mode; |
|
54 |
|
55 TInt err = adminApi->Set(KLbsSettingHomeGpsMode, CLbsAdmin::EGpsAutonomous); |
|
56 User::LeaveIfError(err); |
|
57 err = adminApi->Get(KLbsSettingHomeGpsMode, mode); |
|
58 User::LeaveIfError(err); |
|
59 |
|
60 if(mode != CLbsAdmin::EGpsAutonomous) |
|
61 { |
|
62 INFO_PRINTF1(_L("Admin setting didn't work")); |
|
63 ret = FALSE; |
|
64 } |
|
65 CleanupStack::PopAndDestroy(adminApi); |
|
66 |
|
67 // Alow he setting to be propagated |
|
68 User::After(2000000); |
|
69 |
|
70 return ret; |
|
71 } |
|
72 |
|
73 /** |
|
74 @pre |
|
75 @return Test verdict |
|
76 @post GPSMode set to autonomous |
|
77 */ |
|
78 TVerdict CT_LbsStep_SetAutonomousMode::doTestStepL() |
|
79 { |
|
80 INFO_PRINTF1(_L(">>CT_LbsStep_SetAutonomousMode::doTestStepL()")); |
|
81 |
|
82 if(!SetAndVerifyAutonomousGpsModeL()) |
|
83 { |
|
84 SetTestStepResult(EFail); |
|
85 } |
|
86 |
|
87 INFO_PRINTF1(_L("<<CT_LbsStep_SetAutonomousMode::doTestStepL()")); |
|
88 |
|
89 return TestStepResult(); |
|
90 } |