os/mm/mmplugins/cameraplugins/source/mmcameraclientplugin/mmcameraclientsession/src/mmcameraclientsession.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
/**
sl@0
    17
 @file
sl@0
    18
 @internalTechnology
sl@0
    19
*/
sl@0
    20
sl@0
    21
#ifndef MMCAMERACLIENTSESSION_H
sl@0
    22
#define MMCAMERACLIENTSESSION_H
sl@0
    23
sl@0
    24
sl@0
    25
#include "mmcameraclientinterface.h"
sl@0
    26
sl@0
    27
#include <ecam/ecamplugin.h>
sl@0
    28
#include <ecam/ecaminfoplugin.h>
sl@0
    29
#include <ecam/ecamviewfinderintf.h>
sl@0
    30
#include <e32hashtab.h>
sl@0
    31
sl@0
    32
sl@0
    33
class CMMDirectViewFinder; // Friend class implementing functionality for CCameraV2DirectViewFinder
sl@0
    34
class CMMCameraAccessHandler; // Response class used to handle asynchronous reserve of camera device
sl@0
    35
class CMMCameraPowerHandler; // Response class used to handle asynchronous powering of camera device
sl@0
    36
sl@0
    37
_LIT(KMMCameraPluginName, "C:\\mmcameraclientplugin.txt");
sl@0
    38
sl@0
    39
sl@0
    40
/**
sl@0
    41
* Reference implementation of CCamera.
sl@0
    42
* 
sl@0
    43
*/
sl@0
    44
