telephonyprotocols/csdagt/script/SSCREXEC.CPP
branchRCL_3
changeset 65 630d2f34d719
parent 0 3553901f7fa8
child 66 07a122eea281
equal deleted inserted replaced
61:17af172ffa5f 65:630d2f34d719
     1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2003-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".
    17 
    17 
    18 /**
    18 /**
    19  @file Sscrexec.cpp 
    19  @file Sscrexec.cpp 
    20 */
    20 */
    21 
    21 
       
    22 
       
    23 #include "OstTraceDefinitions.h"
       
    24 #ifdef OST_TRACE_COMPILER_IN_USE
       
    25 #include "SSCREXECTraces.h"
       
    26 #endif
       
    27 
    22 #include "SSCREXEC.H"
    28 #include "SSCREXEC.H"
    23 #include "SIO.H"
    29 #include "SIO.H"
    24 #include "SLOGGER.H"
       
    25 #include "ND_SCR.H"
    30 #include "ND_SCR.H"
    26 
    31 
    27 _LIT(KPPPProtocolName,"PPP.");
    32 _LIT(KPPPProtocolName,"PPP.");
    28 
    33 
    29 const TInt KNumErrorVariables=9;
    34 const TInt KNumErrorVariables=9;
   171 */
   176 */
   172 	{
   177 	{
   173 	__ASSERT_DEBUG(iLastCommand==NULL, NetDialPanic(ELastCommandNotNull));
   178 	__ASSERT_DEBUG(iLastCommand==NULL, NetDialPanic(ELastCommandNotNull));
   174 	__ASSERT_DEBUG(iScriptReader!=NULL, NetDialPanic(ENullScriptReader));
   179 	__ASSERT_DEBUG(iScriptReader!=NULL, NetDialPanic(ENullScriptReader));
   175 
   180 
   176 	__FLOG_STMT(_LIT8(logString,"Script:\tBeginning");)
   181 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSCRIPTEXECUTOR_SETSCRIPT_1,"Script:\tBeginning");
   177 	__FLOG_STATIC(KNetDialLogFolder(),KNetDialLogFile(),logString());
       
   178 	iScriptReader->SetScript(aScript);
   182 	iScriptReader->SetScript(aScript);
   179 	iLoopCommand->Loop(EFalse);
   183 	iLoopCommand->Loop(EFalse);
   180 	}
   184 	}
   181 
   185 
   182 void CScriptExecutor::ScanScriptL()
   186 void CScriptExecutor::ScanScriptL()
   183 /**
   187 /**
   184 Scans script for READ command.
   188 Scans script for READ command.
   185 */
   189 */
   186 	{
   190 	{
   187 	__FLOG_STMT(_LIT8(logString1,"Script:\tScanning");)
   191 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSCRIPTEXECUTOR_SCANSCRIPTL_1,"Script:\tScanning");
   188 	__FLOG_STATIC(KNetDialLogFolder(),KNetDialLogFile(),logString1());
       
   189 
   192 
   190 	__ASSERT_DEBUG(iScriptReader!=NULL, NetDialPanic(ENullScriptReader));
   193 	__ASSERT_DEBUG(iScriptReader!=NULL, NetDialPanic(ENullScriptReader));
   191 
   194 
   192 	iReadFound=EFalse;
   195 	iReadFound=EFalse;
   193 	TInt ret=KErrNone;
   196 	TInt ret=KErrNone;
   200 		ret=iScriptReader->GetNextLine();
   203 		ret=iScriptReader->GetNextLine();
   201 		}
   204 		}
   202 
   205 
   203 	if (iReadFound)
   206 	if (iReadFound)
   204 		{
   207 		{
   205 		__FLOG_STMT(_LIT8(logString2,"Script:\tFound Read");)
   208 		OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSCRIPTEXECUTOR_SCANSCRIPTL_2,"Script:\tFound Read");
   206 		__FLOG_STATIC(KNetDialLogFolder(),KNetDialLogFile(),logString2());
       
   207 		}
   209 		}
   208 	else
   210 	else
   209 		{
   211 		{
   210 		__FLOG_STMT(_LIT8(logString3,"Script:\tDid Not Find Read");)
   212 		OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSCRIPTEXECUTOR_SCANSCRIPTL_3,"Script:\tDid Not Find Read");
   211 		__FLOG_STATIC(KNetDialLogFolder(),KNetDialLogFile(),logString3());
       
   212 		}
   213 		}
   213 
   214 
   214 	User::LeaveIfError(iScriptReader->Reset());
   215 	User::LeaveIfError(iScriptReader->Reset());
   215 	}
   216 	}
   216 
   217 
   395 		if(aStatus==KErrScriptCompleted)
   396 		if(aStatus==KErrScriptCompleted)
   396 			aStatus=KErrNone;
   397 			aStatus=KErrNone;
   397 	
   398 	
   398 		TInt error=aStatus;
   399 		TInt error=aStatus;
   399 
   400 
   400 		__FLOG_STMT(_LIT8(logString,"Script:\tScript Completed With Error %d");)
   401 		OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSCRIPTEXECUTOR_COMPLETEDSCRIPT_1,"Script:\tScript Completed With Error %d",error);
   401 		__FLOG_STATIC1(KNetDialLogFolder(),KNetDialLogFile(),TRefByValue<const TDesC8>(logString()),error);
       
   402 
   402 
   403 		ConvertScriptError(error);
   403 		ConvertScriptError(error);
   404 		PctCancelAndClose();
   404 		PctCancelAndClose();
   405 
   405 
   406 		CleanupLastCommand();
   406 		CleanupLastCommand();
   454 void CScriptExecutor::CloseScript()
   454 void CScriptExecutor::CloseScript()
   455 /**
   455 /**
   456 Close script.
   456 Close script.
   457 */
   457 */
   458 	{
   458 	{
   459 	__FLOG_STMT(_LIT8(logString,"Script:\tClosing");)
   459 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSCRIPTEXECUTOR_CLOSESCRIPT_1, "Script:\tClosing");
   460 	__FLOG_STATIC(KNetDialLogFolder(),KNetDialLogFile(),logString());
       
   461 	if (iScriptReader!=NULL)
   460 	if (iScriptReader!=NULL)
   462 		iScriptReader->Reset();		// ignore error
   461 		iScriptReader->Reset();		// ignore error
   463 	}
   462 	}
   464 
   463 
   465 void CScriptExecutor::Close()
   464 void CScriptExecutor::Close()
   594 		iReadFromPctPending=EFalse;
   593 		iReadFromPctPending=EFalse;
   595 		CompletedScript(ret);
   594 		CompletedScript(ret);
   596 		return;
   595 		return;
   597 		}
   596 		}
   598 	TPtr8 eightBitBuf(buf->Des());
   597 	TPtr8 eightBitBuf(buf->Des());
   599 #ifdef __FLOG_ACTIVE
   598 	OstTraceDefExt1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSCRIPTEXECUTOR_READPCTCOMPLETE_1, "Script:\tRead %s from PCT",eightBitBuf);
   600 	_LIT(logString,"Script:\tRead %S from PCT");
       
   601 	TBuf16<KLogBufferSize> temp;
       
   602 	temp.Copy(eightBitBuf.Left(Min(eightBitBuf.Length(),KLogBufferSize)));
       
   603 	__FLOG_STATIC1(KNetDialLogFolder(),KNetDialLogFile(),TRefByValue<const TDesC>(logString()),&temp);
       
   604 #endif
       
   605 	TInt end=iReadBuffer.Locate(KCarriageReturn);
   599 	TInt end=iReadBuffer.Locate(KCarriageReturn);
   606 	TInt spaceInBuffer=iDataToWrite.MaxLength()-iDataToWrite.Length();
   600 	TInt spaceInBuffer=iDataToWrite.MaxLength()-iDataToWrite.Length();
   607 	
   601 	
   608 	if (end<0)
   602 	if (end<0)
   609 		iDataToWrite.Append(eightBitBuf.Left(Min(spaceInBuffer,eightBitBuf.Length())));
   603 		iDataToWrite.Append(eightBitBuf.Left(Min(spaceInBuffer,eightBitBuf.Length())));