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#include "genericdevice_p.h"
8#include "manager.h"
9#include "nmdebug.h"
10
11NetworkManager::GenericDevicePrivate::GenericDevicePrivate(const QString &path, GenericDevice *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
21NetworkManager::GenericDevicePrivate::~GenericDevicePrivate()
22{
23}
24
25NetworkManager::GenericDevice::GenericDevice(const QString &path, QObject *parent)
26 : Device(*new NetworkManager::GenericDevicePrivate(path, this), parent)
27{
28 Q_D(GenericDevice);
29
30 QVariantMap initialProperties = NetworkManagerPrivate::retrieveInitialProperties(interfaceName: d->iface.staticInterfaceName(), path);
31 if (!initialProperties.isEmpty()) {
32 d->propertiesChanged(properties: initialProperties);
33 }
34}
35
36NetworkManager::GenericDevice::~GenericDevice()
37{
38}
39
40NetworkManager::Device::Type NetworkManager::GenericDevice::type() const
41{
42 return NetworkManager::Device::Generic;
43}
44
45QString NetworkManager::GenericDevice::hardwareAddress() const
46{
47 Q_D(const GenericDevice);
48 return d->hwAddress;
49}
50
51QString NetworkManager::GenericDevice::typeDescription() const
52{
53 Q_D(const GenericDevice);
54 return d->typeDescription;
55}
56
57void NetworkManager::GenericDevicePrivate::propertyChanged(const QString &property, const QVariant &value)
58{
59 Q_Q(GenericDevice);
60
61 if (property == QLatin1String("HwAddress")) {
62 hwAddress = value.toString();
63 Q_EMIT q->hardwareAddressChanged(hwAddress);
64 } else if (property == QLatin1String("TypeDescription")) {
65 typeDescription = value.toString();
66 Q_EMIT q->permanentHardwareAddressChanged(permHwAddress: typeDescription);
67 } else {
68 DevicePrivate::propertyChanged(property, value);
69 }
70}
71
72#include "moc_genericdevice.cpp"
73#include "moc_genericdevice_p.cpp"
74

source code of networkmanager-qt/src/genericdevice.cpp