diff -r 000000000000 -r 3553901f7fa8 telephonyprotocols/csdagt/script/SSCREXEC.H --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/telephonyprotocols/csdagt/script/SSCREXEC.H Tue Feb 02 01:41:59 2010 +0200 @@ -0,0 +1,162 @@ +/** +* Copyright (c) 2003-2009 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Script Executor Header. +* +* +*/ + + + +/** + @file Sscrexec.h + @internalComponent +*/ + +#ifndef __SSCREXEC_H__ +#define __SSCREXEC_H__ + +#include +#include +#include +#include "ND_STD.H" +#include "SCOMMAND.H" + +const TInt KMaxReadBufferLength=100; +const TInt KNumCommands=9; ///< number of derived command classes in SCommand.h + +struct SErrorVariable + { + const TText* iString; + TInt iValue; + }; + +// Forward declarations + +class CScriptIO; +class CScriptCharacterConverter; +class CNetDialScript; +class CGotoCommand; +class CWaitCommand; +class CLoopCommand; +class CReadPCTCommand; +class CScriptCommandBase; +class CScriptReader; +class CScriptVarMan; +class CScriptLabelMan; +class CScriptCharacterConverter; + + +class CScriptExecutor : public CActive +/** +One per CNetDialScript object. Has one of all script commands and label and variable managers. +Controls execution of the scripts. + +@internalComponent +*/ + { +public: + static CScriptExecutor* NewL(CNetDialScript* aScript,const TDesC& aCommChannel, TInt aScriptLength); + CScriptExecutor(CNetDialScript* aScript); + ~CScriptExecutor(); + // + void SetLoginParams(const TDesC& aLoginName,const TDesC& aLoginPass); + void SetScript(const TDesC& aScript); + void ScanScriptL(); + void RunScript(); + + static TInt StartScript(TAny* aPtr); + void ProcessScript(); + void CompletedWrite(TInt aStatus); + void CompletedReadL(TInt aStatus,TInt aIndex =0); + void Disconnect(); + void CreateChannel(TRequestStatus& aStatus); + void CancelCreateChannel(); + void ShutdownChannel(TRequestStatus& aStatus); + void ReConfigureAndCancelCommPort(TRequestStatus& aStatus); + void DropSignals(TRequestStatus& aStatus); + void CloseScript(); + void Close(); + inline TBool IsScriptSet() const; + // + TInt WritePct(const TDesC8& aBuffer); + void ReadPct(); + void ReadPctComplete(TInt aStatus); + void DestroyPctNotificationReceived(TInt aStatus); + void PctCancelAndClose(); + void SetReadFromPctPending(TBool aPending); + inline TBool ReadFound() const; + inline TBool ReadPctPending() const; + inline TBool RequestUsePct() const; + // + void SetVariableL(const TDesC& aName, const TDesC& aContent); + void ConfigureCommPort(TRequestStatus& aStatus, const TCommConfig& aConfiguration); + void CancelConfigureCommPort(); + void DropDTR(TRequestStatus* aStatusPtr); + + inline const TDesC& BcaStack() const; + inline TInt IapId() const; + TInt GetExcessData(TDes8& aBuffer); + + void SetRetransmittedLoginTimeout(TReal& aRetransmitLoginTimeOut); +protected: + // derived from CActive + void RunL(); + void DoCancel(); +private: + void ConstructL(const TDesC& aCommChannel, TInt aScriptLength); + void ProcessNextLinesL(); + void SetReadPctBuffer(); + void CompletedScript(TInt aStatus); + void CleanupLastCommand(); + void ConvertScriptError(TInt& aError) const; +private: + CScriptIO* iScriptIO; + CGotoCommand* iGotoCommand; + CWaitCommand* iWaitCommand; + CLoopCommand* iLoopCommand; + CReadPCTCommand* iReadCommand; + CScriptCommandBase* iCommands[KNumCommands]; + CScriptCommandBase* iLastCommand; + CScriptReader* iScriptReader; + CScriptVarMan* iVarMan; + CScriptLabelMan* iLabelMan; + CScriptCharacterConverter* iCharConv; + CNetDialScript* iScript; + TBool iInitializationFlag; + enum { + EFirstWaitCommand, + ESendingCR, + ESecondWaitCommand, + EDeactivated + } iServerRetransmitLoginPromptStatus; + CLabelSearchArray* iDummySearchArray; + TReal iRetransmitLoginTimeOut; + enum { + EIdle, + ERunning + } iScriptStatus; + TBool iReadFound; + TInt iReadReq; + TBool iReadFromPctPending; + TBuf iReadBuffer; ///< This is a straight ASCII or UNICODE buffer - no fancy character sets! + TBuf8 iDataToWrite; ///< This is an 8 bit buffer with characters converted appropriately +// Need for test dialog server only + TBuf iLoginName; + TBuf iLoginPass; + }; + +#include "SSCREXEC.INL" + +#endif