wlanutilities/wpswizard/src/wpswizardstepfour_p.cpp
changeset 39 7b3e49e4608a
child 53 bdc64aa9b954
equal deleted inserted replaced
36:682dd021f9be 39:7b3e49e4608a
       
     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 
       
    19 //System Includes
       
    20 
       
    21 //User Includes
       
    22 #include "wpswizard.h"
       
    23 #include "wpswizardstepfour_p.h"
       
    24 #include "cwpsactiverunner.h"
       
    25 
       
    26 // Trace includes
       
    27 
       
    28 #include "OstTraceDefinitions.h"
       
    29 #ifdef OST_TRACE_COMPILER_IN_USE
       
    30 #include "wpswizardstepfour_pTraces.h"
       
    31 #endif
       
    32 
       
    33 // External function prototypes
       
    34 
       
    35 // Local constants
       
    36 
       
    37 
       
    38 /*!
       
    39    \class WpsPageStepFourPrivate
       
    40    \brief Private implementation of wps wizard page for step four. 
       
    41  */
       
    42 // ======== LOCAL FUNCTIONS ========
       
    43 
       
    44 // ======== MEMBER FUNCTIONS ========
       
    45 
       
    46 /*!
       
    47    Constructor for WPS page four
       
    48    
       
    49    @param [in] WpsPageStepFour* Pointer to the public/Ui class 
       
    50  */
       
    51 
       
    52 WpsPageStepFourPrivate::WpsPageStepFourPrivate(WpsPageStepFour* pageStepFour) :
       
    53     mWpsActiveRunner(NULL), 
       
    54     q_ptr(pageStepFour)
       
    55 {
       
    56     OstTraceFunctionEntry1( WPSPAGESTEPFOURPRIVATE_WPSPAGESTEPFOURPRIVATE_ENTRY, this );
       
    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     TPtrC ptrName(reinterpret_cast<const TText*> (ssid.constData()));
       
    84 
       
    85     RBuf8 ssidName;
       
    86     ssidName.Create(ptrName.Length());
       
    87     ssidName.Copy(ptrName);
       
    88 
       
    89     mWpsActiveRunner->StartSetup(ssidName, pin);
       
    90     ssidName.Close();
       
    91     OstTraceFunctionExit1( WPSPAGESTEPFOURPRIVATE_STARTSETUP_EXIT, this );
       
    92 }
       
    93 
       
    94 /*!
       
    95    CallBack informing the completion of the WPS setup.
       
    96    
       
    97    @param [in] aCredentials An array of credentials from the remote AP
       
    98    @param [in] aError integer variable indicating result of the operation
       
    99  */
       
   100 void WpsPageStepFourPrivate::WpsActiveRunnerStopped(
       
   101     QList<TWlanProtectedSetupCredentialAttribute>& aCredentials, 
       
   102     TInt aError)
       
   103 {
       
   104     OstTraceFunctionEntry1( WPSPAGESTEPFOURPRIVATE_WPSACTIVERUNNERSTOPPED_ENTRY, this );
       
   105 
       
   106     // mWpsErrorCode = aError;
       
   107     if (aError == KErrNone) {
       
   108         q_ptr->setCredentials(aCredentials, aCredentials.count());
       
   109     }
       
   110     else if (aError == KErrCancel) {
       
   111         // operation was cancelled 
       
   112 
       
   113     }
       
   114     else {
       
   115         OstTrace1( 
       
   116             TRACE_ERROR, 
       
   117             WPSPAGESTEPFOURPRIVATE_WPSACTIVERUNNERSTOPPED_ERROR, 
       
   118             "WpsPageStepFourPrivate::WpsActiveRunnerStopped;Error=%d", 
       
   119             aError );
       
   120         
       
   121         q_ptr->handleError(aError);
       
   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     mWpsActiveRunner->DoCancel();
       
   133     OstTraceFunctionExit1( WPSPAGESTEPFOURPRIVATE_CANCEL_EXIT, this );
       
   134 }
       
   135