|
1 // Copyright (c) 2006-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 #include <ecom/ecom.h> |
|
17 #include <mtp/cmtpdataproviderplugin.h> |
|
18 #include <mtp/mmtpdataproviderframework.h> |
|
19 |
|
20 /** |
|
21 MTP data provider plug-in factory method. |
|
22 @param aImplementationUid A UID specifying the required data provider |
|
23 interface implementation. |
|
24 @param aParams An MTP framework specific parameter block pointer. This pointer |
|
25 should simply be passed through to this class's constructor by the derived |
|
26 class. |
|
27 @return Pointer to the plug-in instance. Ownership IS transfered. |
|
28 @leave KErrNoMemory If the plug-in instance could not be allocated. |
|
29 @leave KErrArgument If an invalid aImplementationUid was specified. |
|
30 */ |
|
31 EXPORT_C CMTPDataProviderPlugin* CMTPDataProviderPlugin::NewL(TUid aImplementationUid, TAny* aParams) |
|
32 { |
|
33 CMTPDataProviderPlugin* self = reinterpret_cast<CMTPDataProviderPlugin*>( |
|
34 REComSession::CreateImplementationL( |
|
35 aImplementationUid, |
|
36 _FOFF(CMTPDataProviderPlugin, iDtorIdKey), |
|
37 aParams)); |
|
38 return self; |
|
39 } |
|
40 |
|
41 /** |
|
42 Destructor. |
|
43 */ |
|
44 EXPORT_C CMTPDataProviderPlugin::~CMTPDataProviderPlugin() |
|
45 { |
|
46 REComSession::DestroyedImplementation(iDtorIdKey); |
|
47 } |
|
48 |
|
49 /** |
|
50 Constructor. |
|
51 @param aParams Parameter block pointer. |
|
52 @panic USER 0 If the parameter block pointer is 0. |
|
53 */ |
|
54 EXPORT_C CMTPDataProviderPlugin::CMTPDataProviderPlugin(TAny* aParams) : |
|
55 iFramework(reinterpret_cast<MMTPDataProviderFramework*> (aParams)) |
|
56 { |
|
57 __ASSERT_ALWAYS(iFramework, User::Invariant()); |
|
58 } |
|
59 |
|
60 EXPORT_C MMTPDataProviderFramework& CMTPDataProviderPlugin::Framework() const |
|
61 { |
|
62 return *iFramework; |
|
63 } |