wlanutilities/wlanplugin/inc/wlanpluginwlanstate.h
changeset 0 56b72877c1cb
child 11 8b0eae1b1d71
equal deleted inserted replaced
-1:000000000000 0:56b72877c1cb
       
     1 /*
       
     2 * Copyright (c) 2007 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: 
       
    15 *        Header file for WlanPluginWlanState class.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef __C_WLANPLUGINWLANSTATE_H__
       
    21 #define __C_WLANPLUGINWLANSTATE_H__
       
    22 
       
    23 // System includes
       
    24 #include <e32base.h>
       
    25 #include <wsfstatechangeobserver.h>
       
    26 #include <wsfwlaninfo.h>
       
    27 #include <AknsItemID.h>
       
    28 
       
    29 //forward declarations
       
    30 class CWsfModel;
       
    31 class CWsfWlanInfoArray;
       
    32 class CCoeEnv;
       
    33 class CGSParentPlugin;
       
    34 class CGulIcon;
       
    35 class CWlanPluginDbObserver;
       
    36 class CWsfWlanInfoArrayVisitor;
       
    37 class CWlanPluginTimeShifter;
       
    38 
       
    39 /**
       
    40 * WLAN state class.
       
    41 */
       
    42 class CWlanPluginWlanState : public CBase,
       
    43                                 public MWsfStateChangeObserver
       
    44     {
       
    45         
       
    46     public:
       
    47     
       
    48         /*
       
    49         * Default constructor
       
    50         * @param aParent The the parent plugin of it in.
       
    51         * the Control Panel
       
    52         */
       
    53         CWlanPluginWlanState( CGSParentPlugin *aParent );
       
    54         
       
    55         /*
       
    56         * Destructor
       
    57         */
       
    58         virtual ~CWlanPluginWlanState();
       
    59         
       
    60         /*
       
    61         * First phase of 2 phase constructor.
       
    62         * @param aParent pointer to parent plugin.
       
    63         * @return An instance.
       
    64         */
       
    65         static CWlanPluginWlanState* NewLC( CGSParentPlugin *aParent );
       
    66         
       
    67         /*
       
    68         * First phase of 2 phase constructor
       
    69         * @param aParent Pointer to parent plugin.
       
    70         * @return An instance.
       
    71         */
       
    72         static CWlanPluginWlanState* NewL( CGSParentPlugin *aParent );
       
    73         
       
    74         /*
       
    75         *  Gives back the wlan state descriptor into aDes.
       
    76         *  @param aDes Reference to the destination descriptor.
       
    77         */
       
    78         void GetStateStringL( TDes& aDes );
       
    79         
       
    80         /*
       
    81         * Gives back the wlan state main icon. The result is
       
    82         * ETrue if there is valid id. 
       
    83         * @param aPic The id of the icon.
       
    84         * @param aPicMask The id of the mask.
       
    85         */
       
    86         TBool GetMainIconL( TInt& aPic, 
       
    87         		            TInt& aPicMask, 
       
    88         		            TAknsItemID& aItemID );
       
    89 
       
    90         /*
       
    91         * Gives back the signal strength. The result is
       
    92         * ETrue if there is valid strength, and the state
       
    93         * is connected. 
       
    94         * @param aPic The id of the icon.
       
    95         * @param aPicMask The id of the mask.
       
    96         * @return If D column icon is needed.
       
    97         */
       
    98         TBool GetStrengthIconL( TInt& aPic, 
       
    99         		                TInt& aPicMask, 
       
   100         		                TAknsItemID& aItemId );
       
   101         
       
   102         /**
       
   103         * Returns if the observed scanning is on
       
   104         * @return If the scanning is on.
       
   105         */
       
   106         TBool IsScanning();
       
   107         
       
   108         /**
       
   109         * Sets the scanning value, and manage effects, caused
       
   110         * by it. It is used by the dbobserver class to manage 
       
   111         * setting scanning value caused by the "Wlan availability".
       
   112         * @param aScanning The set value.
       
   113         */
       
   114         void SetScanningL( TBool aScanning );
       
   115         
       
   116         /**
       
   117         *
       
   118         */
       
   119         void DirectlyScanL();
       
   120         
       
   121         /**
       
   122         *
       
   123         */
       
   124         void DeleteTimeShifter();
       
   125         
       
   126     public: //from MWlanSnifferStateChangeObserver
       
   127         /*
       
   128         * The current wlan data has changed
       
   129         * and it is ready to be retrieved.
       
   130         */
       
   131         virtual void WlanListChangedL();
       
   132 
       
   133         /*
       
   134         * Engine error occured
       
   135         * @param aError System wide error to describe what has happened.
       
   136         */
       
   137         virtual void NotifyEngineError( TInt aError );
       
   138 
       
   139         /*
       
   140         *  The network scanning has been disabled.
       
   141         */
       
   142         virtual void ScanDisabledL();
       
   143 
       
   144         /*
       
   145         * The network scanning has been enabled.
       
   146         */
       
   147         virtual void ScanEnabledL();
       
   148 
       
   149         /*
       
   150         * Wlan bearer opened using accesspoint
       
   151         * @param TDesC aAccesspointName.
       
   152         */
       
   153         virtual void WlanConnectionActivatedL( const 
       
   154                                        TDesC& aAccessPointName );
       
   155 
       
   156         /*
       
   157         * wlan bearer has been closed
       
   158         */
       
   159         virtual void WlanConnectionClosedL();
       
   160         
       
   161         /**
       
   162         * Connection creation process finished
       
   163         * @param aError System wide error code
       
   164         */
       
   165         virtual void ConnectionCreationProcessFinishedL( TInt aError );
       
   166         
       
   167     protected:
       
   168         /*
       
   169         * Makes the wlan state descriptor according to
       
   170         * the given info array.
       
   171         * @param aArray the given info array.
       
   172         * @param aDes the result is written here.
       
   173         */
       
   174         void MakeStateStringL( CWsfWlanInfoArray* aArray, HBufC*& aBuf );
       
   175 
       
   176 
       
   177         /*
       
   178         * Gives the connected wlan status string.
       
   179         * @param aItem Ref to the result descriptor. 
       
   180         */
       
   181         void FormatConnectedL( HBufC*& aBuf );
       
   182         
       
   183         /*
       
   184         * Gives the offline wlan status string.
       
   185         * @param aItem Ref to the result descriptor. 
       
   186         */
       
   187         void FormatStatusOffL( HBufC*& aBuf );
       
   188 
       
   189         /*
       
   190         * Decides if there is one interesting wlan or
       
   191         * more and writes out wlan state string.
       
   192         * @param aArray input array of wlans.
       
   193         * @param aItem ref to the result descriptor.
       
   194         */
       
   195         void CheckWlansL( CWsfWlanInfoArray* aArray, HBufC*& aBuf );
       
   196 
       
   197         /*
       
   198         * Decides if the wlan given is connected, or known 
       
   199         * and writes out the suitable text to aItem according
       
   200         * to it.
       
   201         * @param aWlan Input wlan info.
       
   202         * @param aItem Ref to the result descriptor. 
       
   203         */
       
   204         void FormatWlanSingleLineL( TWsfWlanInfo& aWlan, HBufC*& aBuf );
       
   205 
       
   206         /*
       
   207         * Decides if there is one unknown or more
       
   208         * networks and writes solution according to it.
       
   209         * @param aMultipleUnknownWlans If 
       
   210         * there is more network available.
       
   211         * @param aItem Ref to the result descriptor.
       
   212         */
       
   213         void FormatUnknownWlansSingleLineL( 
       
   214                     const TBool aMultipleUnknownWlans, 
       
   215                     HBufC*& aBuf );
       
   216 
       
   217         /*
       
   218         * Gives the descripto meaning there are no
       
   219         * wlans found. 
       
   220         * @param aItem Ref to output descriptor.
       
   221         */
       
   222         void FormatNoWlansAvailableL( HBufC*& aBuf );
       
   223 
       
   224         /*
       
   225         * Checks if the wlan state is different from
       
   226         * the one iPresentString represent. The
       
   227         * result is ETrue if the state changed.
       
   228         * @return If the state is changed.
       
   229         */
       
   230         TBool IsStateChangedL();
       
   231         
       
   232         /*
       
   233         * Gets the present signal strength. It is a normal
       
   234         * strength if the wlan state is connected, otherwise it is
       
   235         * ENoSignal.
       
   236         * @return The signal strength
       
   237         */
       
   238         TWsfWlanSignalStrengthLevel GetSignalStrength();
       
   239         
       
   240         /**
       
   241         * Updates the parent plugin in Control Panel
       
   242         */
       
   243         void UpdateParentViewL();
       
   244                   
       
   245     private:
       
   246 
       
   247         /*
       
   248         * Second phase of two phase construction
       
   249         */
       
   250         void ConstructL();
       
   251         
       
   252         /**
       
   253         * Updates the wlan list
       
   254         */
       
   255         void UpdateWlanListL();
       
   256         
       
   257     protected:
       
   258         
       
   259         /*
       
   260         * @var pointer to a sniffer model    
       
   261         */
       
   262         CWsfModel* iEngine;
       
   263 
       
   264         /*
       
   265         * @var present wlan info list    
       
   266         */
       
   267         CWsfWlanInfoArray* iInfoArray;
       
   268         
       
   269         /*
       
   270         * @var if wlan is scanning    
       
   271         */
       
   272         TBool iScanning;
       
   273         
       
   274         /*
       
   275         * @var if there is wlan connection    
       
   276         */
       
   277         TInt iConnected;
       
   278         
       
   279         /*
       
   280         * @var true if the plugin explicitely started wlan scanning
       
   281         */
       
   282         TInt iExplicitScanning;
       
   283         
       
   284         /*
       
   285         * @var pointer to coeEnv
       
   286         */
       
   287         CCoeEnv* iCoeEnv;
       
   288 
       
   289         /*
       
   290         * @var pointer to parent plugin
       
   291         */
       
   292         CGSParentPlugin* iParent;
       
   293 
       
   294         /*
       
   295         * @var the present written out status string
       
   296         */
       
   297         HBufC* iPresentString;
       
   298         
       
   299         /*
       
   300         * @var the present signal strength
       
   301         */ 
       
   302         TWsfWlanSignalStrengthLevel iSignalStrength;
       
   303         
       
   304         /**
       
   305         * @var The Database observer class
       
   306         */
       
   307         CWlanPluginDbObserver* iDbObserver;
       
   308                 
       
   309         /**
       
   310         * @var A bool representing if calling an update for parent
       
   311         * plugin is enabled. True if the parent do not have be updated. 
       
   312         */
       
   313         TBool iSupressParentUpdate;
       
   314         
       
   315         /**
       
   316         * @var A bool false, if wlan list update is valid to call
       
   317         */
       
   318         TBool iSupressUpdateWlan;
       
   319         
       
   320         /**
       
   321         * @var object needed filtering out wlans
       
   322         */
       
   323         CWsfWlanInfoArrayVisitor* iWlanInfoBranding;
       
   324         
       
   325         /*
       
   326         * @var the second line data reachable is valid
       
   327         */
       
   328         TBool iValidSecondLine;
       
   329         
       
   330         /*
       
   331         * @var tThe wlan info of the connected network
       
   332         */
       
   333         TWsfWlanInfo iConnectedWlanInfo;
       
   334         
       
   335         /*
       
   336         * @var Time shifter
       
   337         */
       
   338         CWlanPluginTimeShifter* iTimeShifter;
       
   339         
       
   340         /*
       
   341         * @var Time shifter supressing
       
   342         */
       
   343         TBool iSupressTimeShifter;
       
   344         
       
   345     };
       
   346 
       
   347 #endif //__C_WLANPLUGINWLANSTATE_H__