|
1 /* |
|
2 * Copyright (c) 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: PSM Plug-in loader |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <ecom/ecom.h> |
|
20 #include <psmpluginbase.h> |
|
21 #include "psmsrvplugin.h" |
|
22 #include "psmsettingshandler.h" |
|
23 #include "psmmanager.h" |
|
24 #include "psmtrace.h" |
|
25 |
|
26 // ----------------------------------------------------------------------------- |
|
27 // CPsmSrvPlugin::NewL |
|
28 // Two-phased constructor. |
|
29 // ----------------------------------------------------------------------------- |
|
30 // |
|
31 CPsmSrvPlugin* CPsmSrvPlugin::NewL( CPsmManager& aManager, TUid aImplUid ) |
|
32 { |
|
33 COMPONENT_TRACE( ( _L( "PSM Server - CPsmSrvPlugin::NewL()" ) ) ); |
|
34 |
|
35 CPsmSrvPlugin* self = CPsmSrvPlugin::NewLC( aManager, aImplUid ); |
|
36 CleanupStack::Pop( self ); |
|
37 |
|
38 COMPONENT_TRACE( ( _L( "PSM Server - CPsmSrvPlugin::NewL - return 0x%x" ), self ) ); |
|
39 |
|
40 return self; |
|
41 } |
|
42 |
|
43 // ----------------------------------------------------------------------------- |
|
44 // CPsmSrvPlugin::NewLC |
|
45 // Two-phased constructor. |
|
46 // ----------------------------------------------------------------------------- |
|
47 // |
|
48 CPsmSrvPlugin* CPsmSrvPlugin::NewLC( CPsmManager& aManager, TUid aImplUid ) |
|
49 { |
|
50 COMPONENT_TRACE( ( _L( "PSM Server - CPsmSrvPlugin::NewLC()" ) ) ); |
|
51 |
|
52 CPsmSrvPlugin* self = new( ELeave ) CPsmSrvPlugin( aManager, aImplUid ); |
|
53 |
|
54 CleanupStack::PushL( self ); |
|
55 self->ConstructL(); |
|
56 |
|
57 COMPONENT_TRACE( ( _L( "PSM Server - CPsmSrvPlugin::NewLC - return 0x%x" ), self ) ); |
|
58 |
|
59 return self; |
|
60 } |
|
61 |
|
62 |
|
63 // ----------------------------------------------------------------------------- |
|
64 // CPsmSrvPlugin::CPsmSrvPlugin |
|
65 // C++ default constructor can NOT contain any code, that |
|
66 // might leave. |
|
67 // ----------------------------------------------------------------------------- |
|
68 // |
|
69 CPsmSrvPlugin::CPsmSrvPlugin( CPsmManager& aManager, TUid aImplUid ) : |
|
70 iManager( aManager ), |
|
71 iImplUid( aImplUid ) |
|
72 { |
|
73 // Nothing to do |
|
74 } |
|
75 |
|
76 // ----------------------------------------------------------------------------- |
|
77 // CPsmSrvPlugin::ConstructL |
|
78 // Symbian 2nd phase constructor can leave. |
|
79 // ----------------------------------------------------------------------------- |
|
80 // |
|
81 void CPsmSrvPlugin::ConstructL() |
|
82 { |
|
83 COMPONENT_TRACE( ( _L( "PSM Server - CPsmSrvPlugin::ConstructL()" ) ) ); |
|
84 |
|
85 // First, create settings handler |
|
86 iSettingsHandler = CPsmSettingsHandler::NewL( iManager.SettingsProvider().Mode() ); |
|
87 |
|
88 // Then, initialize plugin |
|
89 iActivePlugin = CPsmPluginBase::NewL( iImplUid, *iSettingsHandler ); |
|
90 |
|
91 COMPONENT_TRACE( ( _L( "PSM Server - CPsmSrvPlugin::ConstructL - return" ) ) ); |
|
92 } |
|
93 |
|
94 // ----------------------------------------------------------------------------- |
|
95 // Destructor |
|
96 // ----------------------------------------------------------------------------- |
|
97 // |
|
98 CPsmSrvPlugin::~CPsmSrvPlugin() |
|
99 { |
|
100 COMPONENT_TRACE( ( _L( "PSM Server - CPsmSrvPlugin::~CPsmSrvPlugin()" ) ) ); |
|
101 |
|
102 if ( iActivePlugin ) |
|
103 { |
|
104 delete iActivePlugin; |
|
105 iActivePlugin = NULL; |
|
106 } |
|
107 |
|
108 delete iSettingsHandler; |
|
109 |
|
110 COMPONENT_TRACE( ( _L( "PSM Server - CPsmSrvPlugin::~CPsmSrvPlugin - return") ) ); |
|
111 } |
|
112 |
|
113 // ----------------------------------------------------------------------------- |
|
114 // CPsmSrvPlugin::NotifyModeChange |
|
115 // ----------------------------------------------------------------------------- |
|
116 // |
|
117 void CPsmSrvPlugin::NotifyModeChange( const TPsmsrvMode aMode ) |
|
118 { |
|
119 COMPONENT_TRACE( ( _L( "PSM Server - CPsmSrvPlugin::NotifyModeChange()" ) ) ); |
|
120 |
|
121 iSettingsHandler->SetMode( aMode ); |
|
122 |
|
123 iActivePlugin->NotifyModeChange( aMode ); |
|
124 |
|
125 COMPONENT_TRACE( ( _L( "PSM Server - CPsmSrvPlugin::NotifyModeChange - return" ) ) ); |
|
126 } |
|
127 |
|
128 // End of file |