class CMMCameraClientSession : public CCameraPlugin
sl@0
    45
	{
sl@0
    46
friend class CMMCameraAccessHandler;
sl@0
    47
friend class CMMCameraPowerHandler;
sl@0
    48
friend class CMMDirectViewFinder;
sl@0
    49
sl@0
    50
public:
sl@0
    51
	static CMMCameraClientSession* NewL();
sl@0
    52
	~CMMCameraClientSession();
sl@0
    53
sl@0
    54
	// from CCameraPlugin
sl@0
    55
	void Construct2L(MCameraObserver& aObserver, TInt aCameraIndex);
sl@0
    56
	void Construct2DupL(MCameraObserver& aObserver, TInt aCameraHandle);
sl@0
    57
	
sl@0
    58
	void Construct2L(MCameraObserver2& aObserver, TInt aCameraIndex, TInt aPriority);
sl@0
    59
	void Construct2DupL(MCameraObserver2& aObserver, TInt aCameraHandle);
sl@0
    60
sl@0
    61
	// from CCamera itself
sl@0
    62
	void CameraInfo(TCameraInfo& aInfo) const;
sl@0
    63
	void Reserve();
sl@0
    64
	void Release();
sl@0
    65
	void PowerOn();
sl@0
    66
	void PowerOff();
sl@0
    67
	TInt Handle();
sl@0
    68
	void SetZoomFactorL(TInt aZoomFactor = 0);
sl@0
    69
	TInt ZoomFactor() const;
sl@0
    70
	void SetDigitalZoomFactorL(TInt aDigitalZoomFactor = 0);
sl@0
    71
	TInt DigitalZoomFactor() const;
sl@0
    72
	void SetContrastL(TInt aContrast);
sl@0
    73
	TInt Contrast() const;
sl@0
    74
	void SetBrightnessL(TInt aBrightness);
sl@0
    75
	TInt Brightness() const;
sl@0
    76
	void SetFlashL(TFlash aFlash = EFlashNone);
sl@0
    77
	TFlash Flash() const;
sl@0
    78
	void SetExposureL(TExposure aExposure = EExposureAuto);
sl@0
    79
	TExposure Exposure() const;
sl@0
    80
	void SetWhiteBalanceL(TWhiteBalance aWhiteBalance = EWBAuto);
sl@0
    81
	TWhiteBalance WhiteBalance() const;
sl@0
    82
	void StartViewFinderDirectL(RWsSession& aWs, CWsScreenDevice& aScreenDevice, RWindowBase& aWindow, TRect& aScreenRect);
sl@0
    83
	void StartViewFinderDirectL(RWsSession& aWs, CWsScreenDevice& aScreenDevice, RWindowBase& aWindow, TRect& aScreenRect, TRect& aClipRect);
sl@0
    84
	void StartViewFinderBitmapsL(TSize& aSize);	
sl@0
    85
	void StartViewFinderBitmapsL(TSize& aSize, TRect& aClipRect);
sl@0
    86
sl@0
    87
	void StartViewFinderL(TFormat aImageFormat, TSize& aSize);
sl@0
    88
	void StartViewFinderL(TFormat aImageFormat, TSize& aSize, TRect& aClipRect);
sl@0
    89
sl@0
    90
	void StopViewFinder();
sl@0
    91
	TBool ViewFinderActive() const;
sl@0
    92
	void SetViewFinderMirrorL(TBool aMirror);
sl@0
    93
	TBool ViewFinderMirror() const;
sl@0
    94
	void PrepareImageCaptureL(TFormat aImageFormat, TInt aSizeIndex);
sl@0
    95
	void PrepareImageCaptureL(TFormat aImageFormat, TInt aSizeIndex, const TRect& aClipRect);
sl@0
    96
	void CaptureImage();
sl@0
    97
	void CancelCaptureImage();
sl@0
    98
	void EnumerateCaptureSizes(TSize& aSize, TInt aSizeIndex, TFormat aFormat) const;
sl@0
    99
	void PrepareVideoCaptureL(TFormat aFormat, TInt aSizeIndex, TInt aRateIndex, TInt aBuffersToUse, TInt aFramesPerBuffer);
sl@0
   100
	void PrepareVideoCaptureL(TFormat aFormat, TInt aSizeIndex, TInt aRateIndex, TInt aBuffersToUse, TInt aFramesPerBuffer, const TRect& aClipRect);
sl@0
   101
	void StartVideoCapture();
sl@0
   102
	void StopVideoCapture();
sl@0
   103
	TBool VideoCaptureActive() const;
sl@0
   104
	void EnumerateVideoFrameSizes(TSize& aSize, TInt aSizeIndex, TFormat aFormat) const;
sl@0
   105
	void EnumerateVideoFrameRates(TReal32& aRate, TInt aRateIndex, TFormat aFormat, TInt aSizeIndex, TExposure aExposure = EExposureAuto) const;
sl@0
   106
	void GetFrameSize(TSize& aSize) const;
sl@0
   107
	TReal32 FrameRate() const;
sl@0
   108
	TInt BuffersInUse() const;
sl@0
   109
	TInt FramesPerBuffer() const;
sl@0
   110
	void SetJpegQuality(TInt aQuality);
sl@0
   111
	TInt JpegQuality() const;
sl@0
   112
	TAny* CustomInterface(TUid aInterface);
sl@0
   113
sl@0
   114
private:
sl@0
   115
	CMMCameraClientSession();
sl@0
   116
sl@0
   117
private:
sl@0
   118
	MCameraObserver2* 			iCameraObserver2; // not owned
sl@0
   119
	CMMDirectViewFinder*	 	iDirectViewFinder;
sl@0
   120
	MCameraViewFinder*			iVF;
sl@0
   121
sl@0
   122
	CMMCameraAccessHandler* 	iCameraAccessHandler; // This response class gets created by the plugin class as part of its construction process
sl@0
   123
	CMMCameraPowerHandler* 		iCameraPowerHandler; // This response class gets created by the plugin class as part of its construction process
sl@0
   124
	RMMCameraSession 			iCameraSession; // handle to client side session to perform synchronous request of CCamera
sl@0
   125
sl@0
   126
	RHashMap<TInt, CCameraV2DirectViewFinder*>					iHashMap;
sl@0
   127
sl@0
   128
	// ECam States
sl@0
   129
	TBool iReserved;
sl@0
   130
	TBool iPoweredUp;
sl@0
   131
	TBool iPrepareCompleted;
sl@0
   132
sl@0
   133
	TInt iCameraIndex;
sl@0
   134
	TInt iCameraHandle;
sl@0
   135
	TInt iPriority;
sl@0
   136
	TBool iCollaborativeClient;
sl@0
   137
	};
