|
1 /* |
|
2 * Copyright (c) 2008 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: Implementation of metadata handler |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef C_CMPXMETADATAHANDLERIMP_H |
|
21 #define C_CMPXMETADATAHANDLERIMP_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <mpxplaybackobserver.h> |
|
25 #include <mpxplaybackframeworkdefs.h> |
|
26 #include <mpxcollectionplaylistobserver.h> |
|
27 |
|
28 #include <remconmediainformationtarget.h> |
|
29 #include <playerinformationtargetobserver.h> |
|
30 #include <remcongroupnavigationtargetobserver.h> |
|
31 |
|
32 // FORWARD DECLARATIONS |
|
33 class CRemConInterfaceSelector; |
|
34 class CRepository; |
|
35 class MMPXPlaybackUtility; |
|
36 class MPlayerCapabilitiesObserver; |
|
37 class MPlayerApplicationSettingsObserver; |
|
38 class MPlayerEventsObserver; |
|
39 class CRemConGroupNavigationApiTarget; |
|
40 class CPlayerInfoTarget; |
|
41 class CEqualizerPresetChangeListener; |
|
42 |
|
43 |
|
44 /** |
|
45 * Observer class for equalizer preset changes. |
|
46 * |
|
47 * @lib mpxmetadatahandler.lib |
|
48 * @since S60 v5.1 |
|
49 */ |
|
50 class MEqualizerPresetChangeListenerObserver |
|
51 { |
|
52 public: |
|
53 |
|
54 /** |
|
55 * Callback for receiving changes in the equalizer preset settings. |
|
56 * |
|
57 * @since S60 v5.1 |
|
58 * @param aNewPreset The ID of the new equalizer preset |
|
59 */ |
|
60 virtual void EqualizerPresetChangedL(TInt aNewPreset) = 0; |
|
61 |
|
62 }; |
|
63 |
|
64 |
|
65 /** |
|
66 * AVRCP 1.3 metadata handler implementation class |
|
67 * |
|
68 * @lib mpxmetadatahandler.lib |
|
69 * @since S60 v5.1 |
|
70 */ |
|
71 NONSHARABLE_CLASS( CMPXMetaDataHandlerImp ): public CBase, |
|
72 public MMPXMetaDataHandler, |
|
73 public MMPXPlaybackObserver, |
|
74 public MMPXPlaybackCallback, |
|
75 public MPlayerApplicationSettingsNotify, |
|
76 public MRemConMediaInformationTargetObserver, |
|
77 public MRemConGroupNavigationTargetObserver, |
|
78 public MMPXCollectionPlaylistObserver, |
|
79 public MEqualizerPresetChangeListenerObserver |
|
80 { |
|
81 public: |
|
82 |
|
83 /** |
|
84 * Two-phased constructor. |
|
85 * |
|
86 * @since v5.1 |
|
87 * @param aInterfaceSelector RemCon interface selector. |
|
88 * @return Pointer to newly created object. |
|
89 */ |
|
90 static MMPXMetaDataHandler* NewL(CRemConInterfaceSelector &aInterfaceSelector); |
|
91 |
|
92 /** |
|
93 * Destructor. |
|
94 */ |
|
95 virtual ~CMPXMetaDataHandlerImp(); |
|
96 |
|
97 private: |
|
98 |
|
99 /** |
|
100 * C++ default constructor. |
|
101 * |
|
102 * @since S60 v5.1 |
|
103 */ |
|
104 CMPXMetaDataHandlerImp(); |
|
105 |
|
106 /** |
|
107 * By default Symbian 2nd phase constructor is private. |
|
108 * |
|
109 * @since S60 v5.1 |
|
110 * @param aInterfaceSelector RemCon interface selector. |
|
111 */ |
|
112 void ConstructL(CRemConInterfaceSelector &aInterfaceSelector); |
|
113 |
|
114 /** |
|
115 * Sends currently playing metadata |
|
116 * see MrcmitoGetCurrentlyPlayingMetadata |
|
117 * |
|
118 * @since Symbian^3 |
|
119 * @param aAttributeIter Attribute iterator |
|
120 */ |
|
121 void SendCurrentlyPlayingMetadata(TMediaAttributeIter& aAttributeIter ); |
|
122 |
|
123 /** |
|
124 * Handle playback message |
|
125 * |
|
126 * @since S60 v5.1 |
|
127 * @param aMessage playback message |
|
128 */ |
|
129 void DoHandlePlaybackMessageL( const CMPXMessage& aMessage ); |
|
130 |
|
131 /** |
|
132 * Handle playback property |
|
133 * |
|
134 * @since S60 v5.1 |
|
135 * @param aProperty the property |
|
136 * @param aValue the value of the property |
|
137 * @param aError error code |
|
138 */ |
|
139 void DoHandlePropertyL( TMPXPlaybackProperty aProperty, TInt aValue, TInt aError ); |
|
140 |
|
141 /** |
|
142 * Handle media properties. |
|
143 * |
|
144 * @since S60 v5.1 |
|
145 * @param aMedia media properties |
|
146 * @param aError error code |
|
147 */ |
|
148 void DoHandleMediaL( const CMPXMedia& aMedia, TInt aError ); |
|
149 |
|
150 /** |
|
151 * Handle playback state changed. |
|
152 * |
|
153 * @since S60 v5.1 |
|
154 * @param aState New Playback state |
|
155 */ |
|
156 void DoHandleStateChangedL( TMPXPlaybackState aState ); |
|
157 |
|
158 // from base class MMPXPlaybackObserver |
|
159 |
|
160 /** |
|
161 * From MMPXPlaybackObserver |
|
162 * Handle playback message |
|
163 * |
|
164 * @since S60 v5.1 |
|
165 * @param aMessage playback message |
|
166 * @param aErr system error code. |
|
167 */ |
|
168 void HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError ); |
|
169 |
|
170 // from base class MMPXPlaybackCallback |
|
171 |
|
172 /** |
|
173 * From MMPXPlaybackCallback |
|
174 * Handle playback property |
|
175 * |
|
176 * @since S60 v5.1 |
|
177 * @param aProperty the property |
|
178 * @param aValue the value of the property |
|
179 * @param aError error code |
|
180 */ |
|
181 void HandlePropertyL( TMPXPlaybackProperty aProperty, TInt aValue, TInt aError ); |
|
182 |
|
183 /** |
|
184 * From MMPXPlaybackCallback |
|
185 * Method is called continously until aComplete=ETrue, signifying that |
|
186 * it is done and there will be no more callbacks |
|
187 * Only new items are passed each time |
|
188 * |
|
189 * @since S60 v5.1 |
|
190 * @param aPlayer UID of the subplayer |
|
191 * @param aSubPlayers a list of sub players |
|
192 * @param aComplete ETrue no more sub players. EFalse more subplayer expected |
|
193 * @param aError error code |
|
194 */ |
|
195 void HandleSubPlayerNamesL( TUid aPlayer, const MDesCArray* aSubPlayers, |
|
196 TBool aComplete, TInt aError ); |
|
197 |
|
198 /** |
|
199 * From MMPXPlaybackCallback |
|
200 * Handle media properties |
|
201 * |
|
202 * @since S60 v5.1 |
|
203 * @param aMedia media |
|
204 * @param aError error code |
|
205 */ |
|
206 void HandleMediaL( const CMPXMedia& aMedia, TInt aError ); |
|
207 |
|
208 // From base class MMPXCollectionPlaylistObserver |
|
209 |
|
210 /** |
|
211 * From MMPXCollectionPlaylistObserver |
|
212 * Handle collection playlist change. |
|
213 * |
|
214 * @since S60 v5.1 |
|
215 * @param aError KErrNotFound - Playlist is updated, current item removed |
|
216 * KErrNone - Playlist is updated, current item is valid |
|
217 * KErrEof - Playlist is updated, current item removed and |
|
218 * reached to the end of playlist |
|
219 */ |
|
220 void HandleCollectionPlaylistChange(TInt aError); |
|
221 |
|
222 // From base class MPlayerApplicationSettingsNotify |
|
223 |
|
224 /** |
|
225 * From MPlayerApplicationSettingsNotify |
|
226 * This is called when the controller has changed a setting |
|
227 * |
|
228 * @since S60 v5.1 |
|
229 * @param aAttributeID A list of attribute IDs whose value has changed. |
|
230 * @param aAttributeValue A list of new values for the attributes listed in aAttributeID. |
|
231 */ |
|
232 virtual void MpasnSetPlayerApplicationValueL(const RArray<TInt>& aAttributeID, const RArray<TInt>& aAttributeValue); |
|
233 |
|
234 // From base class MRemConMediaInformationTargetObserver |
|
235 |
|
236 /** |
|
237 * From MRemConMediaInformationTargetObserver |
|
238 * For each element in aAttributeList the client should respond by calling |
|
239 * CRemConMediaInformationTarget::AttributeValue(). After all attributes have |
|
240 * been supplied the client should call CRemConMediaInformationTarget::Completed(). |
|
241 * |
|
242 * @since S60 v5.1 |
|
243 * @param aAttributeList A list of TAttributeID requested by the controller |
|
244 */ |
|
245 virtual void MrcmitoGetCurrentlyPlayingMetadata( TMediaAttributeIter& aAttributeIter ); |
|
246 |
|
247 /** |
|
248 * From MRemConGroupNavigationTargetObserver |
|
249 * Clients must implement this interface in order to instantiate objects of type |
|
250 * CRemConGroupNavigation. This interface passes incoming commands from RemCon to |
|
251 * the client. |
|
252 * A 'Next Group' has been received. |
|
253 * |
|
254 * @since S60 v5.1 |
|
255 * @param aButtonAct The button action associated with the command. |
|
256 */ |
|
257 virtual void MrcgntoNextGroup(TRemConCoreApiButtonAction aButtonAct); |
|
258 |
|
259 /** |
|
260 * From MRemConGroupNavigationTargetObserver |
|
261 * For each element in aAttributeList the client should respond by calling |
|
262 * CRemConMediaInformationTarget::AttributeValue(). After all attributes have |
|
263 * been supplied the client should call CRemConMediaInformationTarget::Completed(). |
|
264 * A 'Previous Group' has been received. |
|
265 * |
|
266 * @since S60 v5.1 |
|
267 * @param aButtonAct The button action associated with the command. |
|
268 */ |
|
269 virtual void MrcgntoPreviousGroup(TRemConCoreApiButtonAction aButtonAct); |
|
270 |
|
271 // From base class MEqualizerPresetChangeListenerObserver |
|
272 |
|
273 /** |
|
274 * From MEqualizerPresetChangeListenerObserver |
|
275 * Callback for receiving changes in the equalizer preset settings. |
|
276 * |
|
277 * @since S60 v5.1 |
|
278 * @param aNewPreset The ID of the new equalizer preset |
|
279 */ |
|
280 virtual void EqualizerPresetChangedL(TInt aNewPreset); |
|
281 |
|
282 private: // Data |
|
283 |
|
284 /** |
|
285 * The current player state (playing, paused, stopped). |
|
286 */ |
|
287 TMPXPlaybackState iPlayerState; |
|
288 |
|
289 /** |
|
290 * Current track's position info (in seconds) |
|
291 */ |
|
292 TInt iPlaybackPosition; |
|
293 |
|
294 /** |
|
295 * Current track's playing time info (in milliseconds) |
|
296 */ |
|
297 TInt iPlayingTime; |
|
298 |
|
299 /** |
|
300 * Current track number |
|
301 */ |
|
302 TInt iTrackNumber; |
|
303 |
|
304 /** |
|
305 * Last selected equalizer preset settings |
|
306 */ |
|
307 TInt iLastEqPresetId; |
|
308 |
|
309 /** |
|
310 * Current track's title info |
|
311 * Own. |
|
312 */ |
|
313 HBufC* iTrackTitle; |
|
314 |
|
315 /** |
|
316 * Current track's artist info |
|
317 * Own. |
|
318 */ |
|
319 HBufC* iArtist; |
|
320 |
|
321 /** |
|
322 * Current track's album info |
|
323 * Own. |
|
324 */ |
|
325 HBufC* iAlbum; |
|
326 |
|
327 /** |
|
328 * Current track's genre info |
|
329 * Own. |
|
330 */ |
|
331 HBufC* iGenre; |
|
332 |
|
333 /** |
|
334 * Current track's unique id info |
|
335 * Own. |
|
336 */ |
|
337 |
|
338 TUid iColId; |
|
339 |
|
340 /** |
|
341 * Observer for equalizer preset changes |
|
342 * Own. |
|
343 */ |
|
344 CEqualizerPresetChangeListener* iEqPresetListener; |
|
345 |
|
346 /** |
|
347 * Metadata iterator |
|
348 * Own. |
|
349 */ |
|
350 TMediaAttributeIter *iMetadataIter; |
|
351 |
|
352 /** |
|
353 * Main interface to the player. |
|
354 * Not own. |
|
355 */ |
|
356 MMPXPlaybackUtility* iPlaybackUtility; |
|
357 |
|
358 /** |
|
359 * Container for player information responses |
|
360 * Not own. |
|
361 */ |
|
362 CPlayerInfoTarget* iPlayerInformationTarget; |
|
363 |
|
364 /** |
|
365 * Observer of this player's capabilities. |
|
366 * Not own. |
|
367 */ |
|
368 MPlayerCapabilitiesObserver* iPlayerCapabilitiesObserver; |
|
369 |
|
370 /** |
|
371 * Observer of this player's settings. |
|
372 * Not own. |
|
373 */ |
|
374 MPlayerApplicationSettingsObserver* iPlayerApplicationSettingsObserver; |
|
375 |
|
376 /** |
|
377 * Observer of player events. |
|
378 * Not own. |
|
379 */ |
|
380 MPlayerEventsObserver* iPlayerEventsObserver; |
|
381 |
|
382 /** |
|
383 * Interface for sending media information |
|
384 * Not own. |
|
385 */ |
|
386 CRemConMediaInformationTarget* iMediaInfoTarget; |
|
387 |
|
388 /** |
|
389 * Interface for group navigation responses |
|
390 * Not own. |
|
391 */ |
|
392 CRemConGroupNavigationApiTarget* iGroupNavigationTarget; |
|
393 |
|
394 }; |
|
395 |
|
396 |
|
397 /** |
|
398 * Helper class for receiving equalizer preset changed events. |
|
399 * |
|
400 * @lib mpxmetadatahandler.lib |
|
401 * @since S60 v5.1 |
|
402 */ |
|
403 NONSHARABLE_CLASS(CEqualizerPresetChangeListener): public CActive |
|
404 { |
|
405 public: |
|
406 |
|
407 /** |
|
408 * Two-phased constructor. |
|
409 * |
|
410 * @since v5.1 |
|
411 * @param aFlags Flags for creating popups. |
|
412 * @param aObserver Custom command observer for media key handling. |
|
413 * @return Pointer to newly created object. |
|
414 */ |
|
415 static CEqualizerPresetChangeListener* NewL(MEqualizerPresetChangeListenerObserver& aObserver); |
|
416 |
|
417 /** |
|
418 * Destructor. |
|
419 */ |
|
420 virtual ~CEqualizerPresetChangeListener(); |
|
421 |
|
422 /** |
|
423 * Get the current equalizer preset ID |
|
424 * |
|
425 * @since S60 v5.1 |
|
426 * @return The current preset ID |
|
427 */ |
|
428 TInt GetCurrentPresetL(); |
|
429 |
|
430 /** |
|
431 * Set the equalizer preset |
|
432 * |
|
433 * @since S60 v5.1 |
|
434 * @param aNewPreset The ID of the preset to be activated |
|
435 */ |
|
436 void ChangePresetL(TInt aNewPreset); |
|
437 |
|
438 /** |
|
439 * Start listening to equalizer preset changes |
|
440 * |
|
441 * @since S60 v5.1 |
|
442 */ |
|
443 void StartL(); |
|
444 |
|
445 /** |
|
446 * Stop listening to equalizer preset changes |
|
447 * |
|
448 * @since S60 v5.1 |
|
449 * @return The current preset ID |
|
450 */ |
|
451 void Stop(); |
|
452 |
|
453 private: |
|
454 |
|
455 /** |
|
456 * C++ default constructor. |
|
457 * |
|
458 * @since S60 v5.1 |
|
459 * @param aObserver Client for receiving equalizer preset changed events |
|
460 */ |
|
461 CEqualizerPresetChangeListener(MEqualizerPresetChangeListenerObserver& aObserver); |
|
462 |
|
463 /** |
|
464 * Symbian 2nd-phase constructor |
|
465 * |
|
466 * @since S60 v5.1 |
|
467 */ |
|
468 void ConstructL(); |
|
469 |
|
470 // from base class CActive |
|
471 |
|
472 /** |
|
473 * From CActive. |
|
474 * Called by the active scheduler when the request has been cancelled. |
|
475 * |
|
476 * @since S60 v5.1 |
|
477 */ |
|
478 virtual void DoCancel(); |
|
479 |
|
480 /** |
|
481 * From CActive. |
|
482 * Called by the active scheduler when the request has been completed. |
|
483 * |
|
484 * @since S60 v5.1 |
|
485 */ |
|
486 virtual void RunL(); |
|
487 |
|
488 /** |
|
489 * From CActive. |
|
490 * Called by the active scheduler when an error in RunL has occurred. |
|
491 * |
|
492 * @since S60 v5.1 |
|
493 */ |
|
494 TInt RunError( TInt aError ); |
|
495 |
|
496 private: // Data |
|
497 |
|
498 /** |
|
499 * Handle to Central Repository |
|
500 * Own. |
|
501 */ |
|
502 CRepository* iRepository; |
|
503 |
|
504 /** |
|
505 * Client for receiving equalizer preset changed events |
|
506 * Not own. |
|
507 */ |
|
508 MEqualizerPresetChangeListenerObserver& iObserver; |
|
509 |
|
510 }; |
|
511 |
|
512 #endif // C_CMPXMETADATAHANDLERIMP_H |
|
513 |
|
514 // End of File |