1 /* This file is part of the KDE project
2 Copyright (C) 2006 Will Stephenson <wstephenson@kde.org>
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License version 2 as published by the Free Software Foundation.
8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details.
13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 Boston, MA 02110-1301, USA.
20 #ifndef SOLID_IFACES_NETWORKMANAGER
21 #define SOLID_IFACES_NETWORKMANAGER
23 #include <QtCore/QObject>
24 #include <QtCore/QStringList>
25 #include <solid/networking.h>
26 #include "../solid_control_export.h"
27 #include "../networkmanager.h"
36 * This class specifies the interface a backend will have to implement in
37 * order to be used in the system.
39 * A network manager allow to query the underlying platform to discover the
40 * available network interfaces and reachable network. It has also the
41 * responsibility to notify when a network interface or a network appear or disappear.
43 class SOLIDCONTROLIFACES_EXPORT NetworkManager
: public QObject
48 * Constructs a NetworkManager.
50 * @param parent the parent object
52 NetworkManager(QObject
* parent
= 0);
54 * Destructs a NetworkManager object.
56 virtual ~NetworkManager();
59 * Get the manager connection state
61 virtual Solid::Networking::Status
status() const = 0;
64 * Retrieves the list of all the network interfaces Unique Network Identifiers (UNIs)
65 * in the system. It includes both hardware and virtual devices.
67 * @return the list of network interfaces available in this system
69 virtual QStringList
networkInterfaces() const = 0;
72 * Instantiates a new NetworkInterface object from this backend given its UNI.
74 * @param uni the identifier of the network interface instantiated
75 * @returns a new NetworkInterface object if there's a device having the given UNI, 0 otherwise
77 virtual QObject
*createNetworkInterface(const QString
&uni
) = 0;
80 * Retrieves the activation status of networking (as a whole) in the system.
82 * @return true if this networking is enabled, false otherwise
84 virtual bool isNetworkingEnabled() const = 0;
87 * Retrieves the activation status of wireless networking in the system.
89 * @return true if this wireless networking is enabled, false otherwise
91 virtual bool isWirelessEnabled() const = 0;
94 * Retrieves the status of wireless hardware in the system. This is typically
95 * controlled by a physical switch so there is no way to set this in software.
98 * @return true if this wireless networking is enabled, false otherwise
100 virtual bool isWirelessHardwareEnabled() const = 0;
102 virtual void activateConnection(const QString
& interfaceUni
, const QString
& connectionUni
, const QVariantMap
& connectionParameters
) = 0;
104 virtual void deactivateConnection(const QString
& activeConnection
) = 0;
107 * Access the list of active connection UNIs
109 virtual QStringList
activeConnections() const = 0;
113 * Activates or deactivates networking (as a whole).
115 * @param enabled true to activate networking, false otherwise
117 virtual void setNetworkingEnabled(bool enabled
) = 0;
120 * Activates or deactivates wireless networking.
122 * @param enabled true to activate wireless networking, false otherwise
124 virtual void setWirelessEnabled(bool enabled
) = 0;
128 * This signal is emitted when the system's connection state changes
130 void statusChanged(Solid::Networking::Status status
);
133 * This signal is emitted when a new network interface is available.
135 * @param uni the network interface identifier
137 void networkInterfaceAdded(const QString
& uni
);
140 * This signal is emitted when a network interface is not available anymore.
142 * @param uni the network interface identifier
144 void networkInterfaceRemoved(const QString
& uni
);
147 * This signal is emitted when the status of the wireless changed
149 void wirelessEnabledChanged(bool enabled
);
152 * This signal is emitted when the status of the wireless hardware changed
154 void wirelessHardwareEnabledChanged(bool enabled
);
157 * This signal is emitted when the set of active connections changes
159 void activeConnectionsChanged();
168 Q_DECLARE_INTERFACE(Solid::Control::Ifaces::NetworkManager
, "org.kde.Solid.Control.Ifaces.NetworkManager/0.1")