diff options
author | Sona Kurazyan <sona.kurazyan@qt.io> | 2019-08-06 13:50:45 +0200 |
---|---|---|
committer | Sona Kurazyan <sona.kurazyan@qt.io> | 2019-08-07 10:48:21 +0200 |
commit | 8596715ffc5036d380217fc55418c82449504fe3 (patch) | |
tree | a5dedf60a38a4df784041c4a73170527350f5422 /src/bluetooth/qbluetoothdeviceinfo.cpp | |
parent | 6c3fde845d391e86003ff87371e2d4174b8212dc (diff) |
Fix build with deprecated APIs disabled since 5.13
The DataCompleteness enum has been deprecated since 5.13, but some of
its uses are still compiled for all versions. Make the related code
and docs compile only when the enum is defined.
To keep source compatibility, add another version of serviceUuids()
returning a QList and not taking a DataCompleteness parameter.
Task-number: QTBUG-76491
Change-Id: I20e045230df18e7211ef9982d98ed6e77ec87d16
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/bluetooth/qbluetoothdeviceinfo.cpp')
-rw-r--r-- | src/bluetooth/qbluetoothdeviceinfo.cpp | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/src/bluetooth/qbluetoothdeviceinfo.cpp b/src/bluetooth/qbluetoothdeviceinfo.cpp index 46df5c7b..de73bf56 100644 --- a/src/bluetooth/qbluetoothdeviceinfo.cpp +++ b/src/bluetooth/qbluetoothdeviceinfo.cpp @@ -282,7 +282,9 @@ QBluetoothDeviceInfoPrivate::QBluetoothDeviceInfoPrivate() : serviceClasses(QBluetoothDeviceInfo::NoService), majorDeviceClass(QBluetoothDeviceInfo::MiscellaneousDevice), minorDeviceClass(0), +#if QT_DEPRECATED_SINCE(5, 13) serviceUuidsCompleteness(QBluetoothDeviceInfo::DataUnavailable), +#endif deviceCoreConfiguration(QBluetoothDeviceInfo::UnknownCoreConfiguration) { } @@ -322,7 +324,9 @@ QBluetoothDeviceInfo::QBluetoothDeviceInfo(const QBluetoothAddress &address, con d->majorDeviceClass = static_cast<MajorDeviceClass>((classOfDevice >> 8) & 0x1f); d->serviceClasses = static_cast<ServiceClasses>((classOfDevice >> 13) & 0x7ff); +#if QT_DEPRECATED_SINCE(5, 13) d->serviceUuidsCompleteness = DataUnavailable; +#endif d->valid = true; d->cached = false; @@ -353,7 +357,9 @@ QBluetoothDeviceInfo::QBluetoothDeviceInfo(const QBluetoothUuid &uuid, const QSt d->majorDeviceClass = static_cast<MajorDeviceClass>((classOfDevice >> 8) & 0x1f); d->serviceClasses = static_cast<ServiceClasses>((classOfDevice >> 13) & 0x7ff); +#if QT_DEPRECATED_SINCE(5, 13) d->serviceUuidsCompleteness = DataUnavailable; +#endif d->valid = true; d->cached = false; @@ -420,7 +426,9 @@ QBluetoothDeviceInfo &QBluetoothDeviceInfo::operator=(const QBluetoothDeviceInfo d->serviceClasses = other.d_func()->serviceClasses; d->valid = other.d_func()->valid; d->cached = other.d_func()->cached; +#if QT_DEPRECATED_SINCE(5, 13) d->serviceUuidsCompleteness = other.d_func()->serviceUuidsCompleteness; +#endif d->serviceUuids = other.d_func()->serviceUuids; d->manufacturerData = other.d_func()->manufacturerData; d->rssi = other.d_func()->rssi; @@ -451,8 +459,10 @@ bool QBluetoothDeviceInfo::operator==(const QBluetoothDeviceInfo &other) const return false; if (d->address != other.d_func()->address) return false; +#if QT_DEPRECATED_SINCE(5, 13) if (d->serviceUuidsCompleteness != other.d_func()->serviceUuidsCompleteness) return false; +#endif if (d->serviceUuids.count() != other.d_func()->serviceUuids.count()) return false; if (d->serviceUuids != other.d_func()->serviceUuids) @@ -538,6 +548,7 @@ quint8 QBluetoothDeviceInfo::minorDeviceClass() const return d->minorDeviceClass; } +#if QT_DEPRECATED_SINCE(5, 13) /*! \deprecated @@ -551,6 +562,7 @@ void QBluetoothDeviceInfo::setServiceUuids(const QList<QBluetoothUuid> &uuids, d->serviceUuids = uuids.toVector(); d->serviceUuidsCompleteness = completeness; } +#endif /*! Sets the list of service UUIDs to \a uuids. @@ -577,7 +589,7 @@ QVector<QBluetoothUuid> QBluetoothDeviceInfo::serviceUuids() const return d->serviceUuids; } -#else +#elif QT_DEPRECATED_SINCE(5, 13) /*! Returns the list of service UUIDS supported by the device. If \a completeness is not 0 it will @@ -596,8 +608,23 @@ QList<QBluetoothUuid> QBluetoothDeviceInfo::serviceUuids(DataCompleteness *compl return d->serviceUuids.toList(); } + +#else + +/*! + Returns the list of service UUIDS supported by the device. Most commonly this + list of uuids represents custom uuids or a uuid value specified by + \l QBluetoothUuid::ServiceClassUuid. +*/ +QList<QBluetoothUuid> QBluetoothDeviceInfo::serviceUuids() const +{ + Q_D(const QBluetoothDeviceInfo); + return d->serviceUuids.toList(); +} + #endif //QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +#if QT_DEPRECATED_SINCE(5, 13) /*! \deprecated @@ -611,7 +638,7 @@ QBluetoothDeviceInfo::DataCompleteness QBluetoothDeviceInfo::serviceUuidsComplet Q_D(const QBluetoothDeviceInfo); return d->serviceUuidsCompleteness; } - +#endif /*! Returns all manufacturer ids attached to this device information. |