usbmgmt/usbmgr/usbman/server/SRC/cusbhost.cpp
branchRCL_3
changeset 16 012cc2ee6408
parent 15 f92a4f87e424
--- a/usbmgmt/usbmgr/usbman/server/SRC/cusbhost.cpp	Tue Aug 31 17:01:47 2010 +0300
+++ b/usbmgmt/usbmgr/usbman/server/SRC/cusbhost.cpp	Wed Sep 01 12:35:00 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -15,14 +15,14 @@
 *
 */
 
+#include "cusbhost.h"
 #include <usb/usblogger.h>
-#include "cusbhost.h"
-#include "OstTraceDefinitions.h"
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "cusbhostTraces.h"
+
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, "usbhost");
 #endif
 
-
 CUsbHost* CUsbHost::iInstance = 0;
 
 CUsbHost* CUsbHost::NewL()
@@ -39,7 +39,7 @@
 
 CUsbHost::~CUsbHost()
 	{
-    OstTraceFunctionEntry0( CUSBHOST_CUSBHOST_DES_ENTRY );
+	LOG_FUNC
 
 	Stop();
 
@@ -51,37 +51,30 @@
 		}
 	iObservers.Close();
 	iInstance = 0;
-	OstTraceFunctionExit0( CUSBHOST_CUSBHOST_DES_EXIT );
 	}
 
 CUsbHost::CUsbHost()
 	{
-    OstTraceFunctionEntry0( CUSBHOST_CUSBHOST_CONS_ENTRY );
-	OstTraceFunctionExit0( CUSBHOST_CUSBHOST_CONS_EXIT );
+	LOG_FUNC
 	}
 
 void CUsbHost::ConstructL()
 	{
-    OstTraceFunctionEntry0( CUSBHOST_CONSTRUCTL_ENTRY );
+	LOG_FUNC
 
 	iUsbHostWatcher[EHostEventMonitor] = 
 			CActiveUsbHostEventWatcher::NewL(iUsbHostStack,*this,iHostEventInfo);
 	iUsbHostWatcher[EHostMessageMonitor] = 
 			CActiveUsbHostMessageWatcher::NewL(iUsbHostStack,*this,iHostMessage);
-	OstTraceFunctionExit0( CUSBHOST_CONSTRUCTL_EXIT );
 	}
 void CUsbHost::StartL()
 	{
-	OstTraceFunctionEntry0( CUSBHOST_STARTL_ENTRY );
+	LOG_FUNC
 
 	if(!iHasBeenStarted)
 		{
-		TInt err = iUsbHostStack.Connect();
-		if(err < 0)
-		    {
-            OstTrace1( TRACE_NORMAL, CUSBHOST_STARTL, "CUsbHost::StartL; iUsbHostStack.Connect() error. Leave error=%d", err );
-            User::Leave(err);
-		    }
+
+		LEAVEIFERRORL(iUsbHostStack.Connect());
 
 		for(TInt i=0;i<ENumMonitor;i++)
 			{
@@ -89,12 +82,11 @@
 			}
 		iHasBeenStarted = ETrue;
 		}
-	OstTraceFunctionExit0( CUSBHOST_STARTL_EXIT );
 	}
 
 void CUsbHost::Stop()
 	{
-	OstTraceFunctionEntry0( CUSBHOST_STOP_ENTRY );
+	LOG_FUNC
 
 	TInt i=0;
 	for(i=0;i<ENumMonitor;i++)
@@ -108,25 +100,23 @@
 	iUsbHostStack.Close();
 
 	iHasBeenStarted = EFalse;
-	OstTraceFunctionExit0( CUSBHOST_STOP_EXIT );
 	}
 
 void CUsbHost::RegisterObserverL(MUsbOtgHostNotifyObserver& aObserver)
 	{
-	OstTraceFunctionEntry0( CUSBHOST_REGISTEROBSERVERL_ENTRY );
+	LOG_FUNC
 
 	iObservers.AppendL(&aObserver);
 	UpdateNumOfObservers();
-	OstTraceFunctionExit0( CUSBHOST_REGISTEROBSERVERL_EXIT );
 	}
 
 void CUsbHost::DeregisterObserver(MUsbOtgHostNotifyObserver& aObserver)
 	{
-	OstTraceFunctionEntry0( CUSBHOST_DEREGISTEROBSERVER_ENTRY );
+	LOG_FUNC
 	TInt index = iObservers.Find(&aObserver);
 	if(index == KErrNotFound)
 		{
-        OstTrace0( TRACE_NORMAL, CUSBHOST_DEREGISTEROBSERVER, "CUsbHost::DeregisterObserver;  Cannot remove observer, not found" );
+		LOGTEXT(_L8("\t Cannot remove observer, not found"));
 		}
 	else
 		{
@@ -134,12 +124,11 @@
 		}
 
 	UpdateNumOfObservers();
-	OstTraceFunctionExit0( CUSBHOST_DEREGISTEROBSERVER_EXIT );
 	}
 
 TInt CUsbHost::GetSupportedLanguages(TUint aDeviceId,RArray<TUint>& aLangIds)
 	{
-	OstTraceFunctionEntry0( CUSBHOST_GETSUPPORTEDLANGUAGES_ENTRY );
+	LOG_FUNC
 	TInt err = KErrNone;
 	if ( iUsbHostStack.Handle() )
 		{
@@ -149,13 +138,12 @@
 		{
 		err = KErrBadHandle;
 		}
-	OstTraceFunctionExit0( CUSBHOST_GETSUPPORTEDLANGUAGES_EXIT );
 	return err;
 	}
 
 TInt CUsbHost::GetManufacturerStringDescriptor(TUint aDeviceId,TUint aLangId,TName& aString)
 	{
-	OstTraceFunctionEntry0( CUSBHOST_GETMANUFACTURERSTRINGDESCRIPTOR_ENTRY );
+	LOG_FUNC
 	TInt err = KErrNone;
 	if ( iUsbHostStack.Handle() )
 		{
@@ -165,13 +153,12 @@
 		{
 		err = KErrBadHandle;
 		}
-	OstTraceFunctionExit0( CUSBHOST_GETMANUFACTURERSTRINGDESCRIPTOR_EXIT );
 	return err;
 	}
 
 TInt CUsbHost::GetProductStringDescriptor(TUint aDeviceId,TUint aLangId,TName& aString)
 	{
-	OstTraceFunctionEntry0( CUSBHOST_GETPRODUCTSTRINGDESCRIPTOR_ENTRY );
+	LOG_FUNC
 	TInt err = KErrNone;
 	if ( iUsbHostStack.Handle() )
 		{
@@ -181,13 +168,12 @@
 		{
 		err = KErrBadHandle;
 		}
-	OstTraceFunctionExit0( CUSBHOST_GETPRODUCTSTRINGDESCRIPTOR_EXIT );
 	return err;
 	}
 
 TInt CUsbHost::GetOtgDescriptor(TUint aDeviceId, TOtgDescriptor& otgDescriptor)
 	{
-	OstTraceFunctionEntry0( CUSBHOST_GETOTGDESCRIPTOR_ENTRY );
+	LOG_FUNC
 	
 	TInt err(KErrNone);
 	
@@ -200,21 +186,20 @@
 		err = KErrBadHandle;
 		}
 	
-	OstTraceFunctionExit0( CUSBHOST_GETOTGDESCRIPTOR_EXIT );
 	return err;
 	}
 
 void CUsbHost::NotifyHostEvent(TUint aWatcherId)
 	{
-    OstTraceFunctionEntry0( CUSBHOST_NOTIFYHOSTEVENT_ENTRY );
-
+	LOG_FUNC
 	if(aWatcherId == EHostEventMonitor)
 		{
-		OstTrace1( TRACE_NORMAL, CUSBHOST_NOTIFYHOSTEVENT, "CUsbHost::NotifyHostEvent;DeviceId=%d", iHostEventInfo.iDeviceId );
-		OstTrace1( TRACE_NORMAL, CUSBHOST_NOTIFYHOSTEVENT_DUP1, "CUsbHost::NotifyHostEvent;iEventType=%d", iHostEventInfo.iEventType );
-		OstTrace1( TRACE_NORMAL, CUSBHOST_NOTIFYHOSTEVENT_DUP2, "CUsbHost::NotifyHostEvent;TDriverLoadStatus=%d", iHostEventInfo.iDriverLoadStatus );
-		OstTrace1( TRACE_NORMAL, CUSBHOST_NOTIFYHOSTEVENT_DUP3, "CUsbHost::NotifyHostEvent;VID=%d", iHostEventInfo.iVid );
-		OstTrace1( TRACE_NORMAL, CUSBHOST_NOTIFYHOSTEVENT_DUP4, "CUsbHost::NotifyHostEvent;Pid=%d", iHostEventInfo.iPid );
+
+		LOGTEXT2(_L8("\t Device id %d"),iHostEventInfo.iDeviceId);
+		LOGTEXT2(_L8("\t iEventType  %d"),iHostEventInfo.iEventType);
+		LOGTEXT2(_L8("\t TDriverLoadStatus %d"),iHostEventInfo.iDriverLoadStatus);
+		LOGTEXT2(_L8("\t VID %d"),iHostEventInfo.iVid);
+		LOGTEXT2(_L8("\t PID %d"),iHostEventInfo.iPid);
 
 		for(TUint i=0;i<iNumOfObservers;i++)
 			{
@@ -223,26 +208,24 @@
 		}
 	else
 		{
-		OstTrace1( TRACE_NORMAL, CUSBHOST_NOTIFYHOSTEVENT_DUP5, "CUsbHost::NotifyHostEvent;Host Message=%d", iHostMessage );
-		
+		LOGTEXT2(_L8("\t Host Message %d"),iHostMessage);
+
 		for(TUint i=0;i<iNumOfObservers;i++)
 			{
 			iObservers[i]->UsbOtgHostMessage(iHostMessage);
 			}
 		}
-	OstTraceFunctionExit0( CUSBHOST_NOTIFYHOSTEVENT_EXIT );
 	}
 
 void CUsbHost::UpdateNumOfObservers()
 	{
-	OstTraceFunctionEntry0( CUSBHOST_UPDATENUMOFOBSERVERS_ENTRY );
+	LOG_FUNC
 	iNumOfObservers = iObservers.Count();
-	OstTraceFunctionExit0( CUSBHOST_UPDATENUMOFOBSERVERS_EXIT );
 	}
 
 TInt CUsbHost::EnableDriverLoading()
 	{
-	OstTraceFunctionEntry0( CUSBHOST_ENABLEDRIVERLOADING_ENTRY );
+	LOG_FUNC
 	TInt err = KErrNone;
 	if ( iUsbHostStack.Handle() )
 		{
@@ -252,16 +235,14 @@
 		{
 		err = KErrBadHandle;
 		}
-	OstTraceFunctionExit0( CUSBHOST_ENABLEDRIVERLOADING_EXIT );
 	return err;
 	}
 
 void CUsbHost::DisableDriverLoading()
 	{
-	OstTraceFunctionEntry0( CUSBHOST_DISABLEDRIVERLOADING_ENTRY );
+	LOG_FUNC
 	if ( iUsbHostStack.Handle() )
 		{
 		iUsbHostStack.DisableDriverLoading();
 		}
-	OstTraceFunctionExit0( CUSBHOST_DISABLEDRIVERLOADING_EXIT );
 	}