wlanutilities/wpswizard/src/cwpsactiverunner.cpp
changeset 62 b47b808de481
parent 46 2fbd1d709fe7
equal deleted inserted replaced
58:301aeb18ae47 62:b47b808de481
    89 void CWpsActiveRunner::ConstructL()
    89 void CWpsActiveRunner::ConstructL()
    90 {
    90 {
    91     OstTraceFunctionEntry1( CWPSACTIVERUNNER_CONSTRUCTL_ENTRY, this );
    91     OstTraceFunctionEntry1( CWPSACTIVERUNNER_CONSTRUCTL_ENTRY, this );
    92 
    92 
    93     CActiveScheduler::Add(this);
    93     CActiveScheduler::Add(this);
    94     InitializeL();
    94     
    95     OstTraceFunctionExit1( CWPSACTIVERUNNER_CONSTRUCTL_EXIT, this );
       
    96 }
       
    97 
       
    98 /*!
       
    99  * Initializes the member variables for making the middleware calls
       
   100  *
       
   101  */
       
   102 
       
   103 void CWpsActiveRunner::InitializeL()
       
   104 {
       
   105     OstTraceFunctionEntry1( CWPSACTIVERUNNER_INITIALIZEL_ENTRY, this );
       
   106     iWLANMgmtClient = CWlanMgmtClient::NewL();
    95     iWLANMgmtClient = CWlanMgmtClient::NewL();
       
    96 
   107     iIapParametersArray = new (ELeave) CArrayFixSeg<
    97     iIapParametersArray = new (ELeave) CArrayFixSeg<
   108         TWlanProtectedSetupCredentialAttribute> (KArrayGranularity);
    98         TWlanProtectedSetupCredentialAttribute> (KArrayGranularity);
   109     
    99     
   110     OstTraceFunctionExit1( CWPSACTIVERUNNER_INITIALIZEL_EXIT, this );
   100     OstTraceFunctionExit1( CWPSACTIVERUNNER_CONSTRUCTL_EXIT, this );
   111 }
   101 }
   112 
   102 
   113 /*!
   103 /*!
   114  * Destructor
   104  * Destructor
   115  *
   105  *
   137 
   127 
   138     isCancelTriggered = false;
   128     isCancelTriggered = false;
   139     ssid.Copy(aSsid);
   129     ssid.Copy(aSsid);
   140     TBuf8<KDefaultPinLength> pinCode;
   130     TBuf8<KDefaultPinLength> pinCode;
   141 
   131 
       
   132     // When Pin is zero it means that push-button mode is used.
   142     if (aPin == 0) {
   133     if (aPin == 0) {
   143         pinCode.AppendFill('0', 8);
   134         pinCode.AppendFill('0', 8);
   144     }
   135     } else {
   145     else {
       
   146         pinCode.AppendNum(aPin);
   136         pinCode.AppendNum(aPin);
   147     }
   137     }
   148 
   138 
   149     pin.Copy(pinCode);
   139     pin.Copy(pinCode);
   150 
   140 
   163     OstTraceFunctionEntry1( CWPSACTIVERUNNER_RUNL_ENTRY, this );
   153     OstTraceFunctionEntry1( CWPSACTIVERUNNER_RUNL_ENTRY, this );
   164 
   154 
   165     TInt completionCode = iStatus.Int();
   155     TInt completionCode = iStatus.Int();
   166     QList<TWlanProtectedSetupCredentialAttribute> credentials;
   156     QList<TWlanProtectedSetupCredentialAttribute> credentials;
   167 
   157 
   168     if(!isCancelTriggered) {
   158     if (!isCancelTriggered) {
   169 
   159 
   170         if (completionCode < KErrNone) {
   160         if (completionCode < KErrNone) {
   171             //Raise Error
   161             //Raise Error
   172         QT_TRYCATCH_LEAVING(iObserver.WpsActiveRunnerStopped(credentials, completionCode));
   162             QT_TRYCATCH_LEAVING(iObserver.WpsActiveRunnerStopped(credentials, completionCode));
   173         }
   163         } else {
   174         else {
       
   175             TInt len = iIapParametersArray->Length();
   164             TInt len = iIapParametersArray->Length();
   176             TInt count;
   165             TInt count;
   177             for(count=0;count<iIapParametersArray->Count();count++)
   166             for (count = 0 ; count < iIapParametersArray->Count() ; count++) {
   178                 {
       
   179                 TWlanProtectedSetupCredentialAttribute attr =(*iIapParametersArray)[count];
   167                 TWlanProtectedSetupCredentialAttribute attr =(*iIapParametersArray)[count];
   180                 credentials.append(attr);
   168                 credentials.append(attr);
   181                 }
   169             }
   182             QT_TRYCATCH_LEAVING(iObserver.WpsActiveRunnerStopped(credentials,completionCode));
   170             QT_TRYCATCH_LEAVING(iObserver.WpsActiveRunnerStopped(credentials,completionCode));
   183 
       
   184         }
   171         }
   185     }
   172     }
   186 
   173 
   187     OstTraceFunctionExit1( CWPSACTIVERUNNER_RUNL_EXIT, this );
   174     OstTraceFunctionExit1( CWPSACTIVERUNNER_RUNL_EXIT, this );
   188 }
   175 }
   192  */
   179  */
   193 void CWpsActiveRunner::DoCancel()
   180 void CWpsActiveRunner::DoCancel()
   194 {
   181 {
   195     OstTraceFunctionEntry1( CWPSACTIVERUNNER_DOCANCEL_ENTRY, this );
   182     OstTraceFunctionEntry1( CWPSACTIVERUNNER_DOCANCEL_ENTRY, this );
   196     isCancelTriggered = true;
   183     isCancelTriggered = true;
   197     if(iWLANMgmtClient)
   184 
   198         {
   185     iWLANMgmtClient->CancelProtectedSetup();
   199         iWLANMgmtClient->CancelProtectedSetup();
   186 
   200         }
       
   201     OstTraceFunctionExit1( CWPSACTIVERUNNER_DOCANCEL_EXIT, this );
   187     OstTraceFunctionExit1( CWPSACTIVERUNNER_DOCANCEL_EXIT, this );
   202 }
   188 }
   203 
   189 
   204 /*!
   190 /*!
   205  * Handles the error usecase
   191  * Handles the error usecase
   209     OstTraceFunctionEntry1( CWPSACTIVERUNNER_RUNERROR_ENTRY, this );
   195     OstTraceFunctionEntry1( CWPSACTIVERUNNER_RUNERROR_ENTRY, this );
   210 
   196 
   211     OstTrace1( TRACE_ERROR, CWPSACTIVERUNNER_RUNERROR, "CWpsActiveRunner::RunError;aError=%d", aError );
   197     OstTrace1( TRACE_ERROR, CWPSACTIVERUNNER_RUNERROR, "CWpsActiveRunner::RunError;aError=%d", aError );
   212 
   198 
   213     QList<TWlanProtectedSetupCredentialAttribute> credentials;
   199     QList<TWlanProtectedSetupCredentialAttribute> credentials;
   214     if(iWLANMgmtClient)
   200     iWLANMgmtClient->CancelProtectedSetup();
   215         {
   201     
   216         iWLANMgmtClient->CancelProtectedSetup();
       
   217         }
       
   218 
       
   219     QT_TRYCATCH_LEAVING(iObserver.WpsActiveRunnerStopped(credentials, aError));
   202     QT_TRYCATCH_LEAVING(iObserver.WpsActiveRunnerStopped(credentials, aError));
   220 
   203 
   221     return 0;
   204     return KErrNone;
   222 }
   205 }
   223 
   206