os/mm/imagingandcamerafws/cameraunittest/src/ECamUnitTestPlugin/ECamUnitTestPlugin.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
#include <f32file.h>
sl@0
    17
#include <ecom/ecom.h>
sl@0
    18
#include <ecom/implementationproxy.h>
sl@0
    19
#include <ecamuids.hrh>
sl@0
    20
#include <ecam.h>
sl@0
    21
#include <ecam/ecamadvsettingsintfuids.hrh>
sl@0
    22
#include "ECamUnitTestPlugin.h"
sl@0
    23
#include "ECamUnitTestPluginUids.hrh"
sl@0
    24
#include "AdvancedSettings.h"
sl@0
    25
#include <ecam/ecamcommonuids.hrh>
sl@0
    26
#include "EnhanceFunctionality.h"
sl@0
    27
#include "directviewfinder.h"
sl@0
    28
#include "extended_functionality.h"
sl@0
    29
sl@0
    30
const TBool KTestCamerasPresent[] = {ETrue, EFalse, EFalse};
sl@0
    31
const CCamera::CCameraAdvancedSettings::TCameraType KTestCamerasTypes[] = 	
sl@0
    32
									{
sl@0
    33
									CCamera::CCameraAdvancedSettings::ECameraOnBoard, 
sl@0
    34
									CCamera::CCameraAdvancedSettings::ECameraPluggable, 
sl@0
    35
									CCamera::CCameraAdvancedSettings::ECameraPluggable
sl@0
    36
									}; 
sl@0
    37
sl@0
    38
//
sl@0
    39
// Main stuff
sl@0
    40
//
sl@0
    41
static void Panic(TInt aReason)
sl@0
    42
	{
sl@0
    43
	_LIT(KDllName, "ECam Unit Test Plugin");
sl@0
    44
	User::Panic(KDllName, aReason);
sl@0
    45
	}
sl@0
    46
	
sl@0
    47
//
sl@0
    48
// CCamUnitTestPlugin
sl@0
    49
//
sl@0
    50
CCamUnitTestPlugin::CCamUnitTestPlugin()
sl@0
    51
	{
sl@0
    52
	iPresets.Reset();
sl@0
    53
	iSupportedISORates.Reset();
sl@0
    54
	iIsoRate = KDefaultIsoRate;
sl@0
    55
	for ( TInt i = 0; i< KECamSetAvailableCameras; i++)
sl@0
    56
		{
sl@0
    57
		iCameras[i] = KTestCamerasPresent[i]; 
sl@0
    58
		iCameraTypes[i] = KTestCamerasTypes[i];
sl@0
    59
		}	
sl@0
    60
		
sl@0
    61
	iVFHandleGenerater = 0;
sl@0
    62
	}
sl@0
    63
	
sl@0
    64
CCamUnitTestPlugin::~CCamUnitTestPlugin()
sl@0
    65
	{
sl@0
    66
	iSupportedISORates.Close();
sl@0
    67
	}
sl@0
    68
	
sl@0
    69
CCamUnitTestPlugin* CCamUnitTestPlugin::NewL()
sl@0
    70
	{
sl@0
    71
	FileDependencyUtil::CheckFileDependencyL();
sl@0
    72
	return new (ELeave) CCamUnitTestPlugin;
sl@0
    73
	}
sl@0
    74
	
sl@0
    75
// 
sl@0
    76
// 2nd stage ConstructL calls called by framework
sl@0
    77
//
sl@0
    78
sl@0
    79
void CCamUnitTestPlugin::Construct2L(MCameraObserver& aObserver,TInt aCameraIndex)
sl@0
    80
	{
sl@0
    81
	iObserver = &aObserver;
sl@0
    82
	iCameraIndex = aCameraIndex;
sl@0
    83
	}
sl@0
    84
	
sl@0
    85
void CCamUnitTestPlugin::Construct2DupL(MCameraObserver& aObserver,TInt aCameraHandle)
sl@0
    86
	{
sl@0
    87
	iObserver = &aObserver;
sl@0
    88
	iCameraHandle = aCameraHandle;
sl@0
    89
	}
sl@0
    90
sl@0
    91
sl@0
    92
void CCamUnitTestPlugin::Construct2L(MCameraObserver2& aObserver,TInt aCameraIndex,TInt aPriority)
sl@0
    93
	{
sl@0
    94
	iObserver2 = &aObserver;
sl@0
    95
	iCameraIndex = aCameraIndex;
sl@0
    96
	iPriority = aPriority;
sl@0
    97
			
sl@0
    98
	iSupportedISORates.AppendL(KMinIsoRate);
sl@0
    99
	iSupportedISORates.AppendL(KDefaultIsoRate);
sl@0
   100
	iSupportedISORates.AppendL(KIsoRate1);
sl@0
   101
	iSupportedISORates.AppendL(KIsoRate2);
sl@0
   102
	iSupportedISORates.AppendL(KIsoRate3);
sl@0
   103
	iSupportedISORates.AppendL(KIsoRate4);
sl@0
   104
	iSupportedISORates.AppendL(KIsoRate5);
sl@0
   105
	iSupportedISORates.AppendL(KMaxIsoRate);
sl@0
   106
	}
sl@0
   107
	
sl@0
   108
void CCamUnitTestPlugin::Construct2DupL(MCameraObserver2& aObserver,TInt aCameraHandle)
sl@0
   109
	{
sl@0
   110
	iObserver2 = &aObserver;
sl@0
   111
	iCameraHandle = aCameraHandle;
sl@0
   112
	
sl@0
   113
		
sl@0
   114
	iSupportedISORates.AppendL(KMinIsoRate);
sl@0
   115
	iSupportedISORates.AppendL(KDefaultIsoRate);
sl@0
   116
	iSupportedISORates.AppendL(KIsoRate1);
sl@0
   117
	iSupportedISORates.AppendL(KIsoRate2);
sl@0
   118
	iSupportedISORates.AppendL(KIsoRate3);
sl@0
   119
	iSupportedISORates.AppendL(KIsoRate4);
sl@0
   120
	iSupportedISORates.AppendL(KIsoRate5);
sl@0
   121
	iSupportedISORates.AppendL(KMaxIsoRate);
sl@0
   122
	}
sl@0
   123
sl@0
   124
sl@0
   125
	
sl@0
   126
//
sl@0
   127
// Dummy versions of virtual functions
sl@0
   128
//
sl@0
   129
sl@0
   130
void CCamUnitTestPlugin::CameraInfo(TCameraInfo& /*aInfo*/) const
sl@0
   131
	{
sl@0
   132
	}
sl@0
   133
sl@0
   134
void CCamUnitTestPlugin::Reserve()
sl@0
   135
	{
sl@0
   136
	}
sl@0
   137
sl@0
   138
sl@0
   139
void CCamUnitTestPlugin::Release()
sl@0
   140
	{
sl@0
   141
	}
sl@0
   142
sl@0
   143
void CCamUnitTestPlugin::PowerOn()
sl@0
   144
	{
sl@0
   145
	}
sl@0
   146
sl@0
   147
void CCamUnitTestPlugin::PowerOff()
sl@0
   148
	{
sl@0
   149
	}
sl@0
   150
sl@0
   151
TInt CCamUnitTestPlugin::Handle()
sl@0
   152
	{
sl@0
   153
	return 0;
sl@0
   154
	}
sl@0
   155
sl@0
   156
void CCamUnitTestPlugin::SetZoomFactorL(TInt /*aZoomFactor = 0*/)
sl@0
   157
	{
sl@0
   158
	}
sl@0
   159
sl@0
   160
TInt CCamUnitTestPlugin::ZoomFactor() const
sl@0
   161
	{
sl@0
   162
	return 0;
sl@0
   163
	}
sl@0
   164
sl@0
   165
void CCamUnitTestPlugin::SetDigitalZoomFactorL(TInt /*aDigitalZoomFactor = 0*/)
sl@0
   166
	{
sl@0
   167
	}
sl@0
   168
sl@0
   169
TInt CCamUnitTestPlugin::DigitalZoomFactor() const
sl@0
   170
	{
sl@0
   171
	return 0;
sl@0
   172
	}
sl@0
   173
sl@0
   174
void CCamUnitTestPlugin::SetContrastL(TInt /*aContrast*/)
sl@0
   175
	{
sl@0
   176
	}
sl@0
   177
sl@0
   178
TInt CCamUnitTestPlugin::Contrast() const
sl@0
   179
	{
sl@0
   180
	return 0;
sl@0
   181
	}
sl@0
   182
sl@0
   183
void CCamUnitTestPlugin::SetBrightnessL(TInt /*aBrightness*/)
sl@0
   184
	{
sl@0
   185
	}
sl@0
   186
sl@0
   187
TInt CCamUnitTestPlugin::Brightness() const
sl@0
   188
	{
sl@0
   189
	return 0;
sl@0
   190
	}
