diff options
author | Alex Blasche <alexander.blasche@digia.com> | 2014-06-30 14:17:47 +0200 |
---|---|---|
committer | Alex Blasche <alexander.blasche@digia.com> | 2014-07-02 16:17:20 +0200 |
commit | e1fdef843fd8a6d8495bf96810e0ffc32d9ca0f6 (patch) | |
tree | bed0dc1d419dc11f294f19d2d8b77d3ddb64e5d6 /src/bluetooth/qlowenergycharacteristic.cpp | |
parent | a354431ba0d8c057bd360c0b23565b650814ffc3 (diff) |
Add comparison operators for QLECharacteristic & QLEDescriptor
Change-Id: I5e23af887aa423c6c80335399d0342bec964f6d2
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
Diffstat (limited to 'src/bluetooth/qlowenergycharacteristic.cpp')
-rw-r--r-- | src/bluetooth/qlowenergycharacteristic.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/bluetooth/qlowenergycharacteristic.cpp b/src/bluetooth/qlowenergycharacteristic.cpp index f74aa808..aa1795c3 100644 --- a/src/bluetooth/qlowenergycharacteristic.cpp +++ b/src/bluetooth/qlowenergycharacteristic.cpp @@ -219,6 +219,41 @@ QLowEnergyCharacteristic &QLowEnergyCharacteristic::operator=(const QLowEnergyCh } /*! + Returns \c true if \a other is equal to this QLowEnergyCharacteristic; otherwise \c false. + + Two QLowEnergyCharcteristic instances are considered to be equal if they refer to + the same charcteristic on the same remote Bluetooth Low Energy device. + */ +bool QLowEnergyCharacteristic::operator==(const QLowEnergyCharacteristic &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->handle != other.data->handle) + return false; + + return true; +} + +/*! + Returns \c true if \a other is not equal to this QLowEnergyCharacteristic; otherwise \c false. + + Two QLowEnergyCharcteristic instances are considered to be equal if they refer to + the same charcteristic on the same remote Bluetooth Low Energy device. + */ + +bool QLowEnergyCharacteristic::operator!=(const QLowEnergyCharacteristic &other) const +{ + return !(*this == other); +} + +/*! Returns \c true if the QLowEnergyCharacteristic object is valid, otherwise returns \c false. An invalid characteristic object is not associated to any service |