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