lbs/common/src/ctlbsstepsetptbmode.cpp
branchSymbian2
changeset 1 8758140453c0
child 6 c108117318cb
equal deleted inserted replaced
0:e8c1ea2c6496 1:8758140453c0
       
     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 ctlbsstepsetptbmode.cpp
       
    15 // This is the class implementation for the Set Gps Mode PTB
       
    16 // 
       
    17 //
       
    18 
       
    19 
       
    20 
       
    21 /**
       
    22  @file
       
    23  @internalTechnology
       
    24  @test
       
    25 */
       
    26 		  
       
    27 #include "ctlbsstepsetptbmode.h"
       
    28 #include <lbsadmin.h>
       
    29 
       
    30 CT_LbsStep_SetPTBMode::CT_LbsStep_SetPTBMode(CT_LbsServer& aParent) : CT_LbsStep(aParent)
       
    31 	{
       
    32 	SetTestStepName(KLbsStep_SetPTBMode);
       
    33 	}
       
    34 
       
    35 /**
       
    36 Static Constructor
       
    37 */
       
    38 CT_LbsStep_SetPTBMode* CT_LbsStep_SetPTBMode::New(CT_LbsServer& aParent)
       
    39 	{
       
    40 	return new CT_LbsStep_SetPTBMode(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_SetPTBMode::SetAndVerifyPTBModeL()
       
    49  	{
       
    50  	TBool ret = TRUE;
       
    51 	CLbsAdmin* adminApi = CLbsAdmin::NewL();
       
    52 	CleanupStack::PushL(adminApi);
       
    53 	
       
    54 	TInt err = adminApi->Set(KLbsSettingRoamingGpsMode, CLbsAdmin::EGpsPreferTerminalBased);
       
    55 	User::LeaveIfError(err);
       
    56 	err = adminApi->Set(KLbsSettingHomeGpsMode, CLbsAdmin::EGpsPreferTerminalBased);
       
    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::EGpsPreferTerminalBased)
       
    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::EGpsPreferTerminalBased)
       
    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_SetPTBMode::doTestStepL()
       
    88 	{
       
    89 	INFO_PRINTF1(_L("&gt;&gt;CT_LbsStep_SetPTBMode::doTestStepL()"));
       
    90 
       
    91 	if(!SetAndVerifyPTBModeL())
       
    92 		{
       
    93 		SetTestStepResult(EFail);
       
    94 		}
       
    95 	
       
    96 	INFO_PRINTF1(_L("&lt;&lt;CT_LbsStep_SetPTBMode::doTestStepL()"));
       
    97 
       
    98 	return TestStepResult();
       
    99 	}