| 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 | |
| 12 | NetworkManager::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 | |
| 23 | NetworkManager::InfinibandDevice::~InfinibandDevice() |
| 24 | { |
| 25 | } |
| 26 | |
| 27 | NetworkManager::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(interfaceName: d->iface.staticInterfaceName(), path); |
| 33 | if (!initialProperties.isEmpty()) { |
| 34 | d->propertiesChanged(properties: initialProperties); |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | NetworkManager::InfinibandDevicePrivate::~InfinibandDevicePrivate() |
| 39 | { |
| 40 | } |
| 41 | |
| 42 | NetworkManager::Device::Type NetworkManager::InfinibandDevice::type() const |
| 43 | { |
| 44 | return NetworkManager::Device::InfiniBand; |
| 45 | } |
| 46 | |
| 47 | bool NetworkManager::InfinibandDevice::carrier() const |
| 48 | { |
| 49 | Q_D(const InfinibandDevice); |
| 50 | |
| 51 | return d->carrier; |
| 52 | } |
| 53 | |
| 54 | QString NetworkManager::InfinibandDevice::hwAddress() const |
| 55 | { |
| 56 | Q_D(const InfinibandDevice); |
| 57 | |
| 58 | return d->hwAddress; |
| 59 | } |
| 60 | |
| 61 | void NetworkManager::InfinibandDevicePrivate::propertyChanged(const QString &property, const QVariant &value) |
| 62 | { |
| 63 | Q_Q(InfinibandDevice); |
| 64 | |
| 65 | if (property == QLatin1String("Carrier" )) { |
| 66 | carrier = value.toBool(); |
| 67 | Q_EMIT q->carrierChanged(plugged: carrier); |
| 68 | } else if (property == QLatin1String("HwAddress" )) { |
| 69 | hwAddress = value.toString(); |
| 70 | Q_EMIT q->hwAddressChanged(address: hwAddress); |
| 71 | } else { |
| 72 | DevicePrivate::propertyChanged(property, value); |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | #include "moc_infinibanddevice.cpp" |
| 77 | #include "moc_infinibanddevice_p.cpp" |
| 78 | |