kerneltest/e32test/usbho/t_usbdi/src/PBASE-T_USBDI-0481.cpp
changeset 253 d37db4dcc88d
parent 0 a41df078684a
child 257 3e88ff8f41d5
--- a/kerneltest/e32test/usbho/t_usbdi/src/PBASE-T_USBDI-0481.cpp	Tue Aug 24 14:42:58 2010 +0100
+++ b/kerneltest/e32test/usbho/t_usbdi/src/PBASE-T_USBDI-0481.cpp	Tue Aug 24 14:49:21 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2007-2010 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 "Eclipse Public License v1.0"
@@ -20,6 +20,10 @@
 #include "testpolicy.h"
 #include "testdebug.h"
 #include "modelleddevices.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "PBASE-T_USBDI-0481Traces.h"
+#endif
 
 namespace NUnitTesting_USBDI
 	{
@@ -29,10 +33,12 @@
 
 CUT_PBASE_T_USBDI_0481* CUT_PBASE_T_USBDI_0481::NewL(TBool aHostRole)
 	{
+	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0481_NEWL_ENTRY, aHostRole );
 	CUT_PBASE_T_USBDI_0481* self = new (ELeave) CUT_PBASE_T_USBDI_0481(aHostRole);
 	CleanupStack::PushL(self);
 	self->ConstructL();
 	CleanupStack::Pop(self);
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0481_NEWL_EXIT, ( TUint )( self ) );
 	return self;
 	} 
 	
@@ -41,19 +47,23 @@
 :	CBaseTestCase(KTestCaseId,aHostRole),
 	iCaseStep(EInProgress)
 	{
+	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0481_CUT_PBASE_T_USBDI_0481_ENTRY, this );
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0481_CUT_PBASE_T_USBDI_0481_EXIT, this );
 	} 
 
 
 void CUT_PBASE_T_USBDI_0481::ConstructL()
 	{
+	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0481_CONSTRUCTL_ENTRY, this );
 	iTestDevice = new RUsbDeviceA(this);
 	BaseConstructL();
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0481_CONSTRUCTL_EXIT, this );
 	}
 
 
 CUT_PBASE_T_USBDI_0481::~CUT_PBASE_T_USBDI_0481()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0481_CUT_PBASE_T_USBDI_0481_ENTRY_DUP01, this );
 	
 	Cancel();
 	
@@ -69,11 +79,12 @@
 		iTestDevice->Close();
 		}		
 	delete iTestDevice;
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0481_CUT_PBASE_T_USBDI_0481_EXIT_DUP01, this );
 	}
 	
 void CUT_PBASE_T_USBDI_0481::ExecuteHostTestCaseL()	
 	{
-	LOG_FUNC
+    OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0481_EXECUTEHOSTTESTCASEL_ENTRY, this );
 
 	// Create the actor for the Function Driver Framework 	
 	iActorFDF = CActorFDF::NewL(*this);
@@ -86,12 +97,13 @@
 	
 	// Start the connection timeout timer
 	TimeoutIn(30);
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0481_EXECUTEHOSTTESTCASEL_EXIT, this );
 	}
 
 
 void CUT_PBASE_T_USBDI_0481::ExecuteDeviceTestCaseL()	
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0481_EXECUTEDEVICETESTCASEL_ENTRY, this );
 	
 	// Create the test device	
 	iTestDevice->OpenL(TestCaseId());
