|
1 /** |
|
2 * Copyright (c) 1997-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 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 /** |
|
21 @file DialogProcessor.H |
|
22 @internalTechnology |
|
23 */ |
|
24 |
|
25 #ifndef __ND_DLGPC_H__ |
|
26 #define __ND_DLGPC_H__ |
|
27 |
|
28 #include <agentdialog.h> |
|
29 #include <comms-infras/connectionsettings.h> |
|
30 |
|
31 class CDialogDestroyPCTNotification; |
|
32 |
|
33 class MDialogProcessorObserver |
|
34 /** |
|
35 MDialogProcessorObserver |
|
36 |
|
37 Mixin observer class to be derived from by classes wishing to use CDialogProcessor. |
|
38 When the relevant asynchronous function call completes the appropriate function will |
|
39 be called on the observer. Only completion functions used need to be implemented. |
|
40 @internalTechnology |
|
41 */ |
|
42 { |
|
43 public: |
|
44 IMPORT_C virtual void MDPOSelectComplete(TInt aError, const TConnectionSettings& aSettings); |
|
45 IMPORT_C virtual void MDPOSelectModemAndLocationComplete(TInt aError, const TConnectionSettings& aSettings); |
|
46 IMPORT_C virtual void MDPOWarnComplete(TInt aError, TBool aResponse); |
|
47 IMPORT_C virtual void MDPOLoginComplete(TInt aError); |
|
48 IMPORT_C virtual void MDPOAuthenticateComplete(TInt aError); |
|
49 IMPORT_C virtual void MDPOReconnectComplete(TInt aError); |
|
50 IMPORT_C virtual void MDPOReadPctComplete(TInt aError); |
|
51 IMPORT_C virtual void MDPODestroyPctComplete(TInt aError); |
|
52 IMPORT_C virtual void MDPOQoSWarningComplete(TInt aError, TBool aResponse); |
|
53 }; |
|
54 |
|
55 /** |
|
56 CDialogDestroyPCTNotification |
|
57 |
|
58 Interface between CDialogProcessor and dialog server for destroy PCT notification only. |
|
59 This needs to be a sepearate class to CDailogProcesor because it will be active |
|
60 the whole time the PCT is open. One per CDialogProcessor object and it uses the |
|
61 CScriptEngD object to return destroy PCt notification to the scrpt engine. Has an |
|
62 RGenConAgentDialogServer - class with fixed API to be implemented by dialog server. |
|
63 |
|
64 This class is private to CDialogProcessor implementation and so its definition |
|
65 has been moved to dialogprocessor.cpp |
|
66 */ |
|
67 class CDialogDestroyPCTNotification; |
|
68 |
|
69 class CDialogProcessor : public CActive |
|
70 /** |
|
71 CDialogProcessor |
|
72 |
|
73 Interface between the agent and the dialog server. One per CAgentController object and it itself |
|
74 uses the CAgentController object to return results of dialogs to state machine. Also uses a |
|
75 CScriptEngD to return results of PCT read to the script engine. Has a |
|
76 CDialogDestroyPCTNotification to request that a notification is sent when the PCT is |
|
77 destroyed. Has an RGenConAgentDialogServer - class with fixed API to be implemented by |
|
78 dialog server. |
|
79 @internalTechnology |
|
80 */ |
|
81 { |
|
82 friend class CDialogDestroyPCTNotification; |
|
83 public: |
|
84 IMPORT_C static CDialogProcessor* NewL(TInt aPriority = CActive::EPriorityStandard); |
|
85 IMPORT_C ~CDialogProcessor(); |
|
86 |
|
87 /** Call from the agent controller (which require a response) */ |
|
88 IMPORT_C void SelectConnection(MDialogProcessorObserver& aObserver, const TConnectionPrefs& aPrefs); |
|
89 IMPORT_C void SelectConnection(MDialogProcessorObserver& aObserver, const TConnectionPrefs& aPrefs, TInt aLastError); |
|
90 IMPORT_C void SelectModemAndLocation(MDialogProcessorObserver& aObserver); |
|
91 IMPORT_C void Authenticate(MDialogProcessorObserver& aObserver, TDes& aUsername, TDes& aPassword, TBool aIsReconnect); |
|
92 IMPORT_C void Reconnect(MDialogProcessorObserver& aObserver); |
|
93 |
|
94 /** Call from the states (which require a response) */ |
|
95 IMPORT_C void WarnNewConnection(MDialogProcessorObserver& aObserver, const TConnectionPrefs& aPrefs, const TDesC* aNewIapName, const TIspConnectionNames* aNewConnectionNames, TInt aLastError); |
|
96 IMPORT_C void Login(MDialogProcessorObserver& aObserver, TDes& aUsername, TDes& aPassword, TBool aIsReconnect); |
|
97 IMPORT_C void DestroyPctNotification(MDialogProcessorObserver& aObserver); |
|
98 IMPORT_C void ReadPct(MDialogProcessorObserver& aObserver, TDes& aData); |
|
99 IMPORT_C void QoSWarning(MDialogProcessorObserver& aObserver); |
|
100 // |
|
101 // Calls from the states (which do not require a response) |
|
102 // |
|
103 IMPORT_C TInt OpenPct(); |
|
104 IMPORT_C TInt WritePct(const TDesC& aData); |
|
105 IMPORT_C void ClosePct(); |
|
106 |
|
107 /** Should always call this rather than Cancel() if using PCT */ |
|
108 IMPORT_C void CancelEverything(); |
|
109 private: |
|
110 enum TDPState |
|
111 { |
|
112 ENoState =0, |
|
113 ESelectConnection, |
|
114 EWarnNewConnection, |
|
115 ESelectModemAndLocation, |
|
116 ELogin, |
|
117 EAuthentication, |
|
118 EReconnect, |
|
119 EReadPct, |
|
120 EQoSWarning |
|
121 }; |
|
122 private: |
|
123 CDialogProcessor(TInt aPriority); |
|
124 void ConstructL(); |
|
125 void CompleteDestroyPctNotification(TInt aStatus); |
|
126 void SetActive(MDialogProcessorObserver& aObserver, TDPState aState); |
|
127 |
|
128 /** From CActive */ |
|
129 virtual void DoCancel(); |
|
130 virtual void RunL(); |
|
131 private: |
|
132 MDialogProcessorObserver* iCurrentObserver; |
|
133 MDialogProcessorObserver* iPctDestructionObserver; |
|
134 CDialogDestroyPCTNotification* iDestroyPctNotification; |
|
135 RGenConAgentDialogServer iDlgServ; |
|
136 TDPState iState; |
|
137 TConnectionSettings iSettings; |
|
138 TBool iReconResponse; |
|
139 TBool iWarnNewConnectResponse; |
|
140 TBool iQoSWarningResponse; |
|
141 }; |
|
142 |
|
143 #endif |
|
144 |