|
1 /* |
|
2 * Copyright (c) 2006-2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDES |
|
22 #include <ecom/ecom.h> |
|
23 |
|
24 // CONSTANTS |
|
25 // Plugin name defined by default_data in resource file |
|
26 _LIT8( KPluginName, "HWRMPowerState" ); |
|
27 |
|
28 |
|
29 // ----------------------------------------------------------------------------- |
|
30 // CHWRMPowerStatePlugin::~CHWRMPowerStatePlugin |
|
31 // Destructor informs ECom that implementation has been destroyed. |
|
32 // ----------------------------------------------------------------------------- |
|
33 // |
|
34 inline CHWRMPowerStatePlugin::~CHWRMPowerStatePlugin() |
|
35 { |
|
36 REComSession::DestroyedImplementation(iDestructorIDKey); |
|
37 } |
|
38 |
|
39 // ----------------------------------------------------------------------------- |
|
40 // CHWRMPowerStatePlugin::NewL |
|
41 // Factory method to create implementation. Implementation is found via ECom. |
|
42 // ----------------------------------------------------------------------------- |
|
43 // |
|
44 inline CHWRMPowerStatePlugin* CHWRMPowerStatePlugin::NewL( |
|
45 MHWRMPowerStatePluginCallback* aNotificationCallback ) |
|
46 { |
|
47 // Set resolve parameters to find correct implementation |
|
48 TEComResolverParams resolverParams; |
|
49 resolverParams.SetDataType( KPluginName ); |
|
50 resolverParams.SetGenericMatch( EFalse ); |
|
51 |
|
52 // Create instance using ECom |
|
53 TAny* interface = REComSession::CreateImplementationL( |
|
54 KCHWRMPowerStatePluginInterfaceUid, |
|
55 _FOFF(CHWRMPowerStatePlugin, iDestructorIDKey), |
|
56 resolverParams, |
|
57 KRomOnlyResolverUid ); |
|
58 |
|
59 CHWRMPowerStatePlugin* service = reinterpret_cast<CHWRMPowerStatePlugin*>(interface); |
|
60 |
|
61 // Set notification callback pointer |
|
62 service->iNotificationCallback = aNotificationCallback; |
|
63 |
|
64 return service; |
|
65 } |
|
66 |
|
67 // End of File |