usbmgmt/usbmgr/host/fdf/production/server/src/fdfserver.cpp
changeset 29 59aa7d6e3e0f
parent 0 c9bc50fca66e
child 43 012cc2ee6408
--- a/usbmgmt/usbmgr/host/fdf/production/server/src/fdfserver.cpp	Wed Jul 07 14:16:40 2010 +0800
+++ b/usbmgmt/usbmgr/host/fdf/production/server/src/fdfserver.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"
@@ -26,32 +26,36 @@
 #include "utils.h"
 #include "fdfapi.h"
 #include "fdf.h"
-
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "fdf      ");
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "fdfserverTraces.h"
 #endif
 
 #ifdef _DEBUG
-PANICCATEGORY("fdfsrv");
+_LIT(KPanicCategory, "fdfsrv");
 #endif
 
+
 void CFdfServer::NewLC()
 	{
-	LOG_STATIC_FUNC_ENTRY
-
+	OstTraceFunctionEntry0( CFDFSERVER_NEWLC_ENTRY );
+	
 	CFdfServer* self = new(ELeave) CFdfServer;
 	CleanupStack::PushL(self);
 	// StartL is where the kernel checks that there isn't already an instance
 	// of the same server running, so do it before ConstructL.
 	self->StartL(KUsbFdfServerName);
 	self->ConstructL();
+	OstTraceFunctionExit0( CFDFSERVER_NEWLC_EXIT );
 	}
 
 CFdfServer::~CFdfServer()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CFDFSERVER_CFDFSERVER_DES_ENTRY );
+	
 
 	delete iFdf;
+	OstTraceFunctionExit0( CFDFSERVER_CFDFSERVER_DES_EXIT );
 	}
 
 CFdfServer::CFdfServer()
@@ -61,23 +65,25 @@
 
 void CFdfServer::ConstructL()
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CFDFSERVER_CONSTRUCTL_ENTRY );
+	
 	iFdf = CFdf::NewL();
+	OstTraceFunctionExit0( CFDFSERVER_CONSTRUCTL_EXIT );
 	}
 
 CSession2* CFdfServer::NewSessionL(const TVersion& aVersion,
 	const RMessage2& aMessage) const
 	{
-	LOG_LINE
-	LOG_FUNC;
-	LOGTEXT4(_L8("\taVersion = (%d,%d,%d)"), aVersion.iMajor, aVersion.iMinor, aVersion.iBuild);
+	OstTraceFunctionEntry0( CFDFSERVER_NEWSESSIONL_ENTRY );
+	OstTraceExt3( TRACE_NORMAL, CFDFSERVER_NEWSESSIONL, "aVersion = (%d,%d,%d)", aVersion.iMajor, aVersion.iMinor, aVersion.iBuild );
 	(void)aMessage;
 
 	// Check if we already have a session open.
 	if ( iSession )
 		{
-		LEAVEL(KErrInUse);
+		OstTrace0( TRACE_NORMAL, CFDFSERVER_NEWSESSIONL_DUP1, 
+		        "Session in use");
+		User::Leave(KErrInUse);
 		}
 
 	// In the production system, check the secure ID of the prospective
@@ -96,7 +102,8 @@
 	// check OFF to allow any client to pass and thereby break our
 	// architecture.
 	TInt error = ( aMessage.SecureId() == KUsbsvrSecureId ) ? KErrNone : KErrPermissionDenied;
-	LEAVEIFERRORL(error);
+	LEAVEIFERRORL(error,OstTrace0( TRACE_NORMAL, CFDFSERVER_NEWSESSIONL_DUP2, 
+            "SecureId error"););
 #endif // __TEST_FDF__
 
 #endif // __OVER_DUMMYUSBDI__
@@ -108,27 +115,41 @@
 
 	if ( !User::QueryVersionSupported(v, aVersion) )
 		{
-		LEAVEL(KErrNotSupported);
+		OstTrace0( TRACE_NORMAL, CFDFSERVER_NEWSESSIONL_DUP3, 
+                "Version not supported");
+		User::Leave(KErrNotSupported);
 		}
 
 	CFdfServer* ncThis = const_cast<CFdfServer*>(this);
 	ncThis->iSession = new(ELeave) CFdfSession(*iFdf, *ncThis);
-	ASSERT_DEBUG(ncThis->iFdf);
+	if(!ncThis->iFdf)
+	    {
+        OstTrace0( TRACE_FATAL, CFDFSERVER_NEWSESSIONL_DUP4,"ncThis->iFdf is empty"); 
+        __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+	    }
+            
 	ncThis->iFdf->SetSession(iSession);
 
-	LOGTEXT2(_L8("\tiSession = 0x%08x"), iSession);
+	OstTrace1( TRACE_NORMAL, CFDFSERVER_NEWSESSIONL_DUP5, "iSession = 0x%08x", iSession );
+	OstTraceFunctionExit0( CFDFSERVER_NEWSESSIONL_EXIT );
 	return iSession;
 	}
 
 void CFdfServer::SessionClosed()
 	{
-	LOG_FUNC
+    OstTraceFunctionEntry0( CFDFSERVER_SESSIONCLOSED_ENTRY );
 
-	ASSERT_DEBUG(iSession);
+	if(!iSession)
+	    {
+        OstTrace0( TRACE_FATAL, CFDFSERVER_SESSIONCLOSED,"Empty iSession" ); 
+        __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+	    }
+	        
 	iSession = NULL;
 	iFdf->SetSession(NULL);
 
-	LOGTEXT(_L8("\tno remaining sessions- shutting down"));
+	OstTrace0( TRACE_NORMAL, CFDFSERVER_SESSIONCLOSED_DUP1, "no remaining sessions- shutting down" );
+	
 	// This returns control to the server boilerplate in main.cpp. This
 	// destroys all the objects, which includes signalling device detachment
 	// to any extant FDCs.
@@ -137,4 +158,5 @@
 	// that's created immediately before calling CActiveScheduler::Start in
 	// main.cpp.
 	CActiveScheduler::Stop();
+	OstTraceFunctionExit0( CFDFSERVER_SESSIONCLOSED_EXIT );
 	}