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

📄 nqmtmsengine.h

📁 本例是SYMBIAN C++一个创建短信的例子
💻 H
字号:
/*
 * CNqMtmsEngine class
 * Contact Engine for NetQin
 * Date: 2008.06.11
 * Author: Tomken
 */

#ifndef __NQ_MTMS_ENGINE_H__
#define __NQ_MTMS_ENGINE_H__

#include <e32base.h> // CBase
#include <msvapi.h>  // MMsvSessionObserver
#include <badesca.h>

#include <msvids.h>
#include <msvapi.h>

#include "NqTimer.h"

#ifdef EKA2
#include <tz.h>
#endif

#define  KNqFolderDraff               KMsvDraftEntryId                      // 0x1004
#define  KNqFolderInbox               KMsvGlobalInBoxIndexEntryId           // 0x1002
#define  KNqFolderOutbox              KMsvSentEntryId                       // 0x1005
#define  KNqFolderUnsend              KMsvGlobalOutBoxIndexEntryId          // 0x1003

#define  KNqFolderEventCreate         MMsvSessionObserver::EMsvEntriesCreated    // 0
#define  KNqFolderEventDelete         MMsvSessionObserver::EMsvEntriesDeleted    // 2
#define  KNqFolderEventChange         MMsvSessionObserver::EMsvEntriesChanged    // 1
#define  KNqFolderEventMoveTo         MMsvSessionObserver::EMsvEntriesMoved      // 3
#define  KNqFolderEventUpdate         0x100

class CClientMtmRegistry;
class CSmsClientMtm;
class CMmsClientMtm;
class MNqMtmsEngineObserver
{
public:
	virtual void HandleMtmsEngineInitialized() = 0;
	virtual void HandleMtmsEngineSessionEventL(MMsvSessionObserver::TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3) = 0;
	virtual void HandleMtmsEngineError(TInt aError) = 0;
};

class CNqMtmsEngine : public CActive, public MMsvSessionObserver, public MTimeOutNotifier
{
public:
	static CNqMtmsEngine* NewL(MNqMtmsEngineObserver& aObserver);
	~CNqMtmsEngine();
	
public:
	TBool IsReady() { return iReady; }
	TBool IsSending();
	TBool IsSms(TMsvId aId);
	TBool IsCompleted(TMsvId aId);
	TInt SendingState(TMsvId aId);

	TBool New(TMsvId aId);
	
	void SetUnread(TMsvId aId, TBool aUnread);
	TBool Unread(TMsvId aId);
	
	void GetFolderMessageInfo(TMsvId aFolderID, CMsvEntrySelection*& aArray);
	TMsvId CreateSMSMessageL(TInt aFolderId, const TDesC& aAddress, const TDesC& aName, const TDesC& aMessage);
	
	void DeleteMessageL(TMsvId entry);
	void MoveToFolderL( TMsvId aMessageId,  TMsvId aFolder );
	void CopyMessageL( TMsvId aMessageId, TMsvId aFolder );
	
	void GetMessageTime(TMsvId aId, TTime& aTime);
	void GetMessageInfo(TMsvId aId, TTime& aTime, TBool& aUnRead, TDes& aAddress, TDes& aBody);
	
	void GetMessageFromAddressL( TMsvId aMessageId, TDes& aAddress );
	void GetMessageAddressAliasL( TMsvId aMessageId, TDes& aName );
	void GetMessageTextL( TMsvId aMessageId, TDes& aMessage);
	void GetMessageIndexBodyTextL( TMsvId aMessageId, TDes& aDescription);

	TBool SendSMSL(const TDesC& aNumber, const TDesC& aAliasName, const TDesC& aBody);
	TBool ResendSmsL(TMsvId aId);
	
private: // from CActive
	virtual void DoCancel();
	virtual void RunL();

private: // from MMsvSessionObserver
	void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3);

private: // from MTimeOutNotifier
	void TimerExpired(TInt aIdentity);
	
private:
	CNqMtmsEngine(MNqMtmsEngineObserver& aObserver);
	void ConstructL();
	void CompleteConstructL();

	TBool ValidateL();
	void ScheduleL();
	
private:
	MNqMtmsEngineObserver&      iObserver;
	CMsvSession*                iSession;
	CClientMtmRegistry*         iMtmReg;
	CSmsClientMtm*              iSmsMtm;
	TBool                       iReady;
#ifdef  EKA2
	RTz                         iTz;
#endif

	enum TState
	{
		EWaitingForNothing = 0,
		EWaitingForMoving = 1,
		EWaitingForScheduling
	};
	TState                      iState;
	CMsvOperation*              iOperation;
	CNQTimer*                   iSendTimer;
	RArray<TMsvId>              iSendQueue;
};

#endif // __NQ_MTMS_ENGINE_H__

⌨️ 快捷键说明

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