📄 clocationexamplesmsengine.h
字号:
/*
* ============================================================================
* Name : clocationexamplesmsengine.h
* Part of : Location Example
* Created : 21.05.2007 by Forum Nokia
* Description:
* Version : 1.0
* Copyright: Nokia Corporation
* ============================================================================
*/
#ifndef __CLOCATIONEXAMPLESMSENGINE_H__
#define __CLOCATIONEXAMPLESMSENGINE_H__
// INCLUDES
#include <e32base.h>
#include <msvapi.h> // MMsvSessionObserver
#include <rsendas.h> // RSendAd
#include <rsendasmessage.h> // RSendAd
#include <lbsposition.h>
// CONSTANTS
const TInt KSmsMessageLength = 512;
const TInt KAddressLength = 64;
class MSmsEngineObserver
{
public:
virtual void MessageSent() = 0;
virtual void MessageReceived(TDesC& aMsg, TDesC& aAddr) = 0;
virtual void MessageRequested(TDesC& aMsg, TDesC& aAddr) = 0;
virtual void SmsEngineError(TInt aErrorCode) = 0;
};
class CLocationExampleSmsEngine : public CBase,
public MMsvSessionObserver
{
public:
/**
* NewL
* Two-phased constructor
* @return A pointer to the created instance of CLocationExampleSmsEngine
*/
static CLocationExampleSmsEngine* NewL(MSmsEngineObserver* aObserver);
/**
* NewLC
* Two-phased constructor
* @return A pointer to the created instance of CLocationExampleSmsEngine
*/
static CLocationExampleSmsEngine* NewLC(MSmsEngineObserver* aObserver);
/**
* ~CLocationExampleSmsEngine
* Virtual Destructor
*/
virtual ~CLocationExampleSmsEngine();
public:
/**
* Sending a message.
* @param aAddr the receiver address
* @param aMsg the message to send
*/
IMPORT_C void SendSmsL(const TDesC& aAddr, const TDesC& aMsg);
private:
void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3);
public:
TInt ParseMsgRequestType(const TDesC& aMsg, TUint& aType);
TInt ParseMsgUid(const TDesC& aMsg);
TInt ParseMsgCoordinates(const TDesC& aMsg, TCoordinate& aCoordinate);
private:
/**
* ConstructL
* 2nd phase constructor
*/
void ConstructL();
/**
* CLocationExampleSmsEngine
* C++ default constructor
*/
CLocationExampleSmsEngine(MSmsEngineObserver* aObserver);
private:
// Observers SmsEngine states
MSmsEngineObserver* iObserver;
// Message body
TBuf<KSmsMessageLength> iMessage;
// Address (phonenumber)
TBuf<KAddressLength> iAddress;
// Session with the messaging server
CMsvSession* iMsvSession;
// CMsvEntry accesses and acts upon a particular Message Server entry
CMsvEntry* iMsvEntry;
// Id of a new message
TMsvId iNewMessageId;
// Id of the sent message
TMsvId iSentMessageId;
RSendAs iSendAs;
};
#endif // __CLOCATIONEXAMPLESMSENGINE_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -