diff options
author | Nedim Hadzic <nhadzic@blackberry.com> | 2013-10-23 17:33:36 +0200 |
---|---|---|
committer | Alex Blasche <alexander.blasche@digia.com> | 2013-11-04 09:35:01 +0100 |
commit | ec61d7b9e82e6d653c02df14f34acdba8fc060db (patch) | |
tree | d61e73318c11e0dcae471ee7c1f8ed56397b9f75 /examples/bluetooth/btscanner/service.cpp | |
parent | b00388ea1448cfd977c54f53d038d1a270562d53 (diff) |
Implemented Bluetooth Low Energy gatt service and characteristics discovery
Bluez v4.x does not have total support for LE devices, a new approach, using gatttool command was implemented.
Auto-tests and documentation will be in other commits.
Change-Id: Iee711cc111199e15956052eebb7593bd3a5e27c8
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Diffstat (limited to 'examples/bluetooth/btscanner/service.cpp')
-rw-r--r-- | examples/bluetooth/btscanner/service.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/examples/bluetooth/btscanner/service.cpp b/examples/bluetooth/btscanner/service.cpp index dedd3770..c1db7cce 100644 --- a/examples/bluetooth/btscanner/service.cpp +++ b/examples/bluetooth/btscanner/service.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2013 BlackBerry Limited. All rights reserved. ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtBluetooth module of the Qt Toolkit. @@ -44,6 +45,9 @@ #include <qbluetoothservicediscoveryagent.h> #include <qbluetoothserviceinfo.h> #include <qbluetoothlocaldevice.h> +#include <qlowenergyserviceinfo.h> +#include <qlowenergycharacteristicinfo.h> +#include <qbluetoothuuid.h> ServiceDiscoveryDialog::ServiceDiscoveryDialog(const QString &name, @@ -74,6 +78,8 @@ ServiceDiscoveryDialog::ServiceDiscoveryDialog(const QString &name, connect(discoveryAgent, SIGNAL(serviceDiscovered(const QBluetoothServiceInfo&)), this, SLOT(addService(const QBluetoothServiceInfo&))); connect(discoveryAgent, SIGNAL(finished()), ui->status, SLOT(hide())); + connect(discoveryAgent, SIGNAL(serviceDiscovered(const QLowEnergyServiceInfo&)), + this, SLOT(addLowEnergyService(const QLowEnergyServiceInfo&))); discoveryAgent->start(); } @@ -98,3 +104,10 @@ void ServiceDiscoveryDialog::addService(const QBluetoothServiceInfo &info) ui->list->addItem(line); } +void ServiceDiscoveryDialog::addLowEnergyService(const QLowEnergyServiceInfo &gatt) +{ + QString line = gatt.name(); + + ui->list->addItem(line); +} + |