camerauis/cameraapp/generic/src/CamAppController.cpp
branchRCL_3
changeset 62 f0c0788c4de2
parent 57 2c87b2808fd7
child 67 756ad29ed18e
equal deleted inserted replaced
57:2c87b2808fd7 62:f0c0788c4de2
   591   PRINT( _L("Camera <> delete Configuration Manager..") );
   591   PRINT( _L("Camera <> delete Configuration Manager..") );
   592   delete iConfiguration;
   592   delete iConfiguration;
   593   iConfiguration = NULL;  
   593   iConfiguration = NULL;  
   594 
   594 
   595   RProperty::Delete( KPSUidCamcorderNotifier, KCCorFocused );  
   595   RProperty::Delete( KPSUidCamcorderNotifier, KCCorFocused );  
   596     if( iPlugin )
   596   if( TUid::Null() != iPlugin )
   597         {
   597       {
   598         // Destroy Ecom plugin
   598       // Destroy Ecom plugin
   599         iPlugin->DestroyPlugin();
   599       REComSession::DestroyedImplementation( iPlugin );    
   600         }
   600       REComSession::FinalClose();
   601   iPlugin = NULL;
   601       }
   602   delete iDriveChangeNotifier;
   602   delete iDriveChangeNotifier;
   603   iFs.Close();
   603   iFs.Close();
   604   
   604   
   605   if( iRotatorAo )
   605   if( iRotatorAo )
   606       {
   606       {
  1963       {
  1963       {
  1964       // IssueDirectRequestL( ECamRequestVfStop );
  1964       // IssueDirectRequestL( ECamRequestVfStop );
  1965       StopViewFinder(); 
  1965       StopViewFinder(); 
  1966       IssueRequestL( ECamRequestVideoStop ); // Rest handled when event comes.
  1966       IssueRequestL( ECamRequestVideoStop ); // Rest handled when event comes.
  1967       });
  1967       });
  1968     
  1968 
       
  1969     iIdleTimer->SetTimeout( KIdleTimeout ); //Set normal idle timeout value
  1969     StartIdleTimer();
  1970     StartIdleTimer();
  1970     }
  1971     }
  1971   else
  1972   else
  1972     {
  1973     {
  1973     // otherwise there is no current recording operation
  1974     // otherwise there is no current recording operation
  2050         iSoundPlayer->EnableAllKeySounds();
  2051         iSoundPlayer->EnableAllKeySounds();
  2051         }
  2052         }
  2052   // Keep track of the fact we are now leaving saving state
  2053   // Keep track of the fact we are now leaving saving state
  2053   iSaving = EFalse;
  2054   iSaving = EFalse;
  2054   
  2055   
  2055   // try closing video record to free up resources
  2056   //create thumbnail before harvesting
  2056   // Test - <eo> commented out, no such direct request supported
  2057   if( iConfigManager && iConfigManager->IsThumbnailManagerAPISupported() )
  2057   // TRAP_IGNORE( IssueDirectRequestL( ECamRequestVideoRelease ) );
  2058       {
  2058   
  2059       TRAP_IGNORE( iImageSaveActive->CreateThumbnailsL( *BurstCaptureArray() ) ;
  2059   // if video post capture is off then force re-prepare so
  2060                    iImageSaveActive->DoCreateThumbnailL() );
  2060   // that remaining record time is updated
  2061       }
  2061   // REMOVED
  2062         
  2062 
       
  2063   // if using direct viewfinding pause viewfinder
       
  2064   // REMOVED
       
  2065 
       
  2066   // report to LifeBlog
  2063   // report to LifeBlog
  2067   RProperty::Set( KPSUidCamcorderNotifier, KCamLatestFilePath, iSuggestedVideoPath ); 
  2064   RProperty::Set( KPSUidCamcorderNotifier, KCamLatestFilePath, iSuggestedVideoPath ); 
  2068   // Add to album if this is enabled for videos
  2065   // Add to album if this is enabled for videos
  2069   TUint32 defaultAlbumId = static_cast<TUint32>( 
  2066   TUint32 defaultAlbumId = static_cast<TUint32>( 
  2070               IntegerSettingValue( ECamSettingItemDefaultAlbumId ));       
  2067               IntegerSettingValue( ECamSettingItemDefaultAlbumId ));       
  2075     }
  2072     }
  2076   else // Harvest the file but dont add to the default album
  2073   else // Harvest the file but dont add to the default album
  2077     {
  2074     {
  2078     iImageSaveActive->AddToAlbum( iSuggestedVideoPath, EFalse, defaultAlbumId );
  2075     iImageSaveActive->AddToAlbum( iSuggestedVideoPath, EFalse, defaultAlbumId );
  2079     }
  2076     }
  2080 
  2077       
  2081   //create thumbnail
       
  2082   if( iConfigManager && iConfigManager->IsThumbnailManagerAPISupported() )
       
  2083       {
       
  2084       TRAP_IGNORE( iImageSaveActive->CreateThumbnailsL( *BurstCaptureArray() ) );
       
  2085       }
       
  2086   NotifyControllerObservers( ECamEventRecordComplete,   aStatus );
  2078   NotifyControllerObservers( ECamEventRecordComplete,   aStatus );
  2087   SetOperation( ECamNoOperation );
  2079   SetOperation( ECamNoOperation );
  2088   PRINT( _L( "Camera <> calling HandleCaptureCompletion.." ) )        
  2080   PRINT( _L( "Camera <> calling HandleCaptureCompletion.." ) )        
  2089   HandleCaptureCompletion();
  2081   HandleCaptureCompletion();
  2090   NotifyControllerObservers( ECamEventMediaFileChanged, aStatus );
  2082   NotifyControllerObservers( ECamEventMediaFileChanged, aStatus );
  2120             PRINT( _L("Camera <> PAUSING FAILED!!") );
  2112             PRINT( _L("Camera <> PAUSING FAILED!!") );
  2121             }
  2113             }
  2122         else
  2114         else
  2123             {
  2115             {
  2124             // start video pause timeout
  2116             // start video pause timeout
       
  2117             iIdleTimer->SetTimeout( iLongIdleTimeout );            
  2125             StartIdleTimer();
  2118             StartIdleTimer();
  2126             }
  2119             }
  2127         }  
  2120         }  
  2128     PRINT( _L("Camera <= CCamAppController::PauseVideoRecording") );
  2121     PRINT( _L("Camera <= CCamAppController::PauseVideoRecording") );
  2129     }
  2122     }
  2137 void CCamAppController::ContinueVideoRecording()
  2130 void CCamAppController::ContinueVideoRecording()
  2138   {
  2131   {
  2139   PRINT( _L("Camera => CCamAppController::ContinueVideoRecording") );
  2132   PRINT( _L("Camera => CCamAppController::ContinueVideoRecording") );
  2140   if ( ECamPaused == CurrentVideoOperation() )
  2133   if ( ECamPaused == CurrentVideoOperation() )
  2141     {
  2134     {
       
  2135     iIdleTimer->SetTimeout( KIdleTimeout ); //Set normal idle timeout value
  2142     SetOperation( ECamResuming );
  2136     SetOperation( ECamResuming );
  2143     // Restart video when sound played
  2137     // Restart video when sound played
  2144     PlaySound( ECamVideoResumeSoundId, ETrue );        
  2138     PlaySound( ECamVideoResumeSoundId, ETrue );        
  2145     }
  2139     }
  2146   PRINT( _L("Camera <= CCamAppController::ContinueVideoRecording") );
  2140   PRINT( _L("Camera <= CCamAppController::ContinueVideoRecording") );
  3468       if ( scene != ECamSceneMacro &&
  3462       if ( scene != ECamSceneMacro &&
  3469            scene != ECamSceneScenery &&
  3463            scene != ECamSceneScenery &&
  3470            scene != ECamSceneSports && 
  3464            scene != ECamSceneSports && 
  3471            !iSceneModeForcedBySecondaryCamera )
  3465            !iSceneModeForcedBySecondaryCamera )
  3472           {
  3466           {
  3473           PRINT1( _L("Camera MK: Changing face tracking state -> update iPreviousFaceTrack to %d"), aSettingValue );
  3467           PRINT1( _L("Camera <> Changing face tracking state -> update iPreviousFaceTrack to %d"), aSettingValue );
  3474           iSettingsModel->SetPreviousFaceTrack( static_cast<TCamSettingsOnOff>( aSettingValue ) );
  3468           iSettingsModel->SetPreviousFaceTrack( static_cast<TCamSettingsOnOff>( aSettingValue ) );
  3475           }
  3469           }
  3476       
  3470       
  3477       break;
  3471       break;
  3478       }  
  3472       }  
  4789   : iBusyFlags( EBusyNone )
  4783   : iBusyFlags( EBusyNone )
  4790   , iDiskCriticalLevel   ( KErrNotFound )
  4784   , iDiskCriticalLevel   ( KErrNotFound )
  4791   , iRamDiskCriticalLevel( KErrNotFound )
  4785   , iRamDiskCriticalLevel( KErrNotFound )
  4792   , iImageOrientation( ECamOrientation0 )
  4786   , iImageOrientation( ECamOrientation0 )
  4793   , iLastImageOrientation( ECamOrientation0 )
  4787   , iLastImageOrientation( ECamOrientation0 )
       
  4788   , iLongIdleTimeout( KIdleTimeout * 5 )
       
  4789   , iPlugin( TUid::Null() )
  4794   , iPendingHdmiEvent( ECamHdmiNoEvent )
  4790   , iPendingHdmiEvent( ECamHdmiNoEvent )
  4795   {
  4791   {
  4796   }
  4792   }
  4797 
  4793 
  4798 // ---------------------------------------------------------------------------
  4794 // ---------------------------------------------------------------------------
  6636   PRINT( _L( "Camera <= CCamAppController::HandleImageStopEventL" ) );
  6632   PRINT( _L( "Camera <= CCamAppController::HandleImageStopEventL" ) );
  6637   }
  6633   }
  6638 
  6634 
  6639 
  6635 
  6640 // ---------------------------------------------------------------------------
  6636 // ---------------------------------------------------------------------------
       
  6637 // CCamAppController::SetIdleTimerTimeout
       
  6638 // ---------------------------------------------------------------------------
       
  6639 //
       
  6640 void CCamAppController::SetIdleTimerTimeout( TBool aLong )
       
  6641     {
       
  6642     PRINT1( _L( "Camera => CCamAppController::SetIdleTimerTimeout aLong=%d" ),aLong );
       
  6643     TBool changed = EFalse;
       
  6644     if( aLong )
       
  6645         {
       
  6646         if( iLongIdleTimeout < ( KIdleTimeout * 5 ) )
       
  6647             {
       
  6648             iLongIdleTimeout = KIdleTimeout * 5;
       
  6649             changed = ETrue;
       
  6650             }
       
  6651         }
       
  6652     else
       
  6653         {
       
  6654         if( iLongIdleTimeout > KIdleTimeout )
       
  6655             {
       
  6656             iLongIdleTimeout = KIdleTimeout; //Low power. Set normal idle timeout value
       
  6657             changed = ETrue;            
       
  6658             }
       
  6659         }
       
  6660     
       
  6661     if( changed && ECamPaused == CurrentVideoOperation() )
       
  6662         {
       
  6663         iIdleTimer->SetTimeout( iLongIdleTimeout );            
       
  6664         }
       
  6665     PRINT1( _L( "Camera <= CCamAppController::SetIdleTimerTimeout changed=%d" ),changed );
       
  6666     }
       
  6667 
       
  6668 // ---------------------------------------------------------------------------
  6641 // CCamAppController::IdleTimeoutL
  6669 // CCamAppController::IdleTimeoutL
  6642 // ---------------------------------------------------------------------------
  6670 // ---------------------------------------------------------------------------
  6643 //
  6671 //
  6644 TInt CCamAppController::IdleTimeoutL( TAny* aPtr )
  6672 TInt CCamAppController::IdleTimeoutL( TAny* aPtr )
  6645     {
  6673     {
  6650 // CCamAppController::DoIdleTimeoutL
  6678 // CCamAppController::DoIdleTimeoutL
  6651 // ---------------------------------------------------------------------------
  6679 // ---------------------------------------------------------------------------
  6652 //
  6680 //
  6653 TInt CCamAppController::DoIdleTimeoutL()
  6681 TInt CCamAppController::DoIdleTimeoutL()
  6654   {
  6682   {
  6655   // if a video recording has been paused for 60 seconds without key presses
  6683   // if a video recording has been paused for 5 minutes without key presses
  6656   if ( ECamPaused == CurrentVideoOperation() )
  6684   if ( ECamPaused == CurrentVideoOperation() )
  6657     {
  6685     {
       
  6686     iIdleTimer->SetTimeout( KIdleTimeout ); //Set normal idle timeout value
  6658     NotifyControllerObservers( ECamEventVideoPauseTimeout, KErrNone );
  6687     NotifyControllerObservers( ECamEventVideoPauseTimeout, KErrNone );
  6659     }
  6688     }
  6660 
  6689 
  6661   // notify switch to standby mode and stop timer
  6690   // notify switch to standby mode and stop timer
  6662   else if( ECamStandby != iInfo.iOperation && ECamTriActive == iCameraController->ViewfinderState())
  6691   else if( ECamStandby != iInfo.iOperation && ECamTriActive == iCameraController->ViewfinderState())
  6701     {
  6730     {
  6702     PRINT( _L( "Camera <> CCamAppController::StartIdleTimer no restart" ) );
  6731     PRINT( _L( "Camera <> CCamAppController::StartIdleTimer no restart" ) );
  6703     // don't restart if recording operation in progress
  6732     // don't restart if recording operation in progress
  6704     return;
  6733     return;
  6705     }
  6734     }
  6706   // if recording is paused, use the idle timer to stop recording after 60 secs
  6735   // if recording is paused, use the idle timer to stop recording after 5 mins
  6707   else
  6736   else
  6708     {
  6737     {
  6709     PRINT( _L( "Camera <> CCamAppController::StartIdleTimer else part" ) );
  6738     PRINT( _L( "Camera <> CCamAppController::StartIdleTimer else part" ) );
  6710     // empty else statement to remove LINT error
  6739     // empty else statement to remove LINT error
  6711     }
  6740     }
  9798 
  9827 
  9799     if( iVideoRequested )
  9828     if( iVideoRequested )
  9800       {
  9829       {
  9801       PRINT( _L("Camera <> starting recording..") );
  9830       PRINT( _L("Camera <> starting recording..") );
  9802       iVideoRequested = EFalse;
  9831       iVideoRequested = EFalse;
  9803       IssueRequestL( ECamRequestVideoStart );
  9832       // Make sure the MMC have enough free memory to record video.  
       
  9833       if( appUi->CheckMemoryL() )
       
  9834         {  
       
  9835         IssueRequestL( ECamRequestVideoStart );
       
  9836     	}
  9804       PRINT( _L("Camera <> ..done") );
  9837       PRINT( _L("Camera <> ..done") );
  9805       }
  9838       }
  9806 
  9839 
  9807 
  9840 
  9808     NotifyControllerObservers( ECamEventEngineStateChanged, KErrNone ); 
  9841     NotifyControllerObservers( ECamEventEngineStateChanged, KErrNone ); 
 10578         
 10611         
 10579 // -----------------------------------------------------------------------------
 10612 // -----------------------------------------------------------------------------
 10580 //
 10613 //
 10581 // -----------------------------------------------------------------------------
 10614 // -----------------------------------------------------------------------------
 10582 //
 10615 //
 10583 void CCamAppController::SetSettingsPlugin( CCamGSInterface* aPlugin )
 10616 void CCamAppController::SetSettingsPlugin( TUid aPlugin )
 10584 	{
 10617 	{
 10585 	iPlugin = aPlugin;
 10618 	iPlugin = aPlugin;
 10586 	}
 10619 	}
 10587 
 10620 
 10588 // ---------------------------------------------------------------------------
 10621 // ---------------------------------------------------------------------------
 10906               SwitchToStandbyL( KErrNone );
 10939               SwitchToStandbyL( KErrNone );
 10907               }
 10940               }
 10908           else if( aType == EDriveDismount &&
 10941           else if( aType == EDriveDismount &&
 10909                   appUi->IsRecoverableStatus() )
 10942                   appUi->IsRecoverableStatus() )
 10910               {
 10943               {
 10911               TInt mmcInserted = 0;
       
 10912               TInt usbPersonality = 0;
 10944               TInt usbPersonality = 0;
 10913               User::LeaveIfError( RProperty::Get( KPSUidUikon, KUikMMCInserted, mmcInserted ) );
       
 10914               User::LeaveIfError(RProperty::Get(KPSUidUsbWatcher, 
 10945               User::LeaveIfError(RProperty::Get(KPSUidUsbWatcher, 
 10915                                             KUsbWatcherSelectedPersonality,
 10946                                             KUsbWatcherSelectedPersonality,
 10916                                             usbPersonality) );
 10947                                             usbPersonality) );
 10917               if( !IsMemoryAvailable(ECamMediaStorageMassStorage) &&
 10948               if( !IsMemoryAvailable(ECamMediaStorageMassStorage) &&
 10918                    !IsMemoryAvailable(ECamMediaStorageCard) )
 10949                    !IsMemoryAvailable(ECamMediaStorageCard) )
 10919                   {
 10950                   {
 10920                   if( KUsbPersonalityIdMS == usbPersonality )
 10951                   if( KUsbPersonalityIdMS == usbPersonality )
 10921                       {
 10952                       {
 10922                       SwitchToStandbyL( ECamErrMassStorageMode );
 10953                       SwitchToStandbyL( ECamErrMassStorageMode );
 10923                       }
 10954                       }
 10924                   else if ( !mmcInserted )
 10955                   else if ( aType == EDriveDismount )
 10925                       {
 10956                       {
 10926                       SwitchToStandbyL( ECamErrMemoryCardNotInserted );
 10957                       SwitchToStandbyL( ECamErrMemoryCardNotInserted );
 10927                       }
 10958                       }
 10928                   }
 10959                   }
 10929               }
 10960               }