wlanutilities/wlansniffer/aiplugin/src/wsfaimodel.cpp
branchRCL_3
changeset 24 63be7eb3fc78
parent 23 b852595f5cbe
child 25 f28ada11abbf
equal deleted inserted replaced
23:b852595f5cbe 24:63be7eb3fc78
     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 CWsfAiModel.
       
    15 *
       
    16 */
       
    17 
       
    18 //  EXTERNAL INCLUDES
       
    19 #include <badesca.h>
       
    20 #include <coemain.h>
       
    21 #include <StringLoader.h>
       
    22 #include <wsfaipluginrsc.rsg>
       
    23 
       
    24 //  INTERNAL INCLUDES
       
    25 #include "wsfaimodel.h"
       
    26 #include "wsfwlaninfo.h"
       
    27 #include "wsfwlaninfoarray.h"
       
    28 #include "wsfaiplugincommon.h"
       
    29 #include "wsfwlaninfoarrayvisitor.h"
       
    30 #include "wsflogger.h"
       
    31 
       
    32 //  MACROS
       
    33 #ifdef _DEBUG
       
    34     _LIT( KModelPanic, "CWsfAiModel" );
       
    35     #define _ASS_D( cond ) __ASSERT_DEBUG( (cond), \
       
    36             User::Panic( KModelPanic, __LINE__) )
       
    37 #else
       
    38         #define _ASS_D( cond ) {}
       
    39 #endif //_DEBUG
       
    40     
       
    41 //  LOCAL DEFINITIONS
       
    42 const TInt KListBoxItemMaxLength = 128;
       
    43 const TUint KWLanListGranularity = 4;
       
    44 
       
    45 // List item format
       
    46 _LIT( KListItemFormat, "%d\t%S\t%d\t%d" ); 
       
    47 
       
    48 // List item format for "Other (unlisted)" item
       
    49 _LIT( KHiddenItemFormat, "\t%S" );
       
    50 
       
    51 
       
    52 //  CONSTRUCTION AND DESTRUCTION
       
    53 // --------------------------------------------------------------------------
       
    54 // CWsfAiModel::NewL
       
    55 // --------------------------------------------------------------------------
       
    56 //
       
    57 CWsfAiModel* CWsfAiModel::NewL()
       
    58     {
       
    59     CWsfAiModel* self = CWsfAiModel::NewLC();
       
    60     CleanupStack::Pop( self );
       
    61     return self;
       
    62     }
       
    63 
       
    64 
       
    65 // --------------------------------------------------------------------------
       
    66 // CWsfAiModel::NewLC
       
    67 // --------------------------------------------------------------------------
       
    68 //
       
    69 CWsfAiModel* CWsfAiModel::NewLC()
       
    70     {
       
    71     CWsfAiModel* self = new( ELeave ) CWsfAiModel;
       
    72     CleanupStack::PushL( self );
       
    73     self->ConstructL();
       
    74     return self;
       
    75     }
       
    76 
       
    77 
       
    78 // --------------------------------------------------------------------------
       
    79 // CWsfAiModel::~CWsfAiModel
       
    80 // --------------------------------------------------------------------------
       
    81 //
       
    82 CWsfAiModel::~CWsfAiModel()
       
    83     {  
       
    84     delete iWlanInfoBranding;
       
    85     delete iFormattedWlanList;
       
    86     if ( iStatusRefreshing )
       
    87         {
       
    88         delete iStatusRefreshing;
       
    89         }
       
    90     if ( iStatusConnecting )
       
    91         {
       
    92         delete iStatusConnecting;
       
    93         }
       
    94     if ( iStatusScanningOff )
       
    95         {
       
    96         delete iStatusScanningOff;
       
    97         }
       
    98     if ( iManualSSIDInputting )
       
    99         {
       
   100         delete iManualSSIDInputting;
       
   101         }
       
   102     }
       
   103 
       
   104 
       
   105 // --------------------------------------------------------------------------
       
   106 // CWsfAiModel::CWsfAiModel
       
   107 // --------------------------------------------------------------------------
       
   108 //
       
   109 CWsfAiModel::CWsfAiModel(): 
       
   110     iCoeEnv( CCoeEnv::Static() ),
       
   111     iScanning( EFalse ),
       
   112     iConnected( EFalse ),
       
   113     iRefreshIndex( iRefreshIcons.Count() - 1 ),
       
   114     iConnectingIndex( iConnectingIcons.Count() - 1 )
       
   115     {
       
   116     }
       
   117 
       
   118 
       
   119 // --------------------------------------------------------------------------
       
   120 // CWsfAiModel::ConstructL
       
   121 // --------------------------------------------------------------------------
       
   122 //
       
   123 void CWsfAiModel::ConstructL()
       
   124     {
       
   125     iFormattedWlanList = new (ELeave) CDesCArrayFlat( KWLanListGranularity );
       
   126     iWlanInfoBranding = CWsfWlanInfoArrayVisitor::NewL( ETrue );
       
   127     iWlanInfoBranding->LoadFilterDefinitionsL();  
       
   128     
       
   129     iRefreshIcons[0] = EWlanOnIcon_0;
       
   130     iRefreshIcons[1] = EWlanOnIcon_1;
       
   131     iRefreshIcons[2] = EWlanOnIcon;
       
   132     iRefreshIcons[3] = EWlanOnIcon_1;
       
   133     
       
   134     iConnectingIcons[0] = EWlanOnIcon_0;
       
   135     iConnectingIcons[1] = EWlanOnIcon_1;
       
   136     iConnectingIcons[2] = EWlanOnIcon;
       
   137     iConnectingIcons[3] = EWlanOnIcon_1;
       
   138     }
       
   139 
       
   140 
       
   141 // --------------------------------------------------------------------------
       
   142 // CWsfAiModel::FormatWlanListL
       
   143 // --------------------------------------------------------------------------
       
   144 //
       
   145 CDesCArrayFlat* CWsfAiModel::FormatWlanListL( CWsfWlanInfoArray* aWlanList, const TBool aUIPrioritySort )
       
   146     {
       
   147     LOG_ENTERFN( "CWsfAiModel::FormatWlanListL" );
       
   148     HBufC* item = HBufC::NewLC( KListBoxItemMaxLength );
       
   149     TPtr ptr( item->Des() ); 
       
   150     iFormattedWlanList->Reset();
       
   151     
       
   152     // Function expects that items in list are already in proper order
       
   153     iWlanInfoArray = aWlanList;
       
   154     
       
   155     if ( iWlanInfoArray )
       
   156         {
       
   157         if ( aUIPrioritySort )
       
   158             {
       
   159             iWlanInfoArray->SetUIPrioritySort( ETrue );
       
   160             iWlanInfoArray->SortArrayL( *iWlanInfoBranding );
       
   161             // Sort Array with default sort
       
   162             // this sets the highest UI priority networks on top
       
   163             iWlanInfoArray->SortArrayL( );
       
   164             iWlanInfoArray->SetUIPrioritySort( EFalse );
       
   165             }
       
   166         else
       
   167             {
       
   168             iWlanInfoArray->SortArrayL( *iWlanInfoBranding );
       
   169             }
       
   170                
       
   171         for (TInt i = 0; i < iWlanInfoArray->Count(); ++i )
       
   172             {
       
   173             TWsfWlanInfo* wlanInfo = iWlanInfoArray->At(i);
       
   174         
       
   175             // Hidden WLAN item is appended later for unknown hidden networks
       
   176             if ( !wlanInfo || ( wlanInfo->Hidden() && !wlanInfo->iIapId ) )
       
   177                 {
       
   178                 continue;
       
   179                 }
       
   180             
       
   181             // known hidden wlans are also "visible"
       
   182             ptr.Zero();
       
   183             FormatWlanSingleLineL( *wlanInfo, ptr, EFalse );
       
   184             iFormattedWlanList->AppendL( ptr );
       
   185             }
       
   186         }
       
   187 
       
   188     // now add "Other (unlisted)..." for hidden networks (always visible)
       
   189     // make up a dummy wlaninfo
       
   190     TWsfWlanInfo dummy;
       
   191     
       
   192     ptr.Zero();
       
   193     FormatHiddenWlanItemL( dummy, ptr );
       
   194     iFormattedWlanList->AppendL( ptr );
       
   195 
       
   196     CleanupStack::PopAndDestroy ( item );
       
   197     return iFormattedWlanList;
       
   198     }
       
   199 
       
   200 
       
   201 // --------------------------------------------------------------------------
       
   202 // CWsfAiModel::GetWlanList
       
   203 // --------------------------------------------------------------------------
       
   204 //
       
   205 CDesCArrayFlat* CWsfAiModel::GetWlanList()
       
   206     {
       
   207     LOG_ENTERFN( "CWsfAiModel::GetWlanList" );
       
   208     return iFormattedWlanList;
       
   209     }
       
   210 
       
   211 
       
   212 // --------------------------------------------------------------------------
       
   213 // CWsfAiModel::GetInfoArray
       
   214 // --------------------------------------------------------------------------
       
   215 //
       
   216 CWsfWlanInfoArray* CWsfAiModel::GetInfoArray()
       
   217     {
       
   218     LOG_ENTERFN( "CWsfAiModel::GetInfoArray" );
       
   219     return iWlanInfoArray;
       
   220     }
       
   221 
       
   222 
       
   223 // --------------------------------------------------------------------------
       
   224 // CWsfAiModel::FormatSingleLineWlanListL
       
   225 // --------------------------------------------------------------------------
       
   226 //
       
   227 CDesCArrayFlat* CWsfAiModel::FormatSingleLineWlanListL( 
       
   228                                         CWsfWlanInfoArray* aWlanList )
       
   229     {
       
   230     LOG_ENTERFN( "CWsfAiModel::FormatSingleLineWlanListL" );
       
   231     iWlanInfoArray = aWlanList;
       
   232     
       
   233     if ( iWlanInfoArray )
       
   234         {
       
   235         iWlanInfoArray->SetUIPrioritySort( ETrue );
       
   236         iWlanInfoArray->SortArrayL( *iWlanInfoBranding );
       
   237         
       
   238         // Sort Array with default sort
       
   239         // this sets the highest UI priority networks on top
       
   240         iWlanInfoArray->SortArrayL();
       
   241         iWlanInfoArray->SetUIPrioritySort( EFalse );
       
   242         }
       
   243       
       
   244     iFormattedWlanList->Reset();
       
   245             
       
   246     HBufC* item = HBufC::NewLC( KListBoxItemMaxLength );
       
   247     TPtr ptr( item->Des() );
       
   248         
       
   249     if ( iConnected )
       
   250         {
       
   251         FormatConnectedL( ptr );
       
   252         iFormattedWlanList->AppendL( ptr );
       
   253         }
       
   254     else if ( iConnecting )
       
   255         {
       
   256         FormatConnectingL();
       
   257         }
       
   258     else if ( !iScanning )
       
   259         {
       
   260         FormatStatusOffL( ptr );
       
   261         iFormattedWlanList->AppendL( ptr );       
       
   262         }
       
   263     // if there's wlans avail
       
   264     else if ( iWlanInfoArray && iWlanInfoArray->Count() )
       
   265         {
       
   266         CheckWlansL( iWlanInfoArray, ptr );
       
   267         iFormattedWlanList->AppendL( ptr );
       
   268         }
       
   269     else 
       
   270         {
       
   271         // no wlans available
       
   272         FormatNoWlansAvailableL( ptr );
       
   273         iFormattedWlanList->AppendL( ptr );
       
   274         }
       
   275         
       
   276     CleanupStack::PopAndDestroy( item );
       
   277           
       
   278     return iFormattedWlanList;
       
   279     }
       
   280 
       
   281 
       
   282 // --------------------------------------------------------------------------
       
   283 // CWsfAiModel::FormatRefreshingL
       
   284 // --------------------------------------------------------------------------
       
   285 //
       
   286 CDesCArrayFlat* CWsfAiModel::FormatRefreshingL()
       
   287     {
       
   288     LOG_ENTERFN( "CWsfAiModel::FormatRefreshingL" );
       
   289     iFormattedWlanList->Reset();
       
   290     HBufC* item = HBufC::NewLC( KListBoxItemMaxLength );
       
   291     TPtr ptr( item->Des() );           
       
   292     
       
   293     if ( !iStatusRefreshing )
       
   294         {
       
   295         iStatusRefreshing = StringLoader::LoadL( 
       
   296                 R_QTN_SNIFFER_PLUG_IN_REFRESHING );
       
   297         }
       
   298    
       
   299     ptr.Format( KListItemFormat, ScanningOn() ? 
       
   300     		                     iRefreshIcons[ iRefreshIndex ] 
       
   301                                   : EWlanOffIcon, 
       
   302                                   iStatusRefreshing,
       
   303                                  ETransparentIcon, 
       
   304                                  ETransparentIcon );
       
   305         
       
   306     iFormattedWlanList->AppendL( ptr );   
       
   307     CleanupStack::PopAndDestroy ( item );
       
   308 
       
   309     return iFormattedWlanList;
       
   310     }
       
   311 
       
   312 
       
   313 // --------------------------------------------------------------------------
       
   314 // CWsfAiModel::FormatConnecting
       
   315 // --------------------------------------------------------------------------
       
   316 //
       
   317 CDesCArrayFlat* CWsfAiModel::FormatConnectingL()
       
   318     {
       
   319     LOG_ENTERFN( "CWsfAiModel::FormatConnectingL" );
       
   320     iFormattedWlanList->Reset();
       
   321     HBufC* item = HBufC::NewLC( KListBoxItemMaxLength );
       
   322     TPtr ptr( item->Des() );           
       
   323     
       
   324     if ( !iStatusConnecting )
       
   325         {
       
   326         iStatusConnecting = StringLoader::LoadL( 
       
   327                 R_QTN_SNIFFER_PLUG_IN_CONNECTING );
       
   328         }
       
   329    
       
   330     ptr.Format( KListItemFormat, iConnectingIcons[ iConnectingIndex ], 
       
   331                                  iStatusConnecting,
       
   332                                  ETransparentIcon, 
       
   333                                  ETransparentIcon );
       
   334         
       
   335     iFormattedWlanList->AppendL( ptr );   
       
   336     CleanupStack::PopAndDestroy ( item );
       
   337     return iFormattedWlanList;
       
   338     }
       
   339 
       
   340 
       
   341 // --------------------------------------------------------------------------
       
   342 // CWsfAiModel::AppendBrandIconsL
       
   343 // --------------------------------------------------------------------------
       
   344 //
       
   345 void CWsfAiModel::AppendBrandIconsL( CAknIconArray& aIconArray )
       
   346     {
       
   347     LOG_ENTERFN( "CWsfAiModel::AppendBrandIconsL" );
       
   348     iWlanInfoBranding->AppendBrandingIconsL( aIconArray );
       
   349     }
       
   350 
       
   351 
       
   352 // --------------------------------------------------------------------------
       
   353 // CWsfAiModel::FormatHiddenWlanItemL
       
   354 // --------------------------------------------------------------------------
       
   355 //
       
   356 void CWsfAiModel::FormatHiddenWlanItemL( TWsfWlanInfo& /*aWlan*/, 
       
   357                                          TPtr& aItem )
       
   358     {
       
   359     LOG_ENTERFN( "CWsfAiModel::FormatHiddenWlanItemL" );
       
   360     if ( !iManualSSIDInputting )
       
   361         {
       
   362         iManualSSIDInputting = StringLoader::LoadL( 
       
   363                 R_QTN_WLAN_MANUAL_SSID_INPUT );
       
   364         }
       
   365 
       
   366     // Only Hidden WLAN text is shown.
       
   367     // No icons for this item
       
   368     aItem.Format( KHiddenItemFormat, iManualSSIDInputting );      
       
   369     }
       
   370 
       
   371 
       
   372 // --------------------------------------------------------------------------
       
   373 // CWsfAiModel::FormatStatusOffL
       
   374 // --------------------------------------------------------------------------
       
   375 //
       
   376 void CWsfAiModel::FormatStatusOffL( TPtr& aItem )
       
   377     {
       
   378     LOG_ENTERFN( "CWsfAiModel::FormatStatusOffL" );
       
   379     if ( !iStatusScanningOff )
       
   380         {
       
   381         iStatusScanningOff = StringLoader::LoadL( 
       
   382                 R_QTN_SNIFFER_PLUG_IN_SCANNING_OFF );
       
   383         }
       
   384 
       
   385         aItem.Format( KListItemFormat, 
       
   386                       EWlanOffIcon, 
       
   387                       iStatusScanningOff,
       
   388                       ETransparentIcon, 
       
   389                       ETransparentIcon );         
       
   390     }
       
   391 
       
   392 
       
   393 // --------------------------------------------------------------------------
       
   394 // CWsfAiModel::FormatNoWlansAvailableL
       
   395 // --------------------------------------------------------------------------
       
   396 //
       
   397 void CWsfAiModel::FormatNoWlansAvailableL( TPtr& aItem )
       
   398     {
       
   399     LOG_ENTERFN( "CWsfAiModel::FormatNoWlansAvailableL" );
       
   400 
       
   401     if ( !iNoWLANsAvailable )
       
   402         {
       
   403         iNoWLANsAvailable = StringLoader::LoadL( 
       
   404                 R_QTN_STATUS_NO_WLANS_AVAILABLE );
       
   405         }
       
   406    
       
   407         aItem.Format( KListItemFormat, 
       
   408                       ScanningOn()? EWlanOnIcon: EWlanOffIcon, 
       
   409                       iNoWLANsAvailable,
       
   410                       ETransparentIcon, 
       
   411                       ETransparentIcon );  
       
   412     }
       
   413 
       
   414 
       
   415 // --------------------------------------------------------------------------
       
   416 // CWsfAiModel::FormatWlanSingleLineL
       
   417 // --------------------------------------------------------------------------
       
   418 //
       
   419 void CWsfAiModel::FormatWlanSingleLineL( TWsfWlanInfo& aWlan, 
       
   420                                          TPtr& aItem, 
       
   421                                          TBool aSingleLine )
       
   422     {
       
   423     LOG_ENTERFN( "CWsfAiModel::FormatWlanSingleLineL" );
       
   424     //Ssid as primary text
       
   425     HBufC* ssid( NULL );
       
   426     HBufC* formatData( NULL );
       
   427     TInt column1Icon( 0 );
       
   428     
       
   429     if ( aWlan.iNetworkName.Length() ) // If there is IAP
       
   430         {
       
   431         ssid = aWlan.GetIapNameAsUnicodeLC();
       
   432         }
       
   433     else // If there no IAP
       
   434         {
       
   435         ssid = aWlan.GetSsidAsUnicodeLC();
       
   436         }
       
   437 
       
   438 
       
   439     column1Icon = ETransparentIcon;
       
   440     
       
   441     if ( aSingleLine )
       
   442         {
       
   443         // AI single line mode
       
   444         if ( aWlan.Connected() )
       
   445             {
       
   446             column1Icon = EConnectedNWIcon; 
       
   447             }
       
   448         else if ( aWlan.Known() )
       
   449             {
       
   450             column1Icon = EWlanOnIcon;     
       
   451             }
       
   452         
       
   453         // format ssid into string '<ssid>'
       
   454         formatData = StringLoader::LoadLC( R_SSID, *ssid, iCoeEnv ); 
       
   455         }
       
   456     else
       
   457         {
       
   458         // Search wlans dialog multiline mode
       
   459         
       
   460         if ( aWlan.BrandId() )
       
   461             {
       
   462             column1Icon = EWlanOffIcon + aWlan.BrandId();
       
   463             }
       
   464         else if ( aWlan.Connected() )
       
   465             {
       
   466             column1Icon = EConnectedNWIcon; // qgn_prop_wlan_bearer.svg
       
   467             }
       
   468         else if ( aWlan.Known() )
       
   469             {
       
   470             column1Icon = EKnownNWIcon;     // qgn_prop_wlan_bearer.svg
       
   471             }       
       
   472         }
       
   473         
       
   474 
       
   475     // Signal strenght for column 4
       
   476     // No signal icon is set by default in case is SingleLine mode off
       
   477     TInt column3Icon = aSingleLine ? ETransparentIcon: 
       
   478                                     ENoSignalIcon;    //qgn_transparent.svg 
       
   479     TInt column4Icon = ETransparentIcon;
       
   480     
       
   481     if ( aWlan.Connected() || !aSingleLine )
       
   482         {
       
   483         // Column 3
       
   484         // Show secure icon if network is secure. 
       
   485         // By default show transparant icon.
       
   486         column4Icon = aWlan.Secure()? ESecureNetworkIcon: ETransparentIcon;
       
   487               
       
   488         switch ( aWlan.SignalStrength() )
       
   489             {      
       
   490             case EPoor:
       
   491                 {
       
   492                 //qgn_indi_wlan_signal_low_add.svg
       
   493                 column3Icon = EPoorSignal;
       
   494                 break;
       
   495                 }
       
   496             case EAverage:
       
   497                 {
       
   498                 //qgn_indi_wlan_signal_med_add.svg
       
   499                 column3Icon = EAverageSignal;                
       
   500                 break;
       
   501                 }
       
   502             case EExcelent:
       
   503                 {
       
   504                 //qgn_indi_wlan_signal_good_add.svg
       
   505                 column3Icon = EExcelentSignal;                 
       
   506                 break;
       
   507                 }
       
   508                     
       
   509             case ENoSignal:
       
   510             default:
       
   511                 {
       
   512                 //qgn_indi_wlan_signal_no_wlan.svg
       
   513                 column3Icon = ENoSignalIcon;                
       
   514                 break;
       
   515                 }        
       
   516             }
       
   517         }
       
   518     
       
   519     if ( aSingleLine )
       
   520         {
       
   521         aItem.Format( KListItemFormat, 
       
   522                       column1Icon, 
       
   523                       formatData,
       
   524                       column3Icon, 
       
   525                       column4Icon );
       
   526         CleanupStack::PopAndDestroy( formatData );
       
   527         }
       
   528     else
       
   529         {
       
   530         aItem.Format( KListItemFormat, 
       
   531                       column1Icon, 
       
   532                       ssid,
       
   533                       column3Icon, 
       
   534                       column4Icon );
       
   535         }
       
   536     CleanupStack::PopAndDestroy( ssid );            
       
   537     }
       
   538 
       
   539 
       
   540 // --------------------------------------------------------------------------
       
   541 // CWsfAiModel::FormatUnknownWlansSingleLineL
       
   542 // --------------------------------------------------------------------------
       
   543 //
       
   544 void CWsfAiModel::FormatUnknownWlansSingleLineL( 
       
   545                                            const TBool aMultipleUnknownWlans,
       
   546                                            TPtr& aItem )
       
   547     {
       
   548     LOG_ENTERFN( "CWsfAiModel::FormatUnknownWlansSingleLineL" );
       
   549     TInt unknownItemResource = aMultipleUnknownWlans ? 
       
   550                         R_QTN_SNIFFER_PLUG_IN_UNKNOWN_SSIDS_FOUND :
       
   551                         R_QTN_SNIFFER_PLUG_IN_UNKNOWN_SSID_FOUND;
       
   552 
       
   553     HBufC* unknownWlansStatusText = iCoeEnv->AllocReadResourceLC( 
       
   554                                                        unknownItemResource );
       
   555 
       
   556     aItem.Format( KListItemFormat, ScanningOn()? EWlanOnIcon: EWlanOffIcon, 
       
   557                                    unknownWlansStatusText,
       
   558                                    ETransparentIcon, 
       
   559                                    ETransparentIcon );         
       
   560                         
       
   561     CleanupStack::PopAndDestroy( unknownWlansStatusText );
       
   562     }
       
   563 
       
   564 
       
   565 // --------------------------------------------------------------------------
       
   566 // CWsfAiModel::FindPreferredKnownWlan
       
   567 // --------------------------------------------------------------------------
       
   568 //
       
   569 TInt CWsfAiModel::FindPreferredKnownWlan( CWsfWlanInfoArray* aWlanList )
       
   570     {
       
   571     LOG_ENTERFN( "CWsfAiModel::FindPreferredKnownWlan" );
       
   572     _ASS_D( aWlanList  );
       
   573     _ASS_D( aWlanList->Count() ); 
       
   574 
       
   575     TWsfWlanInfo *preferred = NULL;
       
   576     TWsfWlanInfo *temp = NULL;
       
   577     TInt loopIndex( 0 );
       
   578     TInt preferredIndex( 0 );
       
   579     //loop through the list and find Max signal strength amont know wlans...
       
   580      
       
   581     preferred = aWlanList->At( loopIndex );
       
   582     loopIndex++;
       
   583  
       
   584     for ( ; loopIndex < aWlanList->Count(); ++loopIndex )
       
   585         {
       
   586         temp = aWlanList->At( loopIndex );
       
   587         if ( !temp->Known() )
       
   588             {
       
   589             // not known net any more...
       
   590             break;
       
   591             }
       
   592         // check the signal strength
       
   593         if ( temp->SignalStrength() > preferred->SignalStrength() )
       
   594             {
       
   595             preferredIndex = loopIndex;
       
   596             preferred = temp;
       
   597             }
       
   598         }
       
   599     return preferredIndex;
       
   600     }
       
   601 
       
   602 
       
   603 // --------------------------------------------------------------------------
       
   604 // CWsfAiModel::CheckWlansL
       
   605 // --------------------------------------------------------------------------
       
   606 //
       
   607 void CWsfAiModel::CheckWlansL( CWsfWlanInfoArray* aWlanList, TPtr& aItem )
       
   608     {
       
   609     LOG_ENTERFN( "CWsfAiModel::CheckWlansL" );
       
   610     _ASS_D( aWlanList );
       
   611     _ASS_D( aWlanList->Count() ); 
       
   612     // first check the connected
       
   613     // if there's connection... it is the first item in array
       
   614 
       
   615     if ( aWlanList->At( 0 )->Known() )
       
   616         {
       
   617         FormatWlanSingleLineL( *aWlanList->At( 0 ), aItem, ETrue );
       
   618         }
       
   619     else
       
   620         {
       
   621         TBool multipleUnknownWlans = ( aWlanList->Count() > 1 );
       
   622         FormatUnknownWlansSingleLineL( multipleUnknownWlans, aItem ); 
       
   623         }          
       
   624     }
       
   625 
       
   626 
       
   627 // --------------------------------------------------------------------------
       
   628 // CWsfAiModel::FormatConnectedL
       
   629 // --------------------------------------------------------------------------
       
   630 //
       
   631 void CWsfAiModel::FormatConnectedL( TPtr& aItem )
       
   632     {
       
   633     LOG_ENTERFN( "CWsfAiModel::FormatConnectedL" );
       
   634     // Ssid as primary text
       
   635     FormatWlanSingleLineL( iConnectedWlanInfo, aItem, ETrue );
       
   636     }
       
   637 
       
   638 // --------------------------------------------------------------------------
       
   639 // CWsfAiModel::InitializeRefreshAnimation
       
   640 // --------------------------------------------------------------------------
       
   641 //
       
   642 void CWsfAiModel::InitializeRefreshAnimation()
       
   643 	{
       
   644 	LOG_ENTERFN( "CWsfAiModel::InitializeRefreshAnimation" );
       
   645 	iRefreshIndex = 0;
       
   646 	}
       
   647 
       
   648 // --------------------------------------------------------------------------
       
   649 // CWsfAiModel::InitializeRefreshAnimation
       
   650 // --------------------------------------------------------------------------
       
   651 //
       
   652 void CWsfAiModel::InitializeConnectingAnimation()
       
   653     {
       
   654     LOG_ENTERFN( "CWsfAiModel::InitializeConnectingAnimation" );
       
   655     iConnectingIndex = 0;
       
   656     }
       
   657 
       
   658 // --------------------------------------------------------------------------
       
   659 // CWsfAiModel::AnimateRefresh
       
   660 // --------------------------------------------------------------------------
       
   661 //
       
   662 void CWsfAiModel::AnimateRefresh()
       
   663 	{
       
   664 	LOG_ENTERFN( "CWsfAiModel::AnimateRefresh" );
       
   665 	++iRefreshIndex %= iRefreshIcons.Count();
       
   666 	}
       
   667 
       
   668 // --------------------------------------------------------------------------
       
   669 // CWsfAiModel::AnimateRefresh
       
   670 // --------------------------------------------------------------------------
       
   671 //
       
   672 void CWsfAiModel::AnimateConnecting()
       
   673     {
       
   674     LOG_ENTERFN( "CWsfAiModel::AnimateConnecting" );
       
   675     ++iConnectingIndex %= iConnectingIcons.Count();
       
   676     }
       
   677 
       
   678 
       
   679 
       
   680 // End of file
       
   681