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