NetworkManagerQt

wimaxsetting.cpp
1/*
2 SPDX-FileCopyrightText: 2012-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 "wimaxsetting.h"
9#include "wimaxsetting_p.h"
10
11#include <QDebug>
12
13NetworkManager::WimaxSettingPrivate::WimaxSettingPrivate()
14 : name(NM_SETTING_WIMAX_SETTING_NAME)
15{
16}
17
18NetworkManager::WimaxSetting::WimaxSetting()
19 : Setting(Setting::Wimax)
20 , d_ptr(new WimaxSettingPrivate())
21{
22}
23
24NetworkManager::WimaxSetting::WimaxSetting(const Ptr &other)
25 : Setting(other)
26 , d_ptr(new WimaxSettingPrivate())
27{
28 setNetworkName(other->networkName());
29 setMacAddress(other->macAddress());
30}
31
32NetworkManager::WimaxSetting::~WimaxSetting()
33{
34 delete d_ptr;
35}
36
38{
39 Q_D(const WimaxSetting);
40
41 return d->name;
42}
43
44void NetworkManager::WimaxSetting::setNetworkName(const QString &name)
45{
47
48 d->networkName = name;
49}
50
51QString NetworkManager::WimaxSetting::networkName() const
52{
53 Q_D(const WimaxSetting);
54
55 return d->networkName;
56}
57
58void NetworkManager::WimaxSetting::setMacAddress(const QByteArray &address)
59{
60 Q_D(WimaxSetting);
61
62 d->macAddress = address;
63}
64
65QByteArray NetworkManager::WimaxSetting::macAddress() const
66{
67 Q_D(const WimaxSetting);
68
69 return d->macAddress;
70}
71
72void NetworkManager::WimaxSetting::fromMap(const QVariantMap &setting)
73{
74 if (setting.contains(QLatin1String(NM_SETTING_WIMAX_NETWORK_NAME))) {
75 setNetworkName(setting.value(QLatin1String(NM_SETTING_WIMAX_NETWORK_NAME)).toString());
76 }
77
78 if (setting.contains(QLatin1String(NM_SETTING_WIMAX_MAC_ADDRESS))) {
79 setMacAddress(setting.value(QLatin1String(NM_SETTING_WIMAX_MAC_ADDRESS)).toByteArray());
80 }
81}
82
84{
85 QVariantMap setting;
86
87 if (!networkName().isEmpty()) {
88 setting.insert(QLatin1String(NM_SETTING_WIMAX_NETWORK_NAME), networkName());
89 }
90
91 if (!macAddress().isEmpty()) {
92 setting.insert(QLatin1String(NM_SETTING_WIMAX_MAC_ADDRESS), macAddress());
93 }
94
95 return setting;
96}
97
98QDebug NetworkManager::operator<<(QDebug dbg, const NetworkManager::WimaxSetting &setting)
99{
100 dbg.nospace() << "type: " << setting.typeAsString(setting.type()) << '\n';
101 dbg.nospace() << "initialized: " << !setting.isNull() << '\n';
102
103 dbg.nospace() << NM_SETTING_WIMAX_NETWORK_NAME << ": " << setting.networkName() << '\n';
104 dbg.nospace() << NM_SETTING_WIMAX_MAC_ADDRESS << ": " << setting.macAddress() << '\n';
105
106 return dbg.maybeSpace();
107}
Represents wimax setting.
void fromMap(const QVariantMap &setting) override
Must be reimplemented, default implementation does nothing.
QVariantMap toMap() const override
Must be reimplemented, default implementationd does nothing.
QString name() const override
Must be reimplemented, default implementationd does nothing.
PostalAddress address(const QVariant &location)
QDebug & maybeSpace()
QDebug & nospace()
Q_D(Todo)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:08:13 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.