diff options
61 files changed, 217 insertions, 206 deletions
diff --git a/examples/bluetooth/btchat/chatclient.cpp b/examples/bluetooth/btchat/chatclient.cpp index 09946765..b6c85488 100644 --- a/examples/bluetooth/btchat/chatclient.cpp +++ b/examples/bluetooth/btchat/chatclient.cpp @@ -77,9 +77,7 @@ void ChatClient::startClient(const QBluetoothServiceInfo &remoteService) connect(socket, &QBluetoothSocket::readyRead, this, &ChatClient::readSocket); connect(socket, &QBluetoothSocket::connected, this, QOverload<>::of(&ChatClient::connected)); connect(socket, &QBluetoothSocket::disconnected, this, &ChatClient::disconnected); - connect(socket, QOverload<QBluetoothSocket::SocketError>::of(&QBluetoothSocket::error), - this, &ChatClient::onSocketErrorOccurred); - + connect(socket, &QBluetoothSocket::errorOccurred, this, &ChatClient::onSocketErrorOccurred); } //! [startClient] diff --git a/examples/bluetooth/heartrate-game/devicefinder.cpp b/examples/bluetooth/heartrate-game/devicefinder.cpp index 19ebee90..c63327f6 100644 --- a/examples/bluetooth/heartrate-game/devicefinder.cpp +++ b/examples/bluetooth/heartrate-game/devicefinder.cpp @@ -61,8 +61,8 @@ DeviceFinder::DeviceFinder(DeviceHandler *handler, QObject *parent): m_deviceDiscoveryAgent->setLowEnergyDiscoveryTimeout(5000); connect(m_deviceDiscoveryAgent, &QBluetoothDeviceDiscoveryAgent::deviceDiscovered, this, &DeviceFinder::addDevice); - connect(m_deviceDiscoveryAgent, static_cast<void (QBluetoothDeviceDiscoveryAgent::*)(QBluetoothDeviceDiscoveryAgent::Error)>(&QBluetoothDeviceDiscoveryAgent::error), - this, &DeviceFinder::scanError); + connect(m_deviceDiscoveryAgent, &QBluetoothDeviceDiscoveryAgent::errorOccurred, this, + &DeviceFinder::scanError); connect(m_deviceDiscoveryAgent, &QBluetoothDeviceDiscoveryAgent::finished, this, &DeviceFinder::scanFinished); connect(m_deviceDiscoveryAgent, &QBluetoothDeviceDiscoveryAgent::canceled, this, &DeviceFinder::scanFinished); diff --git a/examples/bluetooth/heartrate-game/devicehandler.cpp b/examples/bluetooth/heartrate-game/devicehandler.cpp index 96d93044..16e94577 100644 --- a/examples/bluetooth/heartrate-game/devicehandler.cpp +++ b/examples/bluetooth/heartrate-game/devicehandler.cpp @@ -121,11 +121,11 @@ void DeviceHandler::setDevice(DeviceInfo *device) connect(m_control, &QLowEnergyController::discoveryFinished, this, &DeviceHandler::serviceScanDone); - connect(m_control, static_cast<void (QLowEnergyController::*)(QLowEnergyController::Error)>(&QLowEnergyController::error), - this, [this](QLowEnergyController::Error error) { - Q_UNUSED(error); - setError("Cannot connect to remote device."); - }); + connect(m_control, &QLowEnergyController::errorOccurred, this, + [this](QLowEnergyController::Error error) { + Q_UNUSED(error); + setError("Cannot connect to remote device."); + }); connect(m_control, &QLowEnergyController::connected, this, [this]() { setInfo("Controller connected. Search services..."); m_control->discoverServices(); diff --git a/examples/bluetooth/lowenergyscanner/device.cpp b/examples/bluetooth/lowenergyscanner/device.cpp index 3c695970..be3f3103 100644 --- a/examples/bluetooth/lowenergyscanner/device.cpp +++ b/examples/bluetooth/lowenergyscanner/device.cpp @@ -68,8 +68,8 @@ Device::Device() discoveryAgent->setLowEnergyDiscoveryTimeout(5000); connect(discoveryAgent, &QBluetoothDeviceDiscoveryAgent::deviceDiscovered, this, &Device::addDevice); - connect(discoveryAgent, QOverload<QBluetoothDeviceDiscoveryAgent::Error>::of(&QBluetoothDeviceDiscoveryAgent::error), - this, &Device::deviceScanError); + connect(discoveryAgent, &QBluetoothDeviceDiscoveryAgent::errorOccurred, this, + &Device::deviceScanError); connect(discoveryAgent, &QBluetoothDeviceDiscoveryAgent::finished, this, &Device::deviceScanFinished); //! [les-devicediscovery-1] @@ -188,8 +188,7 @@ void Device::scanServices(const QString &address) controller = QLowEnergyController::createCentral(currentDevice.getDevice()); connect(controller, &QLowEnergyController::connected, this, &Device::deviceConnected); - connect(controller, QOverload<QLowEnergyController::Error>::of(&QLowEnergyController::error), - this, &Device::errorReceived); + connect(controller, &QLowEnergyController::errorOccurred, this, &Device::errorReceived); connect(controller, &QLowEnergyController::disconnected, this, &Device::deviceDisconnected); connect(controller, &QLowEnergyController::serviceDiscovered, diff --git a/examples/bluetooth/pingpong/pingpong.cpp b/examples/bluetooth/pingpong/pingpong.cpp index 671f673d..8787875f 100644 --- a/examples/bluetooth/pingpong/pingpong.cpp +++ b/examples/bluetooth/pingpong/pingpong.cpp @@ -269,8 +269,7 @@ void PingPong::startServer() m_serverInfo = new QBluetoothServer(QBluetoothServiceInfo::RfcommProtocol, this); connect(m_serverInfo, &QBluetoothServer::newConnection, this, &PingPong::clientConnected); - connect(m_serverInfo, QOverload<QBluetoothServer::Error>::of(&QBluetoothServer::error), - this, &PingPong::serverError); + connect(m_serverInfo, &QBluetoothServer::errorOccurred, this, &PingPong::serverError); const QBluetoothUuid uuid(serviceUuid); m_serverInfo->listen(uuid, QStringLiteral("PingPong server")); @@ -290,8 +289,8 @@ void PingPong::startClient() this, &PingPong::addService); connect(discoveryAgent, &QBluetoothServiceDiscoveryAgent::finished, this, &PingPong::done); - connect(discoveryAgent, QOverload<QBluetoothServiceDiscoveryAgent::Error>::of(&QBluetoothServiceDiscoveryAgent::error), - this, &PingPong::serviceScanError); + connect(discoveryAgent, &QBluetoothServiceDiscoveryAgent::errorOccurred, this, + &PingPong::serviceScanError); #ifdef Q_OS_ANDROID //see QTBUG-61392 if (QtAndroid::androidSdkVersion() >= 23) discoveryAgent->setUuidFilter(QBluetoothUuid(androidUuid)); @@ -324,8 +323,7 @@ void PingPong::clientConnected() this, &PingPong::readSocket); connect(socket, &QBluetoothSocket::disconnected, this, &PingPong::clientDisconnected); - connect(socket, QOverload<QBluetoothSocket::SocketError>::of(&QBluetoothSocket::error), - this, &PingPong::socketError); + connect(socket, &QBluetoothSocket::errorOccurred, this, &PingPong::socketError); //! [Initiating server socket] setMessage(QStringLiteral("Client connected. Get ready!")); diff --git a/src/bluetooth/ApiChangesQt6.txt b/src/bluetooth/ApiChangesQt6.txt index 139f731c..ba5df648 100644 --- a/src/bluetooth/ApiChangesQt6.txt +++ b/src/bluetooth/ApiChangesQt6.txt @@ -81,3 +81,10 @@ QML Interface (in QML: BluetoothService, BluetoothSocket, and BluetoothDiscoveryModel) have been removed without replacement. +"error" signals +--------------- + + - The "error" signals in QBluetoothDeviceDiscoveryAgent, QBluetoothLocalDevice, QBluetoothServer, + QBluetoothServiceDiscoveryAgent, QBluetoothSocket, QLowEnergyController, and QLowEnergyService + have been renamed to "errorOccurred" to remove ambiguities between the "error" signal and the + "error" getter. diff --git a/src/bluetooth/android/inputstreamthread.cpp b/src/bluetooth/android/inputstreamthread.cpp index 73cee823..c893fc28 100644 --- a/src/bluetooth/android/inputstreamthread.cpp +++ b/src/bluetooth/android/inputstreamthread.cpp @@ -99,9 +99,9 @@ void InputStreamThread::javaThreadErrorOccurred(int errorCode) QMutexLocker lock(&m_mutex); if (!expectClosure) - emit error(errorCode); + emit errorOccurred(errorCode); else - emit error(-1); //magic error, -1 means error was expected due to expected close() + emit errorOccurred(-1); // magic error, -1 means error was expected due to expected close() } //inside the java thread diff --git a/src/bluetooth/android/inputstreamthread_p.h b/src/bluetooth/android/inputstreamthread_p.h index 060b2acf..6ee0e50c 100644 --- a/src/bluetooth/android/inputstreamthread_p.h +++ b/src/bluetooth/android/inputstreamthread_p.h @@ -79,7 +79,7 @@ public: signals: void dataAvailable(); - void error(int errorCode); + void errorOccurred(int errorCode); private: QBluetoothSocketPrivateAndroid *m_socket_p; diff --git a/src/bluetooth/android/serveracceptancethread.cpp b/src/bluetooth/android/serveracceptancethread.cpp index ff176d5b..1e09f987 100644 --- a/src/bluetooth/android/serveracceptancethread.cpp +++ b/src/bluetooth/android/serveracceptancethread.cpp @@ -149,7 +149,7 @@ bool ServerAcceptanceThread::isRunning() const void ServerAcceptanceThread::javaThreadErrorOccurred(int errorCode) { qCDebug(QT_BT_ANDROID) << "JavaThread error:" << errorCode; - emit error(QBluetoothServer::InputOutputError); + emit errorOccurred(QBluetoothServer::InputOutputError); } //Runs inside the Java thread diff --git a/src/bluetooth/android/serveracceptancethread_p.h b/src/bluetooth/android/serveracceptancethread_p.h index c7c68314..06c081da 100644 --- a/src/bluetooth/android/serveracceptancethread_p.h +++ b/src/bluetooth/android/serveracceptancethread_p.h @@ -81,7 +81,7 @@ public: signals: void newConnection(); - void error(QBluetoothServer::Error); + void errorOccurred(QBluetoothServer::Error); private: bool validSetup() const; diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent.cpp index b334ba13..45ad9756 100644 --- a/src/bluetooth/qbluetoothdevicediscoveryagent.cpp +++ b/src/bluetooth/qbluetoothdevicediscoveryagent.cpp @@ -168,12 +168,14 @@ Q_DECLARE_LOGGING_CATEGORY(QT_BT) */ /*! - \fn void QBluetoothDeviceDiscoveryAgent::error(QBluetoothDeviceDiscoveryAgent::Error error) + \fn void QBluetoothDeviceDiscoveryAgent::errorOccurred(QBluetoothDeviceDiscoveryAgent::Error + error) This signal is emitted when an \a error occurs during Bluetooth device discovery. The \a error parameter describes the error that occurred. \sa error(), errorString() + \since 6.2 */ /*! @@ -348,7 +350,7 @@ void QBluetoothDeviceDiscoveryAgent::start(DiscoveryMethods methods) d->lastError = UnsupportedDiscoveryMethod; d->errorString = QBluetoothDeviceDiscoveryAgent::tr("One or more device discovery methods " "are not supported on this platform"); - emit error(d->lastError); + emit errorOccurred(d->lastError); return; } diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent.h b/src/bluetooth/qbluetoothdevicediscoveryagent.h index 3278baf9..cc3dc861 100644 --- a/src/bluetooth/qbluetoothdevicediscoveryagent.h +++ b/src/bluetooth/qbluetoothdevicediscoveryagent.h @@ -103,7 +103,7 @@ Q_SIGNALS: void deviceDiscovered(const QBluetoothDeviceInfo &info); void deviceUpdated(const QBluetoothDeviceInfo &info, QBluetoothDeviceInfo::Fields updatedFields); void finished(); - void error(QBluetoothDeviceDiscoveryAgent::Error error); + void errorOccurred(QBluetoothDeviceDiscoveryAgent::Error error); void canceled(); private: diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp index 8c6488d5..9726643c 100644 --- a/src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp +++ b/src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp @@ -126,7 +126,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::start(QBluetoothDeviceDiscoveryAgent qCWarning(QT_BT_ANDROID) << "Device does not support Bluetooth"; lastError = QBluetoothDeviceDiscoveryAgent::InputOutputError; errorString = QBluetoothDeviceDiscoveryAgent::tr("Device does not support Bluetooth"); - emit q->error(lastError); + emit q->errorOccurred(lastError); return; } @@ -136,7 +136,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::start(QBluetoothDeviceDiscoveryAgent qCWarning(QT_BT_ANDROID) << "Incorrect local adapter passed."; lastError = QBluetoothDeviceDiscoveryAgent::InvalidBluetoothAdapterError; errorString = QBluetoothDeviceDiscoveryAgent::tr("Passed address is not a local device."); - emit q->error(lastError); + emit q->errorOccurred(lastError); return; } @@ -144,7 +144,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::start(QBluetoothDeviceDiscoveryAgent if (state != 12) { // BluetoothAdapter.STATE_ON lastError = QBluetoothDeviceDiscoveryAgent::PoweredOffError; errorString = QBluetoothDeviceDiscoveryAgent::tr("Device is powered off"); - emit q->error(lastError); + emit q->errorOccurred(lastError); return; } @@ -176,7 +176,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::start(QBluetoothDeviceDiscoveryAgent qCWarning(QT_BT_ANDROID) << "Search not possible due to missing permission (ACCESS_COARSE|FINE_LOCATION)"; lastError = QBluetoothDeviceDiscoveryAgent::UnknownError; errorString = QBluetoothDeviceDiscoveryAgent::tr("Missing Location permission. Search is not possible."); - emit q->error(lastError); + emit q->errorOccurred(lastError); return; } } @@ -216,7 +216,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::start(QBluetoothDeviceDiscoveryAgent qCWarning(QT_BT_ANDROID) << "Search not possible due to turned off Location service"; lastError = QBluetoothDeviceDiscoveryAgent::UnknownError; errorString = QBluetoothDeviceDiscoveryAgent::tr("Location service turned off. Search is not possible."); - emit q->error(lastError); + emit q->errorOccurred(lastError); return; } @@ -244,7 +244,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::start(QBluetoothDeviceDiscoveryAgent lastError = QBluetoothDeviceDiscoveryAgent::InputOutputError; errorString = QBluetoothDeviceDiscoveryAgent::tr("Classic Discovery cannot be started"); - emit q->error(lastError); + emit q->errorOccurred(lastError); return; } // else fall through to LE discovery } else { @@ -265,7 +265,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::start(QBluetoothDeviceDiscoveryAgent m_active = NoScanActive; lastError = QBluetoothDeviceDiscoveryAgent::UnsupportedDiscoveryMethod; errorString = QBluetoothDeviceDiscoveryAgent::tr("Low Energy Discovery not supported"); - emit q->error(lastError); + emit q->errorOccurred(lastError); return; } @@ -290,7 +290,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::stop() if (!success) { lastError = QBluetoothDeviceDiscoveryAgent::InputOutputError; errorString = QBluetoothDeviceDiscoveryAgent::tr("Discovery cannot be stopped"); - emit q->error(lastError); + emit q->errorOccurred(lastError); return; } } else if (m_active == BtleScanActive) { @@ -322,7 +322,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::processSdpDiscoveryFinished() m_active = NoScanActive; lastError = QBluetoothDeviceDiscoveryAgent::PoweredOffError; errorString = QBluetoothDeviceDiscoveryAgent::tr("Device is powered off"); - emit q->error(lastError); + emit q->errorOccurred(lastError); return; } diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_bluez.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent_bluez.cpp index ea13dca3..4b9633c9 100644 --- a/src/bluetooth/qbluetoothdevicediscoveryagent_bluez.cpp +++ b/src/bluetooth/qbluetoothdevicediscoveryagent_bluez.cpp @@ -154,7 +154,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::start(QBluetoothDeviceDiscoveryAgent qCDebug(QT_BT_BLUEZ) << Q_FUNC_INFO << "ERROR: " << errorString; lastError = QBluetoothDeviceDiscoveryAgent::InputOutputError; Q_Q(QBluetoothDeviceDiscoveryAgent); - emit q->error(lastError); + emit q->errorOccurred(lastError); return; } @@ -182,7 +182,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::start(QBluetoothDeviceDiscoveryAgent Q_Q(QBluetoothDeviceDiscoveryAgent); delete adapter; adapter = nullptr; - emit q->error(lastError); + emit q->errorOccurred(lastError); return; } @@ -192,7 +192,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::start(QBluetoothDeviceDiscoveryAgent errorString = QBluetoothDeviceDiscoveryAgent::tr("Device is powered off"); delete adapter; adapter = nullptr; - emit q->error(lastError); + emit q->errorOccurred(lastError); return; } @@ -225,7 +225,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::start(QBluetoothDeviceDiscoveryAgent lastError = QBluetoothDeviceDiscoveryAgent::InputOutputError; Q_Q(QBluetoothDeviceDiscoveryAgent); qCDebug(QT_BT_BLUEZ) << Q_FUNC_INFO << "ERROR: " << errorString; - emit q->error(lastError); + emit q->errorOccurred(lastError); return; } } @@ -240,7 +240,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::startBluez5(QBluetoothDeviceDiscover qCWarning(QT_BT_BLUEZ) << "Cannot find Bluez 5 adapter for device search" << ok; lastError = QBluetoothDeviceDiscoveryAgent::InputOutputError; errorString = QBluetoothDeviceDiscoveryAgent::tr("Cannot find valid Bluetooth adapter."); - q->error(lastError); + q->errorOccurred(lastError); return; } @@ -254,7 +254,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::startBluez5(QBluetoothDeviceDiscover errorString = QBluetoothDeviceDiscoveryAgent::tr("Device is powered off"); delete adapterBluez5; adapterBluez5 = nullptr; - emit q->error(lastError); + emit q->errorOccurred(lastError); return; } @@ -279,7 +279,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::startBluez5(QBluetoothDeviceDiscover "are not supported on this platform"); delete adapterBluez5; adapterBluez5 = nullptr; - emit q->error(lastError); + emit q->errorOccurred(lastError); return; } else if (filterReply.error().type() != QDBusError::UnknownMethod) { qCDebug(QT_BT_BLUEZ) << "SetDiscoveryFilter failed:" << filterReply.error(); @@ -636,7 +636,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::_q_discoveryInterrupted(const QStrin errorString = QBluetoothDeviceDiscoveryAgent::tr("Bluetooth adapter error"); lastError = QBluetoothDeviceDiscoveryAgent::InputOutputError; - emit q->error(lastError); + emit q->errorOccurred(lastError); } } diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_darwin.mm b/src/bluetooth/qbluetoothdevicediscoveryagent_darwin.mm index 86b7cea9..d2177af6 100644 --- a/src/bluetooth/qbluetoothdevicediscoveryagent_darwin.mm +++ b/src/bluetooth/qbluetoothdevicediscoveryagent_darwin.mm @@ -156,7 +156,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::start(QBluetoothDeviceDiscoveryAgent #ifdef Q_OS_MACOS if (!controller) { setError(QBluetoothDeviceDiscoveryAgent::InvalidBluetoothAdapterError); - emit q_ptr->error(lastError); + emit q_ptr->errorOccurred(lastError); return; } #endif // Q_OS_MACOS @@ -202,7 +202,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::startClassic() qCCritical(QT_BT_DARWIN) << "failed to initialize an Classic device inquiry"; setError(QBluetoothDeviceDiscoveryAgent::UnknownError, QCoreApplication::translate(DEV_DISCOVERY, DD_NOT_STARTED)); - emit q_ptr->error(lastError); + emit q_ptr->errorOccurred(lastError); return; } } @@ -213,7 +213,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::startClassic() if (res != kIOReturnSuccess) { setError(res, QCoreApplication::translate(DEV_DISCOVERY, DD_NOT_STARTED)); agentState = NonActive; - emit q_ptr->error(lastError); + emit q_ptr->errorOccurred(lastError); } } @@ -250,7 +250,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::startLE() setError(QBluetoothDeviceDiscoveryAgent::UnknownError, QCoreApplication::translate(DEV_DISCOVERY, DD_NOT_STARTED_LE)); agentState = NonActive; - emit q_ptr->error(lastError); + emit q_ptr->errorOccurred(lastError); return; } @@ -285,7 +285,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::stop() startPending = prevStart; stopPending = false; setError(res, QCoreApplication::translate(DEV_DISCOVERY, DD_NOT_STOPPED)); - emit q_ptr->error(lastError); + emit q_ptr->errorOccurred(lastError); } } else { #else @@ -340,7 +340,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::error(IOReturn error) setError(error); - emit q_ptr->error(lastError); + emit q_ptr->errorOccurred(lastError); } void QBluetoothDeviceDiscoveryAgentPrivate::classicDeviceFound(void *obj) @@ -429,7 +429,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::LEinquiryError(QBluetoothDeviceDisco stopPending = false; agentState = NonActive; setError(error); - emit q_ptr->error(lastError); + emit q_ptr->errorOccurred(lastError); } void QBluetoothDeviceDiscoveryAgentPrivate::LEnotSupported() @@ -452,7 +452,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::LEnotSupported() startPending = false; stopPending = false; setError(QBluetoothDeviceDiscoveryAgent::UnsupportedPlatformError); - emit q_ptr->error(lastError); + emit q_ptr->errorOccurred(lastError); #endif } diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_p.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent_p.cpp index 6d92b2c7..fb8f53b2 100644 --- a/src/bluetooth/qbluetoothdevicediscoveryagent_p.cpp +++ b/src/bluetooth/qbluetoothdevicediscoveryagent_p.cpp @@ -79,7 +79,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::start(QBluetoothDeviceDiscoveryAgent lastError = QBluetoothDeviceDiscoveryAgent::UnsupportedPlatformError; errorString = QBluetoothDeviceDiscoveryAgent::tr("Device discovery not supported on this platform"); - emit q->error(lastError); + emit q->errorOccurred(lastError); } void QBluetoothDeviceDiscoveryAgentPrivate::stop() diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_win.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent_win.cpp index 05ab3e53..cd36717b 100644 --- a/src/bluetooth/qbluetoothdevicediscoveryagent_win.cpp +++ b/src/bluetooth/qbluetoothdevicediscoveryagent_win.cpp @@ -369,7 +369,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::start(QBluetoothDeviceDiscoveryAgent qCWarning(QT_BT_WINDOWS) << "Device does not support Bluetooth"; lastError = QBluetoothDeviceDiscoveryAgent::InputOutputError; errorString = QBluetoothDeviceDiscoveryAgent::tr("Device does not support Bluetooth"); - emit q->error(lastError); + emit q->errorOccurred(lastError); return; } @@ -384,7 +384,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::start(QBluetoothDeviceDiscoveryAgent qCWarning(QT_BT_WINDOWS) << "Incorrect local adapter passed."; lastError = QBluetoothDeviceDiscoveryAgent::InvalidBluetoothAdapterError; errorString = QBluetoothDeviceDiscoveryAgent::tr("Passed address is not a local device."); - emit q->error(lastError); + emit q->errorOccurred(lastError); return; } @@ -434,7 +434,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::finishDiscovery(QBluetoothDeviceDisc if (errorCode == QBluetoothDeviceDiscoveryAgent::NoError) emit q->finished(); else - emit q->error(lastError); + emit q->errorOccurred(lastError); } void QBluetoothDeviceDiscoveryAgentPrivate::startLeDevicesDiscovery() diff --git a/src/bluetooth/qbluetoothlocaldevice.cpp b/src/bluetooth/qbluetoothlocaldevice.cpp index 75c21094..91abbe62 100644 --- a/src/bluetooth/qbluetoothlocaldevice.cpp +++ b/src/bluetooth/qbluetoothlocaldevice.cpp @@ -274,17 +274,21 @@ bool QBluetoothLocalDevice::isValid() const */ /*! - \fn QBluetoothLocalDevice::pairingFinished(const QBluetoothAddress &address, QBluetoothLocalDevice::Pairing pairing) + \fn QBluetoothLocalDevice::pairingFinished(const QBluetoothAddress &address, + QBluetoothLocalDevice::Pairing pairing) Pairing or unpairing has completed with \a address. Current pairing status is in \a pairing. - If the pairing request was not successful, this signal will not be emitted. The error() signal - is emitted if the pairing request failed. The signal is only ever emitted for pairing requests - which have previously requested by calling \l requestPairing() of the current object instance. + If the pairing request was not successful, this signal will not be emitted. The errorOccurred() + signal is emitted if the pairing request failed. The signal is only ever emitted for pairing + requests which have previously requested by calling \l requestPairing() of the current object + instance. */ /*! - \fn QBluetoothLocalDevice::error(QBluetoothLocalDevice::Error error) + \fn QBluetoothLocalDevice::errorOccurred(QBluetoothLocalDevice::Error error) Signal emitted if there's an exceptional \a error while pairing. + + \since 6.2 */ /*! diff --git a/src/bluetooth/qbluetoothlocaldevice.h b/src/bluetooth/qbluetoothlocaldevice.h index b598046e..32feea2e 100644 --- a/src/bluetooth/qbluetoothlocaldevice.h +++ b/src/bluetooth/qbluetoothlocaldevice.h @@ -105,7 +105,7 @@ Q_SIGNALS: void deviceDisconnected(const QBluetoothAddress &address); void pairingFinished(const QBluetoothAddress &address, QBluetoothLocalDevice::Pairing pairing); - void error(QBluetoothLocalDevice::Error error); + void errorOccurred(QBluetoothLocalDevice::Error error); private: Q_DECLARE_PRIVATE(QBluetoothLocalDevice) diff --git a/src/bluetooth/qbluetoothlocaldevice_android.cpp b/src/bluetooth/qbluetoothlocaldevice_android.cpp index 0062cba6..2f90ba77 100644 --- a/src/bluetooth/qbluetoothlocaldevice_android.cpp +++ b/src/bluetooth/qbluetoothlocaldevice_android.cpp @@ -136,7 +136,7 @@ void QBluetoothLocalDevicePrivate::processHostModeChange(QBluetoothLocalDevice:: if (isValid() && newMode == QBluetoothLocalDevice::HostPoweredOff) { bool success = (bool)obj->callMethod<jboolean>("enable", "()Z"); if (!success) - emit q_ptr->error(QBluetoothLocalDevice::UnknownError); + emit q_ptr->errorOccurred(QBluetoothLocalDevice::UnknownError); } pendingHostModeTransition = false; @@ -167,7 +167,7 @@ void QBluetoothLocalDevicePrivate::processPairingStateChanged( || (!entry.second && pairing == QBluetoothLocalDevice::Unpaired)) { emit q_ptr->pairingFinished(address, pairing); } else { - emit q_ptr->error(QBluetoothLocalDevice::PairingError); + emit q_ptr->errorOccurred(QBluetoothLocalDevice::PairingError); } } @@ -233,7 +233,7 @@ void QBluetoothLocalDevice::powerOn() if (d_ptr->adapter()) { bool ret = (bool)d_ptr->adapter()->callMethod<jboolean>("enable", "()Z"); if (!ret) - emit error(QBluetoothLocalDevice::UnknownError); + emit errorOccurred(QBluetoothLocalDevice::UnknownError); } } @@ -252,7 +252,7 @@ void QBluetoothLocalDevice::setHostMode(QBluetoothLocalDevice::HostMode requeste success = (bool)d_ptr->adapter()->callMethod<jboolean>("disable", "()Z"); if (!success) - emit error(QBluetoothLocalDevice::UnknownError); + emit errorOccurred(QBluetoothLocalDevice::UnknownError); } else if (mode == QBluetoothLocalDevice::HostConnectable) { if (hostMode() == QBluetoothLocalDevice::HostDiscoverable) { // cannot directly go from Discoverable to Connectable diff --git a/src/bluetooth/qbluetoothlocaldevice_bluez.cpp b/src/bluetooth/qbluetoothlocaldevice_bluez.cpp index 21f3fc2a..0a3d36b5 100644 --- a/src/bluetooth/qbluetoothlocaldevice_bluez.cpp +++ b/src/bluetooth/qbluetoothlocaldevice_bluez.cpp @@ -250,7 +250,7 @@ void QBluetoothLocalDevicePrivate::requestPairingBluez5(const QBluetoothAddress QDBusPendingReply<ManagedObjectList> reply = managerBluez5->GetManagedObjects(); reply.waitForFinished(); if (reply.isError()) { - emit q_ptr->error(QBluetoothLocalDevice::PairingError); + emit q_ptr->errorOccurred(QBluetoothLocalDevice::PairingError); return; } @@ -332,7 +332,7 @@ void QBluetoothLocalDevicePrivate::processPairingBluez5(const QString &objectPat this, [q, targetAddress](QDBusPendingCallWatcher* watcher){ QDBusPendingReply<> reply = *watcher; if (reply.isError()) - emit q->error(QBluetoothLocalDevice::PairingError); + emit q->errorOccurred(QBluetoothLocalDevice::PairingError); else emit q->pairingFinished(targetAddress, QBluetoothLocalDevice::Unpaired); @@ -378,7 +378,7 @@ void QBluetoothLocalDevicePrivate::pairingDiscoveryTimedOut() QtBluezDiscoveryManager::instance()->unregisterDiscoveryInterest( adapterBluez5->path()); - emit q_ptr->error(QBluetoothLocalDevice::PairingError); + emit q_ptr->errorOccurred(QBluetoothLocalDevice::PairingError); } QBluetoothLocalDevice::Pairing QBluetoothLocalDevice::pairingStatus( @@ -689,7 +689,7 @@ void QBluetoothLocalDevicePrivate::pairingCompleted(QDBusPendingCallWatcher *wat if (reply.isError()) { qCWarning(QT_BT_BLUEZ) << "Failed to create pairing" << reply.error().name(); if (reply.error().name() != QStringLiteral("org.bluez.Error.AuthenticationCanceled")) - emit q->error(QBluetoothLocalDevice::PairingError); + emit q->errorOccurred(QBluetoothLocalDevice::PairingError); watcher->deleteLater(); return; } @@ -697,14 +697,14 @@ void QBluetoothLocalDevicePrivate::pairingCompleted(QDBusPendingCallWatcher *wat if (adapterBluez5) { if (!pairingTarget) { qCWarning(QT_BT_BLUEZ) << "Pairing target expected but found null pointer."; - emit q->error(QBluetoothLocalDevice::PairingError); + emit q->errorOccurred(QBluetoothLocalDevice::PairingError); watcher->deleteLater(); return; } if (!pairingTarget->paired()) { qCWarning(QT_BT_BLUEZ) << "Device was not paired as requested"; - emit q->error(QBluetoothLocalDevice::PairingError); + emit q->errorOccurred(QBluetoothLocalDevice::PairingError); watcher->deleteLater(); return; } diff --git a/src/bluetooth/qbluetoothlocaldevice_macos.mm b/src/bluetooth/qbluetoothlocaldevice_macos.mm index 29612a98..4d0f026d 100644 --- a/src/bluetooth/qbluetoothlocaldevice_macos.mm +++ b/src/bluetooth/qbluetoothlocaldevice_macos.mm @@ -312,7 +312,7 @@ void QBluetoothLocalDevicePrivate::emitError(QBluetoothLocalDevice::Error error, QMetaObject::invokeMethod(q_ptr, "error", Qt::QueuedConnection, Q_ARG(QBluetoothLocalDevice::Error, error)); } else { - emit q_ptr->error(QBluetoothLocalDevice::PairingError); + emit q_ptr->errorOccurred(QBluetoothLocalDevice::PairingError); } } diff --git a/src/bluetooth/qbluetoothlocaldevice_win.cpp b/src/bluetooth/qbluetoothlocaldevice_win.cpp index 61da878d..b0d134cd 100644 --- a/src/bluetooth/qbluetoothlocaldevice_win.cpp +++ b/src/bluetooth/qbluetoothlocaldevice_win.cpp @@ -103,20 +103,20 @@ void QBluetoothLocalDevice::setHostMode( if (::BluetoothIsDiscoverable(nullptr) && !::BluetoothEnableDiscovery(nullptr, FALSE)) { qCWarning(QT_BT_WINDOWS) << "Unable to disable the discoverable mode"; - emit error(QBluetoothLocalDevice::UnknownError); + emit errorOccurred(QBluetoothLocalDevice::UnknownError); return; } if (::BluetoothIsConnectable(nullptr) && !::BluetoothEnableIncomingConnections(nullptr, FALSE)) { qCWarning(QT_BT_WINDOWS) << "Unable to disable the connectable mode"; - emit error(QBluetoothLocalDevice::UnknownError); + emit errorOccurred(QBluetoothLocalDevice::UnknownError); return; } } else if (requestedMode == QBluetoothLocalDevice::HostConnectable) { if (!::BluetoothIsConnectable(nullptr) && !::BluetoothEnableIncomingConnections(nullptr, TRUE)) { qCWarning(QT_BT_WINDOWS) << "Unable to enable the connectable mode"; - emit error(QBluetoothLocalDevice::UnknownError); + emit errorOccurred(QBluetoothLocalDevice::UnknownError); return; } } else if (requestedMode == QBluetoothLocalDevice::HostDiscoverable @@ -124,12 +124,12 @@ void QBluetoothLocalDevice::setHostMode( if (!::BluetoothIsConnectable(nullptr) && !::BluetoothEnableIncomingConnections(nullptr, TRUE)) { qCWarning(QT_BT_WINDOWS) << "Unable to enable the connectable mode"; - emit error(QBluetoothLocalDevice::UnknownError); + emit errorOccurred(QBluetoothLocalDevice::UnknownError); return; } if (!::BluetoothEnableDiscovery(nullptr, TRUE)) { qCWarning(QT_BT_WINDOWS) << "Unable to enable the discoverable mode"; - emit error(QBluetoothLocalDevice::UnknownError); + emit errorOccurred(QBluetoothLocalDevice::UnknownError); return; } } diff --git a/src/bluetooth/qbluetoothserver.cpp b/src/bluetooth/qbluetoothserver.cpp index 81986f5b..e8da0ce1 100644 --- a/src/bluetooth/qbluetoothserver.cpp +++ b/src/bluetooth/qbluetoothserver.cpp @@ -84,11 +84,12 @@ QT_BEGIN_NAMESPACE */ /*! - \fn void QBluetoothServer::error(QBluetoothServer::Error error) + \fn void QBluetoothServer::errorOccurred(QBluetoothServer::Error error) This signal is emitted when an \a error occurs. \sa error(), QBluetoothServer::Error + \since 6.2 */ /*! diff --git a/src/bluetooth/qbluetoothserver.h b/src/bluetooth/qbluetoothserver.h index 5e71b58c..fed57f82 100644 --- a/src/bluetooth/qbluetoothserver.h +++ b/src/bluetooth/qbluetoothserver.h @@ -97,7 +97,7 @@ public: Q_SIGNALS: void newConnection(); - void error(QBluetoothServer::Error error); + void errorOccurred(QBluetoothServer::Error error); protected: QBluetoothServerPrivate *d_ptr; diff --git a/src/bluetooth/qbluetoothserver_android.cpp b/src/bluetooth/qbluetoothserver_android.cpp index a89359b1..f92dd8ee 100644 --- a/src/bluetooth/qbluetoothserver_android.cpp +++ b/src/bluetooth/qbluetoothserver_android.cpp @@ -128,7 +128,7 @@ bool QBluetoothServer::listen(const QBluetoothAddress &localAdapter, quint16 por Q_D(QBluetoothServer); if (serverType() != QBluetoothServiceInfo::RfcommProtocol) { d->m_lastError = UnsupportedProtocolError; - emit error(d->m_lastError); + emit errorOccurred(d->m_lastError); return false; } @@ -136,7 +136,7 @@ bool QBluetoothServer::listen(const QBluetoothAddress &localAdapter, quint16 por if (!localDevices.count()) { qCWarning(QT_BT_ANDROID) << "Device does not support Bluetooth"; d->m_lastError = QBluetoothServer::UnknownError; - emit error(d->m_lastError); + emit errorOccurred(d->m_lastError); return false; //no Bluetooth device } @@ -166,14 +166,14 @@ bool QBluetoothServer::listen(const QBluetoothAddress &localAdapter, quint16 por if (!btAdapter.isValid()) { qCWarning(QT_BT_ANDROID) << "Device does not support Bluetooth"; d->m_lastError = QBluetoothServer::UnknownError; - emit error(d->m_lastError); + emit errorOccurred(d->m_lastError); return false; } const int state = btAdapter.callMethod<jint>("getState"); if (state != 12 ) { //BluetoothAdapter.STATE_ON d->m_lastError = QBluetoothServer::PoweredOffError; - emit error(d->m_lastError); + emit errorOccurred(d->m_lastError); qCWarning(QT_BT_ANDROID) << "Bluetooth device is powered off"; return false; } @@ -196,14 +196,14 @@ bool QBluetoothServer::listen(const QBluetoothAddress &localAdapter, quint16 por } else { qCWarning(QT_BT_ANDROID) << "server with port" << port << "already registered or port invalid"; d->m_lastError = ServiceAlreadyRegisteredError; - emit error(d->m_lastError); + emit errorOccurred(d->m_lastError); return false; } connect(d->thread, SIGNAL(newConnection()), this, SIGNAL(newConnection())); - connect(d->thread, SIGNAL(error(QBluetoothServer::Error)), - this, SIGNAL(error(QBluetoothServer::Error)), Qt::QueuedConnection); + connect(d->thread, SIGNAL(errorOccurred(QBluetoothServer::Error)), this, + SIGNAL(errorOccurred(QBluetoothServer::Error)), Qt::QueuedConnection); return true; } diff --git a/src/bluetooth/qbluetoothserver_bluez.cpp b/src/bluetooth/qbluetoothserver_bluez.cpp index b3e6bbff..3fab415b 100644 --- a/src/bluetooth/qbluetoothserver_bluez.cpp +++ b/src/bluetooth/qbluetoothserver_bluez.cpp @@ -167,14 +167,14 @@ bool QBluetoothServer::listen(const QBluetoothAddress &address, quint16 port) qCWarning(QT_BT_BLUEZ) << "Device does not support Bluetooth or" << address.toString() << "is not a valid local adapter"; d->m_lastError = QBluetoothServer::UnknownError; - emit error(d->m_lastError); + emit errorOccurred(d->m_lastError); return false; } QBluetoothLocalDevice::HostMode hostMode = device.hostMode(); if (hostMode == QBluetoothLocalDevice::HostPoweredOff) { d->m_lastError = QBluetoothServer::PoweredOffError; - emit error(d->m_lastError); + emit errorOccurred(d->m_lastError); qCWarning(QT_BT_BLUEZ) << "Bluetooth device is powered off"; return false; } @@ -197,7 +197,7 @@ bool QBluetoothServer::listen(const QBluetoothAddress &address, quint16 port) sock = d->socket->socketDescriptor(); if (sock < 0) { d->m_lastError = InputOutputError; - emit error(d->m_lastError); + emit errorOccurred(d->m_lastError); return false; } } @@ -218,7 +218,7 @@ bool QBluetoothServer::listen(const QBluetoothAddress &address, quint16 port) d->m_lastError = ServiceAlreadyRegisteredError; else d->m_lastError = InputOutputError; - emit error(d->m_lastError); + emit errorOccurred(d->m_lastError); return false; } } else { @@ -235,7 +235,7 @@ bool QBluetoothServer::listen(const QBluetoothAddress &address, quint16 port) if (::bind(sock, reinterpret_cast<sockaddr *>(&addr), sizeof(sockaddr_l2)) < 0) { d->m_lastError = InputOutputError; - emit error(d->m_lastError); + emit errorOccurred(d->m_lastError); return false; } } @@ -244,7 +244,7 @@ bool QBluetoothServer::listen(const QBluetoothAddress &address, quint16 port) if (::listen(sock, d->maxPendingConnections) < 0) { d->m_lastError = InputOutputError; - emit error(d->m_lastError); + emit errorOccurred(d->m_lastError); return false; } @@ -348,7 +348,7 @@ void QBluetoothServer::setSecurityFlags(QBluetooth::SecurityFlags security) qCWarning(QT_BT_BLUEZ) << "Failed to set socket option, closing socket for safety" << errorCode; qCWarning(QT_BT_BLUEZ) << "Error: " << qt_error_string(errorCode); d->m_lastError = InputOutputError; - emit error(d->m_lastError); + emit errorOccurred(d->m_lastError); d->socket->close(); } } diff --git a/src/bluetooth/qbluetoothserver_macos.mm b/src/bluetooth/qbluetoothserver_macos.mm index e406a8a9..30e4136b 100644 --- a/src/bluetooth/qbluetoothserver_macos.mm +++ b/src/bluetooth/qbluetoothserver_macos.mm @@ -302,7 +302,7 @@ bool QBluetoothServer::listen(const QBluetoothAddress &address, quint16 port) << address.toString() << "is not a valid local adapter"; d_ptr->m_lastError = UnknownError; - emit error(UnknownError); + emit errorOccurred(UnknownError); return false; } @@ -310,7 +310,7 @@ bool QBluetoothServer::listen(const QBluetoothAddress &address, quint16 port) if (hostMode == QBluetoothLocalDevice::HostPoweredOff) { qCWarning(QT_BT_DARWIN) << "Bluetooth device is powered off"; d_ptr->m_lastError = PoweredOffError; - emit error(PoweredOffError); + emit errorOccurred(PoweredOffError); return false; } @@ -319,7 +319,7 @@ bool QBluetoothServer::listen(const QBluetoothAddress &address, quint16 port) if (type == ServiceInfo::UnknownProtocol) { qCWarning(QT_BT_DARWIN) << "invalid protocol"; d_ptr->m_lastError = UnsupportedProtocolError; - emit error(d_ptr->m_lastError); + emit errorOccurred(d_ptr->m_lastError); return false; } @@ -348,14 +348,14 @@ bool QBluetoothServer::listen(const QBluetoothAddress &address, quint16 port) } if (d_ptr->m_lastError != QBluetoothServer::NoError) { - emit error(d_ptr->m_lastError); + emit errorOccurred(d_ptr->m_lastError); return false; } if (!port) { qCWarning(QT_BT_DARWIN) << "all ports are busy"; d_ptr->m_lastError = ServiceAlreadyRegisteredError; - emit error(d_ptr->m_lastError); + emit errorOccurred(d_ptr->m_lastError); return false; } diff --git a/src/bluetooth/qbluetoothserver_p.cpp b/src/bluetooth/qbluetoothserver_p.cpp index 6657e151..0cc15ac6 100644 --- a/src/bluetooth/qbluetoothserver_p.cpp +++ b/src/bluetooth/qbluetoothserver_p.cpp @@ -75,7 +75,7 @@ bool QBluetoothServer::listen(const QBluetoothAddress &address, quint16 port) Q_UNUSED(port); Q_D(QBluetoothServer); d->m_lastError = UnsupportedProtocolError; - emit error(d->m_lastError); + emit errorOccurred(d->m_lastError); return false; } diff --git a/src/bluetooth/qbluetoothserver_win.cpp b/src/bluetooth/qbluetoothserver_win.cpp index b6f10fe0..4fb8bae1 100644 --- a/src/bluetooth/qbluetoothserver_win.cpp +++ b/src/bluetooth/qbluetoothserver_win.cpp @@ -93,7 +93,7 @@ bool QBluetoothServer::listen(const QBluetoothAddress &address, quint16 port) if (d->serverType != QBluetoothServiceInfo::RfcommProtocol) { qCWarning(QT_BT_WINDOWS) << "Protocol is not supported."; d->m_lastError = QBluetoothServer::UnsupportedProtocolError; - emit error(d->m_lastError); + emit errorOccurred(d->m_lastError); return false; } @@ -107,14 +107,14 @@ bool QBluetoothServer::listen(const QBluetoothAddress &address, quint16 port) qCWarning(QT_BT_WINDOWS) << "Device does not support Bluetooth or" << address.toString() << "is not a valid local adapter"; d->m_lastError = QBluetoothServer::UnknownError; - emit error(d->m_lastError); + emit errorOccurred(d->m_lastError); return false; } const QBluetoothLocalDevice::HostMode hostMode = device.hostMode(); if (hostMode == QBluetoothLocalDevice::HostPoweredOff) { d->m_lastError = QBluetoothServer::PoweredOffError; - emit error(d->m_lastError); + emit errorOccurred(d->m_lastError); qCWarning(QT_BT_WINDOWS) << "Bluetooth device is powered off"; return false; } @@ -130,7 +130,7 @@ bool QBluetoothServer::listen(const QBluetoothAddress &address, quint16 port) sock = d->socket->socketDescriptor(); if (sock < 0) { d->m_lastError = InputOutputError; - emit error(d->m_lastError); + emit errorOccurred(d->m_lastError); return false; } } @@ -148,13 +148,13 @@ bool QBluetoothServer::listen(const QBluetoothAddress &address, quint16 port) d->m_lastError = ServiceAlreadyRegisteredError; else d->m_lastError = InputOutputError; - emit error(d->m_lastError); + emit errorOccurred(d->m_lastError); return false; } if (::listen(sock, d->maxPendingConnections) < 0) { d->m_lastError = InputOutputError; - emit error(d->m_lastError); + emit errorOccurred(d->m_lastError); return false; } diff --git a/src/bluetooth/qbluetoothserver_winrt.cpp b/src/bluetooth/qbluetoothserver_winrt.cpp index 224ec5cb..47b9a6e6 100644 --- a/src/bluetooth/qbluetoothserver_winrt.cpp +++ b/src/bluetooth/qbluetoothserver_winrt.cpp @@ -157,7 +157,7 @@ bool QBluetoothServer::listen(const QBluetoothAddress &address, quint16 port) Q_D(QBluetoothServer); if (serverType() != QBluetoothServiceInfo::RfcommProtocol) { d->m_lastError = UnsupportedProtocolError; - emit error(d->m_lastError); + emit errorOccurred(d->m_lastError); return false; } @@ -189,7 +189,7 @@ bool QBluetoothServer::listen(const QBluetoothAddress &address, quint16 port) } else { qCWarning(QT_BT_WINRT) << "server with port" << port << "already registered or port invalid"; d->m_lastError = ServiceAlreadyRegisteredError; - emit error(d->m_lastError); + emit errorOccurred(d->m_lastError); return false; } diff --git a/src/bluetooth/qbluetoothservicediscoveryagent.cpp b/src/bluetooth/qbluetoothservicediscoveryagent.cpp index 3b89b4f6..b34feabc 100644 --- a/src/bluetooth/qbluetoothservicediscoveryagent.cpp +++ b/src/bluetooth/qbluetoothservicediscoveryagent.cpp @@ -141,10 +141,13 @@ QT_BEGIN_NAMESPACE */ /*! - \fn void QBluetoothServiceDiscoveryAgent::error(QBluetoothServiceDiscoveryAgent::Error error) + \fn void QBluetoothServiceDiscoveryAgent::errorOccurred(QBluetoothServiceDiscoveryAgent::Error + error) This signal is emitted when an \a error occurs. The \a error parameter describes the error that occurred. + + \since 6.2 */ /*! @@ -458,11 +461,10 @@ void QBluetoothServiceDiscoveryAgentPrivate::startDeviceDiscovery() q, [this](const QBluetoothDeviceInfo &info){ this->_q_deviceDiscovered(info); }); - QObject::connect(deviceDiscoveryAgent, - QOverload<QBluetoothDeviceDiscoveryAgent::Error>::of(&QBluetoothDeviceDiscoveryAgent::error), - q, [this](QBluetoothDeviceDiscoveryAgent::Error newError){ - this->_q_deviceDiscoveryError(newError); - }); + QObject::connect(deviceDiscoveryAgent, &QBluetoothDeviceDiscoveryAgent::errorOccurred, q, + [this](QBluetoothDeviceDiscoveryAgent::Error newError) { + this->_q_deviceDiscoveryError(newError); + }); } setDiscoveryState(DeviceDiscovery); @@ -500,7 +502,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::_q_deviceDiscoveryFinished() errorString = deviceDiscoveryAgent->errorString(); setDiscoveryState(Inactive); Q_Q(QBluetoothServiceDiscoveryAgent); - emit q->error(error); + emit q->errorOccurred(error); emit q->finished(); return; } @@ -536,7 +538,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::_q_deviceDiscoveryError(QBluetoothD setDiscoveryState(Inactive); Q_Q(QBluetoothServiceDiscoveryAgent); - emit q->error(error); + emit q->errorOccurred(error); emit q->finished(); } diff --git a/src/bluetooth/qbluetoothservicediscoveryagent.h b/src/bluetooth/qbluetoothservicediscoveryagent.h index f1fa4640..dd944a7e 100644 --- a/src/bluetooth/qbluetoothservicediscoveryagent.h +++ b/src/bluetooth/qbluetoothservicediscoveryagent.h @@ -107,7 +107,7 @@ Q_SIGNALS: void serviceDiscovered(const QBluetoothServiceInfo &info); void finished(); void canceled(); - void error(QBluetoothServiceDiscoveryAgent::Error error); + void errorOccurred(QBluetoothServiceDiscoveryAgent::Error error); private: QBluetoothServiceDiscoveryAgentPrivate *d_ptr; diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_android.cpp b/src/bluetooth/qbluetoothservicediscoveryagent_android.cpp index 57daa6b6..eff970bc 100644 --- a/src/bluetooth/qbluetoothservicediscoveryagent_android.cpp +++ b/src/bluetooth/qbluetoothservicediscoveryagent_android.cpp @@ -136,7 +136,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::start(const QBluetoothAddress &addr //abort any outstanding discoveries discoveredDevices.clear(); - emit q->error(error); + emit q->errorOccurred(error); _q_serviceDiscoveryFinished(); return; @@ -159,7 +159,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::start(const QBluetoothAddress &addr //abort any outstanding discoveries sdpCache.clear(); discoveredDevices.clear(); - emit q->error(error); + emit q->errorOccurred(error); _q_serviceDiscoveryFinished(); return; @@ -182,7 +182,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::start(const QBluetoothAddress &addr qCWarning(QT_BT_ANDROID) << "Cannot start SDP for" << discoveredDevices.at(0).name() << "(" << address.toString() << ")"; - emit q->error(error); + emit q->errorOccurred(error); } _q_serviceDiscoveryFinished(); return; @@ -201,7 +201,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::start(const QBluetoothAddress &addr if (singleDevice) { error = QBluetoothServiceDiscoveryAgent::InputOutputError; errorString = QBluetoothServiceDiscoveryAgent::tr("Cannot obtain service uuids"); - emit q->error(error); + emit q->errorOccurred(error); } qCWarning(QT_BT_ANDROID) << "Cannot retrieve SDP UUIDs for" << discoveredDevices.at(0).name() << "(" << address.toString() << ")"; @@ -510,7 +510,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::_q_hostModeStateChanged(QBluetoothL receiver = nullptr; Q_Q(QBluetoothServiceDiscoveryAgent); - emit q->error(error); + emit q->errorOccurred(error); _q_serviceDiscoveryFinished(); } } diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp b/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp index 8f591288..a7d53f77 100644 --- a/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp +++ b/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp @@ -106,7 +106,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::start(const QBluetoothAddress &addr if (reply.isError()) { error = QBluetoothServiceDiscoveryAgent::InputOutputError; errorString = QBluetoothServiceDiscoveryAgent::tr("Unable to find appointed local adapter"); - emit q->error(error); + emit q->errorOccurred(error); _q_serviceDiscoveryFinished(); return; } @@ -147,7 +147,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::startBluez5(const QBluetoothAddress discoveredDevices.clear(); error = QBluetoothServiceDiscoveryAgent::InputOutputError; errorString = QBluetoothDeviceDiscoveryAgent::tr("Cannot access adapter during service discovery"); - emit q->error(error); + emit q->errorOccurred(error); _q_serviceDiscoveryFinished(); return; } @@ -159,7 +159,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::startBluez5(const QBluetoothAddress error = QBluetoothServiceDiscoveryAgent::InvalidBluetoothAdapterError; errorString = QBluetoothServiceDiscoveryAgent::tr("Cannot find local Bluetooth adapter"); - emit q->error(error); + emit q->errorOccurred(error); _q_serviceDiscoveryFinished(); return; @@ -174,7 +174,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::startBluez5(const QBluetoothAddress error = QBluetoothServiceDiscoveryAgent::PoweredOffError; errorString = QBluetoothServiceDiscoveryAgent::tr("Local device is powered off"); - emit q->error(error); + emit q->errorOccurred(error); _q_serviceDiscoveryFinished(); return; @@ -287,7 +287,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::_q_finishSdpScan(QBluetoothServiceD discoveredDevices.clear(); error = errorCode; errorString = errorDescription; - emit q->error(error); + emit q->errorOccurred(error); } else if (!xmlRecords.isEmpty() && discoveryState() != Inactive) { for (const QString &record : xmlRecords) { QBluetoothServiceInfo serviceInfo = parseServiceXml(record); @@ -401,7 +401,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::_q_foundDevice(QDBusPendingCallWatc if (singleDevice) { error = QBluetoothServiceDiscoveryAgent::InputOutputError; errorString = QBluetoothServiceDiscoveryAgent::tr("Unable to access device"); - emit q->error(error); + emit q->errorOccurred(error); } _q_serviceDiscoveryFinished(); return; @@ -445,7 +445,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::_q_createdDevice(QDBusPendingCallWa if (singleDevice) { error = QBluetoothServiceDiscoveryAgent::InputOutputError; errorString = QBluetoothServiceDiscoveryAgent::tr("Unable to access device"); - emit q->error(error); + emit q->errorOccurred(error); } _q_serviceDiscoveryFinished(); return; @@ -538,7 +538,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::discoverServices(const QString &dev if (singleDevice && deviceReply.isError()) { error = QBluetoothServiceDiscoveryAgent::InputOutputError; errorString = QBluetoothServiceDiscoveryAgent::tr("Unable to access device"); - emit q->error(error); + emit q->errorOccurred(error); } _q_serviceDiscoveryFinished(); } else { @@ -576,7 +576,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::_q_discoveredServices(QDBusPendingC if (singleDevice) { error = QBluetoothServiceDiscoveryAgent::UnknownError; errorString = reply.error().message(); - emit q->error(error); + emit q->errorOccurred(error); } delete device; device = nullptr; @@ -677,8 +677,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::performMinimalServiceDiscovery(cons if (singleDevice) { error = QBluetoothServiceDiscoveryAgent::InputOutputError; errorString = reply.error().message(); - emit q->error(error); - + emit q->errorOccurred(error); } _q_serviceDiscoveryFinished(); return; diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_macos.mm b/src/bluetooth/qbluetoothservicediscoveryagent_macos.mm index af166a5c..657bb474 100644 --- a/src/bluetooth/qbluetoothservicediscoveryagent_macos.mm +++ b/src/bluetooth/qbluetoothservicediscoveryagent_macos.mm @@ -103,7 +103,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::start(const QBluetoothAddress &devi if (singleDevice) { error = QBluetoothServiceDiscoveryAgent::PoweredOffError; errorString = QCoreApplication::translate(SERVICE_DISCOVERY, SD_LOCAL_DEV_OFF); - emit q_ptr->error(error); + emit q_ptr->errorOccurred(error); } return _q_serviceDiscoveryFinished(); @@ -183,7 +183,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::SDPInquiryError(void *device, IORet if (singleDevice) { error = QBluetoothServiceDiscoveryAgent::UnknownError; errorString = QCoreApplication::translate(DEV_DISCOVERY, DD_UNKNOWN_ERROR); - emit q_ptr->error(error); + emit q_ptr->errorOccurred(error); } _q_serviceDiscoveryFinished(); @@ -201,7 +201,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::performMinimalServiceDiscovery(cons if (singleDevice) { error = QBluetoothServiceDiscoveryAgent::UnknownError; errorString = QCoreApplication::translate(SERVICE_DISCOVERY, SD_MINIMAL_FAILED); - emit q_ptr->error(error); + emit q_ptr->errorOccurred(error); } } else { diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_win.cpp b/src/bluetooth/qbluetoothservicediscoveryagent_win.cpp index 51b281bb..c8bc1525 100644 --- a/src/bluetooth/qbluetoothservicediscoveryagent_win.cpp +++ b/src/bluetooth/qbluetoothservicediscoveryagent_win.cpp @@ -405,7 +405,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::_q_nextSdpScan(const QVariant &inpu : QBluetoothServiceDiscoveryAgent::InputOutputError; errorString = qt_error_string(result.systemError); qCWarning(QT_BT_WINDOWS) << errorString; - emit q->error(this->error); + emit q->errorOccurred(this->error); } else { if (serviceMatches(result.info)) { diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_winrt.cpp b/src/bluetooth/qbluetoothservicediscoveryagent_winrt.cpp index a62058cd..d7564205 100644 --- a/src/bluetooth/qbluetoothservicediscoveryagent_winrt.cpp +++ b/src/bluetooth/qbluetoothservicediscoveryagent_winrt.cpp @@ -599,7 +599,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::onError() discoveredDevices.clear(); error = QBluetoothServiceDiscoveryAgent::InputOutputError; errorString = "errorDescription"; - emit q->error(error); + emit q->errorOccurred(error); } QT_END_NAMESPACE diff --git a/src/bluetooth/qbluetoothsocket.cpp b/src/bluetooth/qbluetoothsocket.cpp index 6a59da39..7d5e851b 100644 --- a/src/bluetooth/qbluetoothsocket.cpp +++ b/src/bluetooth/qbluetoothsocket.cpp @@ -147,11 +147,12 @@ Q_DECLARE_LOGGING_CATEGORY(QT_BT) */ /*! - \fn void QBluetoothSocket::error(QBluetoothSocket::SocketError error) + \fn void QBluetoothSocket::errorOccurred(QBluetoothSocket::SocketError error) This signal is emitted when an \a error occurs. \sa error() + \since 6.2 */ /*! @@ -603,7 +604,7 @@ void QBluetoothSocket::setSocketError(QBluetoothSocket::SocketError error_) { Q_D(QBluetoothSocketBase); d->socketError = error_; - emit error(error_); + emit errorOccurred(error_); } /*! diff --git a/src/bluetooth/qbluetoothsocket.h b/src/bluetooth/qbluetoothsocket.h index 3b485b6a..2b78b3f1 100644 --- a/src/bluetooth/qbluetoothsocket.h +++ b/src/bluetooth/qbluetoothsocket.h @@ -155,7 +155,7 @@ public: Q_SIGNALS: void connected(); void disconnected(); - void error(QBluetoothSocket::SocketError error); + void errorOccurred(QBluetoothSocket::SocketError error); void stateChanged(QBluetoothSocket::SocketState state); protected: diff --git a/src/bluetooth/qbluetoothsocket_android.cpp b/src/bluetooth/qbluetoothsocket_android.cpp index 8e61cbcf..a7a30bfe 100644 --- a/src/bluetooth/qbluetoothsocket_android.cpp +++ b/src/bluetooth/qbluetoothsocket_android.cpp @@ -606,8 +606,8 @@ void QBluetoothSocketPrivateAndroid::socketConnectSuccess(const QAndroidJniObjec inputThread = new InputStreamThread(this); QObject::connect(inputThread, SIGNAL(dataAvailable()), q, SIGNAL(readyRead()), Qt::QueuedConnection); - QObject::connect(inputThread, SIGNAL(error(int)), - this, SLOT(inputThreadError(int)), Qt::QueuedConnection); + QObject::connect(inputThread, SIGNAL(errorOccurred(int)), this, SLOT(inputThreadError(int)), + Qt::QueuedConnection); if (!inputThread->run()) { //close socket again @@ -912,8 +912,8 @@ bool QBluetoothSocketPrivateAndroid::setSocketDescriptor(const QAndroidJniObject inputThread = new InputStreamThread(this); QObject::connect(inputThread, SIGNAL(dataAvailable()), q, SIGNAL(readyRead()), Qt::QueuedConnection); - QObject::connect(inputThread, SIGNAL(error(int)), - this, SLOT(inputThreadError(int)), Qt::QueuedConnection); + QObject::connect(inputThread, SIGNAL(errorOccurred(int)), this, SLOT(inputThreadError(int)), + Qt::QueuedConnection); inputThread->run(); // WorkerThread manages all sockets for us diff --git a/src/bluetooth/qlowenergycontroller.cpp b/src/bluetooth/qlowenergycontroller.cpp index 321fe300..5310590a 100644 --- a/src/bluetooth/qlowenergycontroller.cpp +++ b/src/bluetooth/qlowenergycontroller.cpp @@ -247,12 +247,13 @@ Q_DECLARE_LOGGING_CATEGORY(QT_BT_WINRT) */ /*! - \fn void QLowEnergyController::error(QLowEnergyController::Error newError) + \fn void QLowEnergyController::errorOccurred(QLowEnergyController::Error newError) This signal is emitted when an error occurs. The \a newError parameter describes the error that occurred. \sa error(), errorString() + \since 6.2 */ /*! diff --git a/src/bluetooth/qlowenergycontroller.h b/src/bluetooth/qlowenergycontroller.h index 82911e01..dad1aafa 100644 --- a/src/bluetooth/qlowenergycontroller.h +++ b/src/bluetooth/qlowenergycontroller.h @@ -139,7 +139,7 @@ Q_SIGNALS: void connected(); void disconnected(); void stateChanged(QLowEnergyController::ControllerState state); - void error(QLowEnergyController::Error newError); + void errorOccurred(QLowEnergyController::Error newError); void serviceDiscovered(const QBluetoothUuid &newService); void discoveryFinished(); diff --git a/src/bluetooth/qlowenergycontroller_android.cpp b/src/bluetooth/qlowenergycontroller_android.cpp index e0a59ddd..db4bad26 100644 --- a/src/bluetooth/qlowenergycontroller_android.cpp +++ b/src/bluetooth/qlowenergycontroller_android.cpp @@ -881,7 +881,7 @@ void QLowEnergyControllerPrivateAndroid::advertisementError(int errorCode) } error = QLowEnergyController::AdvertisingError; - emit q->error(error); + emit q->errorOccurred(error); // not relevant states in peripheral mode Q_ASSERT(state != QLowEnergyController::DiscoveredState); diff --git a/src/bluetooth/qlowenergycontroller_bluez.cpp b/src/bluetooth/qlowenergycontroller_bluez.cpp index cd271c74..72150702 100644 --- a/src/bluetooth/qlowenergycontroller_bluez.cpp +++ b/src/bluetooth/qlowenergycontroller_bluez.cpp @@ -605,8 +605,8 @@ void QLowEnergyControllerPrivateBluez::establishL2cpClientSocket() l2cpSocket = new QBluetoothSocket(QBluetoothServiceInfo::L2capProtocol, this); connect(l2cpSocket, SIGNAL(connected()), this, SLOT(l2cpConnected())); connect(l2cpSocket, SIGNAL(disconnected()), this, SLOT(l2cpDisconnected())); - connect(l2cpSocket, SIGNAL(error(QBluetoothSocket::SocketError)), - this, SLOT(l2cpErrorChanged(QBluetoothSocket::SocketError))); + connect(l2cpSocket, SIGNAL(errorOccurred(QBluetoothSocket::SocketError)), this, + SLOT(l2cpErrorChanged(QBluetoothSocket::SocketError))); connect(l2cpSocket, SIGNAL(readyRead()), this, SLOT(l2cpReadyRead())); quint32 addressTypeToUse = (addressType == QLowEnergyController::PublicAddress) @@ -3132,8 +3132,8 @@ void QLowEnergyControllerPrivateBluez::handleConnectionRequest() rawSocketPrivate, QBluetoothServiceInfo::L2capProtocol, this); connect(l2cpSocket, &QBluetoothSocket::disconnected, this, &QLowEnergyControllerPrivateBluez::l2cpDisconnected); - connect(l2cpSocket, static_cast<void (QBluetoothSocket::*)(QBluetoothSocket::SocketError)> - (&QBluetoothSocket::error), this, &QLowEnergyControllerPrivateBluez::l2cpErrorChanged); + connect(l2cpSocket, &QBluetoothSocket::errorOccurred, this, + &QLowEnergyControllerPrivateBluez::l2cpErrorChanged); connect(l2cpSocket, &QIODevice::readyRead, this, &QLowEnergyControllerPrivateBluez::l2cpReadyRead); l2cpSocket->d_ptr->lowEnergySocketType = addressType == QLowEnergyController::PublicAddress ? BDADDR_LE_PUBLIC : BDADDR_LE_RANDOM; diff --git a/src/bluetooth/qlowenergycontrollerbase.cpp b/src/bluetooth/qlowenergycontrollerbase.cpp index d151f871..dbca072d 100644 --- a/src/bluetooth/qlowenergycontrollerbase.cpp +++ b/src/bluetooth/qlowenergycontrollerbase.cpp @@ -117,7 +117,7 @@ void QLowEnergyControllerPrivate::setError( break; } - emit q->error(newError); + emit q->errorOccurred(newError); } void QLowEnergyControllerPrivate::setState( diff --git a/src/bluetooth/qlowenergyservice.cpp b/src/bluetooth/qlowenergyservice.cpp index 54fe8255..75eeca1e 100644 --- a/src/bluetooth/qlowenergyservice.cpp +++ b/src/bluetooth/qlowenergyservice.cpp @@ -284,10 +284,12 @@ QT_BEGIN_NAMESPACE */ /*! - \fn void QLowEnergyService::error(QLowEnergyService::ServiceError newError) + \fn void QLowEnergyService::errorOccurred(QLowEnergyService::ServiceError newError) This signal is emitted when an error occurrs. The \a newError parameter describes the error that occurred. + + \since 6.2 */ /*! @@ -385,8 +387,8 @@ QLowEnergyService::QLowEnergyService(QSharedPointer<QLowEnergyServicePrivate> p, qRegisterMetaType<QLowEnergyService::ServiceType>(); qRegisterMetaType<QLowEnergyService::WriteMode>(); - connect(p.data(), &QLowEnergyServicePrivate::error, - this, QOverload<QLowEnergyService::ServiceError>::of(&QLowEnergyService::error)); + connect(p.data(), &QLowEnergyServicePrivate::errorOccurred, this, + &QLowEnergyService::errorOccurred); connect(p.data(), &QLowEnergyServicePrivate::stateChanged, this, &QLowEnergyService::stateChanged); connect(p.data(), &QLowEnergyServicePrivate::characteristicChanged, diff --git a/src/bluetooth/qlowenergyservice.h b/src/bluetooth/qlowenergyservice.h index b41bb200..b7e69dca 100644 --- a/src/bluetooth/qlowenergyservice.h +++ b/src/bluetooth/qlowenergyservice.h @@ -124,7 +124,7 @@ Q_SIGNALS: const QByteArray &value); void descriptorWritten(const QLowEnergyDescriptor &info, const QByteArray &value); - void error(QLowEnergyService::ServiceError error); + void errorOccurred(QLowEnergyService::ServiceError error); private: Q_DECLARE_PRIVATE(QLowEnergyService) diff --git a/src/bluetooth/qlowenergyserviceprivate.cpp b/src/bluetooth/qlowenergyserviceprivate.cpp index 0b8d8be0..89f95f62 100644 --- a/src/bluetooth/qlowenergyserviceprivate.cpp +++ b/src/bluetooth/qlowenergyserviceprivate.cpp @@ -70,7 +70,7 @@ void QLowEnergyServicePrivate::setController(QLowEnergyControllerPrivate *contro void QLowEnergyServicePrivate::setError(QLowEnergyService::ServiceError newError) { lastError = newError; - emit error(newError); + emit errorOccurred(newError); } void QLowEnergyServicePrivate::setState(QLowEnergyService::ServiceState newState) diff --git a/src/bluetooth/qlowenergyserviceprivate_p.h b/src/bluetooth/qlowenergyserviceprivate_p.h index 226af145..691d71dc 100644 --- a/src/bluetooth/qlowenergyserviceprivate_p.h +++ b/src/bluetooth/qlowenergyserviceprivate_p.h @@ -104,7 +104,7 @@ public: signals: void stateChanged(QLowEnergyService::ServiceState newState); - void error(QLowEnergyService::ServiceError error); + void errorOccurred(QLowEnergyService::ServiceError error); void characteristicChanged(const QLowEnergyCharacteristic &characteristic, const QByteArray &newValue); void characteristicRead(const QLowEnergyCharacteristic &info, diff --git a/tests/auto/qbluetoothdevicediscoveryagent/tst_qbluetoothdevicediscoveryagent.cpp b/tests/auto/qbluetoothdevicediscoveryagent/tst_qbluetoothdevicediscoveryagent.cpp index 2a8dd8e4..3e8a1036 100644 --- a/tests/auto/qbluetoothdevicediscoveryagent/tst_qbluetoothdevicediscoveryagent.cpp +++ b/tests/auto/qbluetoothdevicediscoveryagent/tst_qbluetoothdevicediscoveryagent.cpp @@ -204,7 +204,8 @@ void tst_QBluetoothDeviceDiscoveryAgent::tst_startStopDeviceDiscoveries() QSignalSpy finishedSpy(&discoveryAgent, SIGNAL(finished())); QSignalSpy cancelSpy(&discoveryAgent, SIGNAL(canceled())); - QSignalSpy errorSpy(&discoveryAgent, SIGNAL(error(QBluetoothDeviceDiscoveryAgent::Error))); + QSignalSpy errorSpy(&discoveryAgent, + SIGNAL(errorOccurred(QBluetoothDeviceDiscoveryAgent::Error))); // Starting case 1: start-stop, expecting cancel signal // we should have no errors at this point. @@ -372,7 +373,8 @@ void tst_QBluetoothDeviceDiscoveryAgent::tst_deviceDiscovery() QVERIFY(discoveryAgent.discoveredDevices().isEmpty()); QSignalSpy finishedSpy(&discoveryAgent, SIGNAL(finished())); - QSignalSpy errorSpy(&discoveryAgent, SIGNAL(error(QBluetoothDeviceDiscoveryAgent::Error))); + QSignalSpy errorSpy(&discoveryAgent, + SIGNAL(errorOccurred(QBluetoothDeviceDiscoveryAgent::Error))); QSignalSpy discoveredSpy(&discoveryAgent, SIGNAL(deviceDiscovered(QBluetoothDeviceInfo))); // connect(&discoveryAgent, SIGNAL(finished()), this, SLOT(finished())); // connect(&discoveryAgent, SIGNAL(deviceDiscovered(QBluetoothDeviceInfo)), @@ -494,7 +496,7 @@ void tst_QBluetoothDeviceDiscoveryAgent::tst_discoveryMethods() QBluetoothDeviceDiscoveryAgent agent; QSignalSpy finishedSpy(&agent, SIGNAL(finished())); - QSignalSpy errorSpy(&agent, SIGNAL(error(QBluetoothDeviceDiscoveryAgent::Error))); + QSignalSpy errorSpy(&agent, SIGNAL(errorOccurred(QBluetoothDeviceDiscoveryAgent::Error))); QSignalSpy discoveredSpy(&agent, SIGNAL(deviceDiscovered(QBluetoothDeviceInfo))); // NoMethod - should just immediately return: diff --git a/tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp b/tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp index 9e7d81f2..2706f89a 100644 --- a/tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp +++ b/tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp @@ -375,7 +375,7 @@ void tst_QBluetoothLocalDevice::tst_pairDevice() QVERIFY(localDevice.hostMode() != QBluetoothLocalDevice::HostPoweredOff); QSignalSpy pairingSpy(&localDevice, SIGNAL(pairingFinished(QBluetoothAddress,QBluetoothLocalDevice::Pairing)) ); - QSignalSpy errorSpy(&localDevice, SIGNAL(error(QBluetoothLocalDevice::Error))); + QSignalSpy errorSpy(&localDevice, SIGNAL(errorOccurred(QBluetoothLocalDevice::Error))); // there should be no signals yet QVERIFY(pairingSpy.isValid()); QVERIFY(pairingSpy.isEmpty()); diff --git a/tests/auto/qbluetoothserver/tst_qbluetoothserver.cpp b/tests/auto/qbluetoothserver/tst_qbluetoothserver.cpp index 4564cf4d..5444de6e 100644 --- a/tests/auto/qbluetoothserver/tst_qbluetoothserver.cpp +++ b/tests/auto/qbluetoothserver/tst_qbluetoothserver.cpp @@ -197,7 +197,7 @@ void tst_QBluetoothServer::tst_receive() } } QBluetoothServer server(QBluetoothServiceInfo::RfcommProtocol); - QSignalSpy errorSpy(&server, SIGNAL(error(QBluetoothServer::Error))); + QSignalSpy errorSpy(&server, SIGNAL(errorOccurred(QBluetoothServer::Error))); bool result = server.listen(address, 20); // port == 20 QTest::qWait(1000); diff --git a/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp b/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp index 913a810e..0ede6d76 100644 --- a/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp +++ b/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp @@ -118,7 +118,8 @@ void tst_QBluetoothServiceDiscoveryAgent::initTestCase() QBluetoothDeviceDiscoveryAgent discoveryAgent; QSignalSpy finishedSpy(&discoveryAgent, SIGNAL(finished())); - QSignalSpy errorSpy(&discoveryAgent, SIGNAL(error(QBluetoothDeviceDiscoveryAgent::Error))); + QSignalSpy errorSpy(&discoveryAgent, + SIGNAL(errorOccurred(QBluetoothDeviceDiscoveryAgent::Error))); QSignalSpy discoveredSpy(&discoveryAgent, SIGNAL(deviceDiscovered(QBluetoothDeviceInfo))); // connect(&discoveryAgent, SIGNAL(deviceDiscovered(QBluetoothDeviceInfo)), // this, SLOT(deviceDiscoveryDebug(QBluetoothDeviceInfo))); @@ -377,12 +378,13 @@ void tst_QBluetoothServiceDiscoveryAgent::tst_serviceDiscovery() QVERIFY(discoveryAgent.uuidFilter() == uuidFilter); QSignalSpy finishedSpy(&discoveryAgent, SIGNAL(finished())); - QSignalSpy errorSpy(&discoveryAgent, SIGNAL(error(QBluetoothServiceDiscoveryAgent::Error))); + QSignalSpy errorSpy(&discoveryAgent, + SIGNAL(errorOccurred(QBluetoothServiceDiscoveryAgent::Error))); QSignalSpy discoveredSpy(&discoveryAgent, SIGNAL(serviceDiscovered(QBluetoothServiceInfo))); // connect(&discoveryAgent, SIGNAL(serviceDiscovered(QBluetoothServiceInfo)), // this, SLOT(serviceDiscoveryDebug(QBluetoothServiceInfo))); - connect(&discoveryAgent, SIGNAL(error(QBluetoothServiceDiscoveryAgent::Error)), - this, SLOT(serviceError(QBluetoothServiceDiscoveryAgent::Error))); + connect(&discoveryAgent, SIGNAL(errorOccurred(QBluetoothServiceDiscoveryAgent::Error)), this, + SLOT(serviceError(QBluetoothServiceDiscoveryAgent::Error))); discoveryAgent.start(QBluetoothServiceDiscoveryAgent::FullDiscovery); diff --git a/tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp b/tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp index dbd4782d..c0124d6c 100644 --- a/tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp +++ b/tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp @@ -136,7 +136,8 @@ void tst_QBluetoothSocket::initTestCase() // Go find the server QBluetoothServiceDiscoveryAgent *sda = new QBluetoothServiceDiscoveryAgent(this); connect(sda, SIGNAL(serviceDiscovered(QBluetoothServiceInfo)), this, SLOT(serviceDiscovered(QBluetoothServiceInfo))); - connect(sda, SIGNAL(error(QBluetoothServiceDiscoveryAgent::Error)), this, SLOT(error(QBluetoothServiceDiscoveryAgent::Error))); + connect(sda, SIGNAL(errorOccurred(QBluetoothServiceDiscoveryAgent::Error)), this, + SLOT(error(QBluetoothServiceDiscoveryAgent::Error))); connect(sda, SIGNAL(finished()), this, SLOT(finished())); qDebug() << "Starting discovery"; @@ -244,7 +245,7 @@ void tst_QBluetoothSocket::tst_serviceConnection() /* Connection */ QSignalSpy connectedSpy(&socket, SIGNAL(connected())); - QSignalSpy errorSpy(&socket, SIGNAL(error(QBluetoothSocket::SocketError))); + QSignalSpy errorSpy(&socket, SIGNAL(errorOccurred(QBluetoothSocket::SocketError))); QCOMPARE(socket.openMode(), QIODevice::NotOpen); QCOMPARE(socket.isWritable(), false); @@ -489,7 +490,7 @@ void tst_QBluetoothSocket::tst_clientCommunication() void tst_QBluetoothSocket::tst_error() { QBluetoothSocket socket; - QSignalSpy errorSpy(&socket, SIGNAL(error(QBluetoothSocket::SocketError))); + QSignalSpy errorSpy(&socket, SIGNAL(errorOccurred(QBluetoothSocket::SocketError))); QCOMPARE(errorSpy.count(), 0); const QBluetoothSocket::SocketError e = socket.error(); @@ -534,7 +535,7 @@ void tst_QBluetoothSocket::tst_unsupportedProtocolError() QVERIFY(socket.error() == QBluetoothSocket::SocketError::NoSocketError); QVERIFY(socket.errorString() == QString()); - QSignalSpy errorSpy(&socket, SIGNAL(error(QBluetoothSocket::SocketError))); + QSignalSpy errorSpy(&socket, SIGNAL(errorOccurred(QBluetoothSocket::SocketError))); // 1. Stop early with 'UnsupportedProtocolError'. QBluetoothServiceInfo dummyServiceInfo; diff --git a/tests/auto/qlowenergycharacteristic/tst_qlowenergycharacteristic.cpp b/tests/auto/qlowenergycharacteristic/tst_qlowenergycharacteristic.cpp index 4b4fc8df..d4e6b9b5 100644 --- a/tests/auto/qlowenergycharacteristic/tst_qlowenergycharacteristic.cpp +++ b/tests/auto/qlowenergycharacteristic/tst_qlowenergycharacteristic.cpp @@ -101,7 +101,7 @@ void tst_QLowEnergyCharacteristic::initTestCase() connect(devAgent, SIGNAL(deviceDiscovered(QBluetoothDeviceInfo)), this, SLOT(deviceDiscovered(QBluetoothDeviceInfo))); - QSignalSpy errorSpy(devAgent, SIGNAL(error(QBluetoothDeviceDiscoveryAgent::Error))); + QSignalSpy errorSpy(devAgent, SIGNAL(errorOccurred(QBluetoothDeviceDiscoveryAgent::Error))); QVERIFY(errorSpy.isValid()); QVERIFY(errorSpy.isEmpty()); diff --git a/tests/auto/qlowenergycontroller-gattserver/test/tst_qlowenergycontroller-gattserver.cpp b/tests/auto/qlowenergycontroller-gattserver/test/tst_qlowenergycontroller-gattserver.cpp index 692b2c73..437900c5 100644 --- a/tests/auto/qlowenergycontroller-gattserver/test/tst_qlowenergycontroller-gattserver.cpp +++ b/tests/auto/qlowenergycontroller-gattserver/test/tst_qlowenergycontroller-gattserver.cpp @@ -440,13 +440,11 @@ void TestQLowEnergyControllerGattServer::serverCommunication() QCOMPARE(customChar5.value(), QByteArray("initial")); customService->writeCharacteristic(customChar, "whatever"); - spy.reset(new QSignalSpy(customService.data(), static_cast<void (QLowEnergyService::*) - (QLowEnergyService::ServiceError)>(&QLowEnergyService::error))); + spy.reset(new QSignalSpy(customService.data(), &QLowEnergyService::errorOccurred)); QVERIFY(spy->wait(3000)); QCOMPARE(customService->error(), QLowEnergyService::CharacteristicWriteError); - spy.reset(new QSignalSpy(customService.data(), static_cast<void (QLowEnergyService::*) - (QLowEnergyService::ServiceError)>(&QLowEnergyService::error))); + spy.reset(new QSignalSpy(customService.data(), &QLowEnergyService::errorOccurred)); customService->writeCharacteristic(customChar5, "1", QLowEnergyService::WriteSigned); // error might happen immediately or once event loop comes back diff --git a/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp b/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp index 14f7b026..3b1345a4 100644 --- a/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp +++ b/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp @@ -223,7 +223,7 @@ void tst_QLowEnergyController::tst_emptyCtor() QScopedPointer<QLowEnergyController> control(QLowEnergyController::createCentral(QBluetoothDeviceInfo())); QSignalSpy connectedSpy(control.data(), SIGNAL(connected())); QSignalSpy stateSpy(control.data(), SIGNAL(stateChanged(QLowEnergyController::ControllerState))); - QSignalSpy errorSpy(control.data(), SIGNAL(error(QLowEnergyController::Error))); + QSignalSpy errorSpy(control.data(), SIGNAL(errorOccurred(QLowEnergyController::Error))); QCOMPARE(control->error(), QLowEnergyController::NoError); control->connectToDevice(); @@ -242,7 +242,7 @@ void tst_QLowEnergyController::tst_emptyCtor() QBluetoothDeviceInfo(), QBluetoothAddress(), this)); QSignalSpy connectedSpy(control.data(), SIGNAL(connected())); QSignalSpy stateSpy(control.data(), SIGNAL(stateChanged(QLowEnergyController::ControllerState))); - QSignalSpy errorSpy(control.data(), SIGNAL(error(QLowEnergyController::Error))); + QSignalSpy errorSpy(control.data(), SIGNAL(errorOccurred(QLowEnergyController::Error))); QCOMPARE(control->error(), QLowEnergyController::NoError); control->connectToDevice(); @@ -368,7 +368,7 @@ void tst_QLowEnergyController::tst_connect() qDebug() << "Discovering" << service->serviceUuid(); QSignalSpy stateSpy(service, SIGNAL(stateChanged(QLowEnergyService::ServiceState))); - QSignalSpy errorSpy(service, SIGNAL(error(QLowEnergyService::ServiceError))); + QSignalSpy errorSpy(service, SIGNAL(errorOccurred(QLowEnergyService::ServiceError))); service->discoverDetails(); QTRY_VERIFY_WITH_TIMEOUT( @@ -1848,7 +1848,7 @@ void tst_QLowEnergyController::tst_writeCharacteristic() // ******************************************* // write wrong value -> error response required - QSignalSpy errorSpy(service, SIGNAL(error(QLowEnergyService::ServiceError))); + QSignalSpy errorSpy(service, SIGNAL(errorOccurred(QLowEnergyService::ServiceError))); writeSpy.clear(); QCOMPARE(errorSpy.count(), 0); QCOMPARE(writeSpy.count(), 0); @@ -2125,7 +2125,7 @@ void tst_QLowEnergyController::tst_readWriteDescriptor() // ******************************************* // write wrong value -> error response required - QSignalSpy errorSpy(service, SIGNAL(error(QLowEnergyService::ServiceError))); + QSignalSpy errorSpy(service, SIGNAL(errorOccurred(QLowEnergyService::ServiceError))); descWrittenSpy.clear(); QCOMPARE(errorSpy.count(), 0); QCOMPARE(descWrittenSpy.count(), 0); @@ -2252,8 +2252,7 @@ void tst_QLowEnergyController::tst_customProgrammableDevice() // encryption already. QSignalSpy encryptedReadSpy(service, SIGNAL(characteristicRead(QLowEnergyCharacteristic,QByteArray))); - QSignalSpy encryptedErrorSpy(service, - SIGNAL(error(QLowEnergyService::ServiceError))); + QSignalSpy encryptedErrorSpy(service, SIGNAL(errorOccurred(QLowEnergyService::ServiceError))); service->readCharacteristic(encryptedChar); QTRY_VERIFY_WITH_TIMEOUT(!encryptedReadSpy.isEmpty(), 10000); QVERIFY(encryptedErrorSpy.isEmpty()); @@ -2294,8 +2293,7 @@ void tst_QLowEnergyController::tst_customProgrammableDevice() // tests readCharacteristic() including blob reads QSignalSpy readSpy(service, SIGNAL(characteristicRead(QLowEnergyCharacteristic,QByteArray))); - QSignalSpy errorSpy(service, - SIGNAL(error(QLowEnergyService::ServiceError))); + QSignalSpy errorSpy(service, SIGNAL(errorOccurred(QLowEnergyService::ServiceError))); const QByteArray expectedSoftRev("Application version 2.3.0.0"); QLowEnergyCharacteristic softwareRevChar = @@ -2412,8 +2410,8 @@ void tst_QLowEnergyController::tst_errorCases() QVERIFY(!irService->contains(invalidChar)); QVERIFY(!irService->contains(invalidDesc)); - QSignalSpy irErrorSpy(irService, SIGNAL(error(QLowEnergyService::ServiceError))); - QSignalSpy oadErrorSpy(oadService, SIGNAL(error(QLowEnergyService::ServiceError))); + QSignalSpy irErrorSpy(irService, SIGNAL(errorOccurred(QLowEnergyService::ServiceError))); + QSignalSpy oadErrorSpy(oadService, SIGNAL(errorOccurred(QLowEnergyService::ServiceError))); QSignalSpy irReadSpy(irService, SIGNAL(characteristicRead(QLowEnergyCharacteristic,QByteArray))); QSignalSpy irWrittenSpy(irService, SIGNAL(characteristicWritten(QLowEnergyCharacteristic,QByteArray))); @@ -2658,8 +2656,7 @@ void tst_QLowEnergyController::tst_writeCharacteristicNoResponse() SIGNAL(characteristicWritten(QLowEnergyCharacteristic,QByteArray))); QSignalSpy charReadSpy(service, SIGNAL(characteristicRead(QLowEnergyCharacteristic,QByteArray))); - QSignalSpy errorSpy(service, - SIGNAL(error(QLowEnergyService::ServiceError))); + QSignalSpy errorSpy(service, SIGNAL(errorOccurred(QLowEnergyService::ServiceError))); //enable notifications on both characteristics if (identityNotification.value() != QByteArray::fromHex("0100")) { diff --git a/tests/auto/qlowenergydescriptor/tst_qlowenergydescriptor.cpp b/tests/auto/qlowenergydescriptor/tst_qlowenergydescriptor.cpp index ebceb0b4..ff7d185f 100644 --- a/tests/auto/qlowenergydescriptor/tst_qlowenergydescriptor.cpp +++ b/tests/auto/qlowenergydescriptor/tst_qlowenergydescriptor.cpp @@ -91,7 +91,7 @@ void tst_QLowEnergyDescriptor::initTestCase() connect(devAgent, SIGNAL(deviceDiscovered(QBluetoothDeviceInfo)), this, SLOT(deviceDiscovered(QBluetoothDeviceInfo))); - QSignalSpy errorSpy(devAgent, SIGNAL(error(QBluetoothDeviceDiscoveryAgent::Error))); + QSignalSpy errorSpy(devAgent, SIGNAL(errorOccurred(QBluetoothDeviceDiscoveryAgent::Error))); QVERIFY(errorSpy.isValid()); QVERIFY(errorSpy.isEmpty()); diff --git a/tests/bttestui/btlocaldevice.cpp b/tests/bttestui/btlocaldevice.cpp index 25a442c3..dc90b7c0 100644 --- a/tests/bttestui/btlocaldevice.cpp +++ b/tests/bttestui/btlocaldevice.cpp @@ -49,8 +49,8 @@ BtLocalDevice::BtLocalDevice(QObject *parent) : QObject(parent), securityFlags(QBluetooth::NoSecurity) { localDevice = new QBluetoothLocalDevice(this); - connect(localDevice, &QBluetoothLocalDevice::error, - this, &BtLocalDevice::error); + connect(localDevice, &QBluetoothLocalDevice::errorOccurred, this, + &BtLocalDevice::errorOccurred); connect(localDevice, &QBluetoothLocalDevice::hostModeStateChanged, this, &BtLocalDevice::hostModeStateChanged); connect(localDevice, &QBluetoothLocalDevice::pairingFinished, @@ -66,8 +66,8 @@ BtLocalDevice::BtLocalDevice(QObject *parent) : this, &BtLocalDevice::deviceDiscovered); connect(deviceAgent, &QBluetoothDeviceDiscoveryAgent::finished, this, &BtLocalDevice::discoveryFinished); - connect(deviceAgent, QOverload<QBluetoothDeviceDiscoveryAgent::Error>::of(&QBluetoothDeviceDiscoveryAgent::error), - this, &BtLocalDevice::discoveryError); + connect(deviceAgent, &QBluetoothDeviceDiscoveryAgent::errorOccurred, this, + &BtLocalDevice::discoveryError); connect(deviceAgent, &QBluetoothDeviceDiscoveryAgent::canceled, this, &BtLocalDevice::discoveryCanceled); @@ -78,14 +78,13 @@ BtLocalDevice::BtLocalDevice(QObject *parent) : this, &BtLocalDevice::serviceDiscoveryFinished); connect(serviceAgent, &QBluetoothServiceDiscoveryAgent::canceled, this, &BtLocalDevice::serviceDiscoveryCanceled); - connect(serviceAgent, QOverload<QBluetoothServiceDiscoveryAgent::Error>::of(&QBluetoothServiceDiscoveryAgent::error), - this, &BtLocalDevice::serviceDiscoveryError); + connect(serviceAgent, &QBluetoothServiceDiscoveryAgent::errorOccurred, this, + &BtLocalDevice::serviceDiscoveryError); socket = new QBluetoothSocket(SOCKET_PROTOCOL, this); connect(socket, &QBluetoothSocket::stateChanged, this, &BtLocalDevice::socketStateChanged); - connect(socket, QOverload<QBluetoothSocket::SocketError>::of(&QBluetoothSocket::error), - this, &BtLocalDevice::socketError); + connect(socket, &QBluetoothSocket::errorOccurred, this, &BtLocalDevice::socketError); connect(socket, &QBluetoothSocket::connected, this, &BtLocalDevice::socketConnected); connect(socket, &QBluetoothSocket::disconnected, this, &BtLocalDevice::socketDisconnected); connect(socket, &QIODevice::readyRead, this, &BtLocalDevice::readData); @@ -96,8 +95,7 @@ BtLocalDevice::BtLocalDevice(QObject *parent) : server = new QBluetoothServer(SOCKET_PROTOCOL, this); connect(server, &QBluetoothServer::newConnection, this, &BtLocalDevice::serverNewConnection); - connect(server, QOverload<QBluetoothServer::Error>::of(&QBluetoothServer::error), - this, &BtLocalDevice::serverError); + connect(server, &QBluetoothServer::errorOccurred, this, &BtLocalDevice::serverError); } else { deviceAgent = nullptr; serviceAgent = nullptr; @@ -659,8 +657,7 @@ void BtLocalDevice::serverNewConnection() connect(client, &QIODevice::readyRead, this, &BtLocalDevice::clientSocketReadyRead); connect(client, &QBluetoothSocket::stateChanged, this, &BtLocalDevice::socketStateChanged); - connect(client, QOverload<QBluetoothSocket::SocketError>::of(&QBluetoothSocket::error), - this, &BtLocalDevice::socketError); + connect(client, &QBluetoothSocket::errorOccurred, this, &BtLocalDevice::socketError); connect(client, &QBluetoothSocket::connected, this, &BtLocalDevice::socketConnected); connect(client, &QBluetoothSocket::bytesWritten, this, [](qint64 bytesWritten){ qDebug() << "Bytes Written to Server socket:" << bytesWritten; @@ -813,7 +810,7 @@ void BtLocalDevice::powerOn() void BtLocalDevice::reset() { - emit error(static_cast<QBluetoothLocalDevice::Error>(1000)); + emit errorOccurred(static_cast<QBluetoothLocalDevice::Error>(1000)); if (serviceAgent) { serviceAgent->clear(); } diff --git a/tests/bttestui/btlocaldevice.h b/tests/bttestui/btlocaldevice.h index d62229ba..ebd29c6d 100644 --- a/tests/bttestui/btlocaldevice.h +++ b/tests/bttestui/btlocaldevice.h @@ -51,7 +51,7 @@ public: QString hostMode() const; signals: - void error(QBluetoothLocalDevice::Error error); + void errorOccurred(QBluetoothLocalDevice::Error error); void hostModeStateChanged(); void socketStateUpdate(int foobar); void secFlagsChanged(); |