kerneltest/e32test/usbho/t_usbdi/src/UsbClientStateWatcher.cpp
changeset 259 57b9594f5772
parent 0 a41df078684a
child 257 3e88ff8f41d5
--- a/kerneltest/e32test/usbho/t_usbdi/src/UsbClientStateWatcher.cpp	Wed Aug 18 11:08:29 2010 +0300
+++ b/kerneltest/e32test/usbho/t_usbdi/src/UsbClientStateWatcher.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"
@@ -17,6 +17,10 @@
 //
 
 #include "UsbClientStateWatcher.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "UsbClientStateWatcherTraces.h"
+#endif
 #include <d32usbc.h>
 #include <e32test.h>
 #include <e32debug.h>
@@ -28,10 +32,12 @@
 
 CUsbClientStateWatcher* CUsbClientStateWatcher::NewL(RDevUsbcClient& aClientDriver,MUsbClientStateObserver& aStateObserver)
 	{
+	OstTraceFunctionEntryExt( CUSBCLIENTSTATEWATCHER_NEWL_ENTRY, 0 );
 	CUsbClientStateWatcher* self = new (ELeave) CUsbClientStateWatcher(aClientDriver,aStateObserver);
 	CleanupStack::PushL(self);
 	self->ConstructL();
 	CleanupStack::Pop(self);
+	OstTraceFunctionExit1( CUSBCLIENTSTATEWATCHER_NEWL_EXIT, ( TUint )( self ) );
 	return self;
 	}
 	
@@ -41,33 +47,41 @@
 	iClientDriver(aClientDriver),
 	iStateObserver(aStateObserver)
 	{
+	OstTraceFunctionEntryExt( CUSBCLIENTSTATEWATCHER_CUSBCLIENTSTATEWATCHER_ENTRY, this );
 	CActiveScheduler::Add(this);
+	OstTraceFunctionExit1( CUSBCLIENTSTATEWATCHER_CUSBCLIENTSTATEWATCHER_EXIT, this );
 	}
 
 
 CUsbClientStateWatcher::~CUsbClientStateWatcher()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry1( CUSBCLIENTSTATEWATCHER_CUSBCLIENTSTATEWATCHER_ENTRY_DUP01, this );
 	Cancel();
+	OstTraceFunctionExit1( CUSBCLIENTSTATEWATCHER_CUSBCLIENTSTATEWATCHER_EXIT_DUP01, this );
 	}
 	
 	
 void CUsbClientStateWatcher::ConstructL()
 	{
-	RDebug::Printf("<Client State Watcher> Watching state of device");
+	OstTraceFunctionEntry1( CUSBCLIENTSTATEWATCHER_CONSTRUCTL_ENTRY, this );
+	OstTrace0(TRACE_NORMAL, CUSBCLIENTSTATEWATCHER_CONSTRUCTL, "<Client State Watcher> Watching state of device");
 	iClientDriver.AlternateDeviceStatusNotify(iStatus,iState);
 	SetActive();
+	OstTraceFunctionExit1( CUSBCLIENTSTATEWATCHER_CONSTRUCTL_EXIT, this );
 	}
 
 
 void CUsbClientStateWatcher::DoCancel()
 	{
+	OstTraceFunctionEntry1( CUSBCLIENTSTATEWATCHER_DOCANCEL_ENTRY, this );
 	// Cancel device status notification
 	iClientDriver.AlternateDeviceStatusNotifyCancel();	
+	OstTraceFunctionExit1( CUSBCLIENTSTATEWATCHER_DOCANCEL_EXIT, this );
 	}
 
 void CUsbClientStateWatcher::RunL()
 	{
+	OstTraceFunctionEntry1( CUSBCLIENTSTATEWATCHER_RUNL_ENTRY, this );
 	// Retrieve the asynchronous completion code
 	TInt completionCode(iStatus.Int());
 	
@@ -83,42 +97,42 @@
 			switch(iState)
 				{
 				case EUsbcDeviceStateUndefined:
-					RDebug::Printf("<Client State> Not attached");
+					OstTrace0(TRACE_NORMAL, CUSBCLIENTSTATEWATCHER_RUNL, "<Client State> Not attached");
 					break;
 				
 				case EUsbcDeviceStateAttached:
-					RDebug::Printf("<Client State> Attached to host but not powered");
+					OstTrace0(TRACE_NORMAL, CUSBCLIENTSTATEWATCHER_RUNL_DUP01, "<Client State> Attached to host but not powered");
 					break;
 					
 				case EUsbcDeviceStatePowered:
-					RDebug::Printf("<Client State> Attached and powered but no reset");
+					OstTrace0(TRACE_NORMAL, CUSBCLIENTSTATEWATCHER_RUNL_DUP02, "<Client State> Attached and powered but no reset");
 					break;
 					
 				case EUsbcDeviceStateDefault:
-					RDebug::Printf("<Client State> Reset but not addressed");
+					OstTrace0(TRACE_NORMAL, CUSBCLIENTSTATEWATCHER_RUNL_DUP03, "<Client State> Reset but not addressed");
 					break;
 					
 				case EUsbcDeviceStateAddress:
-					RDebug::Printf("<Client State> Addressed but not configured");
+					OstTrace0(TRACE_NORMAL, CUSBCLIENTSTATEWATCHER_RUNL_DUP04, "<Client State> Addressed but not configured");
 					break;
 	 
 				case EUsbcDeviceStateConfigured:
-					RDebug::Printf("<Client State> Fully configured");
+					OstTrace0(TRACE_NORMAL, CUSBCLIENTSTATEWATCHER_RUNL_DUP05, "<Client State> Fully configured");
 					break;
 	 
 				case EUsbcDeviceStateSuspended:
-					RDebug::Printf("<Client State> Suspended");
+					OstTrace0(TRACE_NORMAL, CUSBCLIENTSTATEWATCHER_RUNL_DUP06, "<Client State> Suspended");
 					break;
 					
 				case EUsbcNoState: //follow through
 				default:
-					RDebug::Printf("<Client State> Not specified");
+					OstTrace0(TRACE_NORMAL, CUSBCLIENTSTATEWATCHER_RUNL_DUP07, "<Client State> Not specified");
 					break;
 				}
 			}
 		else
 			{
-			RDebug::Printf("<Client State> Notification error %d",completionCode);
+			OstTrace1(TRACE_NORMAL, CUSBCLIENTSTATEWATCHER_RUNL_DUP08, "<Client State> Notification error %d",completionCode);
 			}
 		
 		// Device state change
