telephonyprotocols/rawipnif/src/BcaController.cpp
branchRCL_3
changeset 19 630d2f34d719
parent 6 fc69e1e37771
child 20 07a122eea281
--- a/telephonyprotocols/rawipnif/src/BcaController.cpp	Thu Aug 19 11:03:36 2010 +0300
+++ b/telephonyprotocols/rawipnif/src/BcaController.cpp	Tue Aug 31 16:23:08 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -19,6 +19,12 @@
  @file
 */
 
+
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "BcaControllerTraces.h"
+#endif
+
 #include <e32uid.h>
 #include <nifmbuf.h>
 #include <es_ini.h>
@@ -42,7 +48,6 @@
  * Constructor. 
  */
 	: iObserver(aObserver),  
-	  iTheLogger(aTheLogger),
 	  iTxFlowControl(EFlowControlOff), 
 	  iTxContextActive(ETrue), 
 	  iSendState(EIdle),
@@ -68,11 +73,13 @@
 
 void CBcaController::BaseConstructL()
 	{
-	_LOG_L1C1(_L8("CBcaController::BaseConstructL"));
+	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROLLER_BASECONSTRUCTL_1, "CBcaController::BaseConstructL");
 	
-#ifdef RAWIP_HEADER_APPENDED_TO_PACKETS
-    iIPTagHeader = new (ELeave) CIPTagHeader(iTheLogger);
-#endif // RAWIP_HEADER_APPENDED_TO_PACKETS
+    #ifdef RAWIP_HEADER_APPENDED_TO_PACKETS         
+	iIPTagHeader = new (ELeave) CIPTagHeader();        
+    #endif // RAWIP_HEADER_APPENDED_TO_PACKETS
+	
+	iIPTagHeader = new (ELeave) CIPTagHeader(iTheLogger);
     
 #if defined (__EABI__)
     // Default value for queue length
@@ -91,6 +98,7 @@
 	UserSvr::HalFunction(EHalGroupEmulator,EEmulatorHalIntProperty,(TAny*)"rawip_KMaxTxIPPacketSize",&iMaxTxPacketSize);
 	UserSvr::HalFunction(EHalGroupEmulator,EEmulatorHalIntProperty,(TAny*)"rawip_KMaxRxIPPacketSize",&iMaxRxPacketSize);
 #endif
+		OstTraceDefExt1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROLLER_BASECONSTRUCTL_2, "RawIp ini file %S not found. Default values will be used.", KRawIpIniFile);
 	}
 
 void CBcaController::UpdateInternalFlowFlag(TFlowControl aValue)
@@ -101,13 +109,12 @@
  * @param aValue the new state of iInternalFlow
  */
 	{
-	_LOG_L1C3(_L8("CBcaController::UpdateInternalFlowFlag[NewValue=%d, iSendState=%d]"),
-		aValue, iSendState);
+	OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROLLER_UPDATEINTERNALFLOWFLAG_1, "CBcaController::UpdateInternalFlowFlag[NewValue=%d, iSendState=%d]",aValue, iSendState);
 
 	if(iTxFlowControl == aValue)
 		{
 		// C32 Sent the same indication signal twice. Nif will ignore it.
-		_LOG_L2C1(_L8("WARNING CBcaController: Received same indication twice"));
+		OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROLLER_UPDATEINTERNALFLOWFLAG_2, "WARNING CBcaController: Received same indication twice");
 		return;
 		}
 	
@@ -139,8 +146,7 @@
  * @param aValue the new state of iTxContextState
  */
 	{
-	_LOG_L1C3(_L8("CBcaController::UpdateContextStateFlag[NewValue=%d, OldValue=%d]"),
-		aValue, iTxContextActive);
+	OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROLLER_UPDATECONTEXTSTATEFLAG_1, "CBcaController::UpdateContextStateFlag[NewValue=%d, OldValue=%d]",aValue, iTxContextActive);
 	
 	if(iTxContextActive == aValue)
 		{
@@ -175,12 +181,12 @@
  *	@param aPdu a data packet
  */
 	{
-	_LOG_L1C1(_L8(">>CBcaController::Send"));
+	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROLLER_SEND_1, ">>CBcaController::Send");
 
 	// Check if NIF is shutting down
 	if (iSendState == EShuttingDown)
 		{
-		_LOG_L2C1(_L8("    ERROR: Nif is shutting down"));
+		OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROLLER_SEND_2, "    ERROR: Nif is shutting down");
 		
 		aPdu.Free();
 
@@ -191,8 +197,8 @@
 	// add it to our queue
 	if ((aPdu.Length() - aPdu.First()->Length()) > BcaSendBufferLength())
 		{
-		_LOG_L2C1(_L8("Packet is too large - discarding"));
-		_LOG_L1C1(_L8("<<CSender::Send -> Error"));
+		OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROLLER_SEND_3, "Packet is too large - discarding");
+		OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROLLER_SEND_4, "<<CSender::Send -> Error");
 
 		aPdu.Free();
 		return KErrArgument;
@@ -206,14 +212,14 @@
 		// queue becomes full the IP layer shouldnt send any more packets until it is told to
 		if (!IsSendQueueFull())
 			{
-			_LOG_L1C1(_L8("    Sender busy, appending packet to queue"));
+			OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROLLER_SEND_5, "    Sender busy, appending packet to queue");
 			//We know that flow control is off and context isnt suspended so can add to queue
 			AppendToSendQueue(aPdu);
 			
 			return IsSendQueueFull() ? KStopSending : KContinueSending;
 			}
 			
-		_LOG_L1C1(_L8("    Queue is full, upper layer is still sending packets, potential memory problems."));
+		OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROLLER_SEND_6, "    Queue is full, upper layer is still sending packets, potential memory problems.");
 		AppendToSendQueue(aPdu);
 		return KStopSending;
 		}
@@ -227,12 +233,12 @@
 		//make sure that we don't change the order of packets!
 		//first send what has already been lined up
 		RMBufChain tmpPdu;
-		_LOG_L1C1(_L8("    Packet removed from queue to send"));
+		OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROLLER_SEND_7, "    Packet removed from queue to send");
 		RemoveFromSendQueue(tmpPdu);
 		AppendToSendQueue(aPdu);
 		
 		// Update module state
-		_LOG_L2C1(_L8("     set State to ESending"));
+		OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROLLER_SEND_8, "     set State to ESending");
 		iSendState = ESending;
 		
 		BcaSend(tmpPdu);
@@ -240,13 +246,13 @@
 	else
 		{
 		// Update module state
-		_LOG_L2C1(_L8("     set State to ESending"));
+		OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROLLER_SEND_9, "     set State to ESending");
 		iSendState = ESending;
 		 
 		BcaSend(aPdu);
 		}
 		
-	_LOG_L2C1(_L8("<<CBcaController::Send - return StopSending/ContinueSending"));
+	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROLLER_SEND_10, "<<CBcaController::Send - return StopSending/ContinueSending");
 	return IsSendQueueFull() ? KStopSending : KContinueSending;
 	}
 
@@ -257,8 +263,8 @@
  *  protocol indicating that is available to send more packets.
  */
 	{
-	_LOG_L1C1(_L8("CBcaController::SendComplete"));
-	_LOG_L2C1(_L8("     set State to EIdle"));
+	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROLLER_SENDCOMPLETE_1, "CBcaController::SendComplete");
+	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROLLER_SENDCOMPLETE_2, "     set State to EIdle");
 	
 	iSendState = EIdle;
 
@@ -273,8 +279,7 @@
  * @return The Flow control state
  */
 	{
-	_LOG_L1C3(_L8("CBcaController::IsTxPossible (contextActive %d, flowcontrol %d)"), 
-		iTxContextActive, iTxFlowControl);
+	OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROLLER_ISTXPOSSIBLE_1, "CBcaController::IsTxPossible (contextActive %d, flowcontrol %d)", iTxContextActive, iTxFlowControl);
 
 	if(iTxContextActive && (iTxFlowControl == EFlowControlOff))
 		return ETrue;
@@ -289,7 +294,7 @@
  * @param aPdu a data packet
  */
 	{
-	_LOG_L1C1(_L8(">>CBcaController::Process"));
+	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROLLER_PROCESS_1, ">>CBcaController::Process");
 
 	TInt ret;
 
@@ -299,7 +304,7 @@
 	if (ret != KErrNone)
 		{
 		// Couldn't create package. Packet will be ignored...
-		_LOG_L1C2(_L8("<<CBcaController::Process couldn't create MBuf [ret=%d]"), ret);
+		OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROLLER_PROCESS_2, "<<CBcaController::Process couldn't create MBuf [ret=%d]", ret);
 		return;
 		}
 	else
@@ -316,7 +321,7 @@
 		GetObserver().Process(packet, protocolCode);
 		}
 
-	_LOG_L1C1(_L8("<<CBcaController::Process"));
+	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROLLER_PROCESS_3, "<<CBcaController::Process");
 	}
 
 void CBcaController::ResumeSending()
@@ -325,7 +330,7 @@
  *	process more packets.
  */
 	{
-	_LOG_L1C1(_L8("CBcaIoController::ResumeSending"));
+	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROLLER_RESUMESENDING_1, "CBcaIoController::ResumeSending");
 
 	// If there are still some packets in the queue to be sent, then carry
 	// on sending them.
@@ -335,11 +340,11 @@
 		if(!IsSendQueueEmpty())
 			{
 			RMBufChain tmpPdu;
-			_LOG_L1C1(_L8("    Packet removed from queue to send"));
+			OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROLLER_RESUMESENDING_2, "    Packet removed from queue to send");
 			RemoveFromSendQueue(tmpPdu);
 			
 			// Update module state
-			_LOG_L2C1(_L8("     set State to ESending"));
+			OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROLLER_RESUMESENDING_3, "     set State to ESending");
 			iSendState = ESending;
 			
 			BcaSend(tmpPdu);
@@ -358,7 +363,7 @@
 /**
  *  Used to specify the type of the IP header.
  */
- 	_LOG_L1C1(_L8("CBcaController::SetType"));
+ 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROLLER_SETTYPE_1, "CBcaController::SetType");
  	
  	iIPTagHeader->SetType(aType);	
 	}
@@ -368,7 +373,7 @@
  *  Used to add the IP header to the packet before sending to the BCA.
  */
 	{
-	_LOG_L1C1(_L8("CBcaController::AddHeader"));
+	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROLLER_ADDHEADER_1, "CBcaController::AddHeader");
 
 	iIPTagHeader->AddHeader(aDes);
 	}
@@ -380,7 +385,7 @@
  * @return The IP header that has been removed from the packet
  */
 	{
-	_LOG_L1C1(_L8("CBcaController::RemoveHeader"));
+	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBCACONTROLLER_REMOVEHEADER_1, "CBcaController::RemoveHeader");
 
 	return (iIPTagHeader->RemoveHeader(aPdu));
 	}