sl@0
   191
sl@0
   192
sl@0
   193
void CCamUnitTestPlugin::SetFlashL(TFlash /*aFlash = EFlashNone*/)
sl@0
   194
	{
sl@0
   195
	Panic(EPanicUnimplemented);
sl@0
   196
	}
sl@0
   197
sl@0
   198
CCamera::TFlash CCamUnitTestPlugin::Flash() const
sl@0
   199
	{
sl@0
   200
	Panic(EPanicUnimplemented);
sl@0
   201
	return EFlashNone;
sl@0
   202
	}
sl@0
   203
sl@0
   204
void CCamUnitTestPlugin::SetExposureL(TExposure /*aExposure = EExposureAuto*/)
sl@0
   205
	{
sl@0
   206
	Panic(EPanicUnimplemented);
sl@0
   207
	}
sl@0
   208
sl@0
   209
CCamera::TExposure CCamUnitTestPlugin::Exposure() const
sl@0
   210
	{
sl@0
   211
	Panic(EPanicUnimplemented);
sl@0
   212
	return EExposureAuto;
sl@0
   213
	}
sl@0
   214
sl@0
   215
void CCamUnitTestPlugin::SetWhiteBalanceL(TWhiteBalance /*aWhiteBalance = EWBAuto*/)
sl@0
   216
	{
sl@0
   217
	Panic(EPanicUnimplemented);
sl@0
   218
	}
sl@0
   219
sl@0
   220
CCamera::TWhiteBalance CCamUnitTestPlugin::WhiteBalance() const
sl@0
   221
	{
sl@0
   222
	Panic(EPanicUnimplemented);
sl@0
   223
	return EWBAuto;
sl@0
   224
	}
sl@0
   225
sl@0
   226
void CCamUnitTestPlugin::StartViewFinderDirectL(RWsSession& /*aWs*/,CWsScreenDevice& /*aScreenDevice*/,RWindowBase& /*aWindow*/,TRect& /*aScreenRect*/)
sl@0
   227
	{
sl@0
   228
	Panic(EPanicUnimplemented);
sl@0
   229
	}
sl@0
   230
sl@0
   231
void CCamUnitTestPlugin::StartViewFinderDirectL(RWsSession& /*aWs*/,CWsScreenDevice& /*aScreenDevice*/,RWindowBase& /*aWindow*/,TRect& /*aScreenRect*/,TRect& /*aClipRect*/)
sl@0
   232
	{
sl@0
   233
	Panic(EPanicUnimplemented);
sl@0
   234
	}
sl@0
   235
sl@0
   236
void CCamUnitTestPlugin::StartViewFinderBitmapsL(TSize& /*aSize*/)
sl@0
   237
	{
sl@0
   238
	Panic(EPanicUnimplemented);
sl@0
   239
	}
sl@0
   240
	
sl@0
   241
void CCamUnitTestPlugin::StartViewFinderBitmapsL(TSize& /*aSize*/,TRect& /*aClipRect*/)
sl@0
   242
	{
sl@0
   243
	Panic(EPanicUnimplemented);
sl@0
   244
	}
sl@0
   245
sl@0
   246
sl@0
   247
void CCamUnitTestPlugin::StartViewFinderL(TFormat /*aImageFormat*/,TSize& /*aSize*/)
sl@0
   248
	{
sl@0
   249
	Panic(EPanicUnimplemented);
sl@0
   250
	}
sl@0
   251
sl@0
   252
void CCamUnitTestPlugin::StartViewFinderL(TFormat /*aImageFormat*/,TSize& /*aSize*/,TRect& /*aClipRect*/)
sl@0
   253
	{
sl@0
   254
	Panic(EPanicUnimplemented);
sl@0
   255
	}
sl@0
   256
sl@0
   257
sl@0
   258
void CCamUnitTestPlugin::StopViewFinder()
sl@0
   259
	{
sl@0
   260
	Panic(EPanicUnimplemented);
sl@0
   261
	}
sl@0
   262
sl@0
   263
TBool CCamUnitTestPlugin::ViewFinderActive() const
sl@0
   264
	{
sl@0
   265
	Panic(EPanicUnimplemented);
sl@0
   266
	return EFalse;
sl@0
   267
	}
sl@0
   268
sl@0
   269
void CCamUnitTestPlugin::SetViewFinderMirrorL(TBool /*aMirror*/)
sl@0
   270
	{
sl@0
   271
	Panic(EPanicUnimplemented);
sl@0
   272
	}
sl@0
   273
