⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 smbmusicapsyncservercontentsserviceincrementplaysongtimes.cpp

📁 索爱相关代码。实现功能是server。很有参考价值。代码很难弄到。symbian。
💻 CPP
📖 第 1 页 / 共 2 页
字号:
/* Copyright (C) 2006 Sony Ericsson Mobile Communications Japan, Inc. */
/*--------------------------------------------------------------------*/
// FileName:
//	SmbMusicAPSyncServerContentsServiceIncrementPlaySongTimes.cpp
//
// Description:
//	PTX810 Music傾僾儕 摨婜僒乕僶 僐儞僥儞僣僋儔僗
/*--------------------------------------------------------------------*/
//曄峏棜楌
//擔晅			|曄峏幰			|撪梕
//--------------+---------------+--------------------------------------
//2006/06/20	|SDNA 壀嶳		| 怴婯嶌惉
//2006/08/17	|K3悪杮			| 嵟廔嵞惗擔帪峏怴張棟偺捛壛
//----PTX824----+---------------+--------------------------------------
//2007/04/02	|K3悪杮			| PTX824懳墳(棙梡棜楌峏怴梫媮捛壛)
//2007/06/28	|K3悪杮			| [D_82400004466]僄儔乕帪傕張棟宲懕偡傞傛偆廋惓
//2007/08/10	|K3悪杮			| [D_82400004466][D_82400004710] 僉儍儞僙儖晄壜側僒乕價僗偵懳墳
//2007/09/19	|K3悪杮			| [D_82400015202]棙梡棜楌峏怴帪390MHz偵偡傞懳墳
//2007/09/30	|K3悪杮			| [D_82400015202]390MHz傪傗傔傞曽岦偱廋惓


#ifndef __SMBMUSICAPSYNCSERVERCONTENTSSERVICEINCREMENTPLAYSONGTIMES_H__
#include "SmbMusicAPSyncServerContentsServiceIncrementPlaySongTimes.h"
#endif

#ifndef __SMBMUSICAPSYNCSERVERCONTENTSLIST_H__
#include "SmbMusicAPSyncServerContentsList.h"
#endif

#ifndef __SMBMUSICAPSYNCSERVERCONTENTSITEM_H__
#include "SmbMusicAPSyncServerContentsItem.h"
#endif

////  DEL-S  [D_82400015202]390MHz傪傗傔傞曽岦偱廋惓
//#ifndef	__SMBMUSICAPSYNCSERVERINTERNALDEF_H__
//#include "SmbMusicAPSyncServerInternalDef.h"	//  摨婜僒乕僶傾僾儕UID
//#endif	//  __SMBMUSICAPSYNCSERVERINTERNALDEF_H__
////  DEL-E  [D_82400015202]390MHz傪傗傔傞曽岦偱廋惓


USING_NAMESPACE_SEMCJ

/**
 *  僐儞僗僩儔僋僞
 *  @param[in]		aRlog				RLog偺嶲徠
 *  @param[in]		aModel				儌僨儖僋儔僗偺嶲徠
 *  @param[in]		aObserver			僒乕價僗姰椆捠抦愭僋儔僗偺嶲徠
 *  @param[in]		aFunc				僐儞僥儞僣僼傽儞僋儔僗偺嶲徠
 *  @param[in]		aManagerInterface	奺儅僱乕僕儍傪娗棟偡傞僋儔僗偺嶲徠
 *  @param[in]		aScreenData			夋柺慗堏僨乕僞娗棟僋儔僗偺嶲徠
 *  @param[in,out]	aRMessage			RMessage偺億僀儞僞
 **/
CSmbMusicAPSyncServerContentsServiceIncrementPlaySongTimes::CSmbMusicAPSyncServerContentsServiceIncrementPlaySongTimes(
		DCM_NAMESPACE::RLog&								aRlog,
		CSmbMusicAPSyncServerModel& 						aModel,
		MSmbMusicAPSyncServerContentsAsyncObserver& 		aObserver,
		CSmbMusicAPSyncServerContentsFunc& 					aFunc,
		MSmbMusicAPSyncServerContentsManagerInterface& 		aManagerInterface,
		CSmbMusicAPSyncServerContentsScreenTraceManager&	aScreenData,
		const RMessage2&									aRMessage
		)
	:CSmbMusicAPSyncServerContentsServiceBase(aRlog,aModel,aObserver,aFunc,aManagerInterface,aScreenData,aRMessage,ETrue),
	 iServiceState(ESmbMusicAPSyncServerContentsServiceIncrementPlaySongTimesStateInit)
	{
////  DEL-S  [D_82400015202]390MHz傪傗傔傞曽岦偱廋惓
//	//  RLauncherSession偵愙懕
//	iLauncherSession.Connect(KSmbMusicAPSyncServerUID);
////  DEL-E  [D_82400015202]390MHz傪傗傔傞曽岦偱廋惓
	}


/**
 *  僨僗僩儔僋僞
 **/
CSmbMusicAPSyncServerContentsServiceIncrementPlaySongTimes::~CSmbMusicAPSyncServerContentsServiceIncrementPlaySongTimes()
	{
	if (IsActive() != EFalse)
		{
		CancelService();
		}
	// 擮偺偨傔丄Complete偡傞
	CompleteErr();

	delete iTempItemArray;
	delete iTempSongItem;

////  DEL-S  [D_82400015202]390MHz傪傗傔傞曽岦偱廋惓
//	//  CPU懍搙傪僨僼僅儖僩偵栠偡
//	iLauncherSession.ControlCPUSpeed(DCM_NAMESPACE::ELaCpuSpeedDefault);
//	iLauncherSession.Close();
////  DEL-E  [D_82400015202]390MHz傪傗傔傞曽岦偱廋惓
	}


/**
 *  僒乕價僗傪奐巒偡傞
 *  @return	僒乕價僗張棟忬懺
 **/
