mmappcomponents/harvester/server/src/mpxconnectioneventhandler.cpp
changeset 35 2ee890d2f7e7
parent 32 edd273b3192a
child 38 959ca709b049
equal deleted inserted replaced
32:edd273b3192a 35:2ee890d2f7e7
   164     iMTPKeyWatcher->GetValue(mtpStatus);
   164     iMTPKeyWatcher->GetValue(mtpStatus);
   165     
   165     
   166     MPX_DEBUG3("CMPXConnectionEventHandler::DoHandlePSEventL, usbStatus = %d, mtpStatus = %d", usbStatus, mtpStatus);
   166     MPX_DEBUG3("CMPXConnectionEventHandler::DoHandlePSEventL, usbStatus = %d, mtpStatus = %d", usbStatus, mtpStatus);
   167     MPX_DEBUG2("CMPXConnectionEventHandler::DoHandlePSEventL, iState = %d", iState);
   167     MPX_DEBUG2("CMPXConnectionEventHandler::DoHandlePSEventL, iState = %d", iState);
   168     MPX_DEBUG4("CMPXConnectionEventHandler::DoHandlePSEventL, iDeviceState = %d, EUsbDeviceStateAddress(%d), EUsbDeviceStateConfigured(%d)", iDeviceState, EUsbDeviceStateAddress, EUsbDeviceStateConfigured);
   168     MPX_DEBUG4("CMPXConnectionEventHandler::DoHandlePSEventL, iDeviceState = %d, EUsbDeviceStateAddress(%d), EUsbDeviceStateConfigured(%d)", iDeviceState, EUsbDeviceStateAddress, EUsbDeviceStateConfigured);
   169     
   169         
   170     RDebug::Print(_L("tpoon: CMPXConnectionEventHandler::DoHandlePSEventL, usbStatus = %d, mtpStatus = %d"), usbStatus, mtpStatus);
       
   171     RDebug::Print(_L("tpoon: CMPXConnectionEventHandler::DoHandlePSEventL, iState = %d"), iState);
       
   172     RDebug::Print(_L("tpoon: CMPXConnectionEventHandler::DoHandlePSEventL, iDeviceState = %d, EUsbDeviceStateAddress(%d), EUsbDeviceStateConfigured(%d)"), iDeviceState, EUsbDeviceStateAddress, EUsbDeviceStateConfigured);
       
   173     
       
   174     // events from lower level is not causing multiple callback on the same type
   170     // events from lower level is not causing multiple callback on the same type
   175     // usb is really only connected if went through Address or Configured state
   171     // usb is really only connected if went through Address or Configured state
   176     if( (usbStatus == KUsbPersonalityIdMS) && (iDeviceState == EUsbDeviceStateAddress || iDeviceState == EUsbDeviceStateConfigured))
   172     if( (usbStatus == KUsbPersonalityIdMS) && (iDeviceState == EUsbDeviceStateAddress || iDeviceState == EUsbDeviceStateConfigured))
   177         {
   173         {
   178         if ((iState == EMPXConnectionMTPIdle) || (iState == EMPXConnectionMTPActive))
   174         if ((iState == EMPXConnectionMTPIdle) || (iState == EMPXConnectionMTPActive))
   179             {
   175             {
   180             MPX_DEBUG1("CMPXConnectionEventHandler::DoHandlePSEvent - MTP End");
   176             MPX_DEBUG1("CMPXConnectionEventHandler::DoHandlePSEvent - MTP End");
   181             RDebug::Print(_L("tpoon: MTP End"));
       
   182             iObserver.HandleSystemEventL( EUSBMTPEndEvent, -1 );
   177             iObserver.HandleSystemEventL( EUSBMTPEndEvent, -1 );
   183             iState = EMPXConnectionNone;
   178             iState = EMPXConnectionNone;
   184             }
   179             }
   185         
   180         
   186         if (iState != EMPXConnectionMassStorage)
   181         if (iState != EMPXConnectionMassStorage)
   191     else if (iState == EMPXConnectionMassStorage)
   186     else if (iState == EMPXConnectionMassStorage)
   192         {
   187         {
   193         if (usbStatus != KUsbPersonalityIdMS)
   188         if (usbStatus != KUsbPersonalityIdMS)
   194             {
   189             {
   195             MPX_DEBUG1("CMPXConnectionEventHandler::DoHandlePSEvent - USB MassStorage End");
   190             MPX_DEBUG1("CMPXConnectionEventHandler::DoHandlePSEvent - USB MassStorage End");
   196             RDebug::Print(_L("tpoon: MS End"));
       
   197             iObserver.HandleSystemEventL( EUSBMassStorageEndEvent, -1 );
   191             iObserver.HandleSystemEventL( EUSBMassStorageEndEvent, -1 );
   198             iState = EMPXConnectionNone;
   192             iState = EMPXConnectionNone;
   199             }
   193             }
   200         }
   194         }
   201     
   195     
   203     if (iState != EMPXConnectionMassStorage)
   197     if (iState != EMPXConnectionMassStorage)
   204         {
   198         {
   205         if ((mtpStatus == EMtpPSStatusUninitialized) && (iState != EMPXConnectionNone))
   199         if ((mtpStatus == EMtpPSStatusUninitialized) && (iState != EMPXConnectionNone))
   206             {
   200             {
   207             MPX_DEBUG1("CMPXConnectionEventHandler::DoHandlePSEvent - MTP End");
   201             MPX_DEBUG1("CMPXConnectionEventHandler::DoHandlePSEvent - MTP End");
   208             RDebug::Print(_L("tpoon: MTP End"));
       
   209             iObserver.HandleSystemEventL( EUSBMTPEndEvent, -1 );
   202             iObserver.HandleSystemEventL( EUSBMTPEndEvent, -1 );
   210             iState = EMPXConnectionNone;
   203             iState = EMPXConnectionNone;
   211             }
   204             }
   212         else if ((mtpStatus == EMtpPSStatusActive) && (iState != EMPXConnectionMTPActive)
   205         else if ((mtpStatus == EMtpPSStatusActive) && (iState != EMPXConnectionMTPActive)
   213                 && ((usbStatus == KUsbPersonalityIdMTP) || (usbStatus == KUsbPersonalityIdPCSuiteMTP))) // only trigger MusicPlayer fully block and RAM Drive if USB MTP/PCSuiteMTP is connected
   206                 && ((usbStatus == KUsbPersonalityIdMTP) || (usbStatus == KUsbPersonalityIdPCSuiteMTP))) // only trigger MusicPlayer fully block and RAM Drive if USB MTP/PCSuiteMTP is connected
   222     }
   215     }
   223 
   216 
   224 void CMPXConnectionEventHandler::DoMSStartEventL()
   217 void CMPXConnectionEventHandler::DoMSStartEventL()
   225     {
   218     {
   226     MPX_DEBUG1("CMPXConnectionEventHandler::DoMSStartEventL - USB MassStorage Start");
   219     MPX_DEBUG1("CMPXConnectionEventHandler::DoMSStartEventL - USB MassStorage Start");
   227     RDebug::Print(_L("tpoon: MS Start"));
       
   228     iObserver.HandleSystemEventL( EUSBMassStorageStartEvent, -1 );
   220     iObserver.HandleSystemEventL( EUSBMassStorageStartEvent, -1 );
   229     iState = EMPXConnectionMassStorage;
   221     iState = EMPXConnectionMassStorage;
   230     }
   222     }
   231 
   223 
   232 void CMPXConnectionEventHandler::DoMTPStartEventL()
   224 void CMPXConnectionEventHandler::DoMTPStartEventL()
   233     {
   225     {
   234     MPX_DEBUG1("CMPXConnectionEventHandler::DoMTPStartEventL - MTP Start");
   226     MPX_DEBUG1("CMPXConnectionEventHandler::DoMTPStartEventL - MTP Start");
   235     RDebug::Print(_L("tpoon: MTP Start"));
       
   236     iObserver.HandleSystemEventL( EUSBMTPStartEvent, -1 );
   227     iObserver.HandleSystemEventL( EUSBMTPStartEvent, -1 );
   237     iState = EMPXConnectionMTPActive;
   228     iState = EMPXConnectionMTPActive;
   238     }
   229     }
   239 
   230 
   240 void CMPXConnectionEventHandler::DoMTPNotActiveEventL()
   231 void CMPXConnectionEventHandler::DoMTPNotActiveEventL()
   241     {
   232     {
   242     MPX_DEBUG1("CMPXConnectionEventHandler::DoMTPNotActiveEventL - MTP Not Active");
   233     MPX_DEBUG1("CMPXConnectionEventHandler::DoMTPNotActiveEventL - MTP Not Active");
   243     RDebug::Print(_L("tpoon: MTP Not Active"));
       
   244     iObserver.HandleSystemEventL( EUSBMTPNotActiveEvent, -1 );
   234     iObserver.HandleSystemEventL( EUSBMTPNotActiveEvent, -1 );
   245     iState = EMPXConnectionMTPIdle;
   235     iState = EMPXConnectionMTPIdle;
   246     }
   236     }
   247 
   237 
   248 // ---------------------------------------------------------------------------
   238 // ---------------------------------------------------------------------------