www.pudn.com > LDFUCK.rar > MtmsEngine.h


/* 
* ============================================================================ 
*  Name     : CMtmsEngine from MtmsEngine.h 
*  Part of  : SMSExample 
*  Created  : 12.03.2005 by Forum Nokia 
*  Description: 
*     SMS engine handles SMS message creation, validation, sending and SMS 
*     message handling (i.e moving, deleting, copying, retreiving message data). 
*  Version  : 1.0 
*  Modify: 
*	  2007-11-18 Add 2 functions by tommy 
*  Copyright: Nokia Corporation 
* ============================================================================ 
*/ 
 
#ifndef MTMS_ENGINE 
#define MTMS_ENGINE 
 
// INCLUDES  
#include  // CBase 
#include   // MMsvSessionObserver 
#include  // CDesCArrayFlat 
 
// FORWARD DECLARATIONS 
class CClientMtmRegistry; 
class CSmsClientMtm; 
class MMtmsEngineObserver; 
 
// CLASS DECLARATION 
 
/** 
*  SMS engine. 
*/ 
class CMtmsEngine : public CActive, public MMsvSessionObserver 
{ 
public: 
	static CMtmsEngine* NewL(MMtmsEngineObserver& aObserver); 
	~CMtmsEngine(); 
public: 
	void	MoveToFolderL(TInt aIndex, TMsvId aFolder); 
	void	DeleteMessageL(TInt nCurrent); 
	void	GetMessageInfo(TInt aIndex, TDes& aDate); 
	void	SendSMSL(); 
	void	CreateSMSMessageL(const TDesC& aAddress, const TDesC& aMessage); 
	TBool	ValidateCreatedSMS(); 
 
	void	CopyMessageL( TMsvId aMessageId, TMsvId aFolder ); 
	void	GetMessageAddressL( TMsvId aMessageId, TDes& aAddress ); 
	TBool	GetMessageL( TMsvId aMessageId, TDes& aMessage ); 
	TBool	GetMessageIndexBodyTextL( TMsvId aMessageId, TDes& aMessage ); 
	void	GetFolderSMSMessageInformation(TMsvId aFolderID, CDesCArrayFlat*& aIsRead, CDesCArrayFlat*& aMobile, CDesCArrayFlat*& aMessage);	 
	RArray* GetMessageIds(); 
private: 
	void	DeleteMessageL(TMsvId aMessageId ); 
	void	MoveToFolderL( TMsvId aMessageId,  TMsvId aFolder ); 
/** 
* A constructor. 
* @param aObserver Observer of this engine. 
	*/ 
	CMtmsEngine(MMtmsEngineObserver& aObserver); 
	 
	/** 
	* ConstructL() 
	*/ 
	void ConstructL(); 
	 
	/** 
	* Creates SMS client. 
	*/ 
	void CreateMtmClientL(); 
	 
private: // from CActive 
	virtual void DoCancel(); 
	virtual void RunL(); 
	 
	 
private: // from MMsvSessionObserver 
	void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3); 
	 
private: 
	 
	// SMS client MTM interface 
	CSmsClientMtm*      iSmsMtm; 
	 
	// Observer of this engine. 
	MMtmsEngineObserver& iObserver; 
	 
	// Controls asynchronous commands in the messaging system 
	// Get progress information about the sending. 
	CMsvOperation*      iMsvOper; 
	 
	// Encapsulates an array of entry IDs. 
	CMsvEntrySelection* iEntrySelection; 
	 
	// Represents a session to the messaging server 
	CMsvSession*        iSession;    
	 
	// This registry holds details of the all the Client-side  
	// MTMs currently available on the system.  
	CClientMtmRegistry* iClientMtmReg; 
	 
	// Array of ids 
	RArray*     iIdArray; 
	 
	// Id of an SMS message 
	TMsvId              iSmsId; 
}; 
	 
	/** 
	*  CMtmsEngine SMS engine observer. 
	*/ 
class MMtmsEngineObserver 
{ 
public: 
    virtual void HandleMessageSentL(TInt aError) = 0; 
}; 
	 
	 
#endif  // MTMS_ENGINE