summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qbluetoothdeviceinfo.cpp
diff options
context:
space:
mode:
authorNedim Hadzic <nhadzic@blackberry.com>2013-10-23 17:33:36 +0200
committerAlex Blasche <alexander.blasche@digia.com>2013-11-04 09:35:01 +0100
commitec61d7b9e82e6d653c02df14f34acdba8fc060db (patch)
treed61e73318c11e0dcae471ee7c1f8ed56397b9f75 /src/bluetooth/qbluetoothdeviceinfo.cpp
parentb00388ea1448cfd977c54f53d038d1a270562d53 (diff)
Implemented Bluetooth Low Energy gatt service and characteristics discovery
Bluez v4.x does not have total support for LE devices, a new approach, using gatttool command was implemented. Auto-tests and documentation will be in other commits. Change-Id: Iee711cc111199e15956052eebb7593bd3a5e27c8 Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Diffstat (limited to 'src/bluetooth/qbluetoothdeviceinfo.cpp')
-rw-r--r--src/bluetooth/qbluetoothdeviceinfo.cpp60
1 files changed, 49 insertions, 11 deletions
diff --git a/src/bluetooth/qbluetoothdeviceinfo.cpp b/src/bluetooth/qbluetoothdeviceinfo.cpp
index 7a8e882b..d451bc49 100644
--- a/src/bluetooth/qbluetoothdeviceinfo.cpp
+++ b/src/bluetooth/qbluetoothdeviceinfo.cpp
@@ -249,12 +249,24 @@ QT_BEGIN_NAMESPACE
\value DataUnavailable No data is available.
*/
+/*!
+ \enum QBluetoothDeviceInfo::CoreConfiguration
+
+ This enum describes the configuration of the device.
+
+ \value BaseRateCoreConfiguration The device is a standard Bluetooth device.
+ \value BaseRateAndLowEnergyConfiguration The device is a Bluetooth Smart device with support
+ for standard and Low Energy device.
+ \value LowEnergyCoreCOnfiguration The device is a Bluetooth Low Energy device.
+*/
+
QBluetoothDeviceInfoPrivate::QBluetoothDeviceInfoPrivate()
: valid(false), cached(false), rssi(1),
serviceClasses(QBluetoothDeviceInfo::NoService),
majorDeviceClass(QBluetoothDeviceInfo::MiscellaneousDevice),
minorDeviceClass(0),
- serviceUuidsCompleteness(QBluetoothDeviceInfo::DataUnavailable)
+ serviceUuidsCompleteness(QBluetoothDeviceInfo::DataUnavailable),
+ deviceCoreConfiguration(QBluetoothDeviceInfo::BaseRateCoreConfiguration)
{
}
@@ -361,6 +373,7 @@ QBluetoothDeviceInfo &QBluetoothDeviceInfo::operator=(const QBluetoothDeviceInfo
d->serviceUuidsCompleteness = other.d_func()->serviceUuidsCompleteness;
d->serviceUuids = other.d_func()->serviceUuids;
d->rssi = other.d_func()->rssi;
+ d->deviceCoreConfiguration = other.d_func()->deviceCoreConfiguration;
return *this;
}
@@ -372,25 +385,27 @@ bool QBluetoothDeviceInfo::operator==(const QBluetoothDeviceInfo &other) const
{
Q_D(const QBluetoothDeviceInfo);
- if(d->cached != other.d_func()->cached)
+ if (d->cached != other.d_func()->cached)
return false;
- if(d->valid != other.d_func()->valid)
+ if (d->valid != other.d_func()->valid)
return false;
- if(d->majorDeviceClass != other.d_func()->majorDeviceClass)
+ if (d->majorDeviceClass != other.d_func()->majorDeviceClass)
return false;
- if(d->minorDeviceClass != other.d_func()->minorDeviceClass)
+ if (d->minorDeviceClass != other.d_func()->minorDeviceClass)
return false;
- if(d->serviceClasses != other.d_func()->serviceClasses)
+ if (d->serviceClasses != other.d_func()->serviceClasses)
return false;
- if(d->name != other.d_func()->name)
+ if (d->name != other.d_func()->name)
return false;
- if(d->address != other.d_func()->address)
+ if (d->address != other.d_func()->address)
return false;
- if(d->serviceUuidsCompleteness != other.d_func()->serviceUuidsCompleteness)
+ if (d->serviceUuidsCompleteness != other.d_func()->serviceUuidsCompleteness)
return false;
- if(d->serviceUuids.count() != other.d_func()->serviceUuids.count())
+ if (d->serviceUuids.count() != other.d_func()->serviceUuids.count())
return false;
- if(d->serviceUuids != other.d_func()->serviceUuids)
+ if (d->serviceUuids != other.d_func()->serviceUuids)
+ return false;
+ if (d->deviceCoreConfiguration != other.d_func()->deviceCoreConfiguration)
return false;
return true;
@@ -500,6 +515,29 @@ QBluetoothDeviceInfo::DataCompleteness QBluetoothDeviceInfo::serviceUuidsComplet
}
/*!
+ Sets the CoreConfiguration of the device to a \a coreConfig. This will help to make a difference
+ between regular and Low Energy devices.
+*/
+void QBluetoothDeviceInfo::setCoreConfiguration(const CoreConfiguration &coreConfig)
+{
+ Q_D(QBluetoothDeviceInfo);
+
+ d->deviceCoreConfiguration = coreConfig;
+}
+
+/*!
+ Returns the configuration of the device. If device configuration is not set,
+ basic rate device configuration will be returned.
+ \sa setCoreConfiguration
+*/
+QBluetoothDeviceInfo::CoreConfiguration QBluetoothDeviceInfo::coreConfiguration() const
+{
+ Q_D(const QBluetoothDeviceInfo);
+
+ return d->deviceCoreConfiguration;
+}
+
+/*!
Returns true if the QBluetoothDeviceInfo object is created from cached data.
*/
bool QBluetoothDeviceInfo::isCached() const