--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/eventhandler.cpp Tue Aug 31 17:01:47 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/eventhandler.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"
@@ -27,32 +27,27 @@
#include "msmmengine.h"
#include "subcommands.h"
#include "msmmnodebase.h"
-#include "OstTraceDefinitions.h"
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "eventhandlerTraces.h"
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, "UsbHostMsmmServer");
#endif
-
-
// Push a sub-command into the queue and transfer the owership
// to the queue
void RSubCommandQueue::PushL(TSubCommandBase* aCommand)
{
- OstTraceFunctionEntry0( RSUBCOMMANDQUEUE_PUSHL_ENTRY );
-
+ LOG_FUNC
CleanupStack::PushL(aCommand);
iQueue.AppendL(aCommand);
CleanupStack::Pop(aCommand);
- OstTraceFunctionExit0( RSUBCOMMANDQUEUE_PUSHL_EXIT );
}
// Pop the head entity from the queue and destroy it
void RSubCommandQueue::Pop()
{
- OstTraceFunctionEntry0( RSUBCOMMANDQUEUE_POP_ENTRY );
+ LOG_FUNC
if (iQueue.Count() == 0)
{
- OstTraceFunctionExit0( RSUBCOMMANDQUEUE_POP_EXIT );
return;
}
@@ -60,45 +55,39 @@
iQueue.Remove(0);
delete command;
command = NULL;
- OstTraceFunctionExit0( RSUBCOMMANDQUEUE_POP_EXIT_DUP1 );
}
// Insert a sub-command sequence after head entities
void RSubCommandQueue::InsertAfterHeadL(TSubCommandBase* aCommand)
{
- OstTraceFunctionEntry0( RSUBCOMMANDQUEUE_INSERTAFTERHEADL_ENTRY );
-
+ LOG_FUNC
if (!aCommand)
{
User::Leave(KErrArgument);
}
iQueue.InsertL(aCommand, 1);
- OstTraceFunctionExit0( RSUBCOMMANDQUEUE_INSERTAFTERHEADL_EXIT );
}
// Execute the head sub-comment
void RSubCommandQueue::ExecuteHeadL()
{
- OstTraceFunctionEntry0( RSUBCOMMANDQUEUE_EXECUTEHEADL_ENTRY );
+ LOG_FUNC
Head().ExecuteL();
- OstTraceFunctionExit0( RSUBCOMMANDQUEUE_EXECUTEHEADL_EXIT );
}
// Get a reference of head sub-command in queue
TSubCommandBase& RSubCommandQueue::Head()
{
- OstTraceFunctionEntry0( RSUBCOMMANDQUEUE_HEAD_ENTRY );
+ LOG_FUNC
return *iQueue[0];
}
// Destory all entities and release the memory of queue
void RSubCommandQueue::Release()
{
- OstTraceFunctionEntry0( RSUBCOMMANDQUEUE_RELEASE_ENTRY );
-
+ LOG_FUNC
iQueue.ResetAndDestroy();
- OstTraceFunctionExit0( RSUBCOMMANDQUEUE_RELEASE_EXIT );
}
/*
@@ -106,43 +95,36 @@
*/
CDeviceEventHandler::~CDeviceEventHandler()
{
- OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_CDEVICEEVENTHANDLER_DES_ENTRY );
-
+ LOG_FUNC
Cancel();
delete iErrNotiData;
iSubCommandQueue.Release();
- OstTraceFunctionExit0( CDEVICEEVENTHANDLER_CDEVICEEVENTHANDLER_DES_EXIT );
}
CDeviceEventHandler* CDeviceEventHandler::NewL(MMsmmSrvProxy& aServer)
{
- OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_NEWL_ENTRY );
-
+ LOG_STATIC_FUNC_ENTRY
CDeviceEventHandler* self = CDeviceEventHandler::NewLC(aServer);
CleanupStack::Pop(self);
- OstTraceFunctionExit0( CDEVICEEVENTHANDLER_NEWL_EXIT );
return self;
}
CDeviceEventHandler* CDeviceEventHandler::NewLC(MMsmmSrvProxy& aServer)
{
- OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_NEWLC_ENTRY );
-
+ LOG_STATIC_FUNC_ENTRY
CDeviceEventHandler* self =
new (ELeave) CDeviceEventHandler(aServer);
CleanupStack::PushL(self);
self->ConstructL();
- OstTraceFunctionExit0( CDEVICEEVENTHANDLER_NEWLC_EXIT );
return self;
}
void CDeviceEventHandler::CreateSubCmdForRetrieveDriveLetterL(
TInt aLogicalUnitCount)
{
- OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_CREATESUBCMDFORRETRIEVEDRIVELETTERL_ENTRY );
-
+ LOG_FUNC
TRetrieveDriveLetter* command(NULL);
THostMsSubCommandParam parameter(iServer, *this, *this, iIncomingEvent);
for (TInt index = 0; index < aLogicalUnitCount; index++)
@@ -150,60 +132,49 @@
command = new (ELeave) TRetrieveDriveLetter(parameter, index);
iSubCommandQueue.PushL(command);
}
- OstTraceFunctionExit0( CDEVICEEVENTHANDLER_CREATESUBCMDFORRETRIEVEDRIVELETTERL_EXIT );
}
void CDeviceEventHandler::CreateSubCmdForMountingLogicalUnitL(TText aDrive,
TInt aLuNumber)
{
- OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_CREATESUBCMDFORMOUNTINGLOGICALUNITL_ENTRY );
-
+ LOG_FUNC
THostMsSubCommandParam parameter(iServer, *this, *this, iIncomingEvent);
TMountLogicalUnit* command = new (ELeave) TMountLogicalUnit(
parameter, aDrive, aLuNumber);
iSubCommandQueue.InsertAfterHeadL(command);
- OstTraceFunctionExit0( CDEVICEEVENTHANDLER_CREATESUBCMDFORMOUNTINGLOGICALUNITL_EXIT );
}
void CDeviceEventHandler::CreateSubCmdForSaveLatestMountInfoL(TText aDrive,
TInt aLuNumber)
{
- OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_CREATESUBCMDFORSAVELATESTMOUNTINFOL_ENTRY );
-
+ LOG_FUNC
THostMsSubCommandParam parameter(iServer, *this, *this, iIncomingEvent);
TSaveLatestMountInfo* command =
new (ELeave) TSaveLatestMountInfo(parameter, aDrive, aLuNumber);
iSubCommandQueue.InsertAfterHeadL(command);
- OstTraceFunctionExit0( CDEVICEEVENTHANDLER_CREATESUBCMDFORSAVELATESTMOUNTINFOL_EXIT );
}
void CDeviceEventHandler::Start()
{
- OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_START_ENTRY );
-
+ LOG_FUNC
if (IsActive())
{
- OstTraceFunctionExit0( CDEVICEEVENTHANDLER_START_EXIT );
return;
}
iStatus = KRequestPending;
SetActive();
- OstTraceFunctionExit0( CDEVICEEVENTHANDLER_START_EXIT_DUP1 );
}
void CDeviceEventHandler::Complete(TInt aError)
{
- OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_COMPLETE_ENTRY );
-
+ LOG_FUNC
TRequestStatus* status = &iStatus;
User::RequestComplete(status, aError);
- OstTraceFunctionExit0( CDEVICEEVENTHANDLER_COMPLETE_EXIT );
}
TRequestStatus& CDeviceEventHandler::Status() const
{
- OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_STATUS_ENTRY );
-
+ LOG_FUNC
const TRequestStatus& status = iStatus;
return const_cast<TRequestStatus&>(status);
}
@@ -211,8 +182,7 @@
void CDeviceEventHandler::HandleEventL(TRequestStatus& aStatus,
const TDeviceEvent& aEvent)
{
- OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_HANDLEEVENTL_ENTRY );
-
+ LOG_FUNC
if (IsActive())
{
// An event is being handled. Currently handler is busy.
@@ -231,7 +201,6 @@
// Start the handler to handle the incoming event
Start();
Complete();
- OstTraceFunctionExit0( CDEVICEEVENTHANDLER_HANDLEEVENTL_EXIT );
}
/*
@@ -240,28 +209,25 @@
void CDeviceEventHandler::DoCancel()
{
- OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_DOCANCEL_ENTRY );
-
+ LOG_FUNC
// Complete client with KErrCancel
CompleteClient(KErrCancel);
// Cancel current pending command
- if (iSubCommandQueue.Count())
+ if (iSubCommandQueue.Count())
{
- iSubCommandQueue.Head().CancelAsyncCmd();
- }
- OstTraceFunctionExit0( CDEVICEEVENTHANDLER_DOCANCEL_EXIT );
+ iSubCommandQueue.Head().CancelAsyncCmd();
+ }
}
void CDeviceEventHandler::RunL( )
{
- OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_RUNL_ENTRY );
+ LOG_FUNC
if (iSubCommandQueue.Count() == 0)
{
// Error occurs in lastest sub-command's DoExecuteL()
// Or current command has been cancelled.
- OstTraceFunctionExit0( CDEVICEEVENTHANDLER_RUNL_EXIT );
return;
}
@@ -283,27 +249,26 @@
// Complete client
CompleteClient();
}
- OstTraceFunctionExit0( CDEVICEEVENTHANDLER_RUNL_EXIT_DUP1 );
}
TInt CDeviceEventHandler::RunError(TInt aError)
{
- OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_RUNERROR_ENTRY );
-
- if (iSubCommandQueue.Count())
+ LOG_FUNC
+
+ if (iSubCommandQueue.Count())
{
- // Retrieve sub-command related error notification data
- iSubCommandQueue.Head().HandleError(*iErrNotiData, aError);
+ // Retrieve sub-command related error notification data
+ iSubCommandQueue.Head().HandleError(*iErrNotiData, aError);
- // If current sub-command isn't a key one, the handler will continue to
- // execute rest sub-command in the queue. But, if current sub-command
- // is the last one in the queue, handler shall complete the client also.
- if (iSubCommandQueue.Head().IsKeyCommand() ||
- (iSubCommandQueue.Count() == 1))
- {
- CompleteClient(aError);
- }
- iSubCommandQueue.Pop();
+ // If current sub-command isn't a key one, the handler will continue to
+ // execute rest sub-command in the queue. But, if current sub-command
+ // is the last one in the queue, handler shall complete the client also.
+ if (iSubCommandQueue.Head().IsKeyCommand() ||
+ (iSubCommandQueue.Count() == 1))
+ {
+ CompleteClient(aError);
+ }
+ iSubCommandQueue.Pop();
}
if( IsActive() )
@@ -316,7 +281,6 @@
Complete();
}
- OstTraceFunctionExit0( CDEVICEEVENTHANDLER_RUNERROR_EXIT );
return KErrNone;
}
@@ -325,25 +289,20 @@
CActive(EPriorityStandard),
iServer(aServer)
{
- OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_CDEVICEEVENTHANDLER_ENTRY );
-
+ LOG_FUNC
CActiveScheduler::Add(this);
- OstTraceFunctionExit0( CDEVICEEVENTHANDLER_CDEVICEEVENTHANDLER_EXIT );
}
void CDeviceEventHandler::ConstructL()
{
- OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_CONSTRUCTL_ENTRY );
-
+ LOG_FUNC
iErrNotiData = new (ELeave) THostMsErrData;
ResetHandler();
- OstTraceFunctionExit0( CDEVICEEVENTHANDLER_CONSTRUCTL_EXIT );
}
void CDeviceEventHandler::CreateSubCmdForDeviceEventL()
{
- OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_CREATESUBCMDFORDEVICEEVENTL_ENTRY );
-
+ LOG_FUNC
switch (iIncomingEvent.iEvent)
{
case EDeviceEventAddFunction:
@@ -353,23 +312,19 @@
CreateSubCmdForRemovingUsbMsDeviceL();
break;
}
- OstTraceFunctionExit0( CDEVICEEVENTHANDLER_CREATESUBCMDFORDEVICEEVENTL_EXIT );
}
void CDeviceEventHandler::CreateSubCmdForAddingUsbMsFunctionL()
{
- OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_CREATESUBCMDFORADDINGUSBMSFUNCTIONL_ENTRY );
-
+ LOG_FUNC
THostMsSubCommandParam parameter(iServer, *this, *this, iIncomingEvent);
TRegisterInterface* command = new (ELeave) TRegisterInterface(parameter);
iSubCommandQueue.PushL(command);
- OstTraceFunctionExit0( CDEVICEEVENTHANDLER_CREATESUBCMDFORADDINGUSBMSFUNCTIONL_EXIT );
}
void CDeviceEventHandler::CreateSubCmdForRemovingUsbMsDeviceL()
{
- OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_CREATESUBCMDFORREMOVINGUSBMSDEVICEL_ENTRY );
-
+ LOG_FUNC
CMsmmEngine& engine = iServer.Engine();
TUsbMsDevice* device = engine.SearchDevice(iIncomingEvent.iDeviceId);
if (!device)
@@ -397,22 +352,18 @@
TRemoveUsbMsDeviceNode* removeNode =
new (ELeave) TRemoveUsbMsDeviceNode(parameter, device);
iSubCommandQueue.PushL(removeNode);
- OstTraceFunctionExit0( CDEVICEEVENTHANDLER_CREATESUBCMDFORREMOVINGUSBMSDEVICEL_EXIT );
}
void CDeviceEventHandler::ResetHandler()
{
- OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_RESETHANDLER_ENTRY );
-
+ LOG_FUNC
ResetHandlerData();
ResetHandlerError();
- OstTraceFunctionExit0( CDEVICEEVENTHANDLER_RESETHANDLER_EXIT );
}
void CDeviceEventHandler::ResetHandlerData()
{
- OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_RESETHANDLERDATA_ENTRY );
-
+ LOG_FUNC
// Reset event buffer
iIncomingEvent.iDeviceId = 0;
iIncomingEvent.iEvent = EDeviceEventEndMark;
@@ -420,30 +371,25 @@
// Destory sub-command queue
iSubCommandQueue.Release();
- OstTraceFunctionExit0( CDEVICEEVENTHANDLER_RESETHANDLERDATA_EXIT );
}
void CDeviceEventHandler::ResetHandlerError()
{
- OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_RESETHANDLERERROR_ENTRY );
-
+ LOG_FUNC
// Reset error notification data
iErrNotiData->iDriveName = 0x0;
iErrNotiData->iError = EHostMsErrorEndMarker;
iErrNotiData->iE32Error = KErrNone;
iErrNotiData->iManufacturerString.Zero();
- OstTraceFunctionExit0( CDEVICEEVENTHANDLER_RESETHANDLERERROR_EXIT );
}
void CDeviceEventHandler::CompleteClient(TInt aError/* = KErrNone*/)
{
- OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_COMPLETECLIENT_ENTRY );
-
+ LOG_FUNC
if (iEvtQueueStatus)
{
User::RequestComplete(iEvtQueueStatus, aError);
}
- OstTraceFunctionExit0( CDEVICEEVENTHANDLER_COMPLETECLIENT_EXIT );
}
// End of file