TSmbMusicAPSyncServerContentsServiceState CSmbMusicAPSyncServerContentsServiceIncrementPlaySongTimes::StartServiceL()
	{
#ifdef __SMBMUSICAPSYNCSERVER_ENABLEALLLOG__
	TUint32 logCode = EMusicAPSyncServerClassNumber_ContentsServiceIncrementPlaySongTime|EMusicAPSyncServerLocationNumber00;
	_LIT(KContentsServiceIncrementPlaySongTime00, "SyncServerContentsServiceIncrementPlaySongTimes::StartServiceL() ListHandle:%d Index:%d");
	SmbMusicAPSyncServerLog(iRLog, logCode, ELogLevelLowest, KContentsServiceIncrementPlaySongTime00, 
							iParamListHandle, iParamIndex);
#endif

	if(ESmbMusicAPSyncServerContentsServiceIncrementPlaySongTimesStateParamOK == iServiceState)
		{
		iList = iScreenData.GetList(iParamListHandle);
		if(iList != NULL)
			{
			// 傾僀僥儉攝楍傪惗惉偡傞
			iTempItemArray = CSmbMusicMWLibItemArray::NewL(1);
			// 傾僀僥儉傪庢摼偡傞
			TInt result = iList->CreateNewItem(*iTempItemArray, iParamIndex, 1, iStatus);

			if(KErrNone == result)
				{
////  DEL-S  [D_82400015202]390MHz傪傗傔傞曽岦偱廋惓
//				//  張棟傪奐巒偡傞僞僀儈儞僌偱CPU懍搙傪390MHz偵忋偘傞
//				iLauncherSession.ControlCPUSpeed(DCM_NAMESPACE::ELaCpuSpeedHigh);
////  DEL-E  [D_82400015202]390MHz傪傗傔傞曽岦偱廋惓
				// 僒乕價僗僋儔僗傪傾僋僥傿僽偵偡傞
				Start();

				// 傾僀僥儉庢摼懸偪忬懺偵偡傞
				iServiceState = ESmbMusicAPSyncServerContentsServiceIncrementPlaySongTimesStateWaitItem;

				return ESmbMusicAPSyncServerContetnsServiceStateContinue;
				}
			else
				{
				TUint32 logCode = EMusicAPSyncServerClassNumber_ContentsServiceIncrementPlaySongTime|EMusicAPSyncServerLocationNumber01;
				_LIT(KContentsServiceIncrementPlaySongTime01, "SyncServerContentsServiceIncrementPlaySongTimes::StartServiceL() CreateNewItem() Err %d");
				SmbMusicAPSyncServerLog(iRLog, logCode, ELogLevelHigh, KContentsServiceIncrementPlaySongTime01, result);

				// 僒乕價僗傪僄儔乕偱姰椆偡傞
				CompleteErr();
				return ESmbMusicAPSyncServerContetnsServiceStateErr;
				}
			}
		else
			{
			TUint32 logCode = EMusicAPSyncServerClassNumber_ContentsServiceIncrementPlaySongTime|EMusicAPSyncServerLocationNumber02;
			_LIT(KContentsServiceIncrementPlaySongTime02, "SyncServerContentsServiceIncrementPlaySongTimes::StartServiceL() List Not Found  Handle:0x%08x");
			SmbMusicAPSyncServerLog(iRLog, logCode, ELogLevelHigh, KContentsServiceIncrementPlaySongTime02, iParamListHandle);

			// 僒乕價僗傪僄儔乕偱姰椆偡傞
			CompleteErr();
			return ESmbMusicAPSyncServerContetnsServiceStateErr;
			}
		}
	else
		{
		TUint32 logCode = EMusicAPSyncServerClassNumber_ContentsServiceIncrementPlaySongTime|EMusicAPSyncServerLocationNumber03;
		_LIT(KContentsServiceIncrementPlaySongTime03, "SyncServerContentsServiceIncrementPlaySongTimes::StartServiceL() Invalid State %d");
		SmbMusicAPSyncServerLog(iRLog, logCode, ELogLevelHigh, KContentsServiceIncrementPlaySongTime03, iServiceState);

		// 僒乕價僗傪僄儔乕偱姰椆偡傞
		CompleteErr();
		return ESmbMusicAPSyncServerContetnsServiceStateErr;
		}
	}


/**
 *  僒乕價僗偺撪晹僐儅儞僪愝掕傪奐巒偡傞
 *  @param [in]	aCommand	撪晹僐儅儞僪偺嶲徠
 **/
void CSmbMusicAPSyncServerContentsServiceIncrementPlaySongTimes::SetCommand(TSmbMusicAPSyncServerInternalCommandPkg& aCommand)
	{
	if(ESmbMsuicAPSyncServerIncrementPlaySongTimes == aCommand.iCommand)
		{
		iParamListHandle	= aCommand.iParam.iIncrementPlaySongTimes.iListHandle;
		iParamIndex			= aCommand.iParam.iIncrementPlaySongTimes.iIndex;
		if(0 < iParamIndex)
			{
			iServiceState = ESmbMusicAPSyncServerContentsServiceIncrementPlaySongTimesStateParamOK;
			}
		else
			{
			iServiceState = ESmbMusicAPSyncServerContentsServiceIncrementPlaySongTimesStateParamERR;
			}
		}
	}


/**
 *  旕摨婜墳摎偐傜僒乕價僗傪宲懕偡傞
 *  @return	僒乕價僗張棟忬懺
 **/
