📄 smbmusicapsyncservercontentsservicegetplaysonginfo.cpp
字号:
}
/**
* 僉儍儞僙儖梫媮偵懳偡傞僒乕價僗僉儍儞僙儖敾掕
*
* @param[in] aCancelEvent 僉儍儞僙儖梫媮偝傟偨僀儀儞僩僞僀僾
*
* @return 僉儍儞僙儖傪庴偗傞偐偳偆偐偺敾掕(ETrue:梫媮僉儍儞僙儖丄EFalse:梫媮傪僉儍儞僙儖偟側偄)
**/
TBool CSmbMusicAPSyncServerContentsServiceGetPlaySongInfo::CheckCancel(TSmbMusicAPSyncServerFunction aCancelEvent)
{
if (aCancelEvent == ESmbMusicAPSyncServerFuncCancelGetPlaySongInfo)
{ // 帺僒乕價僗偺僉儍儞僙儖梫媮偺応崌
TInt log = EMusicAPSyncServerClassNumber_ContentsServiceGetPlaySongInfo | EMusicAPSyncServerLocationNumber16;
_LIT(KContentsServiceGetPlaySongInfo16, "SyncServerContentsServiceGetPlaySongInfo::CheckCancel");
SmbMusicAPSyncServerLog(iRLog, log, ELogLevelLowest, KContentsServiceGetPlaySongInfo16);
return ETrue;
}
return EFalse;
}
/**
* 梫媮儊僢僙乕僕偺撪梕傪僐僺乕偡傞
* @param [in] 側偟
* @return 側偟
*/
void CSmbMusicAPSyncServerContentsServiceGetPlaySongInfo::ReadParamFromMsgL()
{
//梫媮儊僢僙乕僕偺撪梕傪惗惉
iReqPkg = new(ELeave)TSmbMusicAPSyncEnginePlaySongDetail;
iReqTPckg = new(ELeave)TPckg<TSmbMusicAPSyncEnginePlaySongDetail>(*iReqPkg);
//庴怣儊僢僙乕僕傪僐僺乕偡傞
iRMessage.ReadL(KSmbMusicAPSyncEngineMsgIn1, *iReqTPckg);
//MW亅傾僾儕娫偱Index偺僘儗偑偁傞偺偱曗惓偟傑偡
iReqPkg->iReserve2++;
}
/**
* 儊僢僙乕僕偵張棟寢壥傪僐僺乕偡傞
* @param [in] 側偟
* @return 張棟寢壥
*/
TInt CSmbMusicAPSyncServerContentsServiceGetPlaySongInfo::WriteToMsg(TInt aPlayTime, TDes& aArtist,
TDes& aAlbum, TDes& aSong)
{
//婛偵嵞惗忣曬偑搊榐嵪傒偩偭偨
TSmbMusicAPSyncEnginePlaySongDetail playSongInfo;
playSongInfo.iTotalPlayTime = aPlayTime;
playSongInfo.iReserve1 = iReqPkg->iReserve1;
//MW-傾僾儕娫偱Index偵僘儗偑偁傞偺偱曗惓偟傑偡
playSongInfo.iReserve2 = (iReqPkg->iReserve2--);
TPckg<TSmbMusicAPSyncEnginePlaySongDetail> pkg(playSongInfo);
TInt res = KErrNone;
//憲怣儊僢僙乕僕偵僨乕僞傪僐僺乕偡傞
res = iRMessage.Write(KSmbMusicAPSyncEnginePlayInfoDefailMsg, pkg);
if(KErrNone != res)
{
//彂偒崬傒幐攕
TInt log = EMusicAPSyncServerClassNumber_ContentsServiceGetPlaySongInfo | EMusicAPSyncServerLocationNumber08;
_LIT(KContentsServiceGetPlaySongInfo08, "SyncServerContentsServiceGetPlaySongInfo::WriteToMsg Error = %d");
SmbMusicAPSyncServerLog(iRLog, log, ELogLevelHighest, KContentsServiceGetPlaySongInfo08, res);
return res;
}
res = iRMessage.Write(KSmbMusicAPSyncEnginePlayInfoArtMsg, aArtist);
if(KErrNone != res)
{
//彂偒崬傒幐攕
TInt log = EMusicAPSyncServerClassNumber_ContentsServiceGetPlaySongInfo | EMusicAPSyncServerLocationNumber09;
_LIT(KContentsServiceGetPlaySongInfo09, "SyncServerContentsServiceGetPlaySongInfo::WriteToMsg = %d");
SmbMusicAPSyncServerLog(iRLog, log, ELogLevelHighest, KContentsServiceGetPlaySongInfo09, res);
return res;
}
res = iRMessage.Write(KSmbMusicAPSyncEnginePlayInfoAlbMsg, aAlbum);
if(KErrNone != res)
{
//彂偒崬傒幐攕
TInt log = EMusicAPSyncServerClassNumber_ContentsServiceGetPlaySongInfo | EMusicAPSyncServerLocationNumber10;
_LIT(KContentsServiceGetPlaySongInfo10, "SyncServerContentsServiceGetPlaySongInfo::WriteToMsg = %d");
SmbMusicAPSyncServerLog(iRLog, log, ELogLevelHighest, KContentsServiceGetPlaySongInfo10, res);
return res;
}
res = iRMessage.Write(KSmbMusicAPSyncEnginePlayInfoSTMsg, aSong);
if(KErrNone != res)
{
//彂偒崬傒幐攕
TInt log = EMusicAPSyncServerClassNumber_ContentsServiceGetPlaySongInfo | EMusicAPSyncServerLocationNumber11;
_LIT(KContentsServiceGetPlaySongInfo11, "SyncServerContentsServiceGetPlaySongInfo::WriteToMsg = %d");
SmbMusicAPSyncServerLog(iRLog, log, ELogLevelHighest, KContentsServiceGetPlaySongInfo11, res);
return res;
}
return res;
}
/**
* 嵞惗昞帵忣曬幚峴
* @param [in] 側偟
* @return 側偟
*/
TSmbMusicAPSyncServerContentsServiceState CSmbMusicAPSyncServerContentsServiceGetPlaySongInfo::StartGetPlaySongInfoL()
{
//惗惉偟偨傾僀僥儉傪揈弌偡傞
iLibItem = iLibImteArray->GetMusicItemL(0);
if(NULL == iLibItem)
{
//傾僀僥儉傪揈弌偱偒側偗傟偽
TInt log = EMusicAPSyncServerClassNumber_ContentsServiceGetPlaySongInfo | EMusicAPSyncServerLocationNumber07;
_LIT(KContentsServiceGetPlaySongInfo07, "SyncServerContentsServiceGetPlaySongInfo::StartGetPlaySongInfoL Index = %d");
SmbMusicAPSyncServerLog(iRLog, log, ELogLevelHighest, KContentsServiceGetPlaySongInfo07, iReqPkg->iReserve2);
//傕偭偰偄傞僆僽僕僃僋僩傪嶍彍偡傞
DeleteObject();
//張棟傪廔椆偡傞
return CompleteThisService(KErrNotFound);
}
// DEL-S [iKeeper(TRK):12221] 屆偄嵞惗嬋忣曬偑庢摼偝傟偰偄偨栤戣偺懳張
// 嬋傾僀僥儉偺愝掕偼嵞惗嬋忣曬庢摼偑惉岟偟偨応崌偵峴偆偙偲偲偡傞丅
// TSmbMusicAPSyncEngineItemIndex songIndex;
// songIndex.iListHandle = iListHandle;
// songIndex.iIndex = iReqPkg->iReserve2;
// //嵞惗嬋傾僀僥儉傪搊榐偡傞
// iManagers.PlaySongInfoManager().SetPlaySongItem(songIndex, iLibItem);
// DEL-E [iKeeper(TRK):12221] 屆偄嵞惗嬋忣曬偑庢摼偝傟偰偄偨栤戣偺懳張
//嵞惗嬋忣曬傪庢摼偡傞
return GetPlayInfoL();
}
/**
* 忣曬庢摼姰椆
* @param [in] 側偟
* @return 側偟
*/
TSmbMusicAPSyncServerContentsServiceState CSmbMusicAPSyncServerContentsServiceGetPlaySongInfo::CompleteGetInfoL()
{
//幚嵺偵忣曬傪庢傝弌偡
const TSmbMusicMWLibPlayingDispInfo* info = iLibPlayInfo->PlayingDispInfo();
if(NULL == info)
{
//忣曬偑側偄
TInt log = EMusicAPSyncServerClassNumber_ContentsServiceGetPlaySongInfo | EMusicAPSyncServerLocationNumber02;
_LIT(KContentsServiceGetPlaySongInfo02, "SyncServerContentsServiceGetPlaySongInfo::CompleteGetInfoL");
SmbMusicAPSyncServerLog(iRLog, log, ELogLevelHighest, KContentsServiceGetPlaySongInfo02);
//傕偭偰偄傞僆僽僕僃僋僩傪嶍彍偡傞
DeleteObject();
//張棟傪廔椆偡傞
return CompleteThisService(KErrNotFound);
}
TSmbMusicAPSyncEngineItemIndex songIndex;
songIndex.iListHandle = iListHandle;
songIndex.iIndex = iReqPkg->iReserve2;
// ADD-S [iKeeper(TRK):12221] 屆偄嵞惗嬋忣曬偑庢摼偝傟偰偄偨栤戣偺懳張
if (iExistItem == EFalse)
{ // 嬋傾僀僥儉傪MW偐傜庢摼偟偨応崌
//嵞惗嬋傾僀僥儉傪搊榐偡傞
iManagers.PlaySongInfoManager().SetPlaySongItem(songIndex, iLibItem);
iExistItem = ETrue; // 嵞惗嬋忣曬娗棟偵嬋傾僀僥儉偺強桳尃傪堏忳
}
// ADD-E [iKeeper(TRK):12221] 屆偄嵞惗嬋忣曬偑庢摼偝傟偰偄偨栤戣偺懳張
//嵞惗忣曬傪搊榐偡傞
iManagers.PlaySongInfoManager().SetPlaySongInfoL(songIndex, info->iDuration, info->iMusicArtist, info->iMusicAlbum,
info->iMusicTitle);
//傾僀僥儉傪婛偵強桳偟偰偄偨
//傾乕僥傿僗僩僞僀僩儖
TBuf<KSmMaxTitleLength> artistTitle;
//傾儖僶儉僞僀僩儖
TBuf<KSmMaxTitleLength> albumTitle;
//嬋僞僀僩儖
TBuf<KSmMaxTitleLength> songTitle;
//嵞惗帪娫
TInt playTime;
//傔傫偳偔偝偄偗偳嵞惗嬋忣曬傪庢摼偡傞
TBool res = iManagers.PlaySongInfoManager().GetPlaySongInfo(songIndex, playTime,
artistTitle, albumTitle, songTitle);
TInt ret = KErrNone;
if(EFalse == res)
{
//偙偙偵偔傞偼偢偼側偄偺偵丒丒丒
TInt log = EMusicAPSyncServerClassNumber_ContentsServiceGetPlaySongInfo | EMusicAPSyncServerLocationNumber06;
_LIT(KContentsServiceGetPlaySongInfo06, "SyncServerContentsServiceGetPlaySongInfo::CompleteGetInfoL");
SmbMusicAPSyncServerLog(iRLog, log, ELogLevelHighest, KContentsServiceGetPlaySongInfo06);
//偲傝偁偊偢僄儔乕偱偡
ret = KErrServerBusy;
}
else
{
//墳摎儊僢僙乕僕偵張棟寢壥傪彂偒崬傓
ret = WriteToMsg(playTime, artistTitle, albumTitle, songTitle);
}
//傕偭偰偄傞僆僽僕僃僋僩傪嶍彍偡傞
DeleteObject();
//張棟傪廔椆偡傞
return CompleteThisService(ret);
}
/**
* 梫媮張棟姰椆
* @param [in] aResult 張棟寢壥
* @return 側偟
*/
TSmbMusicAPSyncServerContentsServiceState CSmbMusicAPSyncServerContentsServiceGetPlaySongInfo::CompleteThisService(TInt aResult)
{
//墳摎傪敪峴偡傞
MessageComplete(aResult);
//埨掕忬懺偵栠偡
iState = EIdleState;
return ESmbMusicAPSyncServerContetnsServiceStateEnd;
}
/**
* 嵞惗嬋忣曬傪庢摼偡傞
* @param[in] 側偟
* @return 僒乕價僗偺宲懕忬懺
**/
TSmbMusicAPSyncServerContentsServiceState CSmbMusicAPSyncServerContentsServiceGetPlaySongInfo::GetPlayInfoL()
{
//嵞惗嬋忣曬傪庢摼偡傞
TSmbMusicMWLibItemType itemType = iLibItem->ItemType();
if(ESmbMusicMWLibItemTypeSong != itemType)
{
//枹僒億乕僩偲偄偆偙偲偱丒丒丒
TInt log = EMusicAPSyncServerClassNumber_ContentsServiceGetPlaySongInfo | EMusicAPSyncServerLocationNumber03;
_LIT(KContentsServiceGetPlaySongInfo03, "SyncServerContentsServiceGetPlaySongInfo::GetPlayInfoL");
SmbMusicAPSyncServerLog(iRLog, log, ELogLevelHighest, KContentsServiceGetPlaySongInfo03);
//傕偭偰偄傞僆僽僕僃僋僩傪嶍彍偡傞
DeleteObject();
//張棟傪廔椆偡傞
return CompleteThisService(KErrNotSupported);
}
//SongItem偵僉儍僗僩偡傞
CSmbMusicMWLibSongItem* songItem = static_cast<CSmbMusicMWLibSongItem*>(iLibItem);
//嵞惗嬋忣曬庢摼梫媮
iLibPlayInfo = CSmbMusicMWLibPlayingDispInfo::NewL();
TInt result = songItem->PlayingDispInformation(*iLibPlayInfo, iStatus);
if(KErrNone != result)
{
//枹僒億乕僩偲偄偆偙偲偱丒丒丒
TInt log = EMusicAPSyncServerClassNumber_ContentsServiceGetPlaySongInfo | EMusicAPSyncServerLocationNumber04;
_LIT(KContentsServiceGetPlaySongInfo04, "SyncServerContentsServiceGetPlaySongInfo::GetPlayInfoL");
SmbMusicAPSyncServerLog(iRLog, log, ELogLevelHighest, KContentsServiceGetPlaySongInfo04, result);
//傕偭偰偄傞僆僽僕僃僋僩傪嶍彍偡傞
DeleteObject();
//張棟傪廔椆偡傞
return CompleteThisService(result);
}
//AO傪傾僋僥傿僽偵偡傞
Start();
//忣曬庢摼忬懺偵偡傞
iState = EGetInfoState;
//僒乕價僗張棟傪宲懕
return ESmbMusicAPSyncServerContetnsServiceStateContinue;
}
/**
* 強桳偟偰偄傞傾僀僥儉傪嶍彍偡傞
* @param[in] 側偟
* @return 側偟
**/
void CSmbMusicAPSyncServerContentsServiceGetPlaySongInfo::DeleteObject()
{
delete iReqPkg;
iReqPkg = NULL;
delete iReqTPckg;
iReqTPckg = NULL;
delete iLibImteArray;
iLibImteArray = NULL;
delete iLibPlayInfo;
iLibPlayInfo = NULL;
//傾僀僥儉偼PlaySongManager傊忳搉偡傞偺偱偙偙偱偼嶍彍偟傑偣傫
// MODIFY-S [iKeeper(TRK):12221] 屆偄嵞惗嬋忣曬偑庢摼偝傟偰偄偨栤戣偺懳張
// 僼儔僌偵偰嬋傾僀僥儉偺強桳尃傪敾掕偟丄
// 帺暘帩偪偱偁傞応崌偼愑擟傪帩偭偰嶍彍偡傞丅
if (iExistItem == EFalse)
{ // 嬋傾僀僥儉偑帺暘強桳偺応崌
delete iLibItem;
iLibItem = NULL;
}
// MODIFY-E [iKeeper(TRK):12221] 屆偄嵞惗嬋忣曬偑庢摼偝傟偰偄偨栤戣偺懳張
}
/**
* 傾僀僥儉惗惉偺僉儍儞僙儖
* @param[in] 側偟
* @return 側偟
**/
void CSmbMusicAPSyncServerContentsServiceGetPlaySongInfo::CancelCreateItem()
{
//傾僀僥儉惗惉傪僉儍儞僙儖偡傞
iList->CancelCreateNewItem();
//AO偺僉儍儞僙儖
Cancel();
}
/**
* 忣曬庢摼偺僉儍儞僙儖
* @param[in] 側偟
* @return 側偟
**/
void CSmbMusicAPSyncServerContentsServiceGetPlaySongInfo::CancelGetInfo()
{
TSmbMusicMWLibItemType itemType = iLibItem->ItemType();
if(ESmbMusicMWLibItemTypeSong != itemType)
{
//枹僒億乕僩偲偄偆偙偲偱丒丒丒
TInt log = EMusicAPSyncServerClassNumber_ContentsServiceGetPlaySongInfo | EMusicAPSyncServerLocationNumber05;
_LIT(KContentsServiceGetPlaySongInfo05, "SyncServerContentsServiceGetPlaySongInfo::CancelGetInfo");
SmbMusicAPSyncServerLog(iRLog, log, ELogLevelHighest, KContentsServiceGetPlaySongInfo05);
return;
}
//SongItem偵僉儍僗僩偡傞
CSmbMusicMWLibSongItem* songItem = static_cast<CSmbMusicMWLibSongItem*>(iLibItem);
//嵞惗嬋忣曬庢摼拞巭
songItem->CancelGetInfo();
}
// end of SmbMusicAPSyncServerContentsServiceGetPlaySongInfo.cpp
/* Copyright (C) 2006 Sony Ericsson Mobile Communications Japan, Inc. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -