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