|
1 /* |
|
2 * Copyright (c) 2002 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: Implementation of Generic Connection Dialog Client |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "GenConAgentDialogServer.h" |
|
22 #include "ConnectionDialogsUidDefs.h" |
|
23 #include "ActiveLogin.h" |
|
24 #include "ConnectionDialogsLogger.h" |
|
25 |
|
26 #include <agentdialog.h> |
|
27 |
|
28 |
|
29 // --------------------------------------------------------- |
|
30 // ThreadFunction |
|
31 // |
|
32 // Required by Symbian's def file, stub |
|
33 // --------------------------------------------------------- |
|
34 // |
|
35 EXPORT_C TInt ThreadFunction(TAny* /*aArg*/) |
|
36 { |
|
37 return 0; |
|
38 } |
|
39 |
|
40 |
|
41 // --------------------------------------------------------- |
|
42 // StartDialogThread |
|
43 // |
|
44 // Attempt to start a thread for the socket server in the C32 process. |
|
45 // --------------------------------------------------------- |
|
46 // |
|
47 EXPORT_C TInt StartDialogThread() |
|
48 { |
|
49 return KErrNone; |
|
50 } |
|
51 |
|
52 |
|
53 // --------------------------------------------------------- |
|
54 // RGenConAgentDialogServer |
|
55 // --------------------------------------------------------- |
|
56 // |
|
57 EXPORT_C RGenConAgentDialogServer::RGenConAgentDialogServer() |
|
58 : RSessionBase(), |
|
59 iNotifier( NULL ), |
|
60 iIAP( 0 ), |
|
61 iModemId( 0 ), |
|
62 iLocationId( 0 ), |
|
63 iConNames( TIspConnectionNames() ), |
|
64 iPrefs( TConnectionPrefs() ), |
|
65 iBool( EFalse ), |
|
66 iPctBuffer( 0 ), |
|
67 iPctResponse( TPctResponse() ), |
|
68 iAuthenticationPair( TAuthenticationPair() ), |
|
69 iNewIapPrefsBuffer( TNewIapConnectionPrefs() ), |
|
70 iNotUsed( 0 ), |
|
71 iAccessPoint( 0 ) |
|
72 { |
|
73 } |
|
74 |
|
75 |
|
76 // --------------------------------------------------------- |
|
77 // ~RGenConAgentDialogServer |
|
78 // --------------------------------------------------------- |
|
79 // |
|
80 EXPORT_C RGenConAgentDialogServer::~RGenConAgentDialogServer() |
|
81 { |
|
82 delete iNotifier; |
|
83 } |
|
84 |
|
85 |
|
86 // --------------------------------------------------------- |
|
87 // Connect |
|
88 // |
|
89 // Create a session to the extended notifier framework |
|
90 // --------------------------------------------------------- |
|
91 // |
|
92 EXPORT_C TInt RGenConAgentDialogServer::Connect() |
|
93 { |
|
94 TInt error( KErrNone ); |
|
95 if ( !iNotifier ) |
|
96 { |
|
97 TRAP( error, iNotifier = new RDialogNotifier() ); |
|
98 } |
|
99 if ( !error && iNotifier ) |
|
100 { |
|
101 error = iNotifier->Connect(); |
|
102 } |
|
103 return error; |
|
104 } |
|
105 |
|
106 |
|
107 // --------------------------------------------------------- |
|
108 // Close |
|
109 // --------------------------------------------------------- |
|
110 // |
|
111 EXPORT_C void RGenConAgentDialogServer::Close() |
|
112 { |
|
113 if ( iNotifier ) |
|
114 { |
|
115 iNotifier->Close(); |
|
116 } |
|
117 } |
|
118 |
|
119 |
|
120 // --------------------------------------------------------- |
|
121 // Version |
|
122 // --------------------------------------------------------- |
|
123 // |
|
124 EXPORT_C TVersion RGenConAgentDialogServer::Version( void ) const |
|
125 { |
|
126 return( TVersion( KConnDlgMajorVersionNumber, KConnDlgMinorVersionNumber, |
|
127 KConnDlgBuildVersionNumber ) ); |
|
128 } |
|
129 |
|
130 |
|
131 // --------------------------------------------------------- |
|
132 // IapConnection |
|
133 // --------------------------------------------------------- |
|
134 // |
|
135 EXPORT_C void RGenConAgentDialogServer::IapConnection( TUint32& aIAP, |
|
136 const TConnectionPrefs& aPrefs, TRequestStatus& aStatus) |
|
137 { |
|
138 CLOG_ENTERFN( "RGenConAgentDialogServer::IapConnection 1" ); |
|
139 |
|
140 IapConnection( aIAP, aPrefs, KErrNone, aStatus ); |
|
141 |
|
142 CLOG_LEAVEFN( "RGenConAgentDialogServer::IapConnection 1" ); |
|
143 } |
|
144 |
|
145 |
|
146 // --------------------------------------------------------- |
|
147 // IapConnection |
|
148 // --------------------------------------------------------- |
|
149 // |
|
150 EXPORT_C void RGenConAgentDialogServer::IapConnection( TUint32& aIAP, |
|
151 const TConnectionPrefs& aPrefs, TInt /*aLastError*/, |
|
152 TRequestStatus& aStatus) |
|
153 { |
|
154 CLOG_ENTERFN( "RGenConAgentDialogServer::IapConnection 2" ); |
|
155 |
|
156 ::new( &iIAP ) TPckg<TUint32>( aIAP ); |
|
157 iPrefs() = aPrefs; |
|
158 |
|
159 if ( iNotifier ) |
|
160 { |
|
161 iNotifier->StartNotifierAndGetResponse( aStatus, KUidCConnDlgIap, |
|
162 iPrefs, iIAP ); |
|
163 } |
|
164 |
|
165 CLOG_LEAVEFN( "RGenConAgentDialogServer::IapConnection 2" ); |
|
166 } |
|
167 |
|
168 |
|
169 // --------------------------------------------------------- |
|
170 // WarnNewIapConnection |
|
171 // --------------------------------------------------------- |
|
172 // |
|
173 EXPORT_C void RGenConAgentDialogServer::WarnNewIapConnection( |
|
174 const TConnectionPrefs& aPrefs, |
|
175 TInt aLastError, const TDesC& aNewIapName, |
|
176 TBool& aResponse, TRequestStatus& aStatus) |
|
177 { |
|
178 CLOG_ENTERFN( "RGenConAgentDialogServer::WarnNewIapConnection" ); |
|
179 |
|
180 ::new( &iBool ) TPckg<TBool>( aResponse ); |
|
181 ::new( &iNewIapPrefsBuffer ) TPckgBuf<TNewIapConnectionPrefs>( |
|
182 TNewIapConnectionPrefs() ); |
|
183 |
|
184 iNewIapPrefsBuffer().iPrefs = aPrefs; |
|
185 iNewIapPrefsBuffer().iLastError = aLastError; |
|
186 iNewIapPrefsBuffer().iName = aNewIapName; |
|
187 |
|
188 if ( iNotifier ) |
|
189 { |
|
190 iNotifier->StartNotifierAndGetResponse( aStatus, KUidCConnDlgNewIap, |
|
191 iNewIapPrefsBuffer, iBool ); |
|
192 } |
|
193 |
|
194 CLOG_LEAVEFN( "RGenConAgentDialogServer::WarnNewIapConnection" ); |
|
195 } |
|
196 |
|
197 |
|
198 // --------------------------------------------------------- |
|
199 // Login |
|
200 // --------------------------------------------------------- |
|
201 // |
|
202 EXPORT_C void RGenConAgentDialogServer::Login( TDes& aUsername, |
|
203 TDes& aPassword, |
|
204 TBool aIsReconnect, |
|
205 TRequestStatus& aStatus ) |
|
206 { |
|
207 CLOG_ENTERFN( "RGenConAgentDialogServer::Login" ); |
|
208 |
|
209 Authenticate( aUsername, aPassword, aIsReconnect, aStatus ); |
|
210 |
|
211 CLOG_LEAVEFN( "RGenConAgentDialogServer::Login" ); |
|
212 } |
|
213 |
|
214 |
|
215 // --------------------------------------------------------- |
|
216 // Authenticate |
|
217 // --------------------------------------------------------- |
|
218 // |
|
219 EXPORT_C void RGenConAgentDialogServer::Authenticate( TDes& aUsername, |
|
220 TDes& aPassword, |
|
221 TBool /*aIsReconnect*/, |
|
222 TRequestStatus& aStatus ) |
|
223 { |
|
224 CLOG_ENTERFN( "RGenConAgentDialogServer::Authenticate" ); |
|
225 |
|
226 CActiveLogin* activeLogin = NULL; |
|
227 |
|
228 TRAPD( err, activeLogin = CActiveLogin::NewL( aUsername, aPassword ) ); |
|
229 |
|
230 iNotUsed() = ( TUint32 )activeLogin; |
|
231 |
|
232 if ( err != KErrNone ) |
|
233 { |
|
234 TRequestStatus* pS = &aStatus; |
|
235 User::RequestComplete( pS, err ); |
|
236 } |
|
237 else |
|
238 { |
|
239 activeLogin->Observe( aStatus ); |
|
240 |
|
241 TPckgBuf<TAuthenticationPairBuff>* authenticationPairBuff = |
|
242 activeLogin->GetBuffer(); |
|
243 |
|
244 if ( iNotifier ) |
|
245 { |
|
246 iNotifier->StartNotifierAndGetResponse( activeLogin->iStatus, |
|
247 KUidCConnDlgAuthentication, |
|
248 *authenticationPairBuff, |
|
249 *authenticationPairBuff ); |
|
250 } |
|
251 } |
|
252 |
|
253 CLOG_LEAVEFN( "RGenConAgentDialogServer::Authenticate" ); |
|
254 } |
|
255 |
|
256 |
|
257 // --------------------------------------------------------- |
|
258 // Reconnect |
|
259 // --------------------------------------------------------- |
|
260 // |
|
261 EXPORT_C void RGenConAgentDialogServer::Reconnect( TBool& aBool, |
|
262 TRequestStatus& aStatus ) |
|
263 { |
|
264 // Reconnect dialog has not to be showed |
|
265 aBool = EFalse; |
|
266 TRequestStatus* pS = &aStatus; |
|
267 User::RequestComplete( pS, KErrNone ); |
|
268 } |
|
269 |
|
270 |
|
271 // --------------------------------------------------------- |
|
272 // OpenPct |
|
273 // --------------------------------------------------------- |
|
274 // |
|
275 EXPORT_C TInt RGenConAgentDialogServer::OpenPct() |
|
276 { |
|
277 return( KErrNotSupported ); |
|
278 } |
|
279 |
|
280 |
|
281 // --------------------------------------------------------- |
|
282 // WritePct |
|
283 // --------------------------------------------------------- |
|
284 // |
|
285 EXPORT_C TInt RGenConAgentDialogServer::WritePct( const TDesC& /*aData*/ ) |
|
286 { |
|
287 return( KErrNone ); |
|
288 } |
|
289 |
|
290 |
|
291 // --------------------------------------------------------- |
|
292 // ReadPct |
|
293 // --------------------------------------------------------- |
|
294 // |
|
295 EXPORT_C void RGenConAgentDialogServer::ReadPct( TDes& /*aData*/, |
|
296 TRequestStatus& aStatus ) |
|
297 { |
|
298 TRequestStatus* s = &aStatus; |
|
299 User::RequestComplete( s, KErrNotSupported ); |
|
300 } |
|
301 |
|
302 |
|
303 // --------------------------------------------------------- |
|
304 // DestroyPctNotification |
|
305 // --------------------------------------------------------- |
|
306 // |
|
307 EXPORT_C void RGenConAgentDialogServer::DestroyPctNotification( |
|
308 TRequestStatus& /*aStatus*/ ) |
|
309 { |
|
310 } |
|
311 |
|
312 |
|
313 // --------------------------------------------------------- |
|
314 // ClosePct |
|
315 // --------------------------------------------------------- |
|
316 // |
|
317 EXPORT_C void RGenConAgentDialogServer::ClosePct() |
|
318 { |
|
319 } |
|
320 |
|
321 |
|
322 // --------------------------------------------------------- |
|
323 // QoSWarning |
|
324 // --------------------------------------------------------- |
|
325 // |
|
326 EXPORT_C void RGenConAgentDialogServer::QoSWarning( TBool& aResponse, |
|
327 TRequestStatus& aStatus ) |
|
328 { |
|
329 CLOG_ENTERFN( "RGenConAgentDialogServer::QoSWarning" ); |
|
330 |
|
331 ::new( &iBool ) TPckg<TBool>( aResponse ); |
|
332 if ( iNotifier ) |
|
333 { |
|
334 iNotifier->StartNotifierAndGetResponse( aStatus, KUidCConnDlgQos, |
|
335 iBool, iBool ); |
|
336 } |
|
337 |
|
338 CLOG_LEAVEFN( "RGenConAgentDialogServer::QoSWarning" ); |
|
339 } |
|
340 |
|
341 |
|
342 // --------------------------------------------------------- |
|
343 // ModemAndLocationSelection |
|
344 // --------------------------------------------------------- |
|
345 // |
|
346 EXPORT_C void RGenConAgentDialogServer::ModemAndLocationSelection( |
|
347 TUint32& aModemId, |
|
348 TUint32& aLocationId, |
|
349 TRequestStatus& aStatus) |
|
350 { |
|
351 ::new( &iModemId ) TPckg<TUint32>( aModemId ); |
|
352 ::new( &iLocationId ) TPckg<TUint32>( aLocationId ); |
|
353 |
|
354 TIspConnectionNames modemLoc; |
|
355 modemLoc.iModemName.Num( ( TInt )aModemId ); |
|
356 modemLoc.iLocationName.Num( ( TInt )aLocationId ); |
|
357 iConNames = modemLoc; |
|
358 |
|
359 if ( iNotifier ) |
|
360 { |
|
361 iNotifier->StartNotifierAndGetResponse( aStatus, |
|
362 KUidCConnDlgModemAndLocation, |
|
363 iConNames, iConNames); |
|
364 } |
|
365 } |
|
366 |
|
367 |
|
368 // --------------------------------------------------------- |
|
369 // ClosePct |
|
370 // --------------------------------------------------------- |
|
371 // |
|
372 EXPORT_C void RGenConAgentDialogServer::CancelModemAndLocationSelection() |
|
373 { |
|
374 if ( iNotifier ) |
|
375 { |
|
376 iNotifier->CancelNotifier( KUidCConnDlgModemAndLocation ); |
|
377 } |
|
378 } |
|
379 |
|
380 |
|
381 // --------------------------------------------------------- |
|
382 // CancelIapConnection |
|
383 // --------------------------------------------------------- |
|
384 // |
|
385 EXPORT_C void RGenConAgentDialogServer::CancelIapConnection() |
|
386 { |
|
387 CLOG_ENTERFN( "RGenConAgentDialogServer::CancelIapConnection" ); |
|
388 |
|
389 if ( iNotifier ) |
|
390 { |
|
391 iNotifier->CancelNotifier( KUidCConnDlgIap ); |
|
392 } |
|
393 |
|
394 CLOG_LEAVEFN( "RGenConAgentDialogServer::CancelIapConnection" ); |
|
395 } |
|
396 |
|
397 |
|
398 // --------------------------------------------------------- |
|
399 // CancelWarnNewIapConnection |
|
400 // --------------------------------------------------------- |
|
401 // |
|
402 EXPORT_C void RGenConAgentDialogServer::CancelWarnNewIapConnection() |
|
403 { |
|
404 CLOG_ENTERFN( "RGenConAgentDialogServer::CancelWarnNewIapConnection" ); |
|
405 |
|
406 if ( iNotifier ) |
|
407 { |
|
408 iNotifier->CancelNotifier( KUidCConnDlgNewIap ); |
|
409 } |
|
410 |
|
411 CLOG_LEAVEFN( "RGenConAgentDialogServer::CancelWarnNewIapConnection" ); |
|
412 } |
|
413 |
|
414 |
|
415 // --------------------------------------------------------- |
|
416 // CancelLogin |
|
417 // --------------------------------------------------------- |
|
418 // |
|
419 EXPORT_C void RGenConAgentDialogServer::CancelLogin() |
|
420 { |
|
421 CLOG_ENTERFN( "RGenConAgentDialogServer::CancelLogin" ); |
|
422 |
|
423 CancelAuthenticate(); |
|
424 |
|
425 CLOG_LEAVEFN( "RGenConAgentDialogServer::CancelLogin" ); |
|
426 } |
|
427 |
|
428 |
|
429 // --------------------------------------------------------- |
|
430 // CancelAuthenticate |
|
431 // --------------------------------------------------------- |
|
432 // |
|
433 EXPORT_C void RGenConAgentDialogServer::CancelAuthenticate() |
|
434 { |
|
435 CLOG_ENTERFN( "RGenConAgentDialogServer::CancelAuthenticate" ); |
|
436 |
|
437 if ( iNotifier ) |
|
438 { |
|
439 iNotifier->CancelNotifier( KUidCConnDlgAuthentication ); |
|
440 } |
|
441 |
|
442 CActiveLogin* activeLogin = ( CActiveLogin* )iNotUsed(); |
|
443 |
|
444 activeLogin->Cancel(); |
|
445 delete activeLogin; |
|
446 |
|
447 CLOG_LEAVEFN( "RGenConAgentDialogServer::CancelAuthenticate" ); |
|
448 } |
|
449 |
|
450 |
|
451 // --------------------------------------------------------- |
|
452 // CancelReconnect |
|
453 // --------------------------------------------------------- |
|
454 // |
|
455 EXPORT_C void RGenConAgentDialogServer::CancelReconnect() |
|
456 { |
|
457 if ( iNotifier ) |
|
458 { |
|
459 iNotifier->CancelNotifier( KUidCConnDlgReconnect ); |
|
460 } |
|
461 } |
|
462 |
|
463 |
|
464 // --------------------------------------------------------- |
|
465 // CancelReadPct |
|
466 // --------------------------------------------------------- |
|
467 // |
|
468 EXPORT_C void RGenConAgentDialogServer::CancelReadPct() |
|
469 { |
|
470 } |
|
471 |
|
472 |
|
473 // --------------------------------------------------------- |
|
474 // CancelDestroyPctNotification |
|
475 // --------------------------------------------------------- |
|
476 // |
|
477 EXPORT_C void RGenConAgentDialogServer::CancelDestroyPctNotification() |
|
478 { |
|
479 } |
|
480 |
|
481 |
|
482 // --------------------------------------------------------- |
|
483 // CancelQoSWarning |
|
484 // --------------------------------------------------------- |
|
485 // |
|
486 EXPORT_C void RGenConAgentDialogServer::CancelQoSWarning() |
|
487 { |
|
488 CLOG_ENTERFN( "RGenConAgentDialogServer::CancelQoSWarning" ); |
|
489 |
|
490 if ( iNotifier ) |
|
491 { |
|
492 iNotifier->CancelNotifier( KUidCConnDlgQos ); |
|
493 } |
|
494 |
|
495 CLOG_LEAVEFN( "RGenConAgentDialogServer::CancelQoSWarning" ); |
|
496 } |
|
497 |
|
498 |
|
499 // --------------------------------------------------------- |
|
500 // AccessPointConnection |
|
501 // --------------------------------------------------------- |
|
502 // |
|
503 EXPORT_C void RGenConAgentDialogServer::AccessPointConnection( |
|
504 TUint32& /*aAccessPoint*/, |
|
505 TInt /*aAccessPointGroup*/, |
|
506 TRequestStatus& /*aStatus*/ ) |
|
507 { |
|
508 } |
|
509 |
|
510 |
|
511 // --------------------------------------------------------- |
|
512 // CancelAccessPointConnection |
|
513 // --------------------------------------------------------- |
|
514 // |
|
515 EXPORT_C void RGenConAgentDialogServer::CancelAccessPointConnection() |
|
516 { |
|
517 CLOG_ENTERFN( "RGenConAgentDialogServer::CancelAccessPointConnection" ); |
|
518 |
|
519 if ( iNotifier ) |
|
520 { |
|
521 iNotifier->CancelNotifier( KUidCConnDlgSelectConn ); |
|
522 } |
|
523 |
|
524 CLOG_LEAVEFN( "RGenConAgentDialogServer::CancelAccessPointConnection" ); |
|
525 } |
|
526 |
|
527 |
|
528 // --------------------------------------------------------- |
|
529 // AccessPointConnection |
|
530 // --------------------------------------------------------- |
|
531 // |
|
532 EXPORT_C void RGenConAgentDialogServer::AccessPointConnection( |
|
533 TUint32& /*aAP*/, |
|
534 TUint32 aAPType, |
|
535 TUint32& aBearerAPInd, |
|
536 TUint32 aBearerAPType, |
|
537 TRequestStatus& aStatus ) |
|
538 { |
|
539 CLOG_ENTERFN( "RGenConAgentDialogServer::AccessPointConnection" ); |
|
540 |
|
541 ::new( &iIAP ) TPckg<TUint32>( aBearerAPInd ); |
|
542 ::new( &iPrefs ) TPckgBuf<TConnectionPrefs>( TConnectionPrefs() ); |
|
543 |
|
544 // Using the unused iRank to pass the ElementId |
|
545 iPrefs().iRank = aBearerAPInd; |
|
546 iPrefs().iBearerSet = aBearerAPType; |
|
547 |
|
548 // By setting aAPType to 1 application can define that |
|
549 // dialog is displayed even though there was a user connection. |
|
550 if ( aAPType == 1 ) |
|
551 { |
|
552 iPrefs().iDirection = ECommDbConnectionDirectionOutgoing; |
|
553 } |
|
554 else |
|
555 { |
|
556 iPrefs().iDirection = ECommDbConnectionDirectionUnknown; |
|
557 } |
|
558 |
|
559 if ( iNotifier ) |
|
560 { |
|
561 iNotifier->StartNotifierAndGetResponse( aStatus, |
|
562 KUidCConnDlgSelectConn, |
|
563 iPrefs, iIAP ); |
|
564 } |
|
565 |
|
566 CLOG_LEAVEFN( "RGenConAgentDialogServer::AccessPointConnection" ); |
|
567 } |
|
568 |
|
569 |
|
570 // --------------------------------------------------------- |
|
571 // Connect |
|
572 // |
|
573 // Connect to the server |
|
574 // --------------------------------------------------------- |
|
575 // |
|
576 TInt RDialogNotifier::Connect() |
|
577 { |
|
578 TInt ret = RNotifier::Connect(); |
|
579 return ret; |
|
580 } |
|
581 |
|
582 |
|
583 // End of File |