kerneltest/e32test/usbho/t_otgdi/src/t_otgdi_fdfactor.cpp
changeset 253 d37db4dcc88d
parent 0 a41df078684a
child 257 3e88ff8f41d5
--- a/kerneltest/e32test/usbho/t_otgdi/src/t_otgdi_fdfactor.cpp	Tue Aug 24 14:42:58 2010 +0100
+++ b/kerneltest/e32test/usbho/t_otgdi/src/t_otgdi_fdfactor.cpp	Tue Aug 24 14:49:21 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2008-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"
@@ -19,6 +19,10 @@
 */
 
 #include "t_otgdi_fdfactor.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "t_otgdi_fdfactorTraces.h"
+#endif
 #include <Usb.h>
 
 #define LOG_FUNC
@@ -48,7 +52,7 @@
 	TInt err(iDriver.Open());
 	if (err != KErrNone)
 		{
-		RDebug::Print(_L("<Error %d> Unable to open driver channel"),err);
+		OstTrace1(TRACE_NORMAL, CACTORFDF_CONSTRUCTL, "<Error %d> Unable to open driver channel",err);
 		User::Leave(err);
 		}		
 	
@@ -56,7 +60,7 @@
 	if (err != KErrNone)
 		{
 		// Test case did not run successfully
-		RDebug::Print(_L("<Error %d> USB Host stack not starting"),err);		
+		OstTrace1(TRACE_NORMAL, CACTORFDF_CONSTRUCTL_DUP01, "<Error %d> USB Host stack not starting",err);		
 		}
 	}
 
@@ -92,7 +96,7 @@
 void CActorFDF::Monitor()
 	{
 	LOG_FUNC
-	RDebug::Print(_L("Monitoring Bus Events"));
+	OstTrace0(TRACE_NORMAL, CACTORFDF_MONITOR, "Monitoring Bus Events");
 	iDriver.WaitForBusEvent(iBusEvent,iStatus);
 	SetActive();
 	}
@@ -110,14 +114,14 @@
 
 	// Obtain completion code
 	TInt completionCode(iStatus.Int());
-	RDebug::Print(_L("Completion code  : %d"),completionCode);
+	OstTrace1(TRACE_NORMAL, CACTORFDF_RUNL, "Completion code  : %d",completionCode);
 	
 	 if (completionCode == KErrNone)
 		{
 		if (iBusEvent.iEventType == RUsbHubDriver::TBusEvent::EDeviceAttached)
 			{
 			// Device Attached
-			RDebug::Print(_L("Usb device attached: %d"),iBusEvent.iDeviceHandle);
+			OstTrace1(TRACE_NORMAL, CACTORFDF_RUNL_DUP01, "Usb device attached: %d",iBusEvent.iDeviceHandle);
 			
 			// Create the test device object
 			iDevices.InsertL(iBusEvent.iDeviceHandle,CUsbTestDevice::NewL(iDriver,iBusEvent.iDeviceHandle,iObserver));
@@ -129,23 +133,23 @@
 			CUsbTestDevice* newDevice = iDevices.FindL(iBusEvent.iDeviceHandle);
 			if(newDevice)
 				{
-				RDebug::Print(_L("Suspending device %d"),iBusEvent.iDeviceHandle);
+				OstTrace1(TRACE_NORMAL, CACTORFDF_RUNL_DUP02, "Suspending device %d",iBusEvent.iDeviceHandle);
 				TInt err = newDevice->Suspend();
 				if(err)
 					{
-					RDebug::Print(_L("Suspending device %d returned error %d"), iBusEvent.iDeviceHandle, err);
+					OstTraceExt2(TRACE_NORMAL, CACTORFDF_RUNL_DUP03, "Suspending device %d returned error %d", (TInt)iBusEvent.iDeviceHandle, err);
 					}
 				}
 			else
 				{
-				RDebug::Print(_L("Can't find newly attached device %d"),iBusEvent.iDeviceHandle);
+				OstTrace1(TRACE_NORMAL, CACTORFDF_RUNL_DUP04, "Can't find newly attached device %d",iBusEvent.iDeviceHandle);
 				}
 
 			}
 		else if (iBusEvent.iEventType == RUsbHubDriver::TBusEvent::EDeviceRemoved)
 			{
 			// Device Removed
-			RDebug::Print(_L("Usb device removed: %d"),iBusEvent.iDeviceHandle);
+			OstTrace1(TRACE_NORMAL, CACTORFDF_RUNL_DUP05, "Usb device removed: %d",iBusEvent.iDeviceHandle);
 			
 			// Notify observer
 			iObserver.DeviceRemovedL(iBusEvent.iDeviceHandle);
@@ -156,12 +160,12 @@
 			}
 		else
 			{
-			RDebug::Print(_L("<Warning> Bus event %d occured, still monitoring, reason = %d"),iBusEvent.iEventType, iBusEvent.iReason);
+			OstTraceExt2(TRACE_NORMAL, CACTORFDF_RUNL_DUP06, "<Warning> Bus event %d occured, still monitoring, reason = %d",iBusEvent.iEventType, iBusEvent.iReason);
 			}
 		}
 	else
 		{
-		RDebug::Print(_L("<Error %d> Bus event %d"),completionCode,iBusEvent.iEventType);
+		OstTraceExt2(TRACE_NORMAL, CACTORFDF_RUNL_DUP07, "<Error %d> Bus event %d",completionCode,iBusEvent.iEventType);
 		iObserver.BusErrorL(completionCode);
 		}
 	Monitor();	//	Requeue for notification of further bus events