TSmbMusicAPSyncServerContentsServiceState CSmbMusicAPSyncServerContentsServiceIncrementPlaySongTimes::ContinueServiceL()
	{
#ifdef __SMBMUSICAPSYNCSERVER_ENABLEALLLOG__
	TUint32 logCode = EMusicAPSyncServerClassNumber_ContentsServiceIncrementPlaySongTime|EMusicAPSyncServerLocationNumber04;
	_LIT(KContentsServiceIncrementPlaySongTime04, "SyncServerContentsServiceIncrementPlaySongTimes::ContinueServiceL() state:%d");
	SmbMusicAPSyncServerLog(iRLog, logCode, ELogLevelLowest, KContentsServiceIncrementPlaySongTime04, iServiceState);
#endif
	TSmbMusicAPSyncServerContentsServiceState ret(ESmbMusicAPSyncServerContetnsServiceStateErr);

//  MODIFY-S  [D_82400004466]僄儔乕帪傕張棟宲懕偡傞傛偆廋惓
	switch(iServiceState)
		{
		case ESmbMusicAPSyncServerContentsServiceIncrementPlaySongTimesStateWaitItem:		// 僒乕價僗傾僀僥儉庢摼懸偪
			{
			// 傾僀僥儉傪庢摼偡傞
			CSmbMusicMWLibMusicItem* item = iTempItemArray->GetMusicItemL(0);

			if(item != NULL)
				{
				// 傾僀僥儉偑嬋傾僀僥儉偺応崌
				if(item->ItemType() == ESmbMusicMWLibItemTypeSong)
					{
					//  嬋傾僀僥儉僋儔僗偵僉儍僗僩
					iTempSongItem = static_cast<CSmbMusicMWLibSongItem*>(item);

					//  僒僽僗僋儕僾僔儑儞梡嵞惗夞悢峏怴丒壒妝棙梡棜楌忣曬偺婰榐
					ret = RecordPlayReport();
					}
				else
					{
					TUint32 logCode = EMusicAPSyncServerClassNumber_ContentsServiceIncrementPlaySongTime|EMusicAPSyncServerLocationNumber05;
					_LIT(KContentsServiceIncrementPlaySongTime05, "SyncServerContentsServiceIncrementPlaySongTimes::ContinueServiceL() ItemType is not Song[Type:%d]");
					SmbMusicAPSyncServerLog(iRLog, logCode, ELogLevelHigh, KContentsServiceIncrementPlaySongTime05, item->ItemType());

					delete item;
					item = NULL;

					// 僒乕價僗傪僄儔乕偱姰椆偡傞
					CompleteErr();
					}
				}
			else
				{
				TUint32 logCode = EMusicAPSyncServerClassNumber_ContentsServiceIncrementPlaySongTime|EMusicAPSyncServerLocationNumber06;
				_LIT(KContentsServiceIncrementPlaySongTime06, "SyncServerContentsServiceIncrementPlaySongTimes::ContinueServiceL() GetMusicItemL() Error");
				SmbMusicAPSyncServerLog(iRLog, logCode, ELogLevelHigh, KContentsServiceIncrementPlaySongTime06);

				// 僒乕價僗傪僄儔乕偱姰椆偡傞
				CompleteErr();
				}
			}
			break;

		case ESmbMusicAPSyncServerContentsServiceIncrementPlaySongTimesStateWaitUpdatePlayReport:	// 僒乕價僗傾僀僥儉棙梡棜楌峏怴懸偪
			{
			//  嵞惗夞悢峏怴(傛偔挳偔50審梡)
			ret = IncrementPlayCount();
			}
			break;

		case ESmbMusicAPSyncServerContentsServiceIncrementPlaySongTimesStateWaitUpdateCount:	// 僒乕價僗傾僀僥儉嵞惗夞悢峏怴懸偪
			{
			//  嵟廔嵞惗擔峏怴(嵟嬤挳偄偨50審梡)
			ret = UpdateLastPlayTime();
			}
			break;

		case ESmbMusicAPSyncServerContentsServiceIncrementPlaySongTimesStateWaitUpdateDate:	// 僒乕價僗傾僀僥儉嵞惗擔帪峏怴懸偪
			{
			Complete();
			ret = ESmbMusicAPSyncServerContetnsServiceStateEnd;
			}
			break;
//  MODIFY-E  [D_82400004466]僄儔乕帪傕張棟宲懕偡傞傛偆廋惓
		default:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -