?? messagetransport.h
字號:
// Copyright (c) 2004 - 2007, Symbian Software Ltd. All rights reserved.
#ifndef MESSAGETRANSPORT_H
#define MESSAGETRANSPORT_H
#include <txtrich.h>
#include <mtclbase.h>
#include <msvids.h>
#include <msvapi.h>
#include <mtclreg.h>
#include <miutset.h>
#include <rsendas.h>
#include <rsendasmessage.h>
#include "transport.h"
/** Prefixed to payload sent via CMessageTransport. */
_LIT(KMtPylPrefix, "pyl:");
/** Length of messaging transport prefix in characters. */
const TInt KMtPylPrefixLen = 4;
class CMessageTransport : public CTransport, public MMsvSessionObserver
/**
Talk to a remote device via any messaging-supported MTM.
*/
{
protected:
CMessageTransport(MTransportObserver& aObserver);
void ConstructL(const TDesC& aAddress, TBool aInitListen, TBool aObserverSession = ETrue);
virtual ~CMessageTransport();
// partially implement CActive
virtual void DoCancel();
private:
// implement CTransport
virtual void DoSendPayloadL();
virtual void DoLaunchRead();
/**
Construct a message with the supplied payload and send it
to the remote device. This is an asynchronous function and
completes this AO when the message has been sent.
@param aPayloadText Payload to send to remote device.
*/
virtual void BuildAndSendMessageL(const TDesC& aPayloadText) = 0;
// implement MMsvSessionObserver
virtual void HandleSessionEventL(MMsvSessionObserver::TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3);
/**
Test whether the supplied MTM could describe a response
from the remote device. This function is used to filter
incoming messages.
@param aMtmUid Incoming message's MTM UID.
@return Whether the supplied MTM describes a
matching response type for this transport.
*/
virtual TBool ShouldUseReceivedMtmUid(TUid aMtmUid) const = 0;
/**
This function is called when the message has been accepted
by calling ShouldUseReceivedMtmUid. It extracts the plaintext
from the incoming message. The plaintext is the section of
the message which is expected to contain the payload. E.g.,
the body text for SMS and email, and the correctly-named
attachment for MMS.
@param aStore Incoming message's store. This provides
access to the message's body text and / or
attachments.
@return The plain text extracted from the store.
The caller takes ownership of this descriptor.
@see ShouldUseReceivedMtmUid
*/
virtual HBufC* ExtractPlainTextLC(CMsvStore& aStore) const = 0;
void HandleReceivedMessageL(const CMsvEntrySelection& aEntries);
void HandleReceivedMessage2L(TMsvId aEntryId);
protected:
/** Message server session used to host this observer. */
CMsvSession* iMsvSession;
/** Remote device's address. */
HBufC* iRemoteAddress;
};
// -------- debugging --------
#ifdef _DEBUG
enum TMtPanicReason
/** Invalid states which cause the messaging transports to panic. */
{
EMtDcNotListening, //<<< Attempted to cancel a read when none outstanding
EMsBsBadState, //<<< Attempted to send an MMS sendas message when not ready
EMtBsAlreadySending //<<< Attempted to send a multimedia message when already sending
};
void MtPanic(TMtPanicReason aReason);
#endif
#define __MT_ASSERT(___cond,___reason) __ASSERT_DEBUG(___cond, MtPanic(___reason))
#endif // #ifndef MESSAGETRANSPORT_H
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -