kerneltest/e32test/usbho/t_usbdi/src/PBASE-T_USBDI-1236.cpp
changeset 259 57b9594f5772
parent 0 a41df078684a
child 257 3e88ff8f41d5
--- a/kerneltest/e32test/usbho/t_usbdi/src/PBASE-T_USBDI-1236.cpp	Wed Aug 18 11:08:29 2010 +0300
+++ b/kerneltest/e32test/usbho/t_usbdi/src/PBASE-T_USBDI-1236.cpp	Thu Sep 02 21:54:16 2010 +0300
@@ -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"
@@ -22,6 +22,10 @@
 #include <d32usbdescriptors.h>
 #include "testdebug.h"
 #include "TestPolicy.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "PBASE-T_USBDI-1236Traces.h"
+#endif
 
 namespace NUnitTesting_USBDI
 	{
@@ -31,10 +35,12 @@
 
 CUT_PBASE_T_USBDI_1236* CUT_PBASE_T_USBDI_1236::NewL(TBool aHostRole)
 	{
+	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1236_NEWL_ENTRY, aHostRole );
 	CUT_PBASE_T_USBDI_1236* self = new (ELeave) CUT_PBASE_T_USBDI_1236(aHostRole);
 	CleanupStack::PushL(self);
 	self->ConstructL();
 	CleanupStack::Pop(self);
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1236_NEWL_EXIT, ( TUint )( self ) );
 	return self; 
 	}
 	   
@@ -42,19 +48,23 @@
 CUT_PBASE_T_USBDI_1236::CUT_PBASE_T_USBDI_1236(TBool aHostRole)
 :	CBaseTestCase(KTestCaseId,aHostRole)
 	{
+	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_1236_CUT_PBASE_T_USBDI_1236_ENTRY, this );
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1236_CUT_PBASE_T_USBDI_1236_EXIT, this );
 	} 
 
 
 void CUT_PBASE_T_USBDI_1236::ConstructL()
 	{
+	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1236_CONSTRUCTL_ENTRY, this );
 	iTestDevice = new RUsbDeviceA(this);
 	BaseConstructL();
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1236_CONSTRUCTL_EXIT, this );
 	}
 
 
 CUT_PBASE_T_USBDI_1236::~CUT_PBASE_T_USBDI_1236()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1236_CUT_PBASE_T_USBDI_1236_ENTRY_DUP01, this );
 	
 	// Cancel any async operations
 	
@@ -71,12 +81,13 @@
 		iTestDevice->Close();
 		}		
 	delete iTestDevice;
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1236_CUT_PBASE_T_USBDI_1236_EXIT_DUP01, this );
 	}
 
 
 void CUT_PBASE_T_USBDI_1236::ExecuteHostTestCaseL()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1236_EXECUTEHOSTTESTCASEL_ENTRY, this );
 	iCaseStep = EStepGetInterfaceString;
 	iActorFDF = CActorFDF::NewL(*this);
 	iControlEp0 = new (ELeave) CEp0Transfer(iUsbInterface0);
@@ -86,11 +97,12 @@
 
 	// Start the connection timeout	
 	TimeoutIn(30);
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1236_EXECUTEHOSTTESTCASEL_EXIT, this );
 	}
 
 void CUT_PBASE_T_USBDI_1236::ExecuteDeviceTestCaseL()
 	{
-	LOG_FUNC
+    OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1236_EXECUTEDEVICETESTCASEL_ENTRY, this );
 
 	// Construct the device for the test case
 	iTestDevice->OpenL(TestCaseId());
@@ -99,12 +111,13 @@
 
 	// Connect the test device	
 	iTestDevice->SoftwareConnect();
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1236_EXECUTEDEVICETESTCASEL_EXIT, this );
 	}
 	
 	
 void CUT_PBASE_T_USBDI_1236::DeviceInsertedL(TUint aDeviceHandle)
 	{
-	LOG_FUNC
+    OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_1236_DEVICEINSERTEDL_ENTRY, this );
 
 	Cancel(); // Cancel the timer
 	TInt err(KErrNone);
@@ -117,11 +130,12 @@
 		{
 		// 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_1236_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_1236_DEVICEINSERTEDL_EXIT, this );
 		return;
 		}	
 		
@@ -133,52 +147,52 @@
 			TUint32 token1(0);
 			TUint32 token2(0);
 	
-			RDebug::Printf("Obtaining token for interface 0");
+			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1236_DEVICEINSERTEDL_DUP01, "Obtaining token for interface 0");
 			err = testDevice.Device().GetTokenForInterface(0,token1);
 			if(err != KErrNone)
 				{
-				RDebug::Printf("<Error %d> Token for interface 0 could not be retrieved",err);
+				OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1236_DEVICEINSERTEDL_DUP02, "<Error %d> Token for interface 0 could not be retrieved",err);
 				return TestFailed(err);
 				}
-			RDebug::Printf("Token 1 (%d) retrieved",token1);
-			RDebug::Printf("Opening interface 0");
+			OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1236_DEVICEINSERTEDL_DUP03, "Token 1 (%d) retrieved",token1);
+			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1236_DEVICEINSERTEDL_DUP04, "Opening interface 0");
 			err = iUsbInterface0.Open(token1); // Alternate interface setting 0
 			if(err != KErrNone)
 				{
-				RDebug::Printf("<Error %d> Interface 0 could not be opened",err);
+				OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1236_DEVICEINSERTEDL_DUP05, "<Error %d> Interface 0 could not be opened",err);
 				return TestFailed(err);
 				}
-			RDebug::Printf("Interface 0 opened");
+			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1236_DEVICEINSERTEDL_DUP06, "Interface 0 opened");
 		
 																
-			RDebug::Printf("Obtaining token for interface 1");
+			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1236_DEVICEINSERTEDL_DUP07, "Obtaining token for interface 1");
 			err = testDevice.Device().GetTokenForInterface(1,token2);
 			if(err != KErrNone)
 				{
-				RDebug::Printf("<Error %d> Token for interface 1 could not be retrieved",err);
+				OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1236_DEVICEINSERTEDL_DUP08, "<Error %d> Token for interface 1 could not be retrieved",err);
 				return TestFailed(err);			
 				}	
-			RDebug::Printf("Opening interface 1");
+			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1236_DEVICEINSERTEDL_DUP09, "Opening interface 1");
 			err = iUsbInterface1.Open(token2); // Alternate interface setting 0
 			if(err != KErrNone)
 				{
-				RDebug::Printf("<Error %d> Interface 1 could not be opened",err);
+				OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1236_DEVICEINSERTEDL_DUP10, "<Error %d> Interface 1 could not be opened",err);
 				return TestFailed(err);
 				}
-			RDebug::Printf("Interface 1 opened");
+			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1236_DEVICEINSERTEDL_DUP11, "Interface 1 opened");
 	
 			// close it
 			iUsbInterface1.Close();		
-			RDebug::Printf("Interface 1 closed");
+			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1236_DEVICEINSERTEDL_DUP12, "Interface 1 closed");
 	
 			//re-open now
 			err = iUsbInterface1.Open(token2); // Alternate interface setting 0
 			if(err != KErrNone)
 				{
-				RDebug::Printf("<Error %d> Interface 1 could not be re-opened",err);
+				OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1236_DEVICEINSERTEDL_DUP13, "<Error %d> Interface 1 could not be re-opened",err);
 				return TestFailed(err);
 				}
-			RDebug::Printf("Interface 1 re-opened");
+			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1236_DEVICEINSERTEDL_DUP14, "Interface 1 re-opened");
 			
 
 			
@@ -195,14 +209,14 @@
 			u16String.SetLength(interfaceString.Length()/2);
 			if (u16String.Compare(_L16("i1s0")) == 0)
 				{
-				RDebug::Printf("interface String match");
+				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1236_DEVICEINSERTEDL_DUP15, "interface String match");
 				iCaseStep = EPassed;
 				TTestCasePassed request;
 				iControlEp0->SendRequest(request,this);
 				}
 			else
 				{
-				RDebug::Printf("interface String not match %S", &interfaceString);
+				OstTraceExt1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1236_DEVICEINSERTEDL_DUP16, "interface String not match %s", interfaceString);
 				iCaseStep = EFailed;
 				TTestCaseFailed request(KErrCompletion, _L8("interface string not match"));
 				iControlEp0->SendRequest(request,this);
