wlanutilities/wlanqtutilities/base/src/wlanqtutils.cpp
changeset 31 e8f4211554fb
parent 19 10810c91db26
child 39 7b3e49e4608a
--- a/wlanutilities/wlanqtutilities/base/src/wlanqtutils.cpp	Fri May 14 10:30:51 2010 +0300
+++ b/wlanutilities/wlanqtutilities/base/src/wlanqtutils.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,69 +12,231 @@
 * Contributors:
 *
 * Description:
+* WLAN Qt Utilities implementation.
 */
 
-#include "wlanqtutilswlanap.h"
-#include "wlanqtutilswlaniap.h"
+// System includes
 
+// User includes
+
+#include "wlanqtutilsap.h"
+#include "wlanqtutilsiap.h"
 #include "wlanqtutils_p.h"
 #include "wlanqtutils.h"
 
-WlanQtUtils::WlanQtUtils()
+/*!
+    \class WlanQtUtils
+    \brief Wlan Qt Utilities. This class provides a Qt API for UI components
+           for retrieving different kind of information related to WLAN
+           functionality.
+*/
+
+
+// External function prototypes
+
+// Local constants
+
+// ======== LOCAL FUNCTIONS ========
+
+// ======== MEMBER FUNCTIONS ========
+
+/*!
+    Constructor.
+*/
+
+WlanQtUtils::WlanQtUtils() :
+    d_ptr(new WlanQtUtilsPrivate(this))
 {
-    d_ptr = new WlanQtUtilsPrivate(this);
 }
 
+/*!
+    Destructor.
+*/
+
 WlanQtUtils::~WlanQtUtils()
 {
-    delete d_ptr;
+}
+
+/*!
+    Function for requesting a single WLAN scan to be triggered.
+    Signal wlanScanReady() is emitted when new scan results are available.
+*/
+
+void WlanQtUtils::scanWlans()
+{
+    d_ptr->scanWlans();
+}
+
+/*!
+    Function for requesting a WLAN AP scan to be triggered.
+    Signal availableWlanAps() is emitted when new scan results are available.
+*/
+
+void WlanQtUtils::scanWlanAps()
+{
+    d_ptr->scanWlanAps();
 }
 
-void WlanQtUtils::availableWlanAps(
-    QList<WlanQtUtilsWlanIap *> &wlanIapList,
-    QList<WlanQtUtilsWlanAp *> &wlanApList)
+/*!
+    Function for requesting a direct WLAN scan with given SSID.
+
+    Signal wlanScanDirectReady() is emitted when new scan results are
+    available.
+
+    @param [in] ssid Network name to be found
+*/
+
+void WlanQtUtils::scanWlanDirect(const QString &ssid)
 {
-    d_ptr->availableWlanAps(wlanIapList, wlanApList);
+    d_ptr->scanWlanDirect(ssid);
+}
+
+/*!
+    Function for stopping a (possibly) ongoing WLAN scan. No scan result
+    signal will be sent before a new scan request is made.
+*/
+
+void WlanQtUtils::stopWlanScan()
+{
+    d_ptr->stopWlanScan();
+}
+
+/*!
+    Function to request details of available WLAN networks. Can be called 
+    at any time. Calling right after wlanScanReady() signal ensures you get
+    the most recent results.
+
+    @param [out] wlanIapList List of available WLAN IAPs.
+    @param [out] wlanApList List of unknown WLAN APs.
+*/
+
+void WlanQtUtils::availableWlans(
+    QList< QSharedPointer<WlanQtUtilsIap> > &wlanIapList,
+    QList< QSharedPointer<WlanQtUtilsAp> > &wlanApList) const
+{
+    d_ptr->availableWlans(wlanIapList, wlanApList);
 }
 
