Update contrib.
1 // Copyright (c) 2003-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.
16 #include <ecam/ecamplugin.h>
17 #include <ecam/ecaminfoplugin.h>
19 #include <ecom/ecom.h>
20 #include <mm/mmpluginutils.h>
22 #include <ecamuids.hrh>
28 EXPORT_C TInt CCameraPlugin::CamerasAvailable()
30 CCameraInfoPlugin* info = NULL;
31 TRAPD(error, info = CCameraInfoPlugin::NewL());
34 // error during open, default to 0
35 // TODO - can we return an error here?
38 TInt result = info->CamerasAvailable();
40 REComSession::FinalClose(); // don't have to do this here, but might as well tidy up
44 CCameraPlugin* CCameraPlugin::NewL(TInt aCameraVersion)
46 TUid interfaceUid = {KUidOnboardCameraPlugin};
51 static_cast<CCameraPlugin*>
52 (MmPluginUtils::CreateImplementationL(interfaceUid, dtor, KECamPluginMatchString));
55 static_cast<CCameraPlugin*>
56 (MmPluginUtils::CreateImplementationL(interfaceUid, dtor, KECamPluginMatchString, KRomOnlyResolverUid));
59 //create CCameraStructure here
60 self->iCameraStructure = new CCameraStructure();
61 if (!self->iCameraStructure)
64 REComSession::DestroyedImplementation(dtor);
65 User::Leave(KErrNoMemory);
69 self->iCameraStructure->iCameraVersion = aCameraVersion;
70 self->iCameraStructure->iDestructorKey = dtor;
75 CCameraPlugin* CCameraPlugin::NewLC(TInt aCameraVersion)
77 CCameraPlugin* self = NewL(aCameraVersion);
78 CleanupStack::PushL(self);
82 EXPORT_C CCameraPlugin* CCameraPlugin::NewL(MCameraObserver2& aObserver,TInt aCameraIndex,TInt aPriority,TInt aCameraVersion)
84 CCameraPlugin* self = NewLC(aCameraVersion);
85 self->Construct2L(aObserver, aCameraIndex, aPriority);
86 CleanupStack::Pop(self);
90 EXPORT_C CCameraPlugin* CCameraPlugin::NewDuplicateL(MCameraObserver2& aObserver,TInt aCameraHandle,TInt aCameraVersion)
92 CCameraPlugin* self = NewLC(aCameraVersion);
93 self->Construct2DupL(aObserver, aCameraHandle);
94 CleanupStack::Pop(self);
99 EXPORT_C CCameraPlugin* CCameraPlugin::NewL(MCameraObserver& aObserver,TInt aCameraIndex,TInt aCameraVersion)
101 CCameraPlugin* self = NewLC(aCameraVersion);
102 self->Construct2L(aObserver, aCameraIndex);
103 CleanupStack::Pop(self);
107 EXPORT_C CCameraPlugin* CCameraPlugin::NewDuplicateL(MCameraObserver& aObserver,TInt aCameraHandle,TInt aCameraVersion)
109 CCameraPlugin* self = NewLC(aCameraVersion);
110 self->Construct2DupL(aObserver, aCameraHandle);
111 CleanupStack::Pop(self);
115 EXPORT_C CCameraPlugin::~CCameraPlugin()
117 if (iCameraStructure)
119 REComSession::DestroyedImplementation(iCameraStructure->iDestructorKey);
121 delete iCameraStructure;
124 EXPORT_C CCameraPlugin::CCameraPlugin()
128 EXPORT_C TInt CCameraPlugin::CameraVersion()
130 return iCameraStructure->iCameraVersion;