Update contrib.
1 // Copyright (c) 2007-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // testadvancedsettings.cpp
18 #include "test_advanced_settings.h"
19 #include <ecamerrors.h>
20 #include "ecamversion.h"
22 CTestCamAdvSet::CTestCamAdvSet(CTestCamera& aOwner): iOwner(aOwner)
27 CTestCamAdvSet::~CTestCamAdvSet()
29 iSupportedISORates.Close();
30 iSupportedApertures.Close();
31 iSupportedShutterSpeeds.Close();
33 CDataGlobal* globalData = static_cast <CDataGlobal*> (Dll::Tls());
34 if(globalData != NULL)
36 if(!globalData->iTestCamPresets && !globalData->iTestCamSnapshot && !globalData->iTestCamImgProc)
43 globalData->iTestCamAdvSet = NULL;
44 Dll::SetTls(globalData);
49 CTestCamAdvSet* CTestCamAdvSet::NewL(CTestCamera& aOwner)
51 CDataGlobal* globalData = static_cast <CDataGlobal*> (Dll::Tls());
53 if(globalData == NULL)
55 globalData = new (ELeave) CDataGlobal;
56 CleanupStack::PushL(globalData);
57 globalData->iAdvSetReferenceCount = 0;
58 globalData->iTestCamAdvSet = new (ELeave) CTestCamAdvSet(aOwner);
59 CleanupStack::PushL(globalData->iTestCamAdvSet);
60 globalData->iTestCamAdvSet->ConstructL();
61 globalData->iTestCamAdvSet->iRefCount = 1;
62 User::LeaveIfError(Dll::SetTls(globalData));
63 CleanupStack::Pop(globalData->iTestCamAdvSet);
64 CleanupStack::Pop(globalData);
65 return globalData->iTestCamAdvSet;
69 if(globalData->iTestCamAdvSet == NULL)
71 globalData->iAdvSetReferenceCount = 0;
72 globalData->iTestCamAdvSet = new (ELeave) CTestCamAdvSet(aOwner);
73 CleanupStack::PushL(globalData->iTestCamAdvSet);
74 globalData->iTestCamAdvSet->ConstructL();
75 globalData->iTestCamAdvSet->iRefCount = 1;
76 User::LeaveIfError(Dll::SetTls(globalData));
77 CleanupStack::Pop(globalData->iTestCamAdvSet);
78 return globalData->iTestCamAdvSet;
81 CTestCamAdvSet* self = globalData->iTestCamAdvSet;
83 globalData->iAdvSetReferenceCount++;
84 self->iRefCount = globalData->iAdvSetReferenceCount + 1;
85 if (globalData->iAdvSetReferenceCount == KNumOfAdvSetExtensions-1 )
87 globalData->iTestCamAdvSet = NULL;
88 if(!globalData->iTestCamPresets && !globalData->iTestCamSnapshot && !globalData->iTestCamImgProc)
95 User::LeaveIfError(Dll::SetTls(globalData));
100 User::LeaveIfError(Dll::SetTls(globalData));
106 void CTestCamAdvSet::Release()
111 iOwner.iAdvSettingsImpl = NULL;
116 void CTestCamAdvSet::Init()
118 for(TUint i=0; i< KNumAvailableCameras; i++)
120 iCameraTypes[i] = CCamera::CCameraAdvancedSettings::ECameraPluggable;
123 iFocusDistance = KDefaultFocusDistance;
124 iIsoRate = KDefaultIsoRate;
125 iISORateType = CCamera::CCameraAdvancedSettings::EISOManual;
126 iAperture = KDefaultAperture;
127 iShutterSpeed = KDefaultShutterSpeed;
130 void CTestCamAdvSet::ConstructL()
132 iSupportedISORates.Reset();
133 iSupportedISORates.AppendL(KDefaultIsoRate);
135 iSupportedApertures.Reset();
136 iSupportedApertures.AppendL(KDefaultAperture);
138 iSupportedShutterSpeeds.Reset();
139 iSupportedShutterSpeeds.AppendL(KDefaultShutterSpeed);
142 CCamera::CCameraAdvancedSettings::TCameraType CTestCamAdvSet::CameraType() const
144 return CCamera::CCameraAdvancedSettings::ECameraPluggable;
147 CCamera::CCameraAdvancedSettings::TCameraType CTestCamAdvSet::CameraType(TInt aCameraIndex) const
149 if (aCameraIndex >= KNumAvailableCameras || aCameraIndex < 0)
151 return CCamera::CCameraAdvancedSettings::ECameraUnknown;
155 return iCameraTypes[aCameraIndex];
159 TBool CTestCamAdvSet::IsCameraPresent() const
164 TBool CTestCamAdvSet::IsCameraPresent(TInt aCameraIndex) const
166 if (aCameraIndex >= KNumAvailableCameras || aCameraIndex < 0)
176 TInt CTestCamAdvSet::CameraIndex() const
178 return iOwner.iCameraIndex;
181 TInt CTestCamAdvSet::SupportedStabilizationModes() const
183 return KFeatureNotSupported;
186 CCamera::CCameraAdvancedSettings::TStabilizationMode CTestCamAdvSet::StabilizationMode() const
188 return CCamera::CCameraAdvancedSettings::EStabilizationModeOff;
191 void CTestCamAdvSet::SetStabilizationMode(CCamera::CCameraAdvancedSettings::TStabilizationMode aStabilizationMode)
193 TInt eventError = KErrNotSupported;
194 if(aStabilizationMode == CCamera::CCameraAdvancedSettings::EStabilizationModeOff)
196 eventError = KErrAlreadyExists;
199 TECAMEvent ecamevent(KUidECamEventCameraSettingStabilizationMode, eventError);
201 iOwner.iECamEvent = ecamevent;
202 iOwner.iHandleEventAsync.CallBack();
205 TInt CTestCamAdvSet::SupportedFocusModes() const
207 return KFeatureNotSupported;
210 CCamera::CCameraAdvancedSettings::TFocusMode CTestCamAdvSet::FocusMode() const
212 return CCamera::CCameraAdvancedSettings::EFocusModeAuto;
215 void CTestCamAdvSet::SetFocusMode(CCamera::CCameraAdvancedSettings::TFocusMode aFocusMode)
217 TInt eventError = KErrNotSupported;
218 if(aFocusMode == CCamera::CCameraAdvancedSettings::EFocusModeAuto)
220 eventError = KErrAlreadyExists;
223 TECAMEvent ecamevent(KUidECamEventCameraSettingFocusMode, eventError);
225 iOwner.iECamEvent = ecamevent;
226 iOwner.iHandleEventAsync.CallBack();
229 TInt CTestCamAdvSet::SupportedFocusRanges() const
231 return KFeatureNotSupported;
234 CCamera::CCameraAdvancedSettings::TFocusRange CTestCamAdvSet::FocusRange() const
236 return CCamera::CCameraAdvancedSettings::EFocusRangeAuto;
239 void CTestCamAdvSet::SetFocusRange(CCamera::CCameraAdvancedSettings::TFocusRange aFocusRange)
241 TInt eventError = KErrNotSupported;
242 if(aFocusRange == CCamera::CCameraAdvancedSettings::EFocusRangeAuto)
244 eventError = KErrAlreadyExists;
247 TECAMEvent ecamevent1(KUidECamEventCameraSettingFocusRange2, eventError);
248 TECAMEvent ecamevent2(KUidECamEventCameraSettingFocusRange, eventError);
250 iOwner.iECamEvent = ecamevent1;
251 iOwner.iHandleEventAsync.CallBack();
253 iOwner.iECamEvent = ecamevent2;
254 iOwner.iHandleEventAsync.CallBack();
257 TInt CTestCamAdvSet::SupportedAutoFocusTypes() const
259 return KFeatureNotSupported;
262 CCamera::CCameraAdvancedSettings::TAutoFocusType CTestCamAdvSet::AutoFocusType() const
264 return CCamera::CCameraAdvancedSettings::EAutoFocusTypeOff;
267 void CTestCamAdvSet::SetAutoFocusType(CCamera::CCameraAdvancedSettings::TAutoFocusType aAutoFocusType)
269 TInt eventError = KErrNotSupported;
270 if(aAutoFocusType == CCamera::CCameraAdvancedSettings::EAutoFocusTypeOff)
272 eventError = KErrAlreadyExists;
275 TECAMEvent ecamevent1(KUidECamEventCameraSettingAutoFocusType2, eventError);
276 TECAMEvent ecamevent2(KUidECamEventCameraSettingAutoFocusType, eventError);
278 iOwner.iECamEvent = ecamevent1;
279 iOwner.iHandleEventAsync.CallBack();
281 iOwner.iECamEvent = ecamevent2;
282 iOwner.iHandleEventAsync.CallBack();
285 TInt CTestCamAdvSet::SupportedAutoFocusAreas() const
287 return KFeatureNotSupported;
290 CCamera::CCameraAdvancedSettings::TAutoFocusArea CTestCamAdvSet::AutoFocusArea() const
292 return CCamera::CCameraAdvancedSettings::EAutoFocusTypeAuto;
295 void CTestCamAdvSet::SetAutoFocusArea(CCamera::CCameraAdvancedSettings::TAutoFocusArea aAutoFocusArea)
297 TInt eventError = KErrNotSupported;
298 if(aAutoFocusArea == CCamera::CCameraAdvancedSettings::EAutoFocusTypeAuto)
300 eventError = KErrAlreadyExists;
303 TECAMEvent ecamevent(KUidECamEventCameraSettingAutoFocusArea, eventError);
305 iOwner.iECamEvent = ecamevent;
306 iOwner.iHandleEventAsync.CallBack();
309 TInt CTestCamAdvSet::FocusDistance() const
311 return iFocusDistance;
314 void CTestCamAdvSet::SetFocusDistance(TInt aDistance)
316 TInt eventError = KErrNone;
319 eventError = KErrNotSupported;
323 iFocusDistance = aDistance;
326 TECAMEvent ecamevent(KUidECamEventCameraSettingFocusDistance, eventError);
328 iOwner.iECamEvent = ecamevent;
329 iOwner.iHandleEventAsync.CallBack();
332 TInt CTestCamAdvSet::GetMinFocalLength() const
334 return KErrNotSupported;
337 void CTestCamAdvSet::GetSupportedIsoRatesL(RArray<TInt>& aSupportedIsoRates) const
339 if(iSupportedISORates.Count() == 0)
341 User::Leave(KErrNotSupported);
344 for(TInt index=0; index < iSupportedISORates.Count(); index++)
346 aSupportedIsoRates.AppendL(iSupportedISORates[index]);
350 TInt CTestCamAdvSet::IsoRate() const
355 void CTestCamAdvSet::SetIsoRate(TInt aRate)
357 TInt eventError = KErrNone;
358 if(iSupportedISORates.Find(aRate) == KErrNotFound)
360 eventError = KErrECamParameterNotInRange;
364 //set the ISO type to Manual
365 iISORateType = CCamera::CCameraAdvancedSettings::EISOManual;
369 TECAMEvent ecamevent(KUidECamEventCameraSettingIsoRate, eventError);
371 iOwner.iECamEvent = ecamevent;
372 iOwner.iHandleEventAsync.CallBack();
375 void CTestCamAdvSet::GetSupportedISORateTypeL(TInt& aSupportedISORateTypes) const
377 aSupportedISORateTypes = KSupportedISORateTypes;
380 void CTestCamAdvSet::SetISORate(CCamera::CCameraAdvancedSettings::TISORateType aISORateType, TInt aParam)
382 TInt eventError = KErrNone;
384 if(!(aISORateType & KSupportedISORateTypes) || iSupportedISORates.Count() == 0)
386 eventError = KErrNotSupported;
392 case CCamera::CCameraAdvancedSettings::EISOManual:
394 if(iSupportedISORates.Find(aParam) == KErrNotFound)
396 eventError = KErrECamParameterNotInRange;
400 iISORateType = aISORateType;
401 if(aParam == iIsoRate)
403 eventError = KErrAlreadyExists;
412 case CCamera::CCameraAdvancedSettings::EISOAutoUnPrioritised:
414 eventError = KErrNotSupported;
417 case CCamera::CCameraAdvancedSettings::EISOAutoISOPrioritised:
419 eventError = KErrNotSupported;
422 case CCamera::CCameraAdvancedSettings::EISOAutoShutterSpeedPrioritised:
424 eventError = KErrNotSupported;
427 case CCamera::CCameraAdvancedSettings::EISOAutoAperturePrioritised:
429 eventError = KErrNotSupported;
433 eventError = KErrNotSupported;
437 TECAMEvent ecamevent(KUidECamEventCameraSettingIsoRateType, eventError);
439 iOwner.iECamEvent = ecamevent;
440 iOwner.iHandleEventAsync.CallBack();
443 void CTestCamAdvSet::GetISORateL(CCamera::CCameraAdvancedSettings::TISORateType& aISORateType, TInt& /*aParam*/, TInt& aISORate) const
445 //If camera has no ISO rate supported, then leave
446 if(iSupportedISORates.Count() == 0)
448 User::Leave(KErrNotSupported);
451 aISORateType = iISORateType;
453 // aParam is redundant for manual ISO.
456 void CTestCamAdvSet::GetAperturesL(RArray<TInt>& aFStops, TValueInfo& aInfo) const
458 if(iSupportedApertures.Count() == 0)
464 for(TInt index=0; index < iSupportedApertures.Count(); index++)
466 aFStops.AppendL(iSupportedApertures[index]);
469 aInfo = EDiscreteSteps;
472 TInt CTestCamAdvSet::Aperture() const
477 void CTestCamAdvSet::SetAperture(TInt aFStop)
479 TInt eventError = KErrNone;
480 if(iSupportedApertures.Find(aFStop) == KErrNotFound)
482 eventError = KErrECamParameterNotInRange;
489 TECAMEvent ecamevent(KUidECamEventCameraSettingAperture, eventError);
491 iOwner.iECamEvent = ecamevent;
492 iOwner.iHandleEventAsync.CallBack();
495 void CTestCamAdvSet::GetShutterSpeedsL(RArray<TInt>& aShutterSpeeds, TValueInfo& aInfo) const
497 if(iSupportedShutterSpeeds.Count() == 0)
499 aShutterSpeeds.Reset();
503 for(TInt index=0; index < iSupportedShutterSpeeds.Count(); index++)
505 aShutterSpeeds.AppendL(iSupportedShutterSpeeds[index]);
506 aInfo = EDiscreteSteps;
510 TInt CTestCamAdvSet::ShutterSpeed() const
512 return iShutterSpeed;
515 void CTestCamAdvSet::SetShutterSpeed(TInt aShutterSpeed)
517 TInt eventError = KErrNone;
518 if(iSupportedShutterSpeeds.Find(aShutterSpeed) == KErrNotFound)
520 eventError = KErrECamParameterNotInRange;
524 iShutterSpeed = aShutterSpeed;
527 TECAMEvent ecamevent(KUidECamEventCameraSettingShutterSpeed, eventError);
529 iOwner.iECamEvent = ecamevent;
530 iOwner.iHandleEventAsync.CallBack();
533 TInt CTestCamAdvSet::SupportedMeteringModes() const
535 return KFeatureNotSupported;
538 CCamera::CCameraAdvancedSettings::TMeteringMode CTestCamAdvSet::MeteringMode() const
540 return CCamera::CCameraAdvancedSettings::EMeteringModeAuto;
543 void CTestCamAdvSet::SetMeteringMode(CCamera::CCameraAdvancedSettings::TMeteringMode aMeteringMode)
545 TInt eventError = KErrNotSupported;
546 if(aMeteringMode == CCamera::CCameraAdvancedSettings::EMeteringModeAuto)
548 eventError = KErrAlreadyExists;
551 TECAMEvent ecamevent(KUidECamEventCameraSettingMeteringMode, eventError);
553 iOwner.iECamEvent = ecamevent;
554 iOwner.iHandleEventAsync.CallBack();
557 TInt CTestCamAdvSet::SupportedDriveModes() const
559 return KSupportedDriveModes;
562 CCamera::CCameraAdvancedSettings::TDriveMode CTestCamAdvSet::DriveMode() const
564 return iOwner.iDriveMode;
567 void CTestCamAdvSet::SetDriveMode(CCamera::CCameraAdvancedSettings::TDriveMode aDriveMode)
569 TInt eventError = KErrNone;
570 if(iOwner.iVideoCaptureActive || iOwner.iImageCaptureActive)
572 eventError = KErrNotReady;
576 if(!(aDriveMode & KSupportedDriveModes))
578 eventError = KErrNotSupported;
582 if(eventError == KErrNone)
584 iOwner.iDriveMode = aDriveMode;
589 TECAMEvent ecamevent(KUidECamEventCameraSettingDriveMode, eventError);
591 iOwner.iECamEvent = ecamevent;
592 iOwner.iHandleEventAsync.CallBack();
595 TInt CTestCamAdvSet::SupportedBracketModes() const
597 return KFeatureNotSupported;
600 CCamera::CCameraAdvancedSettings::TBracketMode CTestCamAdvSet::BracketMode() const
602 return CCamera::CCameraAdvancedSettings::EBracketModeOff;
605 void CTestCamAdvSet::SetBracketMode(CCamera::CCameraAdvancedSettings::TBracketMode aBracketMode)
607 TInt eventError = KErrNotSupported;
608 if(aBracketMode == CCamera::CCameraAdvancedSettings::EBracketModeOff)
610 eventError = KErrAlreadyExists;
613 TECAMEvent ecamevent(KUidECamEventCameraSettingBracketMode, eventError);
615 iOwner.iECamEvent = ecamevent;
616 iOwner.iHandleEventAsync.CallBack();
619 TInt CTestCamAdvSet::SupportedBracketParameters() const
621 return KFeatureNotSupported;
624 CCamera::CCameraAdvancedSettings::TBracketParameter CTestCamAdvSet::BracketParameter() const
626 return CCamera::CCameraAdvancedSettings::EBracketParameterNone;
629 void CTestCamAdvSet::SetBracketParameter(CCamera::CCameraAdvancedSettings::TBracketParameter aBracketParameter)
631 TInt eventError = KErrNotSupported;
632 if(aBracketParameter == CCamera::CCameraAdvancedSettings::EBracketParameterNone)
634 eventError = KErrAlreadyExists;
637 TECAMEvent ecamevent(KUidECamEventCameraSettingBracketParameter, eventError);
639 iOwner.iECamEvent = ecamevent;
640 iOwner.iHandleEventAsync.CallBack();
643 TInt CTestCamAdvSet::SupportedBracketSteps() const
645 return KFeatureNotSupported;
648 CCamera::CCameraAdvancedSettings::TBracketStep CTestCamAdvSet::BracketStep() const
650 return CCamera::CCameraAdvancedSettings::EBracketStepNonConfig;
653 void CTestCamAdvSet::SetBracketStep(CCamera::CCameraAdvancedSettings::TBracketStep aBracketStep)
655 TInt eventError = KErrNotSupported;
656 if(aBracketStep == CCamera::CCameraAdvancedSettings::EBracketStepNonConfig)
658 eventError = KErrAlreadyExists;
661 TECAMEvent ecamevent(KUidECamEventCameraSettingBracketStep, eventError);
663 iOwner.iECamEvent = ecamevent;
664 iOwner.iHandleEventAsync.CallBack();
667 void CTestCamAdvSet::GetBracketMerge(TInt& aStartIndex, TInt& aFrames) const
669 aStartIndex = KFeatureNotSupported;
670 aFrames = KFeatureNotSupported;
673 void CTestCamAdvSet::SetBracketMerge(TInt /*aStartIndex*/ , TInt /*aFrames*/)
675 TECAMEvent ecamevent(KUidECamEventBracketMerge, KErrNotSupported);
677 iOwner.iECamEvent = ecamevent;
678 iOwner.iHandleEventAsync.CallBack();
681 TInt CTestCamAdvSet::SupportedFlashModes() const
683 return KFeatureNotSupported;
686 CCamera::TFlash CTestCamAdvSet::FlashMode() const
688 return CCamera::EFlashNone;
691 void CTestCamAdvSet::SetFlashMode(CCamera::TFlash /*aMode*/)
693 TECAMEvent ecamevent(KUidECamEventCameraSettingFlashMode, KErrNotSupported);
695 iOwner.iECamEvent = ecamevent;
696 iOwner.iHandleEventAsync.CallBack();
699 TBool CTestCamAdvSet::RedEyeReduceOn() const
701 return KDefaultRedEyeReduce;
704 void CTestCamAdvSet::SetRedEyeReduceOn(TBool /*aState*/)
706 TECAMEvent ecamevent(KUidECamEventCameraSettingFlashRedEyeReduce, KErrNotSupported);
708 iOwner.iECamEvent = ecamevent;
709 iOwner.iHandleEventAsync.CallBack();
712 void CTestCamAdvSet::GetFlashCompensationStepsL(RArray<TInt>& aFlashCompensationSteps, TValueInfo& aInfo) const
714 aFlashCompensationSteps.Reset();
718 TInt CTestCamAdvSet::FlashCompensationStep() const
720 return KFlashCompensationStep;
723 TInt CTestCamAdvSet::GetFlashCompensationStep(TInt& aFlashCompensationStep) const
725 aFlashCompensationStep = KFlashCompensationStep;
729 void CTestCamAdvSet::GetFlashCompensationRangeInSteps(TInt& aNegativeCompensation, TInt& aPositiveCompensation) const
731 aNegativeCompensation = KFlashCompensationStep;
732 aPositiveCompensation = KFlashCompensationStep;
735 void CTestCamAdvSet::SetFlashCompensationStep(TInt /*aFlashCompensationStep*/)
737 TECAMEvent ecamevent(KUidECamEventCameraSettingFlashCompensationStep, KErrNotSupported);
739 iOwner.iECamEvent = ecamevent;
740 iOwner.iHandleEventAsync.CallBack();
743 TInt CTestCamAdvSet::FlashCompensation() const
745 return KFlashCompensationStep;
748 TInt CTestCamAdvSet::GetFlashCompensation(TInt& aFlashCompensation) const
750 aFlashCompensation = KFlashCompensationStep;
754 void CTestCamAdvSet::SetFlashCompensation(TInt /*aFlashCompensation*/)
756 TECAMEvent ecamevent(KUidECamEventCameraSettingFlashCompensation, KErrNotSupported);
758 iOwner.iECamEvent = ecamevent;
759 iOwner.iHandleEventAsync.CallBack();
762 TBool CTestCamAdvSet::IsExternalFlashPresent() const
764 return KExternalFlashPresentState;
767 void CTestCamAdvSet::GetManualFlashPowerLevelsL(RArray<TInt>& aManualFlashPowerLevels, TValueInfo& aInfo) const
769 aManualFlashPowerLevels.Reset();
773 TInt CTestCamAdvSet::ManualFlashPowerLevel() const
775 return KErrNotSupported;
778 void CTestCamAdvSet::SetManualFlashPowerLevel(TInt /*aManualFlashPowerLevel*/)
780 TECAMEvent ecamevent(KUidECamEventCameraSettingFlashManualPower, KErrNotSupported);
782 iOwner.iECamEvent = ecamevent;
783 iOwner.iHandleEventAsync.CallBack();
786 TInt CTestCamAdvSet::SupportedExposureModes() const
788 return CCamera::EExposureAuto;
791 CCamera::TExposure CTestCamAdvSet::ExposureMode() const
793 return CCamera::EExposureAuto;
796 void CTestCamAdvSet::SetExposureMode(CCamera::TExposure aExposureMode)
798 TInt eventError = KErrNotSupported;
799 if(aExposureMode == CCamera::EExposureAuto)
801 eventError = KErrAlreadyExists;
804 TECAMEvent ecamevent(KUidECamEventCameraSettingExposureMode, eventError);
806 iOwner.iECamEvent = ecamevent;
807 iOwner.iHandleEventAsync.CallBack();
810 void CTestCamAdvSet::GetExposureCompensationStepsL(RArray<TInt>& aExposureCompensationSteps, TValueInfo& aInfo) const
812 aExposureCompensationSteps.Reset();
816 void CTestCamAdvSet::GetExposureCompensationRangeInSteps(TInt& aNegativeCompensation, TInt& aPositiveCompensation) const
818 aNegativeCompensation = KExposureCompensationStep;
819 aPositiveCompensation = KExposureCompensationStep;
822 TInt CTestCamAdvSet::ExposureCompensationStep() const
824 return KExposureCompensationStep;
827 TInt CTestCamAdvSet::GetExposureCompensationStep(TInt& aExposureCompensationStep) const
829 aExposureCompensationStep = KExposureCompensationStep;
833 void CTestCamAdvSet::SetExposureCompensationStep(TInt /*aExposureCompensationStep*/)
835 TECAMEvent ecamevent(KUidECamEventCameraSettingExposureCompensationStep, KErrNotSupported);
837 iOwner.iECamEvent = ecamevent;
838 iOwner.iHandleEventAsync.CallBack();
841 TInt CTestCamAdvSet::ExposureCompensation() const
843 return KExposureCompensationStep;
846 TInt CTestCamAdvSet::GetExposureCompensation(TInt& aExposureCompensation) const
848 aExposureCompensation = KExposureCompensationStep;
852 void CTestCamAdvSet::SetExposureCompensation(TInt /*aExposureCompensation*/)
854 TECAMEvent ecamevent(KUidECamEventCameraSettingExposureCompensation, KErrNotSupported);
856 iOwner.iECamEvent = ecamevent;
857 iOwner.iHandleEventAsync.CallBack();
860 TInt CTestCamAdvSet::SupportedWhiteBalanceModes() const
862 return KFeatureNotSupported;
865 CCamera::TWhiteBalance CTestCamAdvSet::WhiteBalanceMode() const
867 return CCamera::EWBAuto;
870 void CTestCamAdvSet::SetWhiteBalanceMode(CCamera::TWhiteBalance aWhiteBalanceMode)
872 TInt eventError = KErrNotSupported;
873 if(aWhiteBalanceMode == CCamera::EWBAuto)
875 eventError = KErrAlreadyExists;
878 TECAMEvent ecamevent(KUidECamEventCameraSettingWhiteBalanceMode, eventError);
880 iOwner.iECamEvent = ecamevent;
881 iOwner.iHandleEventAsync.CallBack();
884 TBool CTestCamAdvSet::ApertureExposureLockOn() const
886 return KApertureExposureLockOn;
889 void CTestCamAdvSet::SetApertureExposureLockOn(TBool /*aAELock*/)
891 TECAMEvent ecamevent(KUidECamEventAELock, KErrNotSupported);
893 iOwner.iECamEvent = ecamevent;
894 iOwner.iHandleEventAsync.CallBack();
897 TBool CTestCamAdvSet::ShootClickOn() const
899 return KShootClickOn;
902 void CTestCamAdvSet::SetShootClickOn(TBool /*aShootClickOn*/)
904 TECAMEvent ecamevent(KUidECamEventSoundClick, KErrNotSupported);
906 iOwner.iECamEvent = ecamevent;
907 iOwner.iHandleEventAsync.CallBack();
910 void CTestCamAdvSet::GetTimerIntervalsL(RArray<TInt>& aTimerIntervals, TValueInfo& aInfo) const
912 aTimerIntervals.Reset();
916 TInt CTestCamAdvSet::TimerInterval() const
918 return KErrNotSupported;
921 void CTestCamAdvSet::SetTimerInterval(TInt /*aTimerInterval*/)
923 TECAMEvent ecamevent(KUidECamEventCameraSettingTimerInterval, KErrNotSupported);
925 iOwner.iECamEvent = ecamevent;
926 iOwner.iHandleEventAsync.CallBack();
929 void CTestCamAdvSet::GetTimeLapsePeriodRange(TTime& aTimeLapseMin, TTime& aTimeLapseMax) const
931 TTime timeLapse(KTimeLapse);
932 aTimeLapseMin = aTimeLapseMax = timeLapse;
935 void CTestCamAdvSet::GetTimeLapse(TTime& aStart, TTime& aEnd, TTime& aInterval) const
937 TTime timeLapse(KTimeLapse);
938 aStart = aEnd = aInterval = timeLapse;
941 void CTestCamAdvSet::SetTimeLapse(const TTime& /*aStart*/, const TTime& /*aEnd*/, const TTime& /*aInterval*/)
943 TECAMEvent ecamevent(KUidECamEventCameraSettingTimeLapse, KErrNotSupported);
945 iOwner.iECamEvent = ecamevent;
946 iOwner.iHandleEventAsync.CallBack();
949 CCamera::CCameraAdvancedSettings::TPictureOrientation CTestCamAdvSet::PictureOrientation() const
951 return CCamera::CCameraAdvancedSettings::EPictureOrientationUnknown;
954 void CTestCamAdvSet::SetPictureOrientation(CCamera::CCameraAdvancedSettings::TPictureOrientation aOrientation)
956 TInt eventError = KErrNotSupported;
958 if(iOwner.iVideoCaptureActive || iOwner.iImageCaptureActive)
960 eventError = KErrNotReady;
964 if(aOrientation == CCamera::CCameraAdvancedSettings::EPictureOrientationUnknown)
966 eventError = KErrAlreadyExists;
970 TECAMEvent ecamevent(KUidECamEventCameraSettingPictureOrientation, eventError);
972 iOwner.iECamEvent = ecamevent;
973 iOwner.iHandleEventAsync.CallBack();
976 TInt CTestCamAdvSet::SupportedPixelAspectRatios() const
978 return KSupportedPixelAspectRatio;
981 CCamera::CCameraAdvancedSettings::TPixelAspectRatio CTestCamAdvSet::PixelAspectRatio() const
983 return CCamera::CCameraAdvancedSettings::EPixelAspectUnknown;
986 void CTestCamAdvSet::SetPixelAspectRatio(CCamera::CCameraAdvancedSettings::TPixelAspectRatio aPixelAspectRatio)
988 TInt eventError = KErrNotSupported;
990 if(aPixelAspectRatio == CCamera::CCameraAdvancedSettings::EPixelAspectUnknown)
992 eventError = KErrAlreadyExists;
995 TECAMEvent ecamevent(KUidECamEventPixelAspectRatio, eventError);
997 iOwner.iECamEvent = ecamevent;
998 iOwner.iHandleEventAsync.CallBack();
1001 TInt CTestCamAdvSet::SupportedYuvRanges() const
1003 return KSupportedYuvRange;
1006 CCamera::CCameraAdvancedSettings::TYuvRange CTestCamAdvSet::YuvRange() const
1008 return CCamera::CCameraAdvancedSettings::EYuvRangeUnknown;
1011 void CTestCamAdvSet::SetYuvRange(CCamera::CCameraAdvancedSettings::TYuvRange aYuvRange)
1013 TInt eventError = KErrNotSupported;
1015 if(aYuvRange == CCamera::CCameraAdvancedSettings::EYuvRangeUnknown)
1017 eventError = KErrAlreadyExists;
1020 TECAMEvent ecamevent(KUidECamEventYuvRange, eventError);
1022 iOwner.iECamEvent = ecamevent;
1023 iOwner.iHandleEventAsync.CallBack();
1026 TInt CTestCamAdvSet::BurstImages() const
1028 return iOwner.iBurstImages;
1031 void CTestCamAdvSet::SetBurstImages(TInt aImages)
1033 TInt eventError = iOwner.CheckReserveAndPower();
1035 if(eventError == KErrNone)
1037 if(aImages == iOwner.iBurstImages)
1039 eventError = KErrAlreadyExists;
1045 eventError = KErrArgument;
1050 if(eventError != KErrNone)
1052 TECAMEvent ecamevent(KUidECamEventBurstImages, eventError);
1054 iOwner.iECamEvent = ecamevent;
1055 iOwner.iHandleEventAsync.CallBack();
1059 if(aImages > KMaxBurstImages)
1061 iOwner.iBurstImages = KMaxBurstImages;
1065 iOwner.iBurstImages = aImages;
1068 TECAMEvent ecamevent(KUidECamEventBurstImages, eventError);
1070 iOwner.iECamEvent = ecamevent;
1071 iOwner.iHandleEventAsync.CallBack();
1074 void CTestCamAdvSet::GetOpticalZoomStepsL(RArray<TInt>& aOpticalZoomSteps, TValueInfo& aInfo) const
1076 aOpticalZoomSteps.Reset();
1077 aOpticalZoomSteps.AppendL(KECamFineResolutionFactor);
1078 aInfo = EDiscreteSteps;
1081 TInt CTestCamAdvSet::OpticalZoom() const
1083 return KECamFineResolutionFactor;
1086 void CTestCamAdvSet::SetOpticalZoom(TInt aOpticalZoom)
1088 TInt eventError = KErrNotSupported;
1090 if(aOpticalZoom == KECamFineResolutionFactor)
1092 eventError = KErrAlreadyExists;
1095 TECAMEvent ecamevent(KUidECamEventCameraSettingOpticalZoom, eventError);
1097 iOwner.iECamEvent = ecamevent;
1098 iOwner.iHandleEventAsync.CallBack();
1101 void CTestCamAdvSet::GetDigitalZoomStepsL(RArray<TInt>& aDigitalZoomSteps,
1102 TValueInfo& aInfo) const
1104 aDigitalZoomSteps.Reset();
1105 aDigitalZoomSteps.AppendL(KECamFineResolutionFactor);
1106 aInfo = EDiscreteSteps;
1109 void CTestCamAdvSet::GetDigitalZoomStepsForStillL(RArray<TInt>& aDigitalZoomSteps, TValueInfo& aInfo, TInt /*aSizeIndex*/,
1110 CCamera::TFormat /*aFormat*/, TBool& /*aIsInfluencePossible*/) const
1112 aDigitalZoomSteps.Reset();
1113 aDigitalZoomSteps.AppendL(KECamFineResolutionFactor);
1114 aInfo = EDiscreteSteps;
1117 void CTestCamAdvSet::GetDigitalZoomStepsForVideoL(RArray<TInt>& aDigitalZoomSteps, TValueInfo& aInfo, TInt /*aFrameRateIndex*/,
1118 TInt /*aSizeIndex*/, CCamera::TFormat /*aFormat*/, TBool& /*aIsInfluencePossible*/, CCamera::TExposure /*aExposure*/) const
1120 aDigitalZoomSteps.Reset();
1121 aDigitalZoomSteps.AppendL(KECamFineResolutionFactor);
1122 aInfo = EDiscreteSteps;
1125 TInt CTestCamAdvSet::DigitalZoom() const
1127 return KECamFineResolutionFactor;
1130 void CTestCamAdvSet::SetDigitalZoom(TInt aDigitalZoom)
1132 TInt eventError = KErrNotSupported;
1134 if(aDigitalZoom == KECamFineResolutionFactor)
1136 eventError = KErrAlreadyExists;
1139 TECAMEvent ecamevent(KUidECamEventCameraSettingDigitalZoom, eventError);
1141 iOwner.iECamEvent = ecamevent;
1142 iOwner.iHandleEventAsync.CallBack();
1145 TBool CTestCamAdvSet::ExposureLockOn() const
1147 return KExposureLockOn;
1150 void CTestCamAdvSet::SetExposureLockOn(TBool aState)
1152 TInt eventError = KErrNotSupported;
1154 if(aState == KExposureLockOn)
1156 eventError = KErrAlreadyExists;
1159 TECAMEvent ecamevent(KUidECamEventCameraSettingExposureLock, eventError);
1161 iOwner.iECamEvent = ecamevent;
1162 iOwner.iHandleEventAsync.CallBack();
1165 TBool CTestCamAdvSet::AutoFocusLockOn() const
1167 return KAutoFocusLockOn;
1170 void CTestCamAdvSet::SetAutoFocusLockOn(TBool aState)
1172 TInt eventError = KErrNotSupported;
1174 if(aState == KAutoFocusLockOn)
1176 eventError = KErrAlreadyExists;
1179 TECAMEvent ecamevent(KUidECamEventCameraSettingAutoFocusLock, eventError);
1181 iOwner.iECamEvent = ecamevent;
1182 iOwner.iHandleEventAsync.CallBack();
1185 void CTestCamAdvSet::GetSupportedSettingsL(RArray<TUid>& aSettings) const
1188 User::Leave(KErrNotSupported);
1191 void CTestCamAdvSet::GetActiveSettingsL(RArray<TUid>& aActiveSettings) const
1193 aActiveSettings.Reset();
1194 User::Leave(KErrNotSupported);
1197 void CTestCamAdvSet::GetDisabledSettingsL(RArray<TUid>& aDisbledSettings) const
1199 aDisbledSettings.Reset();
1200 User::Leave(KErrNotSupported);
1203 void CTestCamAdvSet::SetAutomaticSizeSelectionChangeOn(TBool aSetOn)
1205 TInt eventError = KErrNotSupported;
1207 if(aSetOn == KAutomaticSizeSelectionChangeOn)
1209 eventError = KErrAlreadyExists;
1212 TECAMEvent ecamevent(KUidECamEventCameraSettingAutomaticSizeSelection, eventError);
1214 iOwner.iECamEvent = ecamevent;
1215 iOwner.iHandleEventAsync.CallBack();
1218 TBool CTestCamAdvSet::AutomaticSizeSelectionChangeOn() const
1220 return KAutomaticSizeSelectionChangeOn;
1223 void CTestCamAdvSet::GetSupportedContinuousAutoFocusTimeoutsL(RArray<TInt>& aTimeouts, TValueInfo& aInfo) const
1229 void CTestCamAdvSet::SetContinuousAutoFocusTimeout(TInt /*aTimeout*/)
1231 TECAMEvent ecamevent(KUidECamEventCameraSettingsContinuousAutoFocusTimeout, KErrNotSupported);
1233 iOwner.iECamEvent = ecamevent;
1234 iOwner.iHandleEventAsync.CallBack();
1237 void CTestCamAdvSet::SetStabilizationEffect(CCamera::CCameraAdvancedSettings::TStabilizationEffect aEffect)
1239 TInt eventError = KErrNotSupported;
1241 if(aEffect == KStabilizationEffect)
1243 eventError = KErrAlreadyExists;
1246 TECAMEvent ecamevent(KUidECamEventCameraSettingsStabilizationEffect, eventError);
1248 iOwner.iECamEvent = ecamevent;
1249 iOwner.iHandleEventAsync.CallBack();
1252 CCamera::CCameraAdvancedSettings::TStabilizationEffect CTestCamAdvSet::StabilizationEffect() const
1254 return KStabilizationEffect;
1257 TInt CTestCamAdvSet::SupportedStabilizationEffects() const
1259 return KStabilizationEffect;
1262 TInt CTestCamAdvSet::SupportedStabilizationComplexityValues() const
1264 return KStabilizationComplexity;
1267 CCamera::CCameraAdvancedSettings::TStabilizationAlgorithmComplexity CTestCamAdvSet::StabilizationComplexity() const
1269 return KStabilizationComplexity;
1272 void CTestCamAdvSet::SetStabilizationComplexity(CCamera::CCameraAdvancedSettings::TStabilizationAlgorithmComplexity aComplexity)
1274 TInt eventError = KErrNotSupported;
1276 if(aComplexity == KStabilizationComplexity)
1278 eventError = KErrAlreadyExists;
1281 TECAMEvent ecamevent(KUidECamEventSettingsStabilizationAlgorithmComplexity, eventError);
1283 iOwner.iECamEvent = ecamevent;
1284 iOwner.iHandleEventAsync.CallBack();
1287 CCamera::CCameraAdvancedSettings::TWBUnits CTestCamAdvSet::SupportedWBUnits() const
1289 return KSupportedWBUnits;
1292 void CTestCamAdvSet::SetWBRgbValue(const TRgb& /*aValue*/)
1294 TECAMEvent ecamevent(KUidECamEventCameraSettingsWBValue, KErrNotSupported);
1296 iOwner.iECamEvent = ecamevent;
1297 iOwner.iHandleEventAsync.CallBack();
1300 void CTestCamAdvSet::GetWBRgbValue(TRgb& aValue) const
1305 void CTestCamAdvSet::GetWBSupportedColorTemperaturesL(RArray<TInt>& aWBColorTemperatures, TValueInfo& aInfo) const
1307 aWBColorTemperatures.Reset();
1311 void CTestCamAdvSet::SetWBColorTemperature(TInt /*aColorTemperature*/)
1313 TECAMEvent ecamevent(KUidECamEventCameraSettingsWBValue, KErrNotSupported);
1315 iOwner.iECamEvent = ecamevent;
1316 iOwner.iHandleEventAsync.CallBack();
1319 TInt CTestCamAdvSet::WBColorTemperature() const
1321 return KErrNotSupported;
1324 TInt CTestCamAdvSet::ContinuousAutoFocusTimeout() const
1326 return KErrNotSupported;
1329 TInt CTestCamAdvSet::IsFlashReady(TBool& aReady) const
1331 aReady = KFlashReadyState;
1335 void CTestCamAdvSet::GetCurrentFocusModeStepsL(RArray<TInt>& aFocusModeSteps, TValueInfo& aInfo) const
1337 aFocusModeSteps.Reset();
1341 void CTestCamAdvSet::SetReferenceScreen(CWsScreenDevice& /*aScreenDevice*/)
1343 TECAMEvent ecamevent(KUidECamEventCameraSettingReferenceScreen, KErrNotSupported);
1345 iOwner.iECamEvent = ecamevent;
1346 iOwner.iHandleEventAsync.CallBack();
1349 void CTestCamAdvSet::GetPreCaptureWarningSupportedL(CCamera::CCameraAdvancedSettings::TCameraMode /*aCameraMode*/, TInt& aPreCaptureWarningSupported) const
1351 aPreCaptureWarningSupported = KPreCaptureWarning;
1354 void CTestCamAdvSet::SubscribeToPreCaptureWarningL(TInt /*aPreCaptureWarning*/)
1356 User::Leave(KErrNotSupported);
1359 void CTestCamAdvSet::UnSubscribePreCaptureWarningL()
1361 User::Leave(KErrNotSupported);
1364 void CTestCamAdvSet::GetPreCaptureWarningL(TInt& /*aPreCaptureWarning*/) const
1366 User::Leave(KErrNotSupported);
1369 void CTestCamAdvSet::GetSupportedAFAssistantLightL(TInt& aSupportedAFAssistantLight) const
1371 aSupportedAFAssistantLight = KAFAssisstantLight;
1374 void CTestCamAdvSet::GetAFAssistantLightL(CCamera::CCameraAdvancedSettings::TAFAssistantLight& /*aAFAssistantLight*/) const
1376 User::Leave(KErrNotSupported);
1379 void CTestCamAdvSet::SetAFAssistantLight(CCamera::CCameraAdvancedSettings::TAFAssistantLight aAFAssistantLight)
1381 TInt eventError = KErrNotSupported;
1383 if(aAFAssistantLight == KAFAssisstantLight)
1385 eventError = KErrAlreadyExists;
1388 TECAMEvent ecamevent(KUidECamEventCameraSettingAFAssistantLight, eventError);
1390 iOwner.iECamEvent = ecamevent;
1391 iOwner.iHandleEventAsync.CallBack();
1394 /**********************************************************************************************************/
1395 /* CTestCamPresets */
1396 /**********************************************************************************************************/
1398 CTestCamPresets::CTestCamPresets(CTestCamera& aOwner): iOwner(aOwner),iCurrentPreset(KNullUid)
1401 CTestCamPresets::~CTestCamPresets()
1403 iSupportedPresets.Close();
1404 iFactoryPresetAffectSettings.Close();
1406 CDataGlobal* globalData = static_cast <CDataGlobal*> (Dll::Tls());
1407 if(globalData != NULL)
1409 if(!globalData->iTestCamAdvSet && !globalData->iTestCamSnapshot && !globalData->iTestCamImgProc)
1416 globalData->iTestCamPresets = NULL;
1417 Dll::SetTls(globalData);
1422 CTestCamPresets* CTestCamPresets::NewL(CTestCamera& aOwner)
1424 CDataGlobal* globalData = static_cast <CDataGlobal*> (Dll::Tls());
1426 if(globalData == NULL)
1428 globalData = new (ELeave) CDataGlobal;
1429 CleanupStack::PushL(globalData);
1430 globalData->iPresetsReferenceCount = 0;
1431 globalData->iTestCamPresets = new (ELeave) CTestCamPresets(aOwner);
1432 globalData->iTestCamPresets->ConstructL();
1433 globalData->iTestCamPresets->iRefCount = 1;
1434 User::LeaveIfError(Dll::SetTls(globalData));
1435 CleanupStack::Pop(globalData);
1436 return globalData->iTestCamPresets;
1440 if(globalData->iTestCamPresets == NULL)
1442 globalData->iPresetsReferenceCount = 0;
1443 globalData->iTestCamPresets = new (ELeave) CTestCamPresets(aOwner);
1444 CleanupStack::PushL(globalData->iTestCamPresets);
1445 globalData->iTestCamPresets->ConstructL();
1446 globalData->iTestCamPresets->iRefCount = 1;
1447 User::LeaveIfError(Dll::SetTls(globalData));
1448 CleanupStack::Pop(globalData->iTestCamPresets);
1449 return globalData->iTestCamPresets;
1452 CTestCamPresets* self = globalData->iTestCamPresets;
1454 globalData->iPresetsReferenceCount++;
1455 self->iRefCount = globalData->iPresetsReferenceCount + 1;
1456 if (globalData->iPresetsReferenceCount == KNumOfPresetExtensions-1 )
1458 globalData->iTestCamPresets = NULL;
1459 if(!globalData->iTestCamAdvSet && !globalData->iTestCamSnapshot && !globalData->iTestCamImgProc)
1466 User::LeaveIfError(Dll::SetTls(globalData));
1471 User::LeaveIfError(Dll::SetTls(globalData));
1477 void CTestCamPresets::Release()
1486 void CTestCamPresets::ConstructL()
1488 iSupportedPresets.Reset();
1489 iSupportedPresets.AppendL(KUidECamPresetFactoryDefault);
1491 iFactoryPresetAffectSettings.Reset();
1492 iFactoryPresetAffectSettings.AppendL(KUidECamEventCameraSettingDriveMode);
1493 iFactoryPresetAffectSettings.AppendL(KUidECamEventBurstImages);
1496 void CTestCamPresets::GetSupportedPresetsL(RArray<TUid>& aPresets) const
1499 for (TInt index=0; index < iSupportedPresets.Count(); index++)
1501 User::LeaveIfError(aPresets.Append(iSupportedPresets[index]));
1505 void CTestCamPresets::SetPreset(TUid aPreset)
1507 TInt eventError = iOwner.CheckReserveAndPower();
1508 if(eventError == KErrNone)
1510 if(aPreset == iSupportedPresets[0])
1512 //ResetBrightness, Contrast, Drivemode, No. of burst mode images
1513 iOwner.iBrightness = 0;
1514 iOwner.iContrast = 0;
1515 iOwner.iImgProcBrightness = 0;
1516 iOwner.iImgProcContrast = 0;
1517 iOwner.iDriveMode = KDefaultDriveMode;
1518 iOwner.iBurstImages = KBurstImages;
1522 eventError = KErrNotSupported;
1526 TECAMEvent ecamevent(aPreset, eventError);
1528 iOwner.iECamEvent = ecamevent;
1529 iOwner.iHandleEventAsync.CallBack();
1532 TUid CTestCamPresets::Preset() const
1534 return iCurrentPreset;
1537 void CTestCamPresets::GetAffectedSettingsL(RArray<TUid>& aSettings) const
1541 if(iCurrentPreset == iSupportedPresets[0])
1543 for (TInt index=0; index < iFactoryPresetAffectSettings.Count(); index++)
1545 User::LeaveIfError(aSettings.Append(iFactoryPresetAffectSettings[index]));
1550 void CTestCamPresets::GetAssociatedSettingsL(TUid aPreset, RArray<TUid>& aSettings) const
1552 switch(aPreset.iUid)
1554 case KUidECamPresetFactoryDefaultUidValue:
1557 for (TInt index=0; index < iFactoryPresetAffectSettings.Count(); index++)
1559 User::LeaveIfError(aSettings.Append(iFactoryPresetAffectSettings[index]));
1565 case KUidECamPresetOutdoorUidValue:
1566 case KUidECamPresetOutdoorSportUidValue:
1567 case KUidECamPresetSnowUidValue:
1568 case KUidECamPresetBeachUidValue:
1569 case KUidECamPresetNightPortraitUidValue:
1570 case KUidECamPresetNightFireworksUidValue:
1571 case KUidECamPresetFogUidValue:
1572 case KUidECamPresetIndoorUidValue:
1573 case KUidECamPresetIndoorSportUidValue:
1575 User::Leave(KErrNotSupported);
1578 case KUidECamPresetNightPartyIndoorUidValue:
1579 case KUidECamPresetNightCloseUpUidValue:
1580 case KUidECamPresetNightMacroUidValue:
1581 case KUidECamPresetTextDocumentUidValue:
1582 case KUidECamPresetBarcodeUidValue:
1583 case KUidECamPresetAutoUidValue:
1584 case KUidECamPresetPortraitUidValue:
1585 case KUidECamPresetLandscapeUidValue:
1586 case KUidECamPresetAmbienceMoodUidValue:
1588 if(iOwner.CameraVersion() == KCameraDefaultVersion)
1590 User::Leave(KErrArgument);
1594 User::Leave(KErrNotSupported);
1599 User::Leave(KErrArgument);