📄 smbmusicapsyncservercontentsservicegetplaysongimage.cpp
字号:
/* Copyright (C) 2006 Sony Ericsson Mobile Communications Japan, Inc. */
/*-------------------------------------------------------------------------*/
// FileName:
// SmbMusicAPSyncServerContentsServiceGetPlaySongInfo.cpp
//
// Description:
// 嵞惗嬋偺夋憸庢摼梫媮僒乕價僗
/*------------------------------------------------------------------------*/
//曄峏棜楌
//擔晅 |曄峏幰 |撪梕
//--------------+-----------+----------------------------------------------
//2006/06/23 |娵壀 | 怴婯嶌惉
//2006/09/25 |K3悪杮 | [iKeeper(TRK):9946] UIM幚峴惂尷敾掕捛壛
//2006/09/27 |K3悪杮 | [iKeeper(TRK):10035] 梫媮弴偵傛傞僉儍儞僙儖偺僨僢僪儘僢僋栤戣懳張
//2006/10/26 |K3悪杮 | 儘僌儗儀儖廋惓
//2006/10/30 |K3悪杮 | [iKeeper(TRK):12221] 屆偄嵞惗嬋忣曬偑庢摼偝傟偰偄偨栤戣偺懳張
//----PTX824----+-----------+----------------------------------------------
//2007/06/23 |K3悪杮 | AAA夋憸懳墳
#ifndef __SMBMUSICAPSYNCSERVERCONTENTSSERVICEGETPLAYSONGIMAGE_H__
#include "SmbMusicAPSyncServerContentsServiceGetPlaySongImage.h"
#endif
#ifndef __E32ERR_H__
#include <e32err.h> // 僄儔乕僐乕僪
#endif // __E32ERR_H__
#ifndef __SMBMUSICAPSYNCSERVERDEF_H__
#include <SmbMusicAPSyncServerDef.h>
#endif // __SMBMUSICAPSYNCSERVERDEF_H__
#ifndef __SMBMUSICMWLIBCLIENT_H__
#include <SmbMusicMWLibClient.h> // CSmbMusicMWLibPLItem
#endif // __SMBMUSICMWLIBCLIENT_H__
#ifndef __SMBMUSICAPSYNCSERVERCOMMANDOBSERVER_H__
#include "SmbMusicAPSyncServerCommandObserver.h"
#endif // __SMBMUSICAPSYNCSERVERCOMMANDOBSERVER_H__
#ifndef __SMBMUSICAPSYNCSERVERCONTENTSFUNC_H__
#include "SmbMusicAPSyncServerContentsFunc.h"
#endif // __SMBMUSICAPSYNCSERVERCONTENTSFUNC_H__
#ifndef __SMBMUSICAPSYNCSERVERCONTENTSIMAGEDATAMANAGER_H__
#include "SmbMusicAPSyncServerContentsImageDataManager.h"
#endif // __SMBMUSICAPSYNCSERVERCONTENTSIMAGEDATAMANAGER_H__
#ifndef __SMBMUSICAPSYNCSERVERCONTENTSSCREENTRACEMANAGER_H__
#include "SmbMusicAPSyncServerContentsScreenTraceManager.h"
#endif // __SMBMUSICAPSYNCSERVERCONTENTSSCREENTRACEMANAGER_H__
#ifndef __SMBMUSICAPSYNCSERVERCONTENTSASYNCOBSERVER_H__
#include "SmbMusicAPSyncServerContentsAsyncObserver.h"
#endif // __SMBMUSICAPSYNCSERVERCONTENTSASYNCOBSERVER_H__
#ifndef __SMBMUSICAPSYNCSERVERCONTENTSMANAGERINTERFACE_H__
#include "SmbMusicAPSyncServerContentsManagerInterface.h"
#endif // __SMBMUSICAPSYNCSERVERCONTENTSMANAGERINTERFACE_H__
#ifndef __SMBMUSICAPSYNCSERVERCONTENTSPLAYSONGINFOMANAGER_H__
#include "SmbMusicAPSyncServerContentsPlaySongInfoManager.h"
#endif // __SMBMUSICAPSYNCSERVERCONTENTSPLAYSONGINFOMANAGER_H__
#ifndef __SMBMUSICAPSYNCSERVERCONTENTSLIST_H__
#include "SmbMusicAPSyncServerContentsList.h"
#endif // __SMBMUSICAPSYNCSERVERCONTENTSLIST_H__
USING_NAMESPACE_SEMCJ
#define KMaxRetryCount (2) ///< 嵟戝儕僩儔僀夞悢
/**
* 僨僗僩儔僋僞
**/
CSmbMusicAPSyncServerContentsServiceGetPlaySongImage::~CSmbMusicAPSyncServerContentsServiceGetPlaySongImage()
{
if (IsActive() != EFalse)
{
CancelService();
}
// 擮偺偨傔丄僉儍儞僙儖偵偰Complete偡傞
MessageComplete(KErrCancel);
//傕偭偰偄傞僆僽僕僃僋僩傪嶍彍偡傞
DeleteObject();
}
/**
* 僐儞僗僩儔僋僞
*
* @param[in] aRlog 儘僌僒乕僶
* @param[in] aCommandObserver 僐儅儞僪僆僽僓乕僶
* @param[in] aFunc 僼傽儞僋僔儑儞
* @param[in] aImageData 僀儊乕僕僨乕僞僐儞僩儘乕儔
* @param[in] aScreenData 僗僋儕乕儞僩儗乕僗儅僱乕僕儍
* @param[in] aObserver 旕摨婜僆僽僓乕僶
* @param[in] aRMessage 僋儔僀傾儞僩偐傜偺儊僢僙乕僕
**/
CSmbMusicAPSyncServerContentsServiceGetPlaySongImage::CSmbMusicAPSyncServerContentsServiceGetPlaySongImage(
DCM_NAMESPACE::RLog& aRlog,
CSmbMusicAPSyncServerModel& aModel,
MSmbMusicAPSyncServerContentsAsyncObserver& aObserver,
CSmbMusicAPSyncServerContentsFunc& aFunc,
MSmbMusicAPSyncServerContentsManagerInterface& aMgrIf,
CSmbMusicAPSyncServerContentsScreenTraceManager& aScreenData,
const RMessage2& aRMessage):
CSmbMusicAPSyncServerContentsServiceBase(aRlog, aModel, aObserver, aFunc,
aMgrIf, aScreenData, aRMessage),
iState(EIdleState)
{
}
/**
* 僒乕價僗偺奐巒梫媮
* @param [in] 側偟
* @return 僒乕價僗張棟偺宲懕忬嫷
*/
TSmbMusicAPSyncServerContentsServiceState CSmbMusicAPSyncServerContentsServiceGetPlaySongImage::StartServiceL()
{
//梫媮儊僢僙乕僕偺撪梕傪儊儞僶曄悢偵僐僺乕偡傞
ReadParamFromMsgL();
//儕僗僩傪庢摼偡傞
iListHandle = iReqPkg->iData.iPlaySong.iItem.iListHandle;
iList = iScreenData.GetList(iListHandle);
if(NULL == iList)
{
//巜掕偝傟偨儕僗僩偑懚嵼偟側偄帠偼側偄偺偱
TInt log = EMusicAPSyncServerClassNumber_ContentsServiceGetPlaySongImage | EMusicAPSyncServerLocationNumber00;
_LIT(KContentsServiceGetPlaySongImage00, "SyncServerContentsServiceGetPlaySongImage::StartServiceL NotFoundList = %d");
SmbMusicAPSyncServerLog(iRLog, log, ELogLevelHigh, KContentsServiceGetPlaySongImage00, iListHandle);
//傕偭偰偄傞僆僽僕僃僋僩傪嶍彍偡傞
DeleteObject();
//偲傝偁偊偢僄儔乕傪捠抦偟傑偡
CompleteThisService(KErrNotFound);
return ESmbMusicAPSyncServerContetnsServiceStateErr;
}
//夋憸惗惉夞悢傪弶婜壔偡傞
iCreateImageTimes = 0;
//嵞惗嬋忣曬娗棟儅僱乕僕儍偵傾僀僥儉傪強桳偟偰偄傞偐栤偄崌偣傞
iLibItem = iManagers.PlaySongInfoManager().GetPlaySongItem(iReqPkg->iData.iPlaySong.iItem);
if(NULL != iLibItem)
{
iExistItem = ETrue; // 嵞惗嬋忣曬娗棟偵嬋傾僀僥儉偑懚嵼偟偨丅
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;
}
//傾僀僥儉傪婛偵強桳偟偰偄偨
//夋憸僼傽僀儖傊偺僷僗
TBuf<KSmMaxTitleLength> aFileName;
//嵞惗嬋偵娷傑傟傞夋憸傪庢摼
TBool res = iManagers.PlaySongInfoManager().GetPlaySongImage(iReqPkg->iData.iPlaySong.iItem, aFileName);
if(EFalse != res)
{
//婛偵嵞惗嬋夋憸偑搊榐嵪傒偩偭偨
//墳摎儊僢僙乕僕偵張棟寢壥傪彂偒崬傓
TInt ret = WriteToMsg(aFileName);
//僒乕價僗張棟傪廔椆偡傞
return CompleteThisService(ret);
}
else
{
//巆擮側偑傜嵞惗忣曬偼傑偩搊榐偝傟偰偄側偐偭偨
return GetPlaySongImage();
}
}
//儕僗僩偵傾僀僥儉偺惗惉傪埶棅偡傞
TInt itemCount = 1;
iLibImteArray = CSmbMusicMWLibItemArray::NewL(itemCount);
TInt ret = iList->CreateNewItem(*iLibImteArray, iListHandle = iReqPkg->iData.iPlaySong.iItem.iIndex,
itemCount, iStatus);
if(KErrNone != ret)
{
//傾僀僥儉偺惗惉偵幐攕
TInt log = EMusicAPSyncServerClassNumber_ContentsServiceGetPlaySongImage | EMusicAPSyncServerLocationNumber06;
_LIT(KContentsServiceGetPlaySongImage06, "SyncServerContentsServiceGetPlaySongImage::StartServiceL FailCreateItem = %d");
SmbMusicAPSyncServerLog(iRLog, log, ELogLevelHighest, KContentsServiceGetPlaySongImage06, ret);
//傕偭偰偄傞僆僽僕僃僋僩傪嶍彍偡傞
DeleteObject();
//偲傝偁偊偢僄儔乕傪捠抦偟傑偡
CompleteThisService(ret);
return ESmbMusicAPSyncServerContetnsServiceStateErr;
}
//ActiveObject傪妶惈壔偡傞
Start();
//傾僀僥儉惗惉忬懺偵慗堏
iState = ECreateItemState;
//僒乕價僗張棟傪宲懕
return ESmbMusicAPSyncServerContetnsServiceStateContinue;
}
/**
* 僒乕價僗僄儔乕捠抦
*
* @param[in] aError 僄儔乕僐乕僪
**/
TSmbMusicAPSyncServerContentsServiceState CSmbMusicAPSyncServerContentsServiceGetPlaySongImage::ServiceErr(TInt aError)
{
TInt log = EMusicAPSyncServerClassNumber_ContentsServiceGetPlaySongImage | EMusicAPSyncServerLocationNumber02;
_LIT(KContentsServiceGetPlaySongImage02, "SyncServerContentsServiceGetPlaySongImage::ServiceErr = %d");
SmbMusicAPSyncServerLog(iRLog, log, ELogLevelLowest, KContentsServiceGetPlaySongImage02, aError);
switch(iState)
{
///<傾僀僥儉惗惉忬懺
case ECreateItemState:
// CancelCreateItem();
break;
///<夋憸庢摼忬懺
case EGetImageState:
//Retry偡傞偐挷傋傑偡
if(EFalse != FailSafe(aError))
{
//Retry偟傑偡
return GetPlaySongImage();
}
break;
default:
break;
}
//傕偭偰偄傞僆僽僕僃僋僩傪嶍彍偡傞
DeleteObject();
//埨掕忬懺偵栠偡
iState = EIdleState;
//偲傝偁偊偢僄儔乕傪捠抦偟傑偡
CompleteThisService(aError);
//埨掕忬懺偵栠偡
iState = EIdleState;
return ESmbMusicAPSyncServerContetnsServiceStateErr;
}
/**
* 僒乕價僗僉儍儞僙儖捠抦
* @param [in] 側偟
* @return 僒乕價僗張棟偺宲懕忬嫷
*/
void CSmbMusicAPSyncServerContentsServiceGetPlaySongImage::CancelService()
{
TInt res = KErrNone;
switch(iState)
{
///<梫媮側偟忬懺
case EIdleState:
//張棟柍偟偱廔椆偡傞
res = KErrNone;
break;
///<傾僀僥儉惗惉忬懺
case ECreateItemState:
CancelCreateItem();
break;
///<夋憸庢摼忬懺
case EGetImageState:
//夋憸庢摼偺僉儍儞僙儖
CancelGetPlaySongImage();
break;
default:
//婎杮揑偵偙偙偵偔傞偙偲偼側偄偺偱廔椆偟傑偡
TInt log = EMusicAPSyncServerClassNumber_ContentsServiceGetPlaySongImage | EMusicAPSyncServerLocationNumber03;
_LIT(KContentsServiceGetPlaySongImage03, "SyncServerContentsServiceGetPlaySongImage::CancelService State = %d");
SmbMusicAPSyncServerLog(iRLog, log, ELogLevelHighest, KContentsServiceGetPlaySongImage03, iState);
break;
}
//惓忢張棟偱曉偡
CompleteThisService(res);
//傕偭偰偄傞僆僽僕僃僋僩傪嶍彍偡傞
DeleteObject();
Cancel();
}
/**
* 僒乕價僗宲懕張棟
* @param [in] 側偟
* @return 僒乕價僗張棟偺宲懕忬嫷
*/
TSmbMusicAPSyncServerContentsServiceState CSmbMusicAPSyncServerContentsServiceGetPlaySongImage::ContinueServiceL()
{
TSmbMusicAPSyncServerContentsServiceState retState = ESmbMusicAPSyncServerContetnsServiceStateContinue;
switch(iState)
{
///<梫媮側偟忬懺
case EIdleState:
//張棟柍偟偱廔椆偡傞
retState = CompleteThisService(KErrServerBusy);
break;
///<傾僀僥儉惗惉忬懺
case ECreateItemState:
retState = StartGetPlaySongImageL();
break;
///<夋憸庢摼忬懺
case EGetImageState:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -