imagingandcamerafws/cameraunittest/src/ECamUnitTestPlugin/AdvancedSettings.cpp
changeset 0 40261b775718
equal deleted inserted replaced
-1:000000000000 0:40261b775718
       
     1 // Copyright (c) 2004-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 "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 //
       
    15 
       
    16 
       
    17 #include <ecom/ecom.h>
       
    18 #include <ecom/implementationproxy.h>
       
    19 #include <ecamuids.hrh>
       
    20 #include <ecam.h>
       
    21 #include "ECamUnitTestPluginUids.hrh"
       
    22 #include "AdvancedSettings.h"
       
    23 #include <ecamerrors.h>
       
    24 
       
    25 #include <ecamadvsettings.h>
       
    26 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
       
    27 #include <ecamadvsettingsconst.h>
       
    28 #include <ecamadvsettingsdef.h>
       
    29 #include <ecamimageprocessingconst.h>
       
    30 #include <ecamconst.h>
       
    31 #endif
       
    32 
       
    33 const TInt KContinuousAutoFocusTimeoutValue = 20000;
       
    34 const TInt KBrightnessAdjMinValue			= -50;
       
    35 const TInt KBrightnessAdjMaxValue			= 50;
       
    36 const TInt KDefaultShutterSpeed				= 0;
       
    37 const TInt KDefaultFocusDistance			= 0;
       
    38 const TInt KDefaultAperture					= 280;
       
    39 const TInt KBracketStartIndex				= 0;
       
    40 const TInt KBracketFrames					= 2;
       
    41 const TBool KDefaultRedEyeReduce			= EFalse;
       
    42 const TInt KFlashCompensationStep			= 2;
       
    43 const TInt KFlashCompensationInSteps		= 1;
       
    44 const TBool KExternalFlashPresentState		= EFalse;
       
    45 const TInt KManualFlashPowerLevel			= 0;
       
    46 const TInt KExposureCompensationStep		= 3;
       
    47 const TInt KExposureCompensationInSteps		= 2;
       
    48 const TBool KApertureExposureLockOn         = EFalse;
       
    49 const TBool KShootClickOn					= EFalse;
       
    50 const TInt KTimerInterval					= 0;
       
    51 const TInt KBurstImages						= 0;
       
    52 const TBool KExposureLockOn         		= EFalse;
       
    53 const TBool KAutoFocusLockOn         		= EFalse;
       
    54 const TBool KAutomaticSizeSelectionChangeOn	= EFalse;
       
    55 const TInt KWBColorTemperature				= 6000;
       
    56 const TBool KFlashReadyState				= EFalse;
       
    57 const TInt KSupportedISORateType			= 0x1F;
       
    58 const TBool KCapableActualISOValue			= EFalse;
       
    59 const TInt KAFAssistantLightManual			= 0x01;
       
    60 const TInt KConcurrentColorOpSupported		= 0x01;
       
    61 const TInt KDefault							= 0x01;
       
    62 const TInt KFocusRangeSupported				= 0x7F;
       
    63 const TInt KWhiteBalanceSupported			= 0x0FFF;
       
    64 
       
    65 //
       
    66 // CCamPresets
       
    67 //
       
    68 CCamPresets::CCamPresets(CCamUnitTestPlugin& aOwner): iOwner(aOwner)
       
    69 	{
       
    70 	iSupportedPresets[0] = KUidECamPresetOutdoor;
       
    71 	iSupportedPresets[1] = KUidECamPresetBeach;
       
    72 	iSupportedPresets[2] = KUidECamPresetNightPartyIndoor;
       
    73 	iSupportedPresets[3] = KUidECamPresetNone;
       
    74 
       
    75 	iCurrentPreset = KUidECamPresetNone;
       
    76 
       
    77 	iAffectedSettings[0] = KUidECamEventCameraSettingAperture;
       
    78 	iAffectedSettings[1] = KUidECamEventCameraSettingIsoRateType;
       
    79 	iAffectedSettings[2] = KUidECamEventCameraSettingIsoRate;
       
    80 
       
    81 	iRangeRestrictedSettings.Reset();
       
    82 	iIsPresetUnLockSupported = EFalse;
       
    83 	iIsPresetLocked = ETrue;
       
    84 	}
       
    85 	
       
    86 CCamPresets::~CCamPresets()
       
    87 	{
       
    88 	Dll::FreeTls();
       
    89 	iRangeRestrictedSettings.Close();
       
    90 	}
       
    91 	
       
    92 CCamPresets* CCamPresets::NewL(CCamUnitTestPlugin& aOwner)
       
    93 	{
       
    94 	CDataGlobal* globalData = static_cast <CDataGlobal*> (Dll::Tls());
       
    95 	
       
    96 	if(!globalData)
       
    97 		{
       
    98 		globalData = new (ELeave) CDataGlobal;
       
    99 		CleanupStack::PushL(globalData);
       
   100 		
       
   101 		globalData->iReferenceCount = 0;
       
   102 		globalData->iCamPresets = new (ELeave) CCamPresets(aOwner);
       
   103     	globalData->iCamPresets->iRefCount = 1;
       
   104     	
       
   105 		TInt error = Dll::SetTls(globalData);
       
   106 		if (error)
       
   107 			{
       
   108 			delete globalData->iCamPresets;
       
   109 			User::Leave(error);
       
   110 			}
       
   111 		
       
   112 		CleanupStack::Pop(globalData);
       
   113     	
       
   114 		return static_cast <CCamPresets*> (globalData->iCamPresets);
       
   115 		}
       
   116 	else
       
   117 		{
       
   118 		CCamPresets* self = globalData->iCamPresets;
       
   119 		
       
   120 		globalData->iReferenceCount++;
       
   121 		self->iRefCount = globalData->iReferenceCount + 1;
       
   122 		if (globalData->iReferenceCount == 1 )
       
   123 			{
       
   124 			delete globalData;
       
   125 			Dll::FreeTls();
       
   126 			}
       
   127 		else
       
   128 			{
       
   129 			TInt error = Dll::SetTls(globalData);
       
   130 			if (error)
       
   131 				{
       
   132 				delete globalData->iCamPresets;
       
   133 				User::Leave(error);
       
   134 				}	
       
   135 			}
       
   136 		return static_cast <CCamPresets*> (self);		
       
   137 		}
       
   138 	}
       
   139 
       
   140 void CCamPresets::Release()
       
   141 	{
       
   142 	iRefCount--; 
       
   143 	if(!iRefCount)
       
   144 		{
       
   145 		delete this;
       
   146 		}
       
   147 	}	
       
   148 	
       
   149 void CCamPresets::GetSupportedPresetsL(RArray<TUid>& aPresets) const
       
   150 	{
       
   151 	aPresets.Reset();
       
   152 	TInt count = sizeof(iSupportedPresets)/sizeof(TUid);
       
   153 	
       
   154 	for (TInt i = 0; i < count; i++)
       
   155 		{
       
   156 		aPresets.AppendL(iSupportedPresets[i]);
       
   157 		}	
       
   158 	}
       
   159 	
       
   160 void CCamPresets::SetPreset(TUid aPreset)
       
   161 	{
       
   162 	TInt response = KErrECamParameterNotInRange;
       
   163 	
       
   164 	for (TInt i = 0; i < KSupportedPresetsNumber; i++)
       
   165 		{
       
   166 		if (iSupportedPresets[i] == aPreset)
       
   167 			{
       
   168 			iCurrentPreset = aPreset;
       
   169 			response = KErrNone;
       
   170 			
       
   171 			switch(aPreset.iUid)
       
   172 				{
       
   173 				case KUidECamPresetOutdoorUidValue:
       
   174 					{
       
   175 					response = iRangeRestrictedSettings.Append(KUidECamEventCameraSettingIsoRate);
       
   176 					if(iOwner.iSupportedISORates.Count() == KNumSupportedIsoRate)
       
   177 						{
       
   178 						iOwner.iSupportedISORates.Remove(KNumSupportedIsoRate-1);
       
   179 						if(iOwner.iIsoRate == KMaxIsoRate)
       
   180 							{
       
   181 							iOwner.iIsoRate = KIsoRate5;
       
   182 							}
       
   183 						}
       
   184 					iIsPresetUnLockSupported = ETrue;
       
   185 					
       
   186 					break;
       
   187 					}
       
   188 				
       
   189 				//fall through
       
   190 				case KUidECamPresetBeachUidValue:
       
   191 				case KUidECamPresetNightPartyIndoorUidValue:
       
   192 				case KUidECamPresetNoneUidValue:
       
   193 				default:
       
   194 					{
       
   195 					if(iOwner.iSupportedISORates.Count() == KNumSupportedIsoRate-1)
       
   196 						{
       
   197 						iOwner.iSupportedISORates.AppendL(KMaxIsoRate);
       
   198 						}
       
   199 					iIsPresetUnLockSupported = EFalse;
       
   200 					break;	
       
   201 					}
       
   202 				}
       
   203 			
       
   204 			break;
       
   205 			}
       
   206 		}
       
   207 		
       
   208 	iOwner.Notify(aPreset, response);
       
   209 	
       
   210 	if(aPreset == KUidECamPresetOutdoor)
       
   211 		{
       
   212 		iOwner.Notify(KUidECamEventRangeRestricted, KErrNone);
       
   213 		}
       
   214 	}
       
   215 	
       
   216 TUid CCamPresets::Preset() const
       
   217 	{
       
   218 	return iCurrentPreset;
       
   219 	}
       
   220 	
       
   221 void CCamPresets::GetAffectedSettingsL(RArray<TUid>& aSettings) const
       
   222 	{
       
   223 	aSettings.Reset();
       
   224 		
       
   225 	if (iCurrentPreset!=KUidECamPresetNone)
       
   226 		{
       
   227 		TInt count = sizeof(iAffectedSettings)/sizeof(TUid);
       
   228 		for (TInt i = 0; i < count; i++)
       
   229 			{
       
   230 			aSettings.AppendL(iAffectedSettings[i]);
       
   231 			}
       
   232 		}
       
   233 	}
       
   234 	
       
   235 void CCamPresets::GetAssociatedSettingsL(TUid aPreset, RArray<TUid>& aSettings) const
       
   236 	{
       
   237 	aSettings.Reset();
       
   238 	if (aPreset == KUidECamPresetNone)
       
   239 		{
       
   240 		User::Leave(KErrArgument);
       
   241 		}
       
   242 	TInt count = sizeof(iAffectedSettings)/sizeof(TUid);
       
   243 	for (TInt i = 0; i < count; i++)
       
   244 		{
       
   245 		aSettings.AppendL(iAffectedSettings[i]);
       
   246 		}
       
   247 	}
       
   248 	
       
   249 void CCamPresets::GetRangeRestrictedSettingsL(RArray<TUid>& aRangeRestrictedSettings) const
       
   250 	{
       
   251 	for(TInt index=0; index<iRangeRestrictedSettings.Count(); index++)
       
   252 		{
       
   253 		aRangeRestrictedSettings.AppendL(iRangeRestrictedSettings[index]);
       
   254 		}
       
   255 	}
       
   256 
       
   257 void CCamPresets::GetFeatureRestrictedSettingsL(RArray<TUid>& aFeatureRestrictedSettings) const
       
   258 	{
       
   259 	aFeatureRestrictedSettings.Reset();
       
   260 	}
       
   261 	
       
   262 void CCamPresets::IsPresetUnlockSupportedL(TBool& aUnlockSupported) const
       
   263 	{
       
   264 	aUnlockSupported = iIsPresetUnLockSupported;	
       
   265 	}
       
   266 
       
   267 void CCamPresets::LockPreset()
       
   268 	{
       
   269 	iIsPresetLocked = ETrue;
       
   270 	iOwner.Notify(KUidECamEventPresetLocked, KErrNone);
       
   271 	}
       
   272 	
       
   273 void CCamPresets::UnlockPreset()
       
   274 	{
       
   275 	TInt error = KErrNotSupported;
       
   276 	if(iIsPresetUnLockSupported)
       
   277 		{
       
   278 		iIsPresetLocked = EFalse;
       
   279 		error = KErrNone;
       
   280 		}
       
   281 	iOwner.Notify(KUidECamEventPresetUnlocked, error);
       
   282 	}
       
   283 	
       
   284 //
       
   285 // CCamImgProc
       
   286 //
       
   287 CCamImgProc::CCamImgProc(CCamUnitTestPlugin& aOwner): iOwner(aOwner)
       
   288 	{
       
   289 	}
       
   290 	
       
   291 CCamImgProc::~CCamImgProc()
       
   292 	{
       
   293 	Dll::FreeTls();
       
   294 	iActiveSequence.Close();
       
   295 	iSupportedTransformations.Close();
       
   296 	}
       
   297 	
       
   298 CCamImgProc* CCamImgProc::NewL(CCamUnitTestPlugin& aOwner)
       
   299 	{
       
   300 	CDataGlobal* globalData = static_cast <CDataGlobal*> (Dll::Tls());
       
   301 	
       
   302 	if(!globalData)
       
   303 		{
       
   304 		globalData = new (ELeave) CDataGlobal;
       
   305 		CleanupStack::PushL(globalData);
       
   306 		
       
   307 		globalData->iReferenceCount = 0;
       
   308 		globalData->iCamImgProc = new (ELeave) CCamImgProc(aOwner);
       
   309 		CleanupStack::PushL(globalData->iCamImgProc);
       
   310 		globalData->iCamImgProc->ConstructL();
       
   311     	globalData->iCamImgProc->iRefCount = 1;
       
   312     	CleanupStack::Pop(globalData->iCamImgProc);
       
   313 		TInt error = Dll::SetTls(globalData);
       
   314 		if (error)
       
   315 			{
       
   316 			delete globalData->iCamImgProc;
       
   317 			User::Leave(error);
       
   318 			}
       
   319 		CleanupStack::Pop(globalData);
       
   320 		
       
   321 		return static_cast <CCamImgProc*> (globalData->iCamImgProc);
       
   322 		}
       
   323 	else
       
   324 		{
       
   325 		CCamImgProc* self = globalData->iCamImgProc;
       
   326 		
       
   327 		globalData->iReferenceCount++;
       
   328 		self->iRefCount = globalData->iReferenceCount + 1;
       
   329 		if (globalData->iReferenceCount == 2 )
       
   330 			{
       
   331 			delete globalData;
       
   332 			Dll::FreeTls();
       
   333 			}
       
   334 		else
       
   335 			{
       
   336 			TInt error = Dll::SetTls(globalData);
       
   337 			if (error)
       
   338 				{
       
   339 				delete globalData->iCamImgProc;
       
   340 				User::Leave(error);
       
   341 				}	
       
   342 			}
       
   343 		return static_cast <CCamImgProc*> (self);		
       
   344 		}
       
   345 	}
       
   346 	
       
   347 void CCamImgProc::Release()
       
   348 	{
       
   349 	iRefCount--; 
       
   350 	if(!iRefCount)
       
   351 		{
       
   352 		delete this;
       
   353 		}
       
   354 	}	
       
   355 	
       
   356 void CCamImgProc::ConstructL()
       
   357 	{
       
   358 	iSupportedTransformations.AppendL(KUidECamEventImageProcessingAdjustBrightness);
       
   359 	iSupportedTransformations.AppendL(KUidECamEventImageProcessingAdjustContrast);
       
   360 	iSupportedTransformations.AppendL(KUidECamEventImageProcessingEffect);
       
   361 	iBrightnessRange[0] = KBrightnessAdjMinValue; // min 
       
   362 	iBrightnessRange[1] = KBrightnessAdjMaxValue; // max value, step assumed 1
       
   363 	
       
   364 	iSupportedColorSwapCapabilities.iSupportedSourceRepresentation  = KDefault;
       
   365 	iSupportedColorSwapCapabilities.iSupportedTargetRepresentation  = KDefault;	
       
   366 	iSupportedColorSwapCapabilities.iSupportedSourceRgbGroupingMode = KDefault;
       
   367 	iSupportedColorSwapCapabilities.iSupportedTargetRgbGroupingMode = KDefault;
       
   368 	iSupportedColorSwapCapabilities.iIsCapabilityUniform = ETrue;
       
   369 	
       
   370 	iSupportedColorAccentCapabilities.iSupportedSourceRepresentation   = KDefault;
       
   371 	iSupportedColorAccentCapabilities.iSupportedSourceRgbGroupingMode  = KDefault;
       
   372 	iSupportedColorAccentCapabilities.iIsCapabilityUniform = ETrue;
       
   373 	}
       
   374 	
       
   375 void CCamImgProc::GetSupportedTransformationsL(RArray<TUid>& aTransformations) const
       
   376 	{
       
   377 	aTransformations.Reset();
       
   378 	if (iOwner.iCameras[iOwner.iCameraIndex])
       
   379 		{
       
   380 		for (TInt i=0; i<iSupportedTransformations.Count(); i++)
       
   381 			{
       
   382 			aTransformations.AppendL(iSupportedTransformations[i]);
       
   383 			}
       
   384 		}
       
   385 	}
       
   386 	
       
   387 void CCamImgProc::GetActiveTransformationsL(RArray<TUid>& aTransformations) const
       
   388 	{
       
   389 	aTransformations.Reset();
       
   390 	if (iOwner.iCameras[iOwner.iCameraIndex])
       
   391 		{
       
   392 		for (TInt i=0; i<iSupportedTransformations.Count(); i++)
       
   393 			{
       
   394 			aTransformations.AppendL(iSupportedTransformations[i]);
       
   395 			}
       
   396 		}
       
   397 	}
       
   398 	
       
   399 void CCamImgProc::GetTransformationSupportedValuesL(TUid aTransformation, RArray<TInt>& aValues, TValueInfo& aInfo) const
       
   400 	{
       
   401 	if (iSupportedTransformations.Find(aTransformation)==KErrNotFound)
       
   402 		{
       
   403 		aValues.Reset();
       
   404 		aInfo = ENotActive;
       
   405 		}
       
   406 	else
       
   407 		{
       
   408 		if (aTransformation == KUidECamEventImageProcessingAdjustBrightness)
       
   409 			{
       
   410 			aValues.AppendL(iBrightnessRange[0]);
       
   411 			aValues.AppendL(iBrightnessRange[1]);
       
   412 			aInfo = EContinuousRangeMinMax;
       
   413 			}
       
   414 		else
       
   415 			{
       
   416 			if(aTransformation == KUidECamEventImageProcessingEffect)
       
   417 				{
       
   418 				aValues.AppendL(CCamera::CCameraImageProcessing::EEffectColorSwap | CCamera::CCameraImageProcessing::EEffectColorAccent);
       
   419 				aInfo = EBitField;
       
   420 				}
       
   421 			else
       
   422 				{
       
   423 				aInfo = EDiscreteSteps;
       
   424 				if (aTransformation == iTransformation)
       
   425 					{
       
   426 					aValues.AppendL(iValue);
       
   427 					}
       
   428 				else
       
   429 					{
       
   430 					aValues.AppendL(KECamImageProcessingDefaultValue);
       
   431 					}	
       
   432 				}
       
   433 			}
       
   434 		}
       
   435 	}
       
   436 
       
   437 TInt CCamImgProc::TransformationValue(TUid aTransformation) const
       
   438 	{
       
   439 	if (iSupportedTransformations.Find(aTransformation) == KErrNotFound)
       
   440 		{
       
   441 		return KErrNotFound;
       
   442 		}
       
   443 	else
       
   444 		{
       
   445 		if (aTransformation == iTransformation)
       
   446 			{
       
   447 			return iValue;
       
   448 			}
       
   449 		else
       
   450 			{
       
   451 			return KECamImageProcessingDefaultValue;
       
   452 			}
       
   453 		}
       
   454 	}
       
   455 	
       
   456 TInt CCamImgProc::GetTransformationValue(TUid aTransformation, TInt& aTransformationValue) const
       
   457 	{
       
   458 	if (iSupportedTransformations.Find(aTransformation) == KErrNotFound)
       
   459 		{
       
   460 		return KErrNotFound;
       
   461 		}
       
   462 	else
       
   463 		{
       
   464 		if (aTransformation == iTransformation)
       
   465 			{
       
   466 			aTransformationValue = iValue;
       
   467 			}
       
   468 		else
       
   469 			{
       
   470 			aTransformationValue = KECamImageProcessingDefaultValue;
       
   471 			}
       
   472 			
       
   473 		return KErrNone;
       
   474 		}
       
   475 	}
       
   476 	
       
   477 void CCamImgProc::SetTransformationValue(TUid aTransformation, TInt aValue)
       
   478 	{
       
   479 	TInt response;
       
   480 	
       
   481 	if (iSupportedTransformations.Find(aTransformation) == KErrNotFound)
       
   482 		{
       
   483 		response = KErrECamSettingDisabled;
       
   484 		}
       
   485 	else
       
   486 		{
       
   487 		if (aTransformation == KUidECamEventImageProcessingAdjustBrightness)
       
   488 			{
       
   489 			// if outside the range 
       
   490 			if (aValue < iBrightnessRange[0] || aValue > iBrightnessRange[1])
       
   491 				{
       
   492 				response = KErrECamParameterNotInRange;
       
   493 				}
       
   494 			else
       
   495 				{
       
   496 				response = KErrNone;
       
   497 				}
       
   498 			}
       
   499 		else
       
   500 			{
       
   501 			response = KErrNone;
       
   502 			if(aTransformation == KUidECamEventImageProcessingEffect)
       
   503 				{
       
   504 				if(aValue == CCamera::CCameraImageProcessing::EEffectColorSwap)
       
   505 					{
       
   506 					iColorSwapParameter.iEntryStatus = ENotActive;
       
   507 					}
       
   508 				else
       
   509 					{
       
   510 					if(aValue == CCamera::CCameraImageProcessing::EEffectColorAccent)	
       
   511 						{
       
   512 						iColorAccentParameter.iEntryStatus = ENotActive;
       
   513 						}
       
   514 					else
       
   515 						{
       
   516 						response = KErrArgument;	
       
   517 						}
       
   518 					}
       
   519 				}
       
   520 			}
       
   521 				
       
   522 		if (response == KErrNone)
       
   523 			{
       
   524 			iTransformation = aTransformation;
       
   525 			iValue = aValue;
       
   526 			}
       
   527 		}
       
   528 	iOwner.Notify(aTransformation, response);
       
   529 	}
       
   530 	
       
   531 void CCamImgProc::GetActiveTransformSequenceL(RArray<TUid>& aTransformSequence) const
       
   532 	{
       
   533 	aTransformSequence.Reset();
       
   534 	if (iOwner.iCameras[iOwner.iCameraIndex])
       
   535 		{
       
   536 		for (TInt i = 0; i < iActiveSequence.Count(); i++)
       
   537 			{
       
   538 			aTransformSequence.AppendL(iActiveSequence[i]);
       
   539 			}
       
   540 		}		
       
   541 	}
       
   542 	
       
   543 void CCamImgProc::SetActiveTransformSequenceL(RArray<TUid>& aNewTransformSequence)
       
   544 	{
       
   545 	iActiveSequence.Reset();
       
   546 	if (iOwner.iCameras[iOwner.iCameraIndex])
       
   547 		{
       
   548 		for (TInt i=0; i<aNewTransformSequence.Count(); i++)
       
   549 			{
       
   550 			iActiveSequence.AppendL(aNewTransformSequence[i]);
       
   551 			}
       
   552 		}	
       
   553 	}
       
   554 
       
   555 void CCamImgProc::SetSourceRect( const TRect& aRect)
       
   556 	{
       
   557 	iSourceRect = aRect;	
       
   558 	}
       
   559 void CCamImgProc::GetSourceRect(TRect& aRect) const
       
   560 	{
       
   561 	aRect = iSourceRect;	
       
   562 	}
       
   563 	
       
   564 void CCamImgProc::GetConcurrentColorSwappingsSupportedL(TInt& aConcurrentColorSwappingSupported) const
       
   565 	{
       
   566 	aConcurrentColorSwappingSupported = KConcurrentColorOpSupported;
       
   567 	}
       
   568 	
       
   569 void CCamImgProc::GetColorSwapCapabilitiesL(TInt aIndex, CCamera::CCameraImageProcessing::TColorOperationCapabilities& aColorSwapCapabilities) const
       
   570 	{
       
   571 	if(aIndex <0 || aIndex > KConcurrentColorOpSupported-1)
       
   572 		{
       
   573 		User::Leave(KErrArgument);
       
   574 		}
       
   575 			
       
   576 	if(aColorSwapCapabilities.Size() != sizeof(CCamera::CCameraImageProcessing::TColorOperationCapabilities) ||
       
   577 	   aColorSwapCapabilities.Version() != KECamColorOperationCapabilitiesCurrentVersion)
       
   578 		{
       
   579 		// new app. running on old impl.
       
   580 		User::Leave(KErrNotSupported);
       
   581 		}
       
   582 	else
       
   583 		{
       
   584 		aColorSwapCapabilities = iSupportedColorSwapCapabilities;
       
   585 		}	
       
   586 	}
       
   587 	
       
   588 void CCamImgProc::SetColorSwapEntry(TInt aIndex, const CCamera::CCameraImageProcessing::TColorOperationEntry& aColorSwapParameters)
       
   589 	{
       
   590 	TInt response = KErrNone;
       
   591 
       
   592 	if(aColorSwapParameters.Size() != sizeof(CCamera::CCameraImageProcessing::TColorOperationEntry) ||
       
   593 	aColorSwapParameters.iNumBitsIgnored.Size() != sizeof(CCamera::CCameraImageProcessing::TBitsIgnore) ||
       
   594 	aColorSwapParameters.Version() != KECamColorOperationEntryCurrentVersion ||
       
   595 	aColorSwapParameters.iNumBitsIgnored.Version() != KECamBitsIgnoreCurrentVersion
       
   596 	)
       
   597 		{
       
   598 		// new app. running on old impl.
       
   599 		iOwner.Notify2(KUidECamEvent2CIPSetColorSwapEntry, KErrNotSupported, aIndex);
       
   600 		}
       
   601 	else
       
   602 		{
       
   603 		if(aIndex <0 || aIndex > KConcurrentColorOpSupported-1)
       
   604 			{
       
   605 			iOwner.Notify2(KUidECamEvent2CIPSetColorSwapEntry, KErrArgument, aIndex);
       
   606 			}
       
   607 		else
       
   608 			{
       
   609 			if(!CheckColorSwapEntry(aColorSwapParameters))
       
   610 				{
       
   611 				// if color operation entry is different from what is supported....
       
   612 				iOwner.Notify2(KUidECamEvent2CIPSetColorSwapEntry, KErrArgument, aIndex);
       
   613 				}
       
   614 			else
       
   615 				{
       
   616 				iColorSwapParameter = aColorSwapParameters;
       
   617 				iColorSwapParameter.iEntryStatus = EDiscreteSteps;
       
   618 				
       
   619 				iOwner.Notify2(KUidECamEvent2CIPSetColorSwapEntry, response, aIndex);	
       
   620 				}
       
   621 			}
       
   622 		}
       
   623 	}
       
   624 	
       
   625 void CCamImgProc::RemoveColorSwapEntry(TInt aIndex)
       
   626 	{
       
   627 	TInt response = KErrNone;
       
   628 
       
   629 	if(aIndex <0 || aIndex > KConcurrentColorOpSupported-1)
       
   630 		{
       
   631 		iOwner.Notify2(KUidECamEventCIPRemoveColorSwapEntry, KErrArgument, aIndex);
       
   632 		}
       
   633 	else
       
   634 		{
       
   635 		iColorSwapParameter.iEntryStatus = ENotActive;
       
   636 		iOwner.Notify2(KUidECamEventCIPRemoveColorSwapEntry, response, aIndex);	
       
   637 		}
       
   638 	}
       
   639 	
       
   640 void CCamImgProc::GetColorSwapEntryL(TInt aIndex, CCamera::CCameraImageProcessing::TColorOperationEntry& aColorSwapParameters) const
       
   641 	{
       
   642 	if(aIndex <0 || aIndex > KConcurrentColorOpSupported-1)
       
   643 		{
       
   644 		User::Leave(KErrArgument);
       
   645 		}
       
   646 		
       
   647 	if(aColorSwapParameters.Size() != sizeof(CCamera::CCameraImageProcessing::TColorOperationEntry) ||
       
   648 	aColorSwapParameters.iNumBitsIgnored.Size() != sizeof(CCamera::CCameraImageProcessing::TBitsIgnore))
       
   649 		{
       
   650 		// new app. running on old impl.
       
   651 		User::Leave(KErrNotSupported);
       
   652 		}	
       
   653 	else
       
   654 		{
       
   655 		aColorSwapParameters = iColorSwapParameter;
       
   656 		}		
       
   657 	}
       
   658 	
       
   659 void CCamImgProc::StartColorSwapping()
       
   660 	{
       
   661 	TInt response = KErrNone;
       
   662 	iOwner.Notify(KUidECamEventCIPStartColorSwap, response);
       
   663 	}
       
   664 	
       
   665 void CCamImgProc::CancelColorSwappingL()
       
   666 	{
       
   667 	}
       
   668 	
       
   669 void CCamImgProc::GetConcurrentColorAccentSupportedL(TInt& aConcurrentColorAccentSupported) const
       
   670 	{
       
   671 	aConcurrentColorAccentSupported = KConcurrentColorOpSupported;
       
   672 	}
       
   673 	
       
   674 void CCamImgProc::GetColorAccentCapabilitiesL(TInt aIndex, CCamera::CCameraImageProcessing::TColorOperationCapabilities& aColorAccentCapabilities) const
       
   675 	{
       
   676 	if(aIndex <0 || aIndex > KConcurrentColorOpSupported-1)
       
   677 		{
       
   678 		User::Leave(KErrArgument);
       
   679 		}
       
   680 			
       
   681 	if(aColorAccentCapabilities.Size() != sizeof(CCamera::CCameraImageProcessing::TColorOperationCapabilities))
       
   682 		{
       
   683 		// new app. running on old impl.
       
   684 		User::Leave(KErrNotSupported);
       
   685 		}
       
   686 	else
       
   687 		{
       
   688 		aColorAccentCapabilities = iSupportedColorAccentCapabilities;
       
   689 		}	
       
   690 	}
       
   691 	
       
   692 void CCamImgProc::SetColorAccentEntry(TInt aIndex, const CCamera::CCameraImageProcessing::TColorOperationEntry& aColorAccentParameters)
       
   693 	{
       
   694 	TInt response = KErrNone;
       
   695 
       
   696 	if(aColorAccentParameters.Size() != sizeof(CCamera::CCameraImageProcessing::TColorOperationEntry) ||
       
   697 	aColorAccentParameters.iNumBitsIgnored.Size() != sizeof(CCamera::CCameraImageProcessing::TBitsIgnore))
       
   698 		{
       
   699 		// new app. running on old impl.
       
   700 		iOwner.Notify2(KUidECamEventCIPSetColorAccentEntry, KErrNotSupported, aIndex);
       
   701 		}
       
   702 	else
       
   703 		{
       
   704 		if(aIndex <0 || aIndex > KConcurrentColorOpSupported-1)
       
   705 			{
       
   706 			iOwner.Notify2(KUidECamEventCIPSetColorAccentEntry, KErrArgument, aIndex);
       
   707 			}
       
   708 		else
       
   709 			{
       
   710 			if(!CheckColorAccentEntry(aColorAccentParameters))
       
   711 				{
       
   712 				// if color operation entry is different from what is supported....
       
   713 				iOwner.Notify2(KUidECamEventCIPSetColorAccentEntry, KErrArgument, aIndex);
       
   714 				}
       
   715 			else
       
   716 				{
       
   717 				iColorAccentParameter = aColorAccentParameters;
       
   718 				iColorAccentParameter.iEntryStatus = EDiscreteSteps;
       
   719 				
       
   720 				iOwner.Notify2(KUidECamEventCIPSetColorAccentEntry, response, aIndex);	
       
   721 				}
       
   722 			}
       
   723 		}
       
   724 	}
       
   725 	
       
   726 void CCamImgProc::RemoveColorAccentEntry(TInt aIndex)
       
   727 	{
       
   728 	TInt response = KErrNone;
       
   729 
       
   730 	if(aIndex <0 || aIndex > KConcurrentColorOpSupported-1)
       
   731 		{
       
   732 		iOwner.Notify2(KUidECamEventCIPRemoveColorAccentEntry, KErrArgument, aIndex);
       
   733 		}
       
   734 	else
       
   735 		{
       
   736 		iColorAccentParameter.iEntryStatus = ENotActive;
       
   737 		iOwner.Notify2(KUidECamEventCIPRemoveColorAccentEntry, response, aIndex);	
       
   738 		}
       
   739 	}
       
   740 	
       
   741 void CCamImgProc::GetColorAccentEntryL(TInt aIndex, CCamera::CCameraImageProcessing::TColorOperationEntry& aColorAccentParameters) const
       
   742 	{
       
   743 	if(aIndex <0 || aIndex > KConcurrentColorOpSupported-1)
       
   744 		{
       
   745 		User::Leave(KErrArgument);
       
   746 		}
       
   747 		
       
   748 	if(aColorAccentParameters.Size() != sizeof(CCamera::CCameraImageProcessing::TColorOperationEntry) ||
       
   749 	aColorAccentParameters.iNumBitsIgnored.Size() != sizeof(CCamera::CCameraImageProcessing::TBitsIgnore))
       
   750 		{
       
   751 		// new app. running on old impl.
       
   752 		User::Leave(KErrNotSupported);
       
   753 		}	
       
   754 	else
       
   755 		{
       
   756 		aColorAccentParameters = iColorAccentParameter;
       
   757 		}
       
   758 	}
       
   759 	
       
   760 void CCamImgProc::StartColorAccent()
       
   761 	{
       
   762 	TInt response = KErrNone;
       
   763 	iOwner.Notify(KUidECamEventCIPStartColorAccent, response);
       
   764 	}
       
   765 	
       
   766 void CCamImgProc::CancelColorAccentL()
       
   767 	{
       
   768 	}
       
   769 	
       
   770 TBool CCamImgProc::CheckColorSwapEntry(const CCamera::CCameraImageProcessing::TColorOperationEntry& aColorSwapParameters) const
       
   771 	{
       
   772 	if(aColorSwapParameters.iSourceColorRepresentation != KDefault)
       
   773 		{
       
   774 		return EFalse;
       
   775 		}
       
   776 		
       
   777 	if(aColorSwapParameters.iTargetColorRepresentation != KDefault)
       
   778 		{
       
   779 		return EFalse;
       
   780 		}
       
   781 	
       
   782 	if(aColorSwapParameters.iColorOperationSourceRgbGroupingMode != KDefault)
       
   783 		{
       
   784 		return EFalse;
       
   785 		}
       
   786 	
       
   787 	if(aColorSwapParameters.iColorOperationTargetRgbGroupingMode != KDefault)
       
   788 		{
       
   789 		return EFalse;
       
   790 		}
       
   791 		
       
   792 	if(aColorSwapParameters.iNumBitsIgnored.iRedBitsIgnore != 0)
       
   793 		{
       
   794 		return EFalse;
       
   795 		}	
       
   796 	 
       
   797 	if(aColorSwapParameters.iNumBitsIgnored.iGreenBitsIgnore != 0)
       
   798 		{
       
   799 		return EFalse;
       
   800 		}	
       
   801 		
       
   802 	if(aColorSwapParameters.iNumBitsIgnored.iBlueBitsIgnore != 0)
       
   803 		{
       
   804 		return EFalse;
       
   805 		}		  	
       
   806 		
       
   807 	if(aColorSwapParameters.iNumBitsIgnored.iAlphaBitsIgnore != 0)
       
   808 		{
       
   809 		return EFalse;
       
   810 		}	   
       
   811 	
       
   812 	return ETrue;		 
       
   813 	}
       
   814 
       
   815 TBool CCamImgProc::CheckColorAccentEntry(const CCamera::CCameraImageProcessing::TColorOperationEntry& aColorAccentParameters) const
       
   816 	{
       
   817 	if(aColorAccentParameters.iSourceColorRepresentation != KDefault)
       
   818 		{
       
   819 		return EFalse;
       
   820 		}
       
   821 		
       
   822 	if(aColorAccentParameters.iColorOperationSourceRgbGroupingMode != KDefault)
       
   823 		{
       
   824 		return EFalse;
       
   825 		}
       
   826 	
       
   827 	if(aColorAccentParameters.iNumBitsIgnored.iRedBitsIgnore != 0)
       
   828 		{
       
   829 		return EFalse;
       
   830 		}	
       
   831 	 
       
   832 	if(aColorAccentParameters.iNumBitsIgnored.iGreenBitsIgnore != 0)
       
   833 		{
       
   834 		return EFalse;
       
   835 		}	
       
   836 		
       
   837 	if(aColorAccentParameters.iNumBitsIgnored.iBlueBitsIgnore != 0)
       
   838 		{
       
   839 		return EFalse;
       
   840 		}		  	
       
   841 		
       
   842 	if(aColorAccentParameters.iNumBitsIgnored.iAlphaBitsIgnore != 0)
       
   843 		{
       
   844 		return EFalse;
       
   845 		}	   
       
   846 	
       
   847 	return ETrue;		 
       
   848 	}
       
   849 
       
   850 void CCamImgProc::GetSupportedRelativeOrientationOptionsL(CCamera::CCameraImageProcessing::TOrientationReference /*aOrientationReference*/, 
       
   851 			TUint& /*aSupportedRelativeRotation*/, TUint& /*aSupportedRelativeMirroring*/, TUint& /*aSupportedRelativeFlipping*/) const
       
   852 	{
       
   853 	User::Leave(KErrNotSupported);	
       
   854 	}
       
   855 	
       
   856 void CCamImgProc::GetCurrentRelativeOrientationOptionsL(CCamera::CCameraImageProcessing::TOrientationReference& /*aOrientationReference*/, 
       
   857 			CCamera::CCameraImageProcessing::TRelativeRotation& /*aRelativeRotation*/, CCamera::CCameraImageProcessing::
       
   858 			TRelativeMirror& /*aRelativeMirror*/, CCamera::CCameraImageProcessing::TRelativeFlipping& /*aRelativeFlipping*/) const
       
   859 	{
       
   860 	User::Leave(KErrNotSupported);	
       
   861 	}
       
   862 
       
   863 void CCamImgProc::SetRelativeOrientationOptions(CCamera::CCameraImageProcessing::TOrientationReference /*aOrientationReference*/, 
       
   864 			CCamera::CCameraImageProcessing::TRelativeRotation /*aRelativeRotation*/, CCamera::CCameraImageProcessing::
       
   865 			TRelativeMirror /*aRelativeMirror*/, CCamera::CCameraImageProcessing::TRelativeFlipping /*aRelativeFlipping*/) const
       
   866 	{
       
   867 	iOwner.Notify(KUidECamEventImageProcessingTransformRelativeOrientation, KErrNotSupported);
       
   868 	}
       
   869 	
       
   870 //
       
   871 // CCamAdvSet
       
   872 //
       
   873 
       
   874 CCamAdvSet::CCamAdvSet(CCamUnitTestPlugin& aOwner): iOwner(aOwner)
       
   875 	{
       
   876 	Init();
       
   877 	}
       
   878 	
       
   879 CCamAdvSet::~CCamAdvSet()
       
   880 	{
       
   881 	Dll::FreeTls();
       
   882 	}
       
   883 		
       
   884 CCamAdvSet* CCamAdvSet::NewL(CCamUnitTestPlugin& aOwner)
       
   885 	{
       
   886 	CDataGlobal* globalData = static_cast <CDataGlobal*> (Dll::Tls());
       
   887 	
       
   888 	if(!globalData)
       
   889 		{
       
   890 		globalData = new (ELeave) CDataGlobal;
       
   891 		CleanupStack::PushL(globalData);
       
   892 		
       
   893 		globalData->iReferenceCount = 0;
       
   894 		globalData->iCamAdvSet = new (ELeave) CCamAdvSet(aOwner);
       
   895 		globalData->iCamAdvSet->iRefCount = 1;
       
   896 		TInt error =  Dll::SetTls(globalData);
       
   897 		if(error)
       
   898 			{
       
   899 			delete globalData->iCamAdvSet;
       
   900 			User::Leave(error);
       
   901 			}
       
   902 		CleanupStack::Pop(globalData);
       
   903 		return static_cast <CCamAdvSet*> (globalData->iCamAdvSet);
       
   904 		}
       
   905 	else
       
   906 		{
       
   907 		CCamAdvSet* self = globalData->iCamAdvSet;
       
   908 		
       
   909 		globalData->iReferenceCount++;
       
   910 		self->iRefCount = globalData->iReferenceCount + 1;
       
   911 		if (globalData->iReferenceCount == 3 )
       
   912 			{
       
   913 			delete globalData;
       
   914 			Dll::FreeTls();
       
   915 			}
       
   916 		else
       
   917 			{
       
   918 			TInt error =  Dll::SetTls(globalData);
       
   919 			if(error)
       
   920 				{
       
   921 				delete globalData->iCamAdvSet;
       
   922 				User::Leave(error);
       
   923 				}
       
   924 			}
       
   925 		return static_cast <CCamAdvSet*> (self);		
       
   926 		}
       
   927 	}
       
   928 
       
   929 void CCamAdvSet::Release()
       
   930 	{
       
   931 	iRefCount--; 
       
   932 	if(!iRefCount)
       
   933 		{
       
   934 		delete this;
       
   935 		}
       
   936 	}	
       
   937 	
       
   938 void CCamAdvSet::Init()
       
   939 	{
       
   940 	iShutterSpeed = KDefaultShutterSpeed;
       
   941 	iFocusDistance = KDefaultFocusDistance;
       
   942 	iAperture = KDefaultAperture;
       
   943 	iFocusRange = CCamera::CCameraAdvancedSettings::EFocusRangeAuto;
       
   944 	iWhiteBalance = CCamera::EWBAuto;
       
   945 	
       
   946 	iISORateType = CCamera::CCameraAdvancedSettings::EISOManual;
       
   947 	iSupportedISORateType = KSupportedISORateType;
       
   948 	iIsCapableActualISOValue = KCapableActualISOValue;
       
   949 	iAutoISOIndex = -1;
       
   950 	iSupportedAFAssistantLight = KAFAssistantLightManual;
       
   951 	iAFAssistantLight = CCamera::CCameraAdvancedSettings::EAFAssistantLightOff;
       
   952 	iPixelAspectRatio = CCamera::CCameraAdvancedSettings::EPixelAspect1To1;
       
   953 	iFlashMode = CCamera::EFlashNone;
       
   954 
       
   955 	iSupportedDriveModes |= CCamera::CCameraAdvancedSettings::EDriveModeSingleShot;
       
   956 	iSupportedDriveModes |= CCamera::CCameraAdvancedSettings::EDriveModeBurst;
       
   957 	iSupportedDriveModes |= CCamera::CCameraAdvancedSettings::EDriveModeTimeNudgeCapture;
       
   958 	
       
   959 	iDriveMode = CCamera::CCameraAdvancedSettings::EDriveModeAuto;
       
   960 	}
       
   961 
       
   962 CCamera::CCameraAdvancedSettings::TCameraType CCamAdvSet::CameraType() const
       
   963 	{
       
   964 	return iOwner.iCameraTypes[iOwner.iCameraIndex];	
       
   965 	}
       
   966 
       
   967 CCamera::CCameraAdvancedSettings::TCameraType CCamAdvSet::CameraType(TInt aCameraIndex) const
       
   968 	{
       
   969 	if (aCameraIndex >= KECamSetAvailableCameras)
       
   970 		{
       
   971 		return CCamera::CCameraAdvancedSettings::ECameraUnknown;	
       
   972 		}
       
   973 	else 
       
   974 		{
       
   975 		return iOwner.iCameraTypes[aCameraIndex];	
       
   976 		}
       
   977 	}
       
   978 	
       
   979 TBool CCamAdvSet::IsCameraPresent() const
       
   980 	{
       
   981 	return iOwner.iCameras[iOwner.iCameraIndex];
       
   982 	}
       
   983 
       
   984 TBool CCamAdvSet::IsCameraPresent(TInt aCameraIndex) const
       
   985 	{
       
   986 	if (aCameraIndex >= KECamSetAvailableCameras)
       
   987 		{
       
   988 		return EFalse;
       
   989 		}
       
   990 	else
       
   991 		{
       
   992 		return iOwner.iCameras[aCameraIndex];
       
   993 		}
       
   994 	}
       
   995 	
       
   996 TInt CCamAdvSet::CameraIndex() const
       
   997 	{
       
   998 	return iOwner.iCameraIndex;
       
   999 	}
       
  1000 	
       
  1001 TInt CCamAdvSet::SupportedStabilizationModes() const
       
  1002 	{
       
  1003 	return 0;
       
  1004 	}
       
  1005 CCamera::CCameraAdvancedSettings::TStabilizationMode CCamAdvSet::StabilizationMode() const
       
  1006 	{
       
  1007 	return CCamera::CCameraAdvancedSettings::EStabilizationModeOff;
       
  1008 	}
       
  1009 	
       
  1010 void CCamAdvSet::SetStabilizationMode(CCamera::CCameraAdvancedSettings::TStabilizationMode /*aStabilizationMode*/)
       
  1011 	{
       
  1012 	}
       
  1013 	
       
  1014 TInt CCamAdvSet::SupportedFocusModes() const
       
  1015 	{
       
  1016 	return 0;
       
  1017 	}
       
  1018 	
       
  1019 CCamera::CCameraAdvancedSettings::TFocusMode CCamAdvSet::FocusMode() const
       
  1020 	{
       
  1021 	return CCamera::CCameraAdvancedSettings::EFocusModeAuto;	
       
  1022 	}
       
  1023 	
       
  1024 void CCamAdvSet::SetFocusMode(CCamera::CCameraAdvancedSettings::TFocusMode /*aFocusMode*/)
       
  1025 	{
       
  1026 	TInt response = KErrNone;
       
  1027 	
       
  1028 	RetrieveResult(response);
       
  1029 	
       
  1030 	iOwner.Notify(KUidECamEventCameraSettingFocusMode, response);
       
  1031 	}
       
  1032 	
       
  1033 TInt CCamAdvSet::SupportedFocusRanges() const
       
  1034 	{
       
  1035 	return KFocusRangeSupported;
       
  1036 	}
       
  1037 	
       
  1038 CCamera::CCameraAdvancedSettings::TFocusRange CCamAdvSet::FocusRange() const
       
  1039 	{
       
  1040 	return iFocusRange;
       
  1041 	}
       
  1042 	
       
  1043 void CCamAdvSet::SetFocusRange(CCamera::CCameraAdvancedSettings::TFocusRange aFocusRange )
       
  1044 	{
       
  1045 	TInt response = KErrNone;
       
  1046 	
       
  1047 	RetrieveResult(response);
       
  1048 	
       
  1049 	iFocusRange = aFocusRange;
       
  1050 	iOwner.Notify(KUidECamEventCameraSettingFocusRange2, response);
       
  1051 	iOwner.Notify(KUidECamEventCameraSettingFocusRange, response);
       
  1052 	}
       
  1053 	
       
  1054 TInt CCamAdvSet::SupportedAutoFocusTypes() const
       
  1055 	{
       
  1056 	return 0;
       
  1057 	}
       
  1058 	
       
  1059 CCamera::CCameraAdvancedSettings::TAutoFocusType CCamAdvSet::AutoFocusType() const
       
  1060 	{
       
  1061     return CCamera::CCameraAdvancedSettings::EAutoFocusTypeOff;
       
  1062 	}
       
  1063 	
       
  1064 void CCamAdvSet::SetAutoFocusType(CCamera::CCameraAdvancedSettings::TAutoFocusType /*aAutoFocusType*/)
       
  1065 	{
       
  1066 	TInt response = KErrNone;
       
  1067 	
       
  1068 	RetrieveResult(response);
       
  1069 	
       
  1070 	iOwner.Notify(KUidECamEventCameraSettingAutoFocusType2, response);
       
  1071 	iOwner.Notify(KUidECamEventCameraSettingAutoFocusType, response);
       
  1072 	}
       
  1073 	
       
  1074 TInt CCamAdvSet::SupportedAutoFocusAreas() const
       
  1075 	{
       
  1076 	return 0;
       
  1077 	}
       
  1078 	
       
  1079 CCamera::CCameraAdvancedSettings::TAutoFocusArea CCamAdvSet::AutoFocusArea() const
       
  1080 	{
       
  1081 	return CCamera::CCameraAdvancedSettings::EAutoFocusTypeAuto;
       
  1082 	}
       
  1083 	
       
  1084 void CCamAdvSet::SetAutoFocusArea(CCamera::CCameraAdvancedSettings::TAutoFocusArea /*aAutoFocusArea*/)
       
  1085 	{
       
  1086 	TInt response = KErrNone;
       
  1087 	
       
  1088 	RetrieveResult(response);
       
  1089 	
       
  1090 	iOwner.Notify(KUidECamEventCameraSettingAutoFocusArea, response);
       
  1091 	}
       
  1092 	
       
  1093 TInt CCamAdvSet::FocusDistance() const
       
  1094 	{
       
  1095 	return iFocusDistance;
       
  1096 	}
       
  1097 	
       
  1098 void CCamAdvSet::SetFocusDistance(TInt aDistance) 
       
  1099 	{
       
  1100 	TInt response = KErrNone;
       
  1101 	if (aDistance >=0)
       
  1102 		{
       
  1103 		iFocusDistance = aDistance;
       
  1104 		
       
  1105 		RetrieveResult(response);
       
  1106 		}
       
  1107 	else 
       
  1108 		{
       
  1109 		response = KErrNotSupported;
       
  1110 		}
       
  1111 	
       
  1112 	iOwner.Notify(KUidECamEventCameraSettingFocusDistance, response);
       
  1113 	}
       
  1114 	
       
  1115 TInt CCamAdvSet::GetMinFocalLength() const
       
  1116 	{
       
  1117 	return KErrNotSupported;
       
  1118 	}
       
  1119 	
       
  1120 void CCamAdvSet::GetSupportedIsoRatesL(RArray<TInt>& aSupportedIsoRates) const
       
  1121 	{
       
  1122 	//If no ISO is supported by camera, then leave
       
  1123 	if(!iOwner.iSupportedISORates.Count())
       
  1124 		{
       
  1125 		User::Leave(KErrNotSupported);
       
  1126 		}
       
  1127 	
       
  1128 	for(TInt index=0; index < iOwner.iSupportedISORates.Count(); index++)
       
  1129 		{
       
  1130 		aSupportedIsoRates.AppendL(iOwner.iSupportedISORates[index]);
       
  1131 		}
       
  1132 	}
       
  1133 	
       
  1134 TInt CCamAdvSet::IsoRate() const
       
  1135 	{
       
  1136 	//this returned value may not be true if ISO type is other than manual and camera 
       
  1137 	//has no capability to retrieve actual ISO rate.
       
  1138 	return iOwner.iIsoRate; 
       
  1139 	}
       
  1140 
       
  1141 void CCamAdvSet::SetIsoRate(TInt aRate)
       
  1142 	{
       
  1143 	TInt response;
       
  1144 	//check whether the desired rate to be set is being supported or not.
       
  1145 	if(iOwner.iSupportedISORates.Find(aRate) == KErrNotFound)
       
  1146 		{
       
  1147 		response = KErrECamParameterNotInRange;
       
  1148 		}
       
  1149 	else 
       
  1150 		{
       
  1151 		//set the ISO type to Manual
       
  1152 		//this function should be called by SetISORateL as well after doing boundary checkings 
       
  1153 		//SetISORate(CCamera::CCameraAdvancedSettings::EISOManual, aRate); 
       
  1154 		iISORateType = CCamera::CCameraAdvancedSettings::EISOManual;			
       
  1155 		iOwner.iIsoRate = aRate;
       
  1156 		
       
  1157 		RetrieveResult(response);
       
  1158 		}
       
  1159 	iOwner.Notify(KUidECamEventCameraSettingIsoRate, response);
       
  1160 	}
       
  1161 	
       
  1162 void CCamAdvSet::GetSupportedISORateTypeL(TInt& aSupportedISORateTypes) const
       
  1163 	{
       
  1164 	aSupportedISORateTypes = iSupportedISORateType;	
       
  1165 	}
       
  1166 	
       
  1167 void CCamAdvSet::SetISORate(CCamera::CCameraAdvancedSettings::TISORateType aISORateType, TInt aParam)
       
  1168 	{
       
  1169 	TInt response = KErrNone;
       
  1170 	
       
  1171 	if(!(aISORateType & iSupportedISORateType) || iOwner.iSupportedISORates.Count() == 0)
       
  1172 		{
       
  1173 		response = KErrNotSupported;
       
  1174 		}
       
  1175 	else
       
  1176 		{
       
  1177 		switch(aISORateType)
       
  1178 			{
       
  1179 			case CCamera::CCameraAdvancedSettings::EISOManual:
       
  1180 				{
       
  1181 				if(iOwner.iSupportedISORates.Find(aParam) == KErrNotFound)
       
  1182 					{
       
  1183 					response = KErrECamParameterNotInRange;
       
  1184 					}
       
  1185 				else
       
  1186 					{
       
  1187 					RetrieveResult(response);
       
  1188 					}
       
  1189 				break;
       
  1190 				}
       
  1191 			case CCamera::CCameraAdvancedSettings::EISOAutoUnPrioritised:
       
  1192 				{
       
  1193 				RetrieveResult(response);
       
  1194 				break;	
       
  1195 				}
       
  1196 			case CCamera::CCameraAdvancedSettings::EISOAutoISOPrioritised:
       
  1197 				{
       
  1198 				if(iOwner.iSupportedISORates.Find(aParam) == KErrNotFound)
       
  1199 					{
       
  1200 					response = KErrECamParameterNotInRange;
       
  1201 					}
       
  1202 				else
       
  1203 					{
       
  1204 					RetrieveResult(response);
       
  1205 					}
       
  1206 				break;
       
  1207 				}
       
  1208 			case CCamera::CCameraAdvancedSettings::EISOAutoShutterSpeedPrioritised:
       
  1209 				{
       
  1210 				RetrieveResult(response);
       
  1211 				break;	
       
  1212 				}
       
  1213 			case CCamera::CCameraAdvancedSettings::EISOAutoAperturePrioritised:
       
  1214 				{
       
  1215 				RetrieveResult(response);
       
  1216 				break;	
       
  1217 				}
       
  1218 			default:
       
  1219 				response = KErrNotSupported;
       
  1220 			}
       
  1221 			
       
  1222 		// this function should be called by SetISORate ,in old API, as well after doing boundary checkings 
       
  1223 		// SetISORate(aISORateType, aParam); 	
       
  1224 		// In real impl, following code should be handled by RunL when server responds to the setting request. Error may also occur.
       
  1225 		iISORateType = aISORateType;
       
  1226 		if(aISORateType == CCamera::CCameraAdvancedSettings::EISOManual)
       
  1227 			{
       
  1228 			if(response == KErrNone)
       
  1229 				{
       
  1230 				iOwner.iIsoRate = aParam;
       
  1231 				}
       
  1232 			}
       
  1233 		else
       
  1234 			{
       
  1235 			if(response == KErrNone)
       
  1236 				{
       
  1237 				iAutoISOIndex = aParam;
       
  1238 				}
       
  1239 			}	
       
  1240 		}	
       
  1241 	
       
  1242 	iOwner.Notify(KUidECamEventCameraSettingIsoRateType, response);
       
  1243 	}
       
  1244 
       
  1245 void CCamAdvSet::GetISORateL(CCamera::CCameraAdvancedSettings::TISORateType& aISORateType, TInt& aParam, TInt& aISORate) const
       
  1246 	{
       
  1247 	//If camera has no ISO rate supported, then leave
       
  1248 	if(iOwner.iSupportedISORates.Count() == 0)	
       
  1249 		{
       
  1250 		User::Leave(KErrNotSupported);
       
  1251 		}
       
  1252 		
       
  1253 	if(iISORateType == CCamera::CCameraAdvancedSettings::EISONone)
       
  1254 		{
       
  1255 		aISORateType = iISORateType;
       
  1256 		}
       
  1257 	else
       
  1258 		{
       
  1259 		if(iISORateType != CCamera::CCameraAdvancedSettings::EISOManual)
       
  1260 			{
       
  1261 			aParam = iAutoISOIndex;
       
  1262 			
       
  1263 			//if camera is not capable to retrieve actual ISO value in auto ISO modes, KErrNotFound is returned in aISORate.
       
  1264 			if(!iIsCapableActualISOValue)
       
  1265 				{
       
  1266 				aISORate = KErrNotFound;
       
  1267 				}
       
  1268 			else
       
  1269 				{
       
  1270 				aISORate = iOwner.iIsoRate;	
       
  1271 				}
       
  1272 			}
       
  1273 		else
       
  1274 			{
       
  1275 			aISORate = iOwner.iIsoRate;	
       
  1276 			}
       
  1277 		
       
  1278 		aISORateType = iISORateType;	
       
  1279 		}	
       
  1280 	}
       
  1281 
       
  1282 void CCamAdvSet::GetAperturesL(RArray<TInt>& /*aFStops*/, TValueInfo& /*aInfo*/) const
       
  1283 	{
       
  1284 	
       
  1285 	}
       
  1286 	
       
  1287 TInt CCamAdvSet::Aperture() const
       
  1288 	{
       
  1289 	return iAperture;
       
  1290 	}
       
  1291 
       
  1292 void CCamAdvSet::SetAperture(TInt aFStop)
       
  1293 	{
       
  1294 	TInt response = KErrNone;
       
  1295 	
       
  1296 	iAperture = aFStop;
       
  1297 	RetrieveResult(response);
       
  1298 	
       
  1299 	iOwner.Notify(KUidECamEventCameraSettingAperture, response);
       
  1300 	}	
       
  1301 	
       
  1302 void CCamAdvSet::GetShutterSpeedsL(RArray<TInt>& aShutterSpeeds, TValueInfo& aInfo) const
       
  1303 	{
       
  1304 	aShutterSpeeds.Reset();
       
  1305 	aInfo =  ENotActive;
       
  1306 	}
       
  1307 	
       
  1308 TInt CCamAdvSet::ShutterSpeed() const
       
  1309 	{
       
  1310 	return iShutterSpeed;
       
  1311 	}
       
  1312 	
       
  1313 void CCamAdvSet::SetShutterSpeed(TInt aShutterSpeed)
       
  1314 	{
       
  1315 	TInt response = KErrNone;
       
  1316 	if (aShutterSpeed >=0)
       
  1317 		{
       
  1318 		iShutterSpeed = aShutterSpeed;
       
  1319 		
       
  1320 		RetrieveResult(response);
       
  1321 		}
       
  1322 	else 
       
  1323 		{
       
  1324 		response = KErrNotSupported;
       
  1325 		}
       
  1326 	
       
  1327 	iOwner.Notify(KUidECamEventCameraSettingShutterSpeed, response);
       
  1328 	}
       
  1329 	
       
  1330 TInt CCamAdvSet::SupportedMeteringModes() const
       
  1331 	{
       
  1332 	return CCamera::CCameraAdvancedSettings::EMeteringModeAuto;
       
  1333 	}
       
  1334 	
       
  1335 CCamera::CCameraAdvancedSettings::TMeteringMode CCamAdvSet::MeteringMode() const
       
  1336 	{
       
  1337 	return CCamera::CCameraAdvancedSettings::EMeteringModeAuto;
       
  1338 	}
       
  1339 	
       
  1340 void CCamAdvSet::SetMeteringMode(CCamera::CCameraAdvancedSettings::TMeteringMode /*aMeteringMode*/)
       
  1341 	{
       
  1342 	TInt response = KErrNone;
       
  1343 	
       
  1344 	RetrieveResult(response);
       
  1345 	
       
  1346 	iOwner.Notify(KUidECamEventCameraSettingMeteringMode, response);
       
  1347 	}
       
  1348 	
       
  1349 TInt CCamAdvSet::SupportedDriveModes() const
       
  1350 	{
       
  1351 	return iSupportedDriveModes;
       
  1352 	}
       
  1353 	
       
  1354 CCamera::CCameraAdvancedSettings::TDriveMode CCamAdvSet::DriveMode() const
       
  1355 	{
       
  1356 	return iDriveMode;
       
  1357 	}
       
  1358 	
       
  1359 void CCamAdvSet::SetDriveMode(CCamera::CCameraAdvancedSettings::TDriveMode aDriveMode)
       
  1360 	{
       
  1361 	TInt response = KErrNone;
       
  1362 	
       
  1363 	iDriveMode = aDriveMode;
       
  1364 	
       
  1365 	RetrieveResult(response);
       
  1366 	
       
  1367 	iOwner.Notify(KUidECamEventCameraSettingDriveMode, response);
       
  1368 	}
       
  1369 	
       
  1370 TInt CCamAdvSet::SupportedBracketModes() const
       
  1371 	{
       
  1372 	return CCamera::CCameraAdvancedSettings::EBracketModeOff;
       
  1373 	}
       
  1374 	
       
  1375 CCamera::CCameraAdvancedSettings::TBracketMode CCamAdvSet::BracketMode() const
       
  1376 	{
       
  1377 	return CCamera::CCameraAdvancedSettings::EBracketModeOff;
       
  1378 	}
       
  1379 	
       
  1380 void CCamAdvSet::SetBracketMode(CCamera::CCameraAdvancedSettings::TBracketMode /*aBracketMode*/)
       
  1381 	{
       
  1382 	TInt response = KErrNone;
       
  1383 	
       
  1384 	RetrieveResult(response);
       
  1385 	
       
  1386 	iOwner.Notify(KUidECamEventCameraSettingBracketMode, response);
       
  1387 	}
       
  1388 	
       
  1389 TInt CCamAdvSet::SupportedBracketParameters() const
       
  1390 	{
       
  1391 	return CCamera::CCameraAdvancedSettings::EBracketParameterNone;
       
  1392 	}
       
  1393 	
       
  1394 CCamera::CCameraAdvancedSettings::TBracketParameter CCamAdvSet::BracketParameter() const
       
  1395 	{
       
  1396 	return CCamera::CCameraAdvancedSettings::EBracketParameterNone;
       
  1397 	}
       
  1398 	
       
  1399 void CCamAdvSet::SetBracketParameter(CCamera::CCameraAdvancedSettings::TBracketParameter /*aBracketParameter*/)
       
  1400 	{
       
  1401 	}
       
  1402 	
       
  1403 TInt CCamAdvSet::SupportedBracketSteps() const
       
  1404 	{
       
  1405 	return CCamera::CCameraAdvancedSettings::EBracketStepSmall;
       
  1406 	}
       
  1407 	
       
  1408 CCamera::CCameraAdvancedSettings::TBracketStep CCamAdvSet::BracketStep() const
       
  1409 	{
       
  1410 	return CCamera::CCameraAdvancedSettings::EBracketStepSmall;
       
  1411 	}
       
  1412 	
       
  1413 void CCamAdvSet::SetBracketStep(CCamera::CCameraAdvancedSettings::TBracketStep /*aBracketStep*/)
       
  1414 	{
       
  1415 	
       
  1416 	}
       
  1417 void CCamAdvSet::GetBracketMerge(TInt& aStartIndex, TInt& aFrames) const
       
  1418 	{
       
  1419 	aStartIndex = KBracketStartIndex;
       
  1420 	aFrames     = KBracketFrames;
       
  1421 	}
       
  1422 	
       
  1423 void CCamAdvSet::SetBracketMerge(TInt /*aStartIndex = 0*/, TInt /*aFrames = 2*/)
       
  1424 	{
       
  1425 	
       
  1426 	}
       
  1427 TInt CCamAdvSet::SupportedFlashModes() const
       
  1428 	{
       
  1429 	return (CCamera::EFlashVideoLight << 1) - 1;
       
  1430 	}
       
  1431 	
       
  1432 CCamera::TFlash CCamAdvSet::FlashMode() const
       
  1433 	{
       
  1434 	return CCamera::TFlash(iFlashMode);
       
  1435 	}
       
  1436 	
       
  1437 void CCamAdvSet::SetFlashMode(CCamera::TFlash aMode)
       
  1438 	{
       
  1439     iFlashMode = aMode;
       
  1440 	}
       
  1441 	
       
  1442 TBool CCamAdvSet::RedEyeReduceOn() const
       
  1443 	{
       
  1444 	return KDefaultRedEyeReduce;
       
  1445 	}
       
  1446 	
       
  1447 void CCamAdvSet::SetRedEyeReduceOn(TBool /*aState*/)
       
  1448 	{
       
  1449 	}
       
  1450 	
       
  1451 void CCamAdvSet::GetFlashCompensationStepsL(RArray<TInt>& /*aFlashCompensationSteps*/, TValueInfo& /*aInfo*/) const
       
  1452 	{
       
  1453 	
       
  1454 	}
       
  1455 	
       
  1456 TInt CCamAdvSet::FlashCompensationStep() const
       
  1457 	{
       
  1458 	return KFlashCompensationStep;
       
  1459 	}
       
  1460 
       
  1461 TInt CCamAdvSet::GetFlashCompensationStep(TInt& aFlashCompensationStep) const
       
  1462 	{
       
  1463 	aFlashCompensationStep = KFlashCompensationStep;
       
  1464 	return KErrNone;
       
  1465 	}
       
  1466 	
       
  1467 void CCamAdvSet::GetFlashCompensationRangeInSteps(TInt& /*aNegativeCompensation*/, TInt& /*aPositiveCompensation*/) const
       
  1468 	{
       
  1469 	
       
  1470 	}
       
  1471 void CCamAdvSet::SetFlashCompensationStep(TInt /*aFlashCompensationStep*/)
       
  1472 	{
       
  1473 	
       
  1474 	}
       
  1475 	
       
  1476 TInt CCamAdvSet::FlashCompensation() const
       
  1477 	{
       
  1478 	return KFlashCompensationInSteps;
       
  1479 	}
       
  1480 	
       
  1481 TInt CCamAdvSet::GetFlashCompensation(TInt& aFlashCompensation) const
       
  1482 	{
       
  1483 	aFlashCompensation = KFlashCompensationInSteps;
       
  1484 	return KErrNone;
       
  1485 	}
       
  1486 	
       
  1487 void CCamAdvSet::SetFlashCompensation(TInt /*aFlashCompensation*/)
       
  1488 	{
       
  1489 	}
       
  1490 	
       
  1491 TBool CCamAdvSet::IsExternalFlashPresent() const
       
  1492 	{
       
  1493 	return KExternalFlashPresentState;
       
  1494 	}
       
  1495 	
       
  1496 void CCamAdvSet::GetManualFlashPowerLevelsL(RArray<TInt>& /*aManualFlashPowerLevels*/, TValueInfo& /*aInfo*/) const
       
  1497 	{
       
  1498 	
       
  1499 	}
       
  1500 	
       
  1501 TInt CCamAdvSet::ManualFlashPowerLevel() const
       
  1502 	{
       
  1503 	return KManualFlashPowerLevel;
       
  1504 	}
       
  1505 	
       
  1506 void CCamAdvSet::SetManualFlashPowerLevel(TInt /*aManualFlashPowerLevel*/)
       
  1507 	{
       
  1508 	
       
  1509 	}
       
  1510 	
       
  1511 TInt CCamAdvSet::SupportedExposureModes() const
       
  1512 	{
       
  1513 	return CCamera::EExposureAuto;
       
  1514 	}
       
  1515 	
       
  1516 CCamera::TExposure CCamAdvSet::ExposureMode() const
       
  1517 	{
       
  1518 	return CCamera::EExposureAuto;
       
  1519 	}
       
  1520 	
       
  1521 void CCamAdvSet::SetExposureMode(CCamera::TExposure /*aExposureMode = CCamera::EExposureAuto*/)
       
  1522 	{
       
  1523 	}
       
  1524 	
       
  1525 void CCamAdvSet::GetExposureCompensationStepsL(RArray<TInt>& /*aExposureCompensationSteps*/, TValueInfo& /*aInfo*/) const
       
  1526 	{
       
  1527 	}
       
  1528 
       
  1529 void CCamAdvSet::GetExposureCompensationRangeInSteps(TInt& /*aNegativeCompensation*/, TInt& /*aPositiveCompensation*/) const
       
  1530 	{
       
  1531 	}
       
  1532 	
       
  1533 TInt CCamAdvSet::ExposureCompensationStep() const
       
  1534 	{
       
  1535 	return KExposureCompensationStep;
       
  1536 	}
       
  1537 	
       
  1538 TInt CCamAdvSet::GetExposureCompensationStep(TInt& aExposureCompensationStep) const
       
  1539 	{
       
  1540 	aExposureCompensationStep = KExposureCompensationStep;
       
  1541 	return KErrNone;
       
  1542 	}
       
  1543 	
       
  1544 void CCamAdvSet::SetExposureCompensationStep(TInt /*aExposureCompensationStep*/)
       
  1545 	{
       
  1546 	}
       
  1547 	
       
  1548 TInt CCamAdvSet::ExposureCompensation() const
       
  1549 	{
       
  1550 	return KExposureCompensationInSteps;
       
  1551 	}
       
  1552 	
       
  1553 TInt CCamAdvSet::GetExposureCompensation(TInt& aExposureCompensation) const
       
  1554 	{
       
  1555 	aExposureCompensation = KExposureCompensationInSteps;
       
  1556 	return KErrNone;
       
  1557 	}
       
  1558 	
       
  1559 void CCamAdvSet::SetExposureCompensation(TInt /*aExposureCompensation*/)
       
  1560 	{
       
  1561 	}
       
  1562 	
       
  1563 TInt CCamAdvSet::SupportedWhiteBalanceModes() const
       
  1564 	{
       
  1565 	return KWhiteBalanceSupported;
       
  1566 	}
       
  1567 	
       
  1568 CCamera::TWhiteBalance CCamAdvSet::WhiteBalanceMode() const
       
  1569 	{
       
  1570 	return iWhiteBalance;
       
  1571 	}
       
  1572 	
       
  1573 void CCamAdvSet::SetWhiteBalanceMode(CCamera::TWhiteBalance aWhiteBalanceMode)
       
  1574 	{
       
  1575 	TInt response = KErrNone;
       
  1576 	
       
  1577 	iWhiteBalance = aWhiteBalanceMode;
       
  1578 	RetrieveResult(response);
       
  1579 	
       
  1580 	iOwner.Notify(KUidECamEventCameraSettingsWBValue, response);
       
  1581 	}
       
  1582 	
       
  1583 TBool CCamAdvSet::ApertureExposureLockOn() const
       
  1584 	{
       
  1585 	return KApertureExposureLockOn;
       
  1586 	}
       
  1587 	
       
  1588 void CCamAdvSet::SetApertureExposureLockOn(TBool /*aAELock*/)
       
  1589 	{
       
  1590 	}
       
  1591 	
       
  1592 TBool CCamAdvSet::ShootClickOn() const
       
  1593 	{
       
  1594 	return KShootClickOn;
       
  1595 	}
       
  1596 	
       
  1597 void CCamAdvSet::SetShootClickOn(TBool /*aShootClickOn*/)
       
  1598 	{
       
  1599 	}
       
  1600 	
       
  1601 void CCamAdvSet::GetTimerIntervalsL(RArray<TInt>& /*aTimerIntervals*/, TValueInfo& /*aInfo*/) const
       
  1602 	{
       
  1603 	}
       
  1604 
       
  1605 TInt CCamAdvSet::TimerInterval() const
       
  1606 	{
       
  1607 	return KTimerInterval;
       
  1608 	}
       
  1609 	
       
  1610 void CCamAdvSet::SetTimerInterval(TInt /*aTimerInterval*/)
       
  1611 	{
       
  1612 	}
       
  1613 	
       
  1614 void CCamAdvSet::GetTimeLapsePeriodRange(TTime& /*aTimeLapseMin*/, TTime& /*aTimeLapseMax*/) const
       
  1615 	{
       
  1616 	}
       
  1617 	
       
  1618 void CCamAdvSet::GetTimeLapse(TTime& /*aStart*/, TTime& /*aEnd*/, TTime& /*aInterval*/) const
       
  1619 	{
       
  1620 	}
       
  1621 	
       
  1622 void CCamAdvSet::SetTimeLapse(const TTime& /*aStart*/, const TTime& /*aEnd*/, const TTime& /*aInterval*/)
       
  1623 	{
       
  1624 	}
       
  1625 	
       
  1626 CCamera::CCameraAdvancedSettings::TPictureOrientation CCamAdvSet::PictureOrientation() const
       
  1627 	{
       
  1628 	return CCamera::CCameraAdvancedSettings::EPictureOrientationUnknown;
       
  1629 	}
       
  1630 	
       
  1631 void CCamAdvSet::SetPictureOrientation(CCamera::CCameraAdvancedSettings::TPictureOrientation /*aOrientation*/)
       
  1632 	{
       
  1633 	}
       
  1634 	
       
  1635 TInt CCamAdvSet::SupportedPixelAspectRatios() const
       
  1636 	{
       
  1637 	return (CCamera::CCameraAdvancedSettings::EEPixelAspect40To33 << 1) - 1;
       
  1638 	}
       
  1639 	
       
  1640 CCamera::CCameraAdvancedSettings::TPixelAspectRatio CCamAdvSet::PixelAspectRatio() const
       
  1641 	{
       
  1642 	return CCamera::CCameraAdvancedSettings::TPixelAspectRatio(iPixelAspectRatio);
       
  1643 	}
       
  1644 	
       
  1645 void CCamAdvSet::SetPixelAspectRatio(CCamera::CCameraAdvancedSettings::TPixelAspectRatio aPixelAspectRatio)
       
  1646 	{
       
  1647 	iPixelAspectRatio = aPixelAspectRatio;
       
  1648 	}
       
  1649 	
       
  1650 TInt CCamAdvSet::SupportedYuvRanges() const
       
  1651 	{
       
  1652 	return CCamera::CCameraAdvancedSettings::EYuvRangeFull;
       
  1653 	}
       
  1654 	
       
  1655 CCamera::CCameraAdvancedSettings::TYuvRange CCamAdvSet::YuvRange() const
       
  1656 	{
       
  1657 	return CCamera::CCameraAdvancedSettings::EYuvRangeFull;
       
  1658 	}
       
  1659 	
       
  1660 void CCamAdvSet::SetYuvRange(CCamera::CCameraAdvancedSettings::TYuvRange /*aYuvRange*/)
       
  1661 	{
       
  1662 	
       
  1663 	}
       
  1664 TInt CCamAdvSet::BurstImages() const
       
  1665 	{
       
  1666 	return KBurstImages;
       
  1667 	}
       
  1668 	
       
  1669 void CCamAdvSet::SetBurstImages(TInt /*aImages*/)
       
  1670 	{
       
  1671 	}
       
  1672 	
       
  1673 void CCamAdvSet::GetOpticalZoomStepsL(RArray<TInt>& /*aOpticalZoomSteps*/, TValueInfo& /*aInfo*/)  const
       
  1674 	{
       
  1675 	}
       
  1676 	
       
  1677 TInt CCamAdvSet::OpticalZoom() const
       
  1678 	{
       
  1679 	return KECamFineResolutionFactor;
       
  1680 	}
       
  1681 	
       
  1682 void CCamAdvSet::SetOpticalZoom(TInt /*aOpticalZoom*/)
       
  1683 	{
       
  1684 	}
       
  1685 	
       
  1686 void CCamAdvSet::GetDigitalZoomStepsL(RArray<TInt>& /*aDigitalZoomSteps*/,
       
  1687 								 TValueInfo& /*aInfo*/) const
       
  1688 	{
       
  1689 	}
       
  1690 	
       
  1691 void CCamAdvSet::GetDigitalZoomStepsForStillL(RArray<TInt>& /*aDigitalZoomSteps*/, TValueInfo& /*aInfo*/, TInt /*aSizeIndex*/,
       
  1692 								 CCamera::TFormat /*aFormat*/, TBool& /*aIsInfluencePossible*/) const
       
  1693 	{
       
  1694 	}
       
  1695 
       
  1696 void CCamAdvSet::GetDigitalZoomStepsForVideoL(RArray<TInt>& /*aDigitalZoomSteps*/, TValueInfo& /*aInfo*/, TInt /*aFrameRateIndex*/,
       
  1697 								 TInt /*aSizeIndex*/, CCamera::TFormat /*aFormat*/, TBool& /*aIsInfluencePossible*/, CCamera::TExposure /*aExposure*/) const
       
  1698 	{
       
  1699 	}
       
  1700 
       
  1701 TInt CCamAdvSet::DigitalZoom() const
       
  1702 	{
       
  1703 	return KECamFineResolutionFactor;
       
  1704 	}
       
  1705 
       
  1706 void CCamAdvSet::SetDigitalZoom(TInt /*aDigitalZoom*/)
       
  1707 	{
       
  1708 	}
       
  1709 	
       
  1710 TBool CCamAdvSet::ExposureLockOn() const
       
  1711 	{
       
  1712 	return KExposureLockOn;		
       
  1713 	}
       
  1714 
       
  1715 void CCamAdvSet::SetExposureLockOn(TBool /*aState*/)
       
  1716 	{
       
  1717 	}
       
  1718 		
       
  1719 TBool CCamAdvSet::AutoFocusLockOn() const
       
  1720 	{
       
  1721 	return KAutoFocusLockOn;
       
  1722 	}
       
  1723 
       
  1724 void CCamAdvSet::SetAutoFocusLockOn(TBool /*aState*/)
       
  1725 	{	
       
  1726 	}
       
  1727 
       
  1728 void CCamAdvSet::GetSupportedSettingsL(RArray<TUid>& aSettings) const
       
  1729 	{
       
  1730 	aSettings.Reset();
       
  1731 	// if camera is present 
       
  1732 	if (iOwner.iCameras[iOwner.iCameraIndex])
       
  1733 		{
       
  1734 		aSettings.AppendL(KUidECamEventCameraSettingStabilizationMode);
       
  1735 		aSettings.AppendL(KUidECamEventCameraSettingFocusMode);
       
  1736 		aSettings.AppendL(KUidECamEventCameraSettingIsoRateType);
       
  1737 		}
       
  1738 	}
       
  1739     
       
  1740 void CCamAdvSet::GetActiveSettingsL(RArray<TUid>& aActiveSettings) const
       
  1741 	{
       
  1742 	aActiveSettings.Reset();
       
  1743 	if (iOwner.iCameras[iOwner.iCameraIndex])
       
  1744 		{
       
  1745 		aActiveSettings.AppendL(KUidECamEventCameraSettingFocusMode);
       
  1746 		aActiveSettings.AppendL(KUidECamEventCameraSettingAFAssistantLight);
       
  1747 		}
       
  1748 	}
       
  1749     
       
  1750  
       
  1751 void CCamAdvSet::GetDisabledSettingsL(RArray<TUid>& aDisbledSettings) const
       
  1752 	{
       
  1753 	aDisbledSettings.Reset();
       
  1754 	if (iOwner.iCameras[iOwner.iCameraIndex])
       
  1755 		{
       
  1756 		aDisbledSettings.AppendL(KUidECamEventCameraSettingStabilizationMode);
       
  1757 		aDisbledSettings.AppendL(KUidECamEventCameraSettingReferenceScreen);
       
  1758 		}
       
  1759 	}
       
  1760 	    
       
  1761 void CCamAdvSet::SetAutomaticSizeSelectionChangeOn(TBool /*aSetOn = EFalse*/)
       
  1762 	{
       
  1763 	}
       
  1764 	
       
  1765 TBool CCamAdvSet::AutomaticSizeSelectionChangeOn() const
       
  1766 	{
       
  1767 	return KAutomaticSizeSelectionChangeOn;
       
  1768 	}
       
  1769 
       
  1770 void CCamAdvSet::GetSupportedContinuousAutoFocusTimeoutsL(RArray<TInt>& /*aTimeouts*/, TValueInfo& /*aInfo*/) const
       
  1771 	{
       
  1772 	}
       
  1773 	
       
  1774 void CCamAdvSet::SetContinuousAutoFocusTimeout(TInt /*aTimeout*/)
       
  1775 	{
       
  1776 	}
       
  1777 	
       
  1778 void CCamAdvSet::SetStabilizationEffect(CCamera::CCameraAdvancedSettings::TStabilizationEffect /*aEffect*/)
       
  1779 	{
       
  1780 	}
       
  1781 	
       
  1782 CCamera::CCameraAdvancedSettings::TStabilizationEffect CCamAdvSet::StabilizationEffect() const
       
  1783 	{
       
  1784 	return CCamera::CCameraAdvancedSettings::EStabilizationOff;
       
  1785 	}
       
  1786 
       
  1787 TInt CCamAdvSet::SupportedStabilizationEffects() const
       
  1788 	{
       
  1789 	return CCamera::CCameraAdvancedSettings::EStabilizationOff;
       
  1790 	}
       
  1791 
       
  1792 TInt CCamAdvSet::SupportedStabilizationComplexityValues() const
       
  1793 	{
       
  1794 	return CCamera::CCameraAdvancedSettings::EStabilizationComplexityAuto;
       
  1795 	}
       
  1796 	
       
  1797 CCamera::CCameraAdvancedSettings::TStabilizationAlgorithmComplexity CCamAdvSet::StabilizationComplexity() const
       
  1798 	{
       
  1799 	return CCamera::CCameraAdvancedSettings::EStabilizationComplexityAuto;
       
  1800 	}
       
  1801 	
       
  1802 void CCamAdvSet::SetStabilizationComplexity(CCamera::CCameraAdvancedSettings::TStabilizationAlgorithmComplexity /*aComplexity*/)
       
  1803 	{
       
  1804 	}
       
  1805 	
       
  1806 CCamera::CCameraAdvancedSettings::TWBUnits CCamAdvSet::SupportedWBUnits() const
       
  1807 	{
       
  1808 	return CCamera::CCameraAdvancedSettings::EWBColorTemperature;
       
  1809 	}
       
  1810 	
       
  1811 void CCamAdvSet::SetWBRgbValue(const TRgb& /*aValue*/)
       
  1812 	{
       
  1813 	}
       
  1814 	
       
  1815 void CCamAdvSet::GetWBRgbValue(TRgb& /*aValue*/) const
       
  1816 	{
       
  1817 	}
       
  1818 	
       
  1819 void CCamAdvSet::GetWBSupportedColorTemperaturesL(RArray<TInt>& /*aWBColorTemperatures*/, TValueInfo& /*aInfo*/) const
       
  1820 	{
       
  1821 	}
       
  1822 	
       
  1823 void CCamAdvSet::SetWBColorTemperature(TInt /*aColorTemperature*/)
       
  1824 	{
       
  1825 	}
       
  1826 
       
  1827 TInt CCamAdvSet::WBColorTemperature() const
       
  1828 	{
       
  1829 	return KWBColorTemperature;
       
  1830 	}
       
  1831 
       
  1832 TInt CCamAdvSet::ContinuousAutoFocusTimeout() const
       
  1833 	{
       
  1834 	return KContinuousAutoFocusTimeoutValue;
       
  1835 	}
       
  1836 
       
  1837 TInt CCamAdvSet::IsFlashReady(TBool& aReady) const
       
  1838 	{
       
  1839 	aReady = KFlashReadyState;
       
  1840 	return KErrNone;
       
  1841 	}
       
  1842 
       
  1843 void CCamAdvSet::GetCurrentFocusModeStepsL(RArray<TInt>& /*aFocusModeSteps*/, TValueInfo& /*aInfo*/) const
       
  1844 	{
       
  1845 	}
       
  1846 	
       
  1847 void CCamAdvSet::SetReferenceScreen(CWsScreenDevice& /*aScreenDevice*/)
       
  1848 	{
       
  1849 	TInt error = KErrNone;
       
  1850 	
       
  1851 	RetrieveResult(error);
       
  1852 	
       
  1853 	iOwner.Notify(KUidECamEventCameraSettingReferenceScreen, error);
       
  1854 	}
       
  1855 	
       
  1856 void CCamAdvSet::GetPreCaptureWarningSupportedL(CCamera::CCameraAdvancedSettings::TCameraMode /*aCameraMode*/, TInt& /*aPreCaptureWarningSupported*/) const
       
  1857 	{
       
  1858 	}
       
  1859 
       
  1860 void CCamAdvSet::SubscribeToPreCaptureWarningL(TInt /*aPreCaptureWarning*/)
       
  1861 	{
       
  1862 	}
       
  1863 	
       
  1864 void CCamAdvSet::UnSubscribePreCaptureWarningL()
       
  1865 	{
       
  1866 	}
       
  1867 	
       
  1868 void CCamAdvSet::GetPreCaptureWarningL(TInt& /*aPreCaptureWarning*/) const
       
  1869 	{
       
  1870 	}
       
  1871 	
       
  1872 void CCamAdvSet::GetSupportedAFAssistantLightL(TInt& aSupportedAFAssistantLight) const
       
  1873 	{
       
  1874 	aSupportedAFAssistantLight = iSupportedAFAssistantLight;
       
  1875 	}
       
  1876 
       
  1877 void CCamAdvSet::GetAFAssistantLightL(CCamera::CCameraAdvancedSettings::TAFAssistantLight& aAFAssistantLight) const
       
  1878 	{
       
  1879 	aAFAssistantLight = iAFAssistantLight;
       
  1880 	}
       
  1881 
       
  1882 void CCamAdvSet::SetAFAssistantLight(CCamera::CCameraAdvancedSettings::TAFAssistantLight aAFAssistantLight)
       
  1883 	{
       
  1884 	TInt error = KErrNone;
       
  1885 	
       
  1886 	iAFAssistantLight = aAFAssistantLight;
       
  1887 	RetrieveResult(error);
       
  1888 	
       
  1889 	iOwner.Notify(KUidECamEventCameraSettingAFAssistantLight, error);
       
  1890 	}
       
  1891 
       
  1892 void CCamAdvSet::GetSupportedContinuousZoomTypeL(TUint& aSupportedContinuousZoomType) const
       
  1893 	{
       
  1894 	aSupportedContinuousZoomType = KSupportedContinuousZoomType;	
       
  1895 	}
       
  1896 
       
  1897 void CCamAdvSet::GetFocalLengthInfoL(TInt& /*aMinFocalLength*/, TInt& /*aCurrentFocalLength*/, TInt& /*aMaxFocalLength*/) const
       
  1898 	{
       
  1899 	User::Leave(KErrNotSupported);	
       
  1900 	}
       
  1901 	
       
  1902 void CCamAdvSet::GetNumOperationPreferenceL(TUint& /*aNumOperationPreferenceSupported*/) const
       
  1903 	{
       
  1904 	User::Leave(KErrNotSupported);		
       
  1905 	}
       
  1906 	
       
  1907 void CCamAdvSet::EnumerateOperationPreferenceL(TUint /*aOperationPreferenceIndex*/, CCamera::CCameraAdvancedSettings::
       
  1908 						TPerformanceLevel& /*aSpeedLevel*/, CCamera::CCameraAdvancedSettings::TPerformanceLevel& /*aQualityLevel*/, 
       
  1909 						CCamera::CCameraAdvancedSettings::TPerformanceLevel& /*aLowMemoryConsumptionLevel*/, 
       
  1910 						CCamera::CCameraAdvancedSettings::TPerformanceLevel& /*aLowPowerConsumptionLevel*/) const
       
  1911 	{
       
  1912 	User::Leave(KErrNotSupported);	
       
  1913 	}
       
  1914 	
       
  1915 void CCamAdvSet::SetOperationPreference(TUint /*aOperationPreferenceIndex*/)
       
  1916 	{
       
  1917 	iOwner.Notify(KUidECamEventCameraSettingOperationPreference, KErrNotSupported);
       
  1918 	}
       
  1919 	
       
  1920 	
       
  1921 void CCamAdvSet::GetOperationPreferenceL(TInt& /*aOperationPreferenceIndex*/) const
       
  1922 	{
       
  1923 	User::Leave(KErrNotSupported);		
       
  1924 	}
       
  1925 
       
  1926 void CCamAdvSet::GetSupportedEventsL(RArray<TUid>& aSupportedEvents) const
       
  1927 	{
       
  1928 	aSupportedEvents.Reset();
       
  1929 	}
       
  1930 	
       
  1931 void CCamAdvSet::GetIndirectFeatureChangesL(TUid /*aRequestedSetting*/, RArray<TUid>& aIndirectFeatureChanges) const
       
  1932 	{
       
  1933 	aIndirectFeatureChanges.Reset();
       
  1934 	}
       
  1935 
       
  1936 void CCamAdvSet::CreateContinuousZoomImplFactoryL(MImplementationFactory*& aImplFactoryPtr) const
       
  1937 	{
       
  1938 	aImplFactoryPtr = CContinuousZoomFactory::NewL();
       
  1939 	}
       
  1940 
       
  1941 void CCamAdvSet::RetrieveResult(TInt& aError)
       
  1942 	{
       
  1943 	//It is assumed that hardware retrieves this error
       
  1944 	//Assumed that it returns no error
       
  1945 	aError = KErrNone;
       
  1946 	}
       
  1947 /******************************************************/
       
  1948 
       
  1949 CCamManagement::CCamManagement(CCamUnitTestPlugin& aOwner): iOwner(aOwner)
       
  1950 	{
       
  1951 	}
       
  1952 	
       
  1953 CCamManagement::~CCamManagement()
       
  1954 	{
       
  1955 	}
       
  1956 	
       
  1957 void CCamManagement::Release()
       
  1958 	{
       
  1959 	delete this;
       
  1960 	}
       
  1961 	
       
  1962 CCamManagement* CCamManagement::NewL(CCamUnitTestPlugin& aOwner)
       
  1963 	{
       
  1964 	return new (ELeave) CCamManagement(aOwner);
       
  1965 	}
       
  1966 	
       
  1967 TBool CCamManagement::PlugCameraIn(TInt aIndex)
       
  1968 	{
       
  1969 	if (aIndex >= KECamSetAvailableCameras)
       
  1970 		{
       
  1971 		return EFalse;
       
  1972 		}
       
  1973 	else
       
  1974 		{
       
  1975 		TInt response = KErrNone;
       
  1976 		TUid uid;
       
  1977 		uid.iUid = (KUidECamEventGlobalCamera00PluggedInUidValue + aIndex);
       
  1978 		iOwner.iCameras[aIndex] = ETrue;
       
  1979 		iOwner.Notify(uid, response);
       
  1980 		}
       
  1981 	return ETrue;
       
  1982 	}
       
  1983 
       
  1984 TBool CCamManagement::PlugCameraOut(TInt aIndex)
       
  1985 	{
       
  1986 	if (aIndex >= KECamSetAvailableCameras)
       
  1987 		{
       
  1988 		return EFalse;
       
  1989 		}
       
  1990 	else
       
  1991 		{
       
  1992 		TInt response = KErrNone;
       
  1993 		TUid uid;
       
  1994 		uid.iUid  = KUidECamEventGlobalCamera00PluggedOutUidValue + aIndex;
       
  1995 		iOwner.iCameras[aIndex] = EFalse;
       
  1996 		iOwner.Notify(uid, response);
       
  1997 		}
       
  1998 	return ETrue;
       
  1999 	}
       
  2000 
       
  2001 
       
  2002 //
       
  2003 //Snapshot factory for Image
       
  2004 CContinuousZoomFactory* CContinuousZoomFactory::NewL()
       
  2005 	{
       
  2006 	CContinuousZoomFactory* self = new(ELeave) CContinuousZoomFactory();
       
  2007 	
       
  2008 	CleanupStack::PushL(self);
       
  2009 	self->ConstructL();
       
  2010 	CleanupStack::Pop();
       
  2011 	
       
  2012 	return self;
       
  2013 	}
       
  2014 	
       
  2015 void CContinuousZoomFactory::ConstructL()
       
  2016 	{
       
  2017 	}
       
  2018 
       
  2019 CContinuousZoomFactory::CContinuousZoomFactory() : iCamContinuousZoomImp(NULL)
       
  2020 	{
       
  2021 	}
       
  2022 	
       
  2023 CContinuousZoomFactory::~CContinuousZoomFactory()
       
  2024 	{
       
  2025 	}
       
  2026 	
       
  2027 TInt CContinuousZoomFactory::GetImpl(TAny*& /*aIfPtr*/, TUid /*aIfaceUid*/) const
       
  2028 	{
       
  2029 	return KErrNotSupported;
       
  2030 	}
       
  2031 	
       
  2032 TInt CContinuousZoomFactory::GetImpl1(TAny*& aIfPtr, TUid aIfaceUid, TECamImplFactoryParam aParam1) const
       
  2033 	{
       
  2034 	switch(aIfaceUid.iUid)	
       
  2035 		{
       
  2036 		case KECamMCameraContinuousZoomUidValue:
       
  2037 			{
       
  2038 			CCamera::CCameraAdvancedSettings::TContinuousZoomType zoomType = static_cast<CCamera::CCameraAdvancedSettings::TContinuousZoomType>(aParam1.iIntParam);
       
  2039 			iCamContinuousZoomImp = CCamContinuousZoom::NewL(zoomType);
       
  2040 			aIfPtr = static_cast<MCameraContinuousZoom*>(iCamContinuousZoomImp);
       
  2041 			return KErrNone;	
       
  2042 			}
       
  2043 		default:
       
  2044 			{
       
  2045 			aIfPtr = NULL;
       
  2046 			return KErrNotSupported;	
       
  2047 			}
       
  2048 		}	
       
  2049 	}
       
  2050 	
       
  2051 TInt CContinuousZoomFactory::GetImpl2(TAny*& /*aIfPtr*/, TUid /*aIfaceUid*/, TECamImplFactoryParam /*aParam1*/, TECamImplFactoryParam /*aParam2*/) const
       
  2052 	{
       
  2053 	return KErrNotSupported;	
       
  2054 	}
       
  2055 	
       
  2056 void CContinuousZoomFactory::Release()
       
  2057 	{
       
  2058 	delete this;
       
  2059 	}
       
  2060 
       
  2061 
       
  2062 CCamContinuousZoom* CCamContinuousZoom::NewL(CCamera::CCameraAdvancedSettings::TContinuousZoomType aContinuousZoomType)
       
  2063 	{
       
  2064 	CCamContinuousZoom* self = new (ELeave) CCamContinuousZoom(aContinuousZoomType);
       
  2065 	return self;
       
  2066 	}
       
  2067 
       
  2068 CCamContinuousZoom::CCamContinuousZoom(CCamera::CCameraAdvancedSettings::TContinuousZoomType aContinuousZoomType)
       
  2069 	: iZoomType(aContinuousZoomType)
       
  2070 	{
       
  2071 	iInfo.iMaxSpeedSupported = 10;
       
  2072 	iInfo.iMinAccelerationSupported = 0;
       
  2073 	iInfo.iMaxAccelerationSupported = 0;
       
  2074 	iInfo.iContinuousZoomMinLimit = 0;
       
  2075 	iInfo.iContinuousZoomMaxLimit = 10;
       
  2076 	}
       
  2077 
       
  2078 CCamContinuousZoom::~CCamContinuousZoom()
       
  2079 	{
       
  2080 	}
       
  2081 
       
  2082 void CCamContinuousZoom::SetContinuousZoomObserverAndHandle(MContinuousZoomObserver& aObserver, CCamera::CCameraContinuousZoom* aContinuousZoomHandle)
       
  2083 	{
       
  2084 	iObserver = &aObserver;
       
  2085 	iContinuousZoomHandle = aContinuousZoomHandle;
       
  2086 	}
       
  2087 
       
  2088 void CCamContinuousZoom::StartContinuousZoomL(CCamera::CCameraAdvancedSettings::TContinuousZoomParameters aContinuousZoomParameters)
       
  2089 	{
       
  2090 	if(aContinuousZoomParameters.Size() != sizeof(CCamera::CCameraAdvancedSettings::TContinuousZoomParameters) ||
       
  2091 			aContinuousZoomParameters.Version() != KContinuousZoomParametersCurrentVersion)
       
  2092 		{
       
  2093 		User::Leave(KErrNotSupported);
       
  2094 		}
       
  2095 
       
  2096 	if(aContinuousZoomParameters.iContinuousZoomSpeed > iInfo.iMaxSpeedSupported || 
       
  2097 			aContinuousZoomParameters.iContinuousZoomAcceleration < iInfo.iMinAccelerationSupported || 
       
  2098 			aContinuousZoomParameters.iContinuousZoomAcceleration > iInfo.iMaxAccelerationSupported || 
       
  2099 			aContinuousZoomParameters.iContinuousZoomLimit < iInfo.iContinuousZoomMinLimit ||
       
  2100 			aContinuousZoomParameters.iContinuousZoomLimit > iInfo.iContinuousZoomMaxLimit)
       
  2101 		{
       
  2102 		User::Leave(KErrArgument);
       
  2103 		}
       
  2104 	
       
  2105 	iParameters = aContinuousZoomParameters;
       
  2106 	for(TInt i = 0; i < iParameters.iContinuousZoomLimit; i++)
       
  2107 		{
       
  2108 		iObserver->ContinuousZoomProgress(*iContinuousZoomHandle, i, KErrNone);
       
  2109 		}
       
  2110 	
       
  2111 	iObserver->ContinuousZoomCompleted(*iContinuousZoomHandle, iParameters.iContinuousZoomLimit, KErrNone);
       
  2112 	}
       
  2113 
       
  2114 void CCamContinuousZoom::StopContinuousZoom()
       
  2115 	{
       
  2116 	return;
       
  2117 	}
       
  2118 
       
  2119 void CCamContinuousZoom::GetContinuousZoomSupportInfoL(CCamera::CCameraAdvancedSettings::TContinuousZoomSupportInfo& aContinuousZoomInfo) const
       
  2120 	{
       
  2121 	if(aContinuousZoomInfo.Size() != sizeof(CCamera::CCameraAdvancedSettings::TContinuousZoomSupportInfo) ||
       
  2122 			aContinuousZoomInfo.Version() != KContinuousZoomSupportInfoCurrentVersion)
       
  2123 		{
       
  2124 		User::Leave(KErrNotSupported);
       
  2125 		}
       
  2126 
       
  2127 	aContinuousZoomInfo = iInfo;
       
  2128 	}
       
  2129 
       
  2130 void CCamContinuousZoom::GetContinuousZoomId(TInt& aZoomId) const
       
  2131 	{
       
  2132 	aZoomId = (TInt)(this);
       
  2133 	}
       
  2134 
       
  2135 void CCamContinuousZoom::Release()
       
  2136 	{
       
  2137 	delete this;
       
  2138 	}