connectionmonitoring/connectionmonitorui/src/WlanConnectionInfo.cpp
branchRCL_3
changeset 57 05bc53fe583b
parent 55 fc7b30ed2058
child 58 83ca720e2b9a
equal deleted inserted replaced
55:fc7b30ed2058 57:05bc53fe583b
     1 /*
       
     2 * Copyright (c) 2004 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:  Represents a WLAN connection
       
    15 *     
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <ConnectionMonitorUi.rsg>
       
    22 #include <ConnectionMonitorUi.mbg>
       
    23 
       
    24 #include "ConnectionArray.h"
       
    25 #include "WlanConnectionInfo.h"
       
    26 #include "EasyWLANConnectionInfo.h"
       
    27 #include "ActiveWrapper.h"
       
    28 
       
    29 #include <StringLoader.h>
       
    30 
       
    31 #include "ConnectionMonitorUiLogger.h"
       
    32 
       
    33 // CONSTANTS
       
    34 
       
    35 /**
       
    36 * Count of details of WLAN connection
       
    37 */
       
    38 LOCAL_D const TUint KDetailsArrayMaxGranularityCCX = 15;
       
    39 
       
    40 // ================= MEMBER FUNCTIONS =======================
       
    41 // ---------------------------------------------------------
       
    42 // CWlanConnectionInfo::NewL
       
    43 // ---------------------------------------------------------
       
    44 //
       
    45 CWlanConnectionInfo* CWlanConnectionInfo::NewL( TInt aConnectionId, 
       
    46                                 RConnectionMonitor* const aConnectionMonitor,
       
    47                                 TConnMonBearerType aConnectionBearerType,
       
    48                                 const HBufC* aEasyWlanIAPName,
       
    49                                 CActiveWrapper* aActiveWrapper )
       
    50     {
       
    51     CMUILOGGER_ENTERFN( "CWlanConnectionInfo* CWlanConnectionInfo::NewL" ); 
       
    52        
       
    53     CWlanConnectionInfo* self = new ( ELeave ) CWlanConnectionInfo( 
       
    54                                                       aConnectionId, 
       
    55                                                       aConnectionMonitor, 
       
    56                                                       aConnectionBearerType,
       
    57                                                       aActiveWrapper );
       
    58     CleanupStack::PushL( self );
       
    59     self->ConstructL();
       
    60     
       
    61     if ( aEasyWlanIAPName )
       
    62         {
       
    63         if ( self->iConnectionName.Compare( *aEasyWlanIAPName ) )
       
    64             {
       
    65             CleanupStack::Pop( self );        
       
    66             }
       
    67         else
       
    68             {
       
    69             CEasyWlanConnectionInfo* temp = CEasyWlanConnectionInfo::NewL( 
       
    70                                                       aConnectionId, 
       
    71                                                       aConnectionMonitor, 
       
    72                                                       aConnectionBearerType,
       
    73                                                       aActiveWrapper );
       
    74             CleanupStack::PopAndDestroy( self );
       
    75             self = temp;
       
    76             }        
       
    77         }
       
    78     else
       
    79         {
       
    80         CleanupStack::Pop( self );                            
       
    81         }
       
    82  
       
    83     
       
    84     
       
    85     CMUILOGGER_LEAVEFN( "CWlanConnectionInfo* CWlanConnectionInfo::NewL" );
       
    86         
       
    87     return self;
       
    88     }
       
    89 
       
    90 // ---------------------------------------------------------
       
    91 // CWlanConnectionInfo::CWlanConnectionInfo
       
    92 // ---------------------------------------------------------
       
    93 //
       
    94 CWlanConnectionInfo::CWlanConnectionInfo( TInt aConnectionId, 
       
    95                                 RConnectionMonitor* const aConnectionMonitor,
       
    96                                 TConnMonBearerType aConnectionBearerType,
       
    97                                 CActiveWrapper* aActiveWrapper ) 
       
    98     : CConnectionInfoBase( aConnectionId, 
       
    99                            aConnectionMonitor, 
       
   100                            aConnectionBearerType,
       
   101                            aActiveWrapper ), iEasyWlan( EFalse )
       
   102     {
       
   103     }
       
   104 
       
   105 // ---------------------------------------------------------
       
   106 // CWlanConnectionInfo::ConstructL
       
   107 // ---------------------------------------------------------
       
   108 //
       
   109 void CWlanConnectionInfo::ConstructL()
       
   110     {  
       
   111     CMUILOGGER_ENTERFN( "void CWlanConnectionInfo::ConstructL()" ); 
       
   112      
       
   113     RefreshNetworkNameL();
       
   114     RefreshSignalStrength();
       
   115     RefreshSecurityMode();
       
   116     RefreshNetworkMode();        
       
   117     RefreshTxPowerL();        
       
   118     
       
   119     CConnectionInfoBase::ConstructL(); // and base class ConstructL next.
       
   120     
       
   121     CMUILOGGER_LEAVEFN( "void CWlanConnectionInfo::ConstructL()" );    
       
   122     }
       
   123 
       
   124 
       
   125 // ---------------------------------------------------------
       
   126 // CWlanConnectionInfo::~CWlanConnectionInfo
       
   127 // ---------------------------------------------------------
       
   128 //
       
   129 CWlanConnectionInfo::~CWlanConnectionInfo()
       
   130     {
       
   131     }
       
   132     
       
   133 // ---------------------------------------------------------
       
   134 // CWlanConnectionInfo::DeepCopyL
       
   135 // ---------------------------------------------------------
       
   136 //        
       
   137 CConnectionInfoBase* CWlanConnectionInfo::DeepCopyL()
       
   138 	{
       
   139 	CWlanConnectionInfo* temp = new ( ELeave ) CWlanConnectionInfo(
       
   140                                                     iConnectionId,
       
   141                                                     iConnectionMonitor,
       
   142                                                     iConnectionBearerType,
       
   143                                                     iActiveWrapper );
       
   144                               							
       
   145 	temp->iConnectionName = iConnectionName;
       
   146 	temp->iConnectionStatus = iConnectionStatus;
       
   147 	temp->iUploaded = iUploaded;
       
   148 	temp->iDownloaded = iDownloaded;
       
   149 	temp->iStartTime = iStartTime;
       
   150 	temp->iDuration = iDuration;
       
   151 	temp->iLastSpeedUpdate = iLastSpeedUpdate;
       
   152 	temp->iUpSpeed = iUpSpeed;
       
   153 	temp->iDownSpeed = iDownSpeed;
       
   154 	temp->iListBoxItemText = iListBoxItemText;
       
   155 	
       
   156 	temp->iWlanNetworkName = iWlanNetworkName;
       
   157 	temp->iSignalStrength = iSignalStrength;
       
   158 	temp->iNetworkMode = iNetworkMode;
       
   159 	temp->iSecurityMode = iSecurityMode;
       
   160 	temp->iTxPower = iTxPower;
       
   161 	
       
   162 	if ( iDetailsArray )
       
   163 		{
       
   164 		CleanupStack::PushL( temp );		
       
   165 		temp->ToArrayDetailsL();
       
   166 		CleanupStack::Pop( temp );			
       
   167 		}
       
   168 		
       
   169 	return temp;	
       
   170 	}    
       
   171 
       
   172 // ---------------------------------------------------------
       
   173 // CWlanConnectionInfo::GetIconId
       
   174 // ---------------------------------------------------------
       
   175 //
       
   176 TUint CWlanConnectionInfo::GetIconId() const
       
   177     {
       
   178     CMUILOGGER_ENTERFN( "TUint CWlanConnectionInfo::GetIconId() const" ); 
       
   179     
       
   180     TUint iconId = EWlan;    
       
   181     
       
   182     CMUILOGGER_LEAVEFN( "TUint CWlanConnectionInfo::GetIconId() const" );
       
   183     
       
   184     return iconId;
       
   185     }
       
   186 
       
   187 // ---------------------------------------------------------
       
   188 // CWlanConnectionInfo::IsEasyWLAN
       
   189 // ---------------------------------------------------------
       
   190 //
       
   191 TBool CWlanConnectionInfo::IsEasyWLAN() const
       
   192     {
       
   193     return iEasyWlan;    
       
   194     }
       
   195 
       
   196 // ---------------------------------------------------------
       
   197 // CWlanConnectionInfo::GetWlanNetworkNameLC
       
   198 // ---------------------------------------------------------
       
   199 //
       
   200 HBufC* CWlanConnectionInfo::GetWlanNetworkNameLC() const
       
   201     {
       
   202     CMUILOGGER_ENTERFN( "CWlanConnectionInfo::GetWlanNetworkNameLC()" ); 
       
   203     
       
   204     HBufC* name = iWlanNetworkName.AllocLC();
       
   205     
       
   206     CMUILOGGER_LEAVEFN( "CWlanConnectionInfo::GetWlanNetworkNameLC()" );
       
   207     
       
   208     return name;    
       
   209     }
       
   210 
       
   211 // ---------------------------------------------------------
       
   212 // CWlanConnectionInfo::GetWlanSignalStrength
       
   213 // ---------------------------------------------------------
       
   214 //
       
   215 TWlanSignalStrength CWlanConnectionInfo::GetWlanSignalStrength()  const
       
   216     {
       
   217     return iSignalStrength;
       
   218     }
       
   219 
       
   220 // ---------------------------------------------------------
       
   221 // CWlanConnectionInfo::GetWlanNetworkMode
       
   222 // ---------------------------------------------------------
       
   223 //
       
   224 TWlanNetworkMode CWlanConnectionInfo::GetWlanNetworkMode()  const
       
   225     {
       
   226     return iNetworkMode;
       
   227     }
       
   228 
       
   229 // ---------------------------------------------------------
       
   230 // CWlanConnectionInfo::GetWlanSecurityMode
       
   231 // ---------------------------------------------------------
       
   232 //
       
   233 TWlanSecurityMode CWlanConnectionInfo::GetWlanSecurityMode()  const
       
   234     {
       
   235     return iSecurityMode;
       
   236     }
       
   237 
       
   238 // ---------------------------------------------------------
       
   239 // CWlanConnectionInfo::GetWlanTxPower
       
   240 // ---------------------------------------------------------
       
   241 //
       
   242 TUint CWlanConnectionInfo::GetWlanTxPower() const
       
   243     {
       
   244     return iTxPower;
       
   245     }
       
   246 
       
   247 // ---------------------------------------------------------
       
   248 // CWlanConnectionInfo::RefreshDetailsL
       
   249 // ---------------------------------------------------------
       
   250 //
       
   251 void CWlanConnectionInfo::RefreshDetailsL()
       
   252     {
       
   253     CMUILOGGER_ENTERFN( "void CWlanConnectionInfo::RefreshDetailsL()" ); 
       
   254 
       
   255     if ( IsAlive() )
       
   256         {
       
   257         RefreshNetworkNameL();
       
   258         }
       
   259     
       
   260     if ( IsAlive() )
       
   261         {
       
   262         RefreshNetworkMode();
       
   263         }
       
   264     
       
   265     if ( IsAlive() )
       
   266         {
       
   267         RefreshSecurityMode();
       
   268         }
       
   269     
       
   270     if ( IsAlive() )
       
   271         {
       
   272         RefreshTransferSpeedsL();
       
   273         }
       
   274     
       
   275     if ( IsAlive() )
       
   276         {
       
   277         RefreshDuration(); 
       
   278         }
       
   279     
       
   280     if ( IsAlive() )
       
   281         {
       
   282         RefreshSignalStrength();
       
   283         }
       
   284     
       
   285     if ( IsAlive() )
       
   286         {
       
   287         RefreshTxPowerL();
       
   288         }
       
   289     
       
   290     CMUILOGGER_LEAVEFN( "void CWlanConnectionInfo::RefreshDetailsL()" );    
       
   291     }
       
   292 
       
   293 // ---------------------------------------------------------
       
   294 // CWlanConnectionInfo::RefreshNetworkNameL
       
   295 // ---------------------------------------------------------
       
   296 //
       
   297 void CWlanConnectionInfo::RefreshNetworkNameL()
       
   298     {
       
   299     CMUILOGGER_ENTERFN( "void CWlanConnectionInfo::RefreshNetworkNameL()" ); 
       
   300     
       
   301     iActiveWrapper->StartGetStringAttribute( iConnectionId,
       
   302                                              iConnectionMonitor,
       
   303                                              KNetworkName,
       
   304                                              iWlanNetworkName );
       
   305     
       
   306     CMUILOGGER_WRITE_F( "RefreshNetworkName status : %d", 
       
   307                         iActiveWrapper->iStatus.Int() );
       
   308 
       
   309     if ( iActiveWrapper->iStatus.Int() )
       
   310         {
       
   311         if ( KErrNotFound == iActiveWrapper->iStatus.Int() )
       
   312             {
       
   313             iConnectionStatus = EConnectionClosed;
       
   314             }
       
   315         HBufC* temp = StringLoader::LoadL( R_QTN_CMON_PARAMETER_UNAVAILABLE );
       
   316         iWlanNetworkName = *temp;  
       
   317         delete temp;
       
   318         }
       
   319     
       
   320     CMUILOGGER_LEAVEFN( "void CWlanConnectionInfo::RefreshNetworkNameL()" );
       
   321     }
       
   322 
       
   323 // ---------------------------------------------------------
       
   324 // CWlanConnectionInfo::RefreshSignalStrength
       
   325 // ---------------------------------------------------------
       
   326 //
       
   327 void CWlanConnectionInfo::RefreshSignalStrength()
       
   328     {
       
   329     CMUILOGGER_ENTERFN( "void CWlanConnectionInfo::RefreshSignalStrength()" );
       
   330     
       
   331     iActiveWrapper->StartGetIntAttribute( iConnectionId,
       
   332                                           iConnectionMonitor,
       
   333                                           KSignalStrength,
       
   334                                           ( TInt& )iSignalStrength );
       
   335 
       
   336     CMUILOGGER_WRITE_F( "RefreshSignalStrengthL status : %d",
       
   337                         iActiveWrapper->iStatus.Int() );
       
   338     CMUILOGGER_WRITE_F( "iSignalStrength : %d", ( TInt )iSignalStrength );
       
   339 
       
   340     if ( iActiveWrapper->iStatus.Int() )
       
   341         {
       
   342         if ( KErrNotFound == iActiveWrapper->iStatus.Int() )
       
   343             {
       
   344             iConnectionStatus = EConnectionClosed;
       
   345             }
       
   346         iSignalStrength = EWlanSignalUnavailable;   
       
   347         }
       
   348             
       
   349     CMUILOGGER_LEAVEFN( "void CWlanConnectionInfo::RefreshSignalStrength()" );
       
   350     }
       
   351 
       
   352 // ---------------------------------------------------------
       
   353 // CWlanConnectionInfo::RefreshSecurityMode
       
   354 // ---------------------------------------------------------
       
   355 //
       
   356 void CWlanConnectionInfo::RefreshSecurityMode()
       
   357     {
       
   358     CMUILOGGER_ENTERFN( "void CWlanConnectionInfo::RefreshSecurityMode()" ); 
       
   359     
       
   360     iActiveWrapper->StartGetIntAttribute( iConnectionId,
       
   361                                           iConnectionMonitor,
       
   362                                           KSecurityMode,
       
   363                                           ( TInt& )iSecurityMode );
       
   364 
       
   365     CMUILOGGER_WRITE_F( "RefreshSecurityMode status: %d",
       
   366                         iActiveWrapper->iStatus.Int() );
       
   367     
       
   368     if ( iActiveWrapper->iStatus.Int() )
       
   369         {
       
   370         if ( KErrNotFound == iActiveWrapper->iStatus.Int() )
       
   371             {
       
   372             iConnectionStatus = EConnectionClosed;
       
   373             }
       
   374         iSecurityMode = EWlanSecurityModeUnavailable;    
       
   375         }
       
   376     
       
   377     CMUILOGGER_LEAVEFN( "void CWlanConnectionInfo::RefreshSecurityMode()" );
       
   378     }
       
   379 
       
   380 // ---------------------------------------------------------
       
   381 // CWlanConnectionInfo::RefreshNetworkMode
       
   382 // ---------------------------------------------------------
       
   383 //
       
   384 void CWlanConnectionInfo::RefreshNetworkMode()
       
   385     {
       
   386     CMUILOGGER_ENTERFN( "void CWlanConnectionInfo::RefreshNetworkMode()" ); 
       
   387     
       
   388     iActiveWrapper->StartGetIntAttribute( iConnectionId,
       
   389                                           iConnectionMonitor,
       
   390                                           KNetworkMode,
       
   391                                           ( TInt& )iNetworkMode );
       
   392 
       
   393     CMUILOGGER_WRITE_F( "RefreshNetworkMode status : %d",
       
   394                         iActiveWrapper->iStatus.Int() );
       
   395     
       
   396     if ( iActiveWrapper->iStatus.Int() )
       
   397         {
       
   398         if ( KErrNotFound == iActiveWrapper->iStatus.Int() )
       
   399             {
       
   400             iConnectionStatus = EConnectionClosed;
       
   401             }
       
   402         iNetworkMode = EWlanNetworkModeUnavailable;   
       
   403         }
       
   404         
       
   405     CMUILOGGER_LEAVEFN( "void CWlanConnectionInfo::RefreshNetworkMode()" );
       
   406     }
       
   407 
       
   408 // ---------------------------------------------------------
       
   409 // CWlanConnectionInfo::RefreshTxPowerL
       
   410 // ---------------------------------------------------------
       
   411 //
       
   412 void CWlanConnectionInfo::RefreshTxPowerL()
       
   413     {
       
   414     CMUILOGGER_ENTERFN( "void CWlanConnectionInfo::RefreshTxPowerL()" ); 
       
   415     
       
   416     iActiveWrapper->StartGetUintAttribute( iConnectionId,
       
   417                                            iConnectionMonitor,
       
   418                                            KTransmitPower,
       
   419                                            iTxPower );
       
   420 
       
   421     if ( iActiveWrapper->iStatus.Int() )
       
   422         {
       
   423         if ( KErrNotFound == iActiveWrapper->iStatus.Int() )
       
   424             {
       
   425             iConnectionStatus = EConnectionClosed;
       
   426             }
       
   427         iSignalStrength = EWlanSignalUnavailable;   
       
   428         }
       
   429             
       
   430     CMUILOGGER_WRITE_F( "iTxPower : %d", iTxPower );
       
   431     TInt err( iActiveWrapper->iStatus.Int() );
       
   432     CMUILOGGER_WRITE_F( "RefreshTxPowerL status: %d", err );
       
   433             
       
   434     CMUILOGGER_LEAVEFN( "void CWlanConnectionInfo::RefreshTxPowerL()" );
       
   435     }
       
   436 
       
   437 // ---------------------------------------------------------
       
   438 // CWlanConnectionInfo::ToStringSignalStrengthLC
       
   439 // ---------------------------------------------------------
       
   440 //
       
   441 HBufC* CWlanConnectionInfo::ToStringSignalStrengthLC() const
       
   442     {
       
   443     CMUILOGGER_ENTERFN( "CWlanConnectionInfo::ToStringSignalStrengthLC()" );
       
   444     
       
   445     HBufC* signalStrength = NULL;
       
   446     TInt resourceId( 0 );
       
   447         
       
   448     if ( iSignalStrength == EWlanSignalUnavailable )
       
   449         {
       
   450         resourceId =  R_QTN_CMON_WLAN_SIGNAL_STRENGTH_NO_SIGNAL;   
       
   451         signalStrength = StringLoader::LoadLC( resourceId );
       
   452         }                    
       
   453     else if ( iSignalStrength < EWlanSignalStrengthGood )
       
   454         {
       
   455         resourceId =  R_QTN_CMON_WLAN_SINGAL_STRENGTH_GOOD;
       
   456         }
       
   457     else if ( iSignalStrength > EWlanSignalStrengthLow )
       
   458         {
       
   459         resourceId =  R_QTN_CMON_WLAN_SINGAL_STRENGTH_LOW;
       
   460         }
       
   461     else 
       
   462         {
       
   463         resourceId = R_QTN_CMON_WLAN_SINGAL_STRENGTH_MEDIUM;
       
   464         }
       
   465         
       
   466     TInt signalInPercent( 0 );
       
   467     if ( iSignalStrength <= EWlanSignalStrengthMax )
       
   468         {
       
   469         signalInPercent = 100;
       
   470         }
       
   471     else if ( iSignalStrength >= EWlanSignalStrengthMin )
       
   472         {
       
   473         signalInPercent = 0;        
       
   474         }
       
   475     else
       
   476         {
       
   477         TInt diff = EWlanSignalStrengthMin - iSignalStrength;
       
   478         signalInPercent = diff * 100 / KDiffOfWlanSignalStrength;        
       
   479         }        
       
   480     
       
   481     if ( !signalStrength ) // there is connection to network
       
   482         {
       
   483         CMUILOGGER_WRITE_F( "signalInPercent : %d", signalInPercent );
       
   484         
       
   485         signalStrength = StringLoader::LoadLC( resourceId, 
       
   486                                                signalInPercent );
       
   487         }        
       
   488             
       
   489     CMUILOGGER_LEAVEFN( "CWlanConnectionInfo::ToStringSignalStrengthLC()" );
       
   490             
       
   491     return signalStrength;    
       
   492     }
       
   493 
       
   494 // ---------------------------------------------------------
       
   495 // CWlanConnectionInfo::ToStringNetworkModeLC
       
   496 // ---------------------------------------------------------
       
   497 //
       
   498 HBufC* CWlanConnectionInfo::ToStringNetworkModeLC() const
       
   499     {
       
   500     CMUILOGGER_ENTERFN( "CWlanConnectionInfo::ToStringNetworkModeLC()" ); 
       
   501     
       
   502     HBufC* networkMode = NULL;
       
   503     TInt resourceId( 0 );
       
   504 
       
   505     switch ( iNetworkMode )
       
   506         {
       
   507         case EWlanNetworkModeInfrastructure:
       
   508         case EWlanNetworkModeSecInfrastructure:        
       
   509             {
       
   510             resourceId = R_QTN_CMON_WLAN_NEWTWORK_MODE_INFRA;    
       
   511             break;
       
   512             }
       
   513         case EWlanNetworkModeAdHoc:
       
   514             {
       
   515             resourceId = R_QTN_CMON_WLAN_NEWTWORK_MODE_ADHOC;
       
   516             break;
       
   517             }            
       
   518         case EWlanNetworkModeUnavailable:
       
   519         default:
       
   520             {
       
   521             resourceId = R_QTN_CMON_PARAMETER_UNAVAILABLE;    
       
   522             break;                
       
   523             }
       
   524         }
       
   525     
       
   526     networkMode = StringLoader::LoadLC( resourceId );        
       
   527     
       
   528     CMUILOGGER_LEAVEFN( "CWlanConnectionInfo::ToStringNetworkModeLC()" );
       
   529         
       
   530     return networkMode;
       
   531     }
       
   532 
       
   533 // ---------------------------------------------------------
       
   534 // CWlanConnectionInfo::ToStringSecurityModeLC
       
   535 // ---------------------------------------------------------
       
   536 //
       
   537 HBufC* CWlanConnectionInfo::ToStringSecurityModeLC() const
       
   538     {
       
   539     CMUILOGGER_ENTERFN( "CWlanConnectionInfo::ToStringSecurityModeLC()" );
       
   540     
       
   541     HBufC* securityMode = NULL;
       
   542     TInt resourceId( 0 );
       
   543 
       
   544     switch ( iSecurityMode )
       
   545         {
       
   546         case EWlanSecurityModeOpenNetwork:
       
   547             {
       
   548             resourceId = R_QTN_CMON_WLAN_SECURITY_MODE_OPEN;
       
   549             break;
       
   550             }
       
   551         case EWlanSecurityModeWEP:
       
   552             {
       
   553             resourceId = R_QTN_CMON_WLAN_SECURITY_MODE_WEP;
       
   554             break;
       
   555             }
       
   556         case EWlanSecurityMode8021x:
       
   557             {
       
   558             resourceId = R_QTN_CMON_WLAN_SECURITY_MODE_802_1X;
       
   559             break;
       
   560             }
       
   561         case EWlanSecurityModeWPA:
       
   562             {
       
   563             resourceId = R_QTN_CMON_WLAN_SECURITY_MODE_WPA;
       
   564             break;
       
   565             }
       
   566         case EWlanSecurityWpaPsk:
       
   567             {
       
   568             resourceId = R_QTN_CMON_WLAN_SECURITY_MODE_WPA;
       
   569             break;
       
   570             }
       
   571         case EWlanSecurityModeUnavailable:            
       
   572         default:
       
   573             {
       
   574             resourceId = R_QTN_CMON_PARAMETER_UNAVAILABLE;    
       
   575             break;
       
   576             }
       
   577         }
       
   578     
       
   579     securityMode = StringLoader::LoadLC( resourceId );    
       
   580     
       
   581     CMUILOGGER_LEAVEFN( "CWlanConnectionInfo::ToStringSecurityModeLC()" );
       
   582             
       
   583     return securityMode;    
       
   584     }
       
   585 
       
   586 // ---------------------------------------------------------
       
   587 // CWlanConnectionInfo::ToStringTxPowerLC
       
   588 // ---------------------------------------------------------
       
   589 //
       
   590 HBufC* CWlanConnectionInfo::ToStringTxPowerLC() const
       
   591     {
       
   592     CMUILOGGER_ENTERFN( "CWlanConnectionInfo::ToStringTxPowerLC()" ); 
       
   593     
       
   594     HBufC* txPower = StringLoader::LoadLC( R_QTN_CMON_WLAN_TX_POWER_LEVEL,
       
   595                                            iTxPower );
       
   596     
       
   597     CMUILOGGER_LEAVEFN( "CWlanConnectionInfo::ToStringTxPowerLC()" );
       
   598                                                
       
   599     return txPower;    
       
   600     }
       
   601 
       
   602 // ---------------------------------------------------------
       
   603 // CWlanConnectionInfo::ToArrayDetailsL
       
   604 // ---------------------------------------------------------
       
   605 //
       
   606 void CWlanConnectionInfo::ToArrayDetailsL()
       
   607     {
       
   608     CMUILOGGER_ENTERFN( "void CWlanConnectionInfo::ToArrayDetailsL()" ); 
       
   609     
       
   610     HBufC* temp = NULL;
       
   611     delete iDetailsArray;
       
   612     iDetailsArray = NULL;
       
   613     iDetailsArray = new ( ELeave ) CDesCArrayFlat
       
   614                                     ( KDetailsArrayMaxGranularityCCX );
       
   615     
       
   616     temp = iConnectionName.AllocLC();
       
   617  
       
   618     ToDetailsListBoxItemTextWithAppendL
       
   619         (
       
   620         R_QTN_CMON_HEADING_CONN_NAME,
       
   621         temp );    
       
   622   
       
   623     ToDetailsListBoxItemTextWithAppendL
       
   624         (
       
   625         R_QTN_CMON_HEADING_BEARER,
       
   626         ToStringBearerLC()
       
   627         );
       
   628 
       
   629     ToDetailsListBoxItemTextWithAppendL
       
   630         (
       
   631         R_QTN_CMON_HEADING_STATUS,
       
   632         ToStringStatusLC()
       
   633         );
       
   634     
       
   635     ToDetailsListBoxItemTextWithAppendL
       
   636     (
       
   637     R_QTN_CMON_HEADING_WLAN_NETWORK_NAME,
       
   638     GetWlanNetworkNameLC()
       
   639     );
       
   640 
       
   641     ToDetailsListBoxItemTextWithAppendL
       
   642         (
       
   643         R_QTN_CMON_HEADING_WLAN_SIGNAL_STRENGTH,
       
   644         ToStringSignalStrengthLC()
       
   645         );
       
   646 
       
   647     ToDetailsListBoxItemTextWithAppendL
       
   648         (
       
   649         R_QTN_CMON_HEADING_WLAN_NETWORK_MODE,
       
   650         ToStringNetworkModeLC()
       
   651         );
       
   652 
       
   653     ToDetailsListBoxItemTextWithAppendL
       
   654         (
       
   655         R_QTN_CMON_HEADING_WLAN_SECURITY_MODE,
       
   656         ToStringSecurityModeLC()
       
   657         );
       
   658         
       
   659     ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_WLAN_TX_POWER,
       
   660                                          ToStringTxPowerLC() );
       
   661         
       
   662     ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_DATA_TOTAL,
       
   663                                          ToStringTotalTransmittedDataLC() );
       
   664                                          
       
   665     ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_DATA_RECEIVED,
       
   666                                          ToStringReceivedDataLC() );
       
   667 
       
   668     ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_DATA_SENT,
       
   669                                          ToStringSentDataLC() );
       
   670     
       
   671     ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_DURATION,
       
   672                                          ToStringDurationLC() );
       
   673         
       
   674     ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_SPEED,
       
   675                                          ToStringTransferSpeedDownLC() );
       
   676 
       
   677     ToDetailsListBoxItemTextWithAppendL( 0, 
       
   678                                          ToStringTransferSpeedUpLC() );
       
   679                 
       
   680                                          
       
   681     CleanupStack::PopAndDestroy
       
   682         (
       
   683         KDetailsArrayMaxGranularityCCX - 1, 
       
   684         temp );
       
   685                                  
       
   686     TInt sharing = RefreshAppNamesL();
       
   687 
       
   688     if ( sharing >= 1 )
       
   689         {
       
   690         for ( TInt i = 0; i < sharing; i++ )
       
   691             {
       
   692             if ( i == 0 )
       
   693                 {
       
   694                 ToDetailsListBoxItemTextWithAppendL( 
       
   695                                     R_QTN_CMON_HEADING_SHARING_INFO,
       
   696                                     ToStringAppNameLC( i ) );
       
   697                 }
       
   698             else
       
   699                 {
       
   700                 ToDetailsListBoxItemTextWithAppendL( 0, 
       
   701                                                 ToStringAppNameLC( i ) );
       
   702                 }
       
   703             }
       
   704         CleanupStack::PopAndDestroy( sharing ); // ToStringAppNameLC()
       
   705         }
       
   706     
       
   707     CMUILOGGER_LEAVEFN( "void CWlanConnectionInfo::ToArrayDetailsL()" );
       
   708     }
       
   709 
       
   710 // ---------------------------------------------------------
       
   711 // CWlanConnectionInfo::RefreshDetailsArrayL
       
   712 // ---------------------------------------------------------
       
   713 //
       
   714 void CWlanConnectionInfo::RefreshDetailsArrayL()
       
   715     {
       
   716     CMUILOGGER_ENTERFN( "void CWlanConnectionInfo::RefreshDetailsArrayL()" );
       
   717 
       
   718     HBufC* temp = NULL;
       
   719 
       
   720     temp = ToStringStatusLC();
       
   721 
       
   722     ToDetailsListBoxItemTextWithReplaceL
       
   723         (
       
   724         R_QTN_CMON_HEADING_STATUS,
       
   725         temp,
       
   726         2
       
   727         );
       
   728 
       
   729     ToDetailsListBoxItemTextWithReplaceL
       
   730         (
       
   731         R_QTN_CMON_HEADING_WLAN_SIGNAL_STRENGTH,
       
   732         ToStringSignalStrengthLC(),
       
   733         4
       
   734         );
       
   735                                           
       
   736     ToDetailsListBoxItemTextWithReplaceL
       
   737         (
       
   738         R_QTN_CMON_HEADING_WLAN_TX_POWER,
       
   739         ToStringTxPowerLC(),
       
   740         7
       
   741         );
       
   742         
       
   743     ToDetailsListBoxItemTextWithReplaceL( R_QTN_CMON_HEADING_DATA_TOTAL,
       
   744                                           ToStringTotalTransmittedDataLC(),
       
   745                                           8 );
       
   746         
       
   747 
       
   748     ToDetailsListBoxItemTextWithReplaceL( R_QTN_CMON_HEADING_DATA_RECEIVED,
       
   749                                           ToStringReceivedDataLC(), 
       
   750                                           9 );
       
   751 
       
   752     ToDetailsListBoxItemTextWithReplaceL( R_QTN_CMON_HEADING_DATA_SENT,
       
   753                                           ToStringSentDataLC(), 
       
   754                                           10 );
       
   755     
       
   756     ToDetailsListBoxItemTextWithReplaceL( R_QTN_CMON_HEADING_DURATION,
       
   757                                           ToStringDurationLC(), 
       
   758                                           11 );
       
   759         
       
   760     ToDetailsListBoxItemTextWithReplaceL( R_QTN_CMON_HEADING_SPEED,
       
   761                                           ToStringTransferSpeedDownLC(), 
       
   762                                           12 );
       
   763 
       
   764     ToDetailsListBoxItemTextWithReplaceL( 0, 
       
   765                                           ToStringTransferSpeedUpLC(), 
       
   766                                           13 );
       
   767                                           
       
   768     CleanupStack::PopAndDestroy( 9, temp );
       
   769     
       
   770 
       
   771     TInt count = iDetailsArray->Count();
       
   772     TInt realElementsMaxCount = KDetailsArrayMaxGranularityCCX;
       
   773     
       
   774     CMUILOGGER_WRITE_F( "count : %d", count );
       
   775     CMUILOGGER_WRITE_F( "realElementsMaxCount : %d", realElementsMaxCount );
       
   776     
       
   777     TInt sharing = RefreshAppNamesL();
       
   778 
       
   779     if ( sharing >= 1 )
       
   780         {
       
   781         if ( count >= realElementsMaxCount ) // 15
       
   782             {  
       
   783             iDetailsArray->Delete( realElementsMaxCount - 1,
       
   784                                    iDetailsArray->Count() - 14 );
       
   785             iDetailsArray->Compress(); 
       
   786             }
       
   787         
       
   788         for ( TInt i = 0; i < sharing; i++ )
       
   789             {
       
   790             if ( i == 0 )
       
   791                 {
       
   792                 ToDetailsListBoxItemTextWithAppendL( 
       
   793                                         R_QTN_CMON_HEADING_SHARING_INFO,
       
   794                                         ToStringAppNameLC( i ) );
       
   795                 }
       
   796             else
       
   797                 {
       
   798                 ToDetailsListBoxItemTextWithAppendL( 0, 
       
   799                                         ToStringAppNameLC( i ) );
       
   800                 }
       
   801             }
       
   802         CleanupStack::PopAndDestroy( sharing ); // ToStringAppNameLC()
       
   803         }
       
   804     else
       
   805         {
       
   806         if ( count >= realElementsMaxCount )
       
   807             {
       
   808             iDetailsArray->Delete( realElementsMaxCount - 1,
       
   809                                    iDetailsArray->Count() - 14 );
       
   810             iDetailsArray->Compress();              
       
   811             }
       
   812         }               
       
   813     
       
   814     CMUILOGGER_LEAVEFN( "void CWlanConnectionInfo::RefreshDetailsArrayL()" );
       
   815     }
       
   816 
       
   817 
       
   818 // ---------------------------------------------------------
       
   819 // CWlanConnectionInfo::RefreshConnectionListBoxItemTextL
       
   820 // ---------------------------------------------------------
       
   821 //
       
   822 void CWlanConnectionInfo::RefreshConnectionListBoxItemTextL()
       
   823     {
       
   824     CMUILOGGER_ENTERFN( 
       
   825     "void CWlanConnectionInfo::RefreshConnectionListBoxItemTextL()" ); 
       
   826     
       
   827     TUint  iconId;
       
   828     HBufC* secondRow = NULL;
       
   829     
       
   830     iconId = GetIconId();
       
   831 
       
   832     if ( iConnectionStatus == EConnectionCreated )
       
   833         {
       
   834         secondRow =  ToStringDurationLC();          
       
   835         }
       
   836     else // if connection has not created yet gives back the status of itself.
       
   837         {
       
   838         secondRow = ToStringStatusLC( EFalse );
       
   839         }
       
   840 
       
   841     iListBoxItemText.Format( KConnectonListItemTextFormat, iconId, 
       
   842                              &iConnectionName, secondRow );
       
   843     CleanupStack::PopAndDestroy( secondRow );
       
   844     
       
   845     CMUILOGGER_LEAVEFN( 
       
   846     "void CWlanConnectionInfo::RefreshConnectionListBoxItemTextL()" );    
       
   847     }
       
   848 
       
   849 
       
   850 
       
   851 // End of File