kerneltest/e32test/usbho/t_usbdi/src/PBASE-T_USBDI-1235.cpp
changeset 259 57b9594f5772
parent 0 a41df078684a
child 257 3e88ff8f41d5
--- a/kerneltest/e32test/usbho/t_usbdi/src/PBASE-T_USBDI-1235.cpp	Wed Aug 18 11:08:29 2010 +0300
+++ b/kerneltest/e32test/usbho/t_usbdi/src/PBASE-T_USBDI-1235.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"
@@ -21,6 +21,10 @@
 #include "testdebug.h"
 #include "modelleddevices.h"
 #include "TestPolicy.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "PBASE-T_USBDI-1235Traces.h"
+#endif
 
 namespace NUnitTesting_USBDI
 	{
@@ -32,10 +36,12 @@
 
 	CUT_PBASE_T_USBDI_1235* CUT_PBASE_T_USBDI_1235::NewL(TBool aHostRole)
 		{
+		OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1235_NEWL_ENTRY, aHostRole );
 		CUT_PBASE_T_USBDI_1235* self = new (ELeave) CUT_PBASE_T_USBDI_1235(aHostRole);
 		CleanupStack::PushL(self);
 		self->ConstructL();
 		CleanupStack::Pop(self);
+		OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1235_NEWL_EXIT, ( TUint )( self ) );
 		return self;
 		}
 
@@ -43,17 +49,21 @@
 		CBaseTestCase(KTestCaseId, aHostRole), iSuspendedI0(EFalse),
 				iSuspendedI1(EFalse)
 		{
+		OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_1235_CUT_PBASE_T_USBDI_1235_ENTRY, this );
+		OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1235_CUT_PBASE_T_USBDI_1235_EXIT, this );
 		}
 
 	void CUT_PBASE_T_USBDI_1235::ConstructL()
 		{
+		OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1235_CONSTRUCTL_ENTRY, this );
 		iTestDevice = new RUsbDeviceA(this);
 		BaseConstructL();
+		OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1235_CONSTRUCTL_EXIT, this );
 		}
 
 	CUT_PBASE_T_USBDI_1235::~CUT_PBASE_T_USBDI_1235()
 		{
-		LOG_FUNC
+        OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1235_CUT_PBASE_T_USBDI_1235_ENTRY_DUP01, this );
 
 		// Cancel any async operations
 
@@ -74,11 +84,12 @@
 			iTestDevice->Close();
 			}
 		delete iTestDevice;
+		OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1235_CUT_PBASE_T_USBDI_1235_EXIT_DUP01, this );
 		}
 
 	void CUT_PBASE_T_USBDI_1235::ExecuteHostTestCaseL()
 		{
-		LOG_FUNC
+        OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1235_EXECUTEHOSTTESTCASEL_ENTRY, this );
 
 		iCaseStep = EInProcess;
 		iActorFDF = CActorFDF::NewL(*this);
@@ -91,11 +102,12 @@
 
 		// Start the connection timeout	
 		TimeoutIn(30);
+		OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1235_EXECUTEHOSTTESTCASEL_EXIT, this );
 		}
 
 	void CUT_PBASE_T_USBDI_1235::ExecuteDeviceTestCaseL()
 		{
-		LOG_FUNC
+        OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1235_EXECUTEDEVICETESTCASEL_ENTRY, this );
 
 		// Construct the device for the test case
 		iTestDevice->OpenL(TestCaseId());
@@ -104,27 +116,30 @@
 
 		// Connect the test device	
 		iTestDevice->SoftwareConnect();
+		OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1235_EXECUTEDEVICETESTCASEL_EXIT, this );
 		}
 
 	void CUT_PBASE_T_USBDI_1235::HostDoCancel()
 		{
-		LOG_FUNC
+        OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1235_HOSTDOCANCEL_ENTRY, this );
 
 		// Cancel the timeout timer
 		CancelTimeout();
