ModemManagerQt

bearer.h
1/*
2 SPDX-FileCopyrightText: 2013 Lukas Tinkl <ltinkl@redhat.com>
3 SPDX-FileCopyrightText: 2013-2015 Jan Grulich <jgrulich@redhat.com>
4
5 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
6*/
7
8#ifndef MODEMMANAGERQT_BEARER_H
9#define MODEMMANAGERQT_BEARER_H
10
11#include <modemmanagerqt_export.h>
12
13#include <QObject>
14#include <QSharedPointer>
15
16#include <QDBusPendingReply>
17
18#include "generictypes.h"
19
20namespace ModemManager
21{
22class BearerPrivate;
23
24/**
25 * This class represents IP configuration
26 */
27class MODEMMANAGERQT_EXPORT IpConfig
28{
29public:
30 /**
31 * Constructs an empty IP config object
32 */
33 IpConfig();
34
35 /**
36 * Destroys this IpConfig object.
37 */
38 ~IpConfig();
39
40 /**
41 * Constructs an IpConfig object that is a copy of the object @p other.
42 */
43 IpConfig(const IpConfig &other);
44
45 /**
46 * Returns the MMBearerIpMethod
47 */
48 MMBearerIpMethod method() const;
49
50 /**
51 * Sets the MMBearerIpMethod
52 */
53 void setMethod(MMBearerIpMethod method);
54
55 /**
56 * Returns the IP address
57 */
58 QString address() const;
59
60 /**
61 * Sets the IP address
62 */
63 void setAddress(const QString &address);
64
65 /**
66 * Returns the numeric CIDR network prefix (ie, 24, 32, etc)
67 */
68 uint prefix() const;
69
70 /**
71 * Sets the numeric CIDR network prefix
72 */
73 void setPrefix(uint prefix);
74
75 /**
76 * Returns the IP address of the first DNS server
77 */
78 QString dns1() const;
79
80 /**
81 * Sets the IP address of the first DNS server
82 */
83 void setDns1(const QString &dns1);
84
85 /**
86 * Returns the IP address of the second DNS server
87 */
88 QString dns2() const;
89
90 /**
91 * Sets the IP address of the second DNS server
92 */
93 void setDns2(const QString &dns2);
94
95 /**
96 * Returns the IP address of the third DNS server
97 */
98 QString dns3() const;
99
100 /**
101 * Sets the IP address of the third DNS server
102 */
103 void setDns3(const QString &dns3);
104
105 /**
106 * Returns the IP address of the default gateway
107 */
108 QString gateway() const;
109
110 /**
111 * Sets the IP address of the default gateway
112 */
113 void setGateway(const QString &gateway);
114
115 /**
116 * Makes a copy of the IpConfig object @p other.
117 */
118 IpConfig &operator=(const IpConfig &other);
119
120private:
121 class Private;
122 Private *const d;
123};
124
125/**
126 * @brief The Bearer class
127 *
128 * This class provides access to specific actions that may be performed on available bearers.
129 */
130class MODEMMANAGERQT_EXPORT Bearer : public QObject
131{
132 Q_OBJECT
133public:
135 typedef QList<Ptr> List;
136
137 explicit Bearer(const QString &path, QObject *parent = nullptr);
138 ~Bearer() override;
139
140 /**
141 * @return the operating system name for the network data interface that
142 * provides packet data using this bearer.
143 *
144 * Connection managers must configure this interface depending on the IP
145 * "method" given by the ip4Config() or ip6Config() properties set by bearer
146 * activation.
147 *
148 * If MM_BEARER_IP_METHOD_STATIC or MM_BEARER_IP_METHOD_DHCP methods are
149 * given, the interface will be an ethernet-style interface suitable for DHCP
150 * or setting static IP configuration on, while if the
151 * MM_BEARER_IP_METHOD_PPP method is given, the interface will be a serial
152 * TTY which must then have PPP run over it.
153 *
154 */
155 QString interface() const;
156
157 /**
158 * @return whether or not the bearer is connected and thus whether packet
159 * data communication using this bearer is possible.
160 */
161 bool isConnected() const;
162
163 /**
164 * In some devices, packet data service will be suspended while the device
165 * is handling other communication, like a voice call. If packet data
166 * service is suspended (but not deactivated) this property will be @p true
167 */
168 bool isSuspended() const;
169
170 /**
171 * If the bearer was configured for IPv4 addressing, upon activation
172 * this property contains the addressing details for assignment to the data
173 * interface.
174 */
175 IpConfig ip4Config() const;
176
177 /**
178 * If the bearer was configured for IPv6 addressing, upon activation this
179 * property contains the addressing details for assignment to the data
180 * interface.
181 */
182 IpConfig ip6Config() const;
183
184 /**
185 * @return maximum time to wait for a successful IP establishment, when PPP is used.
186 */
187 uint ipTimeout() const;
188
189 /**
190 * @return map of properties used when creating the bearer
191 * @see IpConfig
192 */
193 QVariantMap properties() const;
194
195 /**
196 * Requests activation of a packet data connection with the network using
197 * this bearer's properties. Upon successful activation, the modem can send
198 * and receive packet data and, depending on the addressing capability of
199 * the modem, a connection manager may need to start PPP, perform DHCP, or
200 * assign the IP address returned by the modem to the data interface. Upon
201 * successful return, the ip4Config() and/or ip6Config() properties become
202 * valid and may contain IP configuration information for the data interface
203 * associated with this bearer.
204 */
205 QDBusPendingReply<void> connectBearer();
206
207 /**
208 * Disconnect and deactivate this packet data connection.
209 *
210 * Any ongoing data session will be terminated and IP addresses become invalid when this method is called.
211 */
212 QDBusPendingReply<void> disconnectBearer();
213
214 /**
215 * Sets the timeout in milliseconds for all async method DBus calls.
216 * -1 means the default DBus timeout (usually 25 seconds).
217 */
218 void setTimeout(int timeout);
219
220 /**
221 * Returns the current value of the DBus timeout in milliseconds.
222 * -1 means the default DBus timeout (usually 25 seconds).
223 */
224 int timeout() const;
225
226 /**
227 * @return the DBUS path (uni) to the object
228 */
229 QString uni() const;
230
231Q_SIGNALS:
232 void interfaceChanged(const QString &iface);
233 void connectedChanged(bool connected);
234 void suspendedChanged(bool suspended);
235 void ip4ConfigChanged(const ModemManager::IpConfig &ipv4Config);
236 void ip6ConfigChanged(const ModemManager::IpConfig &ipv6Config);
237 void ipTimeoutChanged(uint ipTimeout);
238 void propertiesChanged(const QVariantMap &properties);
239
240private:
241 Q_DECLARE_PRIVATE(Bearer)
242 BearerPrivate *const d_ptr;
243};
244
245} // namespace ModemManager
246
247Q_DECLARE_METATYPE(ModemManager::IpConfig)
248
249#endif
The Bearer class.
Definition bearer.h:131
This class represents IP configuration.
Definition bearer.h:28
This namespace allows to query the underlying system to discover the available modem interfaces respo...
Definition bearer.cpp:20
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:07:54 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.