|
1 /* |
|
2 * Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: ECOM interface default implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 //USER |
|
20 #include "musavaobserver.h" |
|
21 #include "musuid.hrh" |
|
22 #include "muscleanupresetanddestroy.h" |
|
23 |
|
24 // --------------------------------------------------------------------------------- |
|
25 // C++ Destructor. |
|
26 // |
|
27 // --------------------------------------------------------------------------------- |
|
28 // |
|
29 inline CMusAvaInterface::~CMusAvaInterface() |
|
30 { |
|
31 REComSession::DestroyedImplementation( iDtor_ID_Key ); |
|
32 } |
|
33 |
|
34 |
|
35 // --------------------------------------------------------------------------------- |
|
36 // CMusAvaInterface::NewL |
|
37 // Two-phased constructor. |
|
38 // --------------------------------------------------------------------------------- |
|
39 // |
|
40 inline CMusAvaInterface* CMusAvaInterface::NewL() |
|
41 |
|
42 { |
|
43 // Find implementation for our interface. |
|
44 // - KClientInterfaceUid is the UID of our custom ECOM |
|
45 // interface. |
|
46 // - This call will leave, if the plugin architecture cannot find |
|
47 // implementation. |
|
48 // - The returned pointer points to one of our interface implementation |
|
49 // instances. |
|
50 RImplInfoPtrArray pluginArray; |
|
51 MusCleanupResetAndDestroy<RImplInfoPtrArray>::PushL( pluginArray ); |
|
52 |
|
53 TUid interfaceUid = { KMusAvaPluginInterfaceUid }; |
|
54 |
|
55 REComSession::ListImplementationsL( interfaceUid, pluginArray ); |
|
56 |
|
57 if( pluginArray.Count() > 0 ) |
|
58 { |
|
59 CImplementationInformation* info = pluginArray[ 0 ]; |
|
60 TAny* interface = REComSession::CreateImplementationL( |
|
61 info->ImplementationUid(), |
|
62 _FOFF( CMusAvaInterface , iDtor_ID_Key ) ); |
|
63 |
|
64 CleanupStack::PopAndDestroy();//pluginArray |
|
65 //pluginArray.ResetAndDestroy(); |
|
66 return reinterpret_cast <CMusAvaInterface *> ( interface ); |
|
67 } |
|
68 |
|
69 CleanupStack::PopAndDestroy();//pluginArray |
|
70 User::Leave( KErrNotFound ); |
|
71 // to avoid compiler warning |
|
72 return NULL; |
|
73 } |
|
74 |