| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/network/bearer/qnetworkconfiguration.cpp |
| Source code | Switch to Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | /**************************************************************************** | - | ||||||||||||
| 2 | ** | - | ||||||||||||
| 3 | ** Copyright (C) 2015 The Qt Company Ltd. | - | ||||||||||||
| 4 | ** Contact: http://www.qt.io/licensing/ | - | ||||||||||||
| 5 | ** | - | ||||||||||||
| 6 | ** This file is part of the QtNetwork module of the Qt Toolkit. | - | ||||||||||||
| 7 | ** | - | ||||||||||||
| 8 | ** $QT_BEGIN_LICENSE:LGPL21$ | - | ||||||||||||
| 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 http://www.qt.io/terms-conditions. For further | - | ||||||||||||
| 15 | ** information use the contact form at http://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 2.1 or version 3 as published by the Free | - | ||||||||||||
| 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and | - | ||||||||||||
| 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the | - | ||||||||||||
| 22 | ** following information to ensure the GNU Lesser General Public License | - | ||||||||||||
| 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and | - | ||||||||||||
| 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - | ||||||||||||
| 25 | ** | - | ||||||||||||
| 26 | ** As a special exception, The Qt Company gives you certain additional | - | ||||||||||||
| 27 | ** rights. These rights are described in The Qt Company LGPL Exception | - | ||||||||||||
| 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - | ||||||||||||
| 29 | ** | - | ||||||||||||
| 30 | ** $QT_END_LICENSE$ | - | ||||||||||||
| 31 | ** | - | ||||||||||||
| 32 | ****************************************************************************/ | - | ||||||||||||
| 33 | - | |||||||||||||
| 34 | #include "qnetworkconfiguration.h" | - | ||||||||||||
| 35 | #include "qnetworkconfiguration_p.h" | - | ||||||||||||
| 36 | #include <QDebug> | - | ||||||||||||
| 37 | - | |||||||||||||
| 38 | #ifdef Q_OS_BLACKBERRY | - | ||||||||||||
| 39 | #include "private/qcore_unix_p.h" // qt_safe_open | - | ||||||||||||
| 40 | #include <sys/pps.h> | - | ||||||||||||
| 41 | #endif // Q_OS_BLACKBERRY | - | ||||||||||||
| 42 | - | |||||||||||||
| 43 | QT_BEGIN_NAMESPACE | - | ||||||||||||
| 44 | - | |||||||||||||
| 45 | /*! | - | ||||||||||||
| 46 | \class QNetworkConfiguration | - | ||||||||||||
| 47 | - | |||||||||||||
| 48 | \brief The QNetworkConfiguration class provides an abstraction of one or more access point configurations. | - | ||||||||||||
| 49 | - | |||||||||||||
| 50 | \since 4.7 | - | ||||||||||||
| 51 | - | |||||||||||||
| 52 | \inmodule QtNetwork | - | ||||||||||||
| 53 | \ingroup network | - | ||||||||||||
| 54 | \ingroup shared | - | ||||||||||||
| 55 | - | |||||||||||||
| 56 | QNetworkConfiguration encapsulates a single access point or service network. | - | ||||||||||||
| 57 | In most cases a single access point configuration can be mapped to one network | - | ||||||||||||
| 58 | interface. However a single network interface may not always map to only one | - | ||||||||||||
| 59 | access point configuration. Multiple configurations for the same | - | ||||||||||||
| 60 | network device may enable multiple access points. An example | - | ||||||||||||
| 61 | device that could exhibit such a configuration might be a | - | ||||||||||||
| 62 | Smartphone which allows the user to manage multiple WLAN | - | ||||||||||||
| 63 | configurations while the device itself has only one WLAN network device. | - | ||||||||||||
| 64 | - | |||||||||||||
| 65 | The QNetworkConfiguration also supports the concept of service networks. | - | ||||||||||||
| 66 | This concept allows the grouping of multiple access point configurations | - | ||||||||||||
| 67 | into one entity. Such a group is called service network and can be | - | ||||||||||||
| 68 | beneficial in cases whereby a network session to a | - | ||||||||||||
| 69 | particular destination network is required (e.g. a company network). | - | ||||||||||||
| 70 | When using a service network the user doesn't usually care which one of the | - | ||||||||||||
| 71 | connectivity options is chosen (e.g. corporate WLAN or VPN via GPRS) | - | ||||||||||||
| 72 | as long as he can reach the company's target server. Depending | - | ||||||||||||
| 73 | on the current position and time some of the access points that make | - | ||||||||||||
| 74 | up the service network may not even be available. Furthermore | - | ||||||||||||
| 75 | automated access point roaming can be enabled which enables the device | - | ||||||||||||
| 76 | to change the network interface configuration dynamically while maintaining | - | ||||||||||||
| 77 | the applications connection to the target network. It allows adaption | - | ||||||||||||
| 78 | to the changing environment and may enable optimization with regards to | - | ||||||||||||
| 79 | cost, speed or other network parameters. | - | ||||||||||||
| 80 | - | |||||||||||||
| 81 | Special configurations of type UserChoice provide a placeholder configuration which is | - | ||||||||||||
| 82 | resolved to an actual network configuration by the platform when a | - | ||||||||||||
| 83 | \l {QNetworkSession}{session} is \l {QNetworkSession::open()}{opened}. Not all platforms | - | ||||||||||||
| 84 | support the concept of a user choice configuration. | - | ||||||||||||
| 85 | - | |||||||||||||
| 86 | \section1 Configuration States | - | ||||||||||||
| 87 | - | |||||||||||||
| 88 | The list of available configurations can be obtained via | - | ||||||||||||
| 89 | QNetworkConfigurationManager::allConfigurations(). A configuration can have | - | ||||||||||||
| 90 | multiple states. The \l Defined configuration state indicates that the configuration | - | ||||||||||||
| 91 | is stored on the device. However the configuration is not yet ready to be activated | - | ||||||||||||
| 92 | as e.g. a WLAN may not be available at the current time. | - | ||||||||||||
| 93 | - | |||||||||||||
| 94 | The \l Discovered state implies that the configuration is \l Defined and | - | ||||||||||||
| 95 | the outside conditions are such that the configuration can be used immediately | - | ||||||||||||
| 96 | to open a new network session. An example of such an outside condition may be | - | ||||||||||||
| 97 | that the Ethernet cable is actually connected to the device or that the WLAN | - | ||||||||||||
| 98 | with the specified SSID is in range. | - | ||||||||||||
| 99 | - | |||||||||||||
| 100 | The \l Active state implies that the configuration is \l Discovered. A configuration | - | ||||||||||||
| 101 | in this state is currently being used by an application. The underlying network | - | ||||||||||||
| 102 | interface has a valid IP configuration and can transfer IP packets between the | - | ||||||||||||
| 103 | device and the target network. | - | ||||||||||||
| 104 | - | |||||||||||||
| 105 | The \l Undefined state indicates that the system has knowledge of possible target | - | ||||||||||||
| 106 | networks but cannot actually use that knowledge to connect to it. An example | - | ||||||||||||
| 107 | for such a state could be an encrypted WLAN that has been discovered | - | ||||||||||||
| 108 | but the user hasn't actually saved a configuration including the required password | - | ||||||||||||
| 109 | which would allow the device to connect to it. | - | ||||||||||||
| 110 | - | |||||||||||||
| 111 | Depending on the type of configuration some states are transient in nature. A GPRS/UMTS | - | ||||||||||||
| 112 | connection may almost always be \l Discovered if the GSM/UMTS network is available. | - | ||||||||||||
| 113 | However if the GSM/UMTS network looses the connection the associated configuration may change its state | - | ||||||||||||
| 114 | from \l Discovered to \l Defined as well. A similar use case might be triggered by | - | ||||||||||||
| 115 | WLAN availability. QNetworkConfigurationManager::updateConfigurations() can be used to | - | ||||||||||||
| 116 | manually trigger updates of states. Note that some platforms do not require such updates | - | ||||||||||||
| 117 | as they implicitly change the state once it has been discovered. If the state of a | - | ||||||||||||
| 118 | configuration changes all related QNetworkConfiguration instances change their state automatically. | - | ||||||||||||
| 119 | - | |||||||||||||
| 120 | \sa QNetworkSession, QNetworkConfigurationManager | - | ||||||||||||
| 121 | */ | - | ||||||||||||
| 122 | - | |||||||||||||
| 123 | /*! | - | ||||||||||||
| 124 | \enum QNetworkConfiguration::Type | - | ||||||||||||
| 125 | - | |||||||||||||
| 126 | This enum describes the type of configuration. | - | ||||||||||||
| 127 | - | |||||||||||||
| 128 | \value InternetAccessPoint The configuration specifies the details for a single access point. | - | ||||||||||||
| 129 | Note that configurations of type InternetAccessPoint may be part | - | ||||||||||||
| 130 | of other QNetworkConfigurations of type ServiceNetwork. | - | ||||||||||||
| 131 | \value ServiceNetwork The configuration is based on a group of QNetworkConfigurations of | - | ||||||||||||
| 132 | type InternetAccessPoint. All group members can reach the same | - | ||||||||||||
| 133 | target network. This type of configuration is a mandatory | - | ||||||||||||
| 134 | requirement for roaming enabled network sessions. On some | - | ||||||||||||
| 135 | platforms this form of configuration may also be called Service | - | ||||||||||||
| 136 | Network Access Point (SNAP). | - | ||||||||||||
| 137 | \value UserChoice The configuration is a placeholder which will be resolved to an | - | ||||||||||||
| 138 | actual configuration by the platform when a session is opened. Depending | - | ||||||||||||
| 139 | on the platform the selection may generate a popup dialog asking the user | - | ||||||||||||
| 140 | for his preferred choice. | - | ||||||||||||
| 141 | \value Invalid The configuration is invalid. | - | ||||||||||||
| 142 | */ | - | ||||||||||||
| 143 | - | |||||||||||||
| 144 | /*! | - | ||||||||||||
| 145 | \enum QNetworkConfiguration::StateFlag | - | ||||||||||||
| 146 | - | |||||||||||||
| 147 | Specifies the configuration states. | - | ||||||||||||
| 148 | - | |||||||||||||
| 149 | \value Undefined This state is used for transient configurations such as newly discovered | - | ||||||||||||
| 150 | WLANs for which the user has not actually created a configuration yet. | - | ||||||||||||
| 151 | \value Defined Defined configurations are known to the system but are not immediately | - | ||||||||||||
| 152 | usable (e.g. a configured WLAN is not within range or the Ethernet cable | - | ||||||||||||
| 153 | is currently not plugged into the machine). | - | ||||||||||||
| 154 | \value Discovered A discovered configuration can be immediately used to create a new | - | ||||||||||||
| 155 | QNetworkSession. An example of a discovered configuration could be a WLAN | - | ||||||||||||
| 156 | which is within in range. If the device moves out of range the discovered | - | ||||||||||||
| 157 | flag is dropped. A second example is a GPRS configuration which generally | - | ||||||||||||
| 158 | remains discovered for as long as the device has network coverage. A | - | ||||||||||||
| 159 | configuration that has this state is also in state | - | ||||||||||||
| 160 | QNetworkConfiguration::Defined. If the configuration is a service network | - | ||||||||||||
| 161 | this flag is set if at least one of the underlying access points | - | ||||||||||||
| 162 | configurations has the Discovered state. | - | ||||||||||||
| 163 | \value Active The configuration is currently used by an open network session | - | ||||||||||||
| 164 | (see \l QNetworkSession::isOpen()). However this does not mean that the | - | ||||||||||||
| 165 | current process is the entity that created the open session. It merely | - | ||||||||||||
| 166 | indicates that if a new QNetworkSession were to be constructed based on | - | ||||||||||||
| 167 | this configuration \l QNetworkSession::state() would return | - | ||||||||||||
| 168 | \l QNetworkSession::Connected. This state implies the | - | ||||||||||||
| 169 | QNetworkConfiguration::Discovered state. | - | ||||||||||||
| 170 | */ | - | ||||||||||||
| 171 | - | |||||||||||||
| 172 | /*! | - | ||||||||||||
| 173 | \enum QNetworkConfiguration::Purpose | - | ||||||||||||
| 174 | - | |||||||||||||
| 175 | Specifies the purpose of the configuration. | - | ||||||||||||
| 176 | - | |||||||||||||
| 177 | \value UnknownPurpose The configuration doesn't specify any purpose. This is the default value. | - | ||||||||||||
| 178 | \value PublicPurpose The configuration can be used for general purpose internet access. | - | ||||||||||||
| 179 | \value PrivatePurpose The configuration is suitable to access a private network such as an office Intranet. | - | ||||||||||||
| 180 | \value ServiceSpecificPurpose The configuration can be used for operator specific services (e.g. | - | ||||||||||||
| 181 | receiving MMS messages or content streaming). | - | ||||||||||||
| 182 | */ | - | ||||||||||||
| 183 | - | |||||||||||||
| 184 | /*! | - | ||||||||||||
| 185 | \enum QNetworkConfiguration::BearerType | - | ||||||||||||
| 186 | - | |||||||||||||
| 187 | Specifies the type of bearer used by a configuration. | - | ||||||||||||
| 188 | - | |||||||||||||
| 189 | \value BearerUnknown The type of bearer is unknown or unspecified. The bearerTypeName() | - | ||||||||||||
| 190 | function may return additional information. | - | ||||||||||||
| 191 | \value BearerEthernet The configuration is for an Ethernet interfaces. | - | ||||||||||||
| 192 | \value BearerWLAN The configuration is for a Wireless LAN interface. | - | ||||||||||||
| 193 | \value Bearer2G The configuration is for a CSD, GPRS, HSCSD, EDGE or cdmaOne interface. | - | ||||||||||||
| 194 | \value Bearer3G The configuration is for a 3G interface. | - | ||||||||||||
| 195 | \value Bearer4G The configuration is for a 4G interface. | - | ||||||||||||
| 196 | \value BearerCDMA2000 The configuration is for CDMA interface. | - | ||||||||||||
| 197 | \value BearerWCDMA The configuration is for W-CDMA/UMTS interface. | - | ||||||||||||
| 198 | \value BearerHSPA The configuration is for High Speed Packet Access (HSPA) interface. | - | ||||||||||||
| 199 | \value BearerBluetooth The configuration is for a Bluetooth interface. | - | ||||||||||||
| 200 | \value BearerWiMAX The configuration is for a WiMAX interface. | - | ||||||||||||
| 201 | \value BearerEVDO The configuration is for an EVDO (3G) interface. | - | ||||||||||||
| 202 | \value BearerLTE The configuration is for a LTE (4G) interface. | - | ||||||||||||
| 203 | */ | - | ||||||||||||
| 204 | - | |||||||||||||
| 205 | #ifdef Q_OS_BLACKBERRY | - | ||||||||||||
| 206 | static const char cellularStatusFile[] = "/pps/services/radioctrl/modem0/status_public"; | - | ||||||||||||
| 207 | - | |||||||||||||
| 208 | static QNetworkConfiguration::BearerType cellularStatus() | - | ||||||||||||
| 209 | { | - | ||||||||||||
| 210 | QNetworkConfiguration::BearerType ret = QNetworkConfiguration::BearerUnknown; | - | ||||||||||||
| 211 | - | |||||||||||||
| 212 | int cellularStatusFD; | - | ||||||||||||
| 213 | if ((cellularStatusFD = qt_safe_open(cellularStatusFile, O_RDONLY)) == -1) { | - | ||||||||||||
| 214 | qWarning() << "failed to open" << cellularStatusFile; | - | ||||||||||||
| 215 | return ret; | - | ||||||||||||
| 216 | } | - | ||||||||||||
| 217 | char buf[2048]; | - | ||||||||||||
| 218 | if (qt_safe_read(cellularStatusFD, &buf, sizeof(buf)) == -1) { | - | ||||||||||||
| 219 | qWarning() << "read from PPS file failed:" << strerror(errno); | - | ||||||||||||
| 220 | qt_safe_close(cellularStatusFD); | - | ||||||||||||
| 221 | return ret; | - | ||||||||||||
| 222 | } | - | ||||||||||||
| 223 | pps_decoder_t ppsDecoder; | - | ||||||||||||
| 224 | if (pps_decoder_initialize(&ppsDecoder, buf) != PPS_DECODER_OK) { | - | ||||||||||||
| 225 | qWarning("failed to initialize PPS decoder"); | - | ||||||||||||
| 226 | qt_safe_close(cellularStatusFD); | - | ||||||||||||
| 227 | return ret; | - | ||||||||||||
| 228 | } | - | ||||||||||||
| 229 | pps_decoder_error_t err; | - | ||||||||||||
| 230 | if ((err = pps_decoder_push(&ppsDecoder, 0)) != PPS_DECODER_OK) { | - | ||||||||||||
| 231 | qWarning() << "pps_decoder_push failed" << err; | - | ||||||||||||
| 232 | pps_decoder_cleanup(&ppsDecoder); | - | ||||||||||||
| 233 | qt_safe_close(cellularStatusFD); | - | ||||||||||||
| 234 | return ret; | - | ||||||||||||
| 235 | } | - | ||||||||||||
| 236 | if (!pps_decoder_is_integer(&ppsDecoder, "network_technology")) { | - | ||||||||||||
| 237 | qWarning("field has not the expected data type"); | - | ||||||||||||
| 238 | pps_decoder_cleanup(&ppsDecoder); | - | ||||||||||||
| 239 | qt_safe_close(cellularStatusFD); | - | ||||||||||||
| 240 | return ret; | - | ||||||||||||
| 241 | } | - | ||||||||||||
| 242 | int type; | - | ||||||||||||
| 243 | if (!pps_decoder_get_int(&ppsDecoder, "network_technology", &type) | - | ||||||||||||
| 244 | == PPS_DECODER_OK) { | - | ||||||||||||
| 245 | qWarning("could not read bearer type from PPS"); | - | ||||||||||||
| 246 | pps_decoder_cleanup(&ppsDecoder); | - | ||||||||||||
| 247 | qt_safe_close(cellularStatusFD); | - | ||||||||||||
| 248 | return ret; | - | ||||||||||||
| 249 | } | - | ||||||||||||
| 250 | switch (type) { | - | ||||||||||||
| 251 | case 0: // 0 == NONE | - | ||||||||||||
| 252 | break; // unhandled | - | ||||||||||||
| 253 | case 1: // fallthrough, 1 == GSM | - | ||||||||||||
| 254 | case 4: // 4 == CDMA_1X | - | ||||||||||||
| 255 | ret = QNetworkConfiguration::Bearer2G; | - | ||||||||||||
| 256 | break; | - | ||||||||||||
| 257 | case 2: // 2 == UMTS | - | ||||||||||||
| 258 | ret = QNetworkConfiguration::BearerWCDMA; | - | ||||||||||||
| 259 | break; | - | ||||||||||||
| 260 | case 8: // 8 == EVDO | - | ||||||||||||
| 261 | ret = QNetworkConfiguration::BearerEVDO; | - | ||||||||||||
| 262 | break; | - | ||||||||||||
| 263 | case 16: // 16 == LTE | - | ||||||||||||
| 264 | ret = QNetworkConfiguration::BearerLTE; | - | ||||||||||||
| 265 | break; | - | ||||||||||||
| 266 | default: | - | ||||||||||||
| 267 | qWarning() << "unhandled bearer type" << type; | - | ||||||||||||
| 268 | break; | - | ||||||||||||
| 269 | } | - | ||||||||||||
| 270 | pps_decoder_cleanup(&ppsDecoder); | - | ||||||||||||
| 271 | qt_safe_close(cellularStatusFD); | - | ||||||||||||
| 272 | return ret; | - | ||||||||||||
| 273 | } | - | ||||||||||||
| 274 | #endif // Q_OS_BLACKBERRY | - | ||||||||||||
| 275 | - | |||||||||||||
| 276 | /*! | - | ||||||||||||
| 277 | Constructs an invalid configuration object. | - | ||||||||||||
| 278 | - | |||||||||||||
| 279 | \sa isValid() | - | ||||||||||||
| 280 | */ | - | ||||||||||||
| 281 | QNetworkConfiguration::QNetworkConfiguration() | - | ||||||||||||
| 282 | : d(0) | - | ||||||||||||
| 283 | { | - | ||||||||||||
| 284 | } executed 8164 times by 35 tests: end of blockExecuted by:
| 8164 | ||||||||||||
| 285 | - | |||||||||||||
| 286 | /*! | - | ||||||||||||
| 287 | Creates a copy of the QNetworkConfiguration object contained in \a other. | - | ||||||||||||
| 288 | */ | - | ||||||||||||
| 289 | QNetworkConfiguration::QNetworkConfiguration(const QNetworkConfiguration &other) | - | ||||||||||||
| 290 | : d(other.d) | - | ||||||||||||
| 291 | { | - | ||||||||||||
| 292 | } executed 1251 times by 19 tests: end of blockExecuted by:
| 1251 | ||||||||||||
| 293 | - | |||||||||||||
| 294 | /*! | - | ||||||||||||
| 295 | Frees the resources associated with the QNetworkConfiguration object. | - | ||||||||||||
| 296 | */ | - | ||||||||||||
| 297 | QNetworkConfiguration::~QNetworkConfiguration() | - | ||||||||||||
| 298 | { | - | ||||||||||||
| 299 | } | - | ||||||||||||
| 300 | - | |||||||||||||
| 301 | /*! | - | ||||||||||||
| 302 | Copies the content of the QNetworkConfiguration object contained in \a other into this one. | - | ||||||||||||
| 303 | */ | - | ||||||||||||
| 304 | QNetworkConfiguration &QNetworkConfiguration::operator=(const QNetworkConfiguration &other) | - | ||||||||||||
| 305 | { | - | ||||||||||||
| 306 | d = other.d; | - | ||||||||||||
| 307 | return *this; executed 309 times by 16 tests: return *this;Executed by:
| 309 | ||||||||||||
| 308 | } | - | ||||||||||||
| 309 | - | |||||||||||||
| 310 | /*! | - | ||||||||||||
| 311 | \fn void QNetworkConfiguration::swap(QNetworkConfiguration &other) | - | ||||||||||||
| 312 | \since 5.0 | - | ||||||||||||
| 313 | - | |||||||||||||
| 314 | Swaps this network configuration with \a other. This function is | - | ||||||||||||
| 315 | very fast and never fails. | - | ||||||||||||
| 316 | */ | - | ||||||||||||
| 317 | - | |||||||||||||
| 318 | /*! | - | ||||||||||||
| 319 | Returns \c true, if this configuration is the same as the \a other | - | ||||||||||||
| 320 | configuration given; otherwise returns \c false. | - | ||||||||||||
| 321 | */ | - | ||||||||||||
| 322 | bool QNetworkConfiguration::operator==(const QNetworkConfiguration &other) const | - | ||||||||||||
| 323 | { | - | ||||||||||||
| 324 | return (d == other.d); executed 702 times by 11 tests: return (d == other.d);Executed by:
| 702 | ||||||||||||
| 325 | } | - | ||||||||||||
| 326 | - | |||||||||||||
| 327 | /*! | - | ||||||||||||
| 328 | \fn bool QNetworkConfiguration::operator!=(const QNetworkConfiguration &other) const | - | ||||||||||||
| 329 | - | |||||||||||||
| 330 | Returns \c true if this configuration is not the same as the \a other | - | ||||||||||||
| 331 | configuration given; otherwise returns \c false. | - | ||||||||||||
| 332 | */ | - | ||||||||||||
| 333 | - | |||||||||||||
| 334 | /*! | - | ||||||||||||
| 335 | Returns the user visible name of this configuration. | - | ||||||||||||
| 336 | - | |||||||||||||
| 337 | The name may either be the name of the underlying access point or the | - | ||||||||||||
| 338 | name for service network that this configuration represents. | - | ||||||||||||
| 339 | */ | - | ||||||||||||
| 340 | QString QNetworkConfiguration::name() const | - | ||||||||||||
| 341 | { | - | ||||||||||||
| 342 | if (!d)
| 6-40 | ||||||||||||
| 343 | return QString(); executed 6 times by 1 test: return QString();Executed by:
| 6 | ||||||||||||
| 344 | - | |||||||||||||
| 345 | QMutexLocker locker(&d->mutex); | - | ||||||||||||
| 346 | return d->name; executed 40 times by 4 tests: return d->name;Executed by:
| 40 | ||||||||||||
| 347 | } | - | ||||||||||||
| 348 | - | |||||||||||||
| 349 | /*! | - | ||||||||||||
| 350 | Returns the unique and platform specific identifier for this network configuration; | - | ||||||||||||
| 351 | otherwise an empty string. | - | ||||||||||||
| 352 | */ | - | ||||||||||||
| 353 | QString QNetworkConfiguration::identifier() const | - | ||||||||||||
| 354 | { | - | ||||||||||||
| 355 | if (!d)
| 2-851 | ||||||||||||
| 356 | return QString(); executed 2 times by 1 test: return QString();Executed by:
| 2 | ||||||||||||
| 357 | - | |||||||||||||
| 358 | QMutexLocker locker(&d->mutex); | - | ||||||||||||
| 359 | return d->id; executed 851 times by 16 tests: return d->id;Executed by:
| 851 | ||||||||||||
| 360 | } | - | ||||||||||||
| 361 | - | |||||||||||||
| 362 | /*! | - | ||||||||||||
| 363 | Returns the type of the configuration. | - | ||||||||||||
| 364 | - | |||||||||||||
| 365 | A configuration can represent a single access point configuration or | - | ||||||||||||
| 366 | a set of access point configurations. Such a set is called service network. | - | ||||||||||||
| 367 | A configuration that is based on a service network can potentially support | - | ||||||||||||
| 368 | roaming of network sessions. | - | ||||||||||||
| 369 | */ | - | ||||||||||||
| 370 | QNetworkConfiguration::Type QNetworkConfiguration::type() const | - | ||||||||||||
| 371 | { | - | ||||||||||||
| 372 | if (!d)
| 7-612 | ||||||||||||
| 373 | return QNetworkConfiguration::Invalid; executed 7 times by 1 test: return QNetworkConfiguration::Invalid;Executed by:
| 7 | ||||||||||||
| 374 | - | |||||||||||||
| 375 | QMutexLocker locker(&d->mutex); | - | ||||||||||||
| 376 | return d->type; executed 612 times by 17 tests: return d->type;Executed by:
| 612 | ||||||||||||
| 377 | } | - | ||||||||||||
| 378 | - | |||||||||||||
| 379 | /*! | - | ||||||||||||
| 380 | Returns \c true if this QNetworkConfiguration object is valid. | - | ||||||||||||
| 381 | A configuration may become invalid if the user deletes the configuration or | - | ||||||||||||
| 382 | the configuration was default-constructed. | - | ||||||||||||
| 383 | - | |||||||||||||
| 384 | The addition and removal of configurations can be monitored via the | - | ||||||||||||
| 385 | QNetworkConfigurationManager. | - | ||||||||||||
| 386 | - | |||||||||||||
| 387 | \sa QNetworkConfigurationManager | - | ||||||||||||
| 388 | */ | - | ||||||||||||
| 389 | bool QNetworkConfiguration::isValid() const | - | ||||||||||||
| 390 | { | - | ||||||||||||
| 391 | if (!d)
| 171-1619 | ||||||||||||
| 392 | return false; executed 171 times by 17 tests: return false;Executed by:
| 171 | ||||||||||||
| 393 | - | |||||||||||||
| 394 | QMutexLocker locker(&d->mutex); | - | ||||||||||||
| 395 | return d->isValid; executed 1619 times by 12 tests: return d->isValid;Executed by:
| 1619 | ||||||||||||
| 396 | } | - | ||||||||||||
| 397 | - | |||||||||||||
| 398 | /*! | - | ||||||||||||
| 399 | Returns the current state of the configuration. | - | ||||||||||||
| 400 | */ | - | ||||||||||||
| 401 | QNetworkConfiguration::StateFlags QNetworkConfiguration::state() const | - | ||||||||||||
| 402 | { | - | ||||||||||||
| 403 | if (!d)
| 11-567 | ||||||||||||
| 404 | return QNetworkConfiguration::Undefined; executed 11 times by 2 tests: return QNetworkConfiguration::Undefined;Executed by:
| 11 | ||||||||||||
| 405 | - | |||||||||||||
| 406 | QMutexLocker locker(&d->mutex); | - | ||||||||||||
| 407 | return d->state; executed 567 times by 18 tests: return d->state;Executed by:
| 567 | ||||||||||||
| 408 | } | - | ||||||||||||
| 409 | - | |||||||||||||
| 410 | /*! | - | ||||||||||||
| 411 | Returns the purpose of this configuration. | - | ||||||||||||
| 412 | - | |||||||||||||
| 413 | The purpose field may be used to programmatically determine the | - | ||||||||||||
| 414 | purpose of a configuration. Such information is usually part of the | - | ||||||||||||
| 415 | access point or service network meta data. | - | ||||||||||||
| 416 | */ | - | ||||||||||||
| 417 | QNetworkConfiguration::Purpose QNetworkConfiguration::purpose() const | - | ||||||||||||
| 418 | { | - | ||||||||||||
| 419 | if (!d)
| 4-507 | ||||||||||||
| 420 | return QNetworkConfiguration::UnknownPurpose; executed 4 times by 1 test: return QNetworkConfiguration::UnknownPurpose;Executed by:
| 4 | ||||||||||||
| 421 | - | |||||||||||||
| 422 | QMutexLocker locker(&d->mutex); | - | ||||||||||||
| 423 | return d->purpose; executed 507 times by 11 tests: return d->purpose;Executed by:
| 507 | ||||||||||||
| 424 | } | - | ||||||||||||
| 425 | - | |||||||||||||
| 426 | /*! | - | ||||||||||||
| 427 | Returns \c true if this configuration supports roaming; otherwise false. | - | ||||||||||||
| 428 | */ | - | ||||||||||||
| 429 | bool QNetworkConfiguration::isRoamingAvailable() const | - | ||||||||||||
| 430 | { | - | ||||||||||||
| 431 | if (!d)
| 2-15 | ||||||||||||
| 432 | return false; executed 2 times by 1 test: return false;Executed by:
| 2 | ||||||||||||
| 433 | - | |||||||||||||
| 434 | QMutexLocker locker(&d->mutex); | - | ||||||||||||
| 435 | return d->roamingSupported; executed 15 times by 2 tests: return d->roamingSupported;Executed by:
| 15 | ||||||||||||
| 436 | } | - | ||||||||||||
| 437 | - | |||||||||||||
| 438 | /*! | - | ||||||||||||
| 439 | Returns all sub configurations of this network configuration in priority order. The first sub | - | ||||||||||||
| 440 | configuration in the list has the highest priority. | - | ||||||||||||
| 441 | - | |||||||||||||
| 442 | Only network configurations of type \l ServiceNetwork can have children. Otherwise this | - | ||||||||||||
| 443 | function returns an empty list. | - | ||||||||||||
| 444 | */ | - | ||||||||||||
| 445 | QList<QNetworkConfiguration> QNetworkConfiguration::children() const | - | ||||||||||||
| 446 | { | - | ||||||||||||
| 447 | QList<QNetworkConfiguration> results; | - | ||||||||||||
| 448 | - | |||||||||||||
| 449 | if (!d)
| 0 | ||||||||||||
| 450 | return results; never executed: return results; | 0 | ||||||||||||
| 451 | - | |||||||||||||
| 452 | QMutexLocker locker(&d->mutex); | - | ||||||||||||
| 453 | - | |||||||||||||
| 454 | if (d->type != QNetworkConfiguration::ServiceNetwork || !d->isValid)
| 0 | ||||||||||||
| 455 | return results; never executed: return results; | 0 | ||||||||||||
| 456 | - | |||||||||||||
| 457 | QMutableMapIterator<unsigned int, QNetworkConfigurationPrivatePointer> i(d->serviceNetworkMembers); | - | ||||||||||||
| 458 | while (i.hasNext()) {
| 0 | ||||||||||||
| 459 | i.next(); | - | ||||||||||||
| 460 | - | |||||||||||||
| 461 | QNetworkConfigurationPrivatePointer p = i.value(); | - | ||||||||||||
| 462 | - | |||||||||||||
| 463 | //if we have an invalid member get rid of it -> was deleted earlier on | - | ||||||||||||
| 464 | { | - | ||||||||||||
| 465 | QMutexLocker childLocker(&p->mutex); | - | ||||||||||||
| 466 | - | |||||||||||||
| 467 | if (!p->isValid) {
| 0 | ||||||||||||
| 468 | i.remove(); | - | ||||||||||||
| 469 | continue; never executed: continue; | 0 | ||||||||||||
| 470 | } | - | ||||||||||||
| 471 | } | - | ||||||||||||
| 472 | - | |||||||||||||
| 473 | QNetworkConfiguration item; | - | ||||||||||||
| 474 | item.d = p; | - | ||||||||||||
| 475 | results << item; | - | ||||||||||||
| 476 | } never executed: end of block | 0 | ||||||||||||
| 477 | - | |||||||||||||
| 478 | return results; never executed: return results; | 0 | ||||||||||||
| 479 | } | - | ||||||||||||
| 480 | - | |||||||||||||
| 481 | /*! | - | ||||||||||||
| 482 | Returns the type of bearer used by this network configuration. | - | ||||||||||||
| 483 | - | |||||||||||||
| 484 | If the bearer type is \l {QNetworkConfiguration::BearerUnknown}{unknown} the bearerTypeName() | - | ||||||||||||
| 485 | function can be used to retrieve a textural type name for the bearer. | - | ||||||||||||
| 486 | - | |||||||||||||
| 487 | An invalid network configuration always returns the BearerUnknown value. | - | ||||||||||||
| 488 | - | |||||||||||||
| 489 | \sa bearerTypeName(), bearerTypeFamily() | - | ||||||||||||
| 490 | */ | - | ||||||||||||
| 491 | QNetworkConfiguration::BearerType QNetworkConfiguration::bearerType() const | - | ||||||||||||
| 492 | { | - | ||||||||||||
| 493 | if (!isValid())
| 0-997 | ||||||||||||
| 494 | return BearerUnknown; never executed: return BearerUnknown; | 0 | ||||||||||||
| 495 | - | |||||||||||||
| 496 | QMutexLocker locker(&d->mutex); | - | ||||||||||||
| 497 | - | |||||||||||||
| 498 | #ifdef Q_OS_BLACKBERRY | - | ||||||||||||
| 499 | // for cellular configurations, we need to determine the exact | - | ||||||||||||
| 500 | // type right now, because it might have changed after the last scan | - | ||||||||||||
| 501 | if (d->bearerType == QNetworkConfiguration::Bearer2G) { | - | ||||||||||||
| 502 | QNetworkConfiguration::BearerType type = cellularStatus(); | - | ||||||||||||
| 503 | // if reading the status failed for some reason, just | - | ||||||||||||
| 504 | // fall back to 2G | - | ||||||||||||
| 505 | return (type == QNetworkConfiguration::BearerUnknown) | - | ||||||||||||
| 506 | ? QNetworkConfiguration::Bearer2G : type; | - | ||||||||||||
| 507 | } | - | ||||||||||||
| 508 | #endif // Q_OS_BLACKBERRY | - | ||||||||||||
| 509 | - | |||||||||||||
| 510 | return d->bearerType; executed 997 times by 9 tests: return d->bearerType;Executed by:
| 997 | ||||||||||||
| 511 | } | - | ||||||||||||
| 512 | - | |||||||||||||
| 513 | /*! | - | ||||||||||||
| 514 | \since 5.2 | - | ||||||||||||
| 515 | - | |||||||||||||
| 516 | Returns the bearer type family used by this network configuration. | - | ||||||||||||
| 517 | The following table lists how bearerType() values map to | - | ||||||||||||
| 518 | bearerTypeFamily() values: | - | ||||||||||||
| 519 | - | |||||||||||||
| 520 | \table | - | ||||||||||||
| 521 | \header | - | ||||||||||||
| 522 | \li bearer type | - | ||||||||||||
| 523 | \li bearer type family | - | ||||||||||||
| 524 | \row | - | ||||||||||||
| 525 | \li BearerUnknown, Bearer2G, BearerEthernet, BearerWLAN, | - | ||||||||||||
| 526 | BearerBluetooth | - | ||||||||||||
| 527 | \li (same type) | - | ||||||||||||
| 528 | \row | - | ||||||||||||
| 529 | \li BearerCDMA2000, BearerEVDO, BearerWCDMA, BearerHSPA, Bearer3G | - | ||||||||||||
| 530 | \li Bearer3G | - | ||||||||||||
| 531 | \row | - | ||||||||||||
| 532 | \li BearerWiMAX, BearerLTE, Bearer4G | - | ||||||||||||
| 533 | \li Bearer4G | - | ||||||||||||
| 534 | \endtable | - | ||||||||||||
| 535 | - | |||||||||||||
| 536 | An invalid network configuration always returns the BearerUnknown value. | - | ||||||||||||
| 537 | - | |||||||||||||
| 538 | \sa bearerType(), bearerTypeName() | - | ||||||||||||
| 539 | */ | - | ||||||||||||
| 540 | QNetworkConfiguration::BearerType QNetworkConfiguration::bearerTypeFamily() const | - | ||||||||||||
| 541 | { | - | ||||||||||||
| 542 | QNetworkConfiguration::BearerType type = bearerType(); | - | ||||||||||||
| 543 | switch (type) { | - | ||||||||||||
| 544 | case QNetworkConfiguration::BearerUnknown: // fallthrough never executed: case QNetworkConfiguration::BearerUnknown: | 0 | ||||||||||||
| 545 | case QNetworkConfiguration::Bearer2G: // fallthrough never executed: case QNetworkConfiguration::Bearer2G: | 0 | ||||||||||||
| 546 | case QNetworkConfiguration::BearerEthernet: // fallthrough never executed: case QNetworkConfiguration::BearerEthernet: | 0 | ||||||||||||
| 547 | case QNetworkConfiguration::BearerWLAN: // fallthrough never executed: case QNetworkConfiguration::BearerWLAN: | 0 | ||||||||||||
| 548 | case QNetworkConfiguration::BearerBluetooth: never executed: case QNetworkConfiguration::BearerBluetooth: | 0 | ||||||||||||
| 549 | return type; never executed: return type; | 0 | ||||||||||||
| 550 | case QNetworkConfiguration::BearerCDMA2000: // fallthrough never executed: case QNetworkConfiguration::BearerCDMA2000: | 0 | ||||||||||||
| 551 | case QNetworkConfiguration::BearerEVDO: // fallthrough never executed: case QNetworkConfiguration::BearerEVDO: | 0 | ||||||||||||
| 552 | case QNetworkConfiguration::BearerWCDMA: // fallthrough never executed: case QNetworkConfiguration::BearerWCDMA: | 0 | ||||||||||||
| 553 | case QNetworkConfiguration::BearerHSPA: // fallthrough never executed: case QNetworkConfiguration::BearerHSPA: | 0 | ||||||||||||
| 554 | case QNetworkConfiguration::Bearer3G: never executed: case QNetworkConfiguration::Bearer3G: | 0 | ||||||||||||
| 555 | return QNetworkConfiguration::Bearer3G; never executed: return QNetworkConfiguration::Bearer3G; | 0 | ||||||||||||
| 556 | case QNetworkConfiguration::BearerWiMAX: // fallthrough never executed: case QNetworkConfiguration::BearerWiMAX: | 0 | ||||||||||||
| 557 | case QNetworkConfiguration::BearerLTE: // fallthrough never executed: case QNetworkConfiguration::BearerLTE: | 0 | ||||||||||||
| 558 | case QNetworkConfiguration::Bearer4G: never executed: case QNetworkConfiguration::Bearer4G: | 0 | ||||||||||||
| 559 | return QNetworkConfiguration::Bearer4G; never executed: return QNetworkConfiguration::Bearer4G; | 0 | ||||||||||||
| 560 | default: never executed: default: | 0 | ||||||||||||
| 561 | qWarning() << "unknown bearer type" << type; | - | ||||||||||||
| 562 | return QNetworkConfiguration::BearerUnknown; never executed: return QNetworkConfiguration::BearerUnknown; | 0 | ||||||||||||
| 563 | } | - | ||||||||||||
| 564 | } | - | ||||||||||||
| 565 | /*! | - | ||||||||||||
| 566 | Returns the type of bearer used by this network configuration as a string. | - | ||||||||||||
| 567 | - | |||||||||||||
| 568 | The string is not translated and therefore can not be shown to the user. The subsequent table | - | ||||||||||||
| 569 | shows the fixed mappings between BearerType and the bearer type name for known types. If the | - | ||||||||||||
| 570 | BearerType is unknown this function may return additional information if it is available; | - | ||||||||||||
| 571 | otherwise an empty string will be returned. | - | ||||||||||||
| 572 | - | |||||||||||||
| 573 | \table | - | ||||||||||||
| 574 | \header | - | ||||||||||||
| 575 | \li BearerType | - | ||||||||||||
| 576 | \li Value | - | ||||||||||||
| 577 | \row | - | ||||||||||||
| 578 | \li BearerUnknown | - | ||||||||||||
| 579 | \li The session is based on an unknown or unspecified bearer type. The value of the | - | ||||||||||||
| 580 | string returned describes the bearer type. | - | ||||||||||||
| 581 | \row | - | ||||||||||||
| 582 | \li BearerEthernet | - | ||||||||||||
| 583 | \li Ethernet | - | ||||||||||||
| 584 | \row | - | ||||||||||||
| 585 | \li BearerWLAN | - | ||||||||||||
| 586 | \li WLAN | - | ||||||||||||
| 587 | \row | - | ||||||||||||
| 588 | \li Bearer2G | - | ||||||||||||
| 589 | \li 2G | - | ||||||||||||
| 590 | \row | - | ||||||||||||
| 591 | \li Bearer3G | - | ||||||||||||
| 592 | \li 3G | - | ||||||||||||
| 593 | \row | - | ||||||||||||
| 594 | \li Bearer4G | - | ||||||||||||
| 595 | \li 4G | - | ||||||||||||
| 596 | \row | - | ||||||||||||
| 597 | \li BearerCDMA2000 | - | ||||||||||||
| 598 | \li CDMA2000 | - | ||||||||||||
| 599 | \row | - | ||||||||||||
| 600 | \li BearerWCDMA | - | ||||||||||||
| 601 | \li WCDMA | - | ||||||||||||
| 602 | \row | - | ||||||||||||
| 603 | \li BearerHSPA | - | ||||||||||||
| 604 | \li HSPA | - | ||||||||||||
| 605 | \row | - | ||||||||||||
| 606 | \li BearerBluetooth | - | ||||||||||||
| 607 | \li Bluetooth | - | ||||||||||||
| 608 | \row | - | ||||||||||||
| 609 | \li BearerWiMAX | - | ||||||||||||
| 610 | \li WiMAX | - | ||||||||||||
| 611 | \row | - | ||||||||||||
| 612 | \li BearerEVDO | - | ||||||||||||
| 613 | \li EVDO | - | ||||||||||||
| 614 | \row | - | ||||||||||||
| 615 | \li BearerLTE | - | ||||||||||||
| 616 | \li LTE | - | ||||||||||||
| 617 | \endtable | - | ||||||||||||
| 618 | - | |||||||||||||
| 619 | This function returns an empty string if this is an invalid configuration, a network | - | ||||||||||||
| 620 | configuration of type \l QNetworkConfiguration::ServiceNetwork or | - | ||||||||||||
| 621 | \l QNetworkConfiguration::UserChoice. | - | ||||||||||||
| 622 | - | |||||||||||||
| 623 | \sa bearerType(), bearerTypeFamily() | - | ||||||||||||
| 624 | */ | - | ||||||||||||
| 625 | QString QNetworkConfiguration::bearerTypeName() const | - | ||||||||||||
| 626 | { | - | ||||||||||||
| 627 | if (!isValid())
| 1-3 | ||||||||||||
| 628 | return QString(); executed 1 time by 1 test: return QString();Executed by:
| 1 | ||||||||||||
| 629 | - | |||||||||||||
| 630 | QMutexLocker locker(&d->mutex); | - | ||||||||||||
| 631 | - | |||||||||||||
| 632 | if (d->type == QNetworkConfiguration::ServiceNetwork ||
| 0-3 | ||||||||||||
| 633 | d->type == QNetworkConfiguration::UserChoice)
| 0-3 | ||||||||||||
| 634 | return QString(); never executed: return QString(); | 0 | ||||||||||||
| 635 | - | |||||||||||||
| 636 | switch (d->bearerType) { | - | ||||||||||||
| 637 | case BearerEthernet: executed 3 times by 1 test: case BearerEthernet:Executed by:
| 3 | ||||||||||||
| 638 | return QStringLiteral("Ethernet"); executed 3 times by 1 test: return ([]() -> QString { enum { Size = sizeof(u"" "Ethernet")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Ethernet" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());Executed by:
executed 3 times by 1 test: return qstring_literal_temp;Executed by:
| 3 | ||||||||||||
| 639 | case BearerWLAN: never executed: case BearerWLAN: | 0 | ||||||||||||
| 640 | return QStringLiteral("WLAN"); never executed: return ([]() -> QString { enum { Size = sizeof(u"" "WLAN")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "WLAN" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());never executed: return qstring_literal_temp; | 0 | ||||||||||||
| 641 | case Bearer2G: never executed: case Bearer2G: | 0 | ||||||||||||
| 642 | #ifdef Q_OS_BLACKBERRY | - | ||||||||||||
| 643 | { | - | ||||||||||||
| 644 | // for cellular configurations, we need to determine the exact | - | ||||||||||||
| 645 | // type right now, because it might have changed after the last scan | - | ||||||||||||
| 646 | QNetworkConfiguration::BearerType type = cellularStatus(); | - | ||||||||||||
| 647 | if (type == QNetworkConfiguration::BearerWCDMA) { | - | ||||||||||||
| 648 | return QStringLiteral("WCDMA"); | - | ||||||||||||
| 649 | } else if (type == QNetworkConfiguration::BearerEVDO) { | - | ||||||||||||
| 650 | return QStringLiteral("EVDO"); | - | ||||||||||||
| 651 | }else if (type == QNetworkConfiguration::BearerLTE) { | - | ||||||||||||
| 652 | return QStringLiteral("LTE"); | - | ||||||||||||
| 653 | } | - | ||||||||||||
| 654 | } | - | ||||||||||||
| 655 | #endif // Q_OS_BLACKBERRY | - | ||||||||||||
| 656 | return QStringLiteral("2G"); never executed: return ([]() -> QString { enum { Size = sizeof(u"" "2G")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "2G" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());never executed: return qstring_literal_temp; | 0 | ||||||||||||
| 657 | case Bearer3G: never executed: case Bearer3G: | 0 | ||||||||||||
| 658 | return QStringLiteral("3G"); never executed: return ([]() -> QString { enum { Size = sizeof(u"" "3G")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "3G" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());never executed: return qstring_literal_temp; | 0 | ||||||||||||
| 659 | case Bearer4G: never executed: case Bearer4G: | 0 | ||||||||||||
| 660 | return QStringLiteral("4G"); never executed: return ([]() -> QString { enum { Size = sizeof(u"" "4G")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "4G" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());never executed: return qstring_literal_temp; | 0 | ||||||||||||
| 661 | case BearerCDMA2000: never executed: case BearerCDMA2000: | 0 | ||||||||||||
| 662 | return QStringLiteral("CDMA2000"); never executed: return ([]() -> QString { enum { Size = sizeof(u"" "CDMA2000")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "CDMA2000" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());never executed: return qstring_literal_temp; | 0 | ||||||||||||
| 663 | case BearerWCDMA: never executed: case BearerWCDMA: | 0 | ||||||||||||
| 664 | return QStringLiteral("WCDMA"); never executed: return ([]() -> QString { enum { Size = sizeof(u"" "WCDMA")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "WCDMA" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());never executed: return qstring_literal_temp; | 0 | ||||||||||||
| 665 | case BearerHSPA: never executed: case BearerHSPA: | 0 | ||||||||||||
| 666 | return QStringLiteral("HSPA"); never executed: return ([]() -> QString { enum { Size = sizeof(u"" "HSPA")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "HSPA" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());never executed: return qstring_literal_temp; | 0 | ||||||||||||
| 667 | case BearerBluetooth: never executed: case BearerBluetooth: | 0 | ||||||||||||
| 668 | return QStringLiteral("Bluetooth"); never executed: return ([]() -> QString { enum { Size = sizeof(u"" "Bluetooth")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Bluetooth" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());never executed: return qstring_literal_temp; | 0 | ||||||||||||
| 669 | case BearerWiMAX: never executed: case BearerWiMAX: | 0 | ||||||||||||
| 670 | return QStringLiteral("WiMAX"); never executed: return ([]() -> QString { enum { Size = sizeof(u"" "WiMAX")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "WiMAX" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());never executed: return qstring_literal_temp; | 0 | ||||||||||||
| 671 | case BearerEVDO: never executed: case BearerEVDO: | 0 | ||||||||||||
| 672 | return QStringLiteral("EVDO"); never executed: return ([]() -> QString { enum { Size = sizeof(u"" "EVDO")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "EVDO" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());never executed: return qstring_literal_temp; | 0 | ||||||||||||
| 673 | case BearerLTE: never executed: case BearerLTE: | 0 | ||||||||||||
| 674 | return QStringLiteral("LTE"); never executed: return ([]() -> QString { enum { Size = sizeof(u"" "LTE")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "LTE" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());never executed: return qstring_literal_temp; | 0 | ||||||||||||
| 675 | case BearerUnknown: never executed: case BearerUnknown: | 0 | ||||||||||||
| 676 | break; never executed: break; | 0 | ||||||||||||
| 677 | } | - | ||||||||||||
| 678 | return QStringLiteral("Unknown"); never executed: return ([]() -> QString { enum { Size = sizeof(u"" "Unknown")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Unknown" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());never executed: return qstring_literal_temp; | 0 | ||||||||||||
| 679 | } | - | ||||||||||||
| 680 | - | |||||||||||||
| 681 | QT_END_NAMESPACE | - | ||||||||||||
| Source code | Switch to Preprocessed file |