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

📄 smstransport.cpp

📁 Symbian OS C++ for Mobile Phones Volume 3 源码
💻 CPP
字号:
// Copyright (c) 2004 - 2007, Symbian Software Ltd. All rights reserved.

#include "smstransport.h"


CSmsTransport* CSmsTransport::NewL(TAny* aTransportCreateInfo)
/**
	This factory function is defined so the class can be instantiated
	via ECOM, which means it can only take a single TAny* argument.
	
	@param	aTransportCreateInfo	Pointer to an instance of
							TTransportCreateInfo, which contains the
							data required to allocate the transport.
	@return					Transport that sends messages to a remote
							device over SMS.  This is owned by the caller.
 */
	{
	const TTransportInterfaceCreateInfo& tci =
		*reinterpret_cast<TTransportInterfaceCreateInfo*>(aTransportCreateInfo);
	return New2L(tci.iObserver, *tci.iAddress, tci.iInitListen);
	}

CSmsTransport* CSmsTransport::New2L(MTransportObserver& aObserver, const TDesC& aAddress, TBool aInitListen)
/**
	Factory function allocates new initialized instance of CSmsTransport.
	The returned object can be used to send short messages to and receive
	them from a single remote device.
	
	@param	aObserver		Observer to notify about transport events.
							This is managed by the CTransport superclass.
	@param	aAddress		Remote device's address.  This should be a
							text representation of a telephone number.
	@param	aInitListen		If true, this object should start by listening
							for an incoming payload.  Otherwise, it should
							wait for its owner to send a payload to the remote
							device.
	@return					Transport that sends messages to a remote
							device via SMS.  This is owned by the caller.
	@see NewL
 */
	{
	CSmsTransport* self = new(ELeave) CSmsTransport(aObserver);
	CleanupStack::PushL(self);
	self->ConstructL(aAddress, aInitListen);
	CleanupStack::Pop(self);
	return self;
	}

CSmsTransport::CSmsTransport(MTransportObserver& aObserver)
/**
	This c'tor is defined to pass the supplied observer to the superclass.

	@param	aObserver		Observer to notify about transport events.
							This is managed by the CTransport superclass.
 */
:	CBodyTextTransport(aObserver, KUidMsgTypeSMS)
	{
	// empty.
	}

// -------- implement CMessageTransport --------

TBool CSmsTransport::ShouldUseReceivedMtmUid(TUid aMtmUid) const
/**
	Implement CMessageTransport by testing whether the supplied
	MTM UID identifies a short message MTM.

	@param	aMtmUid			Incoming message's UID.
	@return					Whether aMtmUid describes an SMS MTM.
 */
	{
	return aMtmUid == KUidMsgTypeSMS;
	}

⌨️ 快捷键说明

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