1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kernel/eka/include/d32camerasc.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,711 @@
1.4 +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// e32\include\d32camerasc.h
1.18 +// User side class definition for the shared chunk camera driver.
1.19 +//
1.20 +//
1.21 +
1.22 +/**
1.23 + @file
1.24 + @internalAll
1.25 + @prototype
1.26 +*/
1.27 +
1.28 +#ifndef __D32CAMERASC_H__
1.29 +#define __D32CAMERASC_H__
1.30 +
1.31 +#include <e32cmn.h>
1.32 +#include <e32ver.h>
1.33 +#include <pixelformats.h>
1.34 +
1.35 +_LIT(KDevCameraScName,"CameraSc");
1.36 +
1.37 +/**
1.38 +Camera capability constants - bitmasks of possible flash modes. @see TCameraCapsV02.
1.39 +*/
1.40 +/** Flash will automatically fire when required. */
1.41 +const TUint KCamFlashAuto = 0x0001;
1.42 +/** Flash will always fire. */
1.43 +const TUint KCamFlashForced = 0x0002;
1.44 +/** Reduced flash for general lighting */
1.45 +const TUint KCamFlashFillIn = 0x0004;
1.46 +/** Red-eye reduction mode. */
1.47 +const TUint KCamFlashRedEyeReduce = 0x0008;
1.48 +/** Flash at the moment when shutter opens. */
1.49 +const TUint KCamFlashSlowFrontSync = 0x0010;
1.50 +/** Flash at the moment when shutter closes. */
1.51 +const TUint KCamFlashSlowRearSync = 0x0020;
1.52 +/** User configurable setting */
1.53 +const TUint KCamFlashManual = 0x0040;
1.54 +
1.55 +/**
1.56 +Camera capability constants - bitmasks of possible exposure modes. @see TCameraCapsV02.
1.57 +*/
1.58 +/** Night-time setting for long exposures. */
1.59 +const TUint KCamExposureNight = 0x0001;
1.60 +/** Backlight setting for bright backgrounds. */
1.61 +const TUint KCamExposureBacklight = 0x0002;
1.62 +/** Centered mode for ignoring surroundings. */
1.63 +const TUint KCamExposureCenter = 0x0004;
1.64 +/** Sport setting for very short exposures. */
1.65 +const TUint KCamExposureSport = 0x0008;
1.66 +/** Generalised setting for very long exposures. */
1.67 +const TUint KCamExposureVeryLong = 0x0010;
1.68 +/** Snow setting for daylight exposure. */
1.69 +const TUint KCamExposureSnow = 0x0020;
1.70 +/** Beach setting for daylight exposure with reflective glare. */
1.71 +const TUint KCamExposureBeach = 0x0040;
1.72 +/** Programmed exposure setting. */
1.73 +const TUint KCamExposureProgram = 0x0080;
1.74 +/** Aperture setting is given priority. */
1.75 +const TUint KCamExposureAperturePriority = 0x0100;
1.76 +/** Shutter speed setting is given priority. */
1.77 +const TUint KCamExposureShutterPriority = 0x0200;
1.78 +/** User selectable exposure value setting. */
1.79 +const TUint KCamExposureManual = 0x0400;
1.80 +/** Exposure night setting with colour removed to get rid of colour noise. */
1.81 +const TUint KCamExposureSuperNight = 0x0800;
1.82 +/** Exposure for infra-red sensor on the camera */
1.83 +const TUint KCamExposureInfra = 0x1000;
1.84 +
1.85 +/**
1.86 +Camera capability constants - bitmasks of possible white balance modes. @see TCameraCapsV02.
1.87 +*/
1.88 +/** Normal daylight. */
1.89 +const TUint KCamWBDaylight = 0x0001;
1.90 +/** Overcast daylight. */
1.91 +const TUint KCamWBCloudy = 0x0002;
1.92 +/** Tungsten filament lighting. */
1.93 +const TUint KCamWBTungsten = 0x0004;
1.94 +/** Fluorescent tube lighting */
1.95 +const TUint KCamWBFluorescent = 0x0008;
1.96 +/** Flash lighting. */
1.97 +const TUint KCamWBFlash = 0x0010;
1.98 +/** High contrast daylight primarily snowy */
1.99 +const TUint KCamWBSnow = 0x0020;
1.100 +/** High contrast daylight primarily near the sea */
1.101 +const TUint KCamWBBeach = 0x0040;
1.102 +/** User configurable mode */
1.103 +const TUint KCamWBManual = 0x0080;
1.104 +
1.105 +/**
1.106 +Camera capability constants - bitmasks of other miscellaneous camera capabilities supported. @see TCameraCapsV02.
1.107 +*/
1.108 +/** The camera has zoom capability. */
1.109 +const TUint KCamMiscZoom = 0x0001;
1.110 +/** The camera supports contrast adjustment. */
1.111 +const TUint KCamMiscContrast = 0x0002;
1.112 +/** The camera supports brightness adjustment. */
1.113 +const TUint KCamMiscBrightness = 0x0004;
1.114 +/** The camera supports color effect adjustment. */
1.115 +const TUint KCamMiscColorEffect = 0x0008;
1.116 +
1.117 +
1.118 +/**
1.119 +Enumeration of capture modes in which to run the sensor.
1.120 +*/
1.121 +enum TDevCamCaptureMode
1.122 + {
1.123 + /** Used to specify that still image mode is to be used. */
1.124 + ECamCaptureModeImage,
1.125 + /** Used to specify that streaming video mode is to be used. */
1.126 + ECamCaptureModeVideo,
1.127 + /** Used to specify that streaming viewfinder mode is to be used. */
1.128 + ECamCaptureModeViewFinder,
1.129 + /** The last value here, helps keep track of the number of capture modes. */
1.130 + ECamCaptureModeMax
1.131 + };
1.132 +
1.133 +/**
1.134 +Enumeration of camera flash modes. @see TCameraConfigV02.
1.135 +*/
1.136 +enum TDevCamFlashMode
1.137 + {
1.138 + /** No flash, always supported. */
1.139 + ECamFlashNone=0x0000,
1.140 + /** Flash will automatically fire when required. */
1.141 + ECamFlashAuto=0x0001,
1.142 + /** Flash will always fire. */
1.143 + ECamFlashForced=0x0002,
1.144 + /** Reduced flash for general lighting */
1.145 + ECamFlashFillIn=0x0004,
1.146 + /** Red-eye reduction mode. */
1.147 + ECamFlashRedEyeReduce=0x0008,
1.148 + /** Flash at the moment when shutter opens. */
1.149 + ECamFlashSlowFrontSync=0x0010,
1.150 + /** Flash at the moment when shutter closes. */
1.151 + ECamFlashSlowRearSync=0x0020,
1.152 + /** User configurable setting */
1.153 + ECamFlashManual=0x0040
1.154 + };
1.155 +
1.156 +/**
1.157 +Enumeration of camera exposure modes. @see TCameraConfigV02.
1.158 +*/
1.159 +enum TDevCamExposureMode
1.160 + {
1.161 + /** Set exposure automatically. Default, always supported. */
1.162 + ECamExposureAuto=0x0000,
1.163 + /** Night-time setting for long exposures. */
1.164 + ECamExposureNight=0x0001,
1.165 + /** Backlight setting for bright backgrounds. */
1.166 + ECamExposureBacklight=0x0002,
1.167 + /** Centered mode for ignoring surroundings. */
1.168 + ECamExposureCenter=0x0004,
1.169 + /** Sport setting for very short exposures. */
1.170 + ECamExposureSport=0x0008,
1.171 + /** Generalised setting for very long exposures. */
1.172 + ECamExposureVeryLong=0x0010,
1.173 + /** Snow setting for daylight exposure. */
1.174 + ECamExposureSnow=0x0020,
1.175 + /** Beach setting for daylight exposure with reflective glare. */
1.176 + ECamExposureBeach=0x0040,
1.177 + /** Programmed exposure setting. */
1.178 + ECamExposureProgram=0x0080,
1.179 + /** Aperture setting is given priority. */
1.180 + ECamExposureAperturePriority=0x0100,
1.181 + /** Shutter speed setting is given priority. */
1.182 + ECamExposureShutterPriority=0x0200,
1.183 + /** User selectable exposure value setting. */
1.184 + ECamExposureManual=0x0400,
1.185 + /** Exposure night setting with colour removed to get rid of colour noise. */
1.186 + ECamExposureSuperNight=0x0800,
1.187 + /** Exposure for infra-red sensor on the camera */
1.188 + ECamExposureInfra=0x1000
1.189 + };
1.190 +
1.191 +/**
1.192 +Enumeration of camera white balance modes. @see TCameraConfigV02.
1.193 +*/
1.194 +enum TDevCamWhiteBalanceMode
1.195 + {
1.196 + /** Set white balance automatically. Default, always supported. */
1.197 + ECamWBAuto=0x0000,
1.198 + /** Normal daylight. */
1.199 + ECamWBDaylight=0x0001,
1.200 + /** Overcast daylight. */
1.201 + ECamWBCloudy=0x0002,
1.202 + /** Tungsten filament lighting. */
1.203 + ECamWBTungsten=0x0004,
1.204 + /** Fluorescent tube lighting */
1.205 + ECamWBFluorescent=0x0008,
1.206 + /** Flash lighting. */
1.207 + ECamWBFlash=0x0010,
1.208 + /** High contrast daylight primarily snowy */
1.209 + ECamWBSnow=0x0020,
1.210 + /** High contrast daylight primarily near the sea */
1.211 + ECamWBBeach=0x0040,
1.212 + /** User configurable mode */
1.213 + ECamWBManual=0x0080
1.214 + };
1.215 +
1.216 +/**
1.217 +Enumeration of possible directions in which the camera may point. @see TCameraCapsV02.
1.218 +*/
1.219 +enum TDevCamOrientation
1.220 + {
1.221 + /** Outward pointing camera for taking pictures. Camera is directed away from the user. */
1.222 + ECamOrientationOutwards,
1.223 + /** Inward pointing camera for conferencing. Camera is directed towards the user. */
1.224 + ECamOrientationInwards,
1.225 + /** Mobile camera capable of multiple orientations. Camera orientation may be changed by the user. */
1.226 + ECamOrientationMobile,
1.227 + /** Camera orientation is not known. */
1.228 + ECamOrientationUnknown
1.229 + };
1.230 +
1.231 +/**
1.232 +Each item in the iPixelFormatSupported array is represented by an instance of this structure.
1.233 +*/
1.234 +struct SDevCamPixelFormat
1.235 + {
1.236 + /** The UID of the pixel format supported */
1.237 + TUidPixelFormat iPixelFormat;
1.238 + /** The number of frame sizes represented by the pixel format. */
1.239 + TUint iNumFrameSizes;
1.240 + /** The pixel width in number of bytes */
1.241 + TUint iPixelWidthInBytes;
1.242 + };
1.243 +
1.244 +/**
1.245 +Each frame size supported is represented by an instance of this structure.
1.246 +*/
1.247 +struct SDevCamFrameSize
1.248 + {
1.249 + /** Width of the frame in pixels. */
1.250 + TUint iWidth;
1.251 + /** Height of the frame in pixels. */
1.252 + TUint iHeight;
1.253 + /** Minimum frame rate supported by this frame size. */
1.254 + TUint iMinFrameRate;
1.255 + /** Maximum frame rate supported by this frame size. */
1.256 + TUint iMaxFrameRate;
1.257 + };
1.258 +
1.259 +/**
1.260 +Lets us associate buffers to their mode when working out the buffer offset in a chunk.
1.261 +**/
1.262 +class TDevCamBufferModeAndId
1.263 + {
1.264 +public:
1.265 + TDevCamCaptureMode iCaptureMode;
1.266 + TInt iId;
1.267 + };
1.268 +typedef TPckgBuf<TDevCamBufferModeAndId> TDevCamBufferModeAndIdBuf;
1.269 +
1.270 +/**
1.271 +The general driver capabilites class - returned by the LDD factory in response to RDevice::GetCaps().
1.272 +*/
1.273 +class TCapsDevCameraV01
1.274 + {
1.275 +public:
1.276 + TVersion iVersion;
1.277 + };
1.278 +
1.279 +/**
1.280 +Defines a list of settings that are changable often (dynamically) within a single use of the device.
1.281 +*/
1.282 +enum TDevCamDynamicAttribute
1.283 + {
1.284 + ECamAttributeBrightness,
1.285 + ECamAttributeContrast,
1.286 + ECamAttributeColorEffect,
1.287 + ECamAttributeMax
1.288 + };
1.289 +
1.290 +/**
1.291 +Holds the range and interval (rate of change) values for a dynamic capability.
1.292 +An array of these would be indexed by TDevCamDynamicAttribute
1.293 +*/
1.294 +struct TDynamicRange
1.295 + {
1.296 + TUint iMin;
1.297 + TUint iMax;
1.298 + TUint iDefault;
1.299 + };
1.300 +
1.301 +/**
1.302 +The main camera capabilities class. This is used to get the capabilities of a specific camera
1.303 +device once a channel to it has been opened.
1.304 +*/
1.305 +class TCameraCapsV02
1.306 + {
1.307 +public :
1.308 + /** The flash modes supported - a bit field. */
1.309 + TUint iFlashModes;
1.310 + /** The exposure modes supported - a bit field. */
1.311 + TUint iExposureModes;
1.312 + /** The white balance modes supported - a bit field. */
1.313 + TUint iWhiteBalanceModes;
1.314 + /** The orientation of the camera device. */
1.315 + TDevCamOrientation iOrientation;
1.316 + /** The minimum value that may be set for the zoom factor. Must be negative or zero. Negative values
1.317 + represent macro functionality. @see TCameraCapsV02::iCapsMisc. @see TCameraConfigV02::iZoom. */
1.318 + TUint iMinZoom;
1.319 + /** The maximum value that may be set for the zoom factor. Must be positive or zero.
1.320 + @see TCameraCapsV02::iCapsMisc. @see TCameraConfigV02::iZoom. */
1.321 + TUint iMaxZoom;
1.322 + /** Whether other miscellaneous capabilities are supported - a bitfield. These
1.323 + capabilities include whether the device supports simultaneous capture modes, zoom capabilities, contrast
1.324 + adjustment, brightness, and color effect adjustment. */
1.325 + TUint iCapsMisc;
1.326 + /** Number of pixel formats supported in still image capture mode.
1.327 + Will be set to 0 if image capture is not supported. */
1.328 + TUint iNumImagePixelFormats;
1.329 + /** Number of pixel formats supported in video capture mode.
1.330 + Will be set to 0 if image capture is not supported. */
1.331 + TUint iNumVideoPixelFormats;
1.332 + /** Number of pixel formats supported in view finder capture mode.
1.333 + Will be set to 0 if image capture is not supported. */
1.334 + TUint iNumViewFinderPixelFormats;
1.335 +
1.336 + /** An array specifying the range in values for settings as defined by TDevCamDynamicAttribute.
1.337 + Indices for settings are in the order defined in TDevCamDynamicAttribute.
1.338 + If the setting is not supported then the entry is still present for performance reasons,
1.339 + i.e. indexing over searching.
1.340 + @see TDevCamDynamicAttribute
1.341 + @see TDynamicRange
1.342 + */
1.343 + TDynamicRange iDynamicRange[ECamAttributeMax];
1.344 +
1.345 + /** A variable length array specifying the pixel formats supported by the sensor.
1.346 + The size of the TCameraCapsV02 structure is determined by each sensor's capabilities
1.347 + thus the array of supported pixel formats is of variable length. It is stored in memory
1.348 + exactly after TCameraCapsV02 whenever memory is allocated for it and the array cannot be
1.349 + accessed by a private member.
1.350 + SDevCamPixelFormat iPixelFormatsSupported[];
1.351 + */
1.352 + };
1.353 +
1.354 +typedef TPckgBuf<TCameraCapsV02> TCameraCapsV02Buf;
1.355 +
1.356 +/**
1.357 +The camera configuration class. This is used to get and set the current
1.358 +configuration of the camera. @see SDevCamFrameSize and @see SDevCamPixelFormat.
1.359 +*/
1.360 +class TCameraConfigV02
1.361 + {
1.362 +public:
1.363 + /** The size of the image to get from the sensor. */
1.364 + SDevCamFrameSize iFrameSize;
1.365 + /** The pixel format (RGB, YUV, RGB Bayer etc). */
1.366 + SDevCamPixelFormat iPixelFormat;
1.367 + /** The frame rate (in frame/s). */
1.368 + TUint iFrameRate;
1.369 + /** The flash mode setting. */
1.370 + TDevCamFlashMode iFlashMode;
1.371 + /** The exposure mode setting. */
1.372 + TDevCamExposureMode iExposureMode;
1.373 + /** The white balance mode setting. */
1.374 + TDevCamWhiteBalanceMode iWhiteBalanceMode;
1.375 + /** The zoom factor. Can be zero, positive or negative, Negative values represent macro functionality.*/
1.376 + TInt iZoom;
1.377 + /** Specifies the number of bytes used to store one pixel's worth of data. */
1.378 + TInt iPixelWidthInBytes;
1.379 + };
1.380 +typedef TPckgBuf<TCameraConfigV02> TCameraConfigV02Buf;
1.381 +
1.382 +/** A structure used to assemble arguments for the function RDevCameraSc::SetBufConfigChunkOpen() and to pass
1.383 +these to the driver. */
1.384 +struct SSetBufConfigChunkOpenInfo
1.385 + {
1.386 + const TDesC8* iBufferConfigBuf;
1.387 + TInt iChunkHandle;
1.388 + };
1.389 +
1.390 +/** A structure used to assemble arguments for the function RDevCameraSc::FrameSizeCaps() and to pass
1.391 +these to the driver. */
1.392 +struct SFrameSizeCapsInfo
1.393 + {
1.394 + TUidPixelFormat iUidPixelFormat;
1.395 + TDevCamCaptureMode iCaptureMode;
1.396 + };
1.397 +
1.398 +/**
1.399 +The camera device driver API supporting shared chunks. This is the principle interface to communicate with
1.400 +an attached camera.
1.401 +*/
1.402 +class RDevCameraSc : public RBusLogicalChannel
1.403 + {
1.404 +public:
1.405 + enum TRequest
1.406 + /**
1.407 + Asynchronous request types
1.408 + */
1.409 + {
1.410 + EMsgRequestMax=3, // All requests less than this value are handled in the driver DFC thread.
1.411 + ERequestNotifyNewImage,
1.412 + ENumRequests,
1.413 + EAllRequests = (1<<ENumRequests)-1
1.414 + };
1.415 +
1.416 + enum TControl
1.417 + /**
1.418 + Synchronous request types
1.419 + */
1.420 + {
1.421 + EControlSetBufConfigChunkCreate,
1.422 + EControlSetBufConfigChunkOpen,
1.423 + EControlStart,
1.424 + EControlStop,
1.425 + EControlSetCamConfig,
1.426 + EControlSetCaptureMode,
1.427 + EControlChunkClose,
1.428 + EMsgControlMax=100, // All requests less than this value are handled in the driver DFC thread.
1.429 + EControlCaps,
1.430 + EControlGetCamConfig,
1.431 + EControlGetBufferConfig,
1.432 + EControlReleaseBuffer,
1.433 + EControlNotifyNewImageSpecificCancel,
1.434 + EControlBufferIdToOffset,
1.435 + EControlCapsSize,
1.436 + EControlFrameSizeCaps,
1.437 + EControlSetDynamicAttribute,
1.438 + EControlGetDynamicAttribute
1.439 + };
1.440 +
1.441 +public:
1.442 + /**
1.443 + Get the version number of camera driver interface.
1.444 + @return The camera driver interface version number.
1.445 + */
1.446 + inline static TVersion VersionRequired();
1.447 +
1.448 +#ifndef __KERNEL_MODE__
1.449 +
1.450 + /**
1.451 + Constructor.
1.452 + Initialises private members.
1.453 + */
1.454 + inline RDevCameraSc();
1.455 +
1.456 + /**
1.457 + Open a channel on a specified camera device. This driver only allows one channel to be opened on each device.
1.458 + @param aUnit The unit number of the camera device.
1.459 + @return KErrNone, if successful;
1.460 + KErrInUse, if a channel is already opened on the unit concerned;
1.461 + otherwise one of the other system-wide error codes.
1.462 + */
1.463 + inline TInt Open(TInt aUnit);
1.464 +
1.465 + /**
1.466 + Close the Channel and clean up.
1.467 + */
1.468 + inline void Close();
1.469 +
1.470 + /**
1.471 + Get the capabilities of the camera device.
1.472 + @param aCapsBuf A packaged TCameraCapsV02 object which on return will be filled with the capabilities of the device.
1.473 + @return KErrNone, if successful;
1.474 + KErrArgument, if aCapsBuf is too small.
1.475 + @see TCameraCapsV02.
1.476 + */
1.477 + inline TInt Caps(TDes8& aCapsBuf);
1.478 +
1.479 + /**
1.480 + Get the capabilities of the camera device.
1.481 + @return TPtrC8 pointing to a locally held TCameraCapsV02 structure owned by the driver.
1.482 + @see TCameraCapsV02.
1.483 + */
1.484 + inline TPtrC8 Caps();
1.485 +
1.486 + /**
1.487 + Set the camera configuration settings.
1.488 + @param aCaptureMode The capture mode that camera will be configured for.
1.489 + @param aConfigBuf A packaged TCameraConfigV02 object which contains the configuration settings.
1.490 + @see TCameraConfigV02.
1.491 + */
1.492 + inline TInt SetCamConfig(TDevCamCaptureMode aCaptureMode, const TDesC8& aConfigBuf);
1.493 +
1.494 + /**
1.495 + Trigger the buffer allocation and configuration setting - creating a shared chunk.
1.496 + From the frame size, pixel format (already supplied) and the number of camera buffers specified,
1.497 + the driver will calculate the size of the shared chunk this requires. It will create such
1.498 + a shared chunk containing the specified number of buffers within it (each with memory committed to them).
1.499 + This will replace a previous shared chunk created by this driver.
1.500 + A handle to the chunk will then be created for the client thread which will be assigned to the
1.501 + RChunk object supplied by the client.The configuration cannot be changed unless image capture is disabled.
1.502 + @param aCaptureMode The capture mode that camera will be configured for.
1.503 + @param aNumBuffers The desired number of buffers that is going to be used.
1.504 + @param aChunk An RChunk object to which the chunk handle will be assigned.
1.505 + @return KErrNone if successful;
1.506 + KErrInUse if image capturing is already in progress;
1.507 + KErrArgument if any configuration values are invalid;
1.508 + KErrNoMemory if the driver failed allocate memory for the shared chunk specified;
1.509 + otherwise one of the other system-wide error codes.
1.510 + */
1.511 + inline TInt SetBufConfigChunkCreate(TDevCamCaptureMode aCaptureMode, TInt aNumBuffers, RChunk& aChunk);
1.512 +
1.513 + /**
1.514 + Get the current camera configuration settings.
1.515 + @param aCaptureMode The capture mode that the user requested the configuration settings of.
1.516 + @param aConfigBuf A packaged TCameraConfigV02 object which will be filled with the configuration settings.
1.517 + @see TCameraConfigV02.
1.518 + */
1.519 + inline void GetCamConfig(TDevCamCaptureMode aCaptureMode, TDes8& aConfigBuf);
1.520 +
1.521 + /**
1.522 + Get the current buffer configuration settings.
1.523 + @param aCaptureMode The capture mode that the configuration request is for.
1.524 + @param aConfigBuf A packaged TSharedChunkBufConfigBase derived object which will be filled with the configuration settings.
1.525 + @see TSharedChunkBufConfigBase.
1.526 + */
1.527 + inline void GetBufferConfig(TDevCamCaptureMode aCaptureMode, TDes8& aConfigBuf);
1.528 +
1.529 + /**
1.530 + Set the current buffer configuration settings - using an existing shared chunk.
1.531 + The client supplies an existing shared chunk which is to be used by the driver as the play buffer.
1.532 + Any shared chunk previously created by the driver will be closed by it.
1.533 + The configuration cannot be changed unless image capture is disabled.
1.534 + @param aCaptureMode The capture mode that the configuration is for.
1.535 + @param aBufferConfigBuf A packaged TSharedChunkBufConfigBase derived object holding information on the buffer configuration
1.536 + settings of the chunk supplied.
1.537 + @param aChunk A handle to the shared chunk which is to be used as the buffer. (This must be a
1.538 + valid handle for the calling thread).
1.539 + @return KErrNone if successful;
1.540 + KErrInUse if the playing of data is in progress;
1.541 + KErrBadHandle if the chunk handle was invalid;
1.542 + KErrArgument if any configuration values are invalid;
1.543 + otherwise one of the other system-wide error codes.
1.544 + @see TCameraConfigV02.
1.545 + */
1.546 + inline TInt SetBufConfigChunkOpen(TDevCamCaptureMode aCaptureMode, const TDesC8& aBufferConfigBuf, RChunk& aChunk);
1.547 +
1.548 + /**
1.549 + Closes the chunk associated with a given capture mode, and frees the associated buffers. The chunk being closed,
1.550 + should have been allocated by the device driver by a call to SetBufConfigChunkCreate().
1.551 + @param aCaptureMode The capture mode for which to close the chunk.
1.552 + @return KErrNone if successful.
1.553 + KErrInUse if an attempt has been made to free the memory and chunk while they are in use.
1.554 + Otherwise one of the other system-wide error codes.
1.555 + */
1.556 + inline TInt ChunkClose(TDevCamCaptureMode aCaptureMode);
1.557 +
1.558 + /**
1.559 + Start the image capture process in the capture mode supplied.
1.560 + If the driver is in free running mode then it will commence capturing frames - cycling between
1.561 + each buffer available to it until Stop() is called. In one shot mode the driver postpones the capturing
1.562 + of frames until a NotifyNewImage() request is received.
1.563 + @return KErrNone if successful;
1.564 + KErrNotReady if SetConfig() has not been previously called;
1.565 + otherwise one of the other system-wide error codes.
1.566 + @pre The driver must have been previousely initialised by a call to SetConfigNN()
1.567 + */
1.568 + inline TInt Start();
1.569 +
1.570 + /**
1.571 + End the image capturing process.
1.572 + Also performs NotifyNewImageCancel()
1.573 + @return KErrGeneral if Start() has not been previously called;
1.574 + KErrNone otherwise.
1.575 + */
1.576 + inline TInt Stop();
1.577 +
1.578 + /**
1.579 + Get the next available image.
1.580 + More than one request may be pending at any time.
1.581 + If the camera is enabled for image capture and image capture is not already in progress then the issuing
1.582 + of this request will start image capture mode.
1.583 + @param aStatus The request status which is signaled when an image is available (or an error occurs).
1.584 + If the request is successful then this result value is the offset within the shared chunk
1.585 + where the capture image resides. Alternatively, if an error occurs it will be set to one of
1.586 + the system wide error values:
1.587 + KErrNotReady if Start() hasn't been previousely called;
1.588 + KErrInUse if the client already has all the images buffers.
1.589 + @pre Image capturing must have been started with Start().
1.590 + */
1.591 + inline void NotifyNewImage(TRequestStatus& aStatus);
1.592 +
1.593 + /**
1.594 + Cancels all outstanding NotifyNewImage() requests.
1.595 + All outstanding requests complete with KErrCancel.
1.596 + */
1.597 + inline void NotifyNewImageCancel();
1.598 +
1.599 + /**
1.600 + Cancels a specific NotifyNewImage() request.
1.601 + The outstanding request completes with KErrCancel.
1.602 + @param aStatus The request status object associated with the request to be cancelled.
1.603 + */
1.604 + inline void NotifyNewImageCancel(const TRequestStatus& aStatus);
1.605 +
1.606 + /**
1.607 + Release a buffer - making it available again for the driver to capture images into.
1.608 + @param aBufferId The buffer id of the buffer that the image to be released is stored.
1.609 + This is a value returned by the NotifyNewImage() request when
1.610 + the buffer was claimed by the client.
1.611 + @return KErrNone if successful;
1.612 + KErrNotFound if the buffer id is invalid;
1.613 + otherwise one of the other system-wide error codes.
1.614 + */
1.615 + inline TInt ReleaseBuffer(TInt aBufferId);
1.616 +
1.617 + /**
1.618 + Retrieves the offset to the start of the buffer using its id, in the specified capture mode.
1.619 + @param aCaptureMode The capture mode that the buffer in the chunk is related to.
1.620 + @param aId The id of the buffer in the chunk.
1.621 + @param aOffset The offset, in bytes, of the start of the buffer within the chunk.
1.622 + @return KErrNone if successful;
1.623 + KErrNotFound if the id doesn't exist;
1.624 + otherwise one of the other system-wide error codes.
1.625 + */
1.626 + inline TInt BufferIdToOffset(TDevCamCaptureMode aCaptureMode, TInt aId, TInt& aOffset);
1.627 +
1.628 + /**
1.629 + Sets the current capture mode. Submits the camera configuration to the PDD.
1.630 + @param aCaptureMode The capture mode that the camera switches to. @see TDevCamCaptureMode.
1.631 + @return KErrNone if successful;
1.632 + otherwise one of the other system-wide error codes.
1.633 + */
1.634 + inline TInt SetCaptureMode(TDevCamCaptureMode aCaptureMode);
1.635 +
1.636 + /**
1.637 + Queries the driver for the size of the structure to be passed to Caps().
1.638 + @return The size of the structure required to hold all capability information.
1.639 + otherwise one of the system-wide error codes.
1.640 + */
1.641 + inline TInt CapsSize();
1.642 +
1.643 + /**
1.644 + Gets information regarding the frame sizes and frame rates supported for a given combination of capture mode and pixel format.
1.645 + The capture mode and pixel format chosen will be dependent upon the information returned by RDevCameraSc::Caps().
1.646 + @param aCaptureMode The capture mode concerned.
1.647 + @param aUidPixelFormat The UID of the pixel format mode concerned.
1.648 + @param aFrameSizeCapsBuf A packaged array of SDevCamFrameSize structures.
1.649 + This is a variable length array and must be large enough to hold all entries.
1.650 + Its size is determined by SDevCamPixelFormat::iNumFrameSizes, returned by RDevCameraSc::Caps(),
1.651 + multiplied by the size of SDevCamFrameSize.
1.652 + @return KErrNone if successful;
1.653 + KErrArgument if an invalid capture mode or pixel format is specified, or if aFrameSizeCapsBuf is too small.
1.654 + otherwise one of the other system-wide error codes.
1.655 + */
1.656 + inline TInt FrameSizeCaps(TDevCamCaptureMode aCaptureMode, TUidPixelFormat aUidPixelFormat, TDes8& aFrameSizeCapsBuf);
1.657 +
1.658 +
1.659 + /**
1.660 + Allows changing of the dynamic settings as specified in TDevCamDynamicAttribute.
1.661 + Checks locally the validity of the arguments passed so as to increase performance by not
1.662 + forcing a context switch.
1.663 + Check the allowable range of the settings via the TCameraCapsV02::iDynamicRange member.
1.664 +
1.665 + @param aAttribute An enum identifying the dynamic attribute to change.
1.666 + @param aValue The attributes value within a valid range.
1.667 + @return KErrNone if successful, KErrNotSupported if not supported,
1.668 + KErrArgument if aValue is out of range.
1.669 + Otherwise, one of the system wide error codes.
1.670 + @see TDevCamDynamicAttribute
1.671 + @see TCameraCapsV02
1.672 + */
1.673 + TInt SetDynamicAttribute(TDevCamDynamicAttribute aAttribute, TUint aValue);
1.674 +
1.675 + /**
1.676 + Queries the driver for a dynamic setting's value.
1.677 + This function does not force a context switch by reading the values from a cache.
1.678 +
1.679 + @param aAttribute An enum identifying the dynamic attribute to query.
1.680 + @param aValue A reference to a variable that will be set to the queried attribute's value.
1.681 + @return KErrNone if successful, KErrNotFound if aAttribute is not supported by the driver.
1.682 + Otherwise, one of the system-wide error codes.
1.683 +
1.684 + @see TDevCamDynamicAttribute
1.685 + @see TCameraCapsV02
1.686 + */
1.687 + TInt GetDynamicAttribute(TDevCamDynamicAttribute aAttribute, TUint& aValue);
1.688 +
1.689 +protected:
1.690 + TInt CheckAttributeSupported(TDevCamDynamicAttribute aAttribute);
1.691 +
1.692 +
1.693 +private:
1.694 + /**
1.695 + Capability of Sensor.
1.696 + Kept here for performance issues, i.e. to avoid context switches.
1.697 + */
1.698 + TCameraCapsV02 *iCameraCaps;
1.699 +
1.700 + /**
1.701 + Size of Camera Capabiliy struct.
1.702 + Kept here for performance issues, i.e. to avoid context switches.
1.703 + */
1.704 + TInt iCapsSize;
1.705 +
1.706 +#endif // __KERNEL_MODE__
1.707 + };
1.708 +
1.709 +
1.710 +
1.711 +
1.712 +#include <d32camerasc.inl>
1.713 +
1.714 +#endif // __D32CAMERASC_H__