|
1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Dial Up Networking Dialog Server - Client Side Source |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file ND_DLGCL.CPP |
|
20 */ |
|
21 |
|
22 #include "ND_DLGSV.H" |
|
23 |
|
24 |
|
25 /** |
|
26 PctNotifier & PctRead concurrent requests |
|
27 |
|
28 @internalComponent |
|
29 */ |
|
30 const TUint KNdDlgSvMessageSlots=2; |
|
31 |
|
32 #ifdef _DEBUG |
|
33 #define SETIFDEBUG(R,FUNCTION) TInt R = FUNCTION |
|
34 #else |
|
35 #define SETIFDEBUG(R,FUNCTION) FUNCTION |
|
36 #endif |
|
37 |
|
38 EXPORT_C RGenConAgentDialogServer::RGenConAgentDialogServer() |
|
39 : RSessionBase(), |
|
40 iNotifier(NULL), |
|
41 iIAP(0), |
|
42 iModemId(0), |
|
43 iLocationId(0), |
|
44 iConNames(TIspConnectionNames()), |
|
45 iPrefs(TConnectionPrefs()), |
|
46 iBool(EFalse), |
|
47 iPctBuffer(0), |
|
48 iPctResponse(TPctResponse()), |
|
49 iAuthenticationPair(TAuthenticationPair()), |
|
50 iNewIapPrefsBuffer(TNewIapConnectionPrefs()), |
|
51 iNotUsed(0), |
|
52 iStatus(0), |
|
53 iAccessPoint(0) |
|
54 /** |
|
55 RGenConAgentDialogServer Constructor. |
|
56 */ |
|
57 { |
|
58 // __FLOG_OPEN(KDlgSvrLogSubsys, KDlgCliLogComponent); |
|
59 } |
|
60 |
|
61 EXPORT_C RGenConAgentDialogServer::~RGenConAgentDialogServer() |
|
62 /** |
|
63 Destructor. |
|
64 */ |
|
65 {} |
|
66 |
|
67 EXPORT_C TInt RGenConAgentDialogServer::Connect() |
|
68 /** |
|
69 Connect to the server |
|
70 |
|
71 @return KErrNone if connection succeeded and a standard error code otherwise. |
|
72 */ |
|
73 { |
|
74 TInt ret = CreateSession(KCommsDialogServerName,Version(),KNdDlgSvMessageSlots); |
|
75 |
|
76 if (ret!=KErrNone) |
|
77 { |
|
78 ret=StartDialogThread(); |
|
79 // __FLOG_1(_L("RGenConAgentDialogServer::Connect: StartDialogThread returned %d"),ret); |
|
80 if (ret!=KErrNone) |
|
81 { |
|
82 return(ret); |
|
83 } |
|
84 |
|
85 ret = CreateSession(KCommsDialogServerName,Version(),KNdDlgSvMessageSlots); |
|
86 // __FLOG_1(_L("RGenConAgentDialogServer::Connect: CreateSession returned %d"),ret); |
|
87 } |
|
88 |
|
89 return ret; |
|
90 } |
|
91 |
|
92 EXPORT_C void RGenConAgentDialogServer::Close() |
|
93 /** |
|
94 Disconnect from the notifier server. |
|
95 */ |
|
96 { |
|
97 RHandleBase::Close(); |
|
98 } |
|
99 |
|
100 EXPORT_C TVersion RGenConAgentDialogServer::Version(void) const |
|
101 /** |
|
102 Return the client side version number. |
|
103 |
|
104 @return The API version. |
|
105 */ |
|
106 { |
|
107 return(TVersion(KDialogServMajorVersionNumber,KDialogServMinorVersionNumber,KDialogServBuildVersionNumber)); |
|
108 } |
|
109 |
|
110 EXPORT_C void RGenConAgentDialogServer::ModemAndLocationSelection(TUint32 &aModemId,TUint32 &aLocationId, TRequestStatus &aStatus) |
|
111 /** |
|
112 Shows a dialog to enable the user to choose which modem and location to use for data transactions |
|
113 |
|
114 @param aModemId The id of of the record in the modem table to be used for data transactions |
|
115 @param aLocationId The id of the record in the location table to be used for the modem for data transactions |
|
116 @param aStatus Any error code, or KErrNone if no error |
|
117 */ |
|
118 { |
|
119 ::new(&iModemId) TPckg<TUint32>(aModemId); |
|
120 ::new(&iLocationId) TPckg<TUint32>(aLocationId); |
|
121 SendReceive(EGetModemAndLocation, TIpcArgs( &iModemId, &iLocationId), aStatus); |
|
122 } |
|
123 |
|
124 EXPORT_C void RGenConAgentDialogServer::IapConnection(TUint32& aIAP, const TConnectionPrefs& aPrefs, TRequestStatus& aStatus) |
|
125 /** |
|
126 Shows a connection dialog when CommDb database is of IAP type. |
|
127 |
|
128 @param aIAP The id of the IAP service. |
|
129 @param aPrefs Specifies the rank and desired direction of the connection and bearer. |
|
130 @param aStatus Any error code, or KErrNone if no error. |
|
131 */ |
|
132 { |
|
133 IapConnection(aIAP, aPrefs, KErrNone, aStatus); |
|
134 } |
|
135 |
|
136 EXPORT_C void RGenConAgentDialogServer::IapConnection(TUint32& aIAP, const TConnectionPrefs& aPrefs, TInt aLastError, TRequestStatus& aStatus) |
|
137 /** |
|
138 Shows a connection dialog when CommDb database is of IAP type. |
|
139 |
|
140 @param aIAP The id of the IAP service. |
|
141 @param aPrefs Specifies the rank and desired direction of the connection and bearer. |
|
142 @param aLastError The error with which previous connection failed. |
|
143 @param aStatus Any error code, or KErrNone if no error. |
|
144 */ |
|
145 { |
|
146 ::new(&iIAP) TPckg<TUint32>(aIAP); |
|
147 iPrefs() = aPrefs; |
|
148 |
|
149 SendReceive(EGetIAP, TIpcArgs(&iIAP, &iPrefs, (TAny*)aLastError), aStatus); |
|
150 } |
|
151 |
|
152 EXPORT_C void RGenConAgentDialogServer::WarnNewIapConnection(const TConnectionPrefs& aPrefs, TInt aLastError, const TDesC& aNewIapName, TBool& aResponse, TRequestStatus& aStatus) |
|
153 /** |
|
154 Shows a dialog warning when the CommDb database is of IAP type that the previous attempt to connect |
|
155 failed and that a new connection is to be attempted. |
|
156 |
|
157 @param aPrefs Specifies the rank and desired direction of the connection and bearer. |
|
158 @param aLastError The error with which previous connection failed. |
|
159 @param aNewIapName The name of the IAP to be used for next connection. |
|
160 @param aResponse Specifies whether to proceed with the connection or stop the connection attempt. |
|
161 @param aStatus Any error code, or KErrNone if no error. |
|
162 */ |
|
163 { |
|
164 iPrefs() = aPrefs; |
|
165 iConNames().iServiceName = aNewIapName; |
|
166 ::new(&iBool) TPckg<TBool>(aResponse); |
|
167 SendReceive(EWarnNewIAP, TIpcArgs( &iPrefs, aLastError, &iConNames().iServiceName, &iBool ), aStatus); |
|
168 } |
|
169 |
|
170 EXPORT_C void RGenConAgentDialogServer::Login(TDes& aUsername,TDes& aPassword,TBool aIsReconnect,TRequestStatus& aStatus) |
|
171 /** |
|
172 Shows a login dialog when login information for use with a script is required any the NetDial agent. |
|
173 |
|
174 @param aUsername Username. |
|
175 @param aPassword Password. |
|
176 @param aIsReconnect Whether this is a reconnect attempt or not |
|
177 @param aStatus Any error code, or KErrNone if no error. |
|
178 */ |
|
179 { |
|
180 SendReceive(EGetLogin, TIpcArgs( &aUsername, &aPassword, (TAny*)aIsReconnect), aStatus); |
|
181 } |
|
182 |
|
183 EXPORT_C void RGenConAgentDialogServer::Authenticate(TDes& aUsername,TDes& aPassword,TBool aIsReconnect,TRequestStatus& aStatus) |
|
184 /** |
|
185 Shows an authentication dialog when the NetDial agent requests PPP authentication information. |
|
186 |
|
187 @param aUsername Username. |
|
188 @param aPassword Password. |
|
189 @param aIsReconnect Whether this is a reconnect attempt or not |
|
190 @param aStatus Any error code, or KErrNone if no error. |
|
191 */ |
|
192 { |
|
193 SendReceive(EGetAuthentication, TIpcArgs(&aUsername, &aPassword, (TAny*)aIsReconnect), aStatus); |
|
194 } |
|
195 |
|
196 EXPORT_C void RGenConAgentDialogServer::Reconnect(TBool& aBool, TRequestStatus& aStatus) |
|
197 /** |
|
198 Shows a reconnect dialog when connection has been broken during data transfer. |
|
199 |
|
200 @param aResponse Specifies whether to reconnect or cancel the reconnection attempt. |
|
201 @param aStatus Any error code, or KErrNone if no error. |
|
202 */ |
|
203 { |
|
204 ::new(&iBool) TPckg<TBool>(aBool); |
|
205 |
|
206 SendReceive(EGetReconnectReq, TIpcArgs( &iBool), aStatus); |
|
207 } |
|
208 |
|
209 EXPORT_C TInt RGenConAgentDialogServer::OpenPct() |
|
210 /** |
|
211 Opens a Post Connect Terminal dialog. |
|
212 |
|
213 @return Any error code, or KErrNone if no error. |
|
214 */ |
|
215 { |
|
216 return SendReceive(EOpenPct, TIpcArgs(TIpcArgs::ENothing)); |
|
217 } |
|
218 |
|
219 EXPORT_C TInt RGenConAgentDialogServer::WritePct(const TDesC& aData) |
|
220 /** |
|
221 Called by NetDial agent to write incoming data into the PCT window. |
|
222 |
|
223 @param aData Incoming data. |
|
224 @return Any error code, or KErrNone if no error. |
|
225 */ |
|
226 { |
|
227 return SendReceive(EWritePct, TIpcArgs(&aData)); |
|
228 } |
|
229 |
|
230 EXPORT_C void RGenConAgentDialogServer::ReadPct(TDes& aData, TRequestStatus& aStatus) |
|
231 /** |
|
232 Called by NetDial agent when the script indicates that user needs to enter some information. |
|
233 |
|
234 @param aData Data entered by user. |
|
235 @param aStatus Any error code, or KErrNone if no error. |
|
236 */ |
|
237 { |
|
238 SendReceive(EReadPct, TIpcArgs( &aData), aStatus); |
|
239 } |
|
240 |
|
241 EXPORT_C void RGenConAgentDialogServer::DestroyPctNotification(TRequestStatus& aStatus) |
|
242 /** |
|
243 Used by the NetDial agent to request that if the user cancels the dialog, then the dialog gives |
|
244 notification of this. |
|
245 |
|
246 @param aStatus KErrNone if a cancel occurs, or error code otherwise. |
|
247 */ |
|
248 { |
|
249 SendReceive(EDestroyPctNotification, TIpcArgs(TIpcArgs::ENothing), aStatus); |
|
250 } |
|
251 |
|
252 EXPORT_C void RGenConAgentDialogServer::ClosePct() |
|
253 /** |
|
254 Closes the Post Connect Terminal dialog. |
|
255 |
|
256 @panic ESvrClosePctReturnedError |
|
257 */ |
|
258 { |
|
259 SETIFDEBUG(ret, SendReceive(EClosePct, TIpcArgs(TIpcArgs::ENothing))); |
|
260 __ASSERT_DEBUG(ret==KErrNone, PanicServer(ESvrClosePctReturnedError)); |
|
261 } |
|
262 |
|
263 EXPORT_C void RGenConAgentDialogServer::QoSWarning(TBool& aResponse, TRequestStatus& aStatus) |
|
264 /** |
|
265 Shows a dialog warning that the QoS of the connection has fallen below the minimum |
|
266 values specified in commdb. Expects a response from the dialog indicating if the |
|
267 connection is to be terminated. |
|
268 |
|
269 @param aResponse Specifies whether to terminate the connection or not i.e. ETrue means terminate connection |
|
270 @param aStatus Any error code, or KErrNone if no error. |
|
271 */ |
|
272 { |
|
273 ::new(&iBool) TPckg<TBool>(aResponse); |
|
274 SendReceive(EWarnQoS, TIpcArgs( &iBool), aStatus); |
|
275 } |
|
276 |
|
277 EXPORT_C void RGenConAgentDialogServer::CancelModemAndLocationSelection() |
|
278 /** |
|
279 Cancels the ModemAndLocation connection dialog. |
|
280 |
|
281 @panic ESvrCancelReturnedError. |
|
282 */ |
|
283 { |
|
284 SETIFDEBUG(ret, SendReceive(ECancelGetModemAndLocation, TIpcArgs(TIpcArgs::ENothing))); |
|
285 __ASSERT_DEBUG(ret==KErrNone, PanicServer(ESvrCancelReturnedError)); |
|
286 } |
|
287 |
|
288 EXPORT_C void RGenConAgentDialogServer::CancelIapConnection() |
|
289 /** |
|
290 Cancels the IAP type connection dialog. |
|
291 |
|
292 @panic ESvrCancelReturnedError. |
|
293 */ |
|
294 { |
|
295 SETIFDEBUG(ret, SendReceive(ECancelGetIAP, TIpcArgs(TIpcArgs::ENothing))); |
|
296 __ASSERT_DEBUG(ret==KErrNone, PanicServer(ESvrCancelReturnedError)); |
|
297 } |
|
298 |
|
299 EXPORT_C void RGenConAgentDialogServer::CancelWarnNewIapConnection() |
|
300 /** |
|
301 Cancels the IAP type new connection warning dialog. |
|
302 |
|
303 @panic ESvrCancelReturnedError Cancel WarnNewIapConnection. |
|
304 */ |
|
305 { |
|
306 SETIFDEBUG(ret, SendReceive(ECancelWarnIAP, TIpcArgs(TIpcArgs::ENothing))); |
|
307 __ASSERT_DEBUG(ret==KErrNone, PanicServer(ESvrCancelReturnedError)); |
|
308 } |
|
309 |
|
310 EXPORT_C void RGenConAgentDialogServer::CancelLogin() |
|
311 /** |
|
312 Cancels the login dialog. |
|
313 |
|
314 @panic ESvrCancelReturnedError Request Cancel for Login. |
|
315 */ |
|
316 { |
|
317 SETIFDEBUG(ret, SendReceive(ECancelLogin, TIpcArgs(TIpcArgs::ENothing))); |
|
318 __ASSERT_DEBUG(ret==KErrNone, PanicServer(ESvrCancelReturnedError)); |
|
319 } |
|
320 |
|
321 EXPORT_C void RGenConAgentDialogServer::CancelAuthenticate() |
|
322 /** |
|
323 Cancels the authentication. |
|
324 |
|
325 @panic ESvrCancelReturnedError. |
|
326 */ |
|
327 { |
|
328 SETIFDEBUG(ret, SendReceive(ECancelAuthenticate, TIpcArgs(TIpcArgs::ENothing))); |
|
329 __ASSERT_DEBUG(ret==KErrNone, PanicServer(ESvrCancelReturnedError)); |
|
330 } |
|
331 |
|
332 EXPORT_C void RGenConAgentDialogServer::CancelReconnect() |
|
333 /** |
|
334 Cancels the reconnect dialog. |
|
335 |
|
336 @panic ESvrCancelReturnedError Cancel Reconnect Request. |
|
337 */ |
|
338 { |
|
339 SETIFDEBUG(ret, SendReceive(ECancelReconnect, TIpcArgs(TIpcArgs::ENothing))); |
|
340 __ASSERT_DEBUG(ret==KErrNone, PanicServer(ESvrCancelReturnedError)); |
|
341 } |
|
342 |
|
343 EXPORT_C void RGenConAgentDialogServer::CancelReadPct() |
|
344 /** |
|
345 Cancels the Read Post Connect Terminal request. |
|
346 |
|
347 @panic ESvrCancelReturnedError Cancel Read Pct. |
|
348 */ |
|
349 { |
|
350 SETIFDEBUG(ret, SendReceive(ECancelReadPct, TIpcArgs(TIpcArgs::ENothing))); |
|
351 __ASSERT_DEBUG(ret==KErrNone, PanicServer(ESvrCancelReturnedError)); |
|
352 } |
|
353 |
|
354 EXPORT_C void RGenConAgentDialogServer::CancelDestroyPctNotification() |
|
355 /** |
|
356 Cancels the Destroy Post Connect Terminal Notification request. |
|
357 |
|
358 @panic ESvrCancelReturnedError cancel Pct Notification. |
|
359 */ |
|
360 { |
|
361 SETIFDEBUG(ret, SendReceive(ECancelDestroyPctNotification, TIpcArgs(TIpcArgs::ENothing))); |
|
362 __ASSERT_DEBUG(ret==KErrNone, PanicServer(ESvrCancelReturnedError)); |
|
363 } |
|
364 |
|
365 EXPORT_C void RGenConAgentDialogServer::CancelQoSWarning() |
|
366 /** |
|
367 Cancels the QoS warning dialog |
|
368 |
|
369 @panic ESvrCancelReturnedError Request Cancel from Server. |
|
370 */ |
|
371 { |
|
372 SETIFDEBUG(ret, SendReceive(ECancelWarnQoS, TIpcArgs(TIpcArgs::ENothing))); |
|
373 __ASSERT_DEBUG(ret==KErrNone, PanicServer(ESvrCancelReturnedError)); |
|
374 } |
|
375 |
|
376 EXPORT_C void RGenConAgentDialogServer::AccessPointConnection(TUint32& aAccessPoint, TInt aAccessPointGroup, TRequestStatus& aStatus) |
|
377 /** |
|
378 Shows a connection dialog when connection preference is of an AP type. |
|
379 |
|
380 @param aAP The id of the access point. |
|
381 @param aStatus Any error code, or KErrNone if no error. |
|
382 */ |
|
383 { |
|
384 ::new(&iAccessPoint) TPckg<TUint32>(aAccessPoint); |
|
385 SendReceive(EGetAccessPoint, TIpcArgs(&iAccessPoint,aAccessPointGroup), aStatus); |
|
386 } |
|
387 |
|
388 EXPORT_C void RGenConAgentDialogServer::CancelAccessPointConnection() |
|
389 /** |
|
390 Cancels the access point selection dialog. |
|
391 */ |
|
392 { |
|
393 SendReceive(ECancelGetAccessPoint); |
|
394 } |
|
395 |
|
396 EXPORT_C void RGenConAgentDialogServer::AccessPointConnection(TUint32& aAP, TUint32 aAPType, TUint32& aBearerAPInd, TUint32 aBearerAPType, TRequestStatus& aStatus) |
|
397 /** |
|
398 Shows a connection dialog when connection preference is of an AP type filtered on bearer-related info. |
|
399 |
|
400 @param aAP The id of the access point. |
|
401 @param aStatus Any error code, or KErrNone if no error. |
|
402 @param aBearerAPType an optional filter parameter to limit the data displayed to the client. |
|
403 */ |
|
404 { |
|
405 ::new(&iAccessPoint) TPckg<TUint32>(aAP); |
|
406 ::new(&iIAP) TPckg<TUint32>(aBearerAPInd); |
|
407 SendReceive(EGetAccessPointAP, TIpcArgs(&iAccessPoint,aAPType, &iIAP, aBearerAPType), aStatus); |
|
408 } |