NetworkManagerQt

modemdevice.cpp
1/*
2 SPDX-FileCopyrightText: 2008, 2011 Will Stephenson <wstephenson@kde.org>
3 SPDX-FileCopyrightText: 2011-2013 Lamarque Souza <lamarque@kde.org>
4 SPDX-FileCopyrightText: 2013 Daniel Nicoletti <dantti12@gmail.com>
5 SPDX-FileCopyrightText: 2013 Jan Grulich <jgrulich@redhat.com>
6
7 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
8*/
9
10#include "modemdevice.h"
11#include "modemdevice_p.h"
12
13#include "manager_p.h"
14
15NetworkManager::ModemDevice::Capabilities convertModemCapabilities(uint theirCaps)
16{
18 return ourCaps;
19}
20
21NetworkManager::ModemDevicePrivate::ModemDevicePrivate(const QString &path, ModemDevice *q)
22 : DevicePrivate(path, q)
23#ifdef NMQT_STATIC
24 , modemIface(NetworkManagerPrivate::DBUS_SERVICE, path, QDBusConnection::sessionBus())
25#else
26 , modemIface(NetworkManagerPrivate::DBUS_SERVICE, path, QDBusConnection::systemBus())
27#endif
28{
29}
30
31NetworkManager::ModemDevice::ModemDevice(const QString &path, QObject *parent)
32 : Device(*new ModemDevicePrivate(path, this), parent)
33{
34 Q_D(ModemDevice);
35
36 QVariantMap initialProperties = NetworkManagerPrivate::retrieveInitialProperties(d->modemIface.staticInterfaceName(), path);
37 if (!initialProperties.isEmpty()) {
38 d->propertiesChanged(initialProperties);
39 }
40}
41
42NetworkManager::ModemDevice::ModemDevice(NetworkManager::ModemDevicePrivate &dd, QObject *parent)
43 : Device(dd, parent)
44{
45 Q_D(ModemDevice);
46
47 QDBusConnection::systemBus().connect(NetworkManagerPrivate::DBUS_SERVICE,
48 d->uni,
49 NetworkManagerPrivate::FDO_DBUS_PROPERTIES,
50 QLatin1String("PropertiesChanged"),
51 d,
52 SLOT(dbusPropertiesChanged(QString, QVariantMap, QStringList)));
53}
54
55NetworkManager::ModemDevice::~ModemDevice()
56{
57}
58
63
69
75
76void NetworkManager::ModemDevicePrivate::propertyChanged(const QString &property, const QVariant &value)
77{
78 Q_Q(ModemDevice);
79
80 if (property == QLatin1String("CurrentCapabilities")) {
81 currentCapabilities = convertModemCapabilities(value.toUInt());
82 Q_EMIT q->currentCapabilitiesChanged(currentCapabilities);
83 } else if (property == QLatin1String("ModemCapabilities")) {
84 modemCapabilities = convertModemCapabilities(value.toUInt());
85 } else {
86 DevicePrivate::propertyChanged(property, value);
87 }
88}
89
90#include "moc_modemdevice.cpp"
91#include "moc_modemdevice_p.cpp"
Type
Device type.
Definition device.h:191
@ Modem
POTS, GSM, CDMA or LTE modems.
Definition device.h:200
Represents a generic modem device, generally defined by the modemCapabilities() it exposes and at the...
Definition modemdevice.h:24
Capabilities currentCapabilities() const
The generic family of access technologies the modem currently supports without a firmware reload or r...
Capabilities modemCapabilities() const
The generic family of access technologies the modem supports.
Type type() const override
Return the type.
QString path(const QString &relativePath)
bool connect(const QString &service, const QString &path, const QString &interface, const QString &name, QObject *receiver, const char *slot)
QDBusConnection systemBus()
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 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.