NetworkManagerQt

olpcmeshdevice.cpp
1/*
2 SPDX-FileCopyrightText: 2011 Ilia Kats <ilia-kats@gmx.net>
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 "olpcmeshdevice.h"
9#include "manager_p.h"
10#include "olpcmeshdevice_p.h"
11
12#include "wimaxnsp.h"
13
14NetworkManager::OlpcMeshDevicePrivate::OlpcMeshDevicePrivate(const QString &path, OlpcMeshDevice *q)
15 : DevicePrivate(path, q)
16#ifdef NMQT_STATIC
17 , iface(NetworkManagerPrivate::DBUS_SERVICE, path, QDBusConnection::sessionBus())
18#else
19 , iface(NetworkManagerPrivate::DBUS_SERVICE, path, QDBusConnection::systemBus())
20#endif
21{
22}
23
25 : Device(*new OlpcMeshDevicePrivate(path, this), parent)
26{
28
29 QVariantMap initialProperties = NetworkManagerPrivate::retrieveInitialProperties(d->iface.staticInterfaceName(), path);
30 if (!initialProperties.isEmpty()) {
31 d->propertiesChanged(initialProperties);
32 }
33}
34
38
43
45{
46 Q_D(const OlpcMeshDevice);
47 return d->hardwareAddress;
48}
49
51{
52 Q_D(const OlpcMeshDevice);
53 return d->activeChannel;
54}
55
61
62void NetworkManager::OlpcMeshDevicePrivate::propertyChanged(const QString &property, const QVariant &value)
63{
64 Q_Q(OlpcMeshDevice);
65
66 if (property == QLatin1String("ActiveChannel")) {
67 activeChannel = value.toUInt();
68 Q_EMIT q->activeChannelChanged(activeChannel);
69 } else if (property == QLatin1String("HwAddress")) {
70 hardwareAddress = value.toString();
71 Q_EMIT q->hardwareAddressChanged(hardwareAddress);
72 } else if (property == QLatin1String("Companion")) {
73 companion = qdbus_cast<QDBusObjectPath>(value).path();
74 Q_EMIT q->companionChanged(NetworkManager::findNetworkInterface(companion));
75 } else {
76 DevicePrivate::propertyChanged(property, value);
77 }
78}
79
80#include "moc_olpcmeshdevice.cpp"
81#include "moc_olpcmeshdevice_p.cpp"
This class represents a common device interface.
Definition device.h:34
Type
Device type.
Definition device.h:191
@ OlpcMesh
OLPC Mesh networking device.
Definition device.h:198
A OLPC mesh interface.
Device::Ptr companionDevice() const
The current companion device.
uint activeChannel() const
Currently active channel.
Type type() const override
Return the type.
OlpcMeshDevice(const QString &path, QObject *parent=nullptr)
Creates a new OlpcMeshDevice object.
QString hardwareAddress() const
The hardware address currently used by the network interface.
~OlpcMeshDevice() override
Destroys a OlpcMeshDevice object.
QString path(const QString &relativePath)
NETWORKMANAGERQT_EXPORT Device::Ptr findNetworkInterface(const QString &uni)
Find a new NetworkInterface object given its UNI.
Definition manager.cpp:1026
QString toString() const const
uint toUInt(bool *ok) const const
Q_D(Todo)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 8 2024 11:48:27 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.