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