NetworkManagerQt

infinibanddevice.cpp
1/*
2 SPDX-FileCopyrightText: 2013 Jan Grulich <jgrulich@redhat.com>
3 SPDX-FileCopyrightText: 2013 Daniel Nicoletti <dantti12@gmail.com>
4
5 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
6*/
7
8#include "device_p.h"
9#include "infinibanddevice_p.h"
10#include "manager.h"
11
12NetworkManager::InfinibandDevicePrivate::InfinibandDevicePrivate(const QString &path, InfinibandDevice *q)
13 : DevicePrivate(path, q)
14#ifdef NMQT_STATIC
15 , iface(NetworkManagerPrivate::DBUS_SERVICE, path, QDBusConnection::sessionBus())
16#else
17 , iface(NetworkManagerPrivate::DBUS_SERVICE, path, QDBusConnection::systemBus())
18#endif
19 , carrier(false)
20{
21}
22
23NetworkManager::InfinibandDevice::~InfinibandDevice()
24{
25}
26
27NetworkManager::InfinibandDevice::InfinibandDevice(const QString &path, QObject *parent)
28 : Device(*new InfinibandDevicePrivate(path, this), parent)
29{
30 Q_D(InfinibandDevice);
31
32 QVariantMap initialProperties = NetworkManagerPrivate::retrieveInitialProperties(d->iface.staticInterfaceName(), path);
33 if (!initialProperties.isEmpty()) {
34 d->propertiesChanged(initialProperties);
35 }
36}
37
38NetworkManager::InfinibandDevicePrivate::~InfinibandDevicePrivate()
39{
40}
41
46
47bool NetworkManager::InfinibandDevice::carrier() const
48{
49 Q_D(const InfinibandDevice);
50
51 return d->carrier;
52}
53
54QString NetworkManager::InfinibandDevice::hwAddress() const
55{
56 Q_D(const InfinibandDevice);
57
58 return d->hwAddress;
59}
60
61void NetworkManager::InfinibandDevicePrivate::propertyChanged(const QString &property, const QVariant &value)
62{
64
65 if (property == QLatin1String("Carrier")) {
66 carrier = value.toBool();
67 Q_EMIT q->carrierChanged(carrier);
68 } else if (property == QLatin1String("HwAddress")) {
69 hwAddress = value.toString();
70 Q_EMIT q->hwAddressChanged(hwAddress);
71 } else {
72 DevicePrivate::propertyChanged(property, value);
73 }
74}
75
76#include "moc_infinibanddevice.cpp"
77#include "moc_infinibanddevice_p.cpp"
Type
Device type.
Definition device.h:191
@ InfiniBand
Infiniband network device.
Definition device.h:201
An infiniband device interface.
Type type() const override
Retrieves the interface type.
QString path(const QString &relativePath)
bool toBool() const const
QString toString() const const
Q_D(Todo)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:56:21 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.