summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@qt.io>2017-11-20 13:48:52 +0100
committerOswald Buddenhagen <oswald.buddenhagen@qt.io>2017-11-20 13:48:52 +0100
commit7eb9db93aea072dae984d127caa532090abbdb07 (patch)
tree7b2cf0289cb8691cc3a7460818777f56a8676bd5
parente54779075b936c224b7647599edf8368fc2bbd52 (diff)
parent5a38231103159346c976a620c01fba37eea85d92 (diff)
Merge 5.10 into 5.10.0
-rw-r--r--src/bluetooth/qbluetoothserviceinfo_winrt.cpp7
-rw-r--r--src/bluetooth/qlowenergycontroller_winrt.cpp24
2 files changed, 30 insertions, 1 deletions
diff --git a/src/bluetooth/qbluetoothserviceinfo_winrt.cpp b/src/bluetooth/qbluetoothserviceinfo_winrt.cpp
index 975a3f4a..fd77662a 100644
--- a/src/bluetooth/qbluetoothserviceinfo_winrt.cpp
+++ b/src/bluetooth/qbluetoothserviceinfo_winrt.cpp
@@ -340,7 +340,12 @@ bool QBluetoothServiceInfoPrivate::registerService(const QBluetoothAddress &loca
hr = providerStatics->CreateAsync(serviceId.Get(), &op);
Q_ASSERT_SUCCEEDED(hr);
hr = QWinRTFunctions::await(op, serviceProvider.GetAddressOf());
- Q_ASSERT_SUCCEEDED(hr);
+ if (hr == HRESULT_FROM_WIN32(ERROR_DEVICE_NOT_AVAILABLE)) {
+ qCWarning(QT_BT_WINRT) << Q_FUNC_INFO << "No bluetooth adapter available.";
+ return false;
+ } else {
+ Q_ASSERT_SUCCEEDED(hr);
+ }
ComPtr<IStreamSocketListener> listener = sPriv->listener();
if (!listener) {
diff --git a/src/bluetooth/qlowenergycontroller_winrt.cpp b/src/bluetooth/qlowenergycontroller_winrt.cpp
index 838d563d..3e7c8b20 100644
--- a/src/bluetooth/qlowenergycontroller_winrt.cpp
+++ b/src/bluetooth/qlowenergycontroller_winrt.cpp
@@ -659,6 +659,7 @@ void QLowEnergyControllerPrivate::discoverServiceDetails(const QBluetoothUuid &s
void QLowEnergyControllerPrivate::startAdvertising(const QLowEnergyAdvertisingParameters &, const QLowEnergyAdvertisingData &, const QLowEnergyAdvertisingData &)
{
+ setError(QLowEnergyController::AdvertisingError);
Q_UNIMPLEMENTED();
}
@@ -677,6 +678,12 @@ void QLowEnergyControllerPrivate::readCharacteristic(const QSharedPointer<QLowEn
{
qCDebug(QT_BT_WINRT) << __FUNCTION__ << service << charHandle;
Q_ASSERT(!service.isNull());
+ if (role == QLowEnergyController::PeripheralRole) {
+ service->setError(QLowEnergyService::CharacteristicReadError);
+ Q_UNIMPLEMENTED();
+ return;
+ }
+
if (!service->characteristicList.contains(charHandle)) {
qCDebug(QT_BT_WINRT) << charHandle << "could not be found in service" << service->uuid;
service->setError(QLowEnergyService::CharacteristicReadError);
@@ -736,6 +743,12 @@ void QLowEnergyControllerPrivate::readDescriptor(const QSharedPointer<QLowEnergy
{
qCDebug(QT_BT_WINRT) << __FUNCTION__ << service << charHandle << descHandle;
Q_ASSERT(!service.isNull());
+ if (role == QLowEnergyController::PeripheralRole) {
+ service->setError(QLowEnergyService::DescriptorReadError);
+ Q_UNIMPLEMENTED();
+ return;
+ }
+
if (!service->characteristicList.contains(charHandle)) {
qCDebug(QT_BT_WINRT) << "Descriptor" << descHandle << "in characteristic" << charHandle
<< "cannot be found in service" << service->uuid;
@@ -862,6 +875,11 @@ void QLowEnergyControllerPrivate::writeCharacteristic(const QSharedPointer<QLowE
{
qCDebug(QT_BT_WINRT) << __FUNCTION__ << service << charHandle << newValue << mode;
Q_ASSERT(!service.isNull());
+ if (role == QLowEnergyController::PeripheralRole) {
+ service->setError(QLowEnergyService::CharacteristicWriteError);
+ Q_UNIMPLEMENTED();
+ return;
+ }
if (!service->characteristicList.contains(charHandle)) {
qCDebug(QT_BT_WINRT) << "Characteristic" << charHandle << "cannot be found in service" << service->uuid;
service->setError(QLowEnergyService::CharacteristicWriteError);
@@ -946,6 +964,12 @@ void QLowEnergyControllerPrivate::writeDescriptor(
{
qCDebug(QT_BT_WINRT) << __FUNCTION__ << service << charHandle << descHandle << newValue;
Q_ASSERT(!service.isNull());
+ if (role == QLowEnergyController::PeripheralRole) {
+ service->setError(QLowEnergyService::DescriptorWriteError);
+ Q_UNIMPLEMENTED();
+ return;
+ }
+
if (!service->characteristicList.contains(charHandle)) {
qCDebug(QT_BT_WINRT) << "Descriptor" << descHandle << "in characteristic" << charHandle
<< "could not be found in service" << service->uuid;