32 |
32 |
33 // Constants |
33 // Constants |
34 const TUid KDeviceStatusPluginUid = |
34 const TUid KDeviceStatusPluginUid = |
35 { AI_UID_ECOM_IMPLEMENTATION_CONTENTPUBLISHER_DEVSTAPLUGIN }; |
35 { AI_UID_ECOM_IMPLEMENTATION_CONTENTPUBLISHER_DEVSTAPLUGIN }; |
36 |
36 |
|
37 const TUid KProfilePluginUid = |
|
38 { AI_UID_ECOM_IMPLEMENTATION_CONTENTPUBLISHER_PROFILEPLUGIN }; |
|
39 |
37 _LIT( KDeviceStatusPluginName, "DeviceStatus" ); |
40 _LIT( KDeviceStatusPluginName, "DeviceStatus" ); |
|
41 _LIT( KProfilePluginName, "Profile" ); |
38 |
42 |
39 |
43 |
40 // ======== LOCAL FUNCTIONS ======== |
44 // ======== LOCAL FUNCTIONS ======== |
41 // ---------------------------------------------------------------------------- |
45 // ---------------------------------------------------------------------------- |
42 // IsDeviceStatus() |
46 // IsRecyclable() |
43 // |
47 // |
44 // ---------------------------------------------------------------------------- |
48 // ---------------------------------------------------------------------------- |
45 // |
49 // |
46 TBool IsDeviceStatus( const THsPublisherInfo& aInfo ) |
50 TBool IsRecyclable( const THsPublisherInfo& aInfo ) |
47 { |
51 { |
48 return ( aInfo.Name() == KDeviceStatusPluginName && |
52 if ( ( aInfo.Name() == KProfilePluginName && |
49 aInfo.Uid() == KDeviceStatusPluginUid ); |
53 aInfo.Uid() == KProfilePluginUid ) || |
|
54 ( aInfo.Name() == KDeviceStatusPluginName && |
|
55 aInfo.Uid() == KDeviceStatusPluginUid ) ) |
|
56 { |
|
57 return ETrue; |
|
58 } |
|
59 |
|
60 return EFalse; |
50 } |
61 } |
51 |
62 |
52 // ---------------------------------------------------------------------------- |
63 // ---------------------------------------------------------------------------- |
53 // CleanupResetAndDestroy() |
64 // CleanupResetAndDestroy() |
54 // |
65 // |
134 TInt CAiPluginFactory::CreatePlugin( |
145 TInt CAiPluginFactory::CreatePlugin( |
135 const THsPublisherInfo& aPublisherInfo ) |
146 const THsPublisherInfo& aPublisherInfo ) |
136 { |
147 { |
137 __PRINTS( "*** CAiPluginFactory::CreatePlugin: Start ***" ); |
148 __PRINTS( "*** CAiPluginFactory::CreatePlugin: Start ***" ); |
138 |
149 |
139 if ( IsDeviceStatus( aPublisherInfo ) ) |
150 if ( IsRecyclable( aPublisherInfo ) ) |
140 { |
151 { |
141 CHsContentPublisher* plugin( PluginByUid( aPublisherInfo.Uid() ) ); |
152 CHsContentPublisher* plugin( PluginByUid( aPublisherInfo.Uid() ) ); |
142 |
153 |
143 if ( plugin ) |
154 if ( plugin ) |
144 { |
155 { |
145 // Devicestatus plugin already exists, update its namespace |
156 // Plugin already exists, update its namespace |
146 THsPublisherInfo& info( |
157 THsPublisherInfo& info( |
147 const_cast< THsPublisherInfo& >( plugin->PublisherInfo() ) ); |
158 const_cast< THsPublisherInfo& >( plugin->PublisherInfo() ) ); |
148 |
159 |
149 info.iNamespace.Copy( aPublisherInfo.Namespace() ); |
160 info.iNamespace.Copy( aPublisherInfo.Namespace() ); |
150 |
161 |
151 __PRINTS( "*** CAiPluginFactory::CreatePlugin: Done - DeviceStatus plugin updated ***" ); |
162 __PRINTS( "*** CAiPluginFactory::CreatePlugin: Done - Plugin recycled ***" ); |
152 |
163 |
153 return KErrNone; |
164 return KErrNone; |
154 } |
165 } |
155 } |
166 } |
156 |
167 |
200 // |
211 // |
201 void CAiPluginFactory::DestroyPlugin( const THsPublisherInfo& aPublisherInfo ) |
212 void CAiPluginFactory::DestroyPlugin( const THsPublisherInfo& aPublisherInfo ) |
202 { |
213 { |
203 __PRINTS( "*** CAiPluginFactory::DestroyPlugin: Start ***" ); |
214 __PRINTS( "*** CAiPluginFactory::DestroyPlugin: Start ***" ); |
204 |
215 |
205 if ( IsDeviceStatus( aPublisherInfo ) ) |
216 if ( IsRecyclable( aPublisherInfo ) ) |
206 { |
217 { |
207 // Don't destroy device status plugin |
218 // Don't destroy recyclable plugin |
208 __PRINTS( "*** CAiPluginFactory::DestroyPlugin: Done - Keepind DeviceStatus Plug-in ***" ); |
219 __PRINTS( "*** CAiPluginFactory::DestroyPlugin: Done - Keeping recyclable Plug-in ***" ); |
209 |
220 |
210 return; |
221 return; |
211 } |
222 } |
212 |
223 |
213 CHsContentPublisher* plugin( PluginByInfo( aPublisherInfo ) ); |
224 CHsContentPublisher* plugin( PluginByInfo( aPublisherInfo ) ); |
232 const THsPublisherInfo& aPublisherInfo ) |
243 const THsPublisherInfo& aPublisherInfo ) |
233 { |
244 { |
234 __PRINT( __DBG_FORMAT( "\t[I]\t Loading plug-in uid=%x name=%S"), |
245 __PRINT( __DBG_FORMAT( "\t[I]\t Loading plug-in uid=%x name=%S"), |
235 aPublisherInfo.Uid(), &(aPublisherInfo.Name() ) ); |
246 aPublisherInfo.Uid(), &(aPublisherInfo.Name() ) ); |
236 |
247 |
237 __TIME( "FW: Create plug-in:", |
248 iPublishers.ReserveL( iPublishers.Count() + 1 ); |
238 |
249 |
239 iPublishers.ReserveL( iPublishers.Count() + 1 ); |
250 CHsContentPublisher* plugin( NULL ); |
240 |
251 |
241 CHsContentPublisher* plugin = |
252 __TIME( "CAiPluginFactory::CreatePluginL Create plug-in:", |
242 CHsContentPublisher::NewL( aPublisherInfo ) ); |
253 plugin = CHsContentPublisher::NewL( aPublisherInfo ) ); |
|
254 |
243 CleanupStack::PushL( plugin ); |
255 CleanupStack::PushL( plugin ); |
244 |
256 |
245 __TIME( "FW: Subscribe content observers", |
257 __TIME( "FW: Subscribe content observers", |
246 SubscribeContentObserversL( *plugin, aPublisherInfo ) ); |
258 SubscribeContentObserversL( *plugin, aPublisherInfo ) ); |
247 |
259 |