wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanqtutils_stub.cpp
changeset 56 de27cc8389dd
parent 50 d4198dcb9983
child 58 301aeb18ae47
equal deleted inserted replaced
50:d4198dcb9983 56:de27cc8389dd
     1 /*
       
     2  * Copyright (c) 2009 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  */
       
    16 
       
    17 #include "wlanqtutilsap.h"
       
    18 #include "wlanqtutils.h"
       
    19 #include <QDebug>
       
    20 
       
    21 WlanQtUtils::WlanQtUtils() : mWlanAp(NULL), mEmitScanApReady(true),
       
    22 mScanApStatus(ScanStatusOk), mScanDirectStatus(ScanStatusOk)
       
    23 {
       
    24     mWlanNetworkActiveIapId = -1;
       
    25     mCalledMethods.append("WlanQtUtils");
       
    26 }
       
    27 
       
    28 WlanQtUtils::~WlanQtUtils()
       
    29 {
       
    30     mCalledMethods.append("~WlanQtUtils");
       
    31     delete mWlanAp;
       
    32 }
       
    33 
       
    34 void WlanQtUtils::availableWlanAps(QList<QSharedPointer<WlanQtUtilsAp> > &wlanApList)
       
    35 {
       
    36     wlanApList = *mScanResult;
       
    37     mCalledMethods.append("availableWlanAps");
       
    38 }
       
    39 
       
    40 int WlanQtUtils::createIap(const WlanQtUtilsAp * wlanAp)
       
    41 {
       
    42     mCalledMethods.append("createIap");
       
    43     delete mWlanAp;
       
    44     mWlanAp = new WlanQtUtilsAp(*wlanAp);
       
    45     return mCreateWlanIapReturn;
       
    46 }
       
    47 
       
    48 bool WlanQtUtils::updateIap(int iapId, const WlanQtUtilsAp * wlanAp)
       
    49 {
       
    50     mCalledMethods.append("updateIap"); 
       
    51     qDebug("updateWlanIap iapId = %d", iapId);
       
    52     qDebug("mCreateWlanIapReturn = %d", mCreateWlanIapReturn);
       
    53     delete mWlanAp;
       
    54     mWlanAp = new WlanQtUtilsAp(*wlanAp);
       
    55     QCOMPARE(iapId, mCreateWlanIapReturn);
       
    56     return mUpdateWlanIapReturn;
       
    57 }
       
    58 
       
    59 void WlanQtUtils::deleteIap(int iapId)
       
    60 {
       
    61     mCalledMethods.append("deleteIap");
       
    62     QCOMPARE(iapId, mCreateWlanIapReturn);
       
    63 }
       
    64 
       
    65 int WlanQtUtils::connectedWlanId()
       
    66 {
       
    67     mCalledMethods.append("connectedWlanId");
       
    68     return mCreateWlanIapReturn;
       
    69 }
       
    70 
       
    71 void WlanQtUtils::connectIap(int iapId, bool runIct)
       
    72 {
       
    73     qDebug("connectIap iapId = %d", iapId);
       
    74     qDebug("mCreateWlanIapReturn = %d", mCreateWlanIapReturn);
       
    75     mCalledMethods.append("connectIap");
       
    76     QCOMPARE(iapId, mCreateWlanIapReturn);
       
    77     QCOMPARE(runIct, true);
       
    78     
       
    79     if (mConnectionSuccess) {
       
    80         mWlanNetworkActiveIapId = iapId;
       
    81         emit wlanNetworkOpened(mWlanNetworkOpenedIapId);
       
    82         emit ictResult(mIctResultIapId - 1, false);
       
    83         emit ictResult(mIctResultIapId, mIctResultResults);
       
    84     } else {
       
    85         emit wlanNetworkClosed(
       
    86             mWlanNetworkClosedIapId -1,
       
    87             mWlanNetworkClosedReason );
       
    88         
       
    89         emit wlanNetworkClosed(
       
    90             mWlanNetworkClosedIapId,
       
    91             mWlanNetworkClosedReason );
       
    92     }
       
    93 }
       
    94 
       
    95 void WlanQtUtils::disconnectIap(int iapId)
       
    96 {
       
    97     qDebug("disconnectIap iapId = %d", iapId);
       
    98     qDebug("mActiveWlanIapReturn = %d", mActiveWlanIapReturn);
       
    99     mCalledMethods.append("disconnectIap");
       
   100     QCOMPARE(iapId, mActiveWlanIapReturn);
       
   101 }
       
   102 
       
   103 int WlanQtUtils::activeIap()
       
   104 {
       
   105     mCalledMethods.append("activeIap");
       
   106     return mActiveWlanIapReturn;
       
   107 }
       
   108 
       
   109 void WlanQtUtils::scanWlanAps()
       
   110 {
       
   111     mCalledMethods.append("scanWlanAps");
       
   112     mScanResult = &mScanWlanAps;
       
   113     
       
   114     if(mEmitScanApReady) {
       
   115         emit wlanScanApReady(mScanApStatus);
       
   116     }
       
   117 }
       
   118 
       
   119 void WlanQtUtils::scanWlanDirect(const QString &ssid)
       
   120 {
       
   121     mCalledMethods.append("scanWlanDirect");
       
   122     QCOMPARE(ssid, mScanWlanDirectSsid);
       
   123     mScanResult = &mScanWlanDirect;
       
   124     
       
   125     emit wlanScanDirectReady(mScanDirectStatus);
       
   126 }
       
   127 
       
   128 void WlanQtUtils::stopWlanScan()
       
   129 {
       
   130     mCalledMethods.append("stopWlanScan");
       
   131 }
       
   132 
       
   133 void WlanQtUtils::emitScanApsReady()
       
   134 {
       
   135     emit wlanScanApReady(mScanApStatus);
       
   136 }
       
   137 
       
   138