lbstest/lbstestproduct/common/src/ctlbsstepsetuproamselflocate.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 ctlbsstepsetuproamlocate.cpp
       
    15 // This is the class implementation for the Set Autonomous Moder Test Step
       
    16 // 
       
    17 //
       
    18 
       
    19 /**
       
    20  @file
       
    21  @internalTechnology
       
    22  @test
       
    23 */
       
    24 		  
       
    25 #include "ctlbsstepsetuproamselflocate.h"
       
    26 #include <lbs/lbsadmin.h>
       
    27 
       
    28 CT_LbsStep_SetupRoamSelfLocate::CT_LbsStep_SetupRoamSelfLocate(CT_LbsServer& aParent)
       
    29 :CT_LbsStep(aParent)
       
    30 	{
       
    31 	SetTestStepName(KLbsStep_SetupRoamSelfLocate);
       
    32 	}
       
    33 
       
    34 /**
       
    35 Static Constructor
       
    36 */
       
    37 CT_LbsStep_SetupRoamSelfLocate* CT_LbsStep_SetupRoamSelfLocate::New(CT_LbsServer& aParent)
       
    38 	{
       
    39 	return new CT_LbsStep_SetupRoamSelfLocate(aParent);
       
    40 	// Note the lack of ELeave.
       
    41 	// This means that having insufficient memory will return NULL;
       
    42 	}
       
    43 
       
    44 
       
    45 /**
       
    46 @pre 	
       
    47 @return Test verdict
       
    48 @post	GPSMode set to autonomous
       
    49 */
       
    50 TVerdict CT_LbsStep_SetupRoamSelfLocate::doTestStepL()
       
    51 	{
       
    52 	INFO_PRINTF1(_L("&gt;&gt;CT_LbsStep_SetupRoamSelfLocate::doTestStepL()"));
       
    53 
       
    54  	CLbsAdmin* adminApi = CLbsAdmin::NewL();
       
    55 	CleanupStack::PushL(adminApi);
       
    56 	
       
    57 	// Switch on the self locate API when roaming.
       
    58 	CLbsAdmin::TSelfLocateService serviceSetting = CLbsAdmin::ESelfLocateUnknown;
       
    59 
       
    60 	TInt err = adminApi->Set(KLbsSettingRoamingSelfLocate, CLbsAdmin::ESelfLocateOn);
       
    61 	User::LeaveIfError(err);
       
    62 	err = adminApi->Get(KLbsSettingRoamingSelfLocate, serviceSetting);	
       
    63 	User::LeaveIfError(err);
       
    64 	
       
    65 	if(serviceSetting != CLbsAdmin::ESelfLocateOn)
       
    66 		{
       
    67 		INFO_PRINTF1(_L("Self locate API admin setting didn't work"));
       
    68 		SetTestStepResult(EFail);
       
    69 		}					
       
    70 	
       
    71 	// Set gps mode when roaming.
       
    72 	CLbsAdmin::TGpsMode gpsModeSetting = CLbsAdmin::EGpsModeUnknown;
       
    73 	
       
    74 	err = adminApi->Set(KLbsSettingRoamingGpsMode, CLbsAdmin::EGpsPreferTerminalBased);
       
    75 	User::LeaveIfError(err);
       
    76 	err = adminApi->Get(KLbsSettingRoamingGpsMode, gpsModeSetting);
       
    77 	User::LeaveIfError(err);
       
    78 	
       
    79 	if (gpsModeSetting != CLbsAdmin::EGpsPreferTerminalBased)
       
    80 		{
       
    81 		INFO_PRINTF1(_L("Gps mode admin setting didn't work"));
       
    82 		SetTestStepResult(EFail);
       
    83 		}
       
    84 		
       
    85 	CleanupStack::PopAndDestroy(adminApi);
       
    86 
       
    87 	// Alow he setting to be propagated
       
    88 	User::After(2000000);
       
    89 
       
    90 	INFO_PRINTF1(_L("&lt;&lt;CT_LbsStep_SetupRoamSelfLocate::doTestStepL()"));
       
    91 	return TestStepResult();
       
    92 	}
       
    93