wlanutilities/wlanplugin/inc/wlanpluginwlanstate.h
branchRCL_3
changeset 24 63be7eb3fc78
parent 23 b852595f5cbe
child 25 f28ada11abbf
equal deleted inserted replaced
23:b852595f5cbe 24:63be7eb3fc78
     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         */
       
   152         virtual void WlanConnectionActivatedL();
       
   153 
       
   154         /*
       
   155         * wlan bearer has been closed
       
   156         */
       
   157         virtual void WlanConnectionClosedL();
       
   158         
       
   159         /**
       
   160         * Connection creation process finished
       
   161         * @param aError System wide error code
       
   162         */
       
   163         virtual void ConnectionCreationProcessFinishedL( TInt aError );
       
   164         
       
   165     protected:
       
   166         /*
       
   167         * Makes the wlan state descriptor according to
       
   168         * the given info array.
       
   169         * @param aArray the given info array.
       
   170         * @param aDes the result is written here.
       
   171         */
       
   172         void MakeStateStringL( CWsfWlanInfoArray* aArray, HBufC*& aBuf );
       
   173 
       
   174 
       
   175         /*
       
   176         * Gives the connected wlan status string.
       
   177         * @param aItem Ref to the result descriptor. 
       
   178         */
       
   179         void FormatConnectedL( HBufC*& aBuf );
       
   180         
       
   181         /*
       
   182         * Gives the offline wlan status string.
       
   183         * @param aItem Ref to the result descriptor. 
       
   184         */
       
   185         void FormatStatusOffL( HBufC*& aBuf );
       
   186 
       
   187         /*
       
   188         * Decides if there is one interesting wlan or
       
   189         * more and writes out wlan state string.
       
   190         * @param aArray input array of wlans.
       
   191         * @param aItem ref to the result descriptor.
       
   192         */
       
   193         void CheckWlansL( CWsfWlanInfoArray* aArray, HBufC*& aBuf );
       
   194 
       
   195         /*
       
   196         * Decides if the wlan given is connected, or known 
       
   197         * and writes out the suitable text to aItem according
       
   198         * to it.
       
   199         * @param aWlan Input wlan info.
       
   200         * @param aItem Ref to the result descriptor. 
       
   201         */
       
   202         void FormatWlanSingleLineL( TWsfWlanInfo& aWlan, HBufC*& aBuf );
       
   203 
       
   204         /*
       
   205         * Decides if there is one unknown or more
       
   206         * networks and writes solution according to it.
       
   207         * @param aMultipleUnknownWlans If 
       
   208         * there is more network available.
       
   209         * @param aItem Ref to the result descriptor.
       
   210         */
       
   211         void FormatUnknownWlansSingleLineL( 
       
   212                     const TBool aMultipleUnknownWlans, 
       
   213                     HBufC*& aBuf );
       
   214 
       
   215         /*
       
   216         * Gives the descripto meaning there are no
       
   217         * wlans found. 
       
   218         * @param aItem Ref to output descriptor.
       
   219         */
       
   220         void FormatNoWlansAvailableL( HBufC*& aBuf );
       
   221 
       
   222         /*
       
   223         * Checks if the wlan state is different from
       
   224         * the one iPresentString represent. The
       
   225         * result is ETrue if the state changed.
       
   226         * @return If the state is changed.
       
   227         */
       
   228         TBool IsStateChangedL();
       
   229         
       
   230         /*
       
   231         * Gets the present signal strength. It is a normal
       
   232         * strength if the wlan state is connected, otherwise it is
       
   233         * ENoSignal.
       
   234         * @return The signal strength
       
   235         */
       
   236         TWsfWlanSignalStrengthLevel GetSignalStrength();
       
   237         
       
   238         /**
       
   239         * Updates the parent plugin in Control Panel
       
   240         */
       
   241         void UpdateParentViewL();
       
   242                   
       
   243     private:
       
   244 
       
   245         /*
       
   246         * Second phase of two phase construction
       
   247         */
       
   248         void ConstructL();
       
   249         
       
   250         /**
       
   251         * Updates the wlan list
       
   252         */
       
   253         void UpdateWlanListL();
       
   254         
       
   255     protected:
       
   256         
       
   257         /*
       
   258         * @var pointer to a sniffer model    
       
   259         */
       
   260         CWsfModel* iEngine;
       
   261 
       
   262         /*
       
   263         * @var present wlan info list    
       
   264         */
       
   265         CWsfWlanInfoArray* iInfoArray;
       
   266         
       
   267         /*
       
   268         * @var if wlan is scanning    
       
   269         */
       
   270         TBool iScanning;
       
   271         
       
   272         /*
       
   273         * @var if there is wlan connection    
       
   274         */
       
   275         TInt iConnected;
       
   276         
       
   277         /*
       
   278         * @var true if the plugin explicitely started wlan scanning
       
   279         */
       
   280         TInt iExplicitScanning;
       
   281         
       
   282         /*
       
   283         * @var pointer to coeEnv
       
   284         */
       
   285         CCoeEnv* iCoeEnv;
       
   286 
       
   287         /*
       
   288         * @var pointer to parent plugin
       
   289         */
       
   290         CGSParentPlugin* iParent;
       
   291 
       
   292         /*
       
   293         * @var the present written out status string
       
   294         */
       
   295         HBufC* iPresentString;
       
   296         
       
   297         /*
       
   298         * @var the present signal strength
       
   299         */ 
       
   300         TWsfWlanSignalStrengthLevel iSignalStrength;
       
   301         
       
   302         /**
       
   303         * @var The Database observer class
       
   304         */
       
   305         CWlanPluginDbObserver* iDbObserver;
       
   306                 
       
   307         /**
       
   308         * @var A bool representing if calling an update for parent
       
   309         * plugin is enabled. True if the parent do not have be updated. 
       
   310         */
       
   311         TBool iSupressParentUpdate;
       
   312         
       
   313         /**
       
   314         * @var A bool false, if wlan list update is valid to call
       
   315         */
       
   316         TBool iSupressUpdateWlan;
       
   317         
       
   318         /**
       
   319         * @var object needed filtering out wlans
       
   320         */
       
   321         CWsfWlanInfoArrayVisitor* iWlanInfoBranding;
       
   322         
       
   323         /*
       
   324         * @var the second line data reachable is valid
       
   325         */
       
   326         TBool iValidSecondLine;
       
   327         
       
   328         /*
       
   329         * @var tThe wlan info of the connected network
       
   330         */
       
   331         TWsfWlanInfo iConnectedWlanInfo;
       
   332         
       
   333         /*
       
   334         * @var Time shifter
       
   335         */
       
   336         CWlanPluginTimeShifter* iTimeShifter;
       
   337         
       
   338         /*
       
   339         * @var Time shifter supressing
       
   340         */
       
   341         TBool iSupressTimeShifter;
       
   342         
       
   343     };
       
   344 
       
   345 #endif //__C_WLANPLUGINWLANSTATE_H__