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