72 // --------------------------------------------------------------------------- |
78 // --------------------------------------------------------------------------- |
73 // |
79 // |
74 void CThumbAGVideoObserver::ConstructL() |
80 void CThumbAGVideoObserver::ConstructL() |
75 { |
81 { |
76 TN_DEBUG1( "CThumbAGVideoObserver::ConstructL() - begin" ); |
82 TN_DEBUG1( "CThumbAGVideoObserver::ConstructL() - begin" ); |
|
83 OstTrace0( TRACE_NORMAL, CTHUMBAGVIDEOOBSERVER_CONSTRUCTL, "CThumbAGVideoObserver::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( "CThumbAGVideoObserver::ConstructL() - end" ); |
92 TN_DEBUG1( "CThumbAGVideoObserver::ConstructL() - end" ); |
|
93 OstTrace0( TRACE_NORMAL, DUP1_CTHUMBAGVIDEOOBSERVER_CONSTRUCTL, "CThumbAGVideoObserver::ConstructL - end" ); |
86 } |
94 } |
87 |
95 |
88 // --------------------------------------------------------------------------- |
96 // --------------------------------------------------------------------------- |
89 // ~CThumbAGVideoObserver |
97 // ~CThumbAGVideoObserver |
90 // --------------------------------------------------------------------------- |
98 // --------------------------------------------------------------------------- |
91 // |
99 // |
92 void CThumbAGVideoObserver::InitializeL() |
100 void CThumbAGVideoObserver::InitializeL() |
93 { |
101 { |
94 TN_DEBUG1( "CThumbAGVideoObserver::InitializeL() - begin" ); |
102 TN_DEBUG1( "CThumbAGVideoObserver::InitializeL() - begin" ); |
|
103 OstTrace0( TRACE_NORMAL, CTHUMBAGVIDEOOBSERVER_INITIALIZEL, "CThumbAGVideoObserver::InitializeL - begin" ); |
95 |
104 |
96 |
105 |
97 TN_DEBUG1( "CThumbAGVideoObserver::InitializeL() - create observers" ); |
106 TN_DEBUG1( "CThumbAGVideoObserver::InitializeL() - create observers" ); |
|
107 OstTrace0( TRACE_NORMAL, DUP1_CTHUMBAGVIDEOOBSERVER_INITIALIZEL, "CThumbAGVideoObserver::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( "CThumbAGVideoObserver::InitializeL() - end" ); |
147 TN_DEBUG1( "CThumbAGVideoObserver::InitializeL() - end" ); |
|
148 OstTrace0( TRACE_NORMAL, DUP3_CTHUMBAGVIDEOOBSERVER_INITIALIZEL, "CThumbAGVideoObserver::InitializeL - end" ); |
137 } |
149 } |
138 |
150 |
139 // --------------------------------------------------------------------------- |
151 // --------------------------------------------------------------------------- |
140 // ~CThumbAGVideoObserver |
152 // ~CThumbAGVideoObserver |
141 // --------------------------------------------------------------------------- |
153 // --------------------------------------------------------------------------- |
142 // |
154 // |
143 CThumbAGVideoObserver::~CThumbAGVideoObserver() |
155 CThumbAGVideoObserver::~CThumbAGVideoObserver() |
144 { |
156 { |
145 TN_DEBUG1( "CThumbAGVideoObserver::~CThumbAGVideoObserver() - begin" ); |
157 TN_DEBUG1( "CThumbAGVideoObserver::~CThumbAGVideoObserver() - begin" ); |
|
158 OstTrace0( TRACE_NORMAL, CTHUMBAGVIDEOOBSERVER_CTHUMBAGVIDEOOBSERVER, "CThumbAGVideoObserver::~CThumbAGVideoObserver - begin" ); |
146 |
159 |
147 iShutdown = ETrue; |
160 iShutdown = ETrue; |
148 |
161 |
149 delete iMDSShutdownObserver; |
162 delete iMDSShutdownObserver; |
150 delete iShutdownObserver; |
163 delete iShutdownObserver; |
165 delete iMdESession; |
178 delete iMdESession; |
166 iMdESession = NULL; |
179 iMdESession = NULL; |
167 } |
180 } |
168 |
181 |
169 TN_DEBUG1( "CThumbAGVideoObserver::~CThumbAGVideoObserver() - end" ); |
182 TN_DEBUG1( "CThumbAGVideoObserver::~CThumbAGVideoObserver() - end" ); |
|
183 OstTrace0( TRACE_NORMAL, DUP1_CTHUMBAGVIDEOOBSERVER_CTHUMBAGVIDEOOBSERVER, "CThumbAGVideoObserver::~CThumbAGVideoObserver - end" ); |
170 } |
184 } |
171 |
185 |
172 // ----------------------------------------------------------------------------- |
186 // ----------------------------------------------------------------------------- |
173 // CThumbAGVideoObserver::HandleSessionOpened |
187 // CThumbAGVideoObserver::HandleSessionOpened |
174 // ----------------------------------------------------------------------------- |
188 // ----------------------------------------------------------------------------- |
175 // |
189 // |
176 void CThumbAGVideoObserver::HandleSessionOpened( CMdESession& /* aSession */, TInt aError ) |
190 void CThumbAGVideoObserver::HandleSessionOpened( CMdESession& /* aSession */, TInt aError ) |
177 { |
191 { |
178 TN_DEBUG1( "CThumbAGVideoObserver::HandleSessionOpened"); |
192 TN_DEBUG1( "CThumbAGVideoObserver::HandleSessionOpened"); |
|
193 OstTrace0( TRACE_NORMAL, CTHUMBAGVIDEOOBSERVER_HANDLESESSIONOPENED, "CThumbAGVideoObserver::HandleSessionOpened" ); |
179 |
194 |
180 if (aError == KErrNone) |
195 if (aError == KErrNone) |
181 { |
196 { |
182 TRAPD( err, AddObserversL() ); |
197 TRAPD( err, AddObserversL() ); |
183 if (err != KErrNone) |
198 if (err != KErrNone) |
184 { |
199 { |
185 TN_DEBUG2( "CThumbAGVideoObserver::HandleSessionOpened, AddObserversL error == %d", err ); |
200 TN_DEBUG2( "CThumbAGVideoObserver::HandleSessionOpened, AddObserversL error == %d", err ); |
|
201 OstTrace1( TRACE_NORMAL, DUP1_CTHUMBAGVIDEOOBSERVER_HANDLESESSIONOPENED, "CThumbAGVideoObserver::HandleSessionOpened - AddObserversL;err=%d", err ); |
186 } |
202 } |
187 } |
203 } |
188 else |
204 else |
189 { |
205 { |
190 TN_DEBUG2( "CThumbAGVideoObserver::HandleSessionOpened error == %d", aError ); |
206 TN_DEBUG2( "CThumbAGVideoObserver::HandleSessionOpened error == %d", aError ); |
|
207 OstTrace1( TRACE_NORMAL, DUP2_CTHUMBAGVIDEOOBSERVER_HANDLESESSIONOPENED, "CThumbAGVideoObserver::HandleSessionOpened;aError=%d", aError ); |
191 } |
208 } |
192 } |
209 } |
193 |
210 |
194 // ----------------------------------------------------------------------------- |
211 // ----------------------------------------------------------------------------- |
195 // CThumbAGVideoObserver::HandleSessionError |
212 // CThumbAGVideoObserver::HandleSessionError |
196 // ----------------------------------------------------------------------------- |
213 // ----------------------------------------------------------------------------- |
197 // |
214 // |
198 void CThumbAGVideoObserver::HandleSessionError( CMdESession& /*aSession*/, TInt aError ) |
215 void CThumbAGVideoObserver::HandleSessionError( CMdESession& /*aSession*/, TInt aError ) |
199 { |
216 { |
200 TN_DEBUG2( "CThumbAGVideoObserver::HandleSessionError == %d", aError ); |
217 TN_DEBUG2( "CThumbAGVideoObserver::HandleSessionError == %d", aError ); |
|
218 OstTrace1( TRACE_NORMAL, CTHUMBAGVIDEOOBSERVER_HANDLESESSIONERROR, "CThumbAGVideoObserver::HandleSessionError;aError=%d", aError ); |
201 if (aError != KErrNone && !iSessionError) |
219 if (aError != KErrNone && !iSessionError) |
202 { |
220 { |
203 iSessionError = ETrue; |
221 iSessionError = ETrue; |
204 |
222 |
205 if (!iShutdown) |
223 if (!iShutdown) |
223 void CThumbAGVideoObserver::HandleObjectNotification( CMdESession& /*aSession*/, |
242 void CThumbAGVideoObserver::HandleObjectNotification( CMdESession& /*aSession*/, |
224 TObserverNotificationType aType, |
243 TObserverNotificationType aType, |
225 const RArray<TItemId>& aObjectIdArray ) |
244 const RArray<TItemId>& aObjectIdArray ) |
226 { |
245 { |
227 TN_DEBUG1( "CThumbAGVideoObserver::HandleObjectNotification() - begin" ); |
246 TN_DEBUG1( "CThumbAGVideoObserver::HandleObjectNotification() - begin" ); |
|
247 OstTrace0( TRACE_NORMAL, CTHUMBAGVIDEOOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGVideoObserver::HandleObjectNotification - begin" ); |
228 |
248 |
229 // no processor or shutting down |
249 // no processor or shutting down |
230 if ( iShutdown || !iProcessor) |
250 if ( iShutdown || !iProcessor) |
231 { |
251 { |
232 return; |
252 return; |
234 |
254 |
235 #ifdef _DEBUG |
255 #ifdef _DEBUG |
236 if (aType == ENotifyAdd) |
256 if (aType == ENotifyAdd) |
237 { |
257 { |
238 TN_DEBUG2( "CThumbAGVideoObserver::HandleObjectNotification() - ENotifyAdd %d", aObjectIdArray.Count() ); |
258 TN_DEBUG2( "CThumbAGVideoObserver::HandleObjectNotification() - ENotifyAdd %d", aObjectIdArray.Count() ); |
|
259 OstTrace1( TRACE_NORMAL, DUP1_CTHUMBAGVIDEOOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGVideoObserver::HandleObjectNotification - ENotifyAdd;aObjectIdArray.Count()=%d", aObjectIdArray.Count() ); |
239 iAddCounter = aObjectIdArray.Count(); |
260 iAddCounter = aObjectIdArray.Count(); |
240 } |
261 } |
241 else if (aType == ENotifyModify) |
262 else if (aType == ENotifyModify) |
242 { |
263 { |
243 TN_DEBUG2( "CThumbAGVideoObserver::HandleObjectNotification() - ENotifyModify %d", aObjectIdArray.Count() ); |
264 TN_DEBUG2( "CThumbAGVideoObserver::HandleObjectNotification() - ENotifyModify %d", aObjectIdArray.Count() ); |
|
265 OstTrace1( TRACE_NORMAL, DUP2_CTHUMBAGVIDEOOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGVideoObserver::HandleObjectNotification - ENotifyModify;aObjectIdArray.Count()=%d", aObjectIdArray.Count() ); |
244 iModCounter = aObjectIdArray.Count(); |
266 iModCounter = aObjectIdArray.Count(); |
245 } |
267 } |
246 #endif |
268 #endif |
247 |
269 |
248 if ( (aType == ENotifyAdd || aType == ENotifyModify ) && (aObjectIdArray.Count() > 0) ) |
270 if ( (aType == ENotifyAdd || aType == ENotifyModify ) && (aObjectIdArray.Count() > 0) ) |
249 { |
271 { |
250 TN_DEBUG1( "CThumbAGVideoObserver::HandleObjectNotification() - AddToQueueL" ); |
272 TN_DEBUG1( "CThumbAGVideoObserver::HandleObjectNotification() - AddToQueueL" ); |
|
273 OstTrace0( TRACE_NORMAL, DUP3_CTHUMBAGVIDEOOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGVideoObserver::HandleObjectNotification - AddToQueueL" ); |
251 |
274 |
252 // Add event to processing queue by type and enable force run |
275 // Add event to processing queue by type and enable force run |
253 RPointerArray<HBufC> dummyArray; |
276 RPointerArray<HBufC> dummyArray; |
254 TRAPD(err, iProcessor->AddToQueueL(aType, EGenerationItemTypeVideo, aObjectIdArray, dummyArray, EFalse)); |
277 TRAPD(err, iProcessor->AddToQueueL(aType, EGenerationItemTypeVideo, aObjectIdArray, dummyArray, EFalse)); |
255 if (err != KErrNone) |
278 if (err != KErrNone) |
256 { |
279 { |
257 TN_DEBUG1( "CThumbAGVideoObserver::HandleObjectNotification() - error adding to queue" ); |
280 TN_DEBUG1( "CThumbAGVideoObserver::HandleObjectNotification() - error adding to queue" ); |
|
281 OstTrace0( TRACE_NORMAL, DUP4_CTHUMBAGVIDEOOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGVideoObserver::HandleObjectNotification - error adding to queue" ); |
258 } |
282 } |
259 } |
283 } |
260 else |
284 else |
261 { |
285 { |
262 TN_DEBUG1( "CThumbAGVideoObserver::HandleObjectNotification() - bad notification" ); |
286 TN_DEBUG1( "CThumbAGVideoObserver::HandleObjectNotification() - bad notification" ); |
|
287 OstTrace0( TRACE_NORMAL, DUP5_CTHUMBAGVIDEOOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGVideoObserver::HandleObjectNotification - bad notification" ); |
263 } |
288 } |
264 |
289 |
265 #ifdef _DEBUG |
290 #ifdef _DEBUG |
266 TN_DEBUG3( "CThumbAGVideoObserver::IN-COUNTERS---------- Add = %d Modify = %d", iAddCounter, iModCounter ); |
291 TN_DEBUG3( "CThumbAGVideoObserver::IN-COUNTERS---------- Add = %d Modify = %d", iAddCounter, iModCounter ); |
|
292 OstTraceExt2( TRACE_NORMAL, DUP6_CTHUMBAGVIDEOOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGVideoObserver::IN-COUNTERS---------- Add = %u Modify = %u", iAddCounter, iModCounter ); |
267 iModCounter = 0; |
293 iModCounter = 0; |
268 iAddCounter = 0; |
294 iAddCounter = 0; |
269 #endif |
295 #endif |
270 |
296 |
271 TN_DEBUG1( "CThumbAGVideoObserver::HandleObjectNotification() - end" ); |
297 TN_DEBUG1( "CThumbAGVideoObserver::HandleObjectNotification() - end" ); |
|
298 OstTrace0( TRACE_NORMAL, DUP7_CTHUMBAGVIDEOOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGVideoObserver::HandleObjectNotification - end" ); |
272 } |
299 } |
273 |
300 |
274 // ----------------------------------------------------------------------------- |
301 // ----------------------------------------------------------------------------- |
275 // CThumbAGVideoObserver::ShutdownNotification |
302 // CThumbAGVideoObserver::ShutdownNotification |
276 // ----------------------------------------------------------------------------- |
303 // ----------------------------------------------------------------------------- |
277 // |
304 // |
278 void CThumbAGVideoObserver::ShutdownNotification() |
305 void CThumbAGVideoObserver::ShutdownNotification() |
279 { |
306 { |
280 TN_DEBUG1( "CThumbAGVideoObserver::ShutdownNotification()" ); |
307 TN_DEBUG1( "CThumbAGVideoObserver::ShutdownNotification()" ); |
|
308 OstTrace0( TRACE_NORMAL, CTHUMBAGVIDEOOBSERVER_SHUTDOWNNOTIFICATION, "CThumbAGVideoObserver::ShutdownNotification" ); |
281 |
309 |
282 if (!iShutdown) |
310 if (!iShutdown) |
283 { |
311 { |
284 TN_DEBUG1( "CThumbAGVideoObserver::ShutdownNotification() shutdown" ); |
312 TN_DEBUG1( "CThumbAGVideoObserver::ShutdownNotification() shutdown" ); |
|
313 OstTrace0( TRACE_NORMAL, DUP1_CTHUMBAGVIDEOOBSERVER_SHUTDOWNNOTIFICATION, "CThumbAGVideoObserver::ShutdownNotification - shutdown" ); |
285 iShutdown = ETrue; |
314 iShutdown = ETrue; |
286 } |
315 } |
287 } |
316 } |
288 |
317 |
289 // --------------------------------------------------------------------------- |
318 // --------------------------------------------------------------------------- |
291 // --------------------------------------------------------------------------- |
320 // --------------------------------------------------------------------------- |
292 // |
321 // |
293 void CThumbAGVideoObserver::AddObserversL() |
322 void CThumbAGVideoObserver::AddObserversL() |
294 { |
323 { |
295 TN_DEBUG1( "CThumbAGVideoObserver::AddObserversL() - begin" ); |
324 TN_DEBUG1( "CThumbAGVideoObserver::AddObserversL() - begin" ); |
|
325 OstTrace0( TRACE_NORMAL, CTHUMBAGVIDEOOBSERVER_ADDOBSERVERSL, "CThumbAGVideoObserver::AddObserversL - begin" ); |
296 |
326 |
297 CMdENamespaceDef& defaultNamespace = iMdESession->GetDefaultNamespaceDefL(); |
327 CMdENamespaceDef& defaultNamespace = iMdESession->GetDefaultNamespaceDefL(); |
298 CMdEObjectDef& objectDef = defaultNamespace.GetObjectDefL( MdeConstants::Object::KBaseObject ); |
328 CMdEObjectDef& objectDef = defaultNamespace.GetObjectDefL( MdeConstants::Object::KBaseObject ); |
299 CMdEPropertyDef& originPropDef = objectDef.GetPropertyDefL( MdeConstants::Object::KOriginProperty ); |
329 CMdEPropertyDef& originPropDef = objectDef.GetPropertyDefL( MdeConstants::Object::KOriginProperty ); |
300 CMdEObjectDef& videoDef = defaultNamespace.GetObjectDefL( MdeConstants::Video::KVideoObject ); |
330 CMdEObjectDef& videoDef = defaultNamespace.GetObjectDefL( MdeConstants::Video::KVideoObject ); |
322 iMdESession->AddObjectObserverL( *this, modifyCondition, ENotifyModify ); |
352 iMdESession->AddObjectObserverL( *this, modifyCondition, ENotifyModify ); |
323 |
353 |
324 CleanupStack::Pop( 6, addCondition ); |
354 CleanupStack::Pop( 6, addCondition ); |
325 |
355 |
326 TN_DEBUG1( "CThumbAGVideoObserver::AddObserversL() - end" ); |
356 TN_DEBUG1( "CThumbAGVideoObserver::AddObserversL() - end" ); |
|
357 OstTrace0( TRACE_NORMAL, DUP1_CTHUMBAGVIDEOOBSERVER_ADDOBSERVERSL, "CThumbAGVideoObserver::AddObserversL - end" ); |
327 } |
358 } |
328 |
359 |
329 // --------------------------------------------------------------------------- |
360 // --------------------------------------------------------------------------- |
330 // CThumbAGVideoObserver::ReconnectCallBack() |
361 // CThumbAGVideoObserver::ReconnectCallBack() |
331 // --------------------------------------------------------------------------- |
362 // --------------------------------------------------------------------------- |
332 // |
363 // |
333 TInt CThumbAGVideoObserver::ReconnectCallBack(TAny* aAny) |
364 TInt CThumbAGVideoObserver::ReconnectCallBack(TAny* aAny) |
334 { |
365 { |
335 TN_DEBUG1( "CThumbAGVideoObserver::ReconnectCallBack() - reinitialize"); |
366 TN_DEBUG1( "CThumbAGVideoObserver::ReconnectCallBack() - reinitialize"); |
|
367 OstTrace0( TRACE_NORMAL, CTHUMBAGVIDEOOBSERVER_RECONNECTCALLBACK, "CThumbAGVideoObserver::ReconnectCallBack - reinitialize" ); |
336 |
368 |
337 CThumbAGVideoObserver* self = static_cast<CThumbAGVideoObserver*>( aAny ); |
369 CThumbAGVideoObserver* self = static_cast<CThumbAGVideoObserver*>( aAny ); |
338 |
370 |
339 self->iReconnect->Cancel(); |
371 self->iReconnect->Cancel(); |
340 |
372 |
341 // reconnect to MDS |
373 // reconnect to MDS |
342 TRAP_IGNORE( self->InitializeL() ); |
374 TRAP_IGNORE( self->InitializeL() ); |
343 |
375 |
344 TN_DEBUG1( "CThumbAGVideoObserver::ReconnectCallBack() - done"); |
376 TN_DEBUG1( "CThumbAGVideoObserver::ReconnectCallBack() - done"); |
|
377 OstTrace0( TRACE_NORMAL, DUP1_CTHUMBAGVIDEOOBSERVER_RECONNECTCALLBACK, "CThumbAGVideoObserver::ReconnectCallBack - done" ); |
345 |
378 |
346 return KErrNone; |
379 return KErrNone; |
347 } |
380 } |
348 |
381 |
349 |
382 |