summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qbluetoothdeviceinfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/bluetooth/qbluetoothdeviceinfo.cpp')
-rw-r--r--src/bluetooth/qbluetoothdeviceinfo.cpp34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/bluetooth/qbluetoothdeviceinfo.cpp b/src/bluetooth/qbluetoothdeviceinfo.cpp
index 11a60565..bd3b9c00 100644
--- a/src/bluetooth/qbluetoothdeviceinfo.cpp
+++ b/src/bluetooth/qbluetoothdeviceinfo.cpp
@@ -72,6 +72,20 @@ QT_BEGIN_NAMESPACE
*/
/*!
+ \enum QBluetoothDeviceInfo::Field
+
+ This enum is used in conjuntion with the \l deviceUpdated() signal and indicates the field
+ that changed.
+
+ \value None None of the values changed.
+ \value RSSI The \l rssi() value of the device changed.
+ \value ManufacturerData The \l manufacturerData() field changed
+ \value All Matches every possible field.
+
+ \since 5.12
+*/
+
+/*!
\enum QBluetoothDeviceInfo::MinorMiscellaneousClass
This enum describes the minor device classes for miscellaneous Bluetooth devices.
@@ -598,20 +612,38 @@ QVector<quint16> QBluetoothDeviceInfo::manufacturerIds() const
*/
QByteArray QBluetoothDeviceInfo::manufacturerData(quint16 manufacturerId) const
{
+ // TODO Currently not implemented on WinRT
Q_D(const QBluetoothDeviceInfo);
return d->manufacturerData.value(manufacturerId);
}
/*!
Sets the advertised manufacturer \a data for the given \a manufacturerId.
+ Returns true if it was inserted or changed, false if it was already known.
\sa manufacturerData,
\since 5.12
*/
-void QBluetoothDeviceInfo::setManufacturerData(quint16 manufacturerId, const QByteArray &data)
+bool QBluetoothDeviceInfo::setManufacturerData(quint16 manufacturerId, const QByteArray &data)
{
Q_D(QBluetoothDeviceInfo);
+ const auto it = d->manufacturerData.find(manufacturerId);
+ if (it != d->manufacturerData.end() && *it == data)
+ return false;
d->manufacturerData.insert(manufacturerId, data);
+ return true;
+}
+
+/*!
+ Returns the complete set of all manufacturer data.
+
+ \sa setManufacturerData
+ \since 5.12
+*/
+QHash<quint16, QByteArray> QBluetoothDeviceInfo::manufacturerData() const
+{
+ Q_D(const QBluetoothDeviceInfo);
+ return d->manufacturerData;
}
/*!