|
1 /* |
|
2 * Copyright (c) 2006 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: Helper class for some common MPX routines |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_UPNPMPXHELPER_H |
|
20 #define C_UPNPMPXHELPER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include "mpxmediatorobserver.h" // base class |
|
25 #include "mpxcollectionobserver.h" // base class |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class CMPXMedia; |
|
29 class MUPnPMpxHelperObserver; |
|
30 class MMPXHarvesterUtility; |
|
31 class MMPXCollectionUtility; |
|
32 class CMPXCollectionMediator; |
|
33 |
|
34 |
|
35 /** |
|
36 * A helper class for some common MPX routines |
|
37 * |
|
38 * @lib upnpmusicadapter.lib |
|
39 * @since S60 v3.1 |
|
40 */ |
|
41 class CUPnPMpxHelper : public CBase |
|
42 , public MMPXMediatorObserver |
|
43 , public MMPXCollectionObserver |
|
44 { |
|
45 |
|
46 public: |
|
47 |
|
48 /** |
|
49 * 1st phase constructor |
|
50 * |
|
51 * @param aModeId mode passed to MPX framework |
|
52 * @return a new CUPnPPlayListFiller instance |
|
53 * @since Series 60 3.1 |
|
54 */ |
|
55 static CUPnPMpxHelper* NewL( const TUid& aModeId ); |
|
56 |
|
57 /** |
|
58 * Destructor |
|
59 * |
|
60 * @since Series 60 3.1 |
|
61 */ |
|
62 virtual ~CUPnPMpxHelper(); |
|
63 |
|
64 public: // the interface |
|
65 |
|
66 /** |
|
67 * Add a song or a playlist synchronously. |
|
68 * Note: does not take ownership of aMedia object. Caller must |
|
69 * delete aMedia after calling this method. |
|
70 * see mpxcollectionhelper in mpxmusicplayer |
|
71 * @param aMedia representation of the media to be added |
|
72 */ |
|
73 void AddTrackL( CMPXMedia* aMedia ); |
|
74 |
|
75 /** |
|
76 * add a song or a playlist asynchronously. |
|
77 * Note: does not take ownership of aMedia object. Caller must |
|
78 * delete aMedia after calling this method. |
|
79 * see mpxcollectionuihelper in mpxmusicplayer |
|
80 * @param aMedia representation of the media to be added |
|
81 * @param aObserver the observer interface |
|
82 */ |
|
83 void AddPlaylistL( CMPXMedia* aMedia ); |
|
84 |
|
85 /** |
|
86 * Open the collection in embedded mode with a Media Object. |
|
87 * see mpxcollectionuihelper in mpxmusicplayer |
|
88 * @param aHostId Host Process UID to identify this embedded instance |
|
89 * @param aMedia Media Object to open |
|
90 */ |
|
91 void AddAndOpenL( const TUid& aHostId, CMPXMedia& aMedia ); |
|
92 |
|
93 protected: |
|
94 |
|
95 /** |
|
96 * Retrieve collection from URI |
|
97 */ |
|
98 TInt FindCollectionIdL( const TDesC& aUri ); |
|
99 |
|
100 /** |
|
101 * retrieve information for the required attributes |
|
102 */ |
|
103 void FillInPlaylistDetailsL( CMPXMedia& aMedia ); |
|
104 |
|
105 /** |
|
106 * see MMPXMediatorObserver |
|
107 */ |
|
108 void HandleMediatorPathUpdatedL( |
|
109 CMPXMedia*& /*aMedia*/, TUid /*aOldPath*/ ) {} |
|
110 |
|
111 /** |
|
112 * see MMPXCollectionObserver |
|
113 */ |
|
114 void HandleCollectionMediaL( |
|
115 const CMPXMedia& /*aMedia*/, TInt /*aError*/) {} |
|
116 |
|
117 /** |
|
118 * see MMPXCollectionObserver |
|
119 */ |
|
120 void HandleCollectionMessageL( |
|
121 const TMPXCollectionMessage& /*aMessage*/ ) {} |
|
122 |
|
123 /** |
|
124 * see MMPXCollectionObserver |
|
125 */ |
|
126 void HandleCollectionMessageL( |
|
127 const CMPXMessage& /*aMsg*/ ) {} |
|
128 |
|
129 /** |
|
130 * see MMPXCollectionObserver |
|
131 */ |
|
132 void HandleOpenL( |
|
133 const CMPXMedia& /*aEntries*/, |
|
134 TInt /*aIndex*/, TBool /*aComplete*/, TInt /*aError*/ ) {} |
|
135 |
|
136 /** |
|
137 * see MMPXCollectionObserver |
|
138 */ |
|
139 void HandleOpenL( |
|
140 const CMPXCollectionPlaylist& /*aPlaylist*/, |
|
141 TInt /*aError*/ ) {} |
|
142 |
|
143 /** |
|
144 * see MMPXCollectionObserver |
|
145 */ |
|
146 void HandleCommandComplete( |
|
147 CMPXCommand* /*aCommandResult*/, TInt /*aError*/) {} |
|
148 |
|
149 private: // private methods |
|
150 |
|
151 /** |
|
152 * constructor |
|
153 */ |
|
154 CUPnPMpxHelper::CUPnPMpxHelper(); |
|
155 |
|
156 /** |
|
157 * 2nd phase constructor |
|
158 */ |
|
159 void CUPnPMpxHelper::ConstructL( const TUid& aModeId ); |
|
160 |
|
161 private: // members |
|
162 |
|
163 /** |
|
164 * MPX harvester utility |
|
165 */ |
|
166 MMPXHarvesterUtility* iHarvester; |
|
167 |
|
168 /** |
|
169 * MPX collection utility |
|
170 */ |
|
171 MMPXCollectionUtility* iCollectionUtil; |
|
172 |
|
173 /** |
|
174 * MPX collection mediator |
|
175 */ |
|
176 CMPXCollectionMediator* iMediator; |
|
177 |
|
178 /** |
|
179 * temporarily stored observer for async operations |
|
180 * NOT OWNED |
|
181 */ |
|
182 MUPnPMpxHelperObserver* iObserver; |
|
183 |
|
184 }; |
|
185 |
|
186 /** |
|
187 * Callback ingterface for async methods in CUPnPMpxHelper |
|
188 */ |
|
189 class MUPnPMpxHelperObserver |
|
190 { |
|
191 public: |
|
192 |
|
193 /** |
|
194 * async response for AddL |
|
195 */ |
|
196 void HandleAddComplete( TInt aError ); |
|
197 |
|
198 /** |
|
199 * async response for OpenL |
|
200 */ |
|
201 void HandleOpenComplete( TInt aError ); |
|
202 |
|
203 }; |
|
204 |
|
205 #endif // C_UPNPMPXHELPER_H |
|
206 |