@@ -171,7 +175,7 @@
 TInt CActorFDF::RunError(TInt aError)
 	{
 	LOG_FUNC
-	RDebug::Print(_L("<Error %d> CActorFDF::RunError"),aError);
+	OstTrace1(TRACE_NORMAL, CACTORFDF_RUNERROR, "<Error %d> CActorFDF::RunError",aError);
 	return KErrNone;
 	}
 	
@@ -222,14 +226,14 @@
 	TInt err(iDevice.GetDeviceDescriptor(iDeviceDescriptor));
 	if (err != KErrNone)
 		{
-		RDebug::Print(_L("<Error %d> Getting device (%d) descriptor"),err,iHandle);
+		OstTraceExt2(TRACE_NORMAL, CUSBTESTDEVICE_CONSTRUCTL, "<Error %d> Getting device (%d) descriptor",err,(TInt)iHandle);
 		User::Leave(err);
 		}
 	
 	err = iDevice.GetConfigurationDescriptor(iConfigDescriptor);
 	if (err != KErrNone)
 		{
-		RDebug::Print(_L("<Error %d> Getting device (%d) configuration descriptor"),err,iHandle);
+		OstTraceExt2(TRACE_NORMAL, CUSBTESTDEVICE_CONSTRUCTL_DUP01, "<Error %d> Getting device (%d) configuration descriptor",err,(TInt)iHandle);
 		User::Leave(err);
 		}
 
@@ -237,10 +241,10 @@
 	iPid = iDeviceDescriptor.ProductId();
 	iVid = iDeviceDescriptor.VendorId();
 	
-	RDebug::Print(_L("%dmA configuration maximum power consumption"),iConfigDescriptor.MaxPower()*2);
-	RDebug::Print(_L("%d number of interface(s)"),iConfigDescriptor.NumInterfaces());
-	RDebug::Print(_L("Vendor Id=0x%04x, Product Id=0x%04x"),iVid,iPid);
-	RDebug::Print(_L("TotalLength() = %d"),iConfigDescriptor.TotalLength());
+	OstTrace1(TRACE_NORMAL, CUSBTESTDEVICE_CONSTRUCTL_DUP02, "%dmA configuration maximum power consumption",iConfigDescriptor.MaxPower()*2);
+	OstTrace1(TRACE_NORMAL, CUSBTESTDEVICE_CONSTRUCTL_DUP03, "%d number of interface(s)",iConfigDescriptor.NumInterfaces());
+	OstTraceExt2(TRACE_NORMAL, CUSBTESTDEVICE_CONSTRUCTL_DUP04, "Vendor Id=0x%04x, Product Id=0x%04x",iVid,iPid);
+	OstTrace1(TRACE_NORMAL, CUSBTESTDEVICE_CONSTRUCTL_DUP05, "TotalLength() = %d",iConfigDescriptor.TotalLength());
 
 	// Get changes in device state
 	iDevice.QueueDeviceStateChangeNotification(iCurrentState,iStatus); // iCurrentState now holds the current device state
