7#include "infinibandsetting.h"
8#include "infinibandsetting_p.h"
12NetworkManager::InfinibandSettingPrivate::InfinibandSettingPrivate()
13 : name(NM_SETTING_INFINIBAND_SETTING_NAME)
15 , transportMode(InfinibandSetting::
Unknown)
20NetworkManager::InfinibandSetting::InfinibandSetting()
21 : Setting(Setting::Infiniband)
22 , d_ptr(new InfinibandSettingPrivate())
28 , d_ptr(new InfinibandSettingPrivate())
30 setMacAddress(other->macAddress());
32 setTransportMode(other->transportMode());
33 setPKey(other->pKey());
34 setParent(other->parent());
37NetworkManager::InfinibandSetting::~InfinibandSetting()
49void NetworkManager::InfinibandSetting::setMacAddress(
const QByteArray &address)
53 d->macAddress = address;
56QByteArray NetworkManager::InfinibandSetting::macAddress()
const
58 Q_D(
const InfinibandSetting);
63void NetworkManager::InfinibandSetting::setMtu(quint32 mtu)
65 Q_D(InfinibandSetting);
70quint32 NetworkManager::InfinibandSetting::mtu()
const
72 Q_D(
const InfinibandSetting);
77void NetworkManager::InfinibandSetting::setTransportMode(NetworkManager::InfinibandSetting::TransportMode mode)
79 Q_D(InfinibandSetting);
81 d->transportMode = mode;
84NetworkManager::InfinibandSetting::TransportMode NetworkManager::InfinibandSetting::transportMode()
const
86 Q_D(
const InfinibandSetting);
88 return d->transportMode;
91void NetworkManager::InfinibandSetting::setPKey(qint32 key)
93 Q_D(InfinibandSetting);
98qint32 NetworkManager::InfinibandSetting::pKey()
const
100 Q_D(
const InfinibandSetting);
105void NetworkManager::InfinibandSetting::setParent(
const QString &parent)
107 Q_D(InfinibandSetting);
112QString NetworkManager::InfinibandSetting::parent()
const
114 Q_D(
const InfinibandSetting);
121 if (setting.contains(
QLatin1String(NM_SETTING_INFINIBAND_MAC_ADDRESS))) {
122 setMacAddress(setting.value(
QLatin1String(NM_SETTING_INFINIBAND_MAC_ADDRESS)).toByteArray());
125 if (setting.contains(
QLatin1String(NM_SETTING_INFINIBAND_MTU))) {
126 setMtu(setting.value(
QLatin1String(NM_SETTING_INFINIBAND_MTU)).toUInt());
129 if (setting.contains(
QLatin1String(NM_SETTING_INFINIBAND_TRANSPORT_MODE))) {
132 if (mode ==
"datagram") {
133 setTransportMode(Datagram);
134 }
else if (mode ==
"connected") {
139 if (setting.contains(
QLatin1String(NM_SETTING_INFINIBAND_P_KEY))) {
140 setPKey(setting.value(
QLatin1String(NM_SETTING_INFINIBAND_P_KEY)).toInt());
143 if (setting.contains(
QLatin1String(NM_SETTING_INFINIBAND_PARENT))) {
144 setParent(setting.value(
QLatin1String(NM_SETTING_INFINIBAND_PARENT)).toString());
152 if (!macAddress().isEmpty()) {
153 setting.insert(
QLatin1String(NM_SETTING_INFINIBAND_MAC_ADDRESS), macAddress());
157 setting.insert(
QLatin1String(NM_SETTING_INFINIBAND_MTU), mtu());
160 if (transportMode() !=
Unknown) {
161 if (transportMode() == Datagram) {
162 setting.insert(
QLatin1String(NM_SETTING_INFINIBAND_TRANSPORT_MODE),
"datagram");
163 }
else if (transportMode() ==
Connected) {
164 setting.insert(
QLatin1String(NM_SETTING_INFINIBAND_TRANSPORT_MODE),
"connected");
169 setting.insert(
QLatin1String(NM_SETTING_INFINIBAND_P_KEY), pKey());
172 if (!parent().isEmpty()) {
173 setting.insert(
QLatin1String(NM_SETTING_INFINIBAND_PARENT), parent());
181 dbg.
nospace() <<
"type: " << setting.typeAsString(setting.type()) <<
'\n';
182 dbg.
nospace() <<
"initialized: " << !setting.isNull() <<
'\n';
184 dbg.
nospace() << NM_SETTING_INFINIBAND_MAC_ADDRESS <<
": " << setting.macAddress() <<
'\n';
185 dbg.
nospace() << NM_SETTING_INFINIBAND_MTU <<
": " << setting.mtu() <<
'\n';
186 dbg.
nospace() << NM_SETTING_INFINIBAND_TRANSPORT_MODE <<
": " << setting.transportMode() <<
'\n';
187 dbg.
nospace() << NM_SETTING_INFINIBAND_P_KEY <<
": " << setting.pKey() <<
'\n';
188 dbg.
nospace() << NM_SETTING_INFINIBAND_PARENT <<
": " << setting.parent() <<
'\n';
Represents infiniband setting.
QVariantMap toMap() const override
Must be reimplemented, default implementationd does nothing.
void fromMap(const QVariantMap &setting) override
Must be reimplemented, default implementation does nothing.
QString name() const override
Must be reimplemented, default implementationd does nothing.
@ Connected
the system is currently connected to a network
@ Unknown
the networking system is not active or unable to report its status - proceed with caution