wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsconmonwrapper.cpp
changeset 31 e8f4211554fb
parent 19 10810c91db26
child 39 7b3e49e4608a
equal deleted inserted replaced
30:ab513c8439db 31:e8f4211554fb
     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 *
    15 * Wrapper for Symbian Connection Monitor library.
    16 */
    16 */
    17 
    17 
    18 // INCLUDE FILES
    18 // System includes
    19 #include <cmdestinationext.h>
    19 
    20 #include <cmmanagerext.h>
    20 #include <QSharedPointer>
       
    21 #include <QScopedPointer>
       
    22 
       
    23 // User includes
       
    24 
       
    25 #include "wlanqtutilsconmonwrapperdisconnect_s60_p.h"
       
    26 #include "wlanqtutilsconmonwrapperinfo_s60_p.h"
       
    27 #include "wlanqtutilsconmonwrapperscan_s60_p.h"
    21 #include "wlanqtutilsconmonwrapper.h"
    28 #include "wlanqtutilsconmonwrapper.h"
    22 #include "wlanqtutilsconmonwrapper_s60_p.h"
       
    23 
    29 
    24 // ================= MEMBER FUNCTIONS =======================
    30 /*!
       
    31     \class WlanQtUtilsConMonWrapper
       
    32     \brief Wrapper for Symbian Connection Monitor library.
    25 
    33 
    26 ConMonWrapper::ConMonWrapper(QObject *parent)
    34     Provides functionality to scan WLAN networks, to retrieve connection 
    27  : QObject(parent)
    35     information, and to disconnect connections.
       
    36 */
       
    37 
       
    38 // External function prototypes
       
    39 
       
    40 // Local constants
       
    41 
       
    42 // ======== LOCAL FUNCTIONS ========
       
    43 
       
    44 // ======== MEMBER FUNCTIONS ========
       
    45 
       
    46 /*!
       
    47     Constructor.
       
    48     
       
    49     @param [in] parent Parent object.
       
    50 */
       
    51 
       
    52 WlanQtUtilsConMonWrapper::WlanQtUtilsConMonWrapper(QObject *parent) :
       
    53     QObject(parent),
       
    54     d_ptrScan(new WlanQtUtilsConMonWrapperScan(this)),
       
    55     d_ptrInfo(new WlanQtUtilsConMonWrapperInfo(this)),
       
    56     d_ptrDisconnect(new WlanQtUtilsConMonWrapperDisconnect(this))
    28 {
    57 {
    29     d_ptrScanWlans = new ConnMonScanWlanAps(this);
       
    30     d_ptrConnInfo = new ConnMonConnInfo(this);
       
    31     d_ptrConnDisconnect = new ConnMonConnDisconnect(this);
       
    32 }
    58 }
    33 
    59 
    34 ConMonWrapper::~ConMonWrapper()
    60 /*!
       
    61     Destructor.
       
    62 */
       
    63 
       
    64 WlanQtUtilsConMonWrapper::~WlanQtUtilsConMonWrapper()
    35 {
    65 {
    36     delete d_ptrScanWlans;
       
    37     delete d_ptrConnInfo;
       
    38     delete d_ptrConnDisconnect;
       
    39 }
    66 }
    40 
    67 
    41 int ConMonWrapper::scanAvailableWlanAPs()
    68 /*!
       
    69    Start a WLAN scan.
       
    70 */
       
    71 
       
    72 void WlanQtUtilsConMonWrapper::scanAvailableWlanAPs()
    42 {
    73 {
    43     return d_ptrScanWlans->scanAvailableWlanAPs();
    74     d_ptrScan->ScanAvailableWlanAPs();
    44 }
    75 }
    45 
    76 
    46 void ConMonWrapper::emitAvailableWlans(QList<WlanQtUtilsWlanAp *> &availableWlanAPs)
    77 /*!
       
    78    Stop a (possibly) ongoing WLAN scan.
       
    79 */
       
    80 
       
    81 void WlanQtUtilsConMonWrapper::stopScan()
    47 {
    82 {
    48     emit availableWlanApsFromWrapper(availableWlanAPs);
    83     d_ptrScan->StopScan();
    49 }
    84 }
    50 
    85 
    51 void ConMonWrapper::emitConnCreatedEvent(uint connectionId)
    86 /*!
       
    87    Return active connection information.
       
    88 
       
    89    @return Information of active connection, 0 if not found.
       
    90 */ 
       
    91 
       
    92 WlanQtUtilsConnection *WlanQtUtilsConMonWrapper::activeConnection() const
    52 {
    93 {
    53    emit connCreatedEventFromWrapper(connectionId);
    94     return d_ptrInfo->ActiveConnection();
    54 }
    95 }
    55 
    96 
    56 void ConMonWrapper::emitConnDeletedEvent(uint connectionId)
    97 /*!
       
    98    Returns information of a connection with the given connection ID.
       
    99 
       
   100    @param [in] connectionId Connection ID.
       
   101 
       
   102    @return Information of the given connection, 0 if not found.
       
   103 */ 
       
   104 
       
   105 WlanQtUtilsConnection* WlanQtUtilsConMonWrapper::connectionInfo(
       
   106     uint connectionId) const
    57 {
   107 {
    58    emit connDeletedEventFromWrapper(connectionId);
   108     return d_ptrInfo->ConnectionInfo(connectionId);
    59 }
   109 }
    60 
   110 
    61 void ConMonWrapper::emitConnStatusEvent(uint connectionId, WlanQtUtilsConnectionStatus connectionStatus)
   111 /*!
       
   112    Stops given connection regardless of how many applications are using it.
       
   113 
       
   114    @param [in] iapId IAP ID to disconnect.
       
   115 */ 
       
   116 
       
   117 void WlanQtUtilsConMonWrapper::disconnectIap(int iapId)
    62 {
   118 {
    63    emit connStatusEventFromWrapper(connectionId, connectionStatus);
   119    d_ptrDisconnect->DisconnectConnection(iapId);
    64 }
   120 }
    65 
       
    66 WlanQtUtilsActiveConn *ConMonWrapper::activeConnection()
       
    67 {
       
    68     return d_ptrConnInfo->activeConnection();
       
    69 }
       
    70 
       
    71 WlanQtUtilsActiveConn* ConMonWrapper::connectionInfo(uint connectionId)
       
    72 {
       
    73     return d_ptrConnInfo->connectionInfo(connectionId);
       
    74 }
       
    75 
       
    76 void ConMonWrapper::disconnectIap(int iapId)
       
    77 {
       
    78    d_ptrConnDisconnect->disconnectConnection(iapId);
       
    79 }