wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsesockwrapper.cpp
branchRCL_3
changeset 25 f28ada11abbf
parent 24 63be7eb3fc78
equal deleted inserted replaced
24:63be7eb3fc78 25:f28ada11abbf
     1 /*
       
     2 * Copyright (c) 2009-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 * Wrapper for Symbian Esock library.
       
    16 */
       
    17 
       
    18 // System includes
       
    19 
       
    20 #include <QScopedPointer>
       
    21 
       
    22 // User includes
       
    23 
       
    24 #include "wlanqtutilsesockwrapper.h"
       
    25 #include "wlanqtutilsesockwrapper_symbian.h"
       
    26 
       
    27 /*!
       
    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)
       
    52 {
       
    53 }
       
    54 
       
    55 /*!
       
    56     Destructor.
       
    57  */
       
    58 
       
    59 WlanQtUtilsEsockWrapper::~WlanQtUtilsEsockWrapper()
       
    60 {
       
    61 }
       
    62 
       
    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)
       
    73 {
       
    74     mLastStatusCode = platformStatusCode;
       
    75 	emit connectionStatusFromWrapper(isOpened);
       
    76 }
       
    77 
       
    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()
       
    85 {
       
    86     // Return current status and clear it
       
    87     int status = mLastStatusCode;
       
    88     mLastStatusCode = KErrNone;
       
    89     return status;
       
    90 }
       
    91 
       
    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)
       
    99 {
       
   100     d_ptr->ConnectIap(iapId);
       
   101 }
       
   102 
       
   103 /*!
       
   104    Disconnects connection, if one is active.
       
   105  */
       
   106 
       
   107 void WlanQtUtilsEsockWrapper::disconnectIap()
       
   108 {
       
   109     d_ptr->DisconnectIap();
       
   110 }