kerneltest/e32test/usbho/t_usbdi/src/PBASE-T_USBDI-1232.cpp
changeset 259 57b9594f5772
parent 0 a41df078684a
child 257 3e88ff8f41d5
--- a/kerneltest/e32test/usbho/t_usbdi/src/PBASE-T_USBDI-1232.cpp	Wed Aug 18 11:08:29 2010 +0300
+++ b/kerneltest/e32test/usbho/t_usbdi/src/PBASE-T_USBDI-1232.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-1232Traces.h"
+#endif
 
 namespace NUnitTesting_USBDI
 	{
@@ -46,7 +50,7 @@
 
 	void CUT_PBASE_T_USBDI_1232::ConstructL()
 		{
-		RDebug::Printf("====> Constructor entry priority = %d", RThread().Priority());
+		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_CUT_PBASE_T_USBDI_1232, "====> Constructor entry priority = %d", RThread().Priority());
 
 		// Collect existing thread priority (to reinstate later)
 		iPriority = RThread().Priority();
@@ -57,9 +61,8 @@
 
 	CUT_PBASE_T_USBDI_1232::~CUT_PBASE_T_USBDI_1232()
 		{
-		LOG_FUNC
 
-		RDebug::Printf("====> Destructor entry priority = %d", RThread().Priority());
+		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232, "====> Destructor entry priority = %d", RThread().Priority());
 
 		// Reinstate original priority
 
@@ -89,15 +92,14 @@
 
 	void CUT_PBASE_T_USBDI_1232::ExecuteHostTestCaseL()
 		{
-		LOG_FUNC
 
-		RDebug::Printf("====> ExecuteHostTestCaseL entry priority = %d",
+		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP01, "====> ExecuteHostTestCaseL entry priority = %d",
 				RThread().Priority());
 
 		// Bump thread priority for this test only
 
 		RThread().SetPriority(EPriorityAbsoluteHigh);
-		RDebug::Printf("Thread priority raised %d->%d", iPriority, RThread().Priority());
+		OstTraceExt2(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP02, "Thread priority raised %d->%d", iPriority, RThread().Priority());
 
 		iCaseStep = EInProcess;
 		iActorFDF = CActorFDF::NewL(*this);
@@ -114,7 +116,6 @@
 
 	void CUT_PBASE_T_USBDI_1232::ExecuteDeviceTestCaseL()
 		{
-		LOG_FUNC
 
 		// Construct the device for the test case
 		iTestDevice->OpenL(TestCaseId());
@@ -127,9 +128,8 @@
 
 	void CUT_PBASE_T_USBDI_1232::HostDoCancel()
 		{
-		LOG_FUNC
 
-		RDebug::Printf("====> HostDoCancel entry priority = %d", RThread().Priority());
+		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP03, "====> HostDoCancel entry priority = %d", RThread().Priority());
 
 		// Cancel the timeout timer
 		CancelTimeout();
@@ -137,7 +137,6 @@
 
 	void CUT_PBASE_T_USBDI_1232::DeviceDoCancel()
 		{
-		LOG_FUNC
 
 		// Cancel the device	
 		iTestDevice->CancelSubscriptionToReports();
@@ -145,9 +144,8 @@
 
 	void CUT_PBASE_T_USBDI_1232::DeviceInsertedL(TUint aDeviceHandle)
 		{
-		LOG_FUNC
 
-		RDebug::Printf("====> DeviceInsertedL entry priority = %d", RThread().Priority());
+		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP04, "====> DeviceInsertedL entry priority = %d", RThread().Priority());
 
 		Cancel(); // Cancel the timer
 		TInt err(KErrNone);
@@ -179,7 +177,7 @@
 				TUint32 token1(0);
 				TUint32 token2(0);
 
-				RDebug::Printf("Obtaining token for interface 0");
+				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP05, "Obtaining token for interface 0");
 				err = testDevice.Device().GetTokenForInterface(0, token1);
 				if (err != KErrNone)
 					{
@@ -188,8 +186,8 @@
 							err);
 					return TestFailed(err);
 					}
-				RDebug::Printf("Token 1 (%d) retrieved", token1);
-				RDebug::Printf("Opening interface 0");
+				OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP06, "Token 1 (%d) retrieved", token1);
+				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP07, "Opening interface 0");
 				err = iUsbInterface0.Open(token1); // Alternate interface setting 0
 				if (err != KErrNone)
 					{
@@ -197,9 +195,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_1232_DCUT_PBASE_T_USBDI_1232_DUP08, "Interface 0 opened");
 
