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