|
1 /* |
|
2 * Copyright (c) 2008-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: Updates Music Content Plublisher |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_MCPMUSICPLAYER_H |
|
20 #define C_MCPMUSICPLAYER_H |
|
21 |
|
22 #include <mpxplaybackcommanddefs.h> //for TMPXPlaybackCommand |
|
23 #include <e32std.h> // for TExitType |
|
24 #include <mcpplugin.h> |
|
25 #include <mcppluginobserver.h> |
|
26 #include <mpxcollectionobserver.h> |
|
27 #include "aiplayerpluginengineobserver.h" |
|
28 #include "filemonitorobserver.h" |
|
29 #include "applicationmonitorobserver.h" |
|
30 #include "pnsmonitorobserver.h" |
|
31 |
|
32 class MLiwInterface; |
|
33 class CLiwGenericParamList; |
|
34 class CAiPlayerPluginEngine; |
|
35 class CFileMonitor; |
|
36 class CApplicationMonitor; |
|
37 class CPNSMonitor; |
|
38 class RResourceFile; |
|
39 class MMPXCollectionUtility; |
|
40 |
|
41 /** |
|
42 * Music Player MCP plugin. |
|
43 * CMCPMusicPlayer implements CMCPPlugin |
|
44 * |
|
45 * @since S60 S60 v5.0 |
|
46 */ |
|
47 class CMCPMusicPlayer : public CMCPPlugin, |
|
48 public MAiPlayerPluginEngineObserver, |
|
49 public MFileMonitorObserver, |
|
50 public MApplicationMonitorObserver, |
|
51 public MMPXCollectionObserver, |
|
52 public MPNSMonitorObserver |
|
53 { |
|
54 public: |
|
55 /** |
|
56 * Standard Symbian 2 phase constructor |
|
57 */ |
|
58 static CMCPMusicPlayer* NewL( |
|
59 MMCPPluginObserver* aObserver); |
|
60 |
|
61 /** |
|
62 * Standard C++ destructor. |
|
63 */ |
|
64 virtual ~CMCPMusicPlayer(); |
|
65 |
|
66 // from base class CMCPPlugin |
|
67 |
|
68 /** |
|
69 * From CMCPPlugin |
|
70 * @since S60 5.0 |
|
71 */ |
|
72 void Deactivate(); |
|
73 |
|
74 /** |
|
75 * From CMCPPlugin |
|
76 * @since S60 5.0 |
|
77 */ |
|
78 void SkinChanged(); |
|
79 |
|
80 |
|
81 // from base class MAiPlayerPluginEngineObserver |
|
82 |
|
83 /** |
|
84 * From MAiPlayerPluginEngineObserver |
|
85 * @since S60 5.0 |
|
86 * See aiplayerpluginengineobserver.h for detailed description. |
|
87 */ |
|
88 void PlayerStateChanged(TMPlayerState aState); |
|
89 |
|
90 /** |
|
91 * From MAiPlayerPluginEngineObserver |
|
92 * @since S60 5.0 |
|
93 * See aiplayerpluginengineobserver.h for detailed description. |
|
94 */ |
|
95 void TrackInfoChanged(const TDesC& aTitle, const TDesC& aArtist); |
|
96 |
|
97 /** |
|
98 * From MAiPlayerPluginEngineObserver |
|
99 * @since S60 5.0 |
|
100 * See aiplayerpluginengineobserver.h for detailed description. |
|
101 */ |
|
102 void PlaybackPositionChanged(TInt aPosition); |
|
103 |
|
104 /** |
|
105 * From MAiPlayerPluginEngineObserver |
|
106 * @since S60 5.0 |
|
107 * See aiplayerpluginengineobserver.h for detailed description. |
|
108 */ |
|
109 void AlbumArtChanged( CFbsBitmap* aBitmap ); |
|
110 |
|
111 /** |
|
112 * From MAiPlayerPluginEngineObserver |
|
113 * @since S60 5.0 |
|
114 * See aiplayerpluginengineobserver.h for detailed description. |
|
115 */ |
|
116 void Opening(); |
|
117 |
|
118 /** |
|
119 * From MAiPlayerPluginEngineObserver |
|
120 * @since S60 5.0 |
|
121 * See aiplayerpluginengineobserver.h for detailed description. |
|
122 */ |
|
123 void PlaylisIsEmpty(); |
|
124 |
|
125 // from base class MFileMonitorObserver |
|
126 /** |
|
127 * from MFileMonitorObserver |
|
128 * Handle a file system change notification |
|
129 * |
|
130 */ |
|
131 void HandleFileRemovedL(); |
|
132 |
|
133 // from base class MApplicationMonitorObserver |
|
134 /** |
|
135 * from MApplicationMonitorObserver |
|
136 * Handle an application close event. |
|
137 */ |
|
138 void HandleApplicationClosedL(TExitType aReason); |
|
139 |
|
140 //from base class MMPXCollectionObserver |
|
141 /** |
|
142 * Handle collection message |
|
143 * |
|
144 * @param aMsg collection message, ownership not transferred. |
|
145 * Please check aMsg is not NULL before using it. |
|
146 * If aErr is not KErrNone, plugin might still call back with more |
|
147 * info in the aMsg. |
|
148 * @param aErr system error code. |
|
149 */ |
|
150 void HandleCollectionMessage( CMPXMessage* aMsg, TInt aErr ); |
|
151 |
|
152 /** |
|
153 * Handles the collection entries being opened. Typically called |
|
154 * when client has Open()'d a folder. |
|
155 * |
|
156 * @since S60 3.2.3 |
|
157 * @param aEntries collection entries opened |
|
158 * @param aIndex focused entry |
|
159 * @param aComplete ETrue no more entries. EFalse more entries |
|
160 * expected |
|
161 * @param aError error code |
|
162 */ |
|
163 void HandleOpenL( const CMPXMedia& aEntries, TInt aIndex, TBool aComplete, |
|
164 TInt aError ); |
|
165 |
|
166 /** |
|
167 * Handles the item being opened. Typically called |
|
168 * when client has Open()'d an item. Client typically responds by |
|
169 * 'playing' the item via the playlist. |
|
170 * |
|
171 * @since S60 3.2.3 |
|
172 * @param aPlaylist collection playlist |
|
173 * @param aError error code |
|
174 */ |
|
175 void HandleOpenL( const CMPXCollectionPlaylist& aPlaylist, TInt aError ); |
|
176 |
|
177 /** |
|
178 * From MMPXCollectionMediaObserver |
|
179 * It handles MediaL event. |
|
180 * |
|
181 * @param aMedia object containing collection's informations |
|
182 * @param aError error code |
|
183 */ |
|
184 void HandleCollectionMediaL( const CMPXMedia& aMedia, TInt aError ); |
|
185 |
|
186 /** |
|
187 * from MPNSMonitorObserver |
|
188 * Handle launching music player on the background. |
|
189 */ |
|
190 void OpeningMusicPlayer(); |
|
191 |
|
192 private: |
|
193 |
|
194 /** |
|
195 * Standard C++ constructor. |
|
196 */ |
|
197 CMCPMusicPlayer( MMCPPluginObserver* aObserver ); |
|
198 |
|
199 /** |
|
200 * Standard Symbian 2nd phase constructor. |
|
201 */ |
|
202 void ConstructL(); |
|
203 |
|
204 /** |
|
205 * returns ETrue if data can be propagated to the Music Content Publisher. |
|
206 */ |
|
207 TBool IsOKToPublishData(); |
|
208 |
|
209 /** |
|
210 * Installs Playback command action, the puppose of this is to improve |
|
211 * readability. |
|
212 */ |
|
213 void InstallPlaybackCommandActionL( TMPXPlaybackCommand aCmd, |
|
214 TMCPTriggerDestination aDestination ); |
|
215 /** |
|
216 * Installs Launch Music Player action, the puppose of this is to improve |
|
217 * readability. |
|
218 */ |
|
219 void InstallLaunchMusicPlayerL( TMCPTriggerDestination aDestination ); |
|
220 |
|
221 /** |
|
222 * Installs Go To Now playing action, the puppose of this is to improve |
|
223 * readability. |
|
224 */ |
|
225 void InstallGoToNowPlayingL( TMCPTriggerDestination aDestination ); |
|
226 |
|
227 /** |
|
228 * Installs Go To Last Played action, the puppose of this is to improve |
|
229 * readability. |
|
230 */ |
|
231 void InstallGoToLastPlayedL( TMCPTriggerDestination aDestination, |
|
232 TBool aMinimized ); |
|
233 |
|
234 /** |
|
235 * Installs an action, mainly for readability purposes. |
|
236 * |
|
237 * @since S60 5.0 |
|
238 * @param aDestination Destination trigger that should launch the action. |
|
239 */ |
|
240 void InstallGoToMusicL(TMCPTriggerDestination aDestination); |
|
241 |
|
242 /** |
|
243 * Installs an action, mainly for readability purposes. |
|
244 * |
|
245 * @since S60 5.0 |
|
246 * @param aDestination Destination trigger that should launch the action. |
|
247 */ |
|
248 void InstallGoToAlbumL(TMCPTriggerDestination aDestination); |
|
249 |
|
250 /** |
|
251 * Installs an empty action, mainly for readability purposes. |
|
252 * |
|
253 * @since S60 5.0 |
|
254 * @param aDestination Destination trigger that should launch the action. |
|
255 */ |
|
256 void InstallEmptyActionL(TMCPTriggerDestination aDestination); |
|
257 |
|
258 /** |
|
259 * Installs actions and icons in the toolbar. |
|
260 * |
|
261 * @since S60 5.0 |
|
262 */ |
|
263 void UpdateToolBarL(TUint aToolBarState); |
|
264 |
|
265 /** |
|
266 * Resets the widget an Music Suite. |
|
267 * |
|
268 * @since S60 5.0 |
|
269 */ |
|
270 void ResetL(); |
|
271 |
|
272 /** |
|
273 * Get a heap descriptor from the resource file |
|
274 * |
|
275 * @since S60 5.0 |
|
276 */ |
|
277 void GetLocalizedStringL(RResourceFile& aResourceFile, HBufC*& aRetBuf, |
|
278 TInt aResourceId); |
|
279 |
|
280 |
|
281 /** |
|
282 * @since S60 5.0 |
|
283 */ |
|
284 void ActivateL(); |
|
285 void DoUpdatePlayerStateL(TMPlayerState aState); |
|
286 void DoUpdateTrackInfoL(const TDesC& aTitle, const TDesC& aArtist); |
|
287 void DoUpdatePlaybackPositionL(TInt aPosition); |
|
288 void DoUpdateAlbumArtL( CFbsBitmap* aBitmap ); |
|
289 void DoHandleOpeningL(); |
|
290 void DoHandlePlaylisIsEmptyL(); |
|
291 void DoHandleSkinChangedL(); |
|
292 |
|
293 /** |
|
294 * Logic of HandleCollectionMessageL, to avoid the function leaves |
|
295 * |
|
296 * @param aMsg collection message |
|
297 */ |
|
298 void HandleCollectionMessageL( CMPXMessage* aMsg ); |
|
299 |
|
300 /** |
|
301 * Logic of HandleCollectionMessage, to avoid the function leaves |
|
302 * |
|
303 * @param aMsg collection message |
|
304 */ |
|
305 void DoHandleGeneralMessageL( const CMPXMessage& aMsg ); |
|
306 |
|
307 /** |
|
308 * Music Player opening timer callback |
|
309 * |
|
310 * @param aPtr pointer the this |
|
311 */ |
|
312 static TInt MusicPlayerOpeningTimerCallback( TAny* aPtr ); |
|
313 |
|
314 private: // data |
|
315 |
|
316 /** |
|
317 * Instance of MCP plugin observer |
|
318 * Not owned. |
|
319 */ |
|
320 MMCPPluginObserver* iMHObserver; |
|
321 |
|
322 /** |
|
323 * Instance of CAiPlayerPluginEngine used to observe Music player via |
|
324 * MAiPlayerPluginEngineObserver. |
|
325 * Owned. |
|
326 */ |
|
327 CAiPlayerPluginEngine* iEngine; |
|
328 |
|
329 /** |
|
330 * State indicator, the plugin can be active or inactive. |
|
331 */ |
|
332 TBool iActive; |
|
333 |
|
334 /** |
|
335 * art cached indicator. |
|
336 */ |
|
337 TBool iArtCached; |
|
338 |
|
339 /** |
|
340 * Used to monitor last played song. |
|
341 */ |
|
342 CFileMonitor* iFileMonitor; |
|
343 |
|
344 /** |
|
345 * Used to monitor if music player closes. |
|
346 */ |
|
347 CApplicationMonitor* iAppMonitor; |
|
348 |
|
349 /** |
|
350 * Used to monitor publish and subscribe property. |
|
351 */ |
|
352 CPNSMonitor* iPNSMonitor; |
|
353 |
|
354 /** |
|
355 * Current Album Art. |
|
356 */ |
|
357 CFbsBitmap* iArtBitmap; |
|
358 |
|
359 /** |
|
360 * The art that was extracted but not used due to the current stateof |
|
361 * the plugin (acctive, not active) |
|
362 */ |
|
363 CFbsBitmap* iCachedArtBitmap; |
|
364 |
|
365 /** |
|
366 * Album Art mask. |
|
367 */ |
|
368 CFbsBitmap* iArtBitmapMask; |
|
369 |
|
370 /** |
|
371 * Current Toolbar State. |
|
372 */ |
|
373 TUint iToolBarState; |
|
374 |
|
375 /** |
|
376 * Buffers for the localized strings |
|
377 */ |
|
378 HBufC* iGoToMusicBuffer; |
|
379 HBufC* iOpeningBuffer; |
|
380 |
|
381 /** |
|
382 * Flag of Mass Storage mode or MTP mode |
|
383 */ |
|
384 TBool iUSBOnGoing; |
|
385 |
|
386 /** |
|
387 * collection utility |
|
388 */ |
|
389 MMPXCollectionUtility* iCollectionUtility; |
|
390 |
|
391 CPeriodic* iMusicPlayerOpeningTimer; |
|
392 }; |
|
393 |
|
394 #endif // C_MCPMUSICPLAYER_H |
|
395 |
|
396 // End of File |