os/mm/imagingandcamerafws/cameraunittest/src/ecamramplugin/ecamramplugin.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/imagingandcamerafws/cameraunittest/src/ecamramplugin/ecamramplugin.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,364 @@
     1.4 +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#include <f32file.h>
    1.20 +#include <ecom/ecom.h>
    1.21 +#include <ecom/implementationproxy.h>
    1.22 +#include <ecam.h>
    1.23 +#include "ecamramplugin.h"
    1.24 +#include "ecamrampluginuids.hrh"
    1.25 +
    1.26 +	
    1.27 +//
    1.28 +// CCameraRamPlugin
    1.29 +//
    1.30 +CCameraRamPlugin::CCameraRamPlugin()
    1.31 +	{
    1.32 +	}
    1.33 +	
    1.34 +CCameraRamPlugin::~CCameraRamPlugin()
    1.35 +	{
    1.36 +	}
    1.37 +	
    1.38 +CCameraRamPlugin* CCameraRamPlugin::NewL()
    1.39 +	{
    1.40 +	FileDependencyUtil::CheckFileDependencyL();
    1.41 +	return new (ELeave) CCameraRamPlugin;
    1.42 +	}
    1.43 +	
    1.44 +// 
    1.45 +// 2nd stage ConstructL calls called by framework
    1.46 +//
    1.47 +
    1.48 +void CCameraRamPlugin::Construct2L(MCameraObserver& aObserver,TInt aCameraIndex)
    1.49 +	{
    1.50 +	iObserver = &aObserver;
    1.51 +	iCameraIndex = aCameraIndex;
    1.52 +	}
    1.53 +	
    1.54 +void CCameraRamPlugin::Construct2DupL(MCameraObserver& aObserver,TInt aCameraHandle)
    1.55 +	{
    1.56 +	iObserver = &aObserver;
    1.57 +	iCameraHandle = aCameraHandle;
    1.58 +	}
    1.59 +
    1.60 +
    1.61 +void CCameraRamPlugin::Construct2L(MCameraObserver2& aObserver,TInt aCameraIndex,TInt aPriority)
    1.62 +	{
    1.63 +	iObserver2 = &aObserver;
    1.64 +	iCameraIndex = aCameraIndex;
    1.65 +	iPriority = aPriority;
    1.66 +	}
    1.67 +	
    1.68 +void CCameraRamPlugin::Construct2DupL(MCameraObserver2& aObserver,TInt aCameraHandle)
    1.69 +	{
    1.70 +	iObserver2 = &aObserver;
    1.71 +	iCameraHandle = aCameraHandle;
    1.72 +	}
    1.73 +
    1.74 +
    1.75 +	
    1.76 +//
    1.77 +// Dummy versions of virtual functions
    1.78 +//
    1.79 +
    1.80 +void CCameraRamPlugin::CameraInfo(TCameraInfo& /*aInfo*/) const
    1.81 +	{
    1.82 +	}
    1.83 +
    1.84 +void CCameraRamPlugin::Reserve()
    1.85 +	{
    1.86 +	}
    1.87 +
    1.88 +
    1.89 +void CCameraRamPlugin::Release()
    1.90 +	{
    1.91 +	}
    1.92 +
    1.93 +void CCameraRamPlugin::PowerOn()
    1.94 +	{
    1.95 +	}
    1.96 +
    1.97 +void CCameraRamPlugin::PowerOff()
    1.98 +	{
    1.99 +	}
   1.100 +
   1.101 +TInt CCameraRamPlugin::Handle()
   1.102 +	{
   1.103 +	return 0;
   1.104 +	}
   1.105 +
   1.106 +void CCameraRamPlugin::SetZoomFactorL(TInt /*aZoomFactor = 0*/)
   1.107 +	{
   1.108 +	User::Leave(KErrNotSupported);
   1.109 +	}
   1.110 +
   1.111 +TInt CCameraRamPlugin::ZoomFactor() const
   1.112 +	{
   1.113 +	return 0;
   1.114 +	}
   1.115 +
   1.116 +void CCameraRamPlugin::SetDigitalZoomFactorL(TInt /*aDigitalZoomFactor = 0*/)
   1.117 +	{
   1.118 +	User::Leave(KErrNotSupported);
   1.119 +	}
   1.120 +
   1.121 +TInt CCameraRamPlugin::DigitalZoomFactor() const
   1.122 +	{
   1.123 +	return 0;
   1.124 +	}
   1.125 +
   1.126 +void CCameraRamPlugin::SetContrastL(TInt /*aContrast*/)
   1.127 +	{
   1.128 +	User::Leave(KErrNotSupported);
   1.129 +	}
   1.130 +
   1.131 +TInt CCameraRamPlugin::Contrast() const
   1.132 +	{
   1.133 +	return 0;
   1.134 +	}
   1.135 +
   1.136 +void CCameraRamPlugin::SetBrightnessL(TInt /*aBrightness*/)
   1.137 +	{
   1.138 +	User::Leave(KErrNotSupported);
   1.139 +	}
   1.140 +
   1.141 +TInt CCameraRamPlugin::Brightness() const
   1.142 +	{
   1.143 +	return 0;
   1.144 +	}
   1.145 +
   1.146 +
   1.147 +void CCameraRamPlugin::SetFlashL(TFlash /*aFlash = EFlashNone*/)
   1.148 +	{
   1.149 +	User::Leave(KErrNotSupported);
   1.150 +	}
   1.151 +
   1.152 +CCamera::TFlash CCameraRamPlugin::Flash() const
   1.153 +	{
   1.154 +	return EFlashNone;
   1.155 +	}
   1.156 +
   1.157 +void CCameraRamPlugin::SetExposureL(TExposure /*aExposure = EExposureAuto*/)
   1.158 +	{
   1.159 +	User::Leave(KErrNotSupported);
   1.160 +	}
   1.161 +
   1.162 +CCamera::TExposure CCameraRamPlugin::Exposure() const
   1.163 +	{
   1.164 +	return EExposureAuto;
   1.165 +	}
   1.166 +
   1.167 +void CCameraRamPlugin::SetWhiteBalanceL(TWhiteBalance /*aWhiteBalance = EWBAuto*/)
   1.168 +	{
   1.169 +	}
   1.170 +
   1.171 +CCamera::TWhiteBalance CCameraRamPlugin::WhiteBalance() const
   1.172 +	{
   1.173 +	return EWBAuto;
   1.174 +	}
   1.175 +
   1.176 +void CCameraRamPlugin::StartViewFinderDirectL(RWsSession& /*aWs*/,CWsScreenDevice& /*aScreenDevice*/,RWindowBase& /*aWindow*/,TRect& /*aScreenRect*/)
   1.177 +	{
   1.178 +	User::Leave(KErrNotSupported);
   1.179 +	}
   1.180 +
   1.181 +void CCameraRamPlugin::StartViewFinderDirectL(RWsSession& /*aWs*/,CWsScreenDevice& /*aScreenDevice*/,RWindowBase& /*aWindow*/,TRect& /*aScreenRect*/,TRect& /*aClipRect*/)
   1.182 +	{
   1.183 +	User::Leave(KErrNotSupported);
   1.184 +	}
   1.185 +
   1.186 +void CCameraRamPlugin::StartViewFinderBitmapsL(TSize& /*aSize*/)
   1.187 +	{
   1.188 +	User::Leave(KErrNotSupported);
   1.189 +	}
   1.190 +	
   1.191 +void CCameraRamPlugin::StartViewFinderBitmapsL(TSize& /*aSize*/,TRect& /*aClipRect*/)
   1.192 +	{
   1.193 +	User::Leave(KErrNotSupported);
   1.194 +	}
   1.195 +
   1.196 +
   1.197 +void CCameraRamPlugin::StartViewFinderL(TFormat /*aImageFormat*/,TSize& /*aSize*/)
   1.198 +	{
   1.199 +	User::Leave(KErrNotSupported);
   1.200 +	}
   1.201 +
   1.202 +void CCameraRamPlugin::StartViewFinderL(TFormat /*aImageFormat*/,TSize& /*aSize*/,TRect& /*aClipRect*/)
   1.203 +	{
   1.204 +	User::Leave(KErrNotSupported);
   1.205 +	}
   1.206 +
   1.207 +
   1.208 +void CCameraRamPlugin::StopViewFinder()
   1.209 +	{
   1.210 +	}
   1.211 +
   1.212 +TBool CCameraRamPlugin::ViewFinderActive() const
   1.213 +	{
   1.214 +	return EFalse;
   1.215 +	}
   1.216 +
   1.217 +void CCameraRamPlugin::SetViewFinderMirrorL(TBool /*aMirror*/)
   1.218 +	{
   1.219 +	}
   1.220 +
   1.221 +TBool CCameraRamPlugin::ViewFinderMirror() const
   1.222 +	{
   1.223 +	return EFalse;
   1.224 +	}
   1.225 +
   1.226 +void CCameraRamPlugin::PrepareImageCaptureL(TFormat /*aImageFormat*/,TInt /*aSizeIndex*/)
   1.227 +	{
   1.228 +	User::Leave(KErrNotSupported);
   1.229 +	}
   1.230 +
   1.231 +void CCameraRamPlugin::PrepareImageCaptureL(TFormat /*aImageFormat*/,TInt /*aSizeIndex*/,const TRect& /*aClipRect*/)
   1.232 +	{
   1.233 +	User::Leave(KErrNotSupported);
   1.234 +	}
   1.235 +
   1.236 +void CCameraRamPlugin::CaptureImage()
   1.237 +	{
   1.238 +	}
   1.239 +
   1.240 +void CCameraRamPlugin::CancelCaptureImage()
   1.241 +	{
   1.242 +	}
   1.243 +
   1.244 +void CCameraRamPlugin::EnumerateCaptureSizes(TSize& /*aSize*/,TInt /*aSizeIndex*/,TFormat /*aFormat*/) const
   1.245 +	{
   1.246 +	}
   1.247 +
   1.248 +void CCameraRamPlugin::PrepareVideoCaptureL(TFormat /*aFormat*/,TInt /*aSizeIndex*/,TInt /*aRateIndex*/,TInt /*aBuffersToUse*/,TInt /*aFramesPerBuffer*/)
   1.249 +	{
   1.250 +	User::Leave(KErrNotSupported);
   1.251 +	}
   1.252 +
   1.253 +void CCameraRamPlugin::PrepareVideoCaptureL(TFormat /*aFormat*/,TInt /*aSizeIndex*/,TInt /*aRateIndex*/,TInt /*aBuffersToUse*/,TInt /*aFramesPerBuffer*/,const TRect& /*aClipRect*/)
   1.254 +	{
   1.255 +	User::Leave(KErrNotSupported);
   1.256 +	}
   1.257 +
   1.258 +void CCameraRamPlugin::StartVideoCapture()
   1.259 +	{
   1.260 +	}
   1.261 +
   1.262 +void CCameraRamPlugin::StopVideoCapture()
   1.263 +	{
   1.264 +	}
   1.265 +
   1.266 +TBool CCameraRamPlugin::VideoCaptureActive() const
   1.267 +	{
   1.268 +	return EFalse;
   1.269 +	}
   1.270 +
   1.271 +void CCameraRamPlugin::EnumerateVideoFrameSizes(TSize& /*aSize*/,TInt /*aSizeIndex*/,TFormat /*aFormat*/) const
   1.272 +	{
   1.273 +	}
   1.274 +
   1.275 +void CCameraRamPlugin::EnumerateVideoFrameRates(TReal32& /*aRate*/,TInt /*aRateIndex*/,TFormat /*aFormat*/,TInt /*aSizeIndex*/,TExposure /*aExposure = EExposureAuto*/) const
   1.276 +	{
   1.277 +	}
   1.278 +
   1.279 +void CCameraRamPlugin::GetFrameSize(TSize& /*aSize*/) const
   1.280 +	{
   1.281 +	}
   1.282 +
   1.283 +TReal32 CCameraRamPlugin::FrameRate() const
   1.284 +	{
   1.285 +	return 0.0;
   1.286 +	}
   1.287 +
   1.288 +TInt CCameraRamPlugin::BuffersInUse() const
   1.289 +	{
   1.290 +	return 0;
   1.291 +	}
   1.292 +
   1.293 +TInt CCameraRamPlugin::FramesPerBuffer() const
   1.294 +	{
   1.295 +	return 0;
   1.296 +	}
   1.297 +
   1.298 +void CCameraRamPlugin::SetJpegQuality(TInt /*aQuality*/)
   1.299 +	{
   1.300 +	}
   1.301 +
   1.302 +TInt CCameraRamPlugin::JpegQuality() const
   1.303 +	{
   1.304 +	return 0;
   1.305 +	}
   1.306 +
   1.307 +TAny* CCameraRamPlugin::CustomInterface(TUid /*aInterfaceUid*/)
   1.308 +	{
   1.309 +	return NULL;
   1.310 +	}
   1.311 +	
   1.312 +//
   1.313 +// CCameraRamPluginInfo
   1.314 +//
   1.315 +
   1.316 +CCameraRamPluginInfo::CCameraRamPluginInfo()
   1.317 +	{
   1.318 +	}
   1.319 +	
   1.320 +CCameraRamPluginInfo::~CCameraRamPluginInfo()
   1.321 +	{
   1.322 +	}
   1.323 +	
   1.324 +CCameraRamPluginInfo* CCameraRamPluginInfo::NewL()
   1.325 +	{
   1.326 +	FileDependencyUtil::CheckFileDependencyL();
   1.327 +	return new (ELeave) CCameraRamPluginInfo;
   1.328 +	}
   1.329 +	
   1.330 +TInt CCameraRamPluginInfo::CamerasAvailable()
   1.331 +	{
   1.332 +	return 1;
   1.333 +	}
   1.334 +
   1.335 +void FileDependencyUtil::CheckFileDependencyL()
   1.336 +	{
   1.337 +	RFs fsSession;
   1.338 +  	RFile file;
   1.339 +    
   1.340 +  	User::LeaveIfError(fsSession.Connect());
   1.341 +  	CleanupClosePushL(fsSession);
   1.342 +    TInt err = file.Open(fsSession, KECamRamPluginName, EFileRead);
   1.343 +  	file.Close();
   1.344 +  	
   1.345 +  	if(err != KErrNone)
   1.346 +  		{
   1.347 +	    User::LeaveIfError(KErrNotSupported);
   1.348 +  		}
   1.349 +  	CleanupStack::PopAndDestroy(); //fsSession
   1.350 +	}
   1.351 +
   1.352 +// __________________________________________________________________________
   1.353 +// Exported proxy for instantiation method resolution
   1.354 +// Define the interface UIDs
   1.355 +const TImplementationProxy ImplementationTable[] = 
   1.356 +	{
   1.357 +	IMPLEMENTATION_PROXY_ENTRY(KUidCameraRamTestPlugin, CCameraRamPlugin::NewL),
   1.358 +	IMPLEMENTATION_PROXY_ENTRY(KUidCameraRamTestInfo, CCameraRamPluginInfo::NewL)
   1.359 +	};
   1.360 +
   1.361 +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
   1.362 +	{
   1.363 +	aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
   1.364 +
   1.365 +	return ImplementationTable;
   1.366 +	}
   1.367 +