NetworkManagerQt

fakenetwork.h
1/*
2 SPDX-FileCopyrightText: 2014 Jan Grulich <jgrulich@redhat.com>
3
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5*/
6
7#ifndef NETWORKMANAGERQT_FAKE_NETWORK_H
8#define NETWORKMANAGERQT_FAKE_NETWORK_H
9
10#include <QObject>
11
12#include <QDBusObjectPath>
13
14#include "../device.h"
15#include "../generictypes.h"
16
17#include "activeconnection.h"
18#include "device.h"
19#include "settings.h"
20
21class FakeNetwork : public QObject
22{
24 Q_CLASSINFO("D-Bus Interface", "org.kde.fakenetwork")
25public:
26 explicit FakeNetwork(QObject *parent = nullptr);
27 ~FakeNetwork() override;
28
29 Q_PROPERTY(QDBusObjectPath ActivatingConnection READ activatingConnection)
30 Q_PROPERTY(QList<QDBusObjectPath> ActiveConnections READ activeConnections)
31 Q_PROPERTY(uint Connectivity READ connectivity)
32 Q_PROPERTY(QList<QDBusObjectPath> Devices READ devices)
33 Q_PROPERTY(bool NetworkingEnabled READ networkingEnabled)
34 Q_PROPERTY(QDBusObjectPath PrimaryConnection READ primaryConnection)
35 Q_PROPERTY(uint State READ state)
36 Q_PROPERTY(QString Version READ version)
37 Q_PROPERTY(bool WimaxEnabled READ wimaxEnabled WRITE setWimaxEnabled)
38 Q_PROPERTY(bool WimaxHardwareEnabled READ wimaxHardwareEnabled)
39 Q_PROPERTY(bool WirelessEnabled READ wirelessEnabled WRITE setWirelessEnabled)
40 Q_PROPERTY(bool WirelessHardwareEnabled READ wirelessHardwareEnabled)
41 Q_PROPERTY(bool WwanEnabled READ wwanEnabled WRITE setWwanEnabled)
42 Q_PROPERTY(bool WwanHardwareEnabled READ wwanHardwareEnabled)
43
44 QDBusObjectPath activatingConnection() const;
45 QList<QDBusObjectPath> activeConnections() const;
46 uint connectivity() const;
47 QList<QDBusObjectPath> devices() const;
48 bool networkingEnabled() const;
49 QDBusObjectPath primaryConnection() const;
50 uint state() const;
51 QString version() const;
52 bool wimaxEnabled() const;
53 void setWimaxEnabled(bool enabled);
54 bool wimaxHardwareEnabled() const;
55 void setWimaxHardwareEnabled(bool enabled);
56 bool wirelessEnabled() const;
57 void setWirelessEnabled(bool enabled);
58 bool wirelessHardwareEnabled() const;
59 void setWirelessHardwareEnabled(bool enabled);
60 bool wwanEnabled() const;
61 void setWwanEnabled(bool enabled);
62 bool wwanHardwareEnabled() const;
63
64 /* Not part of DBus interface */
65 void addDevice(Device *device);
66 void removeDevice(Device *device);
67 void registerService();
68 void unregisterService();
69
70private Q_SLOTS:
71 void onConnectionAdded(const QDBusObjectPath &connection);
72 void onConnectionRemoved(const QDBusObjectPath &connection);
73 void removeActiveConnection(const QDBusObjectPath &activeConnection);
74 void updateConnectingState();
75 void updateDeactivatingState();
76
77public Q_SLOTS:
78 Q_SCRIPTABLE QDBusObjectPath ActivateConnection(const QDBusObjectPath &connection, const QDBusObjectPath &device, const QDBusObjectPath &specific_object);
79 Q_SCRIPTABLE uint CheckConnectivity() const;
80 Q_SCRIPTABLE void DeactivateConnection(const QDBusObjectPath &active_connection);
81 Q_SCRIPTABLE QDBusObjectPath GetDeviceByIpIface(const QString &iface);
82 Q_SCRIPTABLE QList<QDBusObjectPath> GetDevices() const;
83
85 Q_SCRIPTABLE void DeviceAdded(const QDBusObjectPath &device_path);
86 Q_SCRIPTABLE void DeviceRemoved(const QDBusObjectPath &device_path);
87 Q_SCRIPTABLE void PropertiesChanged(const QVariantMap &properties);
88 Q_SCRIPTABLE void StateChanged(uint state);
89
90private:
91 QDBusObjectPath m_activatingConnection;
92 QMap<QDBusObjectPath, ActiveConnection *> m_activeConnections;
93 uint m_connectivity;
94 QMap<QDBusObjectPath, Device *> m_devices;
95 bool m_networkingEnabled;
96 QDBusObjectPath m_primaryConnection;
97 uint m_state;
98 QString m_version;
99 bool m_wimaxEnabled;
100 bool m_wimaxHardwareEnabled;
101 bool m_wirelessEnabled;
102 bool m_wirelessHardwareEnabled;
103 bool m_wwanEnabled;
104 bool m_wwanHardwareEnabled;
105
106 /* Not part of DBus interface */
107 QString m_activatedDevice;
108 QString m_deactivatedDevice;
109 int m_activeConnectionsCounter;
110 int m_deviceCounter;
111 Settings *m_settings;
112};
113
114#endif
Q_CLASSINFO(Name, Value)
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 29 2024 11:46:15 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.