~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to libs/solid/control/wirelessnetworkinterface.h

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*  This file is part of the KDE project
 
2
    Copyright (C) 2006 Will Stephenson <wstephenson@kde.org>
 
3
    Copyright (C) 2007 Kevin Ottens <ervin@kde.org>
 
4
 
 
5
    This library is free software; you can redistribute it and/or
 
6
    modify it under the terms of the GNU Library General Public
 
7
    License version 2 as published by the Free Software Foundation.
 
8
 
 
9
    This library is distributed in the hope that it will be useful,
 
10
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
12
    Library General Public License for more details.
 
13
 
 
14
    You should have received a copy of the GNU Library General Public License
 
15
    along with this library; see the file COPYING.LIB.  If not, write to
 
16
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
17
    Boston, MA 02110-1301, USA.
 
18
 
 
19
*/
 
20
 
 
21
#ifndef SOLID_CONTROL_WIRELESSNETWORKINTERFACE_H
 
22
#define SOLID_CONTROL_WIRELESSNETWORKINTERFACE_H
 
23
 
 
24
#include "solid_control_export.h"
 
25
 
 
26
#include "networkinterface.h"
 
27
 
 
28
typedef QStringList AccessPointList;
 
29
namespace Solid
 
30
{
 
31
namespace Control
 
32
{
 
33
    class AccessPoint;
 
34
    class WirelessNetworkInterfacePrivate;
 
35
namespace Ifaces
 
36
{
 
37
    class AccessPoint;
 
38
}
 
39
 
 
40
    /**
 
41
     * This interface represents a wireless network interface
 
42
     */
 
43
    class SOLIDCONTROL_EXPORT WirelessNetworkInterface : public NetworkInterface
 
44
    {
 
45
        Q_OBJECT
 
46
        Q_ENUMS(OperationMode DeviceInterface)
 
47
        Q_FLAGS(Capabilities)
 
48
        Q_DECLARE_PRIVATE(WirelessNetworkInterface)
 
49
 
 
50
    public:
 
51
        enum OperationMode { Unassociated, Adhoc, Managed, Master, Repeater };
 
52
        // corresponding to 802.11 capabilities defined in NetworkManager.h
 
53
        enum Capability { NoCapability = 0x0, Wep40 = 0x1, Wep104 = 0x2, Tkip = 0x4, Ccmp = 0x8, Wpa = 0x10, Rsn = 0x20 };
 
54
        Q_DECLARE_FLAGS(Capabilities, Capability)
 
55
 
 
56
        /**
 
57
         * Creates a new WirelessNetworkInterface object.
 
58
         *
 
59
         * @param backendObject the network object provided by the backend
 
60
         */
 
61
        WirelessNetworkInterface(QObject *backendObject = 0);
 
62
 
 
63
        /**
 
64
         * Constructs a copy of a network.
 
65
         *
 
66
         * @param network the network to copy
 
67
         */
 
68
        WirelessNetworkInterface(const WirelessNetworkInterface &network);
 
69
 
 
70
        /**
 
71
         * Destroys a WirelessNetworkInterface object.
 
72
         */
 
73
        virtual ~WirelessNetworkInterface();
 
74
 
 
75
        /**
 
76
         * The NetworkInterface type.
 
77
         *
 
78
         * @return the NetworkInterface::Type.  This always returns NetworkInterface::Ieee80211
 
79
         */
 
80
        virtual NetworkInterface::Type type() const;
 
81
 
 
82
        /**
 
83
         * List of wireless networks currently visible to the hardware
 
84
         */
 
85
        AccessPointList accessPoints() const;
 
86
 
 
87
        /**
 
88
         * Identifier of the network this interface is currently associated with
 
89
         */
 
90
        QString activeAccessPoint() const;
 
91
 
 
92
        /**
 
93
         * The hardware address assigned to the network interface
 
94
         */
 
95
        QString hardwareAddress() const;
 
96
 
 
97
        /**
 
98
         * Retrieves the operation mode of this network.
 
99
         *
 
100
         * @return the current mode
 
101
         * @see Solid::Control::WirelessNetworkInterface::OperationMode
 
102
         */
 
103
        Solid::Control::WirelessNetworkInterface::OperationMode mode() const;
 
104
 
 
105
        /**
 
106
         * Retrieves the effective bit rate currently attainable by this device.
 
107
         *
 
108
         * @return the bitrate in Kbit/s
 
109
         */
 
110
        int bitRate() const;
 
111
 
 
112
        /**
 
113
         * Retrieves the capabilities of this wifi network.
 
114
         *
 
115
         * @return the flag set describing the capabilities
 
116
         * @see Solid::Control::WirelessNetworkInterface::DeviceInterface
 
117
         */
 
118
        Solid::Control::WirelessNetworkInterface::Capabilities wirelessCapabilities() const;
 
119
 
 
120
        /**
 
121
         * Finds access point object given its Unique Network Identifier.
 
122
         *
 
123
         * @param uni the identifier of the AP to find from this network interface
 
124
         * @returns a valid AccessPoint object if a network having the given UNI for this device is known to the system, 0 otherwise
 
125
         */
 
126
        AccessPoint *findAccessPoint(const QString & uni) const;
 
127
 
 
128
    Q_SIGNALS:
 
129
        /**
 
130
         * This signal is emitted when the bitrate of this network has changed.
 
131
         *
 
132
         * @param bitrate the new bitrate value for this network
 
133
         */
 
134
        void bitRateChanged(int);
 
135
        /**
 
136
         * The active network changed.
 
137
         */
 
138
        void activeAccessPointChanged(const QString &);
 
139
        /**
 
140
         * The device switched operating mode.
 
141
         */
 
142
        void modeChanged(Solid::Control::WirelessNetworkInterface::OperationMode);
 
143
        /**
 
144
         * A new wireless access point appeared
 
145
         */
 
146
        void accessPointAppeared(const QString &);
 
147
        /**
 
148
         * A wireless access point disappeared
 
149
         */
 
150
        void accessPointDisappeared(const QString &);
 
151
    protected:
 
152
        /**
 
153
         * @internal
 
154
         */
 
155
        WirelessNetworkInterface(WirelessNetworkInterfacePrivate &dd, QObject *backendObject);
 
156
 
 
157
        /**
 
158
         * @internal
 
159
         */
 
160
        WirelessNetworkInterface(WirelessNetworkInterfacePrivate &dd, const WirelessNetworkInterface &network);
 
161
 
 
162
        void makeConnections(QObject * source);
 
163
        QPair<AccessPoint *, Ifaces::AccessPoint *> findRegisteredAccessPoint(const QString &uni) const;
 
164
    private Q_SLOTS:
 
165
        void _k_accessPointAdded(const QString &uni);
 
166
        void _k_accessPointRemoved(const QString &uni);
 
167
        void _k_destroyed(QObject *object);
 
168
    };
 
169
} //Control
 
170
} //Solid
 
171
 
 
172
#endif //SOLID_CONTROL_WIREDNETWORKINTERFACE_H
 
173