-				RDebug::Printf("Obtaining token for interface 1");
+				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP09, "Obtaining token for interface 1");
 				err = testDevice.Device().GetTokenForInterface(1, token2);
 				if (err != KErrNone)
 					{
@@ -208,7 +206,7 @@
 							err);
 					return TestFailed(err);
 					}
-				RDebug::Printf("Opening interface 1");
+				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP10, "Opening interface 1");
 				err = iUsbInterface1.Open(token2); // Alternate interface setting 0
 				if (err != KErrNone)
 					{
@@ -216,15 +214,15 @@
 							"<Error %d> Interface 1 could not be opened", err);
 					return TestFailed(err);
 					}
-				RDebug::Printf("Interface 1 opened");
+				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP11, "Interface 1 opened");
 
 				// device go to suspend
 				// Suspend interface 0
-				RDebug::Printf("Suspending interface 0");
+				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP12, "Suspending interface 0");
 				iInterface0Watcher->SuspendAndWatch();
 
 				// Suspend interface 1
-				RDebug::Printf("Suspending interface 1");
+				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP13, "Suspending interface 1");
 				iInterface1Watcher->SuspendAndWatch();
 
 				iCaseStep = ESuspendWhenResuming;
@@ -245,15 +243,14 @@
 
 	TInt CUT_PBASE_T_USBDI_1232::Interface0ResumedL(TAny* aPtr)
 		{
-		LOG_CFUNC
 
-		RDebug::Printf("====> Interface0ResumedL entry priority = %d", RThread().Priority());
+		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP14, "====> Interface0ResumedL entry priority = %d", RThread().Priority());
 
-		RDebug::Printf(" -Interface 0 resumed");
+		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP15, " -Interface 0 resumed");
 		CUT_PBASE_T_USBDI_1232* self =
 				reinterpret_cast<CUT_PBASE_T_USBDI_1232*>(aPtr);
 		TInt completionCode = self->iInterface0Watcher->CompletionCode();
-		RDebug::Printf(" -watcher 0 iStatus=%d",completionCode);
+		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP16, " -watcher 0 iStatus=%d",completionCode);
 
 		switch (self->iCaseStep)
 			{	
@@ -262,12 +259,12 @@
 				{
 				if (completionCode == KErrNone)
 					{
-					RDebug::Printf("Device resume successed,test passed!");
+					OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP17, "Device resume successed,test passed!");
 					self->SendEp0Request(); // stop client site
 					}
 				else
 					{
-					RDebug::Printf("Device resume failed, err = %d ",completionCode);
+					OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP18, "Device resume failed, err = %d ",completionCode);
 					self->iCaseStep = EFailed;
 					self->SendEp0Request();
 					}
@@ -286,20 +283,18 @@
 
 	TInt CUT_PBASE_T_USBDI_1232::Interface1ResumedL(TAny* aPtr)
 		{
-		LOG_CFUNC
 
-		RDebug::Printf("====> Interface1ResumedL entry priority = %d", RThread().Priority());
+		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP19, "====> Interface1ResumedL entry priority = %d", RThread().Priority());
 
-		RDebug::Printf("Interface 1 resumed");
+		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP20, "Interface 1 resumed");
 		CUT_PBASE_T_USBDI_1232* self =
 				reinterpret_cast<CUT_PBASE_T_USBDI_1232*>(aPtr);
