Warning, file /frameworks/modemmanager-qt/src/bearer.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 SPDX-FileCopyrightText: 2013 Lukas Tinkl <ltinkl@redhat.com> 0003 SPDX-FileCopyrightText: 2013-2015 Jan Grulich <jgrulich@redhat.com> 0004 0005 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0006 */ 0007 0008 #ifndef MODEMMANAGERQT_BEARER_H 0009 #define MODEMMANAGERQT_BEARER_H 0010 0011 #include <modemmanagerqt_export.h> 0012 0013 #include <QObject> 0014 #include <QSharedPointer> 0015 0016 #include "generictypes.h" 0017 0018 namespace ModemManager 0019 { 0020 class BearerPrivate; 0021 0022 /** 0023 * This class represents IP configuration 0024 */ 0025 class MODEMMANAGERQT_EXPORT IpConfig 0026 { 0027 public: 0028 /** 0029 * Constructs an empty IP config object 0030 */ 0031 IpConfig(); 0032 0033 /** 0034 * Destroys this IpConfig object. 0035 */ 0036 ~IpConfig(); 0037 0038 /** 0039 * Constructs an IpConfig object that is a copy of the object @p other. 0040 */ 0041 IpConfig(const IpConfig &other); 0042 0043 /** 0044 * Returns the MMBearerIpMethod 0045 */ 0046 MMBearerIpMethod method() const; 0047 0048 /** 0049 * Sets the MMBearerIpMethod 0050 */ 0051 void setMethod(MMBearerIpMethod method); 0052 0053 /** 0054 * Returns the IP address 0055 */ 0056 QString address() const; 0057 0058 /** 0059 * Sets the IP address 0060 */ 0061 void setAddress(const QString &address); 0062 0063 /** 0064 * Returns the numeric CIDR network prefix (ie, 24, 32, etc) 0065 */ 0066 uint prefix() const; 0067 0068 /** 0069 * Sets the numeric CIDR network prefix 0070 */ 0071 void setPrefix(uint prefix); 0072 0073 /** 0074 * Returns the IP address of the first DNS server 0075 */ 0076 QString dns1() const; 0077 0078 /** 0079 * Sets the IP address of the first DNS server 0080 */ 0081 void setDns1(const QString &dns1); 0082 0083 /** 0084 * Returns the IP address of the second DNS server 0085 */ 0086 QString dns2() const; 0087 0088 /** 0089 * Sets the IP address of the second DNS server 0090 */ 0091 void setDns2(const QString &dns2); 0092 0093 /** 0094 * Returns the IP address of the third DNS server 0095 */ 0096 QString dns3() const; 0097 0098 /** 0099 * Sets the IP address of the third DNS server 0100 */ 0101 void setDns3(const QString &dns3); 0102 0103 /** 0104 * Returns the IP address of the default gateway 0105 */ 0106 QString gateway() const; 0107 0108 /** 0109 * Sets the IP address of the default gateway 0110 */ 0111 void setGateway(const QString &gateway); 0112 0113 /** 0114 * Makes a copy of the IpConfig object @p other. 0115 */ 0116 IpConfig &operator=(const IpConfig &other); 0117 0118 private: 0119 class Private; 0120 Private *const d; 0121 }; 0122 0123 /** 0124 * @brief The Bearer class 0125 * 0126 * This class provides access to specific actions that may be performed on available bearers. 0127 */ 0128 class MODEMMANAGERQT_EXPORT Bearer : public QObject 0129 { 0130 Q_OBJECT 0131 public: 0132 typedef QSharedPointer<Bearer> Ptr; 0133 typedef QList<Ptr> List; 0134 0135 explicit Bearer(const QString &path, QObject *parent = nullptr); 0136 ~Bearer() override; 0137 0138 /** 0139 * @return the operating system name for the network data interface that 0140 * provides packet data using this bearer. 0141 * 0142 * Connection managers must configure this interface depending on the IP 0143 * "method" given by the ip4Config() or ip6Config() properties set by bearer 0144 * activation. 0145 * 0146 * If MM_BEARER_IP_METHOD_STATIC or MM_BEARER_IP_METHOD_DHCP methods are 0147 * given, the interface will be an ethernet-style interface suitable for DHCP 0148 * or setting static IP configuration on, while if the 0149 * MM_BEARER_IP_METHOD_PPP method is given, the interface will be a serial 0150 * TTY which must then have PPP run over it. 0151 * 0152 */ 0153 QString interface() const; 0154 0155 /** 0156 * @return whether or not the bearer is connected and thus whether packet 0157 * data communication using this bearer is possible. 0158 */ 0159 bool isConnected() const; 0160 0161 /** 0162 * In some devices, packet data service will be suspended while the device 0163 * is handling other communication, like a voice call. If packet data 0164 * service is suspended (but not deactivated) this property will be @p true 0165 */ 0166 bool isSuspended() const; 0167 0168 /** 0169 * If the bearer was configured for IPv4 addressing, upon activation 0170 * this property contains the addressing details for assignment to the data 0171 * interface. 0172 */ 0173 IpConfig ip4Config() const; 0174 0175 /** 0176 * If the bearer was configured for IPv6 addressing, upon activation this 0177 * property contains the addressing details for assignment to the data 0178 * interface. 0179 */ 0180 IpConfig ip6Config() const; 0181 0182 /** 0183 * @return maximum time to wait for a successful IP establishment, when PPP is used. 0184 */ 0185 uint ipTimeout() const; 0186 0187 /** 0188 * @return map of properties used when creating the bearer 0189 * @see IpConfig 0190 */ 0191 QVariantMap properties() const; 0192 0193 /** 0194 * Requests activation of a packet data connection with the network using 0195 * this bearer's properties. Upon successful activation, the modem can send 0196 * and receive packet data and, depending on the addressing capability of 0197 * the modem, a connection manager may need to start PPP, perform DHCP, or 0198 * assign the IP address returned by the modem to the data interface. Upon 0199 * successful return, the ip4Config() and/or ip6Config() properties become 0200 * valid and may contain IP configuration information for the data interface 0201 * associated with this bearer. 0202 */ 0203 QDBusPendingReply<void> connectBearer(); 0204 0205 /** 0206 * Disconnect and deactivate this packet data connection. 0207 * 0208 * Any ongoing data session will be terminated and IP addresses become invalid when this method is called. 0209 */ 0210 QDBusPendingReply<void> disconnectBearer(); 0211 0212 /** 0213 * Sets the timeout in milliseconds for all async method DBus calls. 0214 * -1 means the default DBus timeout (usually 25 seconds). 0215 */ 0216 void setTimeout(int timeout); 0217 0218 /** 0219 * Returns the current value of the DBus timeout in milliseconds. 0220 * -1 means the default DBus timeout (usually 25 seconds). 0221 */ 0222 int timeout() const; 0223 0224 /** 0225 * @return the DBUS path (uni) to the object 0226 */ 0227 QString uni() const; 0228 0229 Q_SIGNALS: 0230 void interfaceChanged(const QString &iface); 0231 void connectedChanged(bool connected); 0232 void suspendedChanged(bool suspended); 0233 void ip4ConfigChanged(const ModemManager::IpConfig &ipv4Config); 0234 void ip6ConfigChanged(const ModemManager::IpConfig &ipv6Config); 0235 void ipTimeoutChanged(uint ipTimeout); 0236 void propertiesChanged(const QVariantMap &properties); 0237 0238 private: 0239 Q_DECLARE_PRIVATE(Bearer) 0240 BearerPrivate *const d_ptr; 0241 }; 0242 0243 } // namespace ModemManager 0244 0245 Q_DECLARE_METATYPE(ModemManager::IpConfig) 0246 0247 #endif