@@ -100,38 +112,42 @@
 	
 	// Connect the device to the host	
 	iTestDevice->SoftwareConnect();
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0481_EXECUTEDEVICETESTCASEL_EXIT, this );
 	}
 
 
 void CUT_PBASE_T_USBDI_0481::HostDoCancel()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0481_HOSTDOCANCEL_ENTRY, this );
 	
 	// Cancel the test step action timeout timer	
 	CancelTimeout();
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0481_HOSTDOCANCEL_EXIT, this );
 	}
 
 	
 void CUT_PBASE_T_USBDI_0481::DeviceDoCancel()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0481_DEVICEDOCANCEL_ENTRY, this );
 	
 	// Cancel the device (the activity timer and the error reporting)	
 	iTestDevice->CancelSubscriptionToReports();
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0481_DEVICEDOCANCEL_EXIT, this );
 	}
 	
 	
 void CUT_PBASE_T_USBDI_0481::DeviceStateChangeL(RUsbDevice::TDeviceState aPreviousState,
 		RUsbDevice::TDeviceState aNewState,TInt aCompletionCode)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0481_DEVICESTATECHANGEL_ENTRY, this );
 	
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0481_DEVICESTATECHANGEL_EXIT, this );
 	}
 	
 	
 void CUT_PBASE_T_USBDI_0481::DeviceInsertedL(TUint aDeviceHandle)
 	{
-	LOG_FUNC
+    OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0481_DEVICEINSERTEDL_ENTRY, this );
 
 	// Cancel the timeout timer	
 	Cancel();
@@ -143,11 +159,12 @@
 	if(testDevice.SerialNumber().Compare(TestCaseId()) != 0)
 		{
 		// Incorrect device for this test case
-		RDebug::Printf("<Warning %d> Incorrect device serial number (%S) connected for this test case (%S)",
-			KErrNotFound,&testDevice.SerialNumber(),&TestCaseId());
+		OstTraceExt3(TRACE_NORMAL, CUT_PBASE_T_USBDI_0481_DEVICEINSERTEDL, "<Warning %d> Incorrect device serial number (%S) connected for this test case (%S)",
+			KErrNotFound,testDevice.SerialNumber(),TestCaseId());
 
 		// Start the connection timeout again
 		TimeoutIn(30);
+		OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0481_DEVICEINSERTEDL_EXIT, this );
 		return;
 		}	
 	
@@ -155,7 +172,7 @@
 	err = testDevice.Device().GetTokenForInterface(0,iToken0);
 	if(err != KErrNone)
 		{
-		RDebug::Printf("<Error %d> Unable to retrieve token for interface 0",err);
+		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0481_DEVICEINSERTEDL_DUP01, "<Error %d> Unable to retrieve token for interface 0",err);
 		TestFailed(err);
 		}
 	
@@ -163,7 +180,7 @@
 	err = iUsbInterface0.Open(iToken0);
 	if(err != KErrNone)
 		{
-		RDebug::Printf("<Error %d> Unable to open interface 0");
+		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0481_DEVICEINSERTEDL_DUP02, "<Error %d> Unable to open interface 0", err);
 		TestFailed(err);
 		}
 		
@@ -172,14 +189,14 @@
 	err = testDevice.Device().GetTokenForInterface(1,token1);
 	if(err != KErrNone)
 		{
-		RDebug::Printf("<Error %d> token1 for interface 1",err);
+		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0481_DEVICEINSERTEDL_DUP03, "<Error %d> token1 for interface 1",err);
 		return TestFailed(err);
 		}
 	// Open interface 1
 	err = iUsbInterface1.Open(token1); // Alternate interface setting 0
 	if(err != KErrNone)
 		{
-		RDebug::Printf("<Error %d> Unable to open interface 1");
+		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0481_DEVICEINSERTEDL_DUP04, "<Error %d> Unable to open interface 1", err);
 		return TestFailed(err);
 		}
 
@@ -188,16 +205,16 @@
 	err = testDevice.Device().GetTokenForInterface(1,token1Bis);
 	if(err != KErrInUse)
 		{
-		RDebug::Printf("GetTokenForInterface(1,token1Bis), err != KErrInUse");
+		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0481_DEVICEINSERTEDL_DUP05, "GetTokenForInterface(1,token1Bis), err != KErrInUse");
 		return TestFailed(err);
 		}
 		
 	// Open interface 1 again, fails
