wlanutilities/wlanwizard/src/wlanwizard.cpp
branchRCL_3
changeset 25 f28ada11abbf
parent 24 63be7eb3fc78
equal deleted inserted replaced
24:63be7eb3fc78 25:f28ada11abbf
     1 /*
       
     2 * Copyright (c) 2010 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 * WLAN Wizard: API.
       
    16 */
       
    17 
       
    18 // System includes
       
    19 
       
    20 // User includes
       
    21 #include "wlanwizard.h"
       
    22 #include "wlanwizard_p.h"
       
    23 
       
    24 /*!
       
    25    \class WlanWizard
       
    26    \brief Interface of WLAN Wizard.
       
    27    
       
    28    Example usage:
       
    29    \code
       
    30    MyClass::createWizard() {
       
    31        mWizard = new WlanWizard(mainWindow());
       
    32        connect(
       
    33            mWizard,
       
    34            SIGNAL(finished(int, bool)), 
       
    35            this,
       
    36            SLOT(finished(int, bool)));
       
    37        connect(mWizard, SIGNAL(cancelled()), this, SLOT(cancelled()));
       
    38    
       
    39        // If client know the parameters for WLAN Access Point call following
       
    40        mWizard->setParameters(
       
    41            "MySSid", 
       
    42            CmManagerShim::Infra, 
       
    43            CmManagerShim::WlanSecModeWpa,
       
    44            true,    // WPA-PSK
       
    45            false);  // Non-Wifi Protected Setup  
       
    46     
       
    47        // and execute wizard
       
    48        mWizard->show();
       
    49    }
       
    50    
       
    51    void MyClass::finished(int iapId, bool connected) {
       
    52        // User has successfully created WLAN IAP with the wizard. 
       
    53        
       
    54        // if connected equals to true, wizard has established connection to it
       
    55        // now the client needs to connect also to given IAP Id to keep the
       
    56        // connection open. 
       
    57        // see WlanQtUtils or RConnection.
       
    58        
       
    59        // Delete wizard. Do not delete in this call stack since this call has 
       
    60        // been done from the context of the wizards call stack.
       
    61        mWizard->deleteLater();
       
    62        mWizard = NULL;
       
    63    }  
       
    64    
       
    65    void MyClass::cancelled() {
       
    66        // wizard operation was cancelled by user, iap has not been created
       
    67        // and WLAN connection is not established
       
    68  
       
    69        // Delete wizard. Do not delete in this call stack since this call has 
       
    70        // been done from the context of the wizards call stack.      
       
    71        mWizard->deleteLater();
       
    72        mWizard = NULL;
       
    73    }
       
    74    \endcode
       
    75      
       
    76    Implements wizard based on wizard pattern.
       
    77  */
       
    78 
       
    79 /*!
       
    80    \fn void WlanWizard::cancelled()
       
    81    This signal is emitted when the execution of wizard has been cancelled.
       
    82  */
       
    83 
       
    84 /*!
       
    85    \fn void WlanWizard::finished(int iapId, bool connected)
       
    86    This signal is emitted when the execution of wizard has been finished
       
    87    succesfully.
       
    88    
       
    89    @param iapId IAP ID that has been created.
       
    90    @param connected true if the connection to wlan has been established.
       
    91  */
       
    92 
       
    93 // External function prototypes
       
    94 
       
    95 // Local constants
       
    96 
       
    97 
       
    98 // ======== LOCAL FUNCTIONS ========
       
    99 
       
   100 // ======== MEMBER FUNCTIONS ========
       
   101 
       
   102 /*!
       
   103    Constructor of WLAN Wizard.
       
   104    
       
   105    @param [in] mainWindow HbMainWindow to where the wizard is going to be executed.
       
   106  */
       
   107 WlanWizard::WlanWizard(HbMainWindow *mainWindow) :
       
   108     d_ptr(new WlanWizardPrivate(this, mainWindow))
       
   109 {
       
   110 }
       
   111 
       
   112 /*!
       
   113    Destructor.
       
   114  */
       
   115 WlanWizard::~WlanWizard()
       
   116 {
       
   117     delete d_ptr;
       
   118 }
       
   119 
       
   120 /*!
       
   121    Client can set the known WLAN Access Point configurations to speed up wizard
       
   122    processing and make it easier for end user.
       
   123    
       
   124    Values for network mode (CmManagerShim::WlanConnectionMode) and security mode 
       
   125    (CmManagerShim::WlanSecMode). 
       
   126    
       
   127    Supported configuration sets: 
       
   128    - Open: \a ssid \a networkMode \a securityMode 
       
   129    - WEP: \a ssid \a networkMode \a securityMode
       
   130    - WPA (2) with EAP: \a ssid \a networkMode \a securityMode \a usePsk (false)
       
   131    - WPA (2) with PSK: \a ssid \a networkMode \a securityMode \a usePsk (true)
       
   132    - 802.1x: \a ssid \a networkMode \a securityMode
       
   133    
       
   134    Hidden WLAN:
       
   135    \a hidden can be used with \a networkMode CmManagerShim::Infra 
       
   136    
       
   137    Wifi Protected Setup
       
   138    \a wps can be used with Open, WEP and WPA (2) with PSK.
       
   139    
       
   140    @param [in] ssid The name of WLAN network (ssid), max length 32 characters.
       
   141    @param [in] networkMode Network mode of known access point
       
   142    @param [in] securityMode Security mode of known access point
       
   143    @param [in] usePsk used only with WPA or WPA2 \a securityMode
       
   144    @param [in] wps is Wifi Protected Setup supported?
       
   145  */
       
   146 void WlanWizard::setParameters(
       
   147     const QString &ssid, 
       
   148     int networkMode, 
       
   149     int securityMode, 
       
   150     bool usePsk,
       
   151     bool wps)
       
   152 {
       
   153     d_ptr->setParameters(ssid, networkMode, securityMode, usePsk, wps);
       
   154 }
       
   155 
       
   156 /*!
       
   157    Executes the wizard and shows the first page.
       
   158    
       
   159    @note it is not allowed to call this method twice with same instance.
       
   160    
       
   161    Possible signals:
       
   162    - finished(int, bool): called after wizard has successfully completed
       
   163    - cancelled(): user has cancelled the wizard operations.
       
   164    
       
   165    First page for the wizard is SSID (WLAN network name) query or if 
       
   166    setParameters() has been called the first page is determined based on the
       
   167    given configuration combination. 
       
   168  */
       
   169 void WlanWizard::show()
       
   170 {
       
   171     d_ptr->show();
       
   172 }