-		RDebug::Printf("watcher 1 iStatus=%d", self->iInterface1Watcher->CompletionCode());
+		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP21, "watcher 1 iStatus=%d", self->iInterface1Watcher->CompletionCode());
 		return KErrNone;
 		}
 
 	void CUT_PBASE_T_USBDI_1232::DeviceRemovedL(TUint aDeviceHandle)
 		{
-		LOG_FUNC
 
 		// 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
@@ -309,7 +304,6 @@
 
 	void CUT_PBASE_T_USBDI_1232::BusErrorL(TInt aError)
 		{
-		LOG_FUNC
 
 		// This test case handles no failiures on the bus
 
@@ -320,18 +314,17 @@
 			RUsbDevice::TDeviceState aPreviousState,
 			RUsbDevice::TDeviceState aNewState, TInt aCompletionCode)
 		{
-		LOG_FUNC
 		Cancel();
 
 		// test RInterface , the  RUsbDevice notification logic not used . 
-		RDebug::Printf(" -Device State change from err=%d",aCompletionCode);
+		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP22, " -Device State change from err=%d",aCompletionCode);
 
 		switch (iCaseStep)
 			{
 			case ESuspendWhenResuming:
 				if (aNewState == RUsbDevice::EDeviceSuspended)
 					{
-					RDebug::Printf("====> device has suspended!");
+					OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP23, "====> device has suspended!");
                     
 					SuspendWhenResuming();					
 					}
@@ -340,7 +333,7 @@
 				if (aPreviousState == RUsbDevice::EDeviceSuspended&&aNewState
 						== RUsbDevice::EDeviceSuspended)
 					{
-					RDebug::Printf("====> device suspended again,suspend while resuming succeed!");
+					OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP24, "====> device suspended again,suspend while resuming succeed!");
 					iCaseStep = EPassed;
 					iUsbInterface0.CancelPermitSuspend();
 					}
@@ -359,8 +352,7 @@
 
 	void CUT_PBASE_T_USBDI_1232::Ep0TransferCompleteL(TInt aCompletionCode)
 		{
-		LOG_FUNC
-		RDebug::Printf("Ep0TransferCompleteL with aCompletionCode = %d",
+		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP25, "Ep0TransferCompleteL with aCompletionCode = %d",
 				aCompletionCode);
 		switch (iCaseStep)
 			{
@@ -378,9 +370,8 @@
 
 	void CUT_PBASE_T_USBDI_1232::HostRunL()
 		{
-		LOG_FUNC
 
-		RDebug::Printf("====> HostRunL entry priority = %d", RThread().Priority());
+		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP26, "====> HostRunL entry priority = %d", RThread().Priority());
 
 		// Obtain the completion code
 		TInt completionCode(iStatus.Int());
@@ -388,12 +379,12 @@
 		if (completionCode == KErrNone)
 			{
 			// Action timeout
-			RDebug::Printf("<Error> Action timeout");
+			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP27, "<Error> Action timeout");
 			TestFailed(KErrTimedOut);
 			}
 		else
 			{
-			RDebug::Printf("<Error %d> Timeout timer could not complete",
+			OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP28, "<Error %d> Timeout timer could not complete",
 					completionCode);
 			TestFailed(completionCode);
 			}
@@ -401,7 +392,6 @@
 
 	void CUT_PBASE_T_USBDI_1232::DeviceRunL()
 		{
-		LOG_FUNC
 
 		// Disconnect the device
 
@@ -414,21 +404,21 @@
 
 	void CUT_PBASE_T_USBDI_1232::SuspendWhenResuming()
 		{
-		RDebug::Printf("====> SuspendWhenResuming entry priority = %d",
+		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP29, "====> SuspendWhenResuming entry priority = %d",
 				RThread().Priority());
 
 		// Cancel suspend-in-progress
-		RDebug::Printf("Cancel Suspend interface 0");
+		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP30, "Cancel Suspend interface 0");
 				
 		iUsbInterface0.CancelPermitSuspend();
 		
 		// how to prove, see log? 
 		// Suspend interface 0
-		RDebug::Printf("Suspending interface 0");
+		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP31, "Suspending interface 0");
 		iInterface0Watcher->SuspendAndWatch();			
 
 		// Suspend interface 1
-		RDebug::Printf("Suspending interface 1");
+		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP32, "Suspending interface 1");
 		iInterface1Watcher->SuspendAndWatch();
 
 		iCaseStep = EValidSuspendWhenResuming;