summaryrefslogtreecommitdiffstats
path: root/examples/bluetooth
diff options
context:
space:
mode:
authorNedim Hadzic <nhadzic@blackberry.com>2014-02-19 15:59:53 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-21 22:57:03 +0100
commitcdc3ee8b00380ad208561e6c9bf575762fa398fb (patch)
tree768f63e371bdfd914943307d9b330d612d7a3329 /examples/bluetooth
parentf9a28bc6009d3f0eecc65df9da75faa8c4133fcf (diff)
Renaming QLowEnergyServiceInfo methods
Ensures that QLowEnergyServiceInfo and QBluetoothServiceInfo are more alike. Tests and examples updated as well. Change-Id: I0f6a97900891a9673f99578bdc8d156a8c403513 Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Diffstat (limited to 'examples/bluetooth')
-rw-r--r--examples/bluetooth/btscanner/service.cpp2
-rw-r--r--examples/bluetooth/heartlistener/heartrate.cpp12
-rw-r--r--examples/bluetooth/lowenergyscanner/device.cpp6
-rw-r--r--examples/bluetooth/lowenergyscanner/serviceinfo.cpp4
4 files changed, 13 insertions, 11 deletions
diff --git a/examples/bluetooth/btscanner/service.cpp b/examples/bluetooth/btscanner/service.cpp
index c1db7cce..5e0f7da9 100644
--- a/examples/bluetooth/btscanner/service.cpp
+++ b/examples/bluetooth/btscanner/service.cpp
@@ -106,7 +106,7 @@ void ServiceDiscoveryDialog::addService(const QBluetoothServiceInfo &info)
void ServiceDiscoveryDialog::addLowEnergyService(const QLowEnergyServiceInfo &gatt)
{
- QString line = gatt.name();
+ QString line = gatt.serviceName();
ui->list->addItem(line);
}
diff --git a/examples/bluetooth/heartlistener/heartrate.cpp b/examples/bluetooth/heartlistener/heartrate.cpp
index a80f0c0c..1a4e3d47 100644
--- a/examples/bluetooth/heartlistener/heartrate.cpp
+++ b/examples/bluetooth/heartlistener/heartrate.cpp
@@ -155,7 +155,7 @@ void HeartRate::connectToService(const QString &address)
void HeartRate::addLowEnergyService(const QLowEnergyServiceInfo &gatt)
{
- if (gatt.uuid() == QBluetoothUuid::HeartRate) {
+ if (gatt.serviceUuid() == QBluetoothUuid::HeartRate) {
setMessage("Heart Rate service discovered. Waiting for service scan to be done...");
m_heartRateService = QLowEnergyServiceInfo(gatt);
foundHeartRateService = true;
@@ -185,7 +185,7 @@ void HeartRate::startConnection()
void HeartRate::serviceConnected(const QLowEnergyServiceInfo &leService)
{
setMessage("Connected to service. Waiting for updates");
- if (leService.uuid() == QBluetoothUuid::HeartRate) {
+ if (leService.serviceUuid() == QBluetoothUuid::HeartRate) {
for ( int i = 0; i<leService.characteristics().size(); i++) {
if (leService.characteristics().at(i).uuid() == QBluetoothUuid::HeartRateMeasurement) {
m_start = QDateTime::currentDateTime();
@@ -257,12 +257,14 @@ int HeartRate::hR() const
//! [Error handling]
void HeartRate::errorReceived(const QLowEnergyServiceInfo &leService)
{
- setMessage(QStringLiteral("Error: ") + leService.errorString());
+ qWarning() << "Error: " << leService.serviceUuid() << m_leInfo->errorString();
+ setMessage(QStringLiteral("Error: ") + m_leInfo->errorString());
}
void HeartRate::errorReceivedCharacteristic(const QLowEnergyCharacteristicInfo &leCharacteristic)
{
- setMessage(QStringLiteral("Error: ") + leCharacteristic.errorString());
+ qWarning() << "Error: " << leCharacteristic.uuid() << m_leInfo->errorString();
+ setMessage(QStringLiteral("Error: ") + m_leInfo->errorString());
}
//! [Error handling]
@@ -352,7 +354,7 @@ float HeartRate::caloriesCalculation()
void HeartRate::serviceDisconnected(const QLowEnergyServiceInfo &service)
{
setMessage("Heart Rate service disconnected");
- qWarning() << "Service disconnected: " << service.uuid();
+ qWarning() << "Service disconnected: " << service.serviceUuid();
}
int HeartRate::numDevices() const
diff --git a/examples/bluetooth/lowenergyscanner/device.cpp b/examples/bluetooth/lowenergyscanner/device.cpp
index 50d51631..00a0ae39 100644
--- a/examples/bluetooth/lowenergyscanner/device.cpp
+++ b/examples/bluetooth/lowenergyscanner/device.cpp
@@ -176,7 +176,7 @@ void Device::connectToService(const QString &uuid)
for (int i = 0; i < m_services.size(); i++) {
ServiceInfo *service = (ServiceInfo*)m_services.at(i);
a = QLowEnergyServiceInfo(service->getLeService());
- if (a.uuid() == u)
+ if (a.serviceUuid() == u)
info->connectToService(a);
}
}
@@ -195,8 +195,8 @@ void Device::serviceConnected(const QLowEnergyServiceInfo &service)
void Device::errorReceived(const QLowEnergyServiceInfo &service)
{
- qDebug() << "Error: " << service.errorString();
- setUpdate(service.errorString());
+ qDebug() << "Error: " << info->errorString() << service.serviceUuid();
+ setUpdate(info->errorString());
}
void Device::setUpdate(QString message)
diff --git a/examples/bluetooth/lowenergyscanner/serviceinfo.cpp b/examples/bluetooth/lowenergyscanner/serviceinfo.cpp
index 471fb40a..d1223bdc 100644
--- a/examples/bluetooth/lowenergyscanner/serviceinfo.cpp
+++ b/examples/bluetooth/lowenergyscanner/serviceinfo.cpp
@@ -59,10 +59,10 @@ QLowEnergyServiceInfo ServiceInfo::getLeService() const
QString ServiceInfo::getName()
{
- return m_serviceLe.name();
+ return m_serviceLe.serviceName();
}
QString ServiceInfo::getUuid()
{
- return m_serviceLe.uuid().toString().remove(QLatin1Char('{')).remove(QLatin1Char('}'));
+ return m_serviceLe.serviceUuid().toString().remove(QLatin1Char('{')).remove(QLatin1Char('}'));
}