sl@0
   274
TBool CCamUnitTestPlugin::ViewFinderMirror() const
sl@0
   275
	{
sl@0
   276
	Panic(EPanicUnimplemented);
sl@0
   277
	return EFalse;
sl@0
   278
	}
sl@0
   279
sl@0
   280
void CCamUnitTestPlugin::PrepareImageCaptureL(TFormat /*aImageFormat*/,TInt /*aSizeIndex*/)
sl@0
   281
	{
sl@0
   282
	Panic(EPanicUnimplemented);
sl@0
   283
	}
sl@0
   284
sl@0
   285
void CCamUnitTestPlugin::PrepareImageCaptureL(TFormat /*aImageFormat*/,TInt /*aSizeIndex*/,const TRect& /*aClipRect*/)
sl@0
   286
	{
sl@0
   287
	Panic(EPanicUnimplemented);
sl@0
   288
	}
sl@0
   289
sl@0
   290
void CCamUnitTestPlugin::CaptureImage()
sl@0
   291
	{
sl@0
   292
	Panic(EPanicUnimplemented);
sl@0
   293
	}
sl@0
   294
sl@0
   295
void CCamUnitTestPlugin::CancelCaptureImage()
sl@0
   296
	{
sl@0
   297
	Panic(EPanicUnimplemented);
sl@0
   298
	}
sl@0
   299
sl@0
   300
void CCamUnitTestPlugin::EnumerateCaptureSizes(TSize& /*aSize*/,TInt /*aSizeIndex*/,TFormat /*aFormat*/) const
sl@0
   301
	{
sl@0
   302
	Panic(EPanicUnimplemented);
sl@0
   303
	}
sl@0
   304
sl@0
   305
void CCamUnitTestPlugin::PrepareVideoCaptureL(TFormat /*aFormat*/,TInt /*aSizeIndex*/,TInt /*aRateIndex*/,TInt /*aBuffersToUse*/,TInt /*aFramesPerBuffer*/)
sl@0
   306
	{
sl@0
   307
	Panic(EPanicUnimplemented);
sl@0
   308
	}
sl@0
   309
sl@0
   310
void CCamUnitTestPlugin::PrepareVideoCaptureL(TFormat /*aFormat*/,TInt /*aSizeIndex*/,TInt /*aRateIndex*/,TInt /*aBuffersToUse*/,TInt /*aFramesPerBuffer*/,const TRect& /*aClipRect*/)
sl@0
   311
	{
sl@0
   312
	Panic(EPanicUnimplemented);
sl@0
   313
	}
sl@0
   314
sl@0
   315
void CCamUnitTestPlugin::StartVideoCapture()
sl@0
   316
	{
sl@0
   317
	Panic(EPanicUnimplemented);
sl@0
   318
	}
sl@0
   319
sl@0
   320
void CCamUnitTestPlugin::StopVideoCapture()
sl@0
   321
	{
sl@0
   322
	Panic(EPanicUnimplemented);
sl@0
   323
	}
sl@0
   324
sl@0
   325
TBool CCamUnitTestPlugin::VideoCaptureActive() const
sl@0
   326
	{
sl@0
   327
	Panic(EPanicUnimplemented);
sl@0
   328
	return EFalse;
sl@0
   329
	}
sl@0
   330
sl@0
   331
void CCamUnitTestPlugin::EnumerateVideoFrameSizes(TSize& /*aSize*/,TInt /*aSizeIndex*/,TFormat /*aFormat*/) const
sl@0
   332
	{
sl@0
   333
	Panic(EPanicUnimplemented);
sl@0
   334
	}
sl@0
   335
sl@0
   336
void CCamUnitTestPlugin::EnumerateVideoFrameRates(TReal32& /*aRate*/,TInt /*aRateIndex*/,TFormat /*aFormat*/,TInt /*aSizeIndex*/,TExposure /*aExposure = EExposureAuto*/) const
sl@0
   337
	{
sl@0
   338
	Panic(EPanicUnimplemented);
sl@0
   339
	}
sl@0
   340
sl@0
   341
void CCamUnitTestPlugin::GetFrameSize(TSize& /*aSize*/) const
sl@0
   342
	{
sl@0
   343
	Panic(EPanicUnimplemented);
sl@0
   344
	}
sl@0
   345
sl@0
   346
TReal32 CCamUnitTestPlugin::FrameRate() const
sl@0
   347
	{
sl@0
   348
	Panic(EPanicUnimplemented);
sl@0
   349
	return 0.0;
sl@0
   350
	}
sl@0
   351
sl@0
   352
TInt CCamUnitTestPlugin::BuffersInUse() const
sl@0
   353
	{
sl@0
   354
	Panic(EPanicUnimplemented);
sl@0
   355
	return 0;
sl@0
   356
	}
sl@0
   357
sl@0
   358
TInt CCamUnitTestPlugin::FramesPerBuffer() const
sl@0
   359
	{
sl@0
   360
	Panic(EPanicUnimplemented);
sl@0
   361
	return 0;
sl@0
   362
	}
sl@0
   363
sl@0
   364
void CCamUnitTestPlugin::SetJpegQuality(TInt /*aQuality*/)
sl@0
   365
	{
sl@0
   366
	Panic(EPanicUnimplemented);
sl@0
   367
	}
sl@0
   368
sl@0
   369
TInt CCamUnitTestPlugin::JpegQuality() const
sl@0
   370
	{
sl@0
   371
	Panic(EPanicUnimplemented);
sl@0
   372
	return 0;
sl@0
   373
	}
sl@0
   374
sl@0
   375
TAny* CCamUnitTestPlugin::CustomInterface(TUid aInterfaceUid)
sl@0
   376
	{
sl@0
   377
	TAny* advSettingObject = NULL;
sl@0
   378
	// use the fact that the parent is a friend of the class
sl@0
   379
	
sl@0
   380
	TRAPD(err, advSettingObject = CCamera::CustomInterface(aInterfaceUid));
sl@0
   381
	
sl@0
   382
	if (err == KErrNone)
sl@0
   383
		{
sl@0
   384
		return advSettingObject;
sl@0
   385
		}
sl@0
   386
	/*else if (err == KErrNoMemory)
sl@0
   387
		{
sl@0
   388
		User::Leave(KErrNoMemory);
sl@0
   389
		}*/
sl@0
   390
	return NULL;
sl@0
   391
	}
sl@0
   392
sl@0
   393
sl@0
   394
TAny* CCamera::CustomInterface(TUid aInterfaceUid)
sl@0
   395
	{
sl@0
   396
	switch (aInterfaceUid.iUid)
sl@0
   397
		{
sl@0
   398
		// presets
sl@0
   399
		case KECamPresetsUidValue:
sl@0
   400
			{
sl@0
   401
			CCamera::CCameraPresets* presets = new (ELeave)CCamera::CCameraPresets(*this); 
sl@0
   402
			CleanupStack::PushL(presets);
sl@0
   403
			presets->ConstructL();
sl@0
   404
			CleanupStack::Pop(presets);
sl@0
   405
			
sl@0
   406
			return static_cast<TAny*>(presets); 
sl@0
   407
			}	
sl@0
   408
sl@0
   409
		case KECamMCameraPresetsUidValue:
sl@0
   410
			{
sl@0
   411
			return static_cast<MCameraPresets*>(CCamPresets::NewL(static_cast<CCamUnitTestPlugin&>(*this)));
sl@0
   412
			}
sl@0
   413
			
sl@0
   414
		case KECamMCameraPresets2UidValue:
sl@0
   415
			{
sl@0
   416
			return static_cast<MCameraPresets2*>(CCamPresets::NewL(static_cast<CCamUnitTestPlugin&>(*this)));
sl@0
   417
			}
sl@0
   418
			
sl@0
   419
		// image processing 
sl@0
   420
		case KECamImageProcessingUidValue:
sl@0
   421
			{
sl@0
   422
			CCamera::CCameraImageProcessing* processing = new (ELeave)CCamera::CCameraImageProcessing(*this); 
sl@0
   423
			CleanupStack::PushL(processing);
sl@0
   424
			processing->ConstructL();
sl@0
   425
			CleanupStack::Pop(processing);
sl@0
   426
			
sl@0
   427
			return static_cast<TAny*>(processing); 
sl@0
   428
			}
sl@0
   429
						
sl@0
   430
		case KECamMCameraImageProcessingUidValue:
sl@0
   431
			{
sl@0
   432
			return static_cast<MCameraImageProcessing*>(CCamImgProc::NewL(static_cast<CCamUnitTestPlugin&>(*this)));
sl@0
   433
			}
sl@0
   434
			
sl@0
   435
		case KECamMCameraImageProcessing2UidValue:
sl@0
   436
			{
sl@0
   437
			return static_cast<MCameraImageProcessing2*>(CCamImgProc::NewL(static_cast<CCamUnitTestPlugin&>(*this)));
sl@0
   438
			}
sl@0
   439
			
sl@0
   440
		case KECamMCameraImageProcessing3UidValue:
sl@0
   441
			{
sl@0
   442
			return static_cast<MCameraImageProcessing3*>(CCamImgProc::NewL(static_cast<CCamUnitTestPlugin&>(*this)));
sl@0
   443
			}
sl@0
   444
			
sl@0
   445
		// advanced settings
sl@0
   446
		case KECamAdvancedSettingUidValue:
sl@0
   447
			{
sl@0
   448
			CCamera::CCameraAdvancedSettings* settings = new (ELeave)CCamera::CCameraAdvancedSettings(*this); 
sl@0
   449
			CleanupStack::PushL(settings);
sl@0
   450
			settings->ConstructL();
sl@0
   451
			CleanupStack::Pop(settings);
sl@0
   452
			
sl@0
   453
			return static_cast<TAny*>(settings); 
sl@0
   454
			}
sl@0
   455
			
sl@0
   456
		case KECamMCameraAdvancedSettingsUidValue:
sl@0
   457
			{
sl@0
   458
			return static_cast<MCameraAdvancedSettings*>(CCamAdvSet::NewL(static_cast<CCamUnitTestPlugin&>(*this)));
sl@0
   459
			}
sl@0
   460
		
sl@0
   461
		case KECamMCameraAdvancedSettings2UidValue:
sl@0
   462
			{
sl@0
   463
			return static_cast<MCameraAdvancedSettings2*>(CCamAdvSet::NewL(static_cast<CCamUnitTestPlugin&>(*this)));
sl@0
   464
			}	
sl@0
   465
			
sl@0
   466
		case KECamMCameraAdvancedSettings3UidValue:
sl@0
   467
			{
sl@0
   468
			return static_cast<MCameraAdvancedSettings3*>(CCamAdvSet::NewL(static_cast<CCamUnitTestPlugin&>(*this)));
sl@0
   469
			}
sl@0
   470
			
sl@0
   471
		case KECamMCameraAdvancedSettings4UidValue:
sl@0
   472
			{
sl@0
   473
			return static_cast<MCameraAdvancedSettings4*>(CCamAdvSet::NewL(static_cast<CCamUnitTestPlugin&>(*this)));
sl@0
   474
			}
sl@0
   475
		
sl@0
   476
		case KUidCameraManagementUidValue:
sl@0
   477
			{
sl@0
   478
			return (CCamManagement::NewL(static_cast<CCamUnitTestPlugin&>(*this)));
sl@0
   479
			}
sl@0
   480
sl@0
   481
		//		
sl@0
   482
		// enhance camera functionality //
sl@0
   483
		//
sl@0
   484
		case KECamHistogramUidValue:
sl@0
   485
			{
sl@0
   486
			return static_cast<TAny*>(CCamera::CCameraHistogram::NewL(*this)); 
sl@0
   487
			}
sl@0
   488
			
sl@0
   489
		case KECamMCameraHistogramUidValue:
sl@0
   490
			{
sl@0
   491
			return static_cast<MCameraHistogram*>(CCamHistogram::NewL(static_cast<CCamUnitTestPlugin&>(*this)));
sl@0
   492
			}
sl@0
   493
			
sl@0
   494
		case KECamOverlayUidValue:
sl@0
   495
			{
sl@0
   496
			return static_cast<TAny*>(CCamera::CCameraOverlay::NewL(*this)); 
sl@0
   497
			}	
sl@0
   498
			
sl@0
   499
		case KECamMCameraOverlayUidValue:
sl@0
   500
			{
sl@0
   501
			return static_cast<MCameraOverlay*>(CCamOverlay::NewL(static_cast<CCamUnitTestPlugin&>(*this)));
sl@0
   502
			}	
sl@0
   503
			
sl@0
   504
		case KECamMCameraOverlay2UidValue:
sl@0
   505
			{
sl@0
   506
			return static_cast<MCameraOverlay2*>(CCamOverlay::NewL(static_cast<CCamUnitTestPlugin&>(*this)));
sl@0
   507
			}
sl@0
   508
			
sl@0
   509
		case KECamSnapshotUidValue:
sl@0
   510
			{
sl@0
   511
			return static_cast<TAny*>(CCamera::CCameraSnapshot::NewL(*this)); 
sl@0
   512
			}
sl@0
   513
					
sl@0
   514
		case KECamMCameraSnapshotUidValue:
sl@0
   515
			{
sl@0
   516
			return static_cast<MCameraSnapshot*>(CCamSnapshot::NewL(static_cast<CCamUnitTestPlugin&>(*this)));
sl@0
   517
			}	
sl@0
   518
			
sl@0
   519
		//		
sl@0
   520
		// direct viewfinder functionality //
sl@0
   521
		//			
sl@0
   522
		case KECamDirectViewFinderUidValue:
sl@0
   523
			{
sl@0
   524
			return static_cast<TAny*>(CCamera::CCameraDirectViewFinder::NewL(*this));  
sl@0
   525
			}		
sl@0
   526
			
sl@0
   527
		case KECamMCameraDirectViewFinderUidValue:
sl@0
   528
			{
sl@0
   529
			return static_cast<MCameraDirectViewFinder*>(CCamDirectViewFinder::NewL(static_cast<CCamUnitTestPlugin&>(*this)));
sl@0
   530
			}	
sl@0
   531
		
sl@0
   532
		case KECamMCameraPreImageCaptureControlUidValue:
sl@0
   533
			{
sl@0
   534
			return static_cast<MCameraPreImageCaptureControl*>(CCamPreImageCaptureControl::NewL(static_cast<CCamUnitTestPlugin&>(*this)));
sl@0
   535
			}
sl@0
   536
		
sl@0
   537
		case KECamMCameraImageCaptureUidValue:
sl@0
   538
			{
sl@0
   539
			return static_cast<MCameraImageCapture*>(CCamImageCapture::NewL(static_cast<CCamUnitTestPlugin&>(*this)));
sl@0
   540
			}
sl@0
   541
sl@0
   542
		case KECamMCameraVideoCaptureControlUidValue:
sl@0
   543
			{
sl@0
   544
			return static_cast<MCameraVideoCaptureControl*>(CCamVideoCaptureControl::NewL(static_cast<CCamUnitTestPlugin&>(*this)));
sl@0
   545
			}
sl@0
   546
			
sl@0
   547
		case KECamMCameraClientViewFinderUidValue:
sl@0
   548
			{
sl@0
   549
			return static_cast<MCameraClientViewFinder*>(CCamClientViewFinder::NewL(static_cast<CCamUnitTestPlugin&>(*this)));
sl@0
   550
			}
sl@0
   551
			
sl@0
   552
		case KECamMCameraBaseClientViewFinderUidValue:
sl@0
   553
			{
sl@0
   554
			return static_cast<MCameraViewFinder*>(CCamClientViewFinder::NewL(static_cast<CCamUnitTestPlugin&>(*this)));
sl@0
   555
			}
sl@0
   556
			
sl@0
   557
		case KECamMCameraV2DirectViewFinderUidValue:
sl@0
   558
			{
sl@0
   559
			return static_cast<MCameraV2DirectViewFinder*>(CCamV2DirectViewFinder::NewL(static_cast<CCamUnitTestPlugin&>(*this)));
sl@0
   560
			}
sl@0
   561
			
sl@0
   562
		case KECamMCameraBaseV2DirectViewFinderUidValue:
sl@0
   563
			{
sl@0
   564
			return static_cast<MCameraViewFinder*>(CCamV2DirectViewFinder::NewL(static_cast<CCamUnitTestPlugin&>(*this)));
sl@0
   565
			}
sl@0
   566
		default:
sl@0
   567
			{		
sl@0
   568
			return NULL;
sl@0
   569
			}
sl@0
   570
		}
sl@0
   571
	}
sl@0
   572
	
sl@0
   573
void CCamUnitTestPlugin::GenerateVFHandle(TInt& aVFHandle)
sl@0
   574
	{
sl@0
   575
	iVFHandleGenerater++;
sl@0
   576
	aVFHandle = iVFHandleGenerater;
sl@0
   577
	}
sl@0
   578
	
sl@0
   579
void CCamUnitTestPlugin::Notify(TUid aMessageId, TInt aError)
sl@0
   580
	{
sl@0
   581
	if (iObserver2 != NULL)
sl@0
   582
		{
sl@0
   583
		iObserver2->HandleEvent(TECAMEvent(aMessageId, aError));
sl@0
   584
		}
sl@0
   585
	}
sl@0
   586
	
sl@0
   587
void CCamUnitTestPlugin::Notify2(TUid aMessageId, TInt aError, TInt aParam)
sl@0
   588
	{
sl@0
   589
	if (iObserver2 != NULL)
sl@0
   590
		{
sl@0
   591
		iObserver2->HandleEvent(TECAMEvent2(aMessageId, aError, aParam));	
sl@0
   592
		}
sl@0
   593
	}
sl@0
   594
	
sl@0
   595
//
sl@0
   596
// CCamUnitTestPluginInfo
sl@0
   597
//
sl@0
   598
