telephonyprotocols/rawipnif/src/Sender.cpp
branchRCL_3
changeset 7 fe8b59ab9fa0
parent 0 3553901f7fa8
child 17 1ac40e087278
equal deleted inserted replaced
6:fc69e1e37771 7:fe8b59ab9fa0
     1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    28 /**
    28 /**
    29  * Constructor. Performs standard active object initialisation.
    29  * Constructor. Performs standard active object initialisation.
    30  *
    30  *
    31  * @param aObserver Reference to the observer of this state machine
    31  * @param aObserver Reference to the observer of this state machine
    32  */
    32  */
    33 	: CActive(EPriorityStandard), 
    33 	: CActive(EPriorityUserInput), 
    34 	  iObserver(aObserver),
    34 	  iObserver(aObserver),
    35 	  iTheLogger(aTheLogger),
    35 	  iTheLogger(aTheLogger),
    36 	  iMaxPacketSise(aMaxPacketSise)
    36 	  iMaxPacketSize(aMaxPacketSise)
    37 	{
    37 	{
       
    38     // EPriorityUserInput is higher than the default priority but lower than
       
    39     // EPriorityHigh which is used on Receiving (DL having priority), however,
       
    40     // we want this to be handled in an expedited manner compared to other
       
    41     // active objects in the thread.
    38 	CActiveScheduler::Add(this);
    42 	CActiveScheduler::Add(this);
    39 	}
    43 	}
    40 
    44 
    41 CSender* CSender::NewL(CBcaIoController& aObserver, CBttLogger* aTheLogger, TInt aMaxPacketSise)
    45 CSender* CSender::NewL(CBcaIoController& aObserver, CBttLogger* aTheLogger, TInt aMaxPacketSise)
    42 /**
    46 /**
    59 /**
    63 /**
    60  * Second-phase constructor. Creates all the state objects it owns.
    64  * Second-phase constructor. Creates all the state objects it owns.
    61  */
    65  */
    62 	{
    66 	{
    63 	_LOG_L1C1(_L8("CSender::ConstructL"));
    67 	_LOG_L1C1(_L8("CSender::ConstructL"));
    64 	iSendBuffer.CreateL(iMaxPacketSise);
    68 	iSendBuffer.CreateL(iMaxPacketSize);
    65 	}
    69 	}
    66 
    70 
    67 CSender::~CSender()
    71 CSender::~CSender()
    68 /**
    72 /**
    69  * Destructor.
    73  * Destructor.
   141 	iObserver.AddHeader(iSendBuffer);
   145 	iObserver.AddHeader(iSendBuffer);
   142 #endif // RAWIP_HEADER_APPENDED_TO_PACKETS
   146 #endif // RAWIP_HEADER_APPENDED_TO_PACKETS
   143 
   147 
   144 	aPdu.Free();
   148 	aPdu.Free();
   145 
   149 
   146 	SendBuffer(iSendBuffer);
   150 	(iObserver.Bca())->Write(iStatus, iSendBuffer);
       
   151 	
       
   152 	SetActive();
   147 	}
   153 	}
   148 
   154 
   149 void CSender::SendBuffer(const TDesC8& aBuffer)
       
   150 /**
       
   151  * Sends an IP packet, contained in the specified descriptor
       
   152  *
       
   153  * @param aBuffer The IP packet to send.
       
   154  * @return Always KStopSending.
       
   155  */
       
   156 	{
       
   157 	_LOG_L1C1(_L8("CSender::SendBuffer"));
       
   158 
       
   159 	// Finally, send the packet to BCA
       
   160 	(iObserver.Bca())->Write(iStatus, aBuffer);
       
   161 	SetActive();
       
   162 	}