diff options
author | Alex Blasche <alexander.blasche@qt.io> | 2017-06-27 14:56:30 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-06-27 11:03:19 -0700 |
commit | 57753321b069c93050a40eaddef9a49f1a2c9e19 (patch) | |
tree | 7e8636e31b5b84bec7a969ff78fc4ecfdcda7825 /core/qt-ble.h | |
parent | 81dabe5ace3091656cdbac57598699bb3b9beea7 (diff) | |
download | subsurface-57753321b069c93050a40eaddef9a49f1a2c9e19.tar.gz |
Ensure all found BLE services are tracked
If a device has more than one service the order of service discovery
determined the selection of the service that we intend to interact
with. This assumption is not accurate and is even platform dependent.
Thinking ahead, it is likely that some devices may require us to keep
track and interact with multiple services at the time.
The new logic still suffers from the fact that there is no way
to select the correct service for interaction. This will require
higher level stack changes.
Signed-off-by: Alex Blasche <alexander.blasche@qt.io>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'core/qt-ble.h')
-rw-r--r-- | core/qt-ble.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/core/qt-ble.h b/core/qt-ble.h index f1e353946..cd27423a4 100644 --- a/core/qt-ble.h +++ b/core/qt-ble.h @@ -2,6 +2,7 @@ #ifndef QT_BLE_H #define QT_BLE_H +#include <QVector> #include <QLowEnergyController> #include <QEventLoop> @@ -14,7 +15,10 @@ public: ~BLEObject(); dc_status_t write(const void* data, size_t size, size_t *actual); dc_status_t read(void* data, size_t size, size_t *actual); - QLowEnergyService *service; + + //TODO: need better mode of selecting the desired service than below + inline QLowEnergyService *preferredService() + { return services.isEmpty() ? nullptr : services[0]; } public slots: void addService(const QBluetoothUuid &newService); @@ -23,7 +27,9 @@ public slots: void writeCompleted(const QLowEnergyDescriptor &d, const QByteArray &value); private: - QLowEnergyController *controller; + QVector<QLowEnergyService *> services; + + QLowEnergyController *controller = nullptr; QList<QByteArray> receivedPackets; QEventLoop waitForPacket; }; |