summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qlowenergyservice.h
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@digia.com>2014-06-18 12:24:09 +0200
committerAlex Blasche <alexander.blasche@digia.com>2014-06-19 11:11:24 +0200
commit243db8a80ff4cfeba5eda13f900fd11e1144e367 (patch)
tree754db9ebff4ae081b3f5b47ebee301cc352dcfb6 /src/bluetooth/qlowenergyservice.h
parent6014943db4b72962731a90c09a1b476af8385c29 (diff)
Connect QLowEnergyService and QLowEnergyControllerNew classes
Ensures that the two classes have sufficient references to each other. When the controller disconnects the related QLES classes should become invalid. Introduces an error flag for QLowEnergyService. Change-Id: I28aee49e45f93c68c4ac69a5e489c0a3cc33dbf5 Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Diffstat (limited to 'src/bluetooth/qlowenergyservice.h')
-rw-r--r--src/bluetooth/qlowenergyservice.h20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/bluetooth/qlowenergyservice.h b/src/bluetooth/qlowenergyservice.h
index 20ff6c9c..03505e30 100644
--- a/src/bluetooth/qlowenergyservice.h
+++ b/src/bluetooth/qlowenergyservice.h
@@ -47,6 +47,7 @@
QT_BEGIN_NAMESPACE
class QLowEnergyServicePrivate;
+class QLowEnergyControllerNewPrivate;
class Q_BLUETOOTH_EXPORT QLowEnergyService : public QObject
{
Q_OBJECT
@@ -56,6 +57,11 @@ public:
IncludedService
};
+ enum ServiceError {
+ NoError = 0,
+ ServiceNotValidError
+ };
+
enum ServiceState {
InvalidService = 0, // when underlying controller disconnects
DiscoveryRequired, // we know start/end handle but nothing more
@@ -76,22 +82,30 @@ public:
void discoverDetails();
+ ServiceError error() const;
+
+
Q_SIGNALS:
void stateChanged(QLowEnergyService::ServiceState newState);
void characteristicChanged(const QLowEnergyCharacteristicInfo &info,
const QByteArray &value);
void descriptorChanged(const QLowEnergyDescriptorInfo &info,
const QByteArray &value);
+ void error(QLowEnergyService::ServiceError error);
private:
Q_DECLARE_PRIVATE(QLowEnergyService)
QLowEnergyServicePrivate *d_ptr;
- //somehow we need to connect this to QLowEnergyControllerNew
- //which owns the communication
+ // the symbols below are used by QLowEnergyControllerNewPrivate
+ // TODO check whether there are other ways of accessing the internals
+ friend class QLowEnergyControllerNewPrivate;
+
QLowEnergyService(const QBluetoothUuid &uuid,
QObject *parent = 0);
- friend class QLowEnergyControllerNewPrivate;
+ void setController(QLowEnergyControllerNewPrivate* control);
+ void setError(QLowEnergyService::ServiceError newError);
+ void setState(QLowEnergyService::ServiceState newState);
};
QT_END_NAMESPACE