summaryrefslogtreecommitdiffstats
path: root/examples/bluetooth
diff options
context:
space:
mode:
Diffstat (limited to 'examples/bluetooth')
-rw-r--r--examples/bluetooth/btfiletransfer/btfiletransfer.pro2
-rw-r--r--examples/bluetooth/heartlistener/heartrate.cpp14
-rw-r--r--examples/bluetooth/heartlistener/heartrate.h5
-rw-r--r--examples/bluetooth/lowenergyscanner/device.cpp7
-rw-r--r--examples/bluetooth/lowenergyscanner/device.h4
5 files changed, 17 insertions, 15 deletions
diff --git a/examples/bluetooth/btfiletransfer/btfiletransfer.pro b/examples/bluetooth/btfiletransfer/btfiletransfer.pro
index 00b16415..e5d47302 100644
--- a/examples/bluetooth/btfiletransfer/btfiletransfer.pro
+++ b/examples/bluetooth/btfiletransfer/btfiletransfer.pro
@@ -26,5 +26,5 @@ OTHER_FILES += \
RESOURCES += \
btfiletransfer.qrc
-target.path = $$[QT_INSTALL_EXAMPLES]/bluetooth/scanner
+target.path = $$[QT_INSTALL_EXAMPLES]/bluetooth/btfiletransfer
INSTALLS += target
diff --git a/examples/bluetooth/heartlistener/heartrate.cpp b/examples/bluetooth/heartlistener/heartrate.cpp
index a1f80121..7d135e5b 100644
--- a/examples/bluetooth/heartlistener/heartrate.cpp
+++ b/examples/bluetooth/heartlistener/heartrate.cpp
@@ -145,8 +145,10 @@ void HeartRate::connectToService(const QString &address)
m_leInfo = new QLowEnergyController();
connect(m_leInfo, SIGNAL(connected(QLowEnergyServiceInfo)), this, SLOT(serviceConnected(QLowEnergyServiceInfo)));
connect(m_leInfo, SIGNAL(disconnected(QLowEnergyServiceInfo)), this, SLOT(serviceDisconnected(QLowEnergyServiceInfo)));
- connect(m_leInfo, SIGNAL(error(QLowEnergyServiceInfo)), this, SLOT(errorReceived(QLowEnergyServiceInfo)));
- connect(m_leInfo, SIGNAL(error(QLowEnergyCharacteristicInfo)), this, SLOT(errorReceivedCharacteristic(QLowEnergyCharacteristicInfo)));
+ connect(m_leInfo, SIGNAL(error(QLowEnergyServiceInfo,QLowEnergyController::Error)),
+ this, SLOT(errorReceived(QLowEnergyServiceInfo,QLowEnergyController::Error)));
+ connect(m_leInfo, SIGNAL(error(QLowEnergyCharacteristicInfo,QLowEnergyController::Error)),
+ this, SLOT(errorReceivedCharacteristic(QLowEnergyCharacteristicInfo,QLowEnergyController::Error)));
connect(m_leInfo, SIGNAL(valueChanged(QLowEnergyCharacteristicInfo)), this, SLOT(receiveMeasurement(QLowEnergyCharacteristicInfo)));
}
//! [Connect signals]
@@ -253,15 +255,15 @@ int HeartRate::hR() const
}
//! [Error handling]
-void HeartRate::errorReceived(const QLowEnergyServiceInfo &leService)
+void HeartRate::errorReceived(const QLowEnergyServiceInfo &leService, QLowEnergyController::Error error)
{
- qWarning() << "Error: " << leService.serviceUuid() << m_leInfo->errorString();
+ qWarning() << "Error: " << leService.serviceUuid() << m_leInfo->errorString() << error;
setMessage(QStringLiteral("Error: ") + m_leInfo->errorString());
}
-void HeartRate::errorReceivedCharacteristic(const QLowEnergyCharacteristicInfo &leCharacteristic)
+void HeartRate::errorReceivedCharacteristic(const QLowEnergyCharacteristicInfo &leCharacteristic, QLowEnergyController::Error error)
{
- qWarning() << "Error: " << leCharacteristic.uuid() << m_leInfo->errorString();
+ qWarning() << "Error: " << leCharacteristic.uuid() << m_leInfo->errorString() << error;
setMessage(QStringLiteral("Error: ") + m_leInfo->errorString());
}
//! [Error handling]
diff --git a/examples/bluetooth/heartlistener/heartrate.h b/examples/bluetooth/heartlistener/heartrate.h
index 33e3181c..581000ad 100644
--- a/examples/bluetooth/heartlistener/heartrate.h
+++ b/examples/bluetooth/heartlistener/heartrate.h
@@ -59,7 +59,6 @@
QT_FORWARD_DECLARE_CLASS (QLowEnergyServiceInfo)
QT_FORWARD_DECLARE_CLASS (QLowEnergyCharacteristicInfo)
-QT_FORWARD_DECLARE_CLASS (QLowEnergyController)
QT_USE_NAMESPACE
class HeartRate: public QObject
@@ -98,8 +97,8 @@ public slots:
void serviceScanError(QBluetoothServiceDiscoveryAgent::Error);
void serviceConnected(const QLowEnergyServiceInfo &);
void receiveMeasurement(const QLowEnergyCharacteristicInfo &);
- void errorReceived(const QLowEnergyServiceInfo &);
- void errorReceivedCharacteristic(const QLowEnergyCharacteristicInfo &);
+ void errorReceived(const QLowEnergyServiceInfo &, QLowEnergyController::Error);
+ void errorReceivedCharacteristic(const QLowEnergyCharacteristicInfo &, QLowEnergyController::Error);
void serviceDisconnected(const QLowEnergyServiceInfo &);
void disconnectService();
void obtainResults();
diff --git a/examples/bluetooth/lowenergyscanner/device.cpp b/examples/bluetooth/lowenergyscanner/device.cpp
index 44cd3512..d137fd40 100644
--- a/examples/bluetooth/lowenergyscanner/device.cpp
+++ b/examples/bluetooth/lowenergyscanner/device.cpp
@@ -152,7 +152,8 @@ void Device::scanServices(QString address)
// Connecting signals and slots for connecting to LE services.
info = new QLowEnergyController();
connect(info, SIGNAL(connected(QLowEnergyServiceInfo)), this, SLOT(serviceConnected(QLowEnergyServiceInfo)));
- connect(info, SIGNAL(error(QLowEnergyServiceInfo)), this, SLOT(errorReceived(QLowEnergyServiceInfo)));
+ connect(info, SIGNAL(error(QLowEnergyServiceInfo, QLowEnergyCOntroller::Error)),
+ this, SLOT(errorReceived(QLowEnergyServiceInfo,QLowEnergyCOntroller::Error)));
connect(info, SIGNAL(disconnected(QLowEnergyServiceInfo)), this, SLOT(serviceDisconnected(QLowEnergyServiceInfo)));
}
}
@@ -195,9 +196,9 @@ void Device::serviceConnected(const QLowEnergyServiceInfo &service)
emit characteristicsDone();
}
-void Device::errorReceived(const QLowEnergyServiceInfo &service)
+void Device::errorReceived(const QLowEnergyServiceInfo &service, QLowEnergyController::Error error)
{
- qWarning() << "Error: " << info->errorString() << service.serviceUuid();
+ qWarning() << "Error: " << info->errorString() << service.serviceUuid() << error;
setUpdate(info->errorString());
}
diff --git a/examples/bluetooth/lowenergyscanner/device.h b/examples/bluetooth/lowenergyscanner/device.h
index 307b0fb9..3ac28c8f 100644
--- a/examples/bluetooth/lowenergyscanner/device.h
+++ b/examples/bluetooth/lowenergyscanner/device.h
@@ -49,6 +49,7 @@
#include <QBluetoothServiceDiscoveryAgent>
#include <QBluetoothDeviceDiscoveryAgent>
#include "deviceinfo.h"
+#include "qlowenergycontroller.h"
#include "qlowenergyserviceinfo.h"
#include "serviceinfo.h"
#include "characteristicinfo.h"
@@ -56,7 +57,6 @@
QT_FORWARD_DECLARE_CLASS (QBluetoothDeviceInfo)
QT_FORWARD_DECLARE_CLASS (QLowEnergyServiceInfo)
QT_FORWARD_DECLARE_CLASS (QLowEnergyCharacteristicInfo)
-QT_FORWARD_DECLARE_CLASS (QLowEnergyController)
QT_FORWARD_DECLARE_CLASS (QBluetoothServiceInfo)
class Device: public QObject
@@ -86,7 +86,7 @@ public slots:
void serviceScanDone();
void serviceConnected(const QLowEnergyServiceInfo &service);
void connectToService(const QString &uuid);
- void errorReceived(const QLowEnergyServiceInfo &service);
+ void errorReceived(const QLowEnergyServiceInfo &service, QLowEnergyController::Error);
void disconnectFromService();
void serviceDisconnected(const QLowEnergyServiceInfo &service);
void serviceScanError(QBluetoothServiceDiscoveryAgent::Error);