+		OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1235_HOSTDOCANCEL_EXIT, this );
 		}
 
 	void CUT_PBASE_T_USBDI_1235::DeviceDoCancel()
 		{
-		LOG_FUNC
+        OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1235_DEVICEDOCANCEL_ENTRY, this );
 
 		// Cancel the device	
 		iTestDevice->CancelSubscriptionToReports();
+		OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1235_DEVICEDOCANCEL_EXIT, this );
 		}
 
 	void CUT_PBASE_T_USBDI_1235::DeviceInsertedL(TUint aDeviceHandle)
 		{
-		LOG_FUNC
+        OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_1235_DEVICEINSERTEDL_ENTRY, this );
 
 		Cancel(); // Cancel the timer
 		TInt err(KErrNone);
@@ -143,6 +158,7 @@
 
 			// Start the connection timeout again
 			TimeoutIn(30);
+			OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1235_DEVICEINSERTEDL_EXIT, this );
 			return;
 			}
 		// Check tree now	
@@ -156,7 +172,7 @@
 				TUint32 token1(0);
 				TUint32 token2(0);
 
-				RDebug::Printf("Obtaining token for interface 0");
+				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1235_DCUT_PBASE_T_USBDI_1235, "Obtaining token for interface 0");
 				err = testDevice.Device().GetTokenForInterface(0, token1);
 				if (err != KErrNone)
 					{
@@ -165,8 +181,8 @@
 							err);
 					return TestFailed(err);
 					}
-				RDebug::Printf("Token 1 (%d) retrieved", token1);
-				RDebug::Printf("Opening interface 0");
+				OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1235_DCUT_PBASE_T_USBDI_1235_DUP01, "Token 1 (%d) retrieved", token1);
+				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1235_DCUT_PBASE_T_USBDI_1235_DUP02, "Opening interface 0");
 				err = iUsbInterface0.Open(token1); // Alternate interface setting 0
 				if (err != KErrNone)
 					{
@@ -174,9 +190,9 @@
 							"<Error %d> Interface 0 could not be opened", err);
 					return TestFailed(err);
 					}
-				RDebug::Printf("Interface 0 opened");
+				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1235_DCUT_PBASE_T_USBDI_1235_DUP03, "Interface 0 opened");
 
-				RDebug::Printf("Obtaining token for interface 1");
+				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1235_DCUT_PBASE_T_USBDI_1235_DUP04, "Obtaining token for interface 1");
 				err = testDevice.Device().GetTokenForInterface(1, token2);
 				if (err != KErrNone)
 					{
@@ -185,7 +201,7 @@
 							err);
 					return TestFailed(err);
 					}
-				RDebug::Printf("Opening interface 1");
+				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1235_DCUT_PBASE_T_USBDI_1235_DUP05, "Opening interface 1");
 				err = iUsbInterface1.Open(token2); // Alternate interface setting 0
 				if (err != KErrNone)
 					{
@@ -193,7 +209,7 @@
 							"<Error %d> Interface 1 could not be opened", err);
 					return TestFailed(err);
 					}
-				RDebug::Printf("Interface 1 opened");
+				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1235_DCUT_PBASE_T_USBDI_1235_DUP06, "Interface 1 opened");
 
 				SuspendDeviceByInterfacesAndCancelWaitForResume();
 
@@ -206,12 +222,13 @@
 				TestFailed(KErrCorrupt);
 				break;
 			}
+		OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1235_DEVICEINSERTEDL_EXIT_DUP01, this );
 		}
 
 	TInt CUT_PBASE_T_USBDI_1235::Interface0ResumedL(TAny* aPtr)
 		{
-		LOG_CFUNC
-		RDebug::Printf("Interface 0 resumed");
+		OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_1235_INTERFACE0RESUMEDL_ENTRY, 0 );
+		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1235_DCUT_PBASE_T_USBDI_1235_DUP07, "Interface 0 resumed");
 		CUT_PBASE_T_USBDI_1235* self =
 				reinterpret_cast<CUT_PBASE_T_USBDI_1235*>(aPtr);
 		TInt completionCode=self->iInterface0Watcher->CompletionCode();
