|
1 // Copyright (c) 2010 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 <mmf/plugin/mmfmediaclientextdisplayinterface.h> |
|
17 #include <mmf/plugin/mmfmediaclientextdisplayinterface.hrh> |
|
18 #include <e32cmn.h> |
|
19 #include <ecom/ecom.h> |
|
20 |
|
21 void CleanupEComArray(TAny* aArray); |
|
22 |
|
23 CExtDisplayConnectionProviderInterface* CExtDisplayConnectionProviderInterface::NewL() |
|
24 { |
|
25 RImplInfoPtrArray implInfoArray; |
|
26 TCleanupItem cleanup(CleanupEComArray, &implInfoArray); |
|
27 CleanupStack::PushL(cleanup); |
|
28 |
|
29 REComSession::ListImplementationsL(TUid::Uid(KMediaDisplayExtProviderInterfaceUid), implInfoArray); |
|
30 |
|
31 if(implInfoArray.Count() == 0) |
|
32 { |
|
33 CleanupStack::PopAndDestroy(); // implInfoArray |
|
34 return NULL; |
|
35 } |
|
36 |
|
37 CExtDisplayConnectionProviderInterface* self = |
|
38 REINTERPRET_CAST(CExtDisplayConnectionProviderInterface*, REComSession::CreateImplementationL( |
|
39 implInfoArray[0]->ImplementationUid(), _FOFF(CExtDisplayConnectionProviderInterface, iInstanceKey))); |
|
40 |
|
41 CleanupStack::PopAndDestroy(); // implInfoArray |
|
42 return self; |
|
43 } |
|
44 |
|
45 EXPORT_C CExtDisplayConnectionProviderInterface::~CExtDisplayConnectionProviderInterface() |
|
46 { |
|
47 REComSession::DestroyedImplementation(iInstanceKey); |
|
48 } |
|
49 |
|
50 EXPORT_C CExtDisplayConnectionProviderInterface::CExtDisplayConnectionProviderInterface() |
|
51 { |
|
52 } |
|
53 |
|
54 // CleanupEComArray function is used for cleanup support of locally declared arrays |
|
55 void CleanupEComArray(TAny* aArray) |
|
56 { |
|
57 (static_cast<RImplInfoPtrArray*> (aArray))->ResetAndDestroy(); |
|
58 (static_cast<RImplInfoPtrArray*> (aArray))->Close(); |
|
59 } |