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