1 /* |
|
2 * Copyright (c) 2007-2008 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 CWsfDetailsViewModel. |
|
15 * |
|
16 */ |
|
17 |
|
18 // EXTERNAL INCLUDES |
|
19 #include <badesca.h> |
|
20 #include <StringLoader.h> |
|
21 #include <AknUtils.h> |
|
22 #include <wlansniffer.rsg> |
|
23 #include <coemain.h> |
|
24 #include <avkon.rsg> |
|
25 #include <cmpluginwlandef.h> |
|
26 #include <cmmanager.h> |
|
27 #include <cmconnectionmethod.h> |
|
28 #include <rconnmon.h> |
|
29 |
|
30 // INTERNAL INCLUDES |
|
31 #include "wsfwlaninfo.h" |
|
32 #include "wsfdetailsviewmodel.h" |
|
33 #include "wsfwlaninfoarray.h" |
|
34 #include "wsflogger.h" |
|
35 |
|
36 // LOCAL DEFINITIONS |
|
37 using namespace CMManager; |
|
38 |
|
39 #ifdef _DEBUG |
|
40 _LIT( KDetailsViewModelPanic, "CWsfDetailsViewModel" ); |
|
41 #define _ASSERTD( cond ) __ASSERT_DEBUG( (cond), \ |
|
42 User::Panic( KDetailsViewModelPanic, __LINE__) ) |
|
43 #else |
|
44 #define _ASSERTD( cond ) {} |
|
45 #endif //_DEBUG |
|
46 |
|
47 // the size of the Details Listbox's array |
|
48 const TInt KWlanInfoGranularity = 8; |
|
49 // the size of the numbers in the NaviPane |
|
50 const TInt KNumberLegth = 5; |
|
51 // Listbox elements format string |
|
52 _LIT( KListItemFormat, "%S\t%S" ); |
|
53 // NaviPane elements format string |
|
54 _LIT( KPaneFormater, "%i/%i" ); |
|
55 |
|
56 // --------------------------------------------------------------------------- |
|
57 // CWsfDetailsViewModel::CWsfDetailsViewModel() |
|
58 // --------------------------------------------------------------------------- |
|
59 // |
|
60 CWsfDetailsViewModel::CWsfDetailsViewModel():iCoeEnv( CCoeEnv::Static() ) |
|
61 { |
|
62 } |
|
63 |
|
64 // --------------------------------------------------------------------------- |
|
65 // CWsfDetailsViewModel::ConstructL() |
|
66 // --------------------------------------------------------------------------- |
|
67 // |
|
68 void CWsfDetailsViewModel::ConstructL() |
|
69 { |
|
70 LOG_ENTERFN( "CWsfDetailsViewModel::ConstructL" ); |
|
71 iFormattedWlanInfo = new (ELeave) CDesCArrayFlat( KWlanInfoGranularity ); |
|
72 } |
|
73 |
|
74 // --------------------------------------------------------------------------- |
|
75 // CWsfDetailsViewModel::NewL() |
|
76 // --------------------------------------------------------------------------- |
|
77 // |
|
78 EXPORT_C CWsfDetailsViewModel* CWsfDetailsViewModel::NewL() |
|
79 { |
|
80 LOG_ENTERFN( "CWsfDetailsViewModel::NewL" ); |
|
81 CWsfDetailsViewModel* self = CWsfDetailsViewModel::NewLC(); |
|
82 CleanupStack::Pop( self ); |
|
83 return self; |
|
84 } |
|
85 |
|
86 // --------------------------------------------------------------------------- |
|
87 // CWsfDetailsViewModel::NewLC() |
|
88 // --------------------------------------------------------------------------- |
|
89 // |
|
90 EXPORT_C CWsfDetailsViewModel* CWsfDetailsViewModel::NewLC() |
|
91 { |
|
92 LOG_ENTERFN( "CWsfDetailsViewModel::NewLC" ); |
|
93 CWsfDetailsViewModel* self = new( ELeave ) CWsfDetailsViewModel; |
|
94 CleanupStack::PushL( self ); |
|
95 self->ConstructL(); |
|
96 return self; |
|
97 } |
|
98 |
|
99 // --------------------------------------------------------------------------- |
|
100 // CWsfDetailsViewModel::~CWsfDetailsViewModel() |
|
101 // --------------------------------------------------------------------------- |
|
102 // |
|
103 CWsfDetailsViewModel::~CWsfDetailsViewModel() |
|
104 { |
|
105 LOG_ENTERFN( "CWsfDetailsViewModel::~CWsfDetailsViewModel" ); |
|
106 delete iFormattedWlanInfo; |
|
107 } |
|
108 |
|
109 // --------------------------------------------------------------------------- |
|
110 // CWsfDetailsViewModel::FormatWlanInfoL() |
|
111 // --------------------------------------------------------------------------- |
|
112 // |
|
113 CDesCArrayFlat* CWsfDetailsViewModel::FormatWlanInfoL( |
|
114 TWsfWlanInfo* aWlanInfo, |
|
115 CWsfWlanInfoArray* aWlanArray ) |
|
116 { |
|
117 LOG_ENTERFN( "CWsfDetailsViewModel::FormatWlanInfoL" ); |
|
118 _ASSERTD( aWlanArray ); |
|
119 |
|
120 for( TInt i = 0; i < iFormattedWlanInfo->MdcaCount(); i++) |
|
121 { |
|
122 TPtrC temp = iFormattedWlanInfo->MdcaPoint( i ); |
|
123 TBuf<100> tempElement = temp; |
|
124 LOG_WRITEF( "(1)iFormattedWlanInfo: %S", &tempElement ); |
|
125 } |
|
126 |
|
127 iWlanArray = aWlanArray; |
|
128 iFormattedWlanInfo->Reset(); |
|
129 |
|
130 TInt visibleWlans = VisibleWlans( *iWlanArray ); |
|
131 if ( aWlanInfo && visibleWlans ) |
|
132 { |
|
133 iWlanInfo = *aWlanInfo; |
|
134 TWsfWlanInfo* temp = iWlanArray->Match( aWlanInfo->iSsid, |
|
135 visibleWlans ); |
|
136 if ( temp ) |
|
137 { |
|
138 iIndex = iWlanArray->GetArrayIndex( temp ); |
|
139 } |
|
140 else |
|
141 { |
|
142 iIndex = iWlanArray->GetArrayIndex( &iWlanInfo ); |
|
143 } |
|
144 |
|
145 // create array of not-connected WLAN data |
|
146 FormatAndAppenWlanIapNameL(); |
|
147 FormatAndAppenWlanSsidL(); |
|
148 FormatAndAppenSingnalL(); |
|
149 FormatAndAppenModeL(); |
|
150 FormatAndAppenSecurityL(); |
|
151 FormatAndAppenCoverageL(); |
|
152 FormatAndAppenSpeedL(); |
|
153 } |
|
154 else if ( !aWlanInfo )// Current Wlan info has no signal |
|
155 { |
|
156 iWlanInfo.iStrengthLevel = EWlanSignalUnavailable; |
|
157 FormatAndAppenWlanIapNameL(); |
|
158 FormatAndAppenWlanSsidL(); |
|
159 FormatAndAppenSingnalL(); |
|
160 } |
|
161 |
|
162 for( TInt i = 0; i < iFormattedWlanInfo->MdcaCount(); i++) |
|
163 { |
|
164 TPtrC temp = iFormattedWlanInfo->MdcaPoint( i ); |
|
165 TBuf<100> tempElement = temp; |
|
166 LOG_WRITEF( "(2)iFormattedWlanInfo: %S", &tempElement ); |
|
167 } |
|
168 |
|
169 return iFormattedWlanInfo; |
|
170 } |
|
171 |
|
172 // --------------------------------------------------------------------------- |
|
173 // CWsfDetailsViewModel::FormatNextWlanInfoL() |
|
174 // --------------------------------------------------------------------------- |
|
175 // |
|
176 |
|
177 CDesCArrayFlat* CWsfDetailsViewModel::FormatNextWlanInfoL() |
|
178 { |
|
179 LOG_ENTERFN( "CWsfDetailsViewModel::FormatNextWlanInfoL" ); |
|
180 _ASSERTD( iWlanArray ); |
|
181 |
|
182 TInt visibleWlans = VisibleWlans( *iWlanArray ); |
|
183 |
|
184 if( iIndex < visibleWlans - 1 ) |
|
185 { |
|
186 iFormattedWlanInfo->Reset(); |
|
187 iIndex++; |
|
188 |
|
189 if( iIndex >= visibleWlans - 1 ) |
|
190 { |
|
191 // Set the index to point to the last visible in the array. |
|
192 iIndex = visibleWlans - 1; |
|
193 } |
|
194 else if ( iWlanInfo.SignalStrength() == ENoSignal ) |
|
195 { |
|
196 iIndex = 0; |
|
197 } |
|
198 |
|
199 // (Array bounds check is done in the first if sentence.) |
|
200 iWlanInfo = *(iWlanArray->At( iIndex ) ); |
|
201 FormatAndAppenWlanIapNameL(); |
|
202 FormatAndAppenWlanSsidL(); |
|
203 FormatAndAppenSingnalL(); |
|
204 FormatAndAppenModeL(); |
|
205 FormatAndAppenSecurityL(); |
|
206 FormatAndAppenCoverageL(); |
|
207 FormatAndAppenSpeedL(); |
|
208 } |
|
209 |
|
210 return iFormattedWlanInfo; |
|
211 } |
|
212 |
|
213 |
|
214 |
|
215 // --------------------------------------------------------------------------- |
|
216 // CWsfDetailsViewModel::FormatPreviousWlanInfoL() |
|
217 // --------------------------------------------------------------------------- |
|
218 // |
|
219 |
|
220 CDesCArrayFlat* CWsfDetailsViewModel::FormatPreviousWlanInfoL() |
|
221 { |
|
222 LOG_ENTERFN( "CWsfDetailsViewModel::FormatPreviousWlanInfoL" ); |
|
223 _ASSERTD( iWlanArray ); |
|
224 |
|
225 if( VisibleWlans( *iWlanArray ) ) |
|
226 { |
|
227 iFormattedWlanInfo->Reset(); |
|
228 iIndex--; |
|
229 |
|
230 if ( iIndex < 0 || iWlanInfo.SignalStrength() == ENoSignal ) |
|
231 { |
|
232 iIndex = 0; |
|
233 } |
|
234 |
|
235 // Just in case the iIndex would somehow point out of iWlanArray... |
|
236 if( iIndex >= (TInt)iWlanArray->Count() ) |
|
237 { |
|
238 iIndex = 0; |
|
239 } |
|
240 iWlanInfo = *(iWlanArray->At( iIndex ) ); |
|
241 FormatAndAppenWlanIapNameL(); |
|
242 FormatAndAppenWlanSsidL(); |
|
243 FormatAndAppenSingnalL(); |
|
244 FormatAndAppenModeL(); |
|
245 FormatAndAppenSecurityL(); |
|
246 FormatAndAppenCoverageL(); |
|
247 FormatAndAppenSpeedL(); |
|
248 } |
|
249 return iFormattedWlanInfo; |
|
250 } |
|
251 |
|
252 // --------------------------------------------------------------------------- |
|
253 // CWsfDetailsViewModel::FormatPaneTextLC() |
|
254 // --------------------------------------------------------------------------- |
|
255 // |
|
256 HBufC* CWsfDetailsViewModel::FormatPaneTextLC() |
|
257 { |
|
258 LOG_ENTERFN( "CWsfDetailsViewModel::FormatPaneTextLC" ); |
|
259 |
|
260 HBufC* paneText = NULL; |
|
261 |
|
262 if ( iWlanInfo.SignalStrength() == ENoSignal ) |
|
263 { |
|
264 paneText = KNullDesC().AllocLC(); |
|
265 } |
|
266 else |
|
267 { |
|
268 TInt visibleWlans = VisibleWlans( *iWlanArray ); |
|
269 if( visibleWlans ) |
|
270 { |
|
271 paneText = HBufC::NewLC( KPaneFormater().Length() + |
|
272 KNumberLegth + |
|
273 KNumberLegth ); |
|
274 |
|
275 TPtr paneTextPrt = paneText->Des(); |
|
276 |
|
277 // Format string ( KListItemFormat = %i/%i ) |
|
278 paneTextPrt.Format( KPaneFormater, |
|
279 iIndex + 1, |
|
280 visibleWlans ); |
|
281 } |
|
282 else |
|
283 { |
|
284 paneText = KNullDesC().AllocLC(); |
|
285 } |
|
286 } |
|
287 |
|
288 return paneText; |
|
289 } |
|
290 |
|
291 // --------------------------------------------------------------------------- |
|
292 // CWsfDetailsViewModel::FormatLeftScrollButton() |
|
293 // --------------------------------------------------------------------------- |
|
294 // |
|
295 TBool CWsfDetailsViewModel::FormatLeftScrollButton() |
|
296 { |
|
297 LOG_ENTERFN( "CWsfDetailsViewModel::FormatLeftScrollButton" ); |
|
298 TBool leftButton( EFalse ); |
|
299 |
|
300 if ( iIndex == 0 ) |
|
301 { |
|
302 leftButton = ETrue; |
|
303 } |
|
304 |
|
305 return leftButton; |
|
306 } |
|
307 |
|
308 // --------------------------------------------------------------------------- |
|
309 // CWsfDetailsViewModel::FormatRightScrollButton() |
|
310 // --------------------------------------------------------------------------- |
|
311 // |
|
312 TBool CWsfDetailsViewModel::FormatRightScrollButton() |
|
313 { |
|
314 LOG_ENTERFN( "CWsfDetailsViewModel::FormatRightScrollButton" ); |
|
315 TBool rightButton( EFalse ); |
|
316 TInt count = iWlanArray->Count(); |
|
317 |
|
318 if ( iIndex + 1 >= count ) |
|
319 { |
|
320 rightButton = ETrue; |
|
321 } |
|
322 |
|
323 return rightButton; |
|
324 } |
|
325 |
|
326 // --------------------------------------------------------------------------- |
|
327 // CWsfDetailsViewModel::GetWlanDetails() |
|
328 // --------------------------------------------------------------------------- |
|
329 // |
|
330 CDesCArrayFlat* CWsfDetailsViewModel::GetWlanDetails() |
|
331 { |
|
332 return iFormattedWlanInfo; |
|
333 } |
|
334 |
|
335 // --------------------------------------------------------------------------- |
|
336 // CWsfDetailsViewModel::WlanSsid() |
|
337 // --------------------------------------------------------------------------- |
|
338 // |
|
339 const TDesC8& CWsfDetailsViewModel::WlanSsid() const |
|
340 { |
|
341 return iWlanInfo.iSsid; |
|
342 } |
|
343 |
|
344 // --------------------------------------------------------------------------- |
|
345 // CWsfDetailsViewModel::FormatListBoxItemLC |
|
346 // --------------------------------------------------------------------------- |
|
347 // |
|
348 HBufC* CWsfDetailsViewModel::FormatListBoxItemLC( |
|
349 const TUint aResourceId, |
|
350 const TDesC& aValueText ) const |
|
351 { |
|
352 LOG_ENTERFN( "CWsfDetailsViewModel::FormatListBoxItemLC" ); |
|
353 // hold the column name on list item |
|
354 HBufC* columnName = NULL; |
|
355 |
|
356 if ( aResourceId ) |
|
357 { |
|
358 columnName = StringLoader::LoadLC( aResourceId ); |
|
359 } |
|
360 else |
|
361 { |
|
362 columnName = KNullDesC().AllocLC(); |
|
363 } |
|
364 |
|
365 |
|
366 // Holds the list box item |
|
367 HBufC* listBoxItem = HBufC::NewL( KListItemFormat().Length()+ |
|
368 columnName->Length() + |
|
369 aValueText.Length() ); |
|
370 |
|
371 // For formating needs |
|
372 TPtr listBoxItemPrt = listBoxItem->Des(); |
|
373 |
|
374 // Format string ( KListItemFormat = %S\t%S ) |
|
375 listBoxItemPrt.Format( KListItemFormat, columnName, &aValueText ); |
|
376 CleanupStack::PopAndDestroy( columnName ); |
|
377 CleanupStack::PushL( listBoxItem ); |
|
378 return listBoxItem; |
|
379 } |
|
380 |
|
381 // --------------------------------------------------------------------------- |
|
382 // CWsfDetailsViewModel::FormatAndAppenWlanIapNameL() |
|
383 // --------------------------------------------------------------------------- |
|
384 // |
|
385 void CWsfDetailsViewModel::FormatAndAppenWlanIapNameL() |
|
386 { |
|
387 LOG_ENTERFN( "CWsfDetailsViewModel::FormatAndAppenWlanIapNameL" ); |
|
388 if ( iWlanInfo.iNetworkName.Length() ) |
|
389 { |
|
390 HBufC* wlanIapName = iWlanInfo.GetIapNameAsUnicodeLC(); |
|
391 HBufC* listBoxItem = FormatListBoxItemLC( |
|
392 R_QTN_CMON_HEADING_CONN_NAME, |
|
393 *wlanIapName ); |
|
394 |
|
395 iFormattedWlanInfo->AppendL( *listBoxItem ); |
|
396 CleanupStack::PopAndDestroy( listBoxItem ); |
|
397 CleanupStack::PopAndDestroy( wlanIapName ); |
|
398 } |
|
399 } |
|
400 |
|
401 // --------------------------------------------------------------------------- |
|
402 // CWsfDetailsViewModel::FormatAndAppenWlanSsidL() |
|
403 // --------------------------------------------------------------------------- |
|
404 // |
|
405 void CWsfDetailsViewModel::FormatAndAppenWlanSsidL() |
|
406 { |
|
407 LOG_ENTERFN( "CWsfDetailsViewModel::FormatAndAppenWlanSsidL" ); |
|
408 HBufC* wlanSsid = iWlanInfo.GetSsidAsUnicodeLC(); |
|
409 HBufC* listBoxItem = FormatListBoxItemLC( |
|
410 R_QTN_SNIFFER_HEADING_WLAN_NETWORK_NAME, |
|
411 *wlanSsid ); |
|
412 |
|
413 iFormattedWlanInfo->AppendL( *listBoxItem ); |
|
414 CleanupStack::PopAndDestroy( listBoxItem ); |
|
415 CleanupStack::PopAndDestroy( wlanSsid ); |
|
416 } |
|
417 |
|
418 // --------------------------------------------------------------------------- |
|
419 // CWsfDetailsViewModel::FormatAndAppenSingnalL() |
|
420 // --------------------------------------------------------------------------- |
|
421 // |
|
422 void CWsfDetailsViewModel::FormatAndAppenSingnalL() |
|
423 { |
|
424 LOG_ENTERFN( "CWsfDetailsViewModel::FormatAndAppenSingnalL" ); |
|
425 HBufC* singnalStrength = FormatSingnalStrenghtLC(); |
|
426 HBufC* listBoxItem = FormatListBoxItemLC( |
|
427 R_QTN_SNIFFER_HEADING_WLAN_SIGNAL_STRENGTH, |
|
428 *singnalStrength ); |
|
429 |
|
430 iFormattedWlanInfo->AppendL( *listBoxItem ); |
|
431 CleanupStack::PopAndDestroy( listBoxItem ); |
|
432 CleanupStack::PopAndDestroy( singnalStrength ); |
|
433 } |
|
434 |
|
435 // --------------------------------------------------------------------------- |
|
436 // CWsfDetailsViewModel::FormatAndAppenModeL() |
|
437 // --------------------------------------------------------------------------- |
|
438 // |
|
439 void CWsfDetailsViewModel::FormatAndAppenModeL() |
|
440 { |
|
441 LOG_ENTERFN( "CWsfDetailsViewModel::FormatAndAppenModeL" ); |
|
442 HBufC* mode = FormatModeLC(); |
|
443 HBufC* listBoxItem = FormatListBoxItemLC( |
|
444 R_QTN_SNIFFER_HEADING_WLAN_NETWORK_MODE, |
|
445 *mode ); |
|
446 |
|
447 iFormattedWlanInfo->AppendL( *listBoxItem ); |
|
448 CleanupStack::PopAndDestroy( listBoxItem ); |
|
449 CleanupStack::PopAndDestroy( mode ); |
|
450 } |
|
451 |
|
452 // --------------------------------------------------------------------------- |
|
453 // CWsfDetailsViewModel::FormatAndAppenSecurityL() |
|
454 // --------------------------------------------------------------------------- |
|
455 // |
|
456 void CWsfDetailsViewModel::FormatAndAppenSecurityL() |
|
457 { |
|
458 LOG_ENTERFN( "CWsfDetailsViewModel::FormatAndAppenSecurityL" ); |
|
459 HBufC* security = FormatSecurityLC(); |
|
460 HBufC* listBoxItem = FormatListBoxItemLC( |
|
461 R_QTN_SNIFFER_HEADING_WLAN_SECURITY_MODE, |
|
462 *security ); |
|
463 |
|
464 iFormattedWlanInfo->AppendL( *listBoxItem ); |
|
465 CleanupStack::PopAndDestroy( listBoxItem ); |
|
466 CleanupStack::PopAndDestroy( security ); |
|
467 } |
|
468 |
|
469 // --------------------------------------------------------------------------- |
|
470 // CWsfDetailsViewModel::FormatAndAppenCoverageL() |
|
471 // --------------------------------------------------------------------------- |
|
472 // |
|
473 void CWsfDetailsViewModel::FormatAndAppenCoverageL() |
|
474 { |
|
475 LOG_ENTERFN( "CWsfDetailsViewModel::FormatAndAppenCoverageL" ); |
|
476 HBufC* coverage = FormatCoverageLC(); |
|
477 HBufC* listBoxItem = FormatListBoxItemLC( |
|
478 R_QTN_SNIFFER_HEADING_WLAN_NW_AP_AMOUNT, |
|
479 *coverage ); |
|
480 |
|
481 iFormattedWlanInfo->AppendL( *listBoxItem ); |
|
482 CleanupStack::PopAndDestroy( listBoxItem ); |
|
483 CleanupStack::PopAndDestroy( coverage ); |
|
484 } |
|
485 |
|
486 // --------------------------------------------------------------------------- |
|
487 // CWsfDetailsViewModel::FormatAndAppenSpeedL() |
|
488 // --------------------------------------------------------------------------- |
|
489 // |
|
490 void CWsfDetailsViewModel::FormatAndAppenSpeedL() |
|
491 { |
|
492 LOG_ENTERFN( "CWsfDetailsViewModel::FormatAndAppenSpeedL" ); |
|
493 HBufC* speed = FormatTechnologyLC(); |
|
494 HBufC* listBoxItem = FormatListBoxItemLC( |
|
495 R_QTN_SNIFFER_HEADING_WLAN_NW_MAX_RATE, |
|
496 *speed ); |
|
497 |
|
498 iFormattedWlanInfo->AppendL( *listBoxItem ); |
|
499 CleanupStack::PopAndDestroy( listBoxItem ); |
|
500 CleanupStack::PopAndDestroy( speed ); |
|
501 } |
|
502 |
|
503 // --------------------------------------------------------------------------- |
|
504 // CWsfDetailsViewModel::FormatSingnalStrenghtLC() |
|
505 // --------------------------------------------------------------------------- |
|
506 // |
|
507 HBufC* CWsfDetailsViewModel::FormatSingnalStrenghtLC() |
|
508 { |
|
509 LOG_ENTERFN( "CWsfDetailsViewModel::FormatSingnalStrenghtLC" ); |
|
510 // Holds the showed signal strenth string |
|
511 HBufC* singnalStrengthString = NULL; |
|
512 |
|
513 // Get string |
|
514 switch( iWlanInfo.SignalStrength() ) |
|
515 { |
|
516 case ENoSignal: |
|
517 { |
|
518 singnalStrengthString = StringLoader::LoadLC( |
|
519 R_QTN_SNIFFER_WLAN_SIGNAL_STRENGTH_NO_SIGNAL, iCoeEnv ); |
|
520 break; |
|
521 } |
|
522 case EPoor: |
|
523 { |
|
524 singnalStrengthString = StringLoader::LoadLC ( |
|
525 R_QTN_SNIFFER_WLAN_SIGNAL_STRENGTH_LOW, |
|
526 iWlanInfo.SignalStrengthPercentage(), |
|
527 iCoeEnv ); |
|
528 break; |
|
529 } |
|
530 case EAverage: |
|
531 { |
|
532 singnalStrengthString = StringLoader::LoadLC ( |
|
533 R_QTN_SNIFFER_WLAN_SIGNAL_STRENGTH_MEDIUM, |
|
534 iWlanInfo.SignalStrengthPercentage(), |
|
535 iCoeEnv ); |
|
536 break; |
|
537 } |
|
538 case EExcelent: |
|
539 { |
|
540 singnalStrengthString = StringLoader::LoadLC ( |
|
541 R_QTN_SNIFFER_WLAN_SIGNAL_STRENGTH_STRONG, |
|
542 iWlanInfo.SignalStrengthPercentage(), |
|
543 iCoeEnv ); |
|
544 break; |
|
545 } |
|
546 default: |
|
547 { |
|
548 return KNullDesC().AllocLC(); |
|
549 } |
|
550 |
|
551 } |
|
552 return singnalStrengthString; |
|
553 } |
|
554 |
|
555 // --------------------------------------------------------- |
|
556 // CWsfDetailsViewModel::FormatModeLC |
|
557 // --------------------------------------------------------- |
|
558 // |
|
559 HBufC* CWsfDetailsViewModel::FormatModeLC() |
|
560 { |
|
561 LOG_ENTERFN( "CWsfDetailsViewModel::FormatModeLC" ); |
|
562 TInt resourceId(0); |
|
563 |
|
564 switch( iWlanInfo.iNetMode ) |
|
565 { |
|
566 case EAdhoc: |
|
567 { |
|
568 resourceId = R_QTN_SNIFFER_WLAN_SETT_NEWTWORK_MODE_ADHOC; |
|
569 break; |
|
570 } |
|
571 |
|
572 case EInfra: |
|
573 { |
|
574 resourceId = R_QTN_SNIFFER_WLAN_SETT_NEWTWORK_MODE_INFRA; |
|
575 break; |
|
576 } |
|
577 default: |
|
578 { |
|
579 return KNullDesC().AllocLC(); |
|
580 } |
|
581 |
|
582 } |
|
583 |
|
584 return StringLoader::LoadLC( resourceId ); |
|
585 } |
|
586 |
|
587 // --------------------------------------------------------- |
|
588 // CWsfDetailsViewModel::FormatSecurityLC |
|
589 // --------------------------------------------------------- |
|
590 // |
|
591 HBufC* CWsfDetailsViewModel::FormatSecurityLC() |
|
592 { |
|
593 LOG_ENTERFN( "CWsfDetailsViewModel::FormatSecurityLC" ); |
|
594 TInt resourceId(0); |
|
595 |
|
596 switch( iWlanInfo.iSecurityMode ) |
|
597 { |
|
598 |
|
599 case EWlanSecModeOpen: |
|
600 { |
|
601 resourceId = R_QTN_SNIFFER_WLAN_SETT_SECURITY_MODE_OPEN; |
|
602 break; |
|
603 } |
|
604 case EWlanSecModeWep: |
|
605 { |
|
606 resourceId = R_QTN_SNIFFER_WLAN_SETT_SECURITY_MODE_WEP; |
|
607 break; |
|
608 } |
|
609 case EWlanSecMode802_1x: |
|
610 { |
|
611 resourceId = R_QTN_SNIFFER_WLAN_SETT_SECURITY_MODE_802_1X; |
|
612 break; |
|
613 } |
|
614 case EWlanSecModeWpa: |
|
615 case EWlanSecModeWpa2: |
|
616 { |
|
617 resourceId = R_QTN_SNIFFER_WLAN_SETT_SECURITY_MODE_WPA; |
|
618 break; |
|
619 } |
|
620 case EWlanSecModeWAPI: |
|
621 { |
|
622 resourceId = R_QTN_SNIFFER_WLAN_SETT_SECURITY_MODE_WAPI; |
|
623 break; |
|
624 } |
|
625 default: |
|
626 { |
|
627 return KNullDesC().AllocLC(); |
|
628 } |
|
629 } |
|
630 |
|
631 return StringLoader::LoadLC( resourceId ); |
|
632 } |
|
633 |
|
634 // --------------------------------------------------------------------------- |
|
635 // CWsfDetailsViewModel::FormatCoverageLC |
|
636 // --------------------------------------------------------------------------- |
|
637 // |
|
638 HBufC* CWsfDetailsViewModel::FormatCoverageLC() |
|
639 { |
|
640 LOG_ENTERFN( "CWsfDetailsViewModel::FormatCoverageLC" ); |
|
641 if ( iWlanInfo.iCoverage == 1) |
|
642 { |
|
643 return StringLoader::LoadLC( |
|
644 R_QTN_SNIFFER_WLAN_AP_AMOUNT_IN_RANGE, iCoeEnv ); |
|
645 } |
|
646 else |
|
647 { |
|
648 return StringLoader::LoadLC( |
|
649 R_QTN_SNIFFER_WLAN_AP_AMOUNT_IN_RANGE_MANY, |
|
650 iWlanInfo.iCoverage, iCoeEnv ); |
|
651 } |
|
652 } |
|
653 |
|
654 // --------------------------------------------------------- |
|
655 // CWsfDetailsViewModel::FormatTechnologyLC |
|
656 // --------------------------------------------------------- |
|
657 // |
|
658 HBufC* CWsfDetailsViewModel::FormatTechnologyLC() |
|
659 { |
|
660 LOG_ENTERFN( "CWsfDetailsViewModel::FormatTechnologyLC" ); |
|
661 TInt resourceId( 0 ); |
|
662 |
|
663 switch( iWlanInfo.iTransferRate ) |
|
664 { |
|
665 |
|
666 case 1: |
|
667 { |
|
668 resourceId = R_QTN_SNIFFER_WLAN_SETT_TECHNOLOGY_802_11B; |
|
669 break; |
|
670 } |
|
671 case 2: |
|
672 { |
|
673 resourceId = R_QTN_SNIFFER_WLAN_SETT_TECHNOLOGY_802_11G; |
|
674 break; |
|
675 } |
|
676 case 4: |
|
677 { |
|
678 resourceId = R_QTN_SNIFFER_WLAN_SETT_TECHNOLOGY_802_11BG; |
|
679 break; |
|
680 } |
|
681 case 8: |
|
682 { |
|
683 resourceId = R_QTN_SNIFFER_WLAN_SETT_TECHNOLOGY_802_11N; |
|
684 break; |
|
685 } |
|
686 default: |
|
687 { |
|
688 return KNullDesC().AllocLC(); |
|
689 } |
|
690 } |
|
691 |
|
692 return StringLoader::LoadLC( resourceId ); |
|
693 } |
|
694 |
|
695 // --------------------------------------------------------------------------- |
|
696 // CWsfDetailsViewModel::VisibleWlans |
|
697 // --------------------------------------------------------------------------- |
|
698 // |
|
699 TInt CWsfDetailsViewModel::VisibleWlans( CWsfWlanInfoArray& aArray ) |
|
700 { |
|
701 LOG_ENTERFN( "CWsfDetailsViewModel::VisibleWlans" ); |
|
702 TUint i = 0; |
|
703 TWsfWlanInfo* wlanInfo; |
|
704 LOG_WRITEF( "Number of Wlans: %d", aArray.Count() ); |
|
705 // The hidden WLAN should be in the end of the aArray. |
|
706 while ( i < aArray.Count() ) |
|
707 { |
|
708 wlanInfo = aArray[i]; |
|
709 if ( wlanInfo->Hidden() && !wlanInfo->Known() ) |
|
710 { |
|
711 break; // Hidden was found. Break to exit the while-loop. |
|
712 } |
|
713 ++i; |
|
714 } |
|
715 |
|
716 LOG_WRITEF( "VisibleWlans: %d", i ); |
|
717 return i; |
|
718 } |
|
719 |
|
720 // END OF FILE |
|
721 |
|