wlanutilities/wlanwizard/src/wlanwizardpagescanning.cpp
changeset 60 822a45792fdd
parent 53 bdc64aa9b954
equal deleted inserted replaced
53:bdc64aa9b954 60:822a45792fdd
    14 * Description: 
    14 * Description: 
    15 * WLAN Wizard Page: Scan processing.
    15 * WLAN Wizard Page: Scan processing.
    16 */
    16 */
    17 
    17 
    18 // System includes
    18 // System includes
       
    19 
    19 #include <HbParameterLengthLimiter>
    20 #include <HbParameterLengthLimiter>
    20 #include <HbMainWindow>
    21 #include <HbMainWindow>
    21 #include <HbDocumentLoader>
    22 #include <HbDocumentLoader>
    22 #include <HbWidget>
    23 #include <HbWidget>
    23 #include <HbLabel>
    24 #include <HbLabel>
    24 #include <HbProgressBar>
    25 #include <HbProgressBar>
       
    26 
    25 #include <cmmanagerdefines_shim.h>
    27 #include <cmmanagerdefines_shim.h>
    26 #include <wlanqtutils.h>
    28 #include <wlanqtutils.h>
    27 #include <wlanqtutilsap.h>
    29 #include <wlanqtutilsap.h>
    28 
    30 
    29 // User includes
    31 // User includes
       
    32 
    30 #include "wlanwizard_p.h"
    33 #include "wlanwizard_p.h"
    31 #include "wlanwizardpagescanning.h"
    34 #include "wlanwizardpagescanning.h"
       
    35 
    32 #include "OstTraceDefinitions.h"
    36 #include "OstTraceDefinitions.h"
    33 #ifdef OST_TRACE_COMPILER_IN_USE
    37 #ifdef OST_TRACE_COMPILER_IN_USE
    34 #include "wlanwizardpagescanningTraces.h"
    38 #include "wlanwizardpagescanningTraces.h"
    35 #endif
    39 #endif
    36 
    40 
    47     mLoader(NULL),
    51     mLoader(NULL),
    48     mNextPageId(WlanWizardPage::PageNone),
    52     mNextPageId(WlanWizardPage::PageNone),
    49     mScanResultsAvailable(false),
    53     mScanResultsAvailable(false),
    50     mScanStatus(WlanQtUtils::ScanStatusOk)
    54     mScanStatus(WlanQtUtils::ScanStatusOk)
    51 {
    55 {
    52     OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_WLANWIZARDPAGESCANNING_ENTRY );
    56     OstTraceFunctionEntry0(WLANWIZARDPAGESCANNING_WLANWIZARDPAGESCANNING_ENTRY);
       
    57     
    53     WlanQtUtils* utils = mWizard->wlanQtUtils();
    58     WlanQtUtils* utils = mWizard->wlanQtUtils();
    54 
    59 
    55     // Connect normal scan completion signal from wlanQtUtils to result
    60     // Connect normal scan completion signal from wlanQtUtils to result
    56     // handler. Connect here instead of initializePage, since this signal may
    61     // handler. Connect here instead of initializePage, since this signal may
    57     // need to be caught event if the window is not active.
    62     // need to be caught event if the window is not active.
    58     bool ok = connect(
    63     bool ok = connect(
    59         utils,
    64         utils,
    60         SIGNAL(wlanScanApReady(int)),
    65         SIGNAL(wlanScanApReady(int)),
    61         this,
    66         this,
    62         SLOT(wlanScanResultPreCheck(int)));
    67         SLOT(wlanScanResultPreCheck(int)));
    63     
       
    64     Q_ASSERT(ok);
    68     Q_ASSERT(ok);
    65     OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_WLANWIZARDPAGESCANNING_EXIT );
    69     
       
    70     OstTraceFunctionExit0(WLANWIZARDPAGESCANNING_WLANWIZARDPAGESCANNING_EXIT);
    66 }
    71 }
    67 
    72 
    68 /*!
    73 /*!
    69  * Destructor. Loader widget is deleted.
    74  * Destructor. Loader widget is deleted.
    70  * All document widgets are deleted by wlanwizard_p destructor.
    75  * All document widgets are deleted by wlanwizard_p destructor.
    71  */
    76  */
    72 WlanWizardPageScanning::~WlanWizardPageScanning()
    77 WlanWizardPageScanning::~WlanWizardPageScanning()
    73 {
    78 {
    74     OstTraceFunctionEntry0( DUP1_WLANWIZARDPAGESCANNING_WLANWIZARDPAGESCANNING_ENTRY );
    79     OstTraceFunctionEntry0(DUP1_WLANWIZARDPAGESCANNING_WLANWIZARDPAGESCANNING_ENTRY);
       
    80     
    75     delete mLoader;
    81     delete mLoader;
    76     OstTraceFunctionExit0( DUP1_WLANWIZARDPAGESCANNING_WLANWIZARDPAGESCANNING_EXIT );
    82     
       
    83     OstTraceFunctionExit0(DUP1_WLANWIZARDPAGESCANNING_WLANWIZARDPAGESCANNING_EXIT);
    77 }
    84 }
    78 
    85 
    79 /*!
    86 /*!
    80  * Page initialization. If view is already loaded, does nothing. Inherited from
    87  * Page initialization. If view is already loaded, does nothing. Inherited from
    81  * WlanWizardPage.
    88  * WlanWizardPage.
    82  * @return pointer to widget "occ_add_wlan_06".
    89  * @return pointer to widget "occ_add_wlan_06".
    83  */
    90  */
    84 HbWidget* WlanWizardPageScanning::initializePage()
    91 HbWidget* WlanWizardPageScanning::initializePage()
    85 {
    92 {
    86     OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_INITIALIZEPAGE_ENTRY );
    93     OstTraceFunctionEntry0(WLANWIZARDPAGESCANNING_INITIALIZEPAGE_ENTRY);
       
    94     
    87     OstTrace0(
    95     OstTrace0(
    88         TRACE_NORMAL,
    96         TRACE_NORMAL,
    89         WLANWIZARDPAGESCANNING_INITIALIZEPAGE,
    97         WLANWIZARDPAGESCANNING_INITIALIZEPAGE,
    90         "WlanWizardPageScanning::initializePage");
    98         "WlanWizardPageScanning::initializePage");
    91 
    99 
   134 
   142 
   135     mLabel->setPlainText(HbParameterLengthLimiter(
   143     mLabel->setPlainText(HbParameterLengthLimiter(
   136         "txt_occ_dialog_searching").arg(mWizard->configuration(
   144         "txt_occ_dialog_searching").arg(mWizard->configuration(
   137             WlanWizardPrivate::ConfSsid).toString()));
   145             WlanWizardPrivate::ConfSsid).toString()));
   138 
   146 
   139     OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_INITIALIZEPAGE_EXIT );
   147     OstTraceFunctionExit0(WLANWIZARDPAGESCANNING_INITIALIZEPAGE_EXIT);
   140     return mWidget;
   148     return mWidget;
   141 }
   149 }
   142 
   150 
   143 /*!
   151 /*!
   144  * Sends the user to the next page.
   152  * Sends the user to the next page.
   146  * stacked widget after "Next" button is pressed.
   154  * stacked widget after "Next" button is pressed.
   147  * @return the id value of the next page.
   155  * @return the id value of the next page.
   148  */
   156  */
   149 int WlanWizardPageScanning::nextId(bool &removeFromStack) const
   157 int WlanWizardPageScanning::nextId(bool &removeFromStack) const
   150 {
   158 {
   151     OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_NEXTID_ENTRY );
   159     OstTraceFunctionEntry0(WLANWIZARDPAGESCANNING_NEXTID_ENTRY);
       
   160     
   152     removeFromStack = true;
   161     removeFromStack = true;
   153 
   162 
   154     OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_NEXTID_EXIT );
   163     OstTraceFunctionExit0(WLANWIZARDPAGESCANNING_NEXTID_EXIT);
   155     return mNextPageId;
   164     return mNextPageId;
   156 }
   165 }
   157 
   166 
   158 /*!
   167 /*!
   159  * This function reimplements WlanWizardPage::previousTriggered. When going
   168  * This function reimplements WlanWizardPage::previousTriggered. When going
   163  * opration and immediately connected again.
   172  * opration and immediately connected again.
   164  * @return one step backwards value.
   173  * @return one step backwards value.
   165  */
   174  */
   166 int WlanWizardPageScanning::previousTriggered()
   175 int WlanWizardPageScanning::previousTriggered()
   167 {
   176 {
   168     OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_PREVIOUSTRIGGERED_ENTRY );
   177     OstTraceFunctionEntry0(WLANWIZARDPAGESCANNING_PREVIOUSTRIGGERED_ENTRY);
   169     disconnect(this, SLOT(wlanScanDirectReady(int)));
       
   170     disconnect(this, SLOT(wlanScanResultPreCheck(int)));
       
   171     
   178     
   172     WlanQtUtils* utils = mWizard->wlanQtUtils();
   179     WlanQtUtils* utils = mWizard->wlanQtUtils();
       
   180     
       
   181     disconnect(
       
   182         utils,
       
   183         SIGNAL(wlanScanApReady(int)),
       
   184         this,
       
   185         SLOT(wlanScanResultPreCheck(int)));
       
   186     
       
   187     disconnect(
       
   188         utils,
       
   189         SIGNAL(wlanScanDirectReady(int)),
       
   190         this,
       
   191         SLOT(wlanScanDirectReady(int)));
   173     
   192     
   174     utils->stopWlanScan();
   193     utils->stopWlanScan();
   175 
   194 
   176     bool ok = connect(
   195     bool ok = connect(
   177         utils,
   196         utils,
   185         SIGNAL(wlanScanDirectReady(int)),
   204         SIGNAL(wlanScanDirectReady(int)),
   186         this,
   205         this,
   187         SLOT(wlanScanDirectReady(int)));
   206         SLOT(wlanScanDirectReady(int)));
   188     Q_ASSERT(ok);
   207     Q_ASSERT(ok);
   189     
   208     
   190     OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_PREVIOUSTRIGGERED_EXIT );
   209     OstTraceFunctionExit0(WLANWIZARDPAGESCANNING_PREVIOUSTRIGGERED_EXIT);
   191     return OneStepBackwards;
   210     return OneStepBackwards;
   192     
   211     
   193 }
   212 }
   194 
   213 
   195 /*!
   214 /*!
   200  * @return always false - the scanning proceeds to next window
   219  * @return always false - the scanning proceeds to next window
   201  * automatically or not at all.
   220  * automatically or not at all.
   202  */
   221  */
   203 bool WlanWizardPageScanning::showPage()
   222 bool WlanWizardPageScanning::showPage()
   204 {
   223 {
   205     OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_SHOWPAGE_ENTRY );
   224     OstTraceFunctionEntry0(WLANWIZARDPAGESCANNING_SHOWPAGE_ENTRY);
       
   225 
   206     mWizard->setConfiguration(WlanWizardHelper::ConfProcessSettings, false);
   226     mWizard->setConfiguration(WlanWizardHelper::ConfProcessSettings, false);
   207     OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_SHOWPAGE_EXIT );
   227 
       
   228     OstTraceFunctionExit0(WLANWIZARDPAGESCANNING_SHOWPAGE_EXIT);
   208     return false;
   229     return false;
   209 }
   230 }
   210 
   231 
   211 /*!
   232 /*!
   212  * Reimplements the default function in WlanWizardPage. Indicates to the
   233  * Reimplements the default function in WlanWizardPage. Indicates to the
   214  * @return true
   235  * @return true
   215  * @see WlanWizardPage
   236  * @see WlanWizardPage
   216  */
   237  */
   217 bool WlanWizardPageScanning::requiresStartOperation()
   238 bool WlanWizardPageScanning::requiresStartOperation()
   218 {
   239 {
   219     OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_REQUIRESSTARTOPERATION_ENTRY );
   240     OstTraceFunctionEntry0(WLANWIZARDPAGESCANNING_REQUIRESSTARTOPERATION_ENTRY);
   220     OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_REQUIRESSTARTOPERATION_EXIT );
   241     OstTraceFunctionExit0(WLANWIZARDPAGESCANNING_REQUIRESSTARTOPERATION_EXIT);
   221     return true;
   242     return true;
   222 }
   243 }
   223 
   244 
   224 /*!
   245 /*!
   225  * Wlan scan is performed as a "post-initialization" which is executed in a
   246  * Wlan scan is performed as a "post-initialization" which is executed in a
   226  * separate scheduler loop. If scan results are available, starts reading them.
   247  * separate scheduler loop. If scan results are available, starts reading them.
   227  */
   248  */
   228 void WlanWizardPageScanning::startOperation()
   249 void WlanWizardPageScanning::startOperation()
   229 {
   250 {
   230     OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_STARTOPERATION_ENTRY );
   251     OstTraceFunctionEntry0(WLANWIZARDPAGESCANNING_STARTOPERATION_ENTRY);
   231     OstTrace0( TRACE_NORMAL, WLANWIZARDPAGESCANNING_STARTOPERATION,
   252     
       
   253     OstTrace0(
       
   254         TRACE_NORMAL,
       
   255         WLANWIZARDPAGESCANNING_STARTOPERATION,
   232         "WlanWizardPageScanning::startOperation - start AP scan if results"
   256         "WlanWizardPageScanning::startOperation - start AP scan if results"
   233         " are available." );
   257         " are available.");
   234 
   258 
   235     if (mScanResultsAvailable) {
   259     if (mScanResultsAvailable) {
   236         mScanResultsAvailable = false;
   260         mScanResultsAvailable = false;
   237         wlanScanApReady();
   261         wlanScanApReady();
   238     }
   262     }
   239     OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_STARTOPERATION_EXIT );
   263     
       
   264     OstTraceFunctionExit0(WLANWIZARDPAGESCANNING_STARTOPERATION_EXIT);
   240 }
   265 }
   241 
   266 
   242 /*!
   267 /*!
   243  * Loads the document orientation information from occ_add_wlan_06.docml
   268  * Loads the document orientation information from occ_add_wlan_06.docml
   244  * This is called each time phone orientation changes.
   269  * This is called each time phone orientation changes.
   245  * @param [in] orientation indicates whether the phone is in portrait or
   270  * @param [in] orientation indicates whether the phone is in portrait or
   246  * landscape mode.
   271  * landscape mode.
   247  */
   272  */
   248 void WlanWizardPageScanning::loadDocmlSection(Qt::Orientation orientation)
   273 void WlanWizardPageScanning::loadDocmlSection(Qt::Orientation orientation)
   249 {
   274 {
   250     OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_LOADDOCMLSECTION_ENTRY );
   275     OstTraceFunctionEntry0(WLANWIZARDPAGESCANNING_LOADDOCMLSECTION_ENTRY);
   251     OstTrace1( TRACE_NORMAL, WLANWIZARDPAGESCANNING_LOADDOCML,
   276     
       
   277     OstTrace1(
       
   278         TRACE_NORMAL,
       
   279         WLANWIZARDPAGESCANNING_LOADDOCML,
   252         "WlanWizardPageScanning::loadDocml - orientation ;orientation=%x",
   280         "WlanWizardPageScanning::loadDocml - orientation ;orientation=%x",
   253         ( TUint )( orientation ) );
   281         (TUint)orientation);
   254 
   282 
   255     WlanWizardPageInternal::loadDocmlSection(
   283     WlanWizardPageInternal::loadDocmlSection(
   256         mLoader,
   284         mLoader,
   257         orientation,
   285         orientation,
   258         ":/docml/occ_add_wlan_06.docml", 
   286         ":/docml/occ_add_wlan_06.docml", 
   259         "portrait_section",
   287         "portrait_section",
   260         "landscape_section");
   288         "landscape_section");
   261     OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_LOADDOCMLSECTION_EXIT );
   289     
       
   290     OstTraceFunctionExit0(WLANWIZARDPAGESCANNING_LOADDOCMLSECTION_EXIT);
   262 }
   291 }
   263 
   292 
   264 /*!
   293 /*!
   265  * Checks whether the view is active. If it is, execute wlanScanApReady. If
   294  * Checks whether the view is active. If it is, execute wlanScanApReady. If
   266  * not, set mScanResultsAvailable to true.
   295  * not, set mScanResultsAvailable to true.
   267  * @param [in] scanStatus indicates whether the scan was succesful, cancelled of
   296  * @param [in] scanStatus indicates whether the scan was succesful, cancelled of
   268  * failed. The argument is saved to a member variable.
   297  * failed. The argument is saved to a member variable.
   269  */
   298  */
   270 void WlanWizardPageScanning::wlanScanResultPreCheck(int scanStatus)
   299 void WlanWizardPageScanning::wlanScanResultPreCheck(int scanStatus)
   271 {
   300 {
   272     OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK_ENTRY );
   301     OstTraceFunctionEntry0(WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK_ENTRY);
       
   302     
   273     mScanStatus = scanStatus;
   303     mScanStatus = scanStatus;
   274     
   304     
   275     if (!mWidget) {
   305     if (!mWidget) {
   276         OstTrace1( TRACE_BORDER, WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK,
   306         OstTrace1(
       
   307             TRACE_BORDER,
       
   308             WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK,
   277             "WlanWizardPageScanning::wlanScanResultPreCheck no widget;this=%x",
   309             "WlanWizardPageScanning::wlanScanResultPreCheck no widget;this=%x",
   278             this );
   310             this);
   279 
   311 
   280         mScanResultsAvailable = true;
   312         mScanResultsAvailable = true;
   281     } else {
   313     } else {
   282         if (mWizard->isCurrentPage(mWidget)) {
   314         if (mWizard->isCurrentPage(mWidget)) {
   283             OstTrace0( TRACE_BORDER,
   315             OstTrace0(
       
   316                 TRACE_BORDER,
   284                 DUP1_WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK,
   317                 DUP1_WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK,
   285                 "WlanWizardPageScanning::wlanScanResultPreCheck go to results");
   318                 "WlanWizardPageScanning::wlanScanResultPreCheck go to results");
   286 
   319 
   287             wlanScanApReady();
   320             wlanScanApReady();
   288         } else {
   321         } else {
   289             OstTrace0( TRACE_BORDER,
   322             OstTrace0(
       
   323                 TRACE_BORDER,
   290                 DUP2_WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK,
   324                 DUP2_WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK,
   291                 "WlanWizardPageScanning::wlanScanResultPreCheck"
   325                 "WlanWizardPageScanning::wlanScanResultPreCheck"
   292                 " not current widget" );
   326                 " not current widget");
   293 
   327 
   294             mScanResultsAvailable = true;
   328             mScanResultsAvailable = true;
   295         }
   329         }
   296     }
   330     }
   297     OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK_EXIT );
   331     
       
   332     OstTraceFunctionExit0(WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK_EXIT);
   298 }
   333 }
   299 
   334 
   300 /*!
   335 /*!
   301  * Processes the direct scan results.
   336  * Processes the direct scan results.
   302  * @param [in] scanStatus indicates whether the scan was succesful, canceled or
   337  * @param [in] scanStatus indicates whether the scan was succesful, canceled or
   303  * failed. In case the scan was not succesful, always proceed to manual wizard.
   338  * failed. In case the scan was not succesful, always proceed to manual wizard.
   304  */
   339  */
   305 void WlanWizardPageScanning::wlanScanDirectReady(int scanStatus)
   340 void WlanWizardPageScanning::wlanScanDirectReady(int scanStatus)
   306 {
   341 {
   307     OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_WLANSCANDIRECTREADY_ENTRY );
   342     OstTraceFunctionEntry0(WLANWIZARDPAGESCANNING_WLANSCANDIRECTREADY_ENTRY);
   308     OstTrace0( TRACE_NORMAL, WLANWIZARDPAGESCANNING_WLANSCANDIRECTREADY,
   343     
   309         "WlanWizardPageScanning::wlanScanDirectReady" );
   344     OstTrace0(
       
   345         TRACE_NORMAL,
       
   346         WLANWIZARDPAGESCANNING_WLANSCANDIRECTREADY,
       
   347         "WlanWizardPageScanning::wlanScanDirectReady");
   310 
   348 
   311     WlanQtUtils* utils = mWizard->wlanQtUtils();
   349     WlanQtUtils* utils = mWizard->wlanQtUtils();
   312 
   350 
   313     Q_ASSERT(utils);
   351     Q_ASSERT(utils);
   314 
   352 
   315     QList<WlanScanResult> filteredResults;
   353     QList<WlanScanResult> filteredResults;
   316 
   354 
   317     if (scanStatus == WlanQtUtils::ScanStatusOk) {
   355     if (scanStatus == WlanQtUtils::ScanStatusOk) {
   318         QList<QSharedPointer<WlanQtUtilsAp> > directScanResults;
   356         QList< QSharedPointer<WlanQtUtilsAp> > directScanResults;
   319         // Read the directed scan results from Qt Utils
   357         // Read the directed scan results from Qt Utils
   320         utils->availableWlanAps(directScanResults);
   358         utils->availableWlanAps(directScanResults);
   321 
   359 
   322         // Identify open and hidden networks.
   360         // Identify open and hidden networks.
   323         getFinalScanResults(directScanResults, mWlanApList, filteredResults);
   361         getFinalScanResults(directScanResults, mWlanApList, filteredResults);
   324     }
   362     }
   325 
   363 
   326     // Process the scan results. If scan status is not ok, feed an empty
   364     // Process the scan results. If scan status is not ok, feed an empty
   327     // result table to the selection function.
   365     // result table to the selection function.
   328     selectNextPageActions(filteredResults);
   366     selectNextPageActions(filteredResults);
   329     OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_WLANSCANDIRECTREADY_EXIT );
   367     
       
   368     OstTraceFunctionExit0(WLANWIZARDPAGESCANNING_WLANSCANDIRECTREADY_EXIT);
   330 }
   369 }
   331 
   370 
   332 /*!
   371 /*!
   333  * All wlan channels have been scanned for public networks. After processing the
   372  * All wlan channels have been scanned for public networks. After processing the
   334  * results a direct scan is initiated. This function also checks whether the
   373  * results a direct scan is initiated. This function also checks whether the
   335  * scan was succesful, canceled or failed. In case the scan was not succesful,
   374  * scan was succesful, canceled or failed. In case the scan was not succesful,
   336  * always proceed to manual wizard.
   375  * always proceed to manual wizard.
   337  */
   376  */
   338 void WlanWizardPageScanning::wlanScanApReady()
   377 void WlanWizardPageScanning::wlanScanApReady()
   339 {
   378 {
   340     OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_WLANSCANAPREADY_ENTRY );
   379     OstTraceFunctionEntry0(WLANWIZARDPAGESCANNING_WLANSCANAPREADY_ENTRY);
   341     OstTrace0( TRACE_NORMAL, WLANWIZARDPAGESCANNING_WLANSCANAPREADY,
   380     
   342         "WlanWizardPageScanning::wlanScanApReady" );
   381     OstTrace0(
       
   382         TRACE_NORMAL,
       
   383         WLANWIZARDPAGESCANNING_WLANSCANAPREADY,
       
   384         "WlanWizardPageScanning::wlanScanApReady");
   343 
   385 
   344     if (mScanStatus == WlanQtUtils::ScanStatusOk) {
   386     if (mScanStatus == WlanQtUtils::ScanStatusOk) {
   345         WlanQtUtils* utils = mWizard->wlanQtUtils();
   387         WlanQtUtils* utils = mWizard->wlanQtUtils();
   346         Q_ASSERT(utils);
   388         Q_ASSERT(utils);
   347 
   389 
   363     else {
   405     else {
   364         mWizard->clearConfiguration(WlanWizardHelper::ConfAvailableNetworkOptions);
   406         mWizard->clearConfiguration(WlanWizardHelper::ConfAvailableNetworkOptions);
   365         mNextPageId = WlanWizardPageInternal::PageNetworkMode;
   407         mNextPageId = WlanWizardPageInternal::PageNetworkMode;
   366         mWizard->nextPage();
   408         mWizard->nextPage();
   367     }
   409     }
   368     OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_WLANSCANAPREADY_EXIT );
   410     
       
   411     OstTraceFunctionExit0(WLANWIZARDPAGESCANNING_WLANSCANAPREADY_EXIT);
   369 }
   412 }
   370 
   413 
   371 /*!
   414 /*!
   372  * This function stores all the APs that match ssid parameter to mWlanApList
   415  * This function stores all the APs that match ssid parameter to mWlanApList
   373  * member list.
   416  * member list.
   376  */
   419  */
   377 void WlanWizardPageScanning::getSsidMatchList(
   420 void WlanWizardPageScanning::getSsidMatchList(
   378     QString ssid,
   421     QString ssid,
   379     const QList<QSharedPointer<WlanQtUtilsAp> > &matchList)
   422     const QList<QSharedPointer<WlanQtUtilsAp> > &matchList)
   380 {
   423 {
   381     OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_GETSSIDMATCHLIST_ENTRY );
   424     OstTraceFunctionEntry0(WLANWIZARDPAGESCANNING_GETSSIDMATCHLIST_ENTRY);
       
   425     
   382     mWlanApList.clear();
   426     mWlanApList.clear();
   383     QSharedPointer<WlanQtUtilsAp> item;
   427     QSharedPointer<WlanQtUtilsAp> item;
   384 
   428 
   385     for (int i = 0; i < matchList.size(); i++) {
   429     for (int i = 0; i < matchList.size(); i++) {
   386         item = matchList.at(i);
   430         item = matchList.at(i);
   387         if (item->value(WlanQtUtilsAp::ConfIdSsid).toString() == ssid) {
   431         if (item->value(WlanQtUtilsAp::ConfIdSsid).toString() == ssid) {
   388             mWlanApList.append(item);
   432             mWlanApList.append(item);
   389         }
   433         }
   390     }
   434     }
   391     OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_GETSSIDMATCHLIST_EXIT );
   435     
       
   436     OstTraceFunctionExit0(WLANWIZARDPAGESCANNING_GETSSIDMATCHLIST_EXIT);
   392 }
   437 }
   393 
   438 
   394 /*
   439 /*
   395  * Find out which of the direct scan results are open networks by comparing
   440  * Find out which of the direct scan results are open networks by comparing
   396  * result to open scan results. Return finalResults.
   441  * result to open scan results. Return finalResults.
   401 void WlanWizardPageScanning::getFinalScanResults(
   446 void WlanWizardPageScanning::getFinalScanResults(
   402     const QList<QSharedPointer<WlanQtUtilsAp> > &directScanResults,
   447     const QList<QSharedPointer<WlanQtUtilsAp> > &directScanResults,
   403     const QList<QSharedPointer<WlanQtUtilsAp> > &openScanResults,
   448     const QList<QSharedPointer<WlanQtUtilsAp> > &openScanResults,
   404     QList<WlanScanResult> &finalResults)
   449     QList<WlanScanResult> &finalResults)
   405 {
   450 {
   406     OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_GETFINALSCANRESULTS_ENTRY );
   451     OstTraceFunctionEntry0(WLANWIZARDPAGESCANNING_GETFINALSCANRESULTS_ENTRY);
       
   452     
   407     finalResults.clear();
   453     finalResults.clear();
   408 
   454 
   409     // The key assumption of this algorithm is that both direct and public scan
   455     // The key assumption of this algorithm is that both direct and public scan
   410     // reveal the same set of AP:s with the exception of hidden AP:s.
   456     // reveal the same set of AP:s with the exception of hidden AP:s.
   411     // In other words: Direct scan result set is the whole set with each AP 
   457     // In other words: Direct scan result set is the whole set with each AP 
   428             }
   474             }
   429         }
   475         }
   430 
   476 
   431         finalResults.append(resultItem);
   477         finalResults.append(resultItem);
   432     }
   478     }
   433     OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_GETFINALSCANRESULTS_EXIT );
   479     
       
   480     OstTraceFunctionExit0(WLANWIZARDPAGESCANNING_GETFINALSCANRESULTS_EXIT);
   434 }
   481 }
   435 
   482 
   436 /*!
   483 /*!
   437  * This function processes the scan results in case multiple results were
   484  * This function processes the scan results in case multiple results were
   438  * acquired with matching SSIDs.
   485  * acquired with matching SSIDs.
   440  * @return the identifier of the next page.
   487  * @return the identifier of the next page.
   441  */
   488  */
   442 int WlanWizardPageScanning::processMultipleScanResults(
   489 int WlanWizardPageScanning::processMultipleScanResults(
   443     const QList<WlanScanResult> &finalResults)
   490     const QList<WlanScanResult> &finalResults)
   444 {
   491 {
   445     OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_PROCESSMULTIPLESCANRESULTS_ENTRY );
   492     OstTraceFunctionEntry0(WLANWIZARDPAGESCANNING_PROCESSMULTIPLESCANRESULTS_ENTRY);
       
   493     
   446     WlanWizardScanList networkOptions;
   494     WlanWizardScanList networkOptions;
   447     int nextPage;
   495     int nextPage;
   448 
   496 
   449     // Build the list of results to be placed in the configuration.
   497     // Build the list of results to be placed in the configuration.
   450     networkOptions.build(finalResults);
   498     networkOptions.build(finalResults);
   471         mWizard->setConfiguration(WlanWizardHelper::ConfWlanScanSSID, setting.hidden);
   519         mWizard->setConfiguration(WlanWizardHelper::ConfWlanScanSSID, setting.hidden);
   472         mWizard->setConfiguration(WlanWizardHelper::ConfWpsSupported, setting.wpsSupported);
   520         mWizard->setConfiguration(WlanWizardHelper::ConfWpsSupported, setting.wpsSupported);
   473         nextPage = WlanWizardPageInternal::PageNetworkSecurity;
   521         nextPage = WlanWizardPageInternal::PageNetworkSecurity;
   474     }
   522     }
   475     
   523     
   476     OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_PROCESSMULTIPLESCANRESULTS_EXIT );
   524     OstTraceFunctionExit0(WLANWIZARDPAGESCANNING_PROCESSMULTIPLESCANRESULTS_EXIT);
   477     return nextPage;
   525     return nextPage;
   478 }
   526 }
   479 
   527 
   480 /*!
   528 /*!
   481  * This function decides what to do with the scan results.
   529  * This function decides what to do with the scan results.
   482  * @param [in] finalResults is the list of APs revealed by the last scans.
   530  * @param [in] finalResults is the list of APs revealed by the last scans.
   483  */
   531  */
   484 void WlanWizardPageScanning::selectNextPageActions(
   532 void WlanWizardPageScanning::selectNextPageActions(
   485     const QList<WlanScanResult> &finalResults)
   533     const QList<WlanScanResult> &finalResults)
   486 {
   534 {
   487     OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_SELECTNEXTPAGEACTIONS_ENTRY );
   535     OstTraceFunctionEntry0(WLANWIZARDPAGESCANNING_SELECTNEXTPAGEACTIONS_ENTRY);
       
   536 
   488     mWizard->clearConfiguration(WlanWizardHelper::ConfAvailableNetworkOptions);
   537     mWizard->clearConfiguration(WlanWizardHelper::ConfAvailableNetworkOptions);
   489     
   538 
   490     if (finalResults.isEmpty()) {
   539     if (finalResults.isEmpty()) {
   491         // In case of no results at all were found.
   540         // In case of no results at all were found.
   492         mNextPageId = WlanWizardPageInternal::PageNetworkMode;
   541         mNextPageId = WlanWizardPageInternal::PageNetworkMode;
   493     } else if (finalResults.size() == SingleResult) {
   542     } else if (finalResults.size() == SingleResult) {
   494         // In case there is only a single result.
   543         // In case there is only a single result.
   495         WlanScanResult item = finalResults.first();
   544         WlanScanResult item = finalResults.first();
   496         mNextPageId = mWizard->getNextPageId(
   545         mNextPageId = mWizard->getNextPageId(
   497             item.scanResult->value(WlanQtUtilsAp::ConfIdSsid).toString(),
   546             item.scanResult->value(WlanQtUtilsAp::ConfIdName).toString(),
       
   547             item.scanResult->value(WlanQtUtilsAp::ConfIdSsid).toByteArray(),
   498             item.scanResult->value(WlanQtUtilsAp::ConfIdConnectionMode).toInt(),
   548             item.scanResult->value(WlanQtUtilsAp::ConfIdConnectionMode).toInt(),
   499             item.scanResult->value(WlanQtUtilsAp::ConfIdSecurityMode).toInt(),
   549             item.scanResult->value(WlanQtUtilsAp::ConfIdSecurityMode).toInt(),
   500             item.scanResult->value(WlanQtUtilsAp::ConfIdWpaPskUse).toBool(),
   550             item.scanResult->value(WlanQtUtilsAp::ConfIdWpaPskUse).toBool(),
   501             item.networkHidden,
   551             item.networkHidden,
   502             item.scanResult->value(WlanQtUtilsAp::ConfIdWpsSupported).toBool());
   552             item.scanResult->value(WlanQtUtilsAp::ConfIdWpsSupported).toBool());
   505         mWizard->setConfiguration(WlanWizardHelper::ConfProcessSettings, true);
   555         mWizard->setConfiguration(WlanWizardHelper::ConfProcessSettings, true);
   506         mNextPageId = processMultipleScanResults(finalResults);
   556         mNextPageId = processMultipleScanResults(finalResults);
   507     }
   557     }
   508 
   558 
   509     mWizard->nextPage();
   559     mWizard->nextPage();
   510     OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_SELECTNEXTPAGEACTIONS_EXIT );
   560 
   511 }
   561     OstTraceFunctionExit0(WLANWIZARDPAGESCANNING_SELECTNEXTPAGEACTIONS_EXIT);
       
   562 }