accesssec_plat/wpa_security_settings_ui_api/inc/WPASecuritySettingsUI.h
changeset 0 c8830336c852
child 2 1c7bc153c08e
equal deleted inserted replaced
-1:000000000000 0:c8830336c852
       
     1 /*
       
     2 * Copyright (c) 2001-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 the License "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: Declares the main handler CWPASecuritySettings, UI CWPASecuritySettingsUI and public API for the WPA Security Settings. 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef WPASECURITYSETTINGSUI_H
       
    20 #define WPASECURITYSETTINGSUI_H
       
    21 
       
    22 // INCLUDES
       
    23 
       
    24 #include <e32base.h>
       
    25 
       
    26 #include <metadatabase.h>
       
    27 using namespace CommsDat;
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class CEikonEnv;
       
    31 class CWPASecuritySettingsUi;
       
    32 class CWPASecuritySettingsUiImpl;
       
    33 class CWPASecuritySettingsImpl;
       
    34 class CCommsDatabase;
       
    35 
       
    36 
       
    37 // ENUMERATIONS
       
    38 
       
    39 // Security mode in use
       
    40 enum TSecurityMode
       
    41     {
       
    42     ESecurityMode8021x = 4,     // 802.1x
       
    43     ESecurityModeWpa = 8        // WPA
       
    44     };
       
    45 
       
    46 
       
    47 // Type of saving
       
    48 enum TTypeOfSaving
       
    49     {
       
    50     ESavingEditedAP,      // Save an already existing AP that was edited.
       
    51     ESavingBrandNewAP,    // Save a just created AP started from default values
       
    52     ESavingNewAPAsACopy   // Save a new AP as a copy of an already existing AP
       
    53     };
       
    54 
       
    55 
       
    56 
       
    57 
       
    58 // CLASS DECLARATION
       
    59 /*
       
    60 * WPA Security Settings. Enables loading, saving and editing the settings
       
    61 * (editing via CWPASecuritySettingsUi).
       
    62 * Proxy around the real implementation in CWPASecuritySettingsUiImpl. 
       
    63 * No details of the actual data are exposed.
       
    64 */
       
    65 NONSHARABLE_CLASS( CWPASecuritySettings ) : public CBase
       
    66     {
       
    67 
       
    68     public: // Constructors and destructor
       
    69 
       
    70         /**
       
    71         * Two-phased constructor. Leaves on failure.
       
    72         * @param aSecurityMode  The chosen security mode. It can be 
       
    73         *                       ESecurityMode8021x or ESecurityModeWpa
       
    74         * @return The constructed CWPASecuritySettings object.
       
    75         */
       
    76         IMPORT_C static CWPASecuritySettings* NewL( 
       
    77                                                 TSecurityMode aSecurityMode );
       
    78 
       
    79 
       
    80         /**
       
    81         * Destructor.
       
    82         */
       
    83         IMPORT_C ~CWPASecuritySettings();
       
    84 
       
    85 
       
    86     public:     // Types
       
    87 
       
    88         enum TEvent                     // Events happening during edit.
       
    89             {
       
    90             ENone           = 0x0000,   // Nothing happened.
       
    91             EModified       = 0x0001,   // Data changed.
       
    92             EValid          = 0x0010,   // All data entererd are valid, they
       
    93                                         // can be saved
       
    94             EExitReq        = 0x0020,   // Exit option requested, also caller 
       
    95                                         // app should close
       
    96             EShutDownReq    = 0x0040    // ShutDown was requested
       
    97             };
       
    98 
       
    99 
       
   100     public:     // New methods
       
   101 
       
   102         /**
       
   103         * Load from database.
       
   104         * @param Wlan Service Table Id of the IAP to be loaded
       
   105         * @param aCommsDb Comms database.
       
   106         */
       
   107         IMPORT_C void LoadL( TUint32 aIapId, CCommsDatabase& aCommsDb );
       
   108         
       
   109 
       
   110         /**
       
   111         * Edit the settings.
       
   112         * @param aUi UI to be used.
       
   113         * @param aTitle Title Pane text to display during edit.
       
   114         * @return Exit reason.
       
   115         */
       
   116         IMPORT_C TInt EditL( CWPASecuritySettingsUi& aUi, 
       
   117                              const TDesC& aTitle );
       
   118 
       
   119         /**
       
   120         * Save to database.
       
   121         * @param aIapId     Wlan Service Table Id of the IAP to be saved
       
   122         * @param aCommsDb   Comms database.
       
   123         * @param aTypeOfSaving	Tells what kind of AP we are going to save: it 
       
   124         *                       can be ESavingEditedAP, ESavingBrandNewAP, or 
       
   125         *                       ESavingNewAPAsACopy
       
   126         * @param aOldIapId  The old Id of the IAP; it is used to save the EAP 
       
   127         *                   configuration, only when aIsNewAP is ETrue
       
   128         */
       
   129         IMPORT_C void SaveL( TUint32 aIapId, 
       
   130                              CCommsDatabase& aCommsDb, 
       
   131                              TTypeOfSaving aTypeOfSaving, 
       
   132                              TUint32 aOldIapId ) const;
       
   133 
       
   134 
       
   135         /**
       
   136         * Delete from database. It actually just removes EAP Configuration.
       
   137         * @param aIapId Id of the IAP to be saved
       
   138         */
       
   139         IMPORT_C void DeleteL( TUint32 aIapId ) const;
       
   140 
       
   141 
       
   142         /**
       
   143         * Tells if the settings are valid and can be saved
       
   144         * @return ETrue if all the compulsory settings have been entered
       
   145         */
       
   146         IMPORT_C TBool IsValid() const;
       
   147 
       
   148 
       
   149         /**
       
   150         * Sets the Pre-shared key
       
   151         * @param aPreSharedKey  The key to be set
       
   152         * @return KErrNone if successful, or an error code
       
   153         */
       
   154         IMPORT_C TInt SetWPAPreSharedKey( const TDesC& aPreSharedKey );
       
   155         
       
   156         
       
   157         /**
       
   158         * Load from database.
       
   159         * @param aIapId Wlan Service Table Id of the IAP to be loaded
       
   160         * @param aSession CommsDat session.
       
   161         */
       
   162         IMPORT_C void LoadL( TUint32 aIapId, CMDBSession& aSession );
       
   163         
       
   164         
       
   165         /**
       
   166         * Save to database.
       
   167         * @param aIapId     Wlan Service Table Id of the IAP to be saved
       
   168         * @param aSession   CommsDat session.
       
   169         * @param aTypeOfSaving	Tells what kind of AP we are going to save: it 
       
   170         *                       can be ESavingEditedAP, ESavingBrandNewAP, or 
       
   171         *                       ESavingNewAPAsACopy
       
   172         * @param aOldIapId  The old Id of the IAP; it is used to save the EAP 
       
   173         *                   configuration, only when aIsNewAP is ETrue
       
   174         */
       
   175         IMPORT_C void SaveL( TUint32 aIapId, 
       
   176                              CMDBSession& aSession, 
       
   177                              TTypeOfSaving aTypeOfSaving, 
       
   178                              TUint32 aOldIapId ) const;
       
   179 
       
   180         /**
       
   181         * Sets the list of enabled EAP types.
       
   182         * @param aEnabledPluginList Enumeration of enabled plugins 
       
   183         *                           in expanded EAP type format
       
   184         * @return KErrNone if successful, or an error code
       
   185         */
       
   186         IMPORT_C TInt SetWPAEnabledEAPPlugin( const TDesC8& aEnabledPluginList );
       
   187 
       
   188 
       
   189         /**
       
   190         * Sets the list of disabled EAP types
       
   191         * @param aDisabledPluginList Enumeration of disabled plugins
       
   192         *                            in expanded EAP type format
       
   193         * @return KErrNone if successful, or an error code
       
   194         */
       
   195         IMPORT_C TInt SetWPADisabledEAPPlugin( const TDesC8& aDisabledPluginList );
       
   196         
       
   197 
       
   198     private:    // Data 
       
   199 
       
   200         // Implementation. Owned.
       
   201         CWPASecuritySettingsImpl* iImpl;  
       
   202 
       
   203     };
       
   204 
       
   205 
       
   206 
       
   207 /**
       
   208 * User interface to edit WPA Security Settings.
       
   209 * Proxy around the real implementation in CWPASecuritySettingsUiImpl.
       
   210 */
       
   211 NONSHARABLE_CLASS( CWPASecuritySettingsUi ) : public CBase
       
   212     {
       
   213 
       
   214     public:     // Constructors and destructor
       
   215 
       
   216         /**
       
   217         * Two-phased constructor. Leaves on failure.
       
   218         * @param aEikEnv Eikon environment.
       
   219         * @return The constructed CWPASecuritySettingsUi object.
       
   220         */
       
   221         IMPORT_C static CWPASecuritySettingsUi* NewL( CEikonEnv& aEikEnv );
       
   222 
       
   223         /**
       
   224         * Destructor.
       
   225         */
       
   226         IMPORT_C virtual ~CWPASecuritySettingsUi();
       
   227 
       
   228     public:     // New methods
       
   229 
       
   230         /**
       
   231         * Component Validation Test.
       
   232         * @return KErrNone.
       
   233         */
       
   234         IMPORT_C static TInt Cvt();
       
   235 
       
   236     private:    // Friends
       
   237 
       
   238         friend class CWPASecuritySettings;
       
   239 
       
   240     private:    // Data 
       
   241 
       
   242         // Implementation. Owned.
       
   243         CWPASecuritySettingsUiImpl* iImpl;
       
   244 
       
   245     };
       
   246 #endif
       
   247 
       
   248 
       
   249 // End of File