wlanutilities/wlanqtutilities/base/inc/wlanqtutils.h
changeset 19 10810c91db26
child 31 e8f4211554fb
equal deleted inserted replaced
3:ff3b37722600 19:10810c91db26
       
     1 /*
       
     2 * Copyright (c) 2009 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 */
       
    16 
       
    17 #ifndef WLANQTUTILS_H
       
    18 #define WLANQTUTILS_H
       
    19 
       
    20 #include <QObject>
       
    21 
       
    22 #include "wlanqtutilscommon.h"
       
    23 
       
    24 class WlanQtUtilsIap;
       
    25 class WlanQtUtilsWlanIap;
       
    26 class WlanQtUtilsWlanAp;
       
    27 class WlanQtUtilsPrivate;
       
    28 
       
    29 const int WlanQtUtilsInvalidIapId = -1;
       
    30 
       
    31 /**
       
    32  * Wlan Qt Utilities.
       
    33  * 
       
    34  * This class provides a Qt API to UI components for retrieving different kind of information
       
    35  * related to WLAN functionality.
       
    36  */
       
    37 class WLANQTUTILITIESDLL_EXPORT WlanQtUtils : public QObject
       
    38 {
       
    39     Q_OBJECT
       
    40 
       
    41 public:
       
    42     
       
    43     /**
       
    44      * Constructor.
       
    45      */
       
    46     WlanQtUtils();
       
    47     
       
    48     /**
       
    49      * Destructor.
       
    50      */
       
    51     ~WlanQtUtils();
       
    52 
       
    53     /**
       
    54      * Function to request details of available WLAN networks. Can be called at any time, calling right
       
    55      * after wlanScanReady() signal ensures you get the most recent results.
       
    56      *
       
    57      * @param[out] wlanIapList List of available WLAN IAPs.
       
    58      * @param[out] wlanApList List of unknown WLAN APs.
       
    59      */
       
    60     void availableWlanAps(
       
    61         QList<WlanQtUtilsWlanIap *> &wlanIapList,
       
    62         QList<WlanQtUtilsWlanAp *> &wlanApList);
       
    63     
       
    64     /**
       
    65      * Function to create an IAP from the given WLAN access point.
       
    66      *
       
    67      * @param[in] wlanAp Access point containing parameters to include in the new IAP.
       
    68      * @return ID of the newly created IAP.
       
    69      */
       
    70     int createWlanIap(const WlanQtUtilsWlanAp *wlanAp);
       
    71 
       
    72     /**
       
    73      * Function to start connection creation for the given IAP. connectionStatus() signal will be emitted
       
    74      * when connection creation succeeds or fails.
       
    75      *
       
    76      * @param[in] iapId ID of the IAP to be connected.
       
    77      */
       
    78     void connectIap(int iapId);
       
    79 
       
    80     /**
       
    81      * Function to disconnect the given IAP.
       
    82      * 
       
    83      * @param[in] iapId ID of the IAP to be disconnected.
       
    84      */
       
    85     void disconnectIap(int iapId);
       
    86 
       
    87     /**
       
    88      * Function to retrieve a pointer to the IAP with the given ID.
       
    89      * 
       
    90      * @param[in] iapId ID of the requested IAP.
       
    91      * @return Pointer to the found IAP, NULL if not found.
       
    92      */
       
    93     WlanQtUtilsIap *iap(int iapId) const;
       
    94     
       
    95     /**
       
    96      * Function for getting the master WLAN status.
       
    97      * 
       
    98      * @return Master WLAN status: true if enabled, otherwise false.
       
    99      */
       
   100     bool masterWlan() const;
       
   101     
       
   102     /**
       
   103      * Function for switching the master WLAN status ON or OFF.
       
   104      * 
       
   105      * @param[in] enabled If set to true, WLAN is switched ON, and vice versa.
       
   106      */
       
   107     void setMasterWlan(bool enabled);
       
   108     
       
   109     /**
       
   110      * Function for getting the ID of the (possibly) connected WLAN IAP.
       
   111      * 
       
   112      * @return ID of the connected IAP, WlanQtUtilsInvalidIapId if not valid.
       
   113      */
       
   114     int connectedWlanId() const;
       
   115 
       
   116     /**
       
   117      * Function for requesting a WLAN scan to be triggered. Currently triggers
       
   118      * only a single scan, but can be extended to perform also periodic scans,
       
   119      * if needed in the future.
       
   120      * 
       
   121      * Signal wlanScanReady() is emitted when new scan results are available.
       
   122      */
       
   123     void scanWlans();
       
   124     
       
   125 signals:
       
   126     
       
   127     /**
       
   128      * Signal indicating that WLAN scan results are available. 
       
   129      */
       
   130     void wlanScanReady();
       
   131 
       
   132     /**
       
   133      * Signal indicating that new WLAN network has been opened. 
       
   134      * 
       
   135      * @param[in] iapId ID of the opened IAP.
       
   136      */
       
   137     void wlanNetworkOpened(int iapId);
       
   138 
       
   139     /**
       
   140      * Signal indicating that a WLAN network has been closed. 
       
   141      * 
       
   142      * @param[in] iapId ID of the closed IAP.
       
   143      */
       
   144     void wlanNetworkClosed(int iapId);
       
   145 
       
   146     /**
       
   147      * Signal indicating that the WLAN master status has changed.
       
   148      */
       
   149     void masterWlanStatus(bool enabled);
       
   150     
       
   151 private: // Data
       
   152 
       
   153     /** Pointer to private implementation */
       
   154     WlanQtUtilsPrivate *d_ptr;
       
   155 
       
   156 private: // Friend classes
       
   157 
       
   158     // This is defined as a friend class in order to be able to emit public signals
       
   159     // directly from private implementation code.
       
   160     friend class WlanQtUtilsPrivate;
       
   161 
       
   162     // This is defined as a friend class in order to be able to
       
   163     // call event handlers of wrappers from test code.
       
   164     friend class TestWlanQtUtils;
       
   165 };
       
   166 
       
   167 #endif /* WLANQTUTILS_H */
       
   168 
       
   169 // End of File