mmplugins/cameraplugins/source/mmcameraclientplugin/mmcameraclientsession/src/mmcameraclientinterface.h
changeset 0 40261b775718
equal deleted inserted replaced
-1:000000000000 0:40261b775718
       
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @internalTechnology
       
    19 */
       
    20 
       
    21 #ifndef MMCAMERACLIENTINTERFACE_H
       
    22 #define MMCAMERACLIENTINTERFACE_H
       
    23 
       
    24 #include <e32base.h>
       
    25 #include <e32std.h>
       
    26 #include <ecamuids.hrh>
       
    27 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
       
    28 #include <ecamuidsdef.hrh>
       
    29 #endif
       
    30 #include <ecamviewfinder.h>
       
    31 #include <graphics/surface.h>
       
    32 
       
    33 static const TInt KECamMaxMessage = 100;
       
    34 static const TUid KECamServerUid3 = {KUidMMCameraServer};
       
    35 static const TInt KECamNoPriority = -101;
       
    36 static const TInt KECamHandleNotKnown = -1;
       
    37 static const TInt KECamNumAsynchMsg = 8;
       
    38 
       
    39 
       
    40 _LIT(KMMCameraServerName, "!MMCameraServer");
       
    41 _LIT(KMMCameraServerExe, "MMCameraServer");  // Exe name
       
    42 
       
    43 enum TECamMsgId // Enums for use in ServiceL()
       
    44 	{    
       
    45 	ECamQueryCamerasAvailable = 0,	// Query MM server to retrieve number of physical cameras available
       
    46 	ECamCameraAccessControl,    	// Enums to reserve/release the camera for exclusive use. TBool ETrue/EFalse decides Reserve/Release . 
       
    47 	ECamPowerCamera,      			// To Power On the camera if TBool passed =ETrue, else power down 
       
    48   	ECamOpenCamera,        			// Called from ConnectSession to open a particular camera specified by the index 
       
    49 	ECamHandleCamera,     			// Get the handle of the camera 
       
    50 	ECamGetCameraInfo,    			// Retrieve the info about camera device
       
    51 	ECamPrepareDirectViewFinder,	// Sets up the direct view finder
       
    52 	ECamStartDirectViewFinder,		// Starts view finder operation
       
    53 	ECamStopDirectViewFinder,  		// Stops view finder playback
       
    54 	ECamPauseDirectViewFinder,		// Pauses view finder playback
       
    55 	ECamResumeDirectViewFinder,		// If paused, resumes view finder playback
       
    56 	ECamDirectViewFinderState,		// Retrieves state of direct view finder
       
    57 	ECamSetDirectViewFinderMirror,	// Enables/Disables mirror mode on direct viewfinder
       
    58 	ECamGetDirectViewFinderMirror,	// Retrieves mirror mode status of direct viewfinder
       
    59 	ECamDirectViewFinderProperties, // Retrieves properties related to the direct viewfinder
       
    60 	ECamSetParameter,				// Maps Set camera parameters
       
    61 	ECamGetParameter,				// Retrives camera parameters
       
    62 	ECamCameraHandle  		   		// Retrieves unique camera handle
       
    63 	};
       
    64 	
       
    65 enum TCameraParameterId   // Camera parameters to set/get 
       
    66     {
       
    67     EZoomFactor,
       
    68     EDigitalZoomFactor,
       
    69     EContrast,
       
    70     EBrightness,
       
    71     EFlash,
       
    72     EExposure,
       
    73     EWhiteBalance,
       
    74     EJpegQuality
       
    75     };
       
    76 /*    
       
    77 enum TCameraMode   // Camera modes in which the parameter setting is valid 
       
    78     {
       
    79     ECameraVF = 0x0001,
       
    80     ECameraIC = 0x0002,
       
    81     ECameraVC = 0x0004
       
    82     };
       
    83 	
       
    84 */
       
    85 
       
    86 enum TCameraAccessControl
       
    87 	{
       
    88 	ECameraRelease,
       
    89 	ECameraReservedNotification,
       
    90 	ECameraCancelReservedNotification,
       
    91 	ECameraOverthrowNotification,
       
    92 	ECameraCancelOverthrowNotification		
       
    93 	};
       
    94 	
       
    95 enum TCameraPower
       
    96 	{
       
    97 	ECameraPowerOnNotification,
       
    98 	ECameraPowerOff,
       
    99 	ECameraCancelPowerOnNotification		
       
   100 	};
       
   101 	
       
   102 enum TServerPanic
       
   103 	{
       
   104 	EPanicBadDescriptor,
       
   105 	EPanicNotSupported
       
   106 	};
       
   107 	
       
   108 typedef TPckg <TCameraInfo> TCameraInfoBuf;
       
   109 
       
   110 struct TCamerasAvailable
       
   111 	{
       
   112 	TInt iCameraCount;
       
   113 	};
       
   114 typedef TPckg <TCamerasAvailable> TCamerasAvailablePckg;
       
   115 
       
   116 struct TOpenCamera    // Used for passing the infos to the server side session while creating camera channel 
       
   117     {
       
   118     TInt iCameraIndex; // between 0-2 assuming 3 cameras 
       
   119     TInt iPriority; //  If NewDuplicateL called, set KRefCamNoPriority 
       
   120     TInt iHandle;   //  If NewL called, set -1 
       
   121     TBool iMMCapability; // set ETrue 
       
   122     TBool iCollaborativeClient; //  If NewDuplicateL used 
       
   123     };
       
   124 typedef TPckg <TOpenCamera> TOpenCameraPckg;
       
   125 
       
   126 struct TCameraHandle    
       
   127     {
       
   128     TInt iHandle;   
       
   129     };
       
   130 typedef TPckg <TCameraHandle> TCameraHandlePckg;
       
   131 
       
   132 struct TDirectViewFinderInfo    
       
   133     {
       
   134 	TInt iScreenNum;
       
   135 	TRect iScreenRect;
       
   136 	TRect iClipRect;
       
   137 	TSurfaceId iSurfaceId;
       
   138     };
       
   139 typedef TPckg <TDirectViewFinderInfo> TDirectViewFinderInfoPckg;
       
   140 
       
   141 struct TDirectViewFinderState
       
   142 	{
       
   143 	CCamera::CCameraV2DirectViewFinder::TViewFinderState iState;
       
   144 	};
       
   145 typedef TPckg <TDirectViewFinderState> TDirectViewFinderStatePckg;
       
   146 
       
   147 struct TCameraZoom
       
   148 	{
       
   149 	TInt iZoom;
       
   150 	};
       
   151 typedef TPckg <TCameraZoom> TCameraZoomPckg;
       
   152 
       
   153 struct TCameraDigitalZoom
       
   154 	{
       
   155 	TInt iDigitalZoom;
       
   156 	};
       
   157 typedef TPckg <TCameraDigitalZoom> TCameraDigitalZoomPckg;
       
   158 
       
   159 struct TCameraContrast
       
   160 	{
       
   161 	TInt iContrast;
       
   162 	};
       
   163 typedef TPckg <TCameraContrast> TCameraContrastPckg;
       
   164 
       
   165 struct TCameraBrightness
       
   166 	{
       
   167 	TInt iBrightness;
       
   168 	};
       
   169 typedef TPckg <TCameraBrightness> TCameraBrightnessPckg;
       
   170 
       
   171 struct TViewFinderMirror  
       
   172     {
       
   173 	TBool iMirror;
       
   174     };
       
   175 typedef TPckg <TViewFinderMirror> TViewFinderMirrorPckg;
       
   176 
       
   177 struct TCameraFlash
       
   178 	{
       
   179 	CCamera::TFlash iFlash;
       
   180 	};
       
   181 typedef TPckg <TCameraFlash> TCameraFlashPckg;
       
   182 
       
   183 struct TCameraExposure
       
   184 	{
       
   185 	CCamera::TExposure iExposure;
       
   186 	};
       
   187 typedef TPckg <TCameraExposure> TCameraExposurePckg;
       
   188 
       
   189 struct TCameraWhiteBalance
       
   190 	{
       
   191 	CCamera::TWhiteBalance iWhiteBalance;
       
   192 	};
       
   193 typedef TPckg <TCameraWhiteBalance> TCameraWhiteBalancePckg;
       
   194 
       
   195 
       
   196 /**
       
   197  * Interface class to allow communication between clients and server.
       
   198  * 
       
   199  * Provides API's for both synchronous and asynchronous methods of communication. 
       
   200  */
       
   201 class RMMCameraSession : public RSessionBase
       
   202 	{
       
   203 public:
       
   204 	TInt Connect();
       
   205 
       
   206 	TInt SendMessage(TECamMsgId aMsgId, TCameraParameterId aParameterId, TDes8& aMessage);
       
   207 	TInt SendMessage(TECamMsgId aMsgId, TCameraParameterId aParameterId, TInt aMessage);
       
   208 	TInt SendMessage(TECamMsgId aMsgId, TDes8& aMessage);
       
   209 	TInt SendMessage(TECamMsgId aMsgId, TInt aMessage);
       
   210 	TInt SendMessage(TECamMsgId aMsgId);
       
   211 
       
   212 	TInt SendRxMessage(TECamMsgId aMsgId, TCameraParameterId aParameterId, TDes8& aMessage) const;
       
   213 	TInt SendRxMessage(TECamMsgId aMsgId, TCameraParameterId aParameterId, TInt aMessage) const;
       
   214 	TInt SendRxMessage(TECamMsgId aMsgId, TDes8& aMessage) const;
       
   215 
       
   216 	TInt ReceiveMessage(TECamMsgId aMsgId, TDes8& aMessage, TRequestStatus& aStatus);
       
   217 	void ReceiveMessage(TECamMsgId aMsgId, TInt aMessage, TRequestStatus& aStatus);
       
   218 	}; 
       
   219 	
       
   220 #endif // MMCAMERACLIENTINTERFACE_H