@@ -297,7 +301,7 @@
 	
 	if ( completionCode != KErrCancel )
 		{
-		RDebug::Print(_L("CUsbTestDevice::RunL completionCode(%d)"),completionCode);
+		OstTrace1(TRACE_NORMAL, CUSBTESTDEVICE_RUNL, "CUsbTestDevice::RunL completionCode(%d)",completionCode);
 		}
 	
 	if(completionCode == KErrNone)
@@ -315,7 +319,7 @@
 	{
 	LOG_FUNC
 
-	RDebug::Print(_L("<Error %d>"),aError);
+	OstTrace1(TRACE_NORMAL, CUSBTESTDEVICE_RUNERROR, "<Error %d>",aError);
 	return KErrNone;
 	}
 
@@ -333,7 +337,7 @@
 	TInt err=iTotgdiProcess.RendezvousCancel(iStatus);
 	if(err)
 		{
-		RDebug::Print(_L("Cancelling Rendezvous completed with %d"),err);
+		OstTrace1(TRACE_NORMAL, CFDFTOTGDIWATCHER_DOCANCEL, "Cancelling Rendezvous completed with %d",err);
 		}
 	}
 	
@@ -341,7 +345,7 @@
 	{
 	//	The t_otgdi process has signalled its rendezvous
 	//	Time to stop the active scheduler, tidy up and go away
-	RDebug::Print(_L("Rendezvous signalled from t_otgdi"));
+	OstTrace0(TRACE_NORMAL, CFDFTOTGDIWATCHER_RUNL, "Rendezvous signalled from t_otgdi");
 	CActiveScheduler::Stop();
 	}
 	
@@ -359,7 +363,7 @@
 	
 	if(err)
 		{
-		RDebug::Print(_L("Couldn't open process handle to t_otgdi.exe"));
+		OstTrace0(TRACE_NORMAL, CFDFTOTGDIWATCHER_CONSTRUCTL, "Couldn't open process handle to t_otgdi.exe");
 		}
 	User::LeaveIfError(err);
 
@@ -370,13 +374,13 @@
 	
 TInt CFdfTOtgdiWatcher::FindTOtgdiProcessName(TFullName& aProcessName)
 	{
-	RDebug::Print(_L("Into FindTOtgdiProcessName"));
+	OstTrace0(TRACE_NORMAL, CFDFTOTGDIWATCHER_FINDTOTGDIPROCESSNAME, "Into FindTOtgdiProcessName");
 	TInt successCode = KErrNotFound;
 	TFindProcess fp;
 	fp.Find(_L("t_otgdi.exe*"));	//	Process name match pattern
 	while(fp.Next(aProcessName)==KErrNone)
 		{
-		RDebug::Print(_L("FDFActor Found process %S"),&aProcessName);
+		OstTraceExt1(TRACE_NORMAL, CFDFTOTGDIWATCHER_FINDTOTGDIPROCESSNAME_DUP01, "FDFActor Found process %S",aProcessName);
 		successCode = KErrNone;
 		}
 	return successCode;
@@ -389,9 +393,9 @@
 	
 CFdfTOtgdiWatcher::~CFdfTOtgdiWatcher()
 	{
-	RDebug::Print(_L("About to call CFdfTOtgdiWatcher::Cancel"));
+	OstTrace0(TRACE_NORMAL, CFDFTOTGDIWATCHER_DCFDFTOTGDIWATCHER, "About to call CFdfTOtgdiWatcher::Cancel");
 	Cancel();
-	RDebug::Print(_L("About to call iTotgdiProcess.Close"));
+	OstTrace0(TRACE_NORMAL, CFDFTOTGDIWATCHER_DCFDFTOTGDIWATCHER_DUP01, "About to call iTotgdiProcess.Close");
 	iTotgdiProcess.Close();
 	}