usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/eventhandler.cpp
branchRCL_3
changeset 11 bfa24657ff9f
parent 5 c2db6e29750c
child 15 f92a4f87e424
equal deleted inserted replaced
9:6ba7b7d87ab3 11:bfa24657ff9f
   210 void CDeviceEventHandler::DoCancel()
   210 void CDeviceEventHandler::DoCancel()
   211     {
   211     {
   212     LOG_FUNC
   212     LOG_FUNC
   213     // Complete client with KErrCancel
   213     // Complete client with KErrCancel
   214     CompleteClient(KErrCancel);
   214     CompleteClient(KErrCancel);
   215     
   215 
   216     // Cancel current pending command
   216     // Cancel current pending command
   217     iSubCommandQueue.Head().CancelAsyncCmd();
   217     if (iSubCommandQueue.Count())
       
   218         {
       
   219         iSubCommandQueue.Head().CancelAsyncCmd();
       
   220         }
   218     }
   221     }
   219 
   222 
   220 void CDeviceEventHandler::RunL( )
   223 void CDeviceEventHandler::RunL( )
   221     {
   224     {
   222     LOG_FUNC
   225     LOG_FUNC
   249     }
   252     }
   250 
   253 
   251 TInt CDeviceEventHandler::RunError(TInt aError)
   254 TInt CDeviceEventHandler::RunError(TInt aError)
   252     {
   255     {
   253     LOG_FUNC
   256     LOG_FUNC
   254     // Retrieve sub-command related error notification data
   257 
   255     iSubCommandQueue.Head().HandleError(*iErrNotiData, aError);
   258     if (iSubCommandQueue.Count())
   256         
   259         {
   257     // If current sub-command isn't a key one, the handler will continue to
   260         // Retrieve sub-command related error notification data
   258     // execute rest sub-command in the queue. But, if current sub-command
   261         iSubCommandQueue.Head().HandleError(*iErrNotiData, aError);
   259     // is the last one in the queue, handler shall complete the client also. 
   262 
   260     if (iSubCommandQueue.Head().IsKeyCommand() || 
   263         // If current sub-command isn't a key one, the handler will continue to
   261             (iSubCommandQueue.Count() == 1))
   264         // execute rest sub-command in the queue. But, if current sub-command
   262         {
   265         // is the last one in the queue, handler shall complete the client also. 
   263         CompleteClient(aError);
   266         if (iSubCommandQueue.Head().IsKeyCommand() || 
   264         }
   267                 (iSubCommandQueue.Count() == 1))
   265 
   268             {
   266     //Restart the handler after error handling;
   269             CompleteClient(aError);
   267     if (!IsActive())
   270             }
       
   271         iSubCommandQueue.Pop();
       
   272         }
       
   273 
       
   274     if( IsActive() )
       
   275         {
       
   276         Complete(aError);
       
   277         }
       
   278     else if (iSubCommandQueue.Count())
   268         {
   279         {
   269         Start();
   280         Start();
   270         }
   281    	    Complete();
   271     Complete(aError);
   282         }
   272     
   283 
   273     if (iSubCommandQueue.Count())
       
   274         {
       
   275         iSubCommandQueue.Pop();
       
   276         }
       
   277     
       
   278     return KErrNone;
   284     return KErrNone;
   279     }
   285     }
   280 
   286 
   281 // Private member functions
   287 // Private member functions
   282 CDeviceEventHandler::CDeviceEventHandler(MMsmmSrvProxy& aServer):
   288 CDeviceEventHandler::CDeviceEventHandler(MMsmmSrvProxy& aServer):