|
1 /* |
|
2 * Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: provides album handling services for UPnP framework |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "upnpapplicationcrkeys.h" // KCRUidUPnPApplication |
|
19 #include <mpxcollectionutility.h> |
|
20 #include <mpxcollectionframeworkdefs.h> // main attribute keys |
|
21 #include <mpxmessagegeneraldefs.h> |
|
22 #include <mpxmediageneraldefs.h> // commonly used attribute keys |
|
23 #include <mpxmediacontainerdefs.h> // container-specific attribute keys |
|
24 #include <mpxcollectionpath.h> |
|
25 #include <mpxcollectionmessage.h> |
|
26 #include <mpxmediadrmdefs.h> |
|
27 |
|
28 #include <mpxmedia.h> |
|
29 #include <mpxmediaarray.h> |
|
30 |
|
31 #include "upnpalbumservices.h" // ourselves |
|
32 |
|
33 // debug |
|
34 _LIT16( KComponentLogfile, "musicadapter.txt" ); |
|
35 #include "upnplog.h" |
|
36 |
|
37 // Constant definitions |
|
38 #define KAlbumsCollectionUid 0x20007197 // album plugin uid |
|
39 |
|
40 // ======== MEMBER FUNCTIONS ======== |
|
41 |
|
42 // --------------------------------------------------------------------------- |
|
43 // CUPnPAlbumServices::NewL |
|
44 // 1st phase constructor. |
|
45 // --------------------------------------------------------------------------- |
|
46 // |
|
47 EXPORT_C CUPnPAlbumServices* CUPnPAlbumServices::NewL() |
|
48 { |
|
49 __LOG( "CUPnPAlbumServices::NewL" ); |
|
50 |
|
51 CUPnPAlbumServices* self = new(ELeave) CUPnPAlbumServices(); |
|
52 CleanupStack::PushL( self ); |
|
53 self->ConstructL(); |
|
54 CleanupStack::Pop( self ); |
|
55 return self; |
|
56 } |
|
57 |
|
58 // -------------------------------------------------------------------------- |
|
59 // CUPnPAlbumServices::CUPnPAlbumServices |
|
60 // Default constructor. |
|
61 // -------------------------------------------------------------------------- |
|
62 // |
|
63 CUPnPAlbumServices::CUPnPAlbumServices() : iStatus( KErrNone ) |
|
64 { |
|
65 // None. |
|
66 } |
|
67 |
|
68 // -------------------------------------------------------------------------- |
|
69 // CUPnPAlbumServices::ConstructL |
|
70 // 2nd phase constructor |
|
71 // -------------------------------------------------------------------------- |
|
72 // |
|
73 void CUPnPAlbumServices::ConstructL() |
|
74 { |
|
75 __LOG( "CUPnPAlbumServices::ConstructL" ); |
|
76 iAlbumNames = new (ELeave) CDesCArrayFlat(5); |
|
77 iAlbumIds = new (ELeave) CDesCArrayFlat(5); |
|
78 |
|
79 iCollectionUtility = MMPXCollectionUtility::NewL( |
|
80 (MMPXCollectionObserver*)this, KMcModePlaylist ); |
|
81 |
|
82 // Open album collection plugin. Callback to HandleCollectionMessage. |
|
83 CMPXCollectionPath* path = CMPXCollectionPath::NewL(); |
|
84 CleanupStack::PushL( path ); |
|
85 path->AppendL( KAlbumsCollectionUid ); |
|
86 iCollectionUtility->Collection().OpenL( *path ); |
|
87 CleanupStack::PopAndDestroy( path ); |
|
88 |
|
89 // Wait until signalled to proceed |
|
90 iWait = new (ELeave) CActiveSchedulerWait(); |
|
91 iWait->Start(); |
|
92 |
|
93 __LOG1( "CUPnPAlbumServices::ConstructL - End %d", iStatus ); |
|
94 } |
|
95 |
|
96 // -------------------------------------------------------------------------- |
|
97 // CUPnPAlbumServices::ListAlbumsL |
|
98 // -------------------------------------------------------------------------- |
|
99 // |
|
100 EXPORT_C void CUPnPAlbumServices::ListAlbumsL( |
|
101 CDesCArray& aAlbumIds, |
|
102 CDesCArray& aAlbumNames ) |
|
103 { |
|
104 __LOG( "CUPnPAlbumServices::ListAlbumsL" ); |
|
105 |
|
106 // Check if already listed |
|
107 |
|
108 if( iStatus != KErrNone) |
|
109 { |
|
110 __LOG1( "CUPnPAlbumServices::ListAlbumsL iStatus %d return", iStatus ); |
|
111 return; |
|
112 } |
|
113 |
|
114 if( iAlbumNames->Count() > 0 && iAlbumIds->Count() > 0 ) |
|
115 { |
|
116 __LOG( "CUPnPAlbumServices::ListAlbumsL: Already fetched." ); |
|
117 // Copy from member |
|
118 TInt count = iAlbumNames->Count(); |
|
119 __LOG1( "Album count=%d", count ); |
|
120 for( TInt i = 0; i < count; i++ ) |
|
121 { |
|
122 aAlbumNames.AppendL( iAlbumNames->MdcaPoint(i) ); |
|
123 aAlbumIds.AppendL( iAlbumIds->MdcaPoint(i) ); |
|
124 } |
|
125 __LOG( "CUPnPAlbumServices::ListAlbumsL: Return." ); |
|
126 return; |
|
127 } |
|
128 |
|
129 CMPXCollectionPath* path = iCollectionUtility->Collection().PathL(); |
|
130 CleanupStack::PushL( path ); |
|
131 path->SelectAllL(); |
|
132 |
|
133 RArray<TMPXAttribute> attrs; |
|
134 CleanupClosePushL( attrs ); |
|
135 attrs.Append( KMPXMediaGeneralId ); |
|
136 attrs.Append( KMPXMediaGeneralTitle ); |
|
137 |
|
138 // Get album list from collection. Callback to HandleCollectionMediaL |
|
139 iCollectionUtility->Collection().MediaL( *path, attrs.Array() ); |
|
140 CleanupStack::PopAndDestroy( &attrs ); |
|
141 CleanupStack::PopAndDestroy( path ); |
|
142 |
|
143 // Wait until signalled to proceed |
|
144 iWait->Start(); |
|
145 |
|
146 if( iStatus != KErrNone ) |
|
147 { |
|
148 if( iStatus == KErrNotFound ) |
|
149 { |
|
150 // No albums available. |
|
151 __LOG( "ListAlbumsL: No albums available!" ); |
|
152 return; |
|
153 } |
|
154 else // Some other problem |
|
155 { |
|
156 User::Leave( iStatus ); |
|
157 } |
|
158 } |
|
159 |
|
160 if ( iMedia != 0 ) |
|
161 { |
|
162 TMPXAttribute mediaArrayAttr( KMPXMediaIdContainer, |
|
163 EMPXMediaArrayContents ); |
|
164 |
|
165 if( iMedia->IsSupported( mediaArrayAttr ) ) |
|
166 { |
|
167 __LOG("getting album array"); |
|
168 CMPXMediaArray* medias = iMedia->ValueCObjectL<CMPXMediaArray>( |
|
169 mediaArrayAttr ); |
|
170 |
|
171 if( medias ) |
|
172 { |
|
173 CleanupStack::PushL( medias ); |
|
174 // Album count |
|
175 TInt count = medias->Count(); |
|
176 __LOG1( "Album count=%d", count ); |
|
177 |
|
178 for( TInt i = 0; i < count; ++i ) |
|
179 { |
|
180 const CMPXMedia* entry = (*medias)[i]; |
|
181 const TDesC& title = entry->ValueText( |
|
182 KMPXMediaGeneralTitle ); |
|
183 __LOG3( "Title: %d/%d [%S]",i, count, &title ); |
|
184 TMPXItemId id = *entry->Value<TMPXItemId>( |
|
185 KMPXMediaGeneralId ); |
|
186 aAlbumNames.AppendL( title ); |
|
187 iAlbumNames->AppendL( title ); // for later usage |
|
188 aAlbumIds.AppendL( Id2Desc( id ) ); |
|
189 iAlbumIds->AppendL( Id2Desc( id ) ); // for later usage |
|
190 } |
|
191 CleanupStack::PopAndDestroy( medias ); |
|
192 } |
|
193 } |
|
194 else |
|
195 { |
|
196 __LOG( "getting single item" ); |
|
197 const TDesC& title = iMedia->ValueText( |
|
198 KMPXMediaGeneralTitle ); |
|
199 __LOG1( "Title: %S", &title ); |
|
200 TMPXItemId id = *iMedia->Value<TMPXItemId>( |
|
201 KMPXMediaGeneralId ); |
|
202 aAlbumNames.AppendL( title ); |
|
203 iAlbumNames->AppendL( title ); // for later usage |
|
204 aAlbumIds.AppendL( Id2Desc( id ) ); |
|
205 iAlbumIds->AppendL( Id2Desc( id ) ); // for later usage |
|
206 } |
|
207 delete iMedia; |
|
208 iMedia = 0; |
|
209 } |
|
210 |
|
211 __LOG( "CUPnPAlbumServices::ListAlbumsL -End" ); |
|
212 } |
|
213 |
|
214 // -------------------------------------------------------------------------- |
|
215 // CUPnPAlbumServices::OpenAlbumL |
|
216 // -------------------------------------------------------------------------- |
|
217 // |
|
218 EXPORT_C void CUPnPAlbumServices::OpenAlbumL( |
|
219 const TDesC& aAlbumId, |
|
220 CDesCArray& aContentMedia ) |
|
221 |
|
222 { |
|
223 |
|
224 |
|
225 __LOG1( "CUPnPAlbumServices::OpenAlbumL(%S)", &aAlbumId ); |
|
226 |
|
227 |
|
228 if( iStatus != KErrNone) |
|
229 { |
|
230 __LOG1( "CUPnPAlbumServices::OpenAlbumL iStatus %d return", iStatus ); |
|
231 return; |
|
232 } |
|
233 |
|
234 CMPXCollectionPath* path = iCollectionUtility->Collection().PathL(); |
|
235 CleanupStack::PushL( path ); |
|
236 path->AppendL( Desc2Id( aAlbumId ) ); |
|
237 |
|
238 iCollectionUtility->Collection().OpenL( *path ); |
|
239 CleanupStack::PopAndDestroy( path ); |
|
240 |
|
241 // Wait until signalled to proceed |
|
242 iWait->Start(); |
|
243 |
|
244 if( iStatus != KErrNone ) |
|
245 { |
|
246 // Open album failed. |
|
247 User::Leave( iStatus ); |
|
248 } |
|
249 |
|
250 CMPXCollectionPath* mediaPath = iCollectionUtility->Collection().PathL(); |
|
251 CleanupStack::PushL( mediaPath ); |
|
252 mediaPath->SelectAllL(); |
|
253 |
|
254 RArray<TMPXAttribute> attrs; |
|
255 CleanupClosePushL( attrs ); |
|
256 attrs.Append( KMPXMediaGeneralUri ); |
|
257 |
|
258 // Get metadata of given album. Callback to HandleCollectionMediaL |
|
259 iCollectionUtility->Collection().MediaL( *mediaPath, attrs.Array() ); |
|
260 CleanupStack::PopAndDestroy( &attrs ); |
|
261 CleanupStack::PopAndDestroy( mediaPath ); |
|
262 |
|
263 // Wait until signalled to proceed |
|
264 iWait->Start(); |
|
265 |
|
266 if( iStatus != KErrNone ) |
|
267 { |
|
268 if( iStatus == KErrNotFound ) |
|
269 { |
|
270 // Album is empty |
|
271 __LOG( "ListAlbumsL: Album is empty" ); |
|
272 return; |
|
273 } |
|
274 else // Some other problem |
|
275 { |
|
276 User::Leave( iStatus ); |
|
277 } |
|
278 } |
|
279 |
|
280 if ( iMedia != 0 ) |
|
281 { |
|
282 __LOG( "CUPnPAlbumServices::iMedia exist! "); |
|
283 TMPXAttribute mediaArrayAttr( KMPXMediaIdContainer, |
|
284 EMPXMediaArrayContents ); |
|
285 |
|
286 // Check if there is more than one item in album |
|
287 if( iMedia->IsSupported( mediaArrayAttr ) ) |
|
288 { |
|
289 __LOG("getting album array"); |
|
290 CMPXMediaArray* medias = iMedia->ValueCObjectL<CMPXMediaArray>( |
|
291 mediaArrayAttr ); |
|
292 |
|
293 if( medias ) |
|
294 { |
|
295 __LOG( "CUPnPAlbumServices::album array exist! "); |
|
296 CleanupStack::PushL( medias ); |
|
297 // Album count |
|
298 TInt count = medias->Count(); |
|
299 __LOG1( "Album count=%d", count ); |
|
300 |
|
301 for( TInt i = 0; i < count; ++i ) |
|
302 { |
|
303 __LOG2( "accessing album: item %d of %d",i, count ); |
|
304 const CMPXMedia* entry = (*medias)[i]; |
|
305 const TDesC& uri = entry->ValueText( |
|
306 KMPXMediaGeneralUri ); |
|
307 __LOG1( "Item uri:[%S]", &uri ); |
|
308 aContentMedia.AppendL( entry->ValueText( |
|
309 KMPXMediaGeneralUri ) ); |
|
310 } |
|
311 CleanupStack::PopAndDestroy( medias ); |
|
312 } |
|
313 } |
|
314 else // Handle single item |
|
315 { |
|
316 __LOG("getting single item"); |
|
317 const TDesC& uri = iMedia->ValueText( KMPXMediaGeneralUri ); |
|
318 __LOG1( "Item uri:[%S]", &uri ); |
|
319 aContentMedia.AppendL( iMedia->ValueText( KMPXMediaGeneralUri ) ); |
|
320 } |
|
321 |
|
322 delete iMedia; |
|
323 iMedia = 0; |
|
324 } |
|
325 __LOG( "CUPnPAlbumServices::OpenAlbumL - End "); |
|
326 } |
|
327 |
|
328 // -------------------------------------------------------------------------- |
|
329 // CUPnPAlbumServices::IsValidAlbumL |
|
330 // -------------------------------------------------------------------------- |
|
331 // |
|
332 EXPORT_C TBool CUPnPAlbumServices::IsValidAlbumL( |
|
333 const TDesC& aAlbumName ) |
|
334 { |
|
335 TBool found = EFalse; |
|
336 |
|
337 __LOG1( "IsValidAlbumL(%S)", &aAlbumName ); |
|
338 |
|
339 if( iStatus != KErrNone) |
|
340 { |
|
341 __LOG1( "CUPnPAlbumServices::IsValidAlbumL iStatus %d return", iStatus ); |
|
342 return EFalse; |
|
343 } |
|
344 |
|
345 // Check if already listed |
|
346 if( iAlbumNames->Count() > 0 ) |
|
347 { |
|
348 __LOG( "CUPnPAlbumServices::IsValidAlbumL: Already fetched." ); |
|
349 TInt count = iAlbumNames->Count(); |
|
350 __LOG1( "Album count=%d", count ); |
|
351 for( TInt i = 0; i < count; i++ ) |
|
352 { |
|
353 if( aAlbumName.Compare( iAlbumNames->MdcaPoint(i) ) == 0 ) |
|
354 { |
|
355 __LOG( "IsValidAlbum -> True "); |
|
356 i = count; |
|
357 found = ETrue; |
|
358 } |
|
359 } |
|
360 __LOG( "CUPnPAlbumServices::IsValidAlbumL: Return." ); |
|
361 return found; |
|
362 } |
|
363 |
|
364 // List albums |
|
365 CMPXCollectionPath* mediaPath = iCollectionUtility->Collection().PathL(); |
|
366 CleanupStack::PushL( mediaPath ); |
|
367 mediaPath->SelectAllL(); |
|
368 |
|
369 RArray<TMPXAttribute> attrs; |
|
370 CleanupClosePushL( attrs ); |
|
371 attrs.Append( KMPXMediaGeneralId ); |
|
372 attrs.Append( KMPXMediaGeneralTitle ); |
|
373 |
|
374 // Get album data. Callback to HandleCollectionMediaL |
|
375 iCollectionUtility->Collection().MediaL( *mediaPath, attrs.Array() ); |
|
376 CleanupStack::PopAndDestroy( &attrs ); |
|
377 CleanupStack::PopAndDestroy( mediaPath ); |
|
378 |
|
379 // Wait until signalled to proceed |
|
380 iWait->Start(); |
|
381 |
|
382 if( iStatus != KErrNone ) |
|
383 { |
|
384 if( iStatus == KErrNotFound ) |
|
385 { |
|
386 // No albums available |
|
387 __LOG( "ListAlbumsL: No albums available" ); |
|
388 return EFalse; |
|
389 } |
|
390 else // Some other problem |
|
391 { |
|
392 User::Leave( iStatus ); |
|
393 } |
|
394 } |
|
395 |
|
396 if ( iMedia != 0 ) |
|
397 { |
|
398 __LOG( "CUPnPAlbumServices::iMedia exist! "); |
|
399 TMPXAttribute mediaArrayAttr( KMPXMediaIdContainer, |
|
400 EMPXMediaArrayContents ); |
|
401 |
|
402 if( iMedia->IsSupported( mediaArrayAttr ) ) |
|
403 { |
|
404 __LOG("getting album array"); |
|
405 CMPXMediaArray* medias = iMedia->ValueCObjectL<CMPXMediaArray>( |
|
406 mediaArrayAttr ); |
|
407 |
|
408 if( medias ) |
|
409 { |
|
410 __LOG( "CUPnPAlbumServices::album array exist! "); |
|
411 CleanupStack::PushL( medias ); |
|
412 // Album count |
|
413 TInt count = medias->Count(); |
|
414 __LOG1( "Album count=%d", count ); |
|
415 |
|
416 for( TInt i = 0; i < count; ++i ) |
|
417 { |
|
418 const CMPXMedia* entry = (*medias)[i]; |
|
419 if( aAlbumName.Compare( |
|
420 entry->ValueText( KMPXMediaGeneralTitle ) ) == 0 ) |
|
421 { |
|
422 __LOG( "IsValidAlbum -> True "); |
|
423 found = ETrue; |
|
424 break; |
|
425 } |
|
426 } |
|
427 CleanupStack::PopAndDestroy( medias ); |
|
428 } |
|
429 } |
|
430 else |
|
431 { |
|
432 __LOG( "iMedia->IsSupported = False!" ); |
|
433 } |
|
434 delete iMedia; |
|
435 iMedia = 0; |
|
436 } |
|
437 |
|
438 __LOG( "CUPnPAlbumServices::IsValidAlbumL - End "); |
|
439 return found; |
|
440 } |
|
441 |
|
442 // -------------------------------------------------------------------------- |
|
443 // CUPnPAlbumServices::~CUPnPAlbumServices |
|
444 // Destructor. |
|
445 // -------------------------------------------------------------------------- |
|
446 // |
|
447 EXPORT_C CUPnPAlbumServices::~CUPnPAlbumServices() |
|
448 { |
|
449 __LOG( "CUPnPAlbumServices::~CUPnPAlbumServices" ); |
|
450 iAlbumNames->Reset(); |
|
451 delete iAlbumNames; |
|
452 iAlbumNames = 0; |
|
453 iAlbumIds->Reset(); |
|
454 delete iAlbumIds; |
|
455 iAlbumIds = 0; |
|
456 |
|
457 if ( iCollectionUtility ) |
|
458 { |
|
459 iCollectionUtility->Close(); |
|
460 iCollectionUtility = 0; |
|
461 } |
|
462 |
|
463 delete iWait; |
|
464 iWait = 0; |
|
465 |
|
466 if( iMedia ) |
|
467 { |
|
468 delete iMedia; |
|
469 iMedia = 0; |
|
470 } |
|
471 } |
|
472 |
|
473 |
|
474 // Methods from MMPXCollectionObserver: |
|
475 |
|
476 // -------------------------------------------------------------------------- |
|
477 // CUPnPAlbumServices::HandleCollectionMessage |
|
478 // Callback for Collection->OpenL() |
|
479 // -------------------------------------------------------------------------- |
|
480 // |
|
481 void CUPnPAlbumServices::HandleCollectionMessage( CMPXMessage* aMsg, |
|
482 TInt aErr ) |
|
483 |
|
484 { |
|
485 __LOG1( "HandleCollectionMessage: err=%d", aErr ); |
|
486 if( aErr == KErrNone) |
|
487 { |
|
488 TRAPD( error, DoHandleCollectionMessageL( aMsg ) ); |
|
489 if ( error != KErrNone ) |
|
490 { |
|
491 __LOG1( "DoHandleCollectionMessageL: leave with %d", error ); |
|
492 iStatus = error; |
|
493 iWait->AsyncStop(); |
|
494 } |
|
495 } |
|
496 else |
|
497 { |
|
498 iStatus = aErr; |
|
499 iWait->AsyncStop(); |
|
500 } |
|
501 } |
|
502 |
|
503 // -------------------------------------------------------------------------- |
|
504 // CUPnPAlbumServices::HandleCollectionMediaL |
|
505 // -------------------------------------------------------------------------- |
|
506 // |
|
507 |
|
508 void CUPnPAlbumServices::HandleCollectionMediaL( const CMPXMedia& aMedia, |
|
509 TInt aError ) |
|
510 |
|
511 { |
|
512 __LOG1( "CUPnPAlbumServices::HandleCollectionMediaL: err=%d", aError ); |
|
513 if( aError == KErrNone ) |
|
514 { |
|
515 // delete if already exist |
|
516 if( iMedia ) |
|
517 { |
|
518 delete iMedia; |
|
519 iMedia = 0; |
|
520 } |
|
521 iMedia = CMPXMedia::NewL( aMedia ); |
|
522 } |
|
523 |
|
524 iStatus = aError; |
|
525 iWait->AsyncStop(); |
|
526 |
|
527 __LOG("CUPnPAlbumServices::HandleCollectionMediaL - End"); |
|
528 } |
|
529 |
|
530 // -------------------------------------------------------------------------- |
|
531 // CUPnPAlbumServices::HandleOpenL |
|
532 // Callback for Collection->OpenL(path, attrs) |
|
533 // -------------------------------------------------------------------------- |
|
534 // |
|
535 void CUPnPAlbumServices::HandleOpenL( const CMPXMedia& /*aEntries*/, |
|
536 TInt /*aIndex*/, TBool /*aComplete*/, TInt aError ) |
|
537 { |
|
538 __LOG1( "CUPnPAlbumServices::HandleOpenL %d", aError); |
|
539 |
|
540 if( aError != KErrNone) |
|
541 { |
|
542 iStatus = aError; |
|
543 iWait->AsyncStop(); |
|
544 } |
|
545 } |
|
546 |
|
547 // -------------------------------------------------------------------------- |
|
548 // CUPnPAlbumServices::HandleOpenL |
|
549 // -------------------------------------------------------------------------- |
|
550 // |
|
551 void CUPnPAlbumServices::HandleOpenL( |
|
552 const CMPXCollectionPlaylist& /*aPlaylist*/, TInt aError ) |
|
553 { |
|
554 __LOG1( "CUPnPAlbumServices::HandleOpenL %d", aError); |
|
555 |
|
556 if( aError != KErrNone) |
|
557 { |
|
558 iStatus = aError; |
|
559 iWait->AsyncStop(); |
|
560 } |
|
561 } |
|
562 |
|
563 // -------------------------------------------------------------------------- |
|
564 // Converts an ID from TMPXItemId form to descriptor form. |
|
565 // -------------------------------------------------------------------------- |
|
566 // |
|
567 const TDesC& CUPnPAlbumServices::Id2Desc( const TMPXItemId& aId ) |
|
568 { |
|
569 iTempBuffer.Num( aId ); |
|
570 return iTempBuffer; |
|
571 } |
|
572 |
|
573 // -------------------------------------------------------------------------- |
|
574 // Converts an ID from descriptor form to TMPXItemId form. |
|
575 // -------------------------------------------------------------------------- |
|
576 // |
|
577 TMPXItemId CUPnPAlbumServices::Desc2Id( const TDesC& aDesc ) |
|
578 { |
|
579 TLex convert( aDesc ); |
|
580 TUint temp; |
|
581 convert.Val( temp, EDecimal ); |
|
582 TMPXItemId id(temp); |
|
583 return id; |
|
584 } |
|
585 |
|
586 // -------------------------------------------------------------------------- |
|
587 // CUPnPAlbumServices::DoHandleCollectionMessageL |
|
588 // -------------------------------------------------------------------------- |
|
589 // |
|
590 void CUPnPAlbumServices::DoHandleCollectionMessageL( CMPXMessage* aMsg ) |
|
591 { |
|
592 __LOG( "CUPnPAlbumServices::DoHandleCollectionMessageL" ); |
|
593 |
|
594 if( aMsg && aMsg->IsSupported(KMPXMessageGeneralEvent ) && |
|
595 aMsg->IsSupported(KMPXMessageGeneralType ) ) |
|
596 { |
|
597 TInt event( *aMsg->Value<TInt>( KMPXMessageGeneralEvent ) ); |
|
598 TInt type( *aMsg->Value<TInt>( KMPXMessageGeneralType ) ); |
|
599 TInt data( *aMsg->Value<TInt>( KMPXMessageGeneralData ) ); |
|
600 |
|
601 __LOG1("Event: %d", event ); |
|
602 __LOG1("Type: %d", type ); |
|
603 __LOG1("Data: %d", data ); |
|
604 |
|
605 switch ( event ) |
|
606 { |
|
607 case TMPXCollectionMessage::EPathChanged: |
|
608 { |
|
609 __LOG( "TMPXCollectionMessage::EPathChanged" ); |
|
610 if( type == EMcPathChangedByOpen ) |
|
611 { |
|
612 __LOG( " Type: EMcPathChangedByOpen " ); |
|
613 // Album collection is ready for use |
|
614 iStatus = KErrNone; |
|
615 iWait->AsyncStop(); |
|
616 } |
|
617 } |
|
618 break; |
|
619 default: |
|
620 { |
|
621 // do nothing |
|
622 } |
|
623 break; |
|
624 } |
|
625 } |
|
626 } |
|
627 |
|
628 |