wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsesockwrapper.cpp
changeset 38 2dc6da6fb431
parent 19 10810c91db26
child 39 7b3e49e4608a
equal deleted inserted replaced
29:dbe86d96ce5b 38:2dc6da6fb431
     1 /*
     1 /*
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:
    14 * Description:
    15 * This is a source file for EsockWrapper class.
    15 * Wrapper for Symbian Esock library.
    16 */
    16 */
       
    17 
       
    18 // System includes
       
    19 
       
    20 #include <QScopedPointer>
       
    21 
       
    22 // User includes
    17 
    23 
    18 #include "wlanqtutilsesockwrapper.h"
    24 #include "wlanqtutilsesockwrapper.h"
    19 #include "wlanqtutilsesockwrapper_s60_p.h"
    25 #include "wlanqtutilsesockwrapper_s60_p.h"
    20 
    26 
    21 EsockWrapper::EsockWrapper(QObject *parent)
    27 /*!
    22  : QObject(parent)
    28     \class WlanQtUtilsEsockWrapper
       
    29     \brief Wrapper for Symbian Esock library.
       
    30 
       
    31     Provides functionality to connect and disconnect IAPs.
       
    32 */
       
    33 
       
    34 // External function prototypes
       
    35 
       
    36 // Local constants
       
    37 
       
    38 // ======== LOCAL FUNCTIONS ========
       
    39 
       
    40 // ======== MEMBER FUNCTIONS ========
       
    41 
       
    42 /*!
       
    43     Constructor.
       
    44     
       
    45     @param [in] parent Parent object.
       
    46  */
       
    47 
       
    48 WlanQtUtilsEsockWrapper::WlanQtUtilsEsockWrapper(QObject *parent) :
       
    49     QObject(parent),
       
    50     d_ptr(new WlanQtUtilsEsockWrapperPrivate(this)),
       
    51     mLastStatusCode(KErrNone)
    23 {
    52 {
    24     d_ptr = new EsockWrapperPrivate(this);
       
    25 }
    53 }
    26 
    54 
    27 EsockWrapper::~EsockWrapper()
    55 /*!
       
    56     Destructor.
       
    57  */
       
    58 
       
    59 WlanQtUtilsEsockWrapper::~WlanQtUtilsEsockWrapper()
    28 {
    60 {
    29     delete d_ptr;
       
    30 }
    61 }
    31 
    62 
    32 void EsockWrapper::updateConnection(bool isOpened)
    63 /*!
       
    64    Handles connection status update event.
       
    65 
       
    66    @param [in] isOpened Was the connection opened or not?
       
    67    @param [in] platformStatusCode Platform specific status code.
       
    68  */
       
    69 
       
    70 void WlanQtUtilsEsockWrapper::updateConnection(
       
    71     bool isOpened,
       
    72     int platformStatusCode)
    33 {
    73 {
       
    74     mLastStatusCode = platformStatusCode;
    34 	emit connectionStatusFromWrapper(isOpened);
    75 	emit connectionStatusFromWrapper(isOpened);
    35 }
    76 }
    36 
    77 
    37 void EsockWrapper::connectIap(int iapId)
    78 /*!
       
    79    Returns last received connection creation status code. Clears status.
       
    80 
       
    81    @return Platform specific status code of the last connection attempt.
       
    82  */
       
    83 
       
    84 int WlanQtUtilsEsockWrapper::lastStatusCode()
    38 {
    85 {
    39     d_ptr->connectIap(iapId);
    86     // Return current status and clear it
       
    87     int status = mLastStatusCode;
       
    88     mLastStatusCode = KErrNone;
       
    89     return status;
    40 }
    90 }
    41 
    91 
    42 void EsockWrapper::disconnectIap()
    92 /*!
       
    93    Starts connection creation to given IAP.
       
    94 
       
    95    @param [in] iapId IAP ID to connect.
       
    96  */
       
    97 
       
    98 void WlanQtUtilsEsockWrapper::connectIap(int iapId)
    43 {
    99 {
    44     d_ptr->disconnectIap();
   100     d_ptr->ConnectIap(iapId);
    45 }
   101 }
       
   102 
       
   103 /*!
       
   104    Disconnects connection, if one is active.
       
   105  */
       
   106 
       
   107 void WlanQtUtilsEsockWrapper::disconnectIap()
       
   108 {
       
   109     d_ptr->DisconnectIap();
       
   110 }