-	RDebug::Printf("open it twice, catch error Code");
+	OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0481_DEVICEINSERTEDL_DUP06, "open it twice, catch error Code");
 	err = iUsbInterface1.Open(token1); // Alternate interface setting 0
 	if(err != KErrInUse)
 		{
-		RDebug::Printf("iUsbInterface1.Open(token1), err != KErrInUse");
+		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0481_DEVICEINSERTEDL_DUP07, "iUsbInterface1.Open(token1), err != KErrInUse");
 		return TestFailed(err);
 		}
 
@@ -206,19 +223,20 @@
 	iCaseStep = EPassed;
 	TTestCasePassed request;
 	iControlEp0->SendRequest(request,this);	
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0481_DEVICEINSERTEDL_EXIT_DUP01, this );
 	}
 	
 void CUT_PBASE_T_USBDI_0481::Ep0TransferCompleteL(TInt aCompletionCode)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0481_EP0TRANSFERCOMPLETEL_ENTRY, this );
 	
-	RDebug::Printf("Ep0TransferCompleteL with aCompletionCode = %d",aCompletionCode);
+	OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0481_EP0TRANSFERCOMPLETEL, "Ep0TransferCompleteL with aCompletionCode = %d",aCompletionCode);
 	
 	if(aCompletionCode != KErrNone)
 		{	
 		TBuf<256> msg;
 		msg.Format(_L("<Error %d> Transfer to control endpoint 0 was not successful"),aCompletionCode);
-		RDebug::Print(msg);
+		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0481_EP0TRANSFERCOMPLETEL_DUP01, msg);
 		}
 
 	if(iCaseStep == EPassed)
@@ -235,30 +253,33 @@
 		{
 		return TestFailed(KErrCompletion);
 		}
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0481_EP0TRANSFERCOMPLETEL_EXIT, this );
 	}
 	
 void CUT_PBASE_T_USBDI_0481::DeviceRemovedL(TUint aDeviceHandle)
 	{
-	LOG_FUNC
+    OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0481_DEVICEREMOVEDL_ENTRY, this );
 
 	// The test device should not be removed until the test case has passed
 	// so this test case has not completed, and state this event as an error
 	TestFailed(KErrDisconnected);
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0481_DEVICEREMOVEDL_EXIT, this );
 	}
 	
 	
 void CUT_PBASE_T_USBDI_0481::BusErrorL(TInt aError)
 	{
-	LOG_FUNC
+    OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0481_BUSERRORL_ENTRY, this );
 
 	// This test case handles no failiures on the bus
 	TestFailed(aError);
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0481_BUSERRORL_EXIT, this );
 	}
 
 
 void CUT_PBASE_T_USBDI_0481::HostRunL()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0481_HOSTRUNL_ENTRY, this );
 	
 	// Obtain the completion code
 	TInt completionCode(iStatus.Int());
@@ -266,14 +287,15 @@
 	if(completionCode == KErrNone)
 		{
 		// Action timeout
-		RDebug::Printf("<Error> Action timeout");
+		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0481_HOSTRUNL, "<Error> Action timeout");
 		TestFailed(KErrTimedOut);
 		}
 	else
 		{
-		RDebug::Printf("<Error %d> Timeout timer could not complete",completionCode);
+		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0481_HOSTRUNL_DUP01, "<Error %d> Timeout timer could not complete",completionCode);
 		TestFailed(completionCode);
 		}
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0481_HOSTRUNL_EXIT, this );
 	}
 
 /**
@@ -282,11 +304,12 @@
 */
 void CUT_PBASE_T_USBDI_0481::DeviceRunL()
 	{
-	LOG_FUNC	
+	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0481_DEVICERUNL_ENTRY, this );
 	// Disconnect the device	
 	iTestDevice->SoftwareDisconnect();	
 	// Complete the test case request	
 	TestPolicy().SignalTestComplete(iStatus.Int());
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0481_DEVICERUNL_EXIT, this );
 	}