-int WlanQtUtils::createWlanIap(const WlanQtUtilsWlanAp *wlanAp)
+/*!
+    Function to request details of available WLAN networks. This function is
+    used to get the results that are informed by following signals:
+    -wlanScanApReady()
+    -wlanScanDirectReady()
+
+    @param [out] wlanApList List of unknown WLAN APs.
+*/
+
+void WlanQtUtils::availableWlanAps(
+    QList< QSharedPointer<WlanQtUtilsAp> > &wlanApList) const
 {
-    return d_ptr->createWlanIap(wlanAp);
+    d_ptr->availableWlanAps(wlanApList);
+}
+
+/*!
+    Function to create an IAP from the given WLAN access point.
+
+    @param [in] wlanAp Access point containing parameters to include in the new IAP.
+    
+    @return IAP ID if creation succeeds, IapIdNone otherwise.
+*/
+
+int WlanQtUtils::createIap(const WlanQtUtilsAp *wlanAp)
+{
+    return d_ptr->createIap(wlanAp);
 }
 
-void WlanQtUtils::connectIap(int iapId)
+/*!
+    Function to update an IAP from the given WLAN access point.
+
+    @param [in] iapId ID of the IAP to be updated.
+    @param [in] wlanAp Access point containing parameters to update in the IAP.
+    
+    @return Was update successful?
+*/
+
+bool WlanQtUtils::updateIap(int iapId, const WlanQtUtilsAp *wlanAp)
+{
+    return d_ptr->updateIap(iapId, wlanAp);
+}
+
+/*!
+    Function to delete an IAP.
+
+    @param [in] iapId ID of the IAP to be deleted.
+*/
+
+void WlanQtUtils::deleteIap(int iapId)
 {
-    d_ptr->connectIap(iapId);
+    d_ptr->deleteIap(iapId);
 }
 
+/*!
+    Function to start connection creation for the given IAP. Runs also
+    Internet Connectivity Test (ICT), if requested with the optional
+    parameter.
+    
+    Connecting while there is already a connection is also supported.
+
+    wlanNetworkOpened() or wlanNetworkClosed() signal will be emitted
+    when connection status changes.
+    
+    ictResult() signal will be emitted when (possible) ICT result is
+    available.
+
+    @param [in] iapId ID of the IAP to be connected.
+    @param [in] runIct Should ICT be run or not?
+*/
+
+void WlanQtUtils::connectIap(int iapId, bool runIct)
+{
+    d_ptr->connectIap(iapId, runIct);
+}
+
+/*!
+    Function to disconnect the given IAP.
+    Disconnecting when there is no connection is also supported.
+
+    @param [in] iapId ID of the IAP to be disconnected.
+*/
+
 void WlanQtUtils::disconnectIap(int iapId)
 {
     d_ptr->disconnectIap(iapId);
 }
 
-WlanQtUtilsIap *WlanQtUtils::iap(int iapId) const
+/*!
+    Function to retrieve the name of the IAP with the given ID.
+
+    @param [in] iapId ID of the requested IAP.
+    
+    @return Name of the IAP or empty QString if IAP is not found.
+*/
+
+QString WlanQtUtils::iapName(int iapId) const
 {
-    return d_ptr->iap(iapId);
-}
-
-bool WlanQtUtils::masterWlan() const
-{
-    return d_ptr->masterWlan();
+    return d_ptr->iapName(iapId);
 }
 
-void WlanQtUtils::setMasterWlan(bool enabled)
+/*!
+    Connection status getter.
+    
+    @return Current WLAN connection status. 
+*/
+
+WlanQtUtils::ConnStatus WlanQtUtils::connectionStatus() const
 {
-    d_ptr->setMasterWlan(enabled);
+    return d_ptr->connectionStatus();
 }
 
-int WlanQtUtils::connectedWlanId() const
-{
-    return d_ptr->connectedWlanId();
-}
+/*!
+    Function for getting the ID of the (possibly) active WLAN IAP.
+    Active here means non-disconnected.
+    Use connectionStatus() for retrieving the actual status.
 
-void WlanQtUtils::scanWlans()
+    @return ID of the active IAP, IapIdNone if not valid.
+*/
+
+int WlanQtUtils::activeIap() const
 {
-    d_ptr->scanWlans();
+    return d_ptr->activeIap();
 }
-
-// End of File