@@ -128,12 +142,15 @@
 	// Keep asking to be informed for status notifications
 	iClientDriver.AlternateDeviceStatusNotify(iStatus,iState);
 	SetActive();	
+	OstTraceFunctionExit1( CUSBCLIENTSTATEWATCHER_RUNL_EXIT, this );
 	}
 	
 	
 TInt CUsbClientStateWatcher::RunError(TInt aError)
 	{
+	OstTraceFunctionEntryExt( CUSBCLIENTSTATEWATCHER_RUNERROR_ENTRY, this );
 	aError = KErrNone;
+	OstTraceFunctionExitExt( CUSBCLIENTSTATEWATCHER_RUNERROR_EXIT, this, aError );
 	return aError;
 	}
 
@@ -145,10 +162,12 @@
 CAlternateInterfaceSelectionWatcher* CAlternateInterfaceSelectionWatcher::NewL(
 	RDevUsbcClient& aClientDriver,MAlternateSettingObserver& aObserver)
 	{
+	OstTraceFunctionEntryExt( CALTERNATEINTERFACESELECTIONWATCHER_NEWL_ENTRY, 0 );
 	CAlternateInterfaceSelectionWatcher* self = new (ELeave) CAlternateInterfaceSelectionWatcher(aClientDriver,aObserver);
 	CleanupStack::PushL(self);
 	self->ConstructL();
 	CleanupStack::Pop(self);
+	OstTraceFunctionExit1( CALTERNATEINTERFACESELECTIONWATCHER_NEWL_EXIT, ( TUint )( self ) );
 	return self;
 	}
 	
@@ -159,38 +178,43 @@
 	iClientDriver(aClientDriver),
 	iObserver(aObserver)
 	{
+	OstTraceFunctionEntryExt( CALTERNATEINTERFACESELECTIONWATCHER_CALTERNATEINTERFACESELECTIONWATCHER_ENTRY, this );
 	CActiveScheduler::Add(this);
+	OstTraceFunctionExit1( CALTERNATEINTERFACESELECTIONWATCHER_CALTERNATEINTERFACESELECTIONWATCHER_EXIT, this );
 	}
 	
 	
 CAlternateInterfaceSelectionWatcher::~CAlternateInterfaceSelectionWatcher()
 	{
-	LOG_FUNC
+    OstTraceFunctionEntry1( CALTERNATEINTERFACESELECTIONWATCHER_CALTERNATEINTERFACESELECTIONWATCHER_ENTRY_DUP01, this );
 
 	Cancel();
+	OstTraceFunctionExit1( CALTERNATEINTERFACESELECTIONWATCHER_CALTERNATEINTERFACESELECTIONWATCHER_EXIT_DUP01, this );
 	}
 	
 	
 void CAlternateInterfaceSelectionWatcher::ConstructL()
 	{
-	LOG_FUNC
+    OstTraceFunctionEntry1( CALTERNATEINTERFACESELECTIONWATCHER_CONSTRUCTL_ENTRY, this );
 
 	iClientDriver.AlternateDeviceStatusNotify(iStatus,iState);
 	SetActive();	
+	OstTraceFunctionExit1( CALTERNATEINTERFACESELECTIONWATCHER_CONSTRUCTL_EXIT, this );
 	}
 
 
 void CAlternateInterfaceSelectionWatcher::DoCancel()
 	{
-	LOG_FUNC
+    OstTraceFunctionEntry1( CALTERNATEINTERFACESELECTIONWATCHER_DOCANCEL_ENTRY, this );
 
 	iClientDriver.AlternateDeviceStatusNotifyCancel();
+	OstTraceFunctionExit1( CALTERNATEINTERFACESELECTIONWATCHER_DOCANCEL_EXIT, this );
 	}
 	
 	
 void CAlternateInterfaceSelectionWatcher::RunL()
 	{
-	LOG_FUNC
+    OstTraceFunctionEntry1( CALTERNATEINTERFACESELECTIONWATCHER_RUNL_ENTRY, this );
 
 	TInt completionCode(iStatus.Int());
 	
@@ -201,13 +225,15 @@
 	// Keep asking to be informed for status notifications
 	iClientDriver.AlternateDeviceStatusNotify(iStatus,iState);
 	SetActive();	
+	OstTraceFunctionExit1( CALTERNATEINTERFACESELECTIONWATCHER_RUNL_EXIT, this );
 	}
 
 
 TInt CAlternateInterfaceSelectionWatcher::RunError(TInt aError)
 	{
-	LOG_FUNC
+    OstTraceFunctionEntryExt( CALTERNATEINTERFACESELECTIONWATCHER_RUNERROR_ENTRY, this );
 
+	OstTraceFunctionExitExt( CALTERNATEINTERFACESELECTIONWATCHER_RUNERROR_EXIT, this, KErrNone );
 	return KErrNone;
 	}