sl@0
   138
	
sl@0
   139
class CMMCameraClientSessionInfo : public CCameraInfoPlugin
sl@0
   140
	{
sl@0
   141
public:
sl@0
   142
	static CMMCameraClientSessionInfo* NewL();  // may need to connect and create session
sl@0
   143
	
sl@0
   144
	~CMMCameraClientSessionInfo();
sl@0
   145
	
sl@0
   146
	// from CCameraInfoPlugin
sl@0
   147
	TInt CamerasAvailable();
sl@0
   148
	
sl@0
   149
private:
sl@0
   150
	CMMCameraClientSessionInfo();
sl@0
   151
	};
sl@0
   152
sl@0
   153
class FileDependencyUtil
sl@0
   154
	{
sl@0
   155
public:
sl@0
   156
	static void CheckFileDependencyL();
sl@0
   157
	};
sl@0
   158
sl@0
   159
sl@0
   160
class CMMCameraAccessHandler : public CActive
sl@0
   161
    {
sl@0
   162
public: 
sl@0
   163
    static CMMCameraAccessHandler* NewL(CMMCameraClientSession* aPlugin, TInt aPriority);
sl@0
   164
    
sl@0
   165
    ~CMMCameraAccessHandler();
sl@0
   166
    
sl@0
   167
    void Reserve();
sl@0
   168
    /*void PowerOn();
sl@0
   169
    void CaptureImage(TInt aNumberOfImages); // aNumberOfImages is 0 for Image Capture and >1 for burst image( future case) 
sl@0
   170
    void StartVideoCapture();*/
sl@0
   171
    
sl@0
   172
protected:
sl@0
   173
    void RunL();  // void GrabImageData() and GrabVideoData() should be in RRefCameraSession 
sl@0
   174
    void DoCancel();
sl@0
   175
sl@0
   176
private:
sl@0
   177
	CMMCameraAccessHandler(CMMCameraClientSession* aPlugin, TInt aPriority);
sl@0
   178
sl@0
   179
private:
sl@0
   180
    CMMCameraClientSession* iPlugin;
sl@0
   181
    
sl@0
   182
    /*TInt iReqStillImages;
sl@0
   183
    TInt iCapturedStillImages;
sl@0
   184
    TInt iVideoFrames;  // initialized as 0 and gets incremented every time new video frame is received 
sl@0
   185
    */};
sl@0
   186
    
sl@0
   187
sl@0
   188
class CMMCameraPowerHandler : public CActive
sl@0
   189
    {
sl@0
   190
public: 
sl@0
   191
    static CMMCameraPowerHandler* NewL(CMMCameraClientSession* aPlugin, TInt aPriority);
sl@0
   192
    
sl@0
   193
    ~CMMCameraPowerHandler();
sl@0
   194
    
sl@0
   195
    void PowerOn();
sl@0
   196
        
sl@0
   197
protected:
sl@0
   198
    void RunL();  
sl@0
   199
    void DoCancel();
sl@0
   200
sl@0
   201
private:
sl@0
   202
	CMMCameraPowerHandler(CMMCameraClientSession* aPlugin, TInt aPriority);
sl@0
   203
sl@0
   204
private:
sl@0
   205
    CMMCameraClientSession* iPlugin;
sl@0
   206
    };
sl@0
   207
sl@0
   208
#endif // MMCAMERACLIENTSESSION_H
sl@0
   209