|
1 /* |
|
2 * Copyright (c) 2006-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: The view class for ConnTest |
|
15 * Implements command handling, menu initializing and view activation |
|
16 * |
|
17 */ |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <aknViewAppUi.h> |
|
21 #include <akntitle.h> |
|
22 #include <avkon.hrh> |
|
23 #include <AknGlobalNote.h> |
|
24 |
|
25 #include <ConnTest.rsg> |
|
26 #include "ConnTestView.h" |
|
27 #include "ConnTestContainer.h" |
|
28 #include "CustomPrefsItemList.h" |
|
29 #include "CustomPrefsData.h" |
|
30 #include "SettingItemList.h" |
|
31 #include "SettingData.h" |
|
32 #include "SocketsEngine.h" |
|
33 #include "Utils.h" |
|
34 #include <wlanmgmtclient.h> |
|
35 #include "ConnTestAppUi.h" |
|
36 |
|
37 |
|
38 // CONSTANTS |
|
39 |
|
40 |
|
41 // ================= MEMBER FUNCTIONS ======================= |
|
42 |
|
43 |
|
44 // --------------------------------------------------------- |
|
45 // CConnTestView::CConnTestView(const TUid aViewId) |
|
46 // Constructor |
|
47 // --------------------------------------------------------- |
|
48 // |
|
49 CConnTestView::CConnTestView(const TUid aViewId) |
|
50 : iViewId(aViewId), iWaiter( NULL ) |
|
51 { |
|
52 RDebug::Print(_L("ConnTest: CConnTestView::CConnTestView( aViewId )")); |
|
53 } |
|
54 |
|
55 // --------------------------------------------------------- |
|
56 // CConnTestView::CConnTestView(const TUid aViewId, |
|
57 // CSettingData* aSettings, |
|
58 // CCustomPrefsData* aCustomPrefs) |
|
59 // Constructor |
|
60 // --------------------------------------------------------- |
|
61 // |
|
62 CConnTestView::CConnTestView(const TUid aViewId, CSettingData* aSettings, CCustomPrefsData* aCustomPrefs) |
|
63 : iViewId(aViewId), iSettingData(aSettings), iCustomPrefsData(aCustomPrefs), iWaiter( NULL ) |
|
64 { |
|
65 RDebug::Print(_L("ConnTest: CConnTestView::CConnTestView( aViewId, aSettings, aCustomPrefs )")); |
|
66 } |
|
67 |
|
68 // --------------------------------------------------------- |
|
69 // CConnTestView::ConstructL() |
|
70 // EPOC two-phased constructor |
|
71 // --------------------------------------------------------- |
|
72 // |
|
73 void CConnTestView::ConstructL() |
|
74 { |
|
75 RDebug::Print(_L("ConnTest: CConnTestView::ConstructL")); |
|
76 BaseConstructL( R_CONNTEST_VIEW1 ); |
|
77 iSendData = HBufC8::NewL(KMaxSendBuffer); |
|
78 RDebug::Print(_L("ConnTest: CConnTestView::ConstructL iWlanMgmtClient")); |
|
79 TRAPD(err,iWlanMgmtClient = CWlanMgmtClient::NewL()); |
|
80 if (err == KErrNone) |
|
81 { |
|
82 iSupportsWlan = ETrue; |
|
83 } |
|
84 else |
|
85 { |
|
86 iSupportsWlan = EFalse; |
|
87 } |
|
88 } |
|
89 |
|
90 // --------------------------------------------------------- |
|
91 // CConnTestView::~CConnTestView() |
|
92 // Destructor |
|
93 // --------------------------------------------------------- |
|
94 // |
|
95 CConnTestView::~CConnTestView() |
|
96 { |
|
97 RDebug::Print(_L("ConnTest: CConnTestView::~CConnTestView")); |
|
98 if ( iContainer ) |
|
99 { |
|
100 AppUi()->RemoveFromViewStack( *this, iContainer ); |
|
101 } |
|
102 |
|
103 delete iSocketsEngine; |
|
104 delete iContainer; |
|
105 delete iSettingsListBox; |
|
106 delete iCustomPrefsListBox; |
|
107 // delete iSettingData; owned now by CConnTestDocument |
|
108 if(iSendData) |
|
109 { |
|
110 delete iSendData; |
|
111 iSendData = NULL; |
|
112 |
|
113 if ( iSupportsWlan && iWlanMgmtClient ) |
|
114 { |
|
115 iWlanMgmtClient->CancelNotifications(); |
|
116 delete iWlanMgmtClient; |
|
117 } |
|
118 } |
|
119 } |
|
120 |
|
121 // --------------------------------------------------------- |
|
122 // TUid CConnTestView::Id() |
|
123 // Return id of this view instance |
|
124 // --------------------------------------------------------- |
|
125 // |
|
126 TUid CConnTestView::Id() const |
|
127 { |
|
128 //return KViewId; |
|
129 return iViewId; |
|
130 } |
|
131 |
|
132 // --------------------------------------------------------- |
|
133 // CConnTestView::HandleCommandL(TInt aCommand) |
|
134 // Command handler |
|
135 // --------------------------------------------------------- |
|
136 // |
|
137 void CConnTestView::HandleCommandL(TInt aCommand) |
|
138 { |
|
139 switch ( aCommand ) |
|
140 { |
|
141 case EAknSoftkeyExit: |
|
142 iSocketsEngine->Cancel(); |
|
143 AppUi()->HandleCommandL(EEikCmdExit); |
|
144 break; |
|
145 |
|
146 case EAknSoftkeyOk: |
|
147 case EAknSoftkeyBack: |
|
148 // Same actions for OK and Back keys. These are called |
|
149 // from settings or Ext Connection Preferences view. |
|
150 if (iActiveContainer == ESettingsContainer) |
|
151 { |
|
152 // Store settings and update the values |
|
153 // in socket engine. |
|
154 iSettingsListBox->StoreSettingsL(); |
|
155 iSocketsEngine->SetConnectionData(iSettingData); |
|
156 } |
|
157 else // ECustomPrefsContainer |
|
158 { |
|
159 // Store the custom preferences and update the values |
|
160 // in socket engine. |
|
161 iCustomPrefsListBox->StoreSettingsL(); |
|
162 iSocketsEngine->SetCustomPrefsData(iCustomPrefsData); |
|
163 } |
|
164 SwapContainerL(EOutputContainer); |
|
165 break; |
|
166 |
|
167 case EConnTestCmdStartInterface: |
|
168 // Start the interface |
|
169 iSocketsEngine->StartInterfaceL(CSocketsEngine::EAskIap); |
|
170 break; |
|
171 |
|
172 case EConnTestCmdStartSnap: |
|
173 //start connection with snap |
|
174 iSocketsEngine->StartConnWithSnapL(); |
|
175 break; |
|
176 |
|
177 case EConnTestCmdStartInterfaceExtConnPrefs: |
|
178 // Start the interface using Extended Connection Preferences |
|
179 RDebug::Print(_L("ConnTest: Start ExtConnPrefs")); |
|
180 iSocketsEngine->StartInterfaceL(CSocketsEngine::EExtPrefs); |
|
181 break; |
|
182 |
|
183 case EConnTestCmdStartInternet: |
|
184 // Start the interface using Extended Connection Preferences |
|
185 RDebug::Print(_L("ConnTest: Start Internet")); |
|
186 iSocketsEngine->StartInterfaceL(CSocketsEngine::EExtPrefsInternet); |
|
187 break; |
|
188 |
|
189 case EConnTestCmdStartInterfaceNoPrefs: |
|
190 // Start the interface |
|
191 iSocketsEngine->StartInterfaceL(CSocketsEngine::ENoPrefs); |
|
192 break; |
|
193 |
|
194 case EConnTestCmdStartByNetworkId: |
|
195 // Start the interface with network id |
|
196 iSocketsEngine->StartInterfaceL(CSocketsEngine::ENetworkId); |
|
197 break; |
|
198 |
|
199 case EConnTestCmdStopInterface: |
|
200 // Stop the interface with RConnection::Stop |
|
201 iSocketsEngine->StopInterfaceL(); |
|
202 break; |
|
203 |
|
204 case EConnTestCmdStartForClose: |
|
205 // Stop the interface with RConnection::Close |
|
206 iSocketsEngine->StartCloseInterfaceL(); |
|
207 break; |
|
208 |
|
209 case EConnTestCmdCloseInterface: |
|
210 // Stop the interface with RConnection::Close |
|
211 iSocketsEngine->CloseInterface(); |
|
212 break; |
|
213 |
|
214 case EConnTestCmdConnectionInfo: |
|
215 // Print information about the active connections |
|
216 iSocketsEngine->ConnectionInfoL(); |
|
217 break; |
|
218 |
|
219 case EConnTestCmdInterfaceInfo: |
|
220 // Print information about interfaces. Show wait note here, |
|
221 // because this usually takes a while. |
|
222 { |
|
223 TInt permanentNoteId; |
|
224 CAknGlobalNote* globalNote = CAknGlobalNote::NewL(); |
|
225 CleanupStack::PushL(globalNote); |
|
226 globalNote->SetSoftkeys(R_AVKON_SOFTKEYS_EMPTY); |
|
227 permanentNoteId = globalNote->ShowNoteL( EAknGlobalWaitNote, _L("Fetching information...") ); |
|
228 |
|
229 iSocketsEngine->InterfaceInfoL(); |
|
230 |
|
231 globalNote->CancelNoteL(permanentNoteId); |
|
232 CleanupStack::PopAndDestroy(globalNote); // globalNote |
|
233 } |
|
234 break; |
|
235 |
|
236 case EConnTestCmdClearOutputWindow: |
|
237 // Clear the output window |
|
238 iContainer->ClearOutputWindow(); |
|
239 break; |
|
240 |
|
241 case EConnTestCmdSettings: |
|
242 // Display settings list |
|
243 SwapContainerL(ESettingsContainer); |
|
244 break; |
|
245 |
|
246 case EConnTestCmdSetCustomPrefs: |
|
247 // Display Custom Preferences list |
|
248 SwapContainerL(ECustomPrefsContainer); |
|
249 break; |
|
250 |
|
251 case EConnTestCmdMigrate: |
|
252 iSocketsEngine->Migrate(); |
|
253 break; |
|
254 case EConnTestCmdIgnore: |
|
255 iSocketsEngine->Ignore(); |
|
256 break; |
|
257 case EConnTestCmdAccept: |
|
258 iSocketsEngine->AcceptCarrier(); |
|
259 break; |
|
260 case EConnTestCmdReject: |
|
261 iSocketsEngine->RejectCarrier(); |
|
262 break; |
|
263 case EConnTestCmdConnect: |
|
264 // Connect the socket |
|
265 iSocketsEngine->ConnectL(); |
|
266 break; |
|
267 |
|
268 case EConnTestCmdDisconnect: |
|
269 // Disconnect the socket but do not stop the interface |
|
270 iSocketsEngine->Disconnect(); |
|
271 break; |
|
272 |
|
273 case EConnTestCmdListen: |
|
274 // Create TCP socket that listens and receives raw TCP data |
|
275 iSocketsEngine->ListenL(); |
|
276 break; |
|
277 |
|
278 case EConnTestCmdSendHttpGet: |
|
279 { |
|
280 // Send HTTP Get |
|
281 iSocketsEngine->SendHttpRequestOverSocketL(EFalse, EFalse); |
|
282 } |
|
283 break; |
|
284 |
|
285 case EConnTestCmdSendPerformanceHttpGet: |
|
286 { |
|
287 // Send HTTP Get |
|
288 if (iSocketsEngine->GetSocketEngineState() == CSocketsEngine::EConnected) |
|
289 { |
|
290 iSocketsEngine->SendHttpRequestOverSocketL(EFalse, ETrue); |
|
291 } |
|
292 } |
|
293 break; |
|
294 |
|
295 case EConnTestCmdSendHttpPost: |
|
296 { |
|
297 // Send HTTP Post |
|
298 iSocketsEngine->SendHttpRequestOverSocketL(ETrue, ETrue); |
|
299 } |
|
300 break; |
|
301 |
|
302 case EConnTestCmdSendRawData: |
|
303 // Send datagrams |
|
304 CreateDataPacket(); |
|
305 SendDataL(); |
|
306 break; |
|
307 |
|
308 case EConnTestCmdHttpFrameworkGet: |
|
309 // Send HTTP request (for testing the HTTP framework) |
|
310 iSocketsEngine->SendHttpFrameworkRequestL(EFalse, EFalse, EFalse); |
|
311 break; |
|
312 |
|
313 case EConnTestCmdHttpFrameworkPost: |
|
314 // Send HTTP request (for testing the HTTP framework) |
|
315 iSocketsEngine->SendHttpFrameworkRequestL(ETrue, EFalse, EFalse); |
|
316 break; |
|
317 |
|
318 case EConnTestCmdHttpFrameworkSecureGet: |
|
319 // Send HTTP request (for testing the HTTP framework) |
|
320 iSocketsEngine->SendHttpFrameworkRequestL(EFalse, EFalse, ETrue); |
|
321 break; |
|
322 |
|
323 case EConnTestCmdHttpFrameworkPerformanceGet: |
|
324 // Send HTTP request (for testing the HTTP framework) |
|
325 iSocketsEngine->SendHttpFrameworkRequestL(EFalse, ETrue, EFalse); |
|
326 break; |
|
327 |
|
328 case EConnTestCmdHttpFrameworkPerformancePost: |
|
329 // Send HTTP request (for testing the HTTP framework) |
|
330 iSocketsEngine->SendHttpFrameworkRequestL(ETrue, ETrue, EFalse); |
|
331 break; |
|
332 |
|
333 case EConnTestCmdCancel: |
|
334 // Cancel ongoing operation |
|
335 iSocketsEngine->Cancel(); |
|
336 break; |
|
337 |
|
338 case EConnTestCmdConnectionPrefsIap: |
|
339 // Write IapId value to ConnectionPreferences table |
|
340 TRAPD(err, Utils::SetConnectionPrefsIapL()); |
|
341 if(err) |
|
342 { |
|
343 if(err == KErrNotFound) |
|
344 { |
|
345 iContainer->ErrorNotify(_L("Non-existing id"), err); |
|
346 } |
|
347 else |
|
348 { |
|
349 iContainer->ErrorNotify(_L("Setting id failed"), err); |
|
350 } |
|
351 } |
|
352 break; |
|
353 |
|
354 case EConnTestCmdTimeoutLastSocketActivity: |
|
355 // Set LastSocketActivity |
|
356 TRAPD(err2, Utils::SetTimeoutsL(EConnTestCmdTimeoutLastSocketActivity)); |
|
357 if(err2) |
|
358 { |
|
359 iContainer->ErrorNotify(_L("Failed to set timer"), err2); |
|
360 } |
|
361 break; |
|
362 |
|
363 case EConnTestCmdTimeoutLastSocketClosed: |
|
364 // Set LastSocketClosed |
|
365 TRAPD(err3, Utils::SetTimeoutsL(EConnTestCmdTimeoutLastSocketClosed)); |
|
366 if(err3) |
|
367 { |
|
368 iContainer->ErrorNotify(_L("Failed to set timer"), err3); |
|
369 } |
|
370 break; |
|
371 |
|
372 case EConnTestCmdTimeoutLastSessionClosed: |
|
373 // Set LastSessionClosed |
|
374 TRAP(err, Utils::SetTimeoutsL(EConnTestCmdTimeoutLastSessionClosed)); |
|
375 if(err) |
|
376 { |
|
377 iContainer->ErrorNotify(_L("Failed to set timer"), err); |
|
378 } |
|
379 break; |
|
380 |
|
381 case EConnTestCmdWLANQoSVoice: |
|
382 iSocketsEngine->SetWLANQoS(7); |
|
383 break; |
|
384 |
|
385 case EConnTestCmdWLANQoSVideo: |
|
386 iSocketsEngine->SetWLANQoS(5); |
|
387 break; |
|
388 |
|
389 case EConnTestCmdWLANQoSBestEffort: |
|
390 iSocketsEngine->SetWLANQoS(3); |
|
391 break; |
|
392 |
|
393 case EConnTestCmdWLANQoSBackground: |
|
394 iSocketsEngine->SetWLANQoS(1); |
|
395 break; |
|
396 |
|
397 case EConnTestCmdWLANQoSNone: |
|
398 iSocketsEngine->SetWLANQoS(0); |
|
399 break; |
|
400 |
|
401 |
|
402 // |
|
403 // WLAN COMMANDS |
|
404 // |
|
405 case EConnTestWlanAvailableIaps: |
|
406 { |
|
407 if (!iSupportsWlan) { iContainer->PrintNotify(_L("WLAN not supported\n")); break; } |
|
408 iWaiter = new (ELeave) CConnTestViewWaiter( iWlanMgmtClient, *this, EConnTestWaitTypeAvailableIaps ); |
|
409 iWaiter->ConstructL(); |
|
410 iWaiter->IssueRequest(); |
|
411 } |
|
412 break; |
|
413 |
|
414 case EConnTestWlanScan: |
|
415 { |
|
416 if (!iSupportsWlan) { iContainer->PrintNotify(_L("WLAN not supported\n")); break; } |
|
417 iWaiter = new (ELeave) CConnTestViewWaiter( iWlanMgmtClient, *this, EConnTestWaitTypeScan ); |
|
418 iWaiter->ConstructL(); |
|
419 iWaiter->IssueRequest(); |
|
420 } |
|
421 break; |
|
422 |
|
423 case EConnTestWlanGetSsid: |
|
424 { |
|
425 if (!iSupportsWlan) { iContainer->PrintNotify(_L("WLAN not supported\n")); break; } |
|
426 TWlanSsid ssid; |
|
427 TInt ret = iWlanMgmtClient->GetConnectionSsid( ssid ); |
|
428 if( ret ) |
|
429 { |
|
430 RDebug::Print( _L( "ConnTest: Error: %d" ), ret ); |
|
431 break; |
|
432 } |
|
433 |
|
434 RDebug::Print( _L( "ConnTest: SSID = %S" ), &ssid ); |
|
435 |
|
436 TBuf8<64> text; |
|
437 text.Append(_L8("SSID: ")); |
|
438 text.Append(ssid); |
|
439 text.Append(_L8("\n")); |
|
440 iContainer->PrintNotify(text); |
|
441 } |
|
442 break; |
|
443 |
|
444 case EConnTestWlanGetBssid: |
|
445 { |
|
446 if (!iSupportsWlan) { iContainer->PrintNotify(_L("WLAN not supported\n")); break; } |
|
447 TWlanBssid bssid; |
|
448 TInt ret = iWlanMgmtClient->GetConnectionBssid( bssid ); |
|
449 if( ret ) |
|
450 { |
|
451 RDebug::Print( _L( "ConnTest: Error: %d" ), ret ); |
|
452 break; |
|
453 } |
|
454 |
|
455 RDebug::Print( _L( "ConnTest: BSSID = %S" ), &bssid ); |
|
456 |
|
457 TBuf8<64> text; |
|
458 text.AppendFormat(_L8("BSSID: %02X:%02X:%02X:%02X:%02X:%02X\n"), bssid[0], bssid[1], bssid[2], bssid[3],bssid[4], bssid[5] ); |
|
459 iContainer->PrintNotify(text); |
|
460 } |
|
461 break; |
|
462 |
|
463 case EConnTestWlanGetRssi: |
|
464 { |
|
465 if (!iSupportsWlan) { iContainer->PrintNotify(_L("WLAN not supported\n")); break; } |
|
466 TInt32 rssi32; |
|
467 TInt ret = iWlanMgmtClient->GetConnectionSignalQuality( rssi32 ); |
|
468 if( ret ) |
|
469 { |
|
470 RDebug::Print( _L( "ConnTest: Error: %d" ), ret ); |
|
471 break; |
|
472 } |
|
473 |
|
474 RDebug::Print( _L( "ConnTest: RSSI = %d" ), rssi32 ); |
|
475 |
|
476 TInt8 rssi8 = static_cast<TInt8>(rssi32); |
|
477 TBuf8<64> text; |
|
478 text.AppendFormat(_L8("RSSI: %d\n"), rssi8); |
|
479 iContainer->PrintNotify(text); |
|
480 } |
|
481 break; |
|
482 |
|
483 case EConnTestWlanGetConnMode: |
|
484 { |
|
485 if (!iSupportsWlan) { iContainer->PrintNotify(_L("WLAN not supported\n")); break; } |
|
486 TWlanConnectionMode connMode; |
|
487 TInt ret = iWlanMgmtClient->GetConnectionMode( connMode ); |
|
488 if( ret ) |
|
489 { |
|
490 RDebug::Print( _L( "ConnTest: Error: %d" ), ret ); |
|
491 break; |
|
492 } |
|
493 |
|
494 RDebug::Print( _L( "ConnTest: ConnectionMode = %d" ), connMode ); |
|
495 |
|
496 TBuf8<64> text; |
|
497 text.Append(_L8("Mode: ")); |
|
498 switch( connMode ) |
|
499 { |
|
500 case EWlanConnectionModeNotConnected: |
|
501 text.Append(_L8("Not Connected")); |
|
502 break; |
|
503 case EWlanConnectionModeInfrastructure: |
|
504 text.Append(_L8("Infrastructure")); |
|
505 break; |
|
506 case EWlanConnectionModeAdhoc: |
|
507 text.Append(_L8("Ad hoc")); |
|
508 break; |
|
509 case EWlanConnectionModeSecureInfra: |
|
510 text.Append(_L8("SecureInfra")); |
|
511 break; |
|
512 case EWlanConnectionModeSearching: |
|
513 text.Append(_L8("Searching")); |
|
514 break; |
|
515 } |
|
516 text.Append(_L8("\n")); |
|
517 iContainer->PrintNotify(text); |
|
518 } |
|
519 break; |
|
520 |
|
521 case EConnTestWlanGetSecurityMode: |
|
522 { |
|
523 if (!iSupportsWlan) { iContainer->PrintNotify(_L("WLAN not supported\n")); break; } |
|
524 TWlanConnectionSecurityMode securityMode; |
|
525 TInt ret = iWlanMgmtClient->GetConnectionSecurityMode( securityMode ); |
|
526 if( ret ) |
|
527 { |
|
528 RDebug::Print( _L( "ConnTest: Error: %d" ), ret ); |
|
529 break; |
|
530 } |
|
531 |
|
532 RDebug::Print( _L( "ConnTest: SecurityMode = %d" ), securityMode ); |
|
533 |
|
534 TBuf8<64> text; |
|
535 text.Append(_L8("Mode: ")); |
|
536 switch( securityMode ) |
|
537 { |
|
538 case EWlanConnectionSecurityOpen: |
|
539 text.Append(_L8("Open")); |
|
540 break; |
|
541 case EWlanConnectionSecurityWep: |
|
542 text.Append(_L8("WEP")); |
|
543 break; |
|
544 case EWlanConnectionSecurity802d1x: |
|
545 text.Append(_L8("802.1X")); |
|
546 break; |
|
547 case EWlanConnectionSecurityWpa: |
|
548 text.Append(_L8("WPA")); |
|
549 break; |
|
550 case EWlanConnectionSecurityWpaPsk: |
|
551 text.Append(_L8("WPA-PSK")); |
|
552 break; |
|
553 } |
|
554 text.Append(_L8("\n")); |
|
555 iContainer->PrintNotify(text); |
|
556 } |
|
557 break; |
|
558 |
|
559 default: |
|
560 { |
|
561 AppUi()->HandleCommandL( aCommand ); |
|
562 break; |
|
563 } |
|
564 } |
|
565 } |
|
566 |
|
567 // --------------------------------------------------------- |
|
568 // CConnTestView::HandleClientRectChange() |
|
569 // --------------------------------------------------------- |
|
570 // |
|
571 void CConnTestView::SizeChanged() |
|
572 { |
|
573 if(iContainer) |
|
574 { |
|
575 iContainer->SetRect(ClientRect()); |
|
576 } |
|
577 if(iSettingsListBox) |
|
578 { |
|
579 iSettingsListBox->SetRect(ClientRect()); |
|
580 } |
|
581 } |
|
582 |
|
583 // --------------------------------------------------------- |
|
584 // CConnTestView::DoActivateL(...) |
|
585 // Activation of this view instance. |
|
586 // --------------------------------------------------------- |
|
587 // |
|
588 void CConnTestView::DoActivateL( const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/, |
|
589 const TDesC8& /*aCustomMessage*/) |
|
590 { |
|
591 if(!iContainer) |
|
592 { |
|
593 RDebug::Print(_L("ConnTest: CConnTestView::DoActivateL iContainer")); |
|
594 iContainer = new (ELeave) CConnTestContainer; |
|
595 iContainer->SetMopParent(this); |
|
596 iContainer->ConstructL( ClientRect() ); |
|
597 //AppUi()->AddToStackL( *this, iContainer ); |
|
598 } |
|
599 AppUi()->AddToStackL( *this, iContainer ); |
|
600 |
|
601 // Connection data for this view |
|
602 if(!iSettingData) |
|
603 { |
|
604 // Note! Document class owns now settings, so that they can |
|
605 // be stored into file. |
|
606 //iSettingData = CSettingData::NewL(); owned now by CConnTestDocument |
|
607 } |
|
608 |
|
609 // Create socket engine with initial data |
|
610 if(!iSocketsEngine) |
|
611 { |
|
612 RDebug::Print(_L("ConnTest: CConnTestView::DoActivateL iSocketsEngine")); |
|
613 iSocketsEngine = CSocketsEngine::NewL(*iContainer); |
|
614 iSocketsEngine->SetConnectionData(iSettingData); |
|
615 } |
|
616 |
|
617 // Create settings list |
|
618 if(!iSettingsListBox) |
|
619 { |
|
620 RDebug::Print(_L("ConnTest: CConnTestView::DoActivateL iSettingsListBox")); |
|
621 CreateSettingsListBoxL(R_CONNTEST_SETTING_LIST); |
|
622 } |
|
623 |
|
624 // Create Custom Preferences list |
|
625 if(!iCustomPrefsListBox) |
|
626 { |
|
627 RDebug::Print(_L("ConnTest: CConnTestView::DoActivateL iCustomPrefsListBox")); |
|
628 CreateCustomPrefsListBoxL(R_CONNTEST_CUSTOM_PREFS_LIST); |
|
629 } |
|
630 |
|
631 iActiveContainer = EOutputContainer; |
|
632 iContainer->MakeVisible(ETrue); |
|
633 SizeChanged(); |
|
634 |
|
635 if ( iSupportsWlan ) |
|
636 { |
|
637 RDebug::Print(_L("ConnTest: CConnTestView::DoActivateL iWlanMgmtClient->ActivateNotificationsL")); |
|
638 iWlanMgmtClient->ActivateNotificationsL( *this ); |
|
639 } |
|
640 } |
|
641 |
|
642 // --------------------------------------------------------- |
|
643 // CConnTestView::DoDeactivate() |
|
644 // Deactivation of this view instance. Controls are not |
|
645 // deleted, so that old information in status and output |
|
646 // windows stays visible. |
|
647 // --------------------------------------------------------- |
|
648 // |
|
649 void CConnTestView::DoDeactivate() |
|
650 { |
|
651 if ( iSupportsWlan ) |
|
652 { |
|
653 iWlanMgmtClient->CancelNotifications(); |
|
654 } |
|
655 |
|
656 if ( iContainer ) |
|
657 { |
|
658 AppUi()->RemoveFromStack( iContainer ); |
|
659 } |
|
660 iContainer->MakeVisible(EFalse); |
|
661 |
|
662 if (iSettingsListBox) |
|
663 { |
|
664 AppUi()->RemoveFromStack(iSettingsListBox); |
|
665 } |
|
666 } |
|
667 |
|
668 |
|
669 // ---------------------------------------------------------------------------- |
|
670 // CConnTestView::SwapContainerL |
|
671 // Switch the display between main view and settings list. |
|
672 // ---------------------------------------------------------------------------- |
|
673 // |
|
674 void CConnTestView::SwapContainerL(TConnTestContainer aActiveContainer) |
|
675 { |
|
676 CAknTitlePane* titlePane = STATIC_CAST( |
|
677 CAknTitlePane*, |
|
678 StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
679 |
|
680 if (iActiveContainer == aActiveContainer) |
|
681 { |
|
682 return; |
|
683 } |
|
684 |
|
685 // Remove the old container... |
|
686 switch (iActiveContainer) |
|
687 { |
|
688 case EOutputContainer: |
|
689 { |
|
690 iContainer->MakeVisible(EFalse); |
|
691 AppUi()->RemoveFromStack( iContainer ); |
|
692 break; |
|
693 } |
|
694 case ESettingsContainer: |
|
695 { |
|
696 AppUi()->RemoveFromStack(iSettingsListBox); |
|
697 iSettingsListBox->MakeVisible(EFalse); |
|
698 break; |
|
699 } |
|
700 default: // ECustomPrefsContainer: |
|
701 { |
|
702 AppUi()->RemoveFromStack(iCustomPrefsListBox); |
|
703 iCustomPrefsListBox->MakeVisible(EFalse); |
|
704 break; |
|
705 } |
|
706 } |
|
707 |
|
708 // And add the new container |
|
709 switch (aActiveContainer) |
|
710 { |
|
711 case EOutputContainer: |
|
712 { |
|
713 Cba()->SetCommandSetL(R_AVKON_SOFTKEYS_OPTIONS_EXIT); |
|
714 AppUi()->AddToStackL( *this, iContainer ); |
|
715 iContainer->MakeVisible(ETrue); |
|
716 titlePane->SetTextToDefaultL(); |
|
717 |
|
718 Cba()->DrawNow(); |
|
719 break; |
|
720 } |
|
721 case ESettingsContainer: |
|
722 { |
|
723 Cba()->SetCommandSetL(R_AVKON_SOFTKEYS_OK_BACK); |
|
724 AppUi()->AddToStackL( *this, iSettingsListBox ); |
|
725 iSettingsListBox->MakeVisible(ETrue); |
|
726 titlePane->SetTextL( _L("Settings") ); |
|
727 break; |
|
728 } |
|
729 default: // ECustomPrefsContainer: |
|
730 { |
|
731 Cba()->SetCommandSetL(R_AVKON_SOFTKEYS_OK_BACK); |
|
732 AppUi()->AddToStackL( *this, iCustomPrefsListBox ); |
|
733 iCustomPrefsListBox->MakeVisible(ETrue); |
|
734 titlePane->SetTextL( _L("Custom Preferences") ); |
|
735 break; |
|
736 } |
|
737 } |
|
738 |
|
739 iActiveContainer = aActiveContainer; |
|
740 } |
|
741 |
|
742 // ---------------------------------------------------------------------------- |
|
743 // CConnTestView::CreateSettingsListBoxL |
|
744 // Create the setting item list, but don't show it. |
|
745 // ---------------------------------------------------------------------------- |
|
746 // |
|
747 void CConnTestView::CreateSettingsListBoxL(TInt aResourceId) |
|
748 { |
|
749 iSettingsListBox = new (ELeave) CSettingItemList; |
|
750 iSettingsListBox->SetData(iSettingData); |
|
751 iSettingsListBox->SetMopParent(this); |
|
752 iSettingsListBox->ConstructFromResourceL(aResourceId); |
|
753 iSettingsListBox->MakeVisible(EFalse); |
|
754 iSettingsListBox->SetRect(ClientRect()); |
|
755 iSettingsListBox->ActivateL(); |
|
756 } |
|
757 |
|
758 // ---------------------------------------------------------------------------- |
|
759 // CConnTestView::CreateCustomPrefsListBoxL |
|
760 // Create the Custom Prefs item list, but don't show it. |
|
761 // ---------------------------------------------------------------------------- |
|
762 // |
|
763 void CConnTestView::CreateCustomPrefsListBoxL(TInt aResourceId) |
|
764 { |
|
765 iCustomPrefsListBox = new (ELeave) CCustomPrefsItemList; |
|
766 iCustomPrefsListBox->SetData(iCustomPrefsData); |
|
767 iCustomPrefsListBox->SetMopParent(this); |
|
768 iCustomPrefsListBox->ConstructFromResourceL(aResourceId); |
|
769 iCustomPrefsListBox->MakeVisible(EFalse); |
|
770 iCustomPrefsListBox->SetRect(ClientRect()); |
|
771 iCustomPrefsListBox->ActivateL(); |
|
772 } |
|
773 |
|
774 |
|
775 // ---------------------------------------------------------------------------- |
|
776 // CConnTestView::CreateDataPacket |
|
777 // Write data to internal buffer, which is sent to socket. Maximum |
|
778 // size of the buffer is KSendDataSize bytes. |
|
779 // ---------------------------------------------------------------------------- |
|
780 // |
|
781 void CConnTestView::CreateDataPacket() |
|
782 { |
|
783 RDebug::Print(_L("ConnTest: CConnTestView::CreateDataPacket: packet size = %d, SendDataSize = %d"),iSettingData->iPacketSize,KSendDataSize); |
|
784 RDebug::Print(_L("ConnTest: CConnTestView::CreateDataPacket: buffer maxsize = %d"),iSendData->Des().MaxLength()); |
|
785 |
|
786 iSendData->Des().FillZ(); |
|
787 iSendData->Des().Zero(); |
|
788 TInt length = iSettingData->iPacketSize; |
|
789 if(length > iSendData->Des().MaxLength()) |
|
790 { |
|
791 TBuf<128> tt; |
|
792 tt.Format( |
|
793 _L("There was not enough space in the buffer for the data, so truncating to %d"), |
|
794 iSendData->Des().MaxLength() |
|
795 ); |
|
796 iContainer->PrintNotify(tt); |
|
797 length = iSendData->Des().MaxLength(); |
|
798 iSettingData->iPacketSize = length; |
|
799 } |
|
800 iSendData->Des().Fill('a', iSettingData->iPacketSize - 1); |
|
801 iSendData->Des().Append(_L8("\n")); |
|
802 RDebug::Print(_L("ConnTest: CConnTestView::CreateDataPacket: created size = %d"),iSendData->Length()); |
|
803 } |
|
804 |
|
805 |
|
806 // ---------------------------------------------------------------------------- |
|
807 // CConnTestView::SendDataL |
|
808 // The engine does the real work |
|
809 // ---------------------------------------------------------------------------- |
|
810 // |
|
811 void CConnTestView::SendDataL() |
|
812 { |
|
813 iSocketsEngine->SendDataL(*iSendData); |
|
814 } |
|
815 |
|
816 // ------------------------------------------------------------------------------ |
|
817 // CConnTestView::IsReadyForHTTPGet() |
|
818 // This function is used to check if a HTTP get can be performed |
|
819 // on an already existing connection |
|
820 // ------------------------------------------------------------------------------ |
|
821 // |
|
822 TBool CConnTestView::IsReadyForHTTPGet() |
|
823 { |
|
824 TBool res = EFalse; |
|
825 if (iSocketsEngine && iSocketsEngine->GetSocketEngineState() == CSocketsEngine::EConnected ) |
|
826 { |
|
827 res = ETrue; |
|
828 } |
|
829 return res; |
|
830 } |
|
831 |
|
832 // ------------------------------------------------------------------------------ |
|
833 // CConnTestView::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane) |
|
834 // This function is called by the EIKON framework just before it displays |
|
835 // a menu pane. Menu is adjusted according to socket engine state. |
|
836 // ------------------------------------------------------------------------------ |
|
837 // |
|
838 void CConnTestView::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane) |
|
839 { |
|
840 RDebug::Print(_L("ConnTest: DynInitMenuPaneL: resourceId=%x"), aResourceId); |
|
841 |
|
842 switch(aResourceId) |
|
843 { |
|
844 case R_CONNTEST_VIEW1_MENU: |
|
845 { |
|
846 CSocketsEngine::TSocketsEngineState state = iSocketsEngine->GetSocketEngineState(); |
|
847 CSocketsEngine::TRoamingUIState roamingState = iSocketsEngine->GetSocketEngineRoamingState(); |
|
848 |
|
849 switch(state) |
|
850 { |
|
851 case CSocketsEngine::EInterfaceDown: |
|
852 aMenuPane->SetItemDimmed(EConnTestCmdCancel, ETrue); |
|
853 aMenuPane->SetItemDimmed(EConnTestCmdStartInterface, EFalse); |
|
854 aMenuPane->SetItemDimmed(EConnTestCmdStartInternet, EFalse); |
|
855 aMenuPane->SetItemDimmed(EConnTestCmdStopInterface, ETrue); |
|
856 aMenuPane->SetItemDimmed(EConnTestCmdConnect, EFalse); |
|
857 aMenuPane->SetItemDimmed(EConnTestCmdDisconnect, ETrue); |
|
858 aMenuPane->SetItemDimmed(EConnTestCmdListen, ETrue); |
|
859 aMenuPane->SetItemDimmed(EConnTestCmdSendRawData, ETrue); |
|
860 aMenuPane->SetItemDimmed(EConnTestCmdHttpFrameworkGet, EFalse); |
|
861 break; |
|
862 case CSocketsEngine::EStartingInterface: |
|
863 aMenuPane->SetItemDimmed(EConnTestCmdCancel, EFalse); |
|
864 aMenuPane->SetItemDimmed(EConnTestCmdStartInterface, ETrue); |
|
865 aMenuPane->SetItemDimmed(EConnTestCmdStartInternet, ETrue); |
|
866 aMenuPane->SetItemDimmed(EConnTestCmdStopInterface, EFalse); |
|
867 aMenuPane->SetItemDimmed(EConnTestCmdConnect, ETrue); |
|
868 aMenuPane->SetItemDimmed(EConnTestCmdDisconnect, ETrue); |
|
869 aMenuPane->SetItemDimmed(EConnTestCmdListen, ETrue); |
|
870 aMenuPane->SetItemDimmed(EConnTestCmdSendRawData, ETrue); |
|
871 aMenuPane->SetItemDimmed(EConnTestCmdHttpFrameworkGet, ETrue); |
|
872 break; |
|
873 case CSocketsEngine::EInterfaceUp: |
|
874 aMenuPane->SetItemDimmed(EConnTestCmdCancel, ETrue); |
|
875 aMenuPane->SetItemDimmed(EConnTestCmdStartInterface, ETrue); |
|
876 aMenuPane->SetItemDimmed(EConnTestCmdStartInternet, ETrue); |
|
877 aMenuPane->SetItemDimmed(EConnTestCmdStopInterface, EFalse); |
|
878 aMenuPane->SetItemDimmed(EConnTestCmdConnect, EFalse); |
|
879 aMenuPane->SetItemDimmed(EConnTestCmdDisconnect, ETrue); |
|
880 aMenuPane->SetItemDimmed(EConnTestCmdListen, EFalse); |
|
881 aMenuPane->SetItemDimmed(EConnTestCmdSendRawData, ETrue); |
|
882 aMenuPane->SetItemDimmed(EConnTestCmdHttpFrameworkGet, EFalse); |
|
883 break; |
|
884 case CSocketsEngine::EConnected: |
|
885 aMenuPane->SetItemDimmed(EConnTestCmdCancel, ETrue); |
|
886 aMenuPane->SetItemDimmed(EConnTestCmdStartInterface, ETrue); |
|
887 aMenuPane->SetItemDimmed(EConnTestCmdStartInternet, ETrue); |
|
888 aMenuPane->SetItemDimmed(EConnTestCmdStopInterface, ETrue); |
|
889 aMenuPane->SetItemDimmed(EConnTestCmdConnect, ETrue); |
|
890 aMenuPane->SetItemDimmed(EConnTestCmdDisconnect, EFalse); |
|
891 aMenuPane->SetItemDimmed(EConnTestCmdListen, ETrue); |
|
892 aMenuPane->SetItemDimmed(EConnTestCmdSendRawData, EFalse); |
|
893 aMenuPane->SetItemDimmed(EConnTestCmdHttpFrameworkGet, EFalse); |
|
894 break; |
|
895 case CSocketsEngine::EConnecting: |
|
896 aMenuPane->SetItemDimmed(EConnTestCmdCancel, EFalse); |
|
897 aMenuPane->SetItemDimmed(EConnTestCmdStartInterface, ETrue); |
|
898 aMenuPane->SetItemDimmed(EConnTestCmdStartInternet, ETrue); |
|
899 aMenuPane->SetItemDimmed(EConnTestCmdStopInterface, ETrue); |
|
900 aMenuPane->SetItemDimmed(EConnTestCmdConnect, ETrue); |
|
901 aMenuPane->SetItemDimmed(EConnTestCmdDisconnect, ETrue); |
|
902 aMenuPane->SetItemDimmed(EConnTestCmdListen, ETrue); |
|
903 aMenuPane->SetItemDimmed(EConnTestCmdSendRawData, ETrue); |
|
904 aMenuPane->SetItemDimmed(EConnTestCmdHttpFrameworkGet, ETrue); |
|
905 break; |
|
906 case CSocketsEngine::EListening: |
|
907 aMenuPane->SetItemDimmed(EConnTestCmdCancel, ETrue); |
|
908 aMenuPane->SetItemDimmed(EConnTestCmdStartInterface, ETrue); |
|
909 aMenuPane->SetItemDimmed(EConnTestCmdStartInternet, ETrue); |
|
910 aMenuPane->SetItemDimmed(EConnTestCmdStopInterface, ETrue); |
|
911 aMenuPane->SetItemDimmed(EConnTestCmdConnect, ETrue); |
|
912 aMenuPane->SetItemDimmed(EConnTestCmdDisconnect, EFalse); |
|
913 aMenuPane->SetItemDimmed(EConnTestCmdListen, ETrue); |
|
914 aMenuPane->SetItemDimmed(EConnTestCmdSendRawData, EFalse); |
|
915 aMenuPane->SetItemDimmed(EConnTestCmdHttpFrameworkGet, ETrue); |
|
916 break; |
|
917 case CSocketsEngine::EDisconnecting: |
|
918 aMenuPane->SetItemDimmed(EConnTestCmdCancel, EFalse); |
|
919 aMenuPane->SetItemDimmed(EConnTestCmdStartInterface, ETrue); |
|
920 aMenuPane->SetItemDimmed(EConnTestCmdStartInternet, ETrue); |
|
921 aMenuPane->SetItemDimmed(EConnTestCmdStopInterface, ETrue); |
|
922 aMenuPane->SetItemDimmed(EConnTestCmdConnect, ETrue); |
|
923 aMenuPane->SetItemDimmed(EConnTestCmdDisconnect, ETrue); |
|
924 aMenuPane->SetItemDimmed(EConnTestCmdListen, ETrue); |
|
925 aMenuPane->SetItemDimmed(EConnTestCmdSendRawData, ETrue); |
|
926 aMenuPane->SetItemDimmed(EConnTestCmdHttpFrameworkGet, ETrue); |
|
927 break; |
|
928 case CSocketsEngine::ELookingUp: |
|
929 aMenuPane->SetItemDimmed(EConnTestCmdCancel, EFalse); |
|
930 aMenuPane->SetItemDimmed(EConnTestCmdStartInterface, ETrue); |
|
931 aMenuPane->SetItemDimmed(EConnTestCmdStartInternet, ETrue); |
|
932 aMenuPane->SetItemDimmed(EConnTestCmdStopInterface, ETrue); |
|
933 aMenuPane->SetItemDimmed(EConnTestCmdConnect, ETrue); |
|
934 aMenuPane->SetItemDimmed(EConnTestCmdDisconnect, ETrue); |
|
935 aMenuPane->SetItemDimmed(EConnTestCmdListen, ETrue); |
|
936 aMenuPane->SetItemDimmed(EConnTestCmdSendRawData, ETrue); |
|
937 aMenuPane->SetItemDimmed(EConnTestCmdHttpFrameworkGet, ETrue); |
|
938 break; |
|
939 default: |
|
940 break; |
|
941 } |
|
942 switch (roamingState) |
|
943 { |
|
944 case CSocketsEngine::EPendingPreferredCarrier: |
|
945 aMenuPane->SetItemDimmed(EConnTestCmdMigrate, EFalse); |
|
946 aMenuPane->SetItemDimmed(EConnTestCmdIgnore, EFalse); |
|
947 aMenuPane->SetItemDimmed(EConnTestCmdAccept, ETrue); |
|
948 aMenuPane->SetItemDimmed(EConnTestCmdReject, ETrue); |
|
949 break; |
|
950 case CSocketsEngine::EPendingNewCarrierActive: |
|
951 aMenuPane->SetItemDimmed(EConnTestCmdMigrate, ETrue); |
|
952 aMenuPane->SetItemDimmed(EConnTestCmdIgnore, ETrue); |
|
953 aMenuPane->SetItemDimmed(EConnTestCmdAccept, EFalse); |
|
954 aMenuPane->SetItemDimmed(EConnTestCmdReject, EFalse); |
|
955 break; |
|
956 default: |
|
957 aMenuPane->SetItemDimmed(EConnTestCmdMigrate, ETrue); |
|
958 aMenuPane->SetItemDimmed(EConnTestCmdIgnore, ETrue); |
|
959 aMenuPane->SetItemDimmed(EConnTestCmdAccept, ETrue); |
|
960 aMenuPane->SetItemDimmed(EConnTestCmdReject, ETrue); |
|
961 break; |
|
962 } |
|
963 } |
|
964 break; |
|
965 case R_CONNTEST_SUB_MENU_IPDUMP: |
|
966 { |
|
967 |
|
968 // Additional menupane handling, which doesn't depend on the state of the socket engine |
|
969 CConnTestAppUi* appui = (CConnTestAppUi *)AppUi(); |
|
970 if(appui->IsLogging()) |
|
971 { |
|
972 aMenuPane->SetItemDimmed(EConnTestCmdStartIpLog, ETrue); |
|
973 } |
|
974 else |
|
975 { |
|
976 aMenuPane->SetItemDimmed(EConnTestCmdStopIpLog, ETrue); |
|
977 } |
|
978 } |
|
979 break; |
|
980 |
|
981 //enable mobility API submenupoints when connection is started with a snap |
|
982 case R_CONNTEST_SUB_MENU_ADVANCED: |
|
983 { |
|
984 |
|
985 CSocketsEngine::TSocketsEngineStartType connType = iSocketsEngine->GetSocketEngineConnType(); |
|
986 |
|
987 |
|
988 break; |
|
989 |
|
990 } |
|
991 default: |
|
992 break; |
|
993 } |
|
994 } |
|
995 |
|
996 // ------------------------------------------------------------------------------ |
|
997 // CConnTestView::RequestCompleted() |
|
998 // ------------------------------------------------------------------------------ |
|
999 // |
|
1000 void CConnTestView::RequestCompleted( TInt aStatus, RArray<TUint>& aAvailableIaps ) |
|
1001 { |
|
1002 RDebug::Print( _L( "ConnTest: CConnTestView::RequestCompleted(aAvailableIaps)" ) ); |
|
1003 |
|
1004 if ( aStatus != KErrNone ) |
|
1005 { |
|
1006 RDebug::Print( _L( "ConnTest: client->RequestCompleted failed with %d" ), aStatus ); |
|
1007 return; |
|
1008 } |
|
1009 |
|
1010 RDebug::Print( _L( "ConnTest: ivailableIaps.Count() = %u" ), aAvailableIaps.Count() ); |
|
1011 |
|
1012 TBuf<100> msg; |
|
1013 msg.AppendNum( aAvailableIaps.Count() ); |
|
1014 msg.Append( _L( " WLAN IAP(s) found\n\n" ) ); |
|
1015 for ( TUint idx( 0 ); idx < (TUint)aAvailableIaps.Count(); ++idx ) |
|
1016 { |
|
1017 msg.AppendFormat( _L("%02u "), aAvailableIaps[idx] ); |
|
1018 } |
|
1019 msg.Append( _L( "\n" ) ); |
|
1020 iContainer->ErrorNotify( msg, KErrNone ); |
|
1021 |
|
1022 delete iWaiter; |
|
1023 iWaiter = NULL; |
|
1024 } |
|
1025 |
|
1026 // ------------------------------------------------------------------------------ |
|
1027 // CConnTestView::RequestCompleted() |
|
1028 // ------------------------------------------------------------------------------ |
|
1029 // |
|
1030 void CConnTestView::RequestCompleted( TInt aStatus, CWlanScanInfo& aScanInfo ) |
|
1031 { |
|
1032 RDebug::Print( _L( "ConnTest: CConnTestView::RequestCompleted(aScanInfo)" ) ); |
|
1033 |
|
1034 if ( aStatus != KErrNone ) |
|
1035 { |
|
1036 RDebug::Print( _L( "ConnTest: client->RequestCompleted failed with %d" ), aStatus ); |
|
1037 return; |
|
1038 } |
|
1039 |
|
1040 TUint count( 0 ); |
|
1041 |
|
1042 aScanInfo.First(); |
|
1043 while (!aScanInfo.IsDone()) |
|
1044 { |
|
1045 ++count; |
|
1046 aScanInfo.Next(); |
|
1047 } |
|
1048 |
|
1049 TBuf<100> msg; |
|
1050 msg.AppendNum( count ); |
|
1051 msg.Append( _L( " WLAN AP(s) found\n\n" ) ); |
|
1052 iContainer->ErrorNotify( msg, KErrNone ); |
|
1053 |
|
1054 delete iWaiter; |
|
1055 iWaiter = NULL; |
|
1056 } |
|
1057 |
|
1058 // ------------------------------------------------------------------------------ |
|
1059 // CConnTestView::ConnectionStateChanged() |
|
1060 // ------------------------------------------------------------------------------ |
|
1061 // |
|
1062 void CConnTestView::ConnectionStateChanged( TWlanConnectionMode aNewState ) |
|
1063 { |
|
1064 RDebug::Print( _L( "ConnTest: CConnTestView::ConnectionStateChanged" ) ); |
|
1065 |
|
1066 TBuf8<64> text; |
|
1067 TTime currentTime(0); |
|
1068 currentTime.HomeTime(); |
|
1069 TDateTime time = currentTime.DateTime(); |
|
1070 text.AppendFormat(_L8("%02u:%02u:%02u "), |
|
1071 time.Hour(), time.Minute(), time.Second() ); |
|
1072 text.Append(_L8("Wlan State: ")); |
|
1073 switch( aNewState ) |
|
1074 { |
|
1075 case EWlanConnectionModeNotConnected: |
|
1076 text.Append(_L8("Not Connected")); |
|
1077 break; |
|
1078 case EWlanConnectionModeInfrastructure: |
|
1079 text.Append(_L8("Infrastructure")); |
|
1080 break; |
|
1081 case EWlanConnectionModeAdhoc: |
|
1082 text.Append(_L8("Ad hoc")); |
|
1083 break; |
|
1084 case EWlanConnectionModeSecureInfra: |
|
1085 text.Append(_L8("SecureInfra")); |
|
1086 break; |
|
1087 case EWlanConnectionModeSearching: |
|
1088 text.Append(_L8("Searching")); |
|
1089 break; |
|
1090 } |
|
1091 text.Append(_L8("\n")); |
|
1092 iContainer->PrintNotify(text); |
|
1093 } |
|
1094 |
|
1095 // ------------------------------------------------------------------------------ |
|
1096 // CConnTestView::BssidChanged() |
|
1097 // ------------------------------------------------------------------------------ |
|
1098 // |
|
1099 void CConnTestView::BssidChanged( TWlanBssid& aNewBSSID ) |
|
1100 { |
|
1101 RDebug::Print( _L( "ConnTest: CConnTestView::BssidChanged" ) ); |
|
1102 |
|
1103 TBuf8<64> text; |
|
1104 TTime currentTime(0); |
|
1105 currentTime.HomeTime(); |
|
1106 TDateTime time = currentTime.DateTime(); |
|
1107 text.AppendFormat(_L8("%02u:%02u:%02u "), |
|
1108 time.Hour(), time.Minute(), time.Second() ); |
|
1109 text.AppendFormat(_L8("Wlan BSSID: %02X:%02X:%02X:%02X:%02X:%02X\n"), aNewBSSID[0], aNewBSSID[1], aNewBSSID[2], aNewBSSID[3], aNewBSSID[4], aNewBSSID[5] ); |
|
1110 iContainer->PrintNotify(text); |
|
1111 } |
|
1112 |
|
1113 // ------------------------------------------------------------------------------ |
|
1114 // CConnTestView::BssLost() |
|
1115 // ------------------------------------------------------------------------------ |
|
1116 // |
|
1117 void CConnTestView::BssLost() |
|
1118 { |
|
1119 RDebug::Print( _L( "ConnTest: CConnTestView::BssLost" ) ); |
|
1120 |
|
1121 TBuf8<64> text; |
|
1122 TTime currentTime(0); |
|
1123 currentTime.HomeTime(); |
|
1124 TDateTime time = currentTime.DateTime(); |
|
1125 text.AppendFormat(_L8("%02u:%02u:%02u "), |
|
1126 time.Hour(), time.Minute(), time.Second() ); |
|
1127 text.AppendFormat(_L8("Wlan: BssLost\n")); |
|
1128 iContainer->PrintNotify(text); |
|
1129 } |
|
1130 |
|
1131 // ------------------------------------------------------------------------------ |
|
1132 // CConnTestView::BssRegained() |
|
1133 // ------------------------------------------------------------------------------ |
|
1134 // |
|
1135 void CConnTestView::BssRegained() |
|
1136 { |
|
1137 RDebug::Print( _L( "ConnTest: CConnTestView::BssRegained" ) ); |
|
1138 |
|
1139 TBuf8<64> text; |
|
1140 TTime currentTime(0); |
|
1141 currentTime.HomeTime(); |
|
1142 TDateTime time = currentTime.DateTime(); |
|
1143 text.AppendFormat(_L8("%02u:%02u:%02u "), |
|
1144 time.Hour(), time.Minute(), time.Second() ); |
|
1145 text.AppendFormat(_L8("Wlan: BssRegained\n")); |
|
1146 iContainer->PrintNotify(text); |
|
1147 } |
|
1148 |
|
1149 // ------------------------------------------------------------------------------ |
|
1150 // CConnTestView::NewNetworksDetected() |
|
1151 // ------------------------------------------------------------------------------ |
|
1152 // |
|
1153 void CConnTestView::NewNetworksDetected() |
|
1154 { |
|
1155 RDebug::Print( _L( "ConnTest: CConnTestView::NewNetworksDetected" ) ); |
|
1156 |
|
1157 TBuf8<64> text; |
|
1158 TTime currentTime(0); |
|
1159 currentTime.HomeTime(); |
|
1160 TDateTime time = currentTime.DateTime(); |
|
1161 text.AppendFormat(_L8("%02u:%02u:%02u "), |
|
1162 time.Hour(), time.Minute(), time.Second() ); |
|
1163 text.AppendFormat(_L8("Wlan: NewNetworksDetected\n")); |
|
1164 iContainer->PrintNotify(text); |
|
1165 } |
|
1166 |
|
1167 // ------------------------------------------------------------------------------ |
|
1168 // CConnTestView::OldNetworksLost() |
|
1169 // ------------------------------------------------------------------------------ |
|
1170 // |
|
1171 void CConnTestView::OldNetworksLost() |
|
1172 { |
|
1173 RDebug::Print( _L( "ConnTest: CConnTestView::OldNetworksLost" ) ); |
|
1174 |
|
1175 TBuf8<64> text; |
|
1176 TTime currentTime(0); |
|
1177 currentTime.HomeTime(); |
|
1178 TDateTime time = currentTime.DateTime(); |
|
1179 text.AppendFormat(_L8("%02u:%02u:%02u "), |
|
1180 time.Hour(), time.Minute(), time.Second() ); |
|
1181 text.AppendFormat(_L8("Wlan: OldNetworksLost\n")); |
|
1182 iContainer->PrintNotify(text); |
|
1183 } |
|
1184 |
|
1185 // ------------------------------------------------------------------------------ |
|
1186 // CConnTestView::TransmitPowerChanged() |
|
1187 // ------------------------------------------------------------------------------ |
|
1188 // |
|
1189 void CConnTestView::TransmitPowerChanged( TUint aPower ) |
|
1190 { |
|
1191 RDebug::Print( _L( "ConnTest: CConnTestView::TransmitPowerChanged" ) ); |
|
1192 |
|
1193 TBuf8<64> text; |
|
1194 TTime currentTime(0); |
|
1195 currentTime.HomeTime(); |
|
1196 TDateTime time = currentTime.DateTime(); |
|
1197 text.AppendFormat(_L8("%02u:%02u:%02u "), |
|
1198 time.Hour(), time.Minute(), time.Second() ); |
|
1199 text.AppendFormat(_L8("Wlan: TxPower: %d\n"), aPower); |
|
1200 iContainer->PrintNotify(text); |
|
1201 } |
|
1202 |
|
1203 // ------------------------------------------------------------------------------ |
|
1204 // CConnTestView::RssChanged() |
|
1205 // ------------------------------------------------------------------------------ |
|
1206 // |
|
1207 void CConnTestView::RssChanged( TWlanRssClass aRssClass, |
|
1208 TUint aRss ) |
|
1209 { |
|
1210 RDebug::Print( _L( "ConnTest: CConnTestView::RssChanged" ) ); |
|
1211 |
|
1212 TBuf8<64> text; |
|
1213 TTime currentTime(0); |
|
1214 currentTime.HomeTime(); |
|
1215 TDateTime time = currentTime.DateTime(); |
|
1216 text.AppendFormat(_L8("%02u:%02u:%02u "), |
|
1217 time.Hour(), time.Minute(), time.Second() ); |
|
1218 text.AppendFormat(_L8("Wlan: RssChanged: %d, %d\n"), aRssClass, aRss); |
|
1219 iContainer->PrintNotify(text); |
|
1220 } |
|
1221 |
|
1222 // ------------------------------------------------------------------------------ |
|
1223 // CConnTestViewWaiter::CConnTestViewWaiter() |
|
1224 // ------------------------------------------------------------------------------ |
|
1225 // |
|
1226 CConnTestViewWaiter::CConnTestViewWaiter( CWlanMgmtClient* aWlanMgmtClient, |
|
1227 CConnTestView& aCallback, |
|
1228 TConnTestWaitType aType ) |
|
1229 : CActive( CActive::EPriorityStandard ), |
|
1230 iType( aType ), |
|
1231 iCallback( aCallback ), |
|
1232 iMgmtClient( aWlanMgmtClient ), |
|
1233 iScanInfo( NULL ) |
|
1234 { |
|
1235 RDebug::Print( _L( "ConnTest: CConnTestViewWaiter::CConnTestViewWaiter()" ) ); |
|
1236 CActiveScheduler::Add( this ); |
|
1237 } |
|
1238 |
|
1239 // ------------------------------------------------------------------------------ |
|
1240 // CConnTestViewWaiter::ConstructL() |
|
1241 // ------------------------------------------------------------------------------ |
|
1242 // |
|
1243 void CConnTestViewWaiter::ConstructL() |
|
1244 { |
|
1245 iScanInfo = CWlanScanInfo::NewL(); |
|
1246 } |
|
1247 |
|
1248 // ------------------------------------------------------------------------------ |
|
1249 // CConnTestViewWaiter::~CConnTestViewWaiter() |
|
1250 // ------------------------------------------------------------------------------ |
|
1251 // |
|
1252 CConnTestViewWaiter::~CConnTestViewWaiter() |
|
1253 { |
|
1254 RDebug::Print( _L( "ConnTest: CConnTestViewWaiter::~CConnTestViewWaiter()" ) ); |
|
1255 Cancel(); |
|
1256 iAvailableIaps.Close(); |
|
1257 delete iScanInfo; |
|
1258 } |
|
1259 |
|
1260 // ------------------------------------------------------------------------------ |
|
1261 // CConnTestViewWaiter::RunL() |
|
1262 // ------------------------------------------------------------------------------ |
|
1263 // |
|
1264 void CConnTestViewWaiter::RunL() |
|
1265 { |
|
1266 RDebug::Print( _L( "ConnTest: CConnTestViewWaiter::RunL()" ) ); |
|
1267 |
|
1268 if ( iType == EConnTestWaitTypeAvailableIaps ) |
|
1269 { |
|
1270 iCallback.RequestCompleted( iStatus.Int(), iAvailableIaps ); |
|
1271 } |
|
1272 else // EConnTestWaitTypeScan |
|
1273 { |
|
1274 iCallback.RequestCompleted( iStatus.Int(), *iScanInfo ); |
|
1275 } |
|
1276 } |
|
1277 |
|
1278 // ------------------------------------------------------------------------------ |
|
1279 // CConnTestViewWaiter::RunError() |
|
1280 // ------------------------------------------------------------------------------ |
|
1281 // |
|
1282 TInt CConnTestViewWaiter::RunError( TInt /* aError */ ) |
|
1283 { |
|
1284 RDebug::Print( _L( "ConnTest: CConnTestViewWaiter::RunError()" ) ); |
|
1285 return KErrNone; |
|
1286 } |
|
1287 |
|
1288 // ------------------------------------------------------------------------------ |
|
1289 // CConnTestViewWaiter::DoCancel() |
|
1290 // ------------------------------------------------------------------------------ |
|
1291 // |
|
1292 void CConnTestViewWaiter::DoCancel() |
|
1293 { |
|
1294 RDebug::Print( _L( "ConnTest: CConnTestViewWaiter::DoCancel()" ) ); |
|
1295 } |
|
1296 |
|
1297 // ------------------------------------------------------------------------------ |
|
1298 // CConnTestViewWaiter::IssueRequest() |
|
1299 // ------------------------------------------------------------------------------ |
|
1300 // |
|
1301 void CConnTestViewWaiter::IssueRequest() |
|
1302 { |
|
1303 RDebug::Print( _L( "ConnTest: CConnTestViewWaiter::IssueRequest()" ) ); |
|
1304 if ( iType == EConnTestWaitTypeAvailableIaps ) |
|
1305 { |
|
1306 iMgmtClient->GetAvailableIaps( iStatus, iAvailableIaps ); |
|
1307 } |
|
1308 else // EConnTestWaitTypeScan |
|
1309 { |
|
1310 iMgmtClient->GetScanResults( iStatus, *iScanInfo ); |
|
1311 } |
|
1312 SetActive(); |
|
1313 } |
|
1314 |
|
1315 // End of File |
|
1316 |