summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qlowenergydescriptor.cpp
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@digia.com>2014-06-30 14:17:47 +0200
committerAlex Blasche <alexander.blasche@digia.com>2014-07-02 16:17:20 +0200
commite1fdef843fd8a6d8495bf96810e0ffc32d9ca0f6 (patch)
treebed0dc1d419dc11f294f19d2d8b77d3ddb64e5d6 /src/bluetooth/qlowenergydescriptor.cpp
parenta354431ba0d8c057bd360c0b23565b650814ffc3 (diff)
Add comparison operators for QLECharacteristic & QLEDescriptor
Change-Id: I5e23af887aa423c6c80335399d0342bec964f6d2 Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
Diffstat (limited to 'src/bluetooth/qlowenergydescriptor.cpp')
-rw-r--r--src/bluetooth/qlowenergydescriptor.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/bluetooth/qlowenergydescriptor.cpp b/src/bluetooth/qlowenergydescriptor.cpp
index c0dfdbb8..d28e1a6e 100644
--- a/src/bluetooth/qlowenergydescriptor.cpp
+++ b/src/bluetooth/qlowenergydescriptor.cpp
@@ -137,6 +137,42 @@ QLowEnergyDescriptor &QLowEnergyDescriptor::operator=(const QLowEnergyDescriptor
}
/*!
+ Returns \c true if \a other is equal to this QLowEnergyCharacteristic; otherwise \c false.
+
+ Two QLowEnergyDescriptor instances are considered to be equal if they refer to
+ the same descriptor on the same remote Bluetooth Low Energy device.
+ */
+bool QLowEnergyDescriptor::operator==(const QLowEnergyDescriptor &other) const
+{
+ if (d_ptr != other.d_ptr)
+ return false;
+
+ if ((data && !other.data) || (!data && other.data))
+ return false;
+
+ if (!data)
+ return true;
+
+ if (data->charHandle != other.data->charHandle
+ || data->descHandle != other.data->descHandle) {
+ return false;
+ }
+
+ return true;
+}
+
+/*!
+ Returns \c true if \a other is not equal to this QLowEnergyCharacteristic; otherwise \c false.
+
+ Two QLowEnergyDescriptor instances are considered to be equal if they refer to
+ the same descriptor on the same remote Bluetooth Low Energy device.
+ */
+bool QLowEnergyDescriptor::operator!=(const QLowEnergyDescriptor &other) const
+{
+ return !(*this == other);
+}
+
+/*!
Returns \c true if the QLowEnergyDescriptor object is valid, otherwise returns \c false.
An invalid descriptor instance is not associated to any service