Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qnetworkmanagerservice.h
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#ifndef QNETWORKMANAGERSERVICE_H
6#define QNETWORKMANAGERSERVICE_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtCore/qvariant.h>
20#include <QtCore/qmap.h>
21#include <QtDBus/qdbusabstractinterface.h>
22
23#include <optional>
24
25// Matches 'NMDeviceState' from https://developer.gnome.org/NetworkManager/stable/nm-dbus-types.html
39
40QT_BEGIN_NAMESPACE
41
42class QDBusObjectPath;
44
45// This tiny class exists for the purpose of seeing if NetworkManager is available without
46// initializing everything the derived/full class needs.
59
61{
63
64public:
65 // Matches 'NMState' from https://developer.gnome.org/NetworkManager/stable/nm-dbus-types.html
76 Q_ENUM(NMState)
77 // Matches 'NMConnectivityState' from
78 // https://developer.gnome.org/NetworkManager/stable/nm-dbus-types.html#NMConnectivityState
86 Q_ENUM(NMConnectivityState)
87 // Matches 'NMDeviceType' from
88 // https://developer-old.gnome.org/NetworkManager/stable/nm-dbus-types.html#NMDeviceType
123 // Matches 'NMMetered' from
124 // https://developer-old.gnome.org/NetworkManager/stable/nm-dbus-types.html#NMMetered
132
133 explicit QNetworkManagerInterface(QObject *parent = nullptr);
135
137
138 NMState state() const;
140 NMDeviceType deviceType() const;
141 NMMetered meteredState() const;
142
143 bool isValid() const { return QDBusAbstractInterface::isValid() && validDBusConnection; }
144
145private Q_SLOTS:
148
149private:
151
153 NMMetered extractDeviceMetered(const QDBusObjectPath &devicePath) const;
154
155 std::optional<QDBusObjectPath> primaryConnectionDevicePath() const;
156
157 QVariantMap propertyMap;
159 bool validDBusConnection = true;
160};
161
163{
164public:
165 PropertiesDBusInterface(const QString &service, const QString &path, const QString &interface,
166 const QDBusConnection &connection, QObject *parent = nullptr)
168 {
169 }
170};
171
172QT_END_NAMESPACE
173
174#endif
PropertiesDBusInterface(const QString &service, const QString &path, const QString &interface, const QDBusConnection &connection, QObject *parent=nullptr)
void setBackend(QNetworkManagerNetworkInformationBackend *ourBackend)
NMConnectivityState connectivityState() const
QNetworkManagerInterface(QObject *parent=nullptr)
QString name() const override
Backend name, return the same in QNetworkInformationBackend::name().
QNetworkInformationBackend * create(QNetworkInformation::Features requiredFeatures) const override
Create and return an instance of QNetworkInformationBackend.
QNetworkInformation::Features featuresSupported() const override
Features supported, return the same in QNetworkInformationBackend::featuresSupported().
void onStateChanged(QNetworkManagerInterface::NMState state)
QString name() const override
Backend name, return the same in QNetworkInformationBackendFactory::name().
void onMeteredChanged(QNetworkManagerInterface::NMMetered metered)
void onConnectivityChanged(QNetworkManagerInterface::NMConnectivityState connectivityState)
void onDeviceTypeChanged(QNetworkManagerInterface::NMDeviceType deviceType)
QNetworkInformation::Features featuresSupported() const override
Features supported, return the same in QNetworkInformationBackendFactory::featuresSupported().
@ NM_DEVICE_STATE_ACTIVATED
@ NM_DEVICE_STATE_UNMANAGED
@ NM_DEVICE_STATE_FAILED
@ NM_DEVICE_STATE_IP_CONFIG
@ NM_DEVICE_STATE_PREPARE
@ NM_DEVICE_STATE_DEACTIVATING
@ NM_DEVICE_STATE_CONFIG
@ NM_DEVICE_STATE_UNAVAILABLE
@ NM_DEVICE_STATE_NEED_AUTH
@ NM_DEVICE_STATE_DISCONNECTED
@ NM_DEVICE_STATE_UNKNOWN