src/network/bearer/qnetworkconfiguration.cpp
changeset 37 758a864f9613
parent 33 3e2da88830cd
equal deleted inserted replaced
36:ef0373b55136 37:758a864f9613
   181     \value ServiceSpecificPurpose   The configuration can be used for operator specific services (e.g.
   181     \value ServiceSpecificPurpose   The configuration can be used for operator specific services (e.g.
   182                                     receiving MMS messages or content streaming).
   182                                     receiving MMS messages or content streaming).
   183 */
   183 */
   184 
   184 
   185 /*!
   185 /*!
       
   186     \enum QNetworkConfiguration::BearerType
       
   187 
       
   188     Specifies the type of bearer used by a configuration.
       
   189 
       
   190     \value BearerUnknown    The type of bearer is unknown or unspecified. The bearerTypeName()
       
   191                             function may return additional information.
       
   192     \value BearerEthernet   The configuration is for an Ethernet interfaces.
       
   193     \value BearerWLAN       The configuration is for a Wireless LAN interface.
       
   194     \value Bearer2G         The configuration is for a CSD, GPRS, HSCSD, EDGE or cdmaOne interface.
       
   195     \value BearerCDMA2000   The configuration is for CDMA interface.
       
   196     \value BearerWCDMA      The configuration is for W-CDMA/UMTS interface.
       
   197     \value BearerHSPA       The configuration is for High Speed Packet Access (HSPA) interface.
       
   198     \value BearerBluetooth  The configuration is for a Bluetooth interface.
       
   199     \value BearerWiMAX      The configuration is for a WiMAX interface.
       
   200 */
       
   201 
       
   202 /*!
   186     Constructs an invalid configuration object.
   203     Constructs an invalid configuration object.
   187 
   204 
   188     \sa isValid()
   205     \sa isValid()
   189 */
   206 */
   190 QNetworkConfiguration::QNetworkConfiguration()
   207 QNetworkConfiguration::QNetworkConfiguration()
   381 
   398 
   382     return results;
   399     return results;
   383 }
   400 }
   384 
   401 
   385 /*!
   402 /*!
   386     Returns the type of bearer. The string is not translated and
   403     \fn QString QNetworkConfiguration::bearerName() const
   387     therefore can not be shown to the user. The subsequent table presents the currently known
   404     \deprecated
   388     bearer types:
   405 
       
   406     This function is deprecated.  It is equivalent to calling bearerTypeName(), however
       
   407     bearerType() should be used in preference.
       
   408 */
       
   409 
       
   410 /*!
       
   411     Returns the type of bearer used by this network configuration.
       
   412 
       
   413     If the bearer type is \l {QNetworkConfiguration::BearerUnknown}{unknown} the bearerTypeName()
       
   414     function can be used to retrieve a textural type name for the bearer.
       
   415 
       
   416     An invalid network configuration always returns the BearerUnknown value.
       
   417 */
       
   418 QNetworkConfiguration::BearerType QNetworkConfiguration::bearerType() const
       
   419 {
       
   420     if (!isValid())
       
   421         return BearerUnknown;
       
   422 
       
   423     QMutexLocker locker(&d->mutex);
       
   424 
       
   425     return d->bearerType;
       
   426 }
       
   427 
       
   428 /*!
       
   429     Returns the type of bearer used by this network configuration as a string.
       
   430 
       
   431     The string is not translated and therefore can not be shown to the user. The subsequent table
       
   432     shows the fixed mappings between BearerType and the bearer type name for known types.  If the
       
   433     BearerType is unknown this function may return additional information if it is available;
       
   434     otherwise an empty string will be returned.
   389 
   435 
   390     \table
   436     \table
   391         \header 
   437         \header
       
   438             \o BearerType
   392             \o Value
   439             \o Value
   393             \o Description
   440         \row
   394         \row
   441             \o BearerUnknown
   395             \o Unknown
   442             \o
   396             \o The session is based on an unknown or unspecified bearer type.
   443             \o The session is based on an unknown or unspecified bearer type. The value of the
   397         \row
   444                string returned describes the bearer type.
       
   445         \row
       
   446             \o BearerEthernet
   398             \o Ethernet
   447             \o Ethernet
   399             \o The session is based on Ethernet.
   448         \row
   400         \row
   449             \o BearerWLAN
   401             \o WLAN
   450             \o WLAN
   402             \o The session is based on Wireless LAN.
   451         \row
   403         \row
   452             \o Bearer2G
   404             \o 2G
   453             \o 2G
   405             \o The session uses CSD, GPRS, HSCSD, EDGE or cdmaOne.
   454         \row
   406         \row 
   455             \o BearerCDMA2000
   407             \o CDMA2000
   456             \o CDMA2000
   408             \o The session uses CDMA.
   457         \row
   409         \row
   458             \o BearerWCDMA
   410             \o WCDMA
   459             \o WCDMA
   411             \o The session uses W-CDMA/UMTS.
   460         \row
   412         \row
   461             \o BearerHSPA
   413             \o HSPA
   462             \o HSPA
   414             \o The session uses High Speed Packet Access.
   463         \row
   415         \row
   464             \o BearerBluetooth
   416             \o Bluetooth
   465             \o Bluetooth
   417             \o The session uses Bluetooth.
   466         \row
   418         \row
   467             \o BearerWiMAX
   419             \o WiMAX
   468             \o WiMAX
   420             \o The session uses WiMAX.
       
   421     \endtable
   469     \endtable
   422 
   470 
   423     This function returns an empty string if this is an invalid configuration,
   471     This function returns an empty string if this is an invalid configuration, a network
   424     a network configuration of type \l QNetworkConfiguration::ServiceNetwork or
   472     configuration of type \l QNetworkConfiguration::ServiceNetwork or
   425     \l QNetworkConfiguration::UserChoice.
   473     \l QNetworkConfiguration::UserChoice.
   426 */
   474 
   427 QString QNetworkConfiguration::bearerName() const
   475     \sa bearerType()
       
   476 */
       
   477 QString QNetworkConfiguration::bearerTypeName() const
   428 {
   478 {
   429     if (!isValid())
   479     if (!isValid())
   430         return QString();
   480         return QString();
   431 
   481 
   432     return d->bearerName();
   482     QMutexLocker locker(&d->mutex);
       
   483 
       
   484     if (d->type == QNetworkConfiguration::ServiceNetwork ||
       
   485         d->type == QNetworkConfiguration::UserChoice)
       
   486         return QString();
       
   487 
       
   488     switch (d->bearerType) {
       
   489     case BearerUnknown:
       
   490         return d->bearerTypeName();
       
   491     case BearerEthernet:
       
   492         return QLatin1String("Ethernet");
       
   493     case BearerWLAN:
       
   494         return QLatin1String("WLAN");
       
   495     case Bearer2G:
       
   496         return QLatin1String("2G");
       
   497     case BearerCDMA2000:
       
   498         return QLatin1String("CDMA2000");
       
   499     case BearerWCDMA:
       
   500         return QLatin1String("WCDMA");
       
   501     case BearerHSPA:
       
   502         return QLatin1String("HSPA");
       
   503     case BearerBluetooth:
       
   504         return QLatin1String("Bluetooth");
       
   505     case BearerWiMAX:
       
   506         return QLatin1String("WiMAX");
       
   507     }
       
   508 
       
   509     return QLatin1String("Unknown");
   433 }
   510 }
   434 
   511 
   435 QT_END_NAMESPACE
   512 QT_END_NAMESPACE
   436 
   513