wlanutilities/wpswizard/src/wpswizardstepfour_p.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 * WPS Wizard Page: Step 4 progress bar display
       
    16 */
       
    17 
       
    18 //System Includes
       
    19 
       
    20 //User Includes
       
    21 #include "wpswizard.h"
       
    22 #include "wpswizardstepfour_p.h"
       
    23 #include "cwpsactiverunner.h"
       
    24 
       
    25 // Trace includes
       
    26 
       
    27 #include "OstTraceDefinitions.h"
       
    28 #ifdef OST_TRACE_COMPILER_IN_USE
       
    29 #include "wpswizardstepfour_pTraces.h"
       
    30 #endif
       
    31 
       
    32 // External function prototypes
       
    33 
       
    34 // Local constants
       
    35 
       
    36 
       
    37 /*!
       
    38    \class WpsPageStepFourPrivate
       
    39    \brief Private implementation of wps wizard page for step four. 
       
    40  */
       
    41 // ======== LOCAL FUNCTIONS ========
       
    42 
       
    43 // ======== MEMBER FUNCTIONS ========
       
    44 
       
    45 /*!
       
    46    Constructor for WPS page four
       
    47    
       
    48    @param [in] WpsPageStepFour* Pointer to the public/Ui class 
       
    49  */
       
    50 
       
    51 WpsPageStepFourPrivate::WpsPageStepFourPrivate(WpsPageStepFour* pageStepFour) :
       
    52     mWpsActiveRunner(NULL), 
       
    53     q_ptr(pageStepFour)
       
    54 {
       
    55     OstTraceFunctionEntry1(WPSPAGESTEPFOURPRIVATE_WPSPAGESTEPFOURPRIVATE_ENTRY, this);
       
    56     
       
    57     // start the framework.
       
    58     CWpsActiveRunner* runner = NULL;
       
    59     QT_TRAP_THROWING(runner = CWpsActiveRunner::NewL(*this));
       
    60     mWpsActiveRunner.reset(runner);
       
    61     
       
    62     OstTraceFunctionExit1(WPSPAGESTEPFOURPRIVATE_WPSPAGESTEPFOURPRIVATE_EXIT, this);
       
    63 }
       
    64 
       
    65 /*!
       
    66    Destructor
       
    67  */
       
    68 WpsPageStepFourPrivate::~WpsPageStepFourPrivate()
       
    69 {
       
    70     OstTraceFunctionEntry1(DUP1_WPSPAGESTEPFOURPRIVATE_WPSPAGESTEPFOURPRIVATE_ENTRY, this);
       
    71     OstTraceFunctionExit1(DUP1_WPSPAGESTEPFOURPRIVATE_WPSPAGESTEPFOURPRIVATE_EXIT, this);
       
    72 }
       
    73 
       
    74 /*!
       
    75    This method will initiate the WPS setup functionality.
       
    76    
       
    77    @param [in] ssid name of the network which supports wps
       
    78    @param [in] pin pin number to be used for WPS negotiating.
       
    79  */
       
    80 void WpsPageStepFourPrivate::StartSetup(QString ssid, int pin)
       
    81 {
       
    82     OstTraceFunctionEntry1(WPSPAGESTEPFOURPRIVATE_STARTSETUP_ENTRY, this);
       
    83     
       
    84     TPtrC ptrName(reinterpret_cast<const TText*> (ssid.constData()));
       
    85 
       
    86     RBuf8 ssidName;
       
    87     QT_TRAP_THROWING(ssidName.CreateL(ptrName.Length()));
       
    88     ssidName.Copy(ptrName);
       
    89 
       
    90     mWpsActiveRunner->StartSetup(ssidName, pin);
       
    91     ssidName.Close();
       
    92     
       
    93     OstTraceFunctionExit1(WPSPAGESTEPFOURPRIVATE_STARTSETUP_EXIT, this);
       
    94 }
       
    95 
       
    96 /*!
       
    97    CallBack informing the completion of the WPS setup.
       
    98    
       
    99    @param [in] aCredentials An array of credentials from the remote AP
       
   100    @param [in] aError integer variable indicating result of the operation
       
   101  */
       
   102 void WpsPageStepFourPrivate::WpsActiveRunnerStopped(
       
   103     QList<TWlanProtectedSetupCredentialAttribute>& aCredentials, 
       
   104     TInt aError)
       
   105 {
       
   106     OstTraceFunctionEntry1(WPSPAGESTEPFOURPRIVATE_WPSACTIVERUNNERSTOPPED_ENTRY, this);
       
   107 
       
   108     // mWpsErrorCode = aError;
       
   109     if (aError == KErrNone) {
       
   110         q_ptr->setCredentials(aCredentials, aCredentials.count());
       
   111     } else if (aError == KErrCancel) {
       
   112         // operation was cancelled 
       
   113     } else {
       
   114         OstTrace1( 
       
   115             TRACE_ERROR, 
       
   116             WPSPAGESTEPFOURPRIVATE_WPSACTIVERUNNERSTOPPED_ERROR, 
       
   117             "WpsPageStepFourPrivate::WpsActiveRunnerStopped;Error=%d", 
       
   118             aError);
       
   119         
       
   120         q_ptr->handleError(aError);
       
   121     }
       
   122     
       
   123     OstTraceFunctionExit1(WPSPAGESTEPFOURPRIVATE_WPSACTIVERUNNERSTOPPED_EXIT, this);
       
   124 }
       
   125 
       
   126 /*!
       
   127    To cancel the ongoing WPS setup implementation.
       
   128  */
       
   129 void WpsPageStepFourPrivate::Cancel()
       
   130 {
       
   131     OstTraceFunctionEntry1(WPSPAGESTEPFOURPRIVATE_CANCEL_ENTRY, this);
       
   132     
       
   133     mWpsActiveRunner->DoCancel();
       
   134     
       
   135     OstTraceFunctionExit1(WPSPAGESTEPFOURPRIVATE_CANCEL_EXIT, this);
       
   136 }
       
   137