|
1 /* |
|
2 * Copyright (c) 2010 ISB. |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the "Symbian Foundation License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * ISB - Initial contribution |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <ecom/ecom.h> |
|
19 #include <ecom/implementationproxy.h> |
|
20 #include <ecamuids.hrh> |
|
21 #include <ecam.h> |
|
22 #include "ecamwebcameraplugin.h" |
|
23 #include "ecamwebcamerapluginuids.hrh" |
|
24 #include "ecamwebcamerabuffer.h" |
|
25 #include "ecamwebcameraadvset.h" |
|
26 #include "ecamwebcameraactive.h" |
|
27 #include "ecamwebcameravfactive.h" |
|
28 |
|
29 |
|
30 _LIT(KCameraDriverPddName, "webcamera.pdd"); |
|
31 _LIT(KCameraDriverLddName, "ewebcamera.ldd"); |
|
32 |
|
33 const TInt KCaptureWidth = 160; // Capture image width |
|
34 const TInt KCaptureHeight = 120; // Capture image height |
|
35 const TInt KCaptureLineBytes = KCaptureWidth * 3; // bytes of one line |
|
36 |
|
37 // |
|
38 // CWebCamera class |
|
39 // |
|
40 |
|
41 CWebCamera::CWebCamera(): |
|
42 iCaptureBufPtr(NULL, 0) |
|
43 { |
|
44 iInfo.iHardwareVersion.iMajor = 0; |
|
45 iInfo.iHardwareVersion.iMinor = 0; |
|
46 iInfo.iHardwareVersion.iBuild = 0; |
|
47 iInfo.iSoftwareVersion.iMajor = 0; |
|
48 iInfo.iSoftwareVersion.iMinor = 0; |
|
49 iInfo.iSoftwareVersion.iBuild = 0; |
|
50 iInfo.iOrientation = TCameraInfo::EOrientationOutwards; |
|
51 |
|
52 iInfo.iOptionsSupported = 0; |
|
53 iInfo.iOptionsSupported |= TCameraInfo::EViewFinderDirectSupported; |
|
54 iInfo.iOptionsSupported |= TCameraInfo::EViewFinderBitmapsSupported; |
|
55 iInfo.iOptionsSupported |= TCameraInfo::EImageCaptureSupported; |
|
56 iInfo.iOptionsSupported |= TCameraInfo::EVideoCaptureSupported; |
|
57 iInfo.iOptionsSupported |= TCameraInfo::EContrastSupported; |
|
58 iInfo.iOptionsSupported |= TCameraInfo::EBrightnessSupported; |
|
59 iInfo.iOptionsSupported |= TCameraInfo::EViewFinderClippingSupported; |
|
60 |
|
61 iInfo.iFlashModesSupported = 0; // Bitfield of TFlash values |
|
62 iInfo.iExposureModesSupported = 0; // Bitfield of TExposure values |
|
63 iInfo.iWhiteBalanceModesSupported = 0; // Bitfield of TWhiteBalance values |
|
64 |
|
65 iInfo.iMinZoom = KMinTestCameraZoom; |
|
66 // KMinTestCameraZoom is zero or negative |
|
67 // note the algorithm for creating of zoom factor |
|
68 iInfo.iMinZoomFactor = TReal32(1)/TReal32(1 << -KMinTestCameraZoom); |
|
69 iInfo.iMaxZoom = KMaxTestCameraZoom; |
|
70 iInfo.iMaxZoomFactor = 1 << KMaxTestCameraZoom; |
|
71 |
|
72 iInfo.iMaxDigitalZoom = KMaxTestCameraDigitalZoom; |
|
73 iInfo.iMaxDigitalZoomFactor = KMaxTestCameraDigitalZoomFactor; |
|
74 |
|
75 iInfo.iImageFormatsSupported = 0; |
|
76 iInfo.iImageFormatsSupported |= EFormatExif; |
|
77 iInfo.iImageFormatsSupported |= EFormatFbsBitmapColor4K; |
|
78 iInfo.iImageFormatsSupported |= EFormatFbsBitmapColor64K; |
|
79 iInfo.iImageFormatsSupported |= EFormatFbsBitmapColor16M; |
|
80 |
|
81 iInfo.iVideoFrameFormatsSupported = 0; |
|
82 iInfo.iVideoFrameFormatsSupported |= EFormatFbsBitmapColor4K; |
|
83 iInfo.iVideoFrameFormatsSupported |= EFormatFbsBitmapColor64K; |
|
84 iInfo.iVideoFrameFormatsSupported |= EFormatFbsBitmapColor16M; |
|
85 iInfo.iMaxFramesPerBufferSupported = 1; |
|
86 iInfo.iMaxBuffersSupported = 2; |
|
87 } |
|
88 |
|
89 CWebCamera::~CWebCamera() |
|
90 { |
|
91 delete iCaptureBuf; |
|
92 delete iAdvSettingsImpl; |
|
93 delete iVfActive; |
|
94 delete iActive; |
|
95 iImageSizes.Close(); |
|
96 iDriver.Close(); |
|
97 } |
|
98 |
|
99 CWebCamera* CWebCamera::NewL() |
|
100 { |
|
101 CWebCamera* self = new(ELeave) CWebCamera; |
|
102 CleanupStack::PushL(self); |
|
103 self->ConstructL(); |
|
104 CleanupStack::Pop(self); |
|
105 |
|
106 return self; |
|
107 } |
|
108 |
|
109 void CWebCamera::ConstructL() |
|
110 { |
|
111 RDebug::Print(_L("CWebCamera::ConstructL_S")); |
|
112 // Open drivers. |
|
113 TInt err; |
|
114 |
|
115 err = User::LoadPhysicalDevice(KCameraDriverPddName); |
|
116 RDebug::Print(_L("CWebCamera::ConstructL LoadPhysicalDevice[%d]"), err); |
|
117 |
|
118 if (err != KErrNone && err != KErrAlreadyExists) |
|
119 { |
|
120 User::Leave(err); |
|
121 } |
|
122 |
|
123 err = User::LoadLogicalDevice(KCameraDriverLddName); |
|
124 RDebug::Print(_L("CWebCamera::ConstructL LoadLogicalDevice[%d]"), err); |
|
125 |
|
126 if (err != KErrNone && err != KErrAlreadyExists) |
|
127 { |
|
128 User::Leave(err); |
|
129 } |
|
130 |
|
131 RDebug::Print(_L("CWebCamera::ConstructL iDriver.Open()")); |
|
132 iDriver.Open(); |
|
133 |
|
134 iActive = CWebCameraActive::NewL(this, iDriver); |
|
135 iVfActive = CWebCameraVfActive::NewL(this, iDriver); |
|
136 |
|
137 User::LeaveIfError(iImageSizes.Append(TSize(640, 480))); // VGA |
|
138 User::LeaveIfError(iImageSizes.Append(TSize(160, 120))); // QQVGA |
|
139 iInfo.iNumImageSizesSupported = iImageSizes.Count(); |
|
140 |
|
141 RDebug::Print(_L("CWebCamera::ConstructL_E")); |
|
142 } |
|
143 |
|
144 /** |
|
145 from CCameraPlugin |
|
146 |
|
147 A call to one of the factory functions firstly loads the plugin, followed by a |
|
148 call to this function to complete construction. |
|
149 |
|
150 Creates an object representing a camera. |
|
151 |
|
152 @param aObserver |
|
153 Reference to class derived from MCameraObserver2 designed to receive |
|
154 notification of asynchronous event completion. |
|
155 @param aCameraIndex |
|
156 Index from 0 to CamerasAvailable()-1 inclusive specifying the |
|
157 camera device to use. |
|
158 @return Pointer to a fully constructed CCamera object. Ownership is passed |
|
159 to the caller. |
|
160 |
|
161 @leave May leave with KErrNoMemory or KErrNotSupported if aCameraIndex is |
|
162 out of range. |
|
163 */ |
|
164 void CWebCamera::Construct2L(MCameraObserver& aObserver,TInt aCameraIndex) |
|
165 { |
|
166 iObserver = &aObserver; |
|
167 iCameraIndex = aCameraIndex; |
|
168 } |
|
169 |
|
170 /** |
|
171 from CCameraPlugin |
|
172 |
|
173 A call to one of the factory functions firstly loads the plugin, followed by a |
|
174 call to this function to complete construction. |
|
175 |
|
176 Duplicates the original camera object for use by, for example, multimedia systems. |
|
177 |
|
178 May leave with KErrNoMemory or KErrNotFound if aCameraHandle is not valid. |
|
179 |
|
180 @param aObserver |
|
181 Reference to an observer. |
|
182 @param aCameraHandle Handle of an existing camera object. |
|
183 |
|
184 @return Duplicate of the original camera object. |
|
185 */ |
|
186 void CWebCamera::Construct2DupL(MCameraObserver& aObserver,TInt aCameraHandle) |
|
187 { |
|
188 iObserver = &aObserver; |
|
189 iCameraHandle = aCameraHandle; |
|
190 } |
|
191 |
|
192 /** |
|
193 from CCameraPlugin |
|
194 |
|
195 A call to one of the factory functions firstly loads the plugin, followed by a |
|
196 call to this function to complete construction. |
|
197 |
|
198 Creates an object representing a camera. |
|
199 |
|
200 @param aObserver |
|
201 Reference to class derived from MCameraObserver2 designed to receive |
|
202 notification of asynchronous event completion. |
|
203 @param aCameraIndex |
|
204 Index from 0 to CamerasAvailable()-1 inclusive specifying the |
|
205 camera device to use. |
|
206 @param aPriority |
|
207 Value from -100 to 100 indicating relative priority of client to |
|
208 use camera. |
|
209 |
|
210 @return Pointer to a fully constructed CCamera object. Ownership is passed |
|
211 to the caller. |
|
212 |
|
213 @leave May leave with KErrNoMemory or KErrNotSupported if aCameraIndex is |
|
214 out of range. |
|
215 */ |
|
216 void CWebCamera::Construct2L(MCameraObserver2& aObserver,TInt aCameraIndex,TInt aPriority) |
|
217 { |
|
218 iObserver2 = &aObserver; |
|
219 iCameraIndex = aCameraIndex; |
|
220 iPriority = aPriority; |
|
221 } |
|
222 |
|
223 /** |
|
224 from CCameraPlugin |
|
225 |
|
226 Duplicates the original camera object for use by, for example, multimedia systems. |
|
227 |
|
228 @leave KErrNoMemory if out of memory. |
|
229 @leave KErrNotFound if aCameraHandle is not valid. |
|
230 @leave KErrPermissionDenied if the application does not have |
|
231 the UserEnvironment capability. |
|
232 |
|
233 @param aObserver |
|
234 Reference to an observer. |
|
235 @param aCameraHandle Handle of an existing camera object. |
|
236 |
|
237 @return Duplicate of the original camera object. |
|
238 |
|
239 @capability UserEnvironment |
|
240 An application that creates a CCamera object must have |
|
241 the UserEnvironment capability. |
|
242 |
|
243 @note Applications using this method to create camera object may not receive enums/uids added in future(after being baselined). |
|
244 To receive them, they should rather use New2L() or NewDuplicate2L(), in which case, they should prepare |
|
245 themselves to receive unrecognised values. |
|
246 */ |
|
247 void CWebCamera::Construct2DupL(MCameraObserver2& aObserver,TInt aCameraHandle) |
|
248 { |
|
249 iObserver2 = &aObserver; |
|
250 iCameraHandle = aCameraHandle; |
|
251 } |
|
252 |
|
253 // |
|
254 // virtual functions |
|
255 // |
|
256 |
|
257 /** |
|
258 from CCamera |
|
259 |
|
260 Gets information about the camera device. |
|
261 |
|
262 @param aInfo |
|
263 On return, information about the camera device. See TCameraInfo. |
|
264 */ |
|
265 void CWebCamera::CameraInfo(TCameraInfo& aInfo) const |
|
266 { |
|
267 aInfo = iInfo; |
|
268 } |
|
269 |
|
270 /** |
|
271 from CCamera |
|
272 |
|
273 Asynchronous function that performs any required initialisation and reserves |
|
274 the camera for exclusive use. |
|
275 |
|
276 Calls MCameraObserver:: ReserveComplete() when complete. |
|
277 */ |
|
278 void CWebCamera::Reserve() |
|
279 { |
|
280 iActive->Reserve(); |
|
281 } |
|
282 |
|
283 /** |
|
284 from CCamera |
|
285 |
|
286 De-initialises the camera, allowing it to be used by other clients. |
|
287 */ |
|
288 void CWebCamera::Release() |
|
289 { |
|
290 StopViewFinder(); |
|
291 iReserved = EFalse; |
|
292 } |
|
293 |
|
294 /** |
|
295 from CCamera |
|
296 |
|
297 Asynchronous method to switch on camera power. |
|
298 |
|
299 User must have successfully called Reserve() prior to calling this function. |
|
300 |
|
301 Calls MCameraObserver::PowerOnComplete() when power on is complete. |
|
302 */ |
|
303 void CWebCamera::PowerOn() |
|
304 { |
|
305 iActive->PowerOn(); |
|
306 } |
|
307 |
|
308 /** |
|
309 from CCamera |
|
310 |
|
311 Synchronous function for switching off camera power. |
|
312 */ |
|
313 void CWebCamera::PowerOff() |
|
314 { |
|
315 StopViewFinder(); |
|
316 iPowerOn = EFalse; |
|
317 } |
|
318 |
|
319 /** |
|
320 from CCamera |
|
321 |
|
322 Gets the device-unique handle of this camera object. |
|
323 |
|
324 @return The device-unique handle of this camera object. |
|
325 */ |
|
326 TInt CWebCamera::Handle() |
|
327 { |
|
328 return 0; |
|
329 } |
|
330 |
|
331 /** |
|
332 from CCamera |
|
333 |
|
334 Sets the zoom factor. |
|
335 |
|
336 This must be in the range of TCameraInfo::iMinZoom to TCameraInfo::iMaxZoom |
|
337 inclusive. May leave with KErrNotSupported if the specified zoom factor is |
|
338 out of range. |
|
339 |
|
340 @param aZoomFactor |
|
341 Required zoom factor. |
|
342 */ |
|
343 void CWebCamera::SetZoomFactorL(TInt /*aZoomFactor = 0*/) |
|
344 { |
|
345 } |
|
346 |
|
347 /** |
|
348 from CCamera |
|
349 |
|
350 Gets the currently set zoom factor. |
|
351 |
|
352 @return The currently set zoom factor. |
|
353 */ |
|
354 TInt CWebCamera::ZoomFactor() const |
|
355 { |
|
356 return 0; |
|
357 } |
|
358 |
|
359 /** |
|
360 from CCamera |
|
361 |
|
362 Sets the digital zoom factor. |
|
363 |
|
364 This must be in the range of 0 to TCameraInfo::iMaxDigitalZoom inclusive. |
|
365 |
|
366 May leave with KErrNotSupported if the zoom factor is out of range. |
|
367 |
|
368 @param aDigitalZoomFactor |
|
369 The required digital zoom factor. |
|
370 */ |
|
371 void CWebCamera::SetDigitalZoomFactorL(TInt /*aDigitalZoomFactor = 0*/) |
|
372 { |
|
373 } |
|
374 |
|
375 /** |
|
376 from CCamera |
|
377 |
|
378 Gets the currently set digital zoom factor. |
|
379 |
|
380 @return The currently set digital zoom factor. |
|
381 */ |
|
382 TInt CWebCamera::DigitalZoomFactor() const |
|
383 { |
|
384 return 0; |
|
385 } |
|
386 |
|
387 /** |
|
388 from CCamera |
|
389 |
|
390 Sets the contrast adjustment of the device. |
|
391 |
|
392 This must be in the range of -100 to +100 or EContrastAuto. May leave with |
|
393 KErrNotSupported if the specified contrast value is out of range. |
|
394 |
|
395 @param aContrast |
|
396 Required contrast value. See TCameraInfo::iContrastSupported |
|
397 */ |
|
398 void CWebCamera::SetContrastL(TInt /*aContrast*/) |
|
399 { |
|
400 } |
|
401 |
|
402 /** |
|
403 from CCamera |
|
404 |
|
405 Gets the currently set contrast value. |
|
406 |
|
407 @return The currently set contrast value. |
|
408 */ |
|
409 TInt CWebCamera::Contrast() const |
|
410 { |
|
411 return 0; |
|
412 } |
|
413 |
|
414 /** |
|
415 from CCamera |
|
416 |
|
417 Sets the brightness adjustment of the device. |
|
418 |
|
419 No effect if this is not supported, see TCameraInfo::iBrightnessSupported. |
|
420 |
|
421 This must be in the range of -100 to +100 or EBrightnessAuto. May leave |
|
422 with KErrNotSupported if the brightness adjustment is out of range. |
|
423 |
|
424 @param aBrightness |
|
425 The required brightness adjustment. |
|
426 */ |
|
427 void CWebCamera::SetBrightnessL(TInt /*aBrightness*/) |
|
428 { |
|
429 } |
|
430 |
|
431 /** |
|
432 from CCamera |
|
433 |
|
434 Gets the currently set brightness adjustment value. |
|
435 |
|
436 @return The currently set brightness adjustment value. |
|
437 */ |
|
438 TInt CWebCamera::Brightness() const |
|
439 { |
|
440 return 0; |
|
441 } |
|
442 |
|
443 /** |
|
444 from CCamera |
|
445 |
|
446 Sets the flash mode. |
|
447 |
|
448 No effect if this is not supported, see TCameraInfo::iFlashModesSupported. |
|
449 |
|
450 May leave with KErrNotSupported if the specified flash mode is invalid. |
|
451 |
|
452 @param aFlash |
|
453 The required flash mode. |
|
454 */ |
|
455 void CWebCamera::SetFlashL(TFlash /*aFlash = EFlashNone*/) |
|
456 { |
|
457 } |
|
458 |
|
459 /** |
|
460 from CCamera |
|
461 |
|
462 Gets the currently set flash mode. |
|
463 |
|
464 @return The currently set flash mode. |
|
465 @note if CCamera::New2L() or CCamera::NewDuplicate2L() is not used to create CCamera object, it is assumed that |
|
466 application is not prepared to receive extra added enum values (unrecognised). So, any extra enum value(unrecognised) |
|
467 (set in the ECAM implementation because of sharing clients) should not be returned from the ECAM implementation. |
|
468 To receive extra added enum values, application should rather use CCamera::New2L() or CCamera::NewDuplicate2L() |
|
469 to create camera object. ECAM implementation, after verifying this,(by checking version no.) may send new values, if set. |
|
470 In this case, application is assumed to be prepared to receive unrecognised enum values. |
|
471 |
|
472 @see CCamera::CCameraAdvancedSettings::FlashMode() |
|
473 */ |
|
474 CCamera::TFlash CWebCamera::Flash() const |
|
475 { |
|
476 return EFlashNone; |
|
477 } |
|
478 |
|
479 /** |
|
480 from CCamera |
|
481 |
|
482 Sets the exposure adjustment of the device. |
|
483 |
|
484 No effect if this is not supported, see CameraInfo::iExposureModesSupported. |
|
485 |
|
486 May leave with KErrNotSupported if the specified exposure adjustment is invalid. |
|
487 |
|
488 @param aExposure |
|
489 The required exposure adjustment. |
|
490 */ |
|
491 void CWebCamera::SetExposureL(TExposure /*aExposure = EExposureAuto*/) |
|
492 { |
|
493 } |
|
494 |
|
495 /** |
|
496 from CCamera |
|
497 |
|
498 Gets the currently set exposure setting value. |
|
499 |
|
500 @return The currently set exposure setting value. |
|
501 */ |
|
502 CCamera::TExposure CWebCamera::Exposure() const |
|
503 { |
|
504 return EExposureAuto; |
|
505 } |
|
506 |
|
507 /** |
|
508 from CCamera |
|
509 |
|
510 Sets the white balance adjustment of the device. |
|
511 |
|
512 No effect if this is not supported, see TCameraInfo::iWhiteBalanceModesSupported. |
|
513 |
|
514 @param aWhiteBalance |
|
515 The required white balance adjustment. |
|
516 |
|
517 @leave KErrNotSupported if the specified white balance adjustment |
|
518 is invalid. |
|
519 */ |
|
520 void CWebCamera::SetWhiteBalanceL(TWhiteBalance /*aWhiteBalance = EWBAuto*/) |
|
521 { |
|
522 } |
|
523 |
|
524 /** |
|
525 from CCamera |
|
526 |
|
527 Gets the currently set white balance adjustment value. |
|
528 |
|
529 @return The currently set white balance adjustment value. |
|
530 |
|
531 @note if CCamera::New2L() or CCamera::NewDuplicate2L() is not used to create CCamera object, it is assumed that |
|
532 application is not prepared to receive extra added enum values (unrecognised). So, any extra enum value(unrecognised) |
|
533 (set in the ECAM implementation because of sharing clients) should not be returned from the ECAM implementation. |
|
534 To receive extra added enum values, application should rather use CCamera::New2L() or CCamera::NewDuplicate2L() |
|
535 to create camera object. ECAM implementation, after verifying this,(by checking version no.) may send new values, if set. |
|
536 In this case, application is assumed to be prepared to receive unrecognised enum values. |
|
537 Refer CCamera::CCameraAdvancedSettings::WhiteBalanceMode() implementation |
|
538 |
|
539 @see CCamera::CCameraAdvancedSettings::WhiteBalanceMode() |
|
540 */ |
|
541 CCamera::TWhiteBalance CWebCamera::WhiteBalance() const |
|
542 { |
|
543 return EWBAuto; |
|
544 } |
|
545 |
|
546 /** |
|
547 from CCamera |
|
548 |
|
549 Starts transfer of view finder data to the given portion of the screen using |
|
550 direct screen access. |
|
551 |
|
552 The aScreenRect parameter is in screen co-ordinates and may be modified if, |
|
553 eg, the camera requires the destination to have a certain byte alignment, etc. |
|
554 |
|
555 @param aWs |
|
556 Window server session. |
|
557 @param aScreenDevice |
|
558 Screen device. |
|
559 @param aWindow |
|
560 Displayable window. |
|
561 @param aScreenRect |
|
562 Portion of the screen to which view finder data is to be |
|
563 transferred. This is in screen co-ordinates and may be modified if, for example, |
|
564 the camera requires the destination to have a certain byte alignment. |
|
565 |
|
566 @leave KErrNotReady if PowerOn() has either not |
|
567 been called, or has not yet completed. |
|
568 |
|
569 @note This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to |
|
570 refer viewfinders started using CCamera methods. |
|
571 |
|
572 @see CCamera::CCameraV2DirectViewFinder |
|
573 */ |
|
574 void CWebCamera::StartViewFinderDirectL(RWsSession& aWs, CWsScreenDevice& aScreenDevice, RWindowBase& aWindow, TRect& aScreenRect) |
|
575 { |
|
576 RDebug::Print(_L("CWebCamera::StartViewFinderDirectL")); |
|
577 TRect emptyRect; |
|
578 StartViewFinderDirectL(aWs, aScreenDevice, aWindow, aScreenRect, emptyRect); |
|
579 } |
|
580 |
|
581 /** |
|
582 from CCamera |
|
583 |
|
584 Starts transfer of view finder data to the given portion of the screen using |
|
585 direct screen access and also clips to the specified portion of the screen. |
|
586 |
|
587 The view finder has the same size and position as aScreenRect but is only |
|
588 visible in the intersection of aScreenRect and aClipRect. May leave with KErrNotSupported |
|
589 or KErrNotReady if Reserve() has not been called, or has not yet completed. |
|
590 |
|
591 @param aWs |
|
592 Window server session. |
|
593 @param aScreenDevice |
|
594 Screen device. |
|
595 @param aWindow |
|
596 Displayable window. |
|
597 @param aScreenRect |
|
598 Portion of the screen to which view finder data is to be |
|
599 transferred. This is in screen co-ordinates and may be modified if, for example, |
|
600 the camera requires the destination to have a certain byte alignment. |
|
601 @param aClipRect |
|
602 The rectangle to which the screen will be clipped. |
|
603 |
|
604 @leave KErrNotReady if PowerOn() hasn't been called successfully. |
|
605 |
|
606 @note This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to |
|
607 refer viewfinders started using CCamera methods. |
|
608 |
|
609 @see CCamera::CCameraClientViewFinder |
|
610 */ |
|
611 void CWebCamera::StartViewFinderDirectL(RWsSession& aWs, CWsScreenDevice& aScreenDevice, RWindowBase& aWindow, TRect& aScreenRect, TRect& aClipRect) |
|
612 { |
|
613 RDebug::Print(_L("CWebCamera::StartViewFinderDirectL'")); |
|
614 iVfActive->StartViewFinderDirectL(aWs, aScreenDevice, aWindow, aScreenRect, aClipRect); |
|
615 } |
|
616 |
|
617 /** |
|
618 from CCamera |
|
619 |
|
620 Starts transfer of view finder data. |
|
621 |
|
622 Bitmaps are returned by MCameraObserver::ViewFinderFrameReady(). |
|
623 |
|
624 @param aSize |
|
625 On return, the size used. |
|
626 @leave KErrNotReady if PowerOn() has not been called, or has not yet completed. |
|
627 |
|
628 @note This method is assumed to be meant for default display only. |
|
629 |
|
630 @see CCamera::CCameraClientViewFinder |
|
631 */ |
|
632 void CWebCamera::StartViewFinderBitmapsL(TSize& /*aSize*/) |
|
633 { |
|
634 } |
|
635 |
|
636 /** |
|
637 from CCamera |
|
638 |
|
639 Starts transfer of view finder data and clips the bitmap to the specified clip |
|
640 rectangle. |
|
641 |
|
642 The bitmap is the size of the intersection of aSize and aClipRect, not simply |
|
643 aSize padded with white space. |
|
644 |
|
645 @param aSize |
|
646 On return, the size used. |
|
647 @param aClipRect |
|
648 Required clip rectangle. May be modified if, for example, |
|
649 the camera only supports certain byte alignments. |
|
650 |
|
651 @leave KErrInUse if Reserve() hasn't been called successfully. |
|
652 @leave KErrNotReady if PowerOn() hasn't been called successfully. |
|
653 |
|
654 @note This method is assumed to be meant for default display only. |
|
655 |
|
656 @see CCamera::CCameraClientViewFinder |
|
657 */ |
|
658 void CWebCamera::StartViewFinderBitmapsL(TSize& /*aSize*/,TRect& /*aClipRect*/) |
|
659 { |
|
660 } |
|
661 |
|
662 /** |
|
663 from CCamera |
|
664 |
|
665 Starts transfer of view finder data. |
|
666 |
|
667 Picture data is returned by MCameraObserver2::ViewFinderReady(). |
|
668 |
|
669 @param aImageFormat |
|
670 The image format requested by the client. |
|
671 @param aSize |
|
672 On return, the size used. |
|
673 @leave KErrNotSupported |
|
674 @leave KErrNotReady if Reserve() has not been |
|
675 called, or has not yet completed. |
|
676 |
|
677 @note This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to |
|
678 refer viewfinders started using CCamera methods. |
|
679 |
|
680 @see CCamera::CCameraClientViewFinder |
|
681 */ |
|
682 void CWebCamera::StartViewFinderL(TFormat /*aImageFormat*/,TSize& /*aSize*/) |
|
683 { |
|
684 } |
|
685 |
|
686 /** |
|
687 from CCamera |
|
688 |
|
689 Starts transfer of view finder data and clips the picture to the specified clip |
|
690 rectangle. Picture data is returned by MCameraObserver2::ViewFinderReady(). |
|
691 |
|
692 The picture is the size of the intersection of aSize and aClipRect, not simply |
|
693 aSize padded with white space. |
|
694 |
|
695 @param aImageFormat |
|
696 The image format. |
|
697 @param aSize |
|
698 On return, the size used. |
|
699 @param aClipRect |
|
700 Required clip rectangle. May be modified if, for example, |
|
701 the camera only supports certain byte alignments. |
|
702 |
|
703 @leave KErrInUse if Reserve() hasn't been called successfully, |
|
704 @leave KErrNotReady if PowerOn() hasn't been called successfully. |
|
705 |
|
706 @note This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to |
|
707 refer viewfinders started using CCamera methods. |
|
708 |
|
709 @see CCamera::CCameraClientViewFinder |
|
710 */ |
|
711 void CWebCamera::StartViewFinderL(TFormat /*aImageFormat*/,TSize& /*aSize*/,TRect& /*aClipRect*/) |
|
712 { |
|
713 } |
|
714 |
|
715 /** |
|
716 Stops transfer of view finder data to the screen. |
|
717 |
|
718 @note This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to |
|
719 refer viewfinders started using CCamera methods. |
|
720 |
|
721 @see CCamera::CCameraV2DirectViewFinder |
|
722 @see CCamera::CCameraClientViewFinder |
|
723 */ |
|
724 void CWebCamera::StopViewFinder() |
|
725 { |
|
726 iVfActive->StopViewFinder(); |
|
727 } |
|
728 |
|
729 /** |
|
730 from CCamera |
|
731 |
|
732 Queries whether the view finder is active. |
|
733 |
|
734 @return ETrue if the view finder is active. EFalse if the view finder is not |
|
735 active. |
|
736 |
|
737 @note This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to |
|
738 refer viewfinders started using CCamera methods. |
|
739 |
|
740 @see CCamera::CCameraV2DirectViewFinder |
|
741 @see CCamera::CCameraClientViewFinder |
|
742 */ |
|
743 TBool CWebCamera::ViewFinderActive() const |
|
744 { |
|
745 return iVfActive->ViewFinderActive(); |
|
746 } |
|
747 |
|
748 /** |
|
749 from CCamera |
|
750 |
|
751 Sets whether view finder mirroring is on. |
|
752 |
|
753 Used to switch between what the camera sees and what you would see if the |
|
754 device were a mirror. |
|
755 |
|
756 @param aMirror |
|
757 ETrue to set mirroring on, EFalse to set mirroring off. |
|
758 |
|
759 @leave KErrNotSupported. |
|
760 |
|
761 @note This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to |
|
762 refer viewfinders started using CCamera methods. |
|
763 |
|
764 @see CCamera::CCameraV2DirectViewFinder |
|
765 @see CCamera::CCameraClientViewFinder |
|
766 */ |
|
767 void CWebCamera::SetViewFinderMirrorL(TBool /*aMirror*/) |
|
768 { |
|
769 } |
|
770 |
|
771 /** |
|
772 from CCamera |
|
773 |
|
774 Gets whether view finder mirroring is active. |
|
775 |
|
776 @return ETrue if mirroring is set, EFalse if mirroring is not set. |
|
777 |
|
778 @note This method is assumed to be meant for default display only. KECamDefaultViewFinderHandle should be used to |
|
779 refer viewfinders started using CCamera methods. |
|
780 |
|
781 @see CCamera::CCameraV2DirectViewFinder |
|
782 @see CCamera::CCameraClientViewFinder |
|
783 */ |
|
784 TBool CWebCamera::ViewFinderMirror() const |
|
785 { |
|
786 return EFalse; |
|
787 } |
|
788 |
|
789 /** |
|
790 from CCamera |
|
791 |
|
792 Performs setup and allocation of memory. |
|
793 |
|
794 Called prior to calling CaptureImage() to keep the latency of that function |
|
795 to a minimum. |
|
796 |
|
797 Needs to be called only once for multiple CaptureImage() calls. May leave |
|
798 with KErrNotSupported or KErrNoMemory or KErrInUse or KErrNotReady. |
|
799 |
|
800 The specified image format must be one of the formats supported |
|
801 (see TCameraInfo::iImageFormatsSupported). |
|
802 |
|
803 The specified size index must be in the range of 0 to TCameraInfo::iNumImageSizesSupported-1 |
|
804 inclusive. |
|
805 |
|
806 @param aImageFormat |
|
807 The image format. |
|
808 @param aSizeIndex |
|
809 Size index. |
|
810 |
|
811 @leave KErrNotSupported |
|
812 @leave KErrNoMemory |
|
813 @leave KErrNotReady if PowerOn() hasn't been called successfully. |
|
814 |
|
815 @see CCamera::CCameraPreImageCaptureControl::PrepareImageCapture(TPrepareImageParameters aPrepareImageParameters) |
|
816 */ |
|
817 void CWebCamera::PrepareImageCaptureL(TFormat /*aImageFormat*/,TInt /*aSizeIndex*/) |
|
818 { |
|
819 } |
|
820 |
|
821 /** |
|
822 from CCamera |
|
823 |
|
824 Performs setup and allocation of memory and clips the image to the specified |
|
825 rectangle. |
|
826 |
|
827 No effect unless TCameraInfo::iImageClippingSupported is set to ETrue. The |
|
828 image captured is the intersection of aClipRect and the rectangle from (0,0) |
|
829 to aSize. Needs to be called only once for multiple CaptureImage() calls. |
|
830 May leave with KErrNotSupported or KErrNoMemory. |
|
831 |
|
832 The specified image format must be one of the formats supported (see TCameraInfo::iImageFormatsSupported). |
|
833 |
|
834 The specified size index must be in the range of 0 to TCameraInfo::iNumImageSizesSupported-1 |
|
835 inclusive. |
|
836 |
|
837 @param aImageFormat |
|
838 The image format. |
|
839 @param aSizeIndex |
|
840 Size index. |
|
841 @param aClipRect |
|
842 The rectangle to which the image is to be clipped. |
|
843 |
|
844 @leave KErrNotSupported |
|
845 @leave KErrNoMemory |
|
846 @leave KErrInUse if Reserve() hasn't been called successfully |
|
847 @leave KErrNotReady if PowerOn() |
|
848 hasn't been called successfully. |
|
849 |
|
850 @see CCamera::CCameraPreImageCaptureControl::PrepareImageCapture(TPrepareImageParameters aPrepareImageParameters) |
|
851 */ |
|
852 void CWebCamera::PrepareImageCaptureL(TFormat /*aImageFormat*/,TInt /*aSizeIndex*/,const TRect& /*aClipRect*/) |
|
853 { |
|
854 } |
|
855 |
|
856 /** |
|
857 from CCamera |
|
858 |
|
859 Asynchronously performs still image capture. |
|
860 |
|
861 Calls MCameraObserver::ImageReady() when complete. |
|
862 |
|
863 @see CCamera::CCameraImageCapture |
|
864 @see CCamera::CCameraPreImageCaptureControl |
|
865 */ |
|
866 void CWebCamera::CaptureImage() |
|
867 { |
|
868 delete iCaptureBuf; |
|
869 iCaptureBuf = NULL; |
|
870 |
|
871 iCaptureBuf = HBufC8::NewL(KMaxBufSize); |
|
872 iCaptureBufPtr.Set(iCaptureBuf->Des()); |
|
873 iCaptureBufPtr.SetLength(0); |
|
874 |
|
875 iActive->ImageCapture(iCaptureBufPtr); |
|
876 |
|
877 iImageCaptureActive = ETrue; |
|
878 } |
|
879 |
|
880 /** |
|
881 from CCamera |
|
882 |
|
883 Cancels the asynchronous still image capture. |
|
884 |
|
885 @see CCamera::CCameraImageCapture |
|
886 */ |
|
887 void CWebCamera::CancelCaptureImage() |
|
888 { |
|
889 iImageCaptureActive = EFalse; |
|
890 } |
|
891 |
|
892 /** |
|
893 from CCamera |
|
894 |
|
895 Enumerates through the available image capture sizes, based on the specified |
|
896 size index and format |
|
897 |
|
898 The size index must be in the range 0 to TCameraInfo::iNumImageSizesSupported-1 |
|
899 inclusive. |
|
900 |
|
901 @param aSize |
|
902 Image size. |
|
903 @param aSizeIndex |
|
904 Size index. |
|
905 @param aFormat |
|
906 The image format. |
|
907 */ |
|
908 void CWebCamera::EnumerateCaptureSizes(TSize& aSize, TInt aSizeIndex, TFormat aFormat) const |
|
909 { |
|
910 if (aSizeIndex < 0 || aSizeIndex >= iInfo.iNumImageSizesSupported || |
|
911 !(aFormat & iInfo.iImageFormatsSupported) ) |
|
912 { |
|
913 aSize = TSize(0,0); |
|
914 } |
|
915 else |
|
916 { |
|
917 aSize = iImageSizes[aSizeIndex]; |
|
918 } |
|
919 } |
|
920 |
|
921 /** |
|
922 from CCamera |
|
923 |
|
924 Prepares for video capture. |
|
925 |
|
926 Performs setup and allocation of memory prior to calling StartVideoCapture() |
|
927 to keep the latency of that function to a minimum. |
|
928 |
|
929 May leave with KErrNotSupported or KErrNoMemory. |
|
930 |
|
931 @param aFormat |
|
932 Format must be one of the video frame formats supported (see |
|
933 TCameraInfo::iVideoFrameFormatsSupported). |
|
934 @param aSizeIndex |
|
935 Size index must be in the range 0 to TCameraInfo::iNumVideoFrameSizesSupported-1 |
|
936 inclusive. |
|
937 @param aRateIndex |
|
938 The rate must be in the range 0 to TCameraInfo::iNumVideoFrameRatesSupported-1 |
|
939 inclusive. |
|
940 @param aBuffersToUse |
|
941 The number of discrete buffers to use. |
|
942 @param aFramesPerBuffer |
|
943 How large the buffers are to be. Must be less than |
|
944 or equal to TCameraInfo::iMaxFramesPerBufferSupported. One buffer is returned |
|
945 to MCameraObserver::FrameBufferReady() at a time. |
|
946 |
|
947 @leave May leave with KErrNotSupported, KErrNoMemory, or KErrNotReady if PowerOn() |
|
948 hasn't been called successfully. |
|
949 |
|
950 @see CCamera::CCameraVideoCaptureControl::PrepareVideoCapture(const TPrepareVideoParameters& aPrepareVideoParameters) |
|
951 */ |
|
952 void CWebCamera::PrepareVideoCaptureL(TFormat /*aFormat*/,TInt /*aSizeIndex*/,TInt /*aRateIndex*/,TInt /*aBuffersToUse*/,TInt /*aFramesPerBuffer*/) |
|
953 { |
|
954 } |
|
955 |
|
956 /** |
|
957 from CCamera |
|
958 |
|
959 Prepares for video capture and clips the frames to the given rectangle. |
|
960 |
|
961 Performs setup and allocation of memory prior to calling StartVideoCapture() |
|
962 to keep the latency of that function to a minimum. |
|
963 |
|
964 May leave with KErrNotSupported or KErrNoMemory. |
|
965 |
|
966 @param aFormat |
|
967 Format must be one of the video frame formats supported (see |
|
968 TCameraInfo::iVideoFrameFormatsSupported). |
|
969 @param aSizeIndex |
|
970 Size index must be in the range 0 to TCameraInfo::iNumVideoFrameSizesSupported-1 |
|
971 inclusive. |
|
972 @param aRateIndex |
|
973 The rate must be in the range 0 to TCameraInfo::iNumVideoFrameRatesSupported-1 |
|
974 inclusive. |
|
975 @param aBuffersToUse |
|
976 The number of discrete buffers to use. |
|
977 @param aFramesPerBuffer |
|
978 How large the buffers are to be. Must be less than |
|
979 or equal to TCameraInfo::iMaxFramesPerBufferSupported. One buffer is returned |
|
980 to MCameraObserver::FrameBufferReady() at a time. |
|
981 @param aClipRect |
|
982 The rectangle to which the image is to be clipped. |
|
983 @leave KErrNotSupported |
|
984 @leave KErrNoMemory, |
|
985 @leave KErrInUse if Reserve() hasn't been called successfully |
|
986 @leave KErrNotReady if PowerOn() hasn't been called successfully. |
|
987 |
|
988 @see CCamera::CCameraVideoCaptureControl::PrepareVideoCapture(const TPrepareVideoParameters& aPrepareVideoParameters) |
|
989 */ |
|
990 void CWebCamera::PrepareVideoCaptureL(TFormat /*aFormat*/,TInt /*aSizeIndex*/,TInt /*aRateIndex*/,TInt /*aBuffersToUse*/,TInt /*aFramesPerBuffer*/,const TRect& /*aClipRect*/) |
|
991 { |
|
992 } |
|
993 |
|
994 /** |
|
995 from CCamera |
|
996 |
|
997 Starts capturing video. |
|
998 |
|
999 Calls MCameraObserver::FrameBufferReady() when each buffer has been filled |
|
1000 with the required number of frames, as set by PrepareVideoCaptureL(). |
|
1001 */ |
|
1002 void CWebCamera::StartVideoCapture() |
|
1003 { |
|
1004 } |
|
1005 |
|
1006 /** |
|
1007 from CCamera |
|
1008 |
|
1009 Stops video capture. |
|
1010 */ |
|
1011 void CWebCamera::StopVideoCapture() |
|
1012 { |
|
1013 } |
|
1014 |
|
1015 /** |
|
1016 from CCamera |
|
1017 |
|
1018 Tests whether video capture is active. |
|
1019 |
|
1020 @return ETrue if video capture is active. EFalse if video capture is not active |
|
1021 */ |
|
1022 TBool CWebCamera::VideoCaptureActive() const |
|
1023 { |
|
1024 return EFalse; |
|
1025 } |
|
1026 |
|
1027 /** |
|
1028 from CCamera |
|
1029 |
|
1030 Enumerates through the available video frame sizes, based on the specified |
|
1031 size index and format. |
|
1032 |
|
1033 @param aSize |
|
1034 On return the available video frame sizes. Sizes should be returned |
|
1035 in order, largest first, so clients do not have to iterate through every one. |
|
1036 @param aSizeIndex |
|
1037 Size index. Must be in the range 0 to TCameraInfo::iNumVideoFrameSizesSupported-1 |
|
1038 inclusive |
|
1039 @param aFormat |
|
1040 Image format. |
|
1041 */ |
|
1042 void CWebCamera::EnumerateVideoFrameSizes(TSize& /*aSize*/,TInt /*aSizeIndex*/,TFormat /*aFormat*/) const |
|
1043 { |
|
1044 } |
|
1045 |
|
1046 /** |
|
1047 from CCamera |
|
1048 |
|
1049 Enumerates through the available video frame rates, based on the specified |
|
1050 rate index, video frame format, size index and exposure mode. |
|
1051 |
|
1052 @param aRate |
|
1053 On return, the available video frame rates. Some rates may not |
|
1054 be available due to, for example, current flash mode setting. In those cases |
|
1055 a rate of 0 will be returned. Rates should be returned in order, highest first, |
|
1056 so clients do not have to iterate through every one. |
|
1057 @param aRateIndex |
|
1058 The rate index. Must be in the range 0 to TCameraInfo::iNumVideoFrameRatesSupported-1 |
|
1059 inclusive. |
|
1060 @param aFormat |
|
1061 The format. |
|
1062 @param aSizeIndex |
|
1063 The size index. |
|
1064 @param aExposure |
|
1065 The exposure mode. |
|
1066 */ |
|
1067 void CWebCamera::EnumerateVideoFrameRates(TReal32& /*aRate*/,TInt /*aRateIndex*/,TFormat /*aFormat*/,TInt /*aSizeIndex*/,TExposure /*aExposure = EExposureAuto*/) const |
|
1068 { |
|
1069 } |
|
1070 |
|
1071 /** |
|
1072 from CCamera |
|
1073 |
|
1074 Gets the frame size currently in use. |
|
1075 |
|
1076 @param aSize |
|
1077 The frame size currently in use. |
|
1078 */ |
|
1079 void CWebCamera::GetFrameSize(TSize& /*aSize*/) const |
|
1080 { |
|
1081 } |
|
1082 |
|
1083 /** |
|
1084 from CCamera |
|
1085 |
|
1086 Gets the frame rate currently in use. |
|
1087 |
|
1088 @return The frame rate currently in use. |
|
1089 */ |
|
1090 TReal32 CWebCamera::FrameRate() const |
|
1091 { |
|
1092 return 0.0; |
|
1093 } |
|
1094 |
|
1095 /** |
|
1096 from CCamera |
|
1097 |
|
1098 Gets the number of buffers currently in use. |
|
1099 |
|
1100 @return The number of buffers currently in use. |
|
1101 */ |
|
1102 TInt CWebCamera::BuffersInUse() const |
|
1103 { |
|
1104 return 0; |
|
1105 } |
|
1106 |
|
1107 /** |
|
1108 from CCamera |
|
1109 |
|
1110 Gets the number of frames per buffer currently in use. |
|
1111 |
|
1112 @return The number of frames per buffer currently in use. |
|
1113 */ |
|
1114 TInt CWebCamera::FramesPerBuffer() const |
|
1115 { |
|
1116 return 0; |
|
1117 } |
|
1118 |
|
1119 /** |
|
1120 from CCamera |
|
1121 |
|
1122 Sets the quality value to use if jpeg is a supported image for video format. |
|
1123 |
|
1124 Ignored if jpeg is not a supported image for video format. |
|
1125 |
|
1126 @param aQuality |
|
1127 The quality value to use, clamped to the range 1 to 100. |
|
1128 |
|
1129 @see CCamera::CCameraPreImageCaptureControl::TPrepareImageParameters::iImageMaxMemorySize |
|
1130 */ |
|
1131 void CWebCamera::SetJpegQuality(TInt /*aQuality*/) |
|
1132 { |
|
1133 } |
|
1134 |
|
1135 /** |
|
1136 from CCamera |
|
1137 |
|
1138 Gets the currently set jpeg quality value. |
|
1139 |
|
1140 Returns 0 if not supported. |
|
1141 |
|
1142 @return The currently set jpeg quality value. |
|
1143 |
|
1144 @see CCamera::CCameraPreImageCaptureControl::GetImageMaxMemorySizeL(TUint& aMemorySize) |
|
1145 */ |
|
1146 TInt CWebCamera::JpegQuality() const |
|
1147 { |
|
1148 return 0; |
|
1149 } |
|
1150 |
|
1151 /** |
|
1152 from CCamera |
|
1153 |
|
1154 Gets a custom interface. The client has to cast the returned pointer |
|
1155 to the appropriate type. |
|
1156 |
|
1157 @param aInterface |
|
1158 The Uid of the particular interface function required. |
|
1159 |
|
1160 @return Custom interface pointer. NULL if the requested interface is not supported. |
|
1161 */ |
|
1162 TAny* CWebCamera::CustomInterface(TUid aInterface) |
|
1163 { |
|
1164 switch(aInterface.iUid) |
|
1165 { |
|
1166 // advanced settings interface pointers |
|
1167 case KECamMCameraAdvancedSettingsUidValue: |
|
1168 iAdvSettingsImpl = CWebCameraAdvSet::NewL(*this); |
|
1169 return static_cast<MCameraAdvancedSettings*>(iAdvSettingsImpl); |
|
1170 |
|
1171 case KECamMCameraAdvancedSettings2UidValue: |
|
1172 iAdvSettingsImpl = CWebCameraAdvSet::NewL(*this); |
|
1173 return static_cast<MCameraAdvancedSettings2*>(iAdvSettingsImpl); |
|
1174 |
|
1175 case KECamMCameraAdvancedSettings3UidValue: |
|
1176 iAdvSettingsImpl = CWebCameraAdvSet::NewL(*this); |
|
1177 return static_cast<MCameraAdvancedSettings3*>(iAdvSettingsImpl); |
|
1178 |
|
1179 default: |
|
1180 return NULL; |
|
1181 } |
|
1182 } |
|
1183 |
|
1184 /** |
|
1185 from MWebCameraActiveCallBack |
|
1186 |
|
1187 CallBack function of the Reserve |
|
1188 */ |
|
1189 void CWebCamera::ReserveCallBack(TInt aError) |
|
1190 { |
|
1191 RDebug::Print(_L("CWebCamera::ReserveCallBack")); |
|
1192 |
|
1193 if (iObserver) |
|
1194 { |
|
1195 iObserver->ReserveComplete(aError); |
|
1196 } |
|
1197 else if (iObserver2) |
|
1198 { |
|
1199 const TECAMEvent wEvent(KUidECamEventReserveComplete, aError); |
|
1200 iObserver2->HandleEvent(wEvent); |
|
1201 } |
|
1202 } |
|
1203 |
|
1204 /** |
|
1205 from MWebCameraActiveCallBack |
|
1206 |
|
1207 CallBack function of the PowerOn |
|
1208 */ |
|
1209 void CWebCamera::PowerOnCallBack(TInt aError) |
|
1210 { |
|
1211 RDebug::Print(_L("CWebCamera::PowerOnCallBack")); |
|
1212 |
|
1213 if (iObserver) |
|
1214 { |
|
1215 iObserver->PowerOnComplete(aError); |
|
1216 } |
|
1217 else if (iObserver2) |
|
1218 { |
|
1219 const TECAMEvent wEvent(KUidECamEventPowerOnComplete, aError); |
|
1220 iObserver2->HandleEvent(wEvent); |
|
1221 } |
|
1222 } |
|
1223 |
|
1224 /** |
|
1225 from MWebCameraActiveCallBack |
|
1226 |
|
1227 CallBack function of the ImageCapture |
|
1228 */ |
|
1229 void CWebCamera::ImageCaptureCallBackL(TInt aError) |
|
1230 { |
|
1231 RDebug::Print(_L("CWebCamera::ImageCaptureCallBack_S")); |
|
1232 |
|
1233 iImageCaptureActive = EFalse; |
|
1234 |
|
1235 iCaptureBitmap = NULL; |
|
1236 CFbsBitmap* image = new (ELeave) CFbsBitmap(); |
|
1237 CleanupStack::PushL(image); |
|
1238 User::LeaveIfError(image->Create(TSize(KCaptureWidth, KCaptureHeight), EColor16M)); |
|
1239 CleanupStack::Pop(image); |
|
1240 iCaptureBitmap = image; |
|
1241 |
|
1242 //////////////////////////////////////////////////////////////////////////////////////// |
|
1243 // output receive data log |
|
1244 // RDebug::Print(_L("CWebCameraVfActive::ImageCaptureCallBack iCaptureBufPtr[%d]"), iCaptureBufPtr.Length()); |
|
1245 // TBuf<256> hexBuf; |
|
1246 // for (TInt i = 0; i < iCaptureBufPtr.Length(); i++) |
|
1247 // { |
|
1248 // hexBuf.AppendFormat(_L("%02X "), iCaptureBufPtr[i]); |
|
1249 // if ((i % 16) == 15) |
|
1250 // { |
|
1251 // RDebug::Print(hexBuf); |
|
1252 // hexBuf = KNullDesC; |
|
1253 // } |
|
1254 // } |
|
1255 // RDebug::Print(hexBuf); |
|
1256 //////////////////////////////////////////////////////////////////////////////////////// |
|
1257 |
|
1258 RDebug::Print(_L("CWebCamera::ImageCaptureCallBack start setscanline_S")); |
|
1259 for (TInt height=0; height<KCaptureHeight; height++) |
|
1260 { |
|
1261 TInt pos = height * KCaptureLineBytes; |
|
1262 TPtrC8 posptr = iCaptureBuf->Mid(pos, KCaptureLineBytes); |
|
1263 TBuf8<KCaptureLineBytes> buf; |
|
1264 buf.Copy(posptr); |
|
1265 iCaptureBitmap->SetScanLine(buf, ((KCaptureHeight-1)-height)); |
|
1266 } |
|
1267 RDebug::Print(_L("CWebCamera::ImageCaptureCallBack start setscanline_E")); |
|
1268 |
|
1269 if (iObserver) |
|
1270 { |
|
1271 iObserver->ImageReady(iCaptureBitmap, iCaptureBuf, aError); |
|
1272 } |
|
1273 else if (iObserver2) |
|
1274 { |
|
1275 iObserver2->ImageBufferReady(*iCaptureCameraBuf, aError); |
|
1276 } |
|
1277 |
|
1278 RDebug::Print(_L("CWebCamera::ImageCaptureCallBack_E")); |
|
1279 } |
|
1280 |
|
1281 //from MWebCameraVfActiveCallBack |
|
1282 void CWebCamera::ViewFinderCallBack(TInt /*aError*/) |
|
1283 { |
|
1284 RDebug::Print(_L("CWebCamera::ViewFinderCallBack")); |
|
1285 } |
|
1286 |
|
1287 |
|
1288 // |
|
1289 // CWebCameraInfo class |
|
1290 // |
|
1291 |
|
1292 CWebCameraInfo::CWebCameraInfo() |
|
1293 { |
|
1294 } |
|
1295 |
|
1296 CWebCameraInfo::~CWebCameraInfo() |
|
1297 { |
|
1298 } |
|
1299 |
|
1300 CWebCameraInfo* CWebCameraInfo::NewL() |
|
1301 { |
|
1302 return new (ELeave) CWebCameraInfo; |
|
1303 } |
|
1304 |
|
1305 /** |
|
1306 from CCameraInfoPlugin |
|
1307 |
|
1308 Determines the number of cameras on the device. |
|
1309 |
|
1310 @return Count of cameras present on the device. |
|
1311 */ |
|
1312 TInt CWebCameraInfo::CamerasAvailable() |
|
1313 { |
|
1314 return 1; |
|
1315 } |
|
1316 |
|
1317 |
|
1318 // __________________________________________________________________________ |
|
1319 // Exported proxy for instantiation method resolution |
|
1320 // Define the interface UIDs |
|
1321 const TImplementationProxy ImplementationTable[] = |
|
1322 { |
|
1323 IMPLEMENTATION_PROXY_ENTRY(KUidOnboardWebCameraPlugin, CWebCamera::NewL), |
|
1324 IMPLEMENTATION_PROXY_ENTRY(KUidOnboardWebCameraInfo, CWebCameraInfo::NewL) |
|
1325 }; |
|
1326 |
|
1327 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) |
|
1328 { |
|
1329 aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); |
|
1330 |
|
1331 return ImplementationTable; |
|
1332 } |