os/mm/imagingandcamerafws/cameraunittest/src/ECamUnitTestPlugin/ECamUnitTestPlugin.cpp
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/imagingandcamerafws/cameraunittest/src/ECamUnitTestPlugin/ECamUnitTestPlugin.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,681 @@
1.4 +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#include <f32file.h>
1.20 +#include <ecom/ecom.h>
1.21 +#include <ecom/implementationproxy.h>
1.22 +#include <ecamuids.hrh>
1.23 +#include <ecam.h>
1.24 +#include <ecam/ecamadvsettingsintfuids.hrh>
1.25 +#include "ECamUnitTestPlugin.h"
1.26 +#include "ECamUnitTestPluginUids.hrh"
1.27 +#include "AdvancedSettings.h"
1.28 +#include <ecam/ecamcommonuids.hrh>
1.29 +#include "EnhanceFunctionality.h"
1.30 +#include "directviewfinder.h"
1.31 +#include "extended_functionality.h"
1.32 +
1.33 +const TBool KTestCamerasPresent[] = {ETrue, EFalse, EFalse};
1.34 +const CCamera::CCameraAdvancedSettings::TCameraType KTestCamerasTypes[] =
1.35 + {
1.36 + CCamera::CCameraAdvancedSettings::ECameraOnBoard,
1.37 + CCamera::CCameraAdvancedSettings::ECameraPluggable,
1.38 + CCamera::CCameraAdvancedSettings::ECameraPluggable
1.39 + };
1.40 +
1.41 +//
1.42 +// Main stuff
1.43 +//
1.44 +static void Panic(TInt aReason)
1.45 + {
1.46 + _LIT(KDllName, "ECam Unit Test Plugin");
1.47 + User::Panic(KDllName, aReason);
1.48 + }
1.49 +
1.50 +//
1.51 +// CCamUnitTestPlugin
1.52 +//
1.53 +CCamUnitTestPlugin::CCamUnitTestPlugin()
1.54 + {
1.55 + iPresets.Reset();
1.56 + iSupportedISORates.Reset();
1.57 + iIsoRate = KDefaultIsoRate;
1.58 + for ( TInt i = 0; i< KECamSetAvailableCameras; i++)
1.59 + {
1.60 + iCameras[i] = KTestCamerasPresent[i];
1.61 + iCameraTypes[i] = KTestCamerasTypes[i];
1.62 + }
1.63 +
1.64 + iVFHandleGenerater = 0;
1.65 + }
1.66 +
1.67 +CCamUnitTestPlugin::~CCamUnitTestPlugin()
1.68 + {
1.69 + iSupportedISORates.Close();
1.70 + }
1.71 +
1.72 +CCamUnitTestPlugin* CCamUnitTestPlugin::NewL()
1.73 + {
1.74 + FileDependencyUtil::CheckFileDependencyL();
1.75 + return new (ELeave) CCamUnitTestPlugin;
1.76 + }
1.77 +
1.78 +//
1.79 +// 2nd stage ConstructL calls called by framework
1.80 +//
1.81 +
1.82 +void CCamUnitTestPlugin::Construct2L(MCameraObserver& aObserver,TInt aCameraIndex)
1.83 + {
1.84 + iObserver = &aObserver;
1.85 + iCameraIndex = aCameraIndex;
1.86 + }
1.87 +
1.88 +void CCamUnitTestPlugin::Construct2DupL(MCameraObserver& aObserver,TInt aCameraHandle)
1.89 + {
1.90 + iObserver = &aObserver;
1.91 + iCameraHandle = aCameraHandle;
1.92 + }
1.93 +
1.94 +
1.95 +void CCamUnitTestPlugin::Construct2L(MCameraObserver2& aObserver,TInt aCameraIndex,TInt aPriority)
1.96 + {
1.97 + iObserver2 = &aObserver;
1.98 + iCameraIndex = aCameraIndex;
1.99 + iPriority = aPriority;
1.100 +
1.101 + iSupportedISORates.AppendL(KMinIsoRate);
1.102 + iSupportedISORates.AppendL(KDefaultIsoRate);
1.103 + iSupportedISORates.AppendL(KIsoRate1);
1.104 + iSupportedISORates.AppendL(KIsoRate2);
1.105 + iSupportedISORates.AppendL(KIsoRate3);
1.106 + iSupportedISORates.AppendL(KIsoRate4);
1.107 + iSupportedISORates.AppendL(KIsoRate5);
1.108 + iSupportedISORates.AppendL(KMaxIsoRate);
1.109 + }
1.110 +
1.111 +void CCamUnitTestPlugin::Construct2DupL(MCameraObserver2& aObserver,TInt aCameraHandle)
1.112 + {
1.113 + iObserver2 = &aObserver;
1.114 + iCameraHandle = aCameraHandle;
1.115 +
1.116 +
1.117 + iSupportedISORates.AppendL(KMinIsoRate);
1.118 + iSupportedISORates.AppendL(KDefaultIsoRate);
1.119 + iSupportedISORates.AppendL(KIsoRate1);
1.120 + iSupportedISORates.AppendL(KIsoRate2);
1.121 + iSupportedISORates.AppendL(KIsoRate3);
1.122 + iSupportedISORates.AppendL(KIsoRate4);
1.123 + iSupportedISORates.AppendL(KIsoRate5);
1.124 + iSupportedISORates.AppendL(KMaxIsoRate);
1.125 + }
1.126 +
1.127 +
1.128 +
1.129 +//
1.130 +// Dummy versions of virtual functions
1.131 +//
1.132 +
1.133 +void CCamUnitTestPlugin::CameraInfo(TCameraInfo& /*aInfo*/) const
1.134 + {
1.135 + }
1.136 +
1.137 +void CCamUnitTestPlugin::Reserve()
1.138 + {
1.139 + }
1.140 +
1.141 +
1.142 +void CCamUnitTestPlugin::Release()
1.143 + {
1.144 + }
1.145 +
1.146 +void CCamUnitTestPlugin::PowerOn()
1.147 + {
1.148 + }
1.149 +
1.150 +void CCamUnitTestPlugin::PowerOff()
1.151 + {
1.152 + }
1.153 +
1.154 +TInt CCamUnitTestPlugin::Handle()
1.155 + {
1.156 + return 0;
1.157 + }
1.158 +
1.159 +void CCamUnitTestPlugin::SetZoomFactorL(TInt /*aZoomFactor = 0*/)
1.160 + {
1.161 + }
1.162 +
1.163 +TInt CCamUnitTestPlugin::ZoomFactor() const
1.164 + {
1.165 + return 0;
1.166 + }
1.167 +
1.168 +void CCamUnitTestPlugin::SetDigitalZoomFactorL(TInt /*aDigitalZoomFactor = 0*/)
1.169 + {
1.170 + }
1.171 +
1.172 +TInt CCamUnitTestPlugin::DigitalZoomFactor() const
1.173 + {
1.174 + return 0;
1.175 + }
1.176 +
1.177 +void CCamUnitTestPlugin::SetContrastL(TInt /*aContrast*/)
1.178 + {
1.179 + }
1.180 +
1.181 +TInt CCamUnitTestPlugin::Contrast() const
1.182 + {
1.183 + return 0;
1.184 + }
1.185 +
1.186 +void CCamUnitTestPlugin::SetBrightnessL(TInt /*aBrightness*/)
1.187 + {
1.188 + }
1.189 +
1.190 +TInt CCamUnitTestPlugin::Brightness() const
1.191 + {
1.192 + return 0;
1.193 + }
1.194 +
1.195 +
1.196 +void CCamUnitTestPlugin::SetFlashL(TFlash /*aFlash = EFlashNone*/)
1.197 + {
1.198 + Panic(EPanicUnimplemented);
1.199 + }
1.200 +
1.201 +CCamera::TFlash CCamUnitTestPlugin::Flash() const
1.202 + {
1.203 + Panic(EPanicUnimplemented);
1.204 + return EFlashNone;
1.205 + }
1.206 +
1.207 +void CCamUnitTestPlugin::SetExposureL(TExposure /*aExposure = EExposureAuto*/)
1.208 + {
1.209 + Panic(EPanicUnimplemented);
1.210 + }
1.211 +
1.212 +CCamera::TExposure CCamUnitTestPlugin::Exposure() const
1.213 + {
1.214 + Panic(EPanicUnimplemented);
1.215 + return EExposureAuto;
1.216 + }
1.217 +
1.218 +void CCamUnitTestPlugin::SetWhiteBalanceL(TWhiteBalance /*aWhiteBalance = EWBAuto*/)
1.219 + {
1.220 + Panic(EPanicUnimplemented);
1.221 + }
1.222 +
1.223 +CCamera::TWhiteBalance CCamUnitTestPlugin::WhiteBalance() const
1.224 + {
1.225 + Panic(EPanicUnimplemented);
1.226 + return EWBAuto;
1.227 + }
1.228 +
1.229 +void CCamUnitTestPlugin::StartViewFinderDirectL(RWsSession& /*aWs*/,CWsScreenDevice& /*aScreenDevice*/,RWindowBase& /*aWindow*/,TRect& /*aScreenRect*/)
1.230 + {
1.231 + Panic(EPanicUnimplemented);
1.232 + }
1.233 +
1.234 +void CCamUnitTestPlugin::StartViewFinderDirectL(RWsSession& /*aWs*/,CWsScreenDevice& /*aScreenDevice*/,RWindowBase& /*aWindow*/,TRect& /*aScreenRect*/,TRect& /*aClipRect*/)
1.235 + {
1.236 + Panic(EPanicUnimplemented);
1.237 + }
1.238 +
1.239 +void CCamUnitTestPlugin::StartViewFinderBitmapsL(TSize& /*aSize*/)
1.240 + {
1.241 + Panic(EPanicUnimplemented);
1.242 + }
1.243 +
1.244 +void CCamUnitTestPlugin::StartViewFinderBitmapsL(TSize& /*aSize*/,TRect& /*aClipRect*/)
1.245 + {
1.246 + Panic(EPanicUnimplemented);
1.247 + }
1.248 +
1.249 +
1.250 +void CCamUnitTestPlugin::StartViewFinderL(TFormat /*aImageFormat*/,TSize& /*aSize*/)
1.251 + {
1.252 + Panic(EPanicUnimplemented);
1.253 + }
1.254 +
1.255 +void CCamUnitTestPlugin::StartViewFinderL(TFormat /*aImageFormat*/,TSize& /*aSize*/,TRect& /*aClipRect*/)
1.256 + {
1.257 + Panic(EPanicUnimplemented);
1.258 + }
1.259 +
1.260 +
1.261 +void CCamUnitTestPlugin::StopViewFinder()
1.262 + {
1.263 + Panic(EPanicUnimplemented);
1.264 + }
1.265 +
1.266 +TBool CCamUnitTestPlugin::ViewFinderActive() const
1.267 + {
1.268 + Panic(EPanicUnimplemented);
1.269 + return EFalse;
1.270 + }
1.271 +
1.272 +void CCamUnitTestPlugin::SetViewFinderMirrorL(TBool /*aMirror*/)
1.273 + {
1.274 + Panic(EPanicUnimplemented);
1.275 + }
1.276 +
1.277 +TBool CCamUnitTestPlugin::ViewFinderMirror() const
1.278 + {
1.279 + Panic(EPanicUnimplemented);
1.280 + return EFalse;
1.281 + }
1.282 +
1.283 +void CCamUnitTestPlugin::PrepareImageCaptureL(TFormat /*aImageFormat*/,TInt /*aSizeIndex*/)
1.284 + {
1.285 + Panic(EPanicUnimplemented);
1.286 + }
1.287 +
1.288 +void CCamUnitTestPlugin::PrepareImageCaptureL(TFormat /*aImageFormat*/,TInt /*aSizeIndex*/,const TRect& /*aClipRect*/)
1.289 + {
1.290 + Panic(EPanicUnimplemented);
1.291 + }
1.292 +
1.293 +void CCamUnitTestPlugin::CaptureImage()
1.294 + {
1.295 + Panic(EPanicUnimplemented);
1.296 + }
1.297 +
1.298 +void CCamUnitTestPlugin::CancelCaptureImage()
1.299 + {
1.300 + Panic(EPanicUnimplemented);
1.301 + }
1.302 +
1.303 +void CCamUnitTestPlugin::EnumerateCaptureSizes(TSize& /*aSize*/,TInt /*aSizeIndex*/,TFormat /*aFormat*/) const
1.304 + {
1.305 + Panic(EPanicUnimplemented);
1.306 + }
1.307 +
1.308 +void CCamUnitTestPlugin::PrepareVideoCaptureL(TFormat /*aFormat*/,TInt /*aSizeIndex*/,TInt /*aRateIndex*/,TInt /*aBuffersToUse*/,TInt /*aFramesPerBuffer*/)
1.309 + {
1.310 + Panic(EPanicUnimplemented);
1.311 + }
1.312 +
1.313 +void CCamUnitTestPlugin::PrepareVideoCaptureL(TFormat /*aFormat*/,TInt /*aSizeIndex*/,TInt /*aRateIndex*/,TInt /*aBuffersToUse*/,TInt /*aFramesPerBuffer*/,const TRect& /*aClipRect*/)
1.314 + {
1.315 + Panic(EPanicUnimplemented);
1.316 + }
1.317 +
1.318 +void CCamUnitTestPlugin::StartVideoCapture()
1.319 + {
1.320 + Panic(EPanicUnimplemented);
1.321 + }
1.322 +
1.323 +void CCamUnitTestPlugin::StopVideoCapture()
1.324 + {
1.325 + Panic(EPanicUnimplemented);
1.326 + }
1.327 +
1.328 +TBool CCamUnitTestPlugin::VideoCaptureActive() const
1.329 + {
1.330 + Panic(EPanicUnimplemented);
1.331 + return EFalse;
1.332 + }
1.333 +
1.334 +void CCamUnitTestPlugin::EnumerateVideoFrameSizes(TSize& /*aSize*/,TInt /*aSizeIndex*/,TFormat /*aFormat*/) const
1.335 + {
1.336 + Panic(EPanicUnimplemented);
1.337 + }
1.338 +
1.339 +void CCamUnitTestPlugin::EnumerateVideoFrameRates(TReal32& /*aRate*/,TInt /*aRateIndex*/,TFormat /*aFormat*/,TInt /*aSizeIndex*/,TExposure /*aExposure = EExposureAuto*/) const
1.340 + {
1.341 + Panic(EPanicUnimplemented);
1.342 + }
1.343 +
1.344 +void CCamUnitTestPlugin::GetFrameSize(TSize& /*aSize*/) const
1.345 + {
1.346 + Panic(EPanicUnimplemented);
1.347 + }
1.348 +
1.349 +TReal32 CCamUnitTestPlugin::FrameRate() const
1.350 + {
1.351 + Panic(EPanicUnimplemented);
1.352 + return 0.0;
1.353 + }
1.354 +
1.355 +TInt CCamUnitTestPlugin::BuffersInUse() const
1.356 + {
1.357 + Panic(EPanicUnimplemented);
1.358 + return 0;
1.359 + }
1.360 +
1.361 +TInt CCamUnitTestPlugin::FramesPerBuffer() const
1.362 + {
1.363 + Panic(EPanicUnimplemented);
1.364 + return 0;
1.365 + }
1.366 +
1.367 +void CCamUnitTestPlugin::SetJpegQuality(TInt /*aQuality*/)
1.368 + {
1.369 + Panic(EPanicUnimplemented);
1.370 + }
1.371 +
1.372 +TInt CCamUnitTestPlugin::JpegQuality() const
1.373 + {
1.374 + Panic(EPanicUnimplemented);
1.375 + return 0;
1.376 + }
1.377 +
1.378 +TAny* CCamUnitTestPlugin::CustomInterface(TUid aInterfaceUid)
1.379 + {
1.380 + TAny* advSettingObject = NULL;
1.381 + // use the fact that the parent is a friend of the class
1.382 +
1.383 + TRAPD(err, advSettingObject = CCamera::CustomInterface(aInterfaceUid));
1.384 +
1.385 + if (err == KErrNone)
1.386 + {
1.387 + return advSettingObject;
1.388 + }
1.389 + /*else if (err == KErrNoMemory)
1.390 + {
1.391 + User::Leave(KErrNoMemory);
1.392 + }*/
1.393 + return NULL;
1.394 + }
1.395 +
1.396 +
1.397 +TAny* CCamera::CustomInterface(TUid aInterfaceUid)
1.398 + {
1.399 + switch (aInterfaceUid.iUid)
1.400 + {
1.401 + // presets
1.402 + case KECamPresetsUidValue:
1.403 + {
1.404 + CCamera::CCameraPresets* presets = new (ELeave)CCamera::CCameraPresets(*this);
1.405 + CleanupStack::PushL(presets);
1.406 + presets->ConstructL();
1.407 + CleanupStack::Pop(presets);
1.408 +
1.409 + return static_cast<TAny*>(presets);
1.410 + }
1.411 +
1.412 + case KECamMCameraPresetsUidValue:
1.413 + {
1.414 + return static_cast<MCameraPresets*>(CCamPresets::NewL(static_cast<CCamUnitTestPlugin&>(*this)));
1.415 + }
1.416 +
1.417 + case KECamMCameraPresets2UidValue:
1.418 + {
1.419 + return static_cast<MCameraPresets2*>(CCamPresets::NewL(static_cast<CCamUnitTestPlugin&>(*this)));
1.420 + }
1.421 +
1.422 + // image processing
1.423 + case KECamImageProcessingUidValue:
1.424 + {
1.425 + CCamera::CCameraImageProcessing* processing = new (ELeave)CCamera::CCameraImageProcessing(*this);
1.426 + CleanupStack::PushL(processing);
1.427 + processing->ConstructL();
1.428 + CleanupStack::Pop(processing);
1.429 +
1.430 + return static_cast<TAny*>(processing);
1.431 + }
1.432 +
1.433 + case KECamMCameraImageProcessingUidValue:
1.434 + {
1.435 + return static_cast<MCameraImageProcessing*>(CCamImgProc::NewL(static_cast<CCamUnitTestPlugin&>(*this)));
1.436 + }
1.437 +
1.438 + case KECamMCameraImageProcessing2UidValue:
1.439 + {
1.440 + return static_cast<MCameraImageProcessing2*>(CCamImgProc::NewL(static_cast<CCamUnitTestPlugin&>(*this)));
1.441 + }
1.442 +
1.443 + case KECamMCameraImageProcessing3UidValue:
1.444 + {
1.445 + return static_cast<MCameraImageProcessing3*>(CCamImgProc::NewL(static_cast<CCamUnitTestPlugin&>(*this)));
1.446 + }
1.447 +
1.448 + // advanced settings
1.449 + case KECamAdvancedSettingUidValue:
1.450 + {
1.451 + CCamera::CCameraAdvancedSettings* settings = new (ELeave)CCamera::CCameraAdvancedSettings(*this);
1.452 + CleanupStack::PushL(settings);
1.453 + settings->ConstructL();
1.454 + CleanupStack::Pop(settings);
1.455 +
1.456 + return static_cast<TAny*>(settings);
1.457 + }
1.458 +
1.459 + case KECamMCameraAdvancedSettingsUidValue:
1.460 + {
1.461 + return static_cast<MCameraAdvancedSettings*>(CCamAdvSet::NewL(static_cast<CCamUnitTestPlugin&>(*this)));
1.462 + }
1.463 +
1.464 + case KECamMCameraAdvancedSettings2UidValue:
1.465 + {
1.466 + return static_cast<MCameraAdvancedSettings2*>(CCamAdvSet::NewL(static_cast<CCamUnitTestPlugin&>(*this)));
1.467 + }
1.468 +
1.469 + case KECamMCameraAdvancedSettings3UidValue:
1.470 + {
1.471 + return static_cast<MCameraAdvancedSettings3*>(CCamAdvSet::NewL(static_cast<CCamUnitTestPlugin&>(*this)));
1.472 + }
1.473 +
1.474 + case KECamMCameraAdvancedSettings4UidValue:
1.475 + {
1.476 + return static_cast<MCameraAdvancedSettings4*>(CCamAdvSet::NewL(static_cast<CCamUnitTestPlugin&>(*this)));
1.477 + }
1.478 +
1.479 + case KUidCameraManagementUidValue:
1.480 + {
1.481 + return (CCamManagement::NewL(static_cast<CCamUnitTestPlugin&>(*this)));
1.482 + }
1.483 +
1.484 + //
1.485 + // enhance camera functionality //
1.486 + //
1.487 + case KECamHistogramUidValue:
1.488 + {
1.489 + return static_cast<TAny*>(CCamera::CCameraHistogram::NewL(*this));
1.490 + }
1.491 +
1.492 + case KECamMCameraHistogramUidValue:
1.493 + {
1.494 + return static_cast<MCameraHistogram*>(CCamHistogram::NewL(static_cast<CCamUnitTestPlugin&>(*this)));
1.495 + }
1.496 +
1.497 + case KECamOverlayUidValue:
1.498 + {
1.499 + return static_cast<TAny*>(CCamera::CCameraOverlay::NewL(*this));
1.500 + }
1.501 +
1.502 + case KECamMCameraOverlayUidValue:
1.503 + {
1.504 + return static_cast<MCameraOverlay*>(CCamOverlay::NewL(static_cast<CCamUnitTestPlugin&>(*this)));
1.505 + }
1.506 +
1.507 + case KECamMCameraOverlay2UidValue:
1.508 + {
1.509 + return static_cast<MCameraOverlay2*>(CCamOverlay::NewL(static_cast<CCamUnitTestPlugin&>(*this)));
1.510 + }
1.511 +
1.512 + case KECamSnapshotUidValue:
1.513 + {
1.514 + return static_cast<TAny*>(CCamera::CCameraSnapshot::NewL(*this));
1.515 + }
1.516 +
1.517 + case KECamMCameraSnapshotUidValue:
1.518 + {
1.519 + return static_cast<MCameraSnapshot*>(CCamSnapshot::NewL(static_cast<CCamUnitTestPlugin&>(*this)));
1.520 + }
1.521 +
1.522 + //
1.523 + // direct viewfinder functionality //
1.524 + //
1.525 + case KECamDirectViewFinderUidValue:
1.526 + {
1.527 + return static_cast<TAny*>(CCamera::CCameraDirectViewFinder::NewL(*this));
1.528 + }
1.529 +
1.530 + case KECamMCameraDirectViewFinderUidValue:
1.531 + {
1.532 + return static_cast<MCameraDirectViewFinder*>(CCamDirectViewFinder::NewL(static_cast<CCamUnitTestPlugin&>(*this)));
1.533 + }
1.534 +
1.535 + case KECamMCameraPreImageCaptureControlUidValue:
1.536 + {
1.537 + return static_cast<MCameraPreImageCaptureControl*>(CCamPreImageCaptureControl::NewL(static_cast<CCamUnitTestPlugin&>(*this)));
1.538 + }
1.539 +
1.540 + case KECamMCameraImageCaptureUidValue:
1.541 + {
1.542 + return static_cast<MCameraImageCapture*>(CCamImageCapture::NewL(static_cast<CCamUnitTestPlugin&>(*this)));
1.543 + }
1.544 +
1.545 + case KECamMCameraVideoCaptureControlUidValue:
1.546 + {
1.547 + return static_cast<MCameraVideoCaptureControl*>(CCamVideoCaptureControl::NewL(static_cast<CCamUnitTestPlugin&>(*this)));
1.548 + }
1.549 +
1.550 + case KECamMCameraClientViewFinderUidValue:
1.551 + {
1.552 + return static_cast<MCameraClientViewFinder*>(CCamClientViewFinder::NewL(static_cast<CCamUnitTestPlugin&>(*this)));
1.553 + }
1.554 +
1.555 + case KECamMCameraBaseClientViewFinderUidValue:
1.556 + {
1.557 + return static_cast<MCameraViewFinder*>(CCamClientViewFinder::NewL(static_cast<CCamUnitTestPlugin&>(*this)));
1.558 + }
1.559 +
1.560 + case KECamMCameraV2DirectViewFinderUidValue:
1.561 + {
1.562 + return static_cast<MCameraV2DirectViewFinder*>(CCamV2DirectViewFinder::NewL(static_cast<CCamUnitTestPlugin&>(*this)));
1.563 + }
1.564 +
1.565 + case KECamMCameraBaseV2DirectViewFinderUidValue:
1.566 + {
1.567 + return static_cast<MCameraViewFinder*>(CCamV2DirectViewFinder::NewL(static_cast<CCamUnitTestPlugin&>(*this)));
1.568 + }
1.569 + default:
1.570 + {
1.571 + return NULL;
1.572 + }
1.573 + }
1.574 + }
1.575 +
1.576 +void CCamUnitTestPlugin::GenerateVFHandle(TInt& aVFHandle)
1.577 + {
1.578 + iVFHandleGenerater++;
1.579 + aVFHandle = iVFHandleGenerater;
1.580 + }
1.581 +
1.582 +void CCamUnitTestPlugin::Notify(TUid aMessageId, TInt aError)
1.583 + {
1.584 + if (iObserver2 != NULL)
1.585 + {
1.586 + iObserver2->HandleEvent(TECAMEvent(aMessageId, aError));
1.587 + }
1.588 + }
1.589 +
1.590 +void CCamUnitTestPlugin::Notify2(TUid aMessageId, TInt aError, TInt aParam)
1.591 + {
1.592 + if (iObserver2 != NULL)
1.593 + {
1.594 + iObserver2->HandleEvent(TECAMEvent2(aMessageId, aError, aParam));
1.595 + }
1.596 + }
1.597 +
1.598 +//
1.599 +// CCamUnitTestPluginInfo
1.600 +//
1.601 +
1.602 +CCamUnitTestPluginInfo::CCamUnitTestPluginInfo()
1.603 + {
1.604 + }
1.605 +
1.606 +CCamUnitTestPluginInfo::~CCamUnitTestPluginInfo()
1.607 + {
1.608 + }
1.609 +
1.610 +CCamUnitTestPluginInfo* CCamUnitTestPluginInfo::NewL()
1.611 + {
1.612 + FileDependencyUtil::CheckFileDependencyL();
1.613 + return new (ELeave) CCamUnitTestPluginInfo;
1.614 + }
1.615 +
1.616 +TInt CCamUnitTestPluginInfo::CamerasAvailable()
1.617 + {
1.618 + return KECamSetAvailableCameras;
1.619 + }
1.620 +
1.621 +//
1.622 +// CCamUnitTestPluginSecureId
1.623 +//
1.624 +
1.625 +CCamUnitTestPluginSecureId::CCamUnitTestPluginSecureId()
1.626 + {
1.627 + }
1.628 +
1.629 +CCamUnitTestPluginSecureId::~CCamUnitTestPluginSecureId()
1.630 + {
1.631 + }
1.632 +
1.633 +CCamUnitTestPluginSecureId* CCamUnitTestPluginSecureId::NewL()
1.634 + {
1.635 + CCamUnitTestPluginSecureId* pluginSecureId = new (ELeave) CCamUnitTestPluginSecureId;
1.636 + return pluginSecureId;
1.637 + }
1.638 +
1.639 +void CCamUnitTestPluginSecureId::Release()
1.640 + {
1.641 + delete this;
1.642 + }
1.643 +
1.644 +void CCamUnitTestPluginSecureId::GetSecureIdL(TInt& aSecureId) const
1.645 + {
1.646 + TSecureId secureId = User::CreatorSecureId();
1.647 + aSecureId = secureId.iId;
1.648 + }
1.649 +
1.650 +void FileDependencyUtil::CheckFileDependencyL()
1.651 + {
1.652 + RFs fsSession;
1.653 + RFile file;
1.654 +
1.655 + User::LeaveIfError(fsSession.Connect());
1.656 + CleanupClosePushL(fsSession);
1.657 + TInt err = file.Open(fsSession, KECamUnitTestPluginName, EFileRead);
1.658 + file.Close();
1.659 +
1.660 + if(err != KErrNone)
1.661 + {
1.662 + User::LeaveIfError(KErrNotSupported);
1.663 + }
1.664 + CleanupStack::PopAndDestroy(); //fsSession
1.665 +
1.666 + }
1.667 +
1.668 +// __________________________________________________________________________
1.669 +// Exported proxy for instantiation method resolution
1.670 +// Define the interface UIDs
1.671 +const TImplementationProxy ImplementationTable[] =
1.672 + {
1.673 + IMPLEMENTATION_PROXY_ENTRY(KUidCameraUnitTestPlugin, CCamUnitTestPlugin::NewL),
1.674 + IMPLEMENTATION_PROXY_ENTRY(KUidCameraUnitTestInfo, CCamUnitTestPluginInfo::NewL),
1.675 + IMPLEMENTATION_PROXY_ENTRY(KUidCameraUnitTestSecureId, CCamUnitTestPluginSecureId::NewL)
1.676 + };
1.677 +
1.678 +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
1.679 + {
1.680 + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
1.681 +
1.682 + return ImplementationTable;
1.683 + }
1.684 +