diff -r f92a4f87e424 -r 012cc2ee6408 usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/msmmserver.cpp --- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/msmmserver.cpp Tue Aug 31 17:01:47 2010 +0300 +++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/msmmserver.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" @@ -21,21 +21,19 @@ */ #include "msmmserver.h" +#include #include "msmm_internal_def.h" #include "msmmsession.h" #include "msmmengine.h" #include "eventqueue.h" #include "msmmterminator.h" -#include "msmmdismountusbdrives.h" -#include #include -#include "OstTraceDefinitions.h" -#ifdef OST_TRACE_COMPILER_IN_USE -#include "msmmserverTraces.h" + +#ifdef __FLOG_ACTIVE +_LIT8(KLogComponent, "UsbHostMsmmServer"); #endif - // Static public functions TInt CMsmmServer::ThreadFunction() { @@ -46,7 +44,15 @@ CTrapCleanup* cleanupStack = CTrapCleanup::New(); if (cleanupStack) { +#ifdef __FLOG_ACTIVE + (void)CUsbLog::Connect(); +#endif + TRAP(ret, ThreadFunctionL()); + +#ifdef __FLOG_ACTIVE + CUsbLog::Close(); +#endif delete cleanupStack; } @@ -61,7 +67,7 @@ void CMsmmServer::ThreadFunctionL() { - OstTraceFunctionEntry0( CMSMMSERVER_THREADFUNCTIONL_ENTRY ); + LOG_STATIC_FUNC_ENTRY TSecureId creatorSID = User::CreatorSecureId(); if (KFDFWSecureId != creatorSID) @@ -89,35 +95,13 @@ // Free the server and active scheduler. CleanupStack::PopAndDestroy(2, scheduler); - OstTraceFunctionExit0( CMSMMSERVER_THREADFUNCTIONL_EXIT ); } -CPolicyServer::TCustomResult CMsmmServer::CustomSecurityCheckL( - const RMessage2& aMsg, - TInt& /*aAction*/, - TSecurityInfo& /*aMissing*/) - { - CPolicyServer::TCustomResult returnValue = CPolicyServer::EFail; - - TSecureId ClientSID = aMsg.SecureId(); - - if (KFDFWSecureId == ClientSID) - { - returnValue = CPolicyServer::EPass; - } - else if ((KSidHbDeviceDialogAppServer == ClientSID) && SessionNumber() > 0) - { - returnValue = CPolicyServer::EPass; - } - return returnValue; - } - // Public functions // Construction and destruction CMsmmServer* CMsmmServer::NewLC() { - OstTraceFunctionEntry0( CMSMMSERVER_NEWLC_ENTRY ); - + LOG_STATIC_FUNC_ENTRY CMsmmServer* self = new (ELeave) CMsmmServer(EPriorityHigh); CleanupStack::PushL(self); @@ -125,39 +109,34 @@ self->StartL(KMsmmServerName); self->ConstructL(); - OstTraceFunctionExit0( CMSMMSERVER_NEWLC_EXIT ); return self; } CMsmmServer::~CMsmmServer() { - OstTraceFunctionEntry0( CMSMMSERVER_CMSMMSERVER_DES_ENTRY ); - + LOG_FUNC delete iPolicyPlugin; delete iEventQueue; delete iEngine; delete iTerminator; - delete iDismountErrData; - delete iDismountManager; REComSession::FinalClose(); #ifndef __OVER_DUMMYCOMPONENT__ iFs.RemoveProxyDrive(KPROXYDRIVENAME); iFs.Close(); #endif - OstTraceFunctionExit0( CMSMMSERVER_CMSMMSERVER_DES_EXIT ); } // CMsmmServer APIs CSession2* CMsmmServer::NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const { - OstTraceFunctionEntry0( CMSMMSERVER_NEWSESSIONL_ENTRY ); + LOG_FUNC if (KMaxClientCount <= SessionNumber()) { // There is a connection to MSMM server already. - // Currently design of MSMM can have two clients, one FDF and the other Indicator UI + // Currently design of MSMM allows only one activated client // at any time. User::Leave(KErrInUse); } @@ -180,22 +159,22 @@ TInt CMsmmServer::SessionNumber() const { - OstTraceFunctionEntry0( CMSMMSERVER_SESSIONNUMBER_ENTRY ); + LOG_FUNC + return iNumSessions; } void CMsmmServer::AddSession() { - OstTraceFunctionEntry0( CMSMMSERVER_ADDSESSION_ENTRY ); - + LOG_FUNC + ++iNumSessions; iTerminator->Cancel(); - OstTraceFunctionExit0( CMSMMSERVER_ADDSESSION_EXIT ); } void CMsmmServer::RemoveSession() { - OstTraceFunctionEntry0( CMSMMSERVER_REMOVESESSION_ENTRY ); + LOG_FUNC --iNumSessions; if (iNumSessions == 0) @@ -207,49 +186,25 @@ iTerminator->Cancel(); iTerminator->Start(); } - - OstTraceFunctionExit0( CMSMMSERVER_REMOVESESSION_EXIT ); } - - void CMsmmServer::DismountUsbDrivesL(TUSBMSDeviceDescription& aDevice) - { - OstTraceFunctionEntry0( CMSMMSERVER_DISMOUNTUSBDRIVERSL_ENTRY ); - delete iDismountManager; - iDismountManager = NULL; - iDismountManager= CMsmmDismountUsbDrives::NewL(); - - //Also notify the MSMM plugin of beginning of dismounting - iDismountErrData->iError = EHostMsEjectInProgress; - iDismountErrData->iE32Error = KErrNone; - iDismountErrData->iManufacturerString = aDevice.iManufacturerString; - iDismountErrData->iProductString = aDevice.iProductString; - iDismountErrData->iDriveName = 0x0; - - TRAP_IGNORE(iPolicyPlugin->SendErrorNotificationL(*iDismountErrData)); - - // Start dismounting - iDismountManager->DismountUsbDrives(*iPolicyPlugin, aDevice); - OstTraceFunctionExit0( CMSMMSERVER_DISMOUNTUSBDRIVERSL_EXIT ); - } - // Private functions // CMsmmServer Construction CMsmmServer::CMsmmServer(TInt aPriority) :CPolicyServer(aPriority, KMsmmServerSecurityPolicy, EUnsharableSessions) { - OstTraceFunctionEntry0( CMSMMSERVER_CMSMMSERVER_CONS_ENTRY ); + LOG_FUNC + // } void CMsmmServer::ConstructL() { - OstTraceFunctionEntry0( CMSMMSERVER_CONSTRUCTL_ENTRY ); + LOG_FUNC iEngine = CMsmmEngine::NewL(); iEventQueue = CDeviceEventQueue::NewL(*this); iTerminator = CMsmmTerminator::NewL(*iEventQueue); iPolicyPlugin = CMsmmPolicyPluginBase::NewL(); - iDismountErrData = new (ELeave) THostMsErrData; if (!iPolicyPlugin) { // Not any policy plugin implementation available @@ -270,7 +225,6 @@ // Start automatic shutdown timer iTerminator->Start(); - OstTraceFunctionExit0( CMSMMSERVER_CONSTRUCTL_EXIT ); } // End of file