sl@0: /* sl@0: * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of the License "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * sl@0: */ sl@0: sl@0: sl@0: #include "cafhelper.h" sl@0: #include "cafhelperinterface.h" sl@0: #include sl@0: #include sl@0: sl@0: using namespace ContentAccess; sl@0: sl@0: EXPORT_C CCAFHelper* CCAFHelper::NewL() sl@0: { sl@0: CCAFHelper* self = CCAFHelper::NewLC(); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: EXPORT_C CCAFHelper* CCAFHelper::NewLC() sl@0: { sl@0: CCAFHelper* self = new (ELeave) CCAFHelper; sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(); sl@0: return self; sl@0: } sl@0: sl@0: CCAFHelper::CCAFHelper() sl@0: { sl@0: } sl@0: sl@0: void CCAFHelper::ConstructL() sl@0: { sl@0: // Dynamically load the DLL. sl@0: TUidType uidType(KDynamicLibraryUid, KCAFHelperInterfaceUID); sl@0: sl@0: User::LeaveIfError(iLibrary.Load(KCAFHelperLibraryName, uidType)); sl@0: sl@0: // Function at ordinal 1 creates new CCAFAgentHelper. sl@0: TLibraryFunction entryFunc = iLibrary.Lookup(1); sl@0: if (entryFunc == NULL) sl@0: { sl@0: iLibrary.Close(); sl@0: User::Leave(KErrBadLibraryEntryPoint); sl@0: } sl@0: sl@0: // Call the function to create new CCAFAgentHelper. sl@0: iHelper = (MCAFHelperInterface*)entryFunc(); sl@0: } sl@0: sl@0: EXPORT_C MCAFHelperInterface& CCAFHelper::operator()() const sl@0: { sl@0: return *iHelper; sl@0: } sl@0: sl@0: CCAFHelper::~CCAFHelper() sl@0: { sl@0: iHelper->Release(); sl@0: iLibrary.Close(); sl@0: } sl@0: