bearermanagement/mpm/inc/mpmwlanquerydialog.h
changeset 20 9c97ad6591ae
parent 0 5a93021fdf25
equal deleted inserted replaced
18:fcbbe021d614 20:9c97ad6591ae
    20 #define MPMWLANQUERYDIALOG_H
    20 #define MPMWLANQUERYDIALOG_H
    21 
    21 
    22 #include <e32std.h>
    22 #include <e32std.h>
    23 #include <wdbifwlansettings.h> //for struct
    23 #include <wdbifwlansettings.h> //for struct
    24 #include <ConnectionUiUtilities.h>
    24 #include <ConnectionUiUtilities.h>
    25 #include <wifiprotuiclient.h>
       
    26 #include <wifiprotreturn.h>
       
    27 
    25 
    28 #include "mpmiapselection.h" // for TOfflineNoteResponse
    26 #include "mpmcommsdataccess.h"
    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 
    27 
    36 // ID of OfflineWlanNote dialog
    28 // ID of OfflineWlanNote dialog
    37 const TUid KUidCOfflineWlanNoteDlg = { 0x101FD671 };
    29 const TUid KUidCOfflineWlanNoteDlg = { 0x101FD671 };
    38 
    30 
    39 /**
    31 /**
    49     TWlanConnectionSecurityMode         iSecMode;     ///< Security mode of Wlan network
    41     TWlanConnectionSecurityMode         iSecMode;     ///< Security mode of Wlan network
    50     TBool                               iProtectedSetupSupported; 
    42     TBool                               iProtectedSetupSupported; 
    51                                         ///< Wlan network supports Protected Setup
    43                                         ///< Wlan network supports Protected Setup
    52     };
    44     };
    53 
    45 
    54 const TInt KEasyWepQuery256BitMaxLength = 58;
    46 class CMPMIapSelection;
    55 
    47 
    56 class TWlanAgtWepKeyData
       
    57     {
       
    58 public:
       
    59     TBuf< KEasyWepQuery256BitMaxLength > iKey;
       
    60     TBool iHex;
       
    61     };
       
    62 
       
    63 class CMPMIapSelection;
       
    64 /**
    48 /**
    65  *  Handles displaying wlan related dialogs
    49  *  Handles displaying wlan related dialogs
    66  *
    50  *
    67  *  @lib mpmserver.exe
    51  *  @lib mpmserver.exe
    68  *  @since S60 v3.2
    52  *  @since S60 v3.2
    70 class CMPMWlanQueryDialog : public CActive
    54 class CMPMWlanQueryDialog : public CActive
    71     {
    55     {
    72 
    56 
    73 enum TWlanQueryState
    57 enum TWlanQueryState
    74     {
    58     {
    75     EOffline,
    59     EOffline
    76     EWlanNetwork,
       
    77     EWepSettings,
       
    78     EWpaSettings, 
       
    79     EWPS,
       
    80     ERetrySettingsStorage
       
    81     };
    60     };
    82 
    61 
    83 public:
    62 public:
    84 
    63 
    85     static CMPMWlanQueryDialog* NewL( CMPMIapSelection&  aSession,
    64     static CMPMWlanQueryDialog* NewL( CMPMIapSelection&  aSession,
   117         /**
    96         /**
   118         * Starts displaying wlan dialogs if necessary
    97         * Starts displaying wlan dialogs if necessary
   119         * @since 3.2
    98         * @since 3.2
   120         */
    99         */
   121         void StartWlanQueryL();
   100         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 
   101 
   131 private:
   102 private:
   132 
   103 
   133         /**
   104         /**
   134          * Propagates wlan network selection as an initial value for the dialog,
   105          * Propagates wlan network selection as an initial value for the dialog,
   135          * Used if there are several dialogs queued.
   106          * Used if there are several dialogs queued.
   136          *
   107          *
   137          * @param aWlanIapId     Selected WLAN IAP
       
   138          * @param aOfflineStatus Offline note response
       
   139          * @param aDialogStatus  Status of the dialog when destroyed.
   108          * @param aDialogStatus  Status of the dialog when destroyed.
   140          * @since 3.2
   109          * @since 3.2
   141          */
   110          */
   142         void OfferInformation( TUint32 aWlanIapId, 
   111         void OfferInformation( TInt aDialogStatus );
   143                                TOfflineNoteResponse aOfflineStatus,
       
   144                                TInt aDialogStatus );
       
   145 
   112 
   146         CMPMWlanQueryDialog( CMPMIapSelection&  aSession,
   113         CMPMWlanQueryDialog( CMPMIapSelection&  aIapSelection,
   147                              TUint32            aSelectedWlanIap );
   114                              TUint32            aSelectedWlanIap );
   148 
   115 
   149         void ConstructL();
   116         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 
   117 
   236 private: // data
   118 private: // data
   237 
   119 
   238         // Reference to iap selection object
   120         // Reference to iap selection object
   239         CMPMIapSelection& iIapSelection;
   121         CMPMIapSelection& iIapSelection;
   242         TPckgBuf<TBool> iOfflineReply;
   124         TPckgBuf<TBool> iOfflineReply;
   243         
   125         
   244         // Stores data for wlan network guery
   126         // Stores data for wlan network guery
   245         TPckgBuf<TMpmWlanNetworkPrefs> iNetworkPrefs;
   127         TPckgBuf<TMpmWlanNetworkPrefs> iNetworkPrefs;
   246         
   128         
   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
   129         //Interfce to Notifier
   254         RNotifier iNotifier;
   130         RNotifier iNotifier;
   255 
   131 
   256         //State of querying Wlan settings
   132         //State of querying Wlan settings
   257         TWlanQueryState iWlanQueryState;
   133         TWlanQueryState iWlanQueryState;
   258             
   134             
   259         // selected wlan iap id
   135         // Connection Ui Utilities pointer
       
   136         CConnectionUiUtilities* iConnUiUtils;
       
   137         
       
   138         // Wlan iap
   260         TUint32 iWlanIapId;
   139         TUint32 iWlanIapId;
   261             
   140         
   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
   141         // Flag that can be used to cancel the dialog startup based on earlier dialog
   266         TInt iOverrideStatus;
   142         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     };
   143     };
   289 
   144 
   290 #endif // MPMWLANQUERYDIALOG_H
   145 #endif // MPMWLANQUERYDIALOG_H