@@ -227,7 +244,7 @@
 				{
 				if (completionCode == KErrCancel)
 					{
-					RDebug::Printf("CancelWaitForResume request: Success <>!",completionCode);
+					OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1235_DCUT_PBASE_T_USBDI_1235_DUP08, "CancelWaitForResume request: Success <%d>!",completionCode);
 				    // do not care the device's status.
 					self->iCaseStep = EPassed;					
 					}
@@ -247,45 +264,49 @@
 				break;
 			};
 
+		OstTraceFunctionExitExt( CUT_PBASE_T_USBDI_1235_INTERFACE0RESUMEDL_EXIT, 0, KErrNone );
 		return KErrNone;
 		}
 
 	TInt CUT_PBASE_T_USBDI_1235::Interface1ResumedL(TAny* aPtr)
 		{
-		LOG_CFUNC
-		RDebug::Printf("Interface 1 resumed");
+		OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_1235_INTERFACE1RESUMEDL_ENTRY, 0 );
+		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1235_DCUT_PBASE_T_USBDI_1235_DUP09, "Interface 1 resumed");
 		CUT_PBASE_T_USBDI_1235* self =
 				reinterpret_cast<CUT_PBASE_T_USBDI_1235*>(aPtr);
 		TInt completionCode = self->iInterface1Watcher->CompletionCode();		
-		RDebug::Printf("watcher 1 iStatus=%d",completionCode);
+		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1235_DCUT_PBASE_T_USBDI_1235_DUP10, "watcher 1 iStatus=%d",completionCode);
 		self->iSuspendedI1 = EFalse;
 		
 		if(self->iCaseStep == EPassed && completionCode == KErrNone )
 			{
-			RDebug::Printf("Device resumed,test passed!");
+			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1235_DCUT_PBASE_T_USBDI_1235_DUP11, "Device resumed,test passed!");
 			self->SendEp0Request(); // stop client;
 			}
 		
+		OstTraceFunctionExitExt( CUT_PBASE_T_USBDI_1235_INTERFACE1RESUMEDL_EXIT, 0, KErrNone );
 		return KErrNone;
 		}
 
 	void CUT_PBASE_T_USBDI_1235::DeviceRemovedL(TUint aDeviceHandle)
 		{
-		LOG_FUNC
+        OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_1235_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_1235_DEVICEREMOVEDL_EXIT, this );
 		}
 
 	void CUT_PBASE_T_USBDI_1235::BusErrorL(TInt aError)
 		{
-		LOG_FUNC
+        OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_1235_BUSERRORL_ENTRY, this );
 
 		// This test case handles no failiures on the bus
 
 		TestFailed(aError);
+		OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1235_BUSERRORL_EXIT, this );
 		}
 
 
@@ -293,7 +314,7 @@
 			RUsbDevice::TDeviceState aPreviousState,
 			RUsbDevice::TDeviceState aNewState, TInt aCompletionCode)
 		{
-		LOG_FUNC
+		OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_1235_DEVICESTATECHANGEL_ENTRY, this );
 		Cancel();
 		
 		// test RInterface , the  RUsbDevice notification logic not used . 
@@ -301,12 +322,13 @@
 				"-Device State change from %d to %d err=%d",
 				aPreviousState, aNewState, aCompletionCode);
 
+		OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1235_DEVICESTATECHANGEL_EXIT, this );
 		}
 
 	void CUT_PBASE_T_USBDI_1235::Ep0TransferCompleteL(TInt aCompletionCode)
 		{
-		LOG_FUNC
-		RDebug::Printf("Ep0TransferCompleteL with aCompletionCode = %d",
+		OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_1235_EP0TRANSFERCOMPLETEL_ENTRY, this );
+		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1235_DCUT_PBASE_T_USBDI_1235_DUP12, "Ep0TransferCompleteL with aCompletionCode = %d",
 				aCompletionCode);
 		switch (iCaseStep)
 			{
@@ -320,11 +342,12 @@
 				TestPassed();
 				break;
 			}
