📄 smbmusicapsyncservercontentsservicegetplaysongimage.cpp
字号:
retState = CompleteGetPlaySongImage();
break;
default:
//婎杮揑偵偙偙偵偔傞偙偲偼側偄偺偱廔椆偟傑偡
TInt log = EMusicAPSyncServerClassNumber_ContentsServiceGetPlaySongImage | EMusicAPSyncServerLocationNumber04;
_LIT(KContentsServiceGetPlaySongImage04, "SyncServerContentsServiceGetPlaySongImage::ContinueServiceL State = %d");
SmbMusicAPSyncServerLog(iRLog, log, ELogLevelHighest, KContentsServiceGetPlaySongImage04, iState);
retState = CompleteThisService(KErrServerBusy);
break;
}
return retState;
}
/**
* 僉儍儞僙儖梫媮偵懳偡傞僒乕價僗僉儍儞僙儖敾掕
*
* @param[in] aCancelEvent 僉儍儞僙儖梫媮偝傟偨僀儀儞僩僞僀僾
*
* @return 僉儍儞僙儖傪庴偗傞偐偳偆偐偺敾掕(ETrue:梫媮僉儍儞僙儖丄EFalse:梫媮傪僉儍儞僙儖偟側偄)
**/
TBool CSmbMusicAPSyncServerContentsServiceGetPlaySongImage::CheckCancel(TSmbMusicAPSyncServerFunction aCancelEvent)
{
if (aCancelEvent == ESmbMusicAPSyncServerFuncCancelGetPlaySongImage)
{ // 帺僒乕價僗偺僉儍儞僙儖梫媮偺応崌
TInt log = EMusicAPSyncServerClassNumber_ContentsServiceGetPlaySongImage | EMusicAPSyncServerLocationNumber08;
_LIT(KContentsServiceGetPlaySongImage08, "SyncServerContentsServiceGetPlaySongImage::CheckCancel");
SmbMusicAPSyncServerLog(iRLog, log, ELogLevelLowest, KContentsServiceGetPlaySongImage08);
return ETrue;
}
return EFalse;
}
/**
* 梫媮儊僢僙乕僕偺撪梕傪僐僺乕偡傞
* @param [in] 側偟
* @return 側偟
*/
void CSmbMusicAPSyncServerContentsServiceGetPlaySongImage::ReadParamFromMsgL()
{
//梫媮儊僢僙乕僕偺撪梕傪惗惉
iReqPkg = new(ELeave)TSmbMusicAPSyncServerContentsReqPkg;
iReqTPckg = new(ELeave)TPckg<TSmbMusicAPSyncServerContentsReqPkg>(*iReqPkg);
//庴怣儊僢僙乕僕傪僐僺乕偡傞
iRMessage.ReadL(KSmbMusicAPSyncEngineMsgIn1 , *iReqTPckg);
//MW亅傾僾儕娫偱Index偺僘儗偑偁傞偺偱曗惓偡傞
iReqPkg->iData.iGetPlaySongImage.iGetImageInfo.iSongItem.iIndex++;
//MW亅傾僾儕娫偱Index偺僘儗偑偁傞偺偱曗惓偡傞
iReqPkg->iData.iGetPlaySongImage.iGetImageInfo.iIndex++;
}
/**
* 儊僢僙乕僕偵張棟寢壥傪僐僺乕偡傞
* @param [in] 側偟
* @return 張棟寢壥
*/
TInt CSmbMusicAPSyncServerContentsServiceGetPlaySongImage::WriteToMsg(const TDesC& aFileName)
{
//憲怣儊僢僙乕僕偵僨乕僞傪僐僺乕偡傞
TInt res = iRMessage.Write(KSmbMusicAPSyncEngineMsgOut1, aFileName);
if(KErrNone != res)
{
//彂偒崬傒僄儔乕
TInt log = EMusicAPSyncServerClassNumber_ContentsServiceGetPlaySongImage | EMusicAPSyncServerLocationNumber05;
_LIT(KContentsServiceGetPlaySongImage05, "SyncServerContentsServiceGetPlaySongImage::WriteToMsg Error = %d");
SmbMusicAPSyncServerLog(iRLog, log, ELogLevelHighest, KContentsServiceGetPlaySongImage05, res);
}
return res;
}
/**
* 嵞惗嬋偵娷傑傟傞夋憸庢摼奐巒
* @param [in] 側偟
* @return 側偟
*/
TSmbMusicAPSyncServerContentsServiceState CSmbMusicAPSyncServerContentsServiceGetPlaySongImage::StartGetPlaySongImageL()
{
//惗惉偟偨傾僀僥儉傪揈弌偡傞
iLibItem = iLibImteArray->GetMusicItemL(0);
// UIM幚峴惂尷敾掕
TBool isLimited(ETrue);
TInt result(KErrNone);
result = IsLimitedSong(static_cast<CSmbMusicMWLibSongItem&>(*iLibItem), isLimited);
if (result == KErrNone)
{
if (isLimited != EFalse)
{ // UIM幚峴惂尷拞
CompleteThisService(KErrNotSupported);
return ESmbMusicAPSyncServerContetnsServiceStateErr;
}
}
else
{ // 僠僃僢僋張棟幐攕
CompleteThisService(result);
return ESmbMusicAPSyncServerContetnsServiceStateErr;
}
//嵞惗嬋偵娷傑傟傞夋憸傪庢摼偡傞
return GetPlaySongImage();
}
/**
* 夋憸庢摼姰椆
* @param [in] 側偟
* @return 側偟
*/
TSmbMusicAPSyncServerContentsServiceState CSmbMusicAPSyncServerContentsServiceGetPlaySongImage::CompleteGetPlaySongImage()
{
if (iExistItem == EFalse)
{ // 嬋傾僀僥儉傪MW偐傜庢摼偟偨応崌
//嵞惗嬋傾僀僥儉傪搊榐偡傞
iManagers.PlaySongInfoManager().SetPlaySongItem(iReqPkg->iData.iPlaySong.iItem, iLibItem);
iExistItem = ETrue; // 嵞惗嬋忣曬娗棟偵嬋傾僀僥儉偺強桳尃傪埾忳丅
}
//夋憸傪搊榐偡傞
TInt res = iManagers.PlaySongInfoManager().SetPlaySongImage(iReqPkg->iData.iPlaySong.iItem, *iImageFileName);
if(KErrNone == res)
{
//夋憸僼傽僀儖傪搊榐弌棃偨偲偒偵尷傝墳摎儊僢僙乕僕偵張棟寢壥傪彂偒崬傓
res = WriteToMsg(*iImageFileName);
}
//傕偭偰偄傞僆僽僕僃僋僩傪嶍彍偡傞
DeleteObject();
//張棟傪廔椆偡傞
return CompleteThisService(res);
}
/**
* 梫媮張棟姰椆
* @param [in] aResult 張棟寢壥
* @return 側偟
*/
TSmbMusicAPSyncServerContentsServiceState CSmbMusicAPSyncServerContentsServiceGetPlaySongImage::CompleteThisService(TInt aResult)
{
//墳摎傪敪峴偡傞
MessageComplete(aResult);
//埨掕忬懺偵栠偡
iState = EIdleState;
return ESmbMusicAPSyncServerContetnsServiceStateEnd;
}
/**
* 嵞惗嬋偵娷傑傟傞夋憸傪庢摼偡傞
* @param[in] 側偟
* @return 僒乕價僗偺宲懕忬懺
**/
TSmbMusicAPSyncServerContentsServiceState CSmbMusicAPSyncServerContentsServiceGetPlaySongImage::GetPlaySongImage()
{
//嵞惗嬋忣曬娗棟儅僱乕僕儍偐傜師偵惗惉偡傞夋憸僼傽僀儖Name傪庢摼偡傞
iImageFileName = iManagers.PlaySongInfoManager().GetNextImageName();
TInt exType(iReqPkg->iData.iGetPlaySongImage.iExType);
//嵞惗嬋偵娷傑傟傞夋憸傪庢摼偡傞
TInt res = iFunc.CreateImageFile(*iLibItem, iReqPkg->iData.iGetPlaySongImage.iGetImageInfo, *iImageFileName, exType, iStatus);
if(KErrNone != res)
{
//偲傝偁偊偢僄儔乕偱偟偨
//巜掕偝傟偨儕僗僩偑懚嵼偟側偄帠偼側偄偺偱
TInt log = EMusicAPSyncServerClassNumber_ContentsServiceGetPlaySongImage | EMusicAPSyncServerLocationNumber01;
_LIT(KContentsServiceGetPlaySongImage01, "SyncServerContentsServiceGetPlaySongImage::GetPlaySongImage Error = %d");
SmbMusicAPSyncServerLog(iRLog, log, ELogLevelHighest, KContentsServiceGetPlaySongImage01, res);
//傕偭偰偄傞僆僽僕僃僋僩傪嶍彍偡傞
DeleteObject();
//偲傝偁偊偢僄儔乕傪捠抦偟傑偡
return CompleteThisService(res);
}
//AO傪傾僋僥傿僽偵偡傞
Start();
//忣曬庢摼忬懺偵偡傞
iState = EGetImageState;
//夋憸惗惉夞悢傪僀儞僋儕儊儞僩偡傞
iCreateImageTimes++;
//僒乕價僗張棟傪宲懕
return ESmbMusicAPSyncServerContetnsServiceStateContinue;
}
/**
* 強桳偟偰偄傞傾僀僥儉傪嶍彍偡傞
* @param[in] 側偟
* @return 側偟
**/
void CSmbMusicAPSyncServerContentsServiceGetPlaySongImage::DeleteObject()
{
delete iReqPkg;
iReqPkg = NULL;
delete iReqTPckg;
iReqTPckg = NULL;
delete iLibImteArray;
iLibImteArray = NULL;
// 僼儔僌偵偰嬋傾僀僥儉偺強桳尃傪敾掕偟丄
// 帺暘帩偪偱偁傞応崌偼愑擟傪帩偭偰嶍彍偡傞丅
if (iExistItem == EFalse)
{ // 嬋傾僀僥儉偑帺暘強桳偺応崌
delete iLibItem;
iLibItem = NULL;
}
}
/**
* 傾僀僥儉惗惉偺僉儍儞僙儖
* @param[in] 側偟
* @return 側偟
**/
void CSmbMusicAPSyncServerContentsServiceGetPlaySongImage::CancelCreateItem()
{
//傾僀僥儉惗惉傪僉儍儞僙儖偡傞
iList->CancelCreateNewItem();
//AO偺僉儍儞僙儖
Cancel();
}
/**
* 夋憸庢摼偺僉儍儞僙儖
* @param[in] 側偟
* @return 側偟
**/
void CSmbMusicAPSyncServerContentsServiceGetPlaySongImage::CancelGetPlaySongImage()
{
//嵞惗嬋夋憸偺庢摼傪僉儍儞僙儖偡傞
iFunc.CancelGetImageFile();
//堦墳僼傽僀儖傪嶍彍偟傑偡
//僼傽僀儖僒乕僶偲僙僢僔儑儞傪奐偔
RFs fs;
fs.Connect();
//夋憸僼傽僀儖傪嶍彍偡傞
fs.Delete(*iImageFileName);
//僼傽僀儖僒乕僶偲偺僙僢僔儑儞傪暵偠傞
fs.Close();
}
/**
* 応崌偵傛偭偰偼Retry偟傑偡
* @param[in] 僄儔乕抣
* @return ETrue:Retry偟傑偡/EFalse:僄儔乕廔椆偵側傝傑偡
**/
TBool CSmbMusicAPSyncServerContentsServiceGetPlaySongImage::FailSafe(TInt aError)
{
TBool ret = ETrue;
switch(aError)
{
//埲壓偼僼僃乕儖僙乕僼懳徾偺僄儔乕僐乕僪
case KErrAlreadyExists:
case KErrWrite:
if(iCreateImageTimes < KMaxRetryCount)
{
//僼傽僀儖傪嶍彍偟傑偡
TInt res = KErrNone;
//僼傽僀儖僒乕僶偲僙僢僔儑儞傪奐偔
RFs fs;
fs.Connect();
//夋憸僼傽僀儖傪嶍彍偡傞
res = fs.Delete(*iImageFileName);
if((KErrNone != res) && (KErrNotFound != res))
{
//憐掕奜偺僄儔乕抣側偺偱儘僌傪弌椡偟傑偡
TInt log = EMusicAPSyncServerClassNumber_ContentsServiceGetPlaySongImage | EMusicAPSyncServerLocationNumber07;
_LIT(KContentsServiceGetPlaySongImage07, "SyncServerContentsServiceGetPlaySongImage::FailSafe Error = %d");
SmbMusicAPSyncServerLog(iRLog, log, ELogLevelHighest, KContentsServiceGetPlaySongImage07, res);
//僼傽僀儖僒乕僶偲偺僙僢僔儑儞傪暵偠傞
fs.Close();
return EFalse;
}
//僼傽僀儖僒乕僶偲偺僙僢僔儑儞傪暵偠傞
fs.Close();
}
else
{
//夞悢僆乕僶乕
ret = EFalse;
}
break;
default:
ret = EFalse;
break;
}
return ret;
}
// ADD-S [iKeeper(TRK):9946] UIM幚峴惂尷敾掕捛壛
/**
* UIM幚峴惂尷敾掕張棟
*
* @param[in] aSongItem 敾掕懳徾妝嬋傾僀僥儉
* @param[out] aIsLimited 敾掕寢壥(ETrue:UIM幚峴惂尷/EFalse:UIM幚峴惂尷偱側偄)
*
* @return 張棟寢壥(KErrNone:張棟惉岟丄偦偺懠僄儔乕:張棟幐攕)
**/
TInt CSmbMusicAPSyncServerContentsServiceGetPlaySongImage::IsLimitedSong(CSmbMusicMWLibSongItem& aSongItem, TBool& aIsLimited)
{
TSmbMusicMWLibUimConformity uim(ESmbMusicMWLibNotUIMInfo);
TInt result(KErrNone);
aIsLimited = ETrue; // 惂尷拞偲偟偰弶婜壔
result = aSongItem.UimConformation(uim);
if (result == KErrNone)
{ // 庢摼惉岟
if ((uim == ESmbMusicMWLibConformity) ||
(uim == ESmbMusicMWLibNotUIMInfo))
{ // UIM揔崌傑偨偼忣曬偑側偄応崌
aIsLimited = EFalse; // UIM幚峴惂尷偱偼側偄
}
}
#ifdef __SMBMUSICAPSYNCSERVER_ENABLEALLLOG__
TUint32 logCode = EMusicAPSyncServerClassNumber_ContentsServiceGetPlaySongImage | EMusicAPSyncServerLocationNumber08;
_LIT(KServiceGetPlaySongImageIsLimitedSong01, "CSmbMusicAPSyncServerContentsServiceGetPlaySongImage::IsLimitedSong result:%d IsLimited:%d UIM:%d");
SmbMusicAPSyncServerLog(iRLog, logCode, ELogLevelLowest, KServiceGetPlaySongImageIsLimitedSong01, result, aIsLimited, uim);
#endif
return result;
}
// ADD-E [iKeeper(TRK):9946] UIM幚峴惂尷敾掕捛壛
// end of SmbMusicAPSyncServerContentsServiceGetPlaySongImage.cpp
/* Copyright (C) 2006 Sony Ericsson Mobile Communications Japan, Inc. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -