28 #include "cvimpststoragemanagerfactory.h" |
28 #include "cvimpststoragemanagerfactory.h" |
29 |
29 |
30 #include <spnotifychange.h> |
30 #include <spnotifychange.h> |
31 #include <spsettings.h> |
31 #include <spsettings.h> |
32 |
32 |
33 #include "vimpstdebugtrace.h" |
33 #include "uiservicetabtracer.h" |
34 #include "cvimpstenginecvlistener.h" |
34 #include "cvimpstenginecvlistener.h" |
35 |
35 |
36 // ================= MEMBER FUNCTIONS ======================= |
36 // ================= MEMBER FUNCTIONS ======================= |
37 |
37 |
38 // ----------------------------------------------------------------------------- |
38 // ----------------------------------------------------------------------------- |
41 // behaving as singleton object already created then return same instance. |
41 // behaving as singleton object already created then return same instance. |
42 // ----------------------------------------------------------------------------- |
42 // ----------------------------------------------------------------------------- |
43 // |
43 // |
44 EXPORT_C MVIMPSTEngineFactory* CVIMPSTEngineFactory::InstanceL() |
44 EXPORT_C MVIMPSTEngineFactory* CVIMPSTEngineFactory::InstanceL() |
45 { |
45 { |
|
46 TRACER_AUTO; |
46 CVIMPSTEngineFactory* singleton; |
47 CVIMPSTEngineFactory* singleton; |
47 singleton = static_cast<CVIMPSTEngineFactory*> (Dll::Tls()); |
48 singleton = static_cast<CVIMPSTEngineFactory*> (Dll::Tls()); |
48 if( !singleton ) |
49 if( !singleton ) |
49 { |
50 { |
50 singleton = CVIMPSTEngineFactory::NewLC(); |
51 singleton = CVIMPSTEngineFactory::NewLC(); |
61 // Release the singelton |
62 // Release the singelton |
62 // ----------------------------------------------------------------------------- |
63 // ----------------------------------------------------------------------------- |
63 // |
64 // |
64 EXPORT_C void CVIMPSTEngineFactory::Release() |
65 EXPORT_C void CVIMPSTEngineFactory::Release() |
65 { |
66 { |
|
67 TRACER_AUTO; |
66 CVIMPSTEngineFactory* singleton; |
68 CVIMPSTEngineFactory* singleton; |
67 singleton = static_cast<CVIMPSTEngineFactory*>(Dll::Tls()); |
69 singleton = static_cast<CVIMPSTEngineFactory*>(Dll::Tls()); |
68 if( singleton && !singleton->DecreamentRefereneCount()) |
70 if( singleton && !singleton->DecreamentRefereneCount()) |
69 { |
71 { |
70 delete singleton; |
72 delete singleton; |
90 // Symbian OS default constructor can leave. |
92 // Symbian OS default constructor can leave. |
91 // ----------------------------------------------------------------------------- |
93 // ----------------------------------------------------------------------------- |
92 // |
94 // |
93 void CVIMPSTEngineFactory::ConstructL() |
95 void CVIMPSTEngineFactory::ConstructL() |
94 { |
96 { |
95 |
97 TRACER_AUTO; |
96 CVIMPSTStorageManagerFactory::InitialiseLibraryL(); |
98 CVIMPSTStorageManagerFactory::InitialiseLibraryL(); |
97 |
99 |
98 //only 1 instance of iServiceTableFetcher shared between services |
100 //only 1 instance of iServiceTableFetcher shared between services |
99 iServiceTableFetcher = CVIMPSTEngineServiceTableFetcher::NewL(); |
101 iServiceTableFetcher = CVIMPSTEngineServiceTableFetcher::NewL(); |
100 |
102 |
177 // CVIMPSTEngineFactory::GetServiceEnginePtr |
179 // CVIMPSTEngineFactory::GetServiceEnginePtr |
178 // --------------------------------------------------------- |
180 // --------------------------------------------------------- |
179 void CVIMPSTEngineFactory::GetServiceEnginePtr |
181 void CVIMPSTEngineFactory::GetServiceEnginePtr |
180 (RPointerArray<MVIMPSTEngine>& serviceIdArray) const |
182 (RPointerArray<MVIMPSTEngine>& serviceIdArray) const |
181 { |
183 { |
182 |
184 TRACER_AUTO; |
183 TInt count = iServiceItems.Count() ; |
185 TInt count = iServiceItems.Count() ; |
184 |
186 |
185 // iterate the service array |
187 // iterate the service array |
186 for ( TInt index = 0; index < count ; index++ ) |
188 for ( TInt index = 0; index < count ; index++ ) |
187 { |
189 { |
196 // --------------------------------------------------------- |
198 // --------------------------------------------------------- |
197 |
199 |
198 TInt CVIMPSTEngineFactory::FindService( |
200 TInt CVIMPSTEngineFactory::FindService( |
199 TUint aServiceId ) const |
201 TUint aServiceId ) const |
200 { |
202 { |
|
203 TRACER_AUTO; |
201 TInt count = iServiceItems.Count() ; |
204 TInt count = iServiceItems.Count() ; |
202 TInt ret = KErrNotFound; |
205 TInt ret = KErrNotFound; |
203 // iterate the service array |
206 // iterate the service array |
204 for ( TInt index = 0; index < count ; index++ ) |
207 for ( TInt index = 0; index < count ; index++ ) |
205 { |
208 { |
220 // --------------------------------------------------------------------------- |
223 // --------------------------------------------------------------------------- |
221 // |
224 // |
222 void CVIMPSTEngineFactory::HandleNotifyChange( |
225 void CVIMPSTEngineFactory::HandleNotifyChange( |
223 TServiceId aServiceId ) |
226 TServiceId aServiceId ) |
224 { |
227 { |
225 TRACE( T_LIT("CVIMPSTEngineFactory::HandleNotifyChange start")); |
228 TRACER_AUTO; |
226 TRACE( T_LIT("HandleNotifyChange() serviceid: %d"), aServiceId ); |
229 TRACE( "serviceid: %d", aServiceId ); |
227 |
230 |
228 TBool newService = EFalse; |
231 TBool newService = EFalse; |
229 |
232 |
230 if ( KErrNotFound == FindService(aServiceId) ) |
233 if ( KErrNotFound == FindService(aServiceId) ) |
231 { |
234 { |
232 newService = ETrue; |
235 newService = ETrue; |
233 } |
236 } |
234 |
237 |
235 TRAP_IGNORE( iServiceTableFetcher->DoHandleNotifyChangeL( aServiceId, newService, GetEngine(aServiceId) ) ); |
238 TRAP_IGNORE( iServiceTableFetcher->DoHandleNotifyChangeL( aServiceId, newService, GetEngine(aServiceId) ) ); |
236 |
239 |
237 TRACE( T_LIT("CVIMPSTEngineFactory::HandleNotifyChange end")); |
|
238 } |
240 } |
239 |
241 |
240 // --------------------------------------------------------------------------- |
242 // --------------------------------------------------------------------------- |
241 // CVIMPSTEngineFactory::HandleError() |
243 // CVIMPSTEngineFactory::HandleError() |
242 // --------------------------------------------------------------------------- |
244 // --------------------------------------------------------------------------- |
243 // |
245 // |
244 void CVIMPSTEngineFactory::HandleError( TInt /*aError*/ ) |
246 void CVIMPSTEngineFactory::HandleError( TInt /*aError*/ ) |
245 { |
247 { |
246 TRACE( T_LIT("CVIMPSTEngineFactory::HandleError() start")); |
248 TRACER_AUTO; |
247 |
|
248 TRACE( T_LIT("CVIMPSTEngineFactory::HandleError() end")); |
|
249 |
249 |
250 } |
250 } |
251 |
251 |
252 // --------------------------------------------------------------------------- |
252 // --------------------------------------------------------------------------- |
253 // CVIMPSTEngineFactory::GetEngine() |
253 // CVIMPSTEngineFactory::GetEngine() |
254 // --------------------------------------------------------------------------- |
254 // --------------------------------------------------------------------------- |
255 // |
255 // |
256 MVIMPSTEngine* CVIMPSTEngineFactory::GetEngine( TServiceId aServiceId ) |
256 MVIMPSTEngine* CVIMPSTEngineFactory::GetEngine( TServiceId aServiceId ) |
257 { |
257 { |
|
258 TRACER_AUTO; |
258 TInt count = iServiceItems.Count(); |
259 TInt count = iServiceItems.Count(); |
259 MVIMPSTEngine* engine = NULL; |
260 MVIMPSTEngine* engine = NULL; |
260 for(int i=0 ; i<count ; i++) |
261 for(int i=0 ; i<count ; i++) |
261 { |
262 { |
262 if(iServiceItems[i]->ServiceId() == aServiceId) |
263 if(iServiceItems[i]->ServiceId() == aServiceId) |