NetworkManagerQt

genericdevice.cpp
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(d->iface.staticInterfaceName(), path);
31 if (!initialProperties.isEmpty()) {
32 d->propertiesChanged(initialProperties);
33 }
34}
35
36NetworkManager::GenericDevice::~GenericDevice()
37{
38}
39
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(typeDescription);
67 } else {
68 DevicePrivate::propertyChanged(property, value);
69 }
70}
71
72#include "moc_genericdevice.cpp"
73#include "moc_genericdevice_p.cpp"
Type
Device type.
Definition device.h:191
@ Generic
Generic device.
Definition device.h:206
A generic device interface.
Type type() const override
Return the type.
QString path(const QString &relativePath)
This class allows querying the underlying system to discover the available network interfaces and rea...
Definition accesspoint.h:21
QString toString() const const
Q_D(Todo)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:13:24 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.