wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsconmonwrapper.cpp
changeset 31 e8f4211554fb
parent 19 10810c91db26
child 39 7b3e49e4608a
--- a/wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsconmonwrapper.cpp	Fri May 14 10:30:51 2010 +0300
+++ b/wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsconmonwrapper.cpp	Mon May 24 21:11:39 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -12,68 +12,109 @@
 * Contributors:
 *
 * Description:
-*
+* Wrapper for Symbian Connection Monitor library.
+*/
+
+// System includes
+
+#include <QSharedPointer>
+#include <QScopedPointer>
+
+// User includes
+
+#include "wlanqtutilsconmonwrapperdisconnect_s60_p.h"
+#include "wlanqtutilsconmonwrapperinfo_s60_p.h"
+#include "wlanqtutilsconmonwrapperscan_s60_p.h"
+#include "wlanqtutilsconmonwrapper.h"
+
+/*!
+    \class WlanQtUtilsConMonWrapper
+    \brief Wrapper for Symbian Connection Monitor library.
+
+    Provides functionality to scan WLAN networks, to retrieve connection 
+    information, and to disconnect connections.
 */
 
-// INCLUDE FILES
-#include <cmdestinationext.h>
-#include <cmmanagerext.h>
-#include "wlanqtutilsconmonwrapper.h"
-#include "wlanqtutilsconmonwrapper_s60_p.h"
+// External function prototypes
+
+// Local constants
+
+// ======== LOCAL FUNCTIONS ========
+
+// ======== MEMBER FUNCTIONS ========
 
-// ================= MEMBER FUNCTIONS =======================
+/*!
+    Constructor.
+    
+    @param [in] parent Parent object.
+*/
 
-ConMonWrapper::ConMonWrapper(QObject *parent)
- : QObject(parent)
+WlanQtUtilsConMonWrapper::WlanQtUtilsConMonWrapper(QObject *parent) :
+    QObject(parent),
+    d_ptrScan(new WlanQtUtilsConMonWrapperScan(this)),
+    d_ptrInfo(new WlanQtUtilsConMonWrapperInfo(this)),
+    d_ptrDisconnect(new WlanQtUtilsConMonWrapperDisconnect(this))
 {
-    d_ptrScanWlans = new ConnMonScanWlanAps(this);
-    d_ptrConnInfo = new ConnMonConnInfo(this);
-    d_ptrConnDisconnect = new ConnMonConnDisconnect(this);
 }
 
-ConMonWrapper::~ConMonWrapper()
+/*!
+    Destructor.
+*/
+
+WlanQtUtilsConMonWrapper::~WlanQtUtilsConMonWrapper()
 {
-    delete d_ptrScanWlans;
-    delete d_ptrConnInfo;
-    delete d_ptrConnDisconnect;
-}
-
-int ConMonWrapper::scanAvailableWlanAPs()
-{
-    return d_ptrScanWlans->scanAvailableWlanAPs();
 }
 
-void ConMonWrapper::emitAvailableWlans(QList<WlanQtUtilsWlanAp *> &availableWlanAPs)
+/*!
+   Start a WLAN scan.
+*/
+
+void WlanQtUtilsConMonWrapper::scanAvailableWlanAPs()
 {
-    emit availableWlanApsFromWrapper(availableWlanAPs);
+    d_ptrScan->ScanAvailableWlanAPs();
 }
 
-void ConMonWrapper::emitConnCreatedEvent(uint connectionId)
+/*!
+   Stop a (possibly) ongoing WLAN scan.
+*/
+
+void WlanQtUtilsConMonWrapper::stopScan()
 {
-   emit connCreatedEventFromWrapper(connectionId);
-}
-
-void ConMonWrapper::emitConnDeletedEvent(uint connectionId)
-{
-   emit connDeletedEventFromWrapper(connectionId);
+    d_ptrScan->StopScan();
 }
 
-void ConMonWrapper::emitConnStatusEvent(uint connectionId, WlanQtUtilsConnectionStatus connectionStatus)
+/*!
+   Return active connection information.
+
+   @return Information of active connection, 0 if not found.
+*/ 
+
+WlanQtUtilsConnection *WlanQtUtilsConMonWrapper::activeConnection() const
 {
-   emit connStatusEventFromWrapper(connectionId, connectionStatus);
-}
-
-WlanQtUtilsActiveConn *ConMonWrapper::activeConnection()
-{
-    return d_ptrConnInfo->activeConnection();
+    return d_ptrInfo->ActiveConnection();
 }
 
-WlanQtUtilsActiveConn* ConMonWrapper::connectionInfo(uint connectionId)
+/*!
+   Returns information of a connection with the given connection ID.
+
+   @param [in] connectionId Connection ID.
+
+   @return Information of the given connection, 0 if not found.
+*/ 
+
+WlanQtUtilsConnection* WlanQtUtilsConMonWrapper::connectionInfo(
+    uint connectionId) const
 {
-    return d_ptrConnInfo->connectionInfo(connectionId);
+    return d_ptrInfo->ConnectionInfo(connectionId);
 }
 
-void ConMonWrapper::disconnectIap(int iapId)
+/*!
+   Stops given connection regardless of how many applications are using it.
+
+   @param [in] iapId IAP ID to disconnect.
+*/ 
+
+void WlanQtUtilsConMonWrapper::disconnectIap(int iapId)
 {
-   d_ptrConnDisconnect->disconnectConnection(iapId);
+   d_ptrDisconnect->DisconnectConnection(iapId);
 }