wlanutilities/wlanwizard/inc/wlanwizardscanlist.h
changeset 39 7b3e49e4608a
child 43 72ebcbb64834
equal deleted inserted replaced
36:682dd021f9be 39:7b3e49e4608a
       
     1 /*
       
     2  * Copyright (c) 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 Wizard Plugin API: Service required from the wizard plugin.
       
    16  *
       
    17  */
       
    18 
       
    19 #ifndef WLANWIZARDSCANLIST_H_
       
    20 #define WLANWIZARDSCANLIST_H_
       
    21 
       
    22 // System includes
       
    23 #include <QList>
       
    24 #include <QHash>
       
    25 #include <QMetaType>
       
    26 #include <QString>
       
    27 #include <QSharedPointer>
       
    28 
       
    29 /*!
       
    30    @addtogroup group_wlan_wizard
       
    31    @{
       
    32  */
       
    33 
       
    34 // User includes
       
    35 
       
    36 // Forward declarations
       
    37 class WlanQtUtilsAp;
       
    38 
       
    39 // External data types
       
    40 /*!
       
    41  * Data structure with scan results and access point visibility information.
       
    42  */
       
    43 class WlanScanResult
       
    44 {
       
    45 public:
       
    46     QSharedPointer<WlanQtUtilsAp> scanResult;
       
    47     bool networkHidden;
       
    48 };
       
    49 
       
    50 /*!
       
    51  * Data structure containing security setting information and wizard page
       
    52  * navigation information.
       
    53  */
       
    54 class WlanSecuritySetting
       
    55 {
       
    56 public:
       
    57     int mode;
       
    58     bool usePsk;
       
    59     int nextPageId;
       
    60     
       
    61     bool operator==(const WlanSecuritySetting& setting) const {
       
    62         return (mode == setting.mode && 
       
    63             usePsk == setting.usePsk &&
       
    64             nextPageId == setting.nextPageId);
       
    65     }
       
    66 };
       
    67 
       
    68 /*!
       
    69  * Data structure containing network mode, visibility and wireless protection
       
    70  * setup suppport information.
       
    71  */
       
    72 class WlanNetworkSetting 
       
    73 {
       
    74 public:
       
    75     int mode;
       
    76     bool hidden;
       
    77     bool wpsSupported;
       
    78     
       
    79     bool operator==(const WlanNetworkSetting& setting) const {
       
    80         return (mode == setting.mode && 
       
    81             hidden == setting.hidden &&
       
    82             wpsSupported == setting.wpsSupported);
       
    83     }
       
    84 };
       
    85 
       
    86 /*!
       
    87  * Necessary public function for an argument of type WlanNetworkSetting to
       
    88  * function as a QHash key.
       
    89  */
       
    90 inline uint qHash(const WlanNetworkSetting &key)
       
    91  {
       
    92     uint hash = key.mode;
       
    93     hash <<= 1;
       
    94     hash |= key.hidden ? 1 : 0;
       
    95     hash <<= 1;
       
    96     hash |= key.wpsSupported ? 1 : 0;
       
    97     return qHash(hash);
       
    98  }
       
    99 
       
   100 // Constants
       
   101 
       
   102 class WlanWizardScanList
       
   103 {
       
   104 public:
       
   105     WlanWizardScanList();
       
   106     WlanWizardScanList(const WlanWizardScanList &scanList);
       
   107     ~WlanWizardScanList();
       
   108     void build(const QList<WlanScanResult> &results);
       
   109     const WlanSecuritySetting &getSecMode(WlanNetworkSetting netMode, int index = 0) const;
       
   110     int netModes() const;
       
   111     int secModes(WlanNetworkSetting netMode) const;
       
   112     QList<WlanNetworkSetting> getNetModes() const;
       
   113     
       
   114 private:
       
   115     // Disabling implicit assignment operator
       
   116     WlanWizardScanList &operator=(const WlanWizardScanList &);
       
   117     
       
   118 private:
       
   119     QHash<WlanNetworkSetting, QList<WlanSecuritySetting> > mOpenOptions;
       
   120 };
       
   121 
       
   122 /*!
       
   123  * This macro makes WlanWizardScanList QVariant-compatible.
       
   124  */
       
   125 Q_DECLARE_METATYPE(WlanWizardScanList)
       
   126 
       
   127 /*! @} */
       
   128 
       
   129 #endif /* WLANWIZARDSCANLIST_H_ */