2
Copyright 2011 Lamarque Souza <lamarque@gmail.com>
4
This program is free software; you can redistribute it and/or
5
modify it under the terms of the GNU General Public License as
6
published by the Free Software Foundation; either version 2 of
7
the License or (at your option) version 3 or any later version
8
accepted by the membership of KDE e.V. (or its successor approved
9
by the membership of KDE e.V.), which shall act as a proxy
10
defined in Section 14 of version 3 of the license.
12
This program is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
GNU General Public License for more details.
17
You should have received a copy of the GNU General Public License
18
along with this program. If not, see <http://www.gnu.org/licenses/>.
23
#include "networkbtinterface.h"
24
#include "networkbtinterface_p.h"
27
#include "solid/control/modemmanager.h"
29
NMBtNetworkInterfacePrivate::NMBtNetworkInterfacePrivate(const QString & path, QObject * owner)
30
: NMGsmNetworkInterfacePrivate(path, owner), btIface(NMNetworkManager::DBUS_SERVICE, path, QDBusConnection::systemBus())
32
btCapabilities = static_cast<QFlags<Solid::Control::BtNetworkInterface::Capability> >(btIface.btCapabilities());
33
hardwareAddress = btIface.hwAddress();
34
name = btIface.name();
37
NMBtNetworkInterface::NMBtNetworkInterface(const QString & path, NMNetworkManager * manager, QObject * parent)
38
: NMGsmNetworkInterface(*new NMBtNetworkInterfacePrivate(path, this), manager, parent)
40
Q_D(NMBtNetworkInterface);
41
connect( &d->btIface, SIGNAL(PropertiesChanged(const QVariantMap &)),
42
this, SLOT(btPropertiesChanged(const QVariantMap &)));
45
NMBtNetworkInterface::~NMBtNetworkInterface()
50
void NMBtNetworkInterface::btPropertiesChanged(const QVariantMap & changedProperties)
52
kDebug(1441) << changedProperties.keys();
53
Q_D(NMBtNetworkInterface);
54
QLatin1String hwAddrKey("HwAddress"),
56
capabilities("BtCapabilities");
57
QVariantMap::const_iterator it = changedProperties.find(hwAddrKey);
58
it = changedProperties.find(hwAddrKey);
59
if (it != changedProperties.end()) {
60
d->hardwareAddress = it->toString();
62
it = changedProperties.find(name);
63
if (it != changedProperties.end()) {
64
d->name = it->toString();
65
emit networkNameChanged(d->name);
67
if (it != changedProperties.end()) {
68
d->btCapabilities = static_cast<Solid::Control::BtNetworkInterface::Capabilities>(it->toUInt());
72
Solid::Control::BtNetworkInterface::Capabilities NMBtNetworkInterface::btCapabilities() const
74
Q_D(const NMBtNetworkInterface);
75
return d->btCapabilities;
78
QString NMBtNetworkInterface::hardwareAddress() const
80
Q_D(const NMBtNetworkInterface);
81
return d->hardwareAddress;
84
QString NMBtNetworkInterface::name() const
86
Q_D(const NMBtNetworkInterface);
90
#include "networkbtinterface.moc"
92
// vim: sw=4 sts=4 et tw=100