diff -r 000000000000 -r 09774dfdd46b internetradio2.0/presetpluginsrc/irpresetimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/internetradio2.0/presetpluginsrc/irpresetimpl.cpp Mon Apr 19 14:01:53 2010 +0300 @@ -0,0 +1,1167 @@ +/* +* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + +#include + +#include "irchannelserverurl.h" +#include "irchannelserverurlimpl.h" +#include "irdebug.h" +#include "irpresetimpl.h" +#include "irisdspreset.h" + +const TInt KUrlArrayMaxLength = 128; +const TInt KUrlForBitrateMaxLength = 128; + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CIRPresetImpl::NewL() +// Static function +// standard two phased constructor +// --------------------------------------------------------------------------- +// +CIRPresetImpl* CIRPresetImpl::NewL( TAny* aParams ) + { + IRLOG_DEBUG( "CIRPresetImpl::NewL" ); + CIRPresetImpl* self = CIRPresetImpl::NewLC( aParams ); + CleanupStack::Pop( self ); + IRLOG_DEBUG( "CIRPresetImpl::NewL - Exiting." ); + return self; + } + +// --------------------------------------------------------------------------- +// CIRPresetImpl::NewLC() +// Static function +// standard two phased constructor +// --------------------------------------------------------------------------- +// +CIRPresetImpl* CIRPresetImpl::NewLC( TAny* aParams ) + { + IRLOG_DEBUG( "CIRPresetImpl::NewLC" ); + CIRPresetImpl* self = new (ELeave) CIRPresetImpl; + CleanupStack::PushL( self ); + self->ConstructL( aParams ); + IRLOG_DEBUG( "CIRPresetImpl::NewLC - Exiting." ); + return self; + } + +// --------------------------------------------------------------------------- +// CIRPresetImpl::ConstructL() +// standard second phase constructor +// --------------------------------------------------------------------------- +// +void CIRPresetImpl::ConstructL(TAny* aParams) + { + IRLOG_DEBUG( "CIRPresetImpl::ConstructL" ); + BaseConstructL(aParams); + iUrlArray= + new (ELeave) CArrayPtrFlat( + KUrlArrayMaxLength); + iUrlForBitrate=new (ELeave) CDesCArrayFlat(KUrlForBitrateMaxLength); + IRLOG_DEBUG( "CIRPresetImpl::ConstructL - Exiting." ); + } + +// --------------------------------------------------------------------------- +// CIRPresetImpl::~CIRPresetImpl() +// standard C++ destructor +// --------------------------------------------------------------------------- +// +CIRPresetImpl::~CIRPresetImpl() + { + IRLOG_DEBUG( "CIRPresetImpl::~CIRPresetImpl" ); + iLanguageCode.Close(); + iLanguage.Close(); + iCountryCode.Close(); + iCountry.Close(); + iLastModified.Close(); + iAdvertisementUrl.Close(); + iAdvertisementInUse.Close(); + iImgUrl.Close(); + iLogoData.Close(); + iDescription.Close(); + iShortDesc.Close(); + iGenereName.Close(); + iGenereId.Close(); + iMusicStoreStatus.Close(); + delete iUrlForBitrate; + if (iUrlArray) + { + iUrlArray->ResetAndDestroy(); + } + + delete iUrlArray; + iBitrateArray.Close(); + IRLOG_DEBUG( "CIRPresetImpl::~CIRPresetImpl - Exiting." ); + } + + +// --------------------------------------------------------------------------- +// CIRPresetImpl::SetId() +// Function to set iPresetId +// --------------------------------------------------------------------------- +// +void CIRPresetImpl::SetId(TInt aId) + { + iPresetId=aId; + } + +// --------------------------------------------------------------------------- +// CIRPresetImpl::SetId() +// Function to set iPresetId from a TDesC +// --------------------------------------------------------------------------- +// +void CIRPresetImpl::SetId(const TDesC &aId) + { + TLex conv(aId); + conv.Val(iPresetId); + } + +// --------------------------------------------------------------------------- +// CIRPresetImpl::SetLangCode() +// Function to set iLanguageCode from a TDesC +// --------------------------------------------------------------------------- +// +void CIRPresetImpl::SetLangCode(const TDesC &aLangId) + { + iLanguageCode.Close(); + iLanguageCode.Create( aLangId ); + } + +// --------------------------------------------------------------------------- +// CIRPresetImpl::SetLang() +// Function to set iLanguage from a TDesC +// --------------------------------------------------------------------------- +// +void CIRPresetImpl::SetLang(const TDesC& aLangName) + { + iLanguage.Close(); + iLanguage.Create( aLangName ); + } + +// --------------------------------------------------------------------------- +// CIRPresetImpl::SetCountryCode() +// Function to set iCountryCode from a TDesC +// --------------------------------------------------------------------------- +void CIRPresetImpl::SetCountryCode(const TDesC &aCountryId) + { + iCountryCode.Close(); + iCountryCode.Create( aCountryId ); + } + +// --------------------------------------------------------------------------- +// CIRPresetImpl::SetCountryName() +// Function to set iCountry from a TDesC +// --------------------------------------------------------------------------- +// +void CIRPresetImpl::SetCountryName(const TDesC& aCountryName) + { + iCountry.Close(); + iCountry.Create( aCountryName ); + } + +// --------------------------------------------------------------------------- +// CIRPresetImpl::SetLangInfo() +// Function to set iLanguageCode, iLanguage +// --------------------------------------------------------------------------- +// +void CIRPresetImpl::SetLangInfo(const TDesC &aLangId,const TDesC& aLangName) + { + SetLangCode( aLangId ); + SetLang( aLangName ); + } + + +// --------------------------------------------------------------------------- +// CIRPresetImpl::SetLangInfo() +// Function to set iCountryCode, iCountry +// --------------------------------------------------------------------------- +// +void CIRPresetImpl::SetCountryInfo(const TDesC &aCountryId, + const TDesC& aCountryName) + { + SetCountryCode( aCountryId ); + SetCountryName( aCountryName ); + } + +// --------------------------------------------------------------------------- +// CIRPresetImpl::SetLastModifiedTime() +// Function to set iLastModified +// --------------------------------------------------------------------------- +// +void CIRPresetImpl::SetLastModifiedTime(const TDesC &aLastModified) + { + iLastModified.Close(); + iLastModified.Create( aLastModified ); + } + +// --------------------------------------------------------------------------- +// CIRPresetImpl::SetGenreInfo() +// Function to set iGenereName, iGenereId +// --------------------------------------------------------------------------- +// +void CIRPresetImpl::SetGenreInfo(const TDesC& aGenreId, + const TDesC& aGenreName) + { + iGenereName.Close(); + iGenereName.Create( aGenreName ); + iGenereId.Close(); + iGenereId.Create( aGenreId ); + } + +// --------------------------------------------------------------------------- +// CIRPresetImpl::SetImgUrl() +// Function to set iImgUrl +// --------------------------------------------------------------------------- +// +void CIRPresetImpl::SetImgUrl(const TDesC& aImgUrl) + { + iImgUrl.Close(); + iImgUrl.Create( aImgUrl ); + } + +// --------------------------------------------------------------------------- +// From class CIRPresetImpl +// Sets the raw logo image data. +// --------------------------------------------------------------------------- +// +void CIRPresetImpl::SetLogoData( const TDesC8& aData ) + { + iLogoData.Close(); + iLogoData.Create( aData ); + } + +// --------------------------------------------------------------------------- +// From class CIRPresetImpl +// Returns the raw logo image data. +// --------------------------------------------------------------------------- +// +const TDesC8& CIRPresetImpl::GetLogoData() const + { + return iLogoData; + } + +// --------------------------------------------------------------------------- +// CIRPresetImpl::SetAdvertisementUrl() +// Function to set iAdvertisementUrl +// --------------------------------------------------------------------------- +// +void CIRPresetImpl::SetAdvertisementUrl(const TDesC& aAdvertisementUrl) + { + iAdvertisementUrl.Close(); + iAdvertisementUrl.Create( aAdvertisementUrl ); + } + +// --------------------------------------------------------------------------- +// CIRPresetImpl::SetAdvertisementInUse() +// Function to set iAdvertisementInUse +// --------------------------------------------------------------------------- +// +void CIRPresetImpl::SetAdvertisementInUse(const TDesC& aAdvertisementInUse) + { + iAdvertisementInUse.Close(); + iAdvertisementInUse.Create( aAdvertisementInUse ); + } + +// --------------------------------------------------------------------------- +// CIRPresetImpl::SetDescription() +// Function to set iDescription +// --------------------------------------------------------------------------- +// +void CIRPresetImpl:: SetDescription(const TDesC& aDescription) + { + iDescription.Close(); + iDescription.Create( aDescription ); + } + + +// --------------------------------------------------------------------------- +// CIRPresetImpl::SetShortDesc() +// Function to set iShortDesc +// --------------------------------------------------------------------------- +// +void CIRPresetImpl:: SetShortDesc(const TDesC& aShortDesc) + { + iShortDesc.Close(); + iShortDesc.Create( aShortDesc ); + } + +// --------------------------------------------------------------------------- +// CIRPresetImpl::SetUrlCount() +// Function to set iChannelUrlCount +// --------------------------------------------------------------------------- +// +void CIRPresetImpl::SetUrlCount() + { + iChannelUrlCount=iUrlArray->Count(); + } + +// --------------------------------------------------------------------------- +// CIRPresetImpl::SetUrlCount() +// Function to set iChannelUrlCount +// --------------------------------------------------------------------------- +void CIRPresetImpl::SetUrlCount(TInt aCnt) + { + iChannelUrlCount=aCnt; + } + +// --------------------------------------------------------------------------- +// CIRPresetImpl::SetChannelType() +// Function to set iType +// --------------------------------------------------------------------------- +// +void CIRPresetImpl::SetChannelType(TInt aType) + { + iType = aType; + } + +// --------------------------------------------------------------------------- +// CIRPresetImpl::SetUrl() +// Function to set Url parameter +// --------------------------------------------------------------------------- +// +void CIRPresetImpl::SetUrlL(const TDesC &aServerName,const TDesC &aUrl, + const TDesC &aBitrate) + { + IRLOG_DEBUG( "CIRPresetImpl::SetUrlL" ); + CIRChannelServerUrlImpl* hold=CIRChannelServerUrlImpl::NewL(); + hold->SetServerName(aServerName); + hold->SetServerUrl(aUrl); + TLex conv(aBitrate); + TInt conVal = 0; + conv.Val(conVal); + hold->SetBitRate(conVal); + //ownership transferred to the array + //no need to delete hold + iUrlArray->AppendL(hold); + IRLOG_DEBUG( "CIRPresetImpl::SetUrlL - Exiting." ); + } + + + +// --------------------------------------------------------------------------- +// CIRPresetImpl::SetUrl() +// Function to set Url parameter +// --------------------------------------------------------------------------- +// +void CIRPresetImpl::SetUrlL(const TDesC &aServerName,const TDesC &aUrl, + TInt aBitrate) + { + IRLOG_DEBUG( "CIRPresetImpl::SetUrlL(const TDesC &aServerName,const TDesC &aUrl,TInt aBitrate)" ); + CIRChannelServerUrlImpl* hold=CIRChannelServerUrlImpl::NewL(); + hold->SetServerName(aServerName); + hold->SetServerUrl(aUrl); + hold->SetBitRate(aBitrate); + iUrlArray->AppendL(hold); + IRLOG_DEBUG( "CIRPresetImpl::SetUrlL(const TDesC &aServerName,const TDesC &aUrl,TInt aBitrate) - Exiting." ); + } + + +// --------------------------------------------------------------------------- +// CIRPresetImpl::SetMusicStoreStatus() +// Function to set iMusicStoreStatus +// --------------------------------------------------------------------------- +// +void CIRPresetImpl::SetMusicStoreStatus(const TDesC& aMusicStoreStatus) + { + IRLOG_DEBUG( "CIRPresetImpl::SetMusicStoreStatus - Entering" ); + iMusicStoreStatus.Close(); + iMusicStoreStatus.Create( aMusicStoreStatus ); + IRLOG_DEBUG( "CIRPresetImpl::SetMusicStoreStatus - Exiting" ); + } + + + +// --------------------------------------------------------------------------- +// CIRPresetImpl::GetId() +// Function to get iPresetId +// --------------------------------------------------------------------------- +// +TInt CIRPresetImpl::GetId()const + { + return iPresetId; + } + + +// --------------------------------------------------------------------------- +// CIRPresetImpl::GetLangId() +// Function to get iLanguageCode +// --------------------------------------------------------------------------- +// +const TDesC& CIRPresetImpl::GetLangId() const + { + return iLanguageCode; + } + + +// --------------------------------------------------------------------------- +// CIRPresetImpl::GetLangName() +// Function to get iLanguage +// --------------------------------------------------------------------------- +// +const TDesC& CIRPresetImpl::GetLangName() const + { + return iLanguage; + } + + +// --------------------------------------------------------------------------- +// CIRPresetImpl::GetCountryId() +// Function to get iCountryCode +// --------------------------------------------------------------------------- +// +const TDesC& CIRPresetImpl::GetCountryId() const + { + return iCountryCode; + } + + +// --------------------------------------------------------------------------- +// CIRPresetImpl::GetCountryName() +// Function to get iCountry +// --------------------------------------------------------------------------- +// +const TDesC& CIRPresetImpl::GetCountryName() const + { + return iCountry; + } + + +// --------------------------------------------------------------------------- +// CIRPresetImpl::GetLastModifiedTime() +// Function to get iLastModified +// --------------------------------------------------------------------------- +// +const TDesC& CIRPresetImpl::GetLastModifiedTime() const + { + return iLastModified; + } + + +// --------------------------------------------------------------------------- +// CIRPresetImpl::GetGenreId() +// Function to get iGenereId +// --------------------------------------------------------------------------- +// +const TDesC& CIRPresetImpl::GetGenreId() const + { + return iGenereId; + } + + +// --------------------------------------------------------------------------- +// CIRPresetImpl::GetGenreName() +// Function to get iGenereName +// --------------------------------------------------------------------------- +// +const TDesC& CIRPresetImpl::GetGenreName() const + { + return iGenereName; + } + + +// --------------------------------------------------------------------------- +// CIRPresetImpl::GetAdvertisementUrl() +// Function to get iAdvertisementUrl +// --------------------------------------------------------------------------- +// +const TDesC& CIRPresetImpl::GetAdvertisementUrl() const + { + return iAdvertisementUrl; + } + +// --------------------------------------------------------------------------- +// CIRPresetImpl::GetImgUrl() +// Function to get iImgUrl +// --------------------------------------------------------------------------- +// +const TDesC& CIRPresetImpl::GetImgUrl() const + { + return iImgUrl; + } + +// --------------------------------------------------------------------------- +// CIRPresetImpl::GetUrlCount() +// Function to get iChannelUrlCount +// --------------------------------------------------------------------------- +// +TInt CIRPresetImpl::GetUrlCount() const + { + return iChannelUrlCount; + } + +/* + * get the channel url at specified position + * + */ +const TDesC& CIRPresetImpl::GetChannelUrlAt(TInt aIndex) const +{ + return iUrlArray->At(aIndex)->GetServerUrl(); +} + +// --------------------------------------------------------------------------- +// CIRPresetImpl::GetUrl() +// Function to get iLanguageCode +// --------------------------------------------------------------------------- +// +CIRChannelServerUrlImpl& CIRPresetImpl::GetUrl(TInt aInt)const + { + ASSERT( aInt >= 0 && aInt < iUrlArray->Count() ); + return ((*iUrlArray->At(aInt))); + } + +// --------------------------------------------------------------------------- +// CIRPresetImpl::GetDescription() +// Function to get iDescription +// --------------------------------------------------------------------------- +// +const TDesC& CIRPresetImpl::GetDescription() const + { + return iDescription; + } + +// --------------------------------------------------------------------------- +//CIRPresetImpl::GetShortDescription() +//Function to get iDescription +// --------------------------------------------------------------------------- +// +const TDesC& CIRPresetImpl::GetShortDescription() const + { + return iShortDesc; + } + +// --------------------------------------------------------------------------- +//CIRPresetImpl::GetMusicStoreStatus() +//Function to get iMusicStoreStatus +// --------------------------------------------------------------------------- +// +const TDesC& CIRPresetImpl::GetMusicStoreStatus() const + { + return iMusicStoreStatus; + } + + + + +// --------------------------------------------------------------------------- +// CIRPresetImpl::GetChannelType() +// Function to get iType +// --------------------------------------------------------------------------- +// +TInt CIRPresetImpl::GetChannelType()const + { + return iType; + } + +// --------------------------------------------------------------------------- +// CIRPresetImpl& CIRPresetImpl::operator=(const CIRPresetImpl& preset) +// assignment operator eg. preset1=preset2 +// shallow copy +// --------------------------------------------------------------------------- +// +CIRPresetImpl& CIRPresetImpl::operator=(const CIRPresetImpl& aPreset) + { + IRLOG_DEBUG( "CIRPresetImpl::operator=" ); + if(&aPreset == this) + { + return *this; + } + //copy data members + iUniqId = aPreset.iUniqId; + iPresetId = aPreset.iPresetId; + + TRAP_IGNORE(SetNameL(aPreset.Name())) + + iLanguageCode.Close(); + iLanguageCode.Create(aPreset.iLanguageCode); + + iLanguage.Close(); + iLanguage.Create(aPreset.iLanguage); + + iCountryCode.Close(); + iCountryCode.Create(aPreset.iCountryCode); + + iCountry.Close(); + iCountry.Create(aPreset.iCountry); + + iLastModified.Close(); + iLastModified.Create(aPreset.iLastModified); + + iAdvertisementUrl.Close(); + iAdvertisementUrl.Create(aPreset.iAdvertisementUrl); + + iAdvertisementInUse.Close(); + iAdvertisementInUse.Create(aPreset.iAdvertisementInUse); + + iImgUrl.Close(); + iImgUrl.Create(aPreset.iImgUrl); + + iLogoData.Close(); + iLogoData.Create( aPreset.iLogoData ); + + iDescription.Close(); + iDescription.Create(aPreset.iDescription); + + iShortDesc.Close(); + iShortDesc.Create(aPreset.iShortDesc); + + iMusicStoreStatus.Close(); + iMusicStoreStatus.Create(aPreset.iMusicStoreStatus); + + iGenereName.Close(); + iGenereName.Create(aPreset.iGenereName); + + iGenereId.Close(); + iGenereId.Create(aPreset.iGenereId); + + iChannelUrlCount = aPreset.iChannelUrlCount; + iType = aPreset.iType; //0 for user defined 1 for isds type. + for(TInt cnt=0;cnt= 0 && cnt < aPreset.iUrlArray->Count() ); + TRAPD(errUrl,SetUrlL(aPreset.iUrlArray->At(cnt)->GetServerName(), + aPreset.iUrlArray->At(cnt)->GetServerUrl(), + aPreset.iUrlArray->At(cnt)->GetBitRate())) + if(errUrl!=KErrNone) + { + return *this ; + } + } + IRLOG_DEBUG( "CIRPresetImpl::operator= - Exiting." ); + return *this; + } + + +// --------------------------------------------------------------------------- +// CIRPresetImpl::CIRPresetImpl() +// default C++ constructor +// standard two phased constructor +// --------------------------------------------------------------------------- +CIRPresetImpl::CIRPresetImpl() + { + // no implementation + } + + +// --------------------------------------------------------------------------- +// CIRPresetImpl::CIRPresetImpl() +// default C++ constructor +// standard two phased constructor +// --------------------------------------------------------------------------- +// +void CIRPresetImpl::ExternalizeL(RWriteStream& aWriteStream)const + { + IRLOG_DEBUG( "CIRPresetImpl::ExternalizeL" ); +//! externalize TInts s + aWriteStream.WriteUint32L(iUniqId); + aWriteStream.WriteInt32L(iPresetId); + aWriteStream.WriteInt32L(iType); + aWriteStream.WriteInt32L(iChannelUrlCount); + + //Externalize HBufC s + //algo + //1.check if data is present for the particular member variable + //2.if yes get the length of the data and externalize the length and then the data + //3.if no data is present write the length as 0. + TInt len = 0; + if(!iLanguageCode.Length()) + { + len=0; + aWriteStream.WriteInt32L(len); + } + else + { + len=iLanguageCode.Length(); + aWriteStream.WriteInt32L(len); + aWriteStream<InternalizeL(aReadStream); + iUrlArray->AppendL(url); + CleanupStack::Pop(url); + } + + iPlayedTimes = aReadStream.ReadInt32L(); + IRLOG_DEBUG( "CIRPresetImpl::InternalizeL - Exiting." ); + } + + +// --------------------------------------------------------------------------- +// void CIRPresetImpl::CIRIsdsPresetToCIRPresetImpl(const CIRIsdsPreset& aIsdsPreset) +// used to convert the isdspresets to plugnized presets. +// Does a deep copy for all the member variables +// --------------------------------------------------------------------------- +// +void CIRPresetImpl::CIRIsdsPresetToCIRPresetImpl(const CIRIsdsPreset& aIsdsPreset) + { + IRLOG_DEBUG( "CIRPresetImpl::CIRIsdsPresetToCIRPresetImpl" ); + iUniqId = aIsdsPreset.UniqId(); + iPresetId = aIsdsPreset.GetId(); + iChannelUrlCount = aIsdsPreset.GetUrlCount(); + iType = aIsdsPreset.GetChannelType(); //0 for user defined 1 for isds type. + + TRAP_IGNORE( SetNameL( aIsdsPreset.GetName() ) ) + SetLangCode( aIsdsPreset.GetLangId() ); + + SetLogoData( aIsdsPreset.GetLogoData() ); + SetLang( aIsdsPreset.GetLangName() ); + SetCountryCode( aIsdsPreset.GetCountryId() ); + SetCountryName( aIsdsPreset.GetCountryName() ); + SetLastModifiedTime( aIsdsPreset.GetLastModifiedTime() ); + SetAdvertisementUrl( aIsdsPreset.GetAdvertisementUrl() ); + SetAdvertisementInUse( aIsdsPreset.GetAdvertisementInUse() ); + SetImgUrl( aIsdsPreset.GetImgUrl() ); + SetDescription( aIsdsPreset.GetDescription() ); + SetShortDesc( aIsdsPreset.GetShortDescription() ); + SetMusicStoreStatus(aIsdsPreset.GetMusicStoreStatus()); + SetGenreInfo( aIsdsPreset.GetGenreId(), aIsdsPreset.GetGenreName() ); + + + iUrlArray->ResetAndDestroy(); + + for(TInt cnt=0;cnt= 0 && cnt < aIsdsPreset.iUrlArray->Count() ); + TRAPD(errUrl,SetUrlL(aIsdsPreset.iUrlArray->At(cnt)->GetServerName(), + aIsdsPreset.iUrlArray->At(cnt)->GetServerUrl(), + aIsdsPreset.iUrlArray->At(cnt)->GetBitRate())) + if(errUrl!=KErrNone) + { + return ; + } + } + IRLOG_DEBUG( "CIRPresetImpl::CIRIsdsPresetToCIRPresetImpl - Exiting." ); + } +/* +// --------------------------------------------------------------------------- +// void CIRPresetImpl::UserDefinedPresetToCIRPresetImpl +// used to convert the userdefined preset to plugnized presets. +// Does a deep copy for all the member variables +// --------------------------------------------------------------------------- +// +void CIRPresetImpl::UserDefinedPresetToCIRPresetImpl(const TDesC& aName, + const TDesC& aURl,TInt aId,TInt aIndex) + { + IRLOG_DEBUG( "CIRPresetImpl::UserDefinedPresetToCIRPresetImpl" ); + iPresetId=aId; + TRAP_IGNORE(SetNameL(aName)) + SetChannelType(0);//type set to user defined + //done to match the API,new API should be exposed by DS to accept only Url + _LIT(KServerName,"NA"); + //copy the url + TRAPD(errUrl,SetUrlL(KServerName,aURl,0)) + if(errUrl!=KErrNone) + { + IRLOG_ERROR2( "CIRPresetImpl::UserDefinedPresetToCIRPresetImpl - SetUrlL left with %d.", errUrl ); + return ; // WHATTHEHECK + } + // manually added channels have only one channel url + SetUrlCount(1); + IRLOG_DEBUG( "CIRPresetImpl::UserDefinedPresetToCIRPresetImpl - Exiting." ); + } +*/ + +// --------------------------------------------------------------------------- +//CIRPresetImpl::CopyPresetData() +// copy data to CIRIsdsPreset +// --------------------------------------------------------------------------- +// +void CIRPresetImpl::CopyPresetData(CIRIsdsPreset& aIsdsPreset) const + { + IRLOG_DEBUG( "CIRPresetImpl::CopyPresetData" ); + aIsdsPreset.SetUniqId( this->Id() ); + aIsdsPreset.SetId( iPresetId ); + aIsdsPreset.SetUrlCount( iChannelUrlCount ); + aIsdsPreset.SetChannelType( iType ); //0 for user defined 1 for isds type. + //algo + //1.check if the CIRIsdsPreset,member contains any data + //2.if yes delete it and set it to null + //3.allocate memory and copy data + aIsdsPreset.SetGenreName( iGenereName ); + aIsdsPreset.SetGenreId( iGenereId ); + aIsdsPreset.SetLangCode( iLanguageCode ); + + aIsdsPreset.SetLogoData(iLogoData); + aIsdsPreset.SetLang( iLanguage ); + aIsdsPreset.SetCountryCode( iCountryCode ); + aIsdsPreset.SetCountryName( iCountry ); + aIsdsPreset.SetName( Name() ); + aIsdsPreset.SetLastModifiedTime( iLastModified ); + aIsdsPreset.SetAdvertisementUrl( iAdvertisementUrl ); + aIsdsPreset.SetAdvertisementInUse( iAdvertisementInUse ); + aIsdsPreset.SetImgUrl( iImgUrl ); + aIsdsPreset.SetDescription( iDescription ); + aIsdsPreset.SetShortDesc( iShortDesc ); + aIsdsPreset.SetMusicStoreStatus( iMusicStoreStatus ); + + aIsdsPreset.iUrlArray->ResetAndDestroy(); + + for(TInt cnt=0;cnt= 0 && cnt < iUrlArray->Count() ); + TRAPD(errUrl,aIsdsPreset.SetUrlL(iUrlArray->At(cnt)->GetServerName(), + iUrlArray->At(cnt)->GetServerUrl(), + iUrlArray->At(cnt)->GetBitRate())) + if(errUrl!=KErrNone) + { + return ; + } + } + IRLOG_DEBUG( "CIRPresetImpl::CopyPresetData - Exiting." ); + } + + +// --------------------------------------------------------------------------- +// CIRPresetImpl::GetAvailableBitrates() +// Function to get available bitrates +// --------------------------------------------------------------------------- +// +RArray& CIRPresetImpl::GetAvailableBitrates() + { + IRLOG_DEBUG( "CIRPresetImpl::GetAvailableBitrates" ); + iBitrateArray.Reset(); + //creates an array of bitrates(int)that are available for a particular preset + for(TInt loop=0;loopCount();loop++) + { + iBitrateArray.InsertInOrder(iUrlArray->At(loop)->GetBitRate()); + } + IRLOG_DEBUG( "CIRPresetImpl::GetAvailableBitrates - Exiting." ); + return iBitrateArray; + } + +//---------------------------------------------------------------------------- +// TInt UniqId() +//---------------------------------------------------------------------------- +TUint32 CIRPresetImpl::UniqId() + { + return iUniqId; + } +//---------------------------------------------------------------------------- +// SetUniqId(TInt) +//---------------------------------------------------------------------------- +void CIRPresetImpl::SetUniqId( TUint32 aId) + { + iUniqId = aId; + } + +/* + * Returns the played times of the channel + */ +TInt CIRPresetImpl::GetPlayedTimes() const +{ + return iPlayedTimes; +} + +/* + * Set the played times of the channel + */ +void CIRPresetImpl::SetPlayedTimes(TInt aPlayedTimes) +{ + iPlayedTimes = aPlayedTimes; +}