Qt 4.8
qnetworkmanagerservice.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the plugins of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #ifndef QNETWORKMANAGERSERVICE_H
43 #define QNETWORKMANAGERSERVICE_H
44 
45 //
46 // W A R N I N G
47 // -------------
48 //
49 // This file is not part of the Qt API. It exists purely as an
50 // implementation detail. This header file may change from version to
51 // version without notice, or even be removed.
52 //
53 // We mean it.
54 //
55 
56 #include <QtDBus/QtDBus>
57 #include <QtDBus/QDBusConnection>
58 #include <QtDBus/QDBusError>
59 #include <QtDBus/QDBusInterface>
60 #include <QtDBus/QDBusMessage>
61 #include <QtDBus/QDBusReply>
62 
63 #include <QtDBus/QDBusPendingCallWatcher>
64 #include <QtDBus/QDBusObjectPath>
65 #include <QtDBus/QDBusContext>
66 #include <QMap>
67 #include "qnmdbushelper.h"
68 
69 #ifndef QT_NO_DBUS
70 
71 #ifndef NETWORK_MANAGER_H
72 typedef enum NMDeviceType
73 {
79 } NMDeviceType;
80 
81 typedef enum
82 {
94 
95 typedef enum
96 {
101 
102 #define NM_DBUS_SERVICE "org.freedesktop.NetworkManager"
103 
104 #define NM_DBUS_PATH "/org/freedesktop/NetworkManager"
105 #define NM_DBUS_INTERFACE "org.freedesktop.NetworkManager"
106 #define NM_DBUS_INTERFACE_DEVICE NM_DBUS_INTERFACE ".Device"
107 #define NM_DBUS_INTERFACE_DEVICE_WIRED NM_DBUS_INTERFACE_DEVICE ".Wired"
108 #define NM_DBUS_INTERFACE_DEVICE_WIRELESS NM_DBUS_INTERFACE_DEVICE ".Wireless"
109 #define NM_DBUS_PATH_ACCESS_POINT NM_DBUS_PATH "/AccessPoint"
110 #define NM_DBUS_INTERFACE_ACCESS_POINT NM_DBUS_INTERFACE ".AccessPoint"
111 
112 #define NM_DBUS_PATH_SETTINGS "/org/freedesktop/NetworkManagerSettings"
113 
114 #define NM_DBUS_IFACE_SETTINGS_CONNECTION "org.freedesktop.NetworkManagerSettings.Connection"
115 #define NM_DBUS_IFACE_SETTINGS "org.freedesktop.NetworkManagerSettings"
116 #define NM_DBUS_INTERFACE_ACTIVE_CONNECTION NM_DBUS_INTERFACE ".Connection.Active"
117 #define NM_DBUS_INTERFACE_IP4_CONFIG NM_DBUS_INTERFACE ".IP4Config"
118 
119 #define NM_DBUS_SERVICE_USER_SETTINGS "org.freedesktop.NetworkManagerUserSettings"
120 #define NM_DBUS_SERVICE_SYSTEM_SETTINGS "org.freedesktop.NetworkManagerSystemSettings"
121 
122 #define NM_802_11_AP_FLAGS_NONE 0x00000000
123 #define NM_802_11_AP_FLAGS_PRIVACY 0x00000001
124 #endif
125 
127 
130 
132 
135 
137 
140 {
141  Q_OBJECT
142 
143 public:
144 
147 
149  void activateConnection(const QString &serviceName, QDBusObjectPath connection, QDBusObjectPath device, QDBusObjectPath specificObject);
150  void deactivateConnection(QDBusObjectPath connectionPath) const;
151 
152  QDBusObjectPath path() const;
154 
155  bool wirelessEnabled() const;
156  bool wirelessHardwareEnabled() const;
158  quint32 state();
159  bool setConnections();
160  bool isValid();
161 
162 Q_SIGNALS:
166  void stateChanged(const QString&, quint32);
168 
169 private Q_SLOTS:
170 private:
173 };
174 
177 {
178  Q_OBJECT
179 
180 public:
181 
182  enum DeviceState {
183  Unknown = 0,
192  Failed
193  };
194 
195  enum ApFlag {
196  ApNone = 0x0,
197  Privacy = 0x1
198  };
199 
200  Q_DECLARE_FLAGS(ApFlags, ApFlag);
201 
203  ApSecurityNone = 0x0,
204  PairWep40 = 0x1,
205  PairWep104 = 0x2,
206  PairTkip = 0x4,
207  PairCcmp = 0x8,
208  GroupWep40 = 0x10,
209  GroupWep104 = 0x20,
210  GroupTkip = 0x40,
211  GroupCcmp = 0x80,
212  KeyPsk = 0x100,
213  Key8021x = 0x200
214  };
215 
216  Q_DECLARE_FLAGS(ApSecurityFlags, ApSecurityFlag);
217 
218  explicit QNetworkManagerInterfaceAccessPoint(const QString &dbusPathName, QObject *parent = 0);
220 
222 
223  quint32 flags() const;
224  quint32 wpaFlags() const;
225  quint32 rsnFlags() const;
226  QString ssid() const;
227  quint32 frequency() const;
228  QString hwAddress() const;
229  quint32 mode() const;
230  quint32 maxBitrate() const;
231  quint32 strength() const;
232  bool setConnections();
233  bool isValid();
234 
235 Q_SIGNALS:
238 private:
241 
242 };
243 
246 {
247  Q_OBJECT
248 
249 public:
250 
251  explicit QNetworkManagerInterfaceDevice(const QString &deviceObjectPath, QObject *parent = 0);
253 
254  QString udi() const;
255  QString networkInterface() const;
257  quint32 ip4Address() const;
258  quint32 state() const;
259  quint32 deviceType() const;
260 
261  QDBusObjectPath ip4config() const;
262  bool setConnections();
263  bool isValid();
264 
265 Q_SIGNALS:
266  void stateChanged(const QString &, quint32);
267 
268 private:
271 };
272 
275 {
276  Q_OBJECT
277 
278 public:
279 
280  explicit QNetworkManagerInterfaceDeviceWired(const QString &ifaceDevicePath,
281  QObject *parent = 0);
283 
285  QString hwAddress() const;
286  quint32 speed() const;
287  bool carrier() const;
288  bool setConnections();
289  bool isValid();
290 
291 Q_SIGNALS:
293 private:
296 };
297 
300 {
301  Q_OBJECT
302 
303 public:
304 
306  None = 0x0,
307  Wep40 = 0x1,
308  Wep104 = 0x2,
309  Tkip = 0x4,
310  Ccmp = 0x8,
311  Wpa = 0x10,
312  Rsn = 0x20
313  };
314 
315  explicit QNetworkManagerInterfaceDeviceWireless(const QString &ifaceDevicePath,
316  QObject *parent = 0);
318 
319  QDBusObjectPath path() const;
320  QList <QDBusObjectPath> getAccessPoints();
322 
323  QString hwAddress() const;
324  quint32 mode() const;
325  quint32 bitrate() const;
326  QDBusObjectPath activeAccessPoint() const;
327  quint32 wirelessCapabilities() const;
328  bool setConnections();
329  bool isValid();
330 
331 Q_SIGNALS:
333  void accessPointAdded(const QString &,QDBusObjectPath);
334  void accessPointRemoved(const QString &,QDBusObjectPath);
335 private:
338 };
339 
342 {
343  Q_OBJECT
344 
345 public:
346 
347  explicit QNetworkManagerSettings(const QString &settingsService, QObject *parent = 0);
349 
351  QList <QDBusObjectPath> listConnections();
352  bool setConnections();
353  bool isValid();
354 
355 Q_SIGNALS:
356  void newConnection(QDBusObjectPath);
357 private:
359 };
360 
363 {
364  Q_OBJECT
365 
366 public:
367 
368  QNetworkManagerSettingsConnection(const QString &settingsService, const QString &connectionObjectPath, QObject *parent = 0);
370 
372  QNmSettingsMap getSettings();
373  bool setConnections();
374  NMDeviceType getType();
375  bool isAutoConnect();
376  quint64 getTimestamp();
377  QString getId();
378  QString getUuid();
379  QString getSsid();
380  QString getMacAddress();
381  QStringList getSeenBssids();
382  bool isValid();
383 
384 Q_SIGNALS:
385 
386  void updated(const QNmSettingsMap &settings);
387  void removed(const QString &path);
388 
389 private:
392 };
393 
396 {
397  Q_OBJECT
398 
399 public:
400 
402  Unknown = 0,
403  Activating = 1,
404  Activated = 2
405  };
406 
407  explicit QNetworkManagerConnectionActive(const QString &dbusPathName, QObject *parent = 0);
409 
411  QString serviceName() const;
412  QDBusObjectPath connection() const;
413  QDBusObjectPath specificObject() const;
414  QList<QDBusObjectPath> devices() const;
415  quint32 state() const;
416  bool defaultRoute() const;
417  bool setConnections();
418  bool isValid();
419 
420 
421 Q_SIGNALS:
424 private:
427 };
428 
431 {
432  Q_OBJECT
433 
434 public:
435  explicit QNetworkManagerIp4Config(const QString &dbusPathName, QObject *parent = 0);
437 
438  QStringList domains() const;
439  bool isValid();
440 
441  private:
443 };
444 
446 
447 #endif // QT_NO_DBUS
448 #endif //QNETWORKMANAGERSERVICE_H
QList< QDBusObjectPath > activeConnections() const
void deviceRemoved(QDBusObjectPath)
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
NMActiveConnectionState
#define Q_DECLARE_FLAGS(Flags, Enum)
The Q_DECLARE_FLAGS() macro expands to.
Definition: qglobal.h:2348
QNetworkManagerConnectionActivePrivate * d
void propertiesChanged(const QString &, QMap< QString, QVariant >)
The QDBusInterface class is a proxy for interfaces on remote objects.
The QDBusPendingCallWatcher class provides a convenient way for waiting for asynchronous replies...
#define Q_SLOTS
Definition: qobjectdefs.h:71
The QString class provides a Unicode character string.
Definition: qstring.h:83
QList< quint32 > ServerThing
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
#define Q_SIGNALS
Definition: qobjectdefs.h:72
QMap< QString, QMap< QString, QVariant > > QNmSettingsMap
void activationFinished(QDBusPendingCallWatcher *)
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
unsigned __int64 quint64
Definition: qglobal.h:943
QNetworkManagerSettingsConnectionPrivate * d
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
#define QT_PREPEND_NAMESPACE(name)
This macro qualifies identifier with the full namespace.
Definition: qglobal.h:87
QNetworkManagerInterface(QObject *parent=0)
void activateConnection(const QString &serviceName, QDBusObjectPath connection, QDBusObjectPath device, QDBusObjectPath specificObject)
QNetworkManagerInterfaceDeviceWirelessPrivate * d
void deactivateConnection(QDBusObjectPath connectionPath) const
QList< QDBusObjectPath > getDevices() const
#define Q_OBJECT
Definition: qobjectdefs.h:157
#define Q_DECLARE_METATYPE(TYPE)
This macro makes the type Type known to QMetaType as long as it provides a public default constructor...
Definition: qmetatype.h:265
#define None
QNetworkManagerIp4ConfigPrivate * d
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
unsigned int quint32
Definition: qglobal.h:938
void deviceAdded(QDBusObjectPath)
The QDBusObjectPath class enables the programmer to identify the OBJECT_PATH type provided by the D-B...
QNetworkManagerSettingsPrivate * d
void stateChanged(const QString &, quint32)
QDBusInterface * connectionInterface() const
QNetworkManagerInterfaceAccessPointPrivate * d
QNetworkManagerInterfacePrivate * d
QNetworkManagerInterfaceDevicePrivate * d
QDBusObjectPath path() const
The QMap class is a template class that provides a skip-list-based dictionary.
Definition: qdatastream.h:67
QNetworkManagerInterfaceDeviceWiredPrivate * d
The QList class is a template class that provides lists.
Definition: qdatastream.h:62