wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanmgmtclient_context.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 #include <QTest>
       
    17 
       
    18 #include "wlanmgmtclient_context.h"
       
    19 
       
    20 WlanMgmtClientContext::WlanMgmtClientContext() : 
       
    21     mWlanMgmtClient(NULL)
       
    22 {
       
    23 }
       
    24 
       
    25 WlanMgmtClientContext::~WlanMgmtClientContext()
       
    26 {
       
    27 }
       
    28 
       
    29 void WlanMgmtClientContext::setObject(CWlanMgmtClient *wlanMgmtClient)
       
    30 {
       
    31     mWlanMgmtClient = wlanMgmtClient;
       
    32 }
       
    33 
       
    34 
       
    35 void WlanMgmtClientContext::setRunProtectedSetup(const QString &ssid, int completionCode)
       
    36 {
       
    37     mWlanMgmtClient->iSsid.Copy((unsigned char*)ssid.toAscii().constData()); 
       
    38     mWlanMgmtClient->iCompletionCode = completionCode;
       
    39 }
       
    40 
       
    41 void WlanMgmtClientContext::appendResult(
       
    42     const QString &ssid,
       
    43     int securityMode,
       
    44     int operatingMode,
       
    45     int defaultWepKeyIndex,
       
    46     const QString &wepKey1,
       
    47     const QString &wepKey2,
       
    48     const QString &wepKey3,
       
    49     const QString &wepKey4,
       
    50     const QString &wpaKey)
       
    51 {
       
    52     TWlanProtectedSetupCredentialAttribute attr;
       
    53     
       
    54     attr.iOperatingMode =(TWlanOperatingMode)operatingMode;
       
    55     attr.iSecurityMode = (TWlanIapSecurityMode)securityMode;
       
    56     
       
    57     attr.iSsid.Copy(
       
    58         (unsigned char*)ssid.toLatin1().constData(), 
       
    59         ssid.length());
       
    60     
       
    61     attr.iWepKey1.Copy(
       
    62         (unsigned char*)wepKey1.toLatin1().constData(), 
       
    63         wepKey1.length());
       
    64     
       
    65     attr.iWepKey2.Copy(
       
    66         (unsigned char*)wepKey2.toLatin1().constData(), 
       
    67         wepKey2.length());
       
    68     
       
    69     attr.iWepKey3.Copy(
       
    70         (unsigned char*)wepKey3.toLatin1().constData(), 
       
    71         wepKey3.length());
       
    72     
       
    73     attr.iWepKey4.Copy(
       
    74         (unsigned char*)wepKey4.toLatin1().constData(), 
       
    75         wepKey4.length());
       
    76     
       
    77     attr.iWepDefaultKey = (TWlanDefaultWepKey)defaultWepKeyIndex;
       
    78     
       
    79     attr.iWpaPreSharedKey.Copy(
       
    80         (unsigned char*)wpaKey.toLatin1().constData(), 
       
    81             wpaKey.length());
       
    82 
       
    83     mWlanMgmtClient->iResults->AppendL(attr);
       
    84 }