author | William Roberts <williamr@symbian.org> |
Mon, 21 Jun 2010 21:52:32 +0100 | |
branch | GCC_SURGE |
changeset 172 | 8f7f130ac31a |
parent 31 | 56f325a607ea |
child 258 | 880ff05ad710 |
permissions | -rw-r--r-- |
0 | 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 |
*/ |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
279 |
enum TDevCamDynamicAttribute |
0 | 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. |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
289 |
An array of these would be indexed by TDevCamDynamicAttribute |
0 | 290 |
*/ |
291 |
struct TDynamicRange |
|
292 |
{ |
|
293 |
TUint iMin; |
|
294 |
TUint iMax; |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
295 |
TUint iDefault; |
0 | 296 |
}; |
297 |
||
298 |
/** |
|
299 |
The main camera capabilities class. This is used to get the capabilities of a specific camera |
|
300 |
device once a channel to it has been opened. |
|
301 |
*/ |
|
302 |
class TCameraCapsV02 |
|
303 |
{ |
|
304 |
public : |
|
305 |
/** The flash modes supported - a bit field. */ |
|
306 |
TUint iFlashModes; |
|
307 |
/** The exposure modes supported - a bit field. */ |
|
308 |
TUint iExposureModes; |
|
309 |
/** The white balance modes supported - a bit field. */ |
|
310 |
TUint iWhiteBalanceModes; |
|
311 |
/** The orientation of the camera device. */ |
|
312 |
TDevCamOrientation iOrientation; |
|
313 |
/** The minimum value that may be set for the zoom factor. Must be negative or zero. Negative values |
|
314 |
represent macro functionality. @see TCameraCapsV02::iCapsMisc. @see TCameraConfigV02::iZoom. */ |
|
315 |
TUint iMinZoom; |
|
316 |
/** The maximum value that may be set for the zoom factor. Must be positive or zero. |
|
317 |
@see TCameraCapsV02::iCapsMisc. @see TCameraConfigV02::iZoom. */ |
|
318 |
TUint iMaxZoom; |
|
319 |
/** Whether other miscellaneous capabilities are supported - a bitfield. These |
|
320 |
capabilities include whether the device supports simultaneous capture modes, zoom capabilities, contrast |
|
321 |
adjustment, brightness, and color effect adjustment. */ |
|
322 |
TUint iCapsMisc; |
|
323 |
/** Number of pixel formats supported in still image capture mode. |
|
324 |
Will be set to 0 if image capture is not supported. */ |
|
325 |
TUint iNumImagePixelFormats; |
|
326 |
/** Number of pixel formats supported in video capture mode. |
|
327 |
Will be set to 0 if image capture is not supported. */ |
|
328 |
TUint iNumVideoPixelFormats; |
|
329 |
/** Number of pixel formats supported in view finder capture mode. |
|
330 |
Will be set to 0 if image capture is not supported. */ |
|
331 |
TUint iNumViewFinderPixelFormats; |
|
332 |
||
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
333 |
/** An array specifying the range in values for settings as defined by TDevCamDynamicAttribute. |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
334 |
Indices for settings are in the order defined in TDevCamDynamicAttribute. |
0 | 335 |
If the setting is not supported then the entry is still present for performance reasons, |
336 |
i.e. indexing over searching. |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
337 |
@see TDevCamDynamicAttribute |
0 | 338 |
@see TDynamicRange |
339 |
*/ |
|
340 |
TDynamicRange iDynamicRange[ECamAttributeMax]; |
|
341 |
||
342 |
/** A variable length array specifying the pixel formats supported by the sensor. |
|
343 |
The size of the TCameraCapsV02 structure is determined by each sensor's capabilities |
|
344 |
thus the array of supported pixel formats is of variable length. It is stored in memory |
|
345 |
exactly after TCameraCapsV02 whenever memory is allocated for it and the array cannot be |
|
346 |
accessed by a private member. |
|
347 |
SDevCamPixelFormat iPixelFormatsSupported[]; |
|
348 |
*/ |
|
349 |
}; |
|
350 |
||
351 |
typedef TPckgBuf<TCameraCapsV02> TCameraCapsV02Buf; |
|
352 |
||
353 |
/** |
|
354 |
The camera configuration class. This is used to get and set the current |
|
355 |
configuration of the camera. @see SDevCamFrameSize and @see SDevCamPixelFormat. |
|
356 |
*/ |
|
357 |
class TCameraConfigV02 |
|
358 |
{ |
|
359 |
public: |
|
360 |
/** The size of the image to get from the sensor. */ |
|
361 |
SDevCamFrameSize iFrameSize; |
|
362 |
/** The pixel format (RGB, YUV, RGB Bayer etc). */ |
|
363 |
SDevCamPixelFormat iPixelFormat; |
|
364 |
/** The frame rate (in frame/s). */ |
|
365 |
TUint iFrameRate; |
|
366 |
/** The flash mode setting. */ |
|
367 |
TDevCamFlashMode iFlashMode; |
|
368 |
/** The exposure mode setting. */ |
|
369 |
TDevCamExposureMode iExposureMode; |
|
370 |
/** The white balance mode setting. */ |
|
371 |
TDevCamWhiteBalanceMode iWhiteBalanceMode; |
|
372 |
/** The zoom factor. Can be zero, positive or negative, Negative values represent macro functionality.*/ |
|
373 |
TInt iZoom; |
|
374 |
/** Specifies the number of bytes used to store one pixel's worth of data. */ |
|
375 |
TInt iPixelWidthInBytes; |
|
376 |
}; |
|
377 |
typedef TPckgBuf<TCameraConfigV02> TCameraConfigV02Buf; |
|
378 |
||
379 |
/** A structure used to assemble arguments for the function RDevCameraSc::SetBufConfigChunkOpen() and to pass |
|
380 |
these to the driver. */ |
|
381 |
struct SSetBufConfigChunkOpenInfo |
|
382 |
{ |
|
383 |
const TDesC8* iBufferConfigBuf; |
|
384 |
TInt iChunkHandle; |
|
385 |
}; |
|
386 |
||
387 |
/** A structure used to assemble arguments for the function RDevCameraSc::FrameSizeCaps() and to pass |
|
388 |
these to the driver. */ |
|
389 |
struct SFrameSizeCapsInfo |
|
390 |
{ |
|
391 |
TUidPixelFormat iUidPixelFormat; |
|
392 |
TDevCamCaptureMode iCaptureMode; |
|
393 |
}; |
|
394 |
||
395 |
/** |
|
396 |
The camera device driver API supporting shared chunks. This is the principle interface to communicate with |
|
397 |
an attached camera. |
|
398 |
*/ |
|
399 |
class RDevCameraSc : public RBusLogicalChannel |
|
400 |
{ |
|
401 |
public: |
|
402 |
enum TRequest |
|
403 |
/** |
|
404 |
Asynchronous request types |
|
405 |
*/ |
|
406 |
{ |
|
407 |
EMsgRequestMax=3, // All requests less than this value are handled in the driver DFC thread. |
|
408 |
ERequestNotifyNewImage, |
|
409 |
ENumRequests, |
|
410 |
EAllRequests = (1<<ENumRequests)-1 |
|
411 |
}; |
|
412 |
||
413 |
enum TControl |
|
414 |
/** |
|
415 |
Synchronous request types |
|
416 |
*/ |
|
417 |
{ |
|
418 |
EControlSetBufConfigChunkCreate, |
|
419 |
EControlSetBufConfigChunkOpen, |
|
420 |
EControlStart, |
|
421 |
EControlStop, |
|
422 |
EControlSetCamConfig, |
|
423 |
EControlSetCaptureMode, |
|
424 |
EControlChunkClose, |
|
425 |
EMsgControlMax=100, // All requests less than this value are handled in the driver DFC thread. |
|
426 |
EControlCaps, |
|
427 |
EControlGetCamConfig, |
|
428 |
EControlGetBufferConfig, |
|
429 |
EControlReleaseBuffer, |
|
430 |
EControlNotifyNewImageSpecificCancel, |
|
431 |
EControlBufferIdToOffset, |
|
432 |
EControlCapsSize, |
|
433 |
EControlFrameSizeCaps, |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
434 |
EControlSetDynamicAttribute, |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
435 |
EControlGetDynamicAttribute |
0 | 436 |
}; |
437 |
||
438 |
public: |
|
439 |
/** |
|
440 |
Get the version number of camera driver interface. |
|
441 |
@return The camera driver interface version number. |
|
442 |
*/ |
|
443 |
inline static TVersion VersionRequired(); |
|
444 |
||
445 |
#ifndef __KERNEL_MODE__ |
|
446 |
||
447 |
/** |
|
448 |
Constructor. |
|
449 |
Initialises private members. |
|
450 |
*/ |
|
451 |
inline RDevCameraSc(); |
|
452 |
||
453 |
/** |
|
454 |
Open a channel on a specified camera device. This driver only allows one channel to be opened on each device. |
|
455 |
@param aUnit The unit number of the camera device. |
|
456 |
@return KErrNone, if successful; |
|
457 |
KErrInUse, if a channel is already opened on the unit concerned; |
|
458 |
otherwise one of the other system-wide error codes. |
|
459 |
*/ |
|
460 |
inline TInt Open(TInt aUnit); |
|
461 |
||
462 |
/** |
|
463 |
Close the Channel and clean up. |
|
464 |
*/ |
|
465 |
inline void Close(); |
|
466 |
||
467 |
/** |
|
468 |
Get the capabilities of the camera device. |
|
469 |
@param aCapsBuf A packaged TCameraCapsV02 object which on return will be filled with the capabilities of the device. |
|
470 |
@return KErrNone, if successful; |
|
471 |
KErrArgument, if aCapsBuf is too small. |
|
472 |
@see TCameraCapsV02. |
|
473 |
*/ |
|
474 |
inline TInt Caps(TDes8& aCapsBuf); |
|
475 |
||
476 |
/** |
|
477 |
Get the capabilities of the camera device. |
|
478 |
@return TPtrC8 pointing to a locally held TCameraCapsV02 structure owned by the driver. |
|
479 |
@see TCameraCapsV02. |
|
480 |
*/ |
|
481 |
inline TPtrC8 Caps(); |
|
482 |
||
483 |
/** |
|
484 |
Set the camera configuration settings. |
|
485 |
@param aCaptureMode The capture mode that camera will be configured for. |
|
486 |
@param aConfigBuf A packaged TCameraConfigV02 object which contains the configuration settings. |
|
487 |
@see TCameraConfigV02. |
|
488 |
*/ |
|
489 |
inline TInt SetCamConfig(TDevCamCaptureMode aCaptureMode, const TDesC8& aConfigBuf); |
|
490 |
||
491 |
/** |
|
492 |
Trigger the buffer allocation and configuration setting - creating a shared chunk. |
|
493 |
From the frame size, pixel format (already supplied) and the number of camera buffers specified, |
|
494 |
the driver will calculate the size of the shared chunk this requires. It will create such |
|
495 |
a shared chunk containing the specified number of buffers within it (each with memory committed to them). |
|
496 |
This will replace a previous shared chunk created by this driver. |
|
497 |
A handle to the chunk will then be created for the client thread which will be assigned to the |
|
498 |
RChunk object supplied by the client.The configuration cannot be changed unless image capture is disabled. |
|
499 |
@param aCaptureMode The capture mode that camera will be configured for. |
|
500 |
@param aNumBuffers The desired number of buffers that is going to be used. |
|
501 |
@param aChunk An RChunk object to which the chunk handle will be assigned. |
|
502 |
@return KErrNone if successful; |
|
503 |
KErrInUse if image capturing is already in progress; |
|
504 |
KErrArgument if any configuration values are invalid; |
|
505 |
KErrNoMemory if the driver failed allocate memory for the shared chunk specified; |
|
506 |
otherwise one of the other system-wide error codes. |
|
507 |
*/ |
|
508 |
inline TInt SetBufConfigChunkCreate(TDevCamCaptureMode aCaptureMode, TInt aNumBuffers, RChunk& aChunk); |
|
509 |
||
510 |
/** |
|
511 |
Get the current camera configuration settings. |
|
512 |
@param aCaptureMode The capture mode that the user requested the configuration settings of. |
|
513 |
@param aConfigBuf A packaged TCameraConfigV02 object which will be filled with the configuration settings. |
|
514 |
@see TCameraConfigV02. |
|
515 |
*/ |
|
516 |
inline void GetCamConfig(TDevCamCaptureMode aCaptureMode, TDes8& aConfigBuf); |
|
517 |
||
518 |
/** |
|
519 |
Get the current buffer configuration settings. |
|
520 |
@param aCaptureMode The capture mode that the configuration request is for. |
|
521 |
@param aConfigBuf A packaged TSharedChunkBufConfigBase derived object which will be filled with the configuration settings. |
|
522 |
@see TSharedChunkBufConfigBase. |
|
523 |
*/ |
|
524 |
inline void GetBufferConfig(TDevCamCaptureMode aCaptureMode, TDes8& aConfigBuf); |
|
525 |
||
526 |
/** |
|
527 |
Set the current buffer configuration settings - using an existing shared chunk. |
|
528 |
The client supplies an existing shared chunk which is to be used by the driver as the play buffer. |
|
529 |
Any shared chunk previously created by the driver will be closed by it. |
|
530 |
The configuration cannot be changed unless image capture is disabled. |
|
531 |
@param aCaptureMode The capture mode that the configuration is for. |
|
532 |
@param aBufferConfigBuf A packaged TSharedChunkBufConfigBase derived object holding information on the buffer configuration |
|
533 |
settings of the chunk supplied. |
|
534 |
@param aChunk A handle to the shared chunk which is to be used as the buffer. (This must be a |
|
535 |
valid handle for the calling thread). |
|
536 |
@return KErrNone if successful; |
|
537 |
KErrInUse if the playing of data is in progress; |
|
538 |
KErrBadHandle if the chunk handle was invalid; |
|
539 |
KErrArgument if any configuration values are invalid; |
|
540 |
otherwise one of the other system-wide error codes. |
|
541 |
@see TCameraConfigV02. |
|
542 |
*/ |
|
543 |
inline TInt SetBufConfigChunkOpen(TDevCamCaptureMode aCaptureMode, const TDesC8& aBufferConfigBuf, RChunk& aChunk); |
|
544 |
||
545 |
/** |
|
546 |
Closes the chunk associated with a given capture mode, and frees the associated buffers. The chunk being closed, |
|
547 |
should have been allocated by the device driver by a call to SetBufConfigChunkCreate(). |
|
548 |
@param aCaptureMode The capture mode for which to close the chunk. |
|
549 |
@return KErrNone if successful. |
|
550 |
KErrInUse if an attempt has been made to free the memory and chunk while they are in use. |
|
551 |
Otherwise one of the other system-wide error codes. |
|
552 |
*/ |
|
553 |
inline TInt ChunkClose(TDevCamCaptureMode aCaptureMode); |
|
554 |
||
555 |
/** |
|
556 |
Start the image capture process in the capture mode supplied. |
|
557 |
If the driver is in free running mode then it will commence capturing frames - cycling between |
|
558 |
each buffer available to it until Stop() is called. In one shot mode the driver postpones the capturing |
|
559 |
of frames until a NotifyNewImage() request is received. |
|
560 |
@return KErrNone if successful; |
|
561 |
KErrNotReady if SetConfig() has not been previously called; |
|
562 |
otherwise one of the other system-wide error codes. |
|
563 |
@pre The driver must have been previousely initialised by a call to SetConfigNN() |
|
564 |
*/ |
|
565 |
inline TInt Start(); |
|
566 |
||
567 |
/** |
|
568 |
End the image capturing process. |
|
569 |
Also performs NotifyNewImageCancel() |
|
570 |
@return KErrGeneral if Start() has not been previously called; |
|
571 |
KErrNone otherwise. |
|
572 |
*/ |
|
573 |
inline TInt Stop(); |
|
574 |
||
575 |
/** |
|
576 |
Get the next available image. |
|
577 |
More than one request may be pending at any time. |
|
578 |
If the camera is enabled for image capture and image capture is not already in progress then the issuing |
|
579 |
of this request will start image capture mode. |
|
580 |
@param aStatus The request status which is signaled when an image is available (or an error occurs). |
|
581 |
If the request is successful then this result value is the offset within the shared chunk |
|
582 |
where the capture image resides. Alternatively, if an error occurs it will be set to one of |
|
583 |
the system wide error values: |
|
584 |
KErrNotReady if Start() hasn't been previousely called; |
|
585 |
KErrInUse if the client already has all the images buffers. |
|
586 |
@pre Image capturing must have been started with Start(). |
|
587 |
*/ |
|
588 |
inline void NotifyNewImage(TRequestStatus& aStatus); |
|
589 |
||
590 |
/** |
|
591 |
Cancels all outstanding NotifyNewImage() requests. |
|
592 |
All outstanding requests complete with KErrCancel. |
|
593 |
*/ |
|
594 |
inline void NotifyNewImageCancel(); |
|
595 |
||
596 |
/** |
|
597 |
Cancels a specific NotifyNewImage() request. |
|
598 |
The outstanding request completes with KErrCancel. |
|
599 |
@param aStatus The request status object associated with the request to be cancelled. |
|
600 |
*/ |
|
601 |
inline void NotifyNewImageCancel(const TRequestStatus& aStatus); |
|
602 |
||
603 |
/** |
|
604 |
Release a buffer - making it available again for the driver to capture images into. |
|
605 |
@param aBufferId The buffer id of the buffer that the image to be released is stored. |
|
606 |
This is a value returned by the NotifyNewImage() request when |
|
607 |
the buffer was claimed by the client. |
|
608 |
@return KErrNone if successful; |
|
609 |
KErrNotFound if the buffer id is invalid; |
|
610 |
otherwise one of the other system-wide error codes. |
|
611 |
*/ |
|
612 |
inline TInt ReleaseBuffer(TInt aBufferId); |
|
613 |
||
614 |
/** |
|
615 |
Retrieves the offset to the start of the buffer using its id, in the specified capture mode. |
|
616 |
@param aCaptureMode The capture mode that the buffer in the chunk is related to. |
|
617 |
@param aId The id of the buffer in the chunk. |
|
618 |
@param aOffset The offset, in bytes, of the start of the buffer within the chunk. |
|
619 |
@return KErrNone if successful; |
|
620 |
KErrNotFound if the id doesn't exist; |
|
621 |
otherwise one of the other system-wide error codes. |
|
622 |
*/ |
|
623 |
inline TInt BufferIdToOffset(TDevCamCaptureMode aCaptureMode, TInt aId, TInt& aOffset); |
|
624 |
||
625 |
/** |
|
626 |
Sets the current capture mode. Submits the camera configuration to the PDD. |
|
627 |
@param aCaptureMode The capture mode that the camera switches to. @see TDevCamCaptureMode. |
|
628 |
@return KErrNone if successful; |
|
629 |
otherwise one of the other system-wide error codes. |
|
630 |
*/ |
|
631 |
inline TInt SetCaptureMode(TDevCamCaptureMode aCaptureMode); |
|
632 |
||
633 |
/** |
|
634 |
Queries the driver for the size of the structure to be passed to Caps(). |
|
635 |
@return The size of the structure required to hold all capability information. |
|
636 |
otherwise one of the system-wide error codes. |
|
637 |
*/ |
|
638 |
inline TInt CapsSize(); |
|
639 |
||
640 |
/** |
|
641 |
Gets information regarding the frame sizes and frame rates supported for a given combination of capture mode and pixel format. |
|
642 |
The capture mode and pixel format chosen will be dependent upon the information returned by RDevCameraSc::Caps(). |
|
643 |
@param aCaptureMode The capture mode concerned. |
|
644 |
@param aUidPixelFormat The UID of the pixel format mode concerned. |
|
645 |
@param aFrameSizeCapsBuf A packaged array of SDevCamFrameSize structures. |
|
646 |
This is a variable length array and must be large enough to hold all entries. |
|
647 |
Its size is determined by SDevCamPixelFormat::iNumFrameSizes, returned by RDevCameraSc::Caps(), |
|
648 |
multiplied by the size of SDevCamFrameSize. |
|
649 |
@return KErrNone if successful; |
|
650 |
KErrArgument if an invalid capture mode or pixel format is specified, or if aFrameSizeCapsBuf is too small. |
|
651 |
otherwise one of the other system-wide error codes. |
|
652 |
*/ |
|
653 |
inline TInt FrameSizeCaps(TDevCamCaptureMode aCaptureMode, TUidPixelFormat aUidPixelFormat, TDes8& aFrameSizeCapsBuf); |
|
654 |
||
655 |
||
656 |
/** |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
657 |
Allows changing of the dynamic settings as specified in TDevCamDynamicAttribute. |
0 | 658 |
Checks locally the validity of the arguments passed so as to increase performance by not |
659 |
forcing a context switch. |
|
660 |
Check the allowable range of the settings via the TCameraCapsV02::iDynamicRange member. |
|
661 |
||
662 |
@param aAttribute An enum identifying the dynamic attribute to change. |
|
663 |
@param aValue The attributes value within a valid range. |
|
664 |
@return KErrNone if successful, KErrNotSupported if not supported, |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
665 |
KErrArgument if aValue is out of range. |
0 | 666 |
Otherwise, one of the system wide error codes. |
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
667 |
@see TDevCamDynamicAttribute |
0 | 668 |
@see TCameraCapsV02 |
669 |
*/ |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
670 |
TInt SetDynamicAttribute(TDevCamDynamicAttribute aAttribute, TUint aValue); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
671 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
672 |
/** |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
673 |
Queries the driver for a dynamic setting's value. |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
674 |
This function does not force a context switch by reading the values from a cache. |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
675 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
676 |
@param aAttribute An enum identifying the dynamic attribute to query. |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
677 |
@param aValue A reference to a variable that will be set to the queried attribute's value. |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
678 |
@return KErrNone if successful, KErrNotFound if aAttribute is not supported by the driver. |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
679 |
Otherwise, one of the system-wide error codes. |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
680 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
681 |
@see TDevCamDynamicAttribute |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
682 |
@see TCameraCapsV02 |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
683 |
*/ |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
684 |
TInt GetDynamicAttribute(TDevCamDynamicAttribute aAttribute, TUint& aValue); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
685 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
686 |
protected: |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
687 |
TInt CheckAttributeSupported(TDevCamDynamicAttribute aAttribute); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
688 |
|
0 | 689 |
|
690 |
private: |
|
691 |
/** |
|
692 |
Capability of Sensor. |
|
693 |
Kept here for performance issues, i.e. to avoid context switches. |
|
694 |
*/ |
|
695 |
TCameraCapsV02 *iCameraCaps; |
|
696 |
||
697 |
/** |
|
698 |
Size of Camera Capabiliy struct. |
|
699 |
Kept here for performance issues, i.e. to avoid context switches. |
|
700 |
*/ |
|
701 |
TInt iCapsSize; |
|
702 |
||
703 |
#endif // __KERNEL_MODE__ |
|
704 |
}; |
|
705 |
||
706 |
||
707 |
||
708 |
||
709 |
#include <d32camerasc.inl> |
|
710 |
||
711 |
#endif // __D32CAMERASC_H__ |