From ec61d7b9e82e6d653c02df14f34acdba8fc060db Mon Sep 17 00:00:00 2001 From: Nedim Hadzic Date: Wed, 23 Oct 2013 17:33:36 +0200 Subject: 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 --- examples/bluetooth/btscanner/service.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'examples/bluetooth/btscanner/service.cpp') 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 #include #include +#include +#include +#include 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); +} + -- cgit v1.2.3