96 #include "cambuffersharecleanup.h" |
96 #include "cambuffersharecleanup.h" |
97 #include "camaudioplayercontroller.h" |
97 #include "camaudioplayercontroller.h" |
98 #include "camuidconstants.h" |
98 #include "camuidconstants.h" |
99 #include "camconfiguration.h" |
99 #include "camconfiguration.h" |
100 #include "CamPreCaptureViewBase.h" |
100 #include "CamPreCaptureViewBase.h" |
|
101 #include "CamPostCaptureViewBase.h" |
101 |
102 |
102 #include <cfclient.h> |
103 #include <cfclient.h> |
103 #include <cfcontextobject.h> |
104 #include <cfcontextobject.h> |
104 #include <cfcontextquery.h> |
105 #include <cfcontextquery.h> |
105 |
106 |
2981 RCamRequestArray sequence; |
2983 RCamRequestArray sequence; |
2982 CleanupClosePushL( sequence ); |
2984 CleanupClosePushL( sequence ); |
2983 |
2985 |
2984 if( !aStartup ) |
2986 if( !aStartup ) |
2985 { |
2987 { |
2986 TBool usbPersonality = 0; |
|
2987 User::LeaveIfError ( RProperty::Get (KPSUidUsbWatcher, |
|
2988 KUsbWatcherSelectedPersonality, usbPersonality)); |
|
2989 TInt mmcInserted = 0; |
|
2990 User::LeaveIfError( RProperty::Get( KPSUidUikon, KUikMMCInserted, mmcInserted ) ); |
|
2991 CCamAppUi* appUi = static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() ); |
2988 CCamAppUi* appUi = static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() ); |
2992 |
2989 |
2993 if(IntegerSettingValue(ECamSettingItemRemovePhoneMemoryUsage) && |
2990 if(IntegerSettingValue(ECamSettingItemRemovePhoneMemoryUsage) && |
2994 !IsMemoryAvailable(ECamMediaStorageMassStorage) && |
2991 !IsMemoryAvailable(ECamMediaStorageMassStorage) && |
2995 !IsMemoryAvailable(ECamMediaStorageCard) && |
2992 !IsMemoryAvailable(ECamMediaStorageCard) && |
2996 ( appUi->PreCaptureMode() == ECamPreCapViewfinder || |
2993 ( appUi->PreCaptureMode() == ECamPreCapViewfinder || |
2997 appUi->PreCaptureMode() == ECamPreCapGenericSetting ) ) |
2994 appUi->PreCaptureMode() == ECamPreCapGenericSetting ) ) |
2998 { |
2995 { |
|
2996 TBool usbPersonality = 0; |
|
2997 #ifndef __WINSCW__ |
|
2998 User::LeaveIfError ( RProperty::Get (KPSUidUsbWatcher, |
|
2999 KUsbWatcherSelectedPersonality, usbPersonality)); |
|
3000 #endif // __WINSCW__ |
|
3001 TInt mmcInserted = 0; |
|
3002 User::LeaveIfError( RProperty::Get( KPSUidUikon, KUikMMCInserted, mmcInserted ) ); |
|
3003 |
2999 if( KUsbPersonalityIdMS == usbPersonality ) |
3004 if( KUsbPersonalityIdMS == usbPersonality ) |
3000 { |
3005 { |
3001 SwitchToStandbyL( ECamErrMassStorageMode ); |
3006 SwitchToStandbyL( ECamErrMassStorageMode ); |
3002 } |
3007 } |
3003 else if( !mmcInserted ) |
3008 else if( !mmcInserted ) |
7878 CCamAppUi* appUi = static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() ); |
7883 CCamAppUi* appUi = static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() ); |
7879 TVwsViewId activeView; |
7884 TVwsViewId activeView; |
7880 appUi->GetActiveViewId( activeView ); |
7885 appUi->GetActiveViewId( activeView ); |
7881 CCamPreCaptureViewBase* view = static_cast<CCamPreCaptureViewBase*>( appUi->View( activeView.iViewUid ) ); |
7886 CCamPreCaptureViewBase* view = static_cast<CCamPreCaptureViewBase*>( appUi->View( activeView.iViewUid ) ); |
7882 if ( iInfo.iOperation == ECamStandby || |
7887 if ( iInfo.iOperation == ECamStandby || |
7883 ( view && view->IsInStandbyMode() ) ) |
7888 ( view && view->IsInStandbyMode() ) && appUi->IsRecoverableStatus() ) |
7884 { |
7889 { |
7885 PRINT( _L("Camera HandleSlideOpenedL => Exit Standby view") ); |
7890 PRINT( _L("Camera HandleSlideOpenedL => Exit Standby view") ); |
7886 view->HandleCommandL( ECamCmdExitStandby ); |
7891 view->HandleCommandL( ECamCmdExitStandby ); |
7887 } |
7892 } |
7888 } |
7893 } |
8855 |
8860 |
8856 // <<public>> |
8861 // <<public>> |
8857 TBool |
8862 TBool |
8858 CCamAppController::Busy() const |
8863 CCamAppController::Busy() const |
8859 { |
8864 { |
|
8865 PRINT1(_L("Camera <> CCamAppController::Busy:%d"), iBusyFlags ); |
8860 return (EBusyNone != iBusyFlags || CameraControllerBusy() ); |
8866 return (EBusyNone != iBusyFlags || CameraControllerBusy() ); |
8861 } |
8867 } |
8862 |
8868 |
8863 TBool |
8869 TBool |
8864 CCamAppController::CameraControllerBusy() const |
8870 CCamAppController::CameraControllerBusy() const |
8865 { |
8871 { |
|
8872 PRINT1(_L("Camera <> CCamAppController::CameraControllerBusy:%d"), iCameraController->ControllerInfo().iBusy ); |
8866 return (iCameraController && ECamBusyOff != iCameraController->ControllerInfo().iBusy ); |
8873 return (iCameraController && ECamBusyOff != iCameraController->ControllerInfo().iBusy ); |
8867 } |
8874 } |
8868 |
8875 |
8869 // =========================================================================== |
8876 // =========================================================================== |
8870 // From MCamCameraObserver |
8877 // From MCamCameraObserver |
10630 |
10638 |
10631 if ( ECamMediaStoragePhone == iPreferredStorageLocation ) |
10639 if ( ECamMediaStoragePhone == iPreferredStorageLocation ) |
10632 { |
10640 { |
10633 PRINT( _L("Camera <> Phone memory is the preferred storage location. Nothing to be done here. Return KErrNone.") ) |
10641 PRINT( _L("Camera <> Phone memory is the preferred storage location. Nothing to be done here. Return KErrNone.") ) |
10634 PRINT( _L("Camera <= CCamAppController::DriveChangeL" ) ); |
10642 PRINT( _L("Camera <= CCamAppController::DriveChangeL" ) ); |
10635 |
10643 return KErrNone; |
10636 } |
10644 } |
10637 |
10645 |
10638 if ( ( !IsMemoryAvailable( ECamMediaStorageCard, EFalse ) || |
10646 if ( ( !IsMemoryAvailable( ECamMediaStorageCard, EFalse ) || |
10639 !IsMemoryAvailable( ECamMediaStorageMassStorage, EFalse ) ) || |
10647 !IsMemoryAvailable( ECamMediaStorageMassStorage, EFalse ) ) || |
10640 !IsMemoryAvailable( iPreferredStorageLocation, ETrue ) ) |
10648 !IsMemoryAvailable( iPreferredStorageLocation, ETrue ) ) |
10685 PRINT( _L("Camera <> CCamAppController::DriveChangeL sequence or saving ongoing" ) ); |
10693 PRINT( _L("Camera <> CCamAppController::DriveChangeL sequence or saving ongoing" ) ); |
10686 |
10694 |
10687 iDismountPending = ETrue; |
10695 iDismountPending = ETrue; |
10688 // Mass memory may be the forced storage location. Then it's necessary |
10696 // Mass memory may be the forced storage location. Then it's necessary |
10689 // to switch to (forced) phone memory |
10697 // to switch to (forced) phone memory |
10690 ForceUsePhoneMemoryL( ETrue ); |
10698 TRAP_IGNORE( ForceUsePhoneMemoryL( ETrue ) ); |
10691 PRINT( _L("Camera <= CCamAppController::DriveChangeL dismount pending" ) ); |
10699 PRINT( _L("Camera <= CCamAppController::DriveChangeL dismount pending" ) ); |
10692 |
10700 |
10693 } |
10701 } |
10694 else |
10702 else |
10695 { |
10703 { |
10696 // Mass memory may be the forced storage location. Then it's necessary |
10704 // Mass memory may be the forced storage location. Then it's necessary |
10697 // to switch to (forced) phone memory |
10705 // to switch to (forced) phone memory |
10698 ForceUsePhoneMemoryL( ETrue ); |
10706 TRAP_IGNORE( ForceUsePhoneMemoryL( ETrue ) ); |
10699 PRINT( _L("Camera <= CCamAppController::DriveChangeL dismount ok" ) ); |
10707 PRINT( _L("Camera <= CCamAppController::DriveChangeL dismount ok" ) ); |
10700 |
10708 |
10701 } |
10709 } |
10702 } |
10710 } |
10703 else if ( IsMemoryAvailable( iPreferredStorageLocation, ETrue ) && |
10711 else if ( IsMemoryAvailable( iPreferredStorageLocation, ETrue ) && |
10708 |
10716 |
10709 // if phone memory forced, then revert back to user selected location |
10717 // if phone memory forced, then revert back to user selected location |
10710 if ( iForceUseOfPhoneMemory ) |
10718 if ( iForceUseOfPhoneMemory ) |
10711 { |
10719 { |
10712 PRINT( _L("Camera <> Phone memory is forced, switch back to user selected storage location.") ) |
10720 PRINT( _L("Camera <> Phone memory is forced, switch back to user selected storage location.") ) |
10713 ForceUsePhoneMemoryL( EFalse ); |
10721 TRAP_IGNORE( ForceUsePhoneMemoryL( EFalse ) ); |
10714 } |
10722 } |
10715 else |
10723 else |
10716 { |
10724 { |
10717 PRINT( _L("Camera <> !IsPhoneMemoryForced() -> No action.") ) |
10725 PRINT( _L("Camera <> !IsPhoneMemoryForced() -> No action.") ) |
10718 } |
10726 } |
10727 } |
10735 } |
10728 else if( aType == EDriveDismount && |
10736 else if( aType == EDriveDismount && |
10729 appUi->IsRecoverableStatus() ) |
10737 appUi->IsRecoverableStatus() ) |
10730 { |
10738 { |
10731 TInt mmcInserted = 0; |
10739 TInt mmcInserted = 0; |
|
10740 TInt usbPersonality = 0; |
10732 User::LeaveIfError( RProperty::Get( KPSUidUikon, KUikMMCInserted, mmcInserted ) ); |
10741 User::LeaveIfError( RProperty::Get( KPSUidUikon, KUikMMCInserted, mmcInserted ) ); |
|
10742 User::LeaveIfError(RProperty::Get(KPSUidUsbWatcher, |
|
10743 KUsbWatcherSelectedPersonality, |
|
10744 usbPersonality) ); |
10733 if( !IsMemoryAvailable(ECamMediaStorageMassStorage) && |
10745 if( !IsMemoryAvailable(ECamMediaStorageMassStorage) && |
10734 !IsMemoryAvailable(ECamMediaStorageCard) ) |
10746 !IsMemoryAvailable(ECamMediaStorageCard) ) |
10735 { |
10747 { |
10736 if( mmcInserted ) |
10748 if( KUsbPersonalityIdMS == usbPersonality ) |
10737 { |
10749 { |
10738 SwitchToStandbyL( ECamErrMassStorageMode ); |
10750 SwitchToStandbyL( ECamErrMassStorageMode ); |
10739 |
|
10740 } |
10751 } |
10741 else |
10752 else if ( !mmcInserted ) |
10742 { |
10753 { |
10743 SwitchToStandbyL( ECamErrMemoryCardNotInserted ); |
10754 SwitchToStandbyL( ECamErrMemoryCardNotInserted ); |
10744 |
|
10745 } |
10755 } |
10746 } |
10756 } |
10747 } |
10757 } |
10748 else if ( aType == EDriveUSBMassStorageModeOn ) |
10758 else if ( aType == EDriveUSBMassStorageModeOn ) |
10749 { |
10759 { |
10754 { |
10764 { |
10755 SwitchToStandbyL( KErrNone ); |
10765 SwitchToStandbyL( KErrNone ); |
10756 } |
10766 } |
10757 } |
10767 } |
10758 |
10768 |
|
10769 if( appUi->CurrentViewState() == ECamViewStatePostCapture ) |
|
10770 { |
|
10771 if( aType == EDriveDismount && !IsMemoryAvailable( currentStorage, EFalse )) |
|
10772 { |
|
10773 TVwsViewId activeView; |
|
10774 if ( appUi->GetActiveViewId( activeView ) == KErrNone ) |
|
10775 { |
|
10776 if( ECamViewIdStillPostCapture == activeView.iViewUid.iUid || |
|
10777 ECamViewIdVideoPostCapture == activeView.iViewUid.iUid ) |
|
10778 { |
|
10779 CCamPostCaptureViewBase* view = |
|
10780 static_cast<CCamPostCaptureViewBase*>( appUi->View( activeView.iViewUid ) ); |
|
10781 if( view ) |
|
10782 { |
|
10783 view->HandleCommandL( EAknSoftkeyBack ); |
|
10784 } |
|
10785 } |
|
10786 } |
|
10787 } |
|
10788 } |
10759 |
10789 |
10760 PRINT( _L("Camera <= CCamAppController::DriveChangeL" ) ); |
10790 PRINT( _L("Camera <= CCamAppController::DriveChangeL" ) ); |
10761 return KErrNone; |
10791 return KErrNone; |
10762 } |
10792 } |
10763 |
10793 |
10953 // |
10983 // |
10954 void CCamAppController::CompleteCameraConstructionL() |
10984 void CCamAppController::CompleteCameraConstructionL() |
10955 { |
10985 { |
10956 PRINT( _L( "Camera => CCamAppController::CompleteCameraConstructionL" ) ); |
10986 PRINT( _L( "Camera => CCamAppController::CompleteCameraConstructionL" ) ); |
10957 iCameraController->CompleteSwitchCameraL(); |
10987 iCameraController->CompleteSwitchCameraL(); |
10958 // start reserve and poweron already here |
10988 // start reserve and poweron already here unless embedded mode used |
10959 IssueModeChangeSequenceL( ETrue ); |
10989 CCamAppUi* appUi = static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() ); |
|
10990 if( appUi && !appUi->IsEmbedded() ) |
|
10991 { |
|
10992 IssueModeChangeSequenceL( ETrue ); |
|
10993 } |
10960 PRINT( _L( "Camera <= CCamAppController::CompleteCameraConstructionL" ) ); |
10994 PRINT( _L( "Camera <= CCamAppController::CompleteCameraConstructionL" ) ); |
10961 } |
10995 } |
10962 |
10996 |
10963 // --------------------------------------------------------------------------- |
10997 // --------------------------------------------------------------------------- |
10964 // CCamAppController::CurrentImageIndex |
10998 // CCamAppController::CurrentImageIndex |
11011 // empty the array |
11045 // empty the array |
11012 if( iRotationArray->Count() > 0 ) |
11046 if( iRotationArray->Count() > 0 ) |
11013 { |
11047 { |
11014 iRotationArray->Reset(); |
11048 iRotationArray->Reset(); |
11015 } |
11049 } |
|
11050 if( BurstCaptureArray()->Snapshot( iCurrentImageIndex ) ) |
|
11051 { |
11016 // copy snapshot to preserve the original snapshot bitmap |
11052 // copy snapshot to preserve the original snapshot bitmap |
11017 // first get the handle for the original snapshot bitmap |
11053 // first get the handle for the original snapshot bitmap |
11018 CFbsBitmap* snapshot = new (ELeave)CFbsBitmap(); |
11054 CFbsBitmap* snapshot = new (ELeave)CFbsBitmap(); |
11019 CleanupStack::PushL( snapshot ); |
11055 CleanupStack::PushL( snapshot ); |
11020 snapshot->Duplicate( BurstCaptureArray()->Snapshot( iCurrentImageIndex )->Handle() ); |
11056 snapshot->Duplicate( BurstCaptureArray()->Snapshot( iCurrentImageIndex )->Handle() ); |
11037 iRotatorAo = CCamSyncRotatorAo::NewL( *this ); |
11073 iRotatorAo = CCamSyncRotatorAo::NewL( *this ); |
11038 } |
11074 } |
11039 iRotatorAo->RotateL( iRotatedSnapshot, MapCamOrientation2RotationAngle( iCaptureOrientation ) ); |
11075 iRotatorAo->RotateL( iRotatedSnapshot, MapCamOrientation2RotationAngle( iCaptureOrientation ) ); |
11040 |
11076 |
11041 CleanupStack::PopAndDestroy(snapshot); |
11077 CleanupStack::PopAndDestroy(snapshot); |
|
11078 } |
11042 PRINT( _L( "Camera <= CCamAppController::RotateSnapshotL" ) ); |
11079 PRINT( _L( "Camera <= CCamAppController::RotateSnapshotL" ) ); |
11043 } |
11080 } |
11044 |
11081 |
11045 // --------------------------------------------------------------------------- |
11082 // --------------------------------------------------------------------------- |
11046 // CCamAppController::RotationCompleteL |
11083 // CCamAppController::RotationCompleteL |
11285 // |
11322 // |
11286 TBool CCamAppController::IssueModeChangeSequenceSucceeded() |
11323 TBool CCamAppController::IssueModeChangeSequenceSucceeded() |
11287 { |
11324 { |
11288 return iIssueModeChangeSequenceSucceeded; |
11325 return iIssueModeChangeSequenceSucceeded; |
11289 } |
11326 } |
|
11327 |
|
11328 // --------------------------------------------------------------------------- |
|
11329 // CCamAppController::EmbeddedStartupSequence |
|
11330 // |
|
11331 // --------------------------------------------------------------------------- |
|
11332 // |
|
11333 void CCamAppController::EmbeddedStartupSequence() |
|
11334 { |
|
11335 // If startup sequence fails at this point, it will be tried again later |
|
11336 TRAP_IGNORE( IssueModeChangeSequenceL( ETrue ) ); |
|
11337 } |
|
11338 |
11290 // End of File |
11339 // End of File |
11291 |
11340 |