wlanutilities/wlanqtutilities/base/inc/wlanqtutils.h
branchRCL_3
changeset 24 63be7eb3fc78
equal deleted inserted replaced
23:b852595f5cbe 24:63be7eb3fc78
       
     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 * WLAN Qt Utilities interface.
       
    16 */
       
    17 
       
    18 #ifndef WLANQTUTILS_H
       
    19 #define WLANQTUTILS_H
       
    20 
       
    21 // System includes
       
    22 
       
    23 #include <QObject>
       
    24 #include <QScopedPointer>
       
    25 #include <QSharedPointer>
       
    26 
       
    27 // User includes
       
    28 
       
    29 // Forward declarations
       
    30 
       
    31 class WlanQtUtilsIap;
       
    32 class WlanQtUtilsAp;
       
    33 class WlanQtUtilsPrivate;
       
    34 
       
    35 // External data types
       
    36 
       
    37 // Constants
       
    38 
       
    39 //! Library interface export macro
       
    40 #ifdef BUILD_WLANQTUTILITIES_DLL
       
    41 #define WLANQTUTILS_EXPORT Q_DECL_EXPORT
       
    42 #else
       
    43 #define WLANQTUTILS_EXPORT Q_DECL_IMPORT
       
    44 #endif
       
    45 
       
    46 // Class declaration
       
    47 
       
    48 class WLANQTUTILS_EXPORT WlanQtUtils : public QObject
       
    49 {
       
    50     Q_OBJECT
       
    51 
       
    52 public:
       
    53 
       
    54     // Data types
       
    55 
       
    56     //! "None" IAP ID value (e.g. for "not found" cases)
       
    57     static const int IapIdNone = -1;
       
    58 
       
    59     /*!
       
    60         WLAN connection status.
       
    61         Remember to update traces/trace.properties when modifying this enum.
       
    62     */
       
    63     enum ConnStatus {
       
    64         ConnStatusNone = 0,         //!< Reserved.
       
    65         ConnStatusConnecting,       //!< Connecting.
       
    66         ConnStatusConnected,        //!< Connected.
       
    67         ConnStatusDisconnected      //!< Disconnected.
       
    68     };
       
    69     
       
    70     /*!
       
    71         WLAN scan status
       
    72         Remember to update traces/trace.properties when modifying this enum.
       
    73     */
       
    74     enum ScanStatus {
       
    75         ScanStatusOk = 0,           //!< Scan succeeded.
       
    76         ScanStatusCancelled,        //!< Scan was cancelled.
       
    77         ScanStatusError             //!< Scan failed.
       
    78     };
       
    79     
       
    80     /*! 
       
    81         Internet Connectivity Test status.
       
    82         Remember to update traces/trace.properties when modifying this enum.
       
    83     */        
       
    84     enum IctStatus {
       
    85         IctPassed = 0,              //!< Normal ICT passed.
       
    86         IctHotspotPassed,           //!< Hotspot ICT passed.
       
    87         IctCancelled,               //!< ICT was cancelled.
       
    88         IctFailed                   //!< ICT failed.
       
    89     };    
       
    90     
       
    91     WlanQtUtils();
       
    92     
       
    93     ~WlanQtUtils();
       
    94 
       
    95     void scanWlans();
       
    96     
       
    97     void scanWlanAps();
       
    98    
       
    99     void scanWlanDirect(const QString &ssid);
       
   100 
       
   101     void stopWlanScan();
       
   102 
       
   103     void availableWlans(
       
   104         QList< QSharedPointer<WlanQtUtilsIap> > &wlanIapList,
       
   105         QList< QSharedPointer<WlanQtUtilsAp> > &wlanApList) const;
       
   106     
       
   107     void availableWlanAps(
       
   108         QList< QSharedPointer<WlanQtUtilsAp> > &wlanApList) const;
       
   109     
       
   110     int createIap(const WlanQtUtilsAp *wlanAp);
       
   111 
       
   112     bool updateIap(int iapId, const WlanQtUtilsAp *wlanAp);
       
   113 
       
   114     void deleteIap(int iapId);
       
   115 
       
   116     void connectIap(int iapId, bool runIct = false);
       
   117 
       
   118     void disconnectIap(int iapId);
       
   119 
       
   120     ConnStatus connectionStatus() const;
       
   121     
       
   122     int activeIap() const;
       
   123     
       
   124     QString iapName(int iapId) const;
       
   125 
       
   126 signals:
       
   127 
       
   128     /*!
       
   129         Signal indicating that WLAN scan is complete when scanning
       
   130         is requested with scanWlans() method.
       
   131         
       
   132         @param [in] status Scan status code (ScanStatus).
       
   133     */
       
   134     void wlanScanReady(int status);
       
   135     
       
   136     /*!
       
   137         Signal indicating that WLAN scan is complete when scanning
       
   138         is requested with scanWlanAps() method.
       
   139         
       
   140         @param [in] status Scan status code (ScanStatus).
       
   141     */
       
   142     void wlanScanApReady(int status);
       
   143     
       
   144     /*!
       
   145         Signal indicating that WLAN scan is complete when scanning
       
   146         is requested with scanWlanDirect() method.
       
   147         
       
   148         @param [in] status Scan status code (ScanStatus).
       
   149     */
       
   150     void wlanScanDirectReady(int status);
       
   151     
       
   152     /*!
       
   153         Signal indicating that new WLAN network has been opened. 
       
   154 
       
   155         @param [in] iapId ID of the opened IAP.
       
   156     */
       
   157     void wlanNetworkOpened(int iapId);
       
   158     
       
   159     /*!
       
   160         Signal indicating that a WLAN network has been closed.
       
   161 
       
   162         @param [in] iapId ID of the closed IAP.
       
   163         @param [in] reason RConnection::Start() error code.
       
   164                            This is the reason of the closure if user requested
       
   165                            connection creation and it failed.
       
   166                            Otherwise KErrNone.
       
   167     */
       
   168     void wlanNetworkClosed(int iapId, int reason);
       
   169 
       
   170     /*!
       
   171         Signal indicating result of finished ICT run.
       
   172 
       
   173         @param [in] iapId ID of IAP ICT was run for.
       
   174         @param [in] result IctPassed: Normal ICT passed,
       
   175                            IctHotspotPassed: Hotspot ICT passed,
       
   176                            IctCancelled: ICT was cancelled,
       
   177                            IctFailed: ICT failed
       
   178     */
       
   179     void ictResult(int iapId, int result);
       
   180     
       
   181 public slots:
       
   182 
       
   183 protected:
       
   184 
       
   185 protected slots:
       
   186 
       
   187 private:
       
   188 
       
   189     Q_DISABLE_COPY(WlanQtUtils)
       
   190 
       
   191 private slots:
       
   192 
       
   193 private: // data
       
   194 
       
   195     //! Pointer to private implementation
       
   196     QScopedPointer<WlanQtUtilsPrivate> d_ptr;
       
   197 
       
   198     // Friend classes
       
   199     
       
   200     // This is defined as a friend class in order to be able to emit public 
       
   201     // signals directly from private implementation code.
       
   202     friend class WlanQtUtilsPrivate;
       
   203 
       
   204     // This is defined as a friend class in order to be able to
       
   205     // call event handlers of wrappers from test code.
       
   206     friend class TestWlanQtUtils;
       
   207 };
       
   208 
       
   209 #endif // WLANQTUTILS_H