lbs/common/src/ctlbsstepsetautonomousmode.cpp
branchSymbian2
changeset 1 8758140453c0
child 6 c108117318cb
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lbs/common/src/ctlbsstepsetautonomousmode.cpp	Thu Jan 21 12:53:44 2010 +0000
@@ -0,0 +1,90 @@
+// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// @file ctlbsstep_setautonomousmode.cpp
+// This is the class implementation for the Set Autonomous Moder Test Step
+// 
+//
+
+
+
+/**
+ @file
+ @internalTechnology
+ @test
+*/
+		  
+#include "ctlbsstepsetautonomousmode.h"
+#include <lbsadmin.h>
+
+CT_LbsStep_SetAutonomousMode::CT_LbsStep_SetAutonomousMode(CT_LbsServer& aParent) : CT_LbsStep(aParent)
+	{
+	SetTestStepName(KLbsStep_SetAutonomousMode);
+	}
+
+/**
+Static Constructor
+*/
+CT_LbsStep_SetAutonomousMode* CT_LbsStep_SetAutonomousMode::New(CT_LbsServer& aParent)
+	{
+	return new CT_LbsStep_SetAutonomousMode(aParent);
+	// Note the lack of ELeave.
+	// This means that having insufficient memory will return NULL;
+	}
+
+
+/**
+ */
+TBool CT_LbsStep_SetAutonomousMode::SetAndVerifyAutonomousGpsModeL()
+ 	{
+ 	TBool ret = TRUE;
+	CLbsAdmin* adminApi = CLbsAdmin::NewL();
+	CleanupStack::PushL(adminApi);
+	CLbsAdmin::TGpsMode mode;
+	
+	TInt err = adminApi->Set(KLbsSettingHomeGpsMode, CLbsAdmin::EGpsAutonomous);	
+	User::LeaveIfError(err);
+	err = adminApi->Get(KLbsSettingHomeGpsMode, mode);	
+	User::LeaveIfError(err);
+	
+	if(mode != CLbsAdmin::EGpsAutonomous)
+		{
+		INFO_PRINTF1(_L("Admin setting didn't work"));
+		ret = FALSE;
+		}					
+	CleanupStack::PopAndDestroy(adminApi);
+
+	// Alow he setting to be propagated
+	User::After(2000000);
+	
+	return ret;
+ 	}
+
+/**
+@pre 	
+@return Test verdict
+@post	GPSMode set to autonomous
+*/
+TVerdict CT_LbsStep_SetAutonomousMode::doTestStepL()
+	{
+	INFO_PRINTF1(_L("&gt;&gt;CT_LbsStep_SetAutonomousMode::doTestStepL()"));
+
+	if(!SetAndVerifyAutonomousGpsModeL())
+		{
+		SetTestStepResult(EFail);
+		}
+	
+	INFO_PRINTF1(_L("&lt;&lt;CT_LbsStep_SetAutonomousMode::doTestStepL()"));
+
+	return TestStepResult();
+	}