1 | /* |
2 | SPDX-FileCopyrightText: 2013 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 | #include "device_p.h" |
8 | #include "macvlandevice_p.h" |
9 | #include "manager.h" |
10 | |
11 | NetworkManager::MacVlanDevicePrivate::MacVlanDevicePrivate(const QString &path, MacVlanDevice *q) |
12 | : DevicePrivate(path, q) |
13 | #ifdef NMQT_STATIC |
14 | , iface(NetworkManagerPrivate::DBUS_SERVICE, path, QDBusConnection::sessionBus()) |
15 | #else |
16 | , iface(NetworkManagerPrivate::DBUS_SERVICE, path, QDBusConnection::systemBus()) |
17 | #endif |
18 | { |
19 | } |
20 | |
21 | NetworkManager::MacVlanDevicePrivate::~MacVlanDevicePrivate() |
22 | { |
23 | } |
24 | |
25 | NetworkManager::MacVlanDevice::MacVlanDevice(const QString &path, QObject *parent) |
26 | : Device(*new MacVlanDevicePrivate(path, this), parent) |
27 | { |
28 | Q_D(MacVlanDevice); |
29 | |
30 | QVariantMap initialProperties = NetworkManagerPrivate::retrieveInitialProperties(interfaceName: d->iface.staticInterfaceName(), path); |
31 | if (!initialProperties.isEmpty()) { |
32 | d->propertiesChanged(properties: initialProperties); |
33 | } |
34 | } |
35 | |
36 | NetworkManager::MacVlanDevice::~MacVlanDevice() |
37 | { |
38 | } |
39 | |
40 | NetworkManager::Device::Type NetworkManager::MacVlanDevice::type() const |
41 | { |
42 | return NetworkManager::Device::MacVlan; |
43 | } |
44 | |
45 | QString NetworkManager::MacVlanDevice::mode() const |
46 | { |
47 | Q_D(const MacVlanDevice); |
48 | return d->mode; |
49 | } |
50 | |
51 | bool NetworkManager::MacVlanDevice::noPromisc() const |
52 | { |
53 | Q_D(const MacVlanDevice); |
54 | return d->noPromisc; |
55 | } |
56 | |
57 | QString NetworkManager::MacVlanDevice::parent() const |
58 | { |
59 | Q_D(const MacVlanDevice); |
60 | return d->parent; |
61 | } |
62 | |
63 | void NetworkManager::MacVlanDevicePrivate::propertyChanged(const QString &property, const QVariant &value) |
64 | { |
65 | Q_Q(MacVlanDevice); |
66 | |
67 | if (property == QLatin1String("Mode" )) { |
68 | mode = value.toString(); |
69 | Q_EMIT q->modeChanged(mode); |
70 | } else if (property == QLatin1String("NoPromisc" )) { |
71 | noPromisc = value.toBool(); |
72 | Q_EMIT q->noPromiscChanged(noPromisc); |
73 | } else if (property == QLatin1String("Parent" )) { |
74 | parent = value.toString(); |
75 | Q_EMIT q->parentChanged(parent); |
76 | } else { |
77 | DevicePrivate::propertyChanged(property, value); |
78 | } |
79 | } |
80 | |
81 | #include "moc_macvlandevice.cpp" |
82 | #include "moc_macvlandevice_p.cpp" |
83 | |