mmappcomponents/harvester/server/src/mpxusbeventhandler.cpp
changeset 25 d881023c13eb
parent 0 a2952bb97e68
child 27 cbb1bfb7ebfb
equal deleted inserted replaced
21:a05c44bc3c61 25:d881023c13eb
    39 //
    39 //
    40 CMPXUsbEventHandler::CMPXUsbEventHandler( MMPXSystemEventObserver& aObserver ) :
    40 CMPXUsbEventHandler::CMPXUsbEventHandler( MMPXSystemEventObserver& aObserver ) :
    41                                           CActive( EPriorityStandard ),
    41                                           CActive( EPriorityStandard ),
    42                                           iWasMtp  ( EFalse ),
    42                                           iWasMtp  ( EFalse ),
    43                                           iObserver( aObserver ),
    43                                           iObserver( aObserver ),
    44                                           iMTPActive ( EFalse ),
       
    45                                           iUsbManConnected( EFalse )
    44                                           iUsbManConnected( EFalse )
    46     {
    45     {
    47     CActiveScheduler::Add( this );
    46     CActiveScheduler::Add( this );
    48     }
    47     }
    49 
    48 
   173         // Switch mode
   172         // Switch mode
   174         if( iState == KUsbPersonalityIdMTP )
   173         if( iState == KUsbPersonalityIdMTP )
   175             {
   174             {
   176             MPX_DEBUG1("CMPXUsbEventHandler::DoHandlePSEvent - MTP End");
   175             MPX_DEBUG1("CMPXUsbEventHandler::DoHandlePSEvent - MTP End");
   177             iObserver.HandleSystemEventL( EUSBMTPEndEvent, removableDrive );
   176             iObserver.HandleSystemEventL( EUSBMTPEndEvent, removableDrive );
   178             iMTPActive = EFalse;
       
   179             }
   177             }
   180         MPX_DEBUG1("CMPXUsbEventHandler::DoHandlePSEvent - USB Start");
   178         MPX_DEBUG1("CMPXUsbEventHandler::DoHandlePSEvent - USB Start");
   181 #ifdef RD_MULTIPLE_DRIVE
   179 #ifdef RD_MULTIPLE_DRIVE
   182         removableDrive = -1;
   180         removableDrive = -1;
   183 #endif // RD_MULTIPLE_DRIVE
   181 #endif // RD_MULTIPLE_DRIVE
   197         iMTPKeyWatcher->GetValue(value);
   195         iMTPKeyWatcher->GetValue(value);
   198         MPX_DEBUG2("CMPXUsbEventHandler::DoHandlePSEvent -- get MTP value %i", value);
   196         MPX_DEBUG2("CMPXUsbEventHandler::DoHandlePSEvent -- get MTP value %i", value);
   199 		
   197 		
   200         if (value == EMtpPSStatusActive)
   198         if (value == EMtpPSStatusActive)
   201             {
   199             {
   202             if( !iMTPActive )
   200         	MPX_DEBUG1("CMPXUsbEventHandler::DoHandlePSEvent - MTP Start");
   203             	{
   201             iObserver.HandleSystemEventL( EUSBMTPStartEvent, removableDrive );
   204                 MPX_DEBUG1("CMPXUsbEventHandler::DoHandlePSEvent - MTP Start");
   202             iState = KUsbPersonalityIdMTP;
   205                 iObserver.HandleSystemEventL( EUSBMTPStartEvent, removableDrive );
       
   206                 iState = KUsbPersonalityIdMTP;
       
   207                 iMTPActive = ETrue;
       
   208             	}
       
   209             }
   203             }
   210         else if( value != EMtpPSStatusReadyToSync )
   204         else if( value != EMtpPSStatusReadyToSync )
   211             {
   205             {
   212             MPX_DEBUG1("CMPXUsbEventHandler::DoHandlePSEvent - MTP Not Active");
   206             MPX_DEBUG1("CMPXUsbEventHandler::DoHandlePSEvent - MTP Not Active");
   213             iObserver.HandleSystemEventL( EUSBMTPNotActiveEvent, removableDrive );
   207             iObserver.HandleSystemEventL( EUSBMTPNotActiveEvent, removableDrive );
   214             iState = KUsbPersonalityIdMTP;
   208             iState = KUsbPersonalityIdMTP;
   215             iMTPActive = EFalse;
       
   216             }
   209             }
   217         }
   210         }
   218     // Make sure MTP and MS flags are OFF
   211     // Make sure MTP and MS flags are OFF
   219     //
   212     //
   220     else if( value != KUsbPersonalityIdMTP &&
   213     else if( value != KUsbPersonalityIdMTP &&
   229             }
   222             }
   230         else if( iState == KUsbPersonalityIdMTP )
   223         else if( iState == KUsbPersonalityIdMTP )
   231             {
   224             {
   232             MPX_DEBUG1("CMPXUsbEventHandler::DoHandlePSEvent - MTP End");
   225             MPX_DEBUG1("CMPXUsbEventHandler::DoHandlePSEvent - MTP End");
   233             iObserver.HandleSystemEventL( EUSBMTPEndEvent, removableDrive );
   226             iObserver.HandleSystemEventL( EUSBMTPEndEvent, removableDrive );
   234             iMTPActive = EFalse;
       
   235             }
   227             }
   236         iState = KUsbWatcherSelectedPersonalityNone;
   228         iState = KUsbWatcherSelectedPersonalityNone;
   237         }
   229         }
   238     }
   230     }
   239 
   231