usbmgmt/usbmgr/host/fdf/production/server/src/fdfsession.cpp
changeset 29 59aa7d6e3e0f
parent 0 c9bc50fca66e
child 43 012cc2ee6408
--- a/usbmgmt/usbmgr/host/fdf/production/server/src/fdfsession.cpp	Wed Jul 07 14:16:40 2010 +0800
+++ b/usbmgmt/usbmgr/host/fdf/production/server/src/fdfsession.cpp	Wed Jul 07 15:08:54 2010 +0800
@@ -1,5 +1,5 @@
 /*
-* 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 "Eclipse Public License v1.0"
@@ -28,36 +28,37 @@
 #include "fdfapi.h"
 #include "fdf.h"
 #include "event.h"
-
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "fdf      ");
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "fdfsessionTraces.h"
 #endif
 
 #ifdef _DEBUG
-PANICCATEGORY("fdfsession");
+_LIT(KPanicCategory, "fdfsession");
 #endif
 
 CFdfSession::CFdfSession(CFdf& aFdf, CFdfServer& aServer)
  :	iFdf(aFdf),
 	iServer(aServer)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CFDFSESSION_CFDFSESSION_CONS_ENTRY );
+	
+	OstTraceFunctionExit0( CFDFSESSION_CFDFSESSION_CONS_EXIT );
 	}
 
 CFdfSession::~CFdfSession()
 	{
-	LOG_LINE
-	LOG_FUNC;
-
+	OstTraceFunctionEntry0( CFDFSESSION_CFDFSESSION_DES_ENTRY );
+	
 	iServer.SessionClosed();
+	OstTraceFunctionExit0( CFDFSESSION_CFDFSESSION_DES_EXIT );
 	}
 
 void CFdfSession::ServiceL(const RMessage2& aMessage)
 	{
-	LOG_LINE
-	LOG_FUNC;
-	LOGTEXT2(_L8("\taMessage.Function() = %d"), aMessage.Function());
-
+	OstTraceFunctionEntry0( CFDFSESSION_SERVICEL_ENTRY );
+	OstTrace1( TRACE_NORMAL, CFDFSESSION_SERVICEL, "aMessage.Function() = %d", aMessage.Function() );
+	
 	// Switch on the IPC number and call a 'message handler'. Message handlers
 	// complete aMessage (either with Complete or Panic), or make a note of
 	// the message for later asynchronous completion.
@@ -71,12 +72,22 @@
 		// This is a sync API- check that the message has been completed.
 		// (NB We don't check the converse for async APIs because the message
 		// may have been panicked synchronously.)
-		ASSERT_DEBUG(aMessage.Handle() == 0);
+		if(!(aMessage.Handle() == 0))
+		    {
+            OstTrace0( TRACE_FATAL, CFDFSESSION_SERVICEL_DUP1, 
+                        "Empty aMessage.Handle" );
+            __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+		    }
 		break;
 
 	case EUsbFdfSrvDisableDriverLoading:
 		DisableDriverLoading(aMessage);
-		ASSERT_DEBUG(aMessage.Handle() == 0);
+		if(!(aMessage.Handle() == 0))
+		    {
+		    OstTrace0( TRACE_FATAL, CFDFSESSION_SERVICEL_DUP2, 
+		              "Empty aMessage.Handle" );
+		    __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+		    }
 		break;
 
 	case EUsbFdfSrvNotifyDeviceEvent:
@@ -85,7 +96,12 @@
 
 	case EUsbFdfSrvNotifyDeviceEventCancel:
 		NotifyDeviceEventCancel(aMessage);
-		ASSERT_DEBUG(aMessage.Handle() == 0);
+		if(!(aMessage.Handle() == 0))
+		    {
+		    OstTrace0( TRACE_FATAL, CFDFSESSION_SERVICEL_DUP3, 
+                        "Empty aMessage.Handle" );
+		    __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+		    }
 		break;
 
 	case EUsbFdfSrvNotifyDevmonEvent:
@@ -94,39 +110,71 @@
 
 	case EUsbFdfSrvNotifyDevmonEventCancel:
 		NotifyDevmonEventCancel(aMessage);
-		ASSERT_DEBUG(aMessage.Handle() == 0);
+		if(!(aMessage.Handle() == 0))
+		    {
+		    OstTrace0( TRACE_FATAL, CFDFSESSION_SERVICEL_DUP4, 
+		              "Empty aMessage.Handle" );
+		    __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+		    }
 		break;
 
 	case EUsbFdfSrvGetSingleSupportedLanguageOrNumberOfSupportedLanguages:
 		GetSingleSupportedLanguageOrNumberOfSupportedLanguages(aMessage);
-		ASSERT_DEBUG(aMessage.Handle() == 0);
+		if(!(aMessage.Handle() == 0))
+		    {
+		    OstTrace0( TRACE_FATAL, CFDFSESSION_SERVICEL_DUP5, 
+		               "Empty aMessage.Handle" );
+		    __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+		    }
 		break;
 
 	case EUsbFdfSrvGetSupportedLanguages:
 		GetSupportedLanguages(aMessage);
-		ASSERT_DEBUG(aMessage.Handle() == 0);
+		if(!(aMessage.Handle() == 0))
+		    {
+		    OstTrace0( TRACE_FATAL, CFDFSESSION_SERVICEL_DUP6, 
+		              "Empty aMessage.Handle" );
+		    __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+		    }
 		break;
 
 	case EUsbFdfSrvGetManufacturerStringDescriptor:
 		GetManufacturerStringDescriptor(aMessage);
-		ASSERT_DEBUG(aMessage.Handle() == 0);
+		if(!(aMessage.Handle() == 0))
+		    {
+		    OstTrace0( TRACE_FATAL, CFDFSESSION_SERVICEL_DUP7, 
+		              "Empty aMessage.Handle" );
+		    __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+		    }		
 		break;
 
 	case EUsbFdfSrvGetProductStringDescriptor:
 		GetProductStringDescriptor(aMessage);
-		ASSERT_DEBUG(aMessage.Handle() == 0);
+		if(!(aMessage.Handle() == 0))
+		    {
+		    OstTrace0( TRACE_FATAL, CFDFSESSION_SERVICEL_DUP8, 
+		              "Empty aMessage.Handle" );
+		    __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+		    }
 		break;
 		
 	case EUsbFdfSrvGetOtgDescriptor:
 		GetOtgDeviceDescriptor(aMessage);
-		ASSERT_DEBUG(aMessage.Handle() == 0);
+		if(!(aMessage.Handle() == 0))
+		    {
+		    OstTrace0( TRACE_FATAL, CFDFSESSION_SERVICEL_DUP9, 
+		              "Empty aMessage.Handle" );
+		    __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+		    }
 		break;
 
 	// Heap failure testing APIs.
 	case EUsbFdfSrvDbgFailNext:
 #ifdef _DEBUG
 		{
-		LOGTEXT2(_L8("\tfail next (simulating failure after %d allocation(s))"), aMessage.Int0());
+		OstTrace1( TRACE_NORMAL, CFDFSESSION_SERVICEL_DUP10, 
+		                        "fail next (simulating failure after %d allocation(s))", 
+		                        aMessage.Int0() );
 		if ( aMessage.Int0() == 0 )
 			{
 			__UHEAP_RESET;
@@ -136,7 +184,7 @@
 			__UHEAP_FAILNEXT(aMessage.Int0());
 			}
 		}
-#endif // _DEBUG
+#endif
 		CompleteClient(aMessage, KErrNone);
 		break;
 
@@ -144,60 +192,70 @@
 		{
 		TInt err = KErrNone;
 #ifdef _DEBUG
-		LOGTEXT(_L8("\tallocate on the heap"));
+		OstTrace0( TRACE_NORMAL, CFDFSESSION_SERVICEL_DUP11, "allocate on the heap" );
 		TInt* x = NULL;
 		TRAP(err, x = new(ELeave) TInt);
 		delete x;
-
-#endif // _DEBUG
+#endif
 		CompleteClient(aMessage, err);
 		}
 		break;
 
 	default:
-		PANIC_MSG(aMessage, KUsbFdfServerName, EBadIpc);
+		OstTrace0( TRACE_FATAL, CFDFSESSION_SERVICEL_DUP12, 
+		           "Invalid message function" );
+		aMessage.Panic(KUsbFdfServerName,EBadIpc);
+        
 		break;
 		}
+	OstTraceFunctionExit0( CFDFSESSION_SERVICEL_EXIT );
 	}
 
 void CFdfSession::CompleteClient(const RMessage2& aMessage, TInt aError)
 	{
-	LOGTEXT2(_L8("\tcompleting client message with %d"), aError);
-	aMessage.Complete(aError);
+    OstTrace1( TRACE_NORMAL, CFDFSESSION_COMPLETECLIENT, "completing client message with %d", aError );
+ 	aMessage.Complete(aError);
 	}
 
 void CFdfSession::EnableDriverLoading(const RMessage2& aMessage)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CFDFSESSION_ENABLEDRIVERLOADING_ENTRY );
 
 	iFdf.EnableDriverLoading();
 
 	CompleteClient(aMessage, KErrNone);
+	OstTraceFunctionExit0( CFDFSESSION_ENABLEDRIVERLOADING_EXIT );
 	}
 
 void CFdfSession::DisableDriverLoading(const RMessage2& aMessage)
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CFDFSESSION_DISABLEDRIVERLOADING_ENTRY );
+	
 	iFdf.DisableDriverLoading();
 
 	CompleteClient(aMessage, KErrNone);
+	OstTraceFunctionExit0( CFDFSESSION_DISABLEDRIVERLOADING_EXIT );
 	}
 
 TBool CFdfSession::NotifyDeviceEventOutstanding() const
 	{
 	const TBool ret = ( iNotifyDeviceEventMsg.Handle() != 0 );
-	LOGTEXT2(_L("CFdfSession::NotifyDeviceEventOutstanding returning %d"), ret);
+	OstTrace1( TRACE_NORMAL, CFDFSESSION_NOTIFYDEVICEEVENTOUTSTANDING, 
+	        "CFdfSession::NotifyDeviceEventOutstanding returning %d", ret );
+	
 	return ret;
 	}
 
 void CFdfSession::NotifyDeviceEvent(const RMessage2& aMessage)
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CFDFSESSION_NOTIFYDEVICEEVENT_ENTRY );
+	
 	if ( iNotifyDeviceEventMsg.Handle() )
 		{
-		PANIC_MSG(iNotifyDeviceEventMsg, KUsbFdfServerName, ENotifyDeviceEventAlreadyOutstanding);
+        OstTrace0( TRACE_FATAL, CFDFSESSION_NOTIFYDEVICEEVENT, 
+                "Empty iNotifyDeviceEventMsg" );
+		iNotifyDeviceEventMsg.Panic( KUsbFdfServerName, 
+		        ENotifyDeviceEventAlreadyOutstanding);
 		}
 	else
 		{
@@ -208,68 +266,90 @@
 			CompleteDeviceEventNotification(event);
 			}
 		}
+	OstTraceFunctionExit0( CFDFSESSION_NOTIFYDEVICEEVENT_EXIT );
 	}
 
 void CFdfSession::NotifyDeviceEventCancel(const RMessage2& aMessage)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CFDFSESSION_NOTIFYDEVICEEVENTCANCEL_ENTRY );
 
 	if ( iNotifyDeviceEventMsg.Handle() )
 		{
 		CompleteClient(iNotifyDeviceEventMsg, KErrCancel);
 		}
 	CompleteClient(aMessage, KErrNone);
+	OstTraceFunctionExit0( CFDFSESSION_NOTIFYDEVICEEVENTCANCEL_EXIT );
 	}
 
 void CFdfSession::DeviceEvent(const TDeviceEvent& aEvent)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CFDFSESSION_DEVICEEVENT_ENTRY );
 
 	// This function should only be called if there is a request outstanding.
-	ASSERT_DEBUG(iNotifyDeviceEventMsg.Handle());
-
+	if(!iNotifyDeviceEventMsg.Handle())
+	    {
+	    OstTrace0( TRACE_FATAL, CFDFSESSION_DEVICEEVENT, 
+	                "iNotifyDeviceEventMsg.Handle" );
+	    __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+	    }
 	CompleteDeviceEventNotification(aEvent);
+	OstTraceFunctionExit0( CFDFSESSION_DEVICEEVENT_EXIT );
 	}
 
 void CFdfSession::CompleteDeviceEventNotification(const TDeviceEvent& aEvent)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CFDFSESSION_COMPLETEDEVICEEVENTNOTIFICATION_ENTRY );
+	
 
 	TRAPD(err, CompleteDeviceEventNotificationL(aEvent));
 	if ( err )
 		{
-		PANIC_MSG(iNotifyDeviceEventMsg, KUsbFdfServerName, EBadNotifyDeviceEventData);
+        OstTrace0( TRACE_FATAL, CFDFSESSION_COMPLETEDEVICEEVENTNOTIFICATION, 
+                "CompleteDeviceEventNotificationL error" );
+		iNotifyDeviceEventMsg.Panic( KUsbFdfServerName, 
+		        EBadNotifyDeviceEventData);
 		}
+	OstTraceFunctionExit0( CFDFSESSION_COMPLETEDEVICEEVENTNOTIFICATION_EXIT );
 	}
 
 void CFdfSession::CompleteDeviceEventNotificationL(const TDeviceEvent& aEvent)
 	{
-	LOG_FUNC
-
+    OstTraceFunctionEntry0( CFDFSESSION_COMPLETEDEVICEEVENTNOTIFICATIONL_ENTRY );
+	
 	// iNotifyDeviceEventMsg has one IPC arg: a TDeviceEventInformation
-
-	ASSERT_DEBUG(iNotifyDeviceEventMsg.Handle());
+	if(!iNotifyDeviceEventMsg.Handle())
+	    {
+	    OstTrace0( TRACE_FATAL, CFDFSESSION_COMPLETEDEVICEEVENTNOTIFICATIONL, 
+            "Empty iNotifyDeviceEventMsg.Handle" );
+	    __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+	    }
 
 	TPckg<TDeviceEventInformation> info(aEvent.iInfo);
 	iNotifyDeviceEventMsg.WriteL(0, info);
 
 	CompleteClient(iNotifyDeviceEventMsg, KErrNone);
+	OstTraceFunctionExit0( CFDFSESSION_COMPLETEDEVICEEVENTNOTIFICATIONL_EXIT );
 	}
 
 TBool CFdfSession::NotifyDevmonEventOutstanding() const
 	{
 	const TBool ret = ( iNotifyDevmonEventMsg.Handle() != 0 );
-	LOGTEXT2(_L("CFdfSession::NotifyDevmonEventOutstanding returning %d"), ret);
+	OstTrace1( TRACE_NORMAL, CFDFSESSION_NOTIFYDEVMONEVENTOUTSTANDING, 
+	        "CFdfSession::NotifyDevmonEventOutstanding returning %d", ret );
 	return ret;
 	}
 
 void CFdfSession::NotifyDevmonEvent(const RMessage2& aMessage)
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CFDFSESSION_NOTIFYDEVMONEVENT_ENTRY );
+	
 	if ( iNotifyDevmonEventMsg.Handle() )
 		{
-		PANIC_MSG(iNotifyDevmonEventMsg, KUsbFdfServerName, ENotifyDevmonEventAlreadyOutstanding);
+        OstTrace0( TRACE_FATAL, CFDFSESSION_NOTIFYDEVMONEVENT, 
+	              "iNotifyDevmonEventMsg.Handle should empty" );
+		iNotifyDevmonEventMsg.Panic( KUsbFdfServerName, 
+		        ENotifyDevmonEventAlreadyOutstanding);
+		        
 		}
 	else
 		{
@@ -280,59 +360,80 @@
 			CompleteDevmonEventNotification(event);
 			}
 		}
+	OstTraceFunctionExit0( CFDFSESSION_NOTIFYDEVMONEVENT_EXIT );
 	}
 
 void CFdfSession::NotifyDevmonEventCancel(const RMessage2& aMessage)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CFDFSESSION_NOTIFYDEVMONEVENTCANCEL_ENTRY );
+	
 
 	if ( iNotifyDevmonEventMsg.Handle() )
 		{
 		CompleteClient(iNotifyDevmonEventMsg, KErrCancel);
 		}
 	CompleteClient(aMessage, KErrNone);
+	OstTraceFunctionExit0( CFDFSESSION_NOTIFYDEVMONEVENTCANCEL_EXIT );
 	}
 
 void CFdfSession::DevmonEvent(TInt aError)
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CFDFSESSION_DEVMONEVENT_ENTRY );
+	
 	// This function should only be called if there is a request outstanding.
-	ASSERT_DEBUG(iNotifyDevmonEventMsg.Handle());
+	
+	
+	if(!iNotifyDevmonEventMsg.Handle())
+	    {
+	    OstTrace0( TRACE_FATAL, CFDFSESSION_DEVMONEVENT, 
+	                "Empty iNotifyDevmonEventMsg.Handle()" );
+	    __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+	    }
 
 	CompleteDevmonEventNotification(aError);
+	OstTraceFunctionExit0( CFDFSESSION_DEVMONEVENT_EXIT );
 	}
 
 void CFdfSession::CompleteDevmonEventNotification(TInt aError)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CFDFSESSION_COMPLETEDEVMONEVENTNOTIFICATION_ENTRY );
+	
 
 	TRAPD(err, CompleteDevmonEventNotificationL(aError));
 	if ( err )
 		{
-		PANIC_MSG(iNotifyDevmonEventMsg, KUsbFdfServerName, EBadNotifyDevmonEventData);
+        OstTrace0( TRACE_FATAL, CFDFSESSION_COMPLETEDEVMONEVENTNOTIFICATION, 
+	              "Bad Notify Devmon Event Data" );
+		iNotifyDevmonEventMsg.Panic(KUsbFdfServerName, 
+		        EBadNotifyDevmonEventData);
 		}
+	OstTraceFunctionExit0( CFDFSESSION_COMPLETEDEVMONEVENTNOTIFICATION_EXIT );
 	}
 
 void CFdfSession::CompleteDevmonEventNotificationL(TInt aEvent)
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CFDFSESSION_COMPLETEDEVMONEVENTNOTIFICATIONL_ENTRY );
+	
 	// iNotifyDevmonEventMsg has the following IPC args:
 	// 0- TInt& aError
-
-	ASSERT_DEBUG(iNotifyDevmonEventMsg.Handle());
+	if(!iNotifyDevmonEventMsg.Handle())
+	    {
+	    OstTrace0( TRACE_FATAL, CFDFSESSION_COMPLETEDEVMONEVENTNOTIFICATIONL, 
+	              "Empty iNotifyDevmonEventMsg.Handle" );
+	    __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+	    }
 
 	TPckg<TInt> event(aEvent);
 	iNotifyDevmonEventMsg.WriteL(0, event);
 
 	CompleteClient(iNotifyDevmonEventMsg, KErrNone);
+	OstTraceFunctionExit0( CFDFSESSION_COMPLETEDEVMONEVENTNOTIFICATIONL_EXIT );
 	}
 
 void CFdfSession::GetSingleSupportedLanguageOrNumberOfSupportedLanguages(const RMessage2& aMessage)
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CFDFSESSION_GETSINGLESUPPORTEDLANGUAGEORNUMBEROFSUPPORTEDLANGUAGES_ENTRY );
+	
 	// To save IPC operations between client and server, we make use of the
 	// fact that the majority of devices only support a single language.
 	// The client is expected to have a buffer big enough to hold a single
@@ -348,30 +449,37 @@
 	// them all.
 	TRAPD(err, GetSingleSupportedLanguageOrNumberOfSupportedLanguagesL(aMessage));
 	CompleteClient(aMessage, err);
+	OstTraceFunctionExit0( CFDFSESSION_GETSINGLESUPPORTEDLANGUAGEORNUMBEROFSUPPORTEDLANGUAGES_EXIT );
 	}
 
 void CFdfSession::GetSingleSupportedLanguageOrNumberOfSupportedLanguagesL(const RMessage2& aMessage)
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CFDFSESSION_GETSINGLESUPPORTEDLANGUAGEORNUMBEROFSUPPORTEDLANGUAGESL_ENTRY );
+	
 	const TUint deviceId = aMessage.Int0();
-	LOGTEXT2(_L8("\tdeviceId = %d"), deviceId);
+	OstTrace1( TRACE_NORMAL, CFDFSESSION_GETSINGLESUPPORTEDLANGUAGEORNUMBEROFSUPPORTEDLANGUAGESL, 
+	        "deviceId = %d", deviceId );
 	const RArray<TUint>& langIds = iFdf.GetSupportedLanguagesL(deviceId);
 	const TUint count = langIds.Count();
-	LOGTEXT2(_L8("\tcount = %d"), count);
+	OstTrace1( TRACE_NORMAL, CFDFSESSION_GETSINGLESUPPORTEDLANGUAGEORNUMBEROFSUPPORTEDLANGUAGESL_DUP1, 
+	        "count = %d", count );
 	switch ( count )
 		{
 	case 0:
 		// Nothing to write to the client's address space, complete with
-		LEAVEL(KErrNotFound);
-		break;
+	    OstTrace0( TRACE_NORMAL, CFDFSESSION_GETSINGLESUPPORTEDLANGUAGEORNUMBEROFSUPPORTEDLANGUAGESL_DUP2, 
+                "Nothing to write to the client's address space" );
+		User::Leave(KErrNotFound);
+	    break;
 
 	case 1:
 		{
 		// Write the single supported language to the client, complete with
 		// KErrNone (or error of course, if their buffer isn't big enough).
 		TPckg<TUint> buf(langIds[0]);
-		LEAVEIFERRORL(aMessage.Write(1, buf));
+		TInt err=aMessage.Write(1, buf);
+		LEAVEIFERRORL(err,OstTrace1( TRACE_ERROR, CFDFSESSION_GETSINGLESUPPORTEDLANGUAGEORNUMBEROFSUPPORTEDLANGUAGESL_DUP3, 
+                "aMessage.Write with err: %d", err ););
 		}
 		break;
 
@@ -382,31 +490,40 @@
 		// This is the point at which this mechanism depends on
 		// RMessagePtr2::WriteL itself not leaving with KErrTooBig!
 		TPckg<TUint> buf(count);
-		LEAVEIFERRORL(aMessage.Write(1, buf));
-		LEAVEL(KErrTooBig);
+		TInt error=aMessage.Write(1, buf);
+		
+		LEAVEIFERRORL(error, OstTrace1( TRACE_ERROR, CFDFSESSION_GETSINGLESUPPORTEDLANGUAGEORNUMBEROFSUPPORTEDLANGUAGESL_DUP4, 
+                "aMessage.Write with err: %d", error ););
+		OstTrace0( TRACE_ERROR, CFDFSESSION_GETSINGLESUPPORTEDLANGUAGEORNUMBEROFSUPPORTEDLANGUAGESL_DUP5, 
+                "message error too big" );
+		User::Leave(KErrTooBig);
 		}
 		break;
 		}
+	OstTraceFunctionExit0( CFDFSESSION_GETSINGLESUPPORTEDLANGUAGEORNUMBEROFSUPPORTEDLANGUAGESL_EXIT );
 	}
 
 void CFdfSession::GetSupportedLanguages(const RMessage2& aMessage)
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CFDFSESSION_GETSUPPORTEDLANGUAGES_ENTRY );
+	
 	TRAPD(err, GetSupportedLanguagesL(aMessage));
 	CompleteClient(aMessage, err);
+	OstTraceFunctionExit0( CFDFSESSION_GETSUPPORTEDLANGUAGES_EXIT );
 	}
 
 void CFdfSession::GetSupportedLanguagesL(const RMessage2& aMessage)
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CFDFSESSION_GETSUPPORTEDLANGUAGESL_ENTRY );
+	
 	const TUint deviceId = aMessage.Int0();
-	LOGTEXT2(_L8("\tdeviceId = %d"), deviceId);
+	OstTrace1( TRACE_NORMAL, CFDFSESSION_GETSUPPORTEDLANGUAGESL, 
+	        "deviceId = %d", deviceId );
 	const RArray<TUint>& langIds = iFdf.GetSupportedLanguagesL(deviceId);
 
 	const TUint count = langIds.Count();
-	LOGTEXT2(_L8("\tcount = %d"), count);
+	OstTrace1( TRACE_NORMAL, CFDFSESSION_GETSUPPORTEDLANGUAGESL_DUP1, 
+	        "count = %d", count );
 	RBuf8 buf;
 	buf.CreateL(count * sizeof(TUint));
 	CleanupClosePushL(buf);
@@ -416,38 +533,50 @@
 		}
 
 	// Write back to the client.
-	LEAVEIFERRORL(aMessage.Write(1, buf));
+	TInt err=aMessage.Write(1, buf);
+	LEAVEIFERRORL(err,OstTrace1( TRACE_ERROR, CFDFSESSION_GETSUPPORTEDLANGUAGESL_DUP2, 
+            "aMessage.Write with error: %d", err ););
 	CleanupStack::PopAndDestroy(&buf);
+	OstTraceFunctionExit0( CFDFSESSION_GETSUPPORTEDLANGUAGESL_EXIT );
 	}
 
 void CFdfSession::GetManufacturerStringDescriptor(const RMessage2& aMessage)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CFDFSESSION_GETMANUFACTURERSTRINGDESCRIPTOR_ENTRY );
+	
 
 	GetStringDescriptor(aMessage, EManufacturer);
+	OstTraceFunctionExit0( CFDFSESSION_GETMANUFACTURERSTRINGDESCRIPTOR_EXIT );
 	}
 
 void CFdfSession::GetProductStringDescriptor(const RMessage2& aMessage)
 	{
-	LOG_FUNC
+    OstTraceFunctionEntry0( CFDFSESSION_GETPRODUCTSTRINGDESCRIPTOR_ENTRY );
+    
 
 	GetStringDescriptor(aMessage, EProduct);
+	OstTraceFunctionExit0( CFDFSESSION_GETPRODUCTSTRINGDESCRIPTOR_EXIT );
 	}
 
 void CFdfSession::GetStringDescriptor(const RMessage2& aMessage, TStringType aStringType)
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CFDFSESSION_GETSTRINGDESCRIPTOR_ENTRY );
+	
 	TRAPD(err, GetStringDescriptorL(aMessage, aStringType));
 	CompleteClient(aMessage, err);
+	OstTraceFunctionExit0( CFDFSESSION_GETSTRINGDESCRIPTOR_EXIT );
 	}
 
 void CFdfSession::GetStringDescriptorL(const RMessage2& aMessage, TStringType aStringType)
 	{
-	LOG_FUNC
-
-	ASSERT_DEBUG(aStringType == EManufacturer || aStringType == EProduct);
-
+	OstTraceFunctionEntry0( CFDFSESSION_GETSTRINGDESCRIPTORL_ENTRY );
+	
+	if(!(aStringType == EManufacturer || aStringType == EProduct))
+	    {
+	    OstTrace0( TRACE_FATAL, CFDFSESSION_GETSTRINGDESCRIPTORL, 
+	                    "String Type error" );
+	    __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+	    }
 	TName string;
 	const TUint deviceId = aMessage.Int0();
 	const TUint langId = aMessage.Int1();
@@ -459,13 +588,18 @@
 		{
 		iFdf.GetProductStringDescriptorL(deviceId, langId, string);
 		}
-	LOGTEXT2(_L("\tstring = \"%S\""), &string);
-	LEAVEIFERRORL(aMessage.Write(2, string));
+	OstTraceExt1( TRACE_NORMAL, CFDFSESSION_GETSTRINGDESCRIPTORL_DUP1, 
+	        "string = \"%S\"", string );
+
+	TInt err=aMessage.Write(2, string);
+	LEAVEIFERRORL(err,OstTrace1( TRACE_ERROR, CFDFSESSION_GETSTRINGDESCRIPTORL_DUP2, 
+	        "Message write with err: %d", err ););
+	OstTraceFunctionExit0( CFDFSESSION_GETSTRINGDESCRIPTORL_EXIT );
 	}
 
 void CFdfSession::GetOtgDeviceDescriptor(const RMessage2& aMessage)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CFDFSESSION_GETOTGDEVICEDESCRIPTOR_ENTRY );
 	
 	TOtgDescriptor otgDesc;
 	const TUint deviceId = aMessage.Int0();
@@ -476,4 +610,5 @@
 		err = aMessage.Write(1, buf);
 		}
 	CompleteClient(aMessage, err);
+	OstTraceFunctionExit0( CFDFSESSION_GETOTGDEVICEDESCRIPTOR_EXIT );
 	}