os/mm/imagingandcamerafws/cameraunittest/src/ecamramplugin/ecamramplugin.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 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 #include <f32file.h>
    17 #include <ecom/ecom.h>
    18 #include <ecom/implementationproxy.h>
    19 #include <ecam.h>
    20 #include "ecamramplugin.h"
    21 #include "ecamrampluginuids.hrh"
    22 
    23 	
    24 //
    25 // CCameraRamPlugin
    26 //
    27 CCameraRamPlugin::CCameraRamPlugin()
    28 	{
    29 	}
    30 	
    31 CCameraRamPlugin::~CCameraRamPlugin()
    32 	{
    33 	}
    34 	
    35 CCameraRamPlugin* CCameraRamPlugin::NewL()
    36 	{
    37 	FileDependencyUtil::CheckFileDependencyL();
    38 	return new (ELeave) CCameraRamPlugin;
    39 	}
    40 	
    41 // 
    42 // 2nd stage ConstructL calls called by framework
    43 //
    44 
    45 void CCameraRamPlugin::Construct2L(MCameraObserver& aObserver,TInt aCameraIndex)
    46 	{
    47 	iObserver = &aObserver;
    48 	iCameraIndex = aCameraIndex;
    49 	}
    50 	
    51 void CCameraRamPlugin::Construct2DupL(MCameraObserver& aObserver,TInt aCameraHandle)
    52 	{
    53 	iObserver = &aObserver;
    54 	iCameraHandle = aCameraHandle;
    55 	}
    56 
    57 
    58 void CCameraRamPlugin::Construct2L(MCameraObserver2& aObserver,TInt aCameraIndex,TInt aPriority)
    59 	{
    60 	iObserver2 = &aObserver;
    61 	iCameraIndex = aCameraIndex;
    62 	iPriority = aPriority;
    63 	}
    64 	
    65 void CCameraRamPlugin::Construct2DupL(MCameraObserver2& aObserver,TInt aCameraHandle)
    66 	{
    67 	iObserver2 = &aObserver;
    68 	iCameraHandle = aCameraHandle;
    69 	}
    70 
    71 
    72 	
    73 //
    74 // Dummy versions of virtual functions
    75 //
    76 
    77 void CCameraRamPlugin::CameraInfo(TCameraInfo& /*aInfo*/) const
    78 	{
    79 	}
    80 
    81 void CCameraRamPlugin::Reserve()
    82 	{
    83 	}
    84 
    85 
    86 void CCameraRamPlugin::Release()
    87 	{
    88 	}
    89 
    90 void CCameraRamPlugin::PowerOn()
    91 	{
    92 	}
    93 
    94 void CCameraRamPlugin::PowerOff()
    95 	{
    96 	}
    97 
    98 TInt CCameraRamPlugin::Handle()
    99 	{
   100 	return 0;
   101 	}
   102 
   103 void CCameraRamPlugin::SetZoomFactorL(TInt /*aZoomFactor = 0*/)
   104 	{
   105 	User::Leave(KErrNotSupported);
   106 	}
   107 
   108 TInt CCameraRamPlugin::ZoomFactor() const
   109 	{
   110 	return 0;
   111 	}
   112 
   113 void CCameraRamPlugin::SetDigitalZoomFactorL(TInt /*aDigitalZoomFactor = 0*/)
   114 	{
   115 	User::Leave(KErrNotSupported);
   116 	}
   117 
   118 TInt CCameraRamPlugin::DigitalZoomFactor() const
   119 	{
   120 	return 0;
   121 	}
   122 
   123 void CCameraRamPlugin::SetContrastL(TInt /*aContrast*/)
   124 	{
   125 	User::Leave(KErrNotSupported);
   126 	}
   127 
   128 TInt CCameraRamPlugin::Contrast() const
   129 	{
   130 	return 0;
   131 	}
   132 
   133 void CCameraRamPlugin::SetBrightnessL(TInt /*aBrightness*/)
   134 	{
   135 	User::Leave(KErrNotSupported);
   136 	}
   137 
   138 TInt CCameraRamPlugin::Brightness() const
   139 	{
   140 	return 0;
   141 	}
   142 
   143 
   144 void CCameraRamPlugin::SetFlashL(TFlash /*aFlash = EFlashNone*/)
   145 	{
   146 	User::Leave(KErrNotSupported);
   147 	}
   148 
   149 CCamera::TFlash CCameraRamPlugin::Flash() const
   150 	{
   151 	return EFlashNone;
   152 	}
   153 
   154 void CCameraRamPlugin::SetExposureL(TExposure /*aExposure = EExposureAuto*/)
   155 	{
   156 	User::Leave(KErrNotSupported);
   157 	}
   158 
   159 CCamera::TExposure CCameraRamPlugin::Exposure() const
   160 	{
   161 	return EExposureAuto;
   162 	}
   163 
   164 void CCameraRamPlugin::SetWhiteBalanceL(TWhiteBalance /*aWhiteBalance = EWBAuto*/)
   165 	{
   166 	}
   167 
   168 CCamera::TWhiteBalance CCameraRamPlugin::WhiteBalance() const
   169 	{
   170 	return EWBAuto;
   171 	}
   172 
   173 void CCameraRamPlugin::StartViewFinderDirectL(RWsSession& /*aWs*/,CWsScreenDevice& /*aScreenDevice*/,RWindowBase& /*aWindow*/,TRect& /*aScreenRect*/)
   174 	{
   175 	User::Leave(KErrNotSupported);
   176 	}
   177 
   178 void CCameraRamPlugin::StartViewFinderDirectL(RWsSession& /*aWs*/,CWsScreenDevice& /*aScreenDevice*/,RWindowBase& /*aWindow*/,TRect& /*aScreenRect*/,TRect& /*aClipRect*/)
   179 	{
   180 	User::Leave(KErrNotSupported);
   181 	}
   182 
   183 void CCameraRamPlugin::StartViewFinderBitmapsL(TSize& /*aSize*/)
   184 	{
   185 	User::Leave(KErrNotSupported);
   186 	}
   187 	
   188 void CCameraRamPlugin::StartViewFinderBitmapsL(TSize& /*aSize*/,TRect& /*aClipRect*/)
   189 	{
   190 	User::Leave(KErrNotSupported);
   191 	}
   192 
   193 
   194 void CCameraRamPlugin::StartViewFinderL(TFormat /*aImageFormat*/,TSize& /*aSize*/)
   195 	{
   196 	User::Leave(KErrNotSupported);
   197 	}
   198 
   199 void CCameraRamPlugin::StartViewFinderL(TFormat /*aImageFormat*/,TSize& /*aSize*/,TRect& /*aClipRect*/)
   200 	{
   201 	User::Leave(KErrNotSupported);
   202 	}
   203 
   204 
   205 void CCameraRamPlugin::StopViewFinder()
   206 	{
   207 	}
   208 
   209 TBool CCameraRamPlugin::ViewFinderActive() const
   210 	{
   211 	return EFalse;
   212 	}
   213 
   214 void CCameraRamPlugin::SetViewFinderMirrorL(TBool /*aMirror*/)
   215 	{
   216 	}
   217 
   218 TBool CCameraRamPlugin::ViewFinderMirror() const
   219 	{
   220 	return EFalse;
   221 	}
   222 
   223 void CCameraRamPlugin::PrepareImageCaptureL(TFormat /*aImageFormat*/,TInt /*aSizeIndex*/)
   224 	{
   225 	User::Leave(KErrNotSupported);
   226 	}
   227 
   228 void CCameraRamPlugin::PrepareImageCaptureL(TFormat /*aImageFormat*/,TInt /*aSizeIndex*/,const TRect& /*aClipRect*/)
   229 	{
   230 	User::Leave(KErrNotSupported);
   231 	}
   232 
   233 void CCameraRamPlugin::CaptureImage()
   234 	{
   235 	}
   236 
   237 void CCameraRamPlugin::CancelCaptureImage()
   238 	{
   239 	}
   240 
   241 void CCameraRamPlugin::EnumerateCaptureSizes(TSize& /*aSize*/,TInt /*aSizeIndex*/,TFormat /*aFormat*/) const
   242 	{
   243 	}
   244 
   245 void CCameraRamPlugin::PrepareVideoCaptureL(TFormat /*aFormat*/,TInt /*aSizeIndex*/,TInt /*aRateIndex*/,TInt /*aBuffersToUse*/,TInt /*aFramesPerBuffer*/)
   246 	{
   247 	User::Leave(KErrNotSupported);
   248 	}
   249 
   250 void CCameraRamPlugin::PrepareVideoCaptureL(TFormat /*aFormat*/,TInt /*aSizeIndex*/,TInt /*aRateIndex*/,TInt /*aBuffersToUse*/,TInt /*aFramesPerBuffer*/,const TRect& /*aClipRect*/)
   251 	{
   252 	User::Leave(KErrNotSupported);
   253 	}
   254 
   255 void CCameraRamPlugin::StartVideoCapture()
   256 	{
   257 	}
   258 
   259 void CCameraRamPlugin::StopVideoCapture()
   260 	{
   261 	}
   262 
   263 TBool CCameraRamPlugin::VideoCaptureActive() const
   264 	{
   265 	return EFalse;
   266 	}
   267 
   268 void CCameraRamPlugin::EnumerateVideoFrameSizes(TSize& /*aSize*/,TInt /*aSizeIndex*/,TFormat /*aFormat*/) const
   269 	{
   270 	}
   271 
   272 void CCameraRamPlugin::EnumerateVideoFrameRates(TReal32& /*aRate*/,TInt /*aRateIndex*/,TFormat /*aFormat*/,TInt /*aSizeIndex*/,TExposure /*aExposure = EExposureAuto*/) const
   273 	{
   274 	}
   275 
   276 void CCameraRamPlugin::GetFrameSize(TSize& /*aSize*/) const
   277 	{
   278 	}
   279 
   280 TReal32 CCameraRamPlugin::FrameRate() const
   281 	{
   282 	return 0.0;
   283 	}
   284 
   285 TInt CCameraRamPlugin::BuffersInUse() const
   286 	{
   287 	return 0;
   288 	}
   289 
   290 TInt CCameraRamPlugin::FramesPerBuffer() const
   291 	{
   292 	return 0;
   293 	}
   294 
   295 void CCameraRamPlugin::SetJpegQuality(TInt /*aQuality*/)
   296 	{
   297 	}
   298 
   299 TInt CCameraRamPlugin::JpegQuality() const
   300 	{
   301 	return 0;
   302 	}
   303 
   304 TAny* CCameraRamPlugin::CustomInterface(TUid /*aInterfaceUid*/)
   305 	{
   306 	return NULL;
   307 	}
   308 	
   309 //
   310 // CCameraRamPluginInfo
   311 //
   312 
   313 CCameraRamPluginInfo::CCameraRamPluginInfo()
   314 	{
   315 	}
   316 	
   317 CCameraRamPluginInfo::~CCameraRamPluginInfo()
   318 	{
   319 	}
   320 	
   321 CCameraRamPluginInfo* CCameraRamPluginInfo::NewL()
   322 	{
   323 	FileDependencyUtil::CheckFileDependencyL();
   324 	return new (ELeave) CCameraRamPluginInfo;
   325 	}
   326 	
   327 TInt CCameraRamPluginInfo::CamerasAvailable()
   328 	{
   329 	return 1;
   330 	}
   331 
   332 void FileDependencyUtil::CheckFileDependencyL()
   333 	{
   334 	RFs fsSession;
   335   	RFile file;
   336     
   337   	User::LeaveIfError(fsSession.Connect());
   338   	CleanupClosePushL(fsSession);
   339     TInt err = file.Open(fsSession, KECamRamPluginName, EFileRead);
   340   	file.Close();
   341   	
   342   	if(err != KErrNone)
   343   		{
   344 	    User::LeaveIfError(KErrNotSupported);
   345   		}
   346   	CleanupStack::PopAndDestroy(); //fsSession
   347 	}
   348 
   349 // __________________________________________________________________________
   350 // Exported proxy for instantiation method resolution
   351 // Define the interface UIDs
   352 const TImplementationProxy ImplementationTable[] = 
   353 	{
   354 	IMPLEMENTATION_PROXY_ENTRY(KUidCameraRamTestPlugin, CCameraRamPlugin::NewL),
   355 	IMPLEMENTATION_PROXY_ENTRY(KUidCameraRamTestInfo, CCameraRamPluginInfo::NewL)
   356 	};
   357 
   358 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
   359 	{
   360 	aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
   361 
   362 	return ImplementationTable;
   363 	}
   364