26 |
26 |
27 #include "thumbagcameraobserver.h" |
27 #include "thumbagcameraobserver.h" |
28 #include "thumbnaillog.h" |
28 #include "thumbnaillog.h" |
29 #include "thumbnailmanagerconstants.h" |
29 #include "thumbnailmanagerconstants.h" |
30 #include "thumbnailmanagerprivatecrkeys.h" |
30 #include "thumbnailmanagerprivatecrkeys.h" |
|
31 #include "OstTraceDefinitions.h" |
|
32 #ifdef OST_TRACE_COMPILER_IN_USE |
|
33 #include "thumbagcameraobserverTraces.h" |
|
34 #endif |
31 |
35 |
32 |
36 |
33 // --------------------------------------------------------------------------- |
37 // --------------------------------------------------------------------------- |
34 // NewLC |
38 // NewLC |
35 // --------------------------------------------------------------------------- |
39 // --------------------------------------------------------------------------- |
36 // |
40 // |
37 CThumbAGCameraObserver* CThumbAGCameraObserver::NewLC(CThumbAGProcessor* aProcessor) |
41 CThumbAGCameraObserver* CThumbAGCameraObserver::NewLC(CThumbAGProcessor* aProcessor) |
38 { |
42 { |
39 TN_DEBUG1( "CThumbAGCameraObserver::NewLC() - begin" ); |
43 TN_DEBUG1( "CThumbAGCameraObserver::NewLC() - begin" ); |
|
44 OstTrace0( TRACE_FATAL, CTHUMBAGCAMERAOBSERVER_NEWLC, "CThumbAGCameraObserver::NewLC - begin" ); |
40 |
45 |
41 CThumbAGCameraObserver* self = new (ELeave) CThumbAGCameraObserver(aProcessor); |
46 CThumbAGCameraObserver* self = new (ELeave) CThumbAGCameraObserver(aProcessor); |
42 CleanupStack::PushL( self ); |
47 CleanupStack::PushL( self ); |
43 self->ConstructL(); |
48 self->ConstructL(); |
44 return self; |
49 return self; |
72 // --------------------------------------------------------------------------- |
78 // --------------------------------------------------------------------------- |
73 // |
79 // |
74 void CThumbAGCameraObserver::ConstructL() |
80 void CThumbAGCameraObserver::ConstructL() |
75 { |
81 { |
76 TN_DEBUG1( "CThumbAGCameraObserver::ConstructL() - begin" ); |
82 TN_DEBUG1( "CThumbAGCameraObserver::ConstructL() - begin" ); |
|
83 OstTrace0( TRACE_FATAL, CTHUMBAGCAMERAOBSERVER_CONSTRUCTL, "CThumbAGCameraObserver::ConstructL - begin" ); |
77 |
84 |
78 #ifdef _DEBUG |
85 #ifdef _DEBUG |
79 iAddCounter = 0; |
86 iAddCounter = 0; |
80 iModCounter = 0; |
87 iModCounter = 0; |
81 #endif |
88 #endif |
82 |
89 |
83 InitializeL(); |
90 InitializeL(); |
84 |
91 |
85 TN_DEBUG1( "CThumbAGCameraObserver::ConstructL() - end" ); |
92 TN_DEBUG1( "CThumbAGCameraObserver::ConstructL() - end" ); |
|
93 OstTrace0( TRACE_FATAL, DUP1_CTHUMBAGCAMERAOBSERVER_CONSTRUCTL, "CThumbAGCameraObserver::ConstructL - end" ); |
86 } |
94 } |
87 |
95 |
88 // --------------------------------------------------------------------------- |
96 // --------------------------------------------------------------------------- |
89 // ~CThumbAGCameraObserver |
97 // ~CThumbAGCameraObserver |
90 // --------------------------------------------------------------------------- |
98 // --------------------------------------------------------------------------- |
91 // |
99 // |
92 void CThumbAGCameraObserver::InitializeL() |
100 void CThumbAGCameraObserver::InitializeL() |
93 { |
101 { |
94 TN_DEBUG1( "CThumbAGCameraObserver::InitializeL() - begin" ); |
102 TN_DEBUG1( "CThumbAGCameraObserver::InitializeL() - begin" ); |
|
103 OstTrace0( TRACE_FATAL, CTHUMBAGCAMERAOBSERVER_INITIALIZEL, "CThumbAGCameraObserver::InitializeL - begin" ); |
95 |
104 |
96 |
105 |
97 TN_DEBUG1( "CThumbAGCameraObserver::InitializeL() - create observers" ); |
106 TN_DEBUG1( "CThumbAGCameraObserver::InitializeL() - create observers" ); |
|
107 OstTrace0( TRACE_FATAL, DUP1_CTHUMBAGCAMERAOBSERVER_INITIALIZEL, "CThumbAGCameraObserver::InitializeL - create observers" ); |
98 |
108 |
99 // create shutdown observer |
109 // create shutdown observer |
100 if(iMDSShutdownObserver) |
110 if(iMDSShutdownObserver) |
101 { |
111 { |
102 delete iMDSShutdownObserver; |
112 delete iMDSShutdownObserver; |
132 |
143 |
133 iMdESession = CMdESession::NewL( *this ); |
144 iMdESession = CMdESession::NewL( *this ); |
134 iSessionError = EFalse; |
145 iSessionError = EFalse; |
135 |
146 |
136 TN_DEBUG1( "CThumbAGCameraObserver::InitializeL() - end" ); |
147 TN_DEBUG1( "CThumbAGCameraObserver::InitializeL() - end" ); |
|
148 OstTrace0( TRACE_FATAL, DUP3_CTHUMBAGCAMERAOBSERVER_INITIALIZEL, "CThumbAGCameraObserver::InitializeL - end" ); |
137 } |
149 } |
138 |
150 |
139 // --------------------------------------------------------------------------- |
151 // --------------------------------------------------------------------------- |
140 // ~CThumbAGCameraObserver |
152 // ~CThumbAGCameraObserver |
141 // --------------------------------------------------------------------------- |
153 // --------------------------------------------------------------------------- |
142 // |
154 // |
143 CThumbAGCameraObserver::~CThumbAGCameraObserver() |
155 CThumbAGCameraObserver::~CThumbAGCameraObserver() |
144 { |
156 { |
145 TN_DEBUG1( "CThumbAGCameraObserver::~CThumbAGCameraObserver() - begin" ); |
157 TN_DEBUG1( "CThumbAGCameraObserver::~CThumbAGCameraObserver() - begin" ); |
|
158 OstTrace0( TRACE_FATAL, CTHUMBAGCAMERAOBSERVER_CTHUMBAGCAMERAOBSERVER, "CThumbAGCameraObserver::~CThumbAGCameraObserver - begin" ); |
146 |
159 |
147 iShutdown = ETrue; |
160 iShutdown = ETrue; |
148 |
161 |
149 delete iMDSShutdownObserver; |
162 delete iMDSShutdownObserver; |
150 iMDSShutdownObserver = NULL; |
163 iMDSShutdownObserver = NULL; |
168 delete iMdESession; |
181 delete iMdESession; |
169 iMdESession = NULL; |
182 iMdESession = NULL; |
170 } |
183 } |
171 |
184 |
172 TN_DEBUG1( "CThumbAGCameraObserver::~CThumbAGCameraObserver() - end" ); |
185 TN_DEBUG1( "CThumbAGCameraObserver::~CThumbAGCameraObserver() - end" ); |
|
186 OstTrace0( TRACE_FATAL, DUP1_CTHUMBAGCAMERAOBSERVER_CTHUMBAGCAMERAOBSERVER, "CThumbAGCameraObserver::~CThumbAGCameraObserver - end" ); |
173 } |
187 } |
174 |
188 |
175 // ----------------------------------------------------------------------------- |
189 // ----------------------------------------------------------------------------- |
176 // CThumbAGCameraObserver::HandleSessionOpened |
190 // CThumbAGCameraObserver::HandleSessionOpened |
177 // ----------------------------------------------------------------------------- |
191 // ----------------------------------------------------------------------------- |
178 // |
192 // |
179 void CThumbAGCameraObserver::HandleSessionOpened( CMdESession& /* aSession */, TInt aError ) |
193 void CThumbAGCameraObserver::HandleSessionOpened( CMdESession& /* aSession */, TInt aError ) |
180 { |
194 { |
181 TN_DEBUG1( "CThumbAGCameraObserver::HandleSessionOpened"); |
195 TN_DEBUG1( "CThumbAGCameraObserver::HandleSessionOpened"); |
|
196 OstTrace0( TRACE_FATAL, CTHUMBAGCAMERAOBSERVER_HANDLESESSIONOPENED, "CThumbAGCameraObserver::HandleSessionOpened" ); |
182 |
197 |
183 if (aError == KErrNone) |
198 if (aError == KErrNone) |
184 { |
199 { |
185 TRAPD( err, AddObserversL() ); |
200 TRAPD( err, AddObserversL() ); |
186 if (err != KErrNone) |
201 if (err != KErrNone) |
187 { |
202 { |
188 TN_DEBUG2( "CThumbAGCameraObserver::HandleSessionOpened, AddObserversL error == %d", err ); |
203 TN_DEBUG2( "CThumbAGCameraObserver::HandleSessionOpened, AddObserversL error == %d", err ); |
|
204 OstTrace1( TRACE_FATAL, DUP1_CTHUMBAGCAMERAOBSERVER_HANDLESESSIONOPENED, "CThumbAGCameraObserver::HandleSessionOpened - AddObserversL error;err=%d", err ); |
189 } |
205 } |
190 } |
206 } |
191 else |
207 else |
192 { |
208 { |
193 TN_DEBUG2( "CThumbAGCameraObserver::HandleSessionOpened error == %d", aError ); |
209 TN_DEBUG2( "CThumbAGCameraObserver::HandleSessionOpened error == %d", aError ); |
|
210 OstTrace1( TRACE_FATAL, DUP2_CTHUMBAGCAMERAOBSERVER_HANDLESESSIONOPENED, "CThumbAGCameraObserver::HandleSessionOpened;aError=%d", aError ); |
194 } |
211 } |
195 } |
212 } |
196 |
213 |
197 // ----------------------------------------------------------------------------- |
214 // ----------------------------------------------------------------------------- |
198 // CThumbAGCameraObserver::HandleSessionError |
215 // CThumbAGCameraObserver::HandleSessionError |
199 // ----------------------------------------------------------------------------- |
216 // ----------------------------------------------------------------------------- |
200 // |
217 // |
201 void CThumbAGCameraObserver::HandleSessionError( CMdESession& /*aSession*/, TInt aError ) |
218 void CThumbAGCameraObserver::HandleSessionError( CMdESession& /*aSession*/, TInt aError ) |
202 { |
219 { |
203 TN_DEBUG2( "CThumbAGCameraObserver::HandleSessionError == %d", aError ); |
220 TN_DEBUG2( "CThumbAGCameraObserver::HandleSessionError == %d", aError ); |
|
221 OstTrace1( TRACE_FATAL, CTHUMBAGCAMERAOBSERVER_HANDLESESSIONERROR, "CThumbAGCameraObserver::HandleSessionError;aError=%d", aError ); |
204 if (aError != KErrNone && !iSessionError) |
222 if (aError != KErrNone && !iSessionError) |
205 { |
223 { |
206 iSessionError = ETrue; |
224 iSessionError = ETrue; |
207 |
225 |
208 if (!iShutdown) |
226 if (!iShutdown) |
226 void CThumbAGCameraObserver::HandleObjectNotification( CMdESession& /*aSession*/, |
245 void CThumbAGCameraObserver::HandleObjectNotification( CMdESession& /*aSession*/, |
227 TObserverNotificationType aType, |
246 TObserverNotificationType aType, |
228 const RArray<TItemId>& aObjectIdArray ) |
247 const RArray<TItemId>& aObjectIdArray ) |
229 { |
248 { |
230 TN_DEBUG1( "CThumbAGCameraObserver::HandleObjectNotification() - begin" ); |
249 TN_DEBUG1( "CThumbAGCameraObserver::HandleObjectNotification() - begin" ); |
|
250 OstTrace0( TRACE_FATAL, CTHUMBAGCAMERAOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGCameraObserver::HandleObjectNotification - begin" ); |
231 |
251 |
232 // no processor or shutting down |
252 // no processor or shutting down |
233 if ( iShutdown || !iProcessor) |
253 if ( iShutdown || !iProcessor) |
234 { |
254 { |
235 return; |
255 return; |
237 |
257 |
238 #ifdef _DEBUG |
258 #ifdef _DEBUG |
239 if (aType == ENotifyAdd) |
259 if (aType == ENotifyAdd) |
240 { |
260 { |
241 TN_DEBUG2( "CThumbAGCameraObserver::HandleObjectNotification() - ENotifyAdd %d", aObjectIdArray.Count() ); |
261 TN_DEBUG2( "CThumbAGCameraObserver::HandleObjectNotification() - ENotifyAdd %d", aObjectIdArray.Count() ); |
|
262 OstTrace1( TRACE_FATAL, DUP1_CTHUMBAGCAMERAOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGCameraObserver::HandleObjectNotification - ENotifyAdd;aObjectIdArray.Count()=%d", aObjectIdArray.Count() ); |
242 iAddCounter = aObjectIdArray.Count(); |
263 iAddCounter = aObjectIdArray.Count(); |
243 } |
264 } |
244 else if (aType == ENotifyModify) |
265 else if (aType == ENotifyModify) |
245 { |
266 { |
246 TN_DEBUG2( "CThumbAGCameraObserver::HandleObjectNotification() - ENotifyModify %d", aObjectIdArray.Count() ); |
267 TN_DEBUG2( "CThumbAGCameraObserver::HandleObjectNotification() - ENotifyModify %d", aObjectIdArray.Count() ); |
|
268 OstTrace1( TRACE_FATAL, DUP2_CTHUMBAGCAMERAOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGCameraObserver::HandleObjectNotification - ENotifyModify;aObjectIdArray.Count=%d", aObjectIdArray.Count() ); |
247 iModCounter = aObjectIdArray.Count(); |
269 iModCounter = aObjectIdArray.Count(); |
248 } |
270 } |
249 #endif |
271 #endif |
250 |
272 |
251 if ( (aType == ENotifyAdd || aType == ENotifyModify ) && (aObjectIdArray.Count() > 0) ) |
273 if ( (aType == ENotifyAdd || aType == ENotifyModify ) && (aObjectIdArray.Count() > 0) ) |
252 { |
274 { |
253 TN_DEBUG1( "CThumbAGCameraObserver::HandleObjectNotification() - AddToQueueL" ); |
275 TN_DEBUG1( "CThumbAGCameraObserver::HandleObjectNotification() - AddToQueueL" ); |
|
276 OstTrace0( TRACE_FATAL, DUP3_CTHUMBAGCAMERAOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGCameraObserver::HandleObjectNotification - AddToQueueL" ); |
254 |
277 |
255 // Add event to processing queue by type and enable force run |
278 // Add event to processing queue by type and enable force run |
256 RPointerArray<HBufC> dummyArray; |
279 RPointerArray<HBufC> dummyArray; |
257 TRAPD(err, iProcessor->AddToQueueL(aType, EGenerationItemTypeCamera, aObjectIdArray, dummyArray, EFalse)); |
280 TRAPD(err, iProcessor->AddToQueueL(aType, EGenerationItemTypeCamera, aObjectIdArray, dummyArray, EFalse)); |
258 if (err != KErrNone) |
281 if (err != KErrNone) |
259 { |
282 { |
260 TN_DEBUG1( "CThumbAGCameraObserver::HandleObjectNotification() - error adding to queue" ); |
283 TN_DEBUG1( "CThumbAGCameraObserver::HandleObjectNotification() - error adding to queue" ); |
|
284 OstTrace0( TRACE_FATAL, DUP4_CTHUMBAGCAMERAOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGCameraObserver::HandleObjectNotification - error adding to queue" ); |
261 } |
285 } |
262 } |
286 } |
263 else |
287 else |
264 { |
288 { |
265 TN_DEBUG1( "CThumbAGCameraObserver::HandleObjectNotification() - bad notification" ); |
289 TN_DEBUG1( "CThumbAGCameraObserver::HandleObjectNotification() - bad notification" ); |
|
290 OstTrace0( TRACE_FATAL, DUP5_CTHUMBAGCAMERAOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGCameraObserver::HandleObjectNotification - bad notification" ); |
266 } |
291 } |
267 |
292 |
268 #ifdef _DEBUG |
293 #ifdef _DEBUG |
269 TN_DEBUG3( "CThumbAGCameraObserver::IN-COUNTERS---------- Add = %d Modify = %d", iAddCounter, iModCounter ); |
294 TN_DEBUG3( "CThumbAGCameraObserver::IN-COUNTERS---------- Add = %d Modify = %d", iAddCounter, iModCounter ); |
|
295 OstTraceExt2( TRACE_FATAL, DUP6_CTHUMBAGCAMERAOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGCameraObserver::HandleObjectNotification;iAddCounter=%u;iModCounter=%u", iAddCounter, iModCounter ); |
270 iModCounter = 0; |
296 iModCounter = 0; |
271 iAddCounter = 0; |
297 iAddCounter = 0; |
272 #endif |
298 #endif |
273 |
299 |
274 TN_DEBUG1( "CThumbAGCameraObserver::HandleObjectNotification() - end" ); |
300 TN_DEBUG1( "CThumbAGCameraObserver::HandleObjectNotification() - end" ); |
|
301 OstTrace0( TRACE_FATAL, DUP7_CTHUMBAGCAMERAOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGCameraObserver::HandleObjectNotification - end" ); |
275 } |
302 } |
276 |
303 |
277 // ----------------------------------------------------------------------------- |
304 // ----------------------------------------------------------------------------- |
278 // CThumbAGCameraObserver::ShutdownNotification |
305 // CThumbAGCameraObserver::ShutdownNotification |
279 // ----------------------------------------------------------------------------- |
306 // ----------------------------------------------------------------------------- |
280 // |
307 // |
281 void CThumbAGCameraObserver::ShutdownNotification() |
308 void CThumbAGCameraObserver::ShutdownNotification() |
282 { |
309 { |
283 TN_DEBUG1( "CThumbAGCameraObserver::ShutdownNotification()" ); |
310 TN_DEBUG1( "CThumbAGCameraObserver::ShutdownNotification()" ); |
|
311 OstTrace0( TRACE_FATAL, CTHUMBAGCAMERAOBSERVER_SHUTDOWNNOTIFICATION, "CThumbAGCameraObserver::ShutdownNotification" ); |
284 |
312 |
285 if (!iShutdown) |
313 if (!iShutdown) |
286 { |
314 { |
287 TN_DEBUG1( "CThumbAGCameraObserver::ShutdownNotification() shutdown" ); |
315 TN_DEBUG1( "CThumbAGCameraObserver::ShutdownNotification() shutdown" ); |
|
316 OstTrace0( TRACE_FATAL, DUP1_CTHUMBAGCAMERAOBSERVER_SHUTDOWNNOTIFICATION, "CThumbAGCameraObserver::ShutdownNotification - shutdown" ); |
288 iShutdown = ETrue; |
317 iShutdown = ETrue; |
289 } |
318 } |
290 } |
319 } |
291 |
320 |
292 // --------------------------------------------------------------------------- |
321 // --------------------------------------------------------------------------- |
294 // --------------------------------------------------------------------------- |
323 // --------------------------------------------------------------------------- |
295 // |
324 // |
296 void CThumbAGCameraObserver::AddObserversL() |
325 void CThumbAGCameraObserver::AddObserversL() |
297 { |
326 { |
298 TN_DEBUG1( "CThumbAGCameraObserver::AddObserversL() - begin" ); |
327 TN_DEBUG1( "CThumbAGCameraObserver::AddObserversL() - begin" ); |
|
328 OstTrace0( TRACE_FATAL, CTHUMBAGCAMERAOBSERVER_ADDOBSERVERSL, "CThumbAGCameraObserver::AddObserversL - begin" ); |
299 |
329 |
300 CMdENamespaceDef& defaultNamespace = iMdESession->GetDefaultNamespaceDefL(); |
330 CMdENamespaceDef& defaultNamespace = iMdESession->GetDefaultNamespaceDefL(); |
301 CMdEObjectDef& objectDef = defaultNamespace.GetObjectDefL( MdeConstants::Object::KBaseObject ); |
331 CMdEObjectDef& objectDef = defaultNamespace.GetObjectDefL( MdeConstants::Object::KBaseObject ); |
302 CMdEPropertyDef& originPropDef = objectDef.GetPropertyDefL( MdeConstants::Object::KOriginProperty ); |
332 CMdEPropertyDef& originPropDef = objectDef.GetPropertyDefL( MdeConstants::Object::KOriginProperty ); |
303 |
333 |
317 iMdESession->AddObjectObserverL( *this, modifyCondition, ENotifyModify ); |
347 iMdESession->AddObjectObserverL( *this, modifyCondition, ENotifyModify ); |
318 |
348 |
319 CleanupStack::Pop( 4, addCondition ); |
349 CleanupStack::Pop( 4, addCondition ); |
320 |
350 |
321 TN_DEBUG1( "CThumbAGCameraObserver::AddObserversL() - end" ); |
351 TN_DEBUG1( "CThumbAGCameraObserver::AddObserversL() - end" ); |
|
352 OstTrace0( TRACE_FATAL, DUP1_CTHUMBAGCAMERAOBSERVER_ADDOBSERVERSL, "CThumbAGCameraObserver::AddObserversL - end" ); |
322 } |
353 } |
323 |
354 |
324 // --------------------------------------------------------------------------- |
355 // --------------------------------------------------------------------------- |
325 // CThumbAGCameraObserver::ReconnectCallBack() |
356 // CThumbAGCameraObserver::ReconnectCallBack() |
326 // --------------------------------------------------------------------------- |
357 // --------------------------------------------------------------------------- |
327 // |
358 // |
328 TInt CThumbAGCameraObserver::ReconnectCallBack(TAny* aAny) |
359 TInt CThumbAGCameraObserver::ReconnectCallBack(TAny* aAny) |
329 { |
360 { |
330 TN_DEBUG1( "CThumbAGCameraObserver::ReconnectCallBack() - reinitialize"); |
361 TN_DEBUG1( "CThumbAGCameraObserver::ReconnectCallBack() - reinitialize"); |
|
362 OstTrace0( TRACE_FATAL, CTHUMBAGCAMERAOBSERVER_RECONNECTCALLBACK, "CThumbAGCameraObserver::ReconnectCallBack - reinitialize" ); |
331 |
363 |
332 CThumbAGCameraObserver* self = static_cast<CThumbAGCameraObserver*>( aAny ); |
364 CThumbAGCameraObserver* self = static_cast<CThumbAGCameraObserver*>( aAny ); |
333 |
365 |
334 self->iReconnect->Cancel(); |
366 self->iReconnect->Cancel(); |
335 |
367 |
336 // reconnect to MDS |
368 // reconnect to MDS |
337 TRAP_IGNORE( self->InitializeL() ); |
369 TRAP_IGNORE( self->InitializeL() ); |
338 |
370 |
339 TN_DEBUG1( "CThumbAGCameraObserver::ReconnectCallBack() - done"); |
371 TN_DEBUG1( "CThumbAGCameraObserver::ReconnectCallBack() - done"); |
|
372 OstTrace0( TRACE_FATAL, DUP1_CTHUMBAGCAMERAOBSERVER_RECONNECTCALLBACK, "CThumbAGCameraObserver::ReconnectCallBack - done" ); |
340 |
373 |
341 return KErrNone; |
374 return KErrNone; |
342 } |
375 } |
343 |
376 |
344 |
377 |