|
1 /* |
|
2 * Copyright (c) 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 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: Implements customised service update* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 #ifndef VCXGROUPUPDATER_H_ |
|
21 #define VCXGROUPUPDATER_H_ |
|
22 |
|
23 #include <e32std.h> |
|
24 #include "MIptvTimerObserver.h" |
|
25 #include "MIptvEpgVodCallback.h" |
|
26 #include "CIptvEpgPluginInterface.h" |
|
27 |
|
28 class CIptvServer; |
|
29 class CIptvEpgSession; |
|
30 class CIptvEpgService; |
|
31 class CIptvEpgVodMsqQueue; |
|
32 class CIptvTimer; |
|
33 |
|
34 /** |
|
35 * RSS plugin. |
|
36 * |
|
37 * Controls content parsing and download. |
|
38 * |
|
39 * @lib IptvRssPlugin.dll |
|
40 * @since S60 v3.1 |
|
41 */ |
|
42 class CVcxGroupUpdater : public CBase, |
|
43 public MIptvEpgVodCallback, |
|
44 public MIptvTimerObserver |
|
45 { |
|
46 |
|
47 public: |
|
48 |
|
49 static CVcxGroupUpdater* NewL( |
|
50 CIptvServer& aServer, |
|
51 CIptvEpgSession& iSession, |
|
52 CIptvEpgVodMsqQueue& aMsgQueue ); |
|
53 |
|
54 ~CVcxGroupUpdater(); |
|
55 |
|
56 /** |
|
57 * Start download. |
|
58 * |
|
59 * @param aService Group service. |
|
60 */ |
|
61 void StartGroupUpdateL( |
|
62 CIptvEpgService* aService ); |
|
63 |
|
64 /** |
|
65 * Cancel current download download, if any. |
|
66 */ |
|
67 void CancelGroupUpdate(); |
|
68 |
|
69 /** |
|
70 * Enquire is download ongoing. |
|
71 * @return ETrue, if download is ongoing. |
|
72 */ |
|
73 TBool IsGroupUpdateOngoing(); |
|
74 |
|
75 // From MIptvEpgVodCallback interface |
|
76 |
|
77 /** |
|
78 * Plugin started. |
|
79 */ |
|
80 void StartedL(); |
|
81 |
|
82 /** |
|
83 * ECG content update from XML completed. Thumbnails are not downloaded yet. |
|
84 */ |
|
85 void ContentUpdateCompletedL(); |
|
86 |
|
87 /** |
|
88 * Plugin finished. |
|
89 * |
|
90 * @param aUpdateInterval Update interval defines how long EPG data is valid. |
|
91 */ |
|
92 TInt FinishedL( TTime& aUpdateInterval ); |
|
93 |
|
94 /** |
|
95 * Add new category to database. |
|
96 * |
|
97 * @param aCategory Reference to CIptvEpgCategory object. |
|
98 * @param aCategoryKey New category key value is inserted to aCategoryKey |
|
99 * @return KErrNone if successful, otherwise another of the system-wide error codes. |
|
100 */ |
|
101 TInt AddCategoryL( CIptvEpgCategory& aCategory, TUint32& aCategoryKey ); |
|
102 |
|
103 /** |
|
104 * Add new content to given category. |
|
105 * |
|
106 * @param aContent Reference to CIptvEpgContent object. |
|
107 * @param aMediaContents Pointer array containing media content objects. There can be n media content's for one |
|
108 * content. |
|
109 * @param aContentKey New content key value is inserted to aContentKey |
|
110 * @return KErrNone if successful, otherwise another of the system-wide error codes. |
|
111 */ |
|
112 TInt AddContentL( |
|
113 CIptvEpgContent& aContent, |
|
114 RPointerArray<CIptvMediaContent> aMediaContents, |
|
115 TUint32& aContentKey ); |
|
116 |
|
117 /** |
|
118 * Update service thumbnail. |
|
119 * |
|
120 * @param aIconFilePath Full path to service thumbnail in local filesystem. |
|
121 * @param aGrouped if true updates also grouped item, otherwise not. |
|
122 * @return KErrNone if successful, otherwise another of the system-wide error codes. |
|
123 */ |
|
124 TInt UpdateServiceThumbnailL( TDesC& aIconFilePath, const TBool aGrouped ); |
|
125 |
|
126 /** |
|
127 * Add content to category. |
|
128 * |
|
129 * @param aCategoryKey Category key. |
|
130 * @param aContentKey Content key. |
|
131 */ |
|
132 TInt AddRelationL( TUint32& aCategoryKey, TUint32& aContentKey ); |
|
133 |
|
134 /** |
|
135 * Error |
|
136 * |
|
137 * @param aError Error code. |
|
138 * @param aInfo Further info. |
|
139 */ |
|
140 void ErrorL( TInt aError, TInt aInfo ); |
|
141 |
|
142 /** |
|
143 * Update category icon. |
|
144 * |
|
145 * @param aCategoryKey Category key. |
|
146 * @param aIconFileId Icon file id to search from the database. |
|
147 * @param aIconFilePath Full path to icon file or URL + filename. |
|
148 * @param aIsUrl If aIconFilePath is URL aIsUrl == ETrue, if aIconFilePath is path |
|
149 * to local filesystem aIsUrl == EFalse. |
|
150 * @return KErrNone if successful, otherwise another of the system-wide error codes. |
|
151 */ |
|
152 TInt UpdateCategoryIconL( |
|
153 TUint32& aCategoryKey, |
|
154 TUint32& aIconFileId, |
|
155 TDesC& aIconFilePath, |
|
156 TBool aIsUrl ); |
|
157 |
|
158 /** |
|
159 * Update content icon. |
|
160 * |
|
161 * @param aCategoryKey Content key. |
|
162 * @param aIconFileId Icon file id to search from the database. |
|
163 * @param aIconFilePath Full path to icon file or URL + filename. |
|
164 * @param aIsUrl If aIconFilePath is URL aIsUrl == ETrue, if aIconFilePath is path |
|
165 * to local filesystem aIsUrl == EFalse. |
|
166 * @return KErrNone if successful, otherwise another of the system-wide error codes. |
|
167 */ |
|
168 TInt UpdateContentIconL( |
|
169 TUint32& aContentKey, |
|
170 TUint32& aIconFileId, |
|
171 TDesC& aIconFilePath, |
|
172 TBool aIsUrl ); |
|
173 |
|
174 // From MiptvTimerObserver. |
|
175 |
|
176 /** |
|
177 * @param aTimer Pointer to timer which expired. |
|
178 */ |
|
179 void TimerExpired( CIptvTimer* aTimer ); |
|
180 |
|
181 private: |
|
182 |
|
183 /** |
|
184 * C++ default constructor. |
|
185 */ |
|
186 CVcxGroupUpdater( |
|
187 CIptvServer& aServer, |
|
188 CIptvEpgSession& aSession, |
|
189 CIptvEpgVodMsqQueue& aMsgQueue ); |
|
190 |
|
191 /** |
|
192 * By default Symbian 2nd phase constructor is private. |
|
193 */ |
|
194 void ConstructL(); |
|
195 |
|
196 /** |
|
197 * Starts parsing of downloaded VCFG file. |
|
198 * @param aPathName VCFG file path name. |
|
199 */ |
|
200 void StartVcfgFileParseL( const TDesC& aPathName ); |
|
201 |
|
202 /** |
|
203 * Timer leaving implementation. |
|
204 * |
|
205 * @param aTimer Pointer to timer which expired. |
|
206 */ |
|
207 void DoTimerExpiredL( CIptvTimer* aTimer ); |
|
208 |
|
209 /** |
|
210 * Reset .vcfg parsed flag. |
|
211 * |
|
212 * @param aServiceId Id of the service to be checked. |
|
213 */ |
|
214 void SetNotParsedL( TUint32 aServiceId ); |
|
215 |
|
216 /** |
|
217 * Check whether given service has been parsed. |
|
218 * |
|
219 * @param aServiceId Id of the service to be checked. |
|
220 * @return true if parsing completed, otherwise false. |
|
221 */ |
|
222 TBool IsServiceParsed( TUint32 aServiceId ); |
|
223 |
|
224 /** |
|
225 * Set service Last Modified. |
|
226 * |
|
227 * @param aServiceId Id of the service to be checked. |
|
228 * @param aLastModified New last modified time. |
|
229 */ |
|
230 void SetLastModifiedL( |
|
231 TUint32 aServiceId, |
|
232 TTime aLastModified ); |
|
233 |
|
234 /** |
|
235 * Collect list of required thumbnails and start download. |
|
236 */ |
|
237 void StartThumbnailDownloadL(); |
|
238 |
|
239 private: // Data members |
|
240 |
|
241 /** |
|
242 * Server |
|
243 */ |
|
244 CIptvServer& iServer; |
|
245 |
|
246 /** |
|
247 * calling session. |
|
248 */ |
|
249 CIptvEpgSession& iSession; |
|
250 |
|
251 /** |
|
252 * Service id of currently ongoing single file downloads. |
|
253 */ |
|
254 TUint32 iCurrentGroupServiceId; |
|
255 |
|
256 /** |
|
257 * Download plugin. |
|
258 * Own |
|
259 */ |
|
260 CIptvEpgPluginInterface* iPlugin; |
|
261 |
|
262 /** |
|
263 * Informs observers about update state. |
|
264 */ |
|
265 CIptvEpgVodMsqQueue& iMsgQueue; |
|
266 |
|
267 /** |
|
268 * Common file server session, used by CIptvVodDownload objects too |
|
269 */ |
|
270 RFs iFs; |
|
271 |
|
272 /** |
|
273 * Indicates download is in progress. |
|
274 */ |
|
275 TBool iPluginRunning; |
|
276 |
|
277 /** |
|
278 * Current action/type of file to be downloaded. |
|
279 */ |
|
280 CIptvEpgPluginInterface::TIptvRSSAction iCurrentAction; |
|
281 |
|
282 /** |
|
283 * Server object was not updated, no download was actually needed. |
|
284 */ |
|
285 TBool iLocalValid; |
|
286 |
|
287 /** |
|
288 * Downloaded path. |
|
289 * Own. |
|
290 */ |
|
291 HBufC* iDownloadedVcfgPath; |
|
292 |
|
293 /** |
|
294 * This is started when there is file sent to provision parsing. |
|
295 * Own. |
|
296 */ |
|
297 CIptvTimer* iVcfgParseTimer; |
|
298 |
|
299 /** |
|
300 * Keep count of vcfg parsing tries. |
|
301 */ |
|
302 TInt iVcfgParseMaxCount; |
|
303 |
|
304 /** |
|
305 * To be saved to service after successfull dowload and parse. |
|
306 */ |
|
307 TTime iDownloadStartTime; |
|
308 |
|
309 }; |
|
310 |
|
311 #endif /* VCXGROUPUPDATER_H_ */ |