sl@0
   599
CCamUnitTestPluginInfo::CCamUnitTestPluginInfo()
sl@0
   600
	{
sl@0
   601
	}
sl@0
   602
	
sl@0
   603
CCamUnitTestPluginInfo::~CCamUnitTestPluginInfo()
sl@0
   604
	{
sl@0
   605
	}
sl@0
   606
	
sl@0
   607
CCamUnitTestPluginInfo* CCamUnitTestPluginInfo::NewL()
sl@0
   608
	{
sl@0
   609
	FileDependencyUtil::CheckFileDependencyL();
sl@0
   610
	return new (ELeave) CCamUnitTestPluginInfo;
sl@0
   611
	}
sl@0
   612
	
sl@0
   613
TInt CCamUnitTestPluginInfo::CamerasAvailable()
sl@0
   614
	{
sl@0
   615
	return KECamSetAvailableCameras;
sl@0
   616
	}
sl@0
   617
sl@0
   618
//
sl@0
   619
// CCamUnitTestPluginSecureId
sl@0
   620
//	
sl@0
   621
sl@0
   622
CCamUnitTestPluginSecureId::CCamUnitTestPluginSecureId()
sl@0
   623
	{
sl@0
   624
	}
sl@0
   625
	
sl@0
   626
CCamUnitTestPluginSecureId::~CCamUnitTestPluginSecureId()
sl@0
   627
	{
sl@0
   628
	}
sl@0
   629
	
sl@0
   630
CCamUnitTestPluginSecureId* CCamUnitTestPluginSecureId::NewL()
sl@0
   631
	{
sl@0
   632
	CCamUnitTestPluginSecureId* pluginSecureId = new (ELeave) CCamUnitTestPluginSecureId;
sl@0
   633
	return pluginSecureId;
sl@0
   634
	}
sl@0
   635
	
sl@0
   636
void CCamUnitTestPluginSecureId::Release()
sl@0
   637
	{
sl@0
   638
	delete this;
sl@0
   639
	}
sl@0
   640
	
sl@0
   641
void CCamUnitTestPluginSecureId::GetSecureIdL(TInt& aSecureId) const
sl@0
   642
	{
sl@0
   643
	TSecureId secureId = User::CreatorSecureId();	
sl@0
   644
	aSecureId = secureId.iId;
sl@0
   645
	}
sl@0
   646
sl@0
   647
void FileDependencyUtil::CheckFileDependencyL()
sl@0
   648
	{
sl@0
   649
	RFs fsSession;
sl@0
   650
  	RFile file;
sl@0
   651
    
sl@0
   652
  	User::LeaveIfError(fsSession.Connect());
sl@0
   653
  	CleanupClosePushL(fsSession);
sl@0
   654
    TInt err = file.Open(fsSession, KECamUnitTestPluginName, EFileRead);
sl@0
   655
  	file.Close();
sl@0
   656
  	
sl@0
   657
  	if(err != KErrNone)
sl@0
   658
  		{
sl@0
   659
	    User::LeaveIfError(KErrNotSupported);
sl@0
   660
  		}
sl@0
   661
  	CleanupStack::PopAndDestroy(); //fsSession 
sl@0
   662
	
sl@0
   663
	}
sl@0
   664
sl@0
   665
// __________________________________________________________________________
sl@0
   666
// Exported proxy for instantiation method resolution
sl@0
   667
// Define the interface UIDs
sl@0
   668
const TImplementationProxy ImplementationTable[] = 
sl@0
   669
	{
sl@0
   670
		IMPLEMENTATION_PROXY_ENTRY(KUidCameraUnitTestPlugin,	CCamUnitTestPlugin::NewL),
sl@0
   671
		IMPLEMENTATION_PROXY_ENTRY(KUidCameraUnitTestInfo,	CCamUnitTestPluginInfo::NewL),
sl@0
   672
		IMPLEMENTATION_PROXY_ENTRY(KUidCameraUnitTestSecureId,	CCamUnitTestPluginSecureId::NewL)
sl@0
   673
	};
sl@0
   674
sl@0
   675
EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
sl@0
   676
	{
sl@0
   677
	aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
sl@0
   678
sl@0
   679
	return ImplementationTable;
sl@0
   680
	}
sl@0
   681