1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the plugins of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40#ifndef QOFONOSERVICE_H
41#define QOFONOSERVICE_H
42
43//
44// W A R N I N G
45// -------------
46//
47// This file is not part of the Qt API. It exists purely as an
48// implementation detail. This header file may change from version to
49// version without notice, or even be removed.
50//
51// We mean it.
52//
53
54#include <QtDBus/QtDBus>
55#include <QtDBus/QDBusConnection>
56#include <QtDBus/QDBusError>
57#include <QtDBus/QDBusInterface>
58#include <QtDBus/QDBusMessage>
59#include <QtDBus/QDBusReply>
60
61#include <QtDBus/QDBusPendingCallWatcher>
62#include <QtDBus/QDBusObjectPath>
63#include <QtDBus/QDBusContext>
64#include <QMap>
65
66#ifndef QT_NO_DBUS
67
68#define OFONO_SERVICE "org.ofono"
69#define OFONO_MANAGER_INTERFACE "org.ofono.Manager"
70#define OFONO_MANAGER_PATH "/"
71
72#define OFONO_MODEM_INTERFACE "org.ofono.Modem"
73#define OFONO_NETWORK_REGISTRATION_INTERFACE "org.ofono.NetworkRegistration"
74#define OFONO_DATA_CONNECTION_MANAGER_INTERFACE "org.ofono.ConnectionManager"
75#define OFONO_CONNECTION_CONTEXT_INTERFACE "org.ofono.ConnectionContext"
76
77QT_BEGIN_NAMESPACE
78
79QT_END_NAMESPACE
80
81struct ObjectPathProperties
82{
83 QDBusObjectPath path;
84 QVariantMap properties;
85};
86QT_BEGIN_NAMESPACE
87Q_DECLARE_TYPEINFO(ObjectPathProperties, Q_MOVABLE_TYPE); // QDBusObjectPath is movable, but cannot be
88 // marked as such until Qt 6
89QT_END_NAMESPACE
90
91typedef QVector<ObjectPathProperties> PathPropertiesList;
92Q_DECLARE_METATYPE(ObjectPathProperties)
93Q_DECLARE_METATYPE (PathPropertiesList)
94
95QT_BEGIN_NAMESPACE
96
97class QOfonoManagerInterface : public QDBusAbstractInterface
98{
99 Q_OBJECT
100
101public:
102
103 QOfonoManagerInterface( QObject *parent = nullptr);
104 ~QOfonoManagerInterface();
105
106 QStringList getModems();
107 QString currentModem();
108signals:
109 void modemChanged();
110private:
111 QStringList modemList;
112private slots:
113 void modemAdded(const QDBusObjectPath &path, const QVariantMap &var);
114 void modemRemoved(const QDBusObjectPath &path);
115};
116
117class QOfonoModemInterface : public QDBusAbstractInterface
118{
119 Q_OBJECT
120
121public:
122
123 explicit QOfonoModemInterface(const QString &dbusModemPathName, QObject *parent = nullptr);
124 ~QOfonoModemInterface();
125
126 bool isPowered();
127 bool isOnline();
128 QStringList interfaces();
129private:
130 QVariantMap getProperties();
131 QVariantMap propertiesMap;
132 QVariant getProperty(const QString &);
133 void propertyChanged(const QString &, const QDBusVariant &value);
134};
135
136
137class QOfonoNetworkRegistrationInterface : public QDBusAbstractInterface
138{
139 Q_OBJECT
140
141public:
142
143 explicit QOfonoNetworkRegistrationInterface(const QString &dbusModemPathName, QObject *parent = nullptr);
144 ~QOfonoNetworkRegistrationInterface();
145
146 QString getTechnology();
147
148private:
149 QVariantMap getProperties();
150 QVariant getProperty(const QString &);
151 QVariantMap propertiesMap;
152Q_SIGNALS:
153 void propertyChanged(const QString &, const QDBusVariant &value);
154};
155
156class QOfonoDataConnectionManagerInterface : public QDBusAbstractInterface
157{
158 Q_OBJECT
159
160public:
161
162 explicit QOfonoDataConnectionManagerInterface(const QString &dbusPathName, QObject *parent = nullptr);
163 ~QOfonoDataConnectionManagerInterface();
164
165 QStringList contexts();
166 PathPropertiesList contextsWithProperties();
167 bool roamingAllowed();
168 QVariant getProperty(const QString &);
169 QString bearer();
170Q_SIGNALS:
171 void roamingAllowedChanged(bool);
172private:
173 QVariantMap &getProperties();
174 QVariantMap propertiesMap;
175 QStringList contextList;
176 PathPropertiesList contextListProperties;
177private Q_SLOTS:
178 void propertyChanged(const QString &, const QDBusVariant &value);
179};
180
181class QOfonoConnectionContextInterface : public QDBusAbstractInterface
182{
183 Q_OBJECT
184
185public:
186
187 explicit QOfonoConnectionContextInterface(const QString &dbusPathName, QObject *parent = nullptr);
188 ~QOfonoConnectionContextInterface();
189
190 QVariant getProperty(const QString &);
191 bool active();
192 QString accessPointName();
193 QString name();
194
195Q_SIGNALS:
196private:
197 QVariantMap getProperties();
198 QVariantMap propertiesMap;
199private slots:
200 void propertyChanged(const QString &, const QDBusVariant &value);
201};
202
203QT_END_NAMESPACE
204
205#endif // QT_NO_DBUS
206
207#endif //QOFONOSERVICE_H
208

source code of qtbase/src/plugins/bearer/linux_common/qofonoservice_linux_p.h