|
1 /* |
|
2 * Copyright (c) 2004-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: Utility class and constants used by Iptv application.* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CIPTVUTIL_H |
|
21 #define CIPTVUTIL_H |
|
22 |
|
23 #include <e32std.h> |
|
24 #include <e32const.h> |
|
25 #include <e32base.h> |
|
26 #include <f32file.h> // RFs |
|
27 #include <e32property.h> |
|
28 #include <bldvariant.hrh> // for __SERIES60_30__ or similar |
|
29 #include <commdb.h> |
|
30 #include "IptvDebug.h" |
|
31 #include "iptvcustommessageids.h" |
|
32 |
|
33 class TDataType; |
|
34 class TIptvExternalFolderInfo; |
|
35 |
|
36 _LIT( KIptvEmptyDes, "" ); |
|
37 _LIT8( KIptvEmptyDes8, "" ); |
|
38 |
|
39 // Max thumbnail size for RSS plugin in bytes |
|
40 const TInt KIptvRssMaxThumbnailSize = 512000; |
|
41 |
|
42 // KMaxPath - 1 (256 - 1 = 255). This is maximun path length defined in DB. |
|
43 const TInt KIptvMaxPath = 255; |
|
44 |
|
45 const TInt KIptvIdMaxLength = 255; |
|
46 |
|
47 // VOD client API constants |
|
48 const TInt KIptvVodContentMaxPath = KIptvMaxPath; |
|
49 const TInt KIptvVodContentMaxCategoryNameLen = 100; |
|
50 const TInt KIptvVodContentMaxCategoryDescriptionLen = 255; |
|
51 const TInt KIptvVodContentMaxCategoryBrowserUrlLen = KIptvMaxPath; |
|
52 const TInt KIptvVodContentCategoryRootId = 0; |
|
53 |
|
54 // Fixed category id for "invalid" category. |
|
55 const TUint32 KIptvRssInvalidCategoryId = KMaxTUint32 - 2; |
|
56 const TInt KIptvVodContentMaxLanguageLen = 10; |
|
57 const TInt KIptvVodContentMaxContentNameLen = 100; |
|
58 const TInt KIptvVodContentMaxContentDescriptionLen = 255; |
|
59 const TInt KIptvVodContentMaxThumbnailPathLen = KIptvMaxPath; |
|
60 |
|
61 // EPG manager and plugin server side constants |
|
62 |
|
63 // Category |
|
64 const TInt KIptvEpgMaxCategoryCount = 20; |
|
65 const TInt KIptvEpgMaxContentCountInCategory = 200; |
|
66 const TInt KIptvEpgCategoryStartIndex = 1; |
|
67 const TInt KIptvEpgCategoryNameMaxLength = 100; |
|
68 const TInt KIptvEpgCategoryIconFilePathMaxLength = KIptvMaxPath; |
|
69 const TInt KIptvEpgCategoryDescriptionMaxLength = 255; |
|
70 const TInt KIptvEpgCategoryLongDescriptionMaxLength = 500; |
|
71 |
|
72 // Content |
|
73 const TInt KIptvEpgMaxContentCount = 500; |
|
74 const TInt KIptvEpgContentNameMaxLength = 100; |
|
75 const TInt KIptvEpgContentIconFilePathMaxLength = KIptvMaxPath; |
|
76 const TInt KIptvEpgContentDescriptionMaxLength = 255; |
|
77 const TInt KIptvEpgContentLongDescriptionMaxLength = 500; |
|
78 const TInt KIptvEpgContentBrowserUrlMaxLength = 2048; |
|
79 const TInt KIptvEpgContentAuthorLength = 100; |
|
80 const TInt KIptvEpgContentCopyrightLength = 100; |
|
81 const TUint32 KIptvEpgContentIdNone = KMaxTUint32 - 3; |
|
82 |
|
83 // 'Search' |
|
84 const TInt KIptvRssSearchMaxSearchStringLength = 255; |
|
85 // Fixed category id for search category. |
|
86 const TUint32 KIptvRssSearchCategoryId = KMaxTUint32 - 1; |
|
87 const TUint32 KIptvRssSearchInitialContentId = 1000000; |
|
88 |
|
89 // Content access |
|
90 const TInt KIptvCAContentUrlLength = 2048; |
|
91 const TInt KIptvCAPurchaseUrlLength = 2048; |
|
92 const TInt KIptvCALanguageLength = 10; |
|
93 const TInt KIptvCAPriceLength = 10; |
|
94 const TInt KIptvCAMimeTypeLength = 64; |
|
95 |
|
96 const TInt KIptvMyVideosNameMaxLength = 100; |
|
97 const TInt KIptvMyVideosVideoMaxMimeTypeLength = 64; |
|
98 |
|
99 // MyVideos constants |
|
100 const TInt KIptvMyVideosFolderNameMaxLength = 16; |
|
101 const TInt KIptvMyVideosFolderThumbnailPathMaxLength = |
|
102 KIptvVodContentMaxThumbnailPathLen; |
|
103 const TInt KIptvMyVideosFolderDescriptionMaxLength = |
|
104 KIptvVodContentMaxCategoryDescriptionLen; |
|
105 const TInt KIptvMyVideosFolderLongDescriptionMaxLength = 500; |
|
106 const TInt KIptvMyVideosFolderRootId = |
|
107 KIptvVodContentCategoryRootId; |
|
108 const TUint KIptvMyVideosFolderInvalidId = KMaxTUint32; |
|
109 |
|
110 const TInt KIptvMyVideosVideoNameMaxLength = |
|
111 KIptvVodContentMaxContentNameLen; |
|
112 const TInt KIptvMyVideosVideoThumbnailPathMaxLength = |
|
113 KIptvVodContentMaxThumbnailPathLen; |
|
114 const TInt KIptvMyVideosVideoDescriptionMaxLength = |
|
115 KIptvVodContentMaxContentDescriptionLen; |
|
116 const TInt KIptvMyVideosVideoPathMaxLength = |
|
117 KIptvMaxPath; |
|
118 const TInt KIptvMyVideosVideoLongDescriptionMaxLength = |
|
119 KIptvEpgContentLongDescriptionMaxLength; |
|
120 |
|
121 const TInt KIptvMyVideosVideoMaxAudioLanguageLen = 50; |
|
122 |
|
123 const TInt KIptvMyVideosVideoMaxAuthorLength = 255; |
|
124 const TInt KIptvMyVideosVideoMaxCopyrightLength = 255; |
|
125 const TInt KIptvMyVideosVideoMaxFileSourceNameLength = 128; |
|
126 |
|
127 // Service manager |
|
128 // in 16bit words |
|
129 const TInt KIptvSmServicesDbNameMaxLength = 80; |
|
130 const TInt KIptvSmServicesDbAddressMaxLength = 255; |
|
131 const TInt KIptvSmServicesDbIconPathMaxLength = KIptvMaxPath; |
|
132 // Check which plugin has shortest and use it. Currently using |
|
133 // KMaxDefAttrLength from HttpDownloadMgrCommon.h |
|
134 const TInt KIptvSmPasswordsDbUserNameMaxLength = 32; |
|
135 // Currently using KMaxDefAttrLength from HttpDownloadMgrCommon.h |
|
136 const TInt KIptvSmPasswordsDbPasswordMaxLength = 32; |
|
137 const TInt KIptvSmServicesDbDescMaxLength = 200; |
|
138 const TInt KIptvSmServicesDbTempIdMaxLength = 127; |
|
139 const TInt KIptvSmServicesDbMaxIaps = 10; |
|
140 const TInt KIptvSmServicesDbProviderIdMaxLength = |
|
141 KIptvSmServicesDbAddressMaxLength; |
|
142 const TInt KIptvSmServicesDbAccountManagementUrlMaxLength = |
|
143 KIptvSmServicesDbAddressMaxLength; |
|
144 const TInt KIptvSmServicesDbIapNameMaxLength = 255; |
|
145 const TInt KIptvSmServicesDbSearchUrlMaxLength = 2048; |
|
146 const TInt KIptvSmServicesDbRecordUrlMaxLength = 2048; |
|
147 |
|
148 // in 8-bit bytes |
|
149 const int KIptvSmServicesDbIapListMaxLength = |
|
150 1 /*TUint8 count*/ + |
|
151 KIptvSmServicesDbMaxIaps * |
|
152 ( 4 /*TUint32 iId*/ + 2 /*TUint16 priority*/ ); |
|
153 |
|
154 // CIptvEpgService constants |
|
155 const TInt KIptvEpgServiceAddressMaxLength = |
|
156 KIptvSmServicesDbAddressMaxLength; |
|
157 const TInt KIptvEpgServiceUserNameMaxLength = |
|
158 KIptvSmPasswordsDbUserNameMaxLength; |
|
159 const TInt KIptvEpgServicePasswordMaxLength = |
|
160 KIptvSmPasswordsDbPasswordMaxLength; |
|
161 |
|
162 //Network Selection |
|
163 const TInt KIptvNsIapNameMaxLength = 255; |
|
164 |
|
165 //vod dl |
|
166 const TInt KIptvVodDlUserNameMaxLength = |
|
167 KIptvSmPasswordsDbUserNameMaxLength; |
|
168 const TInt KIptvVodDlPasswordMaxLength = |
|
169 KIptvSmPasswordsDbUserNameMaxLength; |
|
170 |
|
171 // EPG manager server side error codes |
|
172 const TInt KIptvErrorGetUpdateInformationLNotFound = 123; |
|
173 const TInt KIptvErrorNoService = 140; |
|
174 |
|
175 // aInfo parameters for error codes. Notice these are not actual error codes! |
|
176 const TInt KIptvRssParserError = 145; |
|
177 |
|
178 // EPG manager messages sent to client! |
|
179 const TInt KIptvErrorVodNoIap = 139; // aInfo is 0 |
|
180 const TInt KIptvVodUpdateStarted = 136; // aInfo is 0 |
|
181 const TInt KIptvContentUpdateCompleted = 146; // aInfo is 0 |
|
182 const TInt KIptvServiceThumbnailDownloaded = 143; // aInfo parameter is |
|
183 // service id |
|
184 const TInt KIptvContentThumbnailDownloaded = 144; // aInfo parameter is |
|
185 // content id |
|
186 const TInt KIptvErrorEpgUpdateFailed = 133; // KIptvRssParserError |
|
187 // or TIptvDlError |
|
188 // (defined in this file) |
|
189 const TInt KIptvErrorEpgUpdateSuccessed = 134; // aInfo is 0 |
|
190 const TInt KIptvVodUpdateNotStarted = 137; // aInfo is 0 |
|
191 const TInt KIptvErrorEpgUpdateStopped = 138; // aInfo is 0 |
|
192 |
|
193 const TInt KIptvErrorRssSearchStarted = 170; |
|
194 const TInt KIptvErrorRssSearchFailed = 171; |
|
195 const TInt KIptvErrorRssSearchSucceed = 172; |
|
196 const TInt KIptvErrorRssSearchNoIap = 173; |
|
197 const TInt KIptvErrorRssSearchCancelled = 174; // Currently used only internally in VoD UI |
|
198 const TInt KIptvRssSearchContentUpdateCompleted = 175; |
|
199 const TInt KIptvRssSearchThumbnailCount = 176; // aInfo is thumbnail count |
|
200 const TInt KIptvRssSearchContentThumbnailDownloaded = 177; // aInfo is content id |
|
201 |
|
202 const TInt KIptvThumbnailCount = 141; // aInfo is thumbnail count |
|
203 |
|
204 // EPG manager messages sent to client (LIVE TV ONLY) |
|
205 const TInt KIptvErrorFailedToLoadPlugin = 135; |
|
206 |
|
207 // Notification plugin |
|
208 const TInt KIptvInstallService = 200; |
|
209 const TInt KIptvDontInstallService = 201; |
|
210 const TInt KIptvAddVodService = 202; |
|
211 const TInt KIptvDontAddVodService = 203; |
|
212 const TInt KIptvAddVodcastService = 204; |
|
213 const TInt KIptvDontAddVodcastService = 205; |
|
214 |
|
215 // Provisioning processor |
|
216 const TInt KIptvSchemaMismatch = 301; |
|
217 const TInt KIptvInvalidServiceType = 302; |
|
218 const TInt KIptvInvalidUrl = 303; |
|
219 |
|
220 _LIT( KIptvEpgDbName, "epgdb." ); |
|
221 const TInt KIptvEpgDbLastModifiedMaxLength = 64; |
|
222 const TInt KIptvEpgDbXmlFileHashMaxLength = 20; |
|
223 const TInt KIptvServiceIdMaxLength = 10; |
|
224 |
|
225 // Time |
|
226 const TInt64 KIptvMinuteAsMicrosecond = 60000000; |
|
227 |
|
228 enum /* Price list indexes */ |
|
229 { |
|
230 EIptvPriceStream = 0, /* Streamed */ |
|
231 EIptvPriceImmediate, /* Immediate download */ |
|
232 EIptvPricePostponed, /* Postponed download */ |
|
233 EIptvPriceScheduled, /* Scheduled download */ |
|
234 EIptvPriceIdList /* Amount of defined price indexes */ |
|
235 }; |
|
236 |
|
237 // CenRep: UIDs |
|
238 // |
|
239 const TUid KIptvCenRepUid = { 0x102750E2 }; |
|
240 const TUid KIptvAlrCenRepUid = { 0x2000B438 }; |
|
241 |
|
242 // CenRep: Keys |
|
243 // |
|
244 const TInt KIptvCenRepPreferredMemoryKey = 0x1; |
|
245 const TInt KIptvCenRepConnectionsKey = 0x2; |
|
246 const TInt KIptvCenRepCellularKey = 0x3; |
|
247 const TInt KIptvCenRepVoDThumbnailsKey = 0x4; |
|
248 const TInt KIptvCenRepActiveServiceIdKey = 0x5; |
|
249 const TInt KIptvCenRepVideoPlayerVolumeKey = 0x6; |
|
250 const TInt KIptvCenRepMainAppServiceFocusKey = 0x7; |
|
251 const TInt KIptvCenRepFirstTimeKey = 0x8; |
|
252 const TInt KIptvCenRepServiceUpdatedKey = 0x9; |
|
253 const TInt KIptvCenRepUpdatedServiceIdKey = 0xA; |
|
254 const TInt KIptvCenRepAPModeKey = 0xB; |
|
255 const TInt KIptvCenRepParentControlKey = 0xC; |
|
256 const TInt KIptvCenRepLastPlaybackPositionFeatureKey = 0xD; |
|
257 |
|
258 const TInt KIptvCenRepUsedSnapIdKey = 0x1; |
|
259 const TInt KIptvCenRepAllowUseGprsKey = 0x2; |
|
260 const TInt KIptvCenRepAllowRoamingKey = 0x3; |
|
261 const TInt KIptvCenRepMaxUsedMemoryKey = 0x4; |
|
262 const TInt KIptvCenRepIadUpdateCheckTimeKey = 0xA; |
|
263 |
|
264 // CenRep: Key values |
|
265 // |
|
266 const TInt KIptvCenRepPreferredMemoryKeyPhone = 0; |
|
267 const TInt KIptvCenRepPreferredMemoryKeyMmc = 1; |
|
268 const TInt KIptvCenRepParentControlKeyOff = 0; |
|
269 const TInt KIptvCenRepAPModeAlwaysAsk = 0; |
|
270 const TInt KIptvCenRepAPModeUserDefined = 1; |
|
271 |
|
272 const TInt KIptvCenRepConnectionKeyValueYes = 1; |
|
273 const TInt KIptvCenRepConnectionKeyValueNo = 0; |
|
274 const TInt KIptvCenRepSnapAlwaysAsk = 0; |
|
275 |
|
276 // CenRep: Default values |
|
277 // |
|
278 const TInt KIptvCenRepPreferredMemoryKeyDefault = KIptvCenRepPreferredMemoryKeyMmc; |
|
279 const TInt KIptvCenRepFirstTimeKeyDefault = 8; |
|
280 const TInt KIptvCenRepParentControlKeyDefault = KIptvCenRepParentControlKeyOff; |
|
281 const TInt KIptvCenRepAPModeKeyDefault = KIptvCenRepAPModeUserDefined; |
|
282 |
|
283 // DATA TYPES |
|
284 typedef TUint32 TIptvServiceId; |
|
285 typedef TUint32 TIptvGroupId; |
|
286 typedef TUint32 TIptvFolderId; |
|
287 typedef TUint32 TIptvCategoryId; |
|
288 typedef TUint32 TIptvContentId; |
|
289 typedef TUint32 TIptvFileId; |
|
290 typedef TUint32 TIptvPlayTime; |
|
291 typedef TReal32 TIptvPrice; |
|
292 typedef TUint32 TIptvFileSize; |
|
293 typedef TUint32 TIptvContentLanguage; |
|
294 |
|
295 typedef enum /* Content download choises */ |
|
296 { |
|
297 EIptvDownloadTypeStream = 0x1, |
|
298 EIptvDownloadTypeImmediate = 0x2, |
|
299 EIptvDownloadTypePostponed = 0x4, |
|
300 EIptvDownloadTypeScheduled = 0x8 |
|
301 } TIptvDownloadType; |
|
302 |
|
303 // Publish & subscribe properties offered by Iptv Engine with |
|
304 // IPTV_SERVER_UID category */ |
|
305 typedef enum |
|
306 { |
|
307 EIptvVodDownloadStateProperty //used by CIptvVodDlClient |
|
308 } TIptvServerProperty; |
|
309 |
|
310 // Filepaths |
|
311 typedef enum /* File path choises */ |
|
312 { |
|
313 EIptvPathWritableRoot = 0x1, // Root path |
|
314 EIptvPathTmp = 0x2, // temp folder |
|
315 EIptvPathMyVideosDb = 0x3, // My Videos DB root |
|
316 EIptvPathEcg = 0x4, // Content guide storage root |
|
317 EIptvPathService = 0x5, // Service thumbnails |
|
318 EIptvPathMyVideosVideo = 0x6, // My Videos video root |
|
319 EIptvPathEcgLive = 0x7, |
|
320 EIptvPathTmpLive = 0x8, |
|
321 EIptvPathRssThumbnail = 0x9, // vod rss thumbnail path |
|
322 EIptvPathRssSearchThumbnail = 0x10 // search thumbnail path |
|
323 } TIptvPathSelection; |
|
324 |
|
325 |
|
326 typedef enum |
|
327 { |
|
328 EIptvDlNoError, |
|
329 EIptvDlOutOfMemory, |
|
330 |
|
331 EIptvDlOutOfMemoryInVodDlPluginCreate, |
|
332 EIptvDlVodDlPluginNotFound, |
|
333 EIptvDlGeneralErrorInVodDlPluginCreate, |
|
334 |
|
335 //errors before the download starts |
|
336 EIptvDlMessageAlreadyPending, |
|
337 EIptvDlTypeNotSupported, |
|
338 EIptvDlMaxDownloadsExceeded, |
|
339 EIptvDlAlreadyExists, |
|
340 KIptvDlCouldNotGetServiceData, //wrong service id? |
|
341 EIptvDlEpgManagerNotReady, |
|
342 EIptvDlCouldNotGetContentFullDetails, |
|
343 EIptvDlFailedToAddNewVideoToMyVideos, |
|
344 EIptvDlCouldNotConnectToS60DlMgr, |
|
345 EIptvDlCouldNotSetIapAttrToS60DlMgr, |
|
346 EIptvDlCouldNotCreateS60Download, |
|
347 EIptvDlCouldNotStartS60Download, |
|
348 |
|
349 //errors during & after download |
|
350 EIptvDlConnectionFailed,// IAP wrong or no network coverage |
|
351 EIptvDlAuthFailed, |
|
352 EIptvDlProxyAuthFailed, |
|
353 EIptvDlContentNotFound, // HTTP 402 |
|
354 EIptvDlDiskFull, |
|
355 EIptvDlDestFileInUse, |
|
356 EIptvDlBadUrl, // Syntax error in url |
|
357 EIptvDlMmcRemoved, |
|
358 EIptvDlGeneral, // Wwrong url, content removed, network does not |
|
359 // work, server side leaved with error, ... |
|
360 EIptvDlDisconnected, // Connection to network lost |
|
361 EIptvDlContentUnchanged, // ETag or last modified data hasn't been changed |
|
362 // so no need to download the file cause it's not |
|
363 // changed |
|
364 EIptvDlInvalidIap, // Invalid IAP |
|
365 EIptvDlNoErrorUpToDate, // No download needed, current content is valid |
|
366 EIptvResumingFromBeginning // Resume not possible, starting from beginning |
|
367 } TIptvDlError; |
|
368 |
|
369 // This value is defined here because of the following explanation: |
|
370 // When download manager does see an http error code (similar to the codes |
|
371 // listed in TIptvHttpResponse enumeration below) it re-maps that error code |
|
372 // with "magical" number -25000. This -25000 is defined in HttpDownload.cpp |
|
373 // file located in \s60\mw\BrowserUtilities\DownloadMgr\DownloadMgrServEng\Src. |
|
374 // Since the constant is defined in .cpp file we cannot include it in our code. |
|
375 // This constant is used in TIptvHttpResponse enumeration to map those values |
|
376 // to the one that is used by download manager -> If download manager ever |
|
377 // changes the error base value we only modify this constant to make mapping |
|
378 // correct again. |
|
379 const TInt KIptvHttpErrorBase = -25000; |
|
380 |
|
381 // Url max length in iptv. |
|
382 // As far as I know url specification allows url to be as big as 2048, but |
|
383 // S60 (v3.1/w31) download manager crashes if url length goes somewhere around |
|
384 // 1200-1400 so we need to limit it here. If someone finds out that |
|
385 // download manager get fixed please feel free to change value to 2048 |
|
386 const TInt KIptvUrlMaxLength = 1024; |
|
387 |
|
388 /** |
|
389 * Enumeration containing all the supported http response messages. |
|
390 * These enumerations can be use by the download operations to check |
|
391 * necessary operations needed when receiving messages from S60 |
|
392 * download manager. |
|
393 */ |
|
394 typedef enum |
|
395 { |
|
396 EHttpResponseContinue = KIptvHttpErrorBase - 100, |
|
397 EHttpResponseSwitchingProtocols = KIptvHttpErrorBase - 101, |
|
398 |
|
399 EHttpResponseOk = KIptvHttpErrorBase - 200, |
|
400 EHttpResponseCreated = KIptvHttpErrorBase - 201, |
|
401 EHttpResponseAccepted = KIptvHttpErrorBase - 202, |
|
402 EHttpResponseNonAuthoritativeInformation = KIptvHttpErrorBase - 203, |
|
403 EHttpResponseNoContent = KIptvHttpErrorBase - 204, |
|
404 EHttpResponseResetContent = KIptvHttpErrorBase - 205, |
|
405 EHttpResponsePartialContent = KIptvHttpErrorBase - 206, |
|
406 |
|
407 EHttpResponseMultipleChoices = KIptvHttpErrorBase - 300, |
|
408 EHttpResponseMovedPermanently = KIptvHttpErrorBase - 301, |
|
409 EHttpResponseFound = KIptvHttpErrorBase - 302, |
|
410 EHttpResponseSeeOther = KIptvHttpErrorBase - 303, |
|
411 EHttpResponseNotModified = KIptvHttpErrorBase - 304, |
|
412 EHttpResponseUseProxy = KIptvHttpErrorBase - 305, |
|
413 EHttpResponseUnused = KIptvHttpErrorBase - 306, // Not used by the protocol |
|
414 EHttpResponseTemporaryRedirect = KIptvHttpErrorBase - 307, |
|
415 |
|
416 EHttpResponseBadRequest = KIptvHttpErrorBase - 400, |
|
417 EHttpResponseUnautorized = KIptvHttpErrorBase - 401, |
|
418 EHttpResponsePaymentRequired = KIptvHttpErrorBase - 402, |
|
419 EHttpResponseForbidden = KIptvHttpErrorBase - 403, |
|
420 EHttpResponseNotFound = KIptvHttpErrorBase - 404, |
|
421 EHttpResponseMethodNotAllowed = KIptvHttpErrorBase - 405, |
|
422 EHttpResponseNotAcceptable = KIptvHttpErrorBase - 406, |
|
423 EHttpResponseProxyAuthenticationRequired = KIptvHttpErrorBase - 407, |
|
424 EHttpResponseRequestTimeout = KIptvHttpErrorBase - 408, |
|
425 EHttpResponseConflict = KIptvHttpErrorBase - 409, |
|
426 EHttpResponseGone = KIptvHttpErrorBase - 410, |
|
427 EHttpResponseLengthRequired = KIptvHttpErrorBase - 411, |
|
428 EHttpResponsePreconditionFailed = KIptvHttpErrorBase - 412, |
|
429 EHttpResponseRequestEntityTooLarge = KIptvHttpErrorBase - 413, |
|
430 EHttpResponseRequestUriTooLong = KIptvHttpErrorBase - 414, |
|
431 EHttpResponseUnsupportedMediaType = KIptvHttpErrorBase - 415, |
|
432 EHttpResponseRequestedRangeNotSatisfiable = KIptvHttpErrorBase - 416, |
|
433 EHttpResponseExpectationFailed = KIptvHttpErrorBase - 417, |
|
434 |
|
435 EHttpResponseInternalServerError = KIptvHttpErrorBase - 500, |
|
436 EHttpResponseNotImplemented = KIptvHttpErrorBase - 501, |
|
437 EHttpResponseBadGateway = KIptvHttpErrorBase - 502, |
|
438 EHttpResponseServiceUnavailable = KIptvHttpErrorBase - 503, |
|
439 EHttpResponseGatewayTimeout = KIptvHttpErrorBase - 504, |
|
440 EHttpResponseHttpVersionNotSupported = KIptvHttpErrorBase - 505 |
|
441 } TIptvHttpResponse; |
|
442 |
|
443 /** |
|
444 * Vod download states, used in CIptvVodDlDownloadEvent::iState and |
|
445 * CIptvVodDownload::iState |
|
446 */ |
|
447 |
|
448 /** |
|
449 * Created. Event only, download does not stay in this state. |
|
450 */ |
|
451 const TUint32 KIptvVodDlDownloadCreated = 0; |
|
452 |
|
453 /** |
|
454 * Not doing anything, does not exist in VOD DL Plugin. |
|
455 */ |
|
456 const TUint32 KIptvVodDlDownloadIdle = 1; |
|
457 |
|
458 /** |
|
459 * VOD DL plugin is starting the download. |
|
460 */ |
|
461 const TUint32 KIptvVodDlDownloadStarting = 2; |
|
462 |
|
463 /** |
|
464 * VOD DL plugin is downloading, deprecated, use KIptvVodDlDownloadRunning |
|
465 * instead. |
|
466 */ |
|
467 const TUint32 KIptvVodDlDownloadStarted = 3; |
|
468 |
|
469 /** |
|
470 * VOD DL plugin is downloading. |
|
471 */ |
|
472 const TUint32 KIptvVodDlDownloadRunning = 3; |
|
473 |
|
474 /** |
|
475 * Indicates that global file id won't change anymore, |
|
476 * ie client can start using it. |
|
477 * Event only, download does not stay in this state. |
|
478 */ |
|
479 const TUint32 KIptvVodDlDownloadGlobalFileIdIsValid = 4; |
|
480 |
|
481 /** |
|
482 * In queue. Either not created in VOD DL plugin yet or in paused or failed |
|
483 * state in VOD DL plugin. |
|
484 */ |
|
485 const TUint32 KIptvVodDlDownloadInQueue = 5; |
|
486 |
|
487 /** |
|
488 * VOD DL Manager is pauseing the download temporarily. |
|
489 * Paused state is entered when download is paused in VOD DL plugin. |
|
490 * This is currently not used, it could be used to pause download |
|
491 * temporarily when checking the available disk space for the download. |
|
492 */ |
|
493 const TUint32 KIptvVodDlDownloadPausing = 6; |
|
494 |
|
495 /** |
|
496 * Paused, exists in VOD DL Plugin. This state is not published. |
|
497 * Idea is to hide short term pauses (less than 10 second) from client. |
|
498 */ |
|
499 const TUint32 KIptvVodDlDownloadPaused = 7; |
|
500 |
|
501 /** |
|
502 * VOD DL Manager is pausing the download permanently. It's permanently |
|
503 * paused when vod dl plugin sends paused event. |
|
504 */ |
|
505 const TUint32 KIptvVodDlDownloadPermanentlyPausing = 8; |
|
506 |
|
507 /** |
|
508 * If KIptvVodDlDownloadPaused state lasts more than |
|
509 * KIptvVodDlPermanentPauseDelay this state is entered. |
|
510 * This state is published to clients. |
|
511 */ |
|
512 const TUint32 KIptvVodDlDownloadPermanentlyPaused = 9; |
|
513 |
|
514 /** |
|
515 * Download finished successfully. Event only, download does not stay in this |
|
516 * state. |
|
517 */ |
|
518 const TUint32 KIptvVodDlDownloadSucceeded = 10; |
|
519 |
|
520 /** |
|
521 * Event only, download does not stay in this state. |
|
522 */ |
|
523 const TUint32 KIptvVodDlDownloadFailed = 11; |
|
524 |
|
525 /** |
|
526 * After receiving event with this state, no further events will arrive of |
|
527 * this download. Download is deleted from VOD DL Manager, file is not |
|
528 * deleted from MyVideos. |
|
529 * Event only. |
|
530 */ |
|
531 const TUint32 KIptvVodDlDownloadDeleted = 12; |
|
532 |
|
533 /** |
|
534 * After receiving event with this state, no further events will arrive of |
|
535 * this download. |
|
536 * Download is deleted from VOD DL plugin, VOD DL Manager and MyVideos. |
|
537 * Event only. |
|
538 */ |
|
539 const TUint32 KIptvVodDlDownloadDeletedCompletely = 13; |
|
540 |
|
541 /** |
|
542 * Maximum simultaneus downloads in VOD DL Manager. |
|
543 */ |
|
544 const TInt KIptvVodDlMaxDownloads = 20; |
|
545 |
|
546 /** |
|
547 * Maximum simultaneous downloads in KIptvVodDlDownloadRunning state. |
|
548 */ |
|
549 const TInt KIptvVodDlMaxActiveDownloads = 3; |
|
550 |
|
551 /** |
|
552 * Maximum length of text field in db. |
|
553 */ |
|
554 const TInt KIptvUtilMaxTextFieldLengthInDb = 255; |
|
555 |
|
556 _LIT(KIptvUtilLanService, "LANService"); |
|
557 _LIT(KIptvUtilOutGoingGprs, "OutgoingGPRS"); |
|
558 _LIT(KIptvUtilDialOutISP, "DialOutISP"); |
|
559 class RWriteStream; |
|
560 class RReadStream; |
|
561 |
|
562 /** |
|
563 * Utility class used by Iptv application. |
|
564 * |
|
565 * @lib IptvClientApi.lib |
|
566 * @since Engine 1.0 |
|
567 */ |
|
568 class CIptvUtil : public CBase |
|
569 { |
|
570 |
|
571 public: |
|
572 |
|
573 /** |
|
574 * To limit changes in current functionality, the implementation |
|
575 * of MIME type check is different for different components. |
|
576 */ |
|
577 enum TIptvMimeTypeSource |
|
578 { |
|
579 EIptvMimeTypeSourcePlayer = 1, |
|
580 EIptvMimeTypeSourceRssPlugin |
|
581 }; |
|
582 |
|
583 /** |
|
584 * |
|
585 */ |
|
586 enum TConnectionType |
|
587 { |
|
588 EUnknown = (1 << 0), |
|
589 EWlan = (1 << 1), //table = IAP_TABLE col = IAP_SERVICE_TYPE value = _L("LANService")) and found from wlan table |
|
590 EGprs = (1 << 2), //table = IAP_TABLE col = IAP_SERVICE_TYPE value = _L("OutgoingGPRS") |
|
591 ECsd = (1 << 3), //table = IAP_TABLE col = IAP_SERVICE_TYPE value = _L("DialOutISP") |
|
592 }; |
|
593 |
|
594 public: |
|
595 |
|
596 /** |
|
597 * Prints long strings (RDebug::Print does not work correctly). |
|
598 * |
|
599 * @param aData String to print. |
|
600 */ |
|
601 IMPORT_C static void LongPrintL( TDesC& aData ); |
|
602 |
|
603 /** |
|
604 * Converts TDesC& descriptor to TUint32 value. |
|
605 * |
|
606 * @param value String to convert. |
|
607 * @return TUint32 value. |
|
608 */ |
|
609 IMPORT_C static TUint32 StringToInt( TDesC& value ); |
|
610 |
|
611 /** |
|
612 * Returns Iptv writable path. If last parameter is ETrue, also checks |
|
613 * the path for existence. |
|
614 * |
|
615 * @param aFs Reference to File Server session. |
|
616 * @param aSelection Indentifies which path is requested. |
|
617 * @param aPath On return, the requested path. |
|
618 * @param aDriveLetter Drive on which the path should point. Default EDriveC. |
|
619 * @param aCreatePath If ETrue, creates the path. Default ETrue. |
|
620 */ |
|
621 IMPORT_C static void GetPathL( |
|
622 RFs& aFs, |
|
623 TIptvPathSelection aSelection, |
|
624 TDes& aPath, |
|
625 TDriveNumber aDriveNumber = EDriveC, |
|
626 TBool aCreatePath = ETrue ); |
|
627 |
|
628 /** |
|
629 * Returns Iptv path. If last parameter is ETrue, also checks the path for |
|
630 * existence. Currently this method servers requests only for following |
|
631 * TIptvPathSelections: |
|
632 * - EIptvPathEcgLive |
|
633 * - EIptvPathTmpLive |
|
634 * - EIptvPathRssThumbnail |
|
635 * - EIptvPathRssSearchThumbnail |
|
636 * Functionality can be extended if there are other situations where |
|
637 * service id needs to be part of the returned path. |
|
638 * |
|
639 * @param aFs Reference to file server session |
|
640 * @param aSelection Identifies which path is requested |
|
641 * @param aServiceId Added to the path to make allow unique directories to be |
|
642 * made (i.e. \videocenter\ecg\<aServiceId>\ ) |
|
643 * @param aPath On return contains the requested path |
|
644 * @param aCreatePath If ETrue, creates the path. Default ETrue. |
|
645 */ |
|
646 IMPORT_C static void GetPathL( |
|
647 RFs& aFs, |
|
648 TIptvPathSelection aSelection, |
|
649 TUint32 aServiceId, |
|
650 TDes& aPath, |
|
651 TBool aCreatePath = ETrue ); |
|
652 |
|
653 /** |
|
654 * Read a string from a stream. |
|
655 * |
|
656 * @param aDes Data to be read. |
|
657 * @param aStream A stream where data is read from. |
|
658 */ |
|
659 IMPORT_C static void ReadDesFromStreamL( |
|
660 TDes& aDes, |
|
661 RReadStream& aStream ); |
|
662 |
|
663 /** |
|
664 * Write a string to a stream. |
|
665 * |
|
666 * @param aDes Data to be written. |
|
667 * @param aStream A stream where data is written to. |
|
668 */ |
|
669 IMPORT_C static void WriteDesToStreamL( |
|
670 const TDesC& aDes, |
|
671 RWriteStream& aStream ); |
|
672 |
|
673 /** |
|
674 * Read a string from a stream. |
|
675 * |
|
676 * @param aDes Data to be read. |
|
677 * @param aStream A stream where data is read from. |
|
678 */ |
|
679 IMPORT_C static void ReadDes8FromStreamL( |
|
680 TDes8& aDes, |
|
681 RReadStream& aStream ); |
|
682 |
|
683 /** |
|
684 * Write a string to a stream. |
|
685 * |
|
686 * @param aDes Data to be written. |
|
687 * @param aStream A stream where data is written to. |
|
688 */ |
|
689 IMPORT_C static void WriteDes8ToStreamL( |
|
690 const TDesC8& aDes, |
|
691 RWriteStream& aStream ); |
|
692 |
|
693 /** |
|
694 * Read TUint64 from a stream. |
|
695 * |
|
696 * @param aData Data to read. |
|
697 * @param aStream A stream where data is read from. |
|
698 */ |
|
699 IMPORT_C static void ReadUint64FromStreamL(TUint64& aData, |
|
700 RReadStream& aStream); |
|
701 |
|
702 /** |
|
703 * Write TUint64 to a stream. |
|
704 * |
|
705 * @param aData Data to be written. |
|
706 * @param aStream A stream where data is written to. |
|
707 */ |
|
708 IMPORT_C static void WriteUint64ToStreamL(const TUint64 aData, |
|
709 RWriteStream& aStream); |
|
710 |
|
711 /** |
|
712 * Reads HBufC from stream. Ownership moves to caller, |
|
713 * ie caller is responsible for freeing the returned pointer. |
|
714 * Use WriteHBufCToStreamL for writing. |
|
715 * |
|
716 * @param aStream A stream where data is read from. |
|
717 * @return The read data. |
|
718 */ |
|
719 IMPORT_C static HBufC* ReadHBufCFromStreamL( RReadStream& aStream ); |
|
720 |
|
721 /** |
|
722 * Writes HBufC to a stream. Ownership does not move. |
|
723 * Maximum length of the data is 0xFFFFFFFF. Use ReadHBufCFromStreamL |
|
724 * to read data from stream. |
|
725 * |
|
726 * @param aData Data to be written. |
|
727 * @param aStream A stream where data is written to. |
|
728 */ |
|
729 IMPORT_C static void WriteHBufCToStreamL( HBufC* aData, RWriteStream& aStream ); |
|
730 |
|
731 /** |
|
732 * Return language code corresponding given string. |
|
733 * |
|
734 * @param aCountryCode Language string. |
|
735 * @return Corresponding code. |
|
736 */ |
|
737 IMPORT_C static TLanguage GetLanguageByCountryCode( |
|
738 const TDesC& aCountryCode ); |
|
739 |
|
740 /** |
|
741 * Runs recognizers on the given file to determine its mime type |
|
742 * |
|
743 * @param aFsSession File server session to be used to read the file |
|
744 * @param aFilePath Full path to the file to be recognized |
|
745 * @param aDataType On return, the mime type of the file |
|
746 * @return System wide error code as returned from RFs, RFile or |
|
747 * RApaLsSession |
|
748 */ |
|
749 IMPORT_C static TInt RecognizeFile( |
|
750 RFs& aFsSession, |
|
751 const TDesC& aFilePath, |
|
752 TDataType& aDataType ); |
|
753 |
|
754 /** |
|
755 * Runs recognizers on the given file to determine its mime type. |
|
756 * |
|
757 * Note! The file handle must be sharable or the recognition will fail |
|
758 * with KErrBadHandle. This function is meant for embedding cases where |
|
759 * the file resides inside another processes private folder and it can |
|
760 * only be accessed through a shared file handle. |
|
761 * A file handle is sharable if the file server session that opened the |
|
762 * file is made sharable by calling ShareProtected() before opening the |
|
763 * file. A dedicate file server session should be used for this purpose. |
|
764 * |
|
765 * @param aFileHandle RFile handle to the file to be recognized |
|
766 * @param aDataType On return, the mime type of the file |
|
767 * @return System wide error code as returned from RFs, RFile or |
|
768 * RApaLsSession |
|
769 */ |
|
770 IMPORT_C static TInt RecognizeFile( |
|
771 const RFile& aFileHandle, |
|
772 TDataType& aDataType ); |
|
773 |
|
774 /** |
|
775 * Gets IAP connection type. |
|
776 * |
|
777 * @param aIapId IAP ID which connection type is queryed. |
|
778 * @return Connection type |
|
779 */ |
|
780 IMPORT_C static TConnectionType ConnectionTypeL( TUint32 aIapId ); |
|
781 |
|
782 /** |
|
783 * Gets IAP connection type, service ID and WLAN hidden status. |
|
784 * |
|
785 * @param aIapId IAP ID which connection type is queryed. |
|
786 * @param aIsHidden WLAN hidden status, this is valid only if type is WLAN. |
|
787 * @return Connection type |
|
788 */ |
|
789 IMPORT_C static TConnectionType ConnectionTypeL( |
|
790 TUint32 aIapId, |
|
791 TBool& aIsHiddenIap ); |
|
792 |
|
793 /** |
|
794 * Checks if aIapId is a WLAN IAP. |
|
795 * @param aIapId |
|
796 * @return ETrue if WLAN IAP, EFalse otherwise. |
|
797 */ |
|
798 IMPORT_C static TBool IsWlanIapL( TUint32 aIapId ); |
|
799 |
|
800 /** |
|
801 * Checks if aIapId is WLAN IAP or hidden WLAN IAP. |
|
802 * @param aIapId |
|
803 * @param aIsHiddenWlanIap ETrue if aIapId was hidden IAP. |
|
804 * @return ETrue if aIapId was wlan IAP. |
|
805 */ |
|
806 IMPORT_C static TBool IsWlanIapL( TUint32 aIapId, TBool& aIsHiddenWlanIap ); |
|
807 |
|
808 /** |
|
809 * Reads list of allowed access points from commsdb. Hidden access points are |
|
810 * not allowed so they are not included on this list. Anyone selecting access |
|
811 * points by reading 'IAP' table from commsdb should use this list to check |
|
812 * that the access point is on allowed list. |
|
813 * |
|
814 * @param aAllowedIaps On return, and if no leaves happened, a list of allowed |
|
815 * access points. |
|
816 */ |
|
817 IMPORT_C static void GetAllowedIapsListL( RArray<TUint32>& aAllowedIaps ); |
|
818 |
|
819 /** |
|
820 * Checks if given access point is on list of allowed access points. |
|
821 * |
|
822 * @param aIapId ID of access point to check. |
|
823 * @param aAllowedIaps List of allowed access points. |
|
824 * @return ETrue if access point is allowed to use. |
|
825 */ |
|
826 IMPORT_C static TBool IsAllowedIapL( TUint32 aIapId, RArray<TUint32>& aAllowedIaps ); |
|
827 |
|
828 /** |
|
829 * Ensures that given path exists and hides the lowest level sub-folder in the |
|
830 * path if third parameter is ETrue (default). This method should be used to ensure |
|
831 * Iptv private data paths, as they should be hidden so that harversters don't find |
|
832 * them. |
|
833 * |
|
834 * @param aFsSession File Server session. |
|
835 * @param aPath Path. |
|
836 * @param aHide If ETrue, path is hidden. |
|
837 */ |
|
838 IMPORT_C static void EnsureAndHidePathL( RFs& aFsSession, |
|
839 const TDesC& aPath, |
|
840 TBool aHide = ETrue ); |
|
841 |
|
842 /** |
|
843 * This method can be used to check whether last playback position feature |
|
844 * is supported. Fetches value from Cenrep. |
|
845 * |
|
846 * @return ETrue if last playback position feature is supported, otherwise EFalse. |
|
847 */ |
|
848 IMPORT_C static TBool LastPlaybackPositionFeatureSupported(); |
|
849 |
|
850 protected: |
|
851 |
|
852 /** |
|
853 * Removes trailing backslashes from a HBufC string. |
|
854 * |
|
855 * @param aString String to modify. |
|
856 */ |
|
857 static void RemoveTrailingBackSlashesL( HBufC* & aString ); |
|
858 }; |
|
859 |
|
860 #endif // CIPTVUTIL_H |