|
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 #include <s32strm.h> |
|
20 |
|
21 #include "irchannelserverurl.h" |
|
22 #include "irdebug.h" |
|
23 #include "irisdspreset.h" |
|
24 |
|
25 const TInt KUrlArrayMaxLength = 128; |
|
26 const TInt KUrlForBitrateMaxLength = 128; |
|
27 |
|
28 _LIT(KComma,","); |
|
29 |
|
30 // ======== LOCAL FUNCTIONS ======== |
|
31 |
|
32 // ======== MEMBER FUNCTIONS ======== |
|
33 |
|
34 // --------------------------------------------------------------------------- |
|
35 //CIRIsdsPreset::NewL() |
|
36 //Static function |
|
37 //standard two phased constructor |
|
38 // --------------------------------------------------------------------------- |
|
39 // |
|
40 EXPORT_C CIRIsdsPreset* CIRIsdsPreset::NewL() |
|
41 { |
|
42 IRLOG_DEBUG( "CIRIsdsPreset::NewL - Entering" ); |
|
43 CIRIsdsPreset* self = CIRIsdsPreset::NewLC(); |
|
44 CleanupStack::Pop(self); |
|
45 IRLOG_DEBUG( "CIRIsdsPreset::NewL - Exiting." ); |
|
46 return self; |
|
47 } |
|
48 |
|
49 |
|
50 // --------------------------------------------------------------------------- |
|
51 //CIRIsdsPreset::NewLC() |
|
52 //Static function |
|
53 //standard two phased constructor |
|
54 // --------------------------------------------------------------------------- |
|
55 // |
|
56 EXPORT_C CIRIsdsPreset* CIRIsdsPreset::NewLC() |
|
57 { |
|
58 IRLOG_DEBUG( "CIRIsdsPreset::NewLC - Entering" ); |
|
59 CIRIsdsPreset* self = new (ELeave) CIRIsdsPreset; |
|
60 CleanupStack::PushL(self); |
|
61 self->ConstructL(); |
|
62 IRLOG_DEBUG( "CIRIsdsPreset::NewLC - Exiting." ); |
|
63 return self; |
|
64 } |
|
65 |
|
66 |
|
67 // --------------------------------------------------------------------------- |
|
68 //CIRIsdsPreset::~CIRIsdsPreset() |
|
69 //standard C++ destructor |
|
70 // --------------------------------------------------------------------------- |
|
71 // |
|
72 CIRIsdsPreset::~CIRIsdsPreset() |
|
73 { |
|
74 IRLOG_DEBUG( "CIRIsdsPreset::~CIRIsdsPreset - Entering" ); |
|
75 iName.Close(); |
|
76 iLanguageCode.Close(); |
|
77 iLanguage.Close(); |
|
78 iCountryCode.Close(); |
|
79 iCountry.Close(); |
|
80 iLastModified.Close(); |
|
81 iMusicStoreStatus.Close(); |
|
82 iAdvertisementUrl.Close(); |
|
83 iAdvertisementInUse.Close(); |
|
84 iImgUrl.Close(); |
|
85 iLogoData.Close(); |
|
86 iDescription.Close(); |
|
87 iShortDesc.Close(); |
|
88 iGenereName.Close(); |
|
89 iGenereId.Close(); |
|
90 |
|
91 if (iUrlArray) |
|
92 { |
|
93 iUrlArray->ResetAndDestroy(); |
|
94 } |
|
95 delete iUrlArray; |
|
96 IRLOG_DEBUG( "CIRIsdsPreset::~CIRIsdsPreset - Exiting." ); |
|
97 } |
|
98 |
|
99 |
|
100 |
|
101 // --------------------------------------------------------------------------- |
|
102 //CIRIsdsPreset::CIRIsdsPreset() |
|
103 //default C++ constructor |
|
104 //standard two phased constructor |
|
105 // --------------------------------------------------------------------------- |
|
106 // |
|
107 EXPORT_C CIRIsdsPreset::CIRIsdsPreset() |
|
108 { |
|
109 IRLOG_DEBUG( "CIRIsdsPreset::CIRIsdsPreset" ); |
|
110 } |
|
111 |
|
112 |
|
113 // --------------------------------------------------------------------------- |
|
114 //CIRIsdsPreset::ConstructL() |
|
115 //standard second phase constructor |
|
116 // --------------------------------------------------------------------------- |
|
117 // |
|
118 void CIRIsdsPreset::ConstructL() |
|
119 { |
|
120 IRLOG_DEBUG( "CIRIsdsPreset::ConstructL - Entering" ); |
|
121 iUrlArray = new (ELeave) CArrayPtrFlat<CIRChannelServerUrl>( |
|
122 KUrlArrayMaxLength); |
|
123 IRLOG_DEBUG( "CIRIsdsPreset::ConstructL - Exiting." ); |
|
124 } |
|
125 |
|
126 |
|
127 // --------------------------------------------------------------------------- |
|
128 //CIRIsdsPreset::SetId() |
|
129 //Function to set iPresetId from a TDesC |
|
130 // --------------------------------------------------------------------------- |
|
131 // |
|
132 EXPORT_C void CIRIsdsPreset::SetId(const TDesC &aId) |
|
133 { |
|
134 IRLOG_DEBUG( "CIRIsdsPreset::SetId - Entering" ); |
|
135 TLex conv(aId); |
|
136 conv.Val(iPresetId); |
|
137 IRLOG_DEBUG( "CIRIsdsPreset::SetId - Exiting." ); |
|
138 } |
|
139 |
|
140 |
|
141 // --------------------------------------------------------------------------- |
|
142 //CIRIsdsPreset::SetId() |
|
143 //Function to set iPresetId |
|
144 // --------------------------------------------------------------------------- |
|
145 // |
|
146 EXPORT_C void CIRIsdsPreset::SetId(TInt aId) |
|
147 { |
|
148 IRLOG_DEBUG( "CIRIsdsPreset::SetId(TInt) - Entering" ); |
|
149 iPresetId=aId; |
|
150 IRLOG_DEBUG( "CIRIsdsPreset::SetId(TInt) - Exiting." ); |
|
151 } |
|
152 |
|
153 |
|
154 |
|
155 // --------------------------------------------------------------------------- |
|
156 //CIRIsdsPreset::SetName() |
|
157 //Function to set iName from a TDesC |
|
158 // --------------------------------------------------------------------------- |
|
159 // |
|
160 EXPORT_C void CIRIsdsPreset::SetName(const TDesC &aName) |
|
161 { |
|
162 IRLOG_DEBUG( "CIRIsdsPreset::SetName - Entering" ); |
|
163 iName.Close(); |
|
164 iName.Create( aName ); |
|
165 IRLOG_DEBUG( "CIRIsdsPreset::SetName - Exiting." ); |
|
166 } |
|
167 |
|
168 |
|
169 // --------------------------------------------------------------------------- |
|
170 //CIRIsdsPreset::SetLangInfo() |
|
171 //Function to set iLanguageCode, iLanguage |
|
172 // --------------------------------------------------------------------------- |
|
173 // |
|
174 EXPORT_C void CIRIsdsPreset::SetLangInfo(const TDesC &aLangId, |
|
175 const TDesC& aLangName) |
|
176 { |
|
177 IRLOG_DEBUG( "CIRIsdsPreset::SetLangInfo - Entering" ); |
|
178 SetLangCode( aLangId ); |
|
179 SetLang( aLangName ); |
|
180 IRLOG_DEBUG( "CIRIsdsPreset::SetLangInfo - Exiting." ); |
|
181 } |
|
182 |
|
183 |
|
184 // --------------------------------------------------------------------------- |
|
185 //CIRIsdsPreset::SetLangCode() |
|
186 //Function to set iLanguageCode from a TDesC |
|
187 // --------------------------------------------------------------------------- |
|
188 // |
|
189 EXPORT_C void CIRIsdsPreset::SetLangCode(const TDesC &aLangId) |
|
190 { |
|
191 IRLOG_DEBUG( "CIRIsdsPreset::SetLangCode - Entering" ); |
|
192 iLanguageCode.Close(); |
|
193 iLanguageCode.Create( aLangId ); |
|
194 IRLOG_DEBUG( "CIRIsdsPreset::SetLangCode - Exiting." ); |
|
195 } |
|
196 |
|
197 |
|
198 // --------------------------------------------------------------------------- |
|
199 //CIRIsdsPreset::SetLang() |
|
200 //Function to set iLanguage from a TDesC |
|
201 // --------------------------------------------------------------------------- |
|
202 // |
|
203 EXPORT_C void CIRIsdsPreset::SetLang(const TDesC& aLangName) |
|
204 { |
|
205 IRLOG_DEBUG( "CIRIsdsPreset::SetLang - Entering" ); |
|
206 iLanguage.Close(); |
|
207 iLanguage.Create( aLangName ); |
|
208 IRLOG_DEBUG( "CIRIsdsPreset::SetLang - Exiting." ); |
|
209 } |
|
210 |
|
211 |
|
212 // --------------------------------------------------------------------------- |
|
213 //CIRIsdsPreset::SetCountryCode() |
|
214 //Function to set iCountryCode from a TDesC |
|
215 // --------------------------------------------------------------------------- |
|
216 // |
|
217 EXPORT_C void CIRIsdsPreset::SetCountryCode(const TDesC &aCountryId) |
|
218 { |
|
219 IRLOG_DEBUG( "CIRIsdsPreset::SetCountryCode - Entering" ); |
|
220 iCountryCode.Close(); |
|
221 iCountryCode.Create( aCountryId ); |
|
222 IRLOG_DEBUG( "CIRIsdsPreset::SetCountryCode - Exiting." ); |
|
223 } |
|
224 |
|
225 |
|
226 // --------------------------------------------------------------------------- |
|
227 //CIRIsdsPreset::SetCountryName() |
|
228 //Function to set iCountry from a TDesC |
|
229 // --------------------------------------------------------------------------- |
|
230 // |
|
231 EXPORT_C void CIRIsdsPreset::SetCountryName(const TDesC& aCountryName) |
|
232 { |
|
233 IRLOG_DEBUG( "CIRIsdsPreset::SetCountryName - Entering" ); |
|
234 iCountry.Close(); |
|
235 iCountry.Create( aCountryName ); |
|
236 IRLOG_DEBUG( "CIRIsdsPreset::SetCountryName - Exiting." ); |
|
237 } |
|
238 |
|
239 |
|
240 |
|
241 // --------------------------------------------------------------------------- |
|
242 //CIRIsdsPreset::SetLangInfo() |
|
243 //Function to set iCountryCode, iCountry |
|
244 // --------------------------------------------------------------------------- |
|
245 // |
|
246 EXPORT_C void CIRIsdsPreset::SetCountryInfo(const TDesC &aCountryId, |
|
247 const TDesC& aCountryName) |
|
248 { |
|
249 IRLOG_DEBUG( "CIRIsdsPreset::SetCountryInfo - Entering" ); |
|
250 SetCountryCode( aCountryId ); |
|
251 SetCountryName( aCountryName ); |
|
252 IRLOG_DEBUG( "CIRIsdsPreset::SetCountryInfo - Exiting." ); |
|
253 } |
|
254 |
|
255 |
|
256 // --------------------------------------------------------------------------- |
|
257 //CIRIsdsPreset::SetLastModifiedTime() |
|
258 //Function to set iLastModified |
|
259 // --------------------------------------------------------------------------- |
|
260 // |
|
261 EXPORT_C void CIRIsdsPreset::SetLastModifiedTime(const TDesC &aLastModified) |
|
262 { |
|
263 IRLOG_DEBUG( "CIRIsdsPreset::SetLastModifiedTime - Entering" ); |
|
264 iLastModified.Close(); |
|
265 iLastModified.Create( aLastModified ); |
|
266 IRLOG_DEBUG( "CIRIsdsPreset::SetLastModifiedTime - Exiting." ); |
|
267 } |
|
268 |
|
269 |
|
270 // --------------------------------------------------------------------------- |
|
271 //CIRIsdsPreset::SetGenreInfo() |
|
272 //Function to set iGenereName, iGenereId |
|
273 // --------------------------------------------------------------------------- |
|
274 // |
|
275 EXPORT_C void CIRIsdsPreset::SetGenreInfo(const TDesC& aGenreId, |
|
276 const TDesC& aGenreName) |
|
277 { |
|
278 IRLOG_DEBUG( "CIRIsdsPreset::SetGenreInfo - Entering" ); |
|
279 |
|
280 if(iGenereName.Length()) |
|
281 { |
|
282 RBuf newBuf; |
|
283 newBuf.Create( |
|
284 iGenereName.Length() + aGenreName.Length() + KComma().Length() ); |
|
285 newBuf.Append( iGenereName ); |
|
286 newBuf.Append( KComma ); |
|
287 newBuf.Append( aGenreName ); |
|
288 iGenereName.Close(); |
|
289 iGenereName.Create( newBuf ); |
|
290 newBuf.Close(); |
|
291 } |
|
292 if(iGenereId.Length()) |
|
293 { |
|
294 RBuf newBuf; |
|
295 newBuf.Create( |
|
296 iGenereId.Length() + aGenreId.Length() + KComma().Length() ); |
|
297 newBuf.Append( iGenereId ); |
|
298 newBuf.Append( KComma ); |
|
299 newBuf.Append( aGenreId ); |
|
300 iGenereId.Close(); |
|
301 iGenereId.Create( newBuf ); |
|
302 newBuf.Close(); |
|
303 } |
|
304 if(!iGenereName.Length()) |
|
305 { |
|
306 iGenereName.Close(); |
|
307 iGenereName.Create( aGenreName ); |
|
308 } |
|
309 if(!iGenereId.Length()) |
|
310 { |
|
311 iGenereId.Close(); |
|
312 iGenereId.Create( aGenreId ); |
|
313 } |
|
314 |
|
315 IRLOG_DEBUG( "CIRIsdsPreset::SetGenreInfo - Exiting." ); |
|
316 } |
|
317 |
|
318 |
|
319 // --------------------------------------------------------------------------- |
|
320 //CIRIsdsPreset::SetImgUrl() |
|
321 //Function to set iImgUrl |
|
322 // --------------------------------------------------------------------------- |
|
323 // |
|
324 EXPORT_C void CIRIsdsPreset::SetImgUrl(const TDesC& aImgUrl) |
|
325 { |
|
326 IRLOG_DEBUG( "CIRIsdsPreset::SetImgUrl - Entering" ); |
|
327 iImgUrl.Close(); |
|
328 iImgUrl.Create( aImgUrl ); |
|
329 IRLOG_DEBUG( "CIRIsdsPreset::SetImgUrl - Exiting." ); |
|
330 } |
|
331 |
|
332 // --------------------------------------------------------------------------- |
|
333 //CIRIsdsPreset::SetLogoData() |
|
334 //Function to set LogoData |
|
335 // --------------------------------------------------------------------------- |
|
336 // |
|
337 |
|
338 EXPORT_C void CIRIsdsPreset::SetLogoData( const TDesC8& aData ) |
|
339 { |
|
340 IRLOG_DEBUG( "CIRIsdsPreset::SetLogoDataL - Entering" ); |
|
341 |
|
342 iLogoData.Close(); |
|
343 iLogoData.Create( aData ); |
|
344 |
|
345 IRLOG_DEBUG( "CIRIsdsPreset::SetLogoDataL - Exiting." ); |
|
346 } |
|
347 |
|
348 // --------------------------------------------------------------------------- |
|
349 //CIRIsdsPreset::SetAdvertisementInUse() |
|
350 //Function to set iAdvertisementInUse |
|
351 // --------------------------------------------------------------------------- |
|
352 // |
|
353 EXPORT_C void CIRIsdsPreset::SetAdvertisementInUse( |
|
354 const TDesC& aAdvertisementInUse) |
|
355 { |
|
356 IRLOG_DEBUG( "CIRIsdsPreset::SetAdvertisementInUse - Entering" ); |
|
357 iAdvertisementInUse.Close(); |
|
358 iAdvertisementInUse.Create( aAdvertisementInUse ); |
|
359 IRLOG_DEBUG( "CIRIsdsPreset::SetAdvertisementInUse - Exiting." ); |
|
360 } |
|
361 |
|
362 |
|
363 // --------------------------------------------------------------------------- |
|
364 //CIRIsdsPreset::SetDescription() |
|
365 //Function to set iDescription |
|
366 // --------------------------------------------------------------------------- |
|
367 // |
|
368 EXPORT_C void CIRIsdsPreset:: SetDescription(const TDesC& aDescription) |
|
369 { |
|
370 IRLOG_DEBUG( "CIRIsdsPreset::SetDescription - Entering" ); |
|
371 iDescription.Close(); |
|
372 iDescription.Create( aDescription ); |
|
373 IRLOG_DEBUG( "CIRIsdsPreset::SetDescription - Exiting." ); |
|
374 } |
|
375 |
|
376 |
|
377 // --------------------------------------------------------------------------- |
|
378 //CIRIsdsPreset::SetAdvertisementUrl() |
|
379 //Function to set iAdvertisementUrl |
|
380 // --------------------------------------------------------------------------- |
|
381 // |
|
382 EXPORT_C void CIRIsdsPreset::SetAdvertisementUrl( |
|
383 const TDesC& aAdvertisementUrl) |
|
384 { |
|
385 IRLOG_DEBUG( "CIRIsdsPreset::SetAdvertisementUrl - Entering" ); |
|
386 iAdvertisementUrl.Close(); |
|
387 iAdvertisementUrl.Create( aAdvertisementUrl ); |
|
388 IRLOG_DEBUG( "CIRIsdsPreset::SetAdvertisementUrl - Exiting." ); |
|
389 } |
|
390 |
|
391 |
|
392 // --------------------------------------------------------------------------- |
|
393 //CIRIsdsPreset::SetUrlCount() |
|
394 //Function to set iChannelUrlCount |
|
395 // --------------------------------------------------------------------------- |
|
396 // |
|
397 EXPORT_C void CIRIsdsPreset::SetUrlCount() |
|
398 { |
|
399 IRLOG_DEBUG( "CIRIsdsPreset::SetUrlCount - Entering" ); |
|
400 iChannelUrlCount=iUrlArray->Count(); |
|
401 IRLOG_DEBUG( "CIRIsdsPreset::SetUrlCount - Exiting." ); |
|
402 } |
|
403 |
|
404 |
|
405 // --------------------------------------------------------------------------- |
|
406 //CIRIsdsPreset::SetShortDesc() |
|
407 //Function to set iShortDesc |
|
408 // --------------------------------------------------------------------------- |
|
409 // |
|
410 EXPORT_C void CIRIsdsPreset:: SetShortDesc(const TDesC& aShortDesc) |
|
411 { |
|
412 IRLOG_DEBUG( "CIRIsdsPreset::SetShortDesc - Entering" ); |
|
413 iShortDesc.Close(); |
|
414 iShortDesc.Create( aShortDesc ); |
|
415 IRLOG_DEBUG( "CIRIsdsPreset::SetShortDesc - Exiting." ); |
|
416 } |
|
417 |
|
418 // --------------------------------------------------------------------------- |
|
419 // CIRIsdsPreset::SetGenreName() |
|
420 // --------------------------------------------------------------------------- |
|
421 // |
|
422 EXPORT_C void CIRIsdsPreset::SetGenreName(const TDesC& aGenreName) |
|
423 { |
|
424 IRLOG_DEBUG( "CIRIsdsPreset::SetGenreName - Entering" ); |
|
425 iGenereName.Close(); |
|
426 iGenereName.Create( aGenreName ); |
|
427 IRLOG_DEBUG( "CIRIsdsPreset::SetGenreName - Exiting" ); |
|
428 } |
|
429 |
|
430 // --------------------------------------------------------------------------- |
|
431 // CIRIsdsPreset::SetGenreId() |
|
432 // --------------------------------------------------------------------------- |
|
433 // |
|
434 EXPORT_C void CIRIsdsPreset::SetGenreId(const TDesC& aGenreId) |
|
435 { |
|
436 IRLOG_DEBUG( "CIRIsdsPreset::SetGenreId - Entering" ); |
|
437 iGenereId.Close(); |
|
438 iGenereId.Create( aGenreId ); |
|
439 IRLOG_DEBUG( "CIRIsdsPreset::SetGenreId - Exiting" ); |
|
440 } |
|
441 |
|
442 // --------------------------------------------------------------------------- |
|
443 //CIRIsdsPreset::SetUrlCount() |
|
444 //Function to set iChannelUrlCount |
|
445 // --------------------------------------------------------------------------- |
|
446 // |
|
447 EXPORT_C void CIRIsdsPreset::SetUrlCount(TInt aCnt) |
|
448 { |
|
449 IRLOG_DEBUG( "CIRIsdsPreset::SetUrlCount - Entering" ); |
|
450 iChannelUrlCount=aCnt; |
|
451 IRLOG_DEBUG( "CIRIsdsPreset::SetUrlCount - Exiting." ); |
|
452 } |
|
453 |
|
454 |
|
455 // --------------------------------------------------------------------------- |
|
456 //CIRIsdsPreset::SetIndex() |
|
457 //Function to set iIndex |
|
458 // --------------------------------------------------------------------------- |
|
459 // |
|
460 EXPORT_C void CIRIsdsPreset::SetIndex(TInt aInt) |
|
461 { |
|
462 IRLOG_DEBUG( "CIRIsdsPreset::SetIndex - Entering" ); |
|
463 iIndex=aInt; |
|
464 IRLOG_DEBUG( "CIRIsdsPreset::SetIndex - Exiting." ); |
|
465 } |
|
466 |
|
467 |
|
468 // --------------------------------------------------------------------------- |
|
469 //CIRIsdsPreset::SetUrl() |
|
470 //Function to set Url parameter |
|
471 // --------------------------------------------------------------------------- |
|
472 // |
|
473 EXPORT_C void CIRIsdsPreset::SetUrlL(const TDesC &aServerName, |
|
474 const TDesC &aUrl,const TDesC &aBitrate) |
|
475 { |
|
476 IRLOG_DEBUG( "CIRIsdsPreset::SetUrlL(..., const TDesC) - Entering" ); |
|
477 CIRChannelServerUrl * hold=CIRChannelServerUrl::NewL(); |
|
478 hold->SetServerName(aServerName); |
|
479 hold->SetServerUrl(aUrl); |
|
480 TLex conv(aBitrate); |
|
481 TInt conVal = 0; |
|
482 conv.Val(conVal); |
|
483 //if a negative value comes,set the bitrate to 0,so that it is accessable |
|
484 //to all the setting combination |
|
485 if ( conVal < 0) |
|
486 { |
|
487 conVal = 0; |
|
488 } |
|
489 hold->SetBitRate(conVal); |
|
490 iUrlArray->AppendL(hold); |
|
491 IRLOG_DEBUG( "CIRIsdsPreset::SetUrlL(..., const TDesC) - Exiting." ); |
|
492 } |
|
493 |
|
494 |
|
495 // --------------------------------------------------------------------------- |
|
496 //CIRIsdsPreset::SetUrl() |
|
497 //Function to set Url parameter |
|
498 // --------------------------------------------------------------------------- |
|
499 // |
|
500 EXPORT_C void CIRIsdsPreset::SetUrlL(const TDesC &aServerName, |
|
501 const TDesC &aUrl,TInt aBitrate) |
|
502 { |
|
503 IRLOG_DEBUG( "CIRIsdsPreset::SetUrlL(..., TInt) - Entering" ); |
|
504 CIRChannelServerUrl * hold=CIRChannelServerUrl::NewL(); |
|
505 hold->SetServerName(aServerName); |
|
506 hold->SetServerUrl(aUrl); |
|
507 |
|
508 //if a negative value comes,set the bitrate to 0,so that it is accessable |
|
509 //to all the setting combination |
|
510 if (aBitrate < 0) |
|
511 { |
|
512 aBitrate = 0; |
|
513 } |
|
514 hold->SetBitRate(aBitrate); |
|
515 iUrlArray->AppendL(hold); |
|
516 IRLOG_DEBUG( "CIRIsdsPreset::SetUrlL(..., TInt) - Exiting." ); |
|
517 } |
|
518 |
|
519 |
|
520 // --------------------------------------------------------------------------- |
|
521 //CIRIsdsPreset::SetChannelType() |
|
522 //Function to set iType |
|
523 // --------------------------------------------------------------------------- |
|
524 // |
|
525 EXPORT_C void CIRIsdsPreset::SetChannelType(TInt aType) |
|
526 { |
|
527 IRLOG_DEBUG( "CIRIsdsPreset::SetChannelType - Entering" ); |
|
528 |
|
529 if ( aType != EUserDefined && aType!=EIsdsPreset && aType!=EAdhoc) |
|
530 { |
|
531 aType=EUserDefined; |
|
532 } |
|
533 iType = aType; |
|
534 IRLOG_DEBUG( "CIRIsdsPreset::SetChannelType - Exiting." ); |
|
535 } |
|
536 |
|
537 |
|
538 // --------------------------------------------------------------------------- |
|
539 //CIRIsdsPreset::SetUrl() |
|
540 //Function to set Url parameter |
|
541 // --------------------------------------------------------------------------- |
|
542 // |
|
543 EXPORT_C void CIRIsdsPreset::SetUrlL(const TDesC &aUrl) |
|
544 { |
|
545 IRLOG_DEBUG( "CIRIsdsPreset::SetUrlL - Entering" ); |
|
546 CIRChannelServerUrl * hold=CIRChannelServerUrl::NewL(); |
|
547 hold->SetServerUrl(aUrl); |
|
548 iUrlArray->AppendL(hold); |
|
549 IRLOG_DEBUG( "CIRIsdsPreset::SetUrlL - Exiting" ); |
|
550 } |
|
551 |
|
552 // --------------------------------------------------------------------------- |
|
553 //CIRIsdsPreset::SetMusicStoreStatus() |
|
554 //Function to set iMusicStoreStatus parameter |
|
555 // --------------------------------------------------------------------------- |
|
556 // |
|
557 EXPORT_C void CIRIsdsPreset::SetMusicStoreStatus(const TDesC& aMusicStoreStatus) |
|
558 { |
|
559 IRLOG_DEBUG( "CIRIsdsPreset::SetMusicStoreStatus - Entering" ); |
|
560 iMusicStoreStatus.Close(); |
|
561 iMusicStoreStatus.Create( aMusicStoreStatus ); |
|
562 IRLOG_DEBUG( "CIRIsdsPreset::SetMusicStoreStatus - Exiting" ); |
|
563 } |
|
564 |
|
565 |
|
566 |
|
567 // --------------------------------------------------------------------------- |
|
568 //CIRIsdsPreset::ExternalizeL() |
|
569 //externalizes the data |
|
570 // --------------------------------------------------------------------------- |
|
571 // |
|
572 EXPORT_C void CIRIsdsPreset::ExternalizeL(RWriteStream& aWriteStream) |
|
573 { |
|
574 IRLOG_DEBUG( "CIRIsdsPreset::ExternalizeL - Entering" ); |
|
575 //! externalize TInts s |
|
576 aWriteStream.WriteUint32L(iUniqId); |
|
577 aWriteStream.WriteInt32L(iPresetId); |
|
578 aWriteStream.WriteInt32L(iIndex); |
|
579 aWriteStream.WriteInt32L(iType); |
|
580 aWriteStream.WriteInt32L(iChannelUrlCount); |
|
581 |
|
582 // Externalize RBufs |
|
583 aWriteStream << iLanguageCode; |
|
584 aWriteStream << iLanguage; |
|
585 aWriteStream << iCountryCode; |
|
586 aWriteStream << iCountry; |
|
587 aWriteStream << iGenereName; |
|
588 aWriteStream << iGenereId; |
|
589 aWriteStream << iName; |
|
590 aWriteStream << iLastModified; |
|
591 aWriteStream << iAdvertisementUrl; |
|
592 aWriteStream << iAdvertisementInUse; |
|
593 aWriteStream << iImgUrl; |
|
594 aWriteStream << iDescription; |
|
595 aWriteStream << iShortDesc; |
|
596 aWriteStream << iMusicStoreStatus; |
|
597 aWriteStream << iLogoData; |
|
598 |
|
599 |
|
600 for(TInt cnt=0;cnt<iChannelUrlCount;cnt++) |
|
601 { |
|
602 GetUrl(cnt).ExternalizeL(aWriteStream); |
|
603 } |
|
604 IRLOG_DEBUG( "CIRIsdsPreset::ExternalizeL - Exiting." ); |
|
605 } |
|
606 |
|
607 |
|
608 // --------------------------------------------------------------------------- |
|
609 //CIRIsdsPreset::InternalizeL() |
|
610 //internalizes the data |
|
611 // --------------------------------------------------------------------------- |
|
612 // |
|
613 EXPORT_C void CIRIsdsPreset::InternalizeL(RReadStream& aReadStream) |
|
614 { |
|
615 IRLOG_DEBUG( "CIRIsdsPreset::InternalizeL - Entering" ); |
|
616 //! Internalize TInts s |
|
617 iUniqId = aReadStream.ReadUint32L(); |
|
618 iPresetId=aReadStream.ReadInt32L(); |
|
619 iIndex=aReadStream.ReadInt32L(); |
|
620 iType=aReadStream.ReadInt32L(); |
|
621 iChannelUrlCount=aReadStream.ReadInt32L(); |
|
622 |
|
623 // Internalize RBufs |
|
624 iLanguageCode.Close(); |
|
625 iLanguageCode.CreateL(aReadStream, KMaxTInt); |
|
626 |
|
627 iLanguage.Close(); |
|
628 iLanguage.CreateL(aReadStream, KMaxTInt); |
|
629 |
|
630 iCountryCode.Close(); |
|
631 iCountryCode.CreateL(aReadStream, KMaxTInt); |
|
632 |
|
633 iCountry.Close(); |
|
634 iCountry.CreateL(aReadStream, KMaxTInt); |
|
635 |
|
636 iGenereName.Close(); |
|
637 iGenereName.CreateL(aReadStream, KMaxTInt); |
|
638 |
|
639 iGenereId.Close(); |
|
640 iGenereId.CreateL(aReadStream, KMaxTInt); |
|
641 |
|
642 iName.Close(); |
|
643 iName.CreateL(aReadStream, KMaxTInt); |
|
644 |
|
645 iLastModified.Close(); |
|
646 iLastModified.CreateL(aReadStream, KMaxTInt); |
|
647 |
|
648 iAdvertisementUrl.Close(); |
|
649 iAdvertisementUrl.CreateL(aReadStream, KMaxTInt); |
|
650 |
|
651 iAdvertisementInUse.Close(); |
|
652 iAdvertisementInUse.CreateL(aReadStream, KMaxTInt); |
|
653 |
|
654 iImgUrl.Close(); |
|
655 iImgUrl.CreateL(aReadStream, KMaxTInt); |
|
656 |
|
657 iDescription.Close(); |
|
658 iDescription.CreateL(aReadStream, KMaxTInt); |
|
659 |
|
660 iShortDesc.Close(); |
|
661 iShortDesc.CreateL(aReadStream, KMaxTInt); |
|
662 |
|
663 iMusicStoreStatus.Close(); |
|
664 iMusicStoreStatus.CreateL(aReadStream, KMaxTInt); |
|
665 |
|
666 |
|
667 iUrlArray->ResetAndDestroy(); |
|
668 |
|
669 iLogoData.Close(); |
|
670 iLogoData.CreateL(aReadStream, KMaxTInt); |
|
671 |
|
672 |
|
673 |
|
674 CIRChannelServerUrl* url = NULL; |
|
675 for(TInt cnt=0;cnt<iChannelUrlCount;cnt++) |
|
676 { |
|
677 url=CIRChannelServerUrl::NewLC(); |
|
678 url->InternalizeL(aReadStream); |
|
679 iUrlArray->AppendL(url); |
|
680 CleanupStack::Pop( url ); |
|
681 } |
|
682 IRLOG_DEBUG( "CIRIsdsPreset::InternalizeL - Exiting." ); |
|
683 } |
|
684 |
|
685 |
|
686 // --------------------------------------------------------------------------- |
|
687 //CIRIsdsPreset::GetId() |
|
688 //Function to get iPresetId |
|
689 // --------------------------------------------------------------------------- |
|
690 // |
|
691 EXPORT_C TInt CIRIsdsPreset::GetId() const |
|
692 { |
|
693 IRLOG_DEBUG( "CIRIsdsPreset::GetId" ); |
|
694 return iPresetId; |
|
695 } |
|
696 |
|
697 |
|
698 // --------------------------------------------------------------------------- |
|
699 //CIRIsdsPreset::GetId() |
|
700 //Function to get iName |
|
701 // --------------------------------------------------------------------------- |
|
702 // |
|
703 EXPORT_C const TDesC& CIRIsdsPreset::GetName() const |
|
704 { |
|
705 IRLOG_DEBUG( "CIRIsdsPreset::GetName" ); |
|
706 return iName; |
|
707 } |
|
708 |
|
709 |
|
710 // --------------------------------------------------------------------------- |
|
711 //CIRIsdsPreset::GetLangId() |
|
712 //Function to get iLanguageCode |
|
713 // --------------------------------------------------------------------------- |
|
714 // |
|
715 EXPORT_C const TDesC& CIRIsdsPreset::GetLangId() const |
|
716 { |
|
717 IRLOG_DEBUG( "CIRIsdsPreset::GetLangId" ); |
|
718 return iLanguageCode; |
|
719 } |
|
720 |
|
721 |
|
722 // --------------------------------------------------------------------------- |
|
723 //CIRIsdsPreset::GetLangName() |
|
724 //Function to get iLanguage |
|
725 // --------------------------------------------------------------------------- |
|
726 // |
|
727 EXPORT_C const TDesC& CIRIsdsPreset::GetLangName() const |
|
728 { |
|
729 IRLOG_DEBUG( "CIRIsdsPreset::GetLangName" ); |
|
730 return iLanguage; |
|
731 } |
|
732 |
|
733 |
|
734 // --------------------------------------------------------------------------- |
|
735 //CIRIsdsPreset::GetCountryId() |
|
736 //Function to get iCountryCode |
|
737 // --------------------------------------------------------------------------- |
|
738 // |
|
739 EXPORT_C const TDesC& CIRIsdsPreset::GetCountryId() const |
|
740 { |
|
741 IRLOG_DEBUG( "CIRIsdsPreset::GetCountryId" ); |
|
742 return iCountryCode; |
|
743 } |
|
744 |
|
745 |
|
746 // --------------------------------------------------------------------------- |
|
747 //CIRIsdsPreset::GetCountryName() |
|
748 //Function to get iCountry |
|
749 // --------------------------------------------------------------------------- |
|
750 // |
|
751 EXPORT_C const TDesC& CIRIsdsPreset::GetCountryName() const |
|
752 { |
|
753 IRLOG_DEBUG( "CIRIsdsPreset::GetCountryName" ); |
|
754 return iCountry; |
|
755 } |
|
756 |
|
757 |
|
758 // --------------------------------------------------------------------------- |
|
759 //CIRIsdsPreset::GetLastModifiedTime() |
|
760 //Function to get iLastModified |
|
761 // --------------------------------------------------------------------------- |
|
762 // |
|
763 EXPORT_C const TDesC& CIRIsdsPreset::GetLastModifiedTime() const |
|
764 { |
|
765 IRLOG_DEBUG( "CIRIsdsPreset::GetLastModifiedTime" ); |
|
766 return iLastModified; |
|
767 } |
|
768 |
|
769 |
|
770 // --------------------------------------------------------------------------- |
|
771 //CIRIsdsPreset::GetDescription() |
|
772 //Function to get iDescription |
|
773 // --------------------------------------------------------------------------- |
|
774 // |
|
775 EXPORT_C const TDesC& CIRIsdsPreset::GetDescription() const |
|
776 { |
|
777 IRLOG_DEBUG( "CIRIsdsPreset::GetDescription" ); |
|
778 return iDescription; |
|
779 } |
|
780 |
|
781 // --------------------------------------------------------------------------- |
|
782 //CIRIsdsPreset::GetShortDescription() |
|
783 //Function to get iDescription |
|
784 // --------------------------------------------------------------------------- |
|
785 // |
|
786 EXPORT_C const TDesC& CIRIsdsPreset::GetShortDescription() const |
|
787 { |
|
788 IRLOG_DEBUG( "CIRIsdsPreset::GetShortDescription" ); |
|
789 return iShortDesc; |
|
790 } |
|
791 |
|
792 // --------------------------------------------------------------------------- |
|
793 //CIRIsdsPreset::GetChannelType() |
|
794 //Function to get iType |
|
795 // --------------------------------------------------------------------------- |
|
796 // |
|
797 EXPORT_C TInt CIRIsdsPreset::GetChannelType() const |
|
798 { |
|
799 IRLOG_DEBUG( "CIRIsdsPreset::GetChannelType" ); |
|
800 return iType; |
|
801 } |
|
802 |
|
803 |
|
804 // --------------------------------------------------------------------------- |
|
805 //CIRIsdsPreset::GetIndex() |
|
806 //Function to get iIndex |
|
807 // --------------------------------------------------------------------------- |
|
808 // |
|
809 EXPORT_C TInt CIRIsdsPreset::GetIndex() const |
|
810 { |
|
811 IRLOG_DEBUG( "CIRIsdsPreset::GetIndex" ); |
|
812 return iIndex; |
|
813 } |
|
814 |
|
815 |
|
816 // --------------------------------------------------------------------------- |
|
817 //CIRIsdsPreset::GetGenreId() |
|
818 //Function to get iGenereId |
|
819 // --------------------------------------------------------------------------- |
|
820 // |
|
821 EXPORT_C const TDesC& CIRIsdsPreset::GetGenreId() const |
|
822 { |
|
823 IRLOG_DEBUG( "CIRIsdsPreset::GetGenreId" ); |
|
824 return iGenereId; |
|
825 } |
|
826 |
|
827 |
|
828 // --------------------------------------------------------------------------- |
|
829 //CIRIsdsPreset::GetGenreName() |
|
830 //Function to get iGenereName |
|
831 // --------------------------------------------------------------------------- |
|
832 // |
|
833 EXPORT_C const TDesC& CIRIsdsPreset::GetGenreName() const |
|
834 { |
|
835 IRLOG_DEBUG( "CIRIsdsPreset::GetGenreName" ); |
|
836 return iGenereName; |
|
837 } |
|
838 |
|
839 |
|
840 // --------------------------------------------------------------------------- |
|
841 //CIRIsdsPreset::GetAdvertisementUrl() |
|
842 //Function to get iAdvertisementUrl |
|
843 // --------------------------------------------------------------------------- |
|
844 // |
|
845 EXPORT_C const TDesC& CIRIsdsPreset::GetAdvertisementUrl() const |
|
846 { |
|
847 IRLOG_DEBUG( "CIRIsdsPreset::GetAdvertisementUrl" ); |
|
848 return iAdvertisementUrl; |
|
849 } |
|
850 |
|
851 // --------------------------------------------------------------------------- |
|
852 // CIRIsdsPreset::GetAdvertisementInUse() |
|
853 // --------------------------------------------------------------------------- |
|
854 // |
|
855 EXPORT_C const TDesC& CIRIsdsPreset::GetAdvertisementInUse() const |
|
856 { |
|
857 IRLOG_DEBUG( "CIRIsdsPreset::GetAdvertisementInUse" ); |
|
858 return iAdvertisementInUse; |
|
859 } |
|
860 |
|
861 // --------------------------------------------------------------------------- |
|
862 // CIRIsdsPreset::GetImgUrl() |
|
863 // Function to get iImgUrl |
|
864 // --------------------------------------------------------------------------- |
|
865 // |
|
866 EXPORT_C const TDesC& CIRIsdsPreset::GetImgUrl() const |
|
867 { |
|
868 IRLOG_DEBUG( "CIRIsdsPreset::GetImgUrl" ); |
|
869 return iImgUrl; |
|
870 } |
|
871 |
|
872 // --------------------------------------------------------------------------- |
|
873 //CIRIsdsPreset::GetUrlCount() |
|
874 //Function to get iChannelUrlCount |
|
875 // --------------------------------------------------------------------------- |
|
876 // |
|
877 EXPORT_C TInt CIRIsdsPreset::GetUrlCount() const |
|
878 { |
|
879 IRLOG_DEBUG( "CIRIsdsPreset::GetUrlCount" ); |
|
880 return iChannelUrlCount; |
|
881 } |
|
882 |
|
883 |
|
884 // --------------------------------------------------------------------------- |
|
885 //CIRIsdsPreset::GetUrl() |
|
886 //Function to get iLanguageCode |
|
887 // --------------------------------------------------------------------------- |
|
888 // |
|
889 EXPORT_C CIRChannelServerUrl& CIRIsdsPreset::GetUrl(TInt aInt) |
|
890 { |
|
891 IRLOG_DEBUG( "CIRIsdsPreset::GetUrl" ); |
|
892 ASSERT( aInt >= 0 && aInt < iUrlArray->Count() ); |
|
893 return ((*iUrlArray->At(aInt))); |
|
894 } |
|
895 |
|
896 |
|
897 EXPORT_C const TDesC& CIRIsdsPreset::GetMusicStoreStatus() const |
|
898 { |
|
899 IRLOG_DEBUG( "CIRIsdsPreset::GetMusicStoreStatus" ); |
|
900 return iMusicStoreStatus; |
|
901 } |
|
902 |
|
903 |
|
904 |
|
905 |
|
906 // --------------------------------------------------------------------------- |
|
907 //CIRIsdsPreset::GetLogoData() |
|
908 //Function to get LogoData |
|
909 // --------------------------------------------------------------------------- |
|
910 // |
|
911 EXPORT_C const TDesC8& CIRIsdsPreset::GetLogoData() const |
|
912 { |
|
913 IRLOG_DEBUG( "CIRIsdsPreset::GetLogoData" ); |
|
914 return iLogoData; |
|
915 } |
|
916 |
|
917 |
|
918 // --------------------------------------------------------------------------- |
|
919 //CIRIsdsPreset::=() |
|
920 //standard C++ copy constructor(deep copy) |
|
921 // --------------------------------------------------------------------------- |
|
922 // |
|
923 EXPORT_C CIRIsdsPreset& CIRIsdsPreset::operator=(const CIRIsdsPreset& aPreset) |
|
924 { |
|
925 IRLOG_DEBUG( "CIRIsdsPreset::operator= - Entering" ); |
|
926 |
|
927 if(&aPreset == this) |
|
928 { |
|
929 return *this; |
|
930 } |
|
931 |
|
932 iName.Close(); |
|
933 iName.Create(aPreset.iName); |
|
934 |
|
935 iLanguageCode.Close(); |
|
936 iLanguageCode.Create(aPreset.iLanguageCode); |
|
937 |
|
938 iLanguage.Close(); |
|
939 iLanguage.Create(aPreset.iLanguage); |
|
940 |
|
941 iCountryCode.Close(); |
|
942 iCountryCode.Create(aPreset.iCountryCode); |
|
943 |
|
944 iCountry.Close(); |
|
945 iCountry.Create(aPreset.iCountry); |
|
946 |
|
947 iLastModified.Close(); |
|
948 iLastModified.Create(aPreset.iLastModified); |
|
949 |
|
950 iAdvertisementUrl.Close(); |
|
951 iAdvertisementUrl.Create(aPreset.iAdvertisementUrl); |
|
952 |
|
953 iAdvertisementInUse.Close(); |
|
954 iAdvertisementInUse.Create(aPreset.iAdvertisementInUse); |
|
955 |
|
956 iImgUrl.Close(); |
|
957 iImgUrl.Create(aPreset.iImgUrl); |
|
958 |
|
959 iLogoData.Close(); |
|
960 iLogoData.Create(aPreset.iLogoData); |
|
961 |
|
962 iDescription.Close(); |
|
963 iDescription.Create(aPreset.iDescription); |
|
964 |
|
965 iShortDesc.Close(); |
|
966 iShortDesc.Create(aPreset.iShortDesc); |
|
967 |
|
968 iMusicStoreStatus.Close(); |
|
969 iMusicStoreStatus.Create(aPreset.iMusicStoreStatus); |
|
970 |
|
971 iGenereName.Close(); |
|
972 iGenereName.Create(aPreset.iGenereName); |
|
973 |
|
974 iGenereId.Close(); |
|
975 iGenereId.Create(aPreset.iGenereId); |
|
976 |
|
977 |
|
978 iUrlArray->ResetAndDestroy(); |
|
979 |
|
980 for(TInt cnt=0;cnt<aPreset.iChannelUrlCount;cnt++) |
|
981 { |
|
982 ASSERT( cnt >= 0 && cnt < aPreset.iUrlArray->Count() ); |
|
983 TRAPD(errUrl,SetUrlL(aPreset.iUrlArray->At(cnt)->GetServerName(), |
|
984 aPreset.iUrlArray->At(cnt)->GetServerUrl(), |
|
985 aPreset.iUrlArray->At(cnt)->GetBitRate())) |
|
986 if(errUrl!=KErrNone) |
|
987 { |
|
988 return *this ; |
|
989 } |
|
990 } |
|
991 iChannelUrlCount=aPreset.iChannelUrlCount; |
|
992 iType=aPreset.iType; //0 for user defined 1 for isds type. |
|
993 iIndex=aPreset.iIndex; |
|
994 iPresetId = aPreset.iPresetId; |
|
995 iUniqId=aPreset.iUniqId; |
|
996 IRLOG_DEBUG( "CIRIsdsPreset::operator= - Exiting." ); |
|
997 return *this; |
|
998 } |
|
999 |
|
1000 |
|
1001 // --------------------------------------------------------------------------- |
|
1002 //CIRIsdsPreset::GetAvailableBitrates() |
|
1003 //Function to get available bitrates |
|
1004 // --------------------------------------------------------------------------- |
|
1005 // |
|
1006 EXPORT_C TInt CIRIsdsPreset::GetAvailableBitrates(RArray<TInt>& aBitrates) const |
|
1007 { |
|
1008 IRLOG_DEBUG( "CIRIsdsPreset::GetAvailableBitrates - Entering." ); |
|
1009 aBitrates.Reset(); |
|
1010 TInt err = KErrNone; |
|
1011 for(TInt loop=0;loop<iUrlArray->Count() && !err;loop++) |
|
1012 { |
|
1013 err = aBitrates.InsertInOrder(iUrlArray->At(loop)->GetBitRate()); |
|
1014 if (err == KErrAlreadyExists) |
|
1015 { |
|
1016 // Do not allow duplicates, but strip them away. |
|
1017 err = KErrNone; |
|
1018 } |
|
1019 } |
|
1020 |
|
1021 if (err) |
|
1022 { |
|
1023 aBitrates.Reset(); |
|
1024 } |
|
1025 IRLOG_DEBUG( "CIRIsdsPreset::GetAvailableBitrates - Exiting." ); |
|
1026 return err; |
|
1027 } |
|
1028 |
|
1029 |
|
1030 // --------------------------------------------------------------------------- |
|
1031 //CIRIsdsPreset::GetUrlForBitrateL() |
|
1032 //Function to get Url for a given bitrate |
|
1033 // --------------------------------------------------------------------------- |
|
1034 // |
|
1035 EXPORT_C CDesCArrayFlat* CIRIsdsPreset::GetUrlForBitrateL(TInt aBitrate) |
|
1036 { |
|
1037 IRLOG_DEBUG( "CIRIsdsPreset::GetUrlForBitrateL - Entering." ); |
|
1038 CDesCArrayFlat* urlForBitrate = new (ELeave) CDesCArrayFlat(KUrlForBitrateMaxLength); |
|
1039 CleanupStack::PushL(urlForBitrate); |
|
1040 iBitrate=aBitrate; |
|
1041 SortInOrderL(); |
|
1042 //appending the urls with bit rate less than or |
|
1043 //equal to given bit rate limit |
|
1044 for(TInt loop=0;loop<iUrlArray->Count();loop++) |
|
1045 { |
|
1046 if(aBitrate>=iUrlArray->At(loop)->GetBitRate()) |
|
1047 { |
|
1048 urlForBitrate->AppendL(iUrlArray->At(loop)->GetServerUrl()); |
|
1049 } |
|
1050 } |
|
1051 //appending the url with bit rate greater than given |
|
1052 //bit rate limit |
|
1053 for(TInt loop = (iUrlArray->Count()-1);loop >= 0;loop--) |
|
1054 { |
|
1055 if(aBitrate<iUrlArray->At(loop)->GetBitRate()) |
|
1056 { |
|
1057 urlForBitrate->AppendL(iUrlArray->At(loop)->GetServerUrl()); |
|
1058 } |
|
1059 } |
|
1060 if ( urlForBitrate->MdcaCount()==0 && iUrlArray->Count() > 0 ) |
|
1061 { |
|
1062 urlForBitrate->AppendL(iUrlArray->At(0)->GetServerUrl()); |
|
1063 } |
|
1064 |
|
1065 |
|
1066 CleanupStack::Pop(urlForBitrate); |
|
1067 IRLOG_DEBUG( "CIRIsdsPreset::GetUrlForBitrateL - Exiting." ); |
|
1068 return urlForBitrate; |
|
1069 } |
|
1070 |
|
1071 |
|
1072 // --------------------------------------------------------------------------- |
|
1073 //CIRIsdsPreset::GetExactUrlForBitrateL() |
|
1074 //Function to get Urls exactly matching a given bitrate for display purpose |
|
1075 // --------------------------------------------------------------------------- |
|
1076 // |
|
1077 EXPORT_C CDesCArrayFlat* CIRIsdsPreset::GetExactUrlForBitrateL(TInt aBitrate) |
|
1078 { |
|
1079 IRLOG_DEBUG( "CIRIsdsPreset::GetUrlForBitrateL - Entering." ); |
|
1080 CDesCArrayFlat* urlForBitrate = new (ELeave) CDesCArrayFlat(KUrlForBitrateMaxLength); |
|
1081 CleanupStack::PushL(urlForBitrate); |
|
1082 |
|
1083 SortInOrderL(); |
|
1084 //appending the urls with bit rate less than or |
|
1085 //equal to given bit rate limit |
|
1086 for(TInt loop=0;loop<iUrlArray->Count();loop++) |
|
1087 { |
|
1088 if(aBitrate==iUrlArray->At(loop)->GetBitRate()) |
|
1089 { |
|
1090 urlForBitrate->AppendL(iUrlArray->At(loop)->GetServerUrl()); |
|
1091 } |
|
1092 } |
|
1093 |
|
1094 CleanupStack::Pop(urlForBitrate); |
|
1095 IRLOG_DEBUG( "CIRIsdsPreset::GetUrlForBitrateL - Exiting." ); |
|
1096 return urlForBitrate; |
|
1097 } |
|
1098 |
|
1099 // --------------------------------------------------------------------------- |
|
1100 //CIRIsdsPreset::GetChannelUrlAtL() |
|
1101 //Function to get channel Url for a given index |
|
1102 // --------------------------------------------------------------------------- |
|
1103 // |
|
1104 EXPORT_C const TDesC& CIRIsdsPreset::GetChannelUrlAtL(TInt aIndex) const |
|
1105 { |
|
1106 IRLOG_DEBUG( "CIRIsdsPreset::GetChannelUrlAtL - Entering." ); |
|
1107 __ASSERT_ALWAYS( aIndex < iUrlArray->Count(), User::Leave( KErrArgument ) ); |
|
1108 IRLOG_DEBUG( "CIRIsdsPreset::GetChannelUrlAtL - Exiting." ); |
|
1109 return iUrlArray->At(aIndex)->GetServerUrl(); |
|
1110 } |
|
1111 |
|
1112 // --------------------------------------------------------------------------- |
|
1113 //CIRIsdsPreset::GetChannelBitrateL() |
|
1114 //Function to get channel Url for a given index |
|
1115 // --------------------------------------------------------------------------- |
|
1116 // |
|
1117 EXPORT_C TInt CIRIsdsPreset::GetChannelBitrateL(TInt aIndex) |
|
1118 { |
|
1119 IRLOG_DEBUG( "CIRIsdsPreset::GetChannelUrlAtL - Entering." ); |
|
1120 __ASSERT_ALWAYS( aIndex < iUrlArray->Count(), User::Leave( KErrArgument ) ); |
|
1121 CDesCArrayFlat* urlForBitrate = new (ELeave) CDesCArrayFlat(KUrlForBitrateMaxLength); |
|
1122 CleanupStack::PushL(urlForBitrate); |
|
1123 SortInOrderL(); |
|
1124 //appending the urls with bit rate less than or |
|
1125 //equal to given bit rate limit |
|
1126 for(TInt loop=0;loop<iUrlArray->Count();loop++) |
|
1127 { |
|
1128 if(iBitrate>=iUrlArray->At(loop)->GetBitRate()) |
|
1129 { |
|
1130 urlForBitrate->AppendL(iUrlArray->At(loop)->GetServerUrl()); |
|
1131 } |
|
1132 } |
|
1133 //appending the url with bit rate greater than given |
|
1134 //bit rate limit |
|
1135 for(TInt loop = (iUrlArray->Count()-1);loop >= 0;loop--) |
|
1136 { |
|
1137 if(iBitrate<iUrlArray->At(loop)->GetBitRate()) |
|
1138 { |
|
1139 urlForBitrate->AppendL(iUrlArray->At(loop)->GetServerUrl()); |
|
1140 } |
|
1141 } |
|
1142 if ( urlForBitrate->MdcaCount()==0 && iUrlArray->Count() > 0 ) |
|
1143 { |
|
1144 urlForBitrate->AppendL(iUrlArray->At(0)->GetServerUrl()); |
|
1145 } |
|
1146 for(TInt i=0;i<iUrlArray->Count();i++) |
|
1147 { |
|
1148 if(iUrlArray->At(i)->GetServerUrl().Compare(urlForBitrate->MdcaPoint(aIndex))==0) |
|
1149 { |
|
1150 IRRDEBUG2("CIRIsdsPreset:: - GetChannelBitrateL", KNullDesC); |
|
1151 CleanupStack::Pop(urlForBitrate); |
|
1152 return iUrlArray->At(i)->GetBitRate(); |
|
1153 } |
|
1154 } |
|
1155 CleanupStack::Pop(urlForBitrate); |
|
1156 IRRDEBUG2("CIRIsdsPreset:: - GetChannelUrlAtL Exiting", KNullDesC); |
|
1157 IRLOG_DEBUG( "CIRIsdsPreset::GetChannelUrlAtL - Exiting." ); |
|
1158 return 0; |
|
1159 } |
|
1160 //---------------------------------------------------------------------------- |
|
1161 // CIRIsdsPreset::SortInOrderL() |
|
1162 // simple bubble shot |
|
1163 // to sort the bitrates in desc order |
|
1164 //---------------------------------------------------------------------------- |
|
1165 // |
|
1166 void CIRIsdsPreset::SortInOrderL() |
|
1167 { |
|
1168 IRLOG_DEBUG( "CIRIsdsPreset::SortInOrderL - Exiting." ); |
|
1169 //temporary holder for pointer |
|
1170 CIRChannelServerUrl* holdTemp = NULL; |
|
1171 TInt urlcount = iUrlArray->Count(); |
|
1172 //sorts the array pointers [of urls] in the descending order of bit rate |
|
1173 //bubble sort algorithm is used for this |
|
1174 for (TInt sortcount = (urlcount - 1); sortcount >= 0; sortcount--) |
|
1175 { |
|
1176 for (TInt index = 1; index <= sortcount; index++) |
|
1177 { |
|
1178 if (iUrlArray->At(index-1)->GetBitRate() < |
|
1179 iUrlArray->At(index)->GetBitRate()) |
|
1180 { |
|
1181 holdTemp = iUrlArray->At(index-1); |
|
1182 iUrlArray->At(index-1) = iUrlArray->At(index); |
|
1183 iUrlArray->At(index) = holdTemp; |
|
1184 } |
|
1185 } |
|
1186 } |
|
1187 IRLOG_DEBUG( "CIRIsdsPreset::SortInOrderL - Exiting." ); |
|
1188 return; |
|
1189 } |
|
1190 //---------------------------------------------------------------------------- |
|
1191 // TInt UniqId() |
|
1192 // |
|
1193 //---------------------------------------------------------------------------- |
|
1194 EXPORT_C TUint32 CIRIsdsPreset::UniqId() const |
|
1195 { |
|
1196 IRLOG_DEBUG( "CIRIsdsPreset::UniqId" ); |
|
1197 return iUniqId; |
|
1198 } |
|
1199 //---------------------------------------------------------------------------- |
|
1200 // SetUniqId(TInt) |
|
1201 // |
|
1202 //---------------------------------------------------------------------------- |
|
1203 EXPORT_C void CIRIsdsPreset::SetUniqId( TUint32 aId) |
|
1204 { |
|
1205 IRLOG_DEBUG( "CIRIsdsPreset::SetUniqId - Entering" ); |
|
1206 iUniqId = aId; |
|
1207 IRLOG_DEBUG( "CIRIsdsPreset::SetUniqId - Exiting" ); |
|
1208 } |
|
1209 |