usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/eventhandler.cpp
branchRCL_3
changeset 16 012cc2ee6408
parent 15 f92a4f87e424
equal deleted inserted replaced
15:f92a4f87e424 16:012cc2ee6408
     1 /*
     1 /*
     2 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    25 #include <usb/usblogger.h>
    25 #include <usb/usblogger.h>
    26 #include "msmmserver.h"
    26 #include "msmmserver.h"
    27 #include "msmmengine.h"
    27 #include "msmmengine.h"
    28 #include "subcommands.h"
    28 #include "subcommands.h"
    29 #include "msmmnodebase.h"
    29 #include "msmmnodebase.h"
    30 #include "OstTraceDefinitions.h"
    30 
    31 #ifdef OST_TRACE_COMPILER_IN_USE
    31 #ifdef __FLOG_ACTIVE
    32 #include "eventhandlerTraces.h"
    32 _LIT8(KLogComponent, "UsbHostMsmmServer");
    33 #endif
    33 #endif
    34 
       
    35 
       
    36 
    34 
    37 // Push a sub-command into the queue and transfer the owership 
    35 // Push a sub-command into the queue and transfer the owership 
    38 // to the queue
    36 // to the queue
    39 void RSubCommandQueue::PushL(TSubCommandBase* aCommand)
    37 void RSubCommandQueue::PushL(TSubCommandBase* aCommand)
    40     {
    38     {
    41     OstTraceFunctionEntry0( RSUBCOMMANDQUEUE_PUSHL_ENTRY );
    39     LOG_FUNC
    42     
       
    43     CleanupStack::PushL(aCommand);
    40     CleanupStack::PushL(aCommand);
    44     iQueue.AppendL(aCommand);
    41     iQueue.AppendL(aCommand);
    45     CleanupStack::Pop(aCommand);
    42     CleanupStack::Pop(aCommand);
    46     OstTraceFunctionExit0( RSUBCOMMANDQUEUE_PUSHL_EXIT );
       
    47     }
    43     }
    48 
    44 
    49 // Pop the head entity from the queue and destroy it
    45 // Pop the head entity from the queue and destroy it
    50 void RSubCommandQueue::Pop()
    46 void RSubCommandQueue::Pop()
    51     {
    47     {
    52     OstTraceFunctionEntry0( RSUBCOMMANDQUEUE_POP_ENTRY );  
    48     LOG_FUNC
    53     if (iQueue.Count() == 0)
    49     if (iQueue.Count() == 0)
    54         {
    50         {
    55         OstTraceFunctionExit0( RSUBCOMMANDQUEUE_POP_EXIT );
       
    56         return;
    51         return;
    57         }
    52         }
    58     
    53     
    59     TSubCommandBase* command = iQueue[0];
    54     TSubCommandBase* command = iQueue[0];
    60     iQueue.Remove(0);
    55     iQueue.Remove(0);
    61     delete command;
    56     delete command;
    62     command = NULL;
    57     command = NULL;
    63     OstTraceFunctionExit0( RSUBCOMMANDQUEUE_POP_EXIT_DUP1 );
       
    64     }
    58     }
    65     
    59     
    66 // Insert a sub-command sequence after head entities
    60 // Insert a sub-command sequence after head entities
    67 void RSubCommandQueue::InsertAfterHeadL(TSubCommandBase* aCommand)
    61 void RSubCommandQueue::InsertAfterHeadL(TSubCommandBase* aCommand)
    68     {
    62     {
    69     OstTraceFunctionEntry0( RSUBCOMMANDQUEUE_INSERTAFTERHEADL_ENTRY );
    63     LOG_FUNC
    70     
       
    71     if (!aCommand)
    64     if (!aCommand)
    72         {
    65         {
    73         User::Leave(KErrArgument);
    66         User::Leave(KErrArgument);
    74         }
    67         }
    75     
    68     
    76     iQueue.InsertL(aCommand, 1);
    69     iQueue.InsertL(aCommand, 1);
    77     OstTraceFunctionExit0( RSUBCOMMANDQUEUE_INSERTAFTERHEADL_EXIT );
       
    78     }
    70     }
    79     
    71     
    80 // Execute the head sub-comment
    72 // Execute the head sub-comment
    81 void RSubCommandQueue::ExecuteHeadL()
    73 void RSubCommandQueue::ExecuteHeadL()
    82     {
    74     {
    83     OstTraceFunctionEntry0( RSUBCOMMANDQUEUE_EXECUTEHEADL_ENTRY );
    75     LOG_FUNC
    84     Head().ExecuteL();
    76     Head().ExecuteL();
    85     OstTraceFunctionExit0( RSUBCOMMANDQUEUE_EXECUTEHEADL_EXIT );
       
    86     }
    77     }
    87     
    78     
    88 // Get a reference of head sub-command in queue
    79 // Get a reference of head sub-command in queue
    89 TSubCommandBase& RSubCommandQueue::Head()
    80 TSubCommandBase& RSubCommandQueue::Head()
    90     {
    81     {
    91     OstTraceFunctionEntry0( RSUBCOMMANDQUEUE_HEAD_ENTRY ); 
    82     LOG_FUNC
    92     return *iQueue[0];
    83     return *iQueue[0];
    93     }
    84     }
    94     
    85     
    95 // Destory all entities and release the memory of queue
    86 // Destory all entities and release the memory of queue
    96 void RSubCommandQueue::Release()
    87 void RSubCommandQueue::Release()
    97     {
    88     {
    98     OstTraceFunctionEntry0( RSUBCOMMANDQUEUE_RELEASE_ENTRY );
    89     LOG_FUNC
    99     
       
   100     iQueue.ResetAndDestroy();
    90     iQueue.ResetAndDestroy();
   101     OstTraceFunctionExit0( RSUBCOMMANDQUEUE_RELEASE_EXIT );
       
   102     }
    91     }
   103 
    92 
   104 /*
    93 /*
   105  *  Public member functions
    94  *  Public member functions
   106  */
    95  */
   107 CDeviceEventHandler::~CDeviceEventHandler()
    96 CDeviceEventHandler::~CDeviceEventHandler()
   108     {
    97     {
   109     OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_CDEVICEEVENTHANDLER_DES_ENTRY );
    98     LOG_FUNC
   110     
       
   111     Cancel();
    99     Cancel();
   112     delete iErrNotiData;
   100     delete iErrNotiData;
   113     iSubCommandQueue.Release();
   101     iSubCommandQueue.Release();
   114     OstTraceFunctionExit0( CDEVICEEVENTHANDLER_CDEVICEEVENTHANDLER_DES_EXIT );
       
   115     }
   102     }
   116 
   103 
   117 CDeviceEventHandler* CDeviceEventHandler::NewL(MMsmmSrvProxy& aServer)
   104 CDeviceEventHandler* CDeviceEventHandler::NewL(MMsmmSrvProxy& aServer)
   118     {
   105     {
   119     OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_NEWL_ENTRY );
   106     LOG_STATIC_FUNC_ENTRY
   120     
       
   121     CDeviceEventHandler* self = CDeviceEventHandler::NewLC(aServer);
   107     CDeviceEventHandler* self = CDeviceEventHandler::NewLC(aServer);
   122     CleanupStack::Pop(self);
   108     CleanupStack::Pop(self);
   123     
   109     
   124     OstTraceFunctionExit0( CDEVICEEVENTHANDLER_NEWL_EXIT );
       
   125     return self;
   110     return self;
   126     }
   111     }
   127 
   112 
   128 CDeviceEventHandler* CDeviceEventHandler::NewLC(MMsmmSrvProxy& aServer)
   113 CDeviceEventHandler* CDeviceEventHandler::NewLC(MMsmmSrvProxy& aServer)
   129     {
   114     {
   130     OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_NEWLC_ENTRY );
   115     LOG_STATIC_FUNC_ENTRY
   131     
       
   132     CDeviceEventHandler* self = 
   116     CDeviceEventHandler* self = 
   133         new (ELeave) CDeviceEventHandler(aServer);
   117         new (ELeave) CDeviceEventHandler(aServer);
   134     CleanupStack::PushL(self);
   118     CleanupStack::PushL(self);
   135     self->ConstructL();
   119     self->ConstructL();
   136     
   120     
   137     OstTraceFunctionExit0( CDEVICEEVENTHANDLER_NEWLC_EXIT );
       
   138     return self;
   121     return self;
   139     }
   122     }
   140 
   123 
   141 void CDeviceEventHandler::CreateSubCmdForRetrieveDriveLetterL(
   124 void CDeviceEventHandler::CreateSubCmdForRetrieveDriveLetterL(
   142         TInt aLogicalUnitCount)
   125         TInt aLogicalUnitCount)
   143     {
   126     {
   144     OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_CREATESUBCMDFORRETRIEVEDRIVELETTERL_ENTRY );
   127     LOG_FUNC
   145     
       
   146     TRetrieveDriveLetter* command(NULL);
   128     TRetrieveDriveLetter* command(NULL);
   147     THostMsSubCommandParam parameter(iServer, *this, *this, iIncomingEvent);
   129     THostMsSubCommandParam parameter(iServer, *this, *this, iIncomingEvent);
   148     for (TInt index = 0; index < aLogicalUnitCount; index++)
   130     for (TInt index = 0; index < aLogicalUnitCount; index++)
   149         {
   131         {
   150         command = new (ELeave) TRetrieveDriveLetter(parameter, index);
   132         command = new (ELeave) TRetrieveDriveLetter(parameter, index);
   151         iSubCommandQueue.PushL(command);
   133         iSubCommandQueue.PushL(command);
   152         }
   134         }
   153     OstTraceFunctionExit0( CDEVICEEVENTHANDLER_CREATESUBCMDFORRETRIEVEDRIVELETTERL_EXIT );
       
   154     }
   135     }
   155 
   136 
   156 void CDeviceEventHandler::CreateSubCmdForMountingLogicalUnitL(TText aDrive, 
   137 void CDeviceEventHandler::CreateSubCmdForMountingLogicalUnitL(TText aDrive, 
   157         TInt aLuNumber)
   138         TInt aLuNumber)
   158     {
   139     {
   159     OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_CREATESUBCMDFORMOUNTINGLOGICALUNITL_ENTRY );
   140     LOG_FUNC
   160     
       
   161     THostMsSubCommandParam parameter(iServer, *this, *this, iIncomingEvent);
   141     THostMsSubCommandParam parameter(iServer, *this, *this, iIncomingEvent);
   162     TMountLogicalUnit* command = new (ELeave) TMountLogicalUnit(
   142     TMountLogicalUnit* command = new (ELeave) TMountLogicalUnit(
   163             parameter, aDrive, aLuNumber);
   143             parameter, aDrive, aLuNumber);
   164     iSubCommandQueue.InsertAfterHeadL(command);
   144     iSubCommandQueue.InsertAfterHeadL(command);
   165     OstTraceFunctionExit0( CDEVICEEVENTHANDLER_CREATESUBCMDFORMOUNTINGLOGICALUNITL_EXIT );
       
   166     }
   145     }
   167 
   146 
   168 void CDeviceEventHandler::CreateSubCmdForSaveLatestMountInfoL(TText aDrive, 
   147 void CDeviceEventHandler::CreateSubCmdForSaveLatestMountInfoL(TText aDrive, 
   169         TInt aLuNumber)
   148         TInt aLuNumber)
   170     {
   149     {
   171     OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_CREATESUBCMDFORSAVELATESTMOUNTINFOL_ENTRY );
   150     LOG_FUNC
   172     
       
   173     THostMsSubCommandParam parameter(iServer, *this, *this, iIncomingEvent);
   151     THostMsSubCommandParam parameter(iServer, *this, *this, iIncomingEvent);
   174     TSaveLatestMountInfo* command = 
   152     TSaveLatestMountInfo* command = 
   175         new (ELeave) TSaveLatestMountInfo(parameter, aDrive, aLuNumber);
   153         new (ELeave) TSaveLatestMountInfo(parameter, aDrive, aLuNumber);
   176     iSubCommandQueue.InsertAfterHeadL(command);
   154     iSubCommandQueue.InsertAfterHeadL(command);
   177     OstTraceFunctionExit0( CDEVICEEVENTHANDLER_CREATESUBCMDFORSAVELATESTMOUNTINFOL_EXIT );
       
   178     }
   155     }
   179 
   156 
   180 void CDeviceEventHandler::Start()
   157 void CDeviceEventHandler::Start()
   181     {
   158     {
   182     OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_START_ENTRY );
   159     LOG_FUNC
   183     
       
   184     if (IsActive())
   160     if (IsActive())
   185         {
   161         {
   186         OstTraceFunctionExit0( CDEVICEEVENTHANDLER_START_EXIT );
       
   187         return;
   162         return;
   188         }
   163         }
   189     iStatus = KRequestPending;
   164     iStatus = KRequestPending;
   190     SetActive();
   165     SetActive();
   191     OstTraceFunctionExit0( CDEVICEEVENTHANDLER_START_EXIT_DUP1 );
       
   192     }
   166     }
   193 
   167 
   194 void CDeviceEventHandler::Complete(TInt aError)
   168 void CDeviceEventHandler::Complete(TInt aError)
   195     {
   169     {
   196     OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_COMPLETE_ENTRY );
   170     LOG_FUNC
   197     
       
   198     TRequestStatus* status = &iStatus;
   171     TRequestStatus* status = &iStatus;
   199     User::RequestComplete(status, aError);
   172     User::RequestComplete(status, aError);
   200     OstTraceFunctionExit0( CDEVICEEVENTHANDLER_COMPLETE_EXIT );
       
   201     }
   173     }
   202 
   174 
   203 TRequestStatus& CDeviceEventHandler::Status() const
   175 TRequestStatus& CDeviceEventHandler::Status() const
   204     {
   176     {
   205     OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_STATUS_ENTRY );
   177     LOG_FUNC
   206     
       
   207     const TRequestStatus& status = iStatus;
   178     const TRequestStatus& status = iStatus;
   208     return const_cast<TRequestStatus&>(status);
   179     return const_cast<TRequestStatus&>(status);
   209     }
   180     }
   210 
   181 
   211 void CDeviceEventHandler::HandleEventL(TRequestStatus& aStatus, 
   182 void CDeviceEventHandler::HandleEventL(TRequestStatus& aStatus, 
   212         const TDeviceEvent& aEvent)
   183         const TDeviceEvent& aEvent)
   213     {
   184     {
   214     OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_HANDLEEVENTL_ENTRY );
   185     LOG_FUNC
   215     
       
   216     if (IsActive())
   186     if (IsActive())
   217         {
   187         {
   218         // An event is being handled. Currently handler is busy.
   188         // An event is being handled. Currently handler is busy.
   219         User::Leave(KErrInUse);
   189         User::Leave(KErrInUse);
   220         }
   190         }
   229     iEvtQueueStatus = &aStatus;
   199     iEvtQueueStatus = &aStatus;
   230     
   200     
   231     // Start the handler to handle the incoming event
   201     // Start the handler to handle the incoming event
   232     Start();
   202     Start();
   233     Complete();
   203     Complete();
   234     OstTraceFunctionExit0( CDEVICEEVENTHANDLER_HANDLEEVENTL_EXIT );
       
   235     }
   204     }
   236 
   205 
   237 /*
   206 /*
   238  * Protected member functions 
   207  * Protected member functions 
   239  */
   208  */
   240 
   209 
   241 void CDeviceEventHandler::DoCancel()
   210 void CDeviceEventHandler::DoCancel()
   242     {
   211     {
   243     OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_DOCANCEL_ENTRY );
   212     LOG_FUNC
   244     
       
   245     // Complete client with KErrCancel
   213     // Complete client with KErrCancel
   246     CompleteClient(KErrCancel);
   214     CompleteClient(KErrCancel);
   247 
   215 
   248     // Cancel current pending command
   216     // Cancel current pending command
   249 	if (iSubCommandQueue.Count())
   217     if (iSubCommandQueue.Count())
   250         {
   218         {
   251 		iSubCommandQueue.Head().CancelAsyncCmd();
   219         iSubCommandQueue.Head().CancelAsyncCmd();
   252     	}
   220         }
   253 	OstTraceFunctionExit0( CDEVICEEVENTHANDLER_DOCANCEL_EXIT );
       
   254     }
   221     }
   255 
   222 
   256 void CDeviceEventHandler::RunL( )
   223 void CDeviceEventHandler::RunL( )
   257     {
   224     {
   258     OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_RUNL_ENTRY );
   225     LOG_FUNC
   259     
   226     
   260     if (iSubCommandQueue.Count() == 0)
   227     if (iSubCommandQueue.Count() == 0)
   261         {
   228         {
   262         // Error occurs in lastest sub-command's DoExecuteL()
   229         // Error occurs in lastest sub-command's DoExecuteL()
   263         // Or current command has been cancelled.
   230         // Or current command has been cancelled.
   264         OstTraceFunctionExit0( CDEVICEEVENTHANDLER_RUNL_EXIT );
       
   265         return;
   231         return;
   266         }
   232         }
   267     
   233     
   268     if (iSubCommandQueue.Head().IsExecuted())
   234     if (iSubCommandQueue.Head().IsExecuted())
   269         {
   235         {
   281         {
   247         {
   282         // Run out of sub-commands. Current handling event achieved.
   248         // Run out of sub-commands. Current handling event achieved.
   283         // Complete client
   249         // Complete client
   284         CompleteClient();
   250         CompleteClient();
   285         }
   251         }
   286     OstTraceFunctionExit0( CDEVICEEVENTHANDLER_RUNL_EXIT_DUP1 );
       
   287     }
   252     }
   288 
   253 
   289 TInt CDeviceEventHandler::RunError(TInt aError)
   254 TInt CDeviceEventHandler::RunError(TInt aError)
   290     {
   255     {
   291     OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_RUNERROR_ENTRY );
   256     LOG_FUNC
   292     
   257 
   293 	if (iSubCommandQueue.Count())
   258     if (iSubCommandQueue.Count())
   294         {
   259         {
   295     	// Retrieve sub-command related error notification data
   260         // Retrieve sub-command related error notification data
   296     	iSubCommandQueue.Head().HandleError(*iErrNotiData, aError);
   261         iSubCommandQueue.Head().HandleError(*iErrNotiData, aError);
   297 
   262 
   298     	// If current sub-command isn't a key one, the handler will continue to
   263         // If current sub-command isn't a key one, the handler will continue to
   299     	// execute rest sub-command in the queue. But, if current sub-command
   264         // execute rest sub-command in the queue. But, if current sub-command
   300     	// is the last one in the queue, handler shall complete the client also. 
   265         // is the last one in the queue, handler shall complete the client also. 
   301     	if (iSubCommandQueue.Head().IsKeyCommand() || 
   266         if (iSubCommandQueue.Head().IsKeyCommand() || 
   302             (iSubCommandQueue.Count() == 1))
   267                 (iSubCommandQueue.Count() == 1))
   303         	{
   268             {
   304         	CompleteClient(aError);
   269             CompleteClient(aError);
   305 			}
   270             }
   306 		iSubCommandQueue.Pop();
   271         iSubCommandQueue.Pop();
   307         }
   272         }
   308 
   273 
   309     if( IsActive() )
   274     if( IsActive() )
   310         {
   275         {
   311         Complete(aError);
   276         Complete(aError);
   314         {
   279         {
   315         Start();
   280         Start();
   316    	    Complete();
   281    	    Complete();
   317         }
   282         }
   318 
   283 
   319     OstTraceFunctionExit0( CDEVICEEVENTHANDLER_RUNERROR_EXIT );
       
   320     return KErrNone;
   284     return KErrNone;
   321     }
   285     }
   322 
   286 
   323 // Private member functions
   287 // Private member functions
   324 CDeviceEventHandler::CDeviceEventHandler(MMsmmSrvProxy& aServer):
   288 CDeviceEventHandler::CDeviceEventHandler(MMsmmSrvProxy& aServer):
   325     CActive(EPriorityStandard),
   289     CActive(EPriorityStandard),
   326     iServer(aServer)
   290     iServer(aServer)
   327     {
   291     {
   328     OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_CDEVICEEVENTHANDLER_ENTRY );
   292     LOG_FUNC
   329     
       
   330     CActiveScheduler::Add(this);
   293     CActiveScheduler::Add(this);
   331     OstTraceFunctionExit0( CDEVICEEVENTHANDLER_CDEVICEEVENTHANDLER_EXIT );
       
   332     }
   294     }
   333 
   295 
   334 void CDeviceEventHandler::ConstructL()
   296 void CDeviceEventHandler::ConstructL()
   335     {
   297     {
   336     OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_CONSTRUCTL_ENTRY );
   298     LOG_FUNC
   337     
       
   338     iErrNotiData = new (ELeave) THostMsErrData;
   299     iErrNotiData = new (ELeave) THostMsErrData;
   339     ResetHandler();
   300     ResetHandler();
   340     OstTraceFunctionExit0( CDEVICEEVENTHANDLER_CONSTRUCTL_EXIT );
       
   341     }
   301     }
   342 
   302 
   343 void CDeviceEventHandler::CreateSubCmdForDeviceEventL()
   303 void CDeviceEventHandler::CreateSubCmdForDeviceEventL()
   344     {
   304     {
   345     OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_CREATESUBCMDFORDEVICEEVENTL_ENTRY );
   305     LOG_FUNC
   346     
       
   347     switch (iIncomingEvent.iEvent)
   306     switch (iIncomingEvent.iEvent)
   348         {
   307         {
   349     case EDeviceEventAddFunction:
   308     case EDeviceEventAddFunction:
   350         CreateSubCmdForAddingUsbMsFunctionL();
   309         CreateSubCmdForAddingUsbMsFunctionL();
   351         break;
   310         break;
   352     case EDeviceEventRemoveDevice:
   311     case EDeviceEventRemoveDevice:
   353         CreateSubCmdForRemovingUsbMsDeviceL();
   312         CreateSubCmdForRemovingUsbMsDeviceL();
   354         break;
   313         break;
   355         }
   314         }
   356     OstTraceFunctionExit0( CDEVICEEVENTHANDLER_CREATESUBCMDFORDEVICEEVENTL_EXIT );
       
   357     }
   315     }
   358 
   316 
   359 void CDeviceEventHandler::CreateSubCmdForAddingUsbMsFunctionL()
   317 void CDeviceEventHandler::CreateSubCmdForAddingUsbMsFunctionL()
   360     {
   318     {
   361     OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_CREATESUBCMDFORADDINGUSBMSFUNCTIONL_ENTRY );
   319     LOG_FUNC
   362     
       
   363     THostMsSubCommandParam parameter(iServer, *this, *this, iIncomingEvent);
   320     THostMsSubCommandParam parameter(iServer, *this, *this, iIncomingEvent);
   364     TRegisterInterface* command = new (ELeave) TRegisterInterface(parameter);
   321     TRegisterInterface* command = new (ELeave) TRegisterInterface(parameter);
   365     iSubCommandQueue.PushL(command);
   322     iSubCommandQueue.PushL(command);
   366     OstTraceFunctionExit0( CDEVICEEVENTHANDLER_CREATESUBCMDFORADDINGUSBMSFUNCTIONL_EXIT );
       
   367     }
   323     }
   368 
   324 
   369 void CDeviceEventHandler::CreateSubCmdForRemovingUsbMsDeviceL()
   325 void CDeviceEventHandler::CreateSubCmdForRemovingUsbMsDeviceL()
   370     {
   326     {
   371     OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_CREATESUBCMDFORREMOVINGUSBMSDEVICEL_ENTRY );
   327     LOG_FUNC
   372     
       
   373     CMsmmEngine& engine = iServer.Engine();
   328     CMsmmEngine& engine = iServer.Engine();
   374     TUsbMsDevice* device = engine.SearchDevice(iIncomingEvent.iDeviceId);
   329     TUsbMsDevice* device = engine.SearchDevice(iIncomingEvent.iDeviceId);
   375     if (!device)
   330     if (!device)
   376         {
   331         {
   377         User::Leave(KErrNotFound);
   332         User::Leave(KErrNotFound);
   395         interface = interface->NextPeer();
   350         interface = interface->NextPeer();
   396         };
   351         };
   397     TRemoveUsbMsDeviceNode* removeNode = 
   352     TRemoveUsbMsDeviceNode* removeNode = 
   398         new (ELeave) TRemoveUsbMsDeviceNode(parameter, device);
   353         new (ELeave) TRemoveUsbMsDeviceNode(parameter, device);
   399     iSubCommandQueue.PushL(removeNode);
   354     iSubCommandQueue.PushL(removeNode);
   400     OstTraceFunctionExit0( CDEVICEEVENTHANDLER_CREATESUBCMDFORREMOVINGUSBMSDEVICEL_EXIT );
       
   401     }
   355     }
   402 
   356 
   403 void CDeviceEventHandler::ResetHandler()
   357 void CDeviceEventHandler::ResetHandler()
   404     {
   358     {
   405     OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_RESETHANDLER_ENTRY );
   359     LOG_FUNC
   406     
       
   407     ResetHandlerData();
   360     ResetHandlerData();
   408     ResetHandlerError();
   361     ResetHandlerError();
   409     OstTraceFunctionExit0( CDEVICEEVENTHANDLER_RESETHANDLER_EXIT );
       
   410     }
   362     }
   411 
   363 
   412 void CDeviceEventHandler::ResetHandlerData()
   364 void CDeviceEventHandler::ResetHandlerData()
   413     {
   365     {
   414     OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_RESETHANDLERDATA_ENTRY );
   366     LOG_FUNC
   415     
       
   416     // Reset event buffer
   367     // Reset event buffer
   417     iIncomingEvent.iDeviceId = 0;
   368     iIncomingEvent.iDeviceId = 0;
   418     iIncomingEvent.iEvent = EDeviceEventEndMark;
   369     iIncomingEvent.iEvent = EDeviceEventEndMark;
   419     iIncomingEvent.iInterfaceNumber = 0;
   370     iIncomingEvent.iInterfaceNumber = 0;
   420     
   371     
   421     // Destory sub-command queue
   372     // Destory sub-command queue
   422     iSubCommandQueue.Release();
   373     iSubCommandQueue.Release();
   423     OstTraceFunctionExit0( CDEVICEEVENTHANDLER_RESETHANDLERDATA_EXIT );
       
   424     }
   374     }
   425 
   375 
   426 void CDeviceEventHandler::ResetHandlerError()
   376 void CDeviceEventHandler::ResetHandlerError()
   427     {
   377     {
   428     OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_RESETHANDLERERROR_ENTRY );
   378     LOG_FUNC
   429     
       
   430     // Reset error notification data
   379     // Reset error notification data
   431     iErrNotiData->iDriveName = 0x0;
   380     iErrNotiData->iDriveName = 0x0;
   432     iErrNotiData->iError = EHostMsErrorEndMarker;
   381     iErrNotiData->iError = EHostMsErrorEndMarker;
   433     iErrNotiData->iE32Error = KErrNone;
   382     iErrNotiData->iE32Error = KErrNone;
   434     iErrNotiData->iManufacturerString.Zero();
   383     iErrNotiData->iManufacturerString.Zero();
   435     OstTraceFunctionExit0( CDEVICEEVENTHANDLER_RESETHANDLERERROR_EXIT );
       
   436     }
   384     }
   437 
   385 
   438 void CDeviceEventHandler::CompleteClient(TInt aError/* = KErrNone*/)
   386 void CDeviceEventHandler::CompleteClient(TInt aError/* = KErrNone*/)
   439     {
   387     {
   440     OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_COMPLETECLIENT_ENTRY );
   388     LOG_FUNC
   441     
       
   442     if (iEvtQueueStatus)
   389     if (iEvtQueueStatus)
   443         {
   390         {
   444         User::RequestComplete(iEvtQueueStatus, aError);
   391         User::RequestComplete(iEvtQueueStatus, aError);
   445         }
   392         }
   446     OstTraceFunctionExit0( CDEVICEEVENTHANDLER_COMPLETECLIENT_EXIT );
       
   447     }
   393     }
   448 
   394 
   449 // End of file
   395 // End of file