dtor first
[personal-kdebase.git] / workspace / libs / solid / control / networkmanager.h
blob6b7c4137b19eb52549639bde6964aa8dff75180f
1 /* This file is part of the KDE project
2 Copyright (C) 2006 Will Stephenson <wstephenson@kde.org>
3 Copyright (C) 2006-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_NETWORKMANAGER
22 #define SOLID_CONTROL_NETWORKMANAGER
24 #include <QtCore/QObject>
25 #include <QtCore/QVariant>
27 #include <solid/networking.h>
28 #include "solid_control_export.h"
30 namespace Solid
32 namespace Control
34 namespace Ifaces
36 class NetworkManager;
38 class Network;
39 class NetworkInterface;
40 typedef QList<NetworkInterface*> NetworkInterfaceList;
42 /**
43 * This class allow to query the underlying system to discover the available
44 * network interfaces and reachable network.It has also the
45 * responsibility to notify when a network interface or a network appear or disappear.
47 * It's the unique entry point for network management. Applications should use
48 * it to find network interfaces, or to be notified about network related changes.
50 * Note that it's implemented as a singleton and encapsulates the backend logic.
52 namespace NetworkManager
54 /**
55 * Get the manager connection state
57 SOLIDCONTROL_EXPORT Solid::Networking::Status status();
58 /**
59 * Retrieves the list of all the network interfaces in the system.
60 * It includes both hardware and virtual devices.
62 * @return the list of network interfaces available in this system
64 SOLIDCONTROL_EXPORT NetworkInterfaceList networkInterfaces();
66 /**
67 * Find a new NetworkInterface object given its UNI. This pointer is owned by the Solid
68 * infrastructure.
70 * @param uni the identifier of the network interface to find
71 * @returns a valid NetworkInterface object if there's a device having the given UNI, an invalid one otherwise
73 SOLIDCONTROL_EXPORT NetworkInterface * findNetworkInterface(const QString &uni);
75 /**
76 * Retrieves the status of networking (as a whole) in the system.
77 * This is distinct from whether the system's networking is online or offline.
78 * To check that, see @ref NetworkStatus.
80 * @return true if this networking is enabled, false otherwise
82 SOLIDCONTROL_EXPORT bool isNetworkingEnabled();
84 /**
85 * Retrieves the activation status of wireless networking in the system.
87 * @return true if this wireless networking is enabled, false otherwise
89 SOLIDCONTROL_EXPORT bool isWirelessEnabled();
92 /**
93 * Activates or deactivates networking (as a whole).
95 * @param enabled true to activate networking, false otherwise
97 SOLIDCONTROL_EXPORT void setNetworkingEnabled(bool enabled);
99 /**
100 * Retrieves the status of wireless hardware in the system. This is typically
101 * controlled by a physical switch so there is no way to set this in software.
103 * @since KDE 4.1
104 * @return true if this wireless networking is enabled, false otherwise
106 SOLIDCONTROL_EXPORT bool isWirelessHardwareEnabled();
109 * Activates or deactivates wireless networking.
111 * @param enabled true to activate wireless networking, false otherwise
113 SOLIDCONTROL_EXPORT void setWirelessEnabled(bool enabled);
116 * @param deviceUni unique identifier of the network interface to be activated
117 * @param connectionUni unique identifier for the connection to be activated
118 * @param connectionParameters can be used to specify extra parameters not specific to the NetworkInterface or the connection, eg which AP to use when several present with same ESSID in range (because ESSID no guarantee that the AP is part of the network you want to join!)
121 SOLIDCONTROL_EXPORT void activateConnection(const QString & deviceUni, const QString & connectionUni,
122 const QVariantMap & connectionParameters );
124 * Deactivate this network interface, if active
125 * @param activeConnectionUni identifer of the connection to deactivate
127 SOLIDCONTROL_EXPORT void deactivateConnection(const QString & activeConnectionUni);
130 * Access the list of any active connections
132 QStringList SOLIDCONTROL_EXPORT activeConnections();
134 class SOLIDCONTROL_EXPORT Notifier : public QObject
136 Q_OBJECT
137 Q_SIGNALS:
139 * This signal is emitted when the system's connection state changes
141 void statusChanged(Solid::Networking::Status status);
143 * This signal is emitted when a new network interface is available.
145 * @param uni the network interface identifier
147 void networkInterfaceAdded(const QString &uni);
150 * This signal is emitted when a network interface is not available anymore.
152 * @param uni the network interface identifier
154 void networkInterfaceRemoved(const QString &uni);
156 * This signal is emitted when the status of the wireless changed
158 void wirelessEnabledChanged(bool enabled);
160 * This signal is emitted when the status of the wireless hardware changed
162 void wirelessHardwareEnabledChanged(bool enabled);
164 * This signal is emitted when the set of active connections changes
166 void activeConnectionsChanged();
169 SOLIDCONTROL_EXPORT Notifier *notifier();
172 } // Control
173 } // Solid
175 #endif