1 // Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2003-2009 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". |
176 */ |
171 */ |
177 { |
172 { |
178 __ASSERT_DEBUG(iLastCommand==NULL, NetDialPanic(ELastCommandNotNull)); |
173 __ASSERT_DEBUG(iLastCommand==NULL, NetDialPanic(ELastCommandNotNull)); |
179 __ASSERT_DEBUG(iScriptReader!=NULL, NetDialPanic(ENullScriptReader)); |
174 __ASSERT_DEBUG(iScriptReader!=NULL, NetDialPanic(ENullScriptReader)); |
180 |
175 |
181 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSCRIPTEXECUTOR_SETSCRIPT_1,"Script:\tBeginning"); |
176 __FLOG_STMT(_LIT8(logString,"Script:\tBeginning");) |
|
177 __FLOG_STATIC(KNetDialLogFolder(),KNetDialLogFile(),logString()); |
182 iScriptReader->SetScript(aScript); |
178 iScriptReader->SetScript(aScript); |
183 iLoopCommand->Loop(EFalse); |
179 iLoopCommand->Loop(EFalse); |
184 } |
180 } |
185 |
181 |
186 void CScriptExecutor::ScanScriptL() |
182 void CScriptExecutor::ScanScriptL() |
187 /** |
183 /** |
188 Scans script for READ command. |
184 Scans script for READ command. |
189 */ |
185 */ |
190 { |
186 { |
191 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSCRIPTEXECUTOR_SCANSCRIPTL_1,"Script:\tScanning"); |
187 __FLOG_STMT(_LIT8(logString1,"Script:\tScanning");) |
|
188 __FLOG_STATIC(KNetDialLogFolder(),KNetDialLogFile(),logString1()); |
192 |
189 |
193 __ASSERT_DEBUG(iScriptReader!=NULL, NetDialPanic(ENullScriptReader)); |
190 __ASSERT_DEBUG(iScriptReader!=NULL, NetDialPanic(ENullScriptReader)); |
194 |
191 |
195 iReadFound=EFalse; |
192 iReadFound=EFalse; |
196 TInt ret=KErrNone; |
193 TInt ret=KErrNone; |
203 ret=iScriptReader->GetNextLine(); |
200 ret=iScriptReader->GetNextLine(); |
204 } |
201 } |
205 |
202 |
206 if (iReadFound) |
203 if (iReadFound) |
207 { |
204 { |
208 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSCRIPTEXECUTOR_SCANSCRIPTL_2,"Script:\tFound Read"); |
205 __FLOG_STMT(_LIT8(logString2,"Script:\tFound Read");) |
|
206 __FLOG_STATIC(KNetDialLogFolder(),KNetDialLogFile(),logString2()); |
209 } |
207 } |
210 else |
208 else |
211 { |
209 { |
212 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSCRIPTEXECUTOR_SCANSCRIPTL_3,"Script:\tDid Not Find Read"); |
210 __FLOG_STMT(_LIT8(logString3,"Script:\tDid Not Find Read");) |
|
211 __FLOG_STATIC(KNetDialLogFolder(),KNetDialLogFile(),logString3()); |
213 } |
212 } |
214 |
213 |
215 User::LeaveIfError(iScriptReader->Reset()); |
214 User::LeaveIfError(iScriptReader->Reset()); |
216 } |
215 } |
217 |
216 |
396 if(aStatus==KErrScriptCompleted) |
395 if(aStatus==KErrScriptCompleted) |
397 aStatus=KErrNone; |
396 aStatus=KErrNone; |
398 |
397 |
399 TInt error=aStatus; |
398 TInt error=aStatus; |
400 |
399 |
401 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSCRIPTEXECUTOR_COMPLETEDSCRIPT_1,"Script:\tScript Completed With Error %d",error); |
400 __FLOG_STMT(_LIT8(logString,"Script:\tScript Completed With Error %d");) |
|
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 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSCRIPTEXECUTOR_CLOSESCRIPT_1, "Script:\tClosing"); |
459 __FLOG_STMT(_LIT8(logString,"Script:\tClosing");) |
|
460 __FLOG_STATIC(KNetDialLogFolder(),KNetDialLogFile(),logString()); |
460 if (iScriptReader!=NULL) |
461 if (iScriptReader!=NULL) |
461 iScriptReader->Reset(); // ignore error |
462 iScriptReader->Reset(); // ignore error |
462 } |
463 } |
463 |
464 |
464 void CScriptExecutor::Close() |
465 void CScriptExecutor::Close() |
593 iReadFromPctPending=EFalse; |
594 iReadFromPctPending=EFalse; |
594 CompletedScript(ret); |
595 CompletedScript(ret); |
595 return; |
596 return; |
596 } |
597 } |
597 TPtr8 eightBitBuf(buf->Des()); |
598 TPtr8 eightBitBuf(buf->Des()); |
598 OstTraceDefExt1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSCRIPTEXECUTOR_READPCTCOMPLETE_1, "Script:\tRead %s from PCT",eightBitBuf); |
599 #ifdef __FLOG_ACTIVE |
|
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 |
599 TInt end=iReadBuffer.Locate(KCarriageReturn); |
605 TInt end=iReadBuffer.Locate(KCarriageReturn); |
600 TInt spaceInBuffer=iDataToWrite.MaxLength()-iDataToWrite.Length(); |
606 TInt spaceInBuffer=iDataToWrite.MaxLength()-iDataToWrite.Length(); |
601 |
607 |
602 if (end<0) |
608 if (end<0) |
603 iDataToWrite.Append(eightBitBuf.Left(Min(spaceInBuffer,eightBitBuf.Length()))); |
609 iDataToWrite.Append(eightBitBuf.Left(Min(spaceInBuffer,eightBitBuf.Length()))); |