|
1 /* |
|
2 * Copyright (c) 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: Header file for the CUpnpUploadHandler class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef UPNP_UPLOAD_HANDLER_H |
|
20 #define UPNP_UPLOAD_HANDLER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include "upnpfiletransfersessionobserver.h" |
|
24 #include "upnpprogressdialogobserver.h" |
|
25 |
|
26 // FORWARD DECLARATIONS |
|
27 |
|
28 class MUPnPAVBrowsingSession; |
|
29 class MUPnPFileUploadSession; |
|
30 class MUPnPAVController; |
|
31 class CUpnpNoteHandler; |
|
32 class CEikonEnv; |
|
33 |
|
34 //class CUpnpPlaylistHandler; |
|
35 // CLASS DECLARATION |
|
36 |
|
37 // CONSTANTS |
|
38 enum TUpnpFileUploadMode |
|
39 { |
|
40 EUpnpCopy = 0, |
|
41 EUpnpMove |
|
42 }; |
|
43 |
|
44 /** |
|
45 * CUpnpUploadHandler |
|
46 * The class encapsulates all the file download functionality of |
|
47 * UpnpFileTransferEngine. |
|
48 * |
|
49 * @since S60 3.2 |
|
50 */ |
|
51 NONSHARABLE_CLASS( CUpnpUploadHandler ) : |
|
52 private CAsyncOneShot, |
|
53 private MUPnPFileTransferSessionObserver, |
|
54 public MUPnPProgressDialogobserver |
|
55 |
|
56 |
|
57 |
|
58 { |
|
59 |
|
60 public: // Constructors and destructor |
|
61 |
|
62 /** |
|
63 * Two-phased constructor. |
|
64 * @param aBrowsingSession (MUPnPAVBrowsingSession*) pointer to the |
|
65 * browsing session |
|
66 */ |
|
67 static CUpnpUploadHandler* NewL( |
|
68 MUPnPAVBrowsingSession* aBrowsingSession ); |
|
69 |
|
70 /** |
|
71 * Destructor. |
|
72 */ |
|
73 virtual ~CUpnpUploadHandler(); |
|
74 |
|
75 public: // Business logic methods |
|
76 |
|
77 /** |
|
78 * Upload the given objects to the remote mediaserver, |
|
79 * |
|
80 * Leaves using e32err.h error codes if the operation fails. |
|
81 * |
|
82 * @since S60 3.2 |
|
83 * @param aObjectIds (RPointerArray<TDesC16>*) list of object |
|
84 * paths to copy |
|
85 * @return none |
|
86 */ |
|
87 void UploadItemsL( RPointerArray<TDesC16>* aObjectPaths, |
|
88 TUpnpFileUploadMode aFileUploadMode ); |
|
89 |
|
90 /** |
|
91 * Upload the given playlist to the remote mediaserver, |
|
92 * |
|
93 * Leaves using e32err.h error codes if the operation fails. |
|
94 * |
|
95 * @since S60 3.2 |
|
96 * @param aObjectIds (RPointerArray<TDesC16>&) list of object |
|
97 * paths to copy |
|
98 * @return none |
|
99 */ |
|
100 void UploadPlayListL( const TDesC& aPlaylistName, |
|
101 RPointerArray<TDesC16>* aObjectPaths, |
|
102 TUpnpFileUploadMode aFileUploadMode ); |
|
103 |
|
104 private: // Call back methods of MUPnPFileTransferSessionObserver |
|
105 |
|
106 /** |
|
107 * Notifies that the transfer has been started |
|
108 * |
|
109 * @since Series 60 3.2 |
|
110 * @param aKey identifies the transfer |
|
111 * @param aStatus status (error) code |
|
112 * @return none |
|
113 */ |
|
114 void TransferStarted( TInt aKey, |
|
115 TInt aStatus ); |
|
116 |
|
117 /** |
|
118 * Notifies that the transfer has been completed |
|
119 * |
|
120 * @since Series 60 3.2 |
|
121 * @param aKey identifies the transfer |
|
122 * @param aStatus status (error) code |
|
123 * @param aFilePath |
|
124 * @return none |
|
125 */ |
|
126 void TransferCompleted( TInt aKey, |
|
127 TInt aStatus, |
|
128 const TDesC& aFilePath ); |
|
129 |
|
130 /** |
|
131 * Notifies transfer progress |
|
132 * |
|
133 * @since Series 60 3.2 |
|
134 * @param aKey identifies the transfer |
|
135 * @param aBytes amount of bytes downloaded |
|
136 * @param aTotalBytes total amount of bytes |
|
137 * @return none |
|
138 */ |
|
139 void TransferProgress( TInt aKey, |
|
140 TInt aBytes, |
|
141 TInt aTotalBytes ); |
|
142 |
|
143 /** |
|
144 * Notifies that the Media Server we have a session with has |
|
145 * disappeared. Session is now unusable and must be closed. |
|
146 * |
|
147 * @since S60 3.2 |
|
148 * @param aReason reason code |
|
149 * @return none |
|
150 */ |
|
151 void MediaServerDisappeared( TUPnPDeviceDisconnectedReason aReason ); |
|
152 |
|
153 public: // Call back methods of MUPnPProgressDialogobserver |
|
154 |
|
155 /** |
|
156 * ProgressDialog call back method. |
|
157 * Get's called when a dialog is dismissed. |
|
158 * |
|
159 * @since S60 3.2 |
|
160 * @param aButtonId (TInt) ID of the button pressed |
|
161 * @return none |
|
162 */ |
|
163 void DialogDismissedL(); |
|
164 |
|
165 private: // from CAsyncOneShot |
|
166 |
|
167 /** |
|
168 * Asynchronous execution |
|
169 */ |
|
170 void RunL(); |
|
171 |
|
172 /** |
|
173 * Execution of the error branch |
|
174 */ |
|
175 TInt RunError( TInt aError ); |
|
176 |
|
177 private: // Construction methods |
|
178 |
|
179 /** |
|
180 * Constructor |
|
181 * |
|
182 * @since 3.2 |
|
183 */ |
|
184 CUpnpUploadHandler(); |
|
185 |
|
186 /** |
|
187 * ConstructL. |
|
188 * |
|
189 * @since 3.2 |
|
190 * @param aController (MUPnPAVBrowsingSession*) pointer to a valid |
|
191 * UpnpAvController BrowsingsSession |
|
192 * @return none |
|
193 */ |
|
194 void ConstructL( MUPnPAVBrowsingSession* aBrowsingSession ); |
|
195 |
|
196 private: |
|
197 |
|
198 /** |
|
199 * Starts the next download. Leaves (KErrCompletion) if there are |
|
200 * no more objects to download. |
|
201 * |
|
202 * @since 3.2 |
|
203 * @param none |
|
204 * @return none |
|
205 */ |
|
206 void StartUploadL(); |
|
207 |
|
208 |
|
209 private: // Data members |
|
210 |
|
211 |
|
212 /* |
|
213 * Browsing session handle. Not owned. |
|
214 */ |
|
215 MUPnPAVBrowsingSession* iBrowsingSession; |
|
216 |
|
217 /* |
|
218 * File upload session handle. |
|
219 */ |
|
220 MUPnPFileUploadSession* iUploadSession; |
|
221 |
|
222 /* |
|
223 * UpnpAvControllerClient. Owned. |
|
224 */ |
|
225 MUPnPAVController* iAvController; |
|
226 |
|
227 /* |
|
228 * Pointer to the UpnpNoteHandler. Owned. |
|
229 */ |
|
230 CUpnpNoteHandler* iNoteHandler; |
|
231 |
|
232 /* |
|
233 * Holds the status code of the transfer operation. |
|
234 */ |
|
235 TInt iStatusCode; |
|
236 |
|
237 /* |
|
238 * Holds the position information. |
|
239 */ |
|
240 TInt iCopyPosition; |
|
241 |
|
242 /* |
|
243 * Indicate whether copy was cancelled after successfully copied |
|
244 * the file but TransferComplete not yet called. |
|
245 */ |
|
246 TBool iCopiedFileStillInArray; |
|
247 |
|
248 /* |
|
249 * Holds the copy completeness per cent value. |
|
250 */ |
|
251 TInt iCopyCompleteness; |
|
252 |
|
253 /* |
|
254 * Pointer to the list of objects to download. owned. |
|
255 */ |
|
256 RPointerArray<TDesC16>* iObjectsToCopy; |
|
257 |
|
258 /** |
|
259 * The number of items has been uploaded |
|
260 */ |
|
261 TInt iUploadItems; |
|
262 |
|
263 /* |
|
264 * Flag to set the progress bar maximum value |
|
265 */ |
|
266 TBool iProgressBarMaxValueSet; |
|
267 |
|
268 /* |
|
269 * Total number of items to be uploaded |
|
270 */ |
|
271 TInt iTotalCount; |
|
272 |
|
273 TUpnpFileUploadMode iUploadMode; |
|
274 |
|
275 CEikonEnv* iCoeEnv; // not owned |
|
276 |
|
277 TBool iUploadFirst; |
|
278 |
|
279 //number of items should be uploaded in a group, if the total number |
|
280 // is bigger than 20, iUploadIndex = 20 |
|
281 TInt iUploadIndex; |
|
282 |
|
283 /* |
|
284 * Information if drm note is already shown. |
|
285 */ |
|
286 TBool iDrmFilesSkipped; |
|
287 |
|
288 //CUpnpPlaylistHandler* iPlaylistHandler; |
|
289 |
|
290 |
|
291 }; |
|
292 |
|
293 #endif // UPNP_DOWNLOAD_HANDLER_H |
|
294 |
|
295 // End of file |