CActiveSocket* CActiveSocket::NewL(RSocketServ& aServer, TUint aAddrFamily, TUint aSockType, TUint aProtocol)
	{
	CActiveSocket* self = new (ELeave) CActiveSocket(aServer, aAddrFamily, aProtocol);
	CleanupStack::PushL(self);
	self->ConstructL(aSockType);
	CleanupStack::Pop(self);
	return self;
	}
示例#2
0
void CActiveSocket::NewL(RSocketServ& aSocketServ, RPointerArray<CActiveSocket>& aActiveSockets, Wap::TBearer aBearer, TWapMessageType aType, MProgressNotify* aNotify, const TSockAddr& aRemoteAddr, RConnection* aConnection)
/**
The static new function instanciates corresponding Bearers in terms of the input bearer type.
This function is used by Fully specified Wap APIs which will open a socket with a single, named remote host. 
@internalComponent
@released
@since v8.0
@param aSocketServ the shared RSocketServ instance used in the Wap messaging API which owns this bearer
@param aActiveSockets the bearer array used in the Wap messaging API which owns the bearer
@param aBearer the bearer to listen on (use EAll for all bearers)
@param aType the type of the wap message that will received
@param aNotify the instance to be notified when a wap message is received
@param aRemoteAddr the remote host to be communicate with
@param aConnection the shared connection from Wap messaging API client
*/
	{
	//Instanciate the corresponding
	switch(aBearer)
		{
		case Wap::ESMS7:
		case Wap::ESMS:
		case Wap::EWAPSMS7:
		case Wap::EWAPSMS:
			{
			CActiveSocket* me = new(ELeave) CActiveSocketSMS(aSocketServ, aNotify, aBearer, aRemoteAddr);
			CleanupStack::PushL(me);
			me->ConstructL(aType);
            aActiveSockets.AppendL(me);
			CleanupStack::Pop(me);
			break;
			}
		case Wap::EIP:
			{
			CActiveSocket* me = new(ELeave) CActiveSocketUDP(aSocketServ, aNotify, aBearer, aRemoteAddr, aConnection);
			CleanupStack::PushL(me);
			me->ConstructL(aType);
            aActiveSockets.AppendL(me);
			CleanupStack::Pop(me);
			break;
			}
		case Wap::EAll:
			{
			CActiveSocket* me = new(ELeave) CActiveSocketUDP(aSocketServ, aNotify, aBearer, aRemoteAddr, aConnection);
			CleanupStack::PushL(me);
			me->ConstructL(aType);
			CActiveSocket* me1 = new(ELeave) CActiveSocketSMS(aSocketServ, aNotify, aBearer, aRemoteAddr);
			CleanupStack::PushL(me1);
			me1->ConstructL(aType);
            aActiveSockets.ReserveL(2); // pre-allocate the memory    
			aActiveSockets.AppendL(me1);
            CleanupStack::Pop(me1);
            aActiveSockets.AppendL(me);
            CleanupStack::Pop(me);
			break;
			}
		default:
		    {
		    OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CACTIVESOCKET_NEWL_1_1, "CActiveSocket::NewL Unknown Bearer Type");
			User::Leave(Wap::EBearerError);
		    }
		}
	}