wlanutilities/wlanqtutilities/base/inc/wlanqtutils.h
changeset 31 e8f4211554fb
parent 19 10810c91db26
child 39 7b3e49e4608a
--- a/wlanutilities/wlanqtutilities/base/inc/wlanqtutils.h	Fri May 14 10:30:51 2010 +0300
+++ b/wlanutilities/wlanqtutilities/base/inc/wlanqtutils.h	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,151 +12,162 @@
 * Contributors:
 *
 * Description:
+* WLAN Qt Utilities interface.
 */
 
 #ifndef WLANQTUTILS_H
 #define WLANQTUTILS_H
 
-#include <QObject>
+// System includes
 
-#include "wlanqtutilscommon.h"
+#include <QObject>
+#include <QScopedPointer>
+#include <QSharedPointer>
+
+// User includes
+
+// Forward declarations
 
 class WlanQtUtilsIap;
-class WlanQtUtilsWlanIap;
-class WlanQtUtilsWlanAp;
+class WlanQtUtilsAp;
 class WlanQtUtilsPrivate;
 
-const int WlanQtUtilsInvalidIapId = -1;
+// External data types
+
+// Constants
 
-/**
- * Wlan Qt Utilities.
- * 
- * This class provides a Qt API to UI components for retrieving different kind of information
- * related to WLAN functionality.
- */
-class WLANQTUTILITIESDLL_EXPORT WlanQtUtils : public QObject
+//! Library interface export macro
+#ifdef BUILD_WLANQTUTILITIES_DLL
+#define WLANQTUTILS_EXPORT Q_DECL_EXPORT
+#else
+#define WLANQTUTILS_EXPORT Q_DECL_IMPORT
+#endif
+
+// Class declaration
+
+class WLANQTUTILS_EXPORT WlanQtUtils : public QObject
 {
     Q_OBJECT
 
 public:
+
+    // Data types
+
+    //! "None" IAP ID value (e.g. for "not found" cases)
+    static const int IapIdNone = -1;
+
+    /*!
+        WLAN connection status.
+        Remember to update traces/trace.properties when modifying this enum.
+    */        
+    enum ConnStatus {
+        ConnStatusNone = 0,         //!< Reserved.
+        ConnStatusConnecting,       //!< Connecting.
+        ConnStatusConnected,        //!< Connected.
+        ConnStatusDisconnected      //!< Disconnected.
+    };
     
-    /**
-     * Constructor.
-     */
     WlanQtUtils();
     
-    /**
-     * Destructor.
-     */
     ~WlanQtUtils();
 
-    /**
-     * 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 availableWlanAps(
-        QList<WlanQtUtilsWlanIap *> &wlanIapList,
-        QList<WlanQtUtilsWlanAp *> &wlanApList);
+    void scanWlans();
+    
+    void scanWlanAps();
+   
+    void scanWlanDirect(const QString &ssid);
+
+    void stopWlanScan();
+
+    void availableWlans(
+        QList< QSharedPointer<WlanQtUtilsIap> > &wlanIapList,
+        QList< QSharedPointer<WlanQtUtilsAp> > &wlanApList) const;
     
-    /**
-     * 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 ID of the newly created IAP.
-     */
-    int createWlanIap(const WlanQtUtilsWlanAp *wlanAp);
+    void availableWlanAps(
+        QList< QSharedPointer<WlanQtUtilsAp> > &wlanApList) const;
+    
+    int createIap(const WlanQtUtilsAp *wlanAp);
 
-    /**
-     * Function to start connection creation for the given IAP. connectionStatus() signal will be emitted
-     * when connection creation succeeds or fails.
-     *
-     * @param[in] iapId ID of the IAP to be connected.
-     */
-    void connectIap(int iapId);
+    bool updateIap(int iapId, const WlanQtUtilsAp *wlanAp);
 
-    /**
-     * Function to disconnect the given IAP.
-     * 
-     * @param[in] iapId ID of the IAP to be disconnected.
-     */
+    void deleteIap(int iapId);
+
+    void connectIap(int iapId, bool runIct = false);
+
     void disconnectIap(int iapId);
 
-    /**
-     * Function to retrieve a pointer to the IAP with the given ID.
-     * 
-     * @param[in] iapId ID of the requested IAP.
-     * @return Pointer to the found IAP, NULL if not found.
-     */
-    WlanQtUtilsIap *iap(int iapId) const;
+    ConnStatus connectionStatus() const;
+    
+    int activeIap() const;
+    
+    QString iapName(int iapId) const;
+
+signals:
+
+    /*!
+        Signal indicating that WLAN scan results are available. 
+    */
+    void wlanScanReady();
     
-    /**
-     * Function for getting the master WLAN status.
-     * 
-     * @return Master WLAN status: true if enabled, otherwise false.
-     */
-    bool masterWlan() const;
+    /*!
+        Signal indicating that WLAN scan results are available when scanning
+        is requested with scanWlanAps() method.
+    */
+    void wlanScanApReady();
     
-    /**
-     * Function for switching the master WLAN status ON or OFF.
-     * 
-     * @param[in] enabled If set to true, WLAN is switched ON, and vice versa.
-     */
-    void setMasterWlan(bool enabled);
+    /*!
+        Signal indicating that WLAN scan results are available when scanning
+        is requested with scanWlanDirect() method.
+    */
+    void wlanScanDirectReady();
     
-    /**
-     * Function for getting the ID of the (possibly) connected WLAN IAP.
-     * 
-     * @return ID of the connected IAP, WlanQtUtilsInvalidIapId if not valid.
-     */
-    int connectedWlanId() const;
+    /*!
+        Signal indicating that new WLAN network has been opened. 
+
+        @param [in] iapId ID of the opened IAP.
+    */
+    void wlanNetworkOpened(int iapId);
+    
+    /*!
+        Signal indicating that a WLAN network has been closed.
 
-    /**
-     * Function for requesting a WLAN scan to be triggered. Currently triggers
-     * only a single scan, but can be extended to perform also periodic scans,
-     * if needed in the future.
-     * 
-     * Signal wlanScanReady() is emitted when new scan results are available.
-     */
-    void scanWlans();
+        @param [in] iapId ID of the closed IAP.
+        @param [in] reason RConnection::Start() error code.
+                           This is the reason of the closure if user requested
+                           connection creation and it failed.
+                           Otherwise KErrNone.
+    */
+    void wlanNetworkClosed(int iapId, int reason);
+
+    /*!
+        Signal indicating result of finished ICT run.
+
+        @param [in] iapId ID of IAP ICT was run for.
+        @param [in] result True: ICT passed, False: ICT failed.
+    */
+    void ictResult(int iapId, bool result);
     
-signals:
-    
-    /**
-     * Signal indicating that WLAN scan results are available. 
-     */
-    void wlanScanReady();
+public slots:
 
-    /**
-     * Signal indicating that new WLAN network has been opened. 
-     * 
-     * @param[in] iapId ID of the opened IAP.
-     */
-    void wlanNetworkOpened(int iapId);
+protected:
+
+protected slots:
 
-    /**
-     * Signal indicating that a WLAN network has been closed. 
-     * 
-     * @param[in] iapId ID of the closed IAP.
-     */
-    void wlanNetworkClosed(int iapId);
+private:
+
+    Q_DISABLE_COPY(WlanQtUtils)
+
+private slots:
 
-    /**
-     * Signal indicating that the WLAN master status has changed.
-     */
-    void masterWlanStatus(bool enabled);
-    
-private: // Data
+private: // data
+
+    //! Pointer to private implementation
+    QScopedPointer<WlanQtUtilsPrivate> d_ptr;
 
-    /** Pointer to private implementation */
-    WlanQtUtilsPrivate *d_ptr;
-
-private: // Friend classes
-
-    // This is defined as a friend class in order to be able to emit public signals
-    // directly from private implementation code.
+    // Friend classes
+    
+    // This is defined as a friend class in order to be able to emit public 
+    // signals directly from private implementation code.
     friend class WlanQtUtilsPrivate;
 
     // This is defined as a friend class in order to be able to
@@ -164,6 +175,4 @@
     friend class TestWlanQtUtils;
 };
 
-#endif /* WLANQTUTILS_H */
-
-// End of File
+#endif // WLANQTUTILS_H