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