btcommtransport.cpp

来自「Symbian OS C++ for Mobile Phones v3 Exam」· C++ 代码 · 共 51 行

CPP
51
字号
// Copyright (c) 2004 - 2007, Symbian Software Ltd. All rights reserved.

#include "btcommtransport.h"


CBtCommTransport* CBtCommTransport::NewL(TAny* aTransportCreateInfo)
/**
	Factory function opens a comm port on BTCOMM::0.

	@param	aTransportCreateInfo Pointer to an instance of
							TTransportCreateInfo, which contains the
							data required to allocate the transport.
							The address field is not used.
	@return					New, initialized COMM connection.
 */
	{
	_LIT(KBtCommCsyName, "BTCOMM");
	_LIT(KBtCommPortName, "BTCOMM::0");
	
	const TTransportInterfaceCreateInfo& tci =
		*reinterpret_cast<TTransportInterfaceCreateInfo*>(aTransportCreateInfo);
	
	CBtCommTransport* self = new(ELeave) CBtCommTransport(tci.iObserver);
	CleanupStack::PushL(self);
	self->ConstructL(KBtCommCsyName, KBtCommPortName, tci.iInitListen);
	CleanupStack::Pop(self);
	return self;
	}

CBtCommTransport::CBtCommTransport(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.
 */
:	CRs232Transport(aObserver)
	{
	// empty.
	}

CBtCommTransport::~CBtCommTransport()
/**
	This d'tor is defined here to ensure that only one
	instance is generated.
 */
	{
	// resources are freed in the CRs232Transport d'tor.
	}

⌨️ 快捷键说明

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