|
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 empty action, mainly for readability purposes. |
|
244 * |
|
245 * @since S60 5.0 |
|
246 * @param aDestination Destination trigger that should launch the action. |
|
247 */ |
|
248 void InstallEmptyActionL(TMCPTriggerDestination aDestination); |
|
249 |
|
250 /** |
|
251 * Installs actions and icons in the toolbar. |
|
252 * |
|
253 * @since S60 5.0 |
|
254 */ |
|
255 void UpdateToolBarL(TUint aToolBarState); |
|
256 |
|
257 /** |
|
258 * Resets the widget an Music Suite. |
|
259 * |
|
260 * @since S60 5.0 |
|
261 */ |
|
262 void ResetL(); |
|
263 |
|
264 /** |
|
265 * Get a heap descriptor from the resource file |
|
266 * |
|
267 * @since S60 5.0 |
|
268 */ |
|
269 void GetLocalizedStringL(RResourceFile& aResourceFile, HBufC*& aRetBuf, |
|
270 TInt aResourceId); |
|
271 |
|
272 |
|
273 /** |
|
274 * @since S60 5.0 |
|
275 */ |
|
276 void ActivateL(); |
|
277 void DoUpdatePlayerStateL(TMPlayerState aState); |
|
278 void DoUpdateTrackInfoL(const TDesC& aTitle, const TDesC& aArtist); |
|
279 void DoUpdatePlaybackPositionL(TInt aPosition); |
|
280 void DoUpdateAlbumArtL( CFbsBitmap* aBitmap ); |
|
281 void DoHandleOpeningL(); |
|
282 void DoHandlePlaylisIsEmptyL(); |
|
283 void DoHandleSkinChangedL(); |
|
284 |
|
285 /** |
|
286 * Logic of HandleCollectionMessageL, to avoid the function leaves |
|
287 * |
|
288 * @param aMsg collection message |
|
289 */ |
|
290 void HandleCollectionMessageL( CMPXMessage* aMsg ); |
|
291 |
|
292 /** |
|
293 * Logic of HandleCollectionMessage, to avoid the function leaves |
|
294 * |
|
295 * @param aMsg collection message |
|
296 */ |
|
297 void DoHandleGeneralMessageL( const CMPXMessage& aMsg ); |
|
298 |
|
299 /** |
|
300 * Music Player opening timer callback |
|
301 * |
|
302 * @param aPtr pointer the this |
|
303 */ |
|
304 static TInt MusicPlayerOpeningTimerCallback( TAny* aPtr ); |
|
305 |
|
306 private: // data |
|
307 |
|
308 /** |
|
309 * Instance of MCP plugin observer |
|
310 * Not owned. |
|
311 */ |
|
312 MMCPPluginObserver* iMHObserver; |
|
313 |
|
314 /** |
|
315 * Instance of CAiPlayerPluginEngine used to observe Music player via |
|
316 * MAiPlayerPluginEngineObserver. |
|
317 * Owned. |
|
318 */ |
|
319 CAiPlayerPluginEngine* iEngine; |
|
320 |
|
321 /** |
|
322 * State indicator, the plugin can be active or inactive. |
|
323 */ |
|
324 TBool iActive; |
|
325 |
|
326 /** |
|
327 * art cached indicator. |
|
328 */ |
|
329 TBool iArtCached; |
|
330 |
|
331 /** |
|
332 * Used to monitor last played song. |
|
333 */ |
|
334 CFileMonitor* iFileMonitor; |
|
335 |
|
336 /** |
|
337 * Used to monitor if music player closes. |
|
338 */ |
|
339 CApplicationMonitor* iAppMonitor; |
|
340 |
|
341 /** |
|
342 * Used to monitor publish and subscribe property. |
|
343 */ |
|
344 CPNSMonitor* iPNSMonitor; |
|
345 |
|
346 /** |
|
347 * Current Album Art. |
|
348 */ |
|
349 CFbsBitmap* iArtBitmap; |
|
350 |
|
351 /** |
|
352 * The art that was extracted but not used due to the current stateof |
|
353 * the plugin (acctive, not active) |
|
354 */ |
|
355 CFbsBitmap* iCachedArtBitmap; |
|
356 |
|
357 /** |
|
358 * Album Art mask. |
|
359 */ |
|
360 CFbsBitmap* iArtBitmapMask; |
|
361 |
|
362 /** |
|
363 * Current Toolbar State. |
|
364 */ |
|
365 TUint iToolBarState; |
|
366 |
|
367 /** |
|
368 * Buffers for the localized strings |
|
369 */ |
|
370 HBufC* iGoToMusicBuffer; |
|
371 HBufC* iOpeningBuffer; |
|
372 |
|
373 /** |
|
374 * Flag of Mass Storage mode or MTP mode |
|
375 */ |
|
376 TBool iUSBOnGoing; |
|
377 |
|
378 /** |
|
379 * collection utility |
|
380 */ |
|
381 MMPXCollectionUtility* iCollectionUtility; |
|
382 |
|
383 CPeriodic* iMusicPlayerOpeningTimer; |
|
384 }; |
|
385 |
|
386 #endif // C_MCPMUSICPLAYER_H |
|
387 |
|
388 // End of File |