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>
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.
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.
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.
21 #ifndef SOLID_CONTROL_WIRELESSNETWORKINTERFACE_H
22 #define SOLID_CONTROL_WIRELESSNETWORKINTERFACE_H
24 #include "solid_control_export.h"
26 #include "networkinterface.h"
28 typedef QStringList AccessPointList
;
34 class WirelessNetworkInterfacePrivate
;
41 * This interface represents a wireless network interface
43 class SOLIDCONTROL_EXPORT WirelessNetworkInterface
: public NetworkInterface
46 Q_ENUMS(OperationMode DeviceInterface
)
48 Q_DECLARE_PRIVATE(WirelessNetworkInterface
)
51 enum OperationMode
{ Unassociated
, Adhoc
, Managed
, Master
, Repeater
};
52 // corresponding to 802.11 capabilities defined in NetworkManager.h
53 enum Capability
{ NoCapability
= 0x0, Wep40
= 0x2, Wep104
, Tkip
= 0x4, Ccmp
= 0x8, Wpa
= 0x10,
55 Q_DECLARE_FLAGS(Capabilities
, Capability
)
58 * Creates a new WirelessNetworkInterface object.
60 * @param backendObject the network object provided by the backend
62 WirelessNetworkInterface(QObject
*backendObject
= 0);
65 * Constructs a copy of a network.
67 * @param network the network to copy
69 WirelessNetworkInterface(const WirelessNetworkInterface
&network
);
72 * Destroys a WirelessNetworkInterface object.
74 virtual ~WirelessNetworkInterface();
77 * The NetworkInterface type.
79 * @return the NetworkInterface::Type. This always returns NetworkInterface::Ieee80211
81 virtual NetworkInterface::Type
type() const;
84 * List of wireless networks currently visible to the hardware
86 AccessPointList
accessPoints() const;
89 * Identifier of the network this interface is currently associated with
91 QString
activeAccessPoint() const;
94 * The hardware address assigned to the network interface
96 QString
hardwareAddress() const;
99 * Retrieves the operation mode of this network.
101 * @return the current mode
102 * @see Solid::Control::WirelessNetworkInterface::OperationMode
104 Solid::Control::WirelessNetworkInterface::OperationMode
mode() const;
107 * Retrieves the effective bit rate currently attainable by this device.
109 * @return the bitrate in bit/s
114 * Retrieves the capabilities of this wifi network.
116 * @return the flag set describing the capabilities
117 * @see Solid::Control::WirelessNetworkInterface::DeviceInterface
119 Solid::Control::WirelessNetworkInterface::Capabilities
wirelessCapabilities() const;
122 * Finds access point object given its Unique Network Identifier.
124 * @param uni the identifier of the AP to find from this network interface
125 * @returns a valid AccessPoint object if a network having the given UNI for this device is known to the system, 0 otherwise
127 AccessPoint
*findAccessPoint(const QString
& uni
) const;
131 * This signal is emitted when the bitrate of this network has changed.
133 * @param bitrate the new bitrate value for this network
135 void bitRateChanged(int);
137 * The active network changed.
139 void activeAccessPointChanged(const QString
&);
141 * The device switched operating mode.
143 void modeChanged(Solid::Control::WirelessNetworkInterface::OperationMode
);
145 * A new wireless access point appeared
147 void accessPointAppeared(const QString
&);
149 * A wireless access point disappeared
151 void accessPointDisappeared(const QString
&);
156 WirelessNetworkInterface(WirelessNetworkInterfacePrivate
&dd
, QObject
*backendObject
);
161 WirelessNetworkInterface(WirelessNetworkInterfacePrivate
&dd
, const WirelessNetworkInterface
&network
);
163 void makeConnections(QObject
* source
);
164 QPair
<AccessPoint
*, Ifaces::AccessPoint
*> findRegisteredAccessPoint(const QString
&uni
) const;
166 void _k_accessPointAdded(const QString
&uni
);
167 void _k_accessPointRemoved(const QString
&uni
);
168 void _k_destroyed(QObject
*object
);
173 #endif //SOLID_CONTROL_WIREDNETWORKINTERFACE_H