bearermanagement/mpm/inc/mpmwlanquerydialog.h
changeset 0 5a93021fdf25
child 17 c14618f9de99
child 20 9c97ad6591ae
equal deleted inserted replaced
-1:000000000000 0:5a93021fdf25
       
     1 /*
       
     2 * Copyright (c) 2008-2009 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: Handles displaying wlan related dialogs
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef MPMWLANQUERYDIALOG_H
       
    20 #define MPMWLANQUERYDIALOG_H
       
    21 
       
    22 #include <e32std.h>
       
    23 #include <wdbifwlansettings.h> //for struct
       
    24 #include <ConnectionUiUtilities.h>
       
    25 #include <wifiprotuiclient.h>
       
    26 #include <wifiprotreturn.h>
       
    27 
       
    28 #include "mpmiapselection.h" // for TOfflineNoteResponse
       
    29 
       
    30 // ID of Easy Wep dialog
       
    31 const TUid KUidEasyWepDlg = { 0x101FD673 };
       
    32 
       
    33 // ID of Easy Wpa dialog
       
    34 const TUid KUidEasyWpaDlg = { 0x101FD674 };
       
    35 
       
    36 // ID of OfflineWlanNote dialog
       
    37 const TUid KUidCOfflineWlanNoteDlg = { 0x101FD671 };
       
    38 
       
    39 /**
       
    40  * This structure is copied from ConnectionUiUtilitiesCommon.h,
       
    41  * but given here a different name.
       
    42  * Defines preferences of the Wlan Network
       
    43  */
       
    44 class TMpmWlanNetworkPrefs
       
    45     {
       
    46 public:
       
    47     TWlanSsid                           iSsId;        ///< Ssid of Wlan network
       
    48     TWlanConnectionMode                 iNetworkMode; ///< mode of Wlan network
       
    49     TWlanConnectionSecurityMode         iSecMode;     ///< Security mode of Wlan network
       
    50     TBool                               iProtectedSetupSupported; 
       
    51                                         ///< Wlan network supports Protected Setup
       
    52     };
       
    53 
       
    54 const TInt KEasyWepQuery256BitMaxLength = 58;
       
    55 
       
    56 class TWlanAgtWepKeyData
       
    57     {
       
    58 public:
       
    59     TBuf< KEasyWepQuery256BitMaxLength > iKey;
       
    60     TBool iHex;
       
    61     };
       
    62 
       
    63 class CMPMIapSelection;
       
    64 /**
       
    65  *  Handles displaying wlan related dialogs
       
    66  *
       
    67  *  @lib mpmserver.exe
       
    68  *  @since S60 v3.2
       
    69  */
       
    70 class CMPMWlanQueryDialog : public CActive
       
    71     {
       
    72 
       
    73 enum TWlanQueryState
       
    74     {
       
    75     EOffline,
       
    76     EWlanNetwork,
       
    77     EWepSettings,
       
    78     EWpaSettings, 
       
    79     EWPS,
       
    80     ERetrySettingsStorage
       
    81     };
       
    82 
       
    83 public:
       
    84 
       
    85     static CMPMWlanQueryDialog* NewL( CMPMIapSelection&  aSession,
       
    86                                       TUint32            aSelectedWlanIap );
       
    87 
       
    88     /**
       
    89     * Destructor.
       
    90     */
       
    91     virtual ~CMPMWlanQueryDialog();
       
    92 
       
    93 public: // Functions from base classes
       
    94 
       
    95         /**
       
    96         * From CActive. Cancels UI dialogs.
       
    97         * @since 3.2
       
    98         */        
       
    99         void DoCancel();
       
   100         
       
   101         /**
       
   102         * From CActive. Run when UI dialog finished.
       
   103         * @since 3.2
       
   104         */               
       
   105         void RunL();
       
   106         
       
   107         /**
       
   108         * From CActive. Run if RunL leaves.
       
   109         * @since 3.2
       
   110         * @param aError Error that caused leave.
       
   111         * @return KErrNone
       
   112         */
       
   113         TInt RunError( TInt aError );
       
   114 
       
   115 public:
       
   116 
       
   117         /**
       
   118         * Starts displaying wlan dialogs if necessary
       
   119         * @since 3.2
       
   120         */
       
   121         void StartWlanQueryL();
       
   122         
       
   123         /**
       
   124         * Stores user defined easy wlan parameters to commsdat
       
   125         * if easy wlan has been selected.
       
   126         *
       
   127         * @since 3.2
       
   128         */
       
   129         void StoreEasyWlanSelectionL();
       
   130 
       
   131 private:
       
   132 
       
   133         /**
       
   134          * Propagates wlan network selection as an initial value for the dialog,
       
   135          * Used if there are several dialogs queued.
       
   136          *
       
   137          * @param aWlanIapId     Selected WLAN IAP
       
   138          * @param aOfflineStatus Offline note response
       
   139          * @param aDialogStatus  Status of the dialog when destroyed.
       
   140          * @since 3.2
       
   141          */
       
   142         void OfferInformation( TUint32 aWlanIapId, 
       
   143                                TOfflineNoteResponse aOfflineStatus,
       
   144                                TInt aDialogStatus );
       
   145 
       
   146         CMPMWlanQueryDialog( CMPMIapSelection&  aSession,
       
   147                              TUint32            aSelectedWlanIap );
       
   148 
       
   149         void ConstructL();
       
   150 
       
   151         /**
       
   152         * Gets Easy Wlan data from member variables and stores 
       
   153         * it to arguments
       
   154         *
       
   155         * @since 9.1
       
   156         * @param aSsid Wlan iap ssid, stored in used ssid field
       
   157         * @param aSecMode Wlan iap security mode
       
   158         * @param aConnMode Wlan iap connection mode
       
   159         * @param aWepKeyData Wlan iap wep key data
       
   160         * @param aEnableWpaPsk Wlan iap enable psk mode
       
   161         * @param aWpaPsk Wlan iap wpa psk
       
   162         * @param aWpaKeyLen Wlan iap wpa key length
       
   163         */
       
   164         void GetEasyWlanDataL( TWlanSsid&    aSsid,
       
   165                                TUint&        aSecMode,
       
   166                                TWlanNetMode& aConnMode,
       
   167                                TWepKeyData&  aWepKeyData, 
       
   168                                TUint&        aEnableWpaPsk,
       
   169                                TDes8&        aWpaPsk,
       
   170                                TUint&        aWpaKeyLen  );
       
   171 
       
   172         /**
       
   173         * Maps TWlanConnectionSecurityMode to security mode stored in CommsDat
       
   174         *
       
   175         * @since 9.1
       
   176         * @param aConnSecmode Security mode in TWlanConnectionSecurityMode format
       
   177         * @param aCommsdatSecMode returned security mode value in CommsDat format
       
   178         */
       
   179         TInt ConnSecModeToCommsDatSecMode( TWlanConnectionSecurityMode aConnSecmode,
       
   180                                            TUint& aCommsdatSecMode ) const;
       
   181 
       
   182         /**
       
   183         * Maps TWlanIapSecurityMode to security mode stored in CommsDat
       
   184         *
       
   185         * @since 9.1
       
   186         * @param aConnSecmode Security mode in TWlanIapSecurityMode format
       
   187         * @param aCommsdatSecMode returned security mode value in CommsDat format
       
   188         */
       
   189         TInt IapSecModeToCommsDatSecMode( TWlanIapSecurityMode aConnSecmode,
       
   190                                           TUint& aCommsdatSecMode ) const;
       
   191 
       
   192         /**
       
   193         * Gets Easy Wlan data from member variables when WPS has been used 
       
   194         * and stores it to arguments
       
   195         *
       
   196         * @since 9.1
       
   197         * @param aSsid Wlan iap ssid, stored in used ssid field
       
   198         * @param aSecMode Wlan iap security mode
       
   199         * @param aConnMode Wlan iap connection mode
       
   200         * @param aWepKeyData WEP key data
       
   201         * @param aEnableWpaPsk Wlan iap enable psk mode
       
   202         * @param aWpaPsk Wlan iap wpa psk
       
   203         * @param aWpaKeyLen Wlan iap wpa key length
       
   204         */
       
   205         void GetEasyWlanDataForWpsL( TWlanSsid&    aSsid,
       
   206                                      TUint&        aSecMode,
       
   207                                      TWlanNetMode& aConnMode,
       
   208                                      TWepKeyData&  aWepKeyData, 
       
   209                                      TUint&        aEnableWpaPsk,
       
   210                                      TDes8&        aWpaPsk,
       
   211                                      TUint&        aWpaKeyLen  );
       
   212 
       
   213         /**
       
   214         * Starts WPS dialog and sets the active object active.
       
   215         *
       
   216         * @since 9.1
       
   217         */
       
   218         void StartWpsDlgL();
       
   219 
       
   220         /**
       
   221         * Determines whether WEP key is hex format based on the length
       
   222         *
       
   223         * @since 9.1
       
   224         * @param aLength 
       
   225         * @return ETrue if format is hex, otherwise EFalse
       
   226         */
       
   227         TBool IsWepFormatHexL( TInt aLength ) const;
       
   228 
       
   229         /**
       
   230         * Get the network preferences using ConnectionUiUtilities API.
       
   231         *
       
   232         * @since 5.1
       
   233         */
       
   234         void GetNetworkPrefs();
       
   235 
       
   236 private: // data
       
   237 
       
   238         // Reference to iap selection object
       
   239         CMPMIapSelection& iIapSelection;
       
   240 
       
   241         // Stores data for offline note
       
   242         TPckgBuf<TBool> iOfflineReply;
       
   243         
       
   244         // Stores data for wlan network guery
       
   245         TPckgBuf<TMpmWlanNetworkPrefs> iNetworkPrefs;
       
   246         
       
   247         // Stores data for wep query
       
   248         TPckgBuf<TWlanAgtWepKeyData> iNotifWep;
       
   249         
       
   250         // Stores data for wpa query
       
   251         TPckgBuf< TBuf< KWLMMaxWpaPskLength > > iNotifWpaKey;
       
   252 
       
   253         //Interfce to Notifier
       
   254         RNotifier iNotifier;
       
   255 
       
   256         //State of querying Wlan settings
       
   257         TWlanQueryState iWlanQueryState;
       
   258             
       
   259         // selected wlan iap id
       
   260         TUint32 iWlanIapId;
       
   261             
       
   262         // ETrue if user has selected easy wlan
       
   263         TBool iEasyWlanSelected;
       
   264             
       
   265         // Flag that can be used to cancel the dialog startup based on earlier dialog
       
   266         TInt iOverrideStatus;
       
   267             
       
   268         // Connection Ui Utilities pointer
       
   269         CConnectionUiUtilities* iConnUiUtils;
       
   270 
       
   271         // Contains WLAN settings received through WPS
       
   272         TWlanProtectedSetupCredentialAttribute iWpsAttribute;
       
   273 
       
   274         // WPS client pointer for displaying WPS dialogs
       
   275         CWiFiProtUiClient* iWps;
       
   276 
       
   277         // Contains WPS return value
       
   278         WiFiProt::TWiFiReturn iWpsReturn;
       
   279 
       
   280         // True if wps has been completed. 
       
   281         TBool iWpsCompleted;
       
   282         
       
   283         // Retry count
       
   284         TUint32 iRetryCount;
       
   285         
       
   286         // Retry timer
       
   287         RTimer iTimer;
       
   288     };
       
   289 
       
   290 #endif // MPMWLANQUERYDIALOG_H