+		OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1235_EP0TRANSFERCOMPLETEL_EXIT, this );
 		}
 
 	void CUT_PBASE_T_USBDI_1235::HostRunL()
 		{
-		LOG_FUNC
+        OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1235_HOSTRUNL_ENTRY, this );
 
 		// Obtain the completion code
 		TInt completionCode(iStatus.Int());
@@ -332,20 +355,21 @@
 		if (completionCode == KErrNone)
 			{
 			// Action timeout
-			RDebug::Printf("<Error> Action timeout");
+			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1235_DCUT_PBASE_T_USBDI_1235_DUP13, "<Error> Action timeout");
 			TestFailed(KErrTimedOut);
 			}
 		else
 			{
-			RDebug::Printf("<Error %d> Timeout timer could not complete",
+			OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1235_DCUT_PBASE_T_USBDI_1235_DUP14, "<Error %d> Timeout timer could not complete",
 					completionCode);
 			TestFailed(completionCode);
 			}
+		OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1235_HOSTRUNL_EXIT, this );
 		}
 
 	void CUT_PBASE_T_USBDI_1235::DeviceRunL()
 		{
-		LOG_FUNC
+        OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1235_DEVICERUNL_ENTRY, this );
 
 		// Disconnect the device
 
@@ -354,36 +378,41 @@
 		// Complete the test case request
 
 		TestPolicy().SignalTestComplete(iStatus.Int());
+		OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1235_DEVICERUNL_EXIT, this );
 		}
 
 	void CUT_PBASE_T_USBDI_1235::SuspendDeviceByInterfacesAndCancelWaitForResume()
 		{
+		OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1235_SUSPENDDEVICEBYINTERFACESANDCANCELWAITFORRESUME_ENTRY, this );
 		// Suspend interface 0
-		RDebug::Printf("Suspending interface 0");
+		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1235_DCUT_PBASE_T_USBDI_1235_DUP15, "Suspending interface 0");
 		iInterface0Watcher->SuspendAndWatch();
 		iSuspendedI0 = ETrue;
 		
 		// Suspend interface 1
-		RDebug::Printf("Suspending interface 1");
+		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1235_DCUT_PBASE_T_USBDI_1235_DUP16, "Suspending interface 1");
 		iInterface1Watcher->SuspendAndWatch();
 		iSuspendedI1 = ETrue;
 		
-		RDebug::Printf("CancelPermitSuspend interface 1");
+		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1235_DCUT_PBASE_T_USBDI_1235_DUP17, "CancelPermitSuspend interface 1");
 		// try to resume device,then host can notify peripheral test passed.
 		iUsbInterface1.CancelPermitSuspend();
 
 		// Only test the CancelWaitForResume() operation 
 		// If we let the devic to suspend ,the periperal site could not receive the test control transfer which test finish result.
         // select interface0 to test the function CancelWaitForResume	
-		RDebug::Printf("CacelWaitForResume interface 0");
+		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1235_DCUT_PBASE_T_USBDI_1235_DUP18, "CacelWaitForResume interface 0");
 		iUsbInterface0.CancelWaitForResume();
 
+		OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1235_SUSPENDDEVICEBYINTERFACESANDCANCELWAITFORRESUME_EXIT, this );
 		}
 	
 	void CUT_PBASE_T_USBDI_1235::SendEp0Request()
 		{		
+		OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1235_SENDEP0REQUEST_ENTRY, this );
 		TTestCasePassed request;
 		iControlEp0->SendRequest(request, this);
+		OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1235_SENDEP0REQUEST_EXIT, this );
 		}
 
 	}//end namespace