From 2da622742aaf2566edea43b541180a7fb23cb899 Mon Sep 17 00:00:00 2001 From: Alex Blasche Date: Wed, 27 Aug 2014 13:36:13 +0200 Subject: Rename descriptorChanged() to descriptorWritten() This is the part of a change to be able to distinguish characteristic write confirmations from characteristic change notifications. Since descriptors cannot receive notifications they won't have a changed() signal and all existing descriptorChanged() signals become descriptorWritten() signals. The changed() signal is emitted when a value notification is received from the device. The written() signal is emitted when a write request from the API user was successful. Change-Id: Ief2491ead4723eaa1bca65a09a09c34458f33630 Reviewed-by: Lars Knoll --- src/bluetooth/qlowenergycontroller_bluez.cpp | 2 +- src/bluetooth/qlowenergydescriptor.cpp | 6 +++--- src/bluetooth/qlowenergyservice.cpp | 12 +++++++----- src/bluetooth/qlowenergyservice.h | 2 +- src/bluetooth/qlowenergyserviceprivate_p.h | 2 +- 5 files changed, 13 insertions(+), 11 deletions(-) (limited to 'src/bluetooth') diff --git a/src/bluetooth/qlowenergycontroller_bluez.cpp b/src/bluetooth/qlowenergycontroller_bluez.cpp index 97eb429b..2fd0e325 100644 --- a/src/bluetooth/qlowenergycontroller_bluez.cpp +++ b/src/bluetooth/qlowenergycontroller_bluez.cpp @@ -799,7 +799,7 @@ void QLowEnergyControllerPrivate::processReply( } else { service->characteristicList[charHandle].descriptorList[descriptorHandle].value = newValue; QLowEnergyDescriptor descriptor(service, charHandle, descriptorHandle); - emit service->descriptorChanged(descriptor, newValue); + emit service->descriptorWritten(descriptor, newValue); } } break; diff --git a/src/bluetooth/qlowenergydescriptor.cpp b/src/bluetooth/qlowenergydescriptor.cpp index 976ee73f..270a8a68 100644 --- a/src/bluetooth/qlowenergydescriptor.cpp +++ b/src/bluetooth/qlowenergydescriptor.cpp @@ -52,10 +52,10 @@ QT_BEGIN_NAMESPACE and so on). The descriptor value may be written via the \l QLowEnergyService instance - that manages the service to which this descriptor belongs. the + that manages the service to which this descriptor belongs. The \l {QLowEnergyService::writeDescriptor()} function writes the new value. - The \l {QLowEnergyService::descriptorChanged()} signal - is emitted upon success. The \l value() of this object is automatically updated accordingly. + The \l {QLowEnergyService::descriptorWritten()} signal + is emitted upon success. The cahced \l value() of this object is updated accordingly. \sa QLowEnergyService, QLowEnergyCharacteristic */ diff --git a/src/bluetooth/qlowenergyservice.cpp b/src/bluetooth/qlowenergyservice.cpp index d60b4e81..ab0e0a43 100644 --- a/src/bluetooth/qlowenergyservice.cpp +++ b/src/bluetooth/qlowenergyservice.cpp @@ -224,7 +224,7 @@ QT_BEGIN_NAMESPACE */ /*! - \fn void QLowEnergyService::descriptorChanged(const QLowEnergyDescriptor &descriptor, const QByteArray &newValue) + \fn void QLowEnergyService::descriptorWritten(const QLowEnergyDescriptor &descriptor, const QByteArray &newValue) This signal is emitted when the value of \a descriptor is successfully changed to \a newValue. The change may have been caused @@ -255,8 +255,8 @@ QLowEnergyService::QLowEnergyService(QSharedPointer p, this, SIGNAL(stateChanged(QLowEnergyService::ServiceState))); connect(p.data(), SIGNAL(characteristicChanged(QLowEnergyCharacteristic,QByteArray)), this, SIGNAL(characteristicChanged(QLowEnergyCharacteristic,QByteArray))); - connect(p.data(), SIGNAL(descriptorChanged(QLowEnergyDescriptor,QByteArray)), - this, SIGNAL(descriptorChanged(QLowEnergyDescriptor,QByteArray))); + connect(p.data(), SIGNAL(descriptorWritten(QLowEnergyDescriptor,QByteArray)), + this, SIGNAL(descriptorWritten(QLowEnergyDescriptor,QByteArray))); } /*! @@ -448,7 +448,8 @@ bool QLowEnergyService::contains(const QLowEnergyCharacteristic &characteristic) /*! Writes \a newValue as value for the \a characteristic. If the operation is successful, - the \l characteristicChanged() signal is emitted. + the \l characteristicChanged() signal is emitted; otherwise the \l CharacteristicWriteError + is emitted. The \a mode parameter determines whether the remote device should send a write confirmation. The to-be-written \a characteristic must support the relevant @@ -522,7 +523,8 @@ bool QLowEnergyService::contains(const QLowEnergyDescriptor &descriptor) const /*! Writes \a newValue as value for \a descriptor. If the operation is successful, - the \l descriptorChanged() signal is emitted. + the \l descriptorWritten() signal is emitted; otherwise the \l DescriptorWriteError + is emitted. A descriptor can only be written if this service is in the \l ServiceDiscovered state, belongs to the service and is writable. diff --git a/src/bluetooth/qlowenergyservice.h b/src/bluetooth/qlowenergyservice.h index 7bb2c0d3..e4612c8a 100644 --- a/src/bluetooth/qlowenergyservice.h +++ b/src/bluetooth/qlowenergyservice.h @@ -101,7 +101,7 @@ Q_SIGNALS: void stateChanged(QLowEnergyService::ServiceState newState); void characteristicChanged(const QLowEnergyCharacteristic &info, const QByteArray &value); - void descriptorChanged(const QLowEnergyDescriptor &info, + void descriptorWritten(const QLowEnergyDescriptor &info, const QByteArray &value); void error(QLowEnergyService::ServiceError error); diff --git a/src/bluetooth/qlowenergyserviceprivate_p.h b/src/bluetooth/qlowenergyserviceprivate_p.h index ec87da1f..9d41f21d 100644 --- a/src/bluetooth/qlowenergyserviceprivate_p.h +++ b/src/bluetooth/qlowenergyserviceprivate_p.h @@ -80,7 +80,7 @@ signals: void error(QLowEnergyService::ServiceError error); void characteristicChanged(const QLowEnergyCharacteristic &characteristic, const QByteArray &newValue); - void descriptorChanged(const QLowEnergyDescriptor &descriptor, + void descriptorWritten(const QLowEnergyDescriptor &descriptor, const QByteArray &newValue); public: -- cgit v1.2.3