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 the License "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: // e32\include\d32camerasc.h sl@0: // User side class definition for the shared chunk camera driver. sl@0: // sl@0: // sl@0: sl@0: /** sl@0: @file sl@0: @internalAll sl@0: @prototype sl@0: */ sl@0: sl@0: #ifndef __D32CAMERASC_H__ sl@0: #define __D32CAMERASC_H__ sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: _LIT(KDevCameraScName,"CameraSc"); sl@0: sl@0: /** sl@0: Camera capability constants - bitmasks of possible flash modes. @see TCameraCapsV02. sl@0: */ sl@0: /** Flash will automatically fire when required. */ sl@0: const TUint KCamFlashAuto = 0x0001; sl@0: /** Flash will always fire. */ sl@0: const TUint KCamFlashForced = 0x0002; sl@0: /** Reduced flash for general lighting */ sl@0: const TUint KCamFlashFillIn = 0x0004; sl@0: /** Red-eye reduction mode. */ sl@0: const TUint KCamFlashRedEyeReduce = 0x0008; sl@0: /** Flash at the moment when shutter opens. */ sl@0: const TUint KCamFlashSlowFrontSync = 0x0010; sl@0: /** Flash at the moment when shutter closes. */ sl@0: const TUint KCamFlashSlowRearSync = 0x0020; sl@0: /** User configurable setting */ sl@0: const TUint KCamFlashManual = 0x0040; sl@0: sl@0: /** sl@0: Camera capability constants - bitmasks of possible exposure modes. @see TCameraCapsV02. sl@0: */ sl@0: /** Night-time setting for long exposures. */ sl@0: const TUint KCamExposureNight = 0x0001; sl@0: /** Backlight setting for bright backgrounds. */ sl@0: const TUint KCamExposureBacklight = 0x0002; sl@0: /** Centered mode for ignoring surroundings. */ sl@0: const TUint KCamExposureCenter = 0x0004; sl@0: /** Sport setting for very short exposures. */ sl@0: const TUint KCamExposureSport = 0x0008; sl@0: /** Generalised setting for very long exposures. */ sl@0: const TUint KCamExposureVeryLong = 0x0010; sl@0: /** Snow setting for daylight exposure. */ sl@0: const TUint KCamExposureSnow = 0x0020; sl@0: /** Beach setting for daylight exposure with reflective glare. */ sl@0: const TUint KCamExposureBeach = 0x0040; sl@0: /** Programmed exposure setting. */ sl@0: const TUint KCamExposureProgram = 0x0080; sl@0: /** Aperture setting is given priority. */ sl@0: const TUint KCamExposureAperturePriority = 0x0100; sl@0: /** Shutter speed setting is given priority. */ sl@0: const TUint KCamExposureShutterPriority = 0x0200; sl@0: /** User selectable exposure value setting. */ sl@0: const TUint KCamExposureManual = 0x0400; sl@0: /** Exposure night setting with colour removed to get rid of colour noise. */ sl@0: const TUint KCamExposureSuperNight = 0x0800; sl@0: /** Exposure for infra-red sensor on the camera */ sl@0: const TUint KCamExposureInfra = 0x1000; sl@0: sl@0: /** sl@0: Camera capability constants - bitmasks of possible white balance modes. @see TCameraCapsV02. sl@0: */ sl@0: /** Normal daylight. */ sl@0: const TUint KCamWBDaylight = 0x0001; sl@0: /** Overcast daylight. */ sl@0: const TUint KCamWBCloudy = 0x0002; sl@0: /** Tungsten filament lighting. */ sl@0: const TUint KCamWBTungsten = 0x0004; sl@0: /** Fluorescent tube lighting */ sl@0: const TUint KCamWBFluorescent = 0x0008; sl@0: /** Flash lighting. */ sl@0: const TUint KCamWBFlash = 0x0010; sl@0: /** High contrast daylight primarily snowy */ sl@0: const TUint KCamWBSnow = 0x0020; sl@0: /** High contrast daylight primarily near the sea */ sl@0: const TUint KCamWBBeach = 0x0040; sl@0: /** User configurable mode */ sl@0: const TUint KCamWBManual = 0x0080; sl@0: sl@0: /** sl@0: Camera capability constants - bitmasks of other miscellaneous camera capabilities supported. @see TCameraCapsV02. sl@0: */ sl@0: /** The camera has zoom capability. */ sl@0: const TUint KCamMiscZoom = 0x0001; sl@0: /** The camera supports contrast adjustment. */ sl@0: const TUint KCamMiscContrast = 0x0002; sl@0: /** The camera supports brightness adjustment. */ sl@0: const TUint KCamMiscBrightness = 0x0004; sl@0: /** The camera supports color effect adjustment. */ sl@0: const TUint KCamMiscColorEffect = 0x0008; sl@0: sl@0: sl@0: /** sl@0: Enumeration of capture modes in which to run the sensor. sl@0: */ sl@0: enum TDevCamCaptureMode sl@0: { sl@0: /** Used to specify that still image mode is to be used. */ sl@0: ECamCaptureModeImage, sl@0: /** Used to specify that streaming video mode is to be used. */ sl@0: ECamCaptureModeVideo, sl@0: /** Used to specify that streaming viewfinder mode is to be used. */ sl@0: ECamCaptureModeViewFinder, sl@0: /** The last value here, helps keep track of the number of capture modes. */ sl@0: ECamCaptureModeMax sl@0: }; sl@0: sl@0: /** sl@0: Enumeration of camera flash modes. @see TCameraConfigV02. sl@0: */ sl@0: enum TDevCamFlashMode sl@0: { sl@0: /** No flash, always supported. */ sl@0: ECamFlashNone=0x0000, sl@0: /** Flash will automatically fire when required. */ sl@0: ECamFlashAuto=0x0001, sl@0: /** Flash will always fire. */ sl@0: ECamFlashForced=0x0002, sl@0: /** Reduced flash for general lighting */ sl@0: ECamFlashFillIn=0x0004, sl@0: /** Red-eye reduction mode. */ sl@0: ECamFlashRedEyeReduce=0x0008, sl@0: /** Flash at the moment when shutter opens. */ sl@0: ECamFlashSlowFrontSync=0x0010, sl@0: /** Flash at the moment when shutter closes. */ sl@0: ECamFlashSlowRearSync=0x0020, sl@0: /** User configurable setting */ sl@0: ECamFlashManual=0x0040 sl@0: }; sl@0: sl@0: /** sl@0: Enumeration of camera exposure modes. @see TCameraConfigV02. sl@0: */ sl@0: enum TDevCamExposureMode sl@0: { sl@0: /** Set exposure automatically. Default, always supported. */ sl@0: ECamExposureAuto=0x0000, sl@0: /** Night-time setting for long exposures. */ sl@0: ECamExposureNight=0x0001, sl@0: /** Backlight setting for bright backgrounds. */ sl@0: ECamExposureBacklight=0x0002, sl@0: /** Centered mode for ignoring surroundings. */ sl@0: ECamExposureCenter=0x0004, sl@0: /** Sport setting for very short exposures. */ sl@0: ECamExposureSport=0x0008, sl@0: /** Generalised setting for very long exposures. */ sl@0: ECamExposureVeryLong=0x0010, sl@0: /** Snow setting for daylight exposure. */ sl@0: ECamExposureSnow=0x0020, sl@0: /** Beach setting for daylight exposure with reflective glare. */ sl@0: ECamExposureBeach=0x0040, sl@0: /** Programmed exposure setting. */ sl@0: ECamExposureProgram=0x0080, sl@0: /** Aperture setting is given priority. */ sl@0: ECamExposureAperturePriority=0x0100, sl@0: /** Shutter speed setting is given priority. */ sl@0: ECamExposureShutterPriority=0x0200, sl@0: /** User selectable exposure value setting. */ sl@0: ECamExposureManual=0x0400, sl@0: /** Exposure night setting with colour removed to get rid of colour noise. */ sl@0: ECamExposureSuperNight=0x0800, sl@0: /** Exposure for infra-red sensor on the camera */ sl@0: ECamExposureInfra=0x1000 sl@0: }; sl@0: sl@0: /** sl@0: Enumeration of camera white balance modes. @see TCameraConfigV02. sl@0: */ sl@0: enum TDevCamWhiteBalanceMode sl@0: { sl@0: /** Set white balance automatically. Default, always supported. */ sl@0: ECamWBAuto=0x0000, sl@0: /** Normal daylight. */ sl@0: ECamWBDaylight=0x0001, sl@0: /** Overcast daylight. */ sl@0: ECamWBCloudy=0x0002, sl@0: /** Tungsten filament lighting. */ sl@0: ECamWBTungsten=0x0004, sl@0: /** Fluorescent tube lighting */ sl@0: ECamWBFluorescent=0x0008, sl@0: /** Flash lighting. */ sl@0: ECamWBFlash=0x0010, sl@0: /** High contrast daylight primarily snowy */ sl@0: ECamWBSnow=0x0020, sl@0: /** High contrast daylight primarily near the sea */ sl@0: ECamWBBeach=0x0040, sl@0: /** User configurable mode */ sl@0: ECamWBManual=0x0080 sl@0: }; sl@0: sl@0: /** sl@0: Enumeration of possible directions in which the camera may point. @see TCameraCapsV02. sl@0: */ sl@0: enum TDevCamOrientation sl@0: { sl@0: /** Outward pointing camera for taking pictures. Camera is directed away from the user. */ sl@0: ECamOrientationOutwards, sl@0: /** Inward pointing camera for conferencing. Camera is directed towards the user. */ sl@0: ECamOrientationInwards, sl@0: /** Mobile camera capable of multiple orientations. Camera orientation may be changed by the user. */ sl@0: ECamOrientationMobile, sl@0: /** Camera orientation is not known. */ sl@0: ECamOrientationUnknown sl@0: }; sl@0: sl@0: /** sl@0: Each item in the iPixelFormatSupported array is represented by an instance of this structure. sl@0: */ sl@0: struct SDevCamPixelFormat sl@0: { sl@0: /** The UID of the pixel format supported */ sl@0: TUidPixelFormat iPixelFormat; sl@0: /** The number of frame sizes represented by the pixel format. */ sl@0: TUint iNumFrameSizes; sl@0: /** The pixel width in number of bytes */ sl@0: TUint iPixelWidthInBytes; sl@0: }; sl@0: sl@0: /** sl@0: Each frame size supported is represented by an instance of this structure. sl@0: */ sl@0: struct SDevCamFrameSize sl@0: { sl@0: /** Width of the frame in pixels. */ sl@0: TUint iWidth; sl@0: /** Height of the frame in pixels. */ sl@0: TUint iHeight; sl@0: /** Minimum frame rate supported by this frame size. */ sl@0: TUint iMinFrameRate; sl@0: /** Maximum frame rate supported by this frame size. */ sl@0: TUint iMaxFrameRate; sl@0: }; sl@0: sl@0: /** sl@0: Lets us associate buffers to their mode when working out the buffer offset in a chunk. sl@0: **/ sl@0: class TDevCamBufferModeAndId sl@0: { sl@0: public: sl@0: TDevCamCaptureMode iCaptureMode; sl@0: TInt iId; sl@0: }; sl@0: typedef TPckgBuf TDevCamBufferModeAndIdBuf; sl@0: sl@0: /** sl@0: The general driver capabilites class - returned by the LDD factory in response to RDevice::GetCaps(). sl@0: */ sl@0: class TCapsDevCameraV01 sl@0: { sl@0: public: sl@0: TVersion iVersion; sl@0: }; sl@0: sl@0: /** sl@0: Defines a list of settings that are changable often (dynamically) within a single use of the device. sl@0: */ sl@0: enum TDevCamDynamicAttribute sl@0: { sl@0: ECamAttributeBrightness, sl@0: ECamAttributeContrast, sl@0: ECamAttributeColorEffect, sl@0: ECamAttributeMax sl@0: }; sl@0: sl@0: /** sl@0: Holds the range and interval (rate of change) values for a dynamic capability. sl@0: An array of these would be indexed by TDevCamDynamicAttribute sl@0: */ sl@0: struct TDynamicRange sl@0: { sl@0: TUint iMin; sl@0: TUint iMax; sl@0: TUint iDefault; sl@0: }; sl@0: sl@0: /** sl@0: The main camera capabilities class. This is used to get the capabilities of a specific camera sl@0: device once a channel to it has been opened. sl@0: */ sl@0: class TCameraCapsV02 sl@0: { sl@0: public : sl@0: /** The flash modes supported - a bit field. */ sl@0: TUint iFlashModes; sl@0: /** The exposure modes supported - a bit field. */ sl@0: TUint iExposureModes; sl@0: /** The white balance modes supported - a bit field. */ sl@0: TUint iWhiteBalanceModes; sl@0: /** The orientation of the camera device. */ sl@0: TDevCamOrientation iOrientation; sl@0: /** The minimum value that may be set for the zoom factor. Must be negative or zero. Negative values sl@0: represent macro functionality. @see TCameraCapsV02::iCapsMisc. @see TCameraConfigV02::iZoom. */ sl@0: TUint iMinZoom; sl@0: /** The maximum value that may be set for the zoom factor. Must be positive or zero. sl@0: @see TCameraCapsV02::iCapsMisc. @see TCameraConfigV02::iZoom. */ sl@0: TUint iMaxZoom; sl@0: /** Whether other miscellaneous capabilities are supported - a bitfield. These sl@0: capabilities include whether the device supports simultaneous capture modes, zoom capabilities, contrast sl@0: adjustment, brightness, and color effect adjustment. */ sl@0: TUint iCapsMisc; sl@0: /** Number of pixel formats supported in still image capture mode. sl@0: Will be set to 0 if image capture is not supported. */ sl@0: TUint iNumImagePixelFormats; sl@0: /** Number of pixel formats supported in video capture mode. sl@0: Will be set to 0 if image capture is not supported. */ sl@0: TUint iNumVideoPixelFormats; sl@0: /** Number of pixel formats supported in view finder capture mode. sl@0: Will be set to 0 if image capture is not supported. */ sl@0: TUint iNumViewFinderPixelFormats; sl@0: sl@0: /** An array specifying the range in values for settings as defined by TDevCamDynamicAttribute. sl@0: Indices for settings are in the order defined in TDevCamDynamicAttribute. sl@0: If the setting is not supported then the entry is still present for performance reasons, sl@0: i.e. indexing over searching. sl@0: @see TDevCamDynamicAttribute sl@0: @see TDynamicRange sl@0: */ sl@0: TDynamicRange iDynamicRange[ECamAttributeMax]; sl@0: sl@0: /** A variable length array specifying the pixel formats supported by the sensor. sl@0: The size of the TCameraCapsV02 structure is determined by each sensor's capabilities sl@0: thus the array of supported pixel formats is of variable length. It is stored in memory sl@0: exactly after TCameraCapsV02 whenever memory is allocated for it and the array cannot be sl@0: accessed by a private member. sl@0: SDevCamPixelFormat iPixelFormatsSupported[]; sl@0: */ sl@0: }; sl@0: sl@0: typedef TPckgBuf TCameraCapsV02Buf; sl@0: sl@0: /** sl@0: The camera configuration class. This is used to get and set the current sl@0: configuration of the camera. @see SDevCamFrameSize and @see SDevCamPixelFormat. sl@0: */ sl@0: class TCameraConfigV02 sl@0: { sl@0: public: sl@0: /** The size of the image to get from the sensor. */ sl@0: SDevCamFrameSize iFrameSize; sl@0: /** The pixel format (RGB, YUV, RGB Bayer etc). */ sl@0: SDevCamPixelFormat iPixelFormat; sl@0: /** The frame rate (in frame/s). */ sl@0: TUint iFrameRate; sl@0: /** The flash mode setting. */ sl@0: TDevCamFlashMode iFlashMode; sl@0: /** The exposure mode setting. */ sl@0: TDevCamExposureMode iExposureMode; sl@0: /** The white balance mode setting. */ sl@0: TDevCamWhiteBalanceMode iWhiteBalanceMode; sl@0: /** The zoom factor. Can be zero, positive or negative, Negative values represent macro functionality.*/ sl@0: TInt iZoom; sl@0: /** Specifies the number of bytes used to store one pixel's worth of data. */ sl@0: TInt iPixelWidthInBytes; sl@0: }; sl@0: typedef TPckgBuf TCameraConfigV02Buf; sl@0: sl@0: /** A structure used to assemble arguments for the function RDevCameraSc::SetBufConfigChunkOpen() and to pass sl@0: these to the driver. */ sl@0: struct SSetBufConfigChunkOpenInfo sl@0: { sl@0: const TDesC8* iBufferConfigBuf; sl@0: TInt iChunkHandle; sl@0: }; sl@0: sl@0: /** A structure used to assemble arguments for the function RDevCameraSc::FrameSizeCaps() and to pass sl@0: these to the driver. */ sl@0: struct SFrameSizeCapsInfo sl@0: { sl@0: TUidPixelFormat iUidPixelFormat; sl@0: TDevCamCaptureMode iCaptureMode; sl@0: }; sl@0: sl@0: /** sl@0: The camera device driver API supporting shared chunks. This is the principle interface to communicate with sl@0: an attached camera. sl@0: */ sl@0: class RDevCameraSc : public RBusLogicalChannel sl@0: { sl@0: public: sl@0: enum TRequest sl@0: /** sl@0: Asynchronous request types sl@0: */ sl@0: { sl@0: EMsgRequestMax=3, // All requests less than this value are handled in the driver DFC thread. sl@0: ERequestNotifyNewImage, sl@0: ENumRequests, sl@0: EAllRequests = (1< sl@0: sl@0: #endif // __D32CAMERASC_H__