1 /* |
|
2 * Copyright (c) 2006-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: Plays remote images,videos and music locally on device |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_CUPNPLOCALPLAYER_H |
|
20 #define C_CUPNPLOCALPLAYER_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <s32mem.h> |
|
24 #include <f32file.h> |
|
25 #include <AknServerApp.h> |
|
26 #include <AknProgressDialog.h> |
|
27 #include "upnpfiletransfersessionobserver.h" |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 |
|
31 class MUPnPAVBrowsingSession; |
|
32 class CUpnpObject; |
|
33 class CDocumentHandler; |
|
34 class CAknWaitDialog; |
|
35 class CUPnPCommonUI; |
|
36 class MUPnPAVController; |
|
37 class MUPnPFileDownloadSession; |
|
38 class MUPnPAVBrowsingSessionObserver; |
|
39 |
|
40 |
|
41 // CLASS DECLARATION |
|
42 |
|
43 /** |
|
44 * CUPnPLocalPlayer |
|
45 * The class works is used to play or show the remote item in |
|
46 * local devices . |
|
47 * |
|
48 * @since S60 3.1 |
|
49 */ |
|
50 |
|
51 class CUPnPLocalPlayer: public CBase, |
|
52 public MAknServerAppExitObserver, |
|
53 public MProgressDialogCallback, |
|
54 public MUPnPFileTransferSessionObserver |
|
55 { |
|
56 public: // Constructors and destructor |
|
57 |
|
58 IMPORT_C static CUPnPLocalPlayer* NewL( |
|
59 MUPnPAVController& aAVController, |
|
60 MUPnPAVBrowsingSession& aBrowseSession, |
|
61 CUPnPCommonUI& aCommonUI ); |
|
62 /** |
|
63 * Destructor. |
|
64 */ |
|
65 virtual ~CUPnPLocalPlayer(); |
|
66 |
|
67 public: // new function |
|
68 |
|
69 /** |
|
70 * Play a given item |
|
71 * |
|
72 * @since Series 60 3.1 |
|
73 * @param CUpnpObject given item to be played |
|
74 * @return none |
|
75 */ |
|
76 IMPORT_C void PlayL( const CUpnpObject& aItem ); |
|
77 |
|
78 public: // Call back methods of MUPnPFileTransferSessionObserver |
|
79 |
|
80 /** |
|
81 * Notifies that the transfer has been started |
|
82 * |
|
83 * @since Series 60 3.2 |
|
84 * @param aKey identifies the transfer |
|
85 * @param aStatus status (error) code |
|
86 * @return none |
|
87 */ |
|
88 void TransferStarted( TInt aKey, |
|
89 TInt aStatus ); |
|
90 |
|
91 /** |
|
92 * Notifies that the transfer has been completed |
|
93 * |
|
94 * @since Series 60 3.2 |
|
95 * @param aKey identifies the transfer |
|
96 * @param aStatus status (error) code |
|
97 * @param aFilePath |
|
98 */ |
|
99 void TransferCompleted( TInt aKey, |
|
100 TInt aStatus, |
|
101 const TDesC& aFilePath ); |
|
102 |
|
103 /** |
|
104 * Notifies transfer progress, not implemented since the transfer |
|
105 * progress is not cared in the download and play/show case |
|
106 * |
|
107 * @since Series 60 3.2 |
|
108 * @param aKey identifies the transfer |
|
109 * @param aBytes amount of bytes downloaded |
|
110 * @param aTotalBytes total amount of bytes |
|
111 */ |
|
112 void TransferProgress( TInt /*aKey*/, |
|
113 TInt /*aBytes*/, |
|
114 TInt /*aTotalBytes*/ ){}; |
|
115 |
|
116 /** |
|
117 * Notifies that the Media Server we have a session with has |
|
118 * disappeared. Session is now unusable and must be closed. |
|
119 * |
|
120 * @since Series 60 3.2 |
|
121 * @return None |
|
122 */ |
|
123 void MediaServerDisappeared( TUPnPDeviceDisconnectedReason aReason ); |
|
124 |
|
125 protected: // From MProgressDialogCallback |
|
126 |
|
127 /** |
|
128 * Callback function for progress bar. |
|
129 * |
|
130 * @since Series 60 3.1 |
|
131 * @param aButtonId, id of the button pressed |
|
132 * @return None |
|
133 */ |
|
134 void DialogDismissedL( TInt aButtonId ); |
|
135 |
|
136 protected: //from MAknServerAppExitObserver |
|
137 |
|
138 /** |
|
139 * Notifies that the image or video player has quit. |
|
140 * |
|
141 * @since Series 60 3.1 |
|
142 * @return aReason (TInt), the reason for quitting |
|
143 */ |
|
144 void HandleServerAppExit( TInt aReason ); |
|
145 |
|
146 private: |
|
147 |
|
148 /** |
|
149 * Constructs the local player |
|
150 */ |
|
151 CUPnPLocalPlayer( MUPnPAVController& aAVController, |
|
152 MUPnPAVBrowsingSession& aBrowseSession, |
|
153 CUPnPCommonUI& aCommonUI ); |
|
154 /** |
|
155 * Perform the second phase construction |
|
156 */ |
|
157 void ConstructL(); |
|
158 |
|
159 private: |
|
160 |
|
161 /** |
|
162 * Notifies that the copy operation is complete. |
|
163 * |
|
164 * @since Series 60 3.2 |
|
165 * @param aStatus TInt status information |
|
166 * @param aFilepath filepath for a downloaded file (CopyToPhoneL) |
|
167 * @return None |
|
168 */ |
|
169 void CopyCompleteL( TInt aError, |
|
170 const TDesC& aFilepath ); |
|
171 /** |
|
172 * Start the current waiting note |
|
173 * @since Series 60 3.1 |
|
174 * @param none |
|
175 * @return none |
|
176 */ |
|
177 void StartWaitingNoteL(); |
|
178 |
|
179 /** |
|
180 * Finish the current waiting note |
|
181 * @since Series 60 3.1 |
|
182 * @param none |
|
183 * @return none |
|
184 */ |
|
185 void FinishNote(); |
|
186 |
|
187 /** |
|
188 * Removes those res-elements from the item that can't be used for |
|
189 * local playback. |
|
190 * @since Series 60 3.1 |
|
191 * @param CUpnpObject item to be checked |
|
192 * @return TBool is there any usable res element left. |
|
193 */ |
|
194 TBool IsLocallySupportedL( CUpnpObject& aItem ); |
|
195 |
|
196 |
|
197 private: |
|
198 |
|
199 MUPnPAVBrowsingSession* iBrowseSession; //not owned |
|
200 MUPnPAVBrowsingSessionObserver* iBrowseSessionObserver; |
|
201 CUpnpObject* iItem; //owned |
|
202 RFs iFs; //owned |
|
203 CDocumentHandler* iDocumentHandler;//owned |
|
204 CAknWaitDialog* iWaitNoteDialog; //owned |
|
205 HBufC* iFilePath; //owned |
|
206 TInt iExitReason; |
|
207 TBool iWaitingNote; |
|
208 MUPnPFileDownloadSession* iDownloadSession; |
|
209 MUPnPAVController* iAVController; //not owned |
|
210 |
|
211 CUPnPCommonUI& iCommonUI; //Not owned |
|
212 }; |
|
213 |
|
214 #endif // C_CUPNPLOCALPLAYER_H |
|