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