wlanutilities/wlansniffer/mainapplication/inc/wsfconnecteddetailsmodel.h
branchRCL_3
changeset 25 f28ada11abbf
parent 0 56b72877c1cb
equal deleted inserted replaced
24:63be7eb3fc78 25:f28ada11abbf
       
     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:  Class header for CWsfConnectedDetailsModel
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_WSFCONNECTEDDETAILSMODEL_H
       
    20 #define C_WSFCONNECTEDDETAILSMODEL_H
       
    21 
       
    22 //EXTERNAL INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <rconnmon.h>
       
    25 #include <badesca.h>
       
    26 
       
    27 //INTERNAL INCLUDES
       
    28 
       
    29 //FORWARD DECLARATIONS
       
    30 class CCoeEnv;
       
    31 class CWsfWlanInfoArray;
       
    32 class TWsfWlanInfo;
       
    33 
       
    34 
       
    35 /**
       
    36  *  Details view Model
       
    37  *
       
    38  *  Holds & formats TWsfWlanInfo for list box showable format
       
    39  *
       
    40  *  @since S60 v5.0
       
    41  */
       
    42 class CWsfConnectedDetailsModel : public CBase
       
    43     {
       
    44 
       
    45     public: // Constructors and destructor
       
    46     
       
    47         /**
       
    48         * Two-phase construction.
       
    49         */
       
    50         static CWsfConnectedDetailsModel* NewL();
       
    51     
       
    52         /**
       
    53         * Two-phased construction.
       
    54         */
       
    55         static CWsfConnectedDetailsModel* NewLC();
       
    56         
       
    57         /**
       
    58         * Destructor.
       
    59         */
       
    60         ~CWsfConnectedDetailsModel();
       
    61     
       
    62     
       
    63     public: // New methods
       
    64         
       
    65         /**
       
    66          * Finds out the current WLAN connection id
       
    67          * @since S60 5.0
       
    68          */
       
    69         void FindWlanConnectionL();
       
    70 
       
    71         /**
       
    72          * Formats Wlan info for showing
       
    73          *
       
    74          * @since S60 v5.0
       
    75          * @param aWlanInfo - selected Wlan info
       
    76          * @param aWlanArray - Wlan info array
       
    77          * @return formated text array
       
    78          */
       
    79         CDesCArrayFlat* FormatWlanInfoL( TWsfWlanInfo* aWlanInfo,
       
    80                                          CWsfWlanInfoArray* aWlanArray );
       
    81         
       
    82         /**
       
    83          * Refresh current Wlan info for showing
       
    84          *
       
    85          * @since S60 v5.0
       
    86          * @return refreshed text array
       
    87          */
       
    88         CDesCArrayFlat* RefreshCurrentWlanInfoL();
       
    89     
       
    90         /**
       
    91          * Creates listbox items from header and value (formatter %S\t%S)
       
    92          * @since S60 v5.0
       
    93          * @param aResourceId - id of loaded header string
       
    94          * @param aValueText - string containing value data 
       
    95          * @return formated string 
       
    96          */        
       
    97         HBufC* FormatListBoxItemLC( const TUint aResourceId,
       
    98                                     const TDesC& aValueText ) const;
       
    99         
       
   100         /**
       
   101          * Returns WLAN details that has already formatted
       
   102          * @since S60 v5.0
       
   103          * @return Formatted WLAN details 
       
   104          */        
       
   105         CDesCArrayFlat* GetWlanDetails();  
       
   106     
       
   107         /**
       
   108          * Returns current Wlan Ssid
       
   109          * @since S60 v5.0
       
   110          * @return Ssid
       
   111          */        
       
   112         const TDesC8& WlanSsid() const;
       
   113     
       
   114     private:
       
   115     
       
   116         /**
       
   117         * C++ default constructor.
       
   118         */
       
   119         CWsfConnectedDetailsModel();
       
   120         
       
   121         /*
       
   122         * Second-phase constructor.
       
   123         */       
       
   124         void ConstructL();
       
   125         
       
   126         // New methods
       
   127     
       
   128     private:
       
   129         /**
       
   130          * Appends Wlan Ssid to 
       
   131          * iFormattedConnectedWlanInfo
       
   132          * @since S60 v5.0
       
   133          */            
       
   134         void FormatAndAppendConnectedWlanSsidL();
       
   135      
       
   136         /**
       
   137          * Appends duration of connection
       
   138          * to iConnectedFormattedWlanInfo
       
   139          * @since S60 v5.0
       
   140          */            
       
   141         void FormatAndAppendDurationL();
       
   142         
       
   143         /**
       
   144          * Appends amount of transferred data 
       
   145          * to iConnectedFormattedWlanInfo
       
   146          * @since S60 v5.0
       
   147          */     
       
   148         void FormatAndAppendTransferredL();
       
   149     
       
   150         /**
       
   151          * Formats connection duration
       
   152          * to string 
       
   153          * @since S60 v5.0
       
   154          * @return formated string
       
   155          */        
       
   156         HBufC* FormatDurationLC();
       
   157     
       
   158         /**
       
   159          * Formats amount of transferred
       
   160          * data to string 
       
   161          * @since S60 v5.0
       
   162          * @return formated string
       
   163          */        
       
   164         HBufC* FormatTransferredLC();
       
   165     
       
   166         /**
       
   167         * Calculate number of visible (Not hidden) WLANs
       
   168         * @since S60 v.5.0
       
   169         * @param aArray Array of WLAN passed as reference
       
   170         * @return Number of visible WLANs
       
   171         */ 
       
   172         TInt VisibleWlans( CWsfWlanInfoArray& aArray );
       
   173     
       
   174     private: // Data
       
   175     
       
   176         /**
       
   177          * Copy of showed Wlan info
       
   178          */
       
   179         TWsfWlanInfo iWlanInfo;
       
   180         
       
   181         /**
       
   182          * Formater Wlan info
       
   183          * Own.
       
   184          */
       
   185         CDesCArrayFlat* iFormattedWlanInfo;    
       
   186         
       
   187         /**
       
   188          * Time when connection started
       
   189          */    
       
   190         TTime iStartTime;
       
   191     
       
   192         /**
       
   193          * True if the connection is still active
       
   194          */    
       
   195         TBool iIsConnActive;
       
   196     
       
   197         /**
       
   198          * Duration of the connection
       
   199          */    
       
   200         TTimeIntervalMicroSeconds iDuration;
       
   201     
       
   202         /**
       
   203          * Total number of bytes transmitted
       
   204          */    
       
   205         TUint iBytesTransmitted;    
       
   206             
       
   207         /**
       
   208          * The Connection Monitor
       
   209          */    
       
   210         RConnectionMonitor iConnectionMonitor;
       
   211             
       
   212         /**
       
   213          * The Connection ID of the WLAN
       
   214          */    
       
   215         TInt iConnectionId;
       
   216         
       
   217         /**
       
   218          * Coe env for loading string from resource
       
   219          * Ref.
       
   220          */
       
   221         CCoeEnv* iCoeEnv; 
       
   222         
       
   223         /**
       
   224          * Reference to Wlan array
       
   225          * ref.
       
   226          */
       
   227         CWsfWlanInfoArray* iWlanArray;
       
   228 
       
   229         /**
       
   230          * Acts as a mutex for refreshing functions
       
   231          */
       
   232         TBool iRefreshing;
       
   233     };
       
   234 
       
   235 #endif // C_WSFCONNECTEDDETAILSMODEL_H