⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cameraappcontroller.h

📁 Symbian智能手机操作系统源代码值的参考_摄像头
💻 H
字号:
/*
* ============================================================================
*  Name     : CameraAppController.h
*  Part of  : CameraApp
*  Description:
*     Interface between the UI and the external modules
*  Created  : 05/06/2006 by Forum Nokia
*  Version  : 2.0
*  Copyright: Nokia Corporation, 2006
* ============================================================================
*/

#ifndef __CAMERA_CONTROLLER_H__
#define __CAMERA_CONTROLLER_H__

#include <e32base.h>
#include <eikapp.h>

#include <avkon.hrh>
#include <avkon.rsg>
#include <StringLoader.h>

#include <AknViewAppUi.h>
#include <MdaAudioSamplePlayer.h>  // For playing the snap sound
//#include <savarset.h>

#define __WITHIN_MCI_LIBRARY 
#include <ImageConversion.h> 

#include <f32file.h>
#include "CameraApp.hrh"

class TVolumeInfo;
class TRequestStatus;
class TSysAgentEvent;
class CCoeControl;

class CCameraCaptureEngine;
class CPAlbImageData;
class CFbsBitmap;
class CAknKeySoundSystem;

const TInt KWhiteColor = 0;
_LIT(KJpgFileExtension, ".jpg");
_LIT8(KMimeType,"image/jpeg");

// The name for the image file.
_LIT(KImageFileName, "CameraApp");

const TInt KSnapSoundId = 2;

/**
* Interface between the UI and the external modules
*/
class CCameraAppController : public CBase, public MMdaAudioPlayerCallback
    {
    public: // Constructor and Destructor

        /**
         * Symbian OS C++ default constructor.
         */
        CCameraAppController(CAknViewAppUi& aAppUi); 

        /**
         * Destructor
         */
        virtual ~CCameraAppController();

        /**
         * Symbian OS second phase constructor.
         */
        void ConstructL();  

    public:
        /**
         * Set the zoom factor
         * @param aEnable, enable the zooming
         *        true  == increase the zoom factor
         *        false == decrease the zoom factor
         * @return zoom factor used
         */
        TInt SetZoomL(TBool aEnable);

        /**
         * Check whether the camera is being used by another app.
         * @return, true if it used by another app. 
         */
        TBool IsCameraUsedByAnotherApp();

        /**
         * Handle the error message from the engine
         * @param aError a error message to be handled  
         */
        void HandleError(TInt aError );

        /**
         * Set the engine state
         * @param aState, new state of the engine
         */
        void SetEngineState( TEngineState aState );

        /**
         * Get the engine state
         * @return return the current engine state
         */
        TEngineState GetEngineState();

        /**
         * Redraw the navi tabs	
         */
        void RedrawNaviTabsL();

        /**
         * Returns whether the image coversion is in progress or not
         * @return true if an image is being converted
         */
        TBool IsImageConversionInProgress();

        /**
         * Update the conversion status
         * @param aStatus, the status to be shown "Image saving..." etc
         */
        void ShowConversionStatusL(const TDesC &aStatus );

        /**
         * Set the camera mode
         * @param aCameraMode, the new camera mode
         */
        void SetCameraMode(TCameraState aCameraMode);       

        /**
        * Gives snapped image to be displayed in the current view
        * @return CFbsBitmap& image to be displayed
        */
        CFbsBitmap& GetSnappedImage();

        /**
        * Gives camera mode setting
        * @return TInt current camera mode
        */
        TCameraState CameraMode() const;

        /**
        * Gives reference to Active view container to Controller
        * @param aAppContainer reference to view container
        * @param aViewId active view Id 
        * @return void
        */
        void SetAppContainer( CCoeControl* aAppContainer, TCameraViewIds aViewId );

        /**
        * Initialize Camera 
        * @return void
        */
        void InitializeCameraL(const TRect& aRect);       

        /**
        * Stops view finding
        * @return void
        */
        void StopViewFinder();

        /**
        * Starts the Active Objet that calls ViewFinding operation regularly
        * @return void
        */        
        void StartViewFinderL();

        /**
        * Gets image from image capture engine, and displays it on screen
        * @return void
        */
        void ViewFinding(CFbsBitmap& aFrame);

        /**
        * Snaps image through the Camera API
        * @return void
        */
        void SnapL();

        /**
        * Returns current quality factor
        * @return TJpegQualityFactor
        */
        TJpegQualityFactor QualityFactor() const;

        /**
        * Saves the snapped image on disk
        * @return void
        */        
        void SaveImageL();

        /**
        * Returns the complete path of the saved image
        * @return TDesC& complete path and name of the last saved image
        */
        const TDesC& ImagePath() const;
   
        /**
        * Initializes snap sound player
        * @return void
        */
        void CreateSoundPlayerL();

        /**
        * Returns default display mode
        * @return TDisplayMode
        */
        TDisplayMode DisplayMode() const;

        /**
        * Releases camera
        * @return void
        */
        void ReleaseCamera();

        /**
        * Bitmaps will be as close as possible to requested size but may not be exactly 
        * if only certain sizes are supported. The actual size used will be set in aSize
        * @param TSize, size of image
        * @return void
        */
        void SetActualVFSize( const TSize& aSize);

        /**
        * Plays snap sound by calling engine's StartPlay()
        * @param TInt aSoundId 
        * @return void
        */
        void PlaySnapSound( );
        
        /**
        * Notify the controller if the client rect size changes
        * @param The new client rect
        */
        void ClientRectChangedL(const TRect& aRect);
        
    private: 
        // From MMdaAudioPlayerCallback
        void MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds &aDuration);
        void MapcPlayComplete(TInt aError);
    
        /**
         * Powers off the camera
         * @return void
         */
        void PowerOff();

        /**
         * Get the next usable file name
         * @return void
         */
        void GetNextUsableFileName();

    private: // data
        CAknViewAppUi& iAppUi; // Not owned by this class
        TCameraState iCameraMode;   
        CCameraCaptureEngine* iCameraCaptureEngine;
        CFbsBitmap* iBitmapSnap;
        HBufC* iImagePath;
        TFileName* iPath;

        CCoeControl* iContainer; //Not owned by class     

        TCameraViewIds iActiveView;
        CEikonEnv* iEikEnv; // Not owned by this class
        CMdaAudioPlayerUtility* iSoundPlayer;
        TBool iSoundPlayerReady; // Was the sound player initialized properly?
        TFileName iNewFileName;
    };

#endif // __CAMERA_CONTROLLER_H__

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -