1 /* |
|
2 * Copyright (c) 2006-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 "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: iSDS preset structure. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef IRISDSPRESET_H |
|
20 #define IRISDSPRESET_H |
|
21 |
|
22 #include <badesca.h> |
|
23 |
|
24 class CIRChannelServerUrl; |
|
25 class RReadStream; |
|
26 class RWriteStream; |
|
27 |
|
28 /** |
|
29 * This class provides the basic structure to hold the preset |
|
30 *information that come from the isds server. |
|
31 *It also provides the basic getter and setter functions to |
|
32 *manage the preset information. |
|
33 *for url selection for a particular bitrate some functionality |
|
34 *has been provided |
|
35 *copy constructor and assignment operator has been provided to |
|
36 *override the default ones |
|
37 * |
|
38 * @code |
|
39 *CIRIsdsPreset* preset = CIRIsdsPreset::NewL() |
|
40 *preset->SetXXX(); |
|
41 *preset->GetXXX() |
|
42 * *preset1 = *preset2 |
|
43 * @endcode |
|
44 * |
|
45 */ |
|
46 |
|
47 class CIRIsdsPreset:public CBase |
|
48 { |
|
49 |
|
50 public: |
|
51 |
|
52 /** |
|
53 *CIRIsdsPreset::NewL() |
|
54 *Static function |
|
55 *standard two phased constructor |
|
56 *@return *CIRIsdsPreset |
|
57 */ |
|
58 IMPORT_C static CIRIsdsPreset* NewL(); |
|
59 |
|
60 |
|
61 /** |
|
62 *CIRIsdsPreset::NewLC() |
|
63 *Static function |
|
64 *standard two phased constructor |
|
65 *@return *CIRIsdsPreset |
|
66 */ |
|
67 IMPORT_C static CIRIsdsPreset* NewLC(); |
|
68 |
|
69 |
|
70 /** |
|
71 *CIRIsdsPreset::~CIRIsdsPreset() |
|
72 *standard C++ destructor |
|
73 */ |
|
74 ~CIRIsdsPreset(); |
|
75 |
|
76 protected: |
|
77 /** |
|
78 *CIRIsdsPreset::CIRIsdsPreset() |
|
79 *standard C++ constructor |
|
80 */ |
|
81 CIRIsdsPreset(); |
|
82 |
|
83 /** |
|
84 *CIRIsdsPreset::ConstructL() |
|
85 *standard second phase constructor(Leaveable) |
|
86 */ |
|
87 void ConstructL(); |
|
88 |
|
89 |
|
90 public: |
|
91 |
|
92 |
|
93 //setter functions |
|
94 |
|
95 /** |
|
96 *CIRIsdsPreset::SetId() |
|
97 *sets id |
|
98 *@param TDesC,supplied by xml parser |
|
99 */ |
|
100 IMPORT_C void SetId(const TDesC &aId); |
|
101 |
|
102 /** |
|
103 *CIRIsdsPreset::SetId() |
|
104 *sets id |
|
105 *@param TInt,provided to manipulate the id number |
|
106 */ |
|
107 IMPORT_C void SetId(TInt aId); |
|
108 |
|
109 /** |
|
110 *CIRIsdsPreset::SetName() |
|
111 *sets the preset name |
|
112 *@param TdesC aname,the name to be set |
|
113 */ |
|
114 IMPORT_C void SetName(const TDesC &aName); |
|
115 |
|
116 /** |
|
117 *CIRIsdsPreset::SetLangInfo() |
|
118 *sets the preset language name and the code |
|
119 *@param TdesC,TdesC language id and name to be set |
|
120 */ |
|
121 IMPORT_C void SetLangInfo(const TDesC &aLangId,const TDesC& aLangName); |
|
122 |
|
123 /** |
|
124 *CIRIsdsPreset::SetCountryInfo() |
|
125 *sets the preset country name and the code |
|
126 *@param TdesC,TdesC country id and country name to be set |
|
127 */ |
|
128 IMPORT_C void SetCountryInfo(const TDesC& aCountryId, |
|
129 const TDesC& aCountryName); |
|
130 |
|
131 /** |
|
132 *CIRIsdsPreset::SetLangCode() |
|
133 *sets the language code |
|
134 *@param TdesC language code |
|
135 */ |
|
136 IMPORT_C void SetLangCode(const TDesC &aLangId); |
|
137 |
|
138 /** |
|
139 *CIRIsdsPreset::SetLang() |
|
140 *sets the language |
|
141 *@param TdesC language |
|
142 */ |
|
143 IMPORT_C void SetLang(const TDesC& aLangName); |
|
144 |
|
145 /** |
|
146 *CIRIsdsPreset::SetCountryCode() |
|
147 *sets the language code |
|
148 *@param TdesC language code |
|
149 */ |
|
150 IMPORT_C void SetCountryCode(const TDesC &aCountryId); |
|
151 |
|
152 /** |
|
153 *CIRIsdsPreset::SetCountryName() |
|
154 *sets the language name |
|
155 *@param TdesC language name |
|
156 */ |
|
157 IMPORT_C void SetCountryName(const TDesC& aCountryName); |
|
158 |
|
159 /** |
|
160 *CIRIsdsPreset::SetLastModifiedTime() |
|
161 *sets the lastmodified time stamp |
|
162 *@param TdesC lastmodified time stamp |
|
163 */ |
|
164 IMPORT_C void SetLastModifiedTime(const TDesC &aLastModified); |
|
165 |
|
166 /** |
|
167 *CIRIsdsPreset::SetGenreInfo() |
|
168 *sets the genreid and name |
|
169 *@param aGenreId |
|
170 *@param aGenreName |
|
171 */ |
|
172 IMPORT_C void SetGenreInfo(const TDesC& aGenreId,const TDesC& aGenreName); |
|
173 |
|
174 /** |
|
175 *CIRIsdsPreset::SetImgUrl() |
|
176 *sets the image url |
|
177 *@param aImgUrl |
|
178 */ |
|
179 IMPORT_C void SetImgUrl(const TDesC& aImgUrl); |
|
180 |
|
181 /** |
|
182 *CIRIsdsPreset::SetLogoDataL() |
|
183 *sets the Logo Data |
|
184 *@param aData |
|
185 *@param aSize |
|
186 */ |
|
187 IMPORT_C void SetLogoData( const TDesC8& aData ); |
|
188 |
|
189 /** |
|
190 *CIRIsdsPreset::SetAdvertisementInUse() |
|
191 *sets the advertisementinuse url |
|
192 *@param aAdvertisementInUse |
|
193 */ |
|
194 IMPORT_C void SetAdvertisementInUse(const TDesC& aAdvertisementInUse); |
|
195 |
|
196 /** |
|
197 *CIRIsdsPreset::SetDescription() |
|
198 *sets the description for the channel |
|
199 *@param aDescription |
|
200 */ |
|
201 IMPORT_C void SetDescription(const TDesC& aDescription); |
|
202 |
|
203 /** |
|
204 *CIRIsdsPreset::SetAdvertisementUrl() |
|
205 *sets the advertisement url |
|
206 *@param aAdvertisementUrl |
|
207 */ |
|
208 IMPORT_C void SetAdvertisementUrl(const TDesC& aAdvertisementUrl); |
|
209 |
|
210 /** |
|
211 *CIRIsdsPreset::SetUrlCount() |
|
212 *sets the count of the number of urls |
|
213 */ |
|
214 IMPORT_C void SetUrlCount(); |
|
215 |
|
216 /** |
|
217 *CIRIsdsPreset::SetShortDesc() |
|
218 *sets the short description |
|
219 *@param aShortDesc |
|
220 */ |
|
221 IMPORT_C void SetShortDesc(const TDesC& aShortDesc); |
|
222 |
|
223 /** |
|
224 * Sets the genre name |
|
225 * @param aGenreName |
|
226 */ |
|
227 IMPORT_C void SetGenreName(const TDesC& aGenreName); |
|
228 |
|
229 /** |
|
230 * Sets the genre id |
|
231 * @param aGenreId |
|
232 */ |
|
233 IMPORT_C void SetGenreId(const TDesC& aGenreId); |
|
234 |
|
235 /** |
|
236 *CIRIsdsPreset::SetUrlCount() |
|
237 *sets the count of the number of urls |
|
238 *@param aCnt ,count |
|
239 */ |
|
240 IMPORT_C void SetUrlCount(TInt aCnt); |
|
241 |
|
242 /** |
|
243 *CIRIsdsPreset::SetUrlL() |
|
244 *sets the channel server url |
|
245 *@param aServerName ,server name |
|
246 *@param aUrl ,server url |
|
247 *@param aBitrate .server bitrate |
|
248 */ |
|
249 IMPORT_C void SetUrlL(const TDesC &aServerName,const TDesC &aUrl,const TDesC &aBitrate); |
|
250 |
|
251 /** |
|
252 *CIRIsdsPreset::SetUrlL() |
|
253 *sets the channel server url |
|
254 *@param aServerName ,server name |
|
255 *@param aUrl ,server url |
|
256 *@param aBitrate ,server bitrate |
|
257 */ |
|
258 IMPORT_C void SetUrlL(const TDesC &aServerName,const TDesC &aUrl,TInt aBitrate); |
|
259 |
|
260 /** |
|
261 *CIRIsdsPreset::SetChannelType() |
|
262 *sets the channel type |
|
263 *@param aChannelType userdefined,isds,adhoc |
|
264 */ |
|
265 IMPORT_C void SetChannelType(TInt aChannelType); |
|
266 |
|
267 |
|
268 /** |
|
269 *CIRIsdsPreset::SetMusicStoreStatus() |
|
270 *sets the musicStoreEnabled |
|
271 *@param aMusicStoreStatus |
|
272 */ |
|
273 IMPORT_C void SetMusicStoreStatus(const TDesC& aMusicStoreStatus); |
|
274 |
|
275 |
|
276 |
|
277 |
|
278 |
|
279 //for serialization |
|
280 /** |
|
281 *CIRIsdsPreset::ExternalizeL() |
|
282 *serializes the preset data into a stream |
|
283 *@param aWriteStream |
|
284 */ |
|
285 IMPORT_C void ExternalizeL(RWriteStream& aWriteStream); |
|
286 |
|
287 /** |
|
288 *CIRIsdsPreset::InternalizeL() |
|
289 *serializes the preset data from a stream to a structure |
|
290 *@param aReadStream |
|
291 */ |
|
292 IMPORT_C void InternalizeL(RReadStream& aReadStream); |
|
293 |
|
294 //getter functions |
|
295 /** |
|
296 *CIRIsdsPreset::GetId() |
|
297 *gets the channel id |
|
298 *@return TInt |
|
299 */ |
|
300 IMPORT_C TInt GetId() const; |
|
301 |
|
302 /** |
|
303 *CIRIsdsPreset::GetName() |
|
304 *gets the channel name |
|
305 *@return TDesC |
|
306 */ |
|
307 IMPORT_C const TDesC& GetName() const; |
|
308 |
|
309 /** |
|
310 *CIRIsdsPreset::GetLangId() |
|
311 *gets the channel channelid |
|
312 *@return TDesC |
|
313 */ |
|
314 IMPORT_C const TDesC& GetLangId() const; |
|
315 |
|
316 /** |
|
317 *CIRIsdsPreset::GetLangName() |
|
318 *gets the channel language name |
|
319 *@return TDesC |
|
320 */ |
|
321 IMPORT_C const TDesC& GetLangName() const; |
|
322 |
|
323 /** |
|
324 *CIRIsdsPreset::GetCountryId() |
|
325 *gets the channel countryid |
|
326 *@return TDesC |
|
327 */ |
|
328 IMPORT_C const TDesC& GetCountryId() const; |
|
329 |
|
330 /** |
|
331 *CIRIsdsPreset::GetCountryName() |
|
332 *gets the channel country name |
|
333 *@return TDesC |
|
334 */ |
|
335 IMPORT_C const TDesC& GetCountryName() const; |
|
336 |
|
337 /** |
|
338 *CIRIsdsPreset::GetLastModifiedTime() |
|
339 *gets the channel last modified time stamp |
|
340 *@return TDesC |
|
341 */ |
|
342 IMPORT_C const TDesC& GetLastModifiedTime() const; |
|
343 |
|
344 /** |
|
345 *CIRIsdsPreset::GetDescription() |
|
346 *gets the channel description |
|
347 *@return TDesC |
|
348 */ |
|
349 IMPORT_C const TDesC& GetDescription() const; |
|
350 |
|
351 /** |
|
352 *CIRIsdsPreset::GetShortDescription() |
|
353 *gets the channel short description |
|
354 *@return TDesC |
|
355 */ |
|
356 IMPORT_C const TDesC& GetShortDescription() const; |
|
357 |
|
358 /** |
|
359 *CIRIsdsPreset::GetChannelType() |
|
360 *gets the channel Type |
|
361 *@return TInt |
|
362 */ |
|
363 IMPORT_C TInt GetChannelType() const; |
|
364 |
|
365 /** |
|
366 *CIRIsdsPreset::GetGenreId() |
|
367 *gets the channel genreid |
|
368 *@return TDesC |
|
369 */ |
|
370 IMPORT_C const TDesC& GetGenreId() const; |
|
371 |
|
372 /** |
|
373 *CIRIsdsPreset::GetGenreName() |
|
374 *gets the channel genre name |
|
375 *@return TDesC |
|
376 */ |
|
377 IMPORT_C const TDesC& GetGenreName() const; |
|
378 |
|
379 /** |
|
380 *CIRIsdsPreset::GetAdvertisementUrl() |
|
381 *gets the channel advertisement url |
|
382 *@return TDesC |
|
383 */ |
|
384 IMPORT_C const TDesC& GetAdvertisementUrl() const; |
|
385 |
|
386 /** |
|
387 * Gets the channel advertisement in use |
|
388 * @return TDesC |
|
389 */ |
|
390 IMPORT_C const TDesC& GetAdvertisementInUse() const; |
|
391 |
|
392 /** |
|
393 * Gets the image url |
|
394 * @return TDesC |
|
395 */ |
|
396 IMPORT_C const TDesC& GetImgUrl() const; |
|
397 |
|
398 /** |
|
399 *CIRIsdsPreset::GetUrlCount() |
|
400 *gets the channel url count |
|
401 *@return TDesC |
|
402 */ |
|
403 IMPORT_C TInt GetUrlCount() const; |
|
404 |
|
405 /* |
|
406 *CIRIsdsPreset::GetLogoData() |
|
407 *gets the Logo Data |
|
408 *@return TDesC& |
|
409 */ |
|
410 IMPORT_C const TDesC8& GetLogoData() const; |
|
411 |
|
412 /** |
|
413 *CIRIsdsPreset::GetMusicStoreStatus() |
|
414 *gets the musicStoreEnabled |
|
415 *@return TDesC& |
|
416 */ |
|
417 IMPORT_C const TDesC& GetMusicStoreStatus() const; |
|
418 |
|
419 |
|
420 /** |
|
421 *CIRIsdsPreset::SetLastModifiedTime() |
|
422 *gets the channel url at a particular index |
|
423 *@param aindex |
|
424 *@return CIRChannelServerUrl |
|
425 */ |
|
426 IMPORT_C CIRChannelServerUrl& GetUrl(TInt aInt); |
|
427 |
|
428 /** |
|
429 *CIRIsdsPreset::operator=() |
|
430 *assignment operator |
|
431 *@param CIRIsdsPreset& aPreset |
|
432 *@return CIRIsdsPreset |
|
433 */ |
|
434 IMPORT_C CIRIsdsPreset& operator=(const CIRIsdsPreset& aPreset); |
|
435 |
|
436 /** |
|
437 *CIRIsdsPreset::GetAvailableBitrates() |
|
438 *gets the bitrate array |
|
439 *@return RArray<TInt> |
|
440 */ |
|
441 IMPORT_C TInt GetAvailableBitrates(RArray<TInt>& aBitrates) const; |
|
442 |
|
443 /** |
|
444 *CIRIsdsPreset::GetUrlForBitrateL() |
|
445 *gets the array of bitrates for a particular bitrate |
|
446 *@param aBitrate |
|
447 *@return CDesCArrayFlat |
|
448 */ |
|
449 IMPORT_C CDesCArrayFlat* GetUrlForBitrateL(TInt aBitrate); |
|
450 |
|
451 /** |
|
452 *CIRIsdsPreset::GetExactUrlForBitrateL() |
|
453 *Urls exactly matching a given bitrate for display purpose |
|
454 *@param aBitrate |
|
455 *@return CDesCArrayFlat |
|
456 */ |
|
457 IMPORT_C CDesCArrayFlat* GetExactUrlForBitrateL(TInt aBitrate); |
|
458 |
|
459 /** |
|
460 *CIRIsdsPreset::GetChannelUrlAtL() |
|
461 *sets the lastmodified time stamp |
|
462 *returns the url at the urlarray by index |
|
463 *@param aIndex |
|
464 *@return TDesC |
|
465 */ |
|
466 IMPORT_C const TDesC& GetChannelUrlAtL(TInt aIndex) const; |
|
467 /** |
|
468 *CIRIsdsPreset::GetChannelUrlAtL() |
|
469 *sets the lastmodified time stamp |
|
470 *returns the url at the urlarray by index |
|
471 *@param aIndex |
|
472 *@return TDesC |
|
473 */ |
|
474 IMPORT_C TInt GetChannelBitrateL(TInt aIndex); |
|
475 |
|
476 private: |
|
477 |
|
478 /** |
|
479 *CIRIsdsPreset::SortInOrderL() |
|
480 *sorts the urls in bitrate order desc. |
|
481 */ |
|
482 void SortInOrderL(); |
|
483 |
|
484 public: |
|
485 |
|
486 //url array |
|
487 CArrayPtrFlat<CIRChannelServerUrl>*iUrlArray; |
|
488 |
|
489 /**type of presets(source)*/ |
|
490 enum TChannelType |
|
491 { |
|
492 EUserDefined,/**added by user*/ |
|
493 EIsdsPreset,/**fetched from isds*/ |
|
494 EAdhoc /**not in use currently*/ |
|
495 }; |
|
496 |
|
497 private: |
|
498 //no of channel urls |
|
499 TInt iChannelUrlCount; |
|
500 //0 for user defined 1 for isds type. |
|
501 TInt iType; |
|
502 //isds generated preset id |
|
503 TInt iPresetId; |
|
504 //preset name |
|
505 RBuf iName; |
|
506 //preset language code |
|
507 RBuf iLanguageCode; |
|
508 //preset language |
|
509 RBuf iLanguage; |
|
510 //preset country of origin code |
|
511 RBuf iCountryCode; |
|
512 //preset country of origin |
|
513 RBuf iCountry; |
|
514 //preset last modified |
|
515 RBuf iLastModified; |
|
516 //musicStoreEnabled value |
|
517 RBuf iMusicStoreStatus; |
|
518 //not in use |
|
519 RBuf iAdvertisementUrl; |
|
520 //not in use |
|
521 RBuf iAdvertisementInUse; |
|
522 //not in use |
|
523 RBuf iImgUrl; |
|
524 //Logo Data |
|
525 RBuf8 iLogoData; |
|
526 //channel description |
|
527 RBuf iDescription; |
|
528 //channel short desription |
|
529 RBuf iShortDesc; |
|
530 //channel genre name |
|
531 RBuf iGenereName; |
|
532 //channel genre id |
|
533 RBuf iGenereId; |
|
534 //channel bitrate |
|
535 TInt iBitrate; |
|
536 |
|
537 }; |
|
538 |
|
539 #endif //IRISDSPRESET_H |
|