24
|
1 |
/**
|
|
2 |
* Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
* Header for NetDial scripts.
|
|
16 |
*
|
|
17 |
*
|
|
18 |
*/
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
/**
|
|
23 |
@file Nd_scr.h
|
|
24 |
@internalComponent
|
|
25 |
*/
|
|
26 |
|
|
27 |
#ifndef __ND_SCR_H__
|
|
28 |
#define __ND_SCR_H__
|
|
29 |
|
|
30 |
#include <cdblen.h>
|
|
31 |
#include <etel.h>
|
|
32 |
#include <comms-infras/dialogprocessor.h>
|
|
33 |
|
|
34 |
// Forward declarations
|
|
35 |
|
|
36 |
class CDialOutSMBase;
|
|
37 |
class CCommsDbNetDialAccess;
|
|
38 |
class CDialogProcessor;
|
|
39 |
class CScriptExecutor;
|
|
40 |
|
|
41 |
class MNetDialScriptObserver
|
|
42 |
/**
|
|
43 |
MNetDialScriptObserver class is used by CNetDialScript to complete the request of the calling state.
|
|
44 |
|
|
45 |
@internalComponent
|
|
46 |
*/
|
|
47 |
{
|
|
48 |
public:
|
|
49 |
virtual void ScriptFunctionComplete(TInt aError) =0;
|
|
50 |
};
|
|
51 |
|
|
52 |
|
|
53 |
class CNetDialScript : public CActive, public MDialogProcessorObserver
|
|
54 |
/**
|
|
55 |
One of these per CDialOutSMBase object. Interfaces between state machine and the script
|
|
56 |
execution and script execution and the dialog server. Uses a CDialOutSMBase to callback on
|
|
57 |
completion of scanning and executing scripts, a CCommsDbAccess to access script and login
|
|
58 |
information from the database, and a CDialogProcessor for PCT commands. It owns a
|
|
59 |
CScriptExecutor object for controlling the script.
|
|
60 |
|
|
61 |
@internalComponent
|
|
62 |
*/
|
|
63 |
{
|
|
64 |
public:
|
|
65 |
static CNetDialScript* NewL(CCommsDbNetDialAccess* aDb,CDialogProcessor* aDlgPrc,RCall::TCommPort& aCommPort,TCommRole aRole,TInt aLength);
|
|
66 |
~CNetDialScript();
|
|
67 |
|
|
68 |
// Script-related calls to script executor
|
|
69 |
void Scan(MNetDialScriptObserver& aObserver);
|
|
70 |
TBool GetLoginParamsL(MNetDialScriptObserver& aObserver, TBool aIsReconnect);
|
|
71 |
void ExecuteL(MNetDialScriptObserver& aObserver);
|
|
72 |
void CloseScript();
|
|
73 |
void CleanupScript();
|
|
74 |
|
|
75 |
// Call from script executor on completion
|
|
76 |
virtual void ScriptOperationComplete(TInt aError);
|
|
77 |
|
|
78 |
// IO-related calls to script executor
|
|
79 |
void ConfigureCommPort(TRequestStatus& aStatus, const TCommConfig& aConfig);
|
|
80 |
void CancelConfigureCommPort();
|
|
81 |
void ReConfigureAndCancelCommPort(TRequestStatus& aStatus);
|
|
82 |
void DropSignals(TRequestStatus& aStatus);
|
|
83 |
void CreateChannel(TRequestStatus& aStatus);
|
|
84 |
void CancelCreateChannel();
|
|
85 |
void ShutdownChannel(TRequestStatus& aStatus);
|
|
86 |
TInt GetExcessData(TDes8& aBuffer);
|
|
87 |
void DropDTR(TRequestStatus* aStatusPtr);
|
|
88 |
|
|
89 |
// Calls to dialog serve
|
|
90 |
TInt WritePct(TDes& aBuffer);
|
|
91 |
void ReadPct(TDes& aBuffer);
|
|
92 |
void ClosePct();
|
|
93 |
void CancelDialogServer();
|
|
94 |
|
|
95 |
// others
|
|
96 |
inline TPtrC LoginName() const;
|
|
97 |
inline TPtrC LoginPass() const;
|
|
98 |
inline TBool UsePct() const;
|
|
99 |
inline const TDesC& BcaStack() const;
|
|
100 |
inline TInt IapId() const;
|
|
101 |
|
|
102 |
// Derived from MDialogProcessorObserver
|
|
103 |
virtual void MDPOLoginComplete(TInt aError);
|
|
104 |
virtual void MDPOReadPctComplete(TInt aError);
|
|
105 |
virtual void MDPODestroyPctComplete(TInt aError);
|
|
106 |
|
|
107 |
protected:
|
|
108 |
// Derived from CActive
|
|
109 |
virtual void RunL();
|
|
110 |
virtual void DoCancel();
|
|
111 |
|
|
112 |
private:
|
|
113 |
CNetDialScript(CCommsDbNetDialAccess* aDb,CDialogProcessor* aDlgPrc,TInt aLength);
|
|
114 |
void ConstructL(RCall::TCommPort& aCommPort,TCommRole aRole);
|
|
115 |
void GetAndSetScriptL();
|
|
116 |
void SetLoginVarsL();
|
|
117 |
void DoScanScriptL();
|
|
118 |
void GetBcaStack();
|
|
119 |
void GetIapIdL();
|
|
120 |
// calls to the dialog server
|
|
121 |
TInt OpenPct();
|
|
122 |
void DestroyPctNotification();
|
|
123 |
private:
|
|
124 |
enum
|
|
125 |
{
|
|
126 |
EIdle =0,
|
|
127 |
EScanScript,
|
|
128 |
EGetLogin,
|
|
129 |
EExecute
|
|
130 |
} iState;
|
|
131 |
|
|
132 |
CCommsDbNetDialAccess* iDb;
|
|
133 |
CDialogProcessor* iDlgPrc;
|
|
134 |
CScriptExecutor* iScriptExecutor;
|
|
135 |
MNetDialScriptObserver* iCurrentObserver;
|
|
136 |
TBool iUsePct;
|
|
137 |
TBool iPctOpen;
|
|
138 |
TBuf<KCommsDbSvrMaxUserIdPassLength> iLoginName;
|
|
139 |
TBuf<KCommsDbSvrMaxUserIdPassLength> iLoginPass;
|
|
140 |
TBuf<KCommsDbSvrMaxFieldLength> iIPAddress;
|
|
141 |
TBuf<KCommsDbSvrMaxFieldLength> iBcaStack;
|
|
142 |
TInt iIapId;
|
|
143 |
TBool iUseLoginDialog;
|
|
144 |
TInt iLength;
|
|
145 |
};
|
|
146 |
|
|
147 |
inline TPtrC CNetDialScript::LoginName() const
|
|
148 |
/**
|
|
149 |
Return login username.
|
|
150 |
*/
|
|
151 |
{
|
|
152 |
return iLoginName;
|
|
153 |
}
|
|
154 |
|
|
155 |
inline TPtrC CNetDialScript::LoginPass() const
|
|
156 |
/**
|
|
157 |
Return login password.
|
|
158 |
*/
|
|
159 |
{
|
|
160 |
return iLoginPass;
|
|
161 |
}
|
|
162 |
|
|
163 |
inline TBool CNetDialScript::UsePct() const
|
|
164 |
/**
|
|
165 |
Return PCT usage.
|
|
166 |
*/
|
|
167 |
{
|
|
168 |
return iUsePct;
|
|
169 |
}
|
|
170 |
|
|
171 |
inline const TDesC& CNetDialScript::BcaStack() const
|
|
172 |
{
|
|
173 |
return iBcaStack;
|
|
174 |
}
|
|
175 |
|
|
176 |
inline TInt CNetDialScript::IapId() const
|
|
177 |
{
|
|
178 |
return iIapId;
|
|
179 |
}
|
|
180 |
|
|
181 |
#endif
|