71
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 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 the License "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:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef VCXTESTMYVIDEOSCOLLECTIONCLIENT_H_
|
|
20 |
#define VCXTESTMYVIDEOSCOLLECTIONCLIENT_H_
|
|
21 |
|
|
22 |
// INCLUDES
|
|
23 |
#include <e32base.h>
|
|
24 |
#include "VCXTestMyVideosObserver.h"
|
|
25 |
#include "MIptvTestTimerObserver.h"
|
|
26 |
|
|
27 |
#include <mpxcollectionobserver.h>
|
|
28 |
#include <mpxmediabase.h>
|
|
29 |
#include <vcxmyvideosdefs.h>
|
|
30 |
|
|
31 |
// CONSTANTS
|
|
32 |
const TInt KVCXTestMpxLevelRoot = 1;
|
|
33 |
const TInt KVCXTestMpxLevelCategory = 2;
|
|
34 |
const TInt KVCXTestMpxLevelVideo = 3;
|
|
35 |
|
|
36 |
// MACROS
|
|
37 |
|
|
38 |
// FORWARD DECLARATIONS
|
|
39 |
|
|
40 |
// DATA TYPES
|
|
41 |
|
|
42 |
// CLASS DECLARATION
|
|
43 |
class MMPXCollectionUtility;
|
|
44 |
class CVCXTestCommon;
|
|
45 |
class CIptvTestActiveWait;
|
|
46 |
class CIptvTestTimer;
|
|
47 |
|
|
48 |
class TVCXTestDownload
|
|
49 |
{
|
|
50 |
public:
|
|
51 |
TVCXTestDownload()
|
|
52 |
{
|
|
53 |
iMdsId = 0;
|
|
54 |
iState = 0;
|
|
55 |
iDownloadId = 0;
|
|
56 |
iProgress = 0;
|
|
57 |
iDownloadError = 0;
|
|
58 |
iGlobalError = 0;
|
|
59 |
}
|
|
60 |
|
|
61 |
TInt32 iMdsId;
|
|
62 |
TUint8 iState;
|
|
63 |
TUint32 iDownloadId;
|
|
64 |
TInt8 iProgress;
|
|
65 |
TInt32 iDownloadError;
|
|
66 |
TInt32 iGlobalError;
|
|
67 |
};
|
|
68 |
|
|
69 |
/**
|
|
70 |
* CVCXTestMyVideosCollectionClient
|
|
71 |
*
|
|
72 |
* @lib ?library
|
|
73 |
* @since ?Series60_version
|
|
74 |
*/
|
|
75 |
class CVCXTestMyVideosCollectionClient : public CBase, public MMPXCollectionObserver, public MIptvTestTimerObserver
|
|
76 |
{
|
|
77 |
|
|
78 |
public: // Constructors and destructor
|
|
79 |
|
|
80 |
/**
|
|
81 |
* Two-phased constructor.
|
|
82 |
*/
|
|
83 |
IMPORT_C static CVCXTestMyVideosCollectionClient* NewL( MVCXTestMyVideosObserver* aObserver );
|
|
84 |
|
|
85 |
/**
|
|
86 |
* Destructor.
|
|
87 |
*/
|
|
88 |
virtual ~CVCXTestMyVideosCollectionClient();
|
|
89 |
|
|
90 |
private:
|
|
91 |
|
|
92 |
/**
|
|
93 |
* C++ default constructor.
|
|
94 |
*/
|
|
95 |
CVCXTestMyVideosCollectionClient( MVCXTestMyVideosObserver* aObserver );
|
|
96 |
|
|
97 |
/**
|
|
98 |
* By default Symbian 2nd phase constructor is private.
|
|
99 |
*/
|
|
100 |
void ConstructL( );
|
|
101 |
|
|
102 |
public: // Functions from base classes.
|
|
103 |
|
|
104 |
/**
|
|
105 |
* From MMPXCollectionObserver->MMPXCollectionMediaObserver
|
|
106 |
* Handle extended media properties
|
|
107 |
*
|
|
108 |
* @param aMedia media
|
|
109 |
* @param aError error code
|
|
110 |
*/
|
|
111 |
void HandleCollectionMediaL( const CMPXMedia& aMedia, TInt aError );
|
|
112 |
|
|
113 |
/**
|
|
114 |
* From MMPXCollectionUtilityObserver.
|
|
115 |
* Handle collection message
|
|
116 |
* NOTE: only one of HandleCollectionMessage callback can be implemented
|
|
117 |
*
|
|
118 |
* @param aMessage collection message, ownership not transferred.
|
|
119 |
* Please check aMsg is not NULL before using it. If aErr is not
|
|
120 |
* KErrNone, plugin might still call back with more info in the aMsg.
|
|
121 |
* @param aErr system error code.
|
|
122 |
*/
|
|
123 |
void HandleCollectionMessage( CMPXMessage* aMessage, TInt aError );
|
|
124 |
|
|
125 |
void HandleSingleCollectionMessageL( CMPXMessage* aMessage );
|
|
126 |
|
|
127 |
void HandleMyVideosMessageL( CMPXMessage* aMessage );
|
|
128 |
void HandleGeneralMessageL( CMPXMessage* aMessage );
|
|
129 |
void HandleItemChangedMessageL( CMPXMessage* aMessage );
|
|
130 |
|
|
131 |
/**
|
|
132 |
* From MMPXCollectionUtilityObserver.
|
|
133 |
* Handles the collection entries being opened. Typically called
|
|
134 |
* when client has Open()'d a folder
|
|
135 |
*
|
|
136 |
* @param aEntries collection entries opened
|
|
137 |
* @param aIndex focused entry
|
|
138 |
* @param aComplete ETrue no more entries. EFalse more entries
|
|
139 |
* expected
|
|
140 |
* @param aError error code
|
|
141 |
*/
|
|
142 |
void HandleOpenL( const CMPXMedia& aEntries,
|
|
143 |
TInt aIndex, TBool aComplete, TInt aError );
|
|
144 |
|
|
145 |
/**
|
|
146 |
* From MMPXCollectionUtilityObserver.
|
|
147 |
* Handles the item being opened. Typically called
|
|
148 |
* when client has Open()'d an item. Client typically responds by
|
|
149 |
* 'playing' the item via the playlist
|
|
150 |
*
|
|
151 |
* @param aPlaylist collection playlist
|
|
152 |
* @param aError error code
|
|
153 |
*/
|
|
154 |
void HandleOpenL( const CMPXCollectionPlaylist& aPlaylist, TInt aError );
|
|
155 |
|
|
156 |
/**
|
|
157 |
* From MMPXCollectionUtilityObserver.
|
|
158 |
* Handle completion of a asynchronous command
|
|
159 |
* @param aCommandResult result of the command, NULL if error
|
|
160 |
* @param aError error code
|
|
161 |
*/
|
|
162 |
void HandleCommandComplete( CMPXCommand* aCommandResult,
|
|
163 |
TInt aError);
|
|
164 |
|
|
165 |
/**
|
|
166 |
* From MIptvTestTimerObserver Handles timer completion
|
|
167 |
* @since
|
|
168 |
* @param aTimerId
|
|
169 |
* @param aError
|
|
170 |
*/
|
|
171 |
void TimerComplete( TInt aTimerId, TInt aError );
|
|
172 |
|
|
173 |
private: // New functions.
|
|
174 |
|
|
175 |
IMPORT_C void OpenCollectionL();
|
|
176 |
|
|
177 |
IMPORT_C void OpenCollectionLevelL( TUint32 aIndex );
|
|
178 |
|
|
179 |
IMPORT_C void UpdateVideoListL( TBool aComplete );
|
|
180 |
|
|
181 |
IMPORT_C void UpdateDownloadListL();
|
|
182 |
|
|
183 |
IMPORT_C void UpdateMediaArrayL();
|
|
184 |
|
|
185 |
IMPORT_C void PrintMediasL( CMPXMediaArray* aMediaArray );
|
|
186 |
|
|
187 |
IMPORT_C TBool UpdateDownloadL( CMPXMedia* aMedia );
|
|
188 |
|
|
189 |
IMPORT_C static TBool CompareDownloads( const TVCXTestDownload& a1, const TVCXTestDownload& a2 );
|
|
190 |
|
|
191 |
IMPORT_C CMPXCommand* CreateMpxCommandLC( TInt aCommandGeneralId, TInt aMyVideosCommandId, TBool aSync );
|
|
192 |
|
|
193 |
public: // New functions.
|
|
194 |
|
|
195 |
IMPORT_C void RefreshCollectionL();
|
|
196 |
|
|
197 |
IMPORT_C TInt LevelsL();
|
|
198 |
|
|
199 |
IMPORT_C TInt VideoCount();
|
|
200 |
|
|
201 |
IMPORT_C CMPXMedia* GetVideoL( TUint aIndex );
|
|
202 |
|
|
203 |
IMPORT_C void RemoveVideoL( TUint aIndex );
|
|
204 |
|
|
205 |
IMPORT_C TInt DownloadCount();
|
|
206 |
|
|
207 |
IMPORT_C void DownloadL( const TDesC& aUrl, TUint aIapId, const TDesC& aUserName, const TDesC& aPassword );
|
|
208 |
|
|
209 |
IMPORT_C void CancelDownloadL( TUint aIndex );
|
|
210 |
|
|
211 |
IMPORT_C void EnsureMediaFilesAreNotInUseL();
|
|
212 |
|
|
213 |
IMPORT_C TInt GetCountOfOngoingDownloads();
|
|
214 |
|
|
215 |
IMPORT_C TInt GetCountOfNewVideos( TBool aIncludeDownloads );
|
|
216 |
|
|
217 |
private: // Data
|
|
218 |
|
|
219 |
TInt iCollectionUid;
|
|
220 |
|
|
221 |
MVCXTestMyVideosObserver* iObserver;
|
|
222 |
|
|
223 |
TInt iOpenLevelIndex;
|
|
224 |
|
|
225 |
// MMPXCollectionUtility.
|
|
226 |
MMPXCollectionUtility* iCollectionUtility;
|
|
227 |
|
|
228 |
// Entries from MPX plugin are saved here.
|
|
229 |
CMPXMedia* iCurrentEntries;
|
|
230 |
|
|
231 |
// Media array for iCurrentEntries.
|
|
232 |
CMPXMediaArray* iMediaArray;
|
|
233 |
|
|
234 |
// Media array for only videos.
|
|
235 |
CMPXMediaArray* iVideos;
|
|
236 |
|
|
237 |
// Media array for only downloads.
|
|
238 |
CMPXMediaArray* iDownloads;
|
|
239 |
|
|
240 |
// RFs.
|
|
241 |
RFs iFs;
|
|
242 |
|
|
243 |
// CVCXTestCommon.
|
|
244 |
CVCXTestCommon* iTestCommon;
|
|
245 |
|
|
246 |
// Refresh is already ongoing.
|
|
247 |
TBool iRefreshingCollection;
|
|
248 |
|
|
249 |
// Active wait.
|
|
250 |
CIptvTestActiveWait* iActiveWait;
|
|
251 |
|
|
252 |
// Timer.
|
|
253 |
CIptvTestTimer* iTimer;
|
|
254 |
|
|
255 |
// IDs of new videos from collection message KMPXMessageIdItemChanged are hold here until
|
|
256 |
// video list is refreshed.
|
|
257 |
RArray<TInt> iInsertedVideoMdsIds;
|
|
258 |
|
|
259 |
// Information of ongoing downloads.
|
|
260 |
RArray<TVCXTestDownload> iOngoingDownloads;
|
|
261 |
|
|
262 |
// Information of completed downloads.
|
|
263 |
RArray<TVCXTestDownload> iCompletedDownloads;
|
|
264 |
};
|
|
265 |
|
|
266 |
#endif /* VCXTESTMYVIDEOSCOLLECTIONCLIENT_H_ */
|