mmappcomponents/harvester/server/src/mpxusbeventhandler.cpp
changeset 27 cbb1bfb7ebfb
parent 25 d881023c13eb
equal deleted inserted replaced
25:d881023c13eb 27:cbb1bfb7ebfb
    17 
    17 
    18 
    18 
    19 #include <e32base.h>
    19 #include <e32base.h>
    20 #include <f32file.h>
    20 #include <f32file.h>
    21 #include <e32property.h>
    21 #include <e32property.h>
    22 #ifdef RD_MULTIPLE_DRIVE
       
    23 #include <driveinfo.h>
    22 #include <driveinfo.h>
    24 #endif //RD_MULTIPLE_DRIVE
       
    25 #include <mpxpskeywatcher.h>
    23 #include <mpxpskeywatcher.h>
    26 #include <coreapplicationuisdomainpskeys.h>
    24 #include <coreapplicationuisdomainpskeys.h>
    27 #include <UsbWatcherInternalPSKeys.h>
    25 #include <UsbWatcherInternalPSKeys.h>
    28 #include <usbpersonalityids.h>
    26 #include <usbpersonalityids.h>
    29 #include <MtpPrivatePSKeys.h>
    27 #include <mtpprivatepskeys.h>
    30 #include <mpxlog.h>
    28 #include <mpxlog.h>
    31 #include "mpxusbeventhandler.h"
    29 #include "mpxusbeventhandler.h"
    32 
    30 
    33 // CONSTANTS
    31 // CONSTANTS
    34 const TUint KUsbAllStates = 0xFFFFFFFF;
    32 const TUint KUsbAllStates = 0xFFFFFFFF;
   149         ConnectUsbMan();
   147         ConnectUsbMan();
   150         }
   148         }
   151     
   149     
   152     // Use the default MMC drive
   150     // Use the default MMC drive
   153     TInt removableDrive( EDriveE );
   151     TInt removableDrive( EDriveE );
   154 #ifdef RD_MULTIPLE_DRIVE
       
   155     User::LeaveIfError( DriveInfo::GetDefaultDrive(
   152     User::LeaveIfError( DriveInfo::GetDefaultDrive(
   156         DriveInfo::EDefaultRemovableMassStorage,
   153         DriveInfo::EDefaultRemovableMassStorage,
   157         removableDrive ) );
   154         removableDrive ) );
   158 #endif // RD_MULTIPLE_DRIVE
       
   159 
   155 
   160     // Handle the Key event
   156     // Handle the Key event
   161     TInt value;
   157     TInt value;
   162     iPSKeyWatcher->GetValue( value );
   158     iPSKeyWatcher->GetValue( value );
   163 
   159 
   174             {
   170             {
   175             MPX_DEBUG1("CMPXUsbEventHandler::DoHandlePSEvent - MTP End");
   171             MPX_DEBUG1("CMPXUsbEventHandler::DoHandlePSEvent - MTP End");
   176             iObserver.HandleSystemEventL( EUSBMTPEndEvent, removableDrive );
   172             iObserver.HandleSystemEventL( EUSBMTPEndEvent, removableDrive );
   177             }
   173             }
   178         MPX_DEBUG1("CMPXUsbEventHandler::DoHandlePSEvent - USB Start");
   174         MPX_DEBUG1("CMPXUsbEventHandler::DoHandlePSEvent - USB Start");
   179 #ifdef RD_MULTIPLE_DRIVE
       
   180         removableDrive = -1;
   175         removableDrive = -1;
   181 #endif // RD_MULTIPLE_DRIVE
       
   182 
   176 
   183         // Notify the state change (may happen more than once)
   177         // Notify the state change (may happen more than once)
   184         iObserver.HandleSystemEventL( EUSBMassStorageStartEvent, removableDrive );
   178         iObserver.HandleSystemEventL( EUSBMassStorageStartEvent, removableDrive );
   185         iState = KUsbPersonalityIdMS;
   179         iState = KUsbPersonalityIdMS;
   186         }
   180         }
   195         iMTPKeyWatcher->GetValue(value);
   189         iMTPKeyWatcher->GetValue(value);
   196         MPX_DEBUG2("CMPXUsbEventHandler::DoHandlePSEvent -- get MTP value %i", value);
   190         MPX_DEBUG2("CMPXUsbEventHandler::DoHandlePSEvent -- get MTP value %i", value);
   197 		
   191 		
   198         if (value == EMtpPSStatusActive)
   192         if (value == EMtpPSStatusActive)
   199             {
   193             {
   200         	MPX_DEBUG1("CMPXUsbEventHandler::DoHandlePSEvent - MTP Start");
   194             MPX_DEBUG1("CMPXUsbEventHandler::DoHandlePSEvent - MTP Start");
   201             iObserver.HandleSystemEventL( EUSBMTPStartEvent, removableDrive );
   195             iObserver.HandleSystemEventL( EUSBMTPStartEvent, removableDrive );
   202             iState = KUsbPersonalityIdMTP;
   196             iState = KUsbPersonalityIdMTP;
   203             }
   197             }
   204         else if( value != EMtpPSStatusReadyToSync )
   198         else if( value != EMtpPSStatusReadyToSync )
   205             {
   199             {