@@ -214,42 +228,46 @@
 			TestFailed(KErrCorrupt);
 			break;
 		}	
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1236_DEVICEINSERTEDL_EXIT_DUP01, this );
 	}
 
 
 	
 void CUT_PBASE_T_USBDI_1236::DeviceRemovedL(TUint aDeviceHandle)
 	{
-	LOG_FUNC
+    OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_1236_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_1236_DEVICEREMOVEDL_EXIT, this );
 	}
 	
 	
 void CUT_PBASE_T_USBDI_1236::BusErrorL(TInt aError)
 	{
-	LOG_FUNC
+    OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_1236_BUSERRORL_ENTRY, this );
 
 	// This test case handles no failiures on the bus
 
 	TestFailed(aError);
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1236_BUSERRORL_EXIT, this );
 	}
 	
 void CUT_PBASE_T_USBDI_1236::DeviceStateChangeL(RUsbDevice::TDeviceState aPreviousState,RUsbDevice::TDeviceState aNewState,TInt aCompletionCode)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_1236_DEVICESTATECHANGEL_ENTRY, this );
 	Cancel();
-	RDebug::Printf("Device State change from %d to %d err=%d",aPreviousState,aNewState,aCompletionCode);
+	OstTraceExt3(TRACE_NORMAL, CUT_PBASE_T_USBDI_1236_DEVICESTATECHANGEL, "Device State change from %d to %d err=%d",aPreviousState,aNewState,aCompletionCode);
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1236_DEVICESTATECHANGEL_EXIT, this );
 	}
 
 
 void CUT_PBASE_T_USBDI_1236::Ep0TransferCompleteL(TInt aCompletionCode)
 	{
-	LOG_FUNC
-	RDebug::Printf("Ep0TransferCompleteL with aCompletionCode = %d",aCompletionCode);
+	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_1236_EP0TRANSFERCOMPLETEL_ENTRY, this );
+	OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1236_EP0TRANSFERCOMPLETEL, "Ep0TransferCompleteL with aCompletionCode = %d",aCompletionCode);
 	switch(iCaseStep)
 		{
 		// Fail the test case
@@ -264,12 +282,13 @@
 			TestPassed();
 			break;
 			}
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1236_EP0TRANSFERCOMPLETEL_EXIT, this );
 	}
 
 
 void CUT_PBASE_T_USBDI_1236::HostRunL()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1236_HOSTRUNL_ENTRY, this );
 	
 	// Obtain the completion code
 	TInt completionCode(iStatus.Int());
@@ -277,20 +296,21 @@
 	if(completionCode == KErrNone)
 		{
 		// Action timeout
-		RDebug::Printf("<Error> Action timeout");
+		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1236_HOSTRUNL, "<Error> Action timeout");
 		TestFailed(KErrTimedOut);
 		}
 	else
 		{
-		RDebug::Printf("<Error %d> Timeout timer could not complete",completionCode);
+		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1236_HOSTRUNL_DUP01, "<Error %d> Timeout timer could not complete",completionCode);
 		TestFailed(completionCode);
 		}
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1236_HOSTRUNL_EXIT, this );
 	}
 	
 
 void CUT_PBASE_T_USBDI_1236::DeviceRunL()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1236_DEVICERUNL_ENTRY, this );
 	
 	// Disconnect the device
 	
@@ -299,23 +319,26 @@
 	// Complete the test case request
 	
 	TestPolicy().SignalTestComplete(iStatus.Int());
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1236_DEVICERUNL_EXIT, this );
 	}
 
 void CUT_PBASE_T_USBDI_1236::HostDoCancel()
 	{
-	LOG_FUNC
+OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1236_HOSTDOCANCEL_ENTRY, this );
 
 	// Cancel the timeout timer
 	CancelTimeout();
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1236_HOSTDOCANCEL_EXIT, this );
 	}
 
 
 void CUT_PBASE_T_USBDI_1236::DeviceDoCancel()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1236_DEVICEDOCANCEL_ENTRY, this );
 	
 	// Cancel the device	
 	iTestDevice->CancelSubscriptionToReports();
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1236_DEVICEDOCANCEL_EXIT, this );
 	}
 	
 	}