kernel/eka/include/d32camerasc.h
changeset 0 a41df078684a
child 4 56f325a607ea
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     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 the License "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 // e32\include\d32camerasc.h
       
    15 // User side class definition for the shared chunk camera driver.
       
    16 // 
       
    17 //
       
    18 
       
    19 /**
       
    20  @file
       
    21  @internalAll
       
    22  @prototype
       
    23 */
       
    24 
       
    25 #ifndef __D32CAMERASC_H__
       
    26 #define __D32CAMERASC_H__
       
    27 
       
    28 #include <e32cmn.h>
       
    29 #include <e32ver.h>
       
    30 #include <pixelformats.h>
       
    31 
       
    32 _LIT(KDevCameraScName,"CameraSc");
       
    33 
       
    34 /**
       
    35 Camera capability constants - bitmasks of possible flash modes. @see TCameraCapsV02.
       
    36 */
       
    37 /** Flash will automatically fire when required. */
       
    38 const TUint KCamFlashAuto = 0x0001;
       
    39 /** Flash will always fire. */
       
    40 const TUint KCamFlashForced = 0x0002;
       
    41 /** Reduced flash for general lighting */
       
    42 const TUint KCamFlashFillIn = 0x0004;
       
    43 /** Red-eye reduction mode. */
       
    44 const TUint KCamFlashRedEyeReduce = 0x0008;
       
    45 /** Flash at the moment when shutter opens. */
       
    46 const TUint KCamFlashSlowFrontSync = 0x0010;
       
    47 /** Flash at the moment when shutter closes. */
       
    48 const TUint KCamFlashSlowRearSync = 0x0020;
       
    49 /** User configurable setting */
       
    50 const TUint KCamFlashManual = 0x0040;
       
    51 
       
    52 /**
       
    53 Camera capability constants - bitmasks of possible exposure modes. @see TCameraCapsV02.
       
    54 */
       
    55 /** Night-time setting for long exposures. */
       
    56 const TUint KCamExposureNight = 0x0001;
       
    57 /** Backlight setting for bright backgrounds. */
       
    58 const TUint KCamExposureBacklight = 0x0002;
       
    59 /** Centered mode for ignoring surroundings. */
       
    60 const TUint KCamExposureCenter = 0x0004;
       
    61 /** Sport setting for very short exposures. */
       
    62 const TUint KCamExposureSport = 0x0008;
       
    63 /** Generalised setting for very long exposures. */
       
    64 const TUint KCamExposureVeryLong = 0x0010;
       
    65 /** Snow setting for daylight exposure. */
       
    66 const TUint KCamExposureSnow = 0x0020;
       
    67 /** Beach setting for daylight exposure with reflective glare. */
       
    68 const TUint KCamExposureBeach = 0x0040;
       
    69 /** Programmed exposure setting. */
       
    70 const TUint KCamExposureProgram = 0x0080;
       
    71 /** Aperture setting is given priority. */
       
    72 const TUint KCamExposureAperturePriority = 0x0100;
       
    73 /** Shutter speed setting is given priority. */
       
    74 const TUint KCamExposureShutterPriority = 0x0200;
       
    75 /** User selectable exposure value setting. */
       
    76 const TUint KCamExposureManual = 0x0400;
       
    77 /** Exposure night setting with colour removed to get rid of colour noise. */
       
    78 const TUint KCamExposureSuperNight = 0x0800;
       
    79 /** Exposure for infra-red sensor on the camera */
       
    80 const TUint KCamExposureInfra = 0x1000;
       
    81 
       
    82 /**
       
    83 Camera capability constants - bitmasks of possible white balance modes. @see TCameraCapsV02.
       
    84 */
       
    85 /** Normal daylight. */
       
    86 const TUint KCamWBDaylight = 0x0001;
       
    87 /** Overcast daylight. */
       
    88 const TUint KCamWBCloudy = 0x0002;
       
    89 /** Tungsten filament lighting. */
       
    90 const TUint KCamWBTungsten = 0x0004;
       
    91 /** Fluorescent tube lighting */
       
    92 const TUint KCamWBFluorescent = 0x0008;
       
    93 /** Flash lighting. */
       
    94 const TUint KCamWBFlash = 0x0010;
       
    95 /** High contrast daylight primarily snowy */
       
    96 const TUint KCamWBSnow = 0x0020;
       
    97 /** High contrast daylight primarily near the sea */
       
    98 const TUint KCamWBBeach = 0x0040;
       
    99 /** User configurable mode */
       
   100 const TUint KCamWBManual = 0x0080;
       
   101 
       
   102 /**
       
   103 Camera capability constants - bitmasks of other miscellaneous camera capabilities supported. @see TCameraCapsV02.
       
   104 */
       
   105 /** The camera has zoom capability. */
       
   106 const TUint KCamMiscZoom = 0x0001;
       
   107 /** The camera supports contrast adjustment. */
       
   108 const TUint KCamMiscContrast = 0x0002;
       
   109 /** The camera supports brightness adjustment. */
       
   110 const TUint KCamMiscBrightness = 0x0004;
       
   111 /** The camera supports color effect adjustment. */
       
   112 const TUint KCamMiscColorEffect = 0x0008;
       
   113 
       
   114 
       
   115 /**
       
   116 Enumeration of capture modes in which to run the sensor.
       
   117 */
       
   118 enum TDevCamCaptureMode
       
   119 	{
       
   120 	/** Used to specify that still image mode is to be used. */
       
   121 	ECamCaptureModeImage,
       
   122 	/** Used to specify that streaming video mode is to be used. */
       
   123 	ECamCaptureModeVideo,
       
   124 	/** Used to specify that streaming viewfinder mode is to be used. */
       
   125 	ECamCaptureModeViewFinder,
       
   126 	/** The last value here, helps keep track of the number of capture modes. */
       
   127 	ECamCaptureModeMax
       
   128 	};
       
   129 
       
   130 /**
       
   131 Enumeration of camera flash modes. @see TCameraConfigV02.
       
   132 */
       
   133 enum TDevCamFlashMode
       
   134 	{
       
   135 	/** No flash, always supported. */
       
   136 	ECamFlashNone=0x0000,
       
   137 	/** Flash will automatically fire when required. */
       
   138 	ECamFlashAuto=0x0001,
       
   139 	/** Flash will always fire. */
       
   140 	ECamFlashForced=0x0002,
       
   141 	/** Reduced flash for general lighting */
       
   142 	ECamFlashFillIn=0x0004,
       
   143 	/** Red-eye reduction mode. */
       
   144 	ECamFlashRedEyeReduce=0x0008,
       
   145 	/** Flash at the moment when shutter opens. */
       
   146 	ECamFlashSlowFrontSync=0x0010,
       
   147 	/** Flash at the moment when shutter closes. */
       
   148 	ECamFlashSlowRearSync=0x0020,
       
   149 	/** User configurable setting */
       
   150 	ECamFlashManual=0x0040
       
   151 	};
       
   152 
       
   153 /**
       
   154 Enumeration of camera exposure modes. @see TCameraConfigV02.
       
   155 */
       
   156 enum TDevCamExposureMode
       
   157 	{
       
   158 	/** Set exposure automatically. Default, always supported. */
       
   159 	ECamExposureAuto=0x0000,
       
   160 	/** Night-time setting for long exposures. */
       
   161 	ECamExposureNight=0x0001,
       
   162 	/** Backlight setting for bright backgrounds. */
       
   163 	ECamExposureBacklight=0x0002,
       
   164 	/** Centered mode for ignoring surroundings. */
       
   165 	ECamExposureCenter=0x0004,
       
   166 	/** Sport setting for very short exposures. */
       
   167 	ECamExposureSport=0x0008,
       
   168 	/** Generalised setting for very long exposures. */
       
   169 	ECamExposureVeryLong=0x0010,
       
   170 	/** Snow setting for daylight exposure. */
       
   171 	ECamExposureSnow=0x0020,
       
   172 	/** Beach setting for daylight exposure with reflective glare. */
       
   173 	ECamExposureBeach=0x0040,
       
   174 	/** Programmed exposure setting. */
       
   175 	ECamExposureProgram=0x0080,
       
   176 	/** Aperture setting is given priority. */
       
   177 	ECamExposureAperturePriority=0x0100,
       
   178 	/** Shutter speed setting is given priority. */
       
   179 	ECamExposureShutterPriority=0x0200,
       
   180 	/** User selectable exposure value setting. */
       
   181 	ECamExposureManual=0x0400,
       
   182 	/** Exposure night setting with colour removed to get rid of colour noise. */
       
   183 	ECamExposureSuperNight=0x0800,
       
   184 	/** Exposure for infra-red sensor on the camera */
       
   185 	ECamExposureInfra=0x1000
       
   186 	};
       
   187 
       
   188 /**
       
   189 Enumeration of camera white balance modes. @see TCameraConfigV02.
       
   190 */
       
   191 enum TDevCamWhiteBalanceMode
       
   192 	{
       
   193 	/** Set white balance automatically. Default, always supported. */
       
   194 	ECamWBAuto=0x0000,
       
   195 	/** Normal daylight. */
       
   196 	ECamWBDaylight=0x0001,
       
   197 	/** Overcast daylight. */
       
   198 	ECamWBCloudy=0x0002,
       
   199 	/** Tungsten filament lighting. */
       
   200 	ECamWBTungsten=0x0004,
       
   201 	/** Fluorescent tube lighting */
       
   202 	ECamWBFluorescent=0x0008,
       
   203 	/** Flash lighting. */
       
   204 	ECamWBFlash=0x0010,
       
   205 	/** High contrast daylight primarily snowy */
       
   206 	ECamWBSnow=0x0020,
       
   207 	/** High contrast daylight primarily near the sea */
       
   208 	ECamWBBeach=0x0040,
       
   209 	/** User configurable mode */
       
   210 	ECamWBManual=0x0080
       
   211 	};
       
   212 
       
   213 /**
       
   214 Enumeration of possible directions in which the camera may point. @see TCameraCapsV02.
       
   215 */
       
   216 enum TDevCamOrientation
       
   217 	{
       
   218 	/** Outward pointing camera for taking pictures. Camera is directed away from the user. */
       
   219 	ECamOrientationOutwards,
       
   220 	/** Inward pointing camera for conferencing. Camera is directed towards the user. */
       
   221 	ECamOrientationInwards,
       
   222 	/** Mobile camera capable of multiple orientations. Camera orientation may be changed by the user. */
       
   223 	ECamOrientationMobile,
       
   224 	/** Camera orientation is not known. */
       
   225 	ECamOrientationUnknown
       
   226 	};
       
   227 
       
   228 /**
       
   229 Each item in the iPixelFormatSupported array is represented by an instance of this structure.
       
   230 */
       
   231 struct SDevCamPixelFormat
       
   232 	{
       
   233 	/** The UID of the pixel format supported */
       
   234 	TUidPixelFormat iPixelFormat;
       
   235 	/** The number of frame sizes represented by the pixel format. */
       
   236 	TUint iNumFrameSizes;
       
   237 	/** The pixel width in number of bytes */
       
   238 	TUint iPixelWidthInBytes;
       
   239 	};
       
   240 
       
   241 /**
       
   242 Each frame size supported is represented by an instance of this structure.
       
   243 */
       
   244 struct SDevCamFrameSize
       
   245 	{
       
   246 	/** Width of the frame in pixels. */
       
   247 	TUint iWidth;
       
   248 	/** Height of the frame in pixels. */
       
   249 	TUint iHeight;
       
   250 	/** Minimum frame rate supported by this frame size. */
       
   251 	TUint iMinFrameRate;
       
   252 	/** Maximum frame rate supported by this frame size. */
       
   253 	TUint iMaxFrameRate;
       
   254 	};
       
   255 
       
   256 /**
       
   257 Lets us associate buffers to their mode when working out the buffer offset in a chunk.
       
   258 **/
       
   259 class TDevCamBufferModeAndId
       
   260 	{
       
   261 public:
       
   262 	TDevCamCaptureMode iCaptureMode;
       
   263 	TInt iId;
       
   264 	};
       
   265 typedef TPckgBuf<TDevCamBufferModeAndId> TDevCamBufferModeAndIdBuf;
       
   266 
       
   267 /**
       
   268 The general driver capabilites class - returned by the LDD factory in response to RDevice::GetCaps().
       
   269 */
       
   270 class TCapsDevCameraV01
       
   271 	{
       
   272 public:
       
   273 	TVersion iVersion;
       
   274 	};
       
   275 
       
   276 /**
       
   277 Defines a list of settings that are changable often (dynamically) within a single use of the device.
       
   278 */
       
   279 enum TDevCamDynamicAttributes
       
   280 	{
       
   281 	ECamAttributeBrightness,
       
   282 	ECamAttributeContrast,
       
   283 	ECamAttributeColorEffect,
       
   284 	ECamAttributeMax
       
   285 	};
       
   286 
       
   287 /**
       
   288 Holds the range and interval (rate of change) values for a dynamic capability.
       
   289 An array of these would be indexed by TDevCamDynamicAttributes
       
   290 */
       
   291 struct TDynamicRange
       
   292 	{
       
   293 	TUint iMin;
       
   294 	TUint iMax;
       
   295 	};
       
   296 
       
   297 /**
       
   298 The main camera capabilities class. This is used to get the capabilities of a specific camera
       
   299 device once a channel to it has been opened.
       
   300 */
       
   301 class TCameraCapsV02
       
   302 	{
       
   303 public :
       
   304 	/** The flash modes supported - a bit field. */
       
   305 	TUint iFlashModes;
       
   306 	/** The exposure modes supported - a bit field. */
       
   307 	TUint iExposureModes;
       
   308 	/** The white balance modes supported - a bit field. */
       
   309 	TUint iWhiteBalanceModes;
       
   310 	/** The orientation of the camera device. */
       
   311 	TDevCamOrientation iOrientation;
       
   312 	/** The minimum value that may be set for the zoom factor. Must be negative or zero. Negative values
       
   313 	represent macro functionality. @see TCameraCapsV02::iCapsMisc. @see TCameraConfigV02::iZoom. */
       
   314 	TUint iMinZoom;
       
   315 	/** The maximum value that may be set for the zoom factor. Must be positive or zero.
       
   316 	@see TCameraCapsV02::iCapsMisc. @see TCameraConfigV02::iZoom. */
       
   317 	TUint iMaxZoom;
       
   318 	/** Whether other miscellaneous capabilities are supported - a bitfield. These
       
   319 	capabilities include whether the device supports simultaneous capture modes, zoom capabilities, contrast
       
   320 	adjustment, brightness, and color effect adjustment. */
       
   321 	TUint iCapsMisc;
       
   322 	/** Number of pixel formats supported in still image capture mode.
       
   323 	Will be set to 0 if image capture is not supported. */
       
   324 	TUint iNumImagePixelFormats;
       
   325 	/** Number of pixel formats supported in video capture mode.
       
   326 	Will be set to 0 if image capture is not supported. */
       
   327 	TUint iNumVideoPixelFormats;
       
   328 	/** Number of pixel formats supported in view finder capture mode.
       
   329 	Will be set to 0 if image capture is not supported. */
       
   330 	TUint iNumViewFinderPixelFormats;
       
   331 	
       
   332 	/** An array specifying the range in values for settings as defined by TDevCamDynamicAttributes.
       
   333 		Indices for settings are in the order defined in TDevCamDynamicAttributes.
       
   334 		If the setting is not supported then the entry is still present for performance reasons,
       
   335 		i.e. indexing over searching.
       
   336 		@see TDevCamDynamicAttributes
       
   337 		@see TDynamicRange
       
   338 	*/
       
   339 	TDynamicRange iDynamicRange[ECamAttributeMax];
       
   340 	
       
   341 	/** A variable length array specifying the pixel formats supported by the sensor.
       
   342 		The size of the TCameraCapsV02 structure is determined by each sensor's capabilities
       
   343 		thus the array of supported pixel formats is of variable length. It is stored in memory
       
   344 		exactly after TCameraCapsV02 whenever memory is allocated for it and the array cannot be
       
   345 		accessed by a private member.
       
   346 	SDevCamPixelFormat iPixelFormatsSupported[];
       
   347 	*/
       
   348 	};
       
   349 
       
   350 typedef TPckgBuf<TCameraCapsV02> TCameraCapsV02Buf;
       
   351 
       
   352 /**
       
   353 The camera configuration class. This is used to get and set the current
       
   354 configuration of the camera. @see SDevCamFrameSize and @see SDevCamPixelFormat.
       
   355 */
       
   356 class TCameraConfigV02
       
   357 	{
       
   358 public:
       
   359 	/** The size of the image to get from the sensor. */
       
   360 	SDevCamFrameSize iFrameSize;
       
   361 	/** The pixel format (RGB, YUV, RGB Bayer etc). */
       
   362 	SDevCamPixelFormat iPixelFormat;
       
   363 	/** The frame rate (in frame/s). */
       
   364 	TUint iFrameRate;
       
   365 	/** The flash mode setting. */
       
   366 	TDevCamFlashMode iFlashMode;
       
   367 	/** The exposure mode setting. */
       
   368 	TDevCamExposureMode iExposureMode;
       
   369 	/** The white balance mode setting. */
       
   370 	TDevCamWhiteBalanceMode iWhiteBalanceMode;
       
   371 	/** The zoom factor. Can be zero, positive or negative, Negative values represent macro functionality.*/
       
   372 	TInt iZoom;
       
   373 	/** Specifies the number of bytes used to store one pixel's worth of data. */
       
   374 	TInt iPixelWidthInBytes;
       
   375 	};
       
   376 typedef TPckgBuf<TCameraConfigV02> TCameraConfigV02Buf;
       
   377 
       
   378 /** A structure used to assemble arguments for the function RDevCameraSc::SetBufConfigChunkOpen() and to pass
       
   379 these to the driver. */
       
   380 struct SSetBufConfigChunkOpenInfo
       
   381 	{
       
   382 	const TDesC8* iBufferConfigBuf;
       
   383 	TInt iChunkHandle;
       
   384 	};
       
   385 
       
   386 /** A structure used to assemble arguments for the function RDevCameraSc::FrameSizeCaps() and to pass
       
   387 these to the driver. */
       
   388 struct SFrameSizeCapsInfo
       
   389 	{
       
   390 	TUidPixelFormat iUidPixelFormat;
       
   391 	TDevCamCaptureMode iCaptureMode;
       
   392 	};
       
   393 
       
   394 /**
       
   395 The camera device driver API supporting shared chunks. This is the principle interface to communicate with
       
   396 an attached camera.
       
   397 */
       
   398 class RDevCameraSc : public RBusLogicalChannel
       
   399 	{
       
   400 public:
       
   401 	enum TRequest
       
   402 	/**
       
   403 	 Asynchronous request types
       
   404 	*/
       
   405 		{
       
   406 		EMsgRequestMax=3,				// All requests less than this value are handled in the driver DFC thread.
       
   407 		ERequestNotifyNewImage,
       
   408 		ENumRequests,
       
   409 		EAllRequests = (1<<ENumRequests)-1
       
   410 		};
       
   411 
       
   412 	enum TControl
       
   413 	/**
       
   414 	 Synchronous request types
       
   415 	*/
       
   416 		{
       
   417 		EControlSetBufConfigChunkCreate,
       
   418 		EControlSetBufConfigChunkOpen,
       
   419 		EControlStart,
       
   420 		EControlStop,
       
   421 		EControlSetCamConfig,
       
   422 		EControlSetCaptureMode,
       
   423 		EControlChunkClose,
       
   424 		EMsgControlMax=100,				// All requests less than this value are handled in the driver DFC thread.
       
   425 		EControlCaps,
       
   426 		EControlGetCamConfig,
       
   427 		EControlGetBufferConfig,
       
   428 		EControlReleaseBuffer,
       
   429 		EControlNotifyNewImageSpecificCancel,
       
   430 		EControlBufferIdToOffset,
       
   431 		EControlCapsSize,
       
   432 		EControlFrameSizeCaps,
       
   433 		EControlSetDynamicAttribute
       
   434 		};
       
   435 
       
   436 public:
       
   437 	/**
       
   438 	Get the version number of camera driver interface.
       
   439 	@return The camera driver interface version number.
       
   440 	*/
       
   441 	inline static TVersion VersionRequired();
       
   442 
       
   443 #ifndef __KERNEL_MODE__
       
   444 	
       
   445 	/**
       
   446 	 Constructor.
       
   447 	 Initialises private members.
       
   448 	 */
       
   449 	inline RDevCameraSc();
       
   450 	
       
   451 	/**
       
   452 	Open a channel on a specified camera device. This driver only allows one channel to be opened on each device.
       
   453 	@param aUnit The unit number of the camera device.
       
   454 	@return KErrNone, if successful;
       
   455 			KErrInUse, if a channel is already opened on the unit concerned;
       
   456 			otherwise one of the other system-wide error codes.
       
   457 	*/
       
   458 	inline TInt Open(TInt aUnit);
       
   459 
       
   460 	/**
       
   461 	Close the Channel and clean up.
       
   462 	*/
       
   463 	inline void Close();
       
   464 
       
   465 	/**
       
   466 	Get the capabilities of the camera device.
       
   467 	@param aCapsBuf A packaged TCameraCapsV02 object which on return will be filled with the capabilities of the device.
       
   468 	@return KErrNone, if successful;
       
   469 			KErrArgument, if aCapsBuf is too small.
       
   470 	@see TCameraCapsV02.
       
   471 	*/
       
   472 	inline TInt Caps(TDes8& aCapsBuf);
       
   473 
       
   474 	/**
       
   475 	Get the capabilities of the camera device.
       
   476 	@return TPtrC8 pointing to a locally held TCameraCapsV02 structure owned by the driver.
       
   477 	@see TCameraCapsV02.
       
   478 	*/
       
   479 	inline TPtrC8 Caps();
       
   480 
       
   481 	/**
       
   482 	Set the camera configuration settings.
       
   483 	@param aCaptureMode	The capture mode that camera will be configured for.
       
   484 	@param aConfigBuf	A packaged TCameraConfigV02 object which contains the configuration settings.
       
   485 	@see TCameraConfigV02.
       
   486 	*/
       
   487 	inline TInt SetCamConfig(TDevCamCaptureMode aCaptureMode, const TDesC8& aConfigBuf);
       
   488 
       
   489 	/**
       
   490 	Trigger the buffer allocation and configuration setting - creating a shared chunk.
       
   491 	From the frame size, pixel format (already supplied) and the number of camera buffers specified,
       
   492 	the driver will	calculate the size of the shared chunk this requires. It will create such
       
   493 	a shared chunk containing the specified number of buffers within it (each with memory committed to them).
       
   494 	This will replace a previous shared chunk created by this driver.
       
   495 	A handle to the chunk will then be created for the client thread which will be assigned to the
       
   496 	RChunk object supplied by the client.The configuration cannot be changed unless image capture is disabled.
       
   497 	@param aCaptureMode	The capture mode that camera will be configured for.
       
   498 	@param aNumBuffers	The desired number of buffers that is going to be used.
       
   499 	@param aChunk		An RChunk object to which the chunk handle will be assigned.
       
   500 	@return KErrNone if successful;
       
   501 			KErrInUse if image capturing is already in progress;
       
   502 			KErrArgument if any configuration values are invalid;
       
   503 			KErrNoMemory if the driver failed allocate memory for the shared chunk specified;
       
   504 			otherwise one of the other system-wide error codes.
       
   505 	*/
       
   506 	inline TInt SetBufConfigChunkCreate(TDevCamCaptureMode aCaptureMode, TInt aNumBuffers, RChunk& aChunk);
       
   507 
       
   508 	/**
       
   509 	Get the current camera configuration settings.
       
   510 	@param aCaptureMode	The capture mode that the user requested the configuration settings of.
       
   511 	@param aConfigBuf	A packaged TCameraConfigV02 object which will be filled with the configuration settings.
       
   512 	@see TCameraConfigV02.
       
   513 	*/
       
   514 	inline void GetCamConfig(TDevCamCaptureMode aCaptureMode, TDes8& aConfigBuf);
       
   515 
       
   516 	/**
       
   517 	Get the current buffer configuration settings.
       
   518 	@param aCaptureMode	The capture mode that the configuration request is for.
       
   519 	@param aConfigBuf	A packaged TSharedChunkBufConfigBase derived object which will be filled with the configuration settings.
       
   520 	@see TSharedChunkBufConfigBase.
       
   521 	*/
       
   522 	inline void GetBufferConfig(TDevCamCaptureMode aCaptureMode, TDes8& aConfigBuf);
       
   523 
       
   524 	/**
       
   525 	Set the current buffer configuration settings - using an existing shared chunk.
       
   526 	The client supplies an existing shared chunk which is to be used by the driver as the play buffer.
       
   527 	Any shared chunk previously created by the driver will be closed by it.
       
   528 	The configuration cannot be changed unless image capture is disabled.
       
   529 	@param aCaptureMode	The capture mode that the configuration is for.
       
   530 	@param aBufferConfigBuf	A packaged TSharedChunkBufConfigBase derived object holding information on the buffer configuration
       
   531 							settings of the chunk supplied.
       
   532 	@param aChunk			A handle to the shared chunk which is to be used as the buffer. (This must be a
       
   533 							valid handle for the calling thread).
       
   534 	@return KErrNone if successful;
       
   535 			KErrInUse if the playing of data is in progress;
       
   536 			KErrBadHandle if the chunk handle was invalid;
       
   537 			KErrArgument if any configuration values are invalid;
       
   538 			otherwise one of the other system-wide error codes.
       
   539 	@see TCameraConfigV02.
       
   540 	*/
       
   541 	inline TInt SetBufConfigChunkOpen(TDevCamCaptureMode aCaptureMode, const TDesC8& aBufferConfigBuf, RChunk& aChunk);
       
   542 
       
   543 	/**
       
   544 	Closes the chunk associated with a given capture mode, and frees the associated buffers.  The chunk being closed,
       
   545 	should have been allocated by the device driver by a call to SetBufConfigChunkCreate().
       
   546 	@param aCaptureMode The capture mode for which to close the chunk.
       
   547 	@return	KErrNone if successful.
       
   548 			KErrInUse if an attempt has been made to free the memory and chunk while they are in use.
       
   549 			Otherwise one of the other system-wide error codes.
       
   550 	*/
       
   551 	inline TInt ChunkClose(TDevCamCaptureMode aCaptureMode);
       
   552 
       
   553 	/**
       
   554 	Start the image capture process in the capture mode supplied.
       
   555 	If the driver is in free running mode then it will commence capturing frames - cycling between
       
   556 	each buffer available to it until Stop() is called. In one shot mode the driver postpones the capturing
       
   557 	of frames until a NotifyNewImage() request is received.
       
   558 	@return KErrNone if successful;
       
   559 			KErrNotReady if SetConfig() has not been previously called;
       
   560 			otherwise one of the other system-wide error codes.
       
   561 	@pre The driver must have been previousely initialised by a call to SetConfigNN()
       
   562 	*/
       
   563 	inline TInt Start();
       
   564 
       
   565 	/**
       
   566 	End the image capturing process.
       
   567 	Also performs NotifyNewImageCancel()
       
   568 	@return KErrGeneral if Start() has not been previously called;
       
   569 			KErrNone otherwise.
       
   570 	*/
       
   571 	inline TInt Stop();
       
   572 
       
   573 	/**
       
   574 	Get the next available image.
       
   575 	More than one request may be pending at any time.
       
   576 	If the camera is enabled for image capture and image capture is not already in progress then the issuing
       
   577 	of this request will start image capture mode.
       
   578 	@param aStatus 	The request status which is signaled when an image is available (or an error occurs).
       
   579 					If the request is successful then this result value is the offset within the shared chunk
       
   580 					where the capture image resides. Alternatively, if an error occurs it will be set to one of
       
   581 					the system wide error values:
       
   582 				 	KErrNotReady if Start() hasn't been previousely called;
       
   583 				 	KErrInUse if the client already has all the images buffers.
       
   584 	@pre Image capturing must have been started with Start().
       
   585 	*/
       
   586 	inline void NotifyNewImage(TRequestStatus& aStatus);
       
   587 
       
   588 	/**
       
   589 	Cancels all outstanding NotifyNewImage() requests.
       
   590 	All outstanding requests complete with KErrCancel.
       
   591 	*/
       
   592 	inline void NotifyNewImageCancel();
       
   593 
       
   594 	/**
       
   595 	Cancels a specific NotifyNewImage() request.
       
   596 	The outstanding request completes with KErrCancel.
       
   597 	@param aStatus The request status object associated with the request to be cancelled.
       
   598 	*/
       
   599 	inline void NotifyNewImageCancel(const TRequestStatus& aStatus);
       
   600 
       
   601 	/**
       
   602 	Release a buffer - making it available again for the driver to capture images into.
       
   603 	@param aBufferId	The buffer id of the buffer that the image to be released is stored.
       
   604 						This is a value returned by the NotifyNewImage() request when
       
   605 						the buffer was claimed by the client.
       
   606 	@return KErrNone if successful;
       
   607 			KErrNotFound if the buffer id is invalid;
       
   608 			otherwise one of the other system-wide error codes.
       
   609 	*/
       
   610 	inline TInt ReleaseBuffer(TInt aBufferId);
       
   611 
       
   612 	/**
       
   613 	Retrieves the offset to the start of the buffer using its id, in the specified capture mode.
       
   614 	@param aCaptureMode	The capture mode that the buffer in the chunk is related to.
       
   615 	@param aId			The id of the buffer in the chunk.
       
   616 	@param aOffset		The offset, in bytes, of the start of the buffer within the chunk.
       
   617 	@return KErrNone if successful;
       
   618 			KErrNotFound if the id doesn't exist;
       
   619 			otherwise one of the other system-wide error codes.
       
   620 	*/
       
   621 	inline TInt BufferIdToOffset(TDevCamCaptureMode aCaptureMode, TInt aId, TInt& aOffset);
       
   622 
       
   623 	/**
       
   624 	Sets the current capture mode. Submits the camera configuration	to the PDD.
       
   625 	@param aCaptureMode	The capture mode that the camera switches to.	@see TDevCamCaptureMode.
       
   626 	@return KErrNone if successful;
       
   627 			otherwise one of the other system-wide error codes.
       
   628 	*/
       
   629 	inline TInt SetCaptureMode(TDevCamCaptureMode aCaptureMode);
       
   630 
       
   631 	/**
       
   632 	Queries the driver for the size of the structure to be passed to Caps().
       
   633 	@return The size of the structure required to hold all capability information.
       
   634 			otherwise one of the system-wide error codes.
       
   635 	*/
       
   636 	inline TInt CapsSize();
       
   637 
       
   638 	/**
       
   639 	Gets information regarding the frame sizes and frame rates supported for a given combination of capture mode and pixel format.
       
   640 	The capture mode and pixel format chosen will be dependent upon the information returned by RDevCameraSc::Caps().
       
   641 	@param	aCaptureMode The capture mode concerned.
       
   642 	@param	aUidPixelFormat The UID of the pixel format mode concerned.
       
   643 	@param	aFrameSizeCapsBuf	A packaged array of SDevCamFrameSize structures.
       
   644 								This is a variable length array and must be large enough to hold all entries.
       
   645 								Its size is determined by SDevCamPixelFormat::iNumFrameSizes, returned by RDevCameraSc::Caps(),
       
   646 								multiplied by the size of SDevCamFrameSize.
       
   647 	@return	KErrNone if successful;
       
   648 			KErrArgument if an invalid capture mode or pixel format is specified, or if aFrameSizeCapsBuf is too small.
       
   649 			otherwise one of the other system-wide error codes.
       
   650 	*/
       
   651 	inline TInt FrameSizeCaps(TDevCamCaptureMode aCaptureMode, TUidPixelFormat aUidPixelFormat, TDes8& aFrameSizeCapsBuf);
       
   652 	
       
   653 
       
   654 	/**
       
   655 	Allows changing of the dynamic settings as specified in TDevCamDynamicAttributes.
       
   656 	Checks locally the validity of the arguments passed so as to increase performance by not
       
   657 	forcing a context switch.
       
   658 	Check the allowable range of the settings via the TCameraCapsV02::iDynamicRange member.
       
   659 
       
   660 	@param aAttribute An enum identifying the dynamic attribute to change.
       
   661 	@param aValue The attributes value within a valid range.
       
   662 	@return KErrNone if successful, KErrNotSupported if not supported, 
       
   663 			KErrArgument if aValue out of range, KErrBadName is aAttribute not valid setting.
       
   664 			Otherwise, one of the system wide error codes.
       
   665 	@see TDevCamDynamicAttributes
       
   666 	@see TCameraCapsV02
       
   667 	*/
       
   668 	inline TInt SetDynamicAttribute(TDevCamDynamicAttributes aAttribute, TUint aValue);
       
   669 
       
   670 private:
       
   671 
       
   672 	/** 
       
   673 	Capability of Sensor. 
       
   674 	Kept here for performance issues, i.e. to avoid context switches.
       
   675 	*/
       
   676 	TCameraCapsV02 *iCameraCaps;
       
   677 
       
   678 	/** 
       
   679 	Size of Camera Capabiliy struct. 
       
   680 	Kept here for performance issues, i.e. to avoid context switches.
       
   681 	*/
       
   682 	TInt iCapsSize;
       
   683 	
       
   684 #endif	// __KERNEL_MODE__
       
   685 	};
       
   686 
       
   687 
       
   688 
       
   689 
       
   690 #include <d32camerasc.inl>
       
   691 
       
   692 #endif	// __D32CAMERASC_H__