|
1 // Copyright (c) 2002-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 #ifndef __MMF_HW_DEVICE_INL__ |
|
17 #define __MMF_HW_DEVICE_INL__ |
|
18 |
|
19 #include <ecom/ecom.h> |
|
20 |
|
21 |
|
22 /** |
|
23 Create a CMMFHwDevice object from .dll. |
|
24 Will leave if dll cannot be loaded (KErrNotFound). |
|
25 |
|
26 @param dll Implementation .dll |
|
27 |
|
28 @return an instantiated CMMFHwDevice derived object from a DLL. |
|
29 */ |
|
30 // modification to pass by reference would cause a BC break |
|
31 // coverity[pass_by_value] |
|
32 inline CMMFHwDevice* CMMFHwDevice::NewL(TFileName dll) |
|
33 { |
|
34 RLibrary library; |
|
35 User::LeaveIfError(library.Load(dll)); |
|
36 TLibraryFunction entry=library.Lookup(2); // 1 ponits to implementation table |
|
37 CMMFHwDevice* mmfHwDevice = (CMMFHwDevice*)entry(); |
|
38 return mmfHwDevice; |
|
39 } |
|
40 |
|
41 /** |
|
42 * |
|
43 * Destructor |
|
44 * |
|
45 */ |
|
46 |
|
47 CMMFHwDevice::~CMMFHwDevice() |
|
48 { |
|
49 // Destroy any instance variables and then |
|
50 // inform ecom that this specific |
|
51 // instance of the interface has been destroyed. |
|
52 REComSession::DestroyedImplementation(iDtor_ID_Key); |
|
53 } |
|
54 |
|
55 /** |
|
56 * |
|
57 * Create a CMMFHwDevice object with a known implementation Uid. |
|
58 * Will leave if it is not found (KErrNotFound). |
|
59 * |
|
60 * @param aUid - The Uid of a plugin implementation |
|
61 * |
|
62 * @return An instantiated CMMFHwDevice derived object from ECom. |
|
63 * |
|
64 */ |
|
65 inline CMMFHwDevice* CMMFHwDevice::NewL(TUid aUid) |
|
66 { |
|
67 CMMFHwDevice* device = REINTERPRET_CAST(CMMFHwDevice*, |
|
68 REComSession::CreateImplementationL(aUid, _FOFF(CMMFHwDevice,iDtor_ID_Key))); |
|
69 return device; |
|
70 } |
|
71 |
|
72 #endif |