sl@0: // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: /** sl@0: @file sl@0: @internalTechnology sl@0: */ sl@0: sl@0: #ifndef MMCAMERACLIENTSESSION_H sl@0: #define MMCAMERACLIENTSESSION_H sl@0: sl@0: sl@0: #include "mmcameraclientinterface.h" sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: sl@0: class CMMDirectViewFinder; // Friend class implementing functionality for CCameraV2DirectViewFinder sl@0: class CMMCameraAccessHandler; // Response class used to handle asynchronous reserve of camera device sl@0: class CMMCameraPowerHandler; // Response class used to handle asynchronous powering of camera device sl@0: sl@0: _LIT(KMMCameraPluginName, "C:\\mmcameraclientplugin.txt"); sl@0: sl@0: sl@0: /** sl@0: * Reference implementation of CCamera. sl@0: * sl@0: */ sl@0: class CMMCameraClientSession : public CCameraPlugin sl@0: { sl@0: friend class CMMCameraAccessHandler; sl@0: friend class CMMCameraPowerHandler; sl@0: friend class CMMDirectViewFinder; sl@0: sl@0: public: sl@0: static CMMCameraClientSession* NewL(); sl@0: ~CMMCameraClientSession(); sl@0: sl@0: // from CCameraPlugin sl@0: void Construct2L(MCameraObserver& aObserver, TInt aCameraIndex); sl@0: void Construct2DupL(MCameraObserver& aObserver, TInt aCameraHandle); sl@0: sl@0: void Construct2L(MCameraObserver2& aObserver, TInt aCameraIndex, TInt aPriority); sl@0: void Construct2DupL(MCameraObserver2& aObserver, TInt aCameraHandle); sl@0: sl@0: // from CCamera itself sl@0: void CameraInfo(TCameraInfo& aInfo) const; sl@0: void Reserve(); sl@0: void Release(); sl@0: void PowerOn(); sl@0: void PowerOff(); sl@0: TInt Handle(); sl@0: void SetZoomFactorL(TInt aZoomFactor = 0); sl@0: TInt ZoomFactor() const; sl@0: void SetDigitalZoomFactorL(TInt aDigitalZoomFactor = 0); sl@0: TInt DigitalZoomFactor() const; sl@0: void SetContrastL(TInt aContrast); sl@0: TInt Contrast() const; sl@0: void SetBrightnessL(TInt aBrightness); sl@0: TInt Brightness() const; sl@0: void SetFlashL(TFlash aFlash = EFlashNone); sl@0: TFlash Flash() const; sl@0: void SetExposureL(TExposure aExposure = EExposureAuto); sl@0: TExposure Exposure() const; sl@0: void SetWhiteBalanceL(TWhiteBalance aWhiteBalance = EWBAuto); sl@0: TWhiteBalance WhiteBalance() const; sl@0: void StartViewFinderDirectL(RWsSession& aWs, CWsScreenDevice& aScreenDevice, RWindowBase& aWindow, TRect& aScreenRect); sl@0: void StartViewFinderDirectL(RWsSession& aWs, CWsScreenDevice& aScreenDevice, RWindowBase& aWindow, TRect& aScreenRect, TRect& aClipRect); sl@0: void StartViewFinderBitmapsL(TSize& aSize); sl@0: void StartViewFinderBitmapsL(TSize& aSize, TRect& aClipRect); sl@0: sl@0: void StartViewFinderL(TFormat aImageFormat, TSize& aSize); sl@0: void StartViewFinderL(TFormat aImageFormat, TSize& aSize, TRect& aClipRect); sl@0: sl@0: void StopViewFinder(); sl@0: TBool ViewFinderActive() const; sl@0: void SetViewFinderMirrorL(TBool aMirror); sl@0: TBool ViewFinderMirror() const; sl@0: void PrepareImageCaptureL(TFormat aImageFormat, TInt aSizeIndex); sl@0: void PrepareImageCaptureL(TFormat aImageFormat, TInt aSizeIndex, const TRect& aClipRect); sl@0: void CaptureImage(); sl@0: void CancelCaptureImage(); sl@0: void EnumerateCaptureSizes(TSize& aSize, TInt aSizeIndex, TFormat aFormat) const; sl@0: void PrepareVideoCaptureL(TFormat aFormat, TInt aSizeIndex, TInt aRateIndex, TInt aBuffersToUse, TInt aFramesPerBuffer); sl@0: void PrepareVideoCaptureL(TFormat aFormat, TInt aSizeIndex, TInt aRateIndex, TInt aBuffersToUse, TInt aFramesPerBuffer, const TRect& aClipRect); sl@0: void StartVideoCapture(); sl@0: void StopVideoCapture(); sl@0: TBool VideoCaptureActive() const; sl@0: void EnumerateVideoFrameSizes(TSize& aSize, TInt aSizeIndex, TFormat aFormat) const; sl@0: void EnumerateVideoFrameRates(TReal32& aRate, TInt aRateIndex, TFormat aFormat, TInt aSizeIndex, TExposure aExposure = EExposureAuto) const; sl@0: void GetFrameSize(TSize& aSize) const; sl@0: TReal32 FrameRate() const; sl@0: TInt BuffersInUse() const; sl@0: TInt FramesPerBuffer() const; sl@0: void SetJpegQuality(TInt aQuality); sl@0: TInt JpegQuality() const; sl@0: TAny* CustomInterface(TUid aInterface); sl@0: sl@0: private: sl@0: CMMCameraClientSession(); sl@0: sl@0: private: sl@0: MCameraObserver2* iCameraObserver2; // not owned sl@0: CMMDirectViewFinder* iDirectViewFinder; sl@0: MCameraViewFinder* iVF; sl@0: sl@0: CMMCameraAccessHandler* iCameraAccessHandler; // This response class gets created by the plugin class as part of its construction process sl@0: CMMCameraPowerHandler* iCameraPowerHandler; // This response class gets created by the plugin class as part of its construction process sl@0: RMMCameraSession iCameraSession; // handle to client side session to perform synchronous request of CCamera sl@0: sl@0: RHashMap iHashMap; sl@0: sl@0: // ECam States sl@0: TBool iReserved; sl@0: TBool iPoweredUp; sl@0: TBool iPrepareCompleted; sl@0: sl@0: TInt iCameraIndex; sl@0: TInt iCameraHandle; sl@0: TInt iPriority; sl@0: TBool iCollaborativeClient; sl@0: }; sl@0: sl@0: class CMMCameraClientSessionInfo : public CCameraInfoPlugin sl@0: { sl@0: public: sl@0: static CMMCameraClientSessionInfo* NewL(); // may need to connect and create session sl@0: sl@0: ~CMMCameraClientSessionInfo(); sl@0: sl@0: // from CCameraInfoPlugin sl@0: TInt CamerasAvailable(); sl@0: sl@0: private: sl@0: CMMCameraClientSessionInfo(); sl@0: }; sl@0: sl@0: class FileDependencyUtil sl@0: { sl@0: public: sl@0: static void CheckFileDependencyL(); sl@0: }; sl@0: sl@0: sl@0: class CMMCameraAccessHandler : public CActive sl@0: { sl@0: public: sl@0: static CMMCameraAccessHandler* NewL(CMMCameraClientSession* aPlugin, TInt aPriority); sl@0: sl@0: ~CMMCameraAccessHandler(); sl@0: sl@0: void Reserve(); sl@0: /*void PowerOn(); sl@0: void CaptureImage(TInt aNumberOfImages); // aNumberOfImages is 0 for Image Capture and >1 for burst image( future case) sl@0: void StartVideoCapture();*/ sl@0: sl@0: protected: sl@0: void RunL(); // void GrabImageData() and GrabVideoData() should be in RRefCameraSession sl@0: void DoCancel(); sl@0: sl@0: private: sl@0: CMMCameraAccessHandler(CMMCameraClientSession* aPlugin, TInt aPriority); sl@0: sl@0: private: sl@0: CMMCameraClientSession* iPlugin; sl@0: sl@0: /*TInt iReqStillImages; sl@0: TInt iCapturedStillImages; sl@0: TInt iVideoFrames; // initialized as 0 and gets incremented every time new video frame is received sl@0: */}; sl@0: sl@0: sl@0: class CMMCameraPowerHandler : public CActive sl@0: { sl@0: public: sl@0: static CMMCameraPowerHandler* NewL(CMMCameraClientSession* aPlugin, TInt aPriority); sl@0: sl@0: ~CMMCameraPowerHandler(); sl@0: sl@0: void PowerOn(); sl@0: sl@0: protected: sl@0: void RunL(); sl@0: void DoCancel(); sl@0: sl@0: private: sl@0: CMMCameraPowerHandler(CMMCameraClientSession* aPlugin, TInt aPriority); sl@0: sl@0: private: sl@0: CMMCameraClientSession* iPlugin; sl@0: }; sl@0: sl@0: #endif // MMCAMERACLIENTSESSION_H sl@0: