telephonyprotocols/psdagt/src/psdstates.cpp
changeset 42 3adadc800673
parent 0 3553901f7fa8
child 66 07a122eea281
--- a/telephonyprotocols/psdagt/src/psdstates.cpp	Thu May 27 14:05:07 2010 +0300
+++ b/telephonyprotocols/psdagt/src/psdstates.cpp	Fri Jun 11 14:49:29 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2003-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"
@@ -17,6 +17,12 @@
  @file PsdStates.cpp
 */
 
+
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "psdstatesTraces.h"
+#endif
+
 #include <comms-infras/cagentsmbase.h>
 #include <etelpckt.h>
 #include <connectprog.h>  // for circuit-switched progress enums
@@ -27,7 +33,6 @@
 #include "psdagt.h"
 #include "psdprog.h"
 
-#include "debuglogger.h"
 #include <logengevents.h>
 
 CPsdOutInit::CPsdOutInit(MAgentStateMachineEnv* aObserver,MPsdEnv* aPsdSM, MPsdCommDbAccess* aDb)
@@ -186,9 +191,8 @@
 */
 	{
 	__ASSERT_DEBUG(iSM,User::Invariant());
-	__FLOG_STMT(_LIT8(logString1,"Packet Data:\tInitialising");)
-	__FLOG_STATIC(KPsdAgxLogFolder(),KPsdAgxLogFile(),logString1());
-
+	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPSDINITBASE_DOSTARTSTATEL_1, "Packet Data:\tInitialising");
+	
 	iSMObserver->PreventConnectionRetries();
 	//
 	//	PSD AGX does not allow any more connection retries. It assumes that GenConn has
@@ -274,8 +278,7 @@
 Complete state for the initialisation state for both incomming and outgoing connections.
 */
 	{
-	__FLOG_STMT(_LIT8(logString2,"Packet Data:\tInitialised");)
-	__FLOG_STATIC(KPsdAgxLogFolder(),KPsdAgxLogFile(),logString2());
+	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPSDINITBASE_RUNL_1, "Packet Data:\tInitialised");
 	if (iStatus!=KErrNone)
 		iSMObserver->ConnectionComplete(EPsdStartingConfiguration,iStatus.Int()); // correct progress?
 	else
@@ -324,8 +327,7 @@
 		{
 		User::Leave(KErrNotSupported);
 		}
-	__FLOG_STMT(_LIT8(logString2,"Packet Data:\tChecked Config");)
-	__FLOG_STATIC(KPsdAgxLogFolder(),KPsdAgxLogFile(),logString2());
+	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPSDCHECKCONFIG_DOINITL_1,"Packet Data:\tChecked Config");
 	}
 
 void CPsdCheckConfig::RunL()
@@ -372,8 +374,7 @@
 	__ASSERT_DEBUG(iSM,User::Invariant());
 	__ASSERT_DEBUG(iSMObserver,User::Invariant());
 
-	__FLOG_STMT(_LIT8(logString1,"Packet Data:\tChecking network availability");)
-	__FLOG_STATIC(KPsdAgxLogFolder(),KPsdAgxLogFile(),logString1());
+	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPSDNETWORKCHECK_STARTSTATE_1,"Packet Data:\tChecking network availability");
 
 	iSubState = EGettingInitialStatus;
 	iSM->PacketNetwork().GetNtwkRegStatus(iStatus,iRegStatus);
@@ -392,8 +393,7 @@
 		iRegStatus==RPacketService::ENotRegisteredNotSearching || 
 		iRegStatus==RPacketService::ENotRegisteredAndNotAvailable)
 		{
-		__FLOG_STMT(_LIT8(logString1,"Packet Data:\tNo network");)
-		__FLOG_STATIC(KPsdAgxLogFolder(),KPsdAgxLogFile(),logString1());
+		OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPSDNETWORKCHECK_DONETWORKCHECK_1, "Packet Data:\tNo network");
 		JumpToRunl(KErrNetConNoGPRSNetwork);
 		return;
 		}
@@ -402,8 +402,7 @@
 		iRegStatus==RPacketService::ENotRegisteredButAvailable ||
 		iRegStatus==RPacketService::EUnknown)
 		{
-		__FLOG_STMT(_LIT8(logString1,"Packet Data:\tReg status %d. Proceeding");)
-		__FLOG_STATIC1(KPsdAgxLogFolder(),KPsdAgxLogFile(),TRefByValue<const TDesC8>(logString1()),iRegStatus);
+		OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPSDNETWORKCHECK_DONETWORKCHECK_2,"Packet Data:\tReg status %d. Proceeding",iRegStatus);
 
 		iSM->BaseEnv().CompleteState(KErrNone);
 		return;
@@ -488,8 +487,7 @@
 	{
 	__ASSERT_DEBUG(iSM,User::Invariant());
 
-	__FLOG_STMT(_LIT8(logString1,"Packet Data:\tWaiting for incoming Packet request");)
-	__FLOG_STATIC(KPsdAgxLogFolder(),KPsdAgxLogFile(),logString1);
+	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPSDWAITFORINCOMING_STARTSTATE_1,"Packet Data:\tWaiting for incoming Packet request");
 
 	iSM->PacketNetwork().NotifyContextActivationRequested(iStatus,iPdpTypeRequested,iAddressRequested);
 	SetActive();
@@ -507,8 +505,7 @@
 
 	if (iStatus==KErrNone)
 		{
-		__FLOG_STMT(_LIT8(logString1,"Packet Data:\tReceived network context activation request");)
-		__FLOG_STATIC(KPsdAgxLogFolder(),KPsdAgxLogFile(),logString1);
+		OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPSDWAITFORINCOMING_RUNL_1, "Packet Data:\tReceived network context activation request");
 		
 		if(iSM->Config().QueryIfIncommingConnectionAcceptable(iPdpTypeRequested,iAddressRequested) )
 			{
@@ -589,8 +586,7 @@
 	__ASSERT_DEBUG(iSM,User::Invariant());
 	__ASSERT_DEBUG(iSMObserver,User::Invariant());
 
-	__FLOG_STMT(_LIT8(logString1,"Packet Data:\tCreating context");)
-	__FLOG_STATIC(KPsdAgxLogFolder(),KPsdAgxLogFile(),logString1);
+	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPSDCREATECONTEXT_STARTSTATE_1, "Packet Data:\tCreating context");
 
 	RPacketService& packetNetwork = iSM->PacketNetwork();
 	RPacketContext& context = iSM->Context();
@@ -617,8 +613,7 @@
 	__ASSERT_DEBUG(iSM,User::Invariant());
 	__ASSERT_DEBUG(iSMObserver,User::Invariant());
 
-	__FLOG_STMT(_LIT8(logString1,"Packet Data:\tCompleted with error %d");)
-	__FLOG_STATIC1(KPsdAgxLogFolder(),KPsdAgxLogFile(),TRefByValue<const TDesC8>(logString1()),iStatus.Int());
+	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPSDCREATECONTEXT_RUNL_1, "Packet Data:\tCompleted with error %d",iStatus.Int());
 
 	if (iStatus==KErrNone)
 		{
@@ -687,8 +682,7 @@
 	__ASSERT_DEBUG(iSM,User::Invariant());
 	__ASSERT_DEBUG(iSMObserver,User::Invariant());
 
-	__FLOG_STMT(_LIT8(logString1,"Packet Data:\tCreating QoS");)
-	__FLOG_STATIC(KPsdAgxLogFolder(),KPsdAgxLogFile(),logString1);
+	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPSDCREATEQOS_STARTSTATE_1, "Packet Data:\tCreating QoS");
 
 	RPacketContext& context = iSM->Context();
 	RPacketQoS& qoS = iSM->QoS();
@@ -719,8 +713,7 @@
 	__ASSERT_DEBUG(iSM,User::Invariant());
 	__ASSERT_DEBUG(iSMObserver,User::Invariant());
 
-	__FLOG_STMT(_LIT8(logString1,"Packet Data:\tCompleted with error %d");)
-	__FLOG_STATIC1(KPsdAgxLogFolder(),KPsdAgxLogFile(),TRefByValue<const TDesC8>(logString1()),iStatus.Int());
+	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPSDCREATEQOS_RUNL_1,"Packet Data:\tCompleted with error %d",iStatus.Int());
 
 	if (iStatus==KErrNone)
 		{
@@ -785,8 +778,8 @@
 	__ASSERT_DEBUG(iSM,User::Invariant());
 	__ASSERT_DEBUG(iSMObserver,User::Invariant());
 
-	__FLOG_STMT(_LIT8(logString1,"Packet Data:\tActivating context");)
-	__FLOG_STATIC(KPsdAgxLogFolder(),KPsdAgxLogFile(),logString1);
+	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPSDACTIVATECONTEXT_STARTSTATE_1, "Packet Data:\tActivating context");
+	
 
 	iSMObserver->UpdateProgress(EPsdStartingActivation,KErrNone);
 	// Check if the context is already active since in the reconnect case it may be
@@ -817,8 +810,7 @@
 	__ASSERT_DEBUG(iSM,User::Invariant());
 	__ASSERT_DEBUG(iSMObserver,User::Invariant());
 
-	__FLOG_STMT(_LIT8(logString1,"Packet Data:\tCompleted with error %d");)
-	__FLOG_STATIC1(KPsdAgxLogFolder(),KPsdAgxLogFile(),TRefByValue<const TDesC8>(logString1()),iStatus.Int());
+	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPSDACTIVATECONTEXT_RUNL_1, "Packet Data:\tCompleted with error %d",iStatus.Int());
 
 	if( (iSubState==EActivatingContext&&(iStatus==KErrNone || iStatus==KErrNotSupported) )
 		||(iSubState==ELoaningCommPort&&iStatus==KErrNone) ) 
@@ -842,8 +834,7 @@
 				{
 				iSMObserver->UpdateProgress(EPsdFinishedActivation,KErrNone);// may want to do this when it really
 																// activates
-				__FLOG_STMT(_LIT8(logString1,"Packet Data:\tHanding control to PPP");)
-				__FLOG_STATIC(KPsdAgxLogFolder(),KPsdAgxLogFile(),logString1);
+				OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPSDACTIVATECONTEXT_RUNL_2,"Packet Data:\tHanding control to PPP");
 
 				iSMObserver->ServiceStarted();	
 				iSM->BaseEnv().CompleteState(KErrNone);
@@ -942,8 +933,8 @@
 	//stuff.
 	RequestStatusChange();
  
-	__FLOG_STMT(_LIT8(logString1,"Packet Data:\tCalling ConnectionComplete");)
-	__FLOG_STATIC(KPsdAgxLogFolder(),KPsdAgxLogFile(),logString1());
+	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPSDOPEN_STARTSTATE_1, "Packet Data:\tCalling ConnectionComplete");
+
 
 	iSMObserver->Notification(EAgentToNifEventTypeModifyInitialTimer,NULL);
 	iSMObserver->UpdateProgress(KConnectionOpen,KErrNone); // I think NIFMAN just swallows this after
@@ -969,8 +960,7 @@
 		if(err != KErrNone)
 			{
 #ifdef __FLOG_ACTIVE
-			_LIT8(logString1,"CPsdOpen:\t Error in getting remote party %d.");
-			__FLOG_STATIC1(KPsdAgxLogFolder(),KPsdAgxLogFile(),TRefByValue<const TDesC8>(logString1()),err);	
+			OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPSDOPEN_LOGACTIVE_1, "CPsdOpen:\t Error in getting remote party %d.",err);
 #endif
 			}
 		iEventLoggerStarted = ETrue;
@@ -1026,16 +1016,14 @@
 	{
 	__ASSERT_DEBUG(iSM && iSMObserver,User::Invariant());
 
-	__FLOG_STMT(_LIT8(logString1,"PacketData:\tStatus change to %s\0");)
-
 	if (iStatus==KErrNone)
 		{
 		switch (iContextStatus)
 			{
 		case RPacketContext::EStatusSuspended:
 			{
-			__FLOG_STMT(const TText8 value[] = "suspended";)
-			__FLOG_STATIC1(KPsdAgxLogFolder(),KPsdAgxLogFile(),TRefByValue<const TDesC8>(logString1()),&value);
+			OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPSDOPEN_RUNL_1, "PacketData:\tStatus change to suspended");
+			
 			iSMObserver->Notification(EAgentToNifEventTypeDisableTimers,NULL);	
 			iSMObserver->UpdateProgress(EPsdSuspended,KErrNone);
 			iSM->Logger()->LogDataUpdateEvent(R_LOG_CON_SUSPENDED, KLogPacketDataEventTypeUid);
@@ -1047,16 +1035,15 @@
 			// if reconnect happened then the logger is allready started and we just do an update
 			if (!iEventLoggerStarted)
 				{
-				__FLOG_STMT(const TText8 value[] = "log active";)
-				__FLOG_STATIC1(KPsdAgxLogFolder(),KPsdAgxLogFile(),TRefByValue<const TDesC8>(logString1()),&value);
+                OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPSDOPEN_RUNL_2, "PacketData:\tStatus change to log active");
 				WatchForConfigChangesL();	//those 2 functions should have been called in start state but
 				LogActive();				//RPacketContext was not EStatusActive at that time
 				}
 			else	// the LogCallStart() has completed 
 				{
 				iSM->Logger()->LogDataUpdateEvent(R_LOG_CON_CONNECTED, KLogPacketDataEventTypeUid);
-				__FLOG_STMT(const TText8 value[] = "active";)
-				__FLOG_STATIC1(KPsdAgxLogFolder(),KPsdAgxLogFile(),TRefByValue<const TDesC8>(logString1()),&value);
+				OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPSDOPEN_RUNL_3, "PacketData:\tStatus change to active");
+				
 				}
 			iSMObserver->Notification(EAgentToNifEventTypeEnableTimers,NULL);	
 			iSMObserver->UpdateProgress(KConnectionOpen,KErrNone);
@@ -1065,8 +1052,7 @@
 			break;
 		case RPacketContext::EStatusDeactivating:
 			{
-			__FLOG_STMT(const TText8 value[] = "deactivating";)
-			__FLOG_STATIC1(KPsdAgxLogFolder(),KPsdAgxLogFile(),TRefByValue<const TDesC8>(logString1()),&value);
+			OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPSDOPEN_RUNL_4, "PacketData:\tStatus change to deactivating");
 			iSMObserver->UpdateProgress(EPsdStartingDeactivation,KErrNone);
 			iSM->Logger()->LogDataUpdateEvent(R_LOG_CON_DISCONNECTING, KLogPacketDataEventTypeUid);
 			RequestStatusChange();			
@@ -1074,23 +1060,20 @@
 			break;
 		case RPacketContext::EStatusInactive:
 			{
-			__FLOG_STMT(const TText8 value[] = "inactive";)
-			__FLOG_STATIC1(KPsdAgxLogFolder(),KPsdAgxLogFile(),TRefByValue<const TDesC8>(logString1()),&value);
+			OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPSDOPEN_RUNL_5, "PacketData:\tStatus change to inactive");
 			iSM->Logger()->LogDataUpdateEvent(R_LOG_CON_DISCONNECTED, KLogPacketDataEventTypeUid);
 			}
 			break;
 		case RPacketContext::EStatusDeleted:
 			{ 
-			__FLOG_STMT(const TText8 value[] = "deleted";)
-			__FLOG_STATIC1(KPsdAgxLogFolder(),KPsdAgxLogFile(),TRefByValue<const TDesC8>(logString1()),&value);
+			OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPSDOPEN_RUNL_6, "PacketData:\tStatus change to deleted");
 			iSMObserver->UpdateProgress(EPsdFinishedDeactivation,KErrNone);
 			iSM->Logger()->LogDataUpdateEvent(R_LOG_CON_DISCONNECTED, KLogPacketDataEventTypeUid);
 			}
 			break;
 		case RPacketContext::EStatusActivating:
 			{
-			__FLOG_STMT(const TText8 value[] = "activating";)
-			__FLOG_STATIC1(KPsdAgxLogFolder(),KPsdAgxLogFile(),TRefByValue<const TDesC8>(logString1()),&value);
+			OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPSDOPEN_RUNL_7, "PacketData:\tStatus change to activating");
 			iSM->Logger()->LogDataUpdateEvent(R_LOG_CON_CONNECTING, KLogPacketDataEventTypeUid);
 			RequestStatusChange();
 			}
@@ -1195,8 +1178,7 @@
 	{
 	__ASSERT_DEBUG(iSM && iSMObserver,User::Invariant());
 
-	__FLOG_STMT(_LIT8(logString1,"Packet Data:\tRecovering Comm Port to ETel");)
-	__FLOG_STATIC(KPsdAgxLogFolder(),KPsdAgxLogFile(),logString1);
+	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPSDRECOVERCOMMPORT_STARTSTATE_1, "Packet Data:\tRecovering Comm Port to ETel");
 
 	iSMObserver->UpdateProgress(EPsdStartingDeactivation,KErrNone);
 	iSM->Context().RecoverCommPort(iStatus);
@@ -1210,8 +1192,7 @@
 	{
 	__ASSERT_DEBUG(iSM,User::Invariant());
 	// what can we do with errors at this stage in the game?
-	__FLOG_STMT(_LIT8(logString1,"Packet Data:\tRecovered Comm Port");)
-	__FLOG_STATIC(KPsdAgxLogFolder(),KPsdAgxLogFile(),logString1);
+	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPSDRECOVERCOMMPORT_RUNL_1, "Packet Data:\tRecovered Comm Port");
 
 	iSM->BaseEnv().CompleteState(KErrNone);
 	}
@@ -1279,8 +1260,7 @@
 Function called by the genconn state machine framework to start the state
 */
 	{
-	__FLOG_STMT(_LIT8(logString1,"Packet Data:\tClosing Log");)
-	__FLOG_STATIC(KPsdAgxLogFolder(),KPsdAgxLogFile(),logString1());
+	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPSDCLOSELOG_STARTSTATE_1, "Packet Data:\tClosing Log");
 	// We need to make sure that logging is finished before closing everything.
 	// forward iStatus to the logger, which will be responsible to complete iStatus when it is finished.
 			iStatus = KRequestPending;
@@ -1349,8 +1329,7 @@
 	{
 	__ASSERT_DEBUG(iSM,User::Invariant());
 
-	__FLOG_STMT(_LIT8(logString1,"Packet Data:\tDeactivating Context");)
-	__FLOG_STATIC(KPsdAgxLogFolder(),KPsdAgxLogFile(),logString1);
+	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPSDDEACTIVATION_STARTSTATE_1, "Packet Data:\tDeactivating Context");
 
 	iSM->Context().Deactivate(iStatus);
 	SetActive();
@@ -1363,9 +1342,8 @@
 	{
 	__ASSERT_DEBUG(iSM && iSMObserver,User::Invariant());
 
-	__FLOG_STMT(_LIT8(logString1,"Packet Data:\tDeactivated Context");)
-	__FLOG_STATIC(KPsdAgxLogFolder(),KPsdAgxLogFile(),logString1);
-	
+	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPSDDEACTIVATION_RUNL_1,"Packet Data:\tDeactivated Context");
+		
 	iSMObserver->UpdateProgress(EPsdFinishedDeactivation,KErrNone);
 	iSM->BaseEnv().CompleteState(KErrNone);
 
@@ -1429,8 +1407,7 @@
 	{
 	__ASSERT_DEBUG(iSM && iSMObserver,User::Invariant());
 
-	__FLOG_STMT(_LIT8(logString1,"Packet Data:\tClosing down");)
-	__FLOG_STATIC(KPsdAgxLogFolder(),KPsdAgxLogFile(),logString1);
+	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPSDCLOSURE_RUNL_1,"Packet Data:\tClosing down");
 
 	RTelServer& etel = iSM->TelServer();
